diff --git a/.gitattributes b/.gitattributes index bed0738c7eeb449bca98b5d2f33c89a1ee56349a..08ade63dc0048fba77b87a49dcaf49972ff5193a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -58,3 +58,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text # Video files - compressed *.mp4 filter=lfs diff=lfs merge=lfs -text *.webm filter=lfs diff=lfs merge=lfs -text +dataset_full.jsonl filter=lfs diff=lfs merge=lfs -text +dataset_permissive.jsonl filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index 9a8284570beb1aa6d2076b1245bbe323e1dcf101..e82e98f04036ebfca4c39715fb1b5e8533c1db3a 100644 --- a/README.md +++ b/README.md @@ -1,91 +1,31 @@ ---- -language: -- en -- code -license: other -task_categories: -- text2text-generation -- text-generation -tags: -- opengl -- glsl -- webgl -- shaders -- computer-graphics -- 3d -- vulkan -- code-generation -size_categories: -- 1K\n\n#include \"gl_helpers.h\"\n\n#include \n#pragma comment(lib, \"gdiplus.lib\")\n#include \n#include \n\nTexture loadImage(const wchar_t* path) {\n\tusing namespace Gdiplus;\n\tULONG_PTR token;\n\tGdiplusStartupInput startupInput;\n\tGdiplusStartup(&token, &startupInput, nullptr);\n\n\tTexture result;\n\t// new scope so RAII objects are released before gdi+ shutdown\n\t{\n\t\tImage image(path);\n\t\timage.RotateFlip(RotateNoneFlipY);\n\t\tconst Rect r(0, 0, image.GetWidth(), image.GetHeight());\n\t\tBitmapData data;\n\t\t((Bitmap*)&image)->LockBits(&r, ImageLockModeRead, PixelFormat32bppARGB, &data);\n\n\t\tglBindTexture(GL_TEXTURE_2D, result);\n\t\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.GetWidth(), image.GetHeight(), 0, GL_BGRA, GL_UNSIGNED_BYTE, data.Scan0);\n\t\tglGenerateMipmap(GL_TEXTURE_2D);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\t\t((Bitmap*)&image)->UnlockBits(&data);\n\t}\n\tGdiplusShutdown(token);\n\treturn result;\n}\n\nTexture loadImage(const char* path) {\n\twchar_t str[1024];\n\tMultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, path, -1, str, 1024);\n\treturn loadImage(str);\n}\n#else\n\n#include \n#include \n#include \n#include \n#include \n#include \"gl_helpers.h\"\n\nTexture loadImage(const wchar_t* path) {}\nTexture loadImage(const char* path) {\n unsigned char header[8];\n\n FILE* fp = fopen(path, \"rb\");\n fread(header, 1, 8, fp);\n assert(!png_sig_cmp(header, 0, 8));\n\n png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);\n\n png_infop info = png_create_info_struct(png);\n\n setjmp(png_jmpbuf(png));\n \n\tpng_init_io(png, fp);\n png_set_sig_bytes(png, 8);\n\n png_read_info(png, info);\n\n int width = png_get_image_width(png, info);\n int height = png_get_image_height(png, info);\n png_byte color_type = png_get_color_type(png, info);\n png_byte bit_depth = png_get_bit_depth(png, info);\n\tassert(bit_depth == 8); // let's just support this\n\n int number_of_passes = png_set_interlace_handling(png);\n png_read_update_info(png, info);\n\n\n\tsetjmp(png_jmpbuf(png));\n\n png_bytep* row_pointers = (png_bytep*)malloc(sizeof(png_bytep) * height);\n\tsize_t stride = png_get_rowbytes(png, info);\n for (int i = 0; i < height; i++)\n row_pointers[i] = (png_byte*)malloc(stride);\n\n png_read_image(png, row_pointers);\n\n\tunsigned char* contiguous = (unsigned char*)malloc(stride * height);\n\n\tfor (int i = 0; i < height; i++)\n\t\tmemcpy(contiguous + stride * (height-1-i), row_pointers[i], stride);\n\n\tGLenum format = GL_INVALID_ENUM, order;\n\tif (PNG_COLOR_TYPE_GRAY == color_type) { format = GL_R8; order = GL_RED; }\n\tif (PNG_COLOR_TYPE_RGB == color_type) { format = GL_RGB8; order = GL_RGB; }\n\tif (PNG_COLOR_TYPE_RGB_ALPHA == color_type) { format = GL_RGBA8; order = GL_RGBA; }\n\tassert(format != GL_INVALID_ENUM);\n\n\tTexture result;\n\tglBindTexture(GL_TEXTURE_2D, result);\n\tglTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, order, GL_UNSIGNED_BYTE, contiguous);\n\tglGenerateMipmap(GL_TEXTURE_2D);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\tfree(row_pointers);\n fclose(fp);\n\n\treturn result;\n}\n#endif\n\n"}, {"path": "impl/gl_helpers.h", "language": "c", "loc": 134, "comment_density": 0.007, "code": "#pragma once\n\n#define GL_GLEXT_LEGACY\n#include \n#undef GL_VERSION_1_3\n#include \"glext.h\"\n\n#include \"loadgl46.h\"\n\n#include \n// RAII lifetime handlers for GLuint-based buffers and textures; in principle, very close to unique pointers (with GLuint playing the role of a raw pointer).\n\nstruct Buffer {\npublic:\n\tvoid destroy() { if (object != 0 && owning) { glDeleteBuffers(1, &object); object = 0; } }\n\tBuffer() : owning(true) { glCreateBuffers(1, &object); }\n\tBuffer(size_t size, void* data = nullptr, bool immutable = false, GLenum usage_or_flags = GL_STATIC_DRAW) : owning(true) {\n\t\tglCreateBuffers(1, &object);\n\t\tif(immutable)\n\t\t\tglNamedBufferStorage(object, size, data, usage_or_flags);\n\t\telse\n\t\t\tglNamedBufferData(object, size, data, usage_or_flags);\n\t}\n\ttemplate\n\tBuffer(const std::vector& v, bool immutable = false, GLenum usage_or_flags = GL_STATIC_DRAW) : owning(true) {\n\t\tglCreateBuffers(1, &object);\n\t\tif(immutable)\n\t\t\tglNamedBufferStorage(object, v.size()*sizeof(T), v.data(), usage_or_flags);\n\t\telse\n\t\t\tglNamedBufferData(object, v.size()*sizeof(T), v.data(), usage_or_flags);\n\t}\n\ttemplate\n\toperator std::vector() const {\n\t\tGLint64 size;\n\t\tglGetNamedBufferParameteri64v(object, GL_BUFFER_SIZE, &size);\n\t\tif (size % sizeof(T)) printf(\"warning: buffer and vector types don't align\");\n\t\tstd::vector result(size/sizeof(T));\n\t\tglGetNamedBufferSubData(object, 0, result.size()*sizeof(T), result.data());\n\t\treturn result;\n\t}\n\t~Buffer() { destroy(); }\n\tBuffer(const Buffer& other) : object(other.object), owning(false) { }\n\tBuffer(GLuint object, bool owning = false) : object(object), owning(owning) { }\n\tBuffer(Buffer&& other) : object(other.object), owning(other.owning) { other.owning = false; }\n\tauto& operator=(const Buffer& other) { object = other.object; owning = false; return *this; }\n\tauto& operator=(Buffer&& other) { object = other.object; owning = other.owning; other.owning = false; return *this; }\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\nprivate:\n\tGLuint object = 0; bool owning;\n};\n\ntemplate struct Texture;\n\ntemplate<>\nstruct Texture {\npublic:\n\tvoid destroy() {\n\t\tif (handle != 0) glMakeTextureHandleNonResident(handle);\n\t\tif (object && owning) { glDeleteTextures(1, &object); object = 0; }\n\t}\n\tTexture() : object(0), target(GL_INVALID_INDEX) {}\n\tTexture(GLuint target, bool owning = false) : target(target), owning(owning) { glCreateTextures(target, 1, &object); }\n\t~Texture() { if (object != 0 && owning) destroy(); }\n\ttemplate\n\tTexture(const Texture& other) : object(other.object), level(other.level), layer(other.layer), target(other.target), owning(false) { }\n\tTexture(GLuint object, GLuint target, bool owning = false) : object(object), target(target), owning(owning) { }\n\ttemplate\n\tTexture(Texture&& other) : object(other.object), level(other.level), layer(other.layer), target(other.target), owning(other.owning) { other.owning = false; }\n\ttemplate\n\tauto& operator=(const Texture& other) {\n\t\tdestroy();\n\t\tobject = other.object; level = other.level; layer = other.layer; target = other.target;\n\t\towning = false;\n\t\treturn *this;\n\t}\n\ttemplate\n\tauto& operator=(Texture&& other) {\n\t\tdestroy();\n\t\tobject = other.object; level = other.level; layer = other.layer; target = other.target;\n\t\towning = other.owning;\n\t\tother.owning = false;\n\t\treturn *this;\n\t}\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\n\tGLuint level = 0, layer = GL_INVALID_INDEX, target;\n\tGLuint64 getBindless() {\n\t\tif (handle == 0) {\n\t\t\thandle = glGetTextureHandle(object);\n\t\t\tglMakeTextureHandleResident(handle);\n\t\t}\n\t\treturn handle;\n\t}\nprivate:\n\tGLuint object; bool owning; GLuint64 handle = 0;\n};\n\ntemplate\nstruct Texture {\npublic:\n\tvoid destroy() {\n\t\tif (handle != 0) glMakeTextureHandleNonResident(handle);\n\t\tif (object && owning) { glDeleteTextures(1, &object); object = 0; }\n\t}\n\tTexture() : owning(true) { glCreateTextures(T, 1, &object); }\n\t~Texture() { destroy(); }\n\tTexture(GLuint other, bool owning = false) : object(other), owning(owning) {}\n\tTexture(const Texture& other) : object(other.object), owning(false) { }\n\tTexture(Texture&& other) : object(other.object), owning(other.owning) { other.owning = false; }\n\tTexture& operator=(const Texture& other) { destroy(); object = other.object; owning = false; return *this; }\n\tTexture& operator=(Texture&& other) { destroy(); object = other.object; owning = other.owning; other.owning = false; return *this; }\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\n\tstatic constexpr GLuint level = 0, layer = GL_INVALID_INDEX;\n\tfriend Texture<>;\n\tstatic constexpr GLuint target = T;\n\tGLuint64 getBindless() {\n\t\tif (handle == 0) {\n\t\t\thandle = glGetTextureHandle(object);\n\t\t\tglMakeTextureHandleResident(handle);\n\t\t}\n\t\treturn handle;\n\t}\nprivate:\n\tGLuint object = 0; bool owning; GLuint64 handle = 0;\n};\n\ntemplate\nTexture<> Level(const Texture& t, int level) {\n\tTexture<> result(t);\n\tresult.level = level;\n\treturn result;\n}\n\ntemplate\nTexture<> Layer(const Texture& t, int layer) {\n\tTexture<> result(t);\n\tresult.layer = layer;\n\treturn result;\n}\n\nTexture loadImage(const char* path);\nTexture loadImage(const wchar_t* path);\n"}, {"path": "impl/glsl.h", "language": "c", "loc": 1625, "comment_density": 0.003, "code": "#pragma once\n\nnamespace glsl {\n\n template\n constexpr int maximal(I... i) {\n int max = 0;\n ((max = max < i ? i : max), ...);\n return max;\n }\n\n template struct sequence { using type = sequence; };\n\n template struct append;\n template\n struct append, sequence> :\n sequence {};\n\n template\n struct iota : append::type, typename iota::type> {};\n template<> struct iota<0> : sequence<> {};\n template<> struct iota<1> : sequence<0> {};\n\n template struct Matrix;\n\n template\n auto id_ptr(sequence) {\n if constexpr (R == 1 && C == 1) return (F*) nullptr;\n else return (Matrix*) nullptr;\n }\n\n template struct no_ptr_ { using type = F; };\n template struct no_ptr_ { using type = F; };\n template struct no_ptr_ { using type = const F; };\n template using no_ptr = typename no_ptr_::type;\n\n template\n using identity = no_ptr(iota{})) > ;\n\n template struct no_const_ { using type = F; };\n template struct no_const_ { using type = F; };\n template struct no_const_ { using type = F*; };\n template using no_const = typename no_const_::type;\n\n template constexpr bool is_const = false;\n template constexpr bool is_const = true;\n\n template constexpr int Rows = 1;\n template\n constexpr int Rows> = R;\n\n template constexpr int Columns = 1;\n template\n constexpr int Columns> = C;\n\n template struct Field_ { using type = T; };\n template\n struct Field_> { using type = no_ptr; };\n\n template\n using Field = typename Field_::type;\n\n template\n struct enabler {};\n template<>\n struct enabler { using type = bool; };\n template\n using enable = typename enabler::type;\n\n template\n constexpr bool same = false;\n template\n constexpr bool same = true;\n\n\n template\n constexpr bool broadcastable = ((Rows == maximal(Rows...) && Columns == maximal(Columns...) || Rows == 1 && Columns == 1)&&...);\n template\n constexpr bool matmul_broadcastable = Columns == 1 && Rows == Rows || Columns == Rows || broadcastable;\n\n template\n auto broadcast_type(sequence) {\n constexpr int rows = maximal(Rows...), columns = maximal(Columns...);\n auto sum = (Field{} + ...);\n if constexpr (rows == 1 && columns == 1)\n return sum;\n else\n return Matrix {};\n }\n\n template\n using Iota = iota...)* maximal(Columns...)>;\n template\n using Common = decltype(broadcast_type(Iota{}));\n\n template\n auto matmul_type(sequence) {\n auto sum = Field{} + Field{};\n if constexpr (Columns == 1 && Columns == 1)\n return Matrix, Rows), 1, const decltype(sum), I...> {};\n else if constexpr (Columns == 1)\n return Matrix, 1, const decltype(sum), I...> {};\n else if constexpr (Rows == 1 && Columns == 1) return Second{};\n else if constexpr (Rows == 1 && Columns == 1) return First{};\n else\n return Matrix, Columns, const decltype(sum), I...> {};\n }\n\n template\n constexpr int mult_iota_length() {\n if constexpr (Columns == 1 && Columns == 1) return maximal(Rows, Rows);\n else return ((Columns == 1) ? 1 : Rows) * Columns;\n }\n\n template\n using MultCommon = decltype(matmul_type(iota()>{}));\n\n template\n constexpr int ordering(sequence) {\n return int(((int(I) * (int(1) << int((sizeof...(I) - Id) * 4))) + ... + 0));\n }\n\n template\n struct Container {\n Container() = default;\n no_ptr> data[1 + maximal(I...)];\n };\n\n template\n struct Matrix : Container, I...> {\n\n using Container, I...>::data;\n\n static_assert(sizeof...(I) == R * C);\n //static_assert(R* C > 1);\n\n Matrix() = default;\n\n explicit Matrix(const F& f) {\n if constexpr (C == 1 || is_const) ((data[I] = f), ...);\n else {\n F choice[2] = { F(0), f };\n ((data[I] = choice[I % R == I / R]), ...);\n }\n }\n template 1 && C2 > 1) || (R2==1 && C2==1)> >\n explicit Matrix(const Matrix& other) {\n if constexpr (R2 == 1 && C2 == 1) {\n constexpr int i2[] = { I2... };\n const auto f = F(other.data[i2[0]]);\n if constexpr (C == 1 || is_const) ((data[I] = f), ...);\n else {\n F choice[2] = { F(0), f };\n ((data[I] = choice[I % R == I / R]), ...);\n }\n }\n else if constexpr (R == R2 && C == C2) {\n int i2[] = { I2... };\n ((data[I] = F(other.data[i2[I]])), ...);\n }\n else {\n F choice[2] = { 0, 1 };\n // I%R gives the row and I/R the column\n ((data[I] = (I % R < R2&& I / R < C2) ? F(other.data[((I / R) * R2) + (I % R)]) : choice[I % R == I / R]), ...);\n }\n }\n\n template\n void place(const Matrix& m, int& i) {\n ((data[i++] = F(m.data[I2])), ...);\n }\n template\n void place(const F2& m, int& i) {\n data[i++] = F(m);\n }\n template == 1 && Columns == 1 && ((Columns == 1) && ...) && R * C == ((Rows +Rows) + ... + Rows)>>\n Matrix(const First& first, const Second& second, const Rest&... rest) {\n int i = 0;\n place(first, i); place(second, i); (place(rest, i), ...);\n }\n\n template>>\n operator Matrix() const {\n Matrix result;\n ((result.data[I] = no_ptr(data[I])), ...);\n return result;\n }\n\n template\n auto& operator=(const Matrix other) {\n ((data[I] = F(other.data[I2])), ...);\n return *this;\n }\n auto& operator=(const Matrix& other) {\n ((data[I] = other.data[I]), ...);\n return *this;\n }\n\n static constexpr int inds[] = { I... };\n auto& operator[](int i) {\n if constexpr (C == 1) return data[inds[i]];\n else return *reinterpret_cast*>(data + i * R);\n }\n const auto& operator[](int i) const {\n if constexpr (C == 1) return const_cast(data[inds[i]]);\n else return *reinterpret_cast*const>(data + i * R);\n }\n\n auto& operator+=(const identity& other) {return *this = *this + other;}\n auto& operator-=(const identity& other) {return *this = *this - other;}\n auto& operator/=(const identity& other) {return *this = *this / other;}\n auto& operator+=(const F& other) { return *this = *this + other; }\n auto& operator-=(const F& other) { return *this = *this - other; }\n auto& operator/=(const F& other) { return *this = *this / other; }\n template\n auto& operator*=(const Other& other) { return *this = *this * other; }\n };\n\n template\n struct Matrix {\n\n no_const data[1 + maximal(I...)];\n\n template || same < const decltype(F{} + no_ptr{}), const F > ) && (ordering(iota{}) >= ordering(iota{})) >>\n operator Matrix() const {\n Matrixresult;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n\n template\n auto& operator=(const Matrix other) {\n ((data[I] = F(other.data[I2])), ...);\n return *this;\n }\n auto& operator=(const Matrix& other) {\n ((data[I] = other.data[I]), ...);\n return *this;\n }\n\n auto& operator+=(const identity& other) { return *this = *this + other; }\n auto& operator-=(const identity& other) { return *this = *this - other; }\n auto& operator/=(const identity& other) { return *this = *this / other; }\n auto& operator+=(const F& other) { return *this = *this + other; }\n auto& operator-=(const F& other) { return *this = *this - other; }\n auto& operator/=(const F& other) { return *this = *this / other; }\n template\n auto& operator*=(const Other& other) { return *this = *this * other; }\n };\n\n template\n struct Matrix {\n\n F data[1 + maximal(I...)];\n\n template || same < const decltype(F{} + no_ptr{}), const F > ) && (ordering(iota{}) >= ordering(iota{})) >>\n operator Matrix() const {\n Matrix result;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n template\n operator Matrix, I2...>() const {\n Matrix, I2...> result;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n };\n\n template\n struct Matrix<1, 1, F*, I> {\n\n no_const data[1 + I];\n auto* operator&() {\n return &data[I];\n }\n auto& operator=(const F& other) {\n data[I] = other;\n return *this;\n }\n operator F& () { return data[I]; }\n operator F() const { return data[I]; }\n };\n\n template\n struct Matrix<1, 1, const F*, I> {\n F data[1 + I];\n operator F() const { return data[I]; }\n };\n\n\n template\n struct Container<2, 1, F, 0, 1> {\n Container() = default;\n union {\n no_ptr> data[2];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n };\n };\n\n template\n struct Container<3, 1, F, 0, 1, 2> {\n Container() = default;\n union {\n no_ptr> data[3];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n Matrix<1, 1, no_ptr*, 2> z, b, p;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 0, 2> xz, rb, sp;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n Matrix<2, 1, no_ptr*, 1, 2> yz, gb, tp;\n Matrix<2, 1, no_ptr*, 2, 0> zx, br, ps;\n Matrix<2, 1, no_ptr*, 2, 1> zy, bg, pt;\n Matrix<2, 1, const no_ptr*, 2, 2> zz, bb, pp;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 0, 2> xxz, rrb, ssp;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, no_ptr*, 0, 1, 2> xyz, rgb, stp;\n Matrix<3, 1, const no_ptr*, 0, 2, 0> xzx, rbr, sps;\n Matrix<3, 1, no_ptr*, 0, 2, 1> xzy, rbg, spt;\n Matrix<3, 1, const no_ptr*, 0, 2, 2> xzz, rbb, spp;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, no_ptr*, 1, 0, 2> yxz, grb, tsp;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n Matrix<3, 1, const no_ptr*, 1, 1, 2> yyz, ggb, ttp;\n Matrix<3, 1, no_ptr*, 1, 2, 0> yzx, gbr, tps;\n Matrix<3, 1, const no_ptr*, 1, 2, 1> yzy, gbg, tpt;\n Matrix<3, 1, const no_ptr*, 1, 2, 2> yzz, gbb, tpp;\n Matrix<3, 1, const no_ptr*, 2, 0, 0> zxx, brr, pss;\n Matrix<3, 1, no_ptr*, 2, 0, 1> zxy, brg, pst;\n Matrix<3, 1, const no_ptr*, 2, 0, 2> zxz, brb, psp;\n Matrix<3, 1, no_ptr*, 2, 1, 0> zyx, bgr, pts;\n Matrix<3, 1, const no_ptr*, 2, 1, 1> zyy, bgg, ptt;\n Matrix<3, 1, const no_ptr*, 2, 1, 2> zyz, bgb, ptp;\n Matrix<3, 1, const no_ptr*, 2, 2, 0> zzx, bbr, pps;\n Matrix<3, 1, const no_ptr*, 2, 2, 1> zzy, bbg, ppt;\n Matrix<3, 1, const no_ptr*, 2, 2, 2> zzz, bbb, ppp;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 2> xxxz, rrrb, sssp;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 2> xxyz, rrgb, sstp;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 0> xxzx, rrbr, ssps;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 1> xxzy, rrbg, sspt;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 2> xxzz, rrbb, sspp;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 2> xyxz, rgrb, stsp;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 2> xyyz, rggb, sttp;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 0> xyzx, rgbr, stps;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 1> xyzy, rgbg, stpt;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 2> xyzz, rgbb, stpp;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 0> xzxx, rbrr, spss;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 1> xzxy, rbrg, spst;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 2> xzxz, rbrb, spsp;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 0> xzyx, rbgr, spts;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 1> xzyy, rbgg, sptt;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 2> xzyz, rbgb, sptp;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 0> xzzx, rbbr, spps;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 1> xzzy, rbbg, sppt;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 2> xzzz, rbbb, sppp;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 2> yxxz, grrb, tssp;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 2> yxyz, grgb, tstp;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 0> yxzx, grbr, tsps;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 1> yxzy, grbg, tspt;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 2> yxzz, grbb, tspp;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 2> yyxz, ggrb, ttsp;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 2> yyyz, gggb, tttp;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 0> yyzx, ggbr, ttps;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 1> yyzy, ggbg, ttpt;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 2> yyzz, ggbb, ttpp;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 0> yzxx, gbrr, tpss;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 1> yzxy, gbrg, tpst;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 2> yzxz, gbrb, tpsp;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 0> yzyx, gbgr, tpts;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 1> yzyy, gbgg, tptt;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 2> yzyz, gbgb, tptp;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 0> yzzx, gbbr, tpps;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 1> yzzy, gbbg, tppt;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 2> yzzz, gbbb, tppp;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 0> zxxx, brrr, psss;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 1> zxxy, brrg, psst;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 2> zxxz, brrb, pssp;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 0> zxyx, brgr, psts;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 1> zxyy, brgg, pstt;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 2> zxyz, brgb, pstp;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 0> zxzx, brbr, psps;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 1> zxzy, brbg, pspt;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 2> zxzz, brbb, pspp;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 0> zyxx, bgrr, ptss;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 1> zyxy, bgrg, ptst;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 2> zyxz, bgrb, ptsp;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 0> zyyx, bggr, ptts;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 1> zyyy, bggg, pttt;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 2> zyyz, bggb, pttp;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 0> zyzx, bgbr, ptps;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 1> zyzy, bgbg, ptpt;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 2> zyzz, bgbb, ptpp;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 0> zzxx, bbrr, ppss;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 1> zzxy, bbrg, ppst;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 2> zzxz, bbrb, ppsp;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 0> zzyx, bbgr, ppts;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 1> zzyy, bbgg, pptt;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 2> zzyz, bbgb, pptp;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 0> zzzx, bbbr, ppps;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 1> zzzy, bbbg, pppt;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 2> zzzz, bbbb, pppp;\n };\n };\n template\n struct Container<4, 1, F, 0, 1, 2, 3> {\n Container() = default;\n union {\n no_ptr> data[4];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n Matrix<1, 1, no_ptr*, 2> z, b, p;\n Matrix<1, 1, no_ptr*, 3> w, a, q;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 0, 2> xz, rb, sp;\n Matrix<2, 1, no_ptr*, 0, 3> xw, ra, sq;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n Matrix<2, 1, no_ptr*, 1, 2> yz, gb, tp;\n Matrix<2, 1, no_ptr*, 1, 3> yw, ga, tq;\n Matrix<2, 1, no_ptr*, 2, 0> zx, br, ps;\n Matrix<2, 1, no_ptr*, 2, 1> zy, bg, pt;\n Matrix<2, 1, const no_ptr*, 2, 2> zz, bb, pp;\n Matrix<2, 1, no_ptr*, 2, 3> zw, ba, pq;\n Matrix<2, 1, no_ptr*, 3, 0> wx, ar, qs;\n Matrix<2, 1, no_ptr*, 3, 1> wy, ag, qt;\n Matrix<2, 1, no_ptr*, 3, 2> wz, ab, qp;\n Matrix<2, 1, const no_ptr*, 3, 3> ww, aa, qq;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 0, 2> xxz, rrb, ssp;\n Matrix<3, 1, const no_ptr*, 0, 0, 3> xxw, rra, ssq;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, no_ptr*, 0, 1, 2> xyz, rgb, stp;\n Matrix<3, 1, no_ptr*, 0, 1, 3> xyw, rga, stq;\n Matrix<3, 1, const no_ptr*, 0, 2, 0> xzx, rbr, sps;\n Matrix<3, 1, no_ptr*, 0, 2, 1> xzy, rbg, spt;\n Matrix<3, 1, const no_ptr*, 0, 2, 2> xzz, rbb, spp;\n Matrix<3, 1, no_ptr*, 0, 2, 3> xzw, rba, spq;\n Matrix<3, 1, const no_ptr*, 0, 3, 0> xwx, rar, sqs;\n Matrix<3, 1, no_ptr*, 0, 3, 1> xwy, rag, sqt;\n Matrix<3, 1, no_ptr*, 0, 3, 2> xwz, rab, sqp;\n Matrix<3, 1, const no_ptr*, 0, 3, 3> xww, raa, sqq;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, no_ptr*, 1, 0, 2> yxz, grb, tsp;\n Matrix<3, 1, no_ptr*, 1, 0, 3> yxw, gra, tsq;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n Matrix<3, 1, const no_ptr*, 1, 1, 2> yyz, ggb, ttp;\n Matrix<3, 1, const no_ptr*, 1, 1, 3> yyw, gga, ttq;\n Matrix<3, 1, no_ptr*, 1, 2, 0> yzx, gbr, tps;\n Matrix<3, 1, const no_ptr*, 1, 2, 1> yzy, gbg, tpt;\n Matrix<3, 1, const no_ptr*, 1, 2, 2> yzz, gbb, tpp;\n Matrix<3, 1, no_ptr*, 1, 2, 3> yzw, gba, tpq;\n Matrix<3, 1, no_ptr*, 1, 3, 0> ywx, gar, tqs;\n Matrix<3, 1, const no_ptr*, 1, 3, 1> ywy, gag, tqt;\n Matrix<3, 1, no_ptr*, 1, 3, 2> ywz, gab, tqp;\n Matrix<3, 1, const no_ptr*, 1, 3, 3> yww, gaa, tqq;\n Matrix<3, 1, const no_ptr*, 2, 0, 0> zxx, brr, pss;\n Matrix<3, 1, no_ptr*, 2, 0, 1> zxy, brg, pst;\n Matrix<3, 1, const no_ptr*, 2, 0, 2> zxz, brb, psp;\n Matrix<3, 1, no_ptr*, 2, 0, 3> zxw, bra, psq;\n Matrix<3, 1, no_ptr*, 2, 1, 0> zyx, bgr, pts;\n Matrix<3, 1, const no_ptr*, 2, 1, 1> zyy, bgg, ptt;\n Matrix<3, 1, const no_ptr*, 2, 1, 2> zyz, bgb, ptp;\n Matrix<3, 1, no_ptr*, 2, 1, 3> zyw, bga, ptq;\n Matrix<3, 1, const no_ptr*, 2, 2, 0> zzx, bbr, pps;\n Matrix<3, 1, const no_ptr*, 2, 2, 1> zzy, bbg, ppt;\n Matrix<3, 1, const no_ptr*, 2, 2, 2> zzz, bbb, ppp;\n Matrix<3, 1, const no_ptr*, 2, 2, 3> zzw, bba, ppq;\n Matrix<3, 1, no_ptr*, 2, 3, 0> zwx, bar, pqs;\n Matrix<3, 1, no_ptr*, 2, 3, 1> zwy, bag, pqt;\n Matrix<3, 1, const no_ptr*, 2, 3, 2> zwz, bab, pqp;\n Matrix<3, 1, const no_ptr*, 2, 3, 3> zww, baa, pqq;\n Matrix<3, 1, const no_ptr*, 3, 0, 0> wxx, arr, qss;\n Matrix<3, 1, no_ptr*, 3, 0, 1> wxy, arg, qst;\n Matrix<3, 1, no_ptr*, 3, 0, 2> wxz, arb, qsp;\n Matrix<3, 1, const no_ptr*, 3, 0, 3> wxw, ara, qsq;\n Matrix<3, 1, no_ptr*, 3, 1, 0> wyx, agr, qts;\n Matrix<3, 1, const no_ptr*, 3, 1, 1> wyy, agg, qtt;\n Matrix<3, 1, no_ptr*, 3, 1, 2> wyz, agb, qtp;\n Matrix<3, 1, const no_ptr*, 3, 1, 3> wyw, aga, qtq;\n Matrix<3, 1, no_ptr*, 3, 2, 0> wzx, abr, qps;\n Matrix<3, 1, no_ptr*, 3, 2, 1> wzy, abg, qpt;\n Matrix<3, 1, const no_ptr*, 3, 2, 2> wzz, abb, qpp;\n Matrix<3, 1, const no_ptr*, 3, 2, 3> wzw, aba, qpq;\n Matrix<3, 1, const no_ptr*, 3, 3, 0> wwx, aar, qqs;\n Matrix<3, 1, const no_ptr*, 3, 3, 1> wwy, aag, qqt;\n Matrix<3, 1, const no_ptr*, 3, 3, 2> wwz, aab, qqp;\n Matrix<3, 1, const no_ptr*, 3, 3, 3> www, aaa, qqq;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 2> xxxz, rrrb, sssp;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 3> xxxw, rrra, sssq;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 2> xxyz, rrgb, sstp;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 3> xxyw, rrga, sstq;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 0> xxzx, rrbr, ssps;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 1> xxzy, rrbg, sspt;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 2> xxzz, rrbb, sspp;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 3> xxzw, rrba, sspq;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 0> xxwx, rrar, ssqs;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 1> xxwy, rrag, ssqt;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 2> xxwz, rrab, ssqp;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 3> xxww, rraa, ssqq;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 2> xyxz, rgrb, stsp;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 3> xyxw, rgra, stsq;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 2> xyyz, rggb, sttp;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 3> xyyw, rgga, sttq;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 0> xyzx, rgbr, stps;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 1> xyzy, rgbg, stpt;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 2> xyzz, rgbb, stpp;\n Matrix<4, 1, no_ptr*, 0, 1, 2, 3> xyzw, rgba, stpq;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 0> xywx, rgar, stqs;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 1> xywy, rgag, stqt;\n Matrix<4, 1, no_ptr*, 0, 1, 3, 2> xywz, rgab, stqp;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 3> xyww, rgaa, stqq;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 0> xzxx, rbrr, spss;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 1> xzxy, rbrg, spst;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 2> xzxz, rbrb, spsp;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 3> xzxw, rbra, spsq;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 0> xzyx, rbgr, spts;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 1> xzyy, rbgg, sptt;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 2> xzyz, rbgb, sptp;\n Matrix<4, 1, no_ptr*, 0, 2, 1, 3> xzyw, rbga, sptq;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 0> xzzx, rbbr, spps;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 1> xzzy, rbbg, sppt;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 2> xzzz, rbbb, sppp;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 3> xzzw, rbba, sppq;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 0> xzwx, rbar, spqs;\n Matrix<4, 1, no_ptr*, 0, 2, 3, 1> xzwy, rbag, spqt;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 2> xzwz, rbab, spqp;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 3> xzww, rbaa, spqq;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 0> xwxx, rarr, sqss;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 1> xwxy, rarg, sqst;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 2> xwxz, rarb, sqsp;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 3> xwxw, rara, sqsq;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 0> xwyx, ragr, sqts;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 1> xwyy, ragg, sqtt;\n Matrix<4, 1, no_ptr*, 0, 3, 1, 2> xwyz, ragb, sqtp;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 3> xwyw, raga, sqtq;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 0> xwzx, rabr, sqps;\n Matrix<4, 1, no_ptr*, 0, 3, 2, 1> xwzy, rabg, sqpt;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 2> xwzz, rabb, sqpp;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 3> xwzw, raba, sqpq;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 0> xwwx, raar, sqqs;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 1> xwwy, raag, sqqt;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 2> xwwz, raab, sqqp;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 3> xwww, raaa, sqqq;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 2> yxxz, grrb, tssp;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 3> yxxw, grra, tssq;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 2> yxyz, grgb, tstp;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 3> yxyw, grga, tstq;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 0> yxzx, grbr, tsps;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 1> yxzy, grbg, tspt;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 2> yxzz, grbb, tspp;\n Matrix<4, 1, no_ptr*, 1, 0, 2, 3> yxzw, grba, tspq;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 0> yxwx, grar, tsqs;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 1> yxwy, grag, tsqt;\n Matrix<4, 1, no_ptr*, 1, 0, 3, 2> yxwz, grab, tsqp;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 3> yxww, graa, tsqq;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 2> yyxz, ggrb, ttsp;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 3> yyxw, ggra, ttsq;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 2> yyyz, gggb, tttp;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 3> yyyw, ggga, tttq;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 0> yyzx, ggbr, ttps;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 1> yyzy, ggbg, ttpt;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 2> yyzz, ggbb, ttpp;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 3> yyzw, ggba, ttpq;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 0> yywx, ggar, ttqs;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 1> yywy, ggag, ttqt;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 2> yywz, ggab, ttqp;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 3> yyww, ggaa, ttqq;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 0> yzxx, gbrr, tpss;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 1> yzxy, gbrg, tpst;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 2> yzxz, gbrb, tpsp;\n Matrix<4, 1, no_ptr*, 1, 2, 0, 3> yzxw, gbra, tpsq;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 0> yzyx, gbgr, tpts;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 1> yzyy, gbgg, tptt;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 2> yzyz, gbgb, tptp;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 3> yzyw, gbga, tptq;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 0> yzzx, gbbr, tpps;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 1> yzzy, gbbg, tppt;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 2> yzzz, gbbb, tppp;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 3> yzzw, gbba, tppq;\n Matrix<4, 1, no_ptr*, 1, 2, 3, 0> yzwx, gbar, tpqs;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 1> yzwy, gbag, tpqt;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 2> yzwz, gbab, tpqp;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 3> yzww, gbaa, tpqq;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 0> ywxx, garr, tqss;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 1> ywxy, garg, tqst;\n Matrix<4, 1, no_ptr*, 1, 3, 0, 2> ywxz, garb, tqsp;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 3> ywxw, gara, tqsq;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 0> ywyx, gagr, tqts;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 1> ywyy, gagg, tqtt;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 2> ywyz, gagb, tqtp;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 3> ywyw, gaga, tqtq;\n Matrix<4, 1, no_ptr*, 1, 3, 2, 0> ywzx, gabr, tqps;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 1> ywzy, gabg, tqpt;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 2> ywzz, gabb, tqpp;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 3> ywzw, gaba, tqpq;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 0> ywwx, gaar, tqqs;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 1> ywwy, gaag, tqqt;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 2> ywwz, gaab, tqqp;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 3> ywww, gaaa, tqqq;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 0> zxxx, brrr, psss;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 1> zxxy, brrg, psst;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 2> zxxz, brrb, pssp;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 3> zxxw, brra, pssq;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 0> zxyx, brgr, psts;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 1> zxyy, brgg, pstt;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 2> zxyz, brgb, pstp;\n Matrix<4, 1, no_ptr*, 2, 0, 1, 3> zxyw, brga, pstq;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 0> zxzx, brbr, psps;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 1> zxzy, brbg, pspt;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 2> zxzz, brbb, pspp;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 3> zxzw, brba, pspq;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 0> zxwx, brar, psqs;\n Matrix<4, 1, no_ptr*, 2, 0, 3, 1> zxwy, brag, psqt;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 2> zxwz, brab, psqp;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 3> zxww, braa, psqq;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 0> zyxx, bgrr, ptss;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 1> zyxy, bgrg, ptst;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 2> zyxz, bgrb, ptsp;\n Matrix<4, 1, no_ptr*, 2, 1, 0, 3> zyxw, bgra, ptsq;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 0> zyyx, bggr, ptts;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 1> zyyy, bggg, pttt;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 2> zyyz, bggb, pttp;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 3> zyyw, bgga, pttq;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 0> zyzx, bgbr, ptps;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 1> zyzy, bgbg, ptpt;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 2> zyzz, bgbb, ptpp;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 3> zyzw, bgba, ptpq;\n Matrix<4, 1, no_ptr*, 2, 1, 3, 0> zywx, bgar, ptqs;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 1> zywy, bgag, ptqt;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 2> zywz, bgab, ptqp;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 3> zyww, bgaa, ptqq;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 0> zzxx, bbrr, ppss;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 1> zzxy, bbrg, ppst;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 2> zzxz, bbrb, ppsp;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 3> zzxw, bbra, ppsq;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 0> zzyx, bbgr, ppts;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 1> zzyy, bbgg, pptt;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 2> zzyz, bbgb, pptp;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 3> zzyw, bbga, pptq;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 0> zzzx, bbbr, ppps;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 1> zzzy, bbbg, pppt;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 2> zzzz, bbbb, pppp;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 3> zzzw, bbba, pppq;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 0> zzwx, bbar, ppqs;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 1> zzwy, bbag, ppqt;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 2> zzwz, bbab, ppqp;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 3> zzww, bbaa, ppqq;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 0> zwxx, barr, pqss;\n Matrix<4, 1, no_ptr*, 2, 3, 0, 1> zwxy, barg, pqst;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 2> zwxz, barb, pqsp;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 3> zwxw, bara, pqsq;\n Matrix<4, 1, no_ptr*, 2, 3, 1, 0> zwyx, bagr, pqts;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 1> zwyy, bagg, pqtt;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 2> zwyz, bagb, pqtp;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 3> zwyw, baga, pqtq;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 0> zwzx, babr, pqps;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 1> zwzy, babg, pqpt;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 2> zwzz, babb, pqpp;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 3> zwzw, baba, pqpq;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 0> zwwx, baar, pqqs;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 1> zwwy, baag, pqqt;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 2> zwwz, baab, pqqp;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 3> zwww, baaa, pqqq;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 0> wxxx, arrr, qsss;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 1> wxxy, arrg, qsst;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 2> wxxz, arrb, qssp;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 3> wxxw, arra, qssq;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 0> wxyx, argr, qsts;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 1> wxyy, argg, qstt;\n Matrix<4, 1, no_ptr*, 3, 0, 1, 2> wxyz, argb, qstp;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 3> wxyw, arga, qstq;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 0> wxzx, arbr, qsps;\n Matrix<4, 1, no_ptr*, 3, 0, 2, 1> wxzy, arbg, qspt;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 2> wxzz, arbb, qspp;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 3> wxzw, arba, qspq;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 0> wxwx, arar, qsqs;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 1> wxwy, arag, qsqt;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 2> wxwz, arab, qsqp;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 3> wxww, araa, qsqq;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 0> wyxx, agrr, qtss;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 1> wyxy, agrg, qtst;\n Matrix<4, 1, no_ptr*, 3, 1, 0, 2> wyxz, agrb, qtsp;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 3> wyxw, agra, qtsq;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 0> wyyx, aggr, qtts;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 1> wyyy, aggg, qttt;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 2> wyyz, aggb, qttp;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 3> wyyw, agga, qttq;\n Matrix<4, 1, no_ptr*, 3, 1, 2, 0> wyzx, agbr, qtps;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 1> wyzy, agbg, qtpt;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 2> wyzz, agbb, qtpp;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 3> wyzw, agba, qtpq;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 0> wywx, agar, qtqs;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 1> wywy, agag, qtqt;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 2> wywz, agab, qtqp;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 3> wyww, agaa, qtqq;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 0> wzxx, abrr, qpss;\n Matrix<4, 1, no_ptr*, 3, 2, 0, 1> wzxy, abrg, qpst;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 2> wzxz, abrb, qpsp;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 3> wzxw, abra, qpsq;\n Matrix<4, 1, no_ptr*, 3, 2, 1, 0> wzyx, abgr, qpts;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 1> wzyy, abgg, qptt;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 2> wzyz, abgb, qptp;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 3> wzyw, abga, qptq;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 0> wzzx, abbr, qpps;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 1> wzzy, abbg, qppt;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 2> wzzz, abbb, qppp;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 3> wzzw, abba, qppq;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 0> wzwx, abar, qpqs;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 1> wzwy, abag, qpqt;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 2> wzwz, abab, qpqp;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 3> wzww, abaa, qpqq;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 0> wwxx, aarr, qqss;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 1> wwxy, aarg, qqst;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 2> wwxz, aarb, qqsp;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 3> wwxw, aara, qqsq;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 0> wwyx, aagr, qqts;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 1> wwyy, aagg, qqtt;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 2> wwyz, aagb, qqtp;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 3> wwyw, aaga, qqtq;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 0> wwzx, aabr, qqps;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 1> wwzy, aabg, qqpt;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 2> wwzz, aabb, qqpp;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 3> wwzw, aaba, qqpq;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 0> wwwx, aaar, qqqs;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 1> wwwy, aaag, qqqt;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 2> wwwz, aaab, qqqp;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 3> wwww, aaaa, qqqq;\n };\n };\n}\n\nusing uint = unsigned;\n\n#ifndef UINT64_C\nusing int64_t = long long;\nusing uint64_t = unsigned long long;\n#endif\n\nusing ivec2 = glsl::Matrix<2, 1, int, 0, 1>;\nusing ivec3 = glsl::Matrix<3, 1, int, 0, 1, 2>;\nusing ivec4 = glsl::Matrix<4, 1, int, 0, 1, 2, 3>;\n\nusing uvec2 = glsl::Matrix<2, 1, uint, 0, 1>;\nusing uvec3 = glsl::Matrix<3, 1, uint, 0, 1, 2>;\nusing uvec4 = glsl::Matrix<4, 1, uint, 0, 1, 2, 3>;\n\nusing i64vec2 = glsl::Matrix<2, 1, int64_t, 0, 1>;\nusing i64vec3 = glsl::Matrix<3, 1, int64_t, 0, 1, 2>;\nusing i64vec4 = glsl::Matrix<4, 1, int64_t, 0, 1, 2, 3>;\n\nusing u64vec2 = glsl::Matrix<2, 1, uint64_t, 0, 1>;\nusing u64vec3 = glsl::Matrix<3, 1, uint64_t, 0, 1, 2>;\nusing u64vec4 = glsl::Matrix<4, 1, uint64_t, 0, 1, 2, 3>;\n\nusing bvec2 = glsl::Matrix<2, 1, bool, 0, 1>;\nusing bvec3 = glsl::Matrix<3, 1, bool, 0, 1, 2>;\nusing bvec4 = glsl::Matrix<4, 1, bool, 0, 1, 2, 3>;\n\nusing vec2 = glsl::Matrix<2, 1, float, 0, 1>;\nusing vec3 = glsl::Matrix<3, 1, float, 0, 1, 2>;\nusing vec4 = glsl::Matrix<4, 1, float, 0, 1, 2, 3>;\n\nusing dvec2 = glsl::Matrix<2, 1, double, 0, 1>;\nusing dvec3 = glsl::Matrix<3, 1, double, 0, 1, 2>;\nusing dvec4 = glsl::Matrix<4, 1, double, 0, 1, 2, 3>;\n\nusing mat2x2 = glsl::Matrix<2, 2, float, 0, 1, 2, 3>;\nusing mat2x3 = glsl::Matrix<3, 2, float, 0, 1, 2, 3, 4, 5>;\nusing mat2x4 = glsl::Matrix<4, 2, float, 0, 1, 2, 3, 4, 5, 6, 7>;\n\nusing mat3x2 = glsl::Matrix<2, 3, float, 0, 1, 2, 3, 4, 5>;\nusing mat3x3 = glsl::Matrix<3, 3, float, 0, 1, 2, 3, 4, 5, 6, 7, 8>;\nusing mat3x4 = glsl::Matrix<4, 3, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\n\nusing mat4x2 = glsl::Matrix<2, 4, float, 0, 1, 2, 3, 4, 5, 6, 7>;\nusing mat4x3 = glsl::Matrix<3, 4, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\nusing mat4x4 = glsl::Matrix<4, 4, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15>;\n\nusing mat2 = mat2x2;\nusing mat3 = mat3x3;\nusing mat4 = mat4x4;\n\nusing dmat2x2 = glsl::Matrix<2, 2, double, 0, 1, 2, 3>;\nusing dmat2x3 = glsl::Matrix<3, 2, double, 0, 1, 2, 3, 4, 5>;\nusing dmat2x4 = glsl::Matrix<4, 2, double, 0, 1, 2, 3, 4, 5, 6, 7>;\n\nusing dmat3x2 = glsl::Matrix<2, 3, double, 0, 1, 2, 3, 4, 5>;\nusing dmat3x3 = glsl::Matrix<3, 3, double, 0, 1, 2, 3, 4, 5, 6, 7, 8>;\nusing dmat3x4 = glsl::Matrix<4, 3, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\n\nusing dmat4x2 = glsl::Matrix<2, 4, double, 0, 1, 2, 3, 4, 5, 6, 7>;\nusing dmat4x3 = glsl::Matrix<3, 4, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\nusing dmat4x4 = glsl::Matrix<4, 4, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15>;\n\nusing dmat2 = dmat2x2;\nusing dmat3 = dmat3x3;\nusing dmat4 = dmat4x4;\n\n#include \n#include \n\nnamespace glsl {\n\n template\n inline auto sum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a + b;\n else return M(a.data[I] + b.data[I] ...);\n }\n template\n inline auto sub(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a - b;\n else return M(a.data[I] - b.data[I] ...);\n }\n template\n inline auto neg(const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return -a;\n else return M(-a.data[I] ...);\n }\n template\n inline auto div(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a / b;\n else return M(a.data[I] / b.data[I] ...);\n }\n template\n constexpr bool integral = same || same || same || same;\n template\n constexpr bool moddable = integral && integral;\n\n template\n inline auto mod(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a % b;\n else return M(a.data[I] % b.data[I] ...);\n }\n template\n inline auto bin_neg(const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return -a;\n else return M(~a.data[I] ...);\n }\n template\n inline auto lshift(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a << b;\n else return M(a.data[I] << b.data[I] ...);\n }\n template\n inline auto rshift(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a >> b;\n else return M(a.data[I] >> b.data[I] ...);\n }\n template\n inline auto and_(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a & b;\n else return M(a.data[I] & b.data[I] ...);\n }\n template\n inline auto or_(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a | b;\n else return M(a.data[I] | b.data[I] ...);\n }\n template\n inline auto xor_(const M & a, const M & b, sequence) {\n if constexpr (sizeof...(I) == 1) return a ^ b;\n else return M(a.data[I] ^ b.data[I] ...);\n }\n template\n inline bool equals(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a == b;\n else return ((a.data[I] == b.data[I]) && ...);\n }\n template\n inline auto mul(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a * b;\n else return M(a.data[I] * b.data[I] ...);\n }\n template\n inline auto matmul(const M1& a, const M2& b, sequence, sequence, MultCommon result = {}) {\n int i;\n if constexpr (Columns == 1) return ((i = I, result.data[i] = ((a.data[K] * b.data[K + (i / Columns>) * Rows]) + ...)), ..., result);\n else {\n constexpr int result_rows = Rows>;\n return ((i = I, result.data[i] = ((a.data[(i % result_rows) + K * Rows] * b.data[K + (i / result_rows) * Rows]) + ...)), ..., result);\n }\n }\n template\n inline auto maximum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return (a > b) ? a : b;\n else return M((a.data[I] > b.data[I]) ? a.data[I] : b.data[I] ...);\n }\n template\n inline auto mininum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return (a < b) ? a : b;\n else return M((a.data[I] < b.data[I]) ? a.data[I] : b.data[I] ...);\n }\n template\n inline auto absolute(const M& x, sequence) {\n constexpr Field zero(0);\n if constexpr (sizeof...(I) == 1) return (x < zero) ? -x : x;\n else return M((x.data[I] < zero) ? -x.data[I] : x.data[I] ...);\n }\n\n template\n auto lt(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] < b.data[I]) ...);\n }\n template\n auto lte(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] <= b.data[I]) ...);\n }\n template\n auto gt(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] > b.data[I]) ...);\n }\n template\n auto gte(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] >= b.data[I]) ...);\n }\n template\n auto eq(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] == b.data[I]) ...);\n }\n template\n auto neq(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] != b.data[I]) ...);\n }\n\n template\n auto not_(const M& x, sequence) {\n return M(!x.data[I]...);\n }\n template\n auto isnan(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::isnan(x);\n else return Matrix, Columns, bool, I...>(std::isnan(x.data[I])...);\n }\n template\n auto isinf(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::isinf(x);\n else return Matrix, Columns, bool, I...>(std::isinf(x.data[I])...);\n }\n\n template\n inline auto ceiling(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::ceil(float(x));\n else return M(std::ceil(float(x.data[I])) ...);\n }\n template\n inline auto flooring(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::floor(float(x));\n else return M(std::floor(float(x.data[I])) ...);\n }\n template\n inline auto fraction(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x - std::floor(float(x));\n else return M(x.data[I] - std::floor(float(x.data[I])) ...);\n }\n template\n inline auto rounder(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::round(float(x));\n else return M(std::round(x.data[I]) ...);\n }\n template\n inline auto modulus(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return x - y * std::floor(float(x / y));\n else return M(x.data[I] - y.data[I] * std::floor(float(x.data[I] / y.data[I])) ...);\n }\n template\n inline auto power(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return std::pow(float(x), float(y));\n else return M(std::pow(float(x.data[I]), float(y.data[I])) ...);\n }\n template\n inline auto clamper(const M& x, const M& v, const M& V, sequence) {\n if constexpr (sizeof...(I) == 1) return (x < v) ? v : ((x > V) ? V : x);\n else return M((x.data[I] < v.data[I]) ? v.data[I] : ((x.data[I] > V.data[I]) ? V.data[I] : x.data[I]) ...);\n }\n template\n inline auto mixer(const M& x, const M& y, const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return x * (1 - a) + y * a;\n else return M(x.data[I] * (1 - a.data[I]) + y.data[I] * a.data[I] ...);\n }\n template\n inline auto smoothstepper(const M& e0, const M& e1, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) {\n M t = (x - e0) / (e1 - e0);\n t = t < 0 ? 0 : (t > 1 ? 1 : t);\n return t * t * (3 - 2 * t);\n }\n else {\n M t;\n ((t.data[I] = (x.data[I] - e0.data[I]) / (e1.data[I] - e0.data[I])), ...);\n ((t.data[I] = t.data[I] < 0 ? 0 : (t.data[I] > 1 ? 1 : t.data[I])), ...);\n return M(t.data[I] * t.data[I] * (3 - 2 * t.data[I]) ...);\n }\n }\n template\n inline auto stepper(const M& edge, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x < edge ? 0 : 1;\n else return M(x.data[I] < edge.data[I] ? 0 : 1 ...);\n }\n template\n inline auto sine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::sin(x);\n else return M(std::sin(x.data[I]) ...);\n }\n template\n inline auto arcussine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::asin(x);\n else return M(std::asin(x.data[I]) ...);\n }\n template\n inline auto cosine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::cos(x);\n else return M(std::cos(x.data[I]) ...);\n }\n template\n inline auto arcuscosine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::acos(x);\n else return M(std::acos(x.data[I]) ...);\n }\n template\n inline auto tangent(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::tan(x);\n else return M(std::tan(x.data[I]) ...);\n }\n template\n inline auto arcustangent(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::atan(x);\n else return M(std::tan(x.data[I]) ...);\n }\n template\n inline auto arcustangent(const M& y, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::atan2(y, x);\n else return M(std::atan2(y.data[I], x.data[I]) ...);\n }\n template\n inline auto to_degrees(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x * 180.f / 3.14159265358979f;\n else return M(x.data[I] * 180.f / 3.14159265358979f ...);\n }\n template\n inline auto to_radians(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x * 3.14159265358979f / 180.f;\n else return M(x.data[I] * 3.14159265358979f / 180.f ...);\n }\n\n template\n inline auto dotter(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return x * y;\n else return ((x.data[I] * y.data[I]) + ...);\n }\n template\n inline auto len(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::fabs(x);\n else return std::sqrt(((x.data[I] * x.data[I]) + ...));\n }\n template\n inline auto square_root(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::sqrt(x);\n else return M(std::sqrt(x.data[I]) ...);\n }\n template\n inline auto exper(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::exp(x);\n else return M(std::exp(x.data[I]) ...);\n }\n template\n inline auto exp2er(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::exp2(x);\n else return M(std::exp2f(x.data[I]) ...);\n }\n template\n inline auto loger(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::log(x);\n else return M(std::log(x.data[I]) ...);\n }\n template\n inline auto log2er(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::log2(x);\n else return M(std::log2(x.data[I]) ...);\n }\n template\n inline auto signum(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return M((x < 0) ? (-1) : ((x > 0) ? 1 : 0));\n else return M((x.data[I] < 0) ? (-1) : ((x.data[I] > 0) ? 1 : 0) ...);\n }\n template\n inline auto cast(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) {\n F result; memcpy(&result, &x, sizeof(F));\n return result;\n }\n else {\n identity, Columns, F> result;\n memcpy(result.data, x.data, sizeof(F) * sizeof...(I));\n return result;\n }\n }\n template\n inline auto outer(const M1& c, const M2& r, sequence) {\n constexpr int R1 = Rows, R2 = Rows;\n return identity((c[I/R1]*r[I%R1]) ...);\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator+(const genType& x, const genType_& y) {\n return sum(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator-(const genType& x, const genType_& y) {\n return sub(Common(x), Common(y), Iota{});\n }\n\n template > 1)>>\n inline auto operator-(const genType& x) {\n return neg(identity, Columns, Field>(x), iota* Columns>{});\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator/(const genType& x, const genType_& y) {\n return div(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && broadcastable && moddable, Field>> >\n inline auto operator%(const genType& x, const genType_& y) {\n return mod(Common(x), Common(y), Iota{});\n }\n template > 1) && integral>>>\n inline auto operator~(const genType& x) {\n return bin_neg(identity, Columns, Field>(x), iota* Columns>{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator<<(const genType& x, const genType_& y) {\n return lshift(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator>>(const genType& x, const genType_& y) {\n return rshift(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator&(const genType& x, const genType_& y) {\n return and_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator|(const genType& x, const genType_& y) {\n return or_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator^(const genType& x, const genType_& y) {\n return xor_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable>>\n inline bool operator==(const genType& x, const genType_& y) {\n return equals(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable>>\n inline auto operator!=(const genType& x, const genType_& y) {\n return !equals(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && matmul_broadcastable>>\n inline MultCommon operator*(const genType& x, const genType_& y) {\n if constexpr (Columns == 1 && Columns == 1 || (Rows == 1 && Columns == 1 || Rows == 1 && Columns == 1))\n return mul(Common(x), Common(y), Iota{});\n else\n return matmul(\n identity, Columns, Field>(x),\n identity, Columns, Field>(y),\n iota()>{},\n iota>{});\n }\n}\n\ntemplate > 1 && glsl::Rows > 1) && glsl::Columns == 1 && glsl::Columns == 1>>\ninline auto outerProduct(const genType& c, const genType_& r) {\n return glsl::outer(c, r, glsl::iota< glsl::Rows* glsl::Rows>{});\n}\n\ntemplate\ninline bool any(const glsl::Matrix& x) {\n return (x.data[I] || ...);\n}\ntemplate\ninline bool all(const glsl::Matrix& x) {\n return (x.data[I] && ...);\n}\ntemplate\ninline glsl::Matrix not_(const glsl::Matrix& x) {\n return glsl::not_(x, glsl::iota{});\n}\n\n//#define not not_ // gcc doesn't enjoy this; glsl code should just use not_ then I guess\n\ntemplate && glsl::same, const glsl::Field>>>\nauto lessThan(const genType& x, const genType_& y) {\n return glsl::lt(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto lessThanEqual(const genType& x, const genType_& y) {\n return glsl::lte(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto greaterThan(const genType& x, const genType_& y) {\n return glsl::gt(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto greaterThanEqual(const genType& x, const genType_& y) {\n return glsl::gte(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto equal(const genType& x, const genType_& y) {\n return glsl::eq(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto notEqual(const genType& x, const genType_& y) {\n return glsl::neq(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto isnan_(const genType& x) {\n return glsl::isnan(glsl::Common(x), glsl::Iota{});\n}\ntemplate\ninline auto isinf_(const genType& x) {\n return glsl::isinf(glsl::Common(x), glsl::Iota{});\n}\n#define isnan isnan_\n#define isinf isinf_\n\ntemplate> >\ninline auto max(const genType& x, const genType_& y) {\n return glsl::maximum(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate> >\ninline auto min(const genType& x, const genType_& y) {\n return glsl::mininum(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto abs(const genType& x) {\n return glsl::absolute(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto ceil(const genType& x) {\n return glsl::ceiling(glsl::Common(x), glsl::Iota{});\n}\ntemplate\ninline auto floor(const genType& x) {\n return glsl::flooring(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto fract(const genType& x) {\n return glsl::fraction(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto round(const genType& x) {\n return glsl::rounder(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate>>\ninline auto mod(const genType& x, const genType_& y) {\n return glsl::modulus(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate || (glsl::same && glsl::same)) && glsl::Rows == glsl::Rows&& glsl::broadcastable>>\ninline auto pow(const genType& x, const genType_& y) {\n return glsl::power(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\n\ntemplate>>\ninline auto clamp(const genType& x, const genType_& minVal, const genType__& maxVal) {\n return glsl::clamper(glsl::Common(x), glsl::Common(minVal), glsl::Common(maxVal), glsl::Iota{});\n}\n\ntemplate>>\ninline auto mix(const genType& x, const genType_& y, const genType__& a) {\n return glsl::mixer(glsl::Common(x), glsl::Common(y), glsl::Common(a), glsl::Iota{});\n}\n\n\ntemplate>>\ninline auto smoothstep(const genType& edge0, const genType_& edge1, const genType__& x) {\n return glsl::smoothstepper(glsl::Common(edge0), glsl::Common(edge1), glsl::Common(x), glsl::Iota{});\n}\ntemplate>>\ninline auto step(const genType& edge, const genType_& x) {\n return glsl::stepper(glsl::Common(edge), glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto sin(const genType& angle) {\n return glsl::sine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto asin(const genType& angle) {\n return glsl::arcussine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto cos(const genType& angle) {\n return glsl::cosine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto acos(const genType& angle) {\n return glsl::arcuscosine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto tan(const genType& angle) {\n return glsl::tangent(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto atan(const genType& y_over_x) {\n return glsl::arcustangent(glsl::Common(y_over_x), glsl::Iota{});\n}\n\ntemplate>>\ninline auto atan(const genType& y, const genType_& x) {\n return glsl::arcustangent(glsl::Common(y), glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto degrees(const genType& radians) {\n return glsl::to_degrees(glsl::Common(radians), glsl::Iota{});\n}\n\ntemplate\ninline auto radians(const genType& degrees) {\n return glsl::to_radians(glsl::Common(degrees), glsl::Iota{});\n}\n\ninline vec3 cross(const vec3& x, const vec3& y) {\n return vec3(x.y * y.z - y.y * x.z, x.z * y.x - y.z * x.x, x.x * y.y - y.x * x.y);\n}\n\ninline float determinant(mat2 m) {\n return m[0][0] * m[1][1] - m[0][1] * m[1][0];\n}\ninline float determinant(mat3 m) {\n return m[0][0] * determinant(mat2(m[1].yz, m[2].yz))\n - m[1][0] * determinant(mat2(m[0].yz, m[2].yz))\n + m[2][0] * determinant(mat2(m[0].yz, m[1].yz));\n}\ninline float determinant(mat4 m) {\n return m[0][0] * determinant(mat3(m[1].yzw, m[2].yzw, m[3].yzw))\n - m[1][0] * determinant(mat3(m[0].yzw, m[2].yzw, m[3].yzw))\n + m[2][0] * determinant(mat3(m[0].yzw, m[1].yzw, m[3].yzw))\n - m[3][0] * determinant(mat3(m[0].yzw, m[1].yzw, m[2].yzw));\n}\n\ninline mat2 inverse(mat2 m) {\n return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) / (m[0][0] * m[1][1] - m[0][1] * m[1][0]);\n}\nnamespace glsl {\n inline vec2 givens_rotation(float f, float g) {\n bool swap = false;\n if (abs(f) < abs(g)) {\n float tmp = f;\n f = g;\n g = tmp;\n swap = true;\n }\n if (g == .0f)\n return vec2(copysignf(1.f, f), .0f);\n else {\n float t = g / f, u = copysignf(1.f, f) * sqrtf(1.f + t * t);\n vec2 result = vec2(1.f, t) / u;\n if (swap)\n result = result.yx;\n return result;\n }\n }\n}\ninline mat3 inverse(mat3 m) {\n mat3 result(1.f), rhs(1.f);\n for (int c = 0; c < 2; ++c) {\n for (int r = 2; r > c; --r) {\n mat3 rot(1.f);\n vec2 cs = glsl::givens_rotation(m[c][c], m[c][r]);\n rot[c][c] = rot[r][r] = cs.x;\n rot[c][r] = -(rot[r][c] = cs.y);\n m = rot * m;\n rhs = rot * rhs;\n }\n }\n for (int i = 0; i < 3; ++i) {\n result[i].z = rhs[i].z / m[2].z;\n rhs[i].xy -= result[i].z * m[2].xy;\n result[i].y = rhs[i].y / m[1].y;\n rhs[i].x -= result[i].y * m[1].x;\n result[i].x = rhs[i].x / m[0].x;\n }\n return result;\n}\ninline mat4 inverse(mat4 m) {\n mat4 result(1.f), rhs(1.f);\n for (int c = 0; c < 3; ++c) {\n for (int r = 3; r > c; --r) {\n mat4 rot(1.f);\n vec2 cs = glsl::givens_rotation(m[c][c], m[c][r]);\n rot[c][c] = rot[r][r] = cs.x;\n rot[c][r] = -(rot[r][c] = cs.y);\n m = rot * m;\n rhs = rot * rhs;\n }\n }\n for (int i = 0; i < 4; ++i) {\n result[i].w = rhs[i].w / m[3].w;\n rhs[i].xyz -= result[i].w * m[3].xyz;\n result[i].z = rhs[i].z / m[2].z;\n rhs[i].xy -= result[i].z * m[2].xy;\n result[i].y = rhs[i].y / m[1].y;\n rhs[i].x -= result[i].y * m[1].x;\n result[i].x = rhs[i].x / m[0].x;\n }\n return result;\n}\n\ntemplate1)>>\n glsl::Matrix transpose(const glsl::Matrix& m) {\n glsl::Matrix result;\n ((result.data[I/R+(I%R)*C] = m.data[I]), ...);\n return result;\n}\n\n\ntemplate>>\ninline auto dot(const genType& x, const genType_& y) {\n return glsl::dotter(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto length(const genType& x) {\n return glsl::len(glsl::Common(x), glsl::Iota{});\n}\ntemplate>>\ninline auto distance(const genType& x, const genType_& y) {\n return glsl::len(glsl::Common(x-y), glsl::Iota{});\n}\ntemplate\ninline auto normalize(const genType& x) {\n return x / glsl::len(x, glsl::Iota{});\n}\n\ntemplate\ninline auto sqrt(const genType& x) {\n return glsl::square_root(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto exp(const genType& x) {\n return glsl::exper(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto exp2(const genType& x) {\n return glsl::exp2er(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto log(const genType& x) {\n return glsl::loger(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto log2(const genType& x) {\n return glsl::log2er(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto sign(const genType& x) {\n return glsl::signum(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto reflect(const genType& I, const genType_& N) {\n return I - 2 * dot(N, I) * N;\n}\n\ntemplate\ninline auto refract(const genType& I, const genType_& N, float eta) {\n glsl::Common R(.0f);\n float k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I));\n if (k > 0.0)\n R = eta * I - (eta * dot(N, I) + sqrt(k)) * N;\n return R;\n}\n\ntemplate, float>>>\ninline auto floatBitsToInt(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, float>>>\ninline auto floatBitsToUint(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, int>>>\ninline auto intBitsToFloat(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, uint>>>\ninline auto uintBitsToFloat(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate, double>>>\ninline auto doubleBitsToInt(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, double>>>\ninline auto doubleBitsToUint(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, int64_t>>>\ninline auto int64BitsToDouble(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, uint64_t>>>\ninline auto uint64BitsToDouble(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\n\ninline int64_t packInt2x32(ivec2 v) { return int64_t(v.y) << 32 | v.x; }\ninline uint64_t packUint2x32(uvec2 v) { return uint64_t(v.y) << 32 | v.x; }\n\ninline ivec2 unpackInt2x32(int64_t v) { return ivec2(v, v>>32); }\ninline uvec2 unpackUint2x32(uint64_t v) { return uvec2(v, v >> 32); }\n\ninline int atomicAdd(int& mem, int data) { return 0; }\ninline uint atomicAdd(uint& mem, uint data) { return 0u; }\ninline int64_t atomicAdd(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicAdd(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicAnd(int& mem, int data) { return 0; }\ninline uint atomicAnd(uint& mem, uint data) { return 0u; }\ninline int64_t atomicAnd(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicAnd(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicCompSwap(int& mem, int comp, int data) { return 0; }\ninline uint atomicCompSwap(uint& mem, uint comp, uint data) { return 0u; }\ninline int64_t atomicCompSwap(int64_t& mem, int64_t comp, int64_t data) { return 0; }\ninline uint64_t atomicCompSwap(uint64_t& mem, uint64_t comp, uint64_t data) { return 0; }\n\ninline int atomicExchange(int& mem, int data) { return 0; }\ninline uint atomicExchange(uint& mem, uint data) { return 0u; }\ninline int64_t atomicExchange(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicExchange(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicMax(int& mem, int data) { return 0; }\ninline uint atomicMax(uint& mem, uint data) { return 0u; }\ninline int64_t atomicMax(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicMax(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicMin(int& mem, int data) { return 0; }\ninline uint atomicMin(uint& mem, uint data) { return 0u; }\ninline int64_t atomicMin(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicMin(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicOr(int& mem, int data) { return 0; }\ninline uint atomicOr(uint& mem, uint data) { return 0u; }\ninline int64_t atomicOr(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicOr(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicXor(int& mem, int data) { return 0; }\ninline uint atomicXor(uint& mem, uint data) { return 0u; }\ninline int64_t atomicXor(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicXor(uint64_t& mem, uint64_t data) { return 0; }\n\ninline void barrier() {}\ninline void groupMemoryBarrier() {}\ninline void memoryBarrier() {}\ninline void memoryBarrierAtomicCounter() {}\ninline void memoryBarrierBuffer() {}\ninline void memoryBarrierImage() {}\ninline void memoryBarrierShared() {}\n\ninline const uvec3 gl_GlobalInvocationID = {};\ninline const uvec3 gl_LocalInvocationID = {};\ninline const uvec3 gl_WorkGroupSize = { 1, 1, 1 };\ninline const uvec3 gl_WorkGroupID = {};\ninline const uvec3 gl_NumWorkGroups = { 1, 1, 1 };\ninline const uint gl_LocalInvocationIndex = 0u;\n\ninline const vec4 gl_FragCoord = {};\ninline const vec2 gl_PointCoord = {};\ninline int gl_ViewportIndex;\ninline const int gl_VertexID = 0;\ninline const int gl_InstanceID = 0;\ninline const int gl_InvocationID = 0;\ninline int gl_PrimitiveIDIn;\ninline const int gl_PrimitiveID = 0;\ninline const int gl_PatchVerticesIn = 0;\ninline const int gl_Layer = 0;\n\ninline const vec3 gl_TessCoord = {};\ninline float gl_TessLevelInner[2];\ninline float gl_TessLevelOuter[4];\n\ninline const bool gl_FrontFacing = true;\ninline const bool gl_HelperInvocation = false;\n\ninline vec4 gl_Position;\ninline float gl_PointSize;\ninline float gl_FragDepth;\ninline float gl_ClipDistance[1];\ninline float gl_CullDistance[1];\nstruct gl_PerVertex\n{\n vec4 gl_Position;\n float gl_PointSize;\n float gl_ClipDistance[1];\n} inline gl_in[1];\n\ninline const int gl_NumSamples = 1;\ninline const int gl_SampleID = 0;\ninline int gl_SampleMask[1];\ninline const int gl_SampleMaskIn[1] = { 0 };\ninline const vec2 gl_SamplePosition = {};\n\ntemplate genType dFdx(genType p) { return p; }\ntemplate genType dFdy(genType p) { return p; }\ntemplate genType dFdxCoarse(genType p) { return p; }\ntemplate genType dFdyCoarse(genType p) { return p; }\ntemplate genType dFdxFine(genType p) { return p; }\ntemplate genType dFdyFine(genType p) { return p; }\ntemplate genType fwidth(genType p) { return p; }\ntemplate genType fwidthCoarse(genType p) { return p; }\ntemplate genType fwidthFine(genType p) { return p; }\n\n// subgroup extension: see https://www.khronos.org/blog/vulkan-subgroup-tutorial\n\ninline const uint gl_NumSubgroups = 1, gl_SubgroupID = 0, gl_SubgroupSize = 128, gl_SubgroupInvocationID = 0;\ninline const uvec4 gl_SubgroupEqMask{ 0 }, gl_SubgroupGeMask{ 0 }, gl_SubgroupGtMask{ 0 }, gl_SubgroupLeMask{ 0 }, gl_SubgroupLtMask{ 0 };\ninline void subgroupBarrier() {}\ninline void subgroupMemoryBarrier() {}\ninline void subgroupMemoryBarrierBuffer() {}\ninline void subgroupMemoryBarrierShared() {}\ninline void subgroupMemoryBarrierImage() {}\ninline bool subgroupElect() { return false; }\n\ninline bool subgroupAll(bool value) { return value; }\ninline bool subgroupAny(bool value) { return value; }\ntemplate bool subgroupAllEqual(T value) { (void)value; return false; }\n\ntemplate T subgroupBroadcast(T value, uint id) { (void)id; return value; }\ntemplate T subgroupBroadcastFirst(T value) { return value; }\ninline uvec4 subgroupBallot(bool value) { (void)value; return uvec4(0); }\ninline bool subgroupInverseBallot(uvec4 value) { (void)value; return false; }\ninline bool subgroupBallotBitExtract(uvec4 value, uint index) { (void)value; (void)index; return false; }\ninline uint subgroupBallotBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotInclusiveBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotExclusiveBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotFindLSB(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotFindMSB(uvec4 value) { (void)value; return 0; }\n\ntemplate T subgroupAdd(T value) { return value; }\ntemplate T subgroupMul(T value) { return value; }\ntemplate T subgroupMin(T value) { return value; }\ntemplate T subgroupMax(T value) { return value; }\ntemplate T subgroupAnd(T value) { return value; }\ntemplate T subgroupOr(T value) { return value; }\ntemplate T subgroupXor(T value) { return value; }\n\ntemplate T subgroupInclusiveAdd(T value) { return value; }\ntemplate T subgroupInclusiveMul(T value) { return value; }\ntemplate T subgroupInclusiveMin(T value) { return value; }\ntemplate T subgroupInclusiveMax(T value) { return value; }\ntemplate T subgroupInclusiveAnd(T value) { return value; }\ntemplate T subgroupInclusiveOr(T value) { return value; }\ntemplate T subgroupInclusiveXor(T value) { return value; }\n\ntemplate T subgroupExclusiveAdd(T value) { return value; }\ntemplate T subgroupExclusiveMul(T value) { return value; }\ntemplate T subgroupExclusiveMin(T value) { return value; }\ntemplate T subgroupExclusiveMax(T value) { return value; }\ntemplate T subgroupExclusiveAnd(T value) { return value; }\ntemplate T subgroupExclusiveOr(T value) { return value; }\ntemplate T subgroupExclusiveXor(T value) { return value; }\n\ntemplate T subgroupShuffle(T value, uint index) { (void)index; return value; }\ntemplate T subgroupShuffleXor(T value, uint mask) { (void)mask; return value; }\ntemplate T subgroupShuffleUp(T value, uint delta) { (void)delta; return value; }\ntemplate T subgroupShuffleDown(T value, uint delta) { (void)delta; return value; }\n\ntemplate T subgroupClusteredAdd(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMul(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMin(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMax(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredAnd(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredOr(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredXor(T value, uint clusterSize) { (void)clusterSize; return value; }\n\ntemplate T subgroupQuadBroadcast(T value, uint id) { (void)id; return value; }\ntemplate T subgroupQuadSwapHorizontal(T value) { return value; }\ntemplate T subgroupQuadSwapVertical(T value) { return value; }\ntemplate T subgroupQuadSwapDiagonal(T value) { return value; }\n\n\n// missing: hyperbolic trigonometry, faceforward etc geometric functions.\n"}, {"path": "impl/inline_glsl.cpp", "language": "cpp", "loc": 719, "comment_density": 0.088, "code": "\n#include \"inline_glsl.h\"\n#ifdef _WIN32\n#include \n#endif\n\nivec2 windowSize();\n\nnamespace inline_glsl {\n#ifdef _WIN32\n long ShaderStore::id_counter = 1; // 0 reserved for non-existing shaders\n inline ULONGLONG lastAccess(const char* path) {\n HANDLE file = CreateFileA(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);\n FILETIME writeTime;\n GetFileTime(file, nullptr, nullptr, &writeTime);\n CloseHandle(file);\n return ULARGE_INTEGER{ writeTime.dwLowDateTime, writeTime.dwHighDateTime }.QuadPart;\n }\n#else\n\tstd::atomic ShaderStore::id_counter{1};\n inline auto lastAccess(const char* path) {\n return last_write_time(std::filesystem::path(path));\n }\n#endif\n\n inline bool alphanum_(char input) {\n return 'a' <= input && input <= 'z' || 'A' <= input && input <= 'Z' || '0' <= input && input <= '9' || input == '_';\n }\n\n inline void remove_bind_calls(char* input) {\n char* output = input;\n bool inside = false;\n const char* needle = \" bind\";\n\n while (*input != '\\0') {\n *output = *input;\n if (!alphanum_(*input)) {\n for (int i = 1;; i++) {\n if (needle[i] == '\\0') {\n while (*input != '(' && *input != '\\0') input++;\n inside = true;\n break;\n }\n if (input[i] != needle[i]) break;\n }\n }\n output++; input++;\n if (inside && *input == ')') {\n input++;\n inside = false;\n }\n }\n *output = '\\0';\n }\n\n inline char* search(char* input, const char* needle, int& line) {\n while (*input != '\\0') {\n if (*input == '\\n') line++;\n for (int i = 0;; i++) {\n if (needle[i] == '\\0') return input;\n else if (input[i] != needle[i]) break;\n }\n input++;\n }\n return input;\n }\n\n void remove_comments(char* source_in, uint* lines_in) {\n char* source_out = source_in;\n uint* lines_out = lines_in;\n bool multi_comment = false, single_comment = false;\n\n while(*source_in!='\\0') {\n if (multi_comment) {\n if (*source_in == '\\n') { // keep commented \\ns to preserve lines\n *(source_out++) = '\\n';\n *(lines_out++) = *lines_in;\n }\n else if (*source_in == '/' && *(source_in-1) == '*')\n multi_comment = false;\n }\n else if (single_comment && *source_in == '\\n') {\n *(source_out++) = '\\n';\n *(lines_out++) = *lines_in;\n single_comment = false;\n }\n else {\n if (*source_in == '/') {\n if (*(source_in+1) == '/')\n single_comment = true;\n else if (*(source_in + 1) == '*')\n multi_comment = true;\n }\n if (!single_comment && !multi_comment) {\n *(source_out++) = *source_in;\n *(lines_out++) = *lines_in;\n }\n }\n source_in++;\n lines_in++;\n }\n *source_out = '\\0';\n *lines_out = *lines_in;\n }\n\n void remove_float_suffixes(char* source_in, uint* lines_in) {\n char* source_out = source_in;\n uint* lines_out = lines_in;\n bool number = false;\n while (*source_in!='\\0') {\n bool keep = true;\n if (number) {\n if (*source_in == 'f')\n keep = number = false;\n if (!('0'<=*source_in && *source_in<='9') && *source_in != '.')\n number = false;\n }\n if (!alphanum_(*source_in) && ('0' <= *(source_in+1) && *(source_in+1) <= '9'))\n number = true;\n if (keep) {\n *(source_out++) = *source_in;\n *(lines_out++) = *lines_in;\n }\n source_in++;\n lines_in++;\n }\n *source_out = '\\0';\n *lines_out = *lines_in;\n }\n\n bool is_same(const char* a, const char* b) {\n while (*a == *b) {\n if (*a == '\\0') return true;\n a++; b++;\n }\n return false;\n }\n \n bool SourceStore::update(const char* path) {\n this->path = path;\n\n auto latestUpdate = lastAccess(path);\n for (auto include : includes) {\n //printf(\"checking include %s\\n\", include);\n auto includeUpdate = lastAccess(include);\n if (includeUpdate > latestUpdate)\n latestUpdate = includeUpdate;\n }\n\n if (latestUpdate == currentUpdate)\n return false;\n\n FILE* file = fopen(path, \"rb\");\n if(!file) return false;\n \n fseek(file, 0, SEEK_END);\n size_t size = size_t(ftell(file)) + 1;\n\t\tif(size == 0) return false;\n\n\t\titeration++;\n\n currentUpdate = latestUpdate;\n\n contents.resize(size);\n contents.back() = '\\0';\n fseek(file, 0, SEEK_SET);\n fread(contents.data(), 1, contents.size() - 1, file);\n fclose(file);\n\n lines.resize(contents.size());\n int line = 1;\n for (int i = 0; i < contents.size(); ++i) {\n lines[i] = line;\n if (contents[i] == '\\n') line++;\n }\n remove_comments(contents.data(), lines.data());\n remove_float_suffixes(contents.data(), lines.data());\n\n char* search = contents.data();\n\n for (auto a : includes) delete[] a;\n includes.clear();\n\n // add include files (absolutely beautiful code I know)\n while (true) {\n int dummy;\n //printf(\"%s\", contents.data());\n search = inline_glsl::search(search, \"#in\", dummy);\n\n if (*search != '\\0') {\n char* include_begin = search;\n while (*search != '\\\"' && *search != '<' && *search != '\\0') search++;\n if (*search == '\\\"' || *search == '<') {\n char* path = ++search;\n\n while (*search != '\\\"' && *search != '>' && *search != '\\0') search++;\n int64_t path_length = search - path + 1;\n char* filePath = new char[path_length];\n for (int i = 0; path < search; ++i)\n filePath[i] = *(path++);\n filePath[path_length - 1] = '\\0';\n \n search++;\n int64_t begin_ind = include_begin - contents.data(), search_ind = search - contents.data();\n\n bool already_included = false;\n for (auto& a : includes)\n if (is_same(a, filePath))\n already_included = true;\n\n if (!already_included && !is_same(filePath, \"glext.h\") && !is_same(filePath, \"window.h\") && !is_same(filePath, \"loadgl46.h\") && !is_same(filePath, \"inline_glsl.h\")) {\n\n //printf(\"%s\\n\", filePath);\n FILE* includeFile = fopen(filePath, \"rb\");\n if (includeFile) {\n\t\t\t\t\t\t\tfseek(includeFile, 0, SEEK_END);\n\t\t\t\t\t\t\tsize_t size = size_t(ftell(includeFile));\n includes.push_back(filePath);\n if(size>0) {\n \t uint includeMask = uint(includes.size()) << 20;\n \t if (includes.size() >= 4096)\n\t printf(\"too many includes, errors may be reported in incorrect files\\n\");\n\n \t size_t copy_length = contents.size() - search_ind;\n \t contents.resize(contents.size() + size - (search_ind - begin_ind) - 1);\n \t lines.resize(contents.size());\n \t memcpy(&contents[contents.size() - copy_length], &contents[search_ind], copy_length);\n \t memcpy(&lines[lines.size() - copy_length], &lines[search_ind], copy_length * sizeof(int));\n\t\n \t fseek(includeFile, 0, SEEK_SET);\n\t \t fread(&contents[begin_ind], 1, size, includeFile);\n \t \tfclose(includeFile);\n\t \t line = 1;\n\t\t\t\t\t\t\t\tfor (int i = 0; i < size; ++i) {\n \t lines[begin_ind + i] = includeMask | line;\n \t if (contents[begin_ind + i] == '\\n') line++;\n \t }\n \t remove_comments(contents.data(), lines.data());\n \t remove_float_suffixes(contents.data(), lines.data());\n\t }\n }\n else delete[] filePath;\n }\n else delete[] filePath;\n search = &contents[search_ind];\n }\n else\n search++;\n }\n else break;\n }\n contents.resize(search + 1 - contents.data());\n lines.resize(contents.size());\n\n /*int lineBegin = 0;\n for (int i = 0; i < contents.size(); ++i) {\n if (contents[i] == '\\n' || contents[i] == '\\0') {\n printf(\"%d: %.*s\", lines[lineBegin], i - lineBegin + 1, &contents[lineBegin]);\n lineBegin = i + 1;\n }\n }\n for (int i = 0; i < 5; ++i) {\n printf(\"%d, \", lines[lines.size() - 1 - i]);\n }*/\n\n glsl_mains.clear();\n glsl_main_lines.clear();\n glsl_functions.clear();\n \n search = contents.data();\n\n while (true) {\n search = inline_glsl::search(search, \"glsl_main\", line);\n if (*search != '\\0') {\n glsl_mains.push_back(search);\n glsl_main_lines.push_back(lines[search-contents.data()]);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"#define\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_global\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search + 11);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_function\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search + 13);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_func(\", line);\n if (*search != '\\0') {\n for (int i = 0; i < 3; ++i) {\n char open = i < 2 ? '(' : '{', close = i < 2 ? ')' : '}';\n while (*search != open && *search != '\\0') search++;\n int inside = 1;\n while (inside > 0 && *(++search)!='\\0') {\n if (*search == open) inside++;\n if (*search == close) inside--;\n }\n }\n /*if (*(search + 1) != ';')\n printf(\"wrong character..?\\n\");\n else\n printf(\"semicolon removed!\\n\");*/\n *(search+1) = ' ';\n }\n else break;\n }\n\n glsl_begin_lines = glsl_main_lines;\n for (int i = 0; i < glsl_mains.size(); i++) {\n char*& c = glsl_mains[i];\n int inside = 1;\n char* k = c;\n while (inside > 0 && *k != '\\0') {\n if (*k == '{') inside++;\n if (*k == '}') inside--;\n k++;\n }\n *(k - 1) = '\\0';\n inside = 1;\n while (inside > 0 && c != contents.data()) {\n c--;\n if (*c == '}') inside++;\n if (*c == '{') inside--;\n if (*c == '\\n') glsl_begin_lines[i]--;\n }\n c++;\n\n remove_bind_calls(c);\n }\n for (char* c : glsl_functions) {\n if (*c == '#') {\n while (*c != '\\n' && *c != '\\0') c++;\n *c = '\\0';\n continue;\n }\n while (*c != ';' && *c != '{' && *c != '(' && *c != '\\0') c++;\n if (*c == '{') {\n c++;\n // struct\n int inside = 1;\n while (inside>0 && *c != '\\0') {\n if (*c == '{') inside++;\n if (*c == '}') inside--;\n c++;\n }\n }\n if (*c == ';') *(c + 1) = '\\0'; // variable\n else {\n // function\n c++;\n int inside = 1;\n while (inside > 0 && *c!='\\0') {\n if (*c == '(') inside++;\n if (*c == ')') inside--;\n c++;\n }\n while (*c != '{' && *c!=';' && *c != '\\0') c++;\n if (*c == ';')\n *(c+1) = '\\0';\n else {\n c++;\n inside = 1;\n while (inside > 0 && *c != '\\0') {\n if (*c == '{') inside++;\n if (*c == '}') inside--;\n c++;\n }\n *c = '\\0';\n }\n }\n }\n for (const char* c : includes) {\n while (*c != '\\\"' && *c != '>' && *c != '\\0') ++c;\n *const_cast(c) = '\\0';\n }\n\n return true;\n }\n\n void write_line(char* target, int line, int file) {\n for (int i = 0; i < 7; ++i) target[i] = \"\\n#line \"[i];\n sprintf(target + 7, \"%u %u\\n\", line, file);\n }\n\n bool add_shader(GLuint program, GLenum type, const char* name, const Shader& shader_obj, SourceStore& store) {\n\n GLuint shader = glCreateShader(type);\n\n if (!shader_obj.store->cached) {\n\n const char* stub = \"\\\n#extension GL_ARB_gpu_shader_int64 : enable\\n\\\n#define glsl_main() main()\\n\\\n#define glsl_func(a) a\\n\\\n#define dynamic_array(t, a) t a[]\\n\\\n#define arg_in(a) in a\\n\\\n#define arg_out(a) out a\\n\\\n#define arg_inout(a) inout a\\n\\\n#define arg_layout layout\\n\\\n#define glsl_extension(a,b) int _##a = 1\\n\\\n#define glsl_version(a) int glsl_version = a\\n\\\n#define glsl_subgroup(a) \\n\\\n#define not_(a) not(a)\\n\";\n\n size_t extensions = shader_obj.store->extensions.size();\n size_t functions = store.glsl_functions.size();\n const char** sources = const_cast(new char* [4 + extensions + 2 * functions]);\n\n sources[0] = shader_obj.store->version ? shader_obj.store->version : \"#version 460\\n\";\n for (int i = 0; i < extensions; ++i)\n sources[1 + i] = shader_obj.store->extensions[i];\n sources[extensions + 1] = stub;\n\n uint mask = 0xffffffffu << 20u;\n for (int i = 0; i < functions; ++i) {\n char* k = new char[32];\n uint line_file = store.lines[store.glsl_functions[i] - store.contents.data()];\n write_line(k, line_file & ~mask, (line_file & mask) >> 20u);\n sources[i * 2 + 2 + extensions] = k;\n sources[i * 2 + 3 + extensions] = store.glsl_functions[i];\n }\n char* l = new char[32];\n write_line(l, store.glsl_begin_lines[shader_obj.store->nth_in_file], 0);\n sources[2 + 2 * functions + extensions] = l;\n sources[3 + 2 * functions + extensions] = store.glsl_mains[shader_obj.store->nth_in_file];\n\n //printf(\"source: \\n\");\n //for (int i = 0; i < 4 + extensions + 2 * store.glsl_functions.size(); ++i)\n // printf(\"%s\", sources[i]);\n\n#ifdef _WIN32\n (void)_mkdir(\"shader_cache\");\n#else\n std::filesystem::create_directory(\"shader_cache\");\n#endif\n\n char cache_name[256];\n get_cache_name(cache_name, store.path, shader_obj.store->line);\n FILE* cache = fopen(cache_name, \"wb\");\n for (auto& include : store.includes) {\n int count = 0;\n while (include[count] != '\\0') count++;\n fwrite(include, 1, count, cache);\n fwrite(\",\", 1, 1, cache);\n }\n fwrite(\"\\n\", 1, 1, cache);\n for (int i = 0; i < 4 + extensions + 2 * store.glsl_functions.size(); ++i) {\n int count = 0;\n while (sources[i][count] != '\\0') count++;\n fwrite(sources[i], 1, count, cache);\n }\n fclose(cache);\n\n glShaderSource(shader, GLsizei(4 + extensions + 2 * functions), sources, nullptr);\n\n delete[] l;\n for (int i = 0; i < functions; ++i)\n delete[] const_cast(sources[i * 2 + 2 + extensions]);\n delete[] sources;\n }\n else\n glShaderSource(shader, 1, &shader_obj.store->cached, nullptr);\n \n glCompileShader(shader);\n GLint status;\n glGetShaderiv(shader, GL_COMPILE_STATUS, &status);\n if (status != GL_TRUE) {\n GLint length;\n glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);\n std::vector info_log(length);\n glGetShaderInfoLog(shader, length, nullptr, info_log.data());\n const GLubyte* vendor = glGetString(GL_VENDOR);\n \n if(vendor[0] == 'N' && vendor[1] == 'V') // should be enough :^)\n for (int i = 0; i < info_log.size(); ++i) {\n uint file_number, line_number;\n if ((i==0||info_log[i-1] == '\\n') && 2 == sscanf(info_log.data() + i, \"%u(%u)\", &file_number, &line_number)) {\n int j = 0; while (i+j < info_log.size() && info_log[i+j] != ')') j++; j++;\n \n const char* path = (file_number == 0) ? shader_obj.store->path : shader_obj.store->include_files[file_number-1];\n \n int last_dir = 0;\n for (int k = 0; path[k] != '\\0'; k++)\n if (path[k] == '\\\\' || path[k] == '/')\n last_dir = k;\n if(last_dir)\n path += last_dir + 1;\n\n int k = 0; while (path[k] != '\\0')k++;\n int t = int(ceil(log10(line_number)));\n // \", line \"\n size_t copy_size = info_log.size() - i - j;\n info_log.resize(info_log.size()-j+k+t+7);\n memcpy(info_log.data() + i + k + t + 7, info_log.data() + i + j, copy_size);\n for (int p = 0; p < k; ++p)\n info_log[i + p] = path[p];\n for (int p = 0; p < 7; ++p)\n info_log[i + k + p] = \", line \"[p];\n info_log[i+k+7+sprintf(info_log.data() + i + k + 7, \"%u\", line_number)] = ' ';\n i += k + t + 7;\n }\n }\n // TODO: AMD, Intel, ...? some vendors may have different error reporting schemes for different generations?\n printf(\"\\n%s failed: \\n%s\", name, info_log.data());\n glDeleteShader(shader);\n return false;\n }\n glAttachShader(program, shader);\n glDeleteShader(shader);\n return true;\n }\n\n // maybe make this O(log n) at some point\n inline Program& find_or_insert(int64_t ids[6], std::vector& programs) {\n for (int i = 0; i < programs.size(); ++i) {\n for (int j = 0; j < 6; ++j) {\n if (programs[i].ids[j] != ids[j]) break;\n else if (j == 5) return programs[i].p;\n }\n }\n programs.resize(programs.size() + 1);\n size_t location = programs.size() - 1;\n programs[location].p = Program();\n for (int i = 0; i < 6; ++i)\n programs[location].ids[i] = (long)ids[i];\n return programs[location].p;\n }\n\n std::vector draw_buffers;\n\n void useShader(const Shader& compute, const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment, std::vector& programs, ShaderState& shader_state, SourceStore& store) {\n\n int64_t ids[] = { compute.unique_id, vertex.unique_id, fragment.unique_id, geometry.unique_id, control.unique_id, evaluation.unique_id };\n Program& program = find_or_insert(ids, programs);\n\n shader_state.rebuilt = false;\n if (program.obj == 0 || compute.changed || vertex.changed || fragment.changed || geometry.changed || control.changed || evaluation.changed) {\n printf(\"compiling... \");\n GLuint newProgram = glCreateProgram();\n\n bool csuccess = !compute.unique_id || add_shader(newProgram, GL_COMPUTE_SHADER, \"compute\", compute, store);\n bool vsuccess = !vertex.unique_id || add_shader(newProgram, GL_VERTEX_SHADER, \"vertex\", vertex, store);\n bool gsuccess = !geometry.unique_id || add_shader(newProgram, GL_GEOMETRY_SHADER, \"geometry\", geometry, store);\n bool tsuccess = !control.unique_id || add_shader(newProgram, GL_TESS_CONTROL_SHADER, \"control\", control, store);\n bool esuccess = !evaluation.unique_id || add_shader(newProgram, GL_TESS_EVALUATION_SHADER, \"evaluation\", evaluation, store);\n bool fsuccess = !fragment.unique_id || add_shader(newProgram, GL_FRAGMENT_SHADER, \"fragment\", fragment, store);\n\n bool success = csuccess && vsuccess && gsuccess && tsuccess && esuccess && fsuccess;\n\n if (success) {\n glLinkProgram(newProgram);\n\n GLint status;\n glGetProgramiv(newProgram, GL_LINK_STATUS, &status);\n if (status != GL_TRUE) {\n GLint length;\n glGetProgramiv(newProgram, GL_INFO_LOG_LENGTH, &length);\n std::vector info_log(length);\n glGetProgramInfoLog(newProgram, length, nullptr, info_log.data());\n printf(\"\\ncouldn't link shader: \\n%s\\n\", info_log.data());\n glDeleteProgram(newProgram);\n success = false;\n }\n }\n else printf(\"\\n\");\n if (success) {\n printf(\"success! \\n\");\n if (program.obj != 0)\n glDeleteProgram(program.obj);\n program.obj = newProgram;\n\n if (program.vao != 0)\n glDeleteVertexArrays(1, &program.vao);\n glCreateVertexArrays(1, &program.vao);\n\n shader_state.rebuilt = true;\n }\n }\n\n glBindVertexArray(program.vao);\n\n glUseProgram(program.obj);\n\n if (draw_buffers.size() == 0) {\n GLint maxBuffers;\n glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxBuffers);\n draw_buffers.resize(maxBuffers);\n }\n for (auto& b : draw_buffers)\n b = GL_NONE;\n\n shader_state.fbo = program.fbo;\n shader_state.program = program.obj;\n shader_state.texture_unit = shader_state.image_unit = shader_state.fbo_width = shader_state.fbo_height = 0;\n\n shader_state.use_fbo = false;\n\n if (compute.unique_id) for (auto& f : compute.store->callbacks) f(shader_state);\n if (vertex.unique_id) for (auto& f : vertex.store->callbacks) f(shader_state);\n if (geometry.unique_id) for (auto& f : geometry.store->callbacks) f(shader_state);\n if (control.unique_id) for (auto& f : control.store->callbacks) f(shader_state);\n if (evaluation.unique_id) for (auto& f : evaluation.store->callbacks) f(shader_state);\n if (fragment.unique_id) for (auto& f : fragment.store->callbacks) f(shader_state);\n\n program.fbo = shader_state.fbo;\n\n if (shader_state.use_fbo) {\n glViewport(0, 0, shader_state.fbo_width, shader_state.fbo_height);\n //auto test = glCheckFramebufferStatus(GL_FRAMEBUFFER);\n //if (test != GL_FRAMEBUFFER_COMPLETE)\n // printf(\"framebuffer status %X\\n\", test);\n\n glDrawBuffers(draw_buffers.size(), draw_buffers.data());\n }\n else {\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n auto size = windowSize();\n glViewport(0, 0, size.x, size.y);\n }\n }\n\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of SSBO '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_SHADER_STORAGE_BLOCK, store.name);\n if (store.location != GL_INVALID_INDEX)\n glShaderStorageBlockBinding(shader_state.program, store.location, store.location);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of UBO '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_UNIFORM_BLOCK, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniformBlockBinding(shader_state.program, store.location, store.location);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of color attachment '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_PROGRAM_OUTPUT, store.name);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"'location' of depth attachment '%s' is obvious\\n\", store.name);\n }\n\n#undef bind\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform float '%s' to %g\\n\", store.name, store.item);\n glUniform1f(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform int '%s' to %i\\n\", store.name, store.item);\n glUniform1i(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uint '%s' to %ui\\n\", store.name, store.item);\n glUniform1ui(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uint '%s' to %ui\\n\", store.name, store.item);\n glUniform1ui64(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec2 '%s'\\n\", store.name);\n glUniform2fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec2 '%s'\\n\", store.name);\n glUniform2iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec2 '%s'\\n\", store.name);\n glUniform2uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec3 '%s'\\n\", store.name);\n glUniform3fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec3 '%s'\\n\", store.name);\n glUniform3iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec3 '%s'\\n\", store.name);\n glUniform3uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec4 '%s'\\n\", store.name);\n glUniform4fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec4 '%s'\\n\", store.name);\n glUniform4iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec4 '%s'\\n\", store.name);\n glUniform4uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2 '%s'\\n\", store.name);\n glUniformMatrix2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3 '%s'\\n\", store.name);\n glUniformMatrix3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4 '%s'\\n\", store.name);\n glUniformMatrix4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3x2 '%s'\\n\", store.name);\n glUniformMatrix3x2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4x2 '%s'\\n\", store.name);\n glUniformMatrix4x2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2x3 '%s'\\n\", store.name);\n glUniformMatrix2x3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4x3 '%s'\\n\", store.name);\n glUniformMatrix4x3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2x4 '%s'\\n\", store.name);\n glUniformMatrix2x4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3x4 '%s'\\n\", store.name);\n glUniformMatrix3x4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"bind SSBO '%s'\\n\", store.name);\n glBindBufferBase(GL_SHADER_STORAGE_BUFFER, store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"bind UBO '%s'\\n\", store.name);\n glBindBufferBase(GL_UNIFORM_BUFFER, store.location, store.item);\n }\n\n void set_fbo_size(GLuint texture, GLint level, ShaderState& state) {\n glGetTextureLevelParameteriv(texture, level, GL_TEXTURE_WIDTH, &state.fbo_width);\n glGetTextureLevelParameteriv(texture, level, GL_TEXTURE_HEIGHT, &state.fbo_height);\n }\n\n bool layered(GLenum type) {\n return type == GL_TEXTURE_2D_ARRAY || type == GL_TEXTURE_3D || type == GL_TEXTURE_CUBE_MAP || type == GL_TEXTURE_CUBE_MAP_ARRAY || type == GL_TEXTURE_2D_MULTISAMPLE_ARRAY;\n }\n\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"attach color '%s'\\n\", store.name);\n if (store.item == 0) return;\n if (shader_state.fbo == 0)\n glGenFramebuffers(1, &shader_state.fbo);\n if(!shader_state.use_fbo)\n glBindFramebuffer(GL_FRAMEBUFFER, shader_state.fbo);\n shader_state.use_fbo = true;\n if (shader_state.fbo_width == 0) set_fbo_size(store.item, store.item.level, shader_state);\n if (layered(store.item.type))\n glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + store.location, store.item, store.item.level, store.item.layer);\n else\n glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + store.location, store.item, store.item.level);\n draw_buffers[store.location] = GL_COLOR_ATTACHMENT0 + store.location;\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"attach %s to depth\\n\", store.name);\n if (store.item == 0) return;\n if (shader_state.fbo == 0)\n glGenFramebuffers(1, &shader_state.fbo);\n if (!shader_state.use_fbo)\n glBindFramebuffer(GL_FRAMEBUFFER, shader_state.fbo);\n shader_state.use_fbo = true;\n if (shader_state.fbo_width == 0) set_fbo_size(store.item, store.item.level, shader_state);\n if (layered(store.item.type))\n glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, store.item, store.item.level, store.item.layer);\n else\n glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, store.item, store.item.level);\n }\n}\n"}, {"path": "impl/inline_glsl.h", "language": "c", "loc": 456, "comment_density": 0.033, "code": "#pragma once\n\n#include \n\n#ifdef _WIN32\n#define VC_EXTRALEAN\n#define WIN32_LEAN_AND_MEAN\n#define NOMINMAX\n#include \n#else\n#include \n#endif\n\n#include \"glsl.h\"\n#include \"shader_types.h\"\n\n#ifndef _WIN32\n#include \n#include \n#endif\n\nnamespace inline_glsl {\n \n struct SourceStore {\n std::vector contents;\n std::vector glsl_mains;\n std::vector glsl_functions;\n std::vector glsl_main_lines, glsl_begin_lines;\n std::vector includes;\n char const* path;\n std::vector lines;\n#ifdef _WIN32\n ULONGLONG currentUpdate = 0;\n#else\n std::filesystem::file_time_type currentUpdate = {};\n#endif\n uint iteration = 0;\n bool update(const char* path);\n ~SourceStore() {\n for (auto include : includes) delete[] include;\n }\n };\n\n static SourceStore store;\n\n // filled prior to invoking a program\n struct ShaderState {\n GLuint program;\n GLuint fbo;\n GLuint image_format, image_access;\n GLubyte texture_unit;\n GLubyte image_unit;\n GLint fbo_width, fbo_height;\n bool rebuilt, use_fbo;\n } static shader_state;\n\n struct Function {\n virtual void operator()(ShaderState&) = 0;\n virtual ~Function() {}\n };\n\n template\n struct Specific : Function {\n T func;\n Specific(T func) : func(func) {}\n virtual void operator()(ShaderState& state) { func(state); }\n };\n\n struct Func {\n Function* func = nullptr;\n template\n Func(T func) : func(new Specific(func)) {}\n Func(Func&& other) : func(other.func) { other.func = nullptr; }\n void operator()(ShaderState& state) { (*func)(state); }\n ~Func() { if (func) delete func; }\n };\n\n using ShaderSetup = std::vector;\n inline ShaderSetup* current_callbacks;\n inline std::vector* extensions;\n inline const char** version;\n\n inline void get_cache_name(char* result, const char* path, int line) {\n\n const char* path_name = path;\n while (*path_name != '\\0') path_name++;\n while (*path_name != '\\\\' && *path_name != '/' && path_name > path)path_name--;\n if (path_name > path) path_name++;\n\n int i = 0;\n for (i = 0; i < 13; ++i)\n result[i] = \"shader_cache/\"[i];\n while (*path_name != '.' && *path_name != '\\0')\n result[i++] = *path_name++;\n result[i++] = '_';\n\n i += sprintf(result+i, \"%d\", line);\n\n for (int j = 0; j < 6; ++j)\n result[i++] = \".glsl\"[j];\n }\n\n struct ShaderStore {\n ShaderSetup callbacks;\n std::vector extensions, include_files;\n const char* version;\n const char* path; int line;\n const char* cached = nullptr;\n uint nth_in_file, iteration = 0;\n long unique_id;\n#ifdef _WIN32\n static long id_counter;\n#else\n\t\tstatic std::atomic id_counter;\n#endif\n ShaderStore(const char* path, int line, SourceStore& store) : path(path), line(line) {\n#ifdef _WIN32\n unique_id = InterlockedAdd(&id_counter, 1);\n#else\n unique_id = id_counter++;\n#endif\n FILE* test = fopen(path, \"r\");\n if (test) {\n fclose(test);\n store.update(path);\n include_files = store.includes;\n for (nth_in_file = 0; nth_in_file < store.glsl_main_lines.size() && store.glsl_main_lines[nth_in_file] != line; ++nth_in_file);\n //printf(\"glsl_main %d at line %d\\n\", nth_in_file, line);\n }\n else {\n char name_buffer[256];\n get_cache_name(name_buffer, path, line);\n FILE* file = fopen(name_buffer, \"rb\");\n fseek(file, 0, SEEK_END);\n size_t size = size_t(ftell(file)) + 1;\n char* cache = new char[size];\n cache[size - 1] = '\\0';\n\n fseek(file, 0, SEEK_SET);\n fread(cache, 1, size - 1, file);\n fclose(file);\n\n while (*cache != '\\0' && *cache != '\\n') {\n include_files.push_back(cache);\n while (*cache != '\\0' && *cache != ',') cache++;\n if (*cache != '\\0') {\n *cache = '\\0';\n cache++;\n }\n }\n\n cached = cache+1;\n }\n }\n\n bool update(SourceStore& store) {\n callbacks.clear();\n extensions.clear();\n version = nullptr;\n inline_glsl::current_callbacks = &callbacks;\n inline_glsl::extensions = &extensions;\n inline_glsl::version = &version;\n if (cached) return false;\n store.update(path);\n uint old_iteration = iteration;\n iteration = store.iteration;\n return old_iteration != iteration;\n }\n ~ShaderStore() { delete[] cached; }\n };\n\n struct Extension {\n const char* ext;\n Extension(const char* ext) : ext(ext) {}\n ~Extension() { inline_glsl::extensions->push_back(ext); }\n };\n struct Version {\n const char* version;\n Version(const char* version) : version(version) {}\n ~Version() { *inline_glsl::version = version; }\n };\n}\nstruct Shader {\n uint unique_id = 0; bool changed = false;\n inline_glsl::ShaderStore* store = nullptr;\n Shader() {}\n Shader(inline_glsl::ShaderStore& shader, inline_glsl::SourceStore& source) {\n changed = shader.update(source);\n unique_id = shader.unique_id;\n store = &shader;\n }\n};\n\nnamespace inline_glsl {\n struct Program {\n GLuint obj = 0, vao = 0, fbo = 0;\n };\n\n struct ProgramEntry {\n long ids[6] = { 0 };\n Program p;\n };\n\n static std::vector programs;\n void useShader(const Shader& compute, const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment, std::vector& programs, ShaderState& shader_state, SourceStore& store);\n\n\n template\n struct ArgStore {\n const char* name;\n GLuint location, program;\n T item;\n ArgStore(const char* name, T i) : name(name), item(i) {\n //printf(\"retainer for %s\\n\", name);\n }\n };\n\n using glsl::same, glsl::Field, glsl::Rows;\n\n template\n constexpr bool is_image = false;\n template\n constexpr bool is_image> = true;\n\n struct Arg {\n template\n void findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"glGetUniformLocation(%s)\\n\", store.name);\n store.location = glGetUniformLocation(shader_state.program, store.name);\n }\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"glGetUniformLocation(%s)\\n\", store.name);\n store.location = glGetUniformLocation(shader_state.program, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniform1i(store.location, shader_state.texture_unit);\n if constexpr (shadow) {\n glTextureParameteri(store.item, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);\n glTextureParameteri(store.item, GL_TEXTURE_COMPARE_FUNC, GL_LESS);\n }\n }\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n store.location = glGetUniformLocation(shader_state.program, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniform1i(store.location, shader_state.image_unit);\n }\n void findLocation(ShaderState& shader_state, ArgStore& store);\n void findLocation(ShaderState& shader_state, ArgStore& store);\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"find location of vertex attribute '%s'\\n\", store.name);\n store.location = glGetAttribLocation(shader_state.program, store.name);\n if(store.location!= GL_INVALID_INDEX)\n glEnableVertexAttribArray(store.location);\n }\n void findLocation(ShaderState& shader_state, ArgStore& store);\n void findLocation(ShaderState& shader_state, ArgStore& store);\n\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n template\n void bind(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"bind vertex attribute '%s'\\n\", store.name);\n glBindBuffer(GL_ARRAY_BUFFER, store.item);\n\n static_assert(same, float> || same, int> || same,uint>, \"attribute base type not supported\");\n if constexpr (same, float>)\n glVertexAttribPointer(store.location, Rows, store.item.type, store.item.normalized, store.item.stride, (void*)(size_t)store.item.offset);\n else\n glVertexAttribIPointer(store.location, Rows, store.item.type, store.item.stride, (void*)(size_t)store.item.offset);\n }\n\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n\n template\n void bind(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"bind sampler2D '%s'\\n\", store.name);\n glBindTextureUnit(shader_state.texture_unit, store.item);\n shader_state.texture_unit++;\n }\n template\n void bind(ShaderState& shader_state, ArgStore>& store, GLuint access, GLuint format) {\n //printf(\"bind image2D '%s'\\n\", store.name);\n if (access == 1) access = GL_READ_ONLY;\n else if (access == 2) access = GL_WRITE_ONLY;\n else access = GL_READ_WRITE;\n\n bool layered = store.item.layer == GL_INVALID_INDEX;\n GLint tex_format, tex_size, bind_size;\n glGetTextureLevelParameteriv(store.item, store.item.level, GL_TEXTURE_INTERNAL_FORMAT, &tex_format);\n glGetInternalformativ(type, tex_format, GL_IMAGE_TEXEL_SIZE, 1, &tex_size);\n glGetInternalformativ(type, format, GL_IMAGE_TEXEL_SIZE, 1, &bind_size);\n if (tex_size != bind_size) {\n printf(\"warning: texture and shader image have different texel sizes\\n\");\n#ifdef _WIN32\n __debugbreak();\n#endif\n }\n glBindImageTexture(shader_state.image_unit, store.item, store.item.level, layered, layered ? 0 : store.item.layer, access, format);\n shader_state.image_unit++;\n }\n\n Func func;\n template\n Arg(volatile ArgStore& store_, const U& j) : func([&, j, state = shader_state](ShaderState& shader_state) {\n ArgStore& store = const_cast&>(store_); // volatile is a legit keyword for images and buffers; the variable is not actually volatile so we cast it away\n\n if (shader_state.rebuilt || store.program != shader_state.program) {\n store.program = shader_state.program;\n findLocation(shader_state, store);\n }\n\n store.item = j;\n if (store.location != -1)\n if constexpr (!is_image)\n bind(shader_state, store);\n else\n bind(shader_state, store, state.image_access, state.image_format);\n }) {}\n\n ~Arg() { current_callbacks->push_back(std::move(func)); }\n };\n}\n\n#define UNIQUE_(a, b) ___ ## a ## b\n#define UNIQUE(a, b) UNIQUE_(a, b)\n\n#define REPEAT1(m, a) m(a)\n#define REPEAT2(m, a, b) m(a), m(b)\n#define REPEAT3(m, a, b, c) m(a), m(b), m(c)\n#define REPEAT4(m, a, b, c, d) m(a), m(b), m(c), m(d)\n#define REPEAT5(m, a, b, c, d, e) m(a), m(b), m(c), m(d), m(e)\n#define REPEAT6(m, a, b, c, d, e, f) m(a), m(b), m(c), m(d), m(e), m(f)\n#define REPEAT7(m, a, b, c, d, e, f, g) m(a), m(b), m(c), m(d), m(e), m(f), m(g)\n#define REPEAT8(m, a, b, c, d, e, f, g, h) m(a), m(b), m(c), m(d), m(e), m(f), m(g), m(h)\n\n#define SELECT(a, b, c, d, e, f, g, h, macro, ...) macro\n#define REPEAT(...) SELECT(__VA_ARGS__, REPEAT8, REPEAT7, REPEAT6, REPEAT5, REPEAT4, REPEAT3, REPEAT2, REPEAT1)\n\n\n#define STORE(a) UNIQUE(a,0)(#a, a)\n#define ARG(a) UNIQUE(a##_,0)(UNIQUE(a, 0), (decltype(UNIQUE(a,0).item))a)\n#define SHADOW(a) a = {}\n\n#define UNIFORM static inline_glsl::ArgStore<\n#define BUFFER static inline_glsl::ArgStore REPEAT(__VA_ARGS__)(STORE, __VA_ARGS__); inline_glsl::Arg REPEAT(__VA_ARGS__)(ARG, __VA_ARGS__); const FIRSTTYPE(__VA_ARGS__, 0) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__); inline_glsl::shader_state.image_access = 0\n#define BIND_BLOCK(a) > UNIQUE(a,0)(#a, a); inline_glsl::Arg UNIQUE(a##_,0)(UNIQUE(a,0), (decltype(UNIQUE(a,0).item))a); inline_glsl::shader_state.image_access = 0; union\n\n// bind(uniform_1, uniform_2, ...)\n#define bind(...) BIND(__VA_ARGS__)\n\n// bind_block(ssbo/ubo) {...};\n#define bind_block(a) BIND_BLOCK(a)\n\n#define DECL_TARGET_(a) UNIQUE(a##_,0)(#a, a)\n#define SELECT_TARGET_DECLARE_(...) REPEAT(__VA_ARGS__)(DECL_TARGET_, __VA_ARGS__)\n\n#define DECL_TARGET(a) UNIQUE(a,0)(#a, a)\n#define SELECT_TARGET_DECLARE(...) REPEAT(__VA_ARGS__)(DECL_TARGET, __VA_ARGS__)\n\n#define TARGET_SETTER(a) UNIQUE(a##_,0)(UNIQUE(a, 0), Target(a))\n#define SELECT_TARGET_SET(...) REPEAT(__VA_ARGS__)(TARGET_SETTER, __VA_ARGS__)\n\n#define SET_ATTR(a) UNIQUE(a##_,0)(UNIQUE(a, 0), Attribute(a))\n#define SELECT_ATTRIB_SET(...) REPEAT(__VA_ARGS__)(SET_ATTR, __VA_ARGS__)\n\n\n#define BIND_ATTRIBUTE(...) UNIQUE(type, __LINE__);(void)UNIQUE(type, __LINE__); static inline_glsl::ArgStore> SELECT_TARGET_DECLARE(__VA_ARGS__); inline_glsl::Arg SELECT_ATTRIB_SET(__VA_ARGS__); const decltype(UNIQUE(type, __LINE__)) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__)\n#define BIND_TARGET(...) UNIQUE(type, __LINE__);(void)UNIQUE(type, __LINE__); static inline_glsl::ArgStore SELECT_TARGET_DECLARE(__VA_ARGS__); inline_glsl::Arg SELECT_TARGET_SET(__VA_ARGS__); decltype(UNIQUE(type, __LINE__)) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__)\n\n// bind_attribute(attribute_1, attribute_2, ...)\n#define bind_attribute(...) BIND_ATTRIBUTE(__VA_ARGS__)\n\n// bind_target(texture_1, texture_2, ...)\n#define bind_target(...) BIND_TARGET(__VA_ARGS__)\n\n#define glsl_func(name) *UNIQUE(type, __LINE__); (void)(UNIQUE(type, __LINE__)); auto name = [&]\n\n#define in\n#define out\n\n#define arg_in(type) type\n#define arg_out(type) type&\n#define arg_inout(type) type&\n\n#define flat\n#define noperspective\n#define smooth\n\n#define layout(...) __VA_ARGS__;\n\n#define std140 0\n#define std430 0\n\n#define shared\n\n#define glsl_extension(name, behavior) inline_glsl::Extension _##name(\"#extension \" #name \" : \" #behavior \"\\n\")\n#define glsl_version(version) inline_glsl::Version glsl_version(\"#version \" #version \"\\n\")\n#define glsl_subgroup(behavior) \\\n glsl_extension(GL_KHR_shader_subgroup_basic, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_vote, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_ballot, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_arithmetic, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_shuffle, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_shuffle_relative, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_clustered, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_quad, behavior)\n\ninline unsigned location, binding, component, offset, vertices, max_vertices, primitive, invocations, local_size_x, local_size_y, local_size_z;\ninline unsigned points, lines, lines_adjacency, triangles, triangles_adjacency, line_strip, triangle_strip;\n\n#define IMAGE_FORMAT(a) inline_glsl::shader_state.image_format = a\ntemplate\nstruct DynamicArray {\n T val;\n T& operator[](int){ return val; }\n int length() { return 0; }\n};\n#define dynamic_array(type, name) DynamicArray name;\n\n#define arg_layout(...)\n\n#define r11f_g11f_b10f IMAGE_FORMAT(GL_R11F_G11F_B10F)\n#define rgb10_a2 IMAGE_FORMAT(GL_RGB10_A2)\n#define rgba32f IMAGE_FORMAT(GL_RGBA32F)\n#define rgba16f IMAGE_FORMAT(GL_RGBA16F)\n#define rgba16 IMAGE_FORMAT(GL_RGBA16)\n#define rgba8 IMAGE_FORMAT(GL_RGBA8)\n#define rg32f IMAGE_FORMAT(GL_RG32F)\n#define rg16f IMAGE_FORMAT(GL_RG16F)\n#define rg16 IMAGE_FORMAT(GL_RG16)\n#define rg8 IMAGE_FORMAT(GL_RG8)\n#define r32f IMAGE_FORMAT(GL_R32F)\n#define r16f IMAGE_FORMAT(GL_R16F)\n#define r16 IMAGE_FORMAT(GL_R16)\n#define r8 IMAGE_FORMAT(GL_R8)\n#define rgba16_snorm IMAGE_FORMAT(GL_RGBA16_SNORM)\n#define rgba8_snorm IMAGE_FORMAT(GL_RGBA8_SNORM)\n#define rg16_snorm IMAGE_FORMAT(GL_RG16_SNORM)\n#define rg8_snorm IMAGE_FORMAT(GL_RG8_SNORM)\n#define r16_snorm IMAGE_FORMAT(GL_R16_SNORM)\n#define r8_snorm IMAGE_FORMAT(GL_R8_SNORM)\n\n#define rgba32i IMAGE_FORMAT(GL_RGBA32I)\n#define rgba16i IMAGE_FORMAT(GL_RGBA16I)\n#define rgba8i IMAGE_FORMAT(GL_RGBA8I)\n#define rg32i IMAGE_FORMAT(GL_RG32I)\n#define rg16i IMAGE_FORMAT(GL_RG16I)\n#define rg8i IMAGE_FORMAT(GL_RG8I)\n#define r32i IMAGE_FORMAT(GL_R32I)\n#define r16i IMAGE_FORMAT(GL_R16I)\n#define r8i IMAGE_FORMAT(GL_R8I)\n\n\n#define rgb10_a2ui IMAGE_FORMAT(GL_RGB10_A2UI)\n#define rgba32ui IMAGE_FORMAT(GL_RGBA32UI)\n#define rgba16ui IMAGE_FORMAT(GL_RGBA16UI)\n#define rgba8ui IMAGE_FORMAT(GL_RGBA8UI)\n#define rg32ui IMAGE_FORMAT(GL_RG32UI)\n#define rg16ui IMAGE_FORMAT(GL_RG16UI)\n#define rg8ui IMAGE_FORMAT(GL_RG8UI)\n#define r32ui IMAGE_FORMAT(GL_R32UI)\n#define r16ui IMAGE_FORMAT(GL_R16UI)\n#define r8ui IMAGE_FORMAT(GL_R8UI)\n\n#define READONLY inline_glsl::shader_state.image_access |= 1;\n#define readonly READONLY\n#define WRITEONLY inline_glsl::shader_state.image_access |= 2;\n#define writeonly WRITEONLY\n\n#define coherent\n#define restrict\n\n#define early_fragment_tests\n\n#define glsl_function\n#define glsl_global\n\n#define EmitVertex()\n#define EndPrimitive()\n#define EmitStreamVertex()\n\n#define GLSL_MAIN ();static inline_glsl::ShaderStore __s(__FILE__, __LINE__, inline_glsl::store); return Shader(__s, inline_glsl::store); if constexpr(false)\n#define glsl_main() GLSL_MAIN\n\n#define BIND_DEPTH(a) ();static inline_glsl::ArgStore UNIQUE(a,__LINE__)(#a, a); inline_glsl::Arg UNIQUE(a##_,__LINE__)(UNIQUE(a, __LINE__), DepthTarget(a))\n// bind_depth(texture)\n#define bind_depth(a) BIND_DEPTH(a)\n\nstatic void useShader(const Shader& compute) {\n inline_glsl::useShader(compute, Shader{}, Shader{}, Shader{}, Shader{}, Shader{}, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, Shader{}, Shader{}, Shader{}, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& geometry, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, geometry, Shader{}, Shader{}, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& control, const Shader& evaluation, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, Shader{}, control, evaluation, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, geometry, control, evaluation, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\n\ninline const Texture<> screen = {};\ninline const Texture<> screen_depth = {};\n"}, {"path": "impl/shader_types.h", "language": "c", "loc": 354, "comment_density": 0.008, "code": "#pragma once\n\n#include \n#include \"gl_helpers.h\"\n\ntemplate\nstruct Image {\n GLuint obj, level, layer;\n Image() : obj(0) { }\n template\n Image(const Texture& t) : obj(t), level(t.level), layer(t.layer) { }\n operator int() { return obj; }\n bool operator !=(const Image& other) {\n return obj != other.obj;\n }\n};\n\n#define IMAGEBASIC(name, sizetype, prefix, ...)\\\ninline sizetype imageSize(prefix##name image) { return {}; }\\\ninline prefix##vec4 imageLoad(prefix##name image, __VA_ARGS__) { return {}; }\\\ninline void imageStore(prefix##name image, __VA_ARGS__, prefix##vec4 data) { }\\\n\n#define IMAGEATOMIC(func, name, ...)\\\ninline int func(i##name, __VA_ARGS__, int data){ return {}; }\\\ninline uint func(u##name, __VA_ARGS__, uint data){ return {}; }\n\n#define IMAGEDEF(name, glenum, sizetype, ...)\\\nusing name = Image < glenum, float>;\\\nusing i ## name = Image < glenum, int>;\\\nusing u ## name = Image < glenum, uint>;\\\nIMAGEBASIC(name, sizetype, , __VA_ARGS__)\\\nIMAGEBASIC(name, sizetype, i, __VA_ARGS__)\\\nIMAGEBASIC(name, sizetype, u, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicAdd, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicMin, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicMax, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicAnd, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicOr, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicXor, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicExchange, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicCompSwap, name, __VA_ARGS__)\n\nIMAGEDEF(image1D, GL_TEXTURE_1D, int, int P)\nIMAGEDEF(image2D, GL_TEXTURE_2D, ivec2, ivec2 P)\nIMAGEDEF(image3D, GL_TEXTURE_3D, ivec3, ivec3 P)\nIMAGEDEF(imageCube, GL_TEXTURE_CUBE_MAP, ivec2, ivec3 P)\nIMAGEDEF(image2DRect, GL_TEXTURE_RECTANGLE, ivec2, ivec2 P)\nIMAGEDEF(image1DArray, GL_TEXTURE_1D_ARRAY, ivec2, ivec2 P)\nIMAGEDEF(image2DArray, GL_TEXTURE_2D_ARRAY, ivec3, ivec3 P)\nIMAGEDEF(imageCubeArray, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3, ivec3 P)\nIMAGEDEF(imageBuffer, GL_TEXTURE_BUFFER, int, int P)\nIMAGEDEF(image2DMS, GL_TEXTURE_2D_MULTISAMPLE, ivec2, ivec2 P, int sample)\nIMAGEDEF(image2DMSArray, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, ivec3, ivec3 P, int sample)\n\ninline int imageSamples(image2DMS image) { return 0; }\ninline int imageSamples(iimage2DMS image) { return 0; }\ninline int imageSamples(uimage2DMS image) { return 0; }\ninline int imageSamples(image2DMSArray image) { return 0; }\ninline int imageSamples(iimage2DMSArray image) { return 0; }\ninline int imageSamples(uimage2DMSArray image) { return 0; }\n\n#undef IMAGEBASIC\n#undef IMAGEATOMIC\n#undef IMAGEDEF\n\ntemplate\nstruct Sampler {\n GLuint obj;\n Sampler() : obj(0) { }\n Sampler(uint64_t) : obj(0) { }\n template\n Sampler(const Texture& t) : obj(t) {}\n operator int() { return obj; }\n bool operator !=(const Sampler& other) {\n return obj != other.obj;\n }\n};\n\n#define COMMA ,\n\n#define SAMPLEFUNC(func, name, params)\\\ninline vec4 func(name sampler params) {return {};}\\\ninline ivec4 func(i##name sampler params) {return {};}\\\ninline uvec4 func(u##name sampler params) {return {};}\n\n#define TEXFUNC(func, name, params)\\\ninline func(name sampler params) { return {}; }\\\ninline func(i##name sampler params) { return {}; }\\\ninline func(u##name sampler params) { return {}; }\n\n#define MIPPABLE(name, glenum, sizetype)\\\nusing name = Sampler;\\\nusing i ## name= Sampler;\\\nusing u ## name = Sampler;\\\nTEXFUNC(sizetype textureSize, name,COMMA int lod)\\\nTEXFUNC(int textureQueryLevels, name,)\n\n#define UNMIPPABLE(name, glenum, sizetype)\\\nusing name = Sampler;\\\nusing i ## name= Sampler;\\\nusing u ## name = Sampler;\\\nTEXFUNC(sizetype textureSize, name,)\n\nMIPPABLE(sampler1D, GL_TEXTURE_1D, int)\nMIPPABLE(sampler2D, GL_TEXTURE_2D, ivec2)\nMIPPABLE(sampler3D, GL_TEXTURE_3D, ivec3)\nMIPPABLE(samplerCube, GL_TEXTURE_CUBE_MAP, ivec2)\nMIPPABLE(sampler1DArray, GL_TEXTURE_1D_ARRAY, ivec2)\nMIPPABLE(sampler2DArray, GL_TEXTURE_2D_ARRAY, ivec3)\nMIPPABLE(samplerCubeArray, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3)\n\nUNMIPPABLE(sampler2DRect, GL_TEXTURE_RECTANGLE, ivec2)\nUNMIPPABLE(samplerBuffer, GL_TEXTURE_BUFFER, int)\nUNMIPPABLE(sampler2DMS, GL_TEXTURE_2D_MULTISAMPLE, ivec2)\nUNMIPPABLE(sampler2DMSArray, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, ivec3)\n\ninline int textureSamples(sampler2DMS image) { return 0; }\ninline int textureSamples(isampler2DMS image) { return 0; }\ninline int textureSamples(usampler2DMS image) { return 0; }\ninline int textureSamples(sampler2DMSArray image) { return 0; }\ninline int textureSamples(isampler2DMSArray image) { return 0; }\ninline int textureSamples(usampler2DMSArray image) { return 0; }\n\n#define MIPPABLE_SHADOW(name, glenum, sizetype)\\\nusing name = Sampler;\\\ninline sizetype textureSize(name sampler, int lod) {return {};}\\\ninline int textureQueryLevels(name sampler) {return 0;}\n\nMIPPABLE_SHADOW(sampler1DShadow, GL_TEXTURE_1D, int)\nMIPPABLE_SHADOW(sampler2DShadow, GL_TEXTURE_2D, ivec2)\nMIPPABLE_SHADOW(samplerCubeShadow, GL_TEXTURE_CUBE_MAP, ivec2)\nMIPPABLE_SHADOW(sampler1DArrayShadow, GL_TEXTURE_1D_ARRAY, ivec2)\nMIPPABLE_SHADOW(sampler2DArrayShadow, GL_TEXTURE_2D_ARRAY, ivec3)\nMIPPABLE_SHADOW(samplerCubeArrayShadow, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3)\nusing sampler2DRectShadow = Sampler;\ninline ivec2 textureSize(sampler2DRectShadow sampler) { return {}; }\n\n\nSAMPLEFUNC(texelFetch, sampler1D, COMMA int P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2D, COMMA ivec2 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler3D, COMMA ivec3 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2DRect, COMMA ivec2 P)\nSAMPLEFUNC(texelFetch, sampler1DArray, COMMA ivec2 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2DArray, COMMA ivec3 P COMMA int lod)\nSAMPLEFUNC(texelFetch, samplerBuffer, COMMA int P)\nSAMPLEFUNC(texelFetch, sampler2DMS, COMMA ivec2 P COMMA int sample)\nSAMPLEFUNC(texelFetch, sampler2DMSArray, COMMA ivec3 P COMMA int sample)\n\nSAMPLEFUNC(texelFetchOffset, sampler1D, COMMA int P COMMA int lod COMMA int offset)\nSAMPLEFUNC(texelFetchOffset, sampler2D, COMMA ivec2 P COMMA int lod COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler3D, COMMA ivec3 P COMMA int lod COMMA ivec3 offset)\nSAMPLEFUNC(texelFetchOffset, sampler2DRect, COMMA ivec2 P COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler1DArray, COMMA ivec2 P COMMA int lod COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler2DArray, COMMA ivec3 P COMMA int lod COMMA ivec3 offset)\n\nSAMPLEFUNC(texture, sampler1D, COMMA float P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2D, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler3D, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, samplerCube, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler1DArray, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2DArray, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, samplerCubeArray, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2DRect, COMMA vec2 P)\ninline float texture(sampler1DShadow sampler, vec3 P, float bias = .0f) { return {}; } // ... why does this take in a vec3???\ninline float texture(sampler2DShadow sampler, vec3 P, float bias = .0f) { return {}; }\ninline float texture(samplerCubeShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float texture(sampler1DArrayShadow sampler, vec3 P, float bias = .0f) { return {}; }\ninline float texture(sampler2DArrayShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float texture(sampler2DRectShadow sampler, vec3 P) { return {}; }\ninline float texture(samplerCubeArrayShadow sampler, vec4 P, float compare) { return {}; }\n\nSAMPLEFUNC(textureGather, sampler2D, COMMA vec2 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, sampler2DArray, COMMA vec3 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, samplerCube, COMMA vec3 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, samplerCubeArray, COMMA vec4 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, sampler2DRect, COMMA vec2 P COMMA int comp = 0)\ninline float textureGather(sampler2DShadow sampler, vec2 P, float refZ) { return {}; }\ninline float textureGather(sampler2DArrayShadow sampler, vec3 P, float refZ) { return {}; }\ninline float textureGather(samplerCubeShadow sampler, vec3 P, float refZ) { return {}; }\ninline float textureGather(samplerCubeArrayShadow sampler, vec4 P, float refZ) { return {}; }\ninline float textureGather(sampler2DRectShadow sampler, vec2 P, float refZ) { return {}; }\n\nSAMPLEFUNC(textureGatherOffset, sampler2D, COMMA vec2 P COMMA ivec2 offset COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffset, sampler2DArray, COMMA vec3 P COMMA ivec2 offset COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffset, sampler2DRect, COMMA vec2 P COMMA ivec2 offset COMMA int comp = 0)\ninline float textureGatherOffset(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offset) { return {}; }\ninline float textureGatherOffset(sampler2DArrayShadow sampler, vec3 P, float refZ, ivec2 offset) { return {}; }\ninline float textureGatherOffset(sampler2DRectShadow sampler, vec2 P, float refZ, ivec2 offset) { return {}; }\n\n\nSAMPLEFUNC(textureGatherOffsets, sampler2D, COMMA vec2 P COMMA ivec2 offsets[4] COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffsets, sampler2DArray, COMMA vec3 P COMMA ivec2 offsets[4] COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffsets, sampler2DRect, COMMA vec2 P COMMA ivec2 offsets[4] COMMA int comp = 0)\ninline float textureGatherOffsets(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offsets[4]) { return {}; }\ninline float textureGatherOffsets(sampler2DArrayShadow sampler, vec3 P, float refZ, ivec2 offsets[4]) { return {}; }\ninline float textureGatherOffsets(sampler2DRectShadow sampler, vec2 P, float refZ, ivec2 offsets[4]) { return {}; }\n\nSAMPLEFUNC(textureGrad, sampler1D, COMMA float P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureGrad, sampler2D, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureGrad, sampler3D, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, samplerCube, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, sampler1DArray, COMMA vec2 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureGrad, sampler2DArray, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureGrad, samplerCubeArray, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, sampler2DRect, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy)\ninline float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy) { return {}; }\ninline float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy) { return {}; }\ninline float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy) { return {}; }\ninline float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureGrad(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy) { return {}; }\n\nSAMPLEFUNC(textureGradOffset, sampler1D, COMMA float P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureGradOffset, sampler2D, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureGradOffset, sampler3D, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy COMMA ivec3 offset)\nSAMPLEFUNC(textureGradOffset, sampler1DArray, COMMA vec2 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureGradOffset, sampler2DArray, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureGradOffset, sampler2DRect, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\ninline float textureGradOffset(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureGradOffset(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureGradOffset(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureGradOffset(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureGradOffset(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureLod, sampler1D, COMMA float P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler2D, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler3D, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, samplerCube, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler1DArray, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler2DArray, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, samplerCubeArray, COMMA vec4 P COMMA float lod)\ninline float textureLod(sampler1DShadow sampler, vec3 P, float lod) { return {}; }\ninline float textureLod(sampler2DShadow sampler, vec3 P, float lod) { return {}; }\ninline float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod) { return {}; }\n\nSAMPLEFUNC(textureLodOffset, sampler1D, COMMA float P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureLodOffset, sampler2D, COMMA vec2 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureLodOffset, sampler3D, COMMA vec3 P COMMA float lod COMMA ivec3 offset)\nSAMPLEFUNC(textureLodOffset, sampler1DArray, COMMA vec2 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureLodOffset, sampler2DArray, COMMA vec3 P COMMA float lod COMMA ivec2 offset)\ninline float textureLodOffset(sampler1DShadow sampler, vec3 P, float lod, int offset) { return {}; }\ninline float textureLodOffset(sampler2DShadow sampler, vec3 P, float lod, ivec2 offset) { return {}; }\ninline float textureLodOffset(sampler1DArrayShadow sampler, vec3 P, float lod, int offset) { return {}; }\n\nSAMPLEFUNC(textureProjLod, sampler1D, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler1D, COMMA vec4 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler2D, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler2D, COMMA vec4 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler3D, COMMA vec4 P COMMA float lod)\ninline float textureProjLod(sampler1DShadow sampler, vec4 P, float lod) { return {}; }\ninline float textureProjLod(sampler2DShadow sampler, vec4 P, float lod) { return {}; }\n\nSAMPLEFUNC(textureProjLodOffset, sampler1D, COMMA vec2 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureProjLodOffset, sampler1D, COMMA vec4 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureProjLodOffset, sampler2D, COMMA vec3 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureProjLodOffset, sampler2D, COMMA vec4 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureProjLodOffset, sampler3D, COMMA vec4 P COMMA float lod COMMA ivec3 offset)\ninline float textureProjLodOffset(sampler1DShadow sampler, vec4 P, float lod, int offset) { return {}; }\ninline float textureProjLodOffset(sampler2DShadow sampler, vec4 P, float lod, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProj, sampler1D, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler1D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2D, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler3D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2DRect, COMMA vec3 P)\nSAMPLEFUNC(textureProj, sampler2DRect, COMMA vec4 P)\ninline float textureProj(sampler1DShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float textureProj(sampler2DShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float textureProj(sampler2DRectShadow sampler, vec4 P) { return {}; }\n\nSAMPLEFUNC(textureOffset, sampler1D, COMMA float P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2D, COMMA vec2 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler3D, COMMA vec3 P COMMA ivec3 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler1DArray, COMMA vec2 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2DArray, COMMA vec3 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2DRect, COMMA vec2 P COMMA ivec2 offset)\ninline float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias = .0f) { return {}; } // ... why does this take in a vec3???\ninline float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler2DArrayShadow sampler, vec4 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler2DRectShadow sampler, vec3 P, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProjGrad, sampler1D, COMMA vec2 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureProjGrad, sampler1D, COMMA vec4 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2D, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2D, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler3D, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2DRect, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2DRect, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy)\ninline float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy) { return {}; }\ninline float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureProjGrad(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\n\nSAMPLEFUNC(textureProjGradOffset, sampler1D, COMMA vec2 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureProjGradOffset, sampler1D, COMMA vec4 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2D, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2D, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler3D, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy COMMA ivec3 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2DRect, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2DRect, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\ninline float textureProjGradOffset(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureProjGradOffset(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureProjGradOffset(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProjOffset, sampler1D, COMMA vec2 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler1D, COMMA vec4 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2D, COMMA vec3 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2D, COMMA vec4 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler3D, COMMA vec4 P COMMA ivec3 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2DRect, COMMA vec3 P COMMA ivec2 offset)\nSAMPLEFUNC(textureProjOffset, sampler2DRect, COMMA vec4 P COMMA ivec2 offset)\ninline float textureProjOffset(sampler1DShadow sampler, vec4 P, int offset, float bias = .0f) { return {}; }\ninline float textureProjOffset(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureProjOffset(sampler2DRectShadow sampler, vec4 P, ivec2 offset) { return {}; }\n\nTEXFUNC(vec2 textureQueryLod, sampler1D, COMMA float P)\nTEXFUNC(vec2 textureQueryLod, sampler2D, COMMA vec2 P)\nTEXFUNC(vec2 textureQueryLod, sampler3D, COMMA vec3 P)\nTEXFUNC(vec2 textureQueryLod, samplerCube, COMMA vec3 P)\nTEXFUNC(vec2 textureQueryLod, sampler1DArray, COMMA float P)\nTEXFUNC(vec2 textureQueryLod, sampler2DArray, COMMA vec2 P)\nTEXFUNC(vec2 textureQueryLod, samplerCubeArray, COMMA vec3 P)\ninline vec2 textureQueryLod(sampler1DShadow sampler, float P) { return {}; } // ... why does this take in a vec3???\ninline vec2 textureQueryLod(sampler2DShadow sampler, vec2 P) { return {}; }\ninline vec2 textureQueryLod(samplerCubeShadow sampler, vec3 P) { return {}; }\ninline vec2 textureQueryLod(sampler1DArrayShadow sampler, float P) { return {}; }\ninline vec2 textureQueryLod(sampler2DArrayShadow sampler, vec2 P) { return {}; }\ninline vec2 textureQueryLod(samplerCubeArrayShadow sampler, vec3 P) { return {}; }\n\n#undef COMMA\n#undef SAMPLEFUNC\n#undef TEXFUNC\n#undef MIPPABLE\n#undef UNMIPPABLE\n#undef MIPPABLE_SHADOW\n\nstruct Target {\n GLuint obj, level, layer, type;\n Target() : obj(0) {}\n template\n Target(const Texture& t) : obj(t), level(t.level), layer(t.layer), type(t.target) { }\n operator int() { return obj; }\n bool operator !=(const Target& other) {\n return obj != other.obj;\n }\n};\n\nstruct DepthTarget {\n GLuint obj, level, layer, type;\n template\n DepthTarget(const Texture& t) : obj(t), level(t.level), layer(t.layer), type(t.target) { }\n operator int() { return obj; }\n bool operator !=(const DepthTarget& other) {\n return obj != other.obj;\n }\n};\n\nstruct UBO {\n GLuint obj;\n UBO(const Buffer& t) : obj(t) {}\n operator int() { return obj; };\n bool operator!=(const UBO& other) {\n return obj != other.obj;\n }\n};\nstruct SSBO {\n GLuint obj;\n SSBO(const Buffer& t) : obj(t) {}\n operator int() { return obj; };\n bool operator!=(const SSBO& other) {\n return obj != other.obj;\n }\n};\n\ntemplate\nstruct Attribute {\n GLuint obj, stride, offset, type;\n bool normalized;\n Attribute(const Buffer& b, int stride, int offset = 0, GLuint type = -1, bool normalized = false)\n : obj(b), stride(stride), offset(offset), type(type), normalized(normalized)\n {\n if (this->type == -1) {\n if constexpr (glsl::same, float>)\n this->type = GL_FLOAT;\n else if constexpr (glsl::same, int>)\n this->type = GL_INT;\n else if constexpr (glsl::same, uint>)\n this->type = GL_UNSIGNED_INT;\n else\n printf(\"vertex attribute type not given and couldn't be deduced from T in Attribute\\n\");\n }\n }\n\n operator int() { return obj; }\n bool operator!=(const Attribute& other) {\n return obj != other.obj || stride != other.stride || offset != other.offset || type != other.type || normalized != other.normalized;\n }\n};\n"}, {"path": "impl/ssgl.h", "language": "c", "loc": 4, "comment_density": 0.0, "code": "#pragma once\n\n#include \"window.h\"\n#include \"inline_glsl.h\"\n#include \"gl_timing.h\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "MIT", "non_commercial": false, "comment_density": 0.023, "dedup_hash": "9942bbbbbd69206f", "has_readme": true, "build_system": "make", "dependency_count": 31, "has_demo": false} -{"id": "ssgl_utils", "source": "https://github.com/local/ssgl", "source_commit": "4d3f2977620be74782a6523fc950e98c0b7f69bb", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Utils", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "utils/gl_timing.h", "language": "c", "loc": 49, "comment_density": 0.163, "code": "#pragma once\n\n#include \n\n#include \n#include \"glext.h\"\n#include \"loadgl46.h\"\n\n// GPU timing object\nstruct TimeStamp {\n\t// todo: move construct, etc? might want map of string to stamp for global use\n\tGLint64 asynchronous;\n\tGLuint synchronousObject;\n\tmutable GLuint available = GL_FALSE;\n\tmutable GLint64 synchronous;\n\tTimeStamp() {\n\t\t// create GPU query\n\t\tglCreateQueries(GL_TIMESTAMP, 1, &synchronousObject);\n\t\tglQueryCounter(synchronousObject, GL_TIMESTAMP);\n\t\t// query CPU counter directly\n\t\tglGetInteger64v(GL_TIMESTAMP, &asynchronous);\n\t}\n\tvoid check() const {\n\t\twhile (available == GL_FALSE) {\n\t\t\tglGetQueryObjectuiv(synchronousObject, GL_QUERY_RESULT_AVAILABLE, &available);\n\t\t\tif(available == GL_TRUE)\n\t\t\t\tglGetQueryObjecti64v(synchronousObject, GL_QUERY_RESULT, &synchronous);\n\t\t}\n\t}\n\t// latency between CPU call and GPU execution, in ms\n\tdouble latency() const {\n\t\tcheck();\n\t\treturn double(synchronous - asynchronous)*1.0e-6;\n\t}\n\t~TimeStamp() {\n\t\tglDeleteQueries(1, &synchronousObject);\n\t}\n};\n\n// GPU time between two stamps, ms\ninline double operator-(const TimeStamp& end, const TimeStamp& begin) {\n\tbegin.check();\n\tend.check();\n\treturn double(end.synchronous - begin.synchronous)*1.0e-6;\n}\n\n// GPU time between two stamps, ms\ninline double gpuTime(const TimeStamp& begin, const TimeStamp& end) {\n\treturn end - begin;\n}\n\n// CPU-side time between two stamps, ms\ninline double cpuTime(const TimeStamp& begin, const TimeStamp& end) {\n\treturn double(end.asynchronous - begin.asynchronous)*1.0e-6;\n}\n"}, {"path": "utils/glext.h", "language": "c", "loc": 12484, "comment_density": 0.065}, {"path": "utils/loadgl46.cpp", "language": "cpp", "loc": 2312, "comment_density": 0.0}, {"path": "utils/loadgl46.h", "language": "c", "loc": 767, "comment_density": 0.0, "code": "#pragma once\nint loadgl();\nvoid unloadgl();\nextern PFNGLDRAWRANGEELEMENTSPROC ptr_glDrawRangeElements; void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);\nextern PFNGLTEXIMAGE3DPROC ptr_glTexImage3D; void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXSUBIMAGE3DPROC ptr_glTexSubImage3D; void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);\nextern PFNGLCOPYTEXSUBIMAGE3DPROC ptr_glCopyTexSubImage3D; void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLACTIVETEXTUREPROC ptr_glActiveTexture; void glActiveTexture(GLenum texture);\nextern PFNGLSAMPLECOVERAGEPROC ptr_glSampleCoverage; void glSampleCoverage(GLfloat value, GLboolean invert);\nextern PFNGLCOMPRESSEDTEXIMAGE3DPROC ptr_glCompressedTexImage3D; void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXIMAGE2DPROC ptr_glCompressedTexImage2D; void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXIMAGE1DPROC ptr_glCompressedTexImage1D; void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC ptr_glCompressedTexSubImage3D; void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC ptr_glCompressedTexSubImage2D; void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC ptr_glCompressedTexSubImage1D; void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLGETCOMPRESSEDTEXIMAGEPROC ptr_glGetCompressedTexImage; void glGetCompressedTexImage(GLenum target, GLint level, void *img);\nextern PFNGLCLIENTACTIVETEXTUREPROC ptr_glClientActiveTexture; void glClientActiveTexture(GLenum texture);\nextern PFNGLMULTITEXCOORD1DPROC ptr_glMultiTexCoord1d; void glMultiTexCoord1d(GLenum target, GLdouble s);\nextern PFNGLMULTITEXCOORD1DVPROC ptr_glMultiTexCoord1dv; void glMultiTexCoord1dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD1FPROC ptr_glMultiTexCoord1f; void glMultiTexCoord1f(GLenum target, GLfloat s);\nextern PFNGLMULTITEXCOORD1FVPROC ptr_glMultiTexCoord1fv; void glMultiTexCoord1fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD1IPROC ptr_glMultiTexCoord1i; void glMultiTexCoord1i(GLenum target, GLint s);\nextern PFNGLMULTITEXCOORD1IVPROC ptr_glMultiTexCoord1iv; void glMultiTexCoord1iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD1SPROC ptr_glMultiTexCoord1s; void glMultiTexCoord1s(GLenum target, GLshort s);\nextern PFNGLMULTITEXCOORD1SVPROC ptr_glMultiTexCoord1sv; void glMultiTexCoord1sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD2DPROC ptr_glMultiTexCoord2d; void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);\nextern PFNGLMULTITEXCOORD2DVPROC ptr_glMultiTexCoord2dv; void glMultiTexCoord2dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD2FPROC ptr_glMultiTexCoord2f; void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);\nextern PFNGLMULTITEXCOORD2FVPROC ptr_glMultiTexCoord2fv; void glMultiTexCoord2fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD2IPROC ptr_glMultiTexCoord2i; void glMultiTexCoord2i(GLenum target, GLint s, GLint t);\nextern PFNGLMULTITEXCOORD2IVPROC ptr_glMultiTexCoord2iv; void glMultiTexCoord2iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD2SPROC ptr_glMultiTexCoord2s; void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);\nextern PFNGLMULTITEXCOORD2SVPROC ptr_glMultiTexCoord2sv; void glMultiTexCoord2sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD3DPROC ptr_glMultiTexCoord3d; void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);\nextern PFNGLMULTITEXCOORD3DVPROC ptr_glMultiTexCoord3dv; void glMultiTexCoord3dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD3FPROC ptr_glMultiTexCoord3f; void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);\nextern PFNGLMULTITEXCOORD3FVPROC ptr_glMultiTexCoord3fv; void glMultiTexCoord3fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD3IPROC ptr_glMultiTexCoord3i; void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);\nextern PFNGLMULTITEXCOORD3IVPROC ptr_glMultiTexCoord3iv; void glMultiTexCoord3iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD3SPROC ptr_glMultiTexCoord3s; void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);\nextern PFNGLMULTITEXCOORD3SVPROC ptr_glMultiTexCoord3sv; void glMultiTexCoord3sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD4DPROC ptr_glMultiTexCoord4d; void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\nextern PFNGLMULTITEXCOORD4DVPROC ptr_glMultiTexCoord4dv; void glMultiTexCoord4dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD4FPROC ptr_glMultiTexCoord4f; void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\nextern PFNGLMULTITEXCOORD4FVPROC ptr_glMultiTexCoord4fv; void glMultiTexCoord4fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD4IPROC ptr_glMultiTexCoord4i; void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);\nextern PFNGLMULTITEXCOORD4IVPROC ptr_glMultiTexCoord4iv; void glMultiTexCoord4iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD4SPROC ptr_glMultiTexCoord4s; void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\nextern PFNGLMULTITEXCOORD4SVPROC ptr_glMultiTexCoord4sv; void glMultiTexCoord4sv(GLenum target, const GLshort *v);\nextern PFNGLLOADTRANSPOSEMATRIXFPROC ptr_glLoadTransposeMatrixf; void glLoadTransposeMatrixf(const GLfloat *m);\nextern PFNGLLOADTRANSPOSEMATRIXDPROC ptr_glLoadTransposeMatrixd; void glLoadTransposeMatrixd(const GLdouble *m);\nextern PFNGLMULTTRANSPOSEMATRIXFPROC ptr_glMultTransposeMatrixf; void glMultTransposeMatrixf(const GLfloat *m);\nextern PFNGLMULTTRANSPOSEMATRIXDPROC ptr_glMultTransposeMatrixd; void glMultTransposeMatrixd(const GLdouble *m);\nextern PFNGLBLENDFUNCSEPARATEPROC ptr_glBlendFuncSeparate; void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\nextern PFNGLMULTIDRAWARRAYSPROC ptr_glMultiDrawArrays; void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\nextern PFNGLMULTIDRAWELEMENTSPROC ptr_glMultiDrawElements; void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);\nextern PFNGLPOINTPARAMETERFPROC ptr_glPointParameterf; void glPointParameterf(GLenum pname, GLfloat param);\nextern PFNGLPOINTPARAMETERFVPROC ptr_glPointParameterfv; void glPointParameterfv(GLenum pname, const GLfloat *params);\nextern PFNGLPOINTPARAMETERIPROC ptr_glPointParameteri; void glPointParameteri(GLenum pname, GLint param);\nextern PFNGLPOINTPARAMETERIVPROC ptr_glPointParameteriv; void glPointParameteriv(GLenum pname, const GLint *params);\nextern PFNGLFOGCOORDFPROC ptr_glFogCoordf; void glFogCoordf(GLfloat coord);\nextern PFNGLFOGCOORDFVPROC ptr_glFogCoordfv; void glFogCoordfv(const GLfloat *coord);\nextern PFNGLFOGCOORDDPROC ptr_glFogCoordd; void glFogCoordd(GLdouble coord);\nextern PFNGLFOGCOORDDVPROC ptr_glFogCoorddv; void glFogCoorddv(const GLdouble *coord);\nextern PFNGLFOGCOORDPOINTERPROC ptr_glFogCoordPointer; void glFogCoordPointer(GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLSECONDARYCOLOR3BPROC ptr_glSecondaryColor3b; void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);\nextern PFNGLSECONDARYCOLOR3BVPROC ptr_glSecondaryColor3bv; void glSecondaryColor3bv(const GLbyte *v);\nextern PFNGLSECONDARYCOLOR3DPROC ptr_glSecondaryColor3d; void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);\nextern PFNGLSECONDARYCOLOR3DVPROC ptr_glSecondaryColor3dv; void glSecondaryColor3dv(const GLdouble *v);\nextern PFNGLSECONDARYCOLOR3FPROC ptr_glSecondaryColor3f; void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);\nextern PFNGLSECONDARYCOLOR3FVPROC ptr_glSecondaryColor3fv; void glSecondaryColor3fv(const GLfloat *v);\nextern PFNGLSECONDARYCOLOR3IPROC ptr_glSecondaryColor3i; void glSecondaryColor3i(GLint red, GLint green, GLint blue);\nextern PFNGLSECONDARYCOLOR3IVPROC ptr_glSecondaryColor3iv; void glSecondaryColor3iv(const GLint *v);\nextern PFNGLSECONDARYCOLOR3SPROC ptr_glSecondaryColor3s; void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);\nextern PFNGLSECONDARYCOLOR3SVPROC ptr_glSecondaryColor3sv; void glSecondaryColor3sv(const GLshort *v);\nextern PFNGLSECONDARYCOLOR3UBPROC ptr_glSecondaryColor3ub; void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);\nextern PFNGLSECONDARYCOLOR3UBVPROC ptr_glSecondaryColor3ubv; void glSecondaryColor3ubv(const GLubyte *v);\nextern PFNGLSECONDARYCOLOR3UIPROC ptr_glSecondaryColor3ui; void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);\nextern PFNGLSECONDARYCOLOR3UIVPROC ptr_glSecondaryColor3uiv; void glSecondaryColor3uiv(const GLuint *v);\nextern PFNGLSECONDARYCOLOR3USPROC ptr_glSecondaryColor3us; void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);\nextern PFNGLSECONDARYCOLOR3USVPROC ptr_glSecondaryColor3usv; void glSecondaryColor3usv(const GLushort *v);\nextern PFNGLSECONDARYCOLORPOINTERPROC ptr_glSecondaryColorPointer; void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLWINDOWPOS2DPROC ptr_glWindowPos2d; void glWindowPos2d(GLdouble x, GLdouble y);\nextern PFNGLWINDOWPOS2DVPROC ptr_glWindowPos2dv; void glWindowPos2dv(const GLdouble *v);\nextern PFNGLWINDOWPOS2FPROC ptr_glWindowPos2f; void glWindowPos2f(GLfloat x, GLfloat y);\nextern PFNGLWINDOWPOS2FVPROC ptr_glWindowPos2fv; void glWindowPos2fv(const GLfloat *v);\nextern PFNGLWINDOWPOS2IPROC ptr_glWindowPos2i; void glWindowPos2i(GLint x, GLint y);\nextern PFNGLWINDOWPOS2IVPROC ptr_glWindowPos2iv; void glWindowPos2iv(const GLint *v);\nextern PFNGLWINDOWPOS2SPROC ptr_glWindowPos2s; void glWindowPos2s(GLshort x, GLshort y);\nextern PFNGLWINDOWPOS2SVPROC ptr_glWindowPos2sv; void glWindowPos2sv(const GLshort *v);\nextern PFNGLWINDOWPOS3DPROC ptr_glWindowPos3d; void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLWINDOWPOS3DVPROC ptr_glWindowPos3dv; void glWindowPos3dv(const GLdouble *v);\nextern PFNGLWINDOWPOS3FPROC ptr_glWindowPos3f; void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);\nextern PFNGLWINDOWPOS3FVPROC ptr_glWindowPos3fv; void glWindowPos3fv(const GLfloat *v);\nextern PFNGLWINDOWPOS3IPROC ptr_glWindowPos3i; void glWindowPos3i(GLint x, GLint y, GLint z);\nextern PFNGLWINDOWPOS3IVPROC ptr_glWindowPos3iv; void glWindowPos3iv(const GLint *v);\nextern PFNGLWINDOWPOS3SPROC ptr_glWindowPos3s; void glWindowPos3s(GLshort x, GLshort y, GLshort z);\nextern PFNGLWINDOWPOS3SVPROC ptr_glWindowPos3sv; void glWindowPos3sv(const GLshort *v);\nextern PFNGLBLENDCOLORPROC ptr_glBlendColor; void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nextern PFNGLBLENDEQUATIONPROC ptr_glBlendEquation; void glBlendEquation(GLenum mode);\nextern PFNGLGENQUERIESPROC ptr_glGenQueries; void glGenQueries(GLsizei n, GLuint *ids);\nextern PFNGLDELETEQUERIESPROC ptr_glDeleteQueries; void glDeleteQueries(GLsizei n, const GLuint *ids);\nextern PFNGLISQUERYPROC ptr_glIsQuery; GLboolean glIsQuery(GLuint id);\nextern PFNGLBEGINQUERYPROC ptr_glBeginQuery; void glBeginQuery(GLenum target, GLuint id);\nextern PFNGLENDQUERYPROC ptr_glEndQuery; void glEndQuery(GLenum target);\nextern PFNGLGETQUERYIVPROC ptr_glGetQueryiv; void glGetQueryiv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETQUERYOBJECTIVPROC ptr_glGetQueryObjectiv; void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);\nextern PFNGLGETQUERYOBJECTUIVPROC ptr_glGetQueryObjectuiv; void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);\nextern PFNGLBINDBUFFERPROC ptr_glBindBuffer; void glBindBuffer(GLenum target, GLuint buffer);\nextern PFNGLDELETEBUFFERSPROC ptr_glDeleteBuffers; void glDeleteBuffers(GLsizei n, const GLuint *buffers);\nextern PFNGLGENBUFFERSPROC ptr_glGenBuffers; void glGenBuffers(GLsizei n, GLuint *buffers);\nextern PFNGLISBUFFERPROC ptr_glIsBuffer; GLboolean glIsBuffer(GLuint buffer);\nextern PFNGLBUFFERDATAPROC ptr_glBufferData; void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);\nextern PFNGLBUFFERSUBDATAPROC ptr_glBufferSubData; void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);\nextern PFNGLGETBUFFERSUBDATAPROC ptr_glGetBufferSubData; void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data);\nextern PFNGLMAPBUFFERPROC ptr_glMapBuffer; void * glMapBuffer(GLenum target, GLenum access);\nextern PFNGLUNMAPBUFFERPROC ptr_glUnmapBuffer; GLboolean glUnmapBuffer(GLenum target);\nextern PFNGLGETBUFFERPARAMETERIVPROC ptr_glGetBufferParameteriv; void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETBUFFERPOINTERVPROC ptr_glGetBufferPointerv; void glGetBufferPointerv(GLenum target, GLenum pname, void **params);\nextern PFNGLBLENDEQUATIONSEPARATEPROC ptr_glBlendEquationSeparate; void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);\nextern PFNGLDRAWBUFFERSPROC ptr_glDrawBuffers; void glDrawBuffers(GLsizei n, const GLenum *bufs);\nextern PFNGLSTENCILOPSEPARATEPROC ptr_glStencilOpSeparate; void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\nextern PFNGLSTENCILFUNCSEPARATEPROC ptr_glStencilFuncSeparate; void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);\nextern PFNGLSTENCILMASKSEPARATEPROC ptr_glStencilMaskSeparate; void glStencilMaskSeparate(GLenum face, GLuint mask);\nextern PFNGLATTACHSHADERPROC ptr_glAttachShader; void glAttachShader(GLuint program, GLuint shader);\nextern PFNGLBINDATTRIBLOCATIONPROC ptr_glBindAttribLocation; void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);\nextern PFNGLCOMPILESHADERPROC ptr_glCompileShader; void glCompileShader(GLuint shader);\nextern PFNGLCREATEPROGRAMPROC ptr_glCreateProgram; GLuint glCreateProgram(void);\nextern PFNGLCREATESHADERPROC ptr_glCreateShader; GLuint glCreateShader(GLenum type);\nextern PFNGLDELETEPROGRAMPROC ptr_glDeleteProgram; void glDeleteProgram(GLuint program);\nextern PFNGLDELETESHADERPROC ptr_glDeleteShader; void glDeleteShader(GLuint shader);\nextern PFNGLDETACHSHADERPROC ptr_glDetachShader; void glDetachShader(GLuint program, GLuint shader);\nextern PFNGLDISABLEVERTEXATTRIBARRAYPROC ptr_glDisableVertexAttribArray; void glDisableVertexAttribArray(GLuint index);\nextern PFNGLENABLEVERTEXATTRIBARRAYPROC ptr_glEnableVertexAttribArray; void glEnableVertexAttribArray(GLuint index);\nextern PFNGLGETACTIVEATTRIBPROC ptr_glGetActiveAttrib; void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\nextern PFNGLGETACTIVEUNIFORMPROC ptr_glGetActiveUniform; void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\nextern PFNGLGETATTACHEDSHADERSPROC ptr_glGetAttachedShaders; void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);\nextern PFNGLGETATTRIBLOCATIONPROC ptr_glGetAttribLocation; GLint glGetAttribLocation(GLuint program, const GLchar *name);\nextern PFNGLGETPROGRAMIVPROC ptr_glGetProgramiv; void glGetProgramiv(GLuint program, GLenum pname, GLint *params);\nextern PFNGLGETPROGRAMINFOLOGPROC ptr_glGetProgramInfoLog; void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLGETSHADERIVPROC ptr_glGetShaderiv; void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);\nextern PFNGLGETSHADERINFOLOGPROC ptr_glGetShaderInfoLog; void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLGETSHADERSOURCEPROC ptr_glGetShaderSource; void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);\nextern PFNGLGETUNIFORMLOCATIONPROC ptr_glGetUniformLocation; GLint glGetUniformLocation(GLuint program, const GLchar *name);\nextern PFNGLGETUNIFORMFVPROC ptr_glGetUniformfv; void glGetUniformfv(GLuint program, GLint location, GLfloat *params);\nextern PFNGLGETUNIFORMIVPROC ptr_glGetUniformiv; void glGetUniformiv(GLuint program, GLint location, GLint *params);\nextern PFNGLGETVERTEXATTRIBDVPROC ptr_glGetVertexAttribdv; void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);\nextern PFNGLGETVERTEXATTRIBFVPROC ptr_glGetVertexAttribfv; void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);\nextern PFNGLGETVERTEXATTRIBIVPROC ptr_glGetVertexAttribiv; void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);\nextern PFNGLGETVERTEXATTRIBPOINTERVPROC ptr_glGetVertexAttribPointerv; void glGetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer);\nextern PFNGLISPROGRAMPROC ptr_glIsProgram; GLboolean glIsProgram(GLuint program);\nextern PFNGLISSHADERPROC ptr_glIsShader; GLboolean glIsShader(GLuint shader);\nextern PFNGLLINKPROGRAMPROC ptr_glLinkProgram; void glLinkProgram(GLuint program);\nextern PFNGLSHADERSOURCEPROC ptr_glShaderSource; void glShaderSource(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);\nextern PFNGLUSEPROGRAMPROC ptr_glUseProgram; void glUseProgram(GLuint program);\nextern PFNGLUNIFORM1FPROC ptr_glUniform1f; void glUniform1f(GLint location, GLfloat v0);\nextern PFNGLUNIFORM2FPROC ptr_glUniform2f; void glUniform2f(GLint location, GLfloat v0, GLfloat v1);\nextern PFNGLUNIFORM3FPROC ptr_glUniform3f; void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\nextern PFNGLUNIFORM4FPROC ptr_glUniform4f; void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\nextern PFNGLUNIFORM1IPROC ptr_glUniform1i; void glUniform1i(GLint location, GLint v0);\nextern PFNGLUNIFORM2IPROC ptr_glUniform2i; void glUniform2i(GLint location, GLint v0, GLint v1);\nextern PFNGLUNIFORM3IPROC ptr_glUniform3i; void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);\nextern PFNGLUNIFORM4IPROC ptr_glUniform4i; void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\nextern PFNGLUNIFORM1FVPROC ptr_glUniform1fv; void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM2FVPROC ptr_glUniform2fv; void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM3FVPROC ptr_glUniform3fv; void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM4FVPROC ptr_glUniform4fv; void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM1IVPROC ptr_glUniform1iv; void glUniform1iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM2IVPROC ptr_glUniform2iv; void glUniform2iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM3IVPROC ptr_glUniform3iv; void glUniform3iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM4IVPROC ptr_glUniform4iv; void glUniform4iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORMMATRIX2FVPROC ptr_glUniformMatrix2fv; void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3FVPROC ptr_glUniformMatrix3fv; void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4FVPROC ptr_glUniformMatrix4fv; void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLVALIDATEPROGRAMPROC ptr_glValidateProgram; void glValidateProgram(GLuint program);\nextern PFNGLVERTEXATTRIB1DPROC ptr_glVertexAttrib1d; void glVertexAttrib1d(GLuint index, GLdouble x);\nextern PFNGLVERTEXATTRIB1DVPROC ptr_glVertexAttrib1dv; void glVertexAttrib1dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB1FPROC ptr_glVertexAttrib1f; void glVertexAttrib1f(GLuint index, GLfloat x);\nextern PFNGLVERTEXATTRIB1FVPROC ptr_glVertexAttrib1fv; void glVertexAttrib1fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB1SPROC ptr_glVertexAttrib1s; void glVertexAttrib1s(GLuint index, GLshort x);\nextern PFNGLVERTEXATTRIB1SVPROC ptr_glVertexAttrib1sv; void glVertexAttrib1sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB2DPROC ptr_glVertexAttrib2d; void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);\nextern PFNGLVERTEXATTRIB2DVPROC ptr_glVertexAttrib2dv; void glVertexAttrib2dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB2FPROC ptr_glVertexAttrib2f; void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);\nextern PFNGLVERTEXATTRIB2FVPROC ptr_glVertexAttrib2fv; void glVertexAttrib2fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB2SPROC ptr_glVertexAttrib2s; void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);\nextern PFNGLVERTEXATTRIB2SVPROC ptr_glVertexAttrib2sv; void glVertexAttrib2sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB3DPROC ptr_glVertexAttrib3d; void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLVERTEXATTRIB3DVPROC ptr_glVertexAttrib3dv; void glVertexAttrib3dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB3FPROC ptr_glVertexAttrib3f; void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);\nextern PFNGLVERTEXATTRIB3FVPROC ptr_glVertexAttrib3fv; void glVertexAttrib3fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB3SPROC ptr_glVertexAttrib3s; void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);\nextern PFNGLVERTEXATTRIB3SVPROC ptr_glVertexAttrib3sv; void glVertexAttrib3sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4NBVPROC ptr_glVertexAttrib4Nbv; void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIB4NIVPROC ptr_glVertexAttrib4Niv; void glVertexAttrib4Niv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIB4NSVPROC ptr_glVertexAttrib4Nsv; void glVertexAttrib4Nsv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4NUBPROC ptr_glVertexAttrib4Nub; void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\nextern PFNGLVERTEXATTRIB4NUBVPROC ptr_glVertexAttrib4Nubv; void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIB4NUIVPROC ptr_glVertexAttrib4Nuiv; void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIB4NUSVPROC ptr_glVertexAttrib4Nusv; void glVertexAttrib4Nusv(GLuint index, const GLushort *v);\nextern PFNGLVERTEXATTRIB4BVPROC ptr_glVertexAttrib4bv; void glVertexAttrib4bv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIB4DPROC ptr_glVertexAttrib4d; void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLVERTEXATTRIB4DVPROC ptr_glVertexAttrib4dv; void glVertexAttrib4dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB4FPROC ptr_glVertexAttrib4f; void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nextern PFNGLVERTEXATTRIB4FVPROC ptr_glVertexAttrib4fv; void glVertexAttrib4fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB4IVPROC ptr_glVertexAttrib4iv; void glVertexAttrib4iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIB4SPROC ptr_glVertexAttrib4s; void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\nextern PFNGLVERTEXATTRIB4SVPROC ptr_glVertexAttrib4sv; void glVertexAttrib4sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4UBVPROC ptr_glVertexAttrib4ubv; void glVertexAttrib4ubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIB4UIVPROC ptr_glVertexAttrib4uiv; void glVertexAttrib4uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIB4USVPROC ptr_glVertexAttrib4usv; void glVertexAttrib4usv(GLuint index, const GLushort *v);\nextern PFNGLVERTEXATTRIBPOINTERPROC ptr_glVertexAttribPointer; void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);\nextern PFNGLUNIFORMMATRIX2X3FVPROC ptr_glUniformMatrix2x3fv; void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3X2FVPROC ptr_glUniformMatrix3x2fv; void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX2X4FVPROC ptr_glUniformMatrix2x4fv; void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4X2FVPROC ptr_glUniformMatrix4x2fv; void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3X4FVPROC ptr_glUniformMatrix3x4fv; void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4X3FVPROC ptr_glUniformMatrix4x3fv; void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLCOLORMASKIPROC ptr_glColorMaski; void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\nextern PFNGLGETBOOLEANI_VPROC ptr_glGetBooleani_v; void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);\nextern PFNGLGETINTEGERI_VPROC ptr_glGetIntegeri_v; void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);\nextern PFNGLENABLEIPROC ptr_glEnablei; void glEnablei(GLenum target, GLuint index);\nextern PFNGLDISABLEIPROC ptr_glDisablei; void glDisablei(GLenum target, GLuint index);\nextern PFNGLISENABLEDIPROC ptr_glIsEnabledi; GLboolean glIsEnabledi(GLenum target, GLuint index);\nextern PFNGLBEGINTRANSFORMFEEDBACKPROC ptr_glBeginTransformFeedback; void glBeginTransformFeedback(GLenum primitiveMode);\nextern PFNGLENDTRANSFORMFEEDBACKPROC ptr_glEndTransformFeedback; void glEndTransformFeedback(void);\nextern PFNGLBINDBUFFERRANGEPROC ptr_glBindBufferRange; void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLBINDBUFFERBASEPROC ptr_glBindBufferBase; void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);\nextern PFNGLTRANSFORMFEEDBACKVARYINGSPROC ptr_glTransformFeedbackVaryings; void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);\nextern PFNGLGETTRANSFORMFEEDBACKVARYINGPROC ptr_glGetTransformFeedbackVarying; void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\nextern PFNGLCLAMPCOLORPROC ptr_glClampColor; void glClampColor(GLenum target, GLenum clamp);\nextern PFNGLBEGINCONDITIONALRENDERPROC ptr_glBeginConditionalRender; void glBeginConditionalRender(GLuint id, GLenum mode);\nextern PFNGLENDCONDITIONALRENDERPROC ptr_glEndConditionalRender; void glEndConditionalRender(void);\nextern PFNGLVERTEXATTRIBIPOINTERPROC ptr_glVertexAttribIPointer; void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLGETVERTEXATTRIBIIVPROC ptr_glGetVertexAttribIiv; void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);\nextern PFNGLGETVERTEXATTRIBIUIVPROC ptr_glGetVertexAttribIuiv; void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);\nextern PFNGLVERTEXATTRIBI1IPROC ptr_glVertexAttribI1i; void glVertexAttribI1i(GLuint index, GLint x);\nextern PFNGLVERTEXATTRIBI2IPROC ptr_glVertexAttribI2i; void glVertexAttribI2i(GLuint index, GLint x, GLint y);\nextern PFNGLVERTEXATTRIBI3IPROC ptr_glVertexAttribI3i; void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);\nextern PFNGLVERTEXATTRIBI4IPROC ptr_glVertexAttribI4i; void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);\nextern PFNGLVERTEXATTRIBI1UIPROC ptr_glVertexAttribI1ui; void glVertexAttribI1ui(GLuint index, GLuint x);\nextern PFNGLVERTEXATTRIBI2UIPROC ptr_glVertexAttribI2ui; void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);\nextern PFNGLVERTEXATTRIBI3UIPROC ptr_glVertexAttribI3ui; void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);\nextern PFNGLVERTEXATTRIBI4UIPROC ptr_glVertexAttribI4ui; void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\nextern PFNGLVERTEXATTRIBI1IVPROC ptr_glVertexAttribI1iv; void glVertexAttribI1iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI2IVPROC ptr_glVertexAttribI2iv; void glVertexAttribI2iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI3IVPROC ptr_glVertexAttribI3iv; void glVertexAttribI3iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI4IVPROC ptr_glVertexAttribI4iv; void glVertexAttribI4iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI1UIVPROC ptr_glVertexAttribI1uiv; void glVertexAttribI1uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI2UIVPROC ptr_glVertexAttribI2uiv; void glVertexAttribI2uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI3UIVPROC ptr_glVertexAttribI3uiv; void glVertexAttribI3uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI4UIVPROC ptr_glVertexAttribI4uiv; void glVertexAttribI4uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI4BVPROC ptr_glVertexAttribI4bv; void glVertexAttribI4bv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIBI4SVPROC ptr_glVertexAttribI4sv; void glVertexAttribI4sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIBI4UBVPROC ptr_glVertexAttribI4ubv; void glVertexAttribI4ubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIBI4USVPROC ptr_glVertexAttribI4usv; void glVertexAttribI4usv(GLuint index, const GLushort *v);\nextern PFNGLGETUNIFORMUIVPROC ptr_glGetUniformuiv; void glGetUniformuiv(GLuint program, GLint location, GLuint *params);\nextern PFNGLBINDFRAGDATALOCATIONPROC ptr_glBindFragDataLocation; void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);\nextern PFNGLGETFRAGDATALOCATIONPROC ptr_glGetFragDataLocation; GLint glGetFragDataLocation(GLuint program, const GLchar *name);\nextern PFNGLUNIFORM1UIPROC ptr_glUniform1ui; void glUniform1ui(GLint location, GLuint v0);\nextern PFNGLUNIFORM2UIPROC ptr_glUniform2ui; void glUniform2ui(GLint location, GLuint v0, GLuint v1);\nextern PFNGLUNIFORM3UIPROC ptr_glUniform3ui; void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);\nextern PFNGLUNIFORM4UIPROC ptr_glUniform4ui; void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\nextern PFNGLUNIFORM1UIVPROC ptr_glUniform1uiv; void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM2UIVPROC ptr_glUniform2uiv; void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM3UIVPROC ptr_glUniform3uiv; void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM4UIVPROC ptr_glUniform4uiv; void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLTEXPARAMETERIIVPROC ptr_glTexParameterIiv; void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);\nextern PFNGLTEXPARAMETERIUIVPROC ptr_glTexParameterIuiv; void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);\nextern PFNGLGETTEXPARAMETERIIVPROC ptr_glGetTexParameterIiv; void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETTEXPARAMETERIUIVPROC ptr_glGetTexParameterIuiv; void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);\nextern PFNGLCLEARBUFFERIVPROC ptr_glClearBufferiv; void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);\nextern PFNGLCLEARBUFFERUIVPROC ptr_glClearBufferuiv; void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);\nextern PFNGLCLEARBUFFERFVPROC ptr_glClearBufferfv; void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);\nextern PFNGLCLEARBUFFERFIPROC ptr_glClearBufferfi; void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);\nextern PFNGLGETSTRINGIPROC ptr_glGetStringi; const GLubyte * glGetStringi(GLenum name, GLuint index);\nextern PFNGLISRENDERBUFFERPROC ptr_glIsRenderbuffer; GLboolean glIsRenderbuffer(GLuint renderbuffer);\nextern PFNGLBINDRENDERBUFFERPROC ptr_glBindRenderbuffer; void glBindRenderbuffer(GLenum target, GLuint renderbuffer);\nextern PFNGLDELETERENDERBUFFERSPROC ptr_glDeleteRenderbuffers; void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);\nextern PFNGLGENRENDERBUFFERSPROC ptr_glGenRenderbuffers; void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);\nextern PFNGLRENDERBUFFERSTORAGEPROC ptr_glRenderbufferStorage; void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLGETRENDERBUFFERPARAMETERIVPROC ptr_glGetRenderbufferParameteriv; void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLISFRAMEBUFFERPROC ptr_glIsFramebuffer; GLboolean glIsFramebuffer(GLuint framebuffer);\nextern PFNGLBINDFRAMEBUFFERPROC ptr_glBindFramebuffer; void glBindFramebuffer(GLenum target, GLuint framebuffer);\nextern PFNGLDELETEFRAMEBUFFERSPROC ptr_glDeleteFramebuffers; void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);\nextern PFNGLGENFRAMEBUFFERSPROC ptr_glGenFramebuffers; void glGenFramebuffers(GLsizei n, GLuint *framebuffers);\nextern PFNGLCHECKFRAMEBUFFERSTATUSPROC ptr_glCheckFramebufferStatus; GLenum glCheckFramebufferStatus(GLenum target);\nextern PFNGLFRAMEBUFFERTEXTURE1DPROC ptr_glFramebufferTexture1D; void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\nextern PFNGLFRAMEBUFFERTEXTURE2DPROC ptr_glFramebufferTexture2D; void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\nextern PFNGLFRAMEBUFFERTEXTURE3DPROC ptr_glFramebufferTexture3D; void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\nextern PFNGLFRAMEBUFFERRENDERBUFFERPROC ptr_glFramebufferRenderbuffer; void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\nextern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC ptr_glGetFramebufferAttachmentParameteriv; void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);\nextern PFNGLGENERATEMIPMAPPROC ptr_glGenerateMipmap; void glGenerateMipmap(GLenum target);\nextern PFNGLBLITFRAMEBUFFERPROC ptr_glBlitFramebuffer; void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\nextern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC ptr_glRenderbufferStorageMultisample; void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLFRAMEBUFFERTEXTURELAYERPROC ptr_glFramebufferTextureLayer; void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\nextern PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);\nextern PFNGLFLUSHMAPPEDBUFFERRANGEPROC ptr_glFlushMappedBufferRange; void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);\nextern PFNGLBINDVERTEXARRAYPROC ptr_glBindVertexArray; void glBindVertexArray(GLuint array);\nextern PFNGLDELETEVERTEXARRAYSPROC ptr_glDeleteVertexArrays; void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);\nextern PFNGLGENVERTEXARRAYSPROC ptr_glGenVertexArrays; void glGenVertexArrays(GLsizei n, GLuint *arrays);\nextern PFNGLISVERTEXARRAYPROC ptr_glIsVertexArray; GLboolean glIsVertexArray(GLuint array);\nextern PFNGLDRAWARRAYSINSTANCEDPROC ptr_glDrawArraysInstanced; void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);\nextern PFNGLDRAWELEMENTSINSTANCEDPROC ptr_glDrawElementsInstanced; void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);\nextern PFNGLTEXBUFFERPROC ptr_glTexBuffer; void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);\nextern PFNGLPRIMITIVERESTARTINDEXPROC ptr_glPrimitiveRestartIndex; void glPrimitiveRestartIndex(GLuint index);\nextern PFNGLCOPYBUFFERSUBDATAPROC ptr_glCopyBufferSubData; void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\nextern PFNGLGETUNIFORMINDICESPROC ptr_glGetUniformIndices; void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);\nextern PFNGLGETACTIVEUNIFORMSIVPROC ptr_glGetActiveUniformsiv; void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);\nextern PFNGLGETACTIVEUNIFORMNAMEPROC ptr_glGetActiveUniformName; void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);\nextern PFNGLGETUNIFORMBLOCKINDEXPROC ptr_glGetUniformBlockIndex; GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);\nextern PFNGLGETACTIVEUNIFORMBLOCKIVPROC ptr_glGetActiveUniformBlockiv; void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);\nextern PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC ptr_glGetActiveUniformBlockName; void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);\nextern PFNGLUNIFORMBLOCKBINDINGPROC ptr_glUniformBlockBinding; void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);\nextern PFNGLDRAWELEMENTSBASEVERTEXPROC ptr_glDrawElementsBaseVertex; void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);\nextern PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC ptr_glDrawRangeElementsBaseVertex; void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC ptr_glDrawElementsInstancedBaseVertex; void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);\nextern PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC ptr_glMultiDrawElementsBaseVertex; void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);\nextern PFNGLPROVOKINGVERTEXPROC ptr_glProvokingVertex; void glProvokingVertex(GLenum mode);\nextern PFNGLFENCESYNCPROC ptr_glFenceSync; GLsync glFenceSync(GLenum condition, GLbitfield flags);\nextern PFNGLISSYNCPROC ptr_glIsSync; GLboolean glIsSync(GLsync sync);\nextern PFNGLDELETESYNCPROC ptr_glDeleteSync; void glDeleteSync(GLsync sync);\nextern PFNGLCLIENTWAITSYNCPROC ptr_glClientWaitSync; GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);\nextern PFNGLWAITSYNCPROC ptr_glWaitSync; void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);\nextern PFNGLGETINTEGER64VPROC ptr_glGetInteger64v; void glGetInteger64v(GLenum pname, GLint64 *data);\nextern PFNGLGETSYNCIVPROC ptr_glGetSynciv; void glGetSynciv(GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values);\nextern PFNGLGETINTEGER64I_VPROC ptr_glGetInteger64i_v; void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);\nextern PFNGLGETBUFFERPARAMETERI64VPROC ptr_glGetBufferParameteri64v; void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);\nextern PFNGLFRAMEBUFFERTEXTUREPROC ptr_glFramebufferTexture; void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);\nextern PFNGLTEXIMAGE2DMULTISAMPLEPROC ptr_glTexImage2DMultisample; void glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXIMAGE3DMULTISAMPLEPROC ptr_glTexImage3DMultisample; void glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLGETMULTISAMPLEFVPROC ptr_glGetMultisamplefv; void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);\nextern PFNGLSAMPLEMASKIPROC ptr_glSampleMaski; void glSampleMaski(GLuint maskNumber, GLbitfield mask);\nextern PFNGLBINDFRAGDATALOCATIONINDEXEDPROC ptr_glBindFragDataLocationIndexed; void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);\nextern PFNGLGETFRAGDATAINDEXPROC ptr_glGetFragDataIndex; GLint glGetFragDataIndex(GLuint program, const GLchar *name);\nextern PFNGLGENSAMPLERSPROC ptr_glGenSamplers; void glGenSamplers(GLsizei count, GLuint *samplers);\nextern PFNGLDELETESAMPLERSPROC ptr_glDeleteSamplers; void glDeleteSamplers(GLsizei count, const GLuint *samplers);\nextern PFNGLISSAMPLERPROC ptr_glIsSampler; GLboolean glIsSampler(GLuint sampler);\nextern PFNGLBINDSAMPLERPROC ptr_glBindSampler; void glBindSampler(GLuint unit, GLuint sampler);\nextern PFNGLSAMPLERPARAMETERIPROC ptr_glSamplerParameteri; void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);\nextern PFNGLSAMPLERPARAMETERIVPROC ptr_glSamplerParameteriv; void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);\nextern PFNGLSAMPLERPARAMETERFPROC ptr_glSamplerParameterf; void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);\nextern PFNGLSAMPLERPARAMETERFVPROC ptr_glSamplerParameterfv; void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);\nextern PFNGLSAMPLERPARAMETERIIVPROC ptr_glSamplerParameterIiv; void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);\nextern PFNGLSAMPLERPARAMETERIUIVPROC ptr_glSamplerParameterIuiv; void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);\nextern PFNGLGETSAMPLERPARAMETERIVPROC ptr_glGetSamplerParameteriv; void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);\nextern PFNGLGETSAMPLERPARAMETERIIVPROC ptr_glGetSamplerParameterIiv; void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);\nextern PFNGLGETSAMPLERPARAMETERFVPROC ptr_glGetSamplerParameterfv; void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);\nextern PFNGLGETSAMPLERPARAMETERIUIVPROC ptr_glGetSamplerParameterIuiv; void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);\nextern PFNGLQUERYCOUNTERPROC ptr_glQueryCounter; void glQueryCounter(GLuint id, GLenum target);\nextern PFNGLGETQUERYOBJECTI64VPROC ptr_glGetQueryObjecti64v; void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);\nextern PFNGLGETQUERYOBJECTUI64VPROC ptr_glGetQueryObjectui64v; void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);\nextern PFNGLVERTEXATTRIBDIVISORPROC ptr_glVertexAttribDivisor; void glVertexAttribDivisor(GLuint index, GLuint divisor);\nextern PFNGLVERTEXATTRIBP1UIPROC ptr_glVertexAttribP1ui; void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP1UIVPROC ptr_glVertexAttribP1uiv; void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP2UIPROC ptr_glVertexAttribP2ui; void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP2UIVPROC ptr_glVertexAttribP2uiv; void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP3UIPROC ptr_glVertexAttribP3ui; void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP3UIVPROC ptr_glVertexAttribP3uiv; void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP4UIPROC ptr_glVertexAttribP4ui; void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP4UIVPROC ptr_glVertexAttribP4uiv; void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXP2UIPROC ptr_glVertexP2ui; void glVertexP2ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP2UIVPROC ptr_glVertexP2uiv; void glVertexP2uiv(GLenum type, const GLuint *value);\nextern PFNGLVERTEXP3UIPROC ptr_glVertexP3ui; void glVertexP3ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP3UIVPROC ptr_glVertexP3uiv; void glVertexP3uiv(GLenum type, const GLuint *value);\nextern PFNGLVERTEXP4UIPROC ptr_glVertexP4ui; void glVertexP4ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP4UIVPROC ptr_glVertexP4uiv; void glVertexP4uiv(GLenum type, const GLuint *value);\nextern PFNGLTEXCOORDP1UIPROC ptr_glTexCoordP1ui; void glTexCoordP1ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP1UIVPROC ptr_glTexCoordP1uiv; void glTexCoordP1uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP2UIPROC ptr_glTexCoordP2ui; void glTexCoordP2ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP2UIVPROC ptr_glTexCoordP2uiv; void glTexCoordP2uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP3UIPROC ptr_glTexCoordP3ui; void glTexCoordP3ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP3UIVPROC ptr_glTexCoordP3uiv; void glTexCoordP3uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP4UIPROC ptr_glTexCoordP4ui; void glTexCoordP4ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP4UIVPROC ptr_glTexCoordP4uiv; void glTexCoordP4uiv(GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP1UIPROC ptr_glMultiTexCoordP1ui; void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP1UIVPROC ptr_glMultiTexCoordP1uiv; void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP2UIPROC ptr_glMultiTexCoordP2ui; void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP2UIVPROC ptr_glMultiTexCoordP2uiv; void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP3UIPROC ptr_glMultiTexCoordP3ui; void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP3UIVPROC ptr_glMultiTexCoordP3uiv; void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP4UIPROC ptr_glMultiTexCoordP4ui; void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP4UIVPROC ptr_glMultiTexCoordP4uiv; void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLNORMALP3UIPROC ptr_glNormalP3ui; void glNormalP3ui(GLenum type, GLuint coords);\nextern PFNGLNORMALP3UIVPROC ptr_glNormalP3uiv; void glNormalP3uiv(GLenum type, const GLuint *coords);\nextern PFNGLCOLORP3UIPROC ptr_glColorP3ui; void glColorP3ui(GLenum type, GLuint color);\nextern PFNGLCOLORP3UIVPROC ptr_glColorP3uiv; void glColorP3uiv(GLenum type, const GLuint *color);\nextern PFNGLCOLORP4UIPROC ptr_glColorP4ui; void glColorP4ui(GLenum type, GLuint color);\nextern PFNGLCOLORP4UIVPROC ptr_glColorP4uiv; void glColorP4uiv(GLenum type, const GLuint *color);\nextern PFNGLSECONDARYCOLORP3UIPROC ptr_glSecondaryColorP3ui; void glSecondaryColorP3ui(GLenum type, GLuint color);\nextern PFNGLSECONDARYCOLORP3UIVPROC ptr_glSecondaryColorP3uiv; void glSecondaryColorP3uiv(GLenum type, const GLuint *color);\nextern PFNGLMINSAMPLESHADINGPROC ptr_glMinSampleShading; void glMinSampleShading(GLfloat value);\nextern PFNGLBLENDEQUATIONIPROC ptr_glBlendEquationi; void glBlendEquationi(GLuint buf, GLenum mode);\nextern PFNGLBLENDEQUATIONSEPARATEIPROC ptr_glBlendEquationSeparatei; void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);\nextern PFNGLBLENDFUNCIPROC ptr_glBlendFunci; void glBlendFunci(GLuint buf, GLenum src, GLenum dst);\nextern PFNGLBLENDFUNCSEPARATEIPROC ptr_glBlendFuncSeparatei; void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\nextern PFNGLDRAWARRAYSINDIRECTPROC ptr_glDrawArraysIndirect; void glDrawArraysIndirect(GLenum mode, const void *indirect);\nextern PFNGLDRAWELEMENTSINDIRECTPROC ptr_glDrawElementsIndirect; void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);\nextern PFNGLUNIFORM1DPROC ptr_glUniform1d; void glUniform1d(GLint location, GLdouble x);\nextern PFNGLUNIFORM2DPROC ptr_glUniform2d; void glUniform2d(GLint location, GLdouble x, GLdouble y);\nextern PFNGLUNIFORM3DPROC ptr_glUniform3d; void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLUNIFORM4DPROC ptr_glUniform4d; void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLUNIFORM1DVPROC ptr_glUniform1dv; void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM2DVPROC ptr_glUniform2dv; void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM3DVPROC ptr_glUniform3dv; void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM4DVPROC ptr_glUniform4dv; void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2DVPROC ptr_glUniformMatrix2dv; void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3DVPROC ptr_glUniformMatrix3dv; void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4DVPROC ptr_glUniformMatrix4dv; void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2X3DVPROC ptr_glUniformMatrix2x3dv; void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2X4DVPROC ptr_glUniformMatrix2x4dv; void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3X2DVPROC ptr_glUniformMatrix3x2dv; void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3X4DVPROC ptr_glUniformMatrix3x4dv; void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4X2DVPROC ptr_glUniformMatrix4x2dv; void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4X3DVPROC ptr_glUniformMatrix4x3dv; void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLGETUNIFORMDVPROC ptr_glGetUniformdv; void glGetUniformdv(GLuint program, GLint location, GLdouble *params);\nextern PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC ptr_glGetSubroutineUniformLocation; GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);\nextern PFNGLGETSUBROUTINEINDEXPROC ptr_glGetSubroutineIndex; GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);\nextern PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC ptr_glGetActiveSubroutineUniformiv; void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);\nextern PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC ptr_glGetActiveSubroutineUniformName; void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLGETACTIVESUBROUTINENAMEPROC ptr_glGetActiveSubroutineName; void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLUNIFORMSUBROUTINESUIVPROC ptr_glUniformSubroutinesuiv; void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);\nextern PFNGLGETUNIFORMSUBROUTINEUIVPROC ptr_glGetUniformSubroutineuiv; void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);\nextern PFNGLGETPROGRAMSTAGEIVPROC ptr_glGetProgramStageiv; void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);\nextern PFNGLPATCHPARAMETERIPROC ptr_glPatchParameteri; void glPatchParameteri(GLenum pname, GLint value);\nextern PFNGLPATCHPARAMETERFVPROC ptr_glPatchParameterfv; void glPatchParameterfv(GLenum pname, const GLfloat *values);\nextern PFNGLBINDTRANSFORMFEEDBACKPROC ptr_glBindTransformFeedback; void glBindTransformFeedback(GLenum target, GLuint id);\nextern PFNGLDELETETRANSFORMFEEDBACKSPROC ptr_glDeleteTransformFeedbacks; void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);\nextern PFNGLGENTRANSFORMFEEDBACKSPROC ptr_glGenTransformFeedbacks; void glGenTransformFeedbacks(GLsizei n, GLuint *ids);\nextern PFNGLISTRANSFORMFEEDBACKPROC ptr_glIsTransformFeedback; GLboolean glIsTransformFeedback(GLuint id);\nextern PFNGLPAUSETRANSFORMFEEDBACKPROC ptr_glPauseTransformFeedback; void glPauseTransformFeedback(void);\nextern PFNGLRESUMETRANSFORMFEEDBACKPROC ptr_glResumeTransformFeedback; void glResumeTransformFeedback(void);\nextern PFNGLDRAWTRANSFORMFEEDBACKPROC ptr_glDrawTransformFeedback; void glDrawTransformFeedback(GLenum mode, GLuint id);\nextern PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC ptr_glDrawTransformFeedbackStream; void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);\nextern PFNGLBEGINQUERYINDEXEDPROC ptr_glBeginQueryIndexed; void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);\nextern PFNGLENDQUERYINDEXEDPROC ptr_glEndQueryIndexed; void glEndQueryIndexed(GLenum target, GLuint index);\nextern PFNGLGETQUERYINDEXEDIVPROC ptr_glGetQueryIndexediv; void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);\nextern PFNGLRELEASESHADERCOMPILERPROC ptr_glReleaseShaderCompiler; void glReleaseShaderCompiler(void);\nextern PFNGLSHADERBINARYPROC ptr_glShaderBinary; void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length);\nextern PFNGLGETSHADERPRECISIONFORMATPROC ptr_glGetShaderPrecisionFormat; void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);\nextern PFNGLDEPTHRANGEFPROC ptr_glDepthRangef; void glDepthRangef(GLfloat n, GLfloat f);\nextern PFNGLCLEARDEPTHFPROC ptr_glClearDepthf; void glClearDepthf(GLfloat d);\nextern PFNGLGETPROGRAMBINARYPROC ptr_glGetProgramBinary; void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);\nextern PFNGLPROGRAMBINARYPROC ptr_glProgramBinary; void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);\nextern PFNGLPROGRAMPARAMETERIPROC ptr_glProgramParameteri; void glProgramParameteri(GLuint program, GLenum pname, GLint value);\nextern PFNGLUSEPROGRAMSTAGESPROC ptr_glUseProgramStages; void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);\nextern PFNGLACTIVESHADERPROGRAMPROC ptr_glActiveShaderProgram; void glActiveShaderProgram(GLuint pipeline, GLuint program);\nextern PFNGLCREATESHADERPROGRAMVPROC ptr_glCreateShaderProgramv; GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const*strings);\nextern PFNGLBINDPROGRAMPIPELINEPROC ptr_glBindProgramPipeline; void glBindProgramPipeline(GLuint pipeline);\nextern PFNGLDELETEPROGRAMPIPELINESPROC ptr_glDeleteProgramPipelines; void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);\nextern PFNGLGENPROGRAMPIPELINESPROC ptr_glGenProgramPipelines; void glGenProgramPipelines(GLsizei n, GLuint *pipelines);\nextern PFNGLISPROGRAMPIPELINEPROC ptr_glIsProgramPipeline; GLboolean glIsProgramPipeline(GLuint pipeline);\nextern PFNGLGETPROGRAMPIPELINEIVPROC ptr_glGetProgramPipelineiv; void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);\nextern PFNGLPROGRAMUNIFORM1IPROC ptr_glProgramUniform1i; void glProgramUniform1i(GLuint program, GLint location, GLint v0);\nextern PFNGLPROGRAMUNIFORM1IVPROC ptr_glProgramUniform1iv; void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM1FPROC ptr_glProgramUniform1f; void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);\nextern PFNGLPROGRAMUNIFORM1FVPROC ptr_glProgramUniform1fv; void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM1DPROC ptr_glProgramUniform1d; void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);\nextern PFNGLPROGRAMUNIFORM1DVPROC ptr_glProgramUniform1dv; void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM1UIPROC ptr_glProgramUniform1ui; void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);\nextern PFNGLPROGRAMUNIFORM1UIVPROC ptr_glProgramUniform1uiv; void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM2IPROC ptr_glProgramUniform2i; void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);\nextern PFNGLPROGRAMUNIFORM2IVPROC ptr_glProgramUniform2iv; void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM2FPROC ptr_glProgramUniform2f; void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);\nextern PFNGLPROGRAMUNIFORM2FVPROC ptr_glProgramUniform2fv; void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM2DPROC ptr_glProgramUniform2d; void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);\nextern PFNGLPROGRAMUNIFORM2DVPROC ptr_glProgramUniform2dv; void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM2UIPROC ptr_glProgramUniform2ui; void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);\nextern PFNGLPROGRAMUNIFORM2UIVPROC ptr_glProgramUniform2uiv; void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM3IPROC ptr_glProgramUniform3i; void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\nextern PFNGLPROGRAMUNIFORM3IVPROC ptr_glProgramUniform3iv; void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM3FPROC ptr_glProgramUniform3f; void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\nextern PFNGLPROGRAMUNIFORM3FVPROC ptr_glProgramUniform3fv; void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM3DPROC ptr_glProgramUniform3d; void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);\nextern PFNGLPROGRAMUNIFORM3DVPROC ptr_glProgramUniform3dv; void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM3UIPROC ptr_glProgramUniform3ui; void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\nextern PFNGLPROGRAMUNIFORM3UIVPROC ptr_glProgramUniform3uiv; void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM4IPROC ptr_glProgramUniform4i; void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\nextern PFNGLPROGRAMUNIFORM4IVPROC ptr_glProgramUniform4iv; void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM4FPROC ptr_glProgramUniform4f; void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\nextern PFNGLPROGRAMUNIFORM4FVPROC ptr_glProgramUniform4fv; void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM4DPROC ptr_glProgramUniform4d; void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);\nextern PFNGLPROGRAMUNIFORM4DVPROC ptr_glProgramUniform4dv; void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM4UIPROC ptr_glProgramUniform4ui; void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\nextern PFNGLPROGRAMUNIFORM4UIVPROC ptr_glProgramUniform4uiv; void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2FVPROC ptr_glProgramUniformMatrix2fv; void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3FVPROC ptr_glProgramUniformMatrix3fv; void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4FVPROC ptr_glProgramUniformMatrix4fv; void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2DVPROC ptr_glProgramUniformMatrix2dv; void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3DVPROC ptr_glProgramUniformMatrix3dv; void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4DVPROC ptr_glProgramUniformMatrix4dv; void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC ptr_glProgramUniformMatrix2x3fv; void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC ptr_glProgramUniformMatrix3x2fv; void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC ptr_glProgramUniformMatrix2x4fv; void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC ptr_glProgramUniformMatrix4x2fv; void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC ptr_glProgramUniformMatrix3x4fv; void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC ptr_glProgramUniformMatrix4x3fv; void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC ptr_glProgramUniformMatrix2x3dv; void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC ptr_glProgramUniformMatrix3x2dv; void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC ptr_glProgramUniformMatrix2x4dv; void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC ptr_glProgramUniformMatrix4x2dv; void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC ptr_glProgramUniformMatrix3x4dv; void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC ptr_glProgramUniformMatrix4x3dv; void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLVALIDATEPROGRAMPIPELINEPROC ptr_glValidateProgramPipeline; void glValidateProgramPipeline(GLuint pipeline);\nextern PFNGLGETPROGRAMPIPELINEINFOLOGPROC ptr_glGetProgramPipelineInfoLog; void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLVERTEXATTRIBL1DPROC ptr_glVertexAttribL1d; void glVertexAttribL1d(GLuint index, GLdouble x);\nextern PFNGLVERTEXATTRIBL2DPROC ptr_glVertexAttribL2d; void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);\nextern PFNGLVERTEXATTRIBL3DPROC ptr_glVertexAttribL3d; void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLVERTEXATTRIBL4DPROC ptr_glVertexAttribL4d; void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLVERTEXATTRIBL1DVPROC ptr_glVertexAttribL1dv; void glVertexAttribL1dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL2DVPROC ptr_glVertexAttribL2dv; void glVertexAttribL2dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL3DVPROC ptr_glVertexAttribL3dv; void glVertexAttribL3dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL4DVPROC ptr_glVertexAttribL4dv; void glVertexAttribL4dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBLPOINTERPROC ptr_glVertexAttribLPointer; void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLGETVERTEXATTRIBLDVPROC ptr_glGetVertexAttribLdv; void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);\nextern PFNGLVIEWPORTARRAYVPROC ptr_glViewportArrayv; void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);\nextern PFNGLVIEWPORTINDEXEDFPROC ptr_glViewportIndexedf; void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);\nextern PFNGLVIEWPORTINDEXEDFVPROC ptr_glViewportIndexedfv; void glViewportIndexedfv(GLuint index, const GLfloat *v);\nextern PFNGLSCISSORARRAYVPROC ptr_glScissorArrayv; void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);\nextern PFNGLSCISSORINDEXEDPROC ptr_glScissorIndexed; void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);\nextern PFNGLSCISSORINDEXEDVPROC ptr_glScissorIndexedv; void glScissorIndexedv(GLuint index, const GLint *v);\nextern PFNGLDEPTHRANGEARRAYVPROC ptr_glDepthRangeArrayv; void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);\nextern PFNGLDEPTHRANGEINDEXEDPROC ptr_glDepthRangeIndexed; void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);\nextern PFNGLGETFLOATI_VPROC ptr_glGetFloati_v; void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);\nextern PFNGLGETDOUBLEI_VPROC ptr_glGetDoublei_v; void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);\nextern PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC ptr_glDrawArraysInstancedBaseInstance; void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC ptr_glDrawElementsInstancedBaseInstance; void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC ptr_glDrawElementsInstancedBaseVertexBaseInstance; void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);\nextern PFNGLGETINTERNALFORMATIVPROC ptr_glGetInternalformativ; void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params);\nextern PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC ptr_glGetActiveAtomicCounterBufferiv; void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);\nextern PFNGLBINDIMAGETEXTUREPROC ptr_glBindImageTexture; void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);\nextern PFNGLMEMORYBARRIERPROC ptr_glMemoryBarrier; void glMemoryBarrier(GLbitfield barriers);\nextern PFNGLTEXSTORAGE1DPROC ptr_glTexStorage1D; void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\nextern PFNGLTEXSTORAGE2DPROC ptr_glTexStorage2D; void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLTEXSTORAGE3DPROC ptr_glTexStorage3D; void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC ptr_glDrawTransformFeedbackInstanced; void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);\nextern PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC ptr_glDrawTransformFeedbackStreamInstanced; void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);\nextern PFNGLCLEARBUFFERDATAPROC ptr_glClearBufferData; void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARBUFFERSUBDATAPROC ptr_glClearBufferSubData; void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);\nextern PFNGLDISPATCHCOMPUTEPROC ptr_glDispatchCompute; void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);\nextern PFNGLDISPATCHCOMPUTEINDIRECTPROC ptr_glDispatchComputeIndirect; void glDispatchComputeIndirect(GLintptr indirect);\nextern PFNGLCOPYIMAGESUBDATAPROC ptr_glCopyImageSubData; void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);\nextern PFNGLFRAMEBUFFERPARAMETERIPROC ptr_glFramebufferParameteri; void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);\nextern PFNGLGETFRAMEBUFFERPARAMETERIVPROC ptr_glGetFramebufferParameteriv; void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETINTERNALFORMATI64VPROC ptr_glGetInternalformati64v; void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params);\nextern PFNGLINVALIDATETEXSUBIMAGEPROC ptr_glInvalidateTexSubImage; void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLINVALIDATETEXIMAGEPROC ptr_glInvalidateTexImage; void glInvalidateTexImage(GLuint texture, GLint level);\nextern PFNGLINVALIDATEBUFFERSUBDATAPROC ptr_glInvalidateBufferSubData; void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);\nextern PFNGLINVALIDATEBUFFERDATAPROC ptr_glInvalidateBufferData; void glInvalidateBufferData(GLuint buffer);\nextern PFNGLINVALIDATEFRAMEBUFFERPROC ptr_glInvalidateFramebuffer; void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);\nextern PFNGLINVALIDATESUBFRAMEBUFFERPROC ptr_glInvalidateSubFramebuffer; void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLMULTIDRAWARRAYSINDIRECTPROC ptr_glMultiDrawArraysIndirect; void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);\nextern PFNGLMULTIDRAWELEMENTSINDIRECTPROC ptr_glMultiDrawElementsIndirect; void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);\nextern PFNGLGETPROGRAMINTERFACEIVPROC ptr_glGetProgramInterfaceiv; void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);\nextern PFNGLGETPROGRAMRESOURCEINDEXPROC ptr_glGetProgramResourceIndex; GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLGETPROGRAMRESOURCENAMEPROC ptr_glGetProgramResourceName; void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLGETPROGRAMRESOURCEIVPROC ptr_glGetProgramResourceiv; void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params);\nextern PFNGLGETPROGRAMRESOURCELOCATIONPROC ptr_glGetProgramResourceLocation; GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC ptr_glGetProgramResourceLocationIndex; GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLSHADERSTORAGEBLOCKBINDINGPROC ptr_glShaderStorageBlockBinding; void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);\nextern PFNGLTEXBUFFERRANGEPROC ptr_glTexBufferRange; void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLTEXSTORAGE2DMULTISAMPLEPROC ptr_glTexStorage2DMultisample; void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXSTORAGE3DMULTISAMPLEPROC ptr_glTexStorage3DMultisample; void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLTEXTUREVIEWPROC ptr_glTextureView; void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);\nextern PFNGLBINDVERTEXBUFFERPROC ptr_glBindVertexBuffer; void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\nextern PFNGLVERTEXATTRIBFORMATPROC ptr_glVertexAttribFormat; void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBIFORMATPROC ptr_glVertexAttribIFormat; void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBLFORMATPROC ptr_glVertexAttribLFormat; void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBBINDINGPROC ptr_glVertexAttribBinding; void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);\nextern PFNGLVERTEXBINDINGDIVISORPROC ptr_glVertexBindingDivisor; void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);\nextern PFNGLDEBUGMESSAGECONTROLPROC ptr_glDebugMessageControl; void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\nextern PFNGLDEBUGMESSAGEINSERTPROC ptr_glDebugMessageInsert; void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);\nextern PFNGLDEBUGMESSAGECALLBACKPROC ptr_glDebugMessageCallback; void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);\nextern PFNGLGETDEBUGMESSAGELOGPROC ptr_glGetDebugMessageLog; GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);\nextern PFNGLPUSHDEBUGGROUPPROC ptr_glPushDebugGroup; void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);\nextern PFNGLPOPDEBUGGROUPPROC ptr_glPopDebugGroup; void glPopDebugGroup(void);\nextern PFNGLOBJECTLABELPROC ptr_glObjectLabel; void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);\nextern PFNGLGETOBJECTLABELPROC ptr_glGetObjectLabel; void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);\nextern PFNGLOBJECTPTRLABELPROC ptr_glObjectPtrLabel; void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);\nextern PFNGLGETOBJECTPTRLABELPROC ptr_glGetObjectPtrLabel; void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);\nextern PFNGLBUFFERSTORAGEPROC ptr_glBufferStorage; void glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);\nextern PFNGLCLEARTEXIMAGEPROC ptr_glClearTexImage; void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARTEXSUBIMAGEPROC ptr_glClearTexSubImage; void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);\nextern PFNGLBINDBUFFERSBASEPROC ptr_glBindBuffersBase; void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers);\nextern PFNGLBINDBUFFERSRANGEPROC ptr_glBindBuffersRange; void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);\nextern PFNGLBINDTEXTURESPROC ptr_glBindTextures; void glBindTextures(GLuint first, GLsizei count, const GLuint *textures);\nextern PFNGLBINDSAMPLERSPROC ptr_glBindSamplers; void glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers);\nextern PFNGLBINDIMAGETEXTURESPROC ptr_glBindImageTextures; void glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures);\nextern PFNGLBINDVERTEXBUFFERSPROC ptr_glBindVertexBuffers; void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);\nextern PFNGLCLIPCONTROLPROC ptr_glClipControl; void glClipControl(GLenum origin, GLenum depth);\nextern PFNGLCREATETRANSFORMFEEDBACKSPROC ptr_glCreateTransformFeedbacks; void glCreateTransformFeedbacks(GLsizei n, GLuint *ids);\nextern PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC ptr_glTransformFeedbackBufferBase; void glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer);\nextern PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC ptr_glTransformFeedbackBufferRange; void glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLGETTRANSFORMFEEDBACKIVPROC ptr_glGetTransformFeedbackiv; void glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param);\nextern PFNGLGETTRANSFORMFEEDBACKI_VPROC ptr_glGetTransformFeedbacki_v; void glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param);\nextern PFNGLGETTRANSFORMFEEDBACKI64_VPROC ptr_glGetTransformFeedbacki64_v; void glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param);\nextern PFNGLCREATEBUFFERSPROC ptr_glCreateBuffers; void glCreateBuffers(GLsizei n, GLuint *buffers);\nextern PFNGLNAMEDBUFFERSTORAGEPROC ptr_glNamedBufferStorage; void glNamedBufferStorage(GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);\nextern PFNGLNAMEDBUFFERDATAPROC ptr_glNamedBufferData; void glNamedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);\nextern PFNGLNAMEDBUFFERSUBDATAPROC ptr_glNamedBufferSubData; void glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);\nextern PFNGLCOPYNAMEDBUFFERSUBDATAPROC ptr_glCopyNamedBufferSubData; void glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\nextern PFNGLCLEARNAMEDBUFFERDATAPROC ptr_glClearNamedBufferData; void glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARNAMEDBUFFERSUBDATAPROC ptr_glClearNamedBufferSubData; void glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);\nextern PFNGLMAPNAMEDBUFFERPROC ptr_glMapNamedBuffer; void * glMapNamedBuffer(GLuint buffer, GLenum access);\nextern PFNGLMAPNAMEDBUFFERRANGEPROC ptr_glMapNamedBufferRange; void * glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);\nextern PFNGLUNMAPNAMEDBUFFERPROC ptr_glUnmapNamedBuffer; GLboolean glUnmapNamedBuffer(GLuint buffer);\nextern PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC ptr_glFlushMappedNamedBufferRange; void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length);\nextern PFNGLGETNAMEDBUFFERPARAMETERIVPROC ptr_glGetNamedBufferParameteriv; void glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);\nextern PFNGLGETNAMEDBUFFERPARAMETERI64VPROC ptr_glGetNamedBufferParameteri64v; void glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params);\nextern PFNGLGETNAMEDBUFFERPOINTERVPROC ptr_glGetNamedBufferPointerv; void glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void **params);\nextern PFNGLGETNAMEDBUFFERSUBDATAPROC ptr_glGetNamedBufferSubData; void glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);\nextern PFNGLCREATEFRAMEBUFFERSPROC ptr_glCreateFramebuffers; void glCreateFramebuffers(GLsizei n, GLuint *framebuffers);\nextern PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC ptr_glNamedFramebufferRenderbuffer; void glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\nextern PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC ptr_glNamedFramebufferParameteri; void glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param);\nextern PFNGLNAMEDFRAMEBUFFERTEXTUREPROC ptr_glNamedFramebufferTexture; void glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);\nextern PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC ptr_glNamedFramebufferTextureLayer; void glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);\nextern PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC ptr_glNamedFramebufferDrawBuffer; void glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf);\nextern PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC ptr_glNamedFramebufferDrawBuffers; void glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs);\nextern PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC ptr_glNamedFramebufferReadBuffer; void glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src);\nextern PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC ptr_glInvalidateNamedFramebufferData; void glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);\nextern PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC ptr_glInvalidateNamedFramebufferSubData; void glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLCLEARNAMEDFRAMEBUFFERIVPROC ptr_glClearNamedFramebufferiv; void glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC ptr_glClearNamedFramebufferuiv; void glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERFVPROC ptr_glClearNamedFramebufferfv; void glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERFIPROC ptr_glClearNamedFramebufferfi; void glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);\nextern PFNGLBLITNAMEDFRAMEBUFFERPROC ptr_glBlitNamedFramebuffer; void glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\nextern PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC ptr_glCheckNamedFramebufferStatus; GLenum glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);\nextern PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC ptr_glGetNamedFramebufferParameteriv; void glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param);\nextern PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC ptr_glGetNamedFramebufferAttachmentParameteriv; void glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);\nextern PFNGLCREATERENDERBUFFERSPROC ptr_glCreateRenderbuffers; void glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers);\nextern PFNGLNAMEDRENDERBUFFERSTORAGEPROC ptr_glNamedRenderbufferStorage; void glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC ptr_glNamedRenderbufferStorageMultisample; void glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC ptr_glGetNamedRenderbufferParameteriv; void glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params);\nextern PFNGLCREATETEXTURESPROC ptr_glCreateTextures; void glCreateTextures(GLenum target, GLsizei n, GLuint *textures);\nextern PFNGLTEXTUREBUFFERPROC ptr_glTextureBuffer; void glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer);\nextern PFNGLTEXTUREBUFFERRANGEPROC ptr_glTextureBufferRange; void glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLTEXTURESTORAGE1DPROC ptr_glTextureStorage1D; void glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);\nextern PFNGLTEXTURESTORAGE2DPROC ptr_glTextureStorage2D; void glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLTEXTURESTORAGE3DPROC ptr_glTextureStorage3D; void glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC ptr_glTextureStorage2DMultisample; void glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC ptr_glTextureStorage3DMultisample; void glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLTEXTURESUBIMAGE1DPROC ptr_glTextureSubImage1D; void glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXTURESUBIMAGE2DPROC ptr_glTextureSubImage2D; void glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXTURESUBIMAGE3DPROC ptr_glTextureSubImage3D; void glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC ptr_glCompressedTextureSubImage1D; void glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC ptr_glCompressedTextureSubImage2D; void glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC ptr_glCompressedTextureSubImage3D; void glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOPYTEXTURESUBIMAGE1DPROC ptr_glCopyTextureSubImage1D; void glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\nextern PFNGLCOPYTEXTURESUBIMAGE2DPROC ptr_glCopyTextureSubImage2D; void glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLCOPYTEXTURESUBIMAGE3DPROC ptr_glCopyTextureSubImage3D; void glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLTEXTUREPARAMETERFPROC ptr_glTextureParameterf; void glTextureParameterf(GLuint texture, GLenum pname, GLfloat param);\nextern PFNGLTEXTUREPARAMETERFVPROC ptr_glTextureParameterfv; void glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param);\nextern PFNGLTEXTUREPARAMETERIPROC ptr_glTextureParameteri; void glTextureParameteri(GLuint texture, GLenum pname, GLint param);\nextern PFNGLTEXTUREPARAMETERIIVPROC ptr_glTextureParameterIiv; void glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params);\nextern PFNGLTEXTUREPARAMETERIUIVPROC ptr_glTextureParameterIuiv; void glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params);\nextern PFNGLTEXTUREPARAMETERIVPROC ptr_glTextureParameteriv; void glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param);\nextern PFNGLGENERATETEXTUREMIPMAPPROC ptr_glGenerateTextureMipmap; void glGenerateTextureMipmap(GLuint texture);\nextern PFNGLBINDTEXTUREUNITPROC ptr_glBindTextureUnit; void glBindTextureUnit(GLuint unit, GLuint texture);\nextern PFNGLGETTEXTUREIMAGEPROC ptr_glGetTextureImage; void glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC ptr_glGetCompressedTextureImage; void glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels);\nextern PFNGLGETTEXTURELEVELPARAMETERFVPROC ptr_glGetTextureLevelParameterfv; void glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params);\nextern PFNGLGETTEXTURELEVELPARAMETERIVPROC ptr_glGetTextureLevelParameteriv; void glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params);\nextern PFNGLGETTEXTUREPARAMETERFVPROC ptr_glGetTextureParameterfv; void glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params);\nextern PFNGLGETTEXTUREPARAMETERIIVPROC ptr_glGetTextureParameterIiv; void glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params);\nextern PFNGLGETTEXTUREPARAMETERIUIVPROC ptr_glGetTextureParameterIuiv; void glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params);\nextern PFNGLGETTEXTUREPARAMETERIVPROC ptr_glGetTextureParameteriv; void glGetTextureParameteriv(GLuint texture, GLenum pname, GLint *params);\nextern PFNGLCREATEVERTEXARRAYSPROC ptr_glCreateVertexArrays; void glCreateVertexArrays(GLsizei n, GLuint *arrays);\nextern PFNGLDISABLEVERTEXARRAYATTRIBPROC ptr_glDisableVertexArrayAttrib; void glDisableVertexArrayAttrib(GLuint vaobj, GLuint index);\nextern PFNGLENABLEVERTEXARRAYATTRIBPROC ptr_glEnableVertexArrayAttrib; void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index);\nextern PFNGLVERTEXARRAYELEMENTBUFFERPROC ptr_glVertexArrayElementBuffer; void glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer);\nextern PFNGLVERTEXARRAYVERTEXBUFFERPROC ptr_glVertexArrayVertexBuffer; void glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\nextern PFNGLVERTEXARRAYVERTEXBUFFERSPROC ptr_glVertexArrayVertexBuffers; void glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);\nextern PFNGLVERTEXARRAYATTRIBBINDINGPROC ptr_glVertexArrayAttribBinding; void glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex);\nextern PFNGLVERTEXARRAYATTRIBFORMATPROC ptr_glVertexArrayAttribFormat; void glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYATTRIBIFORMATPROC ptr_glVertexArrayAttribIFormat; void glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYATTRIBLFORMATPROC ptr_glVertexArrayAttribLFormat; void glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYBINDINGDIVISORPROC ptr_glVertexArrayBindingDivisor; void glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor);\nextern PFNGLGETVERTEXARRAYIVPROC ptr_glGetVertexArrayiv; void glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param);\nextern PFNGLGETVERTEXARRAYINDEXEDIVPROC ptr_glGetVertexArrayIndexediv; void glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param);\nextern PFNGLGETVERTEXARRAYINDEXED64IVPROC ptr_glGetVertexArrayIndexed64iv; void glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);\nextern PFNGLCREATESAMPLERSPROC ptr_glCreateSamplers; void glCreateSamplers(GLsizei n, GLuint *samplers);\nextern PFNGLCREATEPROGRAMPIPELINESPROC ptr_glCreateProgramPipelines; void glCreateProgramPipelines(GLsizei n, GLuint *pipelines);\nextern PFNGLCREATEQUERIESPROC ptr_glCreateQueries; void glCreateQueries(GLenum target, GLsizei n, GLuint *ids);\nextern PFNGLGETQUERYBUFFEROBJECTI64VPROC ptr_glGetQueryBufferObjecti64v; void glGetQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTIVPROC ptr_glGetQueryBufferObjectiv; void glGetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTUI64VPROC ptr_glGetQueryBufferObjectui64v; void glGetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTUIVPROC ptr_glGetQueryBufferObjectuiv; void glGetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLMEMORYBARRIERBYREGIONPROC ptr_glMemoryBarrierByRegion; void glMemoryBarrierByRegion(GLbitfield barriers);\nextern PFNGLGETTEXTURESUBIMAGEPROC ptr_glGetTextureSubImage; void glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC ptr_glGetCompressedTextureSubImage; void glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);\nextern PFNGLGETGRAPHICSRESETSTATUSPROC ptr_glGetGraphicsResetStatus; GLenum glGetGraphicsResetStatus(void);\nextern PFNGLGETNCOMPRESSEDTEXIMAGEPROC ptr_glGetnCompressedTexImage; void glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels);\nextern PFNGLGETNTEXIMAGEPROC ptr_glGetnTexImage; void glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETNUNIFORMDVPROC ptr_glGetnUniformdv; void glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params);\nextern PFNGLGETNUNIFORMFVPROC ptr_glGetnUniformfv; void glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params);\nextern PFNGLGETNUNIFORMIVPROC ptr_glGetnUniformiv; void glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params);\nextern PFNGLGETNUNIFORMUIVPROC ptr_glGetnUniformuiv; void glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params);\nextern PFNGLREADNPIXELSPROC ptr_glReadnPixels; void glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);\nextern PFNGLGETNMAPDVPROC ptr_glGetnMapdv; void glGetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);\nextern PFNGLGETNMAPFVPROC ptr_glGetnMapfv; void glGetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);\nextern PFNGLGETNMAPIVPROC ptr_glGetnMapiv; void glGetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v);\nextern PFNGLGETNPIXELMAPFVPROC ptr_glGetnPixelMapfv; void glGetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values);\nextern PFNGLGETNPIXELMAPUIVPROC ptr_glGetnPixelMapuiv; void glGetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values);\nextern PFNGLGETNPIXELMAPUSVPROC ptr_glGetnPixelMapusv; void glGetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values);\nextern PFNGLGETNPOLYGONSTIPPLEPROC ptr_glGetnPolygonStipple; void glGetnPolygonStipple(GLsizei bufSize, GLubyte *pattern);\nextern PFNGLGETNCOLORTABLEPROC ptr_glGetnColorTable; void glGetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);\nextern PFNGLGETNCONVOLUTIONFILTERPROC ptr_glGetnConvolutionFilter; void glGetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);\nextern PFNGLGETNSEPARABLEFILTERPROC ptr_glGetnSeparableFilter; void glGetnSeparableFilter(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);\nextern PFNGLGETNHISTOGRAMPROC ptr_glGetnHistogram; void glGetnHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);\nextern PFNGLGETNMINMAXPROC ptr_glGetnMinmax; void glGetnMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);\nextern PFNGLTEXTUREBARRIERPROC ptr_glTextureBarrier; void glTextureBarrier(void);\nextern PFNGLSPECIALIZESHADERPROC ptr_glSpecializeShader; void glSpecializeShader(GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);\nextern PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC ptr_glMultiDrawArraysIndirectCount; void glMultiDrawArraysIndirectCount(GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);\nextern PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC ptr_glMultiDrawElementsIndirectCount; void glMultiDrawElementsIndirectCount(GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);\nextern PFNGLPOLYGONOFFSETCLAMPPROC ptr_glPolygonOffsetClamp; void glPolygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp);\nextern PFNGLGETTEXTUREHANDLEARBPROC ptr_glGetTextureHandle; GLuint64 glGetTextureHandle(GLuint texture);\nextern PFNGLGETTEXTURESAMPLERHANDLEARBPROC ptr_glGetTextureSamplerHandle; GLuint64 glGetTextureSamplerHandle(GLuint texture, GLuint sampler);\nextern PFNGLMAKETEXTUREHANDLERESIDENTARBPROC ptr_glMakeTextureHandleResident; void glMakeTextureHandleResident(GLuint64 handle);\nextern PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC ptr_glMakeTextureHandleNonResident; void glMakeTextureHandleNonResident(GLuint64 handle);\nextern PFNGLGETIMAGEHANDLEARBPROC ptr_glGetImageHandle; GLuint64 glGetImageHandle(GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);\nextern PFNGLMAKEIMAGEHANDLERESIDENTARBPROC ptr_glMakeImageHandleResident; void glMakeImageHandleResident(GLuint64 handle, GLenum access);\nextern PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC ptr_glMakeImageHandleNonResident; void glMakeImageHandleNonResident(GLuint64 handle);\nextern PFNGLUNIFORMHANDLEUI64ARBPROC ptr_glUniformHandleui64; void glUniformHandleui64(GLint location, GLuint64 value);\nextern PFNGLUNIFORMHANDLEUI64VARBPROC ptr_glUniformHandleui64v; void glUniformHandleui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC ptr_glProgramUniformHandleui64; void glProgramUniformHandleui64(GLuint program, GLint location, GLuint64 value);\nextern PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC ptr_glProgramUniformHandleui64v; void glProgramUniformHandleui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *values);\nextern PFNGLISTEXTUREHANDLERESIDENTARBPROC ptr_glIsTextureHandleResident; GLboolean glIsTextureHandleResident(GLuint64 handle);\nextern PFNGLISIMAGEHANDLERESIDENTARBPROC ptr_glIsImageHandleResident; GLboolean glIsImageHandleResident(GLuint64 handle);\nextern PFNGLVERTEXATTRIBL1UI64ARBPROC ptr_glVertexAttribL1ui64; void glVertexAttribL1ui64(GLuint index, GLuint64EXT x);\nextern PFNGLVERTEXATTRIBL1UI64VARBPROC ptr_glVertexAttribL1ui64v; void glVertexAttribL1ui64v(GLuint index, const GLuint64EXT *v);\nextern PFNGLGETVERTEXATTRIBLUI64VARBPROC ptr_glGetVertexAttribLui64v; void glGetVertexAttribLui64v(GLuint index, GLenum pname, GLuint64EXT *params);\nextern PFNGLUNIFORM1I64ARBPROC ptr_glUniform1i64; void glUniform1i64(GLint location, GLint64 x);\nextern PFNGLUNIFORM2I64ARBPROC ptr_glUniform2i64; void glUniform2i64(GLint location, GLint64 x, GLint64 y);\nextern PFNGLUNIFORM3I64ARBPROC ptr_glUniform3i64; void glUniform3i64(GLint location, GLint64 x, GLint64 y, GLint64 z);\nextern PFNGLUNIFORM4I64ARBPROC ptr_glUniform4i64; void glUniform4i64(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);\nextern PFNGLUNIFORM1I64VARBPROC ptr_glUniform1i64v; void glUniform1i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM2I64VARBPROC ptr_glUniform2i64v; void glUniform2i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM3I64VARBPROC ptr_glUniform3i64v; void glUniform3i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM4I64VARBPROC ptr_glUniform4i64v; void glUniform4i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM1UI64ARBPROC ptr_glUniform1ui64; void glUniform1ui64(GLint location, GLuint64 x);\nextern PFNGLUNIFORM2UI64ARBPROC ptr_glUniform2ui64; void glUniform2ui64(GLint location, GLuint64 x, GLuint64 y);\nextern PFNGLUNIFORM3UI64ARBPROC ptr_glUniform3ui64; void glUniform3ui64(GLint location, GLuint64 x, GLuint64 y, GLuint64 z);\nextern PFNGLUNIFORM4UI64ARBPROC ptr_glUniform4ui64; void glUniform4ui64(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);\nextern PFNGLUNIFORM1UI64VARBPROC ptr_glUniform1ui64v; void glUniform1ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM2UI64VARBPROC ptr_glUniform2ui64v; void glUniform2ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM3UI64VARBPROC ptr_glUniform3ui64v; void glUniform3ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM4UI64VARBPROC ptr_glUniform4ui64v; void glUniform4ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLGETUNIFORMI64VARBPROC ptr_glGetUniformi64v; void glGetUniformi64v(GLuint program, GLint location, GLint64 *params);\nextern PFNGLGETUNIFORMUI64VARBPROC ptr_glGetUniformui64v; void glGetUniformui64v(GLuint program, GLint location, GLuint64 *params);\nextern PFNGLGETNUNIFORMI64VARBPROC ptr_glGetnUniformi64v; void glGetnUniformi64v(GLuint program, GLint location, GLsizei bufSize, GLint64 *params);\nextern PFNGLGETNUNIFORMUI64VARBPROC ptr_glGetnUniformui64v; void glGetnUniformui64v(GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);\nextern PFNGLPROGRAMUNIFORM1I64ARBPROC ptr_glProgramUniform1i64; void glProgramUniform1i64(GLuint program, GLint location, GLint64 x);\nextern PFNGLPROGRAMUNIFORM2I64ARBPROC ptr_glProgramUniform2i64; void glProgramUniform2i64(GLuint program, GLint location, GLint64 x, GLint64 y);\nextern PFNGLPROGRAMUNIFORM3I64ARBPROC ptr_glProgramUniform3i64; void glProgramUniform3i64(GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);\nextern PFNGLPROGRAMUNIFORM4I64ARBPROC ptr_glProgramUniform4i64; void glProgramUniform4i64(GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);\nextern PFNGLPROGRAMUNIFORM1I64VARBPROC ptr_glProgramUniform1i64v; void glProgramUniform1i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM2I64VARBPROC ptr_glProgramUniform2i64v; void glProgramUniform2i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM3I64VARBPROC ptr_glProgramUniform3i64v; void glProgramUniform3i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM4I64VARBPROC ptr_glProgramUniform4i64v; void glProgramUniform4i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM1UI64ARBPROC ptr_glProgramUniform1ui64; void glProgramUniform1ui64(GLuint program, GLint location, GLuint64 x);\nextern PFNGLPROGRAMUNIFORM2UI64ARBPROC ptr_glProgramUniform2ui64; void glProgramUniform2ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y);\nextern PFNGLPROGRAMUNIFORM3UI64ARBPROC ptr_glProgramUniform3ui64; void glProgramUniform3ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);\nextern PFNGLPROGRAMUNIFORM4UI64ARBPROC ptr_glProgramUniform4ui64; void glProgramUniform4ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);\nextern PFNGLPROGRAMUNIFORM1UI64VARBPROC ptr_glProgramUniform1ui64v; void glProgramUniform1ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM2UI64VARBPROC ptr_glProgramUniform2ui64v; void glProgramUniform2ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM3UI64VARBPROC ptr_glProgramUniform3ui64v; void glProgramUniform3ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM4UI64VARBPROC ptr_glProgramUniform4ui64v; void glProgramUniform4ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\n"}, {"path": "utils/mesh.cpp", "language": "cpp", "loc": 215, "comment_density": 0.019, "code": "\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \"mesh.h\"\n#include \"math_helpers.h\"\n\nstruct ind_type { uint32_t position, uv, normal, material; };\n\nbool operator==(const ind_type& a, const ind_type& b) {\n\treturn a.position == b.position && a.uv == b.uv && a.normal == b.normal && a.material == b.material;\n}\n\nnamespace std {\n\ttemplate<>\n\tstruct hash {\n\t\tsize_t operator()(const ind_type& i) const {\n\t\t\tsize_t result = 0;\n\t\t\tfor (uint32_t k : {i.position, i.uv, i.normal, i.material}) {\n\t\t\t\tsrnd(k); rnd();\n\t\t\t\tresult ^= rnd_seed + 0x9e3779b9 + (result << 6) + (result >> 2);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t};\n}\n\nvoid get_mesh(const char* filename, void* meshPtr, bool smooth_shaded) {\n\t\n\tusing namespace std;\n\t\n\tstruct binary_header {\n\t\tuint32_t position_count, uv_count, normal_count, material_count, triangle_count;\n\t};\n\n\tvector positions;\n\tvector uvs;\n\tvector normals;\n\tvector material_albedos;\n\tvector indices;\n\t\n\tfilesystem::path path(filename);\n\t\n\tpath.replace_extension(\".bin\");\n\tif (!filesystem::exists(path)) {\n\n\t\tpath.replace_extension(\".mtl\");\n\t\tFILE* mtlFile = fopen(path.string().c_str(), \"rb\");\n\t\tfseek(mtlFile, 0, SEEK_END);\n\t\tconst size_t mtlSize = size_t(ftell(mtlFile)) + 1;\n\n\t\tvector mtlContents(mtlSize);\n\t\tmtlContents.back() = '\\0';\n\t\tfseek(mtlFile, 0, SEEK_SET);\n\t\tfread(mtlContents.data(), 1, mtlSize - 1, mtlFile);\n\t\tfclose(mtlFile);\n\n\t\tvector mtlNameIndices;\n\t\tvec3 color(1.f);\n\t\tint i = 0;\n\t\twhile (i < mtlSize - 1) {\n\t\t\tif (mtlContents[i] == 'n') {\n\t\t\t\ti += 7; // skip \"newmtl \"\n\t\t\t\twhile (mtlContents[i] == ' ' || mtlContents[i] == '\\t') i++;\n\n\t\t\t\tif (mtlNameIndices.size() > 0)\n\t\t\t\t\tmaterial_albedos.push_back(color);\n\t\t\t\tmtlNameIndices.push_back(i);\n\t\t\t}\n\t\t\telse if (mtlContents[i] == 'K' && mtlContents[i+1] == 'd')\n\t\t\t\tsscanf(mtlContents.data() + i + 2, \" %g %g %g\", color.data, color.data+1, color.data+2);\n\t\t\twhile (i < mtlSize - 1 && mtlContents[i++] != '\\n');\n\t\t}\n\t\tmaterial_albedos.push_back(color);\n\t\n\t\tpath.replace_extension(\".obj\");\n\n\t\tFILE* objFile = fopen(path.string().c_str(), \"rb\");\n\t\tfseek(objFile, 0, SEEK_END);\n\t\tconst size_t objSize = size_t(ftell(objFile)) + 1;\n\n\t\tvector objContents(objSize);\n\t\tobjContents.back() = '\\0';\n\t\tfseek(objFile, 0, SEEK_SET);\n\t\tfread(objContents.data(), 1, objSize - 1, objFile);\n\t\tfclose(objFile);\n\n\t\tint use_mtl_index = 0;\n\t\ti = 0;\n\t\twhile (i= 2)\n\t\t\t\t\t\tfor(int k = 0; k<3; ++k)\n\t\t\t\t\t\t\tindices.push_back(sweep_inds[k]);\n\n\t\t\t\t\tsweep_inds[1] = sweep_inds[2];\n\t\t\t\t\tj++; write_index = 2;\n\n\t\t\t\t\twhile (objContents[i] == ' ' || objContents[i] == '\\t') i++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (objContents[i] == 'u' && objContents[i+1] == 's') {\n\t\t\t\tuse_mtl_index = -1;\n\t\t\t\ti += 7; // skip \"usemtl \"\n\t\t\t\twhile (objContents[i] == ' ' || objContents[i] == '\\t') i++;\n\t\t\t\tfor (auto j: mtlNameIndices) {\n\t\t\t\t\tuse_mtl_index++;\n\t\t\t\t\tint k = i;\n\t\t\t\t\tbool match = false;\n\t\t\t\t\twhile (objContents[k] == mtlContents[j] && objContents[k] != '\\0') {\n\t\t\t\t\t\tif (objContents[k] == ' ' || objContents[k] == '\\t' || objContents[k] == '\\n' || objContents[k] == '\\0') {\n\t\t\t\t\t\t\tmatch = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tk++; j++;\n\t\t\t\t\t}\n\t\t\t\t\tif (match) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (i < objSize - 1 && objContents[i] != '\\n') i++;\n\t\t\ti++;\n\t\t}\n\t\tpath.replace_extension(\".bin\");\n\t\tFILE* binFile = fopen(path.string().c_str(), \"wb\");\n\t\tbinary_header header = { uint32_t(positions.size()), uint32_t(uvs.size()), uint32_t(normals.size()), uint32_t(material_albedos.size()), uint32_t(indices.size()) };\n\t\tfwrite(&header, sizeof(header), 1, binFile);\n\t\tfwrite(positions.data(), sizeof(positions[0]), positions.size(), binFile);\n\t\tfwrite(uvs.data(), sizeof(uvs[0]), uvs.size(), binFile);\n\t\tfwrite(normals.data(), sizeof(normals[0]), normals.size(), binFile);\n\t\tfwrite(material_albedos.data(), sizeof(material_albedos[0]), material_albedos.size(), binFile);\n\t\tfwrite(indices.data(), sizeof(indices[0]), indices.size(), binFile);\n\t\tfclose(binFile);\n\t}\n\telse {\n\t\tFILE* binFile = fopen(path.string().c_str(), \"rb\");\n\t\tbinary_header header;\n\t\tfread(&header, sizeof(header), 1, binFile);\n\t\tpositions.resize(header.position_count); uvs.resize(header.uv_count); normals.resize(header.normal_count);\n\t\tmaterial_albedos.resize(header.material_count); indices.resize(header.triangle_count);\n\t\tfread(positions.data(), sizeof(positions[0]), positions.size(), binFile);\n\t\tfread(uvs.data(), sizeof(uvs[0]), uvs.size(), binFile);\n\t\tfread(normals.data(), sizeof(normals[0]), normals.size(), binFile);\n\t\tfread(material_albedos.data(), sizeof(material_albedos[0]), material_albedos.size(), binFile);\n\t\tfread(indices.data(), sizeof(indices[0]), indices.size(), binFile);\n\t\tfclose(binFile);\n\t}\n\n\tif (!smooth_shaded) {\n\t\tFlatMesh* mesh = (FlatMesh*)meshPtr;\n\t\tmesh->triangle_count = int(indices.size()/3);\n#ifdef _WIN32\n\t\tmesh->triangles = (FlatMesh::triangle*)_aligned_malloc(mesh->triangle_count * sizeof(FlatMesh::triangle), 16);\n#else\t\t\t\t\t\t\t\t\t\t\t// see how the arguments are flipped? pretty funny joke by whoever defined these :)\n\t\tmesh->triangles = (FlatMesh::triangle*)aligned_alloc(16, mesh->triangle_count * sizeof(FlatMesh::triangle));\n#endif\n\t\tfor (int i = 0; i < mesh->triangle_count; ++i) {\n\t\t\tvec3 color = material_albedos[indices[i * 3].material];\n\t\t\tfor (int j = 0; j < 3; ++j) {\n\t\t\t\tconst auto ind = indices[i * 3 + j];\n\t\t\t\tvec3 position = positions[ind.position];\n\t\t\t\t\n\t\t\t\tmesh->triangles[i].vertices[j].position = _mm_setr_ps(position.x, position.y, position.z, 1.f);\n\t\t\t\tvec3 normal = normals[ind.normal];\n\t\t\t\tmesh->triangles[i].vertices[j].normal = _mm_setr_ps(normal.x, normal.y, normal.z, 1.f);\n\t\t\t\tmesh->triangles[i].vertices[j].color = _mm_setr_ps(color.r, color.g, color.b, 1.f);\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tMesh* mesh = (Mesh*)meshPtr;\n\t\tmesh->triangle_count = int(indices.size() / 3);\n\t\tmesh->vertex_count = int(positions.size());\n\n\t\tstd::unordered_map ind_to_vert;\n\t\tstd::vector verts;\n\t\tstd::vector inds;\n\n\t\tfor (ind_type i : indices) {\n\t\t\tif(i.position > mesh->vertex_count) continue;\n\t\t\tif (!ind_to_vert.count(i)) {\n\t\t\t\tind_to_vert[i] = verts.size();\n\t\t\t\tverts.push_back({});\n\t\t\t\tverts.back().position = vec4(positions[i.position], 1.f);\n\t\t\t\tverts.back().normal = i.normal < normals.size() ? vec4(normals[i.normal], 1.f) : vec4(.0f);\n\t\t\t\tverts.back().uv = i.uvvertex_count = verts.size();\n\t\tmesh->verts = new Mesh::vertex[mesh->vertex_count];\n\t\tmemcpy(mesh->verts, verts.data(), sizeof(Mesh::vertex)*verts.size());\n\t\tmesh->indices = new uint32_t[mesh->triangle_count * 3];\n\t\tmemcpy(mesh->indices, inds.data(), sizeof(uint32_t)*inds.size());\n\t}\n}\n\n"}, {"path": "utils/mesh.h", "language": "c", "loc": 35, "comment_density": 0.0, "code": "#pragma once\n\n\n#include \n\nvoid get_mesh(const char* filename, void* mesh, bool smooth_shaded);\n\nstruct FlatMesh {\n\tstruct vertex {\n\t\t__m128 position, normal, color;\n\t};\n\tstruct triangle {\n\t\tvertex vertices[3];\n\t} *triangles = nullptr;\n\tint triangle_count = 0;\n\n\tFlatMesh(const char* filename) {\n\t\tget_mesh(filename, this, false);\n\t}\n\t~FlatMesh() {\n#ifdef _WIN32\n\t\t_aligned_free(triangles);\n#else\n\t\tfree(triangles);\n#endif\n\t}\n};\n\n#include \"glsl.h\"\n\nstruct Mesh {\n\tstruct vertex {\n\t\tvec4 position, normal, color;\n\t\tvec2 uv;\n\t} *verts = nullptr;\n\tuint32_t* indices = nullptr;\n\tint vertex_count = 0, triangle_count = 0;\n\n\tMesh(const char* filename) {\n\t\tget_mesh(filename, this, true);\n\t}\n\t~Mesh() { delete[] verts; delete[] indices; }\n};\n"}, {"path": "utils/wglext.h", "language": "c", "loc": 788, "comment_density": 0.115, "code": "#ifndef __wglext_h_\n#define __wglext_h_ 1\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\t/*\n\t** Copyright (c) 2013-2017 The Khronos Group Inc.\n\t**\n\t** Permission is hereby granted, free of charge, to any person obtaining a\n\t** copy of this software and/or associated documentation files (the\n\t** \"Materials\"), to deal in the Materials without restriction, including\n\t** without limitation the rights to use, copy, modify, merge, publish,\n\t** distribute, sublicense, and/or sell copies of the Materials, and to\n\t** permit persons to whom the Materials are furnished to do so, subject to\n\t** the following conditions:\n\t**\n\t** The above copyright notice and this permission notice shall be included\n\t** in all copies or substantial portions of the Materials.\n\t**\n\t** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n\t** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\t** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n\t** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\t** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n\t** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n\t*/\n\t/*\n\t** This header is generated from the Khronos OpenGL / OpenGL ES XML\n\t** API Registry. The current version of the Registry, generator scripts\n\t** used to make the header, and the header can be found at\n\t** https://github.com/KhronosGroup/OpenGL-Registry\n\t*/\n\n#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)\n#define WIN32_LEAN_AND_MEAN 1\n#include \n#endif\n\n#define WGL_WGLEXT_VERSION 20170817\n\n\t/* Generated C header for:\n\t* API: wgl\n\t* Versions considered: .*\n\t* Versions emitted: _nomatch_^\n\t* Default extensions included: wgl\n\t* Additional extensions included: _nomatch_^\n\t* Extensions removed: _nomatch_^\n\t*/\n\n#ifndef WGL_ARB_buffer_region\n#define WGL_ARB_buffer_region 1\n#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001\n#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002\n#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004\n#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008\n\ttypedef HANDLE(WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);\n\ttypedef VOID(WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);\n\ttypedef BOOL(WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);\n\ttypedef BOOL(WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHANDLE WINAPI wglCreateBufferRegionARB(HDC hDC, int iLayerPlane, UINT uType);\n\tVOID WINAPI wglDeleteBufferRegionARB(HANDLE hRegion);\n\tBOOL WINAPI wglSaveBufferRegionARB(HANDLE hRegion, int x, int y, int width, int height);\n\tBOOL WINAPI wglRestoreBufferRegionARB(HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\n#endif\n#endif /* WGL_ARB_buffer_region */\n\n#ifndef WGL_ARB_context_flush_control\n#define WGL_ARB_context_flush_control 1\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098\n#endif /* WGL_ARB_context_flush_control */\n\n#ifndef WGL_ARB_create_context\n#define WGL_ARB_create_context 1\n#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001\n#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002\n#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093\n#define WGL_CONTEXT_FLAGS_ARB 0x2094\n#define ERROR_INVALID_VERSION_ARB 0x2095\n\ttypedef HGLRC(WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHGLRC WINAPI wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList);\n#endif\n#endif /* WGL_ARB_create_context */\n\n#ifndef WGL_ARB_create_context_no_error\n#define WGL_ARB_create_context_no_error 1\n#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3\n#endif /* WGL_ARB_create_context_no_error */\n\n#ifndef WGL_ARB_create_context_profile\n#define WGL_ARB_create_context_profile 1\n#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126\n#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define ERROR_INVALID_PROFILE_ARB 0x2096\n#endif /* WGL_ARB_create_context_profile */\n\n#ifndef WGL_ARB_create_context_robustness\n#define WGL_ARB_create_context_robustness 1\n#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261\n#endif /* WGL_ARB_create_context_robustness */\n\n#ifndef WGL_ARB_extensions_string\n#define WGL_ARB_extensions_string 1\n\ttypedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tconst char *WINAPI wglGetExtensionsStringARB(HDC hdc);\n#endif\n#endif /* WGL_ARB_extensions_string */\n\n#ifndef WGL_ARB_framebuffer_sRGB\n#define WGL_ARB_framebuffer_sRGB 1\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9\n#endif /* WGL_ARB_framebuffer_sRGB */\n\n#ifndef WGL_ARB_make_current_read\n#define WGL_ARB_make_current_read 1\n#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043\n#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054\n\ttypedef BOOL(WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\ttypedef HDC(WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\tHDC WINAPI wglGetCurrentReadDCARB(void);\n#endif\n#endif /* WGL_ARB_make_current_read */\n\n#ifndef WGL_ARB_multisample\n#define WGL_ARB_multisample 1\n#define WGL_SAMPLE_BUFFERS_ARB 0x2041\n#define WGL_SAMPLES_ARB 0x2042\n#endif /* WGL_ARB_multisample */\n\n#ifndef WGL_ARB_pbuffer\n#define WGL_ARB_pbuffer 1\n\tDECLARE_HANDLE(HPBUFFERARB);\n#define WGL_DRAW_TO_PBUFFER_ARB 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030\n#define WGL_PBUFFER_LARGEST_ARB 0x2033\n#define WGL_PBUFFER_WIDTH_ARB 0x2034\n#define WGL_PBUFFER_HEIGHT_ARB 0x2035\n#define WGL_PBUFFER_LOST_ARB 0x2036\n\ttypedef HPBUFFERARB(WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\ttypedef HDC(WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);\n\ttypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHPBUFFERARB WINAPI wglCreatePbufferARB(HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\tHDC WINAPI wglGetPbufferDCARB(HPBUFFERARB hPbuffer);\n\tint WINAPI wglReleasePbufferDCARB(HPBUFFERARB hPbuffer, HDC hDC);\n\tBOOL WINAPI wglDestroyPbufferARB(HPBUFFERARB hPbuffer);\n\tBOOL WINAPI wglQueryPbufferARB(HPBUFFERARB hPbuffer, int iAttribute, int *piValue);\n#endif\n#endif /* WGL_ARB_pbuffer */\n\n#ifndef WGL_ARB_pixel_format\n#define WGL_ARB_pixel_format 1\n#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000\n#define WGL_DRAW_TO_WINDOW_ARB 0x2001\n#define WGL_DRAW_TO_BITMAP_ARB 0x2002\n#define WGL_ACCELERATION_ARB 0x2003\n#define WGL_NEED_PALETTE_ARB 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006\n#define WGL_SWAP_METHOD_ARB 0x2007\n#define WGL_NUMBER_OVERLAYS_ARB 0x2008\n#define WGL_NUMBER_UNDERLAYS_ARB 0x2009\n#define WGL_TRANSPARENT_ARB 0x200A\n#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037\n#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038\n#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039\n#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A\n#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B\n#define WGL_SHARE_DEPTH_ARB 0x200C\n#define WGL_SHARE_STENCIL_ARB 0x200D\n#define WGL_SHARE_ACCUM_ARB 0x200E\n#define WGL_SUPPORT_GDI_ARB 0x200F\n#define WGL_SUPPORT_OPENGL_ARB 0x2010\n#define WGL_DOUBLE_BUFFER_ARB 0x2011\n#define WGL_STEREO_ARB 0x2012\n#define WGL_PIXEL_TYPE_ARB 0x2013\n#define WGL_COLOR_BITS_ARB 0x2014\n#define WGL_RED_BITS_ARB 0x2015\n#define WGL_RED_SHIFT_ARB 0x2016\n#define WGL_GREEN_BITS_ARB 0x2017\n#define WGL_GREEN_SHIFT_ARB 0x2018\n#define WGL_BLUE_BITS_ARB 0x2019\n#define WGL_BLUE_SHIFT_ARB 0x201A\n#define WGL_ALPHA_BITS_ARB 0x201B\n#define WGL_ALPHA_SHIFT_ARB 0x201C\n#define WGL_ACCUM_BITS_ARB 0x201D\n#define WGL_ACCUM_RED_BITS_ARB 0x201E\n#define WGL_ACCUM_GREEN_BITS_ARB 0x201F\n#define WGL_ACCUM_BLUE_BITS_ARB 0x2020\n#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021\n#define WGL_DEPTH_BITS_ARB 0x2022\n#define WGL_STENCIL_BITS_ARB 0x2023\n#define WGL_AUX_BUFFERS_ARB 0x2024\n#define WGL_NO_ACCELERATION_ARB 0x2025\n#define WGL_GENERIC_ACCELERATION_ARB 0x2026\n#define WGL_FULL_ACCELERATION_ARB 0x2027\n#define WGL_SWAP_EXCHANGE_ARB 0x2028\n#define WGL_SWAP_COPY_ARB 0x2029\n#define WGL_SWAP_UNDEFINED_ARB 0x202A\n#define WGL_TYPE_RGBA_ARB 0x202B\n#define WGL_TYPE_COLORINDEX_ARB 0x202C\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);\n\ttypedef BOOL(WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetPixelFormatAttribivARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);\n\tBOOL WINAPI wglGetPixelFormatAttribfvARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);\n\tBOOL WINAPI wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#endif\n#endif /* WGL_ARB_pixel_format */\n\n#ifndef WGL_ARB_pixel_format_float\n#define WGL_ARB_pixel_format_float 1\n#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0\n#endif /* WGL_ARB_pixel_format_float */\n\n#ifndef WGL_ARB_render_texture\n#define WGL_ARB_render_texture 1\n#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070\n#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071\n#define WGL_TEXTURE_FORMAT_ARB 0x2072\n#define WGL_TEXTURE_TARGET_ARB 0x2073\n#define WGL_MIPMAP_TEXTURE_ARB 0x2074\n#define WGL_TEXTURE_RGB_ARB 0x2075\n#define WGL_TEXTURE_RGBA_ARB 0x2076\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078\n#define WGL_TEXTURE_1D_ARB 0x2079\n#define WGL_TEXTURE_2D_ARB 0x207A\n#define WGL_MIPMAP_LEVEL_ARB 0x207B\n#define WGL_CUBE_MAP_FACE_ARB 0x207C\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082\n#define WGL_FRONT_LEFT_ARB 0x2083\n#define WGL_FRONT_RIGHT_ARB 0x2084\n#define WGL_BACK_LEFT_ARB 0x2085\n#define WGL_BACK_RIGHT_ARB 0x2086\n#define WGL_AUX0_ARB 0x2087\n#define WGL_AUX1_ARB 0x2088\n#define WGL_AUX2_ARB 0x2089\n#define WGL_AUX3_ARB 0x208A\n#define WGL_AUX4_ARB 0x208B\n#define WGL_AUX5_ARB 0x208C\n#define WGL_AUX6_ARB 0x208D\n#define WGL_AUX7_ARB 0x208E\n#define WGL_AUX8_ARB 0x208F\n#define WGL_AUX9_ARB 0x2090\n\ttypedef BOOL(WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer);\n\tBOOL WINAPI wglReleaseTexImageARB(HPBUFFERARB hPbuffer, int iBuffer);\n\tBOOL WINAPI wglSetPbufferAttribARB(HPBUFFERARB hPbuffer, const int *piAttribList);\n#endif\n#endif /* WGL_ARB_render_texture */\n\n#ifndef WGL_ARB_robustness_application_isolation\n#define WGL_ARB_robustness_application_isolation 1\n#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n#endif /* WGL_ARB_robustness_application_isolation */\n\n#ifndef WGL_ARB_robustness_share_group_isolation\n#define WGL_ARB_robustness_share_group_isolation 1\n#endif /* WGL_ARB_robustness_share_group_isolation */\n\n#ifndef WGL_3DFX_multisample\n#define WGL_3DFX_multisample 1\n#define WGL_SAMPLE_BUFFERS_3DFX 0x2060\n#define WGL_SAMPLES_3DFX 0x2061\n#endif /* WGL_3DFX_multisample */\n\n#ifndef WGL_3DL_stereo_control\n#define WGL_3DL_stereo_control 1\n#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055\n#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056\n#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057\n#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058\n\ttypedef BOOL(WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglSetStereoEmitterState3DL(HDC hDC, UINT uState);\n#endif\n#endif /* WGL_3DL_stereo_control */\n\n#ifndef WGL_AMD_gpu_association\n#define WGL_AMD_gpu_association 1\n#define WGL_GPU_VENDOR_AMD 0x1F00\n#define WGL_GPU_RENDERER_STRING_AMD 0x1F01\n#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define WGL_GPU_RAM_AMD 0x21A3\n#define WGL_GPU_CLOCK_AMD 0x21A4\n#define WGL_GPU_NUM_PIPES_AMD 0x21A5\n#define WGL_GPU_NUM_SIMD_AMD 0x21A6\n#define WGL_GPU_NUM_RB_AMD 0x21A7\n#define WGL_GPU_NUM_SPI_AMD 0x21A8\n\ttypedef UINT(WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);\n\ttypedef INT(WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);\n\ttypedef UINT(WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);\n\ttypedef HGLRC(WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);\n\ttypedef HGLRC(WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);\n\ttypedef BOOL(WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);\n\ttypedef BOOL(WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);\n\ttypedef HGLRC(WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);\n\ttypedef VOID(WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tUINT WINAPI wglGetGPUIDsAMD(UINT maxCount, UINT *ids);\n\tINT WINAPI wglGetGPUInfoAMD(UINT id, int property, GLenum dataType, UINT size, void *data);\n\tUINT WINAPI wglGetContextGPUIDAMD(HGLRC hglrc);\n\tHGLRC WINAPI wglCreateAssociatedContextAMD(UINT id);\n\tHGLRC WINAPI wglCreateAssociatedContextAttribsAMD(UINT id, HGLRC hShareContext, const int *attribList);\n\tBOOL WINAPI wglDeleteAssociatedContextAMD(HGLRC hglrc);\n\tBOOL WINAPI wglMakeAssociatedContextCurrentAMD(HGLRC hglrc);\n\tHGLRC WINAPI wglGetCurrentAssociatedContextAMD(void);\n\tVOID WINAPI wglBlitContextFramebufferAMD(HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\n#endif\n#endif /* WGL_AMD_gpu_association */\n\n#ifndef WGL_ATI_pixel_format_float\n#define WGL_ATI_pixel_format_float 1\n#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0\n#endif /* WGL_ATI_pixel_format_float */\n\n#ifndef WGL_EXT_colorspace\n#define WGL_EXT_colorspace 1\n#define WGL_COLORSPACE_EXT 0x3087\n#define WGL_COLORSPACE_SRGB_EXT 0x3089\n#define WGL_COLORSPACE_LINEAR_EXT 0x308A\n#endif /* WGL_EXT_colorspace */\n\n#ifndef WGL_EXT_create_context_es2_profile\n#define WGL_EXT_create_context_es2_profile 1\n#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n#endif /* WGL_EXT_create_context_es2_profile */\n\n#ifndef WGL_EXT_create_context_es_profile\n#define WGL_EXT_create_context_es_profile 1\n#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n#endif /* WGL_EXT_create_context_es_profile */\n\n#ifndef WGL_EXT_depth_float\n#define WGL_EXT_depth_float 1\n#define WGL_DEPTH_FLOAT_EXT 0x2040\n#endif /* WGL_EXT_depth_float */\n\n#ifndef WGL_EXT_display_color_table\n#define WGL_EXT_display_color_table 1\n\ttypedef GLboolean(WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n\ttypedef GLboolean(WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);\n\ttypedef GLboolean(WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n\ttypedef VOID(WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tGLboolean WINAPI wglCreateDisplayColorTableEXT(GLushort id);\n\tGLboolean WINAPI wglLoadDisplayColorTableEXT(const GLushort *table, GLuint length);\n\tGLboolean WINAPI wglBindDisplayColorTableEXT(GLushort id);\n\tVOID WINAPI wglDestroyDisplayColorTableEXT(GLushort id);\n#endif\n#endif /* WGL_EXT_display_color_table */\n\n#ifndef WGL_EXT_extensions_string\n#define WGL_EXT_extensions_string 1\n\ttypedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tconst char *WINAPI wglGetExtensionsStringEXT(void);\n#endif\n#endif /* WGL_EXT_extensions_string */\n\n#ifndef WGL_EXT_framebuffer_sRGB\n#define WGL_EXT_framebuffer_sRGB 1\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9\n#endif /* WGL_EXT_framebuffer_sRGB */\n\n#ifndef WGL_EXT_make_current_read\n#define WGL_EXT_make_current_read 1\n#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043\n\ttypedef BOOL(WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\ttypedef HDC(WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglMakeContextCurrentEXT(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\tHDC WINAPI wglGetCurrentReadDCEXT(void);\n#endif\n#endif /* WGL_EXT_make_current_read */\n\n#ifndef WGL_EXT_multisample\n#define WGL_EXT_multisample 1\n#define WGL_SAMPLE_BUFFERS_EXT 0x2041\n#define WGL_SAMPLES_EXT 0x2042\n#endif /* WGL_EXT_multisample */\n\n#ifndef WGL_EXT_pbuffer\n#define WGL_EXT_pbuffer 1\n\tDECLARE_HANDLE(HPBUFFEREXT);\n#define WGL_DRAW_TO_PBUFFER_EXT 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030\n#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031\n#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032\n#define WGL_PBUFFER_LARGEST_EXT 0x2033\n#define WGL_PBUFFER_WIDTH_EXT 0x2034\n#define WGL_PBUFFER_HEIGHT_EXT 0x2035\n\ttypedef HPBUFFEREXT(WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\ttypedef HDC(WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);\n\ttypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHPBUFFEREXT WINAPI wglCreatePbufferEXT(HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\tHDC WINAPI wglGetPbufferDCEXT(HPBUFFEREXT hPbuffer);\n\tint WINAPI wglReleasePbufferDCEXT(HPBUFFEREXT hPbuffer, HDC hDC);\n\tBOOL WINAPI wglDestroyPbufferEXT(HPBUFFEREXT hPbuffer);\n\tBOOL WINAPI wglQueryPbufferEXT(HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);\n#endif\n#endif /* WGL_EXT_pbuffer */\n\n#ifndef WGL_EXT_pixel_format\n#define WGL_EXT_pixel_format 1\n#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000\n#define WGL_DRAW_TO_WINDOW_EXT 0x2001\n#define WGL_DRAW_TO_BITMAP_EXT 0x2002\n#define WGL_ACCELERATION_EXT 0x2003\n#define WGL_NEED_PALETTE_EXT 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006\n#define WGL_SWAP_METHOD_EXT 0x2007\n#define WGL_NUMBER_OVERLAYS_EXT 0x2008\n#define WGL_NUMBER_UNDERLAYS_EXT 0x2009\n#define WGL_TRANSPARENT_EXT 0x200A\n#define WGL_TRANSPARENT_VALUE_EXT 0x200B\n#define WGL_SHARE_DEPTH_EXT 0x200C\n#define WGL_SHARE_STENCIL_EXT 0x200D\n#define WGL_SHARE_ACCUM_EXT 0x200E\n#define WGL_SUPPORT_GDI_EXT 0x200F\n#define WGL_SUPPORT_OPENGL_EXT 0x2010\n#define WGL_DOUBLE_BUFFER_EXT 0x2011\n#define WGL_STEREO_EXT 0x2012\n#define WGL_PIXEL_TYPE_EXT 0x2013\n#define WGL_COLOR_BITS_EXT 0x2014\n#define WGL_RED_BITS_EXT 0x2015\n#define WGL_RED_SHIFT_EXT 0x2016\n#define WGL_GREEN_BITS_EXT 0x2017\n#define WGL_GREEN_SHIFT_EXT 0x2018\n#define WGL_BLUE_BITS_EXT 0x2019\n#define WGL_BLUE_SHIFT_EXT 0x201A\n#define WGL_ALPHA_BITS_EXT 0x201B\n#define WGL_ALPHA_SHIFT_EXT 0x201C\n#define WGL_ACCUM_BITS_EXT 0x201D\n#define WGL_ACCUM_RED_BITS_EXT 0x201E\n#define WGL_ACCUM_GREEN_BITS_EXT 0x201F\n#define WGL_ACCUM_BLUE_BITS_EXT 0x2020\n#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021\n#define WGL_DEPTH_BITS_EXT 0x2022\n#define WGL_STENCIL_BITS_EXT 0x2023\n#define WGL_AUX_BUFFERS_EXT 0x2024\n#define WGL_NO_ACCELERATION_EXT 0x2025\n#define WGL_GENERIC_ACCELERATION_EXT 0x2026\n#define WGL_FULL_ACCELERATION_EXT 0x2027\n#define WGL_SWAP_EXCHANGE_EXT 0x2028\n#define WGL_SWAP_COPY_EXT 0x2029\n#define WGL_SWAP_UNDEFINED_EXT 0x202A\n#define WGL_TYPE_RGBA_EXT 0x202B\n#define WGL_TYPE_COLORINDEX_EXT 0x202C\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);\n\ttypedef BOOL(WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetPixelFormatAttribivEXT(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);\n\tBOOL WINAPI wglGetPixelFormatAttribfvEXT(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);\n\tBOOL WINAPI wglChoosePixelFormatEXT(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#endif\n#endif /* WGL_EXT_pixel_format */\n\n#ifndef WGL_EXT_pixel_format_packed_float\n#define WGL_EXT_pixel_format_packed_float 1\n#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8\n#endif /* WGL_EXT_pixel_format_packed_float */\n\n#ifndef WGL_EXT_swap_control\n#define WGL_EXT_swap_control 1\n\ttypedef BOOL(WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);\n\ttypedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglSwapIntervalEXT(int interval);\n\tint WINAPI wglGetSwapIntervalEXT(void);\n#endif\n#endif /* WGL_EXT_swap_control */\n\n#ifndef WGL_EXT_swap_control_tear\n#define WGL_EXT_swap_control_tear 1\n#endif /* WGL_EXT_swap_control_tear */\n\n#ifndef WGL_I3D_digital_video_control\n#define WGL_I3D_digital_video_control 1\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051\n#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052\n#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053\n\ttypedef BOOL(WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetDigitalVideoParametersI3D(HDC hDC, int iAttribute, int *piValue);\n\tBOOL WINAPI wglSetDigitalVideoParametersI3D(HDC hDC, int iAttribute, const int *piValue);\n#endif\n#endif /* WGL_I3D_digital_video_control */\n\n#ifndef WGL_I3D_gamma\n#define WGL_I3D_gamma 1\n#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E\n#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F\n\ttypedef BOOL(WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);\n\ttypedef BOOL(WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetGammaTableParametersI3D(HDC hDC, int iAttribute, int *piValue);\n\tBOOL WINAPI wglSetGammaTableParametersI3D(HDC hDC, int iAttribute, const int *piValue);\n\tBOOL WINAPI wglGetGammaTableI3D(HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);\n\tBOOL WINAPI wglSetGammaTableI3D(HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);\n#endif\n#endif /* WGL_I3D_gamma */\n\n#ifndef WGL_I3D_genlock\n#define WGL_I3D_genlock 1\n#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044\n#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045\n#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046\n#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047\n#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048\n#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049\n#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A\n#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B\n#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C\n\ttypedef BOOL(WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnableGenlockI3D(HDC hDC);\n\tBOOL WINAPI wglDisableGenlockI3D(HDC hDC);\n\tBOOL WINAPI wglIsEnabledGenlockI3D(HDC hDC, BOOL *pFlag);\n\tBOOL WINAPI wglGenlockSourceI3D(HDC hDC, UINT uSource);\n\tBOOL WINAPI wglGetGenlockSourceI3D(HDC hDC, UINT *uSource);\n\tBOOL WINAPI wglGenlockSourceEdgeI3D(HDC hDC, UINT uEdge);\n\tBOOL WINAPI wglGetGenlockSourceEdgeI3D(HDC hDC, UINT *uEdge);\n\tBOOL WINAPI wglGenlockSampleRateI3D(HDC hDC, UINT uRate);\n\tBOOL WINAPI wglGetGenlockSampleRateI3D(HDC hDC, UINT *uRate);\n\tBOOL WINAPI wglGenlockSourceDelayI3D(HDC hDC, UINT uDelay);\n\tBOOL WINAPI wglGetGenlockSourceDelayI3D(HDC hDC, UINT *uDelay);\n\tBOOL WINAPI wglQueryGenlockMaxSourceDelayI3D(HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);\n#endif\n#endif /* WGL_I3D_genlock */\n\n#ifndef WGL_I3D_image_buffer\n#define WGL_I3D_image_buffer 1\n#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001\n#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002\n\ttypedef LPVOID(WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);\n\ttypedef BOOL(WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tLPVOID WINAPI wglCreateImageBufferI3D(HDC hDC, DWORD dwSize, UINT uFlags);\n\tBOOL WINAPI wglDestroyImageBufferI3D(HDC hDC, LPVOID pAddress);\n\tBOOL WINAPI wglAssociateImageBufferEventsI3D(HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);\n\tBOOL WINAPI wglReleaseImageBufferEventsI3D(HDC hDC, const LPVOID *pAddress, UINT count);\n#endif\n#endif /* WGL_I3D_image_buffer */\n\n#ifndef WGL_I3D_swap_frame_lock\n#define WGL_I3D_swap_frame_lock 1\n\ttypedef BOOL(WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnableFrameLockI3D(void);\n\tBOOL WINAPI wglDisableFrameLockI3D(void);\n\tBOOL WINAPI wglIsEnabledFrameLockI3D(BOOL *pFlag);\n\tBOOL WINAPI wglQueryFrameLockMasterI3D(BOOL *pFlag);\n#endif\n#endif /* WGL_I3D_swap_frame_lock */\n\n#ifndef WGL_I3D_swap_frame_usage\n#define WGL_I3D_swap_frame_usage 1\n\ttypedef BOOL(WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);\n\ttypedef BOOL(WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetFrameUsageI3D(float *pUsage);\n\tBOOL WINAPI wglBeginFrameTrackingI3D(void);\n\tBOOL WINAPI wglEndFrameTrackingI3D(void);\n\tBOOL WINAPI wglQueryFrameTrackingI3D(DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n#endif\n#endif /* WGL_I3D_swap_frame_usage */\n\n#ifndef WGL_NV_DX_interop\n#define WGL_NV_DX_interop 1\n#define WGL_ACCESS_READ_ONLY_NV 0x00000000\n#define WGL_ACCESS_READ_WRITE_NV 0x00000001\n#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002\n\ttypedef BOOL(WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);\n\ttypedef HANDLE(WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);\n\ttypedef BOOL(WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);\n\ttypedef HANDLE(WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);\n\ttypedef BOOL(WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);\n\ttypedef BOOL(WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);\n\ttypedef BOOL(WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);\n\ttypedef BOOL(WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglDXSetResourceShareHandleNV(void *dxObject, HANDLE shareHandle);\n\tHANDLE WINAPI wglDXOpenDeviceNV(void *dxDevice);\n\tBOOL WINAPI wglDXCloseDeviceNV(HANDLE hDevice);\n\tHANDLE WINAPI wglDXRegisterObjectNV(HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);\n\tBOOL WINAPI wglDXUnregisterObjectNV(HANDLE hDevice, HANDLE hObject);\n\tBOOL WINAPI wglDXObjectAccessNV(HANDLE hObject, GLenum access);\n\tBOOL WINAPI wglDXLockObjectsNV(HANDLE hDevice, GLint count, HANDLE *hObjects);\n\tBOOL WINAPI wglDXUnlockObjectsNV(HANDLE hDevice, GLint count, HANDLE *hObjects);\n#endif\n#endif /* WGL_NV_DX_interop */\n\n#ifndef WGL_NV_DX_interop2\n#define WGL_NV_DX_interop2 1\n#endif /* WGL_NV_DX_interop2 */\n\n#ifndef WGL_NV_copy_image\n#define WGL_NV_copy_image 1\n\ttypedef BOOL(WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglCopyImageSubDataNV(HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n#endif\n#endif /* WGL_NV_copy_image */\n\n#ifndef WGL_NV_delay_before_swap\n#define WGL_NV_delay_before_swap 1\n\ttypedef BOOL(WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglDelayBeforeSwapNV(HDC hDC, GLfloat seconds);\n#endif\n#endif /* WGL_NV_delay_before_swap */\n\n#ifndef WGL_NV_float_buffer\n#define WGL_NV_float_buffer 1\n#define WGL_FLOAT_COMPONENTS_NV 0x20B0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4\n#define WGL_TEXTURE_FLOAT_R_NV 0x20B5\n#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6\n#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7\n#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8\n#endif /* WGL_NV_float_buffer */\n\n#ifndef WGL_NV_gpu_affinity\n#define WGL_NV_gpu_affinity 1\n\tDECLARE_HANDLE(HGPUNV);\n\tstruct _GPU_DEVICE {\n\t\tDWORD cb;\n\t\tCHAR DeviceName[32];\n\t\tCHAR DeviceString[128];\n\t\tDWORD Flags;\n\t\tRECT rcVirtualScreen;\n\t};\n\ttypedef struct _GPU_DEVICE *PGPU_DEVICE;\n#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0\n#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\n\ttypedef HDC(WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\n\ttypedef BOOL(WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnumGpusNV(UINT iGpuIndex, HGPUNV *phGpu);\n\tBOOL WINAPI wglEnumGpuDevicesNV(HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\n\tHDC WINAPI wglCreateAffinityDCNV(const HGPUNV *phGpuList);\n\tBOOL WINAPI wglEnumGpusFromAffinityDCNV(HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\n\tBOOL WINAPI wglDeleteDCNV(HDC hdc);\n#endif\n#endif /* WGL_NV_gpu_affinity */\n\n#ifndef WGL_NV_multisample_coverage\n#define WGL_NV_multisample_coverage 1\n#define WGL_COVERAGE_SAMPLES_NV 0x2042\n#define WGL_COLOR_SAMPLES_NV 0x20B9\n#endif /* WGL_NV_multisample_coverage */\n\n#ifndef WGL_NV_present_video\n#define WGL_NV_present_video 1\n\tDECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);\n#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0\n\ttypedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tint WINAPI wglEnumerateVideoDevicesNV(HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);\n\tBOOL WINAPI wglBindVideoDeviceNV(HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);\n\tBOOL WINAPI wglQueryCurrentContextNV(int iAttribute, int *piValue);\n#endif\n#endif /* WGL_NV_present_video */\n\n#ifndef WGL_NV_render_depth_texture\n#define WGL_NV_render_depth_texture 1\n#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4\n#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5\n#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6\n#define WGL_DEPTH_COMPONENT_NV 0x20A7\n#endif /* WGL_NV_render_depth_texture */\n\n#ifndef WGL_NV_render_texture_rectangle\n#define WGL_NV_render_texture_rectangle 1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1\n#define WGL_TEXTURE_RECTANGLE_NV 0x20A2\n#endif /* WGL_NV_render_texture_rectangle */\n\n#ifndef WGL_NV_swap_group\n#define WGL_NV_swap_group 1\n\ttypedef BOOL(WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);\n\ttypedef BOOL(WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);\n\ttypedef BOOL(WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglJoinSwapGroupNV(HDC hDC, GLuint group);\n\tBOOL WINAPI wglBindSwapBarrierNV(GLuint group, GLuint barrier);\n\tBOOL WINAPI wglQuerySwapGroupNV(HDC hDC, GLuint *group, GLuint *barrier);\n\tBOOL WINAPI wglQueryMaxSwapGroupsNV(HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);\n\tBOOL WINAPI wglQueryFrameCountNV(HDC hDC, GLuint *count);\n\tBOOL WINAPI wglResetFrameCountNV(HDC hDC);\n#endif\n#endif /* WGL_NV_swap_group */\n\n#ifndef WGL_NV_vertex_array_range\n#define WGL_NV_vertex_array_range 1\n\ttypedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);\n\ttypedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tvoid *WINAPI wglAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);\n\tvoid WINAPI wglFreeMemoryNV(void *pointer);\n#endif\n#endif /* WGL_NV_vertex_array_range */\n\n#ifndef WGL_NV_video_capture\n#define WGL_NV_video_capture 1\n\tDECLARE_HANDLE(HVIDEOINPUTDEVICENV);\n#define WGL_UNIQUE_ID_NV 0x20CE\n#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\n\ttypedef UINT(WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);\n\ttypedef BOOL(WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglBindVideoCaptureDeviceNV(UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\n\tUINT WINAPI wglEnumerateVideoCaptureDevicesNV(HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);\n\tBOOL WINAPI wglLockVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\tBOOL WINAPI wglQueryVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);\n\tBOOL WINAPI wglReleaseVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n#endif\n#endif /* WGL_NV_video_capture */\n\n#ifndef WGL_NV_video_output\n#define WGL_NV_video_output 1\n\tDECLARE_HANDLE(HPVIDEODEV);\n#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0\n#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1\n#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2\n#define WGL_VIDEO_OUT_COLOR_NV 0x20C3\n#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4\n#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5\n#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define WGL_VIDEO_OUT_FRAME 0x20C8\n#define WGL_VIDEO_OUT_FIELD_1 0x20C9\n#define WGL_VIDEO_OUT_FIELD_2 0x20CA\n#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB\n#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC\n\ttypedef BOOL(WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);\n\ttypedef BOOL(WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetVideoDeviceNV(HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);\n\tBOOL WINAPI wglReleaseVideoDeviceNV(HPVIDEODEV hVideoDevice);\n\tBOOL WINAPI wglBindVideoImageNV(HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\n\tBOOL WINAPI wglReleaseVideoImageNV(HPBUFFERARB hPbuffer, int iVideoBuffer);\n\tBOOL WINAPI wglSendPbufferToVideoNV(HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);\n\tBOOL WINAPI wglGetVideoInfoNV(HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\n#endif\n#endif /* WGL_NV_video_output */\n\n#ifndef WGL_OML_sync_control\n#define WGL_OML_sync_control 1\n\ttypedef BOOL(WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);\n\ttypedef BOOL(WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);\n\ttypedef INT64(WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\n\ttypedef INT64(WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\n\ttypedef BOOL(WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);\n\ttypedef BOOL(WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetSyncValuesOML(HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);\n\tBOOL WINAPI wglGetMscRateOML(HDC hdc, INT32 *numerator, INT32 *denominator);\n\tINT64 WINAPI wglSwapBuffersMscOML(HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\n\tINT64 WINAPI wglSwapLayerBuffersMscOML(HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\n\tBOOL WINAPI wglWaitForMscOML(HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);\n\tBOOL WINAPI wglWaitForSbcOML(HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);\n#endif\n#endif /* WGL_OML_sync_control */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif"}, {"path": "utils/window.cpp", "language": "cpp", "loc": 371, "comment_density": 0.065, "code": "\n#include \"window.h\"\n\n#ifndef _WIN32\n#include \n#endif\n\nvoid APIENTRY glDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, void*) {\n\n\t// format the message nicely\n\tauto output = printf(\"OpenGL \");\n\n\tswitch (type) {\n\tcase GL_DEBUG_TYPE_ERROR:\t\t\t\t\tprintf(\"error\");\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_PORTABILITY:\t\t\t\tprintf(\"portability issue\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_PERFORMANCE:\t\t\t\tprintf(\"performance issue\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_OTHER:\t\t\t\t\tprintf(\"issue\");\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:\t\tprintf(\"undefined behavior\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:\t\tprintf(\"deprecated behavior\");\t\t\t\tbreak;\n\tdefault:\t\t\t\t\t\t\t\t\tprintf(\"issue(?)\");\t\t\t\t\t\t\tbreak;\n\t}\n\tswitch (source) {\n\tcase GL_DEBUG_SOURCE_API:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_WINDOW_SYSTEM:\t\t\tprintf(\" in the window system\");\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_SHADER_COMPILER:\t\tprintf(\" in the shader compiler\");\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_THIRD_PARTY:\t\t\tprintf(\" in third party code\");\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_APPLICATION:\t\t\tprintf(\" in this program\");\t\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_OTHER:\t\t\t\t\tprintf(\" in an undefined source\");\t\t\tbreak;\n\tdefault:\t\t\t\t\t\t\t\t\tprintf(\" nowhere(?)\");\t\t\t\t\t\tbreak;\n\t}\n\n\tprintf(\", id %u:\\n%.*s\\n\", id, length, message);\n\t// this is invaluable; you can directly see where any opengl error originated by checking the call stack at this breakpoint\n\tif (type == GL_DEBUG_TYPE_ERROR)\n#ifdef _WIN32\n\t\t__debugbreak();\n#else\n\t\traise(SIGTRAP);\n#endif\n}\n\nvoid setupDebug() {\n\t// enable debug output\n\tglEnable(GL_DEBUG_OUTPUT);\n\t// debug output from main thread: get the correct stack frame when breaking\n\tglEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);\n\n\tglDebugMessageCallback((GLDEBUGPROC)glDebugCallback, 0);\n\n\t// query everything about errors, deprecated and undefined things\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\n\t// disable misc info. might want to check these from time to time!\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 0, 0, GL_FALSE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_PERFORMANCE, GL_DONT_CARE, 0, 0, GL_FALSE);\n}\n\n#ifdef _WIN32\n\n#include \"wglext.h\"\n\n#pragma comment(lib, \"opengl32.lib\")\n\nconst int GL_WINDOW_ATTRIBUTES[] = {\n\tWGL_DRAW_TO_WINDOW_ARB, GL_TRUE,\n\tWGL_SUPPORT_OPENGL_ARB, GL_TRUE,\n\tWGL_DOUBLE_BUFFER_ARB, GL_TRUE,\n\tWGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, GL_TRUE,\n\t//WGL_SAMPLES_ARB, 8, // MSAA\n\n\tWGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,\n\tWGL_COLOR_BITS_ARB, 32,\n\tWGL_DEPTH_BITS_ARB, 24,\n0 };\n\nconst int GL_CONTEXT_ATTRIBUTES[] = {\n\tWGL_CONTEXT_MAJOR_VERSION_ARB, 4,\n\tWGL_CONTEXT_MINOR_VERSION_ARB, 6,\n\tWGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,\n\t//WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,\n0 };\n\nHWND wnd = nullptr;\nHDC dc;\nHGLRC rc;\n\n// update the frame onto screen\nvoid swapBuffers() {\n\tSwapBuffers(dc);\n}\n\nvoid setTitle(const char* title) {\n\tSetWindowTextA(wnd, title);\n}\n\nivec2 getMouse() {\n\tPOINT mouse;\n\tGetCursorPos(&mouse);\n\tScreenToClient(wnd, &mouse);\n\treturn ivec2(mouse.x, mouse.y);\n}\n\nvoid setMouse(ivec2 p) {\n\tPOINT p_{ p.x, p.y };\n\tClientToScreen(wnd, &p_);\n\tSetCursorPos(p_.x, p_.y);\n}\n\nivec2 windowSize() {\n\tRECT r;\n\tGetClientRect(wnd, &r);\n\treturn { r.right - r.left, r.bottom - r.top };\n}\n\nWPARAM down[256]; int downptr = 0;\nWPARAM hit[256]; int hitptr = 0;\n\nbool keyDown(uint vk_code) {\n\tfor (int i = 0; i < downptr; ++i)\n\t\tif (vk_code == down[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nbool keyHit(uint vk_code) {\n\tfor (int i = 0; i < hitptr; ++i)\n\t\tif (vk_code == hit[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nvoid resetHits() {\n\thitptr = 0;\n}\n\ninline WPARAM mapExtended(WPARAM wParam, LPARAM lParam) {\n\tint ext = (lParam>>24)&1;\n\tswitch(wParam) {\n\t\tcase VK_SHIFT: return MapVirtualKeyEx((lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK_EX, GetKeyboardLayout(0));\n\t\tcase VK_CONTROL: return VK_LCONTROL+ext;\n\t\tcase VK_MENU: return VK_LMENU+ext;\n\t\tcase VK_RETURN: return VK_RETURN + ext*(VK_SEPARATOR-VK_RETURN);\n\t\tdefault: return wParam;\n\t}\n}\n\nLRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {\n\tswitch (uMsg) {\n\tcase WM_CLOSE:\n\t\tPostQuitMessage(0);\n\t\treturn 0;\n\tcase WM_SYSKEYDOWN:\n\tcase WM_KEYDOWN:\n\t\twParam = mapExtended(wParam, lParam);\n\t\tif (!keyDown((UINT)wParam))\n\t\t\tdown[downptr++] = hit[hitptr++] = wParam; // todo: if mapNarrowed(wParam)!=wParam: also add mapNarrowed()\n\t\tif (wParam == VK_ESCAPE)\n\t\t\tPostQuitMessage(0);\n\t\treturn 0;\n\tcase WM_SYSKEYUP:\n\tcase WM_KEYUP:\n\t\twParam = mapExtended(wParam, lParam);\n\t\tfor (int i = 0; i < downptr - 1; ++i) // todo: if mapNarrowed(wParam)!=wParam: also remove mapNarrowed()\n\t\t\tif (wParam == down[i]) {\n\t\t\t\tdown[i] = down[downptr-1];\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif (downptr > 0) downptr--;\n\t\treturn 0;\n\tcase WM_KILLFOCUS:\n\t//\thitptr = downptr = 0;\n\t\treturn 0;\n\t}\n\treturn DefWindowProc(hwnd, uMsg, wParam, lParam);\n}\n\nbool loop() {\n\thitptr = 0;\n\tMSG msg;\n\tbool result = true;\n\twhile (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {\n\t\tTranslateMessage(&msg);\n\t\tDispatchMessage(&msg);\n\t\tif (msg.message == WM_QUIT) {\n\t\t\tresult = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show) {\n\n\tif (glOpen()) return;\n\n\tWNDCLASSEX windowClass = { 0 };\n\twindowClass.cbSize = sizeof(windowClass);\n\twindowClass.hInstance = GetModuleHandle(nullptr);\n\twindowClass.lpszClassName = TEXT(\"classy class\");\n\twindowClass.hCursor = LoadCursor(nullptr, IDC_ARROW);\n\twindowClass.style = CS_OWNDC;\n\twindowClass.lpfnWndProc = wndProc;\n\tRegisterClassEx(&windowClass);\n\n\tPIXELFORMATDESCRIPTOR formatDesc = { 0 };\n\tformatDesc.nVersion = 1;\n\tformatDesc.nSize = sizeof(formatDesc);\n\tformatDesc.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;\n\tformatDesc.iLayerType = PFD_MAIN_PLANE;\n\tformatDesc.iPixelType = PFD_TYPE_RGBA;\n\tformatDesc.cColorBits = 32;\n\tformatDesc.cDepthBits = 24;\n\tformatDesc.cStencilBits = 8;\n\n\t// create a temporary window to have a functional opengl context in order to get some extension function pointers\n\tHWND tempWnd = CreateWindow(TEXT(\"classy class\"), TEXT(\"windy window\"), WS_POPUP, 0, 0, width, height, nullptr, nullptr, GetModuleHandle(nullptr), nullptr);\n\tHDC tempDC = GetDC(tempWnd);\n\tSetPixelFormat(tempDC, ChoosePixelFormat(tempDC, &formatDesc), &formatDesc);\n\tHGLRC tempRC = wglCreateContext(tempDC);\n\twglMakeCurrent(tempDC, tempRC);\n\n\t// these are why we made the temporary context; can set more pixel format attributes (multisample, floating point etc.) and create debug/core/etc contexts\n\tauto wglChoosePixelFormat = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress(\"wglChoosePixelFormatARB\");\n\tauto wglCreateContextAttribs = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress(\"wglCreateContextAttribsARB\");\n\n\t// adjust the window borders away, center the window\n\tRECT area = { 0, 0, width, height };\n\tconst DWORD style = (fullscreen ? WS_POPUP : (WS_SYSMENU|WS_CAPTION|WS_MINIMIZEBOX)) | ((fullscreen||show)?WS_VISIBLE:0);\n\tif (fullscreen) {\n\t\tDEVMODE mode = { 0 };\n\t\tmode.dmSize = sizeof(mode);\n\t\tmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;\n\t\tmode.dmPelsWidth = width; mode.dmPelsHeight = height;\n\t\tmode.dmBitsPerPel = 32;\n\t\tChangeDisplaySettings(&mode, CDS_FULLSCREEN);\n\t}\n\n\tAdjustWindowRect(&area, style, false);\n\tint adjustedWidth = fullscreen ? width : area.right - area.left, adjustedHeight = fullscreen ? height : area.bottom - area.top;\n\tint centerX = (GetSystemMetrics(SM_CXSCREEN) - adjustedWidth) / 2, centerY = (GetSystemMetrics(SM_CYSCREEN) - adjustedHeight) / 2;\n\tif (fullscreen)\n\t\tcenterX = centerY = 0;\n\n\t// create the final window and context\n\tdc = GetDC(wnd = CreateWindowA(\"classy class\", title, style, centerX, centerY, adjustedWidth, adjustedHeight, nullptr, nullptr, GetModuleHandle(nullptr), nullptr));\n\n\tint format; UINT numFormats;\n\twglChoosePixelFormat(dc, GL_WINDOW_ATTRIBUTES, nullptr, 1, &format, &numFormats);\n\n\tSetPixelFormat(dc, format, &formatDesc);\n\n\trc = wglCreateContextAttribs(dc, 0, GL_CONTEXT_ATTRIBUTES);\n\n\twglMakeCurrent(dc, rc);\n\tglViewport(0, 0, width, height);\n\n\t// release the temporary window and context\n\twglDeleteContext(tempRC);\n\tReleaseDC(tempWnd, tempDC);\n\tDestroyWindow(tempWnd);\n\n\t// what GL did we get?\n\tprintf(\"gl %s\\non %s\\nby %s\\nsl %s\\n\", glGetString(GL_VERSION), glGetString(GL_RENDERER), glGetString(GL_VENDOR), glGetString(GL_SHADING_LANGUAGE_VERSION));\n\n\tloadgl();\n\n\tsetupDebug();\n\tglEnable(GL_FRAMEBUFFER_SRGB);\n\t((PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress(\"wglSwapIntervalEXT\"))(-1); // freesync\n}\n\n#include \nvoid closeGL() {\n\tif (!glOpen()) return;\n\n\t// release context, window\n\tChangeDisplaySettings(nullptr, CDS_FULLSCREEN);\n\twglMakeCurrent(0, 0);\n\twglDeleteContext(rc);\n\tReleaseDC(wnd, dc);\n\tDestroyWindow(wnd);\n\twnd = nullptr;\n\tUnregisterClass(TEXT(\"classy class\"), GetModuleHandle(nullptr));\n\t_CrtDumpMemoryLeaks();\n}\n\nbool glOpen() {\n\treturn wnd != nullptr;\n}\n\nvoid showWindow() {\n\tShowWindow(wnd, SW_SHOW);\n}\n\nvoid hideWindow() {\n\tShowWindow(wnd, SW_HIDE);\n}\n\n#else\n\n#ifdef HEADLESS\n#define EGL_NO_X11\n#define MESA_EGL_NO_X11_HEADERS\n#else\n#include \nDisplay* xdisplay = nullptr;\nWindow xwindow;\n#endif\n\n#include \n#include \n\n#define GLAPIENTRY\n\n#include \n\nEGLDisplay display;\nEGLContext context;\n\nEGLSurface surface = EGL_NO_SURFACE;\n\nivec2 windowsize{};\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show) {\n\twindowsize = ivec2(width, height);\n#ifndef HEADLESS\n\txdisplay = XOpenDisplay(nullptr);\n\tXSetWindowAttributes window_attributes = {0};\n\twindow_attributes.event_mask = ExposureMask | PointerMotionMask | KeyPressMask;\n\txwindow = XCreateWindow(xdisplay, DefaultRootWindow(xdisplay), 0, 0, width, height, 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask, &window_attributes);\n\tXStoreName(xdisplay, xwindow, title);\n\tXMapWindow(xdisplay, xwindow);\n\tdisplay = eglGetDisplay((EGLNativeDisplayType)xdisplay);\n#else\n\tdisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);\n#endif\n\tEGLint major, minor;\n\teglInitialize(display, &major, &minor);\n\tconst EGLint config_attributes[] = {\n\t\tEGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,\n\t\tEGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8,\n\t\tEGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,\n#ifdef HEADLESS\n\t\tEGL_SURFACE_TYPE, EGL_PBUFFER_BIT,\n#endif\n\t\tEGL_NONE\n\t};\n\n\teglBindAPI(EGL_OPENGL_API);\n\n\tEGLConfig config; EGLint configCount;\n\teglChooseConfig(display, config_attributes, &config, 1, &configCount);\n\n\tconst EGLint context_attributes[] = {\n\t\tEGL_CONTEXT_MAJOR_VERSION, 4,\n\t\tEGL_CONTEXT_MINOR_VERSION, 6,\n\t\tEGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,\n\t\tEGL_NONE\n\t};\n\tcontext = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attributes);\n#ifndef HEADLESS\n\tEGLint surface_attributes[] = {\n\t\tEGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR,\n\t\tEGL_RENDER_BUFFER, EGL_BACK_BUFFER,\n\t\tEGL_NONE\n\t};\n\tsurface = eglCreateWindowSurface(display, config, xwindow, surface_attributes);\n#else\n\tEGLint surface_attributes[] = {\n\t\t//EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR,\n\t\t//EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,\n\t\t//EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,\n\t\tEGL_WIDTH, width, EGL_HEIGHT, height,\n\t\tEGL_NONE\n\t};\n\tsurface = eglCreatePbufferSurface(display, config, surface_attributes);\n#endif\n\teglMakeCurrent(display, surface, surface, context);\n\tloadgl();\n\n\tsetupDebug();\n\tglEnable(GL_FRAMEBUFFER_SRGB);\n}\nvoid closeGL() {\n\teglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);\n\teglDestroySurface(display, surface);\n\teglDestroyContext(display, context);\n\teglTerminate(display);\n#ifndef HEADLESS\n\tXDestroyWindow(xdisplay, xwindow);\n\tXCloseDisplay(xdisplay);\n#endif\n}\nbool loop() {\n#ifdef HEADLESS\n\treturn false;\n#else\n\treturn true;\n#endif\n}\nbool glOpen() {\n\treturn surface!=EGL_NO_SURFACE;\n}\nvoid swapBuffers() {\n\t//printf(\"oh lord is it this\\n\");\n\teglSwapBuffers(display, surface);\n}\nvoid setTitle(const char* title) {}\nvoid showWindow() {}\nvoid hideWindow() {}\n\nint down[256]; int downptr = 0;\nint hit[256]; int hitptr = 0;\n\nbool keyDown(uint vk_code) {\n\tfor (int i = 0; i < downptr; ++i)\n\t\tif (vk_code == down[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nbool keyHit(uint vk_code) {\n\tfor (int i = 0; i < hitptr; ++i)\n\t\tif (vk_code == hit[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nvoid resetHits() {\n\thitptr = 0;\n}\n\nivec2 getMouse() { return {};}\nvoid setMouse(ivec2) {}\n\nivec2 windowSize() {\n\treturn windowsize;\n}\n\n#endif\n"}, {"path": "utils/window.h", "language": "c", "loc": 48, "comment_density": 0.062, "code": "\n#pragma once\n\n#ifdef _WIN32\n\n#define VC_EXTRALEAN\n#define WIN32_LEAN_AND_MEAN\n#define NOMINMAX\n#include \n#endif\n#include \n\n#define GL_GLEXT_LEGACY\n#include \n#undef GL_VERSION_1_3\n#include \"glext.h\"\n#include \"loadgl46.h\"\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show);\nvoid closeGL();\nbool loop();\nbool glOpen();\nvoid swapBuffers();\nvoid setTitle(const char* title);\nvoid showWindow();\nvoid hideWindow();\n\n#include \"glsl.h\"\n\nbool keyDown(uint vk_code);\nbool keyHit(uint vk_code);\nvoid resetHits();\n\nivec2 getMouse();\nvoid setMouse(ivec2);\n\nivec2 windowSize();\n\n// todo: make this a true class? or use some kind of \"finally\" for the close?\n// possible reasoning: don't really want singleton, but don't really want to support multiple contexts either\n// why not just global functions: to be nice, we want to free all RAII objects before closing the GL context, so this has to be RAII as well\nstruct OpenGL {\n\tOpenGL(\n\t\tint width, int height,\n\t\tconst char* title = \"\",\n\t\tbool fullscreen = false,\n\t\tbool show = true)\n\t{\n\t\tif (glOpen()) return;\n\t\tisOwning = true;\n\t\tsetupGL(width, height, title, fullscreen, show);\n\t}\n\t~OpenGL() {\n\t\tif(isOwning)\n\t\t\tcloseGL();\n\t}\n\tbool isOwning = false;\n};\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "MIT", "non_commercial": false, "comment_density": 0.054, "dedup_hash": "33c86aeadedeffdd", "has_readme": true, "build_system": "make", "dependency_count": 40, "has_demo": false} -{"id": "webgl_examples_bumpmapping", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Bumpmapping", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "bumpmapping/bumpmapping.html", "language": "html", "loc": 20, "comment_density": 0.0, "code": "\n\n\n\nCamera height: \n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "bumpmapping/bumpmapping.js", "language": "javascript", "loc": 95, "comment_density": 0.105, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-5.0, cam_height, 0];\n\nvar light_pos_radius = 5;\nvar light_pos = [-1, 5.0, 0];\n\nvar plane = new Plane;\nvar normal_map_size = 512;\nvar texture_gen_bumps = new Texture_generation_bumps;\nvar texture_gen_triangles = new Texture_generation_triangles;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if(gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n //needed to be able to have floating point textures in webgl1\n if(gl.getExtension('OES_texture_float') == null){\n alert(\"cannot have floating point textures\");\n return;\n }\n\n if(gl.getExtension('OES_texture_float_linear') == null){\n alert(\"cannot have linear floating point textures\");\n return;\n }\n\n plane.setup(gl);\n\n texture_gen_bumps.generate_normal_map(normal_map_size);\n texture_gen_triangles.generate_normal_map(normal_map_size);\n\n plane.set_normal_map(texture_gen_bumps.array_texture, normal_map_size);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n model_matrix_plane = mat4.rotate(model_matrix_plane, model_matrix_plane, 0.1*Math.PI, [0,1,0]);\n}\n\nfunction change_selection(){\n var bump_selection = document.getElementById(\"bumps\");\n var triangles_selection = document.getElementById(\"triangles\");\n\n if(bump_selection.checked == true){\n plane.set_normal_map(texture_gen_bumps.array_texture, normal_map_size);\n }\n if(triangles_selection.checked == true){\n plane.set_normal_map(texture_gen_triangles.array_texture, normal_map_size);\n }\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independent\n time_diff = time-last_time;\n\n var camera_height = document.getElementById(\"slider_height\").value;\n\n var light_speed = 80;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 5;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n plane.set_light_pos(light_pos_scaled)\n\n position_cam[1] = camera_height/10;\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "bumpmapping/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n pixel_pos = vec3(model*vertex_pos);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "bumpmapping/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 15, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform vec3 light_pos;\n\n uniform sampler2D texture;\n\n void main() {\n vec3 pixel_normal = texture2D(texture, frag_uv).xyz;\n\n //calculate phong according to the normal map\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n //have white plane affected by light\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "bumpmapping/plane.js", "language": "javascript", "loc": 138, "comment_density": 0.058, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n //prepare buffer for texture\n this.texture_id = gl.createTexture();\n }\n\n set_normal_map(normal_map_float, size){\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, size, size, 0, gl.RGB, gl.FLOAT, new Float32Array(normal_map_float));\n\n // gl.generateMipmap(gl.TEXTURE_2D);\n // or\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n pixel_pos = vec3(model*vertex_pos);\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform vec3 light_pos;\n\n uniform sampler2D texture;\n\n void main() {\n vec3 pixel_normal = texture2D(texture, frag_uv).xyz;\n\n //calculate phong according to the normal map\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n //have white plane affected by light\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "bumpmapping/texture_generation.js", "language": "javascript", "loc": 90, "comment_density": 0.111, "code": "class Texture_generation{\n\n normalize3(vec){\n var length = Math.sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])\n return [vec[0]/length, vec[1]/length, vec[2]/length]\n }\n\n cross(vec_a, vec_b){\n return [vec_a[1]*vec_b[2]-vec_a[2]*vec_b[1], vec_a[2]*vec_b[0]-vec_a[0]*vec_b[2], vec_a[0]*vec_b[1]-vec_a[1]*vec_b[0]];\n }\n\n //default flat normal map\n generate_value(x, y, size){\n return 0;\n }\n\n //generate a normal map from the texture values\n generate_normal_map(size){\n this.array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var EPSILON = 0.001;\n\n //find derivatives in both direction\n var ddi = this.generate_value(i+EPSILON, j, size)-this.generate_value(i, j, size);\n var ddj = this.generate_value(i, j+EPSILON, size)-this.generate_value(i, j, size);\n\n //make vectors from derivatives\n var der_x = [EPSILON, ddi, 0];\n var der_y = [0, ddj, EPSILON];\n\n der_x = this.normalize3(der_x)\n der_y = this.normalize3(der_y)\n\n //cross should be the normal\n var normal = this.cross(der_y, der_x);\n\n normal = this.normalize3(normal);\n\n this.array_texture.push( normal[2] ); //X\n this.array_texture.push( normal[1] ); //Y\n this.array_texture.push( normal[0] ); //Z\n }\n }\n }\n}\n\n//returns pixel for a \"bumpy\" normal map\nclass Texture_generation_bumps extends Texture_generation{\n\n generate_value(x, y, size){\n //have a flat surface with only shallow holes in it\n var sine_frequency = 8*3.1415/size;\n var val = Math.sin(sine_frequency*x)*Math.sin(sine_frequency*y);\n if (val < 0.5){\n return 0;\n }\n\n return -(val-0.5)*8;\n }\n}\n\nclass Texture_generation_triangles extends Texture_generation{\n\n generate_value_sub(x, y, center_x, center_y, size){\n var relative_x = Math.abs(x-center_x);\n var relative_y = Math.abs(y-center_y);\n\n var depth = size/4;\n\n var x_min = center_x-size;\n var x_max = center_x+size;\n var y_min = center_y-size;\n var y_max = center_y+size;\n\n if(x > x_min && x < x_max){\n if(y > y_min && y < y_max){\n if(y <= center_y && relative_y >= relative_x){\n return (y-y_min)/depth;\n }\n if(y > center_y && relative_y > relative_x){\n return (y_max-y)/depth;\n }\n if(x < center_x){\n return (x-x_min)/depth;\n }\n if(x > center_x){\n return (x_max-x)/depth;\n }\n\n }\n }\n\n return 0;\n }\n\n generate_value(x, y, size){\n var sub_div = 64;\n var square_size = 32;\n\n for (var i = 0; i < size; i+=sub_div) {\n for (var j = 0; j < size; j+=sub_div) {\n if(x > i && x < (i+sub_div)){\n if(y > j && y < (j+sub_div)){\n return this.generate_value_sub(x ,y , i+square_size, j+square_size, square_size/2);\n }\n }\n }\n }\n return 0;\n }\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.079, "dedup_hash": "150c45cd54df3d87", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_cube_rotation", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Cube Rotation", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "cube_rotation/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/cube.js", "language": "javascript", "loc": 206, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //buffers for colours\n this.col_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.colours), this.gl.STATIC_DRAW);\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"colour\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"colour\"));\n\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n text_coord = [\n // Front\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n // Back\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Top\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Bottom\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // right\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Left\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n ];\n\n colours = [\n // Front face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Back face\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Right face\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n\n // Left face\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n ];\n}\n"}, {"path": "cube_rotation/cube_rotation.html", "language": "html", "loc": 15, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "cube_rotation/cube_rotation.js", "language": "javascript", "loc": 59, "comment_density": 0.119, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar cube = new Cube;\nvar plane = new Plane;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n cube.setup(gl);\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n cube.set_vp(view_matrix, proj_matrix);\n cube.draw();\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the cube by a little bit\n var model = cube.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n cube.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "cube_rotation/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 6, "comment_density": 0.167, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/plane.js", "language": "javascript", "loc": 86, "comment_density": 0.012, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.082, "dedup_hash": "1739cc2d304a11cf", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_framebuffer", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Framebuffer", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "postprocessing/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "framebuffer/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/cube.js", "language": "javascript", "loc": 206, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //buffers for colours\n this.col_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.colours), this.gl.STATIC_DRAW);\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"colour\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"colour\"));\n\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n text_coord = [\n // Front\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n // Back\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Top\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Bottom\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // right\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Left\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n ];\n\n colours = [\n // Front face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Back face\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Right face\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n\n // Left face\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n ];\n}\n"}, {"path": "framebuffer/framebuffer.html", "language": "html", "loc": 29, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\nEffect:\n\n\n\n\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "framebuffer/framebuffer.js", "language": "javascript", "loc": 38, "comment_density": 0.158, "code": "class Framebuffer{\n\n setup(gl, image_width, image_height) {\n this.gl = gl;\n\n this.image_width = image_width;\n this.image_height = image_height;\n\n this.fb_tex = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.fb_tex);\n\n //allocate space for the texture, but feed nothing to it (null)\n //will be filled later by rendering in the framebuffer\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.image_width, this.image_height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n this.fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n\n //key part, we associate the texture with the framebuffer\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.fb_tex, 0);\n\n //create a depth buffer for the framebuffer, otherwise 3d rendering will be weird\n this.depth_buffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.depth_buffer);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, this.image_width, this.image_height);\n\n //associate the render buffer with the framebuffer\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depth_buffer);\n\n //unbind everything to avoid pollution\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n bind(){\n this.gl.viewport(0, 0, this.image_width, this.image_height);\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n }\n\n unbind(){\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n get_texture(){\n return this.fb_tex;\n }\n\n}"}, {"path": "framebuffer/main.js", "language": "javascript", "loc": 91, "comment_density": 0.099, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar cube = new Cube;\nvar plane = new Plane;\n\nvar quad_screen = new Quad_screen;\n\nvar framebuffer = new Framebuffer;\n\nvar last_time = 0;\n\nvar canvas_width = 1600;\nvar canvas_height = 900;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n canvas_width = gl.canvas.width;\n canvas_height = gl.canvas.height;\n\n cube.setup(gl);\n\n plane.setup(gl);\n\n quad_screen.setup(gl, canvas_width, canvas_height);\n\n framebuffer.setup(gl, canvas_width, canvas_height);\n\n quad_screen.set_framebuffer_texture(framebuffer.get_texture());\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n change_selection();\n}\n\nfunction change_selection(){\n\n if(document.getElementById(\"nothing\").checked == true){\n quad_screen.set_effect_active(0);\n }\n if(document.getElementById(\"invert\").checked == true){\n quad_screen.set_effect_active(1);\n }\n if(document.getElementById(\"gaussian\").checked == true){\n quad_screen.set_effect_active(2);\n }\n if(document.getElementById(\"sobel\").checked == true){\n quad_screen.set_effect_active(3);\n }\n if(document.getElementById(\"glass\").checked == true){\n quad_screen.set_effect_active(4);\n }\n}\n\nfunction draw(){\n //will render in frambuffer\n framebuffer.bind();\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n cube.set_vp(view_matrix, proj_matrix);\n cube.draw();\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the cube by a little bit\n var model = cube.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n cube.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n //everything after that will be rendered in the canvas\n framebuffer.unbind();\n\n quad_screen.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "framebuffer/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 6, "comment_density": 0.167, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/plane.js", "language": "javascript", "loc": 86, "comment_density": 0.012, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "framebuffer/quad_screen.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n gl_Position = vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/quad_screen.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 93, "comment_density": 0.054, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n uniform int effect_select;\n\n uniform float tex_width;\n uniform float tex_height;\n\n //grayscale\n float col_to_gs(vec3 vec){\n return 0.21*vec.x + 0.72*vec.y + 0.07*vec.z;\n }\n\n void main() {\n vec3 color_out = vec3(0.0, 0.0, 0.0);\n\n if(effect_select == 0){\n gl_FragColor = texture2D(texture, frag_uv);\n }\n else if(effect_select == 1){\n gl_FragColor = vec4(vec3(1.0)-texture2D(texture, frag_uv).rgb, 1.0);\n }\n else if(effect_select == 2){\n\n const int gauss_mat_size = 12;\n float variance = 10.0;\n float mean = float(gauss_mat_size)/2.0;\n float gauss_mat[gauss_mat_size];\n float gauss_mat_coef = 0.0;\n\n //init the blurring mat\n for(int i = 0; i < gauss_mat_size; i++){\n float val = 1.0/sqrt(2.0*3.1415*variance);\n val = val*pow(2.7182818, -pow((float(i)-mean), 2.0)/(2.0*variance));\n gauss_mat[i] = val;\n gauss_mat_coef += val;\n }\n\n gauss_mat_coef = 1.0/(gauss_mat_coef*gauss_mat_coef);\n\n for(int i = 0; i < gauss_mat_size; i++){\n float rel_i = float(i-(gauss_mat_size-1)/2);\n float sum = 0.0;\n for(int j = 0; j < gauss_mat_size; j++){\n float rel_j = float(j-(gauss_mat_size-1)/2);\n float matrix_val = gauss_mat[i]*gauss_mat[j];\n color_out += matrix_val*texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb;\n }\n }\n\n color_out = color_out*gauss_mat_coef;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 3){\n\n const int sobel_x_size = 3;\n // float sobel_x[sobel_x_size*sobel_x_size] = float[](1, 0, -1, 2, 0, -2, 1, 0, -1); //only glsl3.0\n float sobel_x[sobel_x_size*sobel_x_size];\n sobel_x[0] = 1.0;\n sobel_x[1] = 0.0;\n sobel_x[2] = -1.0;\n sobel_x[3] = 2.0;\n sobel_x[4] = 0.0;\n sobel_x[5] = -2.0;\n sobel_x[6] = 1.0;\n sobel_x[7] = 0.0;\n sobel_x[8] = -1.0;\n\n const int sobel_y_size = 3;\n // float sobel_y[sobel_y_size*sobel_y_size] = float[](1, 2, 1, 0, 0, 0, -1, -2, -1); //only glsl3.0\n float sobel_y[sobel_y_size*sobel_y_size];\n sobel_y[0] = 1.0;\n sobel_y[1] = 2.0;\n sobel_y[2] = 1.0;\n sobel_y[3] = 0.0;\n sobel_y[4] = 0.0;\n sobel_y[5] = 0.0;\n sobel_y[6] = -1.0;\n sobel_y[7] = -2.0;\n sobel_y[8] = -1.0;\n\n float edge_x = 0.0;\n float edge_y = 0.0;\n\n for(int i = 0; i < sobel_x_size; i++){\n float rel_i = float(i)-(float(sobel_x_size)-1.0)/2.0;\n\n for(int j = 0; j < sobel_y_size; j++){\n float rel_j = float(j)-(float(sobel_y_size)-1.0)/2.0;\n float grayscale_pixel = col_to_gs(texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb);\n edge_x += sobel_x[j*3+i]*grayscale_pixel;\n edge_y += sobel_y[j*3+i]*grayscale_pixel;\n }\n }\n\n color_out = vec3(sqrt(edge_x*edge_x+edge_y*edge_y));\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 4){\n float move_x = sin(frag_uv.x*500.0)*10.0;\n float move_y = sin(frag_uv.y*500.0)*10.0;\n\n color_out = texture2D(texture, frag_uv+vec2(move_x/tex_width,move_y/tex_height)).rgb;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else{\n gl_FragColor = texture2D(texture, frag_uv);\n }\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/quad_screen.js", "language": "javascript", "loc": 175, "comment_density": 0.034, "code": "\nclass Quad_screen{\n\n setup(gl, screen_width, screen_height){\n this.gl = gl;\n\n this.screen_width = screen_width;\n this.screen_height = screen_height;\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n this.effect_active = 0;\n }\n\n set_framebuffer_texture(tex){\n this.fb_texture_id = tex;\n }\n\n set_effect_active(effect){\n this.effect_active = effect;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.fb_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"effect_select\"), this.effect_active);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"tex_width\"), this.screen_width);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"tex_height\"), this.screen_height);\n\n\n this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n gl_Position = vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n uniform int effect_select;\n\n uniform float tex_width;\n uniform float tex_height;\n\n //grayscale\n float col_to_gs(vec3 vec){\n return 0.21*vec.x + 0.72*vec.y + 0.07*vec.z;\n }\n\n void main() {\n vec3 color_out = vec3(0.0, 0.0, 0.0);\n\n if(effect_select == 0){\n gl_FragColor = texture2D(texture, frag_uv);\n }\n else if(effect_select == 1){\n gl_FragColor = vec4(vec3(1.0)-texture2D(texture, frag_uv).rgb, 1.0);\n }\n else if(effect_select == 2){\n\n const int gauss_mat_size = 12;\n float variance = 10.0;\n float mean = float(gauss_mat_size)/2.0;\n float gauss_mat[gauss_mat_size];\n float gauss_mat_coef = 0.0;\n\n //init the blurring mat\n for(int i = 0; i < gauss_mat_size; i++){\n float val = 1.0/sqrt(2.0*3.1415*variance);\n val = val*pow(2.7182818, -pow((float(i)-mean), 2.0)/(2.0*variance));\n gauss_mat[i] = val;\n gauss_mat_coef += val;\n }\n\n gauss_mat_coef = 1.0/(gauss_mat_coef*gauss_mat_coef);\n\n for(int i = 0; i < gauss_mat_size; i++){\n float rel_i = float(i-(gauss_mat_size-1)/2);\n float sum = 0.0;\n for(int j = 0; j < gauss_mat_size; j++){\n float rel_j = float(j-(gauss_mat_size-1)/2);\n float matrix_val = gauss_mat[i]*gauss_mat[j];\n color_out += matrix_val*texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb;\n }\n }\n\n color_out = color_out*gauss_mat_coef;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 3){\n\n const int sobel_x_size = 3;\n // float sobel_x[sobel_x_size*sobel_x_size] = float[](1, 0, -1, 2, 0, -2, 1, 0, -1); //only glsl3.0\n float sobel_x[sobel_x_size*sobel_x_size];\n sobel_x[0] = 1.0;\n sobel_x[1] = 0.0;\n sobel_x[2] = -1.0;\n sobel_x[3] = 2.0;\n sobel_x[4] = 0.0;\n sobel_x[5] = -2.0;\n sobel_x[6] = 1.0;\n sobel_x[7] = 0.0;\n sobel_x[8] = -1.0;\n\n const int sobel_y_size = 3;\n // float sobel_y[sobel_y_size*sobel_y_size] = float[](1, 2, 1, 0, 0, 0, -1, -2, -1); //only glsl3.0\n float sobel_y[sobel_y_size*sobel_y_size];\n sobel_y[0] = 1.0;\n sobel_y[1] = 2.0;\n sobel_y[2] = 1.0;\n sobel_y[3] = 0.0;\n sobel_y[4] = 0.0;\n sobel_y[5] = 0.0;\n sobel_y[6] = -1.0;\n sobel_y[7] = -2.0;\n sobel_y[8] = -1.0;\n\n float edge_x = 0.0;\n float edge_y = 0.0;\n\n for(int i = 0; i < sobel_x_size; i++){\n float rel_i = float(i)-(float(sobel_x_size)-1.0)/2.0;\n\n for(int j = 0; j < sobel_y_size; j++){\n float rel_j = float(j)-(float(sobel_y_size)-1.0)/2.0;\n float grayscale_pixel = col_to_gs(texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb);\n edge_x += sobel_x[j*3+i]*grayscale_pixel;\n edge_y += sobel_y[j*3+i]*grayscale_pixel;\n }\n }\n\n color_out = vec3(sqrt(edge_x*edge_x+edge_y*edge_y));\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 4){\n float move_x = sin(frag_uv.x*500.0)*10.0;\n float move_y = sin(frag_uv.y*500.0)*10.0;\n\n color_out = texture2D(texture, frag_uv+vec2(move_x/tex_width,move_y/tex_height)).rgb;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else{\n gl_FragColor = texture2D(texture, frag_uv);\n }\n }\n `;\n\n positions = [\n -1.0, -1.0, 0.0,\n +1.0, -1.0, 0.0,\n -1.0, +1.0, 0.0,\n +1.0, +1.0, 0.0,\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 0.0, 1.0,\n 1.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_framebuffer.png", "license": "none-found", "non_commercial": false, "comment_density": 0.073, "dedup_hash": "030154224714a88c", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} -{"id": "webgl_examples_grass", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Grass", "api": "OpenGL/WebGL", "glsl_version": "300 es", "topic": "instancing/texturing/vegetation/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "grass/grass.html", "language": "html", "loc": 24, "comment_density": 0.0, "code": "\n\n\n\nWind speed: \nCamera position:
\nNumber of grass blades:\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "grass/grass_manager.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 51, "comment_density": 0.039, "code": "#version 300 es\n precision mediump float;\n in vec4 vertex_pos;\n\n in mat4 mat_model;\n in vec2 uv;\n\n out vec3 pixel_pos;\n out vec2 global_uv;\n out vec2 frag_uv;\n out vec2 rel_tex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n uniform sampler2D tex_wind;\n\n void main() {\n pixel_pos = vec3(mat_model*vertex_pos);\n\n vec2 relative_tex_pos = vec2(pixel_pos.x/100.0+0.5, pixel_pos.z/100.0+0.5);\n global_uv = relative_tex_pos;\n\n frag_uv = uv;\n\n vec2 wind_dir = vec2(time, time);\n float wind_x = texture(tex_wind, relative_tex_pos+wind_dir ).r-0.5;\n float wind_z = texture(tex_wind, relative_tex_pos+vec2(0.5, 0.5)+wind_dir ).r-0.5;\n\n //make wind a bit more dramatic\n wind_x *= 2.0;\n wind_z *= 2.0;\n\n rel_tex_pos = relative_tex_pos;\n\n vec3 new_pos = vec3(mat_model*vertex_pos);\n\n //move the top vertex of the grass move more than the lower ones\n if(gl_VertexID == 0){\n wind_x *= 3.0;\n wind_z *= 3.0;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 1 || gl_VertexID == 2 ){\n wind_x *= 1.5;\n wind_z *= 1.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 3 || gl_VertexID == 4 ){\n wind_x *= 0.5;\n wind_z *= 0.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n\n gl_Position = proj*view*vec4(new_pos, 1.0);\n }", "glsl_version": "300 es", "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/grass_manager.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 19, "comment_density": 0.158, "code": "#version 300 es\n precision mediump float;\n\n in vec3 pixel_pos;\n in vec2 global_uv;\n in vec2 frag_uv;\n in vec2 rel_tex_pos;\n\n out vec4 color;\n\n uniform vec3 light_pos;\n uniform sampler2D tex_wind;\n\n uniform float time;\n\n void main() {\n //get a random value for this blade from its position, will be used to vary the colour a bit from grass to grass\n float rand_val = mod((global_uv.x*global_uv.x)+(0.13-global_uv.x*global_uv.y), 0.01)/0.01;\n\n //make the edges of the blade lighter\n float dist_to_centre = pow(distance(frag_uv, vec2(0.5, 0.5)), 2.0);\n\n //make the base a bit darker\n float dist_to_ground = clamp((1.0-frag_uv.y)*1.0, 0.0, 1.0);\n\n color = vec4( (0.1+rand_val/6.0+dist_to_centre)*dist_to_ground, (0.3+dist_to_centre)*dist_to_ground, (0.0+dist_to_centre)*dist_to_ground, 1.0);\n }", "glsl_version": "300 es", "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/grass_manager.js", "language": "javascript", "loc": 256, "comment_density": 0.105, "code": "class Grass_manager{\n\n setup(gl, plane){\n this.gl = gl;\n\n this.base = plane;\n\n this.max_grass = 16000;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), gl.STATIC_DRAW);\n\n //generate a model matrix for each grass blade, that will be put in a buffer, to be drawn with instanced rendering\n this.lst_transforms = []\n\n for (let i = 0; i < this.max_grass; i++) {\n var pos_x = 100*(Math.random()-0.5)\n var pos_y = 100*(Math.random()-0.5)\n this.lst_transforms[i] = this.get_grass_matrix(pos_x, pos_y);\n }\n\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.lst_transforms.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n //generate the wind texture\n var wind_tex_size = 512;\n\n this.generate_wind_texture(wind_tex_size);\n\n this.texture_id = gl.createTexture();\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, wind_tex_size, wind_tex_size, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.wind_array_texture));\n\n //mirrored repeat as we will pan over the texture multiple times\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n\n this.time = 0;\n }\n\n set_max_grass(mg){\n this.max_grass = mg;\n }\n\n //do a bit of matrix rotations (with randomness) to get a blade of grass standing up\n get_grass_matrix(pos_x, pos_y){\n var model_matrix_grass = mat4.create();\n\n mat4.translate(model_matrix_grass, model_matrix_grass, [0, this.base.get_height(pos_x,pos_y), 0]);\n mat4.translate(model_matrix_grass, model_matrix_grass, [pos_x, 0, pos_y]);\n mat4.scale(model_matrix_grass, model_matrix_grass, [0.3, 1.7, 0.3]);\n mat4.scale(model_matrix_grass, model_matrix_grass, [1, 1+Math.random(), 1]);\n mat4.translate(model_matrix_grass, model_matrix_grass, [0, 2, 0]);\n mat4.rotate(model_matrix_grass, model_matrix_grass, 3.1415/4.0*pos_x*pos_y*5.244 ,[0, 1, 0]);\n mat4.rotate(model_matrix_grass, model_matrix_grass, 3.1415/2.0 ,[1, 0, 0]);\n\n return model_matrix_grass;\n }\n\n //generate wind texture, which will impact the position of the grass\n //only R component of the texture will be used\n generate_wind_texture(size){\n this.wind_array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var val = Math.sin(i/size*16)*Math.cos(j/size*8);\n val += 0.25*Math.sin(i/size*32)*Math.cos(j/size*64);\n this.wind_array_texture.push( val*64+128 ); //R\n this.wind_array_texture.push( 0.0 ); //G useless\n this.wind_array_texture.push( 0.0 ); //B useless\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_time(t){\n this.time = t;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //setup the buffer to tell webgl to use a single mat4 matrix per instanced rendering, a bit wordy$\n //webgl2 was needed for the instanced rendering\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"mat_model\");\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.lst_transforms[0] );\n\n this.gl.uniform1f( this.gl.getUniformLocation(this.shader_program, \"time\"), this.time );\n\n this.gl.activeTexture(gl.TEXTURE0);\n\n this.gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n this.gl.uniform1i(gl.getUniformLocation(this.shader_program, \"tex_wind\"), 0);\n\n\n this.gl.disable(this.gl.CULL_FACE);\n\n //tell webgl we will draw max_grass blades that each contains 15 vertices\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, 15, this.gl.UNSIGNED_SHORT, 0, this.max_grass);\n\n this.gl.enable(this.gl.CULL_FACE);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n }\n\n //needed glsl 3 for gl_VertexID\n vertex_shader_code = `#version 300 es\n precision mediump float;\n in vec4 vertex_pos;\n\n in mat4 mat_model;\n in vec2 uv;\n\n out vec3 pixel_pos;\n out vec2 global_uv;\n out vec2 frag_uv;\n out vec2 rel_tex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n uniform sampler2D tex_wind;\n\n void main() {\n pixel_pos = vec3(mat_model*vertex_pos);\n\n vec2 relative_tex_pos = vec2(pixel_pos.x/100.0+0.5, pixel_pos.z/100.0+0.5);\n global_uv = relative_tex_pos;\n\n frag_uv = uv;\n\n vec2 wind_dir = vec2(time, time);\n float wind_x = texture(tex_wind, relative_tex_pos+wind_dir ).r-0.5;\n float wind_z = texture(tex_wind, relative_tex_pos+vec2(0.5, 0.5)+wind_dir ).r-0.5;\n\n //make wind a bit more dramatic\n wind_x *= 2.0;\n wind_z *= 2.0;\n\n rel_tex_pos = relative_tex_pos;\n\n vec3 new_pos = vec3(mat_model*vertex_pos);\n\n //move the top vertex of the grass move more than the lower ones\n if(gl_VertexID == 0){\n wind_x *= 3.0;\n wind_z *= 3.0;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 1 || gl_VertexID == 2 ){\n wind_x *= 1.5;\n wind_z *= 1.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 3 || gl_VertexID == 4 ){\n wind_x *= 0.5;\n wind_z *= 0.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n\n gl_Position = proj*view*vec4(new_pos, 1.0);\n }\n `;\n\n fragment_shader_code = `#version 300 es\n precision mediump float;\n\n in vec3 pixel_pos;\n in vec2 global_uv;\n in vec2 frag_uv;\n in vec2 rel_tex_pos;\n\n out vec4 color;\n\n uniform vec3 light_pos;\n uniform sampler2D tex_wind;\n\n uniform float time;\n\n void main() {\n //get a random value for this blade from its position, will be used to vary the colour a bit from grass to grass\n float rand_val = mod((global_uv.x*global_uv.x)+(0.13-global_uv.x*global_uv.y), 0.01)/0.01;\n\n //make the edges of the blade lighter\n float dist_to_centre = pow(distance(frag_uv, vec2(0.5, 0.5)), 2.0);\n\n //make the base a bit darker\n float dist_to_ground = clamp((1.0-frag_uv.y)*1.0, 0.0, 1.0);\n\n color = vec4( (0.1+rand_val/6.0+dist_to_centre)*dist_to_ground, (0.3+dist_to_centre)*dist_to_ground, (0.0+dist_to_centre)*dist_to_ground, 1.0);\n }\n `;\n\n positions = [\n 0.0, 0.0, -2.0, // 0\n -1.0, 0.0, 0.0, // 1\n 1.0, 0.0, 0.0, // 2\n -1.0, 0.0, 1.0, // 3\n 1.0, 0.0, 1.0, // 4\n -1.0, 0.0, 2.0, // 5\n 1.0, 0.0, 2.0, // 6\n ];\n\n indices = [\n 0, 1, 2,\n 2, 1, 3,\n 2, 3, 4,\n 4, 3, 5,\n 4, 5, 6,\n ];\n\n tex_coord = [\n 0.5, 0.0,\n 0.0, 0.5,\n 1.0, 0.5,\n 0.0, 0.75,\n 1.0, 0.75,\n 0.0, 1.0,\n 1.0, 1.0,\n ];\n}\n\n"}, {"path": "grass/main.js", "language": "javascript", "loc": 69, "comment_density": 0.087, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\nvar model_matrix_grass_manager = mat4.create();\n\nvar cam_height = 25;\nvar position_cam = [-70.0, cam_height, 0];\n\nvar plane = new Plane_sine;\nvar grass_manager = new Grass_manager;\n\nvar last_time = 0;\n\nvar time_wind = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl2\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL2\");\n return;\n }\n\n plane.setup(gl);\n\n mat4.scale(model_matrix_plane, model_matrix_plane, [50, 3, 50]);\n mat4.scale(model_matrix_grass_manager, model_matrix_grass_manager, [1, 1, 1]);\n mat4.translate(model_matrix_grass_manager, model_matrix_grass_manager, [0, 0, 0]);\n\n plane.set_model_matrix(model_matrix_plane);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n grass_manager.setup(gl, plane);\n}\n\nfunction draw(){\n var cam_pos = document.getElementById(\"camera_position\").value;\n\n position_cam[0] = -cam_pos;\n\n mat4.lookAt(view_matrix, position_cam, [70-cam_pos, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independent\n time_diff = time-last_time;\n\n var wind_speed = document.getElementById(\"slider_speed\").value;\n // wind_speed = wind_speed/50.0;\n time_wind += wind_speed/70000.0;\n\n if(document.getElementById(\"16000\").checked == true){\n grass_manager.set_max_grass(16000);\n }\n else if(document.getElementById(\"8000\").checked == true){\n grass_manager.set_max_grass(8000);\n }\n else if(document.getElementById(\"4000\").checked == true){\n grass_manager.set_max_grass(4000);\n }\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n grass_manager.set_time( time_wind);\n grass_manager.set_mvp(model_matrix_grass_manager, view_matrix, proj_matrix);\n grass_manager.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "grass/plane_sine.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/plane_sine.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float;\n\n void main() {\n // just output some brown color\n gl_FragColor = vec4(0.3, 0.14, 0.07, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/plane_sine.js", "language": "javascript", "loc": 137, "comment_density": 0.226, "code": "class Plane_sine{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n this.nb_vertices_side = 48;//default\n\n this.generate_geometry();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.vertices), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n }\n\n //the shape of the plane\n get_height_priv(x, z){\n return Math.sin(x*5)+Math.sin(z*5);\n }\n\n generate_geometry()\n {\n var increment = 1.0/(this.nb_vertices_side-1);\n\n this.vertices = [];\n\n //the vertices\n for (let y = 0; y < this.nb_vertices_side; y++) {\n for (let x = 0; x < this.nb_vertices_side; x++) {\n this.vertices.push(-1.0+2*increment*x);\n this.vertices.push(this.get_height_priv(-1.0+2*increment*x, -1.0+2*increment*y));\n this.vertices.push(-1.0+2*increment*y);\n }\n }\n\n this.indices = [];\n\n //generate the indices\n for (let y = 0; y < this.nb_vertices_side-1; y++) {\n for (let x = 0; x < this.nb_vertices_side-1; x++) {\n var this_vertice = y*this.nb_vertices_side+x;\n //one of the triangle\n this.indices.push(this_vertice+1); //top right\n this.indices.push(this_vertice);\n this.indices.push(this_vertice+this.nb_vertices_side);\n\n this.indices.push(this_vertice+this.nb_vertices_side);\n this.indices.push(this_vertice+this.nb_vertices_side+1);\n this.indices.push(this_vertice+1);\n }\n }\n }\n\n //get the height of the plane from position, but taking into account a model matrix for the shape (ex scale)\n get_height(pos_x, pos_y){\n //just assume a simple scale matrix, to simplify the matrix manipulations\n\n var pos_x_transf = pos_x/this.model[0]; // [0][0];\n var pos_y_transf = pos_y/this.model[10]; // [2][2] as mat4 is a 1D array\n\n var height = this.get_height_priv(pos_x_transf, pos_y_transf);\n\n return height*this.model[5] //[1][1];\n }\n\n //old version with any type of model matrix, annoying\n // get_height_old(pos_x, pos_y){\n // var vec = vec4.create();\n // vec[0] = pos_x;\n // vec[1] = 0;\n // vec[2] = pos_y;\n // vec[3] = 1.0;\n\n // var vec_transf = vec4.create();\n // vec4.transformMat4(vec_transf, vec, this.model);\n\n // var height = this.get_height_priv(vec_transf[0], vec_transf[2]);\n\n // var vec_height = vec4.create();\n // vec[0] = 0;\n // vec[1] = height;\n // vec[2] = 0;\n // vec[3] = 1.0;\n\n // var model_height = vec4.create();\n // vec4.transformMat4(model_height, vec_height, this.model);\n\n // return model_height[1];\n // }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n var nb_squares = this.nb_vertices_side-1;\n var nb_vertices_to_draw = nb_squares*nb_squares*6;\n\n this.gl.drawElements(this.gl.TRIANGLES, nb_vertices_to_draw, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float;\n\n void main() {\n // just output some brown color\n gl_FragColor = vec4(0.3, 0.14, 0.07, 1.0);\n }\n `;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_grass.png", "license": "none-found", "non_commercial": false, "comment_density": 0.102, "dedup_hash": "4a699a3f1c50ebec", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_shading", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Shading", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "shading/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/cube.js", "language": "javascript", "loc": 193, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "shading/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/plane.js", "language": "javascript", "loc": 112, "comment_density": 0.009, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n}\n"}, {"path": "shading/shading.html", "language": "html", "loc": 16, "comment_density": 0.0, "code": "\n\n\n\nLight Speed: \nLight Height:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "shading/shading.js", "language": "javascript", "loc": 91, "comment_density": 0.11, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\nvar model_matrix_cubes = [mat4.create(), mat4.create()];\n\nvar cam_height = 5;\nvar position_cam = [-20.0, cam_height, -20.0];\n\nvar rotating_cube = new Cube;\n\nvar cubes = [new Cube, new Cube];\nvar plane = new Plane;\n\nvar light_pos_radius = 10;\nvar light_pos = [-1, 5.0, 0];\n\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n rotating_cube.setup(gl);\n cubes[0].setup(gl);\n cubes[1].setup(gl);\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [10, 1, 10]);\n\n mat4.translate(model_matrix_cubes[0], model_matrix_cubes[0], [0, 1, 5]);\n mat4.translate(model_matrix_cubes[1], model_matrix_cubes[1], [5, 1, -5]);\n\n cubes[0].set_model_matrix(model_matrix_cubes[0]);\n cubes[1].set_model_matrix(model_matrix_cubes[1]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independant\n time_diff = time-last_time;\n\n var light_speed = document.getElementById(\"slider_speed\").value;\n var light_height = document.getElementById(\"slider_height\").value;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 11.0-light_height;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n plane.set_light_pos(light_pos_scaled);\n rotating_cube.set_light_pos(light_pos_scaled);\n cubes[0].set_light_pos(light_pos_scaled);\n cubes[1].set_light_pos(light_pos_scaled);\n\n //rotate the model matrix of the cube by a little bit\n var model = rotating_cube.get_model_matrix();\n model = mat4.rotate(model, model, 2*Math.PI*time_diff*10, [0,1,0]);\n rotating_cube.set_model_matrix(model);\n\n rotating_cube.set_vp(view_matrix, proj_matrix);\n rotating_cube.draw();\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n cubes[0].set_mvp(model_matrix_cubes[0], view_matrix, proj_matrix);\n cubes[0].draw();\n\n cubes[1].set_mvp(model_matrix_cubes[1], view_matrix, proj_matrix);\n cubes[1].draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.086, "dedup_hash": "bbda8f24a4fd9735", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_texturing", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Texturing", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "texturing/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "texturing/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 7, "comment_density": 0.286, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = texture2D(texture, frag_uv);\n // gl_FragColor = vec4(frag_uv, 0.0, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "texturing/plane.js", "language": "javascript", "loc": 134, "comment_density": 0.082, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n //generate texture\n this.size_texture = 8;\n this.generate_texture(this.size_texture)\n\n //prepare buffer for texture\n this.texture_id = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, this.size_texture, this.size_texture, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.array_texture));\n\n // gl.generateMipmap(gl.TEXTURE_2D);\n //or\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n\n }\n\n generate_texture(size){\n this.array_texture = [];\n\n //for normalization\n var max_size = size*size;\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n this.array_texture.push( (i*j)/max_size*255 ); //R\n this.array_texture.push( (size-i)*j/max_size*255 ); //G\n this.array_texture.push( i*(size-j)/max_size*255 ); //B\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = texture2D(texture, frag_uv);\n // gl_FragColor = vec4(frag_uv, 0.0, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "texturing/texturing.html", "language": "html", "loc": 14, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n"}, {"path": "texturing/texturing.js", "language": "javascript", "loc": 55, "comment_density": 0.127, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar plane = new Plane;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the plane by a little bit\n var model = plane.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n plane.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.099, "dedup_hash": "9b7ee98367e2a266", "has_readme": true, "build_system": null, "dependency_count": 4, "has_demo": true} -{"id": "webgl_examples_tree", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Tree", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "lighting/texturing/vegetation/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "tree/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.0, "code": "precision highp float;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/cube.js", "language": "javascript", "loc": 197, "comment_density": 0.147, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n this.light_pos = [0,0,0];\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.useProgram(this.shader_program);\n this.gl.bindVertexArray(this.vao);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision highp float;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "tree/leaves.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 44, "comment_density": 0.159, "code": "precision mediump float;\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n attribute vec3 raw_position;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n uniform vec2 wind_offset;\n\n uniform sampler2D tex_wind;\n\n void main() {\n mat4 global_model = model*model_mat;\n\n vec3 new_pos_tex = vec3(global_model*vertex_pos);\n\n //rotate a bit the leaves according to a wind texture map\n vec2 relative_tex_pos = vec2(new_pos_tex.x/40.0+0.5, new_pos_tex.z/40.0+0.5);\n\n float wind_x = texture2D(tex_wind, (relative_tex_pos+wind_offset) ).r;\n float wind_z = texture2D(tex_wind, (relative_tex_pos+vec2(0.5, 0.5)+wind_offset) ).r;\n\n //rotation around x axis\n mat4 rot_mat_x = mat4(1, 0, 0, 0,\n 0, cos(wind_x), -sin(wind_x), 0,\n 0, sin(wind_x), cos(wind_x), 0,\n 0, 0, 0, 1);\n\n //rotation around z axis\n mat4 rot_mat_z = mat4(cos(wind_z), -sin(wind_z), 0, 0,\n sin(wind_z), cos(wind_x), 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 1);\n\n vec4 new_pos = (global_model*rot_mat_x*rot_mat_z*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(global_model)));\n mat3 normal_mat = mat3(global_model);\n\n pixel_pos = vec3(new_pos);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*new_pos;\n\n frag_relative_ground_pos = raw_position.y;\n\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/leaves.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 22, "comment_density": 0.182, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform vec3 light_pos;\n uniform vec2 wind_offset;\n\n void main() {\n\n float distance_to_middle = distance(frag_uv, vec2(0.5, 0.5));\n\n //have some sort of leaf shape instead of a rough triangle\n if(distance_to_middle > 0.5 ){\n discard;\n }\n\n //have a repeatable random value according to relative position of the leaf to the centre of the batch\n float rand_val = sin(pixel_pos.x*pixel_pos.z/10.0)+cos( (0.13-pixel_pos.x*pixel_pos.y) / 10.0 );\n\n gl_FragColor.a = 1.0;\n\n //if the leaf is under the \"centre\" of the batch, draw it darker (to have a canopy effect)\n float light_intensity = (frag_relative_ground_pos+0.6)*1.5;\n light_intensity = clamp(light_intensity, 0.0, 1.0);\n float reverse_dist_to_middle = 1.0-distance_to_middle;\n\n gl_FragColor.rgb = vec3(0.1+rand_val/6.0, 0.4, 0.05)*light_intensity*reverse_dist_to_middle;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/leaves.js", "language": "javascript", "loc": 284, "comment_density": 0.12, "code": "class Leaves{\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n // indices for the texture pos\n this.texcoord_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), this.gl.STATIC_DRAW)\n\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.mat_vector.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n this.rel_pos_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.rel_pos_list);\n\n var pos_vec_flat = this.pos_vector.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(pos_vec_flat), this.gl.STATIC_DRAW);\n\n this.nb_leaves = this.mat_vector.length;\n this.light_pos = [0, 0, 0];\n\n //generate the wind texture\n var wind_tex_size = 512;\n\n this.generate_wind_texture(wind_tex_size);\n\n this.texture_id = gl.createTexture();\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, wind_tex_size, wind_tex_size, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.wind_array_texture));\n\n //mirrored repeat as we will pan over the texture multiple times\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n\n this.wind_offset = [1,1];\n }\n\n generate(end_point_matrices){\n this.mat_vector = []\n this.pos_vector = []\n\n var leaves_scale = 1.0/32.0;\n\n for (let i = 0; i < end_point_matrices.length; i++) {\n var incr = 0.4;\n for (let x = -1.0; x < 1.0; x+=incr) {\n for (let y = -1.0; y < 1.0; y+=incr) {\n for (let z = -1.0; z < 1.0; z+=incr) {\n var dist_to_centre = Math.sqrt(x*x+y*y+z*z);\n if(dist_to_centre < 1.0){\n var t = mat4.create();\n var random_rot = mat4.create();\n //add a bit of randomness to not have a grid of leaves\n mat4.rotate(random_rot, random_rot, Math.random(), [1.0, 0.0, 0.0] );\n mat4.rotate(random_rot, random_rot, Math.random(), [0.0, 1.0, 0.0] );\n mat4.rotate(random_rot, random_rot, Math.random(), [0.0, 0.0, 1.0] );\n\n mat4.multiply(t, t, random_rot);\n mat4.translate(t, t, [x*leaves_scale*4, y*leaves_scale*4, z*leaves_scale*4]);\n mat4.multiply(t, t, random_rot);//rotates again the leaves so they don't have the same orientation\n mat4.scale(t, t, [leaves_scale, leaves_scale, leaves_scale]);\n\n var end_mat = mat4.create();\n mat4.multiply(end_mat, end_point_matrices[i], t);\n this.mat_vector.push(end_mat);\n\n var val = vec4.create();\n val[0] = x;\n val[1] = y;\n val[2] = z;\n val[3] = 1;\n var val_transf = vec4.create();\n vec4.transformMat4(val_transf, val, random_rot);\n var val_transf3 = [val_transf[0], val_transf[1], val_transf[2]];\n this.pos_vector.push(val_transf3);\n }\n }\n }\n }\n\n }\n }\n\n //generate wind texture, which will impact the position of the grass\n //only R component of the texture will be used\n generate_wind_texture(size){\n this.wind_array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var val = Math.sin(i/size*16)*Math.cos(j/size*8);\n this.wind_array_texture.push( val*64+128 ); //R\n this.wind_array_texture.push( 0.0 ); //G useless\n this.wind_array_texture.push( 0.0 ); //B useless\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_time(t){\n var time_delta = t-this.time;\n this.wind_offset[0] = (t*16)%10\n this.wind_offset[1] = (t*8)%10\n this.time = t;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.uniform2fv(\n this.gl.getUniformLocation(this.shader_program, \"wind_offset\"),\n this.wind_offset);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"model_mat\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"raw_position\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.rel_pos_list);\n\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"raw_position\"));\n this.gl.vertexAttribPointer(this.gl.getAttribLocation(this.shader_program, \"raw_position\"), 3, this.gl.FLOAT, this.gl.FALSE, 12, 0);\n\n this.gl.vertexAttribDivisor(this.gl.getAttribLocation(this.shader_program, \"raw_position\"), 1);\n\n\n this.gl.activeTexture(gl.TEXTURE0);\n\n this.gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n this.gl.uniform1i(gl.getUniformLocation(this.shader_program, \"tex_wind\"), 0);\n\n this.gl.disable(this.gl.CULL_FACE);\n\n // this.gl.drawElements(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0);\n\n //this.transf.length\n // this.gl.drawElements(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0);\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, 3, this.gl.UNSIGNED_SHORT, 0, this.nb_leaves);\n\n this.gl.enable(this.gl.CULL_FACE);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n }\n\n vertex_shader_code = `\n precision mediump float;\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n attribute vec3 raw_position;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n uniform vec2 wind_offset;\n\n uniform sampler2D tex_wind;\n\n void main() {\n mat4 global_model = model*model_mat;\n\n vec3 new_pos_tex = vec3(global_model*vertex_pos);\n\n //rotate a bit the leaves according to a wind texture map\n vec2 relative_tex_pos = vec2(new_pos_tex.x/40.0+0.5, new_pos_tex.z/40.0+0.5);\n\n float wind_x = texture2D(tex_wind, (relative_tex_pos+wind_offset) ).r;\n float wind_z = texture2D(tex_wind, (relative_tex_pos+vec2(0.5, 0.5)+wind_offset) ).r;\n\n //rotation around x axis\n mat4 rot_mat_x = mat4(1, 0, 0, 0,\n 0, cos(wind_x), -sin(wind_x), 0,\n 0, sin(wind_x), cos(wind_x), 0,\n 0, 0, 0, 1);\n\n //rotation around z axis\n mat4 rot_mat_z = mat4(cos(wind_z), -sin(wind_z), 0, 0,\n sin(wind_z), cos(wind_x), 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 1);\n\n vec4 new_pos = (global_model*rot_mat_x*rot_mat_z*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(global_model)));\n mat3 normal_mat = mat3(global_model);\n\n pixel_pos = vec3(new_pos);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*new_pos;\n\n frag_relative_ground_pos = raw_position.y;\n\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform vec3 light_pos;\n uniform vec2 wind_offset;\n\n void main() {\n\n float distance_to_middle = distance(frag_uv, vec2(0.5, 0.5));\n\n //have some sort of leaf shape instead of a rough triangle\n if(distance_to_middle > 0.5 ){\n discard;\n }\n\n //have a repeatable random value according to relative position of the leaf to the centre of the batch\n float rand_val = sin(pixel_pos.x*pixel_pos.z/10.0)+cos( (0.13-pixel_pos.x*pixel_pos.y) / 10.0 );\n\n gl_FragColor.a = 1.0;\n\n //if the leaf is under the \"centre\" of the batch, draw it darker (to have a canopy effect)\n float light_intensity = (frag_relative_ground_pos+0.6)*1.5;\n light_intensity = clamp(light_intensity, 0.0, 1.0);\n float reverse_dist_to_middle = 1.0-distance_to_middle;\n\n gl_FragColor.rgb = vec3(0.1+rand_val/6.0, 0.4, 0.05)*light_intensity*reverse_dist_to_middle;\n }\n `;\n\n positions = [\n -1.0, -1.0, 0.0, // 0 bottom left\n 1.0, -1.0, 0.0, // 1 bottom right\n 0.0, 1.0, 0.0, // 2 top\n ];\n\n indices = [\n 0, 1, 2,\n ];\n\n normals = [\n 0, 1, 0,\n 0, 1, 0,\n ];\n\n tex_coord = [\n 0.0, 1.0,\n 1.0, 1.0,\n 0.5, 0.0,\n ];\n}"}, {"path": "tree/main.js", "language": "javascript", "loc": 72, "comment_density": 0.139, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar cam_height = 15;\nvar position_cam = [-28.0, cam_height, 0];\n\nvar light_pos = [-10, 5.0, 20];\n\nvar cube = new Cube;\nvar cube_transf = mat4.create();\n\nvar tree = new Tree;\nvar tree_transf = mat4.create();\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl2\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n // plane.setup(gl);\n cube.setup(gl);\n\n tree.setup(gl);\n\n //base platform for the tree\n mat4.scale(cube_transf, cube_transf, [20, 0.5, 20]);\n\n mat4.scale(tree_transf, tree_transf, [5, 5, 5]);\n mat4.translate(tree_transf, tree_transf, [0, 0.5, 0]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction reload_tree(){\n tree = new Tree;\n tree.setup(gl);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 10, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_active = document.getElementById(\"rotation\").checked;\n var draw_leaves_active = document.getElementById(\"leaves\").checked;\n\n //rotate the model matrix of the plane by a little bit\n var model = mat4.create();\n if(rotation_active){\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*10, [0,1,0]);\n }\n\n mat4.multiply(tree_transf, tree_transf, model);\n mat4.multiply(cube_transf, cube_transf, model);\n\n cube.set_light_pos(light_pos);\n cube.set_mvp(cube_transf, view_matrix, proj_matrix);\n cube.draw();\n\n //wind effect not that nice, leave it for now\n // tree.set_time(d.getTime()/10000.0);\n tree.set_light_pos(light_pos);\n tree.set_mvp(tree_transf, view_matrix, proj_matrix);\n tree.draw(draw_leaves_active);\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "tree/tree.html", "language": "html", "loc": 21, "comment_density": 0.048, "code": "\n\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "tree/tree.js", "language": "javascript", "loc": 33, "comment_density": 0.0, "code": "class Tree{\n setup(gl){\n this.gl = gl;\n\n this.trunk = new Trunk\n this.trunk.setup(gl);\n\n this.leaves = new Leaves;\n\n this.leaves.generate(this.trunk.get_end_point_matrices());\n\n this.leaves.setup(gl);\n }\n\n set_time(t){\n this.leaves.set_time(t);\n }\n\n draw_trunks(){\n this.trunk.draw();\n }\n\n set_mvp(model, view, proj){\n this.trunk.set_mvp(model, view, proj);\n this.leaves.set_mvp(model, view, proj);\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.trunk.set_light_pos(light_pos);\n this.light_pos = light_pos;\n }\n\n draw(draw_leaves_active){\n this.trunk.draw();\n if(draw_leaves_active){\n this.leaves.draw();\n }\n }\n}"}, {"path": "tree/trunk.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 22, "comment_density": 0.182, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n mat4 model_global = model*model_mat;\n pixel_pos = vec3(model_global*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model_global);\n\n frag_uv = uv;\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model_global*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/trunk.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 34, "comment_density": 0.059, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform vec3 light_pos;\n\n vec3 bark_high = vec3(0.6, 0.4, 0.2);\n vec3 bark_low = vec3(0.4, 0.25, 0.2);\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max);\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = dot(light_dir, pixel_normal);\n\n vec3 texture_col = get_billin(frag_uv*4.0, bark_low, bark_high);\n\n vec3 color_trunk = texture_col*diffuse_light;\n\n gl_FragColor = vec4( color_trunk , 1.0);;\n }\n\n float rand(vec2 pt)\n {\n float x = pt.x*3.13;\n float y = pt.y*7.17;\n return fract(x*y/17.0);\n }\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max)\n {\n\n float val00 = rand((pos));\n float val10 = rand((vec2(pos.x, pos.y+1.0)));\n float val01 = rand((vec2(pos.x+1.0, pos.y)));\n float val11 = rand((vec2(pos.x+1.0, pos.y+1.0)));\n\n vec2 pos_fract = fract(pos);\n\n //2d linear interpolation\n float val_x0 = mix(val00, val01, pos_fract.x);\n float val_x1 = mix(val10, val11, pos_fract.x);\n\n float final_val = mix(val_x0, val_x1, pos_fract.y);\n\n return mix(max, min, final_val);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/trunk.js", "language": "javascript", "loc": 349, "comment_density": 0.112, "code": "class Trunk{\n setup(gl){\n this.gl = gl;\n\n this.create_positions();\n\n this.transf = [];\n\n this.rand_vals = [];\n this.end_point_matrices = [];\n\n //have fixed random values for each iteration of the trunks\n for (let i = 0; i < 32; i++) {\n this.rand_vals.push( Math.random());\n }\n\n //first trunk (axiom or root of the lsystem)\n var trunk_initial_transf = mat4.create();\n mat4.translate(trunk_initial_transf, trunk_initial_transf, [0, 0.5, 0]);\n mat4.scale(trunk_initial_transf, trunk_initial_transf, [1.5/14, 1, 1.5/14]);\n\n this.add_sub_trunks_lsystem_random(trunk_initial_transf, 0, 5, true);\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n //indices for the texture pos\n this.texcoord_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), this.gl.STATIC_DRAW)\n\n //this.transf\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.transf.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n this.nb_trunks = this.transf.length;\n this.light_pos = [0, 0, 0];\n }\n\n get_end_point_matrices(){\n return this.end_point_matrices;\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"model_mat\");\n\n const ext = this.gl.getExtension(\"ANGLE_instanced_arrays\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0, this.nb_trunks);\n // gl.drawElementsInstancedANGLE(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0, this.nb_trunksindices, this.nb_trunks);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n this.gl.useProgram(null);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n mat4 model_global = model*model_mat;\n pixel_pos = vec3(model_global*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model_global);\n\n frag_uv = uv;\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model_global*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform vec3 light_pos;\n\n vec3 bark_high = vec3(0.6, 0.4, 0.2);\n vec3 bark_low = vec3(0.4, 0.25, 0.2);\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max);\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = dot(light_dir, pixel_normal);\n\n vec3 texture_col = get_billin(frag_uv*4.0, bark_low, bark_high);\n\n vec3 color_trunk = texture_col*diffuse_light;\n\n gl_FragColor = vec4( color_trunk , 1.0);;\n }\n\n float rand(vec2 pt)\n {\n float x = pt.x*3.13;\n float y = pt.y*7.17;\n return fract(x*y/17.0);\n }\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max)\n {\n\n float val00 = rand((pos));\n float val10 = rand((vec2(pos.x, pos.y+1.0)));\n float val01 = rand((vec2(pos.x+1.0, pos.y)));\n float val11 = rand((vec2(pos.x+1.0, pos.y+1.0)));\n\n vec2 pos_fract = fract(pos);\n\n //2d linear interpolation\n float val_x0 = mix(val00, val01, pos_fract.x);\n float val_x1 = mix(val10, val11, pos_fract.x);\n\n float final_val = mix(val_x0, val_x1, pos_fract.y);\n\n return mix(max, min, final_val);\n }\n `;\n\n lerp(val, min, max){\n return (1-val)*min+val*max;\n }\n\n //recursive function for generating a l-system tree structure\n add_sub_trunks_lsystem_random(t, level, max_level, is_end_point){\n\n //if this trunk section is the last one, generate the matrix and end point for this bit\n //and add them in a list\n if(level >= max_level){\n //model matrix for the trunk model\n this.transf.push(t);\n\n //model matrix for the leaves\n if(is_end_point){\n var point = vec4.create();\n point[0] = 0;\n point[1] = 0.5;\n point[2] = 0;\n point[3] = 1.0;\n vec4.transformMat4(point, point, t);\n var end_point_translation = mat4.create();\n mat4.translate(end_point_translation, end_point_translation, [point[0], point[1], point[2]]);\n\n this.end_point_matrices.push(end_point_translation);\n }\n return;\n }\n\n //base trunk\n var t0 = mat4.create();\n mat4.translate(t0, t0, [0, 0, 0]);\n mat4.scale(t0, t0, [1, 1, 1]);\n mat4.multiply(t0, t0, t);\n this.add_sub_trunks_lsystem_random(t0, level+1000, max_level, false);\n\n //top trunk\n var t1 = mat4.create();\n mat4.translate(t1, t1, [0, 0.98, 0]);\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[2], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[0], 3.1415/14.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[1], 3.1415/14.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(t1, t1, [0.8, 0.8, 0.8]);\n mat4.multiply(t1, t1, t);\n this.add_sub_trunks_lsystem_random(t1, level+1, max_level, true);\n\n //side trunks / twigs\n var b0 = mat4.create();\n mat4.translate(b0, b0, [0, this.lerp(this.rand_vals[16], 0.5, 0.9), 0] );\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[8], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[6], 3.1415/4.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[7], 3.1415/4.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b0, b0, [0.6, 0.6, 0.6]);\n mat4.multiply(b0, b0, t);\n this.add_sub_trunks_lsystem_random(b0, level+1, max_level, true);\n\n var b1 = mat4.create();\n mat4.translate(b1, b1, [0, this.lerp(this.rand_vals[17], 0.5, 0.9), 0] );\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[11], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[9], 3.1415/3.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[10], 3.1415/3.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b1, b1, [0.5, 0.5, 0.5]);\n mat4.multiply(b1, b1, t);\n this.add_sub_trunks_lsystem_random(b1, level+1, max_level, true);\n\n var b2 = mat4.create();\n mat4.translate(b2, b2, [0, this.lerp(this.rand_vals[18], 0.5, 0.9), 0] );\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[14], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[12], 3.1415/2.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[13], 3.1415/2.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b2, b2, [0.4, 0.4, 0.4]);\n mat4.multiply(b2, b2, t);\n this.add_sub_trunks_lsystem_random(b2, level+1, max_level, true);\n }\n\n //create vertices, normals, indices for a cylinder that would represent a trunk section\n create_positions(){\n var nb_vertices = 6;\n\n this.positions = [];\n\n this.positions.push(0);\n this.positions.push(-1.0/2.0);\n this.positions.push(0);\n this.positions.push(0);\n this.positions.push(1.0/2.0);\n this.positions.push(0);\n\n //to make base of trunk slightly larger\n var bigger_base = 1.1;\n\n for (let i = 0; i < nb_vertices; i++) {\n var angle_val = 3.1415*2.0*(1.0/nb_vertices)*i;\n this.positions.push((Math.sin(angle_val)/2.0)*bigger_base);\n this.positions.push(-1.0/2.0);\n this.positions.push((Math.cos(angle_val)/2.0)*bigger_base);\n this.positions.push((Math.sin(angle_val)/2.0)*(1.0/bigger_base));\n this.positions.push(1.0/2.0);\n this.positions.push((Math.cos(angle_val)/2.0)*(1.0/bigger_base));\n }\n\n\n this.nb_indices = 3*nb_vertices*2+3*nb_vertices*2;\n this.indices = [];\n for (let i = 0; i < nb_vertices; i++) {\n var start_idx_face = 2+2*i; // 12 points per face\n var up_left = start_idx_face+1; //may be another one\n var up_right = start_idx_face+3;\n if(up_right >= 2+2*nb_vertices){\n up_right = 2+1;\n }\n var down_left = start_idx_face+0;\n var down_right = start_idx_face+2;\n if(down_right >= 2+2*nb_vertices){\n down_right = 2;\n }\n\n //top\n this.indices.push(1);\n this.indices.push(up_left);\n this.indices.push(up_right);\n //side\n this.indices.push( up_left);\n this.indices.push(down_left);\n this.indices.push(down_right);\n\n this.indices.push(up_right);\n this.indices.push( up_left);\n this.indices.push(down_right);\n\n //bottom\n this.indices.push( 0);\n this.indices.push(down_right);\n this.indices.push(down_left);\n }\n\n //per vertex textcoord\n this.tex_coord = [];\n\n this.tex_coord.push(1);\n this.tex_coord.push(1);\n this.tex_coord.push(0);\n this.tex_coord.push(0);\n\n for (let i = 0; i < nb_vertices; i++) {\n // i: 0 -> 0.5 == 0 -> 1\n // i: 0.5 -> 1.0 == 1 -> 0\n var relative_pos = i/nb_vertices;\n\n if ( relative_pos < 0.5){\n relative_pos = relative_pos*2;\n }\n else{ //relative_pos > 0.5f (0.5=1, 1.0=0)\n relative_pos = relative_pos*(-2)+2;\n }\n\n this.tex_coord.push(relative_pos); //bottom\n this.tex_coord.push(1.0);\n\n this.tex_coord.push(relative_pos); //top\n this.tex_coord.push(0.0);\n }\n\n //per vertex normal\n\n this.normals = []\n\n this.normals.push(0.0);\n this.normals.push(-1.0);\n this.normals.push(0.0);\n\n this.normals.push(0.0);\n this.normals.push(1.0);\n this.normals.push(0.0);\n\n for (let i = 0; i < nb_vertices; i++) {\n var angle_val = 3.1415*2.0*(1.0/nb_vertices)*i;\n this.normals.push(Math.sin(angle_val));\n this.normals.push(0.0);\n this.normals.push(Math.cos(angle_val));\n\n this.normals.push(Math.sin(angle_val));\n this.normals.push(0.0);\n this.normals.push(Math.cos(angle_val));\n }\n }\n}"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_tree.png", "license": "none-found", "non_commercial": false, "comment_density": 0.115, "dedup_hash": "4deb9b0cb20007af", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} -{"id": "webgl_examples_triangle", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Triangle", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "triangle/triangle.html", "language": "html", "loc": 11, "comment_density": 0.0, "code": "\n\n\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n"}, {"path": "triangle/triangle.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n void main() {\n frag_colour = colour;\n gl_Position = vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "triangle/triangle.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //this is necessary in webgl glsl\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "triangle/triangle.js", "language": "javascript", "loc": 93, "comment_density": 0.14, "code": "var canvas;\nvar gl;\n\nvar shader_program;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\")\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"Cannot init WebGL\");\n return;\n }\n\n init_triangle();\n}\n\n//init the shaders and the buffers\nfunction init_triangle(){\n vertex_shader_glsl = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n void main() {\n frag_colour = colour;\n gl_Position = vertex_pos;\n }\n `;\n\n fragment_shader_glsl = `\n precision mediump float; //this is necessary in webgl glsl\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n const vertex_shader = loadShader(gl, gl.VERTEX_SHADER, vertex_shader_glsl);\n const fragment_shader = loadShader(gl, gl.FRAGMENT_SHADER, fragment_shader_glsl);\n\n shader_program = gl.createProgram();\n gl.attachShader(shader_program, vertex_shader);\n gl.attachShader(shader_program, fragment_shader);\n gl.linkProgram(shader_program);\n\n if (!gl.getProgramParameter(shader_program, gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + gl.getProgramInfoLog(shader_program));\n return null;\n }\n\n //create buffers and populate them for the triangle\n\n pos_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, pos_buffer);\n //position for each vertex of the triangle\n var triangle_points = new Float32Array([\n -1.0, -1.0, 0.0,\n 1.0, -1.0, 0.0,\n 0.0, 1.0, 0.0]);\n gl.bufferData(gl.ARRAY_BUFFER, triangle_points, gl.STATIC_DRAW);\n\n col_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, col_buffer);\n //the colours for each points in RGB\n var triangle_colours = new Float32Array([\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0]);\n gl.bufferData(gl.ARRAY_BUFFER, triangle_colours, gl.STATIC_DRAW);\n}\n\nfunction draw(){\n\n gl.clearColor(0.0, 0.0, 0.2, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n gl.useProgram(shader_program);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, pos_buffer);\n gl.vertexAttribPointer(\n gl.getAttribLocation(shader_program, \"vertex_pos\"), //the name of the attribute\n 3, //how many data per vertex point\n gl.FLOAT, //type\n true, //normalize, no effect for float\n 0, //stride\n 0); //offset\n\n gl.enableVertexAttribArray(gl.getAttribLocation(shader_program, \"vertex_pos\"));\n\n gl.bindBuffer(gl.ARRAY_BUFFER, col_buffer);\n gl.vertexAttribPointer(\n gl.getAttribLocation(shader_program, \"colour\"),\n 3,\n gl.FLOAT,\n true,\n 0,\n 0);\n\n gl.enableVertexAttribArray(gl.getAttribLocation(shader_program, \"colour\"));\n\n //will draw 3 points\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.085, "dedup_hash": "ff1d839d47d87d6d", "has_readme": true, "build_system": null, "dependency_count": 2, "has_demo": true} -{"id": "webgl_examples_water", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Water", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "water/lighting/texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "water/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 17, "comment_density": 0.118, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n uniform int active_clip;\n uniform float clip_height;\n\n void main() {\n\n //do not draw anything under the clip height\n if(active_clip != 0 && pixel_pos.y < clip_height){\n discard;\n }\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/cube.js", "language": "javascript", "loc": 208, "comment_density": 0.149, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n this.light_pos = [0,0,0];\n\n this.active_clip = 0;\n this.clip_height = 0;\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_clip(active_clip, clip_height){\n this.active_clip = active_clip;\n this.clip_height = clip_height;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniform1i(this.gl.getUniformLocation(this.shader_program, \"active_clip\"), this.active_clip);\n this.gl.uniform1f(this.gl.getUniformLocation(this.shader_program, \"clip_height\"), this.clip_height);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n uniform int active_clip;\n uniform float clip_height;\n\n void main() {\n\n //do not draw anything under the clip height\n if(active_clip != 0 && pixel_pos.y < clip_height){\n discard;\n }\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "water/framebuffer.js", "language": "javascript", "loc": 38, "comment_density": 0.158, "code": "class Framebuffer{\n\n setup(gl, image_width, image_height) {\n this.gl = gl;\n\n this.image_width = image_width;\n this.image_height = image_height;\n\n this.fb_tex = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.fb_tex);\n\n //allocate space for the texture, but feed nothing to it (null)\n //will be filled later by rendering in the framebuffer\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.image_width, this.image_height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n this.fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n\n //key part, we associate the texture with the framebuffer\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.fb_tex, 0);\n\n //create a depth buffer for the framebuffer, otherwise 3d rendering will be weird\n this.depth_buffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.depth_buffer);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, this.image_width, this.image_height);\n\n //associate the render buffer with the framebuffer\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depth_buffer);\n\n //unbind everything to avoid pollution\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n bind(){\n this.gl.viewport(0, 0, this.image_width, this.image_height);\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n }\n\n unbind(){\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n get_texture(){\n return this.fb_tex;\n }\n\n}"}, {"path": "water/main.js", "language": "javascript", "loc": 162, "comment_density": 0.099, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\nvar view_matrix_reflection = mat4.create();\n\nvar cam_height = 10;\nvar cam_radius = 20;\nvar position_cam = [cam_radius, cam_height, 0.0];\n\nvar water = new Water;\nvar water_transf = mat4.create();\n\nvar cubes_base = [new Cube, new Cube, new Cube, new Cube, new Cube];\nvar model_matrix_cubes_base = [mat4.create(), mat4.create(), mat4.create(), mat4.create(), mat4.create()];\n\nvar cubes_decoration = [new Cube, new Cube];\nvar model_matrix_cubes_decoration = [mat4.create(), mat4.create()]\n\nvar light_pos_radius = 15;\nvar light_pos = [-1, 5.0, 0];\n\nvar framebuffer_reflection = new Framebuffer;\nvar framebuffer_refraction = new Framebuffer;\n\nvar canvas_width = 1600;\nvar canvas_height = 900;\n\nvar last_time = 0;\n\n//needed for reflection matrix calculation\nvar water_height = 2;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n canvas_width = gl.canvas.width;\n canvas_height = gl.canvas.height;\n\n\n framebuffer_reflection.setup(gl, canvas_width, canvas_height);\n framebuffer_refraction.setup(gl, canvas_width, canvas_height);\n\n water.setup(gl);\n\n water.set_reflection_texture(framebuffer_reflection.get_texture());;\n water.set_refraction_texture(framebuffer_refraction.get_texture());;\n\n mat4.translate(model_matrix_cubes_base[0], model_matrix_cubes_base[0], [15, 0, 0]);\n mat4.scale(model_matrix_cubes_base[0], model_matrix_cubes_base[0], [5, 2.5, 20]);\n\n mat4.translate(model_matrix_cubes_base[1], model_matrix_cubes_base[1], [-5, 0, -15]);\n mat4.scale(model_matrix_cubes_base[1], model_matrix_cubes_base[1], [15, 2.5, 5]);\n\n mat4.translate(model_matrix_cubes_base[2], model_matrix_cubes_base[2], [-5, 0, 15]);\n mat4.scale(model_matrix_cubes_base[2], model_matrix_cubes_base[2], [15, 2.5, 5]);\n\n mat4.translate(model_matrix_cubes_base[3], model_matrix_cubes_base[3], [-15, 0, 0]);\n mat4.scale(model_matrix_cubes_base[3], model_matrix_cubes_base[3], [5, 2.5, 10]);\n\n mat4.translate(model_matrix_cubes_base[4], model_matrix_cubes_base[4], [0, -2.5, 0]);\n mat4.scale(model_matrix_cubes_base[4], model_matrix_cubes_base[4], [20, 0.5, 20]);\n\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].setup(gl);\n cubes_base[i].set_model_matrix(model_matrix_cubes_base[i]);\n }\n\n mat4.translate(model_matrix_cubes_decoration[0], model_matrix_cubes_decoration[0], [0, 0, -4]);\n mat4.scale(model_matrix_cubes_decoration[0], model_matrix_cubes_decoration[0], [2.5, 2.5, 2.5]);\n\n mat4.translate(model_matrix_cubes_decoration[1], model_matrix_cubes_decoration[1], [-15, 5, 4]);\n mat4.scale(model_matrix_cubes_decoration[1], model_matrix_cubes_decoration[1], [2.5, 2.5, 2.5]);\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].setup(gl);\n cubes_decoration[i].set_model_matrix(model_matrix_cubes_decoration[i]);\n }\n\n\n mat4.translate(water_transf, water_transf, [0, water_height, 0]);\n mat4.scale(water_transf, water_transf, [20, 20, 20]);\n\n water.set_model_matrix(water_transf);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n var pos_cam_from_underneath = [...position_cam]; //clone array\n pos_cam_from_underneath[1] = -position_cam[1]+water_height*2;\n mat4.lookAt(view_matrix_reflection, pos_cam_from_underneath, [0, water_height*2, 0], [0, 1, 0]);\n\n this.gl.viewport(0, 0, canvas_width, canvas_height);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independant\n time_diff = time-last_time;\n\n var light_speed = document.getElementById(\"slider_speed\").value;\n var light_height = document.getElementById(\"slider_height\").value;\n var cam_height = document.getElementById(\"cam_height\").value;\n var cam_rotation = -document.getElementById(\"cam_rotation\").value;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 11.0-light_height;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n\n position_cam[0] = cam_radius*Math.cos(cam_rotation/10);\n position_cam[1] = cam_height;\n position_cam[2] = cam_radius*Math.sin(cam_rotation/10);\n\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].set_light_pos(light_pos_scaled);\n cubes_base[i].set_vp(view_matrix, proj_matrix);\n cubes_base[i].draw();\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].set_light_pos(light_pos_scaled);\n cubes_decoration[i].set_vp(view_matrix, proj_matrix);\n cubes_decoration[i].draw();\n }\n\n water.set_time( (d.getTime()/500.0)%1000);\n water.set_vp(view_matrix, proj_matrix);\n water.set_light_pos(light_pos_scaled); //for specularity on the water\n water.set_camera_pos(position_cam); //for specularity on the water\n water.draw();\n\n //refraction step is just drawing the normal shapes again, but in a framebuffer\n framebuffer_refraction.bind();\n\n gl.clearColor(0.7, 0.8, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n //we need to clip everything underwater when rendering the reflection framebuffer\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].draw();\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].draw();\n }\n\n framebuffer_refraction.unbind();\n\n //for reflection step we draw every thing from underneath\n framebuffer_reflection.bind();\n\n gl.clearColor(0.7, 0.8, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n //we need to clip everything underwater when rendering the reflection framebuffer\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].set_clip(1, water_height);\n cubes_base[i].set_vp(view_matrix_reflection, proj_matrix);\n cubes_base[i].draw();\n cubes_base[i].set_clip(0, 0);\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].set_clip(1, water_height);\n cubes_decoration[i].set_vp(view_matrix_reflection, proj_matrix);\n cubes_decoration[i].draw();\n cubes_decoration[i].set_clip(0, 0);\n }\n\n framebuffer_reflection.unbind();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "water/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/plane.js", "language": "javascript", "loc": 118, "comment_density": 0.008, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n}\n"}, {"path": "water/water.html", "language": "html", "loc": 20, "comment_density": 0.0, "code": "\n\n\n\nLight Speed: \nLight Height: \nCam Height: \nCam Rotation:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "water/water.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 16, "comment_density": 0.062, "code": "precision highp float; //high precision needed in mobile for light to display correctly\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/water.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 52, "comment_density": 0.115, "code": "precision highp float; //high precision needed in mobile for light to display correctly\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 camera_pos;\n uniform vec3 light_pos;\n\n varying vec2 frag_uv;\n\n uniform sampler2D texture_reflection;\n uniform sampler2D texture_refraction;\n\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n float get_wave_1(float x, float y){\n float wave = 0.01*sin( dot(normalize(vec2(1,0)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(15,1)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(10,-1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.01*sin( dot(normalize(vec2(3,1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.02*sin( dot(normalize(vec2(6,-1)), vec2(x, y)) *64.0+time*0.8);\n wave += 0.015*sin( dot(normalize(vec2(8,1)), vec2(x, y)) *128.0+time*0.7);\n return wave/24.0;\n }\n\n void main() {\n\n float wave = get_wave_1(frag_uv.x, frag_uv.y);\n\n //interestingly the normal_wave would not be calculated correctly on mobile\n //if the float precision was only medium\n vec3 pos_before_x = vec3(frag_uv.x-0.001, get_wave_1(frag_uv.x-0.001, frag_uv.y), frag_uv.y);\n vec3 pos_after_x = vec3(frag_uv.x+0.001, get_wave_1(frag_uv.x+0.001, frag_uv.y), frag_uv.y);\n vec3 pos_before_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y-0.001), frag_uv.y-0.001);\n vec3 pos_after_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y+0.001), frag_uv.y+0.001);\n\n //get normal of wave, for lighting purpose\n vec3 normal_wave = normalize(cross( pos_after_x-pos_before_x, pos_after_y-pos_before_y));\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = 0.0;\n\n diffuse_light = dot(normal_wave, light_dir);\n float light_dist = length(light_pos-pixel_pos);\n diffuse_light /= (1.0+pow(light_dist, -0.5));\n\n //reflexion of light for specular light calculation, not the image reflexion\n vec3 reflexion = 2.0*normal_wave*dot(normal_wave, light_dir)-light_dir;\n reflexion = normalize(reflexion);\n vec3 view_dir = normalize(camera_pos-pixel_pos);\n\n float spec_light = pow(max(dot(reflexion, view_dir), 0.0), 256.0);\n spec_light = clamp(spec_light, 0.0, 1.0);\n\n float lum = 0.5*diffuse_light+spec_light;\n\n vec4 screen_pos = proj*view*vec4(pixel_pos, 1.0);\n vec2 corr_screen_pos_refraction = screen_pos.xy*0.5/screen_pos.w+vec2(0.5, 0.5);\n vec2 corr_screen_pos_reflection = vec2(corr_screen_pos_refraction.x, 1.0-corr_screen_pos_refraction.y); //must invert y\n\n corr_screen_pos_refraction += vec2(wave, wave);\n corr_screen_pos_reflection += vec2(wave, wave);\n\n vec3 colour_refraction = texture2D( texture_refraction, corr_screen_pos_refraction ).rgb;\n vec3 colour_reflection = texture2D( texture_reflection, corr_screen_pos_reflection ).rgb;\n vec4 lighting = vec4(lum, lum, lum, 1.0);\n gl_FragColor = vec4(0.25*colour_refraction, 1.0)+vec4(0.75*colour_reflection, 1.0)+ lighting;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/water.js", "language": "javascript", "loc": 209, "comment_density": 0.038, "code": "class Water{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n this.gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n this.time = 0;\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_camera_pos(cam_pos){\n this.cam_pos = cam_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_reflection_texture(tex){\n this.reflection_texture_id = tex;\n }\n\n set_refraction_texture(tex){\n this.refraction_texture_id = tex;\n }\n\n set_time(time){\n this.time = time;\n }\n\n draw(){\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.reflection_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture_reflection\"), 0);\n\n gl.activeTexture(gl.TEXTURE1);\n\n gl.bindTexture(gl.TEXTURE_2D, this.refraction_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture_refraction\"), 1);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"time\"), this.time);\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"camera_pos\"),\n this.cam_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n precision highp float; //high precision needed in mobile for light to display correctly\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision highp float; //high precision needed in mobile for light to display correctly\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 camera_pos;\n uniform vec3 light_pos;\n\n varying vec2 frag_uv;\n\n uniform sampler2D texture_reflection;\n uniform sampler2D texture_refraction;\n\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n float get_wave_1(float x, float y){\n float wave = 0.01*sin( dot(normalize(vec2(1,0)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(15,1)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(10,-1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.01*sin( dot(normalize(vec2(3,1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.02*sin( dot(normalize(vec2(6,-1)), vec2(x, y)) *64.0+time*0.8);\n wave += 0.015*sin( dot(normalize(vec2(8,1)), vec2(x, y)) *128.0+time*0.7);\n return wave/24.0;\n }\n\n void main() {\n\n float wave = get_wave_1(frag_uv.x, frag_uv.y);\n\n //interestingly the normal_wave would not be calculated correctly on mobile\n //if the float precision was only medium\n vec3 pos_before_x = vec3(frag_uv.x-0.001, get_wave_1(frag_uv.x-0.001, frag_uv.y), frag_uv.y);\n vec3 pos_after_x = vec3(frag_uv.x+0.001, get_wave_1(frag_uv.x+0.001, frag_uv.y), frag_uv.y);\n vec3 pos_before_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y-0.001), frag_uv.y-0.001);\n vec3 pos_after_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y+0.001), frag_uv.y+0.001);\n\n //get normal of wave, for lighting purpose\n vec3 normal_wave = normalize(cross( pos_after_x-pos_before_x, pos_after_y-pos_before_y));\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = 0.0;\n\n diffuse_light = dot(normal_wave, light_dir);\n float light_dist = length(light_pos-pixel_pos);\n diffuse_light /= (1.0+pow(light_dist, -0.5));\n\n //reflexion of light for specular light calculation, not the image reflexion\n vec3 reflexion = 2.0*normal_wave*dot(normal_wave, light_dir)-light_dir;\n reflexion = normalize(reflexion);\n vec3 view_dir = normalize(camera_pos-pixel_pos);\n\n float spec_light = pow(max(dot(reflexion, view_dir), 0.0), 256.0);\n spec_light = clamp(spec_light, 0.0, 1.0);\n\n float lum = 0.5*diffuse_light+spec_light;\n\n vec4 screen_pos = proj*view*vec4(pixel_pos, 1.0);\n vec2 corr_screen_pos_refraction = screen_pos.xy*0.5/screen_pos.w+vec2(0.5, 0.5);\n vec2 corr_screen_pos_reflection = vec2(corr_screen_pos_refraction.x, 1.0-corr_screen_pos_refraction.y); //must invert y\n\n corr_screen_pos_refraction += vec2(wave, wave);\n corr_screen_pos_reflection += vec2(wave, wave);\n\n vec3 colour_refraction = texture2D( texture_refraction, corr_screen_pos_refraction ).rgb;\n vec3 colour_reflection = texture2D( texture_reflection, corr_screen_pos_reflection ).rgb;\n vec4 lighting = vec4(lum, lum, lum, 1.0);\n gl_FragColor = vec4(0.25*colour_refraction, 1.0)+vec4(0.75*colour_reflection, 1.0)+ lighting;\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_water.png", "license": "none-found", "non_commercial": false, "comment_density": 0.089, "dedup_hash": "efc55ff0924657c7", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} -{"id": "shadertoy_4dfgzs", "source": "https://www.shadertoy.com/view/4dfGzs", "source_commit": null, "collected_at": "2026-08-17T14:37:36+00:00", "source_type": "shadertoy", "title": "Raymarching Primitives", "author": "iquilezles", "description": "Raymarching distance fields (primitives, operations, lighting, soft shadows, ambient occlusion).", "api": "WebGL2", "glsl_version": "300 es", "topic": "raymarching/lighting/gi/basics", "difficulty": "intermediate", "source_quality": "curated_gallery", "files": [{"path": "image.frag", "language": "glsl", "stage": "fragment", "loc": 37, "comment_density": 0.027, "code": "// Inigo Quilez - Raymarching Primitives\nfloat sdSphere(vec3 p, float s) { return length(p) - s; }\nfloat sdBox(vec3 p, vec3 b) { vec3 d = abs(p) - b; return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0)); }\n\nfloat map(vec3 p) {\n float d1 = sdSphere(p - vec3(0.0, 0.25, 0.0), 0.75);\n float d2 = sdBox(p - vec3(0.0, -0.5, 0.0), vec3(1.5, 0.1, 1.5));\n return min(d1, d2);\n}\n\nvec3 calcNormal(vec3 p) {\n const float h = 0.001;\n const vec2 k = vec2(1, -1);\n return normalize(k.xyy*map(p + k.xyy*h) + \n k.yyx*map(p + k.yyx*h) + \n k.yxy*map(p + k.yxy*h) + \n k.xxx*map(p + k.xxx*h));\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 p = (2.0 * fragCoord - iResolution.xy) / iResolution.y;\n vec3 ro = vec3(0.0, 1.5, 3.0);\n vec3 rd = normalize(vec3(p, -1.5));\n\n float t = 0.0;\n for (int i = 0; i < 64; i++) {\n vec3 pos = ro + t * rd;\n float h = map(pos);\n if (h < 0.001 || t > 20.0) break;\n t += h;\n }\n\n vec3 col = vec3(0.1, 0.1, 0.15);\n if (t < 20.0) {\n vec3 pos = ro + t * rd;\n vec3 nor = calcNormal(pos);\n vec3 lig = normalize(vec3(0.8, 0.7, 0.6));\n float dif = clamp(dot(nor, lig), 0.0, 1.0);\n col = vec3(0.9, 0.6, 0.3) * dif + vec3(0.05, 0.1, 0.15);\n }\n\n fragColor = vec4(col, 1.0);\n}", "glsl_version": "300 es", "validation_status": "valid", "pass_type": "image"}], "validation": {"glslang_valid": 1, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "CC-BY-NC-SA-3.0", "non_commercial": true, "comment_density": 0.027, "dedup_hash": "77b7ba394cac7613", "has_readme": true, "build_system": null, "dependency_count": 0, "has_demo": true, "views": 182400, "likes": 1420, "tags": ["raymarching", "sdf", "distancefields", "lighting", "shadows", "primitives"]} -{"id": "shadertoy_lsf3rh", "source": "https://www.shadertoy.com/view/lsf3RH", "source_commit": null, "collected_at": "2026-08-17T14:37:36+00:00", "source_type": "shadertoy", "title": "Procedural Simplex Noise 2D/3D", "author": "ashima", "description": "Procedural cellular and simplex noise functions in pure GLSL.", "api": "WebGL2", "glsl_version": "300 es", "topic": "procedural/basics", "difficulty": "intermediate", "source_quality": "curated_gallery", "files": [{"path": "image.frag", "language": "glsl", "stage": "fragment", "loc": 31, "comment_density": 0.0, "code": "vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod289(i);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\n m = m*m;\n m = m*m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n float n = snoise(uv * 6.0 + iTime * 0.5);\n vec3 col = vec3(0.5 + 0.5 * n);\n fragColor = vec4(col, 1.0);\n}", "glsl_version": "300 es", "validation_status": "valid", "pass_type": "image"}], "validation": {"glslang_valid": 1, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "CC-BY-NC-SA-3.0", "non_commercial": true, "comment_density": 0.0, "dedup_hash": "c855c26862ff313f", "has_readme": true, "build_system": null, "dependency_count": 0, "has_demo": true, "views": 94300, "likes": 560, "tags": ["noise", "procedural", "simplex", "fbm", "texture"]} +version https://git-lfs.github.com/spec/v1 +oid sha256:6963c4a443363bce6e552183d5d74fe61f2252d4b6ced5293449c0906c2b2cf8 +size 152394616 diff --git a/dataset_noncommercial.jsonl b/dataset_noncommercial.jsonl index 6136ad254b4aeb3063c118c77ca866f0488358ef..6a532e0dfc1d219f10c8e6c621784449198faaac 100644 --- a/dataset_noncommercial.jsonl +++ b/dataset_noncommercial.jsonl @@ -1,2 +1,131 @@ -{"id": "shadertoy_4dfgzs", "source": "https://www.shadertoy.com/view/4dfGzs", "source_commit": null, "collected_at": "2026-08-17T14:37:36+00:00", "source_type": "shadertoy", "title": "Raymarching Primitives", "author": "iquilezles", "description": "Raymarching distance fields (primitives, operations, lighting, soft shadows, ambient occlusion).", "api": "WebGL2", "glsl_version": "300 es", "topic": "raymarching/lighting/gi/basics", "difficulty": "intermediate", "source_quality": "curated_gallery", "files": [{"path": "image.frag", "language": "glsl", "stage": "fragment", "loc": 37, "comment_density": 0.027, "code": "// Inigo Quilez - Raymarching Primitives\nfloat sdSphere(vec3 p, float s) { return length(p) - s; }\nfloat sdBox(vec3 p, vec3 b) { vec3 d = abs(p) - b; return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0)); }\n\nfloat map(vec3 p) {\n float d1 = sdSphere(p - vec3(0.0, 0.25, 0.0), 0.75);\n float d2 = sdBox(p - vec3(0.0, -0.5, 0.0), vec3(1.5, 0.1, 1.5));\n return min(d1, d2);\n}\n\nvec3 calcNormal(vec3 p) {\n const float h = 0.001;\n const vec2 k = vec2(1, -1);\n return normalize(k.xyy*map(p + k.xyy*h) + \n k.yyx*map(p + k.yyx*h) + \n k.yxy*map(p + k.yxy*h) + \n k.xxx*map(p + k.xxx*h));\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 p = (2.0 * fragCoord - iResolution.xy) / iResolution.y;\n vec3 ro = vec3(0.0, 1.5, 3.0);\n vec3 rd = normalize(vec3(p, -1.5));\n\n float t = 0.0;\n for (int i = 0; i < 64; i++) {\n vec3 pos = ro + t * rd;\n float h = map(pos);\n if (h < 0.001 || t > 20.0) break;\n t += h;\n }\n\n vec3 col = vec3(0.1, 0.1, 0.15);\n if (t < 20.0) {\n vec3 pos = ro + t * rd;\n vec3 nor = calcNormal(pos);\n vec3 lig = normalize(vec3(0.8, 0.7, 0.6));\n float dif = clamp(dot(nor, lig), 0.0, 1.0);\n col = vec3(0.9, 0.6, 0.3) * dif + vec3(0.05, 0.1, 0.15);\n }\n\n fragColor = vec4(col, 1.0);\n}", "glsl_version": "300 es", "validation_status": "valid", "pass_type": "image"}], "validation": {"glslang_valid": 1, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "CC-BY-NC-SA-3.0", "non_commercial": true, "comment_density": 0.027, "dedup_hash": "77b7ba394cac7613", "has_readme": true, "build_system": null, "dependency_count": 0, "has_demo": true, "views": 182400, "likes": 1420, "tags": ["raymarching", "sdf", "distancefields", "lighting", "shadows", "primitives"]} -{"id": "shadertoy_lsf3rh", "source": "https://www.shadertoy.com/view/lsf3RH", "source_commit": null, "collected_at": "2026-08-17T14:37:36+00:00", "source_type": "shadertoy", "title": "Procedural Simplex Noise 2D/3D", "author": "ashima", "description": "Procedural cellular and simplex noise functions in pure GLSL.", "api": "WebGL2", "glsl_version": "300 es", "topic": "procedural/basics", "difficulty": "intermediate", "source_quality": "curated_gallery", "files": [{"path": "image.frag", "language": "glsl", "stage": "fragment", "loc": 31, "comment_density": 0.0, "code": "vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod289(i);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\n m = m*m;\n m = m*m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n float n = snoise(uv * 6.0 + iTime * 0.5);\n vec3 col = vec3(0.5 + 0.5 * n);\n fragColor = vec4(col, 1.0);\n}", "glsl_version": "300 es", "validation_status": "valid", "pass_type": "image"}], "validation": {"glslang_valid": 1, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "CC-BY-NC-SA-3.0", "non_commercial": true, "comment_density": 0.0, "dedup_hash": "c855c26862ff313f", "has_readme": true, "build_system": null, "dependency_count": 0, "has_demo": true, "views": 94300, "likes": 560, "tags": ["noise", "procedural", "simplex", "fbm", "texture"]} +{"id": "joeydevries_learnopengl_includes", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:05+00:00", "source_type": "repo", "title": "Includes", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/particles/vegetation/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/SOIL.c", "language": "code", "loc": 1984, "comment_density": 0.172, "code": "/*\n\tJonathan Dummer\n\t2007-07-26-10.36\n\n\tSimple OpenGL Image Library\n\n\tPublic Domain\n\tusing Sean Barret's stb_image as a base\n\n\tThanks to:\n\t* Sean Barret - for the awesome stb_image\n\t* Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts\n\t* everybody at gamedev.net\n*/\n\n#define SOIL_CHECK_FOR_GL_ERRORS 0\n\n#ifdef WIN32\n\t#define WIN32_LEAN_AND_MEAN\n\t#include \n\t#include \n\t#include \n#elif defined(__APPLE__) || defined(__APPLE_CC__)\n\t/*\tI can't test this Apple stuff!\t*/\n\t#include \n\t#include \n\t#define APIENTRY\n#else\n\t#include \n\t#include \n#endif\n\n#include \"SOIL.h\"\n#include \"stb_image_aug.h\"\n#include \"image_helper.h\"\n#include \"image_DXT.h\"\n\n#include \n#include \n\n/*\terror reporting\t*/\nchar *result_string_pointer = \"SOIL initialized\";\n\n/*\tfor loading cube maps\t*/\nenum{\n\tSOIL_CAPABILITY_UNKNOWN = -1,\n\tSOIL_CAPABILITY_NONE = 0,\n\tSOIL_CAPABILITY_PRESENT = 1\n};\nstatic int has_cubemap_capability = SOIL_CAPABILITY_UNKNOWN;\nint query_cubemap_capability( void );\n#define SOIL_TEXTURE_WRAP_R\t\t\t\t\t0x8072\n#define SOIL_CLAMP_TO_EDGE\t\t\t\t\t0x812F\n#define SOIL_NORMAL_MAP\t\t\t\t\t\t0x8511\n#define SOIL_REFLECTION_MAP\t\t\t\t\t0x8512\n#define SOIL_TEXTURE_CUBE_MAP\t\t\t\t0x8513\n#define SOIL_TEXTURE_BINDING_CUBE_MAP\t\t0x8514\n#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_X\t0x8515\n#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X\t0x8516\n#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y\t0x8517\n#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y\t0x8518\n#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z\t0x8519\n#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z\t0x851A\n#define SOIL_PROXY_TEXTURE_CUBE_MAP\t\t\t0x851B\n#define SOIL_MAX_CUBE_MAP_TEXTURE_SIZE\t\t0x851C\n/*\tfor non-power-of-two texture\t*/\nstatic int has_NPOT_capability = SOIL_CAPABILITY_UNKNOWN;\nint query_NPOT_capability( void );\n/*\tfor texture rectangles\t*/\nstatic int has_tex_rectangle_capability = SOIL_CAPABILITY_UNKNOWN;\nint query_tex_rectangle_capability( void );\n#define SOIL_TEXTURE_RECTANGLE_ARB\t\t\t\t0x84F5\n#define SOIL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\t\t0x84F8\n/*\tfor using DXT compression\t*/\nstatic int has_DXT_capability = SOIL_CAPABILITY_UNKNOWN;\nint query_DXT_capability( void );\n#define SOIL_RGB_S3TC_DXT1\t\t0x83F0\n#define SOIL_RGBA_S3TC_DXT1\t\t0x83F1\n#define SOIL_RGBA_S3TC_DXT3\t\t0x83F2\n#define SOIL_RGBA_S3TC_DXT5\t\t0x83F3\ntypedef void (APIENTRY * P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data);\nP_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC soilGlCompressedTexImage2D = NULL;\nunsigned int SOIL_direct_load_DDS(\n\t\tconst char *filename,\n\t\tunsigned int reuse_texture_ID,\n\t\tint flags,\n\t\tint loading_as_cubemap );\nunsigned int SOIL_direct_load_DDS_from_memory(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tunsigned int reuse_texture_ID,\n\t\tint flags,\n\t\tint loading_as_cubemap );\n/*\tother functions\t*/\nunsigned int\n\tSOIL_internal_create_OGL_texture\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags,\n\t\tunsigned int opengl_texture_type,\n\t\tunsigned int opengl_texture_target,\n\t\tunsigned int texture_check_size_enum\n\t);\n\n/*\tand the code magic begins here [8^)\t*/\nunsigned int\n\tSOIL_load_OGL_texture\n\t(\n\t\tconst char *filename,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\tdoes the user want direct uploading of the image as a DDS file?\t*/\n\tif( flags & SOIL_FLAG_DDS_LOAD_DIRECT )\n\t{\n\t\t/*\t1st try direct loading of the image as a DDS file\n\t\t\tnote: direct uploading will only load what is in the\n\t\t\tDDS file, no MIPmaps will be generated, the image will\n\t\t\tnot be flipped, etc.\t*/\n\t\ttex_id = SOIL_direct_load_DDS( filename, reuse_texture_ID, flags, 0 );\n\t\tif( tex_id )\n\t\t{\n\t\t\t/*\they, it worked!!\t*/\n\t\t\treturn tex_id;\n\t\t}\n\t}\n\t/*\ttry to load the image\t*/\n\timg = SOIL_load_image( filename, &width, &height, &channels, force_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tOK, make it a texture!\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tGL_TEXTURE_2D, GL_TEXTURE_2D,\n\t\t\tGL_MAX_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_HDR_texture\n\t(\n\t\tconst char *filename,\n\t\tint fake_HDR_format,\n\t\tint rescale_to_max,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\tno direct uploading of the image as a DDS file\t*/\n\t/* error check */\n\tif( (fake_HDR_format != SOIL_HDR_RGBE) &&\n\t\t(fake_HDR_format != SOIL_HDR_RGBdivA) &&\n\t\t(fake_HDR_format != SOIL_HDR_RGBdivA2) )\n\t{\n\t\tresult_string_pointer = \"Invalid fake HDR format specified\";\n\t\treturn 0;\n\t}\n\t/*\ttry to load the image (only the HDR type) */\n\timg = stbi_hdr_load_rgbe( filename, &width, &height, &channels, 4 );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/* the load worked, do I need to convert it? */\n\tif( fake_HDR_format == SOIL_HDR_RGBdivA )\n\t{\n\t\tRGBE_to_RGBdivA( img, width, height, rescale_to_max );\n\t} else if( fake_HDR_format == SOIL_HDR_RGBdivA2 )\n\t{\n\t\tRGBE_to_RGBdivA2( img, width, height, rescale_to_max );\n\t}\n\t/*\tOK, make it a texture!\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tGL_TEXTURE_2D, GL_TEXTURE_2D,\n\t\t\tGL_MAX_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_texture_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\tdoes the user want direct uploading of the image as a DDS file?\t*/\n\tif( flags & SOIL_FLAG_DDS_LOAD_DIRECT )\n\t{\n\t\t/*\t1st try direct loading of the image as a DDS file\n\t\t\tnote: direct uploading will only load what is in the\n\t\t\tDDS file, no MIPmaps will be generated, the image will\n\t\t\tnot be flipped, etc.\t*/\n\t\ttex_id = SOIL_direct_load_DDS_from_memory(\n\t\t\t\tbuffer, buffer_length,\n\t\t\t\treuse_texture_ID, flags, 0 );\n\t\tif( tex_id )\n\t\t{\n\t\t\t/*\they, it worked!!\t*/\n\t\t\treturn tex_id;\n\t\t}\n\t}\n\t/*\ttry to load the image\t*/\n\timg = SOIL_load_image_from_memory(\n\t\t\t\t\tbuffer, buffer_length,\n\t\t\t\t\t&width, &height, &channels,\n\t\t\t\t\tforce_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tOK, make it a texture!\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tGL_TEXTURE_2D, GL_TEXTURE_2D,\n\t\t\tGL_MAX_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_cubemap\n\t(\n\t\tconst char *x_pos_file,\n\t\tconst char *x_neg_file,\n\t\tconst char *y_pos_file,\n\t\tconst char *y_neg_file,\n\t\tconst char *z_pos_file,\n\t\tconst char *z_neg_file,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\terror checking\t*/\n\tif( (x_pos_file == NULL) ||\n\t\t(x_neg_file == NULL) ||\n\t\t(y_pos_file == NULL) ||\n\t\t(y_neg_file == NULL) ||\n\t\t(z_pos_file == NULL) ||\n\t\t(z_neg_file == NULL) )\n\t{\n\t\tresult_string_pointer = \"Invalid cube map files list\";\n\t\treturn 0;\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\t1st face: try to load the image\t*/\n\timg = SOIL_load_image( x_pos_file, &width, &height, &channels, force_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tupload the texture, and create a texture ID if necessary\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_X,\n\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( x_neg_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( y_pos_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( y_neg_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( z_pos_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( z_neg_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_cubemap_from_memory\n\t(\n\t\tconst unsigned char *const x_pos_buffer,\n\t\tint x_pos_buffer_length,\n\t\tconst unsigned char *const x_neg_buffer,\n\t\tint x_neg_buffer_length,\n\t\tconst unsigned char *const y_pos_buffer,\n\t\tint y_pos_buffer_length,\n\t\tconst unsigned char *const y_neg_buffer,\n\t\tint y_neg_buffer_length,\n\t\tconst unsigned char *const z_pos_buffer,\n\t\tint z_pos_buffer_length,\n\t\tconst unsigned char *const z_neg_buffer,\n\t\tint z_neg_buffer_length,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\terror checking\t*/\n\tif( (x_pos_buffer == NULL) ||\n\t\t(x_neg_buffer == NULL) ||\n\t\t(y_pos_buffer == NULL) ||\n\t\t(y_neg_buffer == NULL) ||\n\t\t(z_pos_buffer == NULL) ||\n\t\t(z_neg_buffer == NULL) )\n\t{\n\t\tresult_string_pointer = \"Invalid cube map buffers list\";\n\t\treturn 0;\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\t1st face: try to load the image\t*/\n\timg = SOIL_load_image_from_memory(\n\t\t\tx_pos_buffer, x_pos_buffer_length,\n\t\t\t&width, &height, &channels, force_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tupload the texture, and create a texture ID if necessary\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_X,\n\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\tx_neg_buffer, x_neg_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\ty_pos_buffer, y_pos_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\ty_neg_buffer, y_neg_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\tz_pos_buffer, z_pos_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\tz_neg_buffer, z_neg_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_single_cubemap\n\t(\n\t\tconst char *filename,\n\t\tconst char face_order[6],\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels, i;\n\tunsigned int tex_id = 0;\n\t/*\terror checking\t*/\n\tif( filename == NULL )\n\t{\n\t\tresult_string_pointer = \"Invalid single cube map file name\";\n\t\treturn 0;\n\t}\n\t/*\tdoes the user want direct uploading of the image as a DDS file?\t*/\n\tif( flags & SOIL_FLAG_DDS_LOAD_DIRECT )\n\t{\n\t\t/*\t1st try direct loading of the image as a DDS file\n\t\t\tnote: direct uploading will only load what is in the\n\t\t\tDDS file, no MIPmaps will be generated, the image will\n\t\t\tnot be flipped, etc.\t*/\n\t\ttex_id = SOIL_direct_load_DDS( filename, reuse_texture_ID, flags, 1 );\n\t\tif( tex_id )\n\t\t{\n\t\t\t/*\they, it worked!!\t*/\n\t\t\treturn tex_id;\n\t\t}\n\t}\n\t/*\tface order checking\t*/\n\tfor( i = 0; i < 6; ++i )\n\t{\n\t\tif( (face_order[i] != 'N') &&\n\t\t\t(face_order[i] != 'S') &&\n\t\t\t(face_order[i] != 'W') &&\n\t\t\t(face_order[i] != 'E') &&\n\t\t\t(face_order[i] != 'U') &&\n\t\t\t(face_order[i] != 'D') )\n\t\t{\n\t\t\tresult_string_pointer = \"Invalid single cube map face order\";\n\t\t\treturn 0;\n\t\t};\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\t1st off, try to load the full image\t*/\n\timg = SOIL_load_image( filename, &width, &height, &channels, force_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tnow, does this image have the right dimensions?\t*/\n\tif( (width != 6*height) &&\n\t\t(6*width != height) )\n\t{\n\t\tSOIL_free_image_data( img );\n\t\tresult_string_pointer = \"Single cubemap image must have a 6:1 ratio\";\n\t\treturn 0;\n\t}\n\t/*\ttry the image split and create\t*/\n\ttex_id = SOIL_create_OGL_single_cubemap(\n\t\t\timg, width, height, channels,\n\t\t\tface_order, reuse_texture_ID, flags\n\t\t\t);\n\t/*\tnuke the temporary image data and return the texture handle\t*/\n\tSOIL_free_image_data( img );\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_single_cubemap_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tconst char face_order[6],\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels, i;\n\tunsigned int tex_id = 0;\n\t/*\terror checking\t*/\n\tif( buffer == NULL )\n\t{\n\t\tresult_string_pointer = \"Invalid single cube map buffer\";\n\t\treturn 0;\n\t}\n\t/*\tdoes the user want direct uploading of the image as a DDS file?\t*/\n\tif( flags & SOIL_FLAG_DDS_LOAD_DIRECT )\n\t{\n\t\t/*\t1st try direct loading of the image as a DDS file\n\t\t\tnote: direct uploading will only load what is in the\n\t\t\tDDS file, no MIPmaps will be generated, the image will\n\t\t\tnot be flipped, etc.\t*/\n\t\ttex_id = SOIL_direct_load_DDS_from_memory(\n\t\t\t\tbuffer, buffer_length,\n\t\t\t\treuse_texture_ID, flags, 1 );\n\t\tif( tex_id )\n\t\t{\n\t\t\t/*\they, it worked!!\t*/\n\t\t\treturn tex_id;\n\t\t}\n\t}\n\t/*\tface order checking\t*/\n\tfor( i = 0; i < 6; ++i )\n\t{\n\t\tif( (face_order[i] != 'N') &&\n\t\t\t(face_order[i] != 'S') &&\n\t\t\t(face_order[i] != 'W') &&\n\t\t\t(face_order[i] != 'E') &&\n\t\t\t(face_order[i] != 'U') &&\n\t\t\t(face_order[i] != 'D') )\n\t\t{\n\t\t\tresult_string_pointer = \"Invalid single cube map face order\";\n\t\t\treturn 0;\n\t\t};\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\t1st off, try to load the full image\t*/\n\timg = SOIL_load_image_from_memory(\n\t\t\tbuffer, buffer_length,\n\t\t\t&width, &height, &channels,\n\t\t\tforce_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tnow, does this image have the right dimensions?\t*/\n\tif( (width != 6*height) &&\n\t\t(6*width != height) )\n\t{\n\t\tSOIL_free_image_data( img );\n\t\tresult_string_pointer = \"Single cubemap image must have a 6:1 ratio\";\n\t\treturn 0;\n\t}\n\t/*\ttry the image split and create\t*/\n\ttex_id = SOIL_create_OGL_single_cubemap(\n\t\t\timg, width, height, channels,\n\t\t\tface_order, reuse_texture_ID, flags\n\t\t\t);\n\t/*\tnuke the temporary image data and return the texture handle\t*/\n\tSOIL_free_image_data( img );\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_create_OGL_single_cubemap\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tconst char face_order[6],\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* sub_img;\n\tint dw, dh, sz, i;\n\tunsigned int tex_id;\n\t/*\terror checking\t*/\n\tif( data == NULL )\n\t{\n\t\tresult_string_pointer = \"Invalid single cube map image data\";\n\t\treturn 0;\n\t}\n\t/*\tface order checking\t*/\n\tfor( i = 0; i < 6; ++i )\n\t{\n\t\tif( (face_order[i] != 'N') &&\n\t\t\t(face_order[i] != 'S') &&\n\t\t\t(face_order[i] != 'W') &&\n\t\t\t(face_order[i] != 'E') &&\n\t\t\t(face_order[i] != 'U') &&\n\t\t\t(face_order[i] != 'D') )\n\t\t{\n\t\t\tresult_string_pointer = \"Invalid single cube map face order\";\n\t\t\treturn 0;\n\t\t};\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\tnow, does this image have the right dimensions?\t*/\n\tif( (width != 6*height) &&\n\t\t(6*width != height) )\n\t{\n\t\tresult_string_pointer = \"Single cubemap image must have a 6:1 ratio\";\n\t\treturn 0;\n\t}\n\t/*\twhich way am I stepping?\t*/\n\tif( width > height )\n\t{\n\t\tdw = height;\n\t\tdh = 0;\n\t} else\n\t{\n\t\tdw = 0;\n\t\tdh = width;\n\t}\n\tsz = dw+dh;\n\tsub_img = (unsigned char *)malloc( sz*sz*channels );\n\t/*\tdo the splitting and uploading\t*/\n\ttex_id = reuse_texture_ID;\n\tfor( i = 0; i < 6; ++i )\n\t{\n\t\tint x, y, idx = 0;\n\t\tunsigned int cubemap_target = 0;\n\t\t/*\tcopy in the sub-image\t*/\n\t\tfor( y = i*dh; y < i*dh+sz; ++y )\n\t\t{\n\t\t\tfor( x = i*dw*channels; x < (i*dw+sz)*channels; ++x )\n\t\t\t{\n\t\t\t\tsub_img[idx++] = data[y*width*channels+x];\n\t\t\t}\n\t\t}\n\t\t/*\twhat is my texture target?\n\t\t\tremember, this coordinate system is\n\t\t\tLHS if viewed from inside the cube!\t*/\n\t\tswitch( face_order[i] )\n\t\t{\n\t\tcase 'N':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z;\n\t\t\tbreak;\n\t\tcase 'S':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z;\n\t\t\tbreak;\n\t\tcase 'W':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X;\n\t\t\tbreak;\n\t\tcase 'E':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_X;\n\t\t\tbreak;\n\t\tcase 'U':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y;\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y;\n\t\t\tbreak;\n\t\t}\n\t\t/*\tupload it as a texture\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\tsub_img, sz, sz, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP,\n\t\t\t\tcubemap_target,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t}\n\t/*\tand nuke the image and sub-image data\t*/\n\tSOIL_free_image_data( sub_img );\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_create_OGL_texture\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\twrapper function for 2D textures\t*/\n\treturn SOIL_internal_create_OGL_texture(\n\t\t\t\tdata, width, height, channels,\n\t\t\t\treuse_texture_ID, flags,\n\t\t\t\tGL_TEXTURE_2D, GL_TEXTURE_2D,\n\t\t\t\tGL_MAX_TEXTURE_SIZE );\n}\n\n#if SOIL_CHECK_FOR_GL_ERRORS\nvoid check_for_GL_errors( const char *calling_location )\n{\n\t/*\tcheck for errors\t*/\n\tGLenum err_code = glGetError();\n\twhile( GL_NO_ERROR != err_code )\n\t{\n\t\tprintf( \"OpenGL Error @ %s: %i\", calling_location, err_code );\n\t\terr_code = glGetError();\n\t}\n}\n#else\nvoid check_for_GL_errors( const char *calling_location )\n{\n\t/*\tno check for errors\t*/\n}\n#endif\n\nunsigned int\n\tSOIL_internal_create_OGL_texture\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags,\n\t\tunsigned int opengl_texture_type,\n\t\tunsigned int opengl_texture_target,\n\t\tunsigned int texture_check_size_enum\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tunsigned int tex_id;\n\tunsigned int internal_texture_format = 0, original_texture_format = 0;\n\tint DXT_mode = SOIL_CAPABILITY_UNKNOWN;\n\tint max_supported_size;\n\t/*\tIf the user wants to use the texture rectangle I kill a few flags\t*/\n\tif( flags & SOIL_FLAG_TEXTURE_RECTANGLE )\n\t{\n\t\t/*\twell, the user asked for it, can we do that?\t*/\n\t\tif( query_tex_rectangle_capability() == SOIL_CAPABILITY_PRESENT )\n\t\t{\n\t\t\t/*\tonly allow this if the user in _NOT_ trying to do a cubemap!\t*/\n\t\t\tif( opengl_texture_type == GL_TEXTURE_2D )\n\t\t\t{\n\t\t\t\t/*\tclean out the flags that cannot be used with texture rectangles\t*/\n\t\t\t\tflags &= ~(\n\t\t\t\t\t\tSOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS |\n\t\t\t\t\t\tSOIL_FLAG_TEXTURE_REPEATS\n\t\t\t\t\t);\n\t\t\t\t/*\tand change my target\t*/\n\t\t\t\topengl_texture_target = SOIL_TEXTURE_RECTANGLE_ARB;\n\t\t\t\topengl_texture_type = SOIL_TEXTURE_RECTANGLE_ARB;\n\t\t\t} else\n\t\t\t{\n\t\t\t\t/*\tnot allowed for any other uses (yes, I'm looking at you, cubemaps!)\t*/\n\t\t\t\tflags &= ~SOIL_FLAG_TEXTURE_RECTANGLE;\n\t\t\t}\n\n\t\t} else\n\t\t{\n\t\t\t/*\tcan't do it, and that is a breakable offense (uv coords use pixels instead of [0,1]!)\t*/\n\t\t\tresult_string_pointer = \"Texture Rectangle extension unsupported\";\n\t\t\treturn 0;\n\t\t}\n\t}\n\t/*\tcreate a copy the image data\t*/\n\timg = (unsigned char*)malloc( width*height*channels );\n\tmemcpy( img, data, width*height*channels );\n\t/*\tdoes the user want me to invert the image?\t*/\n\tif( flags & SOIL_FLAG_INVERT_Y )\n\t{\n\t\tint i, j;\n\t\tfor( j = 0; j*2 < height; ++j )\n\t\t{\n\t\t\tint index1 = j * width * channels;\n\t\t\tint index2 = (height - 1 - j) * width * channels;\n\t\t\tfor( i = width * channels; i > 0; --i )\n\t\t\t{\n\t\t\t\tunsigned char temp = img[index1];\n\t\t\t\timg[index1] = img[index2];\n\t\t\t\timg[index2] = temp;\n\t\t\t\t++index1;\n\t\t\t\t++index2;\n\t\t\t}\n\t\t}\n\t}\n\t/*\tdoes the user want me to scale the colors into the NTSC safe RGB range?\t*/\n\tif( flags & SOIL_FLAG_NTSC_SAFE_RGB )\n\t{\n\t\tscale_image_RGB_to_NTSC_safe( img, width, height, channels );\n\t}\n\t/*\tdoes the user want me to convert from straight to pre-multiplied alpha?\n\t\t(and do we even _have_ alpha?)\t*/\n\tif( flags & SOIL_FLAG_MULTIPLY_ALPHA )\n\t{\n\t\tint i;\n\t\tswitch( channels )\n\t\t{\n\t\tcase 2:\n\t\t\tfor( i = 0; i < 2*width*height; i += 2 )\n\t\t\t{\n\t\t\t\timg[i] = (img[i] * img[i+1] + 128) >> 8;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tfor( i = 0; i < 4*width*height; i += 4 )\n\t\t\t{\n\t\t\t\timg[i+0] = (img[i+0] * img[i+3] + 128) >> 8;\n\t\t\t\timg[i+1] = (img[i+1] * img[i+3] + 128) >> 8;\n\t\t\t\timg[i+2] = (img[i+2] * img[i+3] + 128) >> 8;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/*\tno other number of channels contains alpha data\t*/\n\t\t\tbreak;\n\t\t}\n\t}\n\t/*\tif the user can't support NPOT textures, make sure we force the POT option\t*/\n\tif( (query_NPOT_capability() == SOIL_CAPABILITY_NONE) &&\n\t\t!(flags & SOIL_FLAG_TEXTURE_RECTANGLE) )\n\t{\n\t\t/*\tadd in the POT flag */\n\t\tflags |= SOIL_FLAG_POWER_OF_TWO;\n\t}\n\t/*\thow large of a texture can this OpenGL implementation handle?\t*/\n\t/*\ttexture_check_size_enum will be GL_MAX_TEXTURE_SIZE or SOIL_MAX_CUBE_MAP_TEXTURE_SIZE\t*/\n\tglGetIntegerv( texture_check_size_enum, &max_supported_size );\n\t/*\tdo I need to make it a power of 2?\t*/\n\tif(\n\t\t(flags & SOIL_FLAG_POWER_OF_TWO) ||\t/*\tuser asked for it\t*/\n\t\t(flags & SOIL_FLAG_MIPMAPS) ||\t\t/*\tneed it for the MIP-maps\t*/\n\t\t(width > max_supported_size) ||\t\t/*\tit's too big, (make sure it's\t*/\n\t\t(height > max_supported_size) )\t\t/*\t2^n for later down-sampling)\t*/\n\t{\n\t\tint new_width = 1;\n\t\tint new_height = 1;\n\t\twhile( new_width < width )\n\t\t{\n\t\t\tnew_width *= 2;\n\t\t}\n\t\twhile( new_height < height )\n\t\t{\n\t\t\tnew_height *= 2;\n\t\t}\n\t\t/*\tstill?\t*/\n\t\tif( (new_width != width) || (new_height != height) )\n\t\t{\n\t\t\t/*\tyep, resize\t*/\n\t\t\tunsigned char *resampled = (unsigned char*)malloc( channels*new_width*new_height );\n\t\t\tup_scale_image(\n\t\t\t\t\timg, width, height, channels,\n\t\t\t\t\tresampled, new_width, new_height );\n\t\t\t/*\tOJO\tthis is for debug only!\t*/\n\t\t\t/*\n\t\t\tSOIL_save_image( \"\\\\showme.bmp\", SOIL_SAVE_TYPE_BMP,\n\t\t\t\t\t\t\tnew_width, new_height, channels,\n\t\t\t\t\t\t\tresampled );\n\t\t\t*/\n\t\t\t/*\tnuke the old guy, then point it at the new guy\t*/\n\t\t\tSOIL_free_image_data( img );\n\t\t\timg = resampled;\n\t\t\twidth = new_width;\n\t\t\theight = new_height;\n\t\t}\n\t}\n\t/*\tnow, if it is too large...\t*/\n\tif( (width > max_supported_size) || (height > max_supported_size) )\n\t{\n\t\t/*\tI've already made it a power of two, so simply use the MIPmapping\n\t\t\tcode to reduce its size to the allowable maximum.\t*/\n\t\tunsigned char *resampled;\n\t\tint reduce_block_x = 1, reduce_block_y = 1;\n\t\tint new_width, new_height;\n\t\tif( width > max_supported_size )\n\t\t{\n\t\t\treduce_block_x = width / max_supported_size;\n\t\t}\n\t\tif( height > max_supported_size )\n\t\t{\n\t\t\treduce_block_y = height / max_supported_size;\n\t\t}\n\t\tnew_width = width / reduce_block_x;\n\t\tnew_height = height / reduce_block_y;\n\t\tresampled = (unsigned char*)malloc( channels*new_width*new_height );\n\t\t/*\tperform the actual reduction\t*/\n\t\tmipmap_image(\timg, width, height, channels,\n\t\t\t\t\t\tresampled, reduce_block_x, reduce_block_y );\n\t\t/*\tnuke the old guy, then point it at the new guy\t*/\n\t\tSOIL_free_image_data( img );\n\t\timg = resampled;\n\t\twidth = new_width;\n\t\theight = new_height;\n\t}\n\t/*\tdoes the user want us to use YCoCg color space?\t*/\n\tif( flags & SOIL_FLAG_CoCg_Y )\n\t{\n\t\t/*\tthis will only work with RGB and RGBA images */\n\t\tconvert_RGB_to_YCoCg( img, width, height, channels );\n\t\t/*\n\t\tsave_image_as_DDS( \"CoCg_Y.dds\", width, height, channels, img );\n\t\t*/\n\t}\n\t/*\tcreate the OpenGL texture ID handle\n \t(note: allowing a forced texture ID lets me reload a texture)\t*/\n tex_id = reuse_texture_ID;\n if( tex_id == 0 )\n {\n\t\tglGenTextures( 1, &tex_id );\n }\n\tcheck_for_GL_errors( \"glGenTextures\" );\n\t/* Note: sometimes glGenTextures fails (usually no OpenGL context)\t*/\n\tif( tex_id )\n\t{\n\t\t/*\tand what type am I using as the internal texture format?\t*/\n\t\tswitch( channels )\n\t\t{\n\t\tcase 1:\n\t\t\toriginal_texture_format = GL_LUMINANCE;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\toriginal_texture_format = GL_LUMINANCE_ALPHA;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\toriginal_texture_format = GL_RGB;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\toriginal_texture_format = GL_RGBA;\n\t\t\tbreak;\n\t\t}\n\t\tinternal_texture_format = original_texture_format;\n\t\t/*\tdoes the user want me to, and can I, save as DXT?\t*/\n\t\tif( flags & SOIL_FLAG_COMPRESS_TO_DXT )\n\t\t{\n\t\t\tDXT_mode = query_DXT_capability();\n\t\t\tif( DXT_mode == SOIL_CAPABILITY_PRESENT )\n\t\t\t{\n\t\t\t\t/*\tI can use DXT, whether I compress it or OpenGL does\t*/\n\t\t\t\tif( (channels & 1) == 1 )\n\t\t\t\t{\n\t\t\t\t\t/*\t1 or 3 channels = DXT1\t*/\n\t\t\t\t\tinternal_texture_format = SOIL_RGB_S3TC_DXT1;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t/*\t2 or 4 channels = DXT5\t*/\n\t\t\t\t\tinternal_texture_format = SOIL_RGBA_S3TC_DXT5;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/* bind an OpenGL texture ID\t*/\n\t\tglBindTexture( opengl_texture_type, tex_id );\n\t\tcheck_for_GL_errors( \"glBindTexture\" );\n\t\t/* upload the main image\t*/\n\t\tif( DXT_mode == SOIL_CAPABILITY_PRESENT )\n\t\t{\n\t\t\t/*\tuser wants me to do the DXT conversion!\t*/\n\t\t\tint DDS_size;\n\t\t\tunsigned char *DDS_data = NULL;\n\t\t\tif( (channels & 1) == 1 )\n\t\t\t{\n\t\t\t\t/*\tRGB, use DXT1\t*/\n\t\t\t\tDDS_data = convert_image_to_DXT1( img, width, height, channels, &DDS_size );\n\t\t\t} else\n\t\t\t{\n\t\t\t\t/*\tRGBA, use DXT5\t*/\n\t\t\t\tDDS_data = convert_image_to_DXT5( img, width, height, channels, &DDS_size );\n\t\t\t}\n\t\t\tif( DDS_data )\n\t\t\t{\n\t\t\t\tsoilGlCompressedTexImage2D(\n\t\t\t\t\topengl_texture_target, 0,\n\t\t\t\t\tinternal_texture_format, width, height, 0,\n\t\t\t\t\tDDS_size, DDS_data );\n\t\t\t\tcheck_for_GL_errors( \"glCompressedTexImage2D\" );\n\t\t\t\tSOIL_free_image_data( DDS_data );\n\t\t\t\t/*\tprintf( \"Internal DXT compressor\\n\" );\t*/\n\t\t\t} else\n\t\t\t{\n\t\t\t\t/*\tmy compression failed, try the OpenGL driver's version\t*/\n\t\t\t\tglTexImage2D(\n\t\t\t\t\topengl_texture_target, 0,\n\t\t\t\t\tinternal_texture_format, width, height, 0,\n\t\t\t\t\toriginal_texture_format, GL_UNSIGNED_BYTE, img );\n\t\t\t\tcheck_for_GL_errors( \"glTexImage2D\" );\n\t\t\t\t/*\tprintf( \"OpenGL DXT compressor\\n\" );\t*/\n\t\t\t}\n\t\t} else\n\t\t{\n\t\t\t/*\tuser want OpenGL to do all the work!\t*/\n\t\t\tglTexImage2D(\n\t\t\t\topengl_texture_target, 0,\n\t\t\t\tinternal_texture_format, width, height, 0,\n\t\t\t\toriginal_texture_format, GL_UNSIGNED_BYTE, img );\n\t\t\tcheck_for_GL_errors( \"glTexImage2D\" );\n\t\t\t/*printf( \"OpenGL DXT compressor\\n\" );\t*/\n\t\t}\n\t\t/*\tare any MIPmaps desired?\t*/\n\t\tif( flags & SOIL_FLAG_MIPMAPS )\n\t\t{\n\t\t\tint MIPlevel = 1;\n\t\t\tint MIPwidth = (width+1) / 2;\n\t\t\tint MIPheight = (height+1) / 2;\n\t\t\tunsigned char *resampled = (unsigned char*)malloc( channels*MIPwidth*MIPheight );\n\t\t\twhile( ((1< 0; --i )\n\t\t{\n\t\t\tunsigned char temp = pixel_data[index1];\n\t\t\tpixel_data[index1] = pixel_data[index2];\n\t\t\tpixel_data[index2] = temp;\n\t\t\t++index1;\n\t\t\t++index2;\n\t\t}\n\t}\n\n /*\tsave the image\t*/\n save_result = SOIL_save_image( filename, image_type, width, height, 3, pixel_data);\n\n /* And free the memory\t*/\n SOIL_free_image_data( pixel_data );\n\treturn save_result;\n}\n\nunsigned char*\n\tSOIL_load_image\n\t(\n\t\tconst char *filename,\n\t\tint *width, int *height, int *channels,\n\t\tint force_channels\n\t)\n{\n\tunsigned char *result = stbi_load( filename,\n\t\t\twidth, height, channels, force_channels );\n\tif( result == NULL )\n\t{\n\t\tresult_string_pointer = stbi_failure_reason();\n\t} else\n\t{\n\t\tresult_string_pointer = \"Image loaded\";\n\t}\n\treturn result;\n}\n\nunsigned char*\n\tSOIL_load_image_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tint *width, int *height, int *channels,\n\t\tint force_channels\n\t)\n{\n\tunsigned char *result = stbi_load_from_memory(\n\t\t\t\tbuffer, buffer_length,\n\t\t\t\twidth, height, channels,\n\t\t\t\tforce_channels );\n\tif( result == NULL )\n\t{\n\t\tresult_string_pointer = stbi_failure_reason();\n\t} else\n\t{\n\t\tresult_string_pointer = \"Image loaded from memory\";\n\t}\n\treturn result;\n}\n\nint\n\tSOIL_save_image\n\t(\n\t\tconst char *filename,\n\t\tint image_type,\n\t\tint width, int height, int channels,\n\t\tconst unsigned char *const data\n\t)\n{\n\tint save_result;\n\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 1) || (channels > 4) ||\n\t\t(data == NULL) ||\n\t\t(filename == NULL) )\n\t{\n\t\treturn 0;\n\t}\n\tif( image_type == SOIL_SAVE_TYPE_BMP )\n\t{\n\t\tsave_result = stbi_write_bmp( filename,\n\t\t\t\twidth, height, channels, (void*)data );\n\t} else\n\tif( image_type == SOIL_SAVE_TYPE_TGA )\n\t{\n\t\tsave_result = stbi_write_tga( filename,\n\t\t\t\twidth, height, channels, (void*)data );\n\t} else\n\tif( image_type == SOIL_SAVE_TYPE_DDS )\n\t{\n\t\tsave_result = save_image_as_DDS( filename,\n\t\t\t\twidth, height, channels, (const unsigned char *const)data );\n\t} else\n\t{\n\t\tsave_result = 0;\n\t}\n\tif( save_result == 0 )\n\t{\n\t\tresult_string_pointer = \"Saving the image failed\";\n\t} else\n\t{\n\t\tresult_string_pointer = \"Image saved\";\n\t}\n\treturn save_result;\n}\n\nvoid\n\tSOIL_free_image_data\n\t(\n\t\tunsigned char *img_data\n\t)\n{\n\tfree( (void*)img_data );\n}\n\nconst char*\n\tSOIL_last_result\n\t(\n\t\tvoid\n\t)\n{\n\treturn result_string_pointer;\n}\n\nunsigned int SOIL_direct_load_DDS_from_memory(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tunsigned int reuse_texture_ID,\n\t\tint flags,\n\t\tint loading_as_cubemap )\n{\n\t/*\tvariables\t*/\n\tDDS_header header;\n\tunsigned int buffer_index = 0;\n\tunsigned int tex_ID = 0;\n\t/*\tfile reading variables\t*/\n\tunsigned int S3TC_type = 0;\n\tunsigned char *DDS_data;\n\tunsigned int DDS_main_size;\n\tunsigned int DDS_full_size;\n\tunsigned int width, height;\n\tint mipmaps, cubemap, uncompressed, block_size = 16;\n\tunsigned int flag;\n\tunsigned int cf_target, ogl_target_start, ogl_target_end;\n\tunsigned int opengl_texture_type;\n\tint i;\n\t/*\t1st off, does the filename even exist?\t*/\n\tif( NULL == buffer )\n\t{\n\t\t/*\twe can't do it!\t*/\n\t\tresult_string_pointer = \"NULL buffer\";\n\t\treturn 0;\n\t}\n\tif( buffer_length < sizeof( DDS_header ) )\n\t{\n\t\t/*\twe can't do it!\t*/\n\t\tresult_string_pointer = \"DDS file was too small to contain the DDS header\";\n\t\treturn 0;\n\t}\n\t/*\ttry reading in the header\t*/\n\tmemcpy ( (void*)(&header), (const void *)buffer, sizeof( DDS_header ) );\n\tbuffer_index = sizeof( DDS_header );\n\t/*\tguilty until proven innocent\t*/\n\tresult_string_pointer = \"Failed to read a known DDS header\";\n\t/*\tvalidate the header (warning, \"goto\"'s ahead, shield your eyes!!)\t*/\n\tflag = ('D'<<0)|('D'<<8)|('S'<<16)|(' '<<24);\n\tif( header.dwMagic != flag ) {goto quick_exit;}\n\tif( header.dwSize != 124 ) {goto quick_exit;}\n\t/*\tI need all of these\t*/\n\tflag = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;\n\tif( (header.dwFlags & flag) != flag ) {goto quick_exit;}\n\t/*\tAccording to the MSDN spec, the dwFlags should contain\n\t\tDDSD_LINEARSIZE if it's compressed, or DDSD_PITCH if\n\t\tuncompressed. Some DDS writers do not conform to the\n\t\tspec, so I need to make my reader more tolerant\t*/\n\t/*\tI need one of these\t*/\n\tflag = DDPF_FOURCC | DDPF_RGB;\n\tif( (header.sPixelFormat.dwFlags & flag) == 0 ) {goto quick_exit;}\n\tif( header.sPixelFormat.dwSize != 32 ) {goto quick_exit;}\n\tif( (header.sCaps.dwCaps1 & DDSCAPS_TEXTURE) == 0 ) {goto quick_exit;}\n\t/*\tmake sure it is a type we can upload\t*/\n\tif( (header.sPixelFormat.dwFlags & DDPF_FOURCC) &&\n\t\t!(\n\t\t(header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('1'<<24))) ||\n\t\t(header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('3'<<24))) ||\n\t\t(header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('5'<<24)))\n\t\t) )\n\t{\n\t\tgoto quick_exit;\n\t}\n\t/*\tOK, validated the header, let's load the image data\t*/\n\tresult_string_pointer = \"DDS header loaded and validated\";\n\twidth = header.dwWidth;\n\theight = header.dwHeight;\n\tuncompressed = 1 - (header.sPixelFormat.dwFlags & DDPF_FOURCC) / DDPF_FOURCC;\n\tcubemap = (header.sCaps.dwCaps2 & DDSCAPS2_CUBEMAP) / DDSCAPS2_CUBEMAP;\n\tif( uncompressed )\n\t{\n\t\tS3TC_type = GL_RGB;\n\t\tblock_size = 3;\n\t\tif( header.sPixelFormat.dwFlags & DDPF_ALPHAPIXELS )\n\t\t{\n\t\t\tS3TC_type = GL_RGBA;\n\t\t\tblock_size = 4;\n\t\t}\n\t\tDDS_main_size = width * height * block_size;\n\t} else\n\t{\n\t\t/*\tcan we even handle direct uploading to OpenGL DXT compressed images?\t*/\n\t\tif( query_DXT_capability() != SOIL_CAPABILITY_PRESENT )\n\t\t{\n\t\t\t/*\twe can't do it!\t*/\n\t\t\tresult_string_pointer = \"Direct upload of S3TC images not supported by the OpenGL driver\";\n\t\t\treturn 0;\n\t\t}\n\t\t/*\twell, we know it is DXT1/3/5, because we checked above\t*/\n\t\tswitch( (header.sPixelFormat.dwFourCC >> 24) - '0' )\n\t\t{\n\t\tcase 1:\n\t\t\tS3TC_type = SOIL_RGBA_S3TC_DXT1;\n\t\t\tblock_size = 8;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tS3TC_type = SOIL_RGBA_S3TC_DXT3;\n\t\t\tblock_size = 16;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tS3TC_type = SOIL_RGBA_S3TC_DXT5;\n\t\t\tblock_size = 16;\n\t\t\tbreak;\n\t\t}\n\t\tDDS_main_size = ((width+3)>>2)*((height+3)>>2)*block_size;\n\t}\n\tif( cubemap )\n\t{\n\t\t/* does the user want a cubemap?\t*/\n\t\tif( !loading_as_cubemap )\n\t\t{\n\t\t\t/*\twe can't do it!\t*/\n\t\t\tresult_string_pointer = \"DDS image was a cubemap\";\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tcan we even handle cubemaps with the OpenGL driver?\t*/\n\t\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t\t{\n\t\t\t/*\twe can't do it!\t*/\n\t\t\tresult_string_pointer = \"Direct upload of cubemap images not supported by the OpenGL driver\";\n\t\t\treturn 0;\n\t\t}\n\t\togl_target_start = SOIL_TEXTURE_CUBE_MAP_POSITIVE_X;\n\t\togl_target_end = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z;\n\t\topengl_texture_type = SOIL_TEXTURE_CUBE_MAP;\n\t} else\n\t{\n\t\t/* does the user want a non-cubemap?\t*/\n\t\tif( loading_as_cubemap )\n\t\t{\n\t\t\t/*\twe can't do it!\t*/\n\t\t\tresult_string_pointer = \"DDS image was not a cubemap\";\n\t\t\treturn 0;\n\t\t}\n\t\togl_target_start = GL_TEXTURE_2D;\n\t\togl_target_end = GL_TEXTURE_2D;\n\t\topengl_texture_type = GL_TEXTURE_2D;\n\t}\n\tif( (header.sCaps.dwCaps1 & DDSCAPS_MIPMAP) && (header.dwMipMapCount > 1) )\n\t{\n\t\tint shift_offset;\n\t\tmipmaps = header.dwMipMapCount - 1;\n\t\tDDS_full_size = DDS_main_size;\n\t\tif( uncompressed )\n\t\t{\n\t\t\t/*\tuncompressed DDS, simple MIPmap size calculation\t*/\n\t\t\tshift_offset = 0;\n\t\t} else\n\t\t{\n\t\t\t/*\tcompressed DDS, MIPmap size calculation is block based\t*/\n\t\t\tshift_offset = 2;\n\t\t}\n\t\tfor( i = 1; i <= mipmaps; ++ i )\n\t\t{\n\t\t\tint w, h;\n\t\t\tw = width >> (shift_offset + i);\n\t\t\th = height >> (shift_offset + i);\n\t\t\tif( w < 1 )\n\t\t\t{\n\t\t\t\tw = 1;\n\t\t\t}\n\t\t\tif( h < 1 )\n\t\t\t{\n\t\t\t\th = 1;\n\t\t\t}\n\t\t\tDDS_full_size += w*h*block_size;\n\t\t}\n\t} else\n\t{\n\t\tmipmaps = 0;\n\t\tDDS_full_size = DDS_main_size;\n\t}\n\tDDS_data = (unsigned char*)malloc( DDS_full_size );\n\t/*\tgot the image data RAM, create or use an existing OpenGL texture handle\t*/\n\ttex_ID = reuse_texture_ID;\n\tif( tex_ID == 0 )\n\t{\n\t\tglGenTextures( 1, &tex_ID );\n\t}\n\t/* bind an OpenGL texture ID\t*/\n\tglBindTexture( opengl_texture_type, tex_ID );\n\t/*\tdo this for each face of the cubemap!\t*/\n\tfor( cf_target = ogl_target_start; cf_target <= ogl_target_end; ++cf_target )\n\t{\n\t\tif( buffer_index + DDS_full_size <= buffer_length )\n\t\t{\n\t\t\tunsigned int byte_offset = DDS_main_size;\n\t\t\tmemcpy( (void*)DDS_data, (const void*)(&buffer[buffer_index]), DDS_full_size );\n\t\t\tbuffer_index += DDS_full_size;\n\t\t\t/*\tupload the main chunk\t*/\n\t\t\tif( uncompressed )\n\t\t\t{\n\t\t\t\t/*\tand remember, DXT uncompressed uses BGR(A),\n\t\t\t\t\tso swap to RGB(A) for ALL MIPmap levels\t*/\n\t\t\t\tfor( i = 0; i < DDS_full_size; i += block_size )\n\t\t\t\t{\n\t\t\t\t\tunsigned char temp = DDS_data[i];\n\t\t\t\t\tDDS_data[i] = DDS_data[i+2];\n\t\t\t\t\tDDS_data[i+2] = temp;\n\t\t\t\t}\n\t\t\t\tglTexImage2D(\n\t\t\t\t\tcf_target, 0,\n\t\t\t\t\tS3TC_type, width, height, 0,\n\t\t\t\t\tS3TC_type, GL_UNSIGNED_BYTE, DDS_data );\n\t\t\t} else\n\t\t\t{\n\t\t\t\tsoilGlCompressedTexImage2D(\n\t\t\t\t\tcf_target, 0,\n\t\t\t\t\tS3TC_type, width, height, 0,\n\t\t\t\t\tDDS_main_size, DDS_data );\n\t\t\t}\n\t\t\t/*\tupload the mipmaps, if we have them\t*/\n\t\t\tfor( i = 1; i <= mipmaps; ++i )\n\t\t\t{\n\t\t\t\tint w, h, mip_size;\n\t\t\t\tw = width >> i;\n\t\t\t\th = height >> i;\n\t\t\t\tif( w < 1 )\n\t\t\t\t{\n\t\t\t\t\tw = 1;\n\t\t\t\t}\n\t\t\t\tif( h < 1 )\n\t\t\t\t{\n\t\t\t\t\th = 1;\n\t\t\t\t}\n\t\t\t\t/*\tupload this mipmap\t*/\n\t\t\t\tif( uncompressed )\n\t\t\t\t{\n\t\t\t\t\tmip_size = w*h*block_size;\n\t\t\t\t\tglTexImage2D(\n\t\t\t\t\t\tcf_target, i,\n\t\t\t\t\t\tS3TC_type, w, h, 0,\n\t\t\t\t\t\tS3TC_type, GL_UNSIGNED_BYTE, &DDS_data[byte_offset] );\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tmip_size = ((w+3)/4)*((h+3)/4)*block_size;\n\t\t\t\t\tsoilGlCompressedTexImage2D(\n\t\t\t\t\t\tcf_target, i,\n\t\t\t\t\t\tS3TC_type, w, h, 0,\n\t\t\t\t\t\tmip_size, &DDS_data[byte_offset] );\n\t\t\t\t}\n\t\t\t\t/*\tand move to the next mipmap\t*/\n\t\t\t\tbyte_offset += mip_size;\n\t\t\t}\n\t\t\t/*\tit worked!\t*/\n\t\t\tresult_string_pointer = \"DDS file loaded\";\n\t\t} else\n\t\t{\n\t\t\tglDeleteTextures( 1, & tex_ID );\n\t\t\ttex_ID = 0;\n\t\t\tcf_target = ogl_target_end + 1;\n\t\t\tresult_string_pointer = \"DDS file was too small for expected image data\";\n\t\t}\n\t}/* end reading each face */\n\tSOIL_free_image_data( DDS_data );\n\tif( tex_ID )\n\t{\n\t\t/*\tdid I have MIPmaps?\t*/\n\t\tif( mipmaps > 0 )\n\t\t{\n\t\t\t/*\tinstruct OpenGL to use the MIPmaps\t*/\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR );\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );\n\t\t} else\n\t\t{\n\t\t\t/*\tinstruct OpenGL _NOT_ to use the MIPmaps\t*/\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR );\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR );\n\t\t}\n\t\t/*\tdoes the user want clamping, or wrapping?\t*/\n\t\tif( flags & SOIL_FLAG_TEXTURE_REPEATS )\n\t\t{\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_S, GL_REPEAT );\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_T, GL_REPEAT );\n\t\t\tglTexParameteri( opengl_texture_type, SOIL_TEXTURE_WRAP_R, GL_REPEAT );\n\t\t} else\n\t\t{\n\t\t\t/*\tunsigned int clamp_mode = SOIL_CLAMP_TO_EDGE;\t*/\n\t\t\tunsigned int clamp_mode = GL_CLAMP;\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_S, clamp_mode );\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_T, clamp_mode );\n\t\t\tglTexParameteri( opengl_texture_type, SOIL_TEXTURE_WRAP_R, clamp_mode );\n\t\t}\n\t}\n\nquick_exit:\n\t/*\treport success or failure\t*/\n\treturn tex_ID;\n}\n\nunsigned int SOIL_direct_load_DDS(\n\t\tconst char *filename,\n\t\tunsigned int reuse_texture_ID,\n\t\tint flags,\n\t\tint loading_as_cubemap )\n{\n\tFILE *f;\n\tunsigned char *buffer;\n\tsize_t buffer_length, bytes_read;\n\tunsigned int tex_ID = 0;\n\t/*\terror checks\t*/\n\tif( NULL == filename )\n\t{\n\t\tresult_string_pointer = \"NULL filename\";\n\t\treturn 0;\n\t}\n\tf = fopen( filename, \"rb\" );\n\tif( NULL == f )\n\t{\n\t\t/*\tthe file doesn't seem to exist (or be open-able)\t*/\n\t\tresult_string_pointer = \"Can not find DDS file\";\n\t\treturn 0;\n\t}\n\tfseek( f, 0, SEEK_END );\n\tbuffer_length = ftell( f );\n\tfseek( f, 0, SEEK_SET );\n\tbuffer = (unsigned char *) malloc( buffer_length );\n\tif( NULL == buffer )\n\t{\n\t\tresult_string_pointer = \"malloc failed\";\n\t\tfclose( f );\n\t\treturn 0;\n\t}\n\tbytes_read = fread( (void*)buffer, 1, buffer_length, f );\n\tfclose( f );\n\tif( bytes_read < buffer_length )\n\t{\n\t\t/*\thuh?\t*/\n\t\tbuffer_length = bytes_read;\n\t}\n\t/*\tnow try to do the loading\t*/\n\ttex_ID = SOIL_direct_load_DDS_from_memory(\n\t\t(const unsigned char *const)buffer, buffer_length,\n\t\treuse_texture_ID, flags, loading_as_cubemap );\n\tSOIL_free_image_data( buffer );\n\treturn tex_ID;\n}\n\nint query_NPOT_capability( void )\n{\n\t/*\tcheck for the capability\t*/\n\tif( has_NPOT_capability == SOIL_CAPABILITY_UNKNOWN )\n\t{\n\t\t/*\twe haven't yet checked for the capability, do so\t*/\n\t\tif(\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_ARB_texture_non_power_of_two\" ) )\n\t\t\t)\n\t\t{\n\t\t\t/*\tnot there, flag the failure\t*/\n\t\t\thas_NPOT_capability = SOIL_CAPABILITY_NONE;\n\t\t} else\n\t\t{\n\t\t\t/*\tit's there!\t*/\n\t\t\thas_NPOT_capability = SOIL_CAPABILITY_PRESENT;\n\t\t}\n\t}\n\t/*\tlet the user know if we can do non-power-of-two textures or not\t*/\n\treturn has_NPOT_capability;\n}\n\nint query_tex_rectangle_capability( void )\n{\n\t/*\tcheck for the capability\t*/\n\tif( has_tex_rectangle_capability == SOIL_CAPABILITY_UNKNOWN )\n\t{\n\t\t/*\twe haven't yet checked for the capability, do so\t*/\n\t\tif(\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_ARB_texture_rectangle\" ) )\n\t\t&&\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_EXT_texture_rectangle\" ) )\n\t\t&&\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_NV_texture_rectangle\" ) )\n\t\t\t)\n\t\t{\n\t\t\t/*\tnot there, flag the failure\t*/\n\t\t\thas_tex_rectangle_capability = SOIL_CAPABILITY_NONE;\n\t\t} else\n\t\t{\n\t\t\t/*\tit's there!\t*/\n\t\t\thas_tex_rectangle_capability = SOIL_CAPABILITY_PRESENT;\n\t\t}\n\t}\n\t/*\tlet the user know if we can do texture rectangles or not\t*/\n\treturn has_tex_rectangle_capability;\n}\n\nint query_cubemap_capability( void )\n{\n\t/*\tcheck for the capability\t*/\n\tif( has_cubemap_capability == SOIL_CAPABILITY_UNKNOWN )\n\t{\n\t\t/*\twe haven't yet checked for the capability, do so\t*/\n\t\tif(\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_ARB_texture_cube_map\" ) )\n\t\t&&\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_EXT_texture_cube_map\" ) )\n\t\t\t)\n\t\t{\n\t\t\t/*\tnot there, flag the failure\t*/\n\t\t\thas_cubemap_capability = SOIL_CAPABILITY_NONE;\n\t\t} else\n\t\t{\n\t\t\t/*\tit's there!\t*/\n\t\t\thas_cubemap_capability = SOIL_CAPABILITY_PRESENT;\n\t\t}\n\t}\n\t/*\tlet the user know if we can do cubemaps or not\t*/\n\treturn has_cubemap_capability;\n}\n\nint query_DXT_capability( void )\n{\n\t/*\tcheck for the capability\t*/\n\tif( has_DXT_capability == SOIL_CAPABILITY_UNKNOWN )\n\t{\n\t\t/*\twe haven't yet checked for the capability, do so\t*/\n\t\tif( NULL == strstr(\n\t\t\t\t(char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_EXT_texture_compression_s3tc\" ) )\n\t\t{\n\t\t\t/*\tnot there, flag the failure\t*/\n\t\t\thas_DXT_capability = SOIL_CAPABILITY_NONE;\n\t\t} else\n\t\t{\n\t\t\t/*\tand find the address of the extension function\t*/\n\t\t\tP_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC ext_addr = NULL;\n\t\t\t#ifdef WIN32\n\t\t\t\text_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC)\n\t\t\t\t\t\twglGetProcAddress\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\"glCompressedTexImage2DARB\"\n\t\t\t\t\t\t);\n\t\t\t#elif defined(__APPLE__) || defined(__APPLE_CC__)\n\t\t\t\t/*\tI can't test this Apple stuff!\t*/\n\t\t\t\tCFBundleRef bundle;\n\t\t\t\tCFURLRef bundleURL =\n\t\t\t\t\tCFURLCreateWithFileSystemPath(\n\t\t\t\t\t\tkCFAllocatorDefault,\n\t\t\t\t\t\tCFSTR(\"/System/Library/Frameworks/OpenGL.framework\"),\n\t\t\t\t\t\tkCFURLPOSIXPathStyle,\n\t\t\t\t\t\ttrue );\n\t\t\t\tCFStringRef extensionName =\n\t\t\t\t\tCFStringCreateWithCString(\n\t\t\t\t\t\tkCFAllocatorDefault,\n\t\t\t\t\t\t\"glCompressedTexImage2DARB\",\n\t\t\t\t\t\tkCFStringEncodingASCII );\n\t\t\t\tbundle = CFBundleCreate( kCFAllocatorDefault, bundleURL );\n\t\t\t\tassert( bundle != NULL );\n\t\t\t\text_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC)\n\t\t\t\t\t\tCFBundleGetFunctionPointerForName\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tbundle, extensionName\n\t\t\t\t\t\t);\n\t\t\t\tCFRelease( bundleURL );\n\t\t\t\tCFRelease( extensionName );\n\t\t\t\tCFRelease( bundle );\n\t\t\t#else\n\t\t\t\text_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC)\n\t\t\t\t\t\tglXGetProcAddressARB\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(const GLubyte *)\"glCompressedTexImage2DARB\"\n\t\t\t\t\t\t);\n\t\t\t#endif\n\t\t\t/*\tFlag it so no checks needed later\t*/\n\t\t\tif( NULL == ext_addr )\n\t\t\t{\n\t\t\t\t/*\thmm, not good!! This should not happen, but does on my\n\t\t\t\t\tlaptop's VIA chipset. The GL_EXT_texture_compression_s3tc\n\t\t\t\t\tspec requires that ARB_texture_compression be present too.\n\t\t\t\t\tthis means I can upload and have the OpenGL drive do the\n\t\t\t\t\tconversion, but I can't use my own routines or load DDS files\n\t\t\t\t\tfrom disk and upload them directly [8^(\t*/\n\t\t\t\thas_DXT_capability = SOIL_CAPABILITY_NONE;\n\t\t\t} else\n\t\t\t{\n\t\t\t\t/*\tall's well!\t*/\n\t\t\t\tsoilGlCompressedTexImage2D = ext_addr;\n\t\t\t\thas_DXT_capability = SOIL_CAPABILITY_PRESENT;\n\t\t\t}\n\t\t}\n\t}\n\t/*\tlet the user know if we can do DXT or not\t*/\n\treturn has_DXT_capability;\n}\n"}, {"path": "includes/SOIL.h", "language": "code", "loc": 397, "comment_density": 0.544, "code": "/**\n\t@mainpage SOIL\n\n\tJonathan Dummer\n\t2007-07-26-10.36\n\n\tSimple OpenGL Image Library\n\n\tA tiny c library for uploading images as\n\ttextures into OpenGL. Also saving and\n\tloading of images is supported.\n\n\tI'm using Sean's Tool Box image loader as a base:\n\thttp://www.nothings.org/\n\n\tI'm upgrading it to load TGA and DDS files, and a direct\n\tpath for loading DDS files straight into OpenGL textures,\n\twhen applicable.\n\n\tImage Formats:\n\t- BMP\t\tload & save\n\t- TGA\t\tload & save\n\t- DDS\t\tload & save\n\t- PNG\t\tload\n\t- JPG\t\tload\n\n\tOpenGL Texture Features:\n\t- resample to power-of-two sizes\n\t- MIPmap generation\n\t- compressed texture S3TC formats (if supported)\n\t- can pre-multiply alpha for you, for better compositing\n\t- can flip image about the y-axis (except pre-compressed DDS files)\n\n\tThanks to:\n\t* Sean Barret - for the awesome stb_image\n\t* Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts\n\t* everybody at gamedev.net\n**/\n\n#ifndef HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY\n#define HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/**\n\tThe format of images that may be loaded (force_channels).\n\tSOIL_LOAD_AUTO leaves the image in whatever format it was found.\n\tSOIL_LOAD_L forces the image to load as Luminous (greyscale)\n\tSOIL_LOAD_LA forces the image to load as Luminous with Alpha\n\tSOIL_LOAD_RGB forces the image to load as Red Green Blue\n\tSOIL_LOAD_RGBA forces the image to load as Red Green Blue Alpha\n**/\nenum\n{\n\tSOIL_LOAD_AUTO = 0,\n\tSOIL_LOAD_L = 1,\n\tSOIL_LOAD_LA = 2,\n\tSOIL_LOAD_RGB = 3,\n\tSOIL_LOAD_RGBA = 4\n};\n\n/**\n\tPassed in as reuse_texture_ID, will cause SOIL to\n\tregister a new texture ID using glGenTextures().\n\tIf the value passed into reuse_texture_ID > 0 then\n\tSOIL will just re-use that texture ID (great for\n\treloading image assets in-game!)\n**/\nenum\n{\n\tSOIL_CREATE_NEW_ID = 0\n};\n\n/**\n\tflags you can pass into SOIL_load_OGL_texture()\n\tand SOIL_create_OGL_texture().\n\t(note that if SOIL_FLAG_DDS_LOAD_DIRECT is used\n\tthe rest of the flags with the exception of\n\tSOIL_FLAG_TEXTURE_REPEATS will be ignored while\n\tloading already-compressed DDS files.)\n\n\tSOIL_FLAG_POWER_OF_TWO: force the image to be POT\n\tSOIL_FLAG_MIPMAPS: generate mipmaps for the texture\n\tSOIL_FLAG_TEXTURE_REPEATS: otherwise will clamp\n\tSOIL_FLAG_MULTIPLY_ALPHA: for using (GL_ONE,GL_ONE_MINUS_SRC_ALPHA) blending\n\tSOIL_FLAG_INVERT_Y: flip the image vertically\n\tSOIL_FLAG_COMPRESS_TO_DXT: if the card can display them, will convert RGB to DXT1, RGBA to DXT5\n\tSOIL_FLAG_DDS_LOAD_DIRECT: will load DDS files directly without _ANY_ additional processing\n\tSOIL_FLAG_NTSC_SAFE_RGB: clamps RGB components to the range [16,235]\n\tSOIL_FLAG_CoCg_Y: Google YCoCg; RGB=>CoYCg, RGBA=>CoCgAY\n\tSOIL_FLAG_TEXTURE_RECTANGLE: uses ARB_texture_rectangle ; pixel indexed & no repeat or MIPmaps or cubemaps\n**/\nenum\n{\n\tSOIL_FLAG_POWER_OF_TWO = 1,\n\tSOIL_FLAG_MIPMAPS = 2,\n\tSOIL_FLAG_TEXTURE_REPEATS = 4,\n\tSOIL_FLAG_MULTIPLY_ALPHA = 8,\n\tSOIL_FLAG_INVERT_Y = 16,\n\tSOIL_FLAG_COMPRESS_TO_DXT = 32,\n\tSOIL_FLAG_DDS_LOAD_DIRECT = 64,\n\tSOIL_FLAG_NTSC_SAFE_RGB = 128,\n\tSOIL_FLAG_CoCg_Y = 256,\n\tSOIL_FLAG_TEXTURE_RECTANGLE = 512\n};\n\n/**\n\tThe types of images that may be saved.\n\t(TGA supports uncompressed RGB / RGBA)\n\t(BMP supports uncompressed RGB)\n\t(DDS supports DXT1 and DXT5)\n**/\nenum\n{\n\tSOIL_SAVE_TYPE_TGA = 0,\n\tSOIL_SAVE_TYPE_BMP = 1,\n\tSOIL_SAVE_TYPE_DDS = 2\n};\n\n/**\n\tDefines the order of faces in a DDS cubemap.\n\tI recommend that you use the same order in single\n\timage cubemap files, so they will be interchangeable\n\twith DDS cubemaps when using SOIL.\n**/\n#define SOIL_DDS_CUBEMAP_FACE_ORDER \"EWUDNS\"\n\n/**\n\tThe types of internal fake HDR representations\n\n\tSOIL_HDR_RGBE:\t\tRGB * pow( 2.0, A - 128.0 )\n\tSOIL_HDR_RGBdivA:\tRGB / A\n\tSOIL_HDR_RGBdivA2:\tRGB / (A*A)\n**/\nenum\n{\n\tSOIL_HDR_RGBE = 0,\n\tSOIL_HDR_RGBdivA = 1,\n\tSOIL_HDR_RGBdivA2 = 2\n};\n\n/**\n\tLoads an image from disk into an OpenGL texture.\n\t\\param filename the name of the file to upload as a texture\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_texture\n\t(\n\t\tconst char *filename,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads 6 images from disk into an OpenGL cubemap texture.\n\t\\param x_pos_file the name of the file to upload as the +x cube face\n\t\\param x_neg_file the name of the file to upload as the -x cube face\n\t\\param y_pos_file the name of the file to upload as the +y cube face\n\t\\param y_neg_file the name of the file to upload as the -y cube face\n\t\\param z_pos_file the name of the file to upload as the +z cube face\n\t\\param z_neg_file the name of the file to upload as the -z cube face\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_cubemap\n\t(\n\t\tconst char *x_pos_file,\n\t\tconst char *x_neg_file,\n\t\tconst char *y_pos_file,\n\t\tconst char *y_neg_file,\n\t\tconst char *z_pos_file,\n\t\tconst char *z_neg_file,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads 1 image from disk and splits it into an OpenGL cubemap texture.\n\t\\param filename the name of the file to upload as a texture\n\t\\param face_order the order of the faces in the file, any combination of NSWEUD, for North, South, Up, etc.\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_single_cubemap\n\t(\n\t\tconst char *filename,\n\t\tconst char face_order[6],\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads an HDR image from disk into an OpenGL texture.\n\t\\param filename the name of the file to upload as a texture\n\t\\param fake_HDR_format SOIL_HDR_RGBE, SOIL_HDR_RGBdivA, SOIL_HDR_RGBdivA2\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_HDR_texture\n\t(\n\t\tconst char *filename,\n\t\tint fake_HDR_format,\n\t\tint rescale_to_max,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads an image from RAM into an OpenGL texture.\n\t\\param buffer the image data in RAM just as if it were still in a file\n\t\\param buffer_length the size of the buffer in bytes\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_texture_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads 6 images from memory into an OpenGL cubemap texture.\n\t\\param x_pos_buffer the image data in RAM to upload as the +x cube face\n\t\\param x_pos_buffer_length the size of the above buffer\n\t\\param x_neg_buffer the image data in RAM to upload as the +x cube face\n\t\\param x_neg_buffer_length the size of the above buffer\n\t\\param y_pos_buffer the image data in RAM to upload as the +x cube face\n\t\\param y_pos_buffer_length the size of the above buffer\n\t\\param y_neg_buffer the image data in RAM to upload as the +x cube face\n\t\\param y_neg_buffer_length the size of the above buffer\n\t\\param z_pos_buffer the image data in RAM to upload as the +x cube face\n\t\\param z_pos_buffer_length the size of the above buffer\n\t\\param z_neg_buffer the image data in RAM to upload as the +x cube face\n\t\\param z_neg_buffer_length the size of the above buffer\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_cubemap_from_memory\n\t(\n\t\tconst unsigned char *const x_pos_buffer,\n\t\tint x_pos_buffer_length,\n\t\tconst unsigned char *const x_neg_buffer,\n\t\tint x_neg_buffer_length,\n\t\tconst unsigned char *const y_pos_buffer,\n\t\tint y_pos_buffer_length,\n\t\tconst unsigned char *const y_neg_buffer,\n\t\tint y_neg_buffer_length,\n\t\tconst unsigned char *const z_pos_buffer,\n\t\tint z_pos_buffer_length,\n\t\tconst unsigned char *const z_neg_buffer,\n\t\tint z_neg_buffer_length,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads 1 image from RAM and splits it into an OpenGL cubemap texture.\n\t\\param buffer the image data in RAM just as if it were still in a file\n\t\\param buffer_length the size of the buffer in bytes\n\t\\param face_order the order of the faces in the file, any combination of NSWEUD, for North, South, Up, etc.\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_single_cubemap_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tconst char face_order[6],\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tCreates a 2D OpenGL texture from raw image data. Note that the raw data is\n\t_NOT_ freed after the upload (so the user can load various versions).\n\t\\param data the raw data to be uploaded as an OpenGL texture\n\t\\param width the width of the image in pixels\n\t\\param height the height of the image in pixels\n\t\\param channels the number of channels: 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_create_OGL_texture\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tCreates an OpenGL cubemap texture by splitting up 1 image into 6 parts.\n\t\\param data the raw data to be uploaded as an OpenGL texture\n\t\\param width the width of the image in pixels\n\t\\param height the height of the image in pixels\n\t\\param channels the number of channels: 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param face_order the order of the faces in the file, and combination of NSWEUD, for North, South, Up, etc.\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_create_OGL_single_cubemap\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tconst char face_order[6],\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tCaptures the OpenGL window (RGB) and saves it to disk\n\t\\return 0 if it failed, otherwise returns 1\n**/\nint\n\tSOIL_save_screenshot\n\t(\n\t\tconst char *filename,\n\t\tint image_type,\n\t\tint x, int y,\n\t\tint width, int height\n\t);\n\n/**\n\tLoads an image from disk into an array of unsigned chars.\n\tNote that *channels return the original channel count of the\n\timage. If force_channels was other than SOIL_LOAD_AUTO,\n\tthe resulting image has force_channels, but *channels may be\n\tdifferent (if the original image had a different channel\n\tcount).\n\t\\return 0 if failed, otherwise returns 1\n**/\nunsigned char*\n\tSOIL_load_image\n\t(\n\t\tconst char *filename,\n\t\tint *width, int *height, int *channels,\n\t\tint force_channels\n\t);\n\n/**\n\tLoads an image from memory into an array of unsigned chars.\n\tNote that *channels return the original channel count of the\n\timage. If force_channels was other than SOIL_LOAD_AUTO,\n\tthe resulting image has force_channels, but *channels may be\n\tdifferent (if the original image had a different channel\n\tcount).\n\t\\return 0 if failed, otherwise returns 1\n**/\nunsigned char*\n\tSOIL_load_image_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tint *width, int *height, int *channels,\n\t\tint force_channels\n\t);\n\n/**\n\tSaves an image from an array of unsigned chars (RGBA) to disk\n\t\\return 0 if failed, otherwise returns 1\n**/\nint\n\tSOIL_save_image\n\t(\n\t\tconst char *filename,\n\t\tint image_type,\n\t\tint width, int height, int channels,\n\t\tconst unsigned char *const data\n\t);\n\n/**\n\tFrees the image data (note, this is just C's \"free()\"...this function is\n\tpresent mostly so C++ programmers don't forget to use \"free()\" and call\n\t\"delete []\" instead [8^)\n**/\nvoid\n\tSOIL_free_image_data\n\t(\n\t\tunsigned char *img_data\n\t);\n\n/**\n\tThis function resturn a pointer to a string describing the last thing\n\tthat happened inside SOIL. It can be used to determine why an image\n\tfailed to load.\n**/\nconst char*\n\tSOIL_last_result\n\t(\n\t\tvoid\n\t);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY\t*/\n"}, {"path": "includes/ft2build.h", "language": "code", "loc": 36, "comment_density": 0.917, "code": "/****************************************************************************\n *\n * ft2build.h\n *\n * FreeType 2 build and setup macros.\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This is the 'entry point' for FreeType header file inclusions. It is\n * the only header file which should be included directly; all other\n * FreeType header files should be accessed with macro names (after\n * including `ft2build.h`).\n *\n * A typical example is\n *\n * ```\n * #include \n * #include FT_FREETYPE_H\n * ```\n *\n */\n\n\n#ifndef FT2BUILD_H_\n#define FT2BUILD_H_\n\n#include \n\n#endif /* FT2BUILD_H_ */\n\n\n/* END */\n"}, {"path": "includes/image_DXT.c", "language": "code", "loc": 615, "comment_density": 0.185, "code": "/*\n\tJonathan Dummer\n\t2007-07-31-10.32\n\n\tsimple DXT compression / decompression code\n\n\tpublic domain\n*/\n\n#include \"image_DXT.h\"\n#include \n#include \n#include \n#include \n\n/*\tset this =1 if you want to use the covariance matrix method...\n\twhich is better than my method of using standard deviations\n\toverall, except on the infinitesimal chance that the power\n\tmethod fails for finding the largest eigenvector\t*/\n#define USE_COV_MAT\t1\n\n/********* Function Prototypes *********/\n/*\n\tTakes a 4x4 block of pixels and compresses it into 8 bytes\n\tin DXT1 format (color only, no alpha). Speed is valued\n\tover prettiness, at least for now.\n*/\nvoid compress_DDS_color_block(\n\t\t\t\tint channels,\n\t\t\t\tconst unsigned char *const uncompressed,\n\t\t\t\tunsigned char compressed[8] );\n/*\n\tTakes a 4x4 block of pixels and compresses the alpha\n\tcomponent it into 8 bytes for use in DXT5 DDS files.\n\tSpeed is valued over prettiness, at least for now.\n*/\nvoid compress_DDS_alpha_block(\n\t\t\t\tconst unsigned char *const uncompressed,\n\t\t\t\tunsigned char compressed[8] );\n\n/********* Actual Exposed Functions *********/\nint\n\tsave_image_as_DDS\n\t(\n\t\tconst char *filename,\n\t\tint width, int height, int channels,\n\t\tconst unsigned char *const data\n\t)\n{\n\t/*\tvariables\t*/\n\tFILE *fout;\n\tunsigned char *DDS_data;\n\tDDS_header header;\n\tint DDS_size;\n\t/*\terror check\t*/\n\tif( (NULL == filename) ||\n\t\t(width < 1) || (height < 1) ||\n\t\t(channels < 1) || (channels > 4) ||\n\t\t(data == NULL ) )\n\t{\n\t\treturn 0;\n\t}\n\t/*\tConvert the image\t*/\n\tif( (channels & 1) == 1 )\n\t{\n\t\t/*\tno alpha, just use DXT1\t*/\n\t\tDDS_data = convert_image_to_DXT1( data, width, height, channels, &DDS_size );\n\t} else\n\t{\n\t\t/*\thas alpha, so use DXT5\t*/\n\t\tDDS_data = convert_image_to_DXT5( data, width, height, channels, &DDS_size );\n\t}\n\t/*\tsave it\t*/\n\tmemset( &header, 0, sizeof( DDS_header ) );\n\theader.dwMagic = ('D' << 0) | ('D' << 8) | ('S' << 16) | (' ' << 24);\n\theader.dwSize = 124;\n\theader.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_LINEARSIZE;\n\theader.dwWidth = width;\n\theader.dwHeight = height;\n\theader.dwPitchOrLinearSize = DDS_size;\n\theader.sPixelFormat.dwSize = 32;\n\theader.sPixelFormat.dwFlags = DDPF_FOURCC;\n\tif( (channels & 1) == 1 )\n\t{\n\t\theader.sPixelFormat.dwFourCC = ('D' << 0) | ('X' << 8) | ('T' << 16) | ('1' << 24);\n\t} else\n\t{\n\t\theader.sPixelFormat.dwFourCC = ('D' << 0) | ('X' << 8) | ('T' << 16) | ('5' << 24);\n\t}\n\theader.sCaps.dwCaps1 = DDSCAPS_TEXTURE;\n\t/*\twrite it out\t*/\n\tfout = fopen( filename, \"wb\");\n\tfwrite( &header, sizeof( DDS_header ), 1, fout );\n\tfwrite( DDS_data, 1, DDS_size, fout );\n\tfclose( fout );\n\t/*\tdone\t*/\n\tfree( DDS_data );\n\treturn 1;\n}\n\nunsigned char* convert_image_to_DXT1(\n\t\tconst unsigned char *const uncompressed,\n\t\tint width, int height, int channels,\n\t\tint *out_size )\n{\n\tunsigned char *compressed;\n\tint i, j, x, y;\n\tunsigned char ublock[16*3];\n\tunsigned char cblock[8];\n\tint index = 0, chan_step = 1;\n\tint block_count = 0;\n\t/*\terror check\t*/\n\t*out_size = 0;\n\tif( (width < 1) || (height < 1) ||\n\t\t(NULL == uncompressed) ||\n\t\t(channels < 1) || (channels > 4) )\n\t{\n\t\treturn NULL;\n\t}\n\t/*\tfor channels == 1 or 2, I do not step forward for R,G,B values\t*/\n\tif( channels < 3 )\n\t{\n\t\tchan_step = 0;\n\t}\n\t/*\tget the RAM for the compressed image\n\t\t(8 bytes per 4x4 pixel block)\t*/\n\t*out_size = ((width+3) >> 2) * ((height+3) >> 2) * 8;\n\tcompressed = (unsigned char*)malloc( *out_size );\n\t/*\tgo through each block\t*/\n\tfor( j = 0; j < height; j += 4 )\n\t{\n\t\tfor( i = 0; i < width; i += 4 )\n\t\t{\n\t\t\t/*\tcopy this block into a new one\t*/\n\t\t\tint idx = 0;\n\t\t\tint mx = 4, my = 4;\n\t\t\tif( j+4 >= height )\n\t\t\t{\n\t\t\t\tmy = height - j;\n\t\t\t}\n\t\t\tif( i+4 >= width )\n\t\t\t{\n\t\t\t\tmx = width - i;\n\t\t\t}\n\t\t\tfor( y = 0; y < my; ++y )\n\t\t\t{\n\t\t\t\tfor( x = 0; x < mx; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels];\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step];\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step+chan_step];\n\t\t\t\t}\n\t\t\t\tfor( x = mx; x < 4; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = ublock[0];\n\t\t\t\t\tublock[idx++] = ublock[1];\n\t\t\t\t\tublock[idx++] = ublock[2];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor( y = my; y < 4; ++y )\n\t\t\t{\n\t\t\t\tfor( x = 0; x < 4; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = ublock[0];\n\t\t\t\t\tublock[idx++] = ublock[1];\n\t\t\t\t\tublock[idx++] = ublock[2];\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\tcompress the block\t*/\n\t\t\t++block_count;\n\t\t\tcompress_DDS_color_block( 3, ublock, cblock );\n\t\t\t/*\tcopy the data from the block into the main block\t*/\n\t\t\tfor( x = 0; x < 8; ++x )\n\t\t\t{\n\t\t\t\tcompressed[index++] = cblock[x];\n\t\t\t}\n\t\t}\n\t}\n\treturn compressed;\n}\n\nunsigned char* convert_image_to_DXT5(\n\t\tconst unsigned char *const uncompressed,\n\t\tint width, int height, int channels,\n\t\tint *out_size )\n{\n\tunsigned char *compressed;\n\tint i, j, x, y;\n\tunsigned char ublock[16*4];\n\tunsigned char cblock[8];\n\tint index = 0, chan_step = 1;\n\tint block_count = 0, has_alpha;\n\t/*\terror check\t*/\n\t*out_size = 0;\n\tif( (width < 1) || (height < 1) ||\n\t\t(NULL == uncompressed) ||\n\t\t(channels < 1) || ( channels > 4) )\n\t{\n\t\treturn NULL;\n\t}\n\t/*\tfor channels == 1 or 2, I do not step forward for R,G,B vales\t*/\n\tif( channels < 3 )\n\t{\n\t\tchan_step = 0;\n\t}\n\t/*\t# channels = 1 or 3 have no alpha, 2 & 4 do have alpha\t*/\n\thas_alpha = 1 - (channels & 1);\n\t/*\tget the RAM for the compressed image\n\t\t(16 bytes per 4x4 pixel block)\t*/\n\t*out_size = ((width+3) >> 2) * ((height+3) >> 2) * 16;\n\tcompressed = (unsigned char*)malloc( *out_size );\n\t/*\tgo through each block\t*/\n\tfor( j = 0; j < height; j += 4 )\n\t{\n\t\tfor( i = 0; i < width; i += 4 )\n\t\t{\n\t\t\t/*\tlocal variables, and my block counter\t*/\n\t\t\tint idx = 0;\n\t\t\tint mx = 4, my = 4;\n\t\t\tif( j+4 >= height )\n\t\t\t{\n\t\t\t\tmy = height - j;\n\t\t\t}\n\t\t\tif( i+4 >= width )\n\t\t\t{\n\t\t\t\tmx = width - i;\n\t\t\t}\n\t\t\tfor( y = 0; y < my; ++y )\n\t\t\t{\n\t\t\t\tfor( x = 0; x < mx; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels];\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step];\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step+chan_step];\n\t\t\t\t\tublock[idx++] =\n\t\t\t\t\t\thas_alpha * uncompressed[(j+y)*width*channels+(i+x)*channels+channels-1]\n\t\t\t\t\t\t+ (1-has_alpha)*255;\n\t\t\t\t}\n\t\t\t\tfor( x = mx; x < 4; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = ublock[0];\n\t\t\t\t\tublock[idx++] = ublock[1];\n\t\t\t\t\tublock[idx++] = ublock[2];\n\t\t\t\t\tublock[idx++] = ublock[3];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor( y = my; y < 4; ++y )\n\t\t\t{\n\t\t\t\tfor( x = 0; x < 4; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = ublock[0];\n\t\t\t\t\tublock[idx++] = ublock[1];\n\t\t\t\t\tublock[idx++] = ublock[2];\n\t\t\t\t\tublock[idx++] = ublock[3];\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\tnow compress the alpha block\t*/\n\t\t\tcompress_DDS_alpha_block( ublock, cblock );\n\t\t\t/*\tcopy the data from the compressed alpha block into the main buffer\t*/\n\t\t\tfor( x = 0; x < 8; ++x )\n\t\t\t{\n\t\t\t\tcompressed[index++] = cblock[x];\n\t\t\t}\n\t\t\t/*\tthen compress the color block\t*/\n\t\t\t++block_count;\n\t\t\tcompress_DDS_color_block( 4, ublock, cblock );\n\t\t\t/*\tcopy the data from the compressed color block into the main buffer\t*/\n\t\t\tfor( x = 0; x < 8; ++x )\n\t\t\t{\n\t\t\t\tcompressed[index++] = cblock[x];\n\t\t\t}\n\t\t}\n\t}\n\treturn compressed;\n}\n\n/********* Helper Functions *********/\nint convert_bit_range( int c, int from_bits, int to_bits )\n{\n\tint b = (1 << (from_bits - 1)) + c * ((1 << to_bits) - 1);\n\treturn (b + (b >> from_bits)) >> from_bits;\n}\n\nint rgb_to_565( int r, int g, int b )\n{\n\treturn\n\t\t(convert_bit_range( r, 8, 5 ) << 11) |\n\t\t(convert_bit_range( g, 8, 6 ) << 05) |\n\t\t(convert_bit_range( b, 8, 5 ) << 00);\n}\n\nvoid rgb_888_from_565( unsigned int c, int *r, int *g, int *b )\n{\n\t*r = convert_bit_range( (c >> 11) & 31, 5, 8 );\n\t*g = convert_bit_range( (c >> 05) & 63, 6, 8 );\n\t*b = convert_bit_range( (c >> 00) & 31, 5, 8 );\n}\n\nvoid compute_color_line_STDEV(\n\t\tconst unsigned char *const uncompressed,\n\t\tint channels,\n\t\tfloat point[3], float direction[3] )\n{\n\tconst float inv_16 = 1.0f / 16.0f;\n\tint i;\n\tfloat sum_r = 0.0f, sum_g = 0.0f, sum_b = 0.0f;\n\tfloat sum_rr = 0.0f, sum_gg = 0.0f, sum_bb = 0.0f;\n\tfloat sum_rg = 0.0f, sum_rb = 0.0f, sum_gb = 0.0f;\n\t/*\tcalculate all data needed for the covariance matrix\n\t\t( to compare with _rygdxt code)\t*/\n\tfor( i = 0; i < 16*channels; i += channels )\n\t{\n\t\tsum_r += uncompressed[i+0];\n\t\tsum_rr += uncompressed[i+0] * uncompressed[i+0];\n\t\tsum_g += uncompressed[i+1];\n\t\tsum_gg += uncompressed[i+1] * uncompressed[i+1];\n\t\tsum_b += uncompressed[i+2];\n\t\tsum_bb += uncompressed[i+2] * uncompressed[i+2];\n\t\tsum_rg += uncompressed[i+0] * uncompressed[i+1];\n\t\tsum_rb += uncompressed[i+0] * uncompressed[i+2];\n\t\tsum_gb += uncompressed[i+1] * uncompressed[i+2];\n\t}\n\t/*\tconvert the sums to averages\t*/\n\tsum_r *= inv_16;\n\tsum_g *= inv_16;\n\tsum_b *= inv_16;\n\t/*\tand convert the squares to the squares of the value - avg_value\t*/\n\tsum_rr -= 16.0f * sum_r * sum_r;\n\tsum_gg -= 16.0f * sum_g * sum_g;\n\tsum_bb -= 16.0f * sum_b * sum_b;\n\tsum_rg -= 16.0f * sum_r * sum_g;\n\tsum_rb -= 16.0f * sum_r * sum_b;\n\tsum_gb -= 16.0f * sum_g * sum_b;\n\t/*\tthe point on the color line is the average\t*/\n\tpoint[0] = sum_r;\n\tpoint[1] = sum_g;\n\tpoint[2] = sum_b;\n\t#if USE_COV_MAT\n\t/*\n\t\tThe following idea was from ryg.\n\t\t(https://mollyrocket.com/forums/viewtopic.php?t=392)\n\t\tThe method worked great (less RMSE than mine) most of\n\t\tthe time, but had some issues handling some simple\n\t\tboundary cases, like full green next to full red,\n\t\twhich would generate a covariance matrix like this:\n\n\t\t| 1 -1 0 |\n\t\t| -1 1 0 |\n\t\t| 0 0 0 |\n\n\t\tFor a given starting vector, the power method can\n\t\tgenerate all zeros! So no starting with {1,1,1}\n\t\tas I was doing! This kind of error is still a\n\t\tslight possibility, but will be very rare.\n\t*/\n\t/*\tuse the covariance matrix directly\n\t\t(1st iteration, don't use all 1.0 values!)\t*/\n\tsum_r = 1.0f;\n\tsum_g = 2.718281828f;\n\tsum_b = 3.141592654f;\n\tdirection[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb;\n\tdirection[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb;\n\tdirection[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb;\n\t/*\t2nd iteration, use results from the 1st guy\t*/\n\tsum_r = direction[0];\n\tsum_g = direction[1];\n\tsum_b = direction[2];\n\tdirection[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb;\n\tdirection[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb;\n\tdirection[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb;\n\t/*\t3rd iteration, use results from the 2nd guy\t*/\n\tsum_r = direction[0];\n\tsum_g = direction[1];\n\tsum_b = direction[2];\n\tdirection[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb;\n\tdirection[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb;\n\tdirection[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb;\n\t#else\n\t/*\tuse my standard deviation method\n\t\t(very robust, a tiny bit slower and less accurate)\t*/\n\tdirection[0] = sqrt( sum_rr );\n\tdirection[1] = sqrt( sum_gg );\n\tdirection[2] = sqrt( sum_bb );\n\t/*\twhich has a greater component\t*/\n\tif( sum_gg > sum_rr )\n\t{\n\t\t/*\tgreen has greater component, so base the other signs off of green\t*/\n\t\tif( sum_rg < 0.0f )\n\t\t{\n\t\t\tdirection[0] = -direction[0];\n\t\t}\n\t\tif( sum_gb < 0.0f )\n\t\t{\n\t\t\tdirection[2] = -direction[2];\n\t\t}\n\t} else\n\t{\n\t\t/*\tred has a greater component\t*/\n\t\tif( sum_rg < 0.0f )\n\t\t{\n\t\t\tdirection[1] = -direction[1];\n\t\t}\n\t\tif( sum_rb < 0.0f )\n\t\t{\n\t\t\tdirection[2] = -direction[2];\n\t\t}\n\t}\n\t#endif\n}\n\nvoid LSE_master_colors_max_min(\n\t\tint *cmax, int *cmin,\n\t\tint channels,\n\t\tconst unsigned char *const uncompressed )\n{\n\tint i, j;\n\t/*\tthe master colors\t*/\n\tint c0[3], c1[3];\n\t/*\tused for fitting the line\t*/\n\tfloat sum_x[] = { 0.0f, 0.0f, 0.0f };\n\tfloat sum_x2[] = { 0.0f, 0.0f, 0.0f };\n\tfloat dot_max = 1.0f, dot_min = -1.0f;\n\tfloat vec_len2 = 0.0f;\n\tfloat dot;\n\t/*\terror check\t*/\n\tif( (channels < 3) || (channels > 4) )\n\t{\n\t\treturn;\n\t}\n\tcompute_color_line_STDEV( uncompressed, channels, sum_x, sum_x2 );\n\tvec_len2 = 1.0f / ( 0.00001f +\n\t\t\tsum_x2[0]*sum_x2[0] + sum_x2[1]*sum_x2[1] + sum_x2[2]*sum_x2[2] );\n\t/*\tfinding the max and min vector values\t*/\n\tdot_max =\n\t\t\t(\n\t\t\t\tsum_x2[0] * uncompressed[0] +\n\t\t\t\tsum_x2[1] * uncompressed[1] +\n\t\t\t\tsum_x2[2] * uncompressed[2]\n\t\t\t);\n\tdot_min = dot_max;\n\tfor( i = 1; i < 16; ++i )\n\t{\n\t\tdot =\n\t\t\t(\n\t\t\t\tsum_x2[0] * uncompressed[i*channels+0] +\n\t\t\t\tsum_x2[1] * uncompressed[i*channels+1] +\n\t\t\t\tsum_x2[2] * uncompressed[i*channels+2]\n\t\t\t);\n\t\tif( dot < dot_min )\n\t\t{\n\t\t\tdot_min = dot;\n\t\t} else if( dot > dot_max )\n\t\t{\n\t\t\tdot_max = dot;\n\t\t}\n\t}\n\t/*\tand the offset (from the average location)\t*/\n\tdot = sum_x2[0]*sum_x[0] + sum_x2[1]*sum_x[1] + sum_x2[2]*sum_x[2];\n\tdot_min -= dot;\n\tdot_max -= dot;\n\t/*\tpost multiply by the scaling factor\t*/\n\tdot_min *= vec_len2;\n\tdot_max *= vec_len2;\n\t/*\tOK, build the master colors\t*/\n\tfor( i = 0; i < 3; ++i )\n\t{\n\t\t/*\tcolor 0\t*/\n\t\tc0[i] = (int)(0.5f + sum_x[i] + dot_max * sum_x2[i]);\n\t\tif( c0[i] < 0 )\n\t\t{\n\t\t\tc0[i] = 0;\n\t\t} else if( c0[i] > 255 )\n\t\t{\n\t\t\tc0[i] = 255;\n\t\t}\n\t\t/*\tcolor 1\t*/\n\t\tc1[i] = (int)(0.5f + sum_x[i] + dot_min * sum_x2[i]);\n\t\tif( c1[i] < 0 )\n\t\t{\n\t\t\tc1[i] = 0;\n\t\t} else if( c1[i] > 255 )\n\t\t{\n\t\t\tc1[i] = 255;\n\t\t}\n\t}\n\t/*\tdown_sample (with rounding?)\t*/\n\ti = rgb_to_565( c0[0], c0[1], c0[2] );\n\tj = rgb_to_565( c1[0], c1[1], c1[2] );\n\tif( i > j )\n\t{\n\t\t*cmax = i;\n\t\t*cmin = j;\n\t} else\n\t{\n\t\t*cmax = j;\n\t\t*cmin = i;\n\t}\n}\n\nvoid\n\tcompress_DDS_color_block\n\t(\n\t\tint channels,\n\t\tconst unsigned char *const uncompressed,\n\t\tunsigned char compressed[8]\n\t)\n{\n\t/*\tvariables\t*/\n\tint i;\n\tint next_bit;\n\tint enc_c0, enc_c1;\n\tint c0[4], c1[4];\n\tfloat color_line[] = { 0.0f, 0.0f, 0.0f, 0.0f };\n\tfloat vec_len2 = 0.0f, dot_offset = 0.0f;\n\t/*\tstupid order\t*/\n\tint swizzle4[] = { 0, 2, 3, 1 };\n\t/*\tget the master colors\t*/\n\tLSE_master_colors_max_min( &enc_c0, &enc_c1, channels, uncompressed );\n\t/*\tstore the 565 color 0 and color 1\t*/\n\tcompressed[0] = (enc_c0 >> 0) & 255;\n\tcompressed[1] = (enc_c0 >> 8) & 255;\n\tcompressed[2] = (enc_c1 >> 0) & 255;\n\tcompressed[3] = (enc_c1 >> 8) & 255;\n\t/*\tzero out the compressed data\t*/\n\tcompressed[4] = 0;\n\tcompressed[5] = 0;\n\tcompressed[6] = 0;\n\tcompressed[7] = 0;\n\t/*\treconstitute the master color vectors\t*/\n\trgb_888_from_565( enc_c0, &c0[0], &c0[1], &c0[2] );\n\trgb_888_from_565( enc_c1, &c1[0], &c1[1], &c1[2] );\n\t/*\tthe new vector\t*/\n\tvec_len2 = 0.0f;\n\tfor( i = 0; i < 3; ++i )\n\t{\n\t\tcolor_line[i] = (float)(c1[i] - c0[i]);\n\t\tvec_len2 += color_line[i] * color_line[i];\n\t}\n\tif( vec_len2 > 0.0f )\n\t{\n\t\tvec_len2 = 1.0f / vec_len2;\n\t}\n\t/*\tpre-proform the scaling\t*/\n\tcolor_line[0] *= vec_len2;\n\tcolor_line[1] *= vec_len2;\n\tcolor_line[2] *= vec_len2;\n\t/*\tcompute the offset (constant) portion of the dot product\t*/\n\tdot_offset = color_line[0]*c0[0] + color_line[1]*c0[1] + color_line[2]*c0[2];\n\t/*\tstore the rest of the bits\t*/\n\tnext_bit = 8*4;\n\tfor( i = 0; i < 16; ++i )\n\t{\n\t\t/*\tfind the dot product of this color, to place it on the line\n\t\t\t(should be [-1,1])\t*/\n\t\tint next_value = 0;\n\t\tfloat dot_product =\n\t\t\tcolor_line[0] * uncompressed[i*channels+0] +\n\t\t\tcolor_line[1] * uncompressed[i*channels+1] +\n\t\t\tcolor_line[2] * uncompressed[i*channels+2] -\n\t\t\tdot_offset;\n\t\t/*\tmap to [0,3]\t*/\n\t\tnext_value = (int)( dot_product * 3.0f + 0.5f );\n\t\tif( next_value > 3 )\n\t\t{\n\t\t\tnext_value = 3;\n\t\t} else if( next_value < 0 )\n\t\t{\n\t\t\tnext_value = 0;\n\t\t}\n\t\t/*\tOK, store this value\t*/\n\t\tcompressed[next_bit >> 3] |= swizzle4[ next_value ] << (next_bit & 7);\n\t\tnext_bit += 2;\n\t}\n\t/*\tdone compressing to DXT1\t*/\n}\n\nvoid\n\tcompress_DDS_alpha_block\n\t(\n\t\tconst unsigned char *const uncompressed,\n\t\tunsigned char compressed[8]\n\t)\n{\n\t/*\tvariables\t*/\n\tint i;\n\tint next_bit;\n\tint a0, a1;\n\tfloat scale_me;\n\t/*\tstupid order\t*/\n\tint swizzle8[] = { 1, 7, 6, 5, 4, 3, 2, 0 };\n\t/*\tget the alpha limits (a0 > a1)\t*/\n\ta0 = a1 = uncompressed[3];\n\tfor( i = 4+3; i < 16*4; i += 4 )\n\t{\n\t\tif( uncompressed[i] > a0 )\n\t\t{\n\t\t\ta0 = uncompressed[i];\n\t\t} else if( uncompressed[i] < a1 )\n\t\t{\n\t\t\ta1 = uncompressed[i];\n\t\t}\n\t}\n\t/*\tstore those limits, and zero the rest of the compressed dataset\t*/\n\tcompressed[0] = a0;\n\tcompressed[1] = a1;\n\t/*\tzero out the compressed data\t*/\n\tcompressed[2] = 0;\n\tcompressed[3] = 0;\n\tcompressed[4] = 0;\n\tcompressed[5] = 0;\n\tcompressed[6] = 0;\n\tcompressed[7] = 0;\n\t/*\tstore the all of the alpha values\t*/\n\tnext_bit = 8*2;\n\tscale_me = 7.9999f / (a0 - a1);\n\tfor( i = 3; i < 16*4; i += 4 )\n\t{\n\t\t/*\tconvert this alpha value to a 3 bit number\t*/\n\t\tint svalue;\n\t\tint value = (int)((uncompressed[i] - a1) * scale_me);\n\t\tsvalue = swizzle8[ value&7 ];\n\t\t/*\tOK, store this value, start with the 1st byte\t*/\n\t\tcompressed[next_bit >> 3] |= svalue << (next_bit & 7);\n\t\tif( (next_bit & 7) > 5 )\n\t\t{\n\t\t\t/*\tspans 2 bytes, fill in the start of the 2nd byte\t*/\n\t\t\tcompressed[1 + (next_bit >> 3)] |= svalue >> (8 - (next_bit & 7) );\n\t\t}\n\t\tnext_bit += 3;\n\t}\n\t/*\tdone compressing to DXT1\t*/\n}\n"}, {"path": "includes/image_DXT.h", "language": "code", "loc": 108, "comment_density": 0.269, "code": "/*\n\tJonathan Dummer\n\t2007-07-31-10.32\n\n\tsimple DXT compression / decompression code\n\n\tpublic domain\n*/\n\n#ifndef HEADER_IMAGE_DXT\n#define HEADER_IMAGE_DXT\n\n/**\n\tConverts an image from an array of unsigned chars (RGB or RGBA) to\n\tDXT1 or DXT5, then saves the converted image to disk.\n\t\\return 0 if failed, otherwise returns 1\n**/\nint\nsave_image_as_DDS\n(\n const char *filename,\n int width, int height, int channels,\n const unsigned char *const data\n);\n\n/**\n\ttake an image and convert it to DXT1 (no alpha)\n**/\nunsigned char*\nconvert_image_to_DXT1\n(\n const unsigned char *const uncompressed,\n int width, int height, int channels,\n int *out_size\n);\n\n/**\n\ttake an image and convert it to DXT5 (with alpha)\n**/\nunsigned char*\nconvert_image_to_DXT5\n(\n const unsigned char *const uncompressed,\n int width, int height, int channels,\n int *out_size\n);\n\n/**\tA bunch of DirectDraw Surface structures and flags **/\ntypedef struct\n{\n unsigned int dwMagic;\n unsigned int dwSize;\n unsigned int dwFlags;\n unsigned int dwHeight;\n unsigned int dwWidth;\n unsigned int dwPitchOrLinearSize;\n unsigned int dwDepth;\n unsigned int dwMipMapCount;\n unsigned int dwReserved1[ 11 ];\n\n /* DDPIXELFORMAT\t*/\n struct\n {\n unsigned int dwSize;\n unsigned int dwFlags;\n unsigned int dwFourCC;\n unsigned int dwRGBBitCount;\n unsigned int dwRBitMask;\n unsigned int dwGBitMask;\n unsigned int dwBBitMask;\n unsigned int dwAlphaBitMask;\n }\n sPixelFormat;\n\n /* DDCAPS2\t*/\n struct\n {\n unsigned int dwCaps1;\n unsigned int dwCaps2;\n unsigned int dwDDSX;\n unsigned int dwReserved;\n }\n sCaps;\n unsigned int dwReserved2;\n}\nDDS_header ;\n\n/*\tthe following constants were copied directly off the MSDN website\t*/\n\n/*\tThe dwFlags member of the original DDSURFACEDESC2 structure\n\tcan be set to one or more of the following values.\t*/\n#define DDSD_CAPS\t0x00000001\n#define DDSD_HEIGHT\t0x00000002\n#define DDSD_WIDTH\t0x00000004\n#define DDSD_PITCH\t0x00000008\n#define DDSD_PIXELFORMAT\t0x00001000\n#define DDSD_MIPMAPCOUNT\t0x00020000\n#define DDSD_LINEARSIZE\t0x00080000\n#define DDSD_DEPTH\t0x00800000\n\n/*\tDirectDraw Pixel Format\t*/\n#define DDPF_ALPHAPIXELS\t0x00000001\n#define DDPF_FOURCC\t0x00000004\n#define DDPF_RGB\t0x00000040\n\n/*\tThe dwCaps1 member of the DDSCAPS2 structure can be\n\tset to one or more of the following values.\t*/\n#define DDSCAPS_COMPLEX\t0x00000008\n#define DDSCAPS_TEXTURE\t0x00001000\n#define DDSCAPS_MIPMAP\t0x00400000\n\n/*\tThe dwCaps2 member of the DDSCAPS2 structure can be\n\tset to one or more of the following values.\t\t*/\n#define DDSCAPS2_CUBEMAP\t0x00000200\n#define DDSCAPS2_CUBEMAP_POSITIVEX\t0x00000400\n#define DDSCAPS2_CUBEMAP_NEGATIVEX\t0x00000800\n#define DDSCAPS2_CUBEMAP_POSITIVEY\t0x00001000\n#define DDSCAPS2_CUBEMAP_NEGATIVEY\t0x00002000\n#define DDSCAPS2_CUBEMAP_POSITIVEZ\t0x00004000\n#define DDSCAPS2_CUBEMAP_NEGATIVEZ\t0x00008000\n#define DDSCAPS2_VOLUME\t0x00200000\n\n#endif /* HEADER_IMAGE_DXT\t*/\n"}, {"path": "includes/image_helper.c", "language": "code", "loc": 421, "comment_density": 0.195, "code": "/*\n Jonathan Dummer\n\n image helper functions\n\n MIT license\n*/\n\n#include \"image_helper.h\"\n#include \n#include \n\n/*\tUpscaling the image uses simple bilinear interpolation\t*/\nint\n\tup_scale_image\n\t(\n\t\tconst unsigned char* const orig,\n\t\tint width, int height, int channels,\n\t\tunsigned char* resampled,\n\t\tint resampled_width, int resampled_height\n\t)\n{\n\tfloat dx, dy;\n\tint x, y, c;\n\n /* error(s) check\t*/\n if ( \t(width < 1) || (height < 1) ||\n (resampled_width < 2) || (resampled_height < 2) ||\n (channels < 1) ||\n (NULL == orig) || (NULL == resampled) )\n {\n /*\tsignify badness\t*/\n return 0;\n }\n /*\n\t\tfor each given pixel in the new map, find the exact location\n\t\tfrom the original map which would contribute to this guy\n\t*/\n dx = (width - 1.0f) / (resampled_width - 1.0f);\n dy = (height - 1.0f) / (resampled_height - 1.0f);\n for ( y = 0; y < resampled_height; ++y )\n {\n \t/* find the base y index and fractional offset from that\t*/\n \tfloat sampley = y * dy;\n \tint inty = (int)sampley;\n \t/*\tif( inty < 0 ) { inty = 0; } else\t*/\n\t\tif( inty > height - 2 ) { inty = height - 2; }\n\t\tsampley -= inty;\n for ( x = 0; x < resampled_width; ++x )\n {\n\t\t\tfloat samplex = x * dx;\n\t\t\tint intx = (int)samplex;\n\t\t\tint base_index;\n\t\t\t/* find the base x index and fractional offset from that\t*/\n\t\t\t/*\tif( intx < 0 ) { intx = 0; } else\t*/\n\t\t\tif( intx > width - 2 ) { intx = width - 2; }\n\t\t\tsamplex -= intx;\n\t\t\t/*\tbase index into the original image\t*/\n\t\t\tbase_index = (inty * width + intx) * channels;\n for ( c = 0; c < channels; ++c )\n {\n \t/*\tdo the sampling\t*/\n\t\t\t\tfloat value = 0.5f;\n\t\t\t\tvalue += orig[base_index]\n\t\t\t\t\t\t\t*(1.0f-samplex)*(1.0f-sampley);\n\t\t\t\tvalue += orig[base_index+channels]\n\t\t\t\t\t\t\t*(samplex)*(1.0f-sampley);\n\t\t\t\tvalue += orig[base_index+width*channels]\n\t\t\t\t\t\t\t*(1.0f-samplex)*(sampley);\n\t\t\t\tvalue += orig[base_index+width*channels+channels]\n\t\t\t\t\t\t\t*(samplex)*(sampley);\n\t\t\t\t/*\tmove to the next channel\t*/\n\t\t\t\t++base_index;\n \t/*\tsave the new value\t*/\n \tresampled[y*resampled_width*channels+x*channels+c] =\n\t\t\t\t\t\t(unsigned char)(value);\n }\n }\n }\n /*\tdone\t*/\n return 1;\n}\n\nint\n\tmipmap_image\n\t(\n\t\tconst unsigned char* const orig,\n\t\tint width, int height, int channels,\n\t\tunsigned char* resampled,\n\t\tint block_size_x, int block_size_y\n\t)\n{\n\tint mip_width, mip_height;\n\tint i, j, c;\n\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 1) || (orig == NULL) ||\n\t\t(resampled == NULL) ||\n\t\t(block_size_x < 1) || (block_size_y < 1) )\n\t{\n\t\t/*\tnothing to do\t*/\n\t\treturn 0;\n\t}\n\tmip_width = width / block_size_x;\n\tmip_height = height / block_size_y;\n\tif( mip_width < 1 )\n\t{\n\t\tmip_width = 1;\n\t}\n\tif( mip_height < 1 )\n\t{\n\t\tmip_height = 1;\n\t}\n\tfor( j = 0; j < mip_height; ++j )\n\t{\n\t\tfor( i = 0; i < mip_width; ++i )\n\t\t{\n\t\t\tfor( c = 0; c < channels; ++c )\n\t\t\t{\n\t\t\t\tconst int index = (j*block_size_y)*width*channels + (i*block_size_x)*channels + c;\n\t\t\t\tint sum_value;\n\t\t\t\tint u,v;\n\t\t\t\tint u_block = block_size_x;\n\t\t\t\tint v_block = block_size_y;\n\t\t\t\tint block_area;\n\t\t\t\t/*\tdo a bit of checking so we don't over-run the boundaries\n\t\t\t\t\t(necessary for non-square textures!)\t*/\n\t\t\t\tif( block_size_x * (i+1) > width )\n\t\t\t\t{\n\t\t\t\t\tu_block = width - i*block_size_y;\n\t\t\t\t}\n\t\t\t\tif( block_size_y * (j+1) > height )\n\t\t\t\t{\n\t\t\t\t\tv_block = height - j*block_size_y;\n\t\t\t\t}\n\t\t\t\tblock_area = u_block*v_block;\n\t\t\t\t/*\tfor this pixel, see what the average\n\t\t\t\t\tof all the values in the block are.\n\t\t\t\t\tnote: start the sum at the rounding value, not at 0\t*/\n\t\t\t\tsum_value = block_area >> 1;\n\t\t\t\tfor( v = 0; v < v_block; ++v )\n\t\t\t\tfor( u = 0; u < u_block; ++u )\n\t\t\t\t{\n\t\t\t\t\tsum_value += orig[index + v*width*channels + u*channels];\n\t\t\t\t}\n\t\t\t\tresampled[j*mip_width*channels + i*channels + c] = sum_value / block_area;\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}\n\nint\n\tscale_image_RGB_to_NTSC_safe\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t)\n{\n\tconst float scale_lo = 16.0f - 0.499f;\n\tconst float scale_hi = 235.0f + 0.499f;\n\tint i, j;\n\tint nc = channels;\n\tunsigned char scale_LUT[256];\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 1) || (orig == NULL) )\n\t{\n\t\t/*\tnothing to do\t*/\n\t\treturn 0;\n\t}\n\t/*\tset up the scaling Look Up Table\t*/\n\tfor( i = 0; i < 256; ++i )\n\t{\n\t\tscale_LUT[i] = (unsigned char)((scale_hi - scale_lo) * i / 255.0f + scale_lo);\n\t}\n\t/*\tfor channels = 2 or 4, ignore the alpha component\t*/\n\tnc -= 1 - (channels & 1);\n\t/*\tOK, go through the image and scale any non-alpha components\t*/\n\tfor( i = 0; i < width*height*channels; i += channels )\n\t{\n\t\tfor( j = 0; j < nc; ++j )\n\t\t{\n\t\t\torig[i+j] = scale_LUT[orig[i+j]];\n\t\t}\n\t}\n\treturn 1;\n}\n\nunsigned char clamp_byte( int x ) { return ( (x) < 0 ? (0) : ( (x) > 255 ? 255 : (x) ) ); }\n\n/*\n\tThis function takes the RGB components of the image\n\tand converts them into YCoCg. 3 components will be\n\tre-ordered to CoYCg (for optimum DXT1 compression),\n\twhile 4 components will be ordered CoCgAY (for DXT5\n\tcompression).\n*/\nint\n\tconvert_RGB_to_YCoCg\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t)\n{\n\tint i;\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 3) || (channels > 4) ||\n\t\t(orig == NULL) )\n\t{\n\t\t/*\tnothing to do\t*/\n\t\treturn -1;\n\t}\n\t/*\tdo the conversion\t*/\n\tif( channels == 3 )\n\t{\n\t\tfor( i = 0; i < width*height*3; i += 3 )\n\t\t{\n\t\t\tint r = orig[i+0];\n\t\t\tint g = (orig[i+1] + 1) >> 1;\n\t\t\tint b = orig[i+2];\n\t\t\tint tmp = (2 + r + b) >> 2;\n\t\t\t/*\tCo\t*/\n\t\t\torig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) );\n\t\t\t/*\tY\t*/\n\t\t\torig[i+1] = clamp_byte( g + tmp );\n\t\t\t/*\tCg\t*/\n\t\t\torig[i+2] = clamp_byte( 128 + g - tmp );\n\t\t}\n\t} else\n\t{\n\t\tfor( i = 0; i < width*height*4; i += 4 )\n\t\t{\n\t\t\tint r = orig[i+0];\n\t\t\tint g = (orig[i+1] + 1) >> 1;\n\t\t\tint b = orig[i+2];\n\t\t\tunsigned char a = orig[i+3];\n\t\t\tint tmp = (2 + r + b) >> 2;\n\t\t\t/*\tCo\t*/\n\t\t\torig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) );\n\t\t\t/*\tCg\t*/\n\t\t\torig[i+1] = clamp_byte( 128 + g - tmp );\n\t\t\t/*\tAlpha\t*/\n\t\t\torig[i+2] = a;\n\t\t\t/*\tY\t*/\n\t\t\torig[i+3] = clamp_byte( g + tmp );\n\t\t}\n\t}\n\t/*\tdone\t*/\n\treturn 0;\n}\n\n/*\n\tThis function takes the YCoCg components of the image\n\tand converts them into RGB. See above.\n*/\nint\n\tconvert_YCoCg_to_RGB\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t)\n{\n\tint i;\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 3) || (channels > 4) ||\n\t\t(orig == NULL) )\n\t{\n\t\t/*\tnothing to do\t*/\n\t\treturn -1;\n\t}\n\t/*\tdo the conversion\t*/\n\tif( channels == 3 )\n\t{\n\t\tfor( i = 0; i < width*height*3; i += 3 )\n\t\t{\n\t\t\tint co = orig[i+0] - 128;\n\t\t\tint y = orig[i+1];\n\t\t\tint cg = orig[i+2] - 128;\n\t\t\t/*\tR\t*/\n\t\t\torig[i+0] = clamp_byte( y + co - cg );\n\t\t\t/*\tG\t*/\n\t\t\torig[i+1] = clamp_byte( y + cg );\n\t\t\t/*\tB\t*/\n\t\t\torig[i+2] = clamp_byte( y - co - cg );\n\t\t}\n\t} else\n\t{\n\t\tfor( i = 0; i < width*height*4; i += 4 )\n\t\t{\n\t\t\tint co = orig[i+0] - 128;\n\t\t\tint cg = orig[i+1] - 128;\n\t\t\tunsigned char a = orig[i+2];\n\t\t\tint y = orig[i+3];\n\t\t\t/*\tR\t*/\n\t\t\torig[i+0] = clamp_byte( y + co - cg );\n\t\t\t/*\tG\t*/\n\t\t\torig[i+1] = clamp_byte( y + cg );\n\t\t\t/*\tB\t*/\n\t\t\torig[i+2] = clamp_byte( y - co - cg );\n\t\t\t/*\tA\t*/\n\t\t\torig[i+3] = a;\n\t\t}\n\t}\n\t/*\tdone\t*/\n\treturn 0;\n}\n\nfloat\nfind_max_RGBE\n(\n\tunsigned char *image,\n int width, int height\n)\n{\n\tfloat max_val = 0.0f;\n\tunsigned char *img = image;\n\tint i, j;\n\tfor( i = width * height; i > 0; --i )\n\t{\n\t\t/* float scale = powf( 2.0f, img[3] - 128.0f ) / 255.0f; */\n\t\tfloat scale = ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );\n\t\tfor( j = 0; j < 3; ++j )\n\t\t{\n\t\t\tif( img[j] * scale > max_val )\n\t\t\t{\n\t\t\t\tmax_val = img[j] * scale;\n\t\t\t}\n\t\t}\n\t\t/* next pixel */\n\t\timg += 4;\n\t}\n\treturn max_val;\n}\n\nint\nRGBE_to_RGBdivA\n(\n unsigned char *image,\n int width, int height,\n int rescale_to_max\n)\n{\n\t/* local variables */\n\tint i, iv;\n\tunsigned char *img = image;\n\tfloat scale = 1.0f;\n\t/* error check */\n\tif( (!image) || (width < 1) || (height < 1) )\n\t{\n\t\treturn 0;\n\t}\n\t/* convert (note: no negative numbers, but 0.0 is possible) */\n\tif( rescale_to_max )\n\t{\n\t\tscale = 255.0f / find_max_RGBE( image, width, height );\n\t}\n\tfor( i = width * height; i > 0; --i )\n\t{\n\t\t/* decode this pixel, and find the max */\n\t\tfloat r,g,b,e, m;\n\t\t/* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */\n\t\te = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );\n\t\tr = e * img[0];\n\t\tg = e * img[1];\n\t\tb = e * img[2];\n\t\tm = (r > g) ? r : g;\n\t\tm = (b > m) ? b : m;\n\t\t/* and encode it into RGBdivA */\n\t\tiv = (m != 0.0f) ? (int)(255.0f / m) : 1.0f;\n\t\tiv = (iv < 1) ? 1 : iv;\n\t\timg[3] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * r + 0.5f);\n\t\timg[0] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * g + 0.5f);\n\t\timg[1] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * b + 0.5f);\n\t\timg[2] = (iv > 255) ? 255 : iv;\n\t\t/* and on to the next pixel */\n\t\timg += 4;\n\t}\n\treturn 1;\n}\n\nint\nRGBE_to_RGBdivA2\n(\n unsigned char *image,\n int width, int height,\n int rescale_to_max\n)\n{\n\t/* local variables */\n\tint i, iv;\n\tunsigned char *img = image;\n\tfloat scale = 1.0f;\n\t/* error check */\n\tif( (!image) || (width < 1) || (height < 1) )\n\t{\n\t\treturn 0;\n\t}\n\t/* convert (note: no negative numbers, but 0.0 is possible) */\n\tif( rescale_to_max )\n\t{\n\t\tscale = 255.0f * 255.0f / find_max_RGBE( image, width, height );\n\t}\n\tfor( i = width * height; i > 0; --i )\n\t{\n\t\t/* decode this pixel, and find the max */\n\t\tfloat r,g,b,e, m;\n\t\t/* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */\n\t\te = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );\n\t\tr = e * img[0];\n\t\tg = e * img[1];\n\t\tb = e * img[2];\n\t\tm = (r > g) ? r : g;\n\t\tm = (b > m) ? b : m;\n\t\t/* and encode it into RGBdivA */\n\t\tiv = (m != 0.0f) ? (int)sqrtf( 255.0f * 255.0f / m ) : 1.0f;\n\t\tiv = (iv < 1) ? 1 : iv;\n\t\timg[3] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * img[3] * r / 255.0f + 0.5f);\n\t\timg[0] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * img[3] * g / 255.0f + 0.5f);\n\t\timg[1] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * img[3] * b / 255.0f + 0.5f);\n\t\timg[2] = (iv > 255) ? 255 : iv;\n\t\t/* and on to the next pixel */\n\t\timg += 4;\n\t}\n\treturn 1;\n}\n"}, {"path": "includes/image_helper.h", "language": "code", "loc": 102, "comment_density": 0.451, "code": "/*\n Jonathan Dummer\n\n Image helper functions\n\n MIT license\n*/\n\n#ifndef HEADER_IMAGE_HELPER\n#define HEADER_IMAGE_HELPER\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/**\n\tThis function upscales an image.\n\tNot to be used to create MIPmaps,\n\tbut to make it square,\n\tor to make it a power-of-two sized.\n**/\nint\n\tup_scale_image\n\t(\n\t\tconst unsigned char* const orig,\n\t\tint width, int height, int channels,\n\t\tunsigned char* resampled,\n\t\tint resampled_width, int resampled_height\n\t);\n\n/**\n\tThis function downscales an image.\n\tUsed for creating MIPmaps,\n\tthe incoming image should be a\n\tpower-of-two sized.\n**/\nint\n\tmipmap_image\n\t(\n\t\tconst unsigned char* const orig,\n\t\tint width, int height, int channels,\n\t\tunsigned char* resampled,\n\t\tint block_size_x, int block_size_y\n\t);\n\n/**\n\tThis function takes the RGB components of the image\n\tand scales each channel from [0,255] to [16,235].\n\tThis makes the colors \"Safe\" for display on NTSC\n\tdisplays. Note that this is _NOT_ a good idea for\n\tloading images like normal- or height-maps!\n**/\nint\n\tscale_image_RGB_to_NTSC_safe\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t);\n\n/**\n\tThis function takes the RGB components of the image\n\tand converts them into YCoCg. 3 components will be\n\tre-ordered to CoYCg (for optimum DXT1 compression),\n\twhile 4 components will be ordered CoCgAY (for DXT5\n\tcompression).\n**/\nint\n\tconvert_RGB_to_YCoCg\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t);\n\n/**\n\tThis function takes the YCoCg components of the image\n\tand converts them into RGB. See above.\n**/\nint\n\tconvert_YCoCg_to_RGB\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t);\n\n/**\n\tConverts an HDR image from an array\n\tof unsigned chars (RGBE) to RGBdivA\n\t\\return 0 if failed, otherwise returns 1\n**/\nint\n\tRGBE_to_RGBdivA\n\t(\n\t\tunsigned char *image,\n\t\tint width, int height,\n\t\tint rescale_to_max\n\t);\n\n/**\n\tConverts an HDR image from an array\n\tof unsigned chars (RGBE) to RGBdivA2\n\t\\return 0 if failed, otherwise returns 1\n**/\nint\n\tRGBE_to_RGBdivA2\n\t(\n\t\tunsigned char *image,\n\t\tint width, int height,\n\t\tint rescale_to_max\n\t);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* HEADER_IMAGE_HELPER\t*/\n"}, {"path": "includes/stb_image.h", "language": "code", "loc": 6376, "comment_density": 0.21, "code": "/* stb_image - v2.14 - public domain image loader - http://nothings.org/stb_image.h\nno warranty implied; use at your own risk\n\nDo this:\n#define STB_IMAGE_IMPLEMENTATION\nbefore you include this file in *one* C or C++ file to create the implementation.\n\n// i.e. it should look like this:\n#include ...\n#include ...\n#include ...\n#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\"\n\nYou can #define STBI_ASSERT(x) before the #include to avoid using assert.h.\nAnd #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free\n\n\nQUICK NOTES:\nPrimarily of interest to game developers and other people who can\navoid problematic images and only need the trivial interface\n\nJPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib)\nPNG 1/2/4/8-bit-per-channel (16 bpc not supported)\n\nTGA (not sure what subset, if a subset)\nBMP non-1bpp, non-RLE\nPSD (composited view only, no extra channels, 8/16 bit-per-channel)\n\nGIF (*comp always reports as 4-channel)\nHDR (radiance rgbE format)\nPIC (Softimage PIC)\nPNM (PPM and PGM binary only)\n\nAnimated GIF still needs a proper API, but here's one way to do it:\nhttp://gist.github.com/urraka/685d9a6340b26b830d49\n\n- decode from memory or through FILE (define STBI_NO_STDIO to remove code)\n- decode from arbitrary I/O callbacks\n- SIMD acceleration on x86/x64 (SSE2) and ARM (NEON)\n\nFull documentation under \"DOCUMENTATION\" below.\n\n\nRevision 2.00 release notes:\n\n- Progressive JPEG is now supported.\n\n- PPM and PGM binary formats are now supported, thanks to Ken Miller.\n\n- x86 platforms now make use of SSE2 SIMD instructions for\nJPEG decoding, and ARM platforms can use NEON SIMD if requested.\nThis work was done by Fabian \"ryg\" Giesen. SSE2 is used by\ndefault, but NEON must be enabled explicitly; see docs.\n\nWith other JPEG optimizations included in this version, we see\n2x speedup on a JPEG on an x86 machine, and a 1.5x speedup\non a JPEG on an ARM machine, relative to previous versions of this\nlibrary. The same results will not obtain for all JPGs and for all\nx86/ARM machines. (Note that progressive JPEGs are significantly\nslower to decode than regular JPEGs.) This doesn't mean that this\nis the fastest JPEG decoder in the land; rather, it brings it\ncloser to parity with standard libraries. If you want the fastest\ndecode, look elsewhere. (See \"Philosophy\" section of docs below.)\n\nSee final bullet items below for more info on SIMD.\n\n- Added STBI_MALLOC, STBI_REALLOC, and STBI_FREE macros for replacing\nthe memory allocator. Unlike other STBI libraries, these macros don't\nsupport a context parameter, so if you need to pass a context into\nthe allocator, you'll have to store it in a global or a thread-local\nvariable.\n\n- Split existing STBI_NO_HDR flag into two flags, STBI_NO_HDR and\nSTBI_NO_LINEAR.\nSTBI_NO_HDR: suppress implementation of .hdr reader format\nSTBI_NO_LINEAR: suppress high-dynamic-range light-linear float API\n\n- You can suppress implementation of any of the decoders to reduce\nyour code footprint by #defining one or more of the following\nsymbols before creating the implementation.\n\nSTBI_NO_JPEG\nSTBI_NO_PNG\nSTBI_NO_BMP\nSTBI_NO_PSD\nSTBI_NO_TGA\nSTBI_NO_GIF\nSTBI_NO_HDR\nSTBI_NO_PIC\nSTBI_NO_PNM (.ppm and .pgm)\n\n- You can request *only* certain decoders and suppress all other ones\n(this will be more forward-compatible, as addition of new decoders\ndoesn't require you to disable them explicitly):\n\nSTBI_ONLY_JPEG\nSTBI_ONLY_PNG\nSTBI_ONLY_BMP\nSTBI_ONLY_PSD\nSTBI_ONLY_TGA\nSTBI_ONLY_GIF\nSTBI_ONLY_HDR\nSTBI_ONLY_PIC\nSTBI_ONLY_PNM (.ppm and .pgm)\n\nNote that you can define multiples of these, and you will get all\nof them (\"only x\" and \"only y\" is interpreted to mean \"only x&y\").\n\n- If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still\nwant the zlib decoder to be available, #define STBI_SUPPORT_ZLIB\n\n- Compilation of all SIMD code can be suppressed with\n#define STBI_NO_SIMD\nIt should not be necessary to disable SIMD unless you have issues\ncompiling (e.g. using an x86 compiler which doesn't support SSE\nintrinsics or that doesn't support the method used to detect\nSSE2 support at run-time), and even those can be reported as\nbugs so I can refine the built-in compile-time checking to be\nsmarter.\n\n- The old STBI_SIMD system which allowed installing a user-defined\nIDCT etc. has been removed. If you need this, don't upgrade. My\nassumption is that almost nobody was doing this, and those who\nwere will find the built-in SIMD more satisfactory anyway.\n\n- RGB values computed for JPEG images are slightly different from\nprevious versions of stb_image. (This is due to using less\ninteger precision in SIMD.) The C code has been adjusted so\nthat the same RGB values will be computed regardless of whether\nSIMD support is available, so your app should always produce\nconsistent results. But these results are slightly different from\nprevious versions. (Specifically, about 3% of available YCbCr values\nwill compute different RGB results from pre-1.49 versions by +-1;\nmost of the deviating values are one smaller in the G channel.)\n\n- If you must produce consistent results with previous versions of\nstb_image, #define STBI_JPEG_OLD and you will get the same results\nyou used to; however, you will not get the SIMD speedups for\nthe YCbCr-to-RGB conversion step (although you should still see\nsignificant JPEG speedup from the other changes).\n\nPlease note that STBI_JPEG_OLD is a temporary feature; it will be\nremoved in future versions of the library. It is only intended for\nnear-term back-compatibility use.\n\n\nLatest revision history:\n2.13 (2016-12-04) experimental 16-bit API, only for PNG so far; fixes\n2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes\n2.11 (2016-04-02) 16-bit PNGS; enable SSE2 in non-gcc x64\nRGB-format JPEG; remove white matting in PSD;\nallocate large structures on the stack;\ncorrect channel count for PNG & BMP\n2.10 (2016-01-22) avoid warning introduced in 2.09\n2.09 (2016-01-16) 16-bit TGA; comments in PNM files; STBI_REALLOC_SIZED\n2.08 (2015-09-13) fix to 2.07 cleanup, reading RGB PSD as RGBA\n2.07 (2015-09-13) partial animated GIF support\nlimited 16-bit PSD support\nminor bugs, code cleanup, and compiler warnings\n\nSee end of file for full revision history.\n\n\n============================ Contributors =========================\n\nImage formats Extensions, features\nSean Barrett (jpeg, png, bmp) Jetro Lauha (stbi_info)\nNicolas Schulz (hdr, psd) Martin \"SpartanJ\" Golini (stbi_info)\nJonathan Dummer (tga) James \"moose2000\" Brown (iPhone PNG)\nJean-Marc Lienher (gif) Ben \"Disch\" Wenger (io callbacks)\nTom Seddon (pic) Omar Cornut (1/2/4-bit PNG)\nThatcher Ulrich (psd) Nicolas Guillemot (vertical flip)\nKen Miller (pgm, ppm) Richard Mitton (16-bit PSD)\ngithub:urraka (animated gif) Junggon Kim (PNM comments)\nDaniel Gibson (16-bit TGA)\nsocks-the-fox (16-bit TGA)\nOptimizations & bugfixes\nFabian \"ryg\" Giesen\nArseny Kapoulkine\n\nBug & warning fixes\nMarc LeBlanc David Woo Guillaume George Martins Mozeiko\nChristpher Lloyd Martin Golini Jerry Jansson Joseph Thomson\nDave Moore Roy Eltham Hayaki Saito Phil Jordan\nWon Chun Luke Graham Johan Duparc Nathan Reed\nthe Horde3D community Thomas Ruf Ronny Chevalier Nick Verigakis\nJanez Zemva John Bartholomew Michal Cichon github:svdijk\nJonathan Blow Ken Hamada Tero Hanninen Baldur Karlsson\nLaurent Gomila Cort Stratton Sergio Gonzalez github:romigrou\nAruelien Pocheville Thibault Reuille Cass Everitt Matthew Gregan\nRyamond Barbiero Paul Du Bois Engin Manap github:snagar\nMichaelangel007@github Oriol Ferrer Mesia Dale Weiler github:Zelex\nPhilipp Wiesemann Josh Tobin github:rlyeh github:grim210@github\nBlazej Dariusz Roszkowski github:sammyhw\n\n\nLICENSE\n\nThis software is dual-licensed to the public domain and under the following\nlicense: you are granted a perpetual, irrevocable license to copy, modify,\npublish, and distribute this file as you see fit.\n\n*/\n\n#ifndef STBI_INCLUDE_STB_IMAGE_H\n#define STBI_INCLUDE_STB_IMAGE_H\n\n// DOCUMENTATION\n//\n// Limitations:\n// - no 16-bit-per-channel PNG\n// - no 12-bit-per-channel JPEG\n// - no JPEGs with arithmetic coding\n// - no 1-bit BMP\n// - GIF always returns *comp=4\n//\n// Basic usage (see HDR discussion below for HDR usage):\n// int x,y,n;\n// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);\n// // ... process data if not NULL ...\n// // ... x = width, y = height, n = # 8-bit components per pixel ...\n// // ... replace '0' with '1'..'4' to force that many components per pixel\n// // ... but 'n' will always be the number that it would have been if you said 0\n// stbi_image_free(data)\n//\n// Standard parameters:\n// int *x -- outputs image width in pixels\n// int *y -- outputs image height in pixels\n// int *channels_in_file -- outputs # of image components in image file\n// int desired_channels -- if non-zero, # of image components requested in result\n//\n// The return value from an image loader is an 'unsigned char *' which points\n// to the pixel data, or NULL on an allocation failure or if the image is\n// corrupt or invalid. The pixel data consists of *y scanlines of *x pixels,\n// with each pixel consisting of N interleaved 8-bit components; the first\n// pixel pointed to is top-left-most in the image. There is no padding between\n// image scanlines or between pixels, regardless of format. The number of\n// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.\n// If req_comp is non-zero, *comp has the number of components that _would_\n// have been output otherwise. E.g. if you set req_comp to 4, you will always\n// get RGBA output, but you can check *comp to see if it's trivially opaque\n// because e.g. there were only 3 channels in the source image.\n//\n// An output image with N components has the following components interleaved\n// in this order in each pixel:\n//\n// N=#comp components\n// 1 grey\n// 2 grey, alpha\n// 3 red, green, blue\n// 4 red, green, blue, alpha\n//\n// If image loading fails for any reason, the return value will be NULL,\n// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()\n// can be queried for an extremely brief, end-user unfriendly explanation\n// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid\n// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly\n// more user-friendly ones.\n//\n// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.\n//\n// ===========================================================================\n//\n// Philosophy\n//\n// stb libraries are designed with the following priorities:\n//\n// 1. easy to use\n// 2. easy to maintain\n// 3. good performance\n//\n// Sometimes I let \"good performance\" creep up in priority over \"easy to maintain\",\n// and for best performance I may provide less-easy-to-use APIs that give higher\n// performance, in addition to the easy to use ones. Nevertheless, it's important\n// to keep in mind that from the standpoint of you, a client of this library,\n// all you care about is #1 and #3, and stb libraries do not emphasize #3 above all.\n//\n// Some secondary priorities arise directly from the first two, some of which\n// make more explicit reasons why performance can't be emphasized.\n//\n// - Portable (\"ease of use\")\n// - Small footprint (\"easy to maintain\")\n// - No dependencies (\"ease of use\")\n//\n// ===========================================================================\n//\n// I/O callbacks\n//\n// I/O callbacks allow you to read from arbitrary sources, like packaged\n// files or some other source. Data read from callbacks are processed\n// through a small internal buffer (currently 128 bytes) to try to reduce\n// overhead.\n//\n// The three functions you must define are \"read\" (reads some bytes of data),\n// \"skip\" (skips some bytes of data), \"eof\" (reports if the stream is at the end).\n//\n// ===========================================================================\n//\n// SIMD support\n//\n// The JPEG decoder will try to automatically use SIMD kernels on x86 when\n// supported by the compiler. For ARM Neon support, you must explicitly\n// request it.\n//\n// (The old do-it-yourself SIMD API is no longer supported in the current\n// code.)\n//\n// On x86, SSE2 will automatically be used when available based on a run-time\n// test; if not, the generic C versions are used as a fall-back. On ARM targets,\n// the typical path is to have separate builds for NEON and non-NEON devices\n// (at least this is true for iOS and Android). Therefore, the NEON support is\n// toggled by a build flag: define STBI_NEON to get NEON loops.\n//\n// The output of the JPEG decoder is slightly different from versions where\n// SIMD support was introduced (that is, for versions before 1.49). The\n// difference is only +-1 in the 8-bit RGB channels, and only on a small\n// fraction of pixels. You can force the pre-1.49 behavior by defining\n// STBI_JPEG_OLD, but this will disable some of the SIMD decoding path\n// and hence cost some performance.\n//\n// If for some reason you do not want to use any of SIMD code, or if\n// you have issues compiling it, you can disable it entirely by\n// defining STBI_NO_SIMD.\n//\n// ===========================================================================\n//\n// HDR image support (disable by defining STBI_NO_HDR)\n//\n// stb_image now supports loading HDR images in general, and currently\n// the Radiance .HDR file format, although the support is provided\n// generically. You can still load any file through the existing interface;\n// if you attempt to load an HDR file, it will be automatically remapped to\n// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;\n// both of these constants can be reconfigured through this interface:\n//\n// stbi_hdr_to_ldr_gamma(2.2f);\n// stbi_hdr_to_ldr_scale(1.0f);\n//\n// (note, do not use _inverse_ constants; stbi_image will invert them\n// appropriately).\n//\n// Additionally, there is a new, parallel interface for loading files as\n// (linear) floats to preserve the full dynamic range:\n//\n// float *data = stbi_loadf(filename, &x, &y, &n, 0);\n//\n// If you load LDR images through this interface, those images will\n// be promoted to floating point values, run through the inverse of\n// constants corresponding to the above:\n//\n// stbi_ldr_to_hdr_scale(1.0f);\n// stbi_ldr_to_hdr_gamma(2.2f);\n//\n// Finally, given a filename (or an open file or memory block--see header\n// file for details) containing image data, you can query for the \"most\n// appropriate\" interface to use (that is, whether the image is HDR or\n// not), using:\n//\n// stbi_is_hdr(char *filename);\n//\n// ===========================================================================\n//\n// iPhone PNG support:\n//\n// By default we convert iphone-formatted PNGs back to RGB, even though\n// they are internally encoded differently. You can disable this conversion\n// by by calling stbi_convert_iphone_png_to_rgb(0), in which case\n// you will always just get the native iphone \"format\" through (which\n// is BGR stored in RGB).\n//\n// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per\n// pixel to remove any premultiplied alpha *only* if the image file explicitly\n// says there's premultiplied data (currently only happens in iPhone images,\n// and only if iPhone convert-to-rgb processing is on).\n//\n\n\n#ifndef STBI_NO_STDIO\n#include \n#endif // STBI_NO_STDIO\n\n#define STBI_VERSION 1\n\nenum\n{\n STBI_default = 0, // only used for req_comp\n\n STBI_grey = 1,\n STBI_grey_alpha = 2,\n STBI_rgb = 3,\n STBI_rgb_alpha = 4\n};\n\ntypedef unsigned char stbi_uc;\ntypedef unsigned short stbi_us;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef STB_IMAGE_STATIC\n#define STBIDEF static\n#else\n#define STBIDEF extern\n#endif\n\n //////////////////////////////////////////////////////////////////////////////\n //\n // PRIMARY API - works on images of any type\n //\n\n //\n // load image by filename, open file, or memory buffer\n //\n\n typedef struct\n {\n int(*read) (void *user, char *data, int size); // fill 'data' with 'size' bytes. return number of bytes actually read\n void(*skip) (void *user, int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative\n int(*eof) (void *user); // returns nonzero if we are at end of file/data\n } stbi_io_callbacks;\n\n ////////////////////////////////////\n //\n // 8-bits-per-channel interface\n //\n\n STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);\n STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);\n STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels);\n\n#ifndef STBI_NO_STDIO\n STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);\n // for stbi_load_from_file, file pointer is left pointing immediately after image\n#endif\n\n ////////////////////////////////////\n //\n // 16-bits-per-channel interface\n //\n\n STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);\n#ifndef STBI_NO_STDIO\n STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);\n#endif\n // @TODO the other variants\n\n ////////////////////////////////////\n //\n // float-per-channel interface\n //\n#ifndef STBI_NO_LINEAR\n STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);\n STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);\n STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels);\n\n#ifndef STBI_NO_STDIO\n STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);\n#endif\n#endif\n\n#ifndef STBI_NO_HDR\n STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);\n STBIDEF void stbi_hdr_to_ldr_scale(float scale);\n#endif // STBI_NO_HDR\n\n#ifndef STBI_NO_LINEAR\n STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);\n STBIDEF void stbi_ldr_to_hdr_scale(float scale);\n#endif // STBI_NO_LINEAR\n\n // stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR\n STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user);\n STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);\n#ifndef STBI_NO_STDIO\n STBIDEF int stbi_is_hdr(char const *filename);\n STBIDEF int stbi_is_hdr_from_file(FILE *f);\n#endif // STBI_NO_STDIO\n\n\n // get a VERY brief reason for failure\n // NOT THREADSAFE\n STBIDEF const char *stbi_failure_reason(void);\n\n // free the loaded image -- this is just free()\n STBIDEF void stbi_image_free(void *retval_from_stbi_load);\n\n // get image dimensions & components without fully decoding\n STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp);\n\n#ifndef STBI_NO_STDIO\n STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp);\n STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp);\n\n#endif\n\n\n\n // for image formats that explicitly notate that they have premultiplied alpha,\n // we just return the colors as stored in the file. set this flag to force\n // unpremultiplication. results are undefined if the unpremultiply overflow.\n STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);\n\n // indicate whether we should process iphone images back to canonical format,\n // or just pass them through \"as-is\"\n STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);\n\n // flip the image vertically, so the first pixel in the output array is the bottom left\n STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip);\n\n // ZLIB client - used by PNG, available for other purposes\n\n STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);\n STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header);\n STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);\n STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);\n\n STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);\n STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n//\n//\n//// end header file /////////////////////////////////////////////////////\n#endif // STBI_INCLUDE_STB_IMAGE_H\n\n#ifdef STB_IMAGE_IMPLEMENTATION\n\n#if defined(STBI_ONLY_JPEG) || defined(STBI_ONLY_PNG) || defined(STBI_ONLY_BMP) \\\n || defined(STBI_ONLY_TGA) || defined(STBI_ONLY_GIF) || defined(STBI_ONLY_PSD) \\\n || defined(STBI_ONLY_HDR) || defined(STBI_ONLY_PIC) || defined(STBI_ONLY_PNM) \\\n || defined(STBI_ONLY_ZLIB)\n#ifndef STBI_ONLY_JPEG\n#define STBI_NO_JPEG\n#endif\n#ifndef STBI_ONLY_PNG\n#define STBI_NO_PNG\n#endif\n#ifndef STBI_ONLY_BMP\n#define STBI_NO_BMP\n#endif\n#ifndef STBI_ONLY_PSD\n#define STBI_NO_PSD\n#endif\n#ifndef STBI_ONLY_TGA\n#define STBI_NO_TGA\n#endif\n#ifndef STBI_ONLY_GIF\n#define STBI_NO_GIF\n#endif\n#ifndef STBI_ONLY_HDR\n#define STBI_NO_HDR\n#endif\n#ifndef STBI_ONLY_PIC\n#define STBI_NO_PIC\n#endif\n#ifndef STBI_ONLY_PNM\n#define STBI_NO_PNM\n#endif\n#endif\n\n#if defined(STBI_NO_PNG) && !defined(STBI_SUPPORT_ZLIB) && !defined(STBI_NO_ZLIB)\n#define STBI_NO_ZLIB\n#endif\n\n\n#include \n#include // ptrdiff_t on osx\n#include \n#include \n#include \n\n#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)\n#include // ldexp\n#endif\n\n#ifndef STBI_NO_STDIO\n#include \n#endif\n\n#ifndef STBI_ASSERT\n#include \n#define STBI_ASSERT(x) assert(x)\n#endif\n\n\n#ifndef _MSC_VER\n#ifdef __cplusplus\n#define stbi_inline inline\n#else\n#define stbi_inline\n#endif\n#else\n#define stbi_inline __forceinline\n#endif\n\n\n#ifdef _MSC_VER\ntypedef unsigned short stbi__uint16;\ntypedef signed short stbi__int16;\ntypedef unsigned int stbi__uint32;\ntypedef signed int stbi__int32;\n#else\n#include \ntypedef uint16_t stbi__uint16;\ntypedef int16_t stbi__int16;\ntypedef uint32_t stbi__uint32;\ntypedef int32_t stbi__int32;\n#endif\n\n// should produce compiler error if size is wrong\ntypedef unsigned char validate_uint32[sizeof(stbi__uint32) == 4 ? 1 : -1];\n\n#ifdef _MSC_VER\n#define STBI_NOTUSED(v) (void)(v)\n#else\n#define STBI_NOTUSED(v) (void)sizeof(v)\n#endif\n\n#ifdef _MSC_VER\n#define STBI_HAS_LROTL\n#endif\n\n#ifdef STBI_HAS_LROTL\n#define stbi_lrot(x,y) _lrotl(x,y)\n#else\n#define stbi_lrot(x,y) (((x) << (y)) | ((x) >> (32 - (y))))\n#endif\n\n#if defined(STBI_MALLOC) && defined(STBI_FREE) && (defined(STBI_REALLOC) || defined(STBI_REALLOC_SIZED))\n// ok\n#elif !defined(STBI_MALLOC) && !defined(STBI_FREE) && !defined(STBI_REALLOC) && !defined(STBI_REALLOC_SIZED)\n// ok\n#else\n#error \"Must define all or none of STBI_MALLOC, STBI_FREE, and STBI_REALLOC (or STBI_REALLOC_SIZED).\"\n#endif\n\n#ifndef STBI_MALLOC\n#define STBI_MALLOC(sz) malloc(sz)\n#define STBI_REALLOC(p,newsz) realloc(p,newsz)\n#define STBI_FREE(p) free(p)\n#endif\n\n#ifndef STBI_REALLOC_SIZED\n#define STBI_REALLOC_SIZED(p,oldsz,newsz) STBI_REALLOC(p,newsz)\n#endif\n\n// x86/x64 detection\n#if defined(__x86_64__) || defined(_M_X64)\n#define STBI__X64_TARGET\n#elif defined(__i386) || defined(_M_IX86)\n#define STBI__X86_TARGET\n#endif\n\n#if defined(__GNUC__) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET)) && !defined(__SSE2__) && !defined(STBI_NO_SIMD)\n// NOTE: not clear do we actually need this for the 64-bit path?\n// gcc doesn't support sse2 intrinsics unless you compile with -msse2,\n// (but compiling with -msse2 allows the compiler to use SSE2 everywhere;\n// this is just broken and gcc are jerks for not fixing it properly\n// http://www.virtualdub.org/blog/pivot/entry.php?id=363 )\n#define STBI_NO_SIMD\n#endif\n\n#if defined(__MINGW32__) && defined(STBI__X86_TARGET) && !defined(STBI_MINGW_ENABLE_SSE2) && !defined(STBI_NO_SIMD)\n// Note that __MINGW32__ doesn't actually mean 32-bit, so we have to avoid STBI__X64_TARGET\n//\n// 32-bit MinGW wants ESP to be 16-byte aligned, but this is not in the\n// Windows ABI and VC++ as well as Windows DLLs don't maintain that invariant.\n// As a result, enabling SSE2 on 32-bit MinGW is dangerous when not\n// simultaneously enabling \"-mstackrealign\".\n//\n// See https://github.com/nothings/stb/issues/81 for more information.\n//\n// So default to no SSE2 on 32-bit MinGW. If you've read this far and added\n// -mstackrealign to your build settings, feel free to #define STBI_MINGW_ENABLE_SSE2.\n#define STBI_NO_SIMD\n#endif\n\n#if !defined(STBI_NO_SIMD) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET))\n#define STBI_SSE2\n#include \n\n#ifdef _MSC_VER\n\n#if _MSC_VER >= 1400 // not VC6\n#include // __cpuid\nstatic int stbi__cpuid3(void)\n{\n int info[4];\n __cpuid(info, 1);\n return info[3];\n}\n#else\nstatic int stbi__cpuid3(void)\n{\n int res;\n __asm {\n mov eax, 1\n cpuid\n mov res, edx\n }\n return res;\n}\n#endif\n\n#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name\n\nstatic int stbi__sse2_available()\n{\n int info3 = stbi__cpuid3();\n return ((info3 >> 26) & 1) != 0;\n}\n#else // assume GCC-style if not VC++\n#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16)))\n\nstatic int stbi__sse2_available()\n{\n#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 // GCC 4.8 or later\n // GCC 4.8+ has a nice way to do this\n return __builtin_cpu_supports(\"sse2\");\n#else\n // portable way to do this, preferably without using GCC inline ASM?\n // just bail for now.\n return 0;\n#endif\n}\n#endif\n#endif\n\n// ARM NEON\n#if defined(STBI_NO_SIMD) && defined(STBI_NEON)\n#undef STBI_NEON\n#endif\n\n#ifdef STBI_NEON\n#include \n// assume GCC or Clang on ARM targets\n#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16)))\n#endif\n\n#ifndef STBI_SIMD_ALIGN\n#define STBI_SIMD_ALIGN(type, name) type name\n#endif\n\n///////////////////////////////////////////////\n//\n// stbi__context struct and start_xxx functions\n\n// stbi__context structure is our basic context used by all images, so it\n// contains all the IO context, plus some basic image information\ntypedef struct\n{\n stbi__uint32 img_x, img_y;\n int img_n, img_out_n;\n\n stbi_io_callbacks io;\n void *io_user_data;\n\n int read_from_callbacks;\n int buflen;\n stbi_uc buffer_start[128];\n\n stbi_uc *img_buffer, *img_buffer_end;\n stbi_uc *img_buffer_original, *img_buffer_original_end;\n} stbi__context;\n\n\nstatic void stbi__refill_buffer(stbi__context *s);\n\n// initialize a memory-decode context\nstatic void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len)\n{\n s->io.read = NULL;\n s->read_from_callbacks = 0;\n s->img_buffer = s->img_buffer_original = (stbi_uc *)buffer;\n s->img_buffer_end = s->img_buffer_original_end = (stbi_uc *)buffer + len;\n}\n\n// initialize a callback-based context\nstatic void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user)\n{\n s->io = *c;\n s->io_user_data = user;\n s->buflen = sizeof(s->buffer_start);\n s->read_from_callbacks = 1;\n s->img_buffer_original = s->buffer_start;\n stbi__refill_buffer(s);\n s->img_buffer_original_end = s->img_buffer_end;\n}\n\n#ifndef STBI_NO_STDIO\n\nstatic int stbi__stdio_read(void *user, char *data, int size)\n{\n return (int)fread(data, 1, size, (FILE*)user);\n}\n\nstatic void stbi__stdio_skip(void *user, int n)\n{\n fseek((FILE*)user, n, SEEK_CUR);\n}\n\nstatic int stbi__stdio_eof(void *user)\n{\n return feof((FILE*)user);\n}\n\nstatic stbi_io_callbacks stbi__stdio_callbacks =\n{\n stbi__stdio_read,\n stbi__stdio_skip,\n stbi__stdio_eof,\n};\n\nstatic void stbi__start_file(stbi__context *s, FILE *f)\n{\n stbi__start_callbacks(s, &stbi__stdio_callbacks, (void *)f);\n}\n\n//static void stop_file(stbi__context *s) { }\n\n#endif // !STBI_NO_STDIO\n\nstatic void stbi__rewind(stbi__context *s)\n{\n // conceptually rewind SHOULD rewind to the beginning of the stream,\n // but we just rewind to the beginning of the initial buffer, because\n // we only use it after doing 'test', which only ever looks at at most 92 bytes\n s->img_buffer = s->img_buffer_original;\n s->img_buffer_end = s->img_buffer_original_end;\n}\n\nenum\n{\n STBI_ORDER_RGB,\n STBI_ORDER_BGR\n};\n\ntypedef struct\n{\n int bits_per_channel;\n int num_channels;\n int channel_order;\n} stbi__result_info;\n\n#ifndef STBI_NO_JPEG\nstatic int stbi__jpeg_test(stbi__context *s);\nstatic void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_PNG\nstatic int stbi__png_test(stbi__context *s);\nstatic void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__png_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_BMP\nstatic int stbi__bmp_test(stbi__context *s);\nstatic void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_TGA\nstatic int stbi__tga_test(stbi__context *s);\nstatic void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_PSD\nstatic int stbi__psd_test(stbi__context *s);\nstatic void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc);\nstatic int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_HDR\nstatic int stbi__hdr_test(stbi__context *s);\nstatic float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_PIC\nstatic int stbi__pic_test(stbi__context *s);\nstatic void *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_GIF\nstatic int stbi__gif_test(stbi__context *s);\nstatic void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_PNM\nstatic int stbi__pnm_test(stbi__context *s);\nstatic void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n// this is not threadsafe\nstatic const char *stbi__g_failure_reason;\n\nSTBIDEF const char *stbi_failure_reason(void)\n{\n return stbi__g_failure_reason;\n}\n\nstatic int stbi__err(const char *str)\n{\n stbi__g_failure_reason = str;\n return 0;\n}\n\nstatic void *stbi__malloc(size_t size)\n{\n return STBI_MALLOC(size);\n}\n\n// stb_image uses ints pervasively, including for offset calculations.\n// therefore the largest decoded image size we can support with the\n// current code, even on 64-bit targets, is INT_MAX. this is not a\n// significant limitation for the intended use case.\n//\n// we do, however, need to make sure our size calculations don't\n// overflow. hence a few helper functions for size calculations that\n// multiply integers together, making sure that they're non-negative\n// and no overflow occurs.\n\n// return 1 if the sum is valid, 0 on overflow.\n// negative terms are considered invalid.\nstatic int stbi__addsizes_valid(int a, int b)\n{\n if (b < 0) return 0;\n // now 0 <= b <= INT_MAX, hence also\n // 0 <= INT_MAX - b <= INTMAX.\n // And \"a + b <= INT_MAX\" (which might overflow) is the\n // same as a <= INT_MAX - b (no overflow)\n return a <= INT_MAX - b;\n}\n\n// returns 1 if the product is valid, 0 on overflow.\n// negative factors are considered invalid.\nstatic int stbi__mul2sizes_valid(int a, int b)\n{\n if (a < 0 || b < 0) return 0;\n if (b == 0) return 1; // mul-by-0 is always safe\n // portable way to check for no overflows in a*b\n return a <= INT_MAX / b;\n}\n\n// returns 1 if \"a*b + add\" has no negative terms/factors and doesn't overflow\nstatic int stbi__mad2sizes_valid(int a, int b, int add)\n{\n return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add);\n}\n\n// returns 1 if \"a*b*c + add\" has no negative terms/factors and doesn't overflow\nstatic int stbi__mad3sizes_valid(int a, int b, int c, int add)\n{\n return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&\n stbi__addsizes_valid(a*b*c, add);\n}\n\n// returns 1 if \"a*b*c*d + add\" has no negative terms/factors and doesn't overflow\nstatic int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)\n{\n return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&\n stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);\n}\n\n// mallocs with size overflow checking\nstatic void *stbi__malloc_mad2(int a, int b, int add)\n{\n if (!stbi__mad2sizes_valid(a, b, add)) return NULL;\n return stbi__malloc(a*b + add);\n}\n\nstatic void *stbi__malloc_mad3(int a, int b, int c, int add)\n{\n if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL;\n return stbi__malloc(a*b*c + add);\n}\n\nstatic void *stbi__malloc_mad4(int a, int b, int c, int d, int add)\n{\n if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL;\n return stbi__malloc(a*b*c*d + add);\n}\n\n// stbi__err - error\n// stbi__errpf - error returning pointer to float\n// stbi__errpuc - error returning pointer to unsigned char\n\n#ifdef STBI_NO_FAILURE_STRINGS\n#define stbi__err(x,y) 0\n#elif defined(STBI_FAILURE_USERMSG)\n#define stbi__err(x,y) stbi__err(y)\n#else\n#define stbi__err(x,y) stbi__err(x)\n#endif\n\n#define stbi__errpf(x,y) ((float *)(size_t) (stbi__err(x,y)?NULL:NULL))\n#define stbi__errpuc(x,y) ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL))\n\nSTBIDEF void stbi_image_free(void *retval_from_stbi_load)\n{\n STBI_FREE(retval_from_stbi_load);\n}\n\n#ifndef STBI_NO_LINEAR\nstatic float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp);\n#endif\n\n#ifndef STBI_NO_HDR\nstatic stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp);\n#endif\n\nstatic int stbi__vertically_flip_on_load = 0;\n\nSTBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip)\n{\n stbi__vertically_flip_on_load = flag_true_if_should_flip;\n}\n\nstatic void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc)\n{\n memset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields\n ri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed\n ri->channel_order = STBI_ORDER_RGB; // all current input & output are this, but this is here so we can add BGR order\n ri->num_channels = 0;\n\n#ifndef STBI_NO_JPEG\n if (stbi__jpeg_test(s)) return stbi__jpeg_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_PNG\n if (stbi__png_test(s)) return stbi__png_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_BMP\n if (stbi__bmp_test(s)) return stbi__bmp_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_GIF\n if (stbi__gif_test(s)) return stbi__gif_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_PSD\n if (stbi__psd_test(s)) return stbi__psd_load(s, x, y, comp, req_comp, ri, bpc);\n#endif\n#ifndef STBI_NO_PIC\n if (stbi__pic_test(s)) return stbi__pic_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_PNM\n if (stbi__pnm_test(s)) return stbi__pnm_load(s, x, y, comp, req_comp, ri);\n#endif\n\n#ifndef STBI_NO_HDR\n if (stbi__hdr_test(s)) {\n float *hdr = stbi__hdr_load(s, x, y, comp, req_comp, ri);\n return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);\n }\n#endif\n\n#ifndef STBI_NO_TGA\n // test tga last because it's a crappy test!\n if (stbi__tga_test(s))\n return stbi__tga_load(s, x, y, comp, req_comp, ri);\n#endif\n\n return stbi__errpuc(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n\nstatic stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, int channels)\n{\n int i;\n int img_len = w * h * channels;\n stbi_uc *reduced;\n\n reduced = (stbi_uc *)stbi__malloc(img_len);\n if (reduced == NULL) return stbi__errpuc(\"outofmem\", \"Out of memory\");\n\n for (i = 0; i < img_len; ++i)\n reduced[i] = (stbi_uc)((orig[i] >> 8) & 0xFF); // top half of each byte is sufficient approx of 16->8 bit scaling\n\n STBI_FREE(orig);\n return reduced;\n}\n\nstatic stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels)\n{\n int i;\n int img_len = w * h * channels;\n stbi__uint16 *enlarged;\n\n enlarged = (stbi__uint16 *)stbi__malloc(img_len * 2);\n if (enlarged == NULL) return (stbi__uint16 *)stbi__errpuc(\"outofmem\", \"Out of memory\");\n\n for (i = 0; i < img_len; ++i)\n enlarged[i] = (stbi__uint16)((orig[i] << 8) + orig[i]); // replicate to high and low byte, maps 0->0, 255->0xffff\n\n STBI_FREE(orig);\n return enlarged;\n}\n\nstatic unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\n stbi__result_info ri;\n void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8);\n\n if (result == NULL)\n return NULL;\n\n if (ri.bits_per_channel != 8) {\n STBI_ASSERT(ri.bits_per_channel == 16);\n result = stbi__convert_16_to_8((stbi__uint16 *)result, *x, *y, req_comp == 0 ? *comp : req_comp);\n ri.bits_per_channel = 8;\n }\n\n // @TODO: move stbi__convert_format to here\n\n if (stbi__vertically_flip_on_load) {\n int w = *x, h = *y;\n int channels = req_comp ? req_comp : *comp;\n int row, col, z;\n stbi_uc *image = (stbi_uc *)result;\n\n // @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once\n for (row = 0; row < (h >> 1); row++) {\n for (col = 0; col < w; col++) {\n for (z = 0; z < channels; z++) {\n stbi_uc temp = image[(row * w + col) * channels + z];\n image[(row * w + col) * channels + z] = image[((h - row - 1) * w + col) * channels + z];\n image[((h - row - 1) * w + col) * channels + z] = temp;\n }\n }\n }\n }\n\n return (unsigned char *)result;\n}\n\nstatic stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\n stbi__result_info ri;\n void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 16);\n\n if (result == NULL)\n return NULL;\n\n if (ri.bits_per_channel != 16) {\n STBI_ASSERT(ri.bits_per_channel == 8);\n result = stbi__convert_8_to_16((stbi_uc *)result, *x, *y, req_comp == 0 ? *comp : req_comp);\n ri.bits_per_channel = 16;\n }\n\n // @TODO: move stbi__convert_format16 to here\n // @TODO: special case RGB-to-Y (and RGBA-to-YA) for 8-bit-to-16-bit case to keep more precision\n\n if (stbi__vertically_flip_on_load) {\n int w = *x, h = *y;\n int channels = req_comp ? req_comp : *comp;\n int row, col, z;\n stbi__uint16 *image = (stbi__uint16 *)result;\n\n // @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once\n for (row = 0; row < (h >> 1); row++) {\n for (col = 0; col < w; col++) {\n for (z = 0; z < channels; z++) {\n stbi__uint16 temp = image[(row * w + col) * channels + z];\n image[(row * w + col) * channels + z] = image[((h - row - 1) * w + col) * channels + z];\n image[((h - row - 1) * w + col) * channels + z] = temp;\n }\n }\n }\n }\n\n return (stbi__uint16 *)result;\n}\n\n#ifndef STBI_NO_HDR\nstatic void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp)\n{\n if (stbi__vertically_flip_on_load && result != NULL) {\n int w = *x, h = *y;\n int depth = req_comp ? req_comp : *comp;\n int row, col, z;\n float temp;\n\n // @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once\n for (row = 0; row < (h >> 1); row++) {\n for (col = 0; col < w; col++) {\n for (z = 0; z < depth; z++) {\n temp = result[(row * w + col) * depth + z];\n result[(row * w + col) * depth + z] = result[((h - row - 1) * w + col) * depth + z];\n result[((h - row - 1) * w + col) * depth + z] = temp;\n }\n }\n }\n }\n}\n#endif\n\n#ifndef STBI_NO_STDIO\n\nstatic FILE *stbi__fopen(char const *filename, char const *mode)\n{\n FILE *f;\n#if defined(_MSC_VER) && _MSC_VER >= 1400\n if (0 != fopen_s(&f, filename, mode))\n f = 0;\n#else\n f = fopen(filename, mode);\n#endif\n return f;\n}\n\n\nSTBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n FILE *f = stbi__fopen(filename, \"rb\");\n unsigned char *result;\n if (!f) return stbi__errpuc(\"can't fopen\", \"Unable to open file\");\n result = stbi_load_from_file(f, x, y, comp, req_comp);\n fclose(f);\n return result;\n}\n\nSTBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *result;\n stbi__context s;\n stbi__start_file(&s, f);\n result = stbi__load_and_postprocess_8bit(&s, x, y, comp, req_comp);\n if (result) {\n // need to 'unget' all the characters in the IO buffer\n fseek(f, -(int)(s.img_buffer_end - s.img_buffer), SEEK_CUR);\n }\n return result;\n}\n\nSTBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n stbi__uint16 *result;\n stbi__context s;\n stbi__start_file(&s, f);\n result = stbi__load_and_postprocess_16bit(&s, x, y, comp, req_comp);\n if (result) {\n // need to 'unget' all the characters in the IO buffer\n fseek(f, -(int)(s.img_buffer_end - s.img_buffer), SEEK_CUR);\n }\n return result;\n}\n\nSTBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n FILE *f = stbi__fopen(filename, \"rb\");\n stbi__uint16 *result;\n if (!f) return (stbi_us *)stbi__errpuc(\"can't fopen\", \"Unable to open file\");\n result = stbi_load_from_file_16(f, x, y, comp, req_comp);\n fclose(f);\n return result;\n}\n\n\n#endif //!STBI_NO_STDIO\n\nSTBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_mem(&s, buffer, len);\n return stbi__load_and_postprocess_8bit(&s, x, y, comp, req_comp);\n}\n\nSTBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user);\n return stbi__load_and_postprocess_8bit(&s, x, y, comp, req_comp);\n}\n\n#ifndef STBI_NO_LINEAR\nstatic float *stbi__loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *data;\n#ifndef STBI_NO_HDR\n if (stbi__hdr_test(s)) {\n stbi__result_info ri;\n float *hdr_data = stbi__hdr_load(s, x, y, comp, req_comp, &ri);\n if (hdr_data)\n stbi__float_postprocess(hdr_data, x, y, comp, req_comp);\n return hdr_data;\n }\n#endif\n data = stbi__load_and_postprocess_8bit(s, x, y, comp, req_comp);\n if (data)\n return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);\n return stbi__errpf(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n\nSTBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_mem(&s, buffer, len);\n return stbi__loadf_main(&s, x, y, comp, req_comp);\n}\n\nSTBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user);\n return stbi__loadf_main(&s, x, y, comp, req_comp);\n}\n\n#ifndef STBI_NO_STDIO\nSTBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n float *result;\n FILE *f = stbi__fopen(filename, \"rb\");\n if (!f) return stbi__errpf(\"can't fopen\", \"Unable to open file\");\n result = stbi_loadf_from_file(f, x, y, comp, req_comp);\n fclose(f);\n return result;\n}\n\nSTBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_file(&s, f);\n return stbi__loadf_main(&s, x, y, comp, req_comp);\n}\n#endif // !STBI_NO_STDIO\n\n#endif // !STBI_NO_LINEAR\n\n// these is-hdr-or-not is defined independent of whether STBI_NO_LINEAR is\n// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always\n// reports false!\n\nSTBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)\n{\n#ifndef STBI_NO_HDR\n stbi__context s;\n stbi__start_mem(&s, buffer, len);\n return stbi__hdr_test(&s);\n#else\n STBI_NOTUSED(buffer);\n STBI_NOTUSED(len);\n return 0;\n#endif\n}\n\n#ifndef STBI_NO_STDIO\nSTBIDEF int stbi_is_hdr(char const *filename)\n{\n FILE *f = stbi__fopen(filename, \"rb\");\n int result = 0;\n if (f) {\n result = stbi_is_hdr_from_file(f);\n fclose(f);\n }\n return result;\n}\n\nSTBIDEF int stbi_is_hdr_from_file(FILE *f)\n{\n#ifndef STBI_NO_HDR\n stbi__context s;\n stbi__start_file(&s, f);\n return stbi__hdr_test(&s);\n#else\n STBI_NOTUSED(f);\n return 0;\n#endif\n}\n#endif // !STBI_NO_STDIO\n\nSTBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user)\n{\n#ifndef STBI_NO_HDR\n stbi__context s;\n stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user);\n return stbi__hdr_test(&s);\n#else\n STBI_NOTUSED(clbk);\n STBI_NOTUSED(user);\n return 0;\n#endif\n}\n\n#ifndef STBI_NO_LINEAR\nstatic float stbi__l2h_gamma = 2.2f, stbi__l2h_scale = 1.0f;\n\nSTBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; }\nSTBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; }\n#endif\n\nstatic float stbi__h2l_gamma_i = 1.0f / 2.2f, stbi__h2l_scale_i = 1.0f;\n\nSTBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1 / gamma; }\nSTBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1 / scale; }\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// Common code used by all image loaders\n//\n\nenum\n{\n STBI__SCAN_load = 0,\n STBI__SCAN_type,\n STBI__SCAN_header\n};\n\nstatic void stbi__refill_buffer(stbi__context *s)\n{\n int n = (s->io.read)(s->io_user_data, (char*)s->buffer_start, s->buflen);\n if (n == 0) {\n // at end of file, treat same as if from memory, but need to handle case\n // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file\n s->read_from_callbacks = 0;\n s->img_buffer = s->buffer_start;\n s->img_buffer_end = s->buffer_start + 1;\n *s->img_buffer = 0;\n }\n else {\n s->img_buffer = s->buffer_start;\n s->img_buffer_end = s->buffer_start + n;\n }\n}\n\nstbi_inline static stbi_uc stbi__get8(stbi__context *s)\n{\n if (s->img_buffer < s->img_buffer_end)\n return *s->img_buffer++;\n if (s->read_from_callbacks) {\n stbi__refill_buffer(s);\n return *s->img_buffer++;\n }\n return 0;\n}\n\nstbi_inline static int stbi__at_eof(stbi__context *s)\n{\n if (s->io.read) {\n if (!(s->io.eof)(s->io_user_data)) return 0;\n // if feof() is true, check if buffer = end\n // special case: we've only got the special 0 character at the end\n if (s->read_from_callbacks == 0) return 1;\n }\n\n return s->img_buffer >= s->img_buffer_end;\n}\n\nstatic void stbi__skip(stbi__context *s, int n)\n{\n if (n < 0) {\n s->img_buffer = s->img_buffer_end;\n return;\n }\n if (s->io.read) {\n int blen = (int)(s->img_buffer_end - s->img_buffer);\n if (blen < n) {\n s->img_buffer = s->img_buffer_end;\n (s->io.skip)(s->io_user_data, n - blen);\n return;\n }\n }\n s->img_buffer += n;\n}\n\nstatic int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)\n{\n if (s->io.read) {\n int blen = (int)(s->img_buffer_end - s->img_buffer);\n if (blen < n) {\n int res, count;\n\n memcpy(buffer, s->img_buffer, blen);\n\n count = (s->io.read)(s->io_user_data, (char*)buffer + blen, n - blen);\n res = (count == (n - blen));\n s->img_buffer = s->img_buffer_end;\n return res;\n }\n }\n\n if (s->img_buffer + n <= s->img_buffer_end) {\n memcpy(buffer, s->img_buffer, n);\n s->img_buffer += n;\n return 1;\n }\n else\n return 0;\n}\n\nstatic int stbi__get16be(stbi__context *s)\n{\n int z = stbi__get8(s);\n return (z << 8) + stbi__get8(s);\n}\n\nstatic stbi__uint32 stbi__get32be(stbi__context *s)\n{\n stbi__uint32 z = stbi__get16be(s);\n return (z << 16) + stbi__get16be(s);\n}\n\n#if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF)\n// nothing\n#else\nstatic int stbi__get16le(stbi__context *s)\n{\n int z = stbi__get8(s);\n return z + (stbi__get8(s) << 8);\n}\n#endif\n\n#ifndef STBI_NO_BMP\nstatic stbi__uint32 stbi__get32le(stbi__context *s)\n{\n stbi__uint32 z = stbi__get16le(s);\n return z + (stbi__get16le(s) << 16);\n}\n#endif\n\n#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// generic converter from built-in img_n to req_comp\n// individual types do this automatically as much as possible (e.g. jpeg\n// does all cases internally since it needs to colorspace convert anyway,\n// and it never has alpha, so very few cases ). png can automatically\n// interleave an alpha=255 channel, but falls back to this for other cases\n//\n// assume data buffer is malloced, so malloc a new one and free that one\n// only failure mode is malloc failing\n\nstatic stbi_uc stbi__compute_y(int r, int g, int b)\n{\n return (stbi_uc)(((r * 77) + (g * 150) + (29 * b)) >> 8);\n}\n\nstatic unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y)\n{\n int i, j;\n unsigned char *good;\n\n if (req_comp == img_n) return data;\n STBI_ASSERT(req_comp >= 1 && req_comp <= 4);\n\n good = (unsigned char *)stbi__malloc_mad3(req_comp, x, y, 0);\n if (good == NULL) {\n STBI_FREE(data);\n return stbi__errpuc(\"outofmem\", \"Out of memory\");\n }\n\n for (j = 0; j < (int)y; ++j) {\n unsigned char *src = data + j * x * img_n;\n unsigned char *dest = good + j * x * req_comp;\n\n#define STBI__COMBO(a,b) ((a)*8+(b))\n#define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)\n // convert source image with img_n components to one with req_comp components;\n // avoid switch per pixel, so use switch per scanline and massive macros\n switch (STBI__COMBO(img_n, req_comp)) {\n STBI__CASE(1, 2) { dest[0] = src[0], dest[1] = 255; } break;\n STBI__CASE(1, 3) { dest[0] = dest[1] = dest[2] = src[0]; } break;\n STBI__CASE(1, 4) { dest[0] = dest[1] = dest[2] = src[0], dest[3] = 255; } break;\n STBI__CASE(2, 1) { dest[0] = src[0]; } break;\n STBI__CASE(2, 3) { dest[0] = dest[1] = dest[2] = src[0]; } break;\n STBI__CASE(2, 4) { dest[0] = dest[1] = dest[2] = src[0], dest[3] = src[1]; } break;\n STBI__CASE(3, 4) { dest[0] = src[0], dest[1] = src[1], dest[2] = src[2], dest[3] = 255; } break;\n STBI__CASE(3, 1) { dest[0] = stbi__compute_y(src[0], src[1], src[2]); } break;\n STBI__CASE(3, 2) { dest[0] = stbi__compute_y(src[0], src[1], src[2]), dest[1] = 255; } break;\n STBI__CASE(4, 1) { dest[0] = stbi__compute_y(src[0], src[1], src[2]); } break;\n STBI__CASE(4, 2) { dest[0] = stbi__compute_y(src[0], src[1], src[2]), dest[1] = src[3]; } break;\n STBI__CASE(4, 3) { dest[0] = src[0], dest[1] = src[1], dest[2] = src[2]; } break;\n default: STBI_ASSERT(0);\n }\n#undef STBI__CASE\n }\n\n STBI_FREE(data);\n return good;\n}\n\nstatic stbi__uint16 stbi__compute_y_16(int r, int g, int b)\n{\n return (stbi__uint16)(((r * 77) + (g * 150) + (29 * b)) >> 8);\n}\n\nstatic stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y)\n{\n int i, j;\n stbi__uint16 *good;\n\n if (req_comp == img_n) return data;\n STBI_ASSERT(req_comp >= 1 && req_comp <= 4);\n\n good = (stbi__uint16 *)stbi__malloc(req_comp * x * y * 2);\n if (good == NULL) {\n STBI_FREE(data);\n return (stbi__uint16 *)stbi__errpuc(\"outofmem\", \"Out of memory\");\n }\n\n for (j = 0; j < (int)y; ++j) {\n stbi__uint16 *src = data + j * x * img_n;\n stbi__uint16 *dest = good + j * x * req_comp;\n\n#define STBI__COMBO(a,b) ((a)*8+(b))\n#define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)\n // convert source image with img_n components to one with req_comp components;\n // avoid switch per pixel, so use switch per scanline and massive macros\n switch (STBI__COMBO(img_n, req_comp)) {\n STBI__CASE(1, 2) { dest[0] = src[0], dest[1] = 0xffff; } break;\n STBI__CASE(1, 3) { dest[0] = dest[1] = dest[2] = src[0]; } break;\n STBI__CASE(1, 4) { dest[0] = dest[1] = dest[2] = src[0], dest[3] = 0xffff; } break;\n STBI__CASE(2, 1) { dest[0] = src[0]; } break;\n STBI__CASE(2, 3) { dest[0] = dest[1] = dest[2] = src[0]; } break;\n STBI__CASE(2, 4) { dest[0] = dest[1] = dest[2] = src[0], dest[3] = src[1]; } break;\n STBI__CASE(3, 4) { dest[0] = src[0], dest[1] = src[1], dest[2] = src[2], dest[3] = 0xffff; } break;\n STBI__CASE(3, 1) { dest[0] = stbi__compute_y_16(src[0], src[1], src[2]); } break;\n STBI__CASE(3, 2) { dest[0] = stbi__compute_y_16(src[0], src[1], src[2]), dest[1] = 0xffff; } break;\n STBI__CASE(4, 1) { dest[0] = stbi__compute_y_16(src[0], src[1], src[2]); } break;\n STBI__CASE(4, 2) { dest[0] = stbi__compute_y_16(src[0], src[1], src[2]), dest[1] = src[3]; } break;\n STBI__CASE(4, 3) { dest[0] = src[0], dest[1] = src[1], dest[2] = src[2]; } break;\n default: STBI_ASSERT(0);\n }\n#undef STBI__CASE\n }\n\n STBI_FREE(data);\n return good;\n}\n\n#ifndef STBI_NO_LINEAR\nstatic float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)\n{\n int i, k, n;\n float *output;\n if (!data) return NULL;\n output = (float *)stbi__malloc_mad4(x, y, comp, sizeof(float), 0);\n if (output == NULL) { STBI_FREE(data); return stbi__errpf(\"outofmem\", \"Out of memory\"); }\n // compute number of non-alpha components\n if (comp & 1) n = comp; else n = comp - 1;\n for (i = 0; i < x*y; ++i) {\n for (k = 0; k < n; ++k) {\n output[i*comp + k] = (float)(pow(data[i*comp + k] / 255.0f, stbi__l2h_gamma) * stbi__l2h_scale);\n }\n if (k < comp) output[i*comp + k] = data[i*comp + k] / 255.0f;\n }\n STBI_FREE(data);\n return output;\n}\n#endif\n\n#ifndef STBI_NO_HDR\n#define stbi__float2int(x) ((int) (x))\nstatic stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp)\n{\n int i, k, n;\n stbi_uc *output;\n if (!data) return NULL;\n output = (stbi_uc *)stbi__malloc_mad3(x, y, comp, 0);\n if (output == NULL) { STBI_FREE(data); return stbi__errpuc(\"outofmem\", \"Out of memory\"); }\n // compute number of non-alpha components\n if (comp & 1) n = comp; else n = comp - 1;\n for (i = 0; i < x*y; ++i) {\n for (k = 0; k < n; ++k) {\n float z = (float)pow(data[i*comp + k] * stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f;\n if (z < 0) z = 0;\n if (z > 255) z = 255;\n output[i*comp + k] = (stbi_uc)stbi__float2int(z);\n }\n if (k < comp) {\n float z = data[i*comp + k] * 255 + 0.5f;\n if (z < 0) z = 0;\n if (z > 255) z = 255;\n output[i*comp + k] = (stbi_uc)stbi__float2int(z);\n }\n }\n STBI_FREE(data);\n return output;\n}\n#endif\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// \"baseline\" JPEG/JFIF decoder\n//\n// simple implementation\n// - doesn't support delayed output of y-dimension\n// - simple interface (only one output format: 8-bit interleaved RGB)\n// - doesn't try to recover corrupt jpegs\n// - doesn't allow partial loading, loading multiple at once\n// - still fast on x86 (copying globals into locals doesn't help x86)\n// - allocates lots of intermediate memory (full size of all components)\n// - non-interleaved case requires this anyway\n// - allows good upsampling (see next)\n// high-quality\n// - upsampled channels are bilinearly interpolated, even across blocks\n// - quality integer IDCT derived from IJG's 'slow'\n// performance\n// - fast huffman; reasonable integer IDCT\n// - some SIMD kernels for common paths on targets with SSE2/NEON\n// - uses a lot of intermediate memory, could cache poorly\n\n#ifndef STBI_NO_JPEG\n\n// huffman decoding acceleration\n#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache\n\ntypedef struct\n{\n stbi_uc fast[1 << FAST_BITS];\n // weirdly, repacking this into AoS is a 10% speed loss, instead of a win\n stbi__uint16 code[256];\n stbi_uc values[256];\n stbi_uc size[257];\n unsigned int maxcode[18];\n int delta[17]; // old 'firstsymbol' - old 'firstcode'\n} stbi__huffman;\n\ntypedef struct\n{\n stbi__context *s;\n stbi__huffman huff_dc[4];\n stbi__huffman huff_ac[4];\n stbi_uc dequant[4][64];\n stbi__int16 fast_ac[4][1 << FAST_BITS];\n\n // sizes for components, interleaved MCUs\n int img_h_max, img_v_max;\n int img_mcu_x, img_mcu_y;\n int img_mcu_w, img_mcu_h;\n\n // definition of jpeg image component\n struct\n {\n int id;\n int h, v;\n int tq;\n int hd, ha;\n int dc_pred;\n\n int x, y, w2, h2;\n stbi_uc *data;\n void *raw_data, *raw_coeff;\n stbi_uc *linebuf;\n short *coeff; // progressive only\n int coeff_w, coeff_h; // number of 8x8 coefficient blocks\n } img_comp[4];\n\n stbi__uint32 code_buffer; // jpeg entropy-coded buffer\n int code_bits; // number of valid bits\n unsigned char marker; // marker seen while filling entropy buffer\n int nomore; // flag if we saw a marker so must stop\n\n int progressive;\n int spec_start;\n int spec_end;\n int succ_high;\n int succ_low;\n int eob_run;\n int rgb;\n\n int scan_n, order[4];\n int restart_interval, todo;\n\n // kernels\n void(*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]);\n void(*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step);\n stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs);\n} stbi__jpeg;\n\nstatic int stbi__build_huffman(stbi__huffman *h, int *count)\n{\n int i, j, k = 0, code;\n // build size list for each symbol (from JPEG spec)\n for (i = 0; i < 16; ++i)\n for (j = 0; j < count[i]; ++j)\n h->size[k++] = (stbi_uc)(i + 1);\n h->size[k] = 0;\n\n // compute actual symbols (from jpeg spec)\n code = 0;\n k = 0;\n for (j = 1; j <= 16; ++j) {\n // compute delta to add to code to compute symbol id\n h->delta[j] = k - code;\n if (h->size[k] == j) {\n while (h->size[k] == j)\n h->code[k++] = (stbi__uint16)(code++);\n if (code - 1 >= (1 << j)) return stbi__err(\"bad code lengths\", \"Corrupt JPEG\");\n }\n // compute largest code + 1 for this size, preshifted as needed later\n h->maxcode[j] = code << (16 - j);\n code <<= 1;\n }\n h->maxcode[j] = 0xffffffff;\n\n // build non-spec acceleration table; 255 is flag for not-accelerated\n memset(h->fast, 255, 1 << FAST_BITS);\n for (i = 0; i < k; ++i) {\n int s = h->size[i];\n if (s <= FAST_BITS) {\n int c = h->code[i] << (FAST_BITS - s);\n int m = 1 << (FAST_BITS - s);\n for (j = 0; j < m; ++j) {\n h->fast[c + j] = (stbi_uc)i;\n }\n }\n }\n return 1;\n}\n\n// build a table that decodes both magnitude and value of small ACs in\n// one go.\nstatic void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h)\n{\n int i;\n for (i = 0; i < (1 << FAST_BITS); ++i) {\n stbi_uc fast = h->fast[i];\n fast_ac[i] = 0;\n if (fast < 255) {\n int rs = h->values[fast];\n int run = (rs >> 4) & 15;\n int magbits = rs & 15;\n int len = h->size[fast];\n\n if (magbits && len + magbits <= FAST_BITS) {\n // magnitude code followed by receive_extend code\n int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits);\n int m = 1 << (magbits - 1);\n if (k < m) k += (-1 << magbits) + 1;\n // if the result is small enough, we can fit it in fast_ac table\n if (k >= -128 && k <= 127)\n fast_ac[i] = (stbi__int16)((k << 8) + (run << 4) + (len + magbits));\n }\n }\n }\n}\n\nstatic void stbi__grow_buffer_unsafe(stbi__jpeg *j)\n{\n do {\n int b = j->nomore ? 0 : stbi__get8(j->s);\n if (b == 0xff) {\n int c = stbi__get8(j->s);\n if (c != 0) {\n j->marker = (unsigned char)c;\n j->nomore = 1;\n return;\n }\n }\n j->code_buffer |= b << (24 - j->code_bits);\n j->code_bits += 8;\n } while (j->code_bits <= 24);\n}\n\n// (1 << n) - 1\nstatic stbi__uint32 stbi__bmask[17] = { 0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535 };\n\n// decode a jpeg huffman value from the bitstream\nstbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h)\n{\n unsigned int temp;\n int c, k;\n\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n\n // look at the top FAST_BITS and determine what symbol ID it is,\n // if the code is <= FAST_BITS\n c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS) - 1);\n k = h->fast[c];\n if (k < 255) {\n int s = h->size[k];\n if (s > j->code_bits)\n return -1;\n j->code_buffer <<= s;\n j->code_bits -= s;\n return h->values[k];\n }\n\n // naive test is to shift the code_buffer down so k bits are\n // valid, then test against maxcode. To speed this up, we've\n // preshifted maxcode left so that it has (16-k) 0s at the\n // end; in other words, regardless of the number of bits, it\n // wants to be compared against something shifted to have 16;\n // that way we don't need to shift inside the loop.\n temp = j->code_buffer >> 16;\n for (k = FAST_BITS + 1; ; ++k)\n if (temp < h->maxcode[k])\n break;\n if (k == 17) {\n // error! code not found\n j->code_bits -= 16;\n return -1;\n }\n\n if (k > j->code_bits)\n return -1;\n\n // convert the huffman code to the symbol id\n c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k];\n STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]);\n\n // convert the id to a symbol\n j->code_bits -= k;\n j->code_buffer <<= k;\n return h->values[c];\n}\n\n// bias[n] = (-1<code_bits < n) stbi__grow_buffer_unsafe(j);\n\n sgn = (stbi__int32)j->code_buffer >> 31; // sign bit is always in MSB\n k = stbi_lrot(j->code_buffer, n);\n STBI_ASSERT(n >= 0 && n < (int)(sizeof(stbi__bmask) / sizeof(*stbi__bmask)));\n j->code_buffer = k & ~stbi__bmask[n];\n k &= stbi__bmask[n];\n j->code_bits -= n;\n return k + (stbi__jbias[n] & ~sgn);\n}\n\n// get some unsigned bits\nstbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n)\n{\n unsigned int k;\n if (j->code_bits < n) stbi__grow_buffer_unsafe(j);\n k = stbi_lrot(j->code_buffer, n);\n j->code_buffer = k & ~stbi__bmask[n];\n k &= stbi__bmask[n];\n j->code_bits -= n;\n return k;\n}\n\nstbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)\n{\n unsigned int k;\n if (j->code_bits < 1) stbi__grow_buffer_unsafe(j);\n k = j->code_buffer;\n j->code_buffer <<= 1;\n --j->code_bits;\n return k & 0x80000000;\n}\n\n// given a value that's at position X in the zigzag stream,\n// where does it appear in the 8x8 matrix coded as row-major?\nstatic stbi_uc stbi__jpeg_dezigzag[64 + 15] =\n{\n 0, 1, 8, 16, 9, 2, 3, 10,\n 17, 24, 32, 25, 18, 11, 4, 5,\n 12, 19, 26, 33, 40, 48, 41, 34,\n 27, 20, 13, 6, 7, 14, 21, 28,\n 35, 42, 49, 56, 57, 50, 43, 36,\n 29, 22, 15, 23, 30, 37, 44, 51,\n 58, 59, 52, 45, 38, 31, 39, 46,\n 53, 60, 61, 54, 47, 55, 62, 63,\n // let corrupt input sample past end\n 63, 63, 63, 63, 63, 63, 63, 63,\n 63, 63, 63, 63, 63, 63, 63\n};\n\n// decode one 64-entry block--\nstatic int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant)\n{\n int diff, dc, k;\n int t;\n\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n t = stbi__jpeg_huff_decode(j, hdc);\n if (t < 0) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n\n // 0 all the ac values now so we can do it 32-bits at a time\n memset(data, 0, 64 * sizeof(data[0]));\n\n diff = t ? stbi__extend_receive(j, t) : 0;\n dc = j->img_comp[b].dc_pred + diff;\n j->img_comp[b].dc_pred = dc;\n data[0] = (short)(dc * dequant[0]);\n\n // decode AC components, see JPEG spec\n k = 1;\n do {\n unsigned int zig;\n int c, r, s;\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS) - 1);\n r = fac[c];\n if (r) { // fast-AC path\n k += (r >> 4) & 15; // run\n s = r & 15; // combined length\n j->code_buffer <<= s;\n j->code_bits -= s;\n // decode into unzigzag'd location\n zig = stbi__jpeg_dezigzag[k++];\n data[zig] = (short)((r >> 8) * dequant[zig]);\n }\n else {\n int rs = stbi__jpeg_huff_decode(j, hac);\n if (rs < 0) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n s = rs & 15;\n r = rs >> 4;\n if (s == 0) {\n if (rs != 0xf0) break; // end block\n k += 16;\n }\n else {\n k += r;\n // decode into unzigzag'd location\n zig = stbi__jpeg_dezigzag[k++];\n data[zig] = (short)(stbi__extend_receive(j, s) * dequant[zig]);\n }\n }\n } while (k < 64);\n return 1;\n}\n\nstatic int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b)\n{\n int diff, dc;\n int t;\n if (j->spec_end != 0) return stbi__err(\"can't merge dc and ac\", \"Corrupt JPEG\");\n\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n\n if (j->succ_high == 0) {\n // first scan for DC coefficient, must be first\n memset(data, 0, 64 * sizeof(data[0])); // 0 all the ac values now\n t = stbi__jpeg_huff_decode(j, hdc);\n diff = t ? stbi__extend_receive(j, t) : 0;\n\n dc = j->img_comp[b].dc_pred + diff;\n j->img_comp[b].dc_pred = dc;\n data[0] = (short)(dc << j->succ_low);\n }\n else {\n // refinement scan for DC coefficient\n if (stbi__jpeg_get_bit(j))\n data[0] += (short)(1 << j->succ_low);\n }\n return 1;\n}\n\n// @OPTIMIZE: store non-zigzagged during the decode passes,\n// and only de-zigzag when dequantizing\nstatic int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac)\n{\n int k;\n if (j->spec_start == 0) return stbi__err(\"can't merge dc and ac\", \"Corrupt JPEG\");\n\n if (j->succ_high == 0) {\n int shift = j->succ_low;\n\n if (j->eob_run) {\n --j->eob_run;\n return 1;\n }\n\n k = j->spec_start;\n do {\n unsigned int zig;\n int c, r, s;\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS) - 1);\n r = fac[c];\n if (r) { // fast-AC path\n k += (r >> 4) & 15; // run\n s = r & 15; // combined length\n j->code_buffer <<= s;\n j->code_bits -= s;\n zig = stbi__jpeg_dezigzag[k++];\n data[zig] = (short)((r >> 8) << shift);\n }\n else {\n int rs = stbi__jpeg_huff_decode(j, hac);\n if (rs < 0) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n s = rs & 15;\n r = rs >> 4;\n if (s == 0) {\n if (r < 15) {\n j->eob_run = (1 << r);\n if (r)\n j->eob_run += stbi__jpeg_get_bits(j, r);\n --j->eob_run;\n break;\n }\n k += 16;\n }\n else {\n k += r;\n zig = stbi__jpeg_dezigzag[k++];\n data[zig] = (short)(stbi__extend_receive(j, s) << shift);\n }\n }\n } while (k <= j->spec_end);\n }\n else {\n // refinement scan for these AC coefficients\n\n short bit = (short)(1 << j->succ_low);\n\n if (j->eob_run) {\n --j->eob_run;\n for (k = j->spec_start; k <= j->spec_end; ++k) {\n short *p = &data[stbi__jpeg_dezigzag[k]];\n if (*p != 0)\n if (stbi__jpeg_get_bit(j))\n if ((*p & bit) == 0) {\n if (*p > 0)\n *p += bit;\n else\n *p -= bit;\n }\n }\n }\n else {\n k = j->spec_start;\n do {\n int r, s;\n int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh\n if (rs < 0) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n s = rs & 15;\n r = rs >> 4;\n if (s == 0) {\n if (r < 15) {\n j->eob_run = (1 << r) - 1;\n if (r)\n j->eob_run += stbi__jpeg_get_bits(j, r);\n r = 64; // force end of block\n }\n else {\n // r=15 s=0 should write 16 0s, so we just do\n // a run of 15 0s and then write s (which is 0),\n // so we don't have to do anything special here\n }\n }\n else {\n if (s != 1) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n // sign bit\n if (stbi__jpeg_get_bit(j))\n s = bit;\n else\n s = -bit;\n }\n\n // advance by r\n while (k <= j->spec_end) {\n short *p = &data[stbi__jpeg_dezigzag[k++]];\n if (*p != 0) {\n if (stbi__jpeg_get_bit(j))\n if ((*p & bit) == 0) {\n if (*p > 0)\n *p += bit;\n else\n *p -= bit;\n }\n }\n else {\n if (r == 0) {\n *p = (short)s;\n break;\n }\n --r;\n }\n }\n } while (k <= j->spec_end);\n }\n }\n return 1;\n}\n\n// take a -128..127 value and stbi__clamp it and convert to 0..255\nstbi_inline static stbi_uc stbi__clamp(int x)\n{\n // trick to use a single test to catch both cases\n if ((unsigned int)x > 255) {\n if (x < 0) return 0;\n if (x > 255) return 255;\n }\n return (stbi_uc)x;\n}\n\n#define stbi__f2f(x) ((int) (((x) * 4096 + 0.5)))\n#define stbi__fsh(x) ((x) << 12)\n\n// derived from jidctint -- DCT_ISLOW\n#define STBI__IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \\\n int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \\\n p2 = s2; \\\n p3 = s6; \\\n p1 = (p2+p3) * stbi__f2f(0.5411961f); \\\n t2 = p1 + p3*stbi__f2f(-1.847759065f); \\\n t3 = p1 + p2*stbi__f2f( 0.765366865f); \\\n p2 = s0; \\\n p3 = s4; \\\n t0 = stbi__fsh(p2+p3); \\\n t1 = stbi__fsh(p2-p3); \\\n x0 = t0+t3; \\\n x3 = t0-t3; \\\n x1 = t1+t2; \\\n x2 = t1-t2; \\\n t0 = s7; \\\n t1 = s5; \\\n t2 = s3; \\\n t3 = s1; \\\n p3 = t0+t2; \\\n p4 = t1+t3; \\\n p1 = t0+t3; \\\n p2 = t1+t2; \\\n p5 = (p3+p4)*stbi__f2f( 1.175875602f); \\\n t0 = t0*stbi__f2f( 0.298631336f); \\\n t1 = t1*stbi__f2f( 2.053119869f); \\\n t2 = t2*stbi__f2f( 3.072711026f); \\\n t3 = t3*stbi__f2f( 1.501321110f); \\\n p1 = p5 + p1*stbi__f2f(-0.899976223f); \\\n p2 = p5 + p2*stbi__f2f(-2.562915447f); \\\n p3 = p3*stbi__f2f(-1.961570560f); \\\n p4 = p4*stbi__f2f(-0.390180644f); \\\n t3 += p1+p4; \\\n t2 += p2+p3; \\\n t1 += p2+p4; \\\n t0 += p1+p3;\n\nstatic void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])\n{\n int i, val[64], *v = val;\n stbi_uc *o;\n short *d = data;\n\n // columns\n for (i = 0; i < 8; ++i, ++d, ++v) {\n // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing\n if (d[8] == 0 && d[16] == 0 && d[24] == 0 && d[32] == 0\n && d[40] == 0 && d[48] == 0 && d[56] == 0) {\n // no shortcut 0 seconds\n // (1|2|3|4|5|6|7)==0 0 seconds\n // all separate -0.047 seconds\n // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds\n int dcterm = d[0] << 2;\n v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;\n }\n else {\n STBI__IDCT_1D(d[0], d[8], d[16], d[24], d[32], d[40], d[48], d[56])\n // constants scaled things up by 1<<12; let's bring them back\n // down, but keep 2 extra bits of precision\n x0 += 512; x1 += 512; x2 += 512; x3 += 512;\n v[0] = (x0 + t3) >> 10;\n v[56] = (x0 - t3) >> 10;\n v[8] = (x1 + t2) >> 10;\n v[48] = (x1 - t2) >> 10;\n v[16] = (x2 + t1) >> 10;\n v[40] = (x2 - t1) >> 10;\n v[24] = (x3 + t0) >> 10;\n v[32] = (x3 - t0) >> 10;\n }\n }\n\n for (i = 0, v = val, o = out; i < 8; ++i, v += 8, o += out_stride) {\n // no fast case since the first 1D IDCT spread components out\n STBI__IDCT_1D(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7])\n // constants scaled things up by 1<<12, plus we had 1<<2 from first\n // loop, plus horizontal and vertical each scale by sqrt(8) so together\n // we've got an extra 1<<3, so 1<<17 total we need to remove.\n // so we want to round that, which means adding 0.5 * 1<<17,\n // aka 65536. Also, we'll end up with -128 to 127 that we want\n // to encode as 0..255 by adding 128, so we'll add that before the shift\n x0 += 65536 + (128 << 17);\n x1 += 65536 + (128 << 17);\n x2 += 65536 + (128 << 17);\n x3 += 65536 + (128 << 17);\n // tried computing the shifts into temps, or'ing the temps to see\n // if any were out of range, but that was slower\n o[0] = stbi__clamp((x0 + t3) >> 17);\n o[7] = stbi__clamp((x0 - t3) >> 17);\n o[1] = stbi__clamp((x1 + t2) >> 17);\n o[6] = stbi__clamp((x1 - t2) >> 17);\n o[2] = stbi__clamp((x2 + t1) >> 17);\n o[5] = stbi__clamp((x2 - t1) >> 17);\n o[3] = stbi__clamp((x3 + t0) >> 17);\n o[4] = stbi__clamp((x3 - t0) >> 17);\n }\n}\n\n#ifdef STBI_SSE2\n// sse2 integer IDCT. not the fastest possible implementation but it\n// produces bit-identical results to the generic C version so it's\n// fully \"transparent\".\nstatic void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])\n{\n // This is constructed to match our regular (generic) integer IDCT exactly.\n __m128i row0, row1, row2, row3, row4, row5, row6, row7;\n __m128i tmp;\n\n // dot product constant: even elems=x, odd elems=y\n#define dct_const(x,y) _mm_setr_epi16((x),(y),(x),(y),(x),(y),(x),(y))\n\n // out(0) = c0[even]*x + c0[odd]*y (c0, x, y 16-bit, out 32-bit)\n // out(1) = c1[even]*x + c1[odd]*y\n#define dct_rot(out0,out1, x,y,c0,c1) \\\n __m128i c0##lo = _mm_unpacklo_epi16((x),(y)); \\\n __m128i c0##hi = _mm_unpackhi_epi16((x),(y)); \\\n __m128i out0##_l = _mm_madd_epi16(c0##lo, c0); \\\n __m128i out0##_h = _mm_madd_epi16(c0##hi, c0); \\\n __m128i out1##_l = _mm_madd_epi16(c0##lo, c1); \\\n __m128i out1##_h = _mm_madd_epi16(c0##hi, c1)\n\n // out = in << 12 (in 16-bit, out 32-bit)\n#define dct_widen(out, in) \\\n __m128i out##_l = _mm_srai_epi32(_mm_unpacklo_epi16(_mm_setzero_si128(), (in)), 4); \\\n __m128i out##_h = _mm_srai_epi32(_mm_unpackhi_epi16(_mm_setzero_si128(), (in)), 4)\n\n // wide add\n#define dct_wadd(out, a, b) \\\n __m128i out##_l = _mm_add_epi32(a##_l, b##_l); \\\n __m128i out##_h = _mm_add_epi32(a##_h, b##_h)\n\n // wide sub\n#define dct_wsub(out, a, b) \\\n __m128i out##_l = _mm_sub_epi32(a##_l, b##_l); \\\n __m128i out##_h = _mm_sub_epi32(a##_h, b##_h)\n\n // butterfly a/b, add bias, then shift by \"s\" and pack\n#define dct_bfly32o(out0, out1, a,b,bias,s) \\\n { \\\n __m128i abiased_l = _mm_add_epi32(a##_l, bias); \\\n __m128i abiased_h = _mm_add_epi32(a##_h, bias); \\\n dct_wadd(sum, abiased, b); \\\n dct_wsub(dif, abiased, b); \\\n out0 = _mm_packs_epi32(_mm_srai_epi32(sum_l, s), _mm_srai_epi32(sum_h, s)); \\\n out1 = _mm_packs_epi32(_mm_srai_epi32(dif_l, s), _mm_srai_epi32(dif_h, s)); \\\n }\n\n // 8-bit interleave step (for transposes)\n#define dct_interleave8(a, b) \\\n tmp = a; \\\n a = _mm_unpacklo_epi8(a, b); \\\n b = _mm_unpackhi_epi8(tmp, b)\n\n // 16-bit interleave step (for transposes)\n#define dct_interleave16(a, b) \\\n tmp = a; \\\n a = _mm_unpacklo_epi16(a, b); \\\n b = _mm_unpackhi_epi16(tmp, b)\n\n#define dct_pass(bias,shift) \\\n { \\\n /* even part */ \\\n dct_rot(t2e,t3e, row2,row6, rot0_0,rot0_1); \\\n __m128i sum04 = _mm_add_epi16(row0, row4); \\\n __m128i dif04 = _mm_sub_epi16(row0, row4); \\\n dct_widen(t0e, sum04); \\\n dct_widen(t1e, dif04); \\\n dct_wadd(x0, t0e, t3e); \\\n dct_wsub(x3, t0e, t3e); \\\n dct_wadd(x1, t1e, t2e); \\\n dct_wsub(x2, t1e, t2e); \\\n /* odd part */ \\\n dct_rot(y0o,y2o, row7,row3, rot2_0,rot2_1); \\\n dct_rot(y1o,y3o, row5,row1, rot3_0,rot3_1); \\\n __m128i sum17 = _mm_add_epi16(row1, row7); \\\n __m128i sum35 = _mm_add_epi16(row3, row5); \\\n dct_rot(y4o,y5o, sum17,sum35, rot1_0,rot1_1); \\\n dct_wadd(x4, y0o, y4o); \\\n dct_wadd(x5, y1o, y5o); \\\n dct_wadd(x6, y2o, y5o); \\\n dct_wadd(x7, y3o, y4o); \\\n dct_bfly32o(row0,row7, x0,x7,bias,shift); \\\n dct_bfly32o(row1,row6, x1,x6,bias,shift); \\\n dct_bfly32o(row2,row5, x2,x5,bias,shift); \\\n dct_bfly32o(row3,row4, x3,x4,bias,shift); \\\n }\n\n __m128i rot0_0 = dct_const(stbi__f2f(0.5411961f), stbi__f2f(0.5411961f) + stbi__f2f(-1.847759065f));\n __m128i rot0_1 = dct_const(stbi__f2f(0.5411961f) + stbi__f2f(0.765366865f), stbi__f2f(0.5411961f));\n __m128i rot1_0 = dct_const(stbi__f2f(1.175875602f) + stbi__f2f(-0.899976223f), stbi__f2f(1.175875602f));\n __m128i rot1_1 = dct_const(stbi__f2f(1.175875602f), stbi__f2f(1.175875602f) + stbi__f2f(-2.562915447f));\n __m128i rot2_0 = dct_const(stbi__f2f(-1.961570560f) + stbi__f2f(0.298631336f), stbi__f2f(-1.961570560f));\n __m128i rot2_1 = dct_const(stbi__f2f(-1.961570560f), stbi__f2f(-1.961570560f) + stbi__f2f(3.072711026f));\n __m128i rot3_0 = dct_const(stbi__f2f(-0.390180644f) + stbi__f2f(2.053119869f), stbi__f2f(-0.390180644f));\n __m128i rot3_1 = dct_const(stbi__f2f(-0.390180644f), stbi__f2f(-0.390180644f) + stbi__f2f(1.501321110f));\n\n // rounding biases in column/row passes, see stbi__idct_block for explanation.\n __m128i bias_0 = _mm_set1_epi32(512);\n __m128i bias_1 = _mm_set1_epi32(65536 + (128 << 17));\n\n // load\n row0 = _mm_load_si128((const __m128i *) (data + 0 * 8));\n row1 = _mm_load_si128((const __m128i *) (data + 1 * 8));\n row2 = _mm_load_si128((const __m128i *) (data + 2 * 8));\n row3 = _mm_load_si128((const __m128i *) (data + 3 * 8));\n row4 = _mm_load_si128((const __m128i *) (data + 4 * 8));\n row5 = _mm_load_si128((const __m128i *) (data + 5 * 8));\n row6 = _mm_load_si128((const __m128i *) (data + 6 * 8));\n row7 = _mm_load_si128((const __m128i *) (data + 7 * 8));\n\n // column pass\n dct_pass(bias_0, 10);\n\n {\n // 16bit 8x8 transpose pass 1\n dct_interleave16(row0, row4);\n dct_interleave16(row1, row5);\n dct_interleave16(row2, row6);\n dct_interleave16(row3, row7);\n\n // transpose pass 2\n dct_interleave16(row0, row2);\n dct_interleave16(row1, row3);\n dct_interleave16(row4, row6);\n dct_interleave16(row5, row7);\n\n // transpose pass 3\n dct_interleave16(row0, row1);\n dct_interleave16(row2, row3);\n dct_interleave16(row4, row5);\n dct_interleave16(row6, row7);\n }\n\n // row pass\n dct_pass(bias_1, 17);\n\n {\n // pack\n __m128i p0 = _mm_packus_epi16(row0, row1); // a0a1a2a3...a7b0b1b2b3...b7\n __m128i p1 = _mm_packus_epi16(row2, row3);\n __m128i p2 = _mm_packus_epi16(row4, row5);\n __m128i p3 = _mm_packus_epi16(row6, row7);\n\n // 8bit 8x8 transpose pass 1\n dct_interleave8(p0, p2); // a0e0a1e1...\n dct_interleave8(p1, p3); // c0g0c1g1...\n\n // transpose pass 2\n dct_interleave8(p0, p1); // a0c0e0g0...\n dct_interleave8(p2, p3); // b0d0f0h0...\n\n // transpose pass 3\n dct_interleave8(p0, p2); // a0b0c0d0...\n dct_interleave8(p1, p3); // a4b4c4d4...\n\n // store\n _mm_storel_epi64((__m128i *) out, p0); out += out_stride;\n _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p0, 0x4e)); out += out_stride;\n _mm_storel_epi64((__m128i *) out, p2); out += out_stride;\n _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p2, 0x4e)); out += out_stride;\n _mm_storel_epi64((__m128i *) out, p1); out += out_stride;\n _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p1, 0x4e)); out += out_stride;\n _mm_storel_epi64((__m128i *) out, p3); out += out_stride;\n _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p3, 0x4e));\n }\n\n#undef dct_const\n#undef dct_rot\n#undef dct_widen\n#undef dct_wadd\n#undef dct_wsub\n#undef dct_bfly32o\n#undef dct_interleave8\n#undef dct_interleave16\n#undef dct_pass\n}\n\n#endif // STBI_SSE2\n\n#ifdef STBI_NEON\n\n// NEON integer IDCT. should produce bit-identical\n// results to the generic C version.\nstatic void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])\n{\n int16x8_t row0, row1, row2, row3, row4, row5, row6, row7;\n\n int16x4_t rot0_0 = vdup_n_s16(stbi__f2f(0.5411961f));\n int16x4_t rot0_1 = vdup_n_s16(stbi__f2f(-1.847759065f));\n int16x4_t rot0_2 = vdup_n_s16(stbi__f2f(0.765366865f));\n int16x4_t rot1_0 = vdup_n_s16(stbi__f2f(1.175875602f));\n int16x4_t rot1_1 = vdup_n_s16(stbi__f2f(-0.899976223f));\n int16x4_t rot1_2 = vdup_n_s16(stbi__f2f(-2.562915447f));\n int16x4_t rot2_0 = vdup_n_s16(stbi__f2f(-1.961570560f));\n int16x4_t rot2_1 = vdup_n_s16(stbi__f2f(-0.390180644f));\n int16x4_t rot3_0 = vdup_n_s16(stbi__f2f(0.298631336f));\n int16x4_t rot3_1 = vdup_n_s16(stbi__f2f(2.053119869f));\n int16x4_t rot3_2 = vdup_n_s16(stbi__f2f(3.072711026f));\n int16x4_t rot3_3 = vdup_n_s16(stbi__f2f(1.501321110f));\n\n#define dct_long_mul(out, inq, coeff) \\\n int32x4_t out##_l = vmull_s16(vget_low_s16(inq), coeff); \\\n int32x4_t out##_h = vmull_s16(vget_high_s16(inq), coeff)\n\n#define dct_long_mac(out, acc, inq, coeff) \\\n int32x4_t out##_l = vmlal_s16(acc##_l, vget_low_s16(inq), coeff); \\\n int32x4_t out##_h = vmlal_s16(acc##_h, vget_high_s16(inq), coeff)\n\n#define dct_widen(out, inq) \\\n int32x4_t out##_l = vshll_n_s16(vget_low_s16(inq), 12); \\\n int32x4_t out##_h = vshll_n_s16(vget_high_s16(inq), 12)\n\n // wide add\n#define dct_wadd(out, a, b) \\\n int32x4_t out##_l = vaddq_s32(a##_l, b##_l); \\\n int32x4_t out##_h = vaddq_s32(a##_h, b##_h)\n\n // wide sub\n#define dct_wsub(out, a, b) \\\n int32x4_t out##_l = vsubq_s32(a##_l, b##_l); \\\n int32x4_t out##_h = vsubq_s32(a##_h, b##_h)\n\n // butterfly a/b, then shift using \"shiftop\" by \"s\" and pack\n#define dct_bfly32o(out0,out1, a,b,shiftop,s) \\\n { \\\n dct_wadd(sum, a, b); \\\n dct_wsub(dif, a, b); \\\n out0 = vcombine_s16(shiftop(sum_l, s), shiftop(sum_h, s)); \\\n out1 = vcombine_s16(shiftop(dif_l, s), shiftop(dif_h, s)); \\\n }\n\n#define dct_pass(shiftop, shift) \\\n { \\\n /* even part */ \\\n int16x8_t sum26 = vaddq_s16(row2, row6); \\\n dct_long_mul(p1e, sum26, rot0_0); \\\n dct_long_mac(t2e, p1e, row6, rot0_1); \\\n dct_long_mac(t3e, p1e, row2, rot0_2); \\\n int16x8_t sum04 = vaddq_s16(row0, row4); \\\n int16x8_t dif04 = vsubq_s16(row0, row4); \\\n dct_widen(t0e, sum04); \\\n dct_widen(t1e, dif04); \\\n dct_wadd(x0, t0e, t3e); \\\n dct_wsub(x3, t0e, t3e); \\\n dct_wadd(x1, t1e, t2e); \\\n dct_wsub(x2, t1e, t2e); \\\n /* odd part */ \\\n int16x8_t sum15 = vaddq_s16(row1, row5); \\\n int16x8_t sum17 = vaddq_s16(row1, row7); \\\n int16x8_t sum35 = vaddq_s16(row3, row5); \\\n int16x8_t sum37 = vaddq_s16(row3, row7); \\\n int16x8_t sumodd = vaddq_s16(sum17, sum35); \\\n dct_long_mul(p5o, sumodd, rot1_0); \\\n dct_long_mac(p1o, p5o, sum17, rot1_1); \\\n dct_long_mac(p2o, p5o, sum35, rot1_2); \\\n dct_long_mul(p3o, sum37, rot2_0); \\\n dct_long_mul(p4o, sum15, rot2_1); \\\n dct_wadd(sump13o, p1o, p3o); \\\n dct_wadd(sump24o, p2o, p4o); \\\n dct_wadd(sump23o, p2o, p3o); \\\n dct_wadd(sump14o, p1o, p4o); \\\n dct_long_mac(x4, sump13o, row7, rot3_0); \\\n dct_long_mac(x5, sump24o, row5, rot3_1); \\\n dct_long_mac(x6, sump23o, row3, rot3_2); \\\n dct_long_mac(x7, sump14o, row1, rot3_3); \\\n dct_bfly32o(row0,row7, x0,x7,shiftop,shift); \\\n dct_bfly32o(row1,row6, x1,x6,shiftop,shift); \\\n dct_bfly32o(row2,row5, x2,x5,shiftop,shift); \\\n dct_bfly32o(row3,row4, x3,x4,shiftop,shift); \\\n }\n\n // load\n row0 = vld1q_s16(data + 0 * 8);\n row1 = vld1q_s16(data + 1 * 8);\n row2 = vld1q_s16(data + 2 * 8);\n row3 = vld1q_s16(data + 3 * 8);\n row4 = vld1q_s16(data + 4 * 8);\n row5 = vld1q_s16(data + 5 * 8);\n row6 = vld1q_s16(data + 6 * 8);\n row7 = vld1q_s16(data + 7 * 8);\n\n // add DC bias\n row0 = vaddq_s16(row0, vsetq_lane_s16(1024, vdupq_n_s16(0), 0));\n\n // column pass\n dct_pass(vrshrn_n_s32, 10);\n\n // 16bit 8x8 transpose\n {\n // these three map to a single VTRN.16, VTRN.32, and VSWP, respectively.\n // whether compilers actually get this is another story, sadly.\n#define dct_trn16(x, y) { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; }\n#define dct_trn32(x, y) { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); }\n#define dct_trn64(x, y) { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); }\n\n // pass 1\n dct_trn16(row0, row1); // a0b0a2b2a4b4a6b6\n dct_trn16(row2, row3);\n dct_trn16(row4, row5);\n dct_trn16(row6, row7);\n\n // pass 2\n dct_trn32(row0, row2); // a0b0c0d0a4b4c4d4\n dct_trn32(row1, row3);\n dct_trn32(row4, row6);\n dct_trn32(row5, row7);\n\n // pass 3\n dct_trn64(row0, row4); // a0b0c0d0e0f0g0h0\n dct_trn64(row1, row5);\n dct_trn64(row2, row6);\n dct_trn64(row3, row7);\n\n#undef dct_trn16\n#undef dct_trn32\n#undef dct_trn64\n }\n\n // row pass\n // vrshrn_n_s32 only supports shifts up to 16, we need\n // 17. so do a non-rounding shift of 16 first then follow\n // up with a rounding shift by 1.\n dct_pass(vshrn_n_s32, 16);\n\n {\n // pack and round\n uint8x8_t p0 = vqrshrun_n_s16(row0, 1);\n uint8x8_t p1 = vqrshrun_n_s16(row1, 1);\n uint8x8_t p2 = vqrshrun_n_s16(row2, 1);\n uint8x8_t p3 = vqrshrun_n_s16(row3, 1);\n uint8x8_t p4 = vqrshrun_n_s16(row4, 1);\n uint8x8_t p5 = vqrshrun_n_s16(row5, 1);\n uint8x8_t p6 = vqrshrun_n_s16(row6, 1);\n uint8x8_t p7 = vqrshrun_n_s16(row7, 1);\n\n // again, these can translate into one instruction, but often don't.\n#define dct_trn8_8(x, y) { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; }\n#define dct_trn8_16(x, y) { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); }\n#define dct_trn8_32(x, y) { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); }\n\n // sadly can't use interleaved stores here since we only write\n // 8 bytes to each scan line!\n\n // 8x8 8-bit transpose pass 1\n dct_trn8_8(p0, p1);\n dct_trn8_8(p2, p3);\n dct_trn8_8(p4, p5);\n dct_trn8_8(p6, p7);\n\n // pass 2\n dct_trn8_16(p0, p2);\n dct_trn8_16(p1, p3);\n dct_trn8_16(p4, p6);\n dct_trn8_16(p5, p7);\n\n // pass 3\n dct_trn8_32(p0, p4);\n dct_trn8_32(p1, p5);\n dct_trn8_32(p2, p6);\n dct_trn8_32(p3, p7);\n\n // store\n vst1_u8(out, p0); out += out_stride;\n vst1_u8(out, p1); out += out_stride;\n vst1_u8(out, p2); out += out_stride;\n vst1_u8(out, p3); out += out_stride;\n vst1_u8(out, p4); out += out_stride;\n vst1_u8(out, p5); out += out_stride;\n vst1_u8(out, p6); out += out_stride;\n vst1_u8(out, p7);\n\n#undef dct_trn8_8\n#undef dct_trn8_16\n#undef dct_trn8_32\n }\n\n#undef dct_long_mul\n#undef dct_long_mac\n#undef dct_widen\n#undef dct_wadd\n#undef dct_wsub\n#undef dct_bfly32o\n#undef dct_pass\n}\n\n#endif // STBI_NEON\n\n#define STBI__MARKER_none 0xff\n// if there's a pending marker from the entropy stream, return that\n// otherwise, fetch from the stream and get a marker. if there's no\n// marker, return 0xff, which is never a valid marker value\nstatic stbi_uc stbi__get_marker(stbi__jpeg *j)\n{\n stbi_uc x;\n if (j->marker != STBI__MARKER_none) { x = j->marker; j->marker = STBI__MARKER_none; return x; }\n x = stbi__get8(j->s);\n if (x != 0xff) return STBI__MARKER_none;\n while (x == 0xff)\n x = stbi__get8(j->s);\n return x;\n}\n\n// in each scan, we'll have scan_n components, and the order\n// of the components is specified by order[]\n#define STBI__RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)\n\n// after a restart interval, stbi__jpeg_reset the entropy decoder and\n// the dc prediction\nstatic void stbi__jpeg_reset(stbi__jpeg *j)\n{\n j->code_bits = 0;\n j->code_buffer = 0;\n j->nomore = 0;\n j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0;\n j->marker = STBI__MARKER_none;\n j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff;\n j->eob_run = 0;\n // no more than 1<<31 MCUs if no restart_interal? that's plenty safe,\n // since we don't even allow 1<<30 pixels\n}\n\nstatic int stbi__parse_entropy_coded_data(stbi__jpeg *z)\n{\n stbi__jpeg_reset(z);\n if (!z->progressive) {\n if (z->scan_n == 1) {\n int i, j;\n STBI_SIMD_ALIGN(short, data[64]);\n int n = z->order[0];\n // non-interleaved data, we just need to process one block at a time,\n // in trivial scanline order\n // number of blocks to do just depends on how many actual \"pixels\" this\n // component has, independent of interleaved MCU blocking and such\n int w = (z->img_comp[n].x + 7) >> 3;\n int h = (z->img_comp[n].y + 7) >> 3;\n for (j = 0; j < h; ++j) {\n for (i = 0; i < w; ++i) {\n int ha = z->img_comp[n].ha;\n "}, {"path": "includes/stb_image_aug.c", "language": "code", "loc": 3334, "comment_density": 0.157, "code": "/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c\n when you control the images you're loading\n\n QUICK NOTES:\n Primarily of interest to game developers and other people who can\n avoid problematic images and only need the trivial interface\n\n JPEG baseline (no JPEG progressive, no oddball channel decimations)\n PNG non-interlaced\n BMP non-1bpp, non-RLE\n TGA (not sure what subset, if a subset)\n PSD (composited view only, no extra channels)\n HDR (radiance rgbE format)\n writes BMP,TGA (define STBI_NO_WRITE to remove code)\n decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)\n supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)\n\n TODO:\n stbi_info_*\n\n history:\n 1.16 major bugfix - convert_format converted one too many pixels\n 1.15 initialize some fields for thread safety\n 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)\n 1.13 threadsafe\n 1.12 const qualifiers in the API\n 1.11 Support installable IDCT, colorspace conversion routines\n 1.10 Fixes for 64-bit (don't use \"unsigned long\")\n optimized upsampling by Fabian \"ryg\" Giesen\n 1.09 Fix format-conversion for PSD code (bad global variables!)\n 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz\n 1.07 attempt to fix C++ warning/errors again\n 1.06 attempt to fix C++ warning/errors again\n 1.05 fix TGA loading to return correct *comp and use good luminance calc\n 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free\n 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR\n 1.02 support for (subset of) HDR files, float interface for preferred access to them\n 1.01 fix bug: possible bug in handling right-side up bmps... not sure\n fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all\n 1.00 interface to zlib that skips zlib header\n 0.99 correct handling of alpha in palette\n 0.98 TGA loader by lonesock; dynamically add loaders (untested)\n 0.97 jpeg errors on too large a file; also catch another malloc failure\n 0.96 fix detection of invalid v value - particleman@mollyrocket forum\n 0.95 during header scan, seek to markers in case of padding\n 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same\n 0.93 handle jpegtran output; verbose errors\n 0.92 read 4,8,16,24,32-bit BMP files of several formats\n 0.91 output 24-bit Windows 3.0 BMP files\n 0.90 fix a few more warnings; bump version number to approach 1.0\n 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd\n 0.60 fix compiling as c++\n 0.59 fix warnings: merge Dave Moore's -Wall fixes\n 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian\n 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less\n than 16 available\n 0.56 fix bug: zlib uncompressed mode len vs. nlen\n 0.55 fix bug: restart_interval not initialized to 0\n 0.54 allow NULL for 'int *comp'\n 0.53 fix bug in png 3->4; speedup png decoding\n 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments\n 0.51 obey req_comp requests, 1-component jpegs return as 1-component,\n on 'test' only check type, not whether we support this variant\n*/\n\n#include \"stb_image_aug.h\"\n\n#ifndef STBI_NO_HDR\n#include // ldexp\n#include // strcmp\n#endif\n\n#ifndef STBI_NO_STDIO\n#include \n#endif\n#include \n#include \n#include \n#include \n\n#ifndef _MSC_VER\n #ifdef __cplusplus\n #define __forceinline inline\n #else\n #define __forceinline\n #endif\n#endif\n\n\n// implementation:\ntypedef unsigned char uint8;\ntypedef unsigned short uint16;\ntypedef signed short int16;\ntypedef unsigned int uint32;\ntypedef signed int int32;\ntypedef unsigned int uint;\n\n// should produce compiler error if size is wrong\ntypedef unsigned char validate_uint32[sizeof(uint32)==4];\n\n#if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE)\n#define STBI_NO_WRITE\n#endif\n\n#ifndef STBI_NO_DDS\n#include \"stbi_DDS_aug.h\"\n#endif\n\n//\tI (JLD) want full messages for SOIL\n#define STBI_FAILURE_USERMSG 1\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// Generic API that works on all image types\n//\n\n// this is not threadsafe\nstatic char *failure_reason;\n\nchar *stbi_failure_reason(void)\n{\n return failure_reason;\n}\n\nstatic int e(char *str)\n{\n failure_reason = str;\n return 0;\n}\n\n#ifdef STBI_NO_FAILURE_STRINGS\n #define e(x,y) 0\n#elif defined(STBI_FAILURE_USERMSG)\n #define e(x,y) e(y)\n#else\n #define e(x,y) e(x)\n#endif\n\n#define epf(x,y) ((float *) (e(x,y)?NULL:NULL))\n#define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL))\n\nvoid stbi_image_free(void *retval_from_stbi_load)\n{\n free(retval_from_stbi_load);\n}\n\n#define MAX_LOADERS 32\nstbi_loader *loaders[MAX_LOADERS];\nstatic int max_loaders = 0;\n\nint stbi_register_loader(stbi_loader *loader)\n{\n int i;\n for (i=0; i < MAX_LOADERS; ++i) {\n // already present?\n if (loaders[i] == loader)\n return 1;\n // end of the list?\n if (loaders[i] == NULL) {\n loaders[i] = loader;\n max_loaders = i+1;\n return 1;\n }\n }\n // no room for it\n return 0;\n}\n\n#ifndef STBI_NO_HDR\nstatic float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp);\nstatic stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp);\n#endif\n\n#ifndef STBI_NO_STDIO\nunsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n FILE *f = fopen(filename, \"rb\");\n unsigned char *result;\n if (!f) return epuc(\"can't fopen\", \"Unable to open file\");\n result = stbi_load_from_file(f,x,y,comp,req_comp);\n fclose(f);\n return result;\n}\n\nunsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n int i;\n if (stbi_jpeg_test_file(f))\n return stbi_jpeg_load_from_file(f,x,y,comp,req_comp);\n if (stbi_png_test_file(f))\n return stbi_png_load_from_file(f,x,y,comp,req_comp);\n if (stbi_bmp_test_file(f))\n return stbi_bmp_load_from_file(f,x,y,comp,req_comp);\n if (stbi_psd_test_file(f))\n return stbi_psd_load_from_file(f,x,y,comp,req_comp);\n #ifndef STBI_NO_DDS\n if (stbi_dds_test_file(f))\n return stbi_dds_load_from_file(f,x,y,comp,req_comp);\n #endif\n #ifndef STBI_NO_HDR\n if (stbi_hdr_test_file(f)) {\n float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp);\n return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);\n }\n #endif\n for (i=0; i < max_loaders; ++i)\n if (loaders[i]->test_file(f))\n return loaders[i]->load_from_file(f,x,y,comp,req_comp);\n // test tga last because it's a crappy test!\n if (stbi_tga_test_file(f))\n return stbi_tga_load_from_file(f,x,y,comp,req_comp);\n return epuc(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n#endif\n\nunsigned char *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n int i;\n if (stbi_jpeg_test_memory(buffer,len))\n return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp);\n if (stbi_png_test_memory(buffer,len))\n return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp);\n if (stbi_bmp_test_memory(buffer,len))\n return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp);\n if (stbi_psd_test_memory(buffer,len))\n return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp);\n #ifndef STBI_NO_DDS\n if (stbi_dds_test_memory(buffer,len))\n return stbi_dds_load_from_memory(buffer,len,x,y,comp,req_comp);\n #endif\n #ifndef STBI_NO_HDR\n if (stbi_hdr_test_memory(buffer, len)) {\n float *hdr = stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);\n return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);\n }\n #endif\n for (i=0; i < max_loaders; ++i)\n if (loaders[i]->test_memory(buffer,len))\n return loaders[i]->load_from_memory(buffer,len,x,y,comp,req_comp);\n // test tga last because it's a crappy test!\n if (stbi_tga_test_memory(buffer,len))\n return stbi_tga_load_from_memory(buffer,len,x,y,comp,req_comp);\n return epuc(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n\n#ifndef STBI_NO_HDR\n\n#ifndef STBI_NO_STDIO\nfloat *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n FILE *f = fopen(filename, \"rb\");\n float *result;\n if (!f) return epf(\"can't fopen\", \"Unable to open file\");\n result = stbi_loadf_from_file(f,x,y,comp,req_comp);\n fclose(f);\n return result;\n}\n\nfloat *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *data;\n #ifndef STBI_NO_HDR\n if (stbi_hdr_test_file(f))\n return stbi_hdr_load_from_file(f,x,y,comp,req_comp);\n #endif\n data = stbi_load_from_file(f, x, y, comp, req_comp);\n if (data)\n return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);\n return epf(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n#endif\n\nfloat *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi_uc *data;\n #ifndef STBI_NO_HDR\n if (stbi_hdr_test_memory(buffer, len))\n return stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);\n #endif\n data = stbi_load_from_memory(buffer, len, x, y, comp, req_comp);\n if (data)\n return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);\n return epf(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n#endif\n\n// these is-hdr-or-not is defined independent of whether STBI_NO_HDR is\n// defined, for API simplicity; if STBI_NO_HDR is defined, it always\n// reports false!\n\nint stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)\n{\n #ifndef STBI_NO_HDR\n return stbi_hdr_test_memory(buffer, len);\n #else\n return 0;\n #endif\n}\n\n#ifndef STBI_NO_STDIO\nextern int stbi_is_hdr (char const *filename)\n{\n FILE *f = fopen(filename, \"rb\");\n int result=0;\n if (f) {\n result = stbi_is_hdr_from_file(f);\n fclose(f);\n }\n return result;\n}\n\nextern int stbi_is_hdr_from_file(FILE *f)\n{\n #ifndef STBI_NO_HDR\n return stbi_hdr_test_file(f);\n #else\n return 0;\n #endif\n}\n\n#endif\n\n// @TODO: get image dimensions & components without fully decoding\n#ifndef STBI_NO_STDIO\nextern int stbi_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\nextern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n#ifndef STBI_NO_HDR\nstatic float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f;\nstatic float l2h_gamma=2.2f, l2h_scale=1.0f;\n\nvoid stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; }\nvoid stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; }\n\nvoid stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; }\nvoid stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; }\n#endif\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// Common code used by all image loaders\n//\n\nenum\n{\n SCAN_load=0,\n SCAN_type,\n SCAN_header,\n};\n\ntypedef struct\n{\n uint32 img_x, img_y;\n int img_n, img_out_n;\n\n #ifndef STBI_NO_STDIO\n FILE *img_file;\n #endif\n uint8 *img_buffer, *img_buffer_end;\n} stbi;\n\n#ifndef STBI_NO_STDIO\nstatic void start_file(stbi *s, FILE *f)\n{\n s->img_file = f;\n}\n#endif\n\nstatic void start_mem(stbi *s, uint8 const *buffer, int len)\n{\n#ifndef STBI_NO_STDIO\n s->img_file = NULL;\n#endif\n s->img_buffer = (uint8 *) buffer;\n s->img_buffer_end = (uint8 *) buffer+len;\n}\n\n__forceinline static int get8(stbi *s)\n{\n#ifndef STBI_NO_STDIO\n if (s->img_file) {\n int c = fgetc(s->img_file);\n return c == EOF ? 0 : c;\n }\n#endif\n if (s->img_buffer < s->img_buffer_end)\n return *s->img_buffer++;\n return 0;\n}\n\n__forceinline static int at_eof(stbi *s)\n{\n#ifndef STBI_NO_STDIO\n if (s->img_file)\n return feof(s->img_file);\n#endif\n return s->img_buffer >= s->img_buffer_end;\n}\n\n__forceinline static uint8 get8u(stbi *s)\n{\n return (uint8) get8(s);\n}\n\nstatic void skip(stbi *s, int n)\n{\n#ifndef STBI_NO_STDIO\n if (s->img_file)\n fseek(s->img_file, n, SEEK_CUR);\n else\n#endif\n s->img_buffer += n;\n}\n\nstatic int get16(stbi *s)\n{\n int z = get8(s);\n return (z << 8) + get8(s);\n}\n\nstatic uint32 get32(stbi *s)\n{\n uint32 z = get16(s);\n return (z << 16) + get16(s);\n}\n\nstatic int get16le(stbi *s)\n{\n int z = get8(s);\n return z + (get8(s) << 8);\n}\n\nstatic uint32 get32le(stbi *s)\n{\n uint32 z = get16le(s);\n return z + (get16le(s) << 16);\n}\n\nstatic void getn(stbi *s, stbi_uc *buffer, int n)\n{\n#ifndef STBI_NO_STDIO\n if (s->img_file) {\n fread(buffer, 1, n, s->img_file);\n return;\n }\n#endif\n memcpy(buffer, s->img_buffer, n);\n s->img_buffer += n;\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// generic converter from built-in img_n to req_comp\n// individual types do this automatically as much as possible (e.g. jpeg\n// does all cases internally since it needs to colorspace convert anyway,\n// and it never has alpha, so very few cases ). png can automatically\n// interleave an alpha=255 channel, but falls back to this for other cases\n//\n// assume data buffer is malloced, so malloc a new one and free that one\n// only failure mode is malloc failing\n\nstatic uint8 compute_y(int r, int g, int b)\n{\n return (uint8) (((r*77) + (g*150) + (29*b)) >> 8);\n}\n\nstatic unsigned char *convert_format(unsigned char *data, int img_n, int req_comp, uint x, uint y)\n{\n int i,j;\n unsigned char *good;\n\n if (req_comp == img_n) return data;\n assert(req_comp >= 1 && req_comp <= 4);\n\n good = (unsigned char *) malloc(req_comp * x * y);\n if (good == NULL) {\n free(data);\n return epuc(\"outofmem\", \"Out of memory\");\n }\n\n for (j=0; j < (int) y; ++j) {\n unsigned char *src = data + j * x * img_n ;\n unsigned char *dest = good + j * x * req_comp;\n\n #define COMBO(a,b) ((a)*8+(b))\n #define CASE(a,b) case COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)\n // convert source image with img_n components to one with req_comp components;\n // avoid switch per pixel, so use switch per scanline and massive macros\n switch(COMBO(img_n, req_comp)) {\n CASE(1,2) dest[0]=src[0], dest[1]=255; break;\n CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break;\n CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break;\n CASE(2,1) dest[0]=src[0]; break;\n CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break;\n CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break;\n CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break;\n CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break;\n CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break;\n CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break;\n CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break;\n CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break;\n default: assert(0);\n }\n #undef CASE\n }\n\n free(data);\n return good;\n}\n\n#ifndef STBI_NO_HDR\nstatic float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp)\n{\n int i,k,n;\n float *output = (float *) malloc(x * y * comp * sizeof(float));\n if (output == NULL) { free(data); return epf(\"outofmem\", \"Out of memory\"); }\n // compute number of non-alpha components\n if (comp & 1) n = comp; else n = comp-1;\n for (i=0; i < x*y; ++i) {\n for (k=0; k < n; ++k) {\n output[i*comp + k] = (float) pow(data[i*comp+k]/255.0f, l2h_gamma) * l2h_scale;\n }\n if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f;\n }\n free(data);\n return output;\n}\n\n#define float2int(x) ((int) (x))\nstatic stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp)\n{\n int i,k,n;\n stbi_uc *output = (stbi_uc *) malloc(x * y * comp);\n if (output == NULL) { free(data); return epuc(\"outofmem\", \"Out of memory\"); }\n // compute number of non-alpha components\n if (comp & 1) n = comp; else n = comp-1;\n for (i=0; i < x*y; ++i) {\n for (k=0; k < n; ++k) {\n float z = (float) pow(data[i*comp+k]*h2l_scale_i, h2l_gamma_i) * 255 + 0.5f;\n if (z < 0) z = 0;\n if (z > 255) z = 255;\n output[i*comp + k] = float2int(z);\n }\n if (k < comp) {\n float z = data[i*comp+k] * 255 + 0.5f;\n if (z < 0) z = 0;\n if (z > 255) z = 255;\n output[i*comp + k] = float2int(z);\n }\n }\n free(data);\n return output;\n}\n#endif\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// \"baseline\" JPEG/JFIF decoder (not actually fully baseline implementation)\n//\n// simple implementation\n// - channel subsampling of at most 2 in each dimension\n// - doesn't support delayed output of y-dimension\n// - simple interface (only one output format: 8-bit interleaved RGB)\n// - doesn't try to recover corrupt jpegs\n// - doesn't allow partial loading, loading multiple at once\n// - still fast on x86 (copying globals into locals doesn't help x86)\n// - allocates lots of intermediate memory (full size of all components)\n// - non-interleaved case requires this anyway\n// - allows good upsampling (see next)\n// high-quality\n// - upsampled channels are bilinearly interpolated, even across blocks\n// - quality integer IDCT derived from IJG's 'slow'\n// performance\n// - fast huffman; reasonable integer IDCT\n// - uses a lot of intermediate memory, could cache poorly\n// - load http://nothings.org/remote/anemones.jpg 3 times on 2.8Ghz P4\n// stb_jpeg: 1.34 seconds (MSVC6, default release build)\n// stb_jpeg: 1.06 seconds (MSVC6, processor = Pentium Pro)\n// IJL11.dll: 1.08 seconds (compiled by intel)\n// IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG)\n// IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro)\n\n// huffman decoding acceleration\n#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache\n\ntypedef struct\n{\n uint8 fast[1 << FAST_BITS];\n // weirdly, repacking this into AoS is a 10% speed loss, instead of a win\n uint16 code[256];\n uint8 values[256];\n uint8 size[257];\n unsigned int maxcode[18];\n int delta[17]; // old 'firstsymbol' - old 'firstcode'\n} huffman;\n\ntypedef struct\n{\n #if STBI_SIMD\n unsigned short dequant2[4][64];\n #endif\n stbi s;\n huffman huff_dc[4];\n huffman huff_ac[4];\n uint8 dequant[4][64];\n\n// sizes for components, interleaved MCUs\n int img_h_max, img_v_max;\n int img_mcu_x, img_mcu_y;\n int img_mcu_w, img_mcu_h;\n\n// definition of jpeg image component\n struct\n {\n int id;\n int h,v;\n int tq;\n int hd,ha;\n int dc_pred;\n\n int x,y,w2,h2;\n uint8 *data;\n void *raw_data;\n uint8 *linebuf;\n } img_comp[4];\n\n uint32 code_buffer; // jpeg entropy-coded buffer\n int code_bits; // number of valid bits\n unsigned char marker; // marker seen while filling entropy buffer\n int nomore; // flag if we saw a marker so must stop\n\n int scan_n, order[4];\n int restart_interval, todo;\n} jpeg;\n\nstatic int build_huffman(huffman *h, int *count)\n{\n int i,j,k=0,code;\n // build size list for each symbol (from JPEG spec)\n for (i=0; i < 16; ++i)\n for (j=0; j < count[i]; ++j)\n h->size[k++] = (uint8) (i+1);\n h->size[k] = 0;\n\n // compute actual symbols (from jpeg spec)\n code = 0;\n k = 0;\n for(j=1; j <= 16; ++j) {\n // compute delta to add to code to compute symbol id\n h->delta[j] = k - code;\n if (h->size[k] == j) {\n while (h->size[k] == j)\n h->code[k++] = (uint16) (code++);\n if (code-1 >= (1 << j)) return e(\"bad code lengths\",\"Corrupt JPEG\");\n }\n // compute largest code + 1 for this size, preshifted as needed later\n h->maxcode[j] = code << (16-j);\n code <<= 1;\n }\n h->maxcode[j] = 0xffffffff;\n\n // build non-spec acceleration table; 255 is flag for not-accelerated\n memset(h->fast, 255, 1 << FAST_BITS);\n for (i=0; i < k; ++i) {\n int s = h->size[i];\n if (s <= FAST_BITS) {\n int c = h->code[i] << (FAST_BITS-s);\n int m = 1 << (FAST_BITS-s);\n for (j=0; j < m; ++j) {\n h->fast[c+j] = (uint8) i;\n }\n }\n }\n return 1;\n}\n\nstatic void grow_buffer_unsafe(jpeg *j)\n{\n do {\n int b = j->nomore ? 0 : get8(&j->s);\n if (b == 0xff) {\n int c = get8(&j->s);\n if (c != 0) {\n j->marker = (unsigned char) c;\n j->nomore = 1;\n return;\n }\n }\n j->code_buffer = (j->code_buffer << 8) | b;\n j->code_bits += 8;\n } while (j->code_bits <= 24);\n}\n\n// (1 << n) - 1\nstatic uint32 bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};\n\n// decode a jpeg huffman value from the bitstream\n__forceinline static int decode(jpeg *j, huffman *h)\n{\n unsigned int temp;\n int c,k;\n\n if (j->code_bits < 16) grow_buffer_unsafe(j);\n\n // look at the top FAST_BITS and determine what symbol ID it is,\n // if the code is <= FAST_BITS\n c = (j->code_buffer >> (j->code_bits - FAST_BITS)) & ((1 << FAST_BITS)-1);\n k = h->fast[c];\n if (k < 255) {\n if (h->size[k] > j->code_bits)\n return -1;\n j->code_bits -= h->size[k];\n return h->values[k];\n }\n\n // naive test is to shift the code_buffer down so k bits are\n // valid, then test against maxcode. To speed this up, we've\n // preshifted maxcode left so that it has (16-k) 0s at the\n // end; in other words, regardless of the number of bits, it\n // wants to be compared against something shifted to have 16;\n // that way we don't need to shift inside the loop.\n if (j->code_bits < 16)\n temp = (j->code_buffer << (16 - j->code_bits)) & 0xffff;\n else\n temp = (j->code_buffer >> (j->code_bits - 16)) & 0xffff;\n for (k=FAST_BITS+1 ; ; ++k)\n if (temp < h->maxcode[k])\n break;\n if (k == 17) {\n // error! code not found\n j->code_bits -= 16;\n return -1;\n }\n\n if (k > j->code_bits)\n return -1;\n\n // convert the huffman code to the symbol id\n c = ((j->code_buffer >> (j->code_bits - k)) & bmask[k]) + h->delta[k];\n assert((((j->code_buffer) >> (j->code_bits - h->size[c])) & bmask[h->size[c]]) == h->code[c]);\n\n // convert the id to a symbol\n j->code_bits -= k;\n return h->values[c];\n}\n\n// combined JPEG 'receive' and JPEG 'extend', since baseline\n// always extends everything it receives.\n__forceinline static int extend_receive(jpeg *j, int n)\n{\n unsigned int m = 1 << (n-1);\n unsigned int k;\n if (j->code_bits < n) grow_buffer_unsafe(j);\n k = (j->code_buffer >> (j->code_bits - n)) & bmask[n];\n j->code_bits -= n;\n // the following test is probably a random branch that won't\n // predict well. I tried to table accelerate it but failed.\n // maybe it's compiling as a conditional move?\n if (k < m)\n return (-1 << n) + k + 1;\n else\n return k;\n}\n\n// given a value that's at position X in the zigzag stream,\n// where does it appear in the 8x8 matrix coded as row-major?\nstatic uint8 dezigzag[64+15] =\n{\n 0, 1, 8, 16, 9, 2, 3, 10,\n 17, 24, 32, 25, 18, 11, 4, 5,\n 12, 19, 26, 33, 40, 48, 41, 34,\n 27, 20, 13, 6, 7, 14, 21, 28,\n 35, 42, 49, 56, 57, 50, 43, 36,\n 29, 22, 15, 23, 30, 37, 44, 51,\n 58, 59, 52, 45, 38, 31, 39, 46,\n 53, 60, 61, 54, 47, 55, 62, 63,\n // let corrupt input sample past end\n 63, 63, 63, 63, 63, 63, 63, 63,\n 63, 63, 63, 63, 63, 63, 63\n};\n\n// decode one 64-entry block--\nstatic int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b)\n{\n int diff,dc,k;\n int t = decode(j, hdc);\n if (t < 0) return e(\"bad huffman code\",\"Corrupt JPEG\");\n\n // 0 all the ac values now so we can do it 32-bits at a time\n memset(data,0,64*sizeof(data[0]));\n\n diff = t ? extend_receive(j, t) : 0;\n dc = j->img_comp[b].dc_pred + diff;\n j->img_comp[b].dc_pred = dc;\n data[0] = (short) dc;\n\n // decode AC components, see JPEG spec\n k = 1;\n do {\n int r,s;\n int rs = decode(j, hac);\n if (rs < 0) return e(\"bad huffman code\",\"Corrupt JPEG\");\n s = rs & 15;\n r = rs >> 4;\n if (s == 0) {\n if (rs != 0xf0) break; // end block\n k += 16;\n } else {\n k += r;\n // decode into unzigzag'd location\n data[dezigzag[k++]] = (short) extend_receive(j,s);\n }\n } while (k < 64);\n return 1;\n}\n\n// take a -128..127 value and clamp it and convert to 0..255\n__forceinline static uint8 clamp(int x)\n{\n x += 128;\n // trick to use a single test to catch both cases\n if ((unsigned int) x > 255) {\n if (x < 0) return 0;\n if (x > 255) return 255;\n }\n return (uint8) x;\n}\n\n#define f2f(x) (int) (((x) * 4096 + 0.5))\n#define fsh(x) ((x) << 12)\n\n// derived from jidctint -- DCT_ISLOW\n#define IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \\\n int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \\\n p2 = s2; \\\n p3 = s6; \\\n p1 = (p2+p3) * f2f(0.5411961f); \\\n t2 = p1 + p3*f2f(-1.847759065f); \\\n t3 = p1 + p2*f2f( 0.765366865f); \\\n p2 = s0; \\\n p3 = s4; \\\n t0 = fsh(p2+p3); \\\n t1 = fsh(p2-p3); \\\n x0 = t0+t3; \\\n x3 = t0-t3; \\\n x1 = t1+t2; \\\n x2 = t1-t2; \\\n t0 = s7; \\\n t1 = s5; \\\n t2 = s3; \\\n t3 = s1; \\\n p3 = t0+t2; \\\n p4 = t1+t3; \\\n p1 = t0+t3; \\\n p2 = t1+t2; \\\n p5 = (p3+p4)*f2f( 1.175875602f); \\\n t0 = t0*f2f( 0.298631336f); \\\n t1 = t1*f2f( 2.053119869f); \\\n t2 = t2*f2f( 3.072711026f); \\\n t3 = t3*f2f( 1.501321110f); \\\n p1 = p5 + p1*f2f(-0.899976223f); \\\n p2 = p5 + p2*f2f(-2.562915447f); \\\n p3 = p3*f2f(-1.961570560f); \\\n p4 = p4*f2f(-0.390180644f); \\\n t3 += p1+p4; \\\n t2 += p2+p3; \\\n t1 += p2+p4; \\\n t0 += p1+p3;\n\n#if !STBI_SIMD\n// .344 seconds on 3*anemones.jpg\nstatic void idct_block(uint8 *out, int out_stride, short data[64], uint8 *dequantize)\n{\n int i,val[64],*v=val;\n uint8 *o,*dq = dequantize;\n short *d = data;\n\n // columns\n for (i=0; i < 8; ++i,++d,++dq, ++v) {\n // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing\n if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0\n && d[40]==0 && d[48]==0 && d[56]==0) {\n // no shortcut 0 seconds\n // (1|2|3|4|5|6|7)==0 0 seconds\n // all separate -0.047 seconds\n // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds\n int dcterm = d[0] * dq[0] << 2;\n v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;\n } else {\n IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],\n d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])\n // constants scaled things up by 1<<12; let's bring them back\n // down, but keep 2 extra bits of precision\n x0 += 512; x1 += 512; x2 += 512; x3 += 512;\n v[ 0] = (x0+t3) >> 10;\n v[56] = (x0-t3) >> 10;\n v[ 8] = (x1+t2) >> 10;\n v[48] = (x1-t2) >> 10;\n v[16] = (x2+t1) >> 10;\n v[40] = (x2-t1) >> 10;\n v[24] = (x3+t0) >> 10;\n v[32] = (x3-t0) >> 10;\n }\n }\n\n for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {\n // no fast case since the first 1D IDCT spread components out\n IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])\n // constants scaled things up by 1<<12, plus we had 1<<2 from first\n // loop, plus horizontal and vertical each scale by sqrt(8) so together\n // we've got an extra 1<<3, so 1<<17 total we need to remove.\n x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;\n o[0] = clamp((x0+t3) >> 17);\n o[7] = clamp((x0-t3) >> 17);\n o[1] = clamp((x1+t2) >> 17);\n o[6] = clamp((x1-t2) >> 17);\n o[2] = clamp((x2+t1) >> 17);\n o[5] = clamp((x2-t1) >> 17);\n o[3] = clamp((x3+t0) >> 17);\n o[4] = clamp((x3-t0) >> 17);\n }\n}\n#else\nstatic void idct_block(uint8 *out, int out_stride, short data[64], unsigned short *dequantize)\n{\n int i,val[64],*v=val;\n uint8 *o;\n unsigned short *dq = dequantize;\n short *d = data;\n\n // columns\n for (i=0; i < 8; ++i,++d,++dq, ++v) {\n // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing\n if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0\n && d[40]==0 && d[48]==0 && d[56]==0) {\n // no shortcut 0 seconds\n // (1|2|3|4|5|6|7)==0 0 seconds\n // all separate -0.047 seconds\n // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds\n int dcterm = d[0] * dq[0] << 2;\n v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;\n } else {\n IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],\n d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])\n // constants scaled things up by 1<<12; let's bring them back\n // down, but keep 2 extra bits of precision\n x0 += 512; x1 += 512; x2 += 512; x3 += 512;\n v[ 0] = (x0+t3) >> 10;\n v[56] = (x0-t3) >> 10;\n v[ 8] = (x1+t2) >> 10;\n v[48] = (x1-t2) >> 10;\n v[16] = (x2+t1) >> 10;\n v[40] = (x2-t1) >> 10;\n v[24] = (x3+t0) >> 10;\n v[32] = (x3-t0) >> 10;\n }\n }\n\n for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {\n // no fast case since the first 1D IDCT spread components out\n IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])\n // constants scaled things up by 1<<12, plus we had 1<<2 from first\n // loop, plus horizontal and vertical each scale by sqrt(8) so together\n // we've got an extra 1<<3, so 1<<17 total we need to remove.\n x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;\n o[0] = clamp((x0+t3) >> 17);\n o[7] = clamp((x0-t3) >> 17);\n o[1] = clamp((x1+t2) >> 17);\n o[6] = clamp((x1-t2) >> 17);\n o[2] = clamp((x2+t1) >> 17);\n o[5] = clamp((x2-t1) >> 17);\n o[3] = clamp((x3+t0) >> 17);\n o[4] = clamp((x3-t0) >> 17);\n }\n}\nstatic stbi_idct_8x8 stbi_idct_installed = idct_block;\n\nextern void stbi_install_idct(stbi_idct_8x8 func)\n{\n stbi_idct_installed = func;\n}\n#endif\n\n#define MARKER_none 0xff\n// if there's a pending marker from the entropy stream, return that\n// otherwise, fetch from the stream and get a marker. if there's no\n// marker, return 0xff, which is never a valid marker value\nstatic uint8 get_marker(jpeg *j)\n{\n uint8 x;\n if (j->marker != MARKER_none) { x = j->marker; j->marker = MARKER_none; return x; }\n x = get8u(&j->s);\n if (x != 0xff) return MARKER_none;\n while (x == 0xff)\n x = get8u(&j->s);\n return x;\n}\n\n// in each scan, we'll have scan_n components, and the order\n// of the components is specified by order[]\n#define RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)\n\n// after a restart interval, reset the entropy decoder and\n// the dc prediction\nstatic void reset(jpeg *j)\n{\n j->code_bits = 0;\n j->code_buffer = 0;\n j->nomore = 0;\n j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0;\n j->marker = MARKER_none;\n j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff;\n // no more than 1<<31 MCUs if no restart_interal? that's plenty safe,\n // since we don't even allow 1<<30 pixels\n}\n\nstatic int parse_entropy_coded_data(jpeg *z)\n{\n reset(z);\n if (z->scan_n == 1) {\n int i,j;\n #if STBI_SIMD\n __declspec(align(16))\n #endif\n short data[64];\n int n = z->order[0];\n // non-interleaved data, we just need to process one block at a time,\n // in trivial scanline order\n // number of blocks to do just depends on how many actual \"pixels\" this\n // component has, independent of interleaved MCU blocking and such\n int w = (z->img_comp[n].x+7) >> 3;\n int h = (z->img_comp[n].y+7) >> 3;\n for (j=0; j < h; ++j) {\n for (i=0; i < w; ++i) {\n if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;\n #if STBI_SIMD\n stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);\n #else\n idct_block(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);\n #endif\n // every data block is an MCU, so countdown the restart interval\n if (--z->todo <= 0) {\n if (z->code_bits < 24) grow_buffer_unsafe(z);\n // if it's NOT a restart, then just bail, so we get corrupt data\n // rather than no data\n if (!RESTART(z->marker)) return 1;\n reset(z);\n }\n }\n }\n } else { // interleaved!\n int i,j,k,x,y;\n short data[64];\n for (j=0; j < z->img_mcu_y; ++j) {\n for (i=0; i < z->img_mcu_x; ++i) {\n // scan an interleaved mcu... process scan_n components in order\n for (k=0; k < z->scan_n; ++k) {\n int n = z->order[k];\n // scan out an mcu's worth of this component; that's just determined\n // by the basic H and V specified for the component\n for (y=0; y < z->img_comp[n].v; ++y) {\n for (x=0; x < z->img_comp[n].h; ++x) {\n int x2 = (i*z->img_comp[n].h + x)*8;\n int y2 = (j*z->img_comp[n].v + y)*8;\n if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;\n #if STBI_SIMD\n stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);\n #else\n idct_block(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);\n #endif\n }\n }\n }\n // after all interleaved components, that's an interleaved MCU,\n // so now count down the restart interval\n if (--z->todo <= 0) {\n if (z->code_bits < 24) grow_buffer_unsafe(z);\n // if it's NOT a restart, then just bail, so we get corrupt data\n // rather than no data\n if (!RESTART(z->marker)) return 1;\n reset(z);\n }\n }\n }\n }\n return 1;\n}\n\nstatic int process_marker(jpeg *z, int m)\n{\n int L;\n switch (m) {\n case MARKER_none: // no marker found\n return e(\"expected marker\",\"Corrupt JPEG\");\n\n case 0xC2: // SOF - progressive\n return e(\"progressive jpeg\",\"JPEG format not supported (progressive)\");\n\n case 0xDD: // DRI - specify restart interval\n if (get16(&z->s) != 4) return e(\"bad DRI len\",\"Corrupt JPEG\");\n z->restart_interval = get16(&z->s);\n return 1;\n\n case 0xDB: // DQT - define quantization table\n L = get16(&z->s)-2;\n while (L > 0) {\n int q = get8(&z->s);\n int p = q >> 4;\n int t = q & 15,i;\n if (p != 0) return e(\"bad DQT type\",\"Corrupt JPEG\");\n if (t > 3) return e(\"bad DQT table\",\"Corrupt JPEG\");\n for (i=0; i < 64; ++i)\n z->dequant[t][dezigzag[i]] = get8u(&z->s);\n #if STBI_SIMD\n for (i=0; i < 64; ++i)\n z->dequant2[t][i] = dequant[t][i];\n #endif\n L -= 65;\n }\n return L==0;\n\n case 0xC4: // DHT - define huffman table\n L = get16(&z->s)-2;\n while (L > 0) {\n uint8 *v;\n int sizes[16],i,m=0;\n int q = get8(&z->s);\n int tc = q >> 4;\n int th = q & 15;\n if (tc > 1 || th > 3) return e(\"bad DHT header\",\"Corrupt JPEG\");\n for (i=0; i < 16; ++i) {\n sizes[i] = get8(&z->s);\n m += sizes[i];\n }\n L -= 17;\n if (tc == 0) {\n if (!build_huffman(z->huff_dc+th, sizes)) return 0;\n v = z->huff_dc[th].values;\n } else {\n if (!build_huffman(z->huff_ac+th, sizes)) return 0;\n v = z->huff_ac[th].values;\n }\n for (i=0; i < m; ++i)\n v[i] = get8u(&z->s);\n L -= m;\n }\n return L==0;\n }\n // check for comment block or APP blocks\n if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) {\n skip(&z->s, get16(&z->s)-2);\n return 1;\n }\n return 0;\n}\n\n// after we see SOS\nstatic int process_scan_header(jpeg *z)\n{\n int i;\n int Ls = get16(&z->s);\n z->scan_n = get8(&z->s);\n if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s.img_n) return e(\"bad SOS component count\",\"Corrupt JPEG\");\n if (Ls != 6+2*z->scan_n) return e(\"bad SOS len\",\"Corrupt JPEG\");\n for (i=0; i < z->scan_n; ++i) {\n int id = get8(&z->s), which;\n int q = get8(&z->s);\n for (which = 0; which < z->s.img_n; ++which)\n if (z->img_comp[which].id == id)\n break;\n if (which == z->s.img_n) return 0;\n z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return e(\"bad DC huff\",\"Corrupt JPEG\");\n z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return e(\"bad AC huff\",\"Corrupt JPEG\");\n z->order[i] = which;\n }\n if (get8(&z->s) != 0) return e(\"bad SOS\",\"Corrupt JPEG\");\n get8(&z->s); // should be 63, but might be 0\n if (get8(&z->s) != 0) return e(\"bad SOS\",\"Corrupt JPEG\");\n\n return 1;\n}\n\nstatic int process_frame_header(jpeg *z, int scan)\n{\n stbi *s = &z->s;\n int Lf,p,i,q, h_max=1,v_max=1,c;\n Lf = get16(s); if (Lf < 11) return e(\"bad SOF len\",\"Corrupt JPEG\"); // JPEG\n p = get8(s); if (p != 8) return e(\"only 8-bit\",\"JPEG format not supported: 8-bit only\"); // JPEG baseline\n s->img_y = get16(s); if (s->img_y == 0) return e(\"no header height\", \"JPEG format not supported: delayed height\"); // Legal, but we don't handle it--but neither does IJG\n s->img_x = get16(s); if (s->img_x == 0) return e(\"0 width\",\"Corrupt JPEG\"); // JPEG requires\n c = get8(s);\n if (c != 3 && c != 1) return e(\"bad component count\",\"Corrupt JPEG\"); // JFIF requires\n s->img_n = c;\n for (i=0; i < c; ++i) {\n z->img_comp[i].data = NULL;\n z->img_comp[i].linebuf = NULL;\n }\n\n if (Lf != 8+3*s->img_n) return e(\"bad SOF len\",\"Corrupt JPEG\");\n\n for (i=0; i < s->img_n; ++i) {\n z->img_comp[i].id = get8(s);\n if (z->img_comp[i].id != i+1) // JFIF requires\n if (z->img_comp[i].id != i) // some version of jpegtran outputs non-JFIF-compliant files!\n return e(\"bad component ID\",\"Corrupt JPEG\");\n q = get8(s);\n z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return e(\"bad H\",\"Corrupt JPEG\");\n z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return e(\"bad V\",\"Corrupt JPEG\");\n z->img_comp[i].tq = get8(s); if (z->img_comp[i].tq > 3) return e(\"bad TQ\",\"Corrupt JPEG\");\n }\n\n if (scan != SCAN_load) return 1;\n\n if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e(\"too large\", \"Image too large to decode\");\n\n for (i=0; i < s->img_n; ++i) {\n if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h;\n if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v;\n }\n\n // compute interleaved mcu info\n z->img_h_max = h_max;\n z->img_v_max = v_max;\n z->img_mcu_w = h_max * 8;\n z->img_mcu_h = v_max * 8;\n z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w;\n z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h;\n\n for (i=0; i < s->img_n; ++i) {\n // number of effective pixels (e.g. for non-interleaved MCU)\n z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max;\n z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max;\n // to simplify generation, we'll allocate enough memory to decode\n // the bogus oversized data from using interleaved MCUs and their\n // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't\n // discard the extra data until colorspace conversion\n z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;\n z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;\n z->img_comp[i].raw_data = malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15);\n if (z->img_comp[i].raw_data == NULL) {\n for(--i; i >= 0; --i) {\n free(z->img_comp[i].raw_data);\n z->img_comp[i].data = NULL;\n }\n return e(\"outofmem\", \"Out of memory\");\n }\n // align blocks for installable-idct using mmx/sse\n z->img_comp[i].data = (uint8*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);\n z->img_comp[i].linebuf = NULL;\n }\n\n return 1;\n}\n\n// use comparisons since in some cases we handle more than one case (e.g. SOF)\n#define DNL(x) ((x) == 0xdc)\n#define SOI(x) ((x) == 0xd8)\n#define EOI(x) ((x) == 0xd9)\n#define SOF(x) ((x) == 0xc0 || (x) == 0xc1)\n#define SOS(x) ((x) == 0xda)\n\nstatic int decode_jpeg_header(jpeg *z, int scan)\n{\n int m;\n z->marker = MARKER_none; // initialize cached marker to empty\n m = get_marker(z);\n if (!SOI(m)) return e(\"no SOI\",\"Corrupt JPEG\");\n if (scan == SCAN_type) return 1;\n m = get_marker(z);\n while (!SOF(m)) {\n if (!process_marker(z,m)) return 0;\n m = get_marker(z);\n while (m == MARKER_none) {\n // some files have extra padding after their blocks, so ok, we'll scan\n if (at_eof(&z->s)) return e(\"no SOF\", \"Corrupt JPEG\");\n m = get_marker(z);\n }\n }\n if (!process_frame_header(z, scan)) return 0;\n return 1;\n}\n\nstatic int decode_jpeg_image(jpeg *j)\n{\n int m;\n j->restart_interval = 0;\n if (!decode_jpeg_header(j, SCAN_load)) return 0;\n m = get_marker(j);\n while (!EOI(m)) {\n if (SOS(m)) {\n if (!process_scan_header(j)) return 0;\n if (!parse_entropy_coded_data(j)) return 0;\n } else {\n if (!process_marker(j, m)) return 0;\n }\n m = get_marker(j);\n }\n return 1;\n}\n\n// static jfif-centered resampling (across block boundaries)\n\ntypedef uint8 *(*resample_row_func)(uint8 *out, uint8 *in0, uint8 *in1,\n int w, int hs);\n\n#define div4(x) ((uint8) ((x) >> 2))\n\nstatic uint8 *resample_row_1(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n return in_near;\n}\n\nstatic uint8* resample_row_v_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n // need to generate two samples vertically for every one in input\n int i;\n for (i=0; i < w; ++i)\n out[i] = div4(3*in_near[i] + in_far[i] + 2);\n return out;\n}\n\nstatic uint8* resample_row_h_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n // need to generate two samples horizontally for every one in input\n int i;\n uint8 *input = in_near;\n if (w == 1) {\n // if only one sample, can't do any interpolation\n out[0] = out[1] = input[0];\n return out;\n }\n\n out[0] = input[0];\n out[1] = div4(input[0]*3 + input[1] + 2);\n for (i=1; i < w-1; ++i) {\n int n = 3*input[i]+2;\n out[i*2+0] = div4(n+input[i-1]);\n out[i*2+1] = div4(n+input[i+1]);\n }\n out[i*2+0] = div4(input[w-2]*3 + input[w-1] + 2);\n out[i*2+1] = input[w-1];\n return out;\n}\n\n#define div16(x) ((uint8) ((x) >> 4))\n\nstatic uint8 *resample_row_hv_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n // need to generate 2x2 samples for every one in input\n int i,t0,t1;\n if (w == 1) {\n out[0] = out[1] = div4(3*in_near[0] + in_far[0] + 2);\n return out;\n }\n\n t1 = 3*in_near[0] + in_far[0];\n out[0] = div4(t1+2);\n for (i=1; i < w; ++i) {\n t0 = t1;\n t1 = 3*in_near[i]+in_far[i];\n out[i*2-1] = div16(3*t0 + t1 + 8);\n out[i*2 ] = div16(3*t1 + t0 + 8);\n }\n out[w*2-1] = div4(t1+2);\n return out;\n}\n\nstatic uint8 *resample_row_generic(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n // resample with nearest-neighbor\n int i,j;\n for (i=0; i < w; ++i)\n for (j=0; j < hs; ++j)\n out[i*hs+j] = in_near[i];\n return out;\n}\n\n#define float2fixed(x) ((int) ((x) * 65536 + 0.5))\n\n// 0.38 seconds on 3*anemones.jpg (0.25 with processor = Pro)\n// VC6 without processor=Pro is generating multiple LEAs per multiply!\nstatic void YCbCr_to_RGB_row(uint8 *out, uint8 *y, uint8 *pcb, uint8 *pcr, int count, int step)\n{\n int i;\n for (i=0; i < count; ++i) {\n int y_fixed = (y[i] << 16) + 32768; // rounding\n int r,g,b;\n int cr = pcr[i] - 128;\n int cb = pcb[i] - 128;\n r = y_fixed + cr*float2fixed(1.40200f);\n g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f);\n b = y_fixed + cb*float2fixed(1.77200f);\n r >>= 16;\n g >>= 16;\n b >>= 16;\n if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; }\n if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; }\n if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; }\n out[0] = (uint8)r;\n out[1] = (uint8)g;\n out[2] = (uint8)b;\n out[3] = 255;\n out += step;\n }\n}\n\n#if STBI_SIMD\nstatic stbi_YCbCr_to_RGB_run stbi_YCbCr_installed = YCbCr_to_RGB_row;\n\nvoid stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func)\n{\n stbi_YCbCr_installed = func;\n}\n#endif\n\n\n// clean up the temporary component buffers\nstatic void cleanup_jpeg(jpeg *j)\n{\n int i;\n for (i=0; i < j->s.img_n; ++i) {\n if (j->img_comp[i].data) {\n free(j->img_comp[i].raw_data);\n j->img_comp[i].data = NULL;\n }\n if (j->img_comp[i].linebuf) {\n free(j->img_comp[i].linebuf);\n j->img_comp[i].linebuf = NULL;\n }\n }\n}\n\ntypedef struct\n{\n resample_row_func resample;\n uint8 *line0,*line1;\n int hs,vs; // expansion factor in each axis\n int w_lores; // horizontal pixels pre-expansion\n int ystep; // how far through vertical expansion we are\n int ypos; // which pre-expansion row we're on\n} stbi_resample;\n\nstatic uint8 *load_jpeg_image(jpeg *z, int *out_x, int *out_y, int *comp, int req_comp)\n{\n int n, decode_n;\n // validate req_comp\n if (req_comp < 0 || req_comp > 4) return epuc(\"bad req_comp\", \"Internal error\");\n z->s.img_n = 0;\n\n // load a jpeg image from whichever source\n if (!decode_jpeg_image(z)) { cleanup_jpeg(z); return NULL; }\n\n // determine actual number of components to generate\n n = req_comp ? req_comp : z->s.img_n;\n\n if (z->s.img_n == 3 && n < 3)\n decode_n = 1;\n else\n decode_n = z->s.img_n;\n\n // resample and color-convert\n {\n int k;\n uint i,j;\n uint8 *output;\n uint8 *coutput[4];\n\n stbi_resample res_comp[4];\n\n for (k=0; k < decode_n; ++k) {\n stbi_resample *r = &res_comp[k];\n\n // allocate line buffer big enough for upsampling off the edges\n // with upsample factor of 4\n z->img_comp[k].linebuf = (uint8 *) malloc(z->s.img_x + 3);\n if (!z->img_comp[k].linebuf) { cleanup_jpeg(z); return epuc(\"outofmem\", \"Out of memory\"); }\n\n r->hs = z->img_h_max / z->img_comp[k].h;\n r->vs = z->img_v_max / z->img_comp[k].v;\n r->ystep = r->vs >> 1;\n r->w_lores = (z->s.img_x + r->hs-1) / r->hs;\n r->ypos = 0;\n r->line0 = r->line1 = z->img_comp[k].data;\n\n if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1;\n else if (r->hs == 1 && r->vs == 2) r->resample = resample_row_v_2;\n else if (r->hs == 2 && r->vs == 1) r->resample = resample_row_h_2;\n else if (r->hs == 2 && r->vs == 2) r->resample = resample_row_hv_2;\n else r->resample = resample_row_generic;\n }\n\n // can't error after this so, this is safe\n output = (uint8 *) malloc(n * z->s.img_x * z->s.img_y + 1);\n if (!output) { cleanup_jpeg(z); return epuc(\"outofmem\", \"Out of memory\"); }\n\n // now go ahead and resample\n for (j=0; j < z->s.img_y; ++j) {\n uint8 *out = output + n * z->s.img_x * j;\n for (k=0; k < decode_n; ++k) {\n stbi_resample *r = &res_comp[k];\n int y_bot = r->ystep >= (r->vs >> 1);\n coutput[k] = r->resample(z->img_comp[k].linebuf,\n y_bot ? r->line1 : r->line0,\n y_bot ? r->line0 : r->line1,\n r->w_lores, r->hs);\n if (++r->ystep >= r->vs) {\n r->ystep = 0;\n r->line0 = r->line1;\n if (++r->ypos < z->img_comp[k].y)\n r->line1 += z->img_comp[k].w2;\n }\n }\n if (n >= 3) {\n uint8 *y = coutput[0];\n if (z->s.img_n == 3) {\n #if STBI_SIMD\n stbi_YCbCr_installed(out, y, coutput[1], coutput[2], z->s.img_x, n);\n #else\n YCbCr_to_RGB_row(out, y, coutput[1], coutput[2], z->s.img_x, n);\n #endif\n } else\n for (i=0; i < z->s.img_x; ++i) {\n out[0] = out[1] = out[2] = y[i];\n out[3] = 255; // not used if n==3\n out += n;\n }\n } else {\n uint8 *y = coutput[0];\n if (n == 1)\n for (i=0; i < z->s.img_x; ++i) out[i] = y[i];\n else\n for (i=0; i < z->s.img_x; ++i) *out++ = y[i], *out++ = 255;\n }\n }\n cleanup_jpeg(z);\n *out_x = z->s.img_x;\n *out_y = z->s.img_y;\n if (comp) *comp = z->s.img_n; // report original components, not output\n return output;\n }\n}\n\n#ifndef STBI_NO_STDIO\nunsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n jpeg j;\n start_file(&j.s, f);\n return load_jpeg_image(&j, x,y,comp,req_comp);\n}\n\nunsigned char *stbi_jpeg_load(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *data;\n FILE *f = fopen(filename, \"rb\");\n if (!f) return NULL;\n data = stbi_jpeg_load_from_file(f,x,y,comp,req_comp);\n fclose(f);\n return data;\n}\n#endif\n\nunsigned char *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n jpeg j;\n start_mem(&j.s, buffer,len);\n return load_jpeg_image(&j, x,y,comp,req_comp);\n}\n\n#ifndef STBI_NO_STDIO\nint stbi_jpeg_test_file(FILE *f)\n{\n int n,r;\n jpeg j;\n n = ftell(f);\n start_file(&j.s, f);\n r = decode_jpeg_header(&j, SCAN_type);\n fseek(f,n,SEEK_SET);\n return r;\n}\n#endif\n\nint stbi_jpeg_test_memory(stbi_uc const *buffer, int len)\n{\n jpeg j;\n start_mem(&j.s, buffer,len);\n return decode_jpeg_header(&j, SCAN_type);\n}\n\n// @TODO:\n#ifndef STBI_NO_STDIO\nextern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\nextern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n// public domain zlib decode v0.2 Sean Barrett 2006-11-18\n// simple implementation\n// - all input must be provided in an upfront buffer\n// - all output is written to a single output buffer (can malloc/realloc)\n// performance\n// - fast huffman\n\n// fast-way is faster to check than jpeg huffman, but slow way is slower\n#define ZFAST_BITS 9 // accelerate all cases in default tables\n#define ZFAST_MASK ((1 << ZFAST_BITS) - 1)\n\n// zlib-style huffman encoding\n// (jpegs packs from left, zlib from right, so can't share code)\ntypedef struct\n{\n uint16 fast[1 << ZFAST_BITS];\n uint16 firstcode[16];\n int maxcode[17];\n uint16 firstsymbol[16];\n uint8 size[288];\n uint16 value[288];\n} zhuffman;\n\n__forceinline static int bitreverse16(int n)\n{\n n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1);\n n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2);\n n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4);\n n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8);\n return n;\n}\n\n__forceinline static int bit_reverse(int v, int bits)\n{\n assert(bits <= 16);\n // to bit reverse n bits, reverse 16 and shift\n // e.g. 11 bits, bit reverse and shift away 5\n return bitreverse16(v) >> (16-bits);\n}\n\nstatic int zbuild_huffman(zhuffman *z, uint8 *sizelist, int num)\n{\n int i,k=0;\n int code, next_code[16], sizes[17];\n\n // DEFLATE spec for generating codes\n memset(sizes, 0, sizeof(sizes));\n memset(z->fast, 255, sizeof(z->fast));\n for (i=0; i < num; ++i)\n ++sizes[sizelist[i]];\n sizes[0] = 0;\n for (i=1; i < 16; ++i)\n assert(sizes[i] <= (1 << i));\n code = 0;\n for (i=1; i < 16; ++i) {\n next_code[i] = code;\n z->firstcode[i] = (uint16) code;\n z->firstsymbol[i] = (uint16) k;\n code = (code + sizes[i]);\n if (sizes[i])\n if (code-1 >= (1 << i)) return e(\"bad codelengths\",\"Corrupt JPEG\");\n z->maxcode[i] = code << (16-i); // preshift for inner loop\n code <<= 1;\n k += sizes[i];\n }\n z->maxcode[16] = 0x10000; // sentinel\n for (i=0; i < num; ++i) {\n int s = sizelist[i];\n if (s) {\n int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s];\n z->size[c] = (uint8)s;\n z->value[c] = (uint16)i;\n if (s <= ZFAST_BITS) {\n int k = bit_reverse(next_code[s],s);\n while (k < (1 << ZFAST_BITS)) {\n z->fast[k] = (uint16) c;\n k += (1 << s);\n }\n }\n ++next_code[s];\n }\n }\n return 1;\n}\n\n// zlib-from-memory implementation for PNG reading\n// because PNG allows splitting the zlib stream arbitrarily,\n// and it's annoying structurally to have PNG call ZLIB call PNG,\n// we require PNG read all the IDATs and combine them into a single\n// memory buffer\n\ntypedef struct\n{\n uint8 *zbuffer, *zbuffer_end;\n int num_bits;\n uint32 code_buffer;\n\n char *zout;\n char *zout_start;\n char *zout_end;\n int z_expandable;\n\n zhuffman z_length, z_distance;\n} zbuf;\n\n__forceinline static int zget8(zbuf *z)\n{\n if (z->zbuffer >= z->zbuffer_end) return 0;\n return *z->zbuffer++;\n}\n\nstatic void fill_bits(zbuf *z)\n{\n do {\n assert(z->code_buffer < (1U << z->num_bits));\n z->code_buffer |= zget8(z) << z->num_bits;\n z->num_bits += 8;\n } while (z->num_bits <= 24);\n}\n\n__forceinline static unsigned int zreceive(zbuf *z, int n)\n{\n unsigned int k;\n if (z->num_bits < n) fill_bits(z);\n k = z->code_buffer & ((1 << n) - 1);\n z->code_buffer >>= n;\n z->num_bits -= n;\n return k;\n}\n\n__forceinline static int zhuffman_decode(zbuf *a, zhuffman *z)\n{\n int b,s,k;\n if (a->num_bits < 16) fill_bits(a);\n b = z->fast[a->code_buffer & ZFAST_MASK];\n if (b < 0xffff) {\n s = z->size[b];\n a->code_buffer >>= s;\n a->num_bits -= s;\n return z->value[b];\n }\n\n // not resolved by fast table, so compute it the slow way\n // use jpeg approach, which requires MSbits at top\n k = bit_reverse(a->code_buffer, 16);\n for (s=ZFAST_BITS+1; ; ++s)\n if (k < z->maxcode[s])\n break;\n if (s == 16) return -1; // invalid code!\n // code size is s, so:\n b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];\n assert(z->size[b] == s);\n a->code_buffer >>= s;\n a->num_bits -= s;\n return z->value[b];\n}\n\nstatic int expand(zbuf *z, int n) // need to make room for n bytes\n{\n char *q;\n int cur, limit;\n if (!z->z_expandable) return e(\"output buffer limit\",\"Corrupt PNG\");\n cur = (int) (z->zout - z->zout_start);\n limit = (int) (z->zout_end - z->zout_start);\n while (cur + n > limit)\n limit *= 2;\n q = (char *) realloc(z->zout_start, limit);\n if (q == NULL) return e(\"outofmem\", \"Out of memory\");\n z->zout_start = q;\n z->zout = q + cur;\n z->zout_end = q + limit;\n return 1;\n}\n\nstatic int length_base[31] = {\n 3,4,5,6,7,8,9,10,11,13,\n 15,17,19,23,27,31,35,43,51,59,\n 67,83,99,115,131,163,195,227,258,0,0 };\n\nstatic int length_extra[31]=\n{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 };\n\nstatic int dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,\n257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0};\n\nstatic int dist_extra[32] =\n{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};\n\nstatic int parse_huffman_block(zbuf *a)\n{\n for(;;) {\n int z = zhuffman_decode(a, &a->z_length);\n if (z < 256) {\n if (z < 0) return e(\"bad huffman code\",\"Corrupt PNG\"); // error in huffman codes\n if (a->zout >= a->zout_end) if (!expand(a, 1)) return 0;\n *a->zout++ = (char) z;\n } else {\n uint8 *p;\n int len,dist;\n if (z == 256) return 1;\n z -= 257;\n len = length_base[z];\n if (length_extra[z]) len += zreceive(a, length_extra[z]);\n z = zhuffman_decode(a, &a->z_distance);\n if (z < 0) return e(\"bad huffman code\",\"Corrupt PNG\");\n dist = dist_base[z];\n if (dist_extra[z]) dist += zreceive(a, dist_extra[z]);\n if (a->zout - a->zout_start < dist) return e(\"bad dist\",\"Corrupt PNG\");\n if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0;\n p = (uint8 *) (a->zout - dist);\n while (len--)\n *a->zout++ = *p++;\n }\n }\n}\n\nstatic int compute_huffman_codes(zbuf *a)\n{\n static uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };\n static zhuffman z_codelength; // static just to save stack space\n uint8 lencodes[286+32+137];//padding for maximum single op\n uint8 codelength_sizes[19];\n int i,n;\n\n int hlit = zreceive(a,5) + 257;\n int hdist = zreceive(a,5) + 1;\n int hclen = zreceive(a,4) + 4;\n\n memset(codelength_sizes, 0, sizeof(codelength_sizes));\n for (i=0; i < hclen; ++i) {\n int s = zreceive(a,3);\n codelength_sizes[length_dezigzag[i]] = (uint8) s;\n }\n if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0;\n\n n = 0;\n while (n < hlit + hdist) {\n int c = zhuffman_decode(a, &z_codelength);\n assert(c >= 0 && c < 19);\n if (c < 16)\n lencodes[n++] = (uint8) c;\n else if (c == 16) {\n c = zreceive(a,2)+3;\n memset(lencodes+n, lencodes[n-1], c);\n n += c;\n } else if (c == 17) {\n c = zreceive(a,3)+3;\n memset(lencodes+n, 0, c);\n n += c;\n } else {\n assert(c == 18);\n c = zreceive(a,7)+11;\n memset(lencodes+n, 0, c);\n n += c;\n }\n }\n if (n != hlit+hdist) return e(\"bad codelengths\",\"Corrupt PNG\");\n if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0;\n if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0;\n return 1;\n}\n\nstatic int parse_uncompressed_block(zbuf *a)\n{\n uint8 header[4];\n int len,nlen,k;\n if (a->num_bits & 7)\n zreceive(a, a->num_bits & 7); // discard\n // drain the bit-packed data into header\n k = 0;\n while (a->num_bits > 0) {\n header[k++] = (uint8) (a->code_buffer & 255); // wtf this warns?\n a->code_buffer >>= 8;\n a->num_bits -= 8;\n }\n assert(a->num_bits == 0);\n // now fill header the normal way\n while (k < 4)\n header[k++] = (uint8) zget8(a);\n len = header[1] * 256 + header[0];\n nlen = header[3] * 256 + header[2];\n if (nlen != (len ^ 0xffff)) return e(\"zlib corrupt\",\"Corrupt PNG\");\n if (a->zbuffer + len > a->zbuffer_end) return e(\"read past buffer\",\"Corrupt PNG\");\n if (a->zout + len > a->zout_end)\n if (!expand(a, len)) return 0;\n memcpy(a->zout, a->zbuffer, len);\n a->zbuffer += len;\n a->zout += len;\n return 1;\n}\n\nstatic int parse_zlib_header(zbuf *a)\n{\n int cmf = zget8(a);\n int cm = cmf & 15;\n /* int cinfo = cmf >> 4; */\n int flg = zget8(a);\n if ((cmf*256+flg) % 31 != 0) return e(\"bad zlib header\",\"Corrupt PNG\"); // zlib spec\n if (flg & 32) return e(\"no preset dict\",\"Corrupt PNG\"); // preset dictionary not allowed in png\n if (cm != 8) return e(\"bad compression\",\"Corrupt PNG\"); // DEFLATE required for png\n // window = 1 << (8 + cinfo)... but who cares, we fully buffer output\n return 1;\n}\n\n// @TODO: should statically initialize these for optimal thread safety\nstatic uint8 default_length[288], default_distance[32];\nstatic void init_defaults(void)\n{\n int i; // use <= to match clearly with spec\n for (i=0; i <= 143; ++i) default_length[i] = 8;\n for ( ; i <= 255; ++i) default_length[i] = 9;\n for ( ; i <= 279; ++i) default_length[i] = 7;\n for ( ; i <= 287; ++i) default_length[i] = 8;\n\n for (i=0; i <= 31; ++i) default_distance[i] = 5;\n}\n\nstatic int parse_zlib(zbuf *a, int parse_header)\n{\n int final, type;\n if (parse_header)\n if (!parse_zlib_header(a)) return 0;\n a->num_bits = 0;\n a->code_buffer = 0;\n do {\n final = zreceive(a,1);\n type = zreceive(a,2);\n if (type == 0) {\n if (!parse_uncompressed_block(a)) return 0;\n } else if (type == 3) {\n return 0;\n } else {\n if (type == 1) {\n // use fixed code lengths\n if (!default_distance[31]) init_defaults();\n if (!zbuild_huffman(&a->z_length , default_length , 288)) return 0;\n if (!zbuild_huffman(&a->z_distance, default_distance, 32)) return 0;\n } else {\n if (!compute_huffman_codes(a)) return 0;\n }\n if (!parse_huffman_block(a)) return 0;\n }\n } while (!final);\n return 1;\n}\n\nstatic int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_header)\n{\n a->zout_start = obuf;\n a->zout = obuf;\n a->zout_end = obuf + olen;\n a->z_expandable = exp;\n\n return parse_zlib(a, parse_header);\n}\n\nchar *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen)\n{\n zbuf a;\n char *p = (char *) malloc(initial_size);\n if (p == NULL) return NULL;\n a.zbuffer = (uint8 *) buffer;\n a.zbuffer_end = (uint8 *) buffer + len;\n if (do_zlib(&a, p, initial_size, 1, 1)) {\n if (outlen) *outlen = (int) (a.zout - a.zout_start);\n return a.zout_start;\n } else {\n free(a.zout_start);\n return NULL;\n }\n}\n\nchar *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen)\n{\n return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen);\n}\n\nint stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen)\n{\n zbuf a;\n a.zbuffer = (uint8 *) ibuffer;\n a.zbuffer_end = (uint8 *) ibuffer + ilen;\n if (do_zlib(&a, obuffer, olen, 0, 1))\n return (int) (a.zout - a.zout_start);\n else\n return -1;\n}\n\nchar *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)\n{\n zbuf a;\n char *p = (char *) malloc(16384);\n if (p == NULL) return NULL;\n a.zbuffer = (uint8 *) buffer;\n a.zbuffer_end = (uint8 *) buffer+len;\n if (do_zlib(&a, p, 16384, 1, 0)) {\n if (outlen) *outlen = (int) (a.zout - a.zout_start);\n return a.zout_start;\n } else {\n free(a.zout_start);\n return NULL;\n }\n}\n\nint stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen)\n{\n zbuf a;\n a.zbuffer = (uint8 *) ibuffer;\n a.zbuffer_end = (uint8 *) ibuffer + ilen;\n if (do_zlib(&a, obuffer, olen, 0, 0))\n return (int) (a.zout - a.zout_start);\n else\n return -1;\n}\n\n// public domain \"baseline\" PNG decoder v0.10 Sean Barrett 2006-11-18\n// simple implementation\n// - only 8-bit samples\n// - no CRC checking\n// - allocates lots of intermediate memory\n// - avoids problem of streaming data between subsystems\n// - avoids explicit window management\n// performance\n// - uses stb_zlib, a PD zlib implementation with fast huffman decoding\n\n\ntypedef struct\n{\n uint32 length;\n uint32 type;\n} chunk;\n\n#define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))\n\nstatic chunk get_chunk_header(stbi *s)\n{\n chunk c;\n c.length = get32(s);\n c.type = get32(s);\n return c;\n}\n\nstatic int check_png_header(stbi *s)\n{\n static uint8 png_sig[8] = { 137,80,78,71,13,10,26,10 };\n int i;\n for (i=0; i < 8; ++i)\n if (get8(s) != png_sig[i]) return e(\"bad png sig\",\"Not a PNG\");\n return 1;\n}\n\ntypedef struct\n{\n stbi s;\n uint8 *idata, *expanded, *out;\n} png;\n\n\nenum {\n F_none=0, F_sub=1, F_up=2, F_avg=3, F_paeth=4,\n F_avg_first, F_paeth_first,\n};\n\nstatic uint8 first_row_filter[5] =\n{\n F_none, F_sub, F_none, F_avg_first, F_paeth_first\n};\n\nstatic int paeth(int a, int b, int c)\n{\n int p = a + b - c;\n int pa = abs(p-a);\n int pb = abs(p-b);\n int pc = abs(p-c);\n if (pa <= pb && pa <= pc) return a;\n if (pb <= pc) return b;\n return c;\n}\n\n// create the png data from post-deflated data\nstatic int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n)\n{\n stbi *s = &a->s;\n uint32 i,j,stride = s->img_x*out_n;\n int k;\n int img_n = s->img_n; // copy it into a local for later\n assert(out_n == s->img_n || out_n == s->img_n+1);\n a->out = (uint8 *) malloc(s->img_x * s->img_y * out_n);\n if (!a->out) return e(\"outofmem\", \"Out of memory\");\n if (raw_len != (img_n * s->img_x + 1) * s->img_y) return e(\"not enough pixels\",\"Corrupt PNG\");\n for (j=0; j < s->img_y; ++j) {\n uint8 *cur = a->out + stride*j;\n uint8 *prior = cur - stride;\n int filter = *raw++;\n if (filter > 4) return e(\"invalid filter\",\"Corrupt PNG\");\n // if first row, use special filter that doesn't sample previous row\n if (j == 0) filter = first_row_filter[filter];\n // handle first pixel explicitly\n for (k=0; k < img_n; ++k) {\n switch(filter) {\n case F_none : cur[k] = raw[k]; break;\n case F_sub : cur[k] = raw[k]; break;\n case F_up : cur[k] = raw[k] + prior[k]; break;\n case F_avg : cur[k] = raw[k] + (prior[k]>>1); break;\n case F_paeth : cur[k] = (uint8) (raw[k] + paeth(0,prior[k],0)); break;\n case F_avg_first : cur[k] = raw[k]; break;\n case F_paeth_first: cur[k] = raw[k]; break;\n }\n }\n if (img_n != out_n) cur[img_n] = 255;\n raw += img_n;\n cur += out_n;\n prior += out_n;\n // this is a little gross, so that we don't switch per-pixel or per-component\n if (img_n == out_n) {\n #define CASE(f) \\\n case f: \\\n for (i=s->img_x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \\\n for (k=0; k < img_n; ++k)\n switch(filter) {\n CASE(F_none) cur[k] = raw[k]; break;\n CASE(F_sub) cur[k] = raw[k] + cur[k-img_n]; break;\n CASE(F_up) cur[k] = raw[k] + prior[k]; break;\n CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break;\n CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break;\n CASE(F_avg_first) cur[k] = raw[k] + (cur[k-img_n] >> 1); break;\n CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0)); break;\n }\n #undef CASE\n } else {\n assert(img_n+1 == out_n);\n #define CASE(f) \\\n case f: \\\n for (i=s->img_x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \\\n for (k=0; k < img_n; ++k)\n switch(filter) {\n CASE(F_none) cur[k] = raw[k]; break;\n CASE(F_sub) cur[k] = raw[k] + cur[k-out_n]; break;\n CASE(F_up) cur[k] = raw[k] + prior[k]; break;\n CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break;\n CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;\n CASE(F_avg_first) cur[k] = raw[k] + (cur[k-out_n] >> 1); break;\n CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0)); break;\n }\n #undef CASE\n }\n }\n return 1;\n}\n\nstatic int compute_transparency(png *z, uint8 tc[3], int out_n)\n{\n stbi *s = &z->s;\n uint32 i, pixel_count = s->img_x * s->img_y;\n uint8 *p = z->out;\n\n // compute color-based transparency, assuming we've\n // already got 255 as the alpha value in the output\n assert(out_n == 2 || out_n == 4);\n\n if (out_n == 2) {\n for (i=0; i < pixel_count; ++i) {\n p[1] = (p[0] == tc[0] ? 0 : 255);\n p += 2;\n }\n } else {\n for (i=0; i < pixel_count; ++i) {\n if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])\n p[3] = 0;\n p += 4;\n }\n }\n return 1;\n}\n\nstatic int expand_palette(png *a, uint8 *palette, int len, int pal_img_n)\n{\n uint32 i, pixel_count = a->s.img_x * a->s.img_y;\n uint8 *p, *temp_out, *orig = a->out;\n\n p = (uint8 *) malloc(pixel_count * pal_img_n);\n if (p == NULL) return e(\"outofmem\", \"Out of memory\");\n\n // between here and free(out) below, exitting would leak\n temp_out = p;\n\n if (pal_img_n == 3) {\n for (i=0; i < pixel_count; ++i) {\n int n = orig[i]*4;\n p[0] = palette[n ];\n p[1] = palette[n+1];\n p[2] = palette[n+2];\n p += 3;\n }\n } else {\n for (i=0; i < pixel_count; ++i) {\n int n = orig[i]*4;\n p[0] = palette[n ];\n p[1] = palette[n+1];\n p[2] = palette[n+2];\n p[3] = palette[n+3];\n p += 4;\n }\n }\n free(a->out);\n a->out = temp_out;\n return 1;\n}\n\nstatic int parse_png_file(png *z, int scan, int req_comp)\n{\n uint8 palette[1024], pal_img_n=0;\n uint8 has_trans=0, tc[3];\n uint32 ioff=0, idata_limit=0, i, pal_len=0;\n int first=1,k;\n stbi *s = &z->s;\n\n if (!check_png_header(s)) return 0;\n\n if (scan == SCAN_type) return 1;\n\n for(;;first=0) {\n chunk c = get_chunk_header(s);\n if (first && c.type != PNG_TYPE('I','H','D','R'))\n return e(\"first not IHDR\",\"Corrupt PNG\");\n switch (c.type) {\n case PNG_TYPE('I','H','D','R'): {\n int depth,color,interlace,comp,filter;\n if (!first) return e(\"multiple IHDR\",\"Corrupt PNG\");\n if (c.length != 13) return e(\"bad IHDR len\",\"Corrupt PNG\");\n s->img_x = get32(s); if (s->img_x > (1 << 24)) return e(\"too large\",\"Very large image (corrupt?)\");\n s->img_y = get32(s); if (s->img_y > (1 << 24)) return e(\"too large\",\"Very large image (corrupt?)\");\n depth = get8(s); if (depth != 8) return e(\"8bit only\",\"PNG not supported: 8-bit only\");\n color = get8(s); if (color > 6) return e(\"bad ctype\",\"Corrupt PNG\");\n if (color == 3) pal_img_n = 3; else if (color & 1) return e(\"bad ctype\",\"Corrupt PNG\");\n comp = get8(s); if (comp) return e(\"bad comp method\",\"Corrupt PNG\");\n filter= get8(s); if (filter) return e(\"bad filter method\",\"Corrupt PNG\");\n interlace = get8(s); if (interlace) return e(\"interlaced\",\"PNG not supported: interlaced mode\");\n if (!s->img_x || !s->img_y) return e(\"0-pixel image\",\"Corrupt PNG\");\n if (!pal_img_n) {\n s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);\n if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e(\"too large\", \"Image too large to decode\");\n if (scan == SCAN_header) return 1;\n } else {\n // if paletted, then pal_n is our final components, and\n // img_n is # components to decompress/filter.\n s->img_n = 1;\n if ((1 << 30) / s->img_x / 4 < s->img_y) return e(\"too large\",\"Corrupt PNG\");\n // if SCAN_header, have to scan to see if we have a tRNS\n }\n break;\n }\n\n case PNG_TYPE('P','L','T','E'): {\n if (c.length > 256*3) return e(\"invalid PLTE\",\"Corrupt PNG\");\n pal_len = c.length / 3;\n if (pal_len * 3 != c.length) return e(\"invalid PLTE\",\"Corrupt PNG\");\n for (i=0; i < pal_len; ++i) {\n palette[i*4+0] = get8u(s);\n palette[i*4+1] = get8u(s);\n palette[i*4+2] = get8u(s);\n palette[i*4+3] = 255;\n }\n break;\n }\n\n case PNG_TYPE('t','R','N','S'): {\n if (z->idata) return e(\"tRNS after IDAT\",\"Corrupt PNG\");\n if (pal_img_n) {\n if (scan == SCAN_header) { s->img_n = 4; return 1; }\n if (pal_len == 0) return e(\"tRNS before PLTE\",\"Corrupt PNG\");\n if (c.length > pal_len) return e(\"bad tRNS len\",\"Corrupt PNG\");\n pal_img_n = 4;\n for (i=0; i < c.length; ++i)\n palette[i*4+3] = get8u(s);\n } else {\n if (!(s->img_n & 1)) return e(\"tRNS with alpha\",\"Corrupt PNG\");\n if (c.length != (uint32) s->img_n*2) return e(\"bad tRNS len\",\"Corrupt PNG\");\n has_trans = 1;\n for (k=0; k < s->img_n; ++k)\n tc[k] = (uint8) get16(s); // non 8-bit images will be larger\n }\n break;\n }\n\n case PNG_TYPE('I','D','A','T'): {\n if (pal_img_n && !pal_len) return e(\"no PLTE\",\"Corrupt PNG\");\n if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; }\n if (ioff + c.length > idata_limit) {\n uint8 *p;\n if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096;\n while (ioff + c.length > idata_limit)\n idata_limit *= 2;\n p = (uint8 *) realloc(z->idata, idata_limit); if (p == NULL) return e(\"outofmem\", \"Out of memory\");\n z->idata = p;\n }\n #ifndef STBI_NO_STDIO\n if (s->img_file)\n {\n if (fread(z->idata+ioff,1,c.length,s->img_file) != c.length) return e(\"outofdata\",\"Corrupt PNG\");\n }\n else\n #endif\n {\n memcpy(z->idata+ioff, s->img_buffer, c.length);\n s->img_buffer += c.length;\n }\n ioff += c.length;\n break;\n }\n\n case PNG_TYPE('I','E','N','D'): {\n uint32 raw_len;\n if (scan != SCAN_load) return 1;\n if (z->idata == NULL) return e(\"no IDAT\",\"Corrupt PNG\");\n z->expanded = (uint8 *) stbi_zlib_decode_malloc((char *) z->idata, ioff, (int *) &raw_len);\n if (z->expanded == NULL) return 0; // zlib should set error\n free(z->idata); z->idata = NULL;\n if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans)\n s->img_out_n = s->img_n+1;\n else\n s->img_out_n = s->img_n;\n if (!create_png_image(z, z->expanded, raw_len, s->img_out_n)) return 0;\n if (has_trans)\n if (!compute_transparency(z, tc, s->img_out_n)) return 0;\n if (pal_img_n) {\n // pal_img_n == 3 or 4\n s->img_n = pal_img_n; // record the actual colors we had\n s->img_out_n = pal_img_n;\n if (req_comp >= 3) s->img_out_n = req_comp;\n if (!expand_palette(z, palette, pal_len, s->img_out_n))\n return 0;\n }\n free(z->expanded); z->expanded = NULL;\n return 1;\n }\n\n default:\n // if critical, fail\n if ((c.type & (1 << 29)) == 0) {\n #ifndef STBI_NO_FAILURE_STRINGS\n // not threadsafe\n static char invalid_chunk[] = \"XXXX chunk not known\";\n invalid_chunk[0] = (uint8) (c.type >> 24);\n invalid_chunk[1] = (uint8) (c.type >> 16);\n invalid_chunk[2] = (uint8) (c.type >> 8);\n invalid_chunk[3] = (uint8) (c.type >> 0);\n #endif\n return e(invalid_chunk, \"PNG not supported: unknown chunk type\");\n }\n skip(s, c.length);\n break;\n }\n // end of chunk, read and skip CRC\n get32(s);\n }\n}\n\nstatic unsigned char *do_png(png *p, int *x, int *y, int *n, int req_comp)\n{\n unsigned char *result=NULL;\n p->expanded = NULL;\n p->idata = NULL;\n p->out = NULL;\n if (req_comp < 0 || req_comp > 4) return epuc(\"bad req_comp\", \"Internal error\");\n if (parse_png_file(p, SCAN_load, req_comp)) {\n result = p->out;\n p->out = NULL;\n if (req_comp && req_comp != p->s.img_out_n) {\n result = convert_format(result, p->s.img_out_n, req_comp, p->s.img_x, p->s.img_y);\n p->s.img_out_n = req_comp;\n if (result == NULL) return result;\n }\n *x = p->s.img_x;\n *y = p->s.img_y;\n if (n) *n = p->s.img_n;\n }\n free(p->out); p->out = NULL;\n free(p->expanded); p->expanded = NULL;\n free(p->idata); p->idata = NULL;\n\n return result;\n}\n\n#ifndef STBI_NO_STDIO\nunsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n png p;\n start_file(&p.s, f);\n return do_png(&p, x,y,comp,req_comp);\n}\n\nunsigned char *stbi_png_load(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *data;\n FILE *f = fopen(filename, \"rb\");\n if (!f) return NULL;\n data = stbi_png_load_from_file(f,x,y,comp,req_comp);\n fclose(f);\n return data;\n}\n#endif\n\nunsigned char *stbi_png_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n png p;\n start_mem(&p.s, buffer,len);\n return do_png(&p, x,y,comp,req_comp);\n}\n\n#ifndef STBI_NO_STDIO\nint stbi_png_test_file(FILE *f)\n{\n png p;\n int n,r;\n n = ftell(f);\n start_file(&p.s, f);\n r = parse_png_file(&p, SCAN_type,STBI_default);\n fseek(f,n,SEEK_SET);\n return r;\n}\n#endif\n\nint stbi_png_test_memory(stbi_uc const *buffer, int len)\n{\n png p;\n start_mem(&p.s, buffer, len);\n return parse_png_file(&p, SCAN_type,STBI_default);\n}\n\n// TODO: load header from png\n#ifndef STBI_NO_STDIO\nextern int stbi_png_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\nextern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n// Microsoft/Windows BMP image\n\nstatic int bmp_test(stbi *s)\n{\n int sz;\n if (get8(s) != 'B') return 0;\n if (get8(s) != 'M') return 0;\n get32le(s); // discard filesize\n get16le(s); // discard reserved\n get16le(s); // discard reserved\n get32le(s); // discard data offset\n sz = get32le(s);\n if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1;\n return 0;\n}\n\n#ifndef STBI_NO_STDIO\nint stbi_bmp_test_file (FILE *f)\n{\n stbi s;\n int r,n = ftell(f);\n start_file(&s,f);\n r = bmp_test(&s);\n fseek(f,n,SEEK_SET);\n return r;\n}\n#endif\n\nint stbi_bmp_test_memory (stbi_uc const *buffer, int len)\n{\n stbi s;\n start_mem(&s, buffer, len);\n return bmp_test(&s);\n}\n\n// returns 0..31 for the highest set bit\nstatic int high_bit(unsigned int z)\n{\n int n=0;\n if (z == 0) return -1;\n if (z >= 0x10000) n += 16, z >>= 16;\n if (z >= 0x00100) n += 8, z >>= 8;\n if (z >= 0x00010) n += 4, z >>= 4;\n if (z >= 0x00004) n += 2, z >>= 2;\n if (z >= 0x00002) n += 1, z >>= 1;\n return n;\n}\n\nstatic int bitcount(unsigned int a)\n{\n a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2\n a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4\n a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits\n a = (a + (a >> 8)); // max 16 per 8 bits\n a = (a + (a >> 16)); // max 32 per 8 bits\n return a & 0xff;\n}\n\nstatic int shiftsigned(int v, int shift, int bits)\n{\n int result;\n int z=0;\n\n if (shift < 0) v <<= -shift;\n else v >>= shift;\n result = v;\n\n z = bits;\n while (z < 8) {\n result += v >> z;\n z += bits;\n }\n return result;\n}\n\nstatic stbi_uc *bmp_load(stbi *s, int *x, int *y, int *comp, int req_comp)\n{\n uint8 *out;\n unsigned int mr=0,mg=0,mb=0,ma=0;\n stbi_uc pal[256][4];\n int psize=0,i,j,compress=0,width;\n int bpp, flip_vertically, pad, target, offset, hsz;\n if (get8(s) != 'B' || get8(s) != 'M') return epuc(\"not BMP\", \"Corrupt BMP\");\n get32le(s); // discard filesize\n get16le(s); // discard reserved\n get16le(s); // discard reserved\n offset = get32le(s);\n hsz = get32le(s);\n if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc(\"unknown BMP\", \"BMP type not supported: unknown\");\n failure_reason = \"bad BMP\";\n if (hsz == 12) {\n s->img_x = get16le(s);\n s->img_y = get16le(s);\n } else {\n s->img_x = get32le(s);\n s->img_y = get32le(s);\n }\n if (get16le(s) != 1) return 0;\n bpp = get16le(s);\n if (bpp == 1) return epuc(\"monochrome\", \"BMP type not supported: 1-bit\");\n flip_vertically = ((int) s->img_y) > 0;\n s->img_y = abs((int) s->img_y);\n if (hsz == 12) {\n if (bpp < 24)\n psize = (offset - 14 - 24) / 3;\n } else {\n compress = get32le(s);\n if (compress == 1 || compress == 2) return epuc(\"BMP RLE\", \"BMP type not supported: RLE\");\n get32le(s); // discard sizeof\n get32le(s); // discard hres\n get32le(s); // discard vres\n get32le(s); // discard colorsused\n get32le(s); // discard max important\n if (hsz == 40 || hsz == 56) {\n if (hsz == 56) {\n get32le(s);\n get32le(s);\n get32le(s);\n get32le(s);\n }\n if (bpp == 16 || bpp == 32) {\n mr = mg = mb = 0;\n if (compress == 0) {\n if (bpp == 32) {\n mr = 0xff << 16;\n mg = 0xff << 8;\n mb = 0xff << 0;\n } else {\n mr = 31 << 10;\n mg = 31 << 5;\n mb = 31 << 0;\n }\n } else if (compress == 3) {\n mr = get32le(s);\n mg = get32le(s);\n mb = get32le(s);\n // not documented, but generated by photoshop and handled by mspaint\n if (mr == mg && mg == mb) {\n // ?!?!?\n return NULL;\n }\n } else\n return NULL;\n }\n } else {\n assert(hsz == 108);\n mr = get32le(s);\n mg = get32le(s);\n mb = get32le(s);\n ma = get32le(s);\n get32le(s); // discard color space\n for (i=0; i < 12; ++i)\n get32le(s); // discard color space parameters\n }\n if (bpp < 16)\n psize = (offset - 14 - hsz) >> 2;\n }\n s->img_n = ma ? 4 : 3;\n if (req_comp && req_comp >= 3) // we can directly decode 3 or 4\n target = req_comp;\n else\n target = s->img_n; // if they want monochrome, we'll post-convert\n out = (stbi_uc *) malloc(target * s->img_x * s->img_y);\n if (!out) return epuc(\"outofmem\", \"Out of memory\");\n if (bpp < 16) {\n int z=0;\n if (psize == 0 || psize > 256) { free(out); return epuc(\"invalid\", \"Corrupt BMP\"); }\n for (i=0; i < psize; ++i) {\n pal[i][2] = get8(s);\n pal[i][1] = get8(s);\n pal[i][0] = get8(s);\n if (hsz != 12) get8(s);\n pal[i][3] = 255;\n }\n skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4));\n if (bpp == 4) width = (s->img_x + 1) >> 1;\n else if (bpp == 8) width = s->img_x;\n else { free(out); return epuc(\"bad bpp\", \"Corrupt BMP\"); }\n pad = (-width)&3;\n for (j=0; j < (int) s->img_y; ++j) {\n for (i=0; i < (int) s->img_x; i += 2) {\n int v=get8(s),v2=0;\n if (bpp == 4) {\n v2 = v & 15;\n v >>= 4;\n }\n out[z++] = pal[v][0];\n out[z++] = pal[v][1];\n out[z++] = pal[v][2];\n if (target == 4) out[z++] = 255;\n if (i+1 == (int) s->img_x) break;\n v = (bpp == 8) ? get8(s) : v2;\n out[z++] = pal[v][0];\n out[z++] = pal[v][1];\n out[z++] = pal[v][2];\n if (target == 4) out[z++] = 255;\n }\n skip(s, pad);\n }\n } else {\n int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0;\n int z = 0;\n int easy=0;\n skip(s, offset - 14 - hsz);\n if (bpp == 24) width = 3 * s->img_x;\n else if (bpp == 16) width = 2*s->img_x;\n else /* bpp = 32 and pad = 0 */ width=0;\n pad = (-width) & 3;\n if (bpp == 24) {\n easy = 1;\n } else if (bpp == 32) {\n if (mb == 0xff && mg == 0xff00 && mr == 0xff000000 && ma == 0xff000000)\n easy = 2;\n }\n if (!easy) {\n if (!mr || !mg || !mb) return epuc(\"bad masks\", \"Corrupt BMP\");\n // right shift amt to put high bit in position #7\n rshift = high_bit(mr)-7; rcount = bitcount(mr);\n gshift = high_bit(mg)-7; gcount = bitcount(mr);\n bshift = high_bit(mb)-7; bcount = bitcount(mr);\n ashift = high_bit(ma)-7; acount = bitcount(mr);\n }\n for (j=0; j < (int) s->img_y; ++j) {\n if (easy) {\n for (i=0; i < (int) s->img_x; ++i) {\n int a;\n out[z+2] = get8(s);\n out[z+1] = get8(s);\n out[z+0] = get8(s);\n z += 3;\n a = (easy == 2 ? get8(s) : 255);\n if (target == 4) out[z++] = a;\n }\n } else {\n for (i=0; i < (int) s->img_x; ++i) {\n uint32 v = (bpp == 16 ? get16le(s) : get32le(s));\n int a;\n out[z++] = shiftsigned(v & mr, rshift, rcount);\n out[z++] = shiftsigned(v & mg, gshift, gcount);\n out[z++] = shiftsigned(v & mb, bshift, bcount);\n a = (ma ? shiftsigned(v & ma, ashift, acount) : 255);\n if (target == 4) out[z++] = a;\n }\n }\n skip(s, pad);\n }\n }\n if (flip_vertically) {\n stbi_uc t;\n for (j=0; j < (int) s->img_y>>1; ++j) {\n stbi_uc *p1 = out + j *s->img_x*target;\n stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;\n for (i=0; i < (int) s->img_x*target; ++i) {\n t = p1[i], p1[i] = p2[i], p2[i] = t;\n }\n }\n }\n\n if (req_comp && req_comp != target) {\n out = convert_format(out, target, req_comp, s->img_x, s->img_y);\n if (out == NULL) return out; // convert_format frees input on failure\n }\n\n *x = s->img_x;\n *y = s->img_y;\n if (comp) *comp = target;\n return out;\n}\n\n#ifndef STBI_NO_STDIO\nstbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n stbi_uc *data;\n FILE *f = fopen(filename, \"rb\");\n if (!f) return NULL;\n data = stbi_bmp_load_from_file(f, x,y,comp,req_comp);\n fclose(f);\n return data;\n}\n\nstbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n stbi s;\n start_file(&s, f);\n return bmp_load(&s, x,y,comp,req_comp);\n}\n#endif\n\nstbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi s;\n start_mem(&s, buffer, len);\n return bmp_load(&s, x,y,comp,req_comp);\n}\n\n// Targa Truevision - TGA\n// by Jonathan Dummer\n\nstatic int tga_test(stbi *s)\n{\n\tint sz;\n\tget8u(s);\t\t//\tdiscard Offset\n\tsz = get8u(s);\t//\tcolor type\n\tif( sz > 1 ) return 0;\t//\tonly RGB or indexed allowed\n\tsz = get8u(s);\t//\timage type\n\tif( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0;\t//\tonly RGB or grey allowed, +/- RLE\n\tget16(s);\t\t//\tdiscard palette start\n\tget16(s);\t\t//\tdiscard palette length\n\tget8(s);\t\t\t//\tdiscard bits per palette color entry\n\tget16(s);\t\t//\tdiscard x origin\n\tget16(s);\t\t//\tdiscard y origin\n\tif( get16(s) < 1 ) return 0;\t\t//\ttest width\n\tif( get16(s) < 1 ) return 0;\t\t//\ttest height\n\tsz = get8(s);\t//\tbits per pixel\n\tif( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) ) return 0;\t//\tonly RGB or RGBA or grey allowed\n\treturn 1;\t\t//\tseems to have passed everything\n}\n\n#ifndef STBI_NO_STDIO\nint stbi_tga_test_file (FILE *f)\n{\n stbi s;\n int r,n = ftell(f);\n start_file(&s, f);\n r = tga_test(&s);\n fseek(f,n,SEEK_SET);\n return r;\n}\n#endif\n\nint stbi_tga_test_memory (stbi_uc const *buffer, int len)\n{\n stbi s;\n start_mem(&s, buffer, len);\n return tga_test(&s);\n}\n\nstatic stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)\n{\n\t//\tread in the TGA header stuff\n\tint tga_offset = get8u(s);\n\tint tga_indexed = get8u(s);\n\tint tga_image_type = get8u(s);\n\tint tga_is_RLE = 0;\n\tint tga_palette_start = get16le(s);\n\tint tga_palette_len = get16le(s);\n\tint tga_palette_bits = get8u(s);\n\tint tga_x_origin = get16le(s);\n\tint tga_y_origin = get16le(s);\n\tint tga_width = get16le(s);\n\tint tga_height = get16le(s);\n\tint tga_bits_per_pixel = get8u(s);\n\tint tga_inverted = get8u(s);\n\t//\timage data\n\tunsigned char *tga_data;\n\tunsigned char *tga_palette = NULL;\n\tint i, j;\n\tunsigned char raw_data[4];\n\tunsigned char trans_data[] = { 0,0,0,0 };\n\tint RLE_count = 0;\n\tint RLE_repeating = 0;\n\tint read_next_pixel = 1;\n\t//\tdo a tiny bit of precessing\n\tif( tga_image_type >= 8 )\n\t{\n\t\ttga_image_type -= 8;\n\t\ttga_is_RLE = 1;\n\t}\n\t/* int tga_alpha_bits = tga_inverted & 15; */\n\ttga_inverted = 1 - ((tga_inverted >> 5) & 1);\n\n\t//\terror check\n\tif( //(tga_indexed) ||\n\t\t(tga_width < 1) || (tga_height < 1) ||\n\t\t(tga_image_type < 1) || (tga_image_type > 3) ||\n\t\t((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) &&\n\t\t(tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32))\n\t\t)\n\t{\n\t\treturn NULL;\n\t}\n\n\t//\tIf I'm paletted, then I'll use the number of bits from the palette\n\tif( tga_indexed )\n\t{\n\t\ttga_bits_per_pixel = tga_palette_bits;\n\t}\n\n\t//\ttga info\n\t*x = tga_width;\n\t*y = tga_height;\n\tif( (req_comp < 1) || (req_comp > 4) )\n\t{\n\t\t//\tjust use whatever the file was\n\t\treq_comp = tga_bits_per_pixel / 8;\n\t\t*comp = req_comp;\n\t} else\n\t{\n\t\t//\tforce a new number of components\n\t\t*comp = tga_bits_per_pixel/8;\n\t}\n\ttga_data = (unsigned char*)malloc( tga_width * tga_height * req_comp );\n\n\t//\tskip to the data's starting position (offset usually = 0)\n\tskip(s, tga_offset );\n\t//\tdo I need to load a palette?\n\tif( tga_indexed )\n\t{\n\t\t//\tany data to skip? (offset usually = 0)\n\t\tskip(s, tga_palette_start );\n\t\t//\tload the palette\n\t\ttga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 );\n\t\tgetn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 );\n\t}\n\t//\tload the data\n\tfor( i = 0; i < tga_width * tga_height; ++i )\n\t{\n\t\t//\tif I'm in RLE mode, do I need to get a RLE chunk?\n\t\tif( tga_is_RLE )\n\t\t{\n\t\t\tif( RLE_count == 0 )\n\t\t\t{\n\t\t\t\t//\tyep, get the next byte as a RLE command\n\t\t\t\tint RLE_cmd = get8u(s);\n\t\t\t\tRLE_count = 1 + (RLE_cmd & 127);\n\t\t\t\tRLE_repeating = RLE_cmd >> 7;\n\t\t\t\tread_next_pixel = 1;\n\t\t\t} else if( !RLE_repeating )\n\t\t\t{\n\t\t\t\tread_next_pixel = 1;\n\t\t\t}\n\t\t} else\n\t\t{\n\t\t\tread_next_pixel = 1;\n\t\t}\n\t\t//\tOK, if I need to read a pixel, do it now\n\t\tif( read_next_pixel )\n\t\t{\n\t\t\t//\tload however much data we did have\n\t\t\tif( tga_indexed )\n\t\t\t{\n\t\t\t\t//\tread in 1 byte, then perform the lookup\n\t\t\t\tint pal_idx = get8u(s);\n\t\t\t\tif( pal_idx >= tga_palette_len )\n\t\t\t\t{\n\t\t\t\t\t//\tinvalid index\n\t\t\t\t\tpal_idx = 0;\n\t\t\t\t}\n\t\t\t\tpal_idx *= tga_bits_per_pixel / 8;\n\t\t\t\tfor( j = 0; j*8 < tga_bits_per_pixel; ++j )\n\t\t\t\t{\n\t\t\t\t\traw_data[j] = tga_palette[pal_idx+j];\n\t\t\t\t}\n\t\t\t} else\n\t\t\t{\n\t\t\t\t//\tread in the data raw\n\t\t\t\tfor( j = 0; j*8 < tga_bits_per_pixel; ++j )\n\t\t\t\t{\n\t\t\t\t\traw_data[j] = get8u(s);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//\tconvert raw to the intermediate format\n\t\t\tswitch( tga_bits_per_pixel )\n\t\t\t{\n\t\t\tcase 8:\n\t\t\t\t//\tLuminous => RGBA\n\t\t\t\ttrans_data[0] = raw_data[0];\n\t\t\t\ttrans_data[1] = raw_data[0];\n\t\t\t\ttrans_data[2] = raw_data[0];\n\t\t\t\ttrans_data[3] = 255;\n\t\t\t\tbreak;\n\t\t\tcase 16:\n\t\t\t\t//\tLuminous,Alpha => RGBA\n\t\t\t\ttrans_data[0] = raw_data[0];\n\t\t\t\ttrans_data[1] = raw_data[0];\n\t\t\t\ttrans_data[2] = raw_data[0];\n\t\t\t\ttrans_data[3] = raw_data[1];\n\t\t\t\tbreak;\n\t\t\tcase 24:\n\t\t\t\t//\tBGR => RGBA\n\t\t\t\ttrans_data[0] = raw_data[2];\n\t\t\t\ttrans_data[1] = raw_data[1];\n\t\t\t\ttrans_data[2] = raw_data[0];\n\t\t\t\ttrans_data[3] = 255;\n\t\t\t\tbreak;\n\t\t\tcase 32:\n\t\t\t\t//\tBGRA => RGBA\n\t\t\t\ttrans_data[0] = raw_data[2];\n\t\t\t\ttrans_data[1] = raw_data[1];\n\t\t\t\ttrans_data[2] = raw_data[0];\n\t\t\t\ttrans_data[3] = raw_data[3];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//\tclear the reading flag for the next pixel\n\t\t\tread_next_pixel = 0;\n\t\t} // end of reading a pixel\n\t\t//\tconvert to final format\n\t\tswitch( req_comp )\n\t\t{\n\t\tcase 1:\n\t\t\t//\tRGBA => Luminance\n\t\t\ttga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\t//\tRGBA => Luminance,Alpha\n\t\t\ttga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);\n\t\t\ttga_data[i*req_comp+1] = trans_data[3];\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\t//\tRGBA => RGB\n\t\t\ttga_data[i*req_comp+0] = trans_data[0];\n\t\t\ttga_data[i*req_comp+1] = trans_data[1];\n\t\t\ttga_data[i*req_comp+2] = trans_data[2];\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\t//\tRGBA => RGBA\n\t\t\ttga_data[i*req_comp+0] = trans_data[0];\n\t\t\ttga_data[i*req_comp+1] = trans_data[1];\n\t\t\ttga_data[i*req_comp+2] = trans_data[2];\n\t\t\ttga_data[i*req_comp+3] = trans_data[3];\n\t\t\tbreak;\n\t\t}\n\t\t//\tin case we're in RLE mode, keep counting down\n\t\t--RLE_count;\n\t}\n\t//\tdo I need to invert the image?\n\tif( tga_inverted )\n\t{\n\t\tfor( j = 0; j*2 < tga_height; ++j )\n\t\t{\n\t\t\tint index1 = j * tga_width * req_comp;\n\t\t\tint index2 = (tga_height - 1 - j) * tga_width * req_comp;\n\t\t\tfor( i = tga_width * req_comp; i > 0; --i )\n\t\t\t{\n\t\t\t\tunsigned char temp = tga_data[index1];\n\t\t\t\ttga_data[index1] = tga_data[index2];\n\t\t\t\ttga_data[index2] = temp;\n\t\t\t\t++index1;\n\t\t\t\t++index2;\n\t\t\t}\n\t\t}\n\t}\n\t//\tclear my palette, if I had one\n\tif( tga_palette != NULL )\n\t{\n\t\tfree( tga_palette );\n\t}\n\t//\tthe things I do to get rid of an error message, and yet keep\n\t//\tMicrosoft's C compilers happy... [8^(\n\ttga_palette_start = tga_palette_len = tga_palette_bits =\n\t\t\ttga_x_origin = tga_y_origin = 0;\n\t//\tOK, done\n\treturn tga_data;\n}\n\n#ifndef STBI_NO_STDIO\nstbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n stbi_uc *data;\n FILE *f = fopen(filename, \"rb\");\n if (!f) return NULL;\n data = stbi_tga_load_from_file(f, x,y,comp,req_comp);\n fclose(f);\n return data;\n}\n\nstbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n stbi s;\n start_file(&s, f);\n return tga_load(&s, x,y,comp,req_comp);\n}\n#endif\n\nstbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi s;\n start_mem(&s"}, {"path": "includes/stb_image_aug.h", "language": "code", "loc": 308, "comment_density": 0.61, "code": "/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c\n when you control the images you're loading\n\n QUICK NOTES:\n Primarily of interest to game developers and other people who can\n avoid problematic images and only need the trivial interface\n\n JPEG baseline (no JPEG progressive, no oddball channel decimations)\n PNG non-interlaced\n BMP non-1bpp, non-RLE\n TGA (not sure what subset, if a subset)\n PSD (composited view only, no extra channels)\n HDR (radiance rgbE format)\n writes BMP,TGA (define STBI_NO_WRITE to remove code)\n decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)\n supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)\n \n TODO:\n stbi_info_*\n \n history:\n 1.16 major bugfix - convert_format converted one too many pixels\n 1.15 initialize some fields for thread safety\n 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)\n 1.13 threadsafe\n 1.12 const qualifiers in the API\n 1.11 Support installable IDCT, colorspace conversion routines\n 1.10 Fixes for 64-bit (don't use \"unsigned long\")\n optimized upsampling by Fabian \"ryg\" Giesen\n 1.09 Fix format-conversion for PSD code (bad global variables!)\n 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz\n 1.07 attempt to fix C++ warning/errors again\n 1.06 attempt to fix C++ warning/errors again\n 1.05 fix TGA loading to return correct *comp and use good luminance calc\n 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free\n 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR\n 1.02 support for (subset of) HDR files, float interface for preferred access to them\n 1.01 fix bug: possible bug in handling right-side up bmps... not sure\n fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all\n 1.00 interface to zlib that skips zlib header\n 0.99 correct handling of alpha in palette\n 0.98 TGA loader by lonesock; dynamically add loaders (untested)\n 0.97 jpeg errors on too large a file; also catch another malloc failure\n 0.96 fix detection of invalid v value - particleman@mollyrocket forum\n 0.95 during header scan, seek to markers in case of padding\n 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same\n 0.93 handle jpegtran output; verbose errors\n 0.92 read 4,8,16,24,32-bit BMP files of several formats\n 0.91 output 24-bit Windows 3.0 BMP files\n 0.90 fix a few more warnings; bump version number to approach 1.0\n 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd\n 0.60 fix compiling as c++\n 0.59 fix warnings: merge Dave Moore's -Wall fixes\n 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian\n 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less\n than 16 available\n 0.56 fix bug: zlib uncompressed mode len vs. nlen\n 0.55 fix bug: restart_interval not initialized to 0\n 0.54 allow NULL for 'int *comp'\n 0.53 fix bug in png 3->4; speedup png decoding\n 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments\n 0.51 obey req_comp requests, 1-component jpegs return as 1-component,\n on 'test' only check type, not whether we support this variant\n*/\n\n#ifndef HEADER_STB_IMAGE_AUGMENTED\n#define HEADER_STB_IMAGE_AUGMENTED\n\n//// begin header file ////////////////////////////////////////////////////\n//\n// Limitations:\n// - no progressive/interlaced support (jpeg, png)\n// - 8-bit samples only (jpeg, png)\n// - not threadsafe\n// - channel subsampling of at most 2 in each dimension (jpeg)\n// - no delayed line count (jpeg) -- IJG doesn't support either\n//\n// Basic usage (see HDR discussion below):\n// int x,y,n;\n// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);\n// // ... process data if not NULL ... \n// // ... x = width, y = height, n = # 8-bit components per pixel ...\n// // ... replace '0' with '1'..'4' to force that many components per pixel\n// stbi_image_free(data)\n//\n// Standard parameters:\n// int *x -- outputs image width in pixels\n// int *y -- outputs image height in pixels\n// int *comp -- outputs # of image components in image file\n// int req_comp -- if non-zero, # of image components requested in result\n//\n// The return value from an image loader is an 'unsigned char *' which points\n// to the pixel data. The pixel data consists of *y scanlines of *x pixels,\n// with each pixel consisting of N interleaved 8-bit components; the first\n// pixel pointed to is top-left-most in the image. There is no padding between\n// image scanlines or between pixels, regardless of format. The number of\n// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.\n// If req_comp is non-zero, *comp has the number of components that _would_\n// have been output otherwise. E.g. if you set req_comp to 4, you will always\n// get RGBA output, but you can check *comp to easily see if it's opaque.\n//\n// An output image with N components has the following components interleaved\n// in this order in each pixel:\n//\n// N=#comp components\n// 1 grey\n// 2 grey, alpha\n// 3 red, green, blue\n// 4 red, green, blue, alpha\n//\n// If image loading fails for any reason, the return value will be NULL,\n// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()\n// can be queried for an extremely brief, end-user unfriendly explanation\n// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid\n// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly\n// more user-friendly ones.\n//\n// Paletted PNG and BMP images are automatically depalettized.\n//\n//\n// ===========================================================================\n//\n// HDR image support (disable by defining STBI_NO_HDR)\n//\n// stb_image now supports loading HDR images in general, and currently\n// the Radiance .HDR file format, although the support is provided\n// generically. You can still load any file through the existing interface;\n// if you attempt to load an HDR file, it will be automatically remapped to\n// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;\n// both of these constants can be reconfigured through this interface:\n//\n// stbi_hdr_to_ldr_gamma(2.2f);\n// stbi_hdr_to_ldr_scale(1.0f);\n//\n// (note, do not use _inverse_ constants; stbi_image will invert them\n// appropriately).\n//\n// Additionally, there is a new, parallel interface for loading files as\n// (linear) floats to preserve the full dynamic range:\n//\n// float *data = stbi_loadf(filename, &x, &y, &n, 0);\n// \n// If you load LDR images through this interface, those images will\n// be promoted to floating point values, run through the inverse of\n// constants corresponding to the above:\n//\n// stbi_ldr_to_hdr_scale(1.0f);\n// stbi_ldr_to_hdr_gamma(2.2f);\n//\n// Finally, given a filename (or an open file or memory block--see header\n// file for details) containing image data, you can query for the \"most\n// appropriate\" interface to use (that is, whether the image is HDR or\n// not), using:\n//\n// stbi_is_hdr(char *filename);\n\n#ifndef STBI_NO_STDIO\n#include \n#endif\n\n#define STBI_VERSION 1\n\nenum\n{\n STBI_default = 0, // only used for req_comp\n\n STBI_grey = 1,\n STBI_grey_alpha = 2,\n STBI_rgb = 3,\n STBI_rgb_alpha = 4,\n};\n\ntypedef unsigned char stbi_uc;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// WRITING API\n\n#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO)\n// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding)\n// (you must include the appropriate extension in the filename).\n// returns TRUE on success, FALSE if couldn't open file, error writing file\nextern int stbi_write_bmp (char const *filename, int x, int y, int comp, void *data);\nextern int stbi_write_tga (char const *filename, int x, int y, int comp, void *data);\n#endif\n\n// PRIMARY API - works on images of any type\n\n// load image by filename, open file, or memory buffer\n#ifndef STBI_NO_STDIO\nextern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\nextern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\nextern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n// for stbi_load_from_file, file pointer is left pointing immediately after image\n\n#ifndef STBI_NO_HDR\n#ifndef STBI_NO_STDIO\nextern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\nextern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n\nextern void stbi_hdr_to_ldr_gamma(float gamma);\nextern void stbi_hdr_to_ldr_scale(float scale);\n\nextern void stbi_ldr_to_hdr_gamma(float gamma);\nextern void stbi_ldr_to_hdr_scale(float scale);\n\n#endif // STBI_NO_HDR\n\n// get a VERY brief reason for failure\n// NOT THREADSAFE\nextern char *stbi_failure_reason (void); \n\n// free the loaded image -- this is just free()\nextern void stbi_image_free (void *retval_from_stbi_load);\n\n// get image dimensions & components without fully decoding\nextern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\nextern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);\n#ifndef STBI_NO_STDIO\nextern int stbi_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_is_hdr (char const *filename);\nextern int stbi_is_hdr_from_file(FILE *f);\n#endif\n\n// ZLIB client - used by PNG, available for other purposes\n\nextern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);\nextern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);\nextern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);\n\nextern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);\nextern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);\n\n// TYPE-SPECIFIC ACCESS\n\n// is it a jpeg?\nextern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len);\nextern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\nextern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n#ifndef STBI_NO_STDIO\nextern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern int stbi_jpeg_test_file (FILE *f);\nextern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n\nextern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\n\n// is it a png?\nextern int stbi_png_test_memory (stbi_uc const *buffer, int len);\nextern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\nextern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n#ifndef STBI_NO_STDIO\nextern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern int stbi_png_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_png_test_file (FILE *f);\nextern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\nextern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\n\n// is it a bmp?\nextern int stbi_bmp_test_memory (stbi_uc const *buffer, int len);\n\nextern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n#ifndef STBI_NO_STDIO\nextern int stbi_bmp_test_file (FILE *f);\nextern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\n\n// is it a tga?\nextern int stbi_tga_test_memory (stbi_uc const *buffer, int len);\n\nextern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n#ifndef STBI_NO_STDIO\nextern int stbi_tga_test_file (FILE *f);\nextern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\n\n// is it a psd?\nextern int stbi_psd_test_memory (stbi_uc const *buffer, int len);\n\nextern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n#ifndef STBI_NO_STDIO\nextern int stbi_psd_test_file (FILE *f);\nextern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\n\n// is it an hdr?\nextern int stbi_hdr_test_memory (stbi_uc const *buffer, int len);\n\nextern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_hdr_load_rgbe (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n#ifndef STBI_NO_STDIO\nextern int stbi_hdr_test_file (FILE *f);\nextern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_hdr_load_rgbe_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\n\n// define new loaders\ntypedef struct\n{\n int (*test_memory)(stbi_uc const *buffer, int len);\n stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n #ifndef STBI_NO_STDIO\n int (*test_file)(FILE *f);\n stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp);\n #endif\n} stbi_loader;\n\n// register a loader by filling out the above structure (you must defined ALL functions)\n// returns 1 if added or already added, 0 if not added (too many loaders)\n// NOT THREADSAFE\nextern int stbi_register_loader(stbi_loader *loader);\n\n// define faster low-level operations (typically SIMD support)\n#if STBI_SIMD\ntypedef void (*stbi_idct_8x8)(uint8 *out, int out_stride, short data[64], unsigned short *dequantize);\n// compute an integer IDCT on \"input\"\n// input[x] = data[x] * dequantize[x]\n// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride'\n// CLAMP results to 0..255\ntypedef void (*stbi_YCbCr_to_RGB_run)(uint8 *output, uint8 const *y, uint8 const *cb, uint8 const *cr, int count, int step);\n// compute a conversion from YCbCr to RGB\n// 'count' pixels\n// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B\n// y: Y input channel\n// cb: Cb input channel; scale/biased to be 0..255\n// cr: Cr input channel; scale/biased to be 0..255\n\nextern void stbi_install_idct(stbi_idct_8x8 func);\nextern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func);\n#endif // STBI_SIMD\n\n#ifdef __cplusplus\n}\n#endif\n\n//\n//\n//// end header file /////////////////////////////////////////////////////\n#endif // STBI_INCLUDE_STB_IMAGE_H\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.371, "dedup_hash": "27d065943d690cc5", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_assimp", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Assimp", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/postprocessing/bumpmapping/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/assimp/DefaultLogger.hpp", "language": "code", "loc": 153, "comment_density": 0.699, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n/** @file DefaultLogger.hpp\n*/\n\n#ifndef INCLUDED_AI_DEFAULTLOGGER\n#define INCLUDED_AI_DEFAULTLOGGER\n\n#include \"Logger.hpp\"\n#include \"LogStream.hpp\"\n#include \"NullLogger.hpp\"\n#include \n\nnamespace Assimp {\n// ------------------------------------------------------------------------------------\nclass IOStream;\nstruct LogStreamInfo;\n\n/** default name of logfile */\n#define ASSIMP_DEFAULT_LOG_NAME \"AssimpLog.txt\"\n\n// ------------------------------------------------------------------------------------\n/** @brief CPP-API: Primary logging facility of Assimp.\n *\n * The library stores its primary #Logger as a static member of this class.\n * #get() returns this primary logger. By default the underlying implementation is\n * just a #NullLogger which rejects all log messages. By calling #create(), logging\n * is turned on. To capture the log output multiple log streams (#LogStream) can be\n * attach to the logger. Some default streams for common streaming locations (such as\n * a file, std::cout, OutputDebugString()) are also provided.\n *\n * If you wish to customize the logging at an even deeper level supply your own\n * implementation of #Logger to #set().\n * @note The whole logging stuff causes a small extra overhead for all imports. */\nclass ASSIMP_API DefaultLogger :\n public Logger {\n\npublic:\n\n // ----------------------------------------------------------------------\n /** @brief Creates a logging instance.\n * @param name Name for log file. Only valid in combination\n * with the aiDefaultLogStream_FILE flag.\n * @param severity Log severity, VERBOSE turns on debug messages\n * @param defStreams Default log streams to be attached. Any bitwise\n * combination of the aiDefaultLogStream enumerated values.\n * If #aiDefaultLogStream_FILE is specified but an empty string is\n * passed for 'name', no log file is created at all.\n * @param io IOSystem to be used to open external files (such as the\n * log file). Pass NULL to rely on the default implementation.\n * This replaces the default #NullLogger with a #DefaultLogger instance. */\n static Logger *create(const char* name = ASSIMP_DEFAULT_LOG_NAME,\n LogSeverity severity = NORMAL,\n unsigned int defStreams = aiDefaultLogStream_DEBUGGER | aiDefaultLogStream_FILE,\n IOSystem* io = NULL);\n\n // ----------------------------------------------------------------------\n /** @brief Setup a custom #Logger implementation.\n *\n * Use this if the provided #DefaultLogger class doesn't fit into\n * your needs. If the provided message formatting is OK for you,\n * it's much easier to use #create() and to attach your own custom\n * output streams to it.\n * @param logger Pass NULL to setup a default NullLogger*/\n static void set (Logger *logger);\n\n // ----------------------------------------------------------------------\n /** @brief Getter for singleton instance\n * @return Only instance. This is never null, but it could be a\n * NullLogger. Use isNullLogger to check this.*/\n static Logger *get();\n\n // ----------------------------------------------------------------------\n /** @brief Return whether a #NullLogger is currently active\n * @return true if the current logger is a #NullLogger.\n * Use create() or set() to setup a logger that does actually do\n * something else than just rejecting all log messages. */\n static bool isNullLogger();\n\n // ----------------------------------------------------------------------\n /** @brief Kills the current singleton logger and replaces it with a\n * #NullLogger instance. */\n static void kill();\n\n // ----------------------------------------------------------------------\n /** @copydoc Logger::attachStream */\n bool attachStream(LogStream *pStream,\n unsigned int severity);\n\n // ----------------------------------------------------------------------\n /** @copydoc Logger::detachStream */\n bool detachStream(LogStream *pStream,\n unsigned int severity);\n\n\nprivate:\n\n // ----------------------------------------------------------------------\n /** @briefPrivate construction for internal use by create().\n * @param severity Logging granularity */\n explicit DefaultLogger(LogSeverity severity);\n\n // ----------------------------------------------------------------------\n /** @briefDestructor */\n ~DefaultLogger();\n\nprivate:\n\n /** @brief Logs debug infos, only been written when severity level VERBOSE is set */\n void OnDebug(const char* message);\n\n /** @brief Logs an info message */\n void OnInfo(const char* message);\n\n /** @brief Logs a warning message */\n void OnWarn(const char* message);\n\n /** @brief Logs an error message */\n void OnError(const char* message);\n\n // ----------------------------------------------------------------------\n /** @brief Writes a message to all streams */\n void WriteToStreams(const char* message, ErrorSeverity ErrorSev );\n\n // ----------------------------------------------------------------------\n /** @brief Returns the thread id.\n * @note This is an OS specific feature, if not supported, a\n * zero will be returned.\n */\n unsigned int GetThreadID();\n\nprivate:\n // Aliases for stream container\n typedef std::vector StreamArray;\n typedef std::vector::iterator StreamIt;\n typedef std::vector::const_iterator ConstStreamIt;\n\n //! only logging instance\n static Logger *m_pLogger;\n static NullLogger s_pNullLogger;\n\n //! Attached streams\n StreamArray m_StreamArray;\n\n bool noRepeatMsg;\n char lastMsg[MAX_LOG_MESSAGE_LENGTH*2];\n size_t lastLen;\n};\n// ------------------------------------------------------------------------------------\n\n} // Namespace Assimp\n\n#endif // !! INCLUDED_AI_DEFAULTLOGGER\n"}, {"path": "includes/assimp/Exporter.hpp", "language": "code", "loc": 419, "comment_density": 0.749, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2011, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\ncopyright notice, this list of conditions and the\nfollowing disclaimer.\n\n* Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the\nfollowing disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\ncontributors may be used to endorse or promote products\nderived from this software without specific prior\nwritten permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file Exporter.hpp\n* @brief Defines the CPP-API for the Assimp export interface\n*/\n#ifndef AI_EXPORT_HPP_INC\n#define AI_EXPORT_HPP_INC\n\n#ifndef ASSIMP_BUILD_NO_EXPORT\n\n#include \"cexport.h\"\n#include \n\nnamespace Assimp {\n class ExporterPimpl;\n class IOSystem;\n\n\n// ----------------------------------------------------------------------------------\n/** CPP-API: The Exporter class forms an C++ interface to the export functionality\n * of the Open Asset Import Library. Note that the export interface is available\n * only if Assimp has been built with ASSIMP_BUILD_NO_EXPORT not defined.\n *\n * The interface is modelled after the importer interface and mostly\n * symmetric. The same rules for threading etc. apply.\n *\n * In a nutshell, there are two export interfaces: #Export, which writes the\n * output file(s) either to the regular file system or to a user-supplied\n * #IOSystem, and #ExportToBlob which returns a linked list of memory\n * buffers (blob), each referring to one output file (in most cases\n * there will be only one output file of course, but this extra complexity is\n * needed since Assimp aims at supporting a wide range of file formats).\n *\n * #ExportToBlob is especially useful if you intend to work\n * with the data in-memory.\n*/\n\nclass ASSIMP_API ExportProperties;\n\nclass ASSIMP_API Exporter\n // TODO: causes good ol' base class has no dll interface warning\n//#ifdef __cplusplus\n// : public boost::noncopyable\n//#endif // __cplusplus\n{\npublic:\n\n /** Function pointer type of a Export worker function */\n typedef void (*fpExportFunc)(const char*, IOSystem*, const aiScene*, const ExportProperties*);\n\n /** Internal description of an Assimp export format option */\n struct ExportFormatEntry\n {\n /// Public description structure to be returned by aiGetExportFormatDescription()\n aiExportFormatDesc mDescription;\n\n // Worker function to do the actual exporting\n fpExportFunc mExportFunction;\n\n // Postprocessing steps to be executed PRIOR to invoking mExportFunction\n unsigned int mEnforcePP;\n\n // Constructor to fill all entries\n ExportFormatEntry( const char* pId, const char* pDesc, const char* pExtension, fpExportFunc pFunction, unsigned int pEnforcePP = 0u)\n {\n mDescription.id = pId;\n mDescription.description = pDesc;\n mDescription.fileExtension = pExtension;\n mExportFunction = pFunction;\n mEnforcePP = pEnforcePP;\n }\n\n ExportFormatEntry() :\n mExportFunction()\n , mEnforcePP()\n {\n mDescription.id = NULL;\n mDescription.description = NULL;\n mDescription.fileExtension = NULL;\n }\n };\n\n\npublic:\n\n\n Exporter();\n ~Exporter();\n\npublic:\n\n\n // -------------------------------------------------------------------\n /** Supplies a custom IO handler to the exporter to use to open and\n * access files.\n *\n * If you need #Export to use custom IO logic to access the files,\n * you need to supply a custom implementation of IOSystem and\n * IOFile to the exporter.\n *\n * #Exporter takes ownership of the object and will destroy it\n * afterwards. The previously assigned handler will be deleted.\n * Pass NULL to take again ownership of your IOSystem and reset Assimp\n * to use its default implementation, which uses plain file IO.\n *\n * @param pIOHandler The IO handler to be used in all file accesses\n * of the Importer. */\n void SetIOHandler( IOSystem* pIOHandler);\n\n // -------------------------------------------------------------------\n /** Retrieves the IO handler that is currently set.\n * You can use #IsDefaultIOHandler() to check whether the returned\n * interface is the default IO handler provided by ASSIMP. The default\n * handler is active as long the application doesn't supply its own\n * custom IO handler via #SetIOHandler().\n * @return A valid IOSystem interface, never NULL. */\n IOSystem* GetIOHandler() const;\n\n // -------------------------------------------------------------------\n /** Checks whether a default IO handler is active\n * A default handler is active as long the application doesn't\n * supply its own custom IO handler via #SetIOHandler().\n * @return true by default */\n bool IsDefaultIOHandler() const;\n\n\n\n // -------------------------------------------------------------------\n /** Exports the given scene to a chosen file format. Returns the exported\n * data as a binary blob which you can write into a file or something.\n * When you're done with the data, simply let the #Exporter instance go\n * out of scope to have it released automatically.\n * @param pScene The scene to export. Stays in possession of the caller,\n * is not changed by the function.\n * @param pFormatId ID string to specify to which format you want to\n * export to. Use\n * #GetExportFormatCount / #GetExportFormatDescription to learn which\n * export formats are available.\n * @param pPreprocessing See the documentation for #Export\n * @return the exported data or NULL in case of error.\n * @note If the Exporter instance did already hold a blob from\n * a previous call to #ExportToBlob, it will be disposed.\n * Any IO handlers set via #SetIOHandler are ignored here.\n * @note Use aiCopyScene() to get a modifiable copy of a previously\n * imported scene. */\n const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);\n inline const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const std::string& pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);\n\n\n // -------------------------------------------------------------------\n /** Convenience function to export directly to a file. Use\n * #SetIOSystem to supply a custom IOSystem to gain fine-grained control\n * about the output data flow of the export process.\n * @param pBlob A data blob obtained from a previous call to #aiExportScene. Must not be NULL.\n * @param pPath Full target file name. Target must be accessible.\n * @param pPreprocessing Accepts any choice of the #aiPostProcessSteps enumerated\n * flags, but in reality only a subset of them makes sense here. Specifying\n * 'preprocessing' flags is useful if the input scene does not conform to\n * Assimp's default conventions as specified in the @link data Data Structures Page @endlink.\n * In short, this means the geometry data should use a right-handed coordinate systems, face\n * winding should be counter-clockwise and the UV coordinate origin is assumed to be in\n * the upper left. The #aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and\n * #aiProcess_FlipWindingOrder flags are used in the import side to allow users\n * to have those defaults automatically adapted to their conventions. Specifying those flags\n * for exporting has the opposite effect, respectively. Some other of the\n * #aiPostProcessSteps enumerated values may be useful as well, but you'll need\n * to try out what their effect on the exported file is. Many formats impose\n * their own restrictions on the structure of the geometry stored therein,\n * so some preprocessing may have little or no effect at all, or may be\n * redundant as exporters would apply them anyhow. A good example\n * is triangulation - whilst you can enforce it by specifying\n * the #aiProcess_Triangulate flag, most export formats support only\n * triangulate data so they would run the step even if it wasn't requested.\n *\n * If assimp detects that the input scene was directly taken from the importer side of\n * the library (i.e. not copied using aiCopyScene and potentially modified afterwards),\n * any postprocessing steps already applied to the scene will not be applied again, unless\n * they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and\n * #aiProcess_FlipWindingOrder).\n * @return AI_SUCCESS if everything was fine.\n * @note Use aiCopyScene() to get a modifiable copy of a previously\n * imported scene.*/\n aiReturn Export( const aiScene* pScene, const char* pFormatId, const char* pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);\n inline aiReturn Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);\n\n\n // -------------------------------------------------------------------\n /** Returns an error description of an error that occurred in #Export\n * or #ExportToBlob\n *\n * Returns an empty string if no error occurred.\n * @return A description of the last error, an empty string if no\n * error occurred. The string is never NULL.\n *\n * @note The returned function remains valid until one of the\n * following methods is called: #Export, #ExportToBlob, #FreeBlob */\n const char* GetErrorString() const;\n\n\n // -------------------------------------------------------------------\n /** Return the blob obtained from the last call to #ExportToBlob */\n const aiExportDataBlob* GetBlob() const;\n\n\n // -------------------------------------------------------------------\n /** Orphan the blob from the last call to #ExportToBlob. This means\n * the caller takes ownership and is thus responsible for calling\n * the C API function #aiReleaseExportBlob to release it. */\n const aiExportDataBlob* GetOrphanedBlob() const;\n\n\n // -------------------------------------------------------------------\n /** Frees the current blob.\n *\n * The function does nothing if no blob has previously been\n * previously produced via #ExportToBlob. #FreeBlob is called\n * automatically by the destructor. The only reason to call\n * it manually would be to reclaim as much storage as possible\n * without giving up the #Exporter instance yet. */\n void FreeBlob( );\n\n\n // -------------------------------------------------------------------\n /** Returns the number of export file formats available in the current\n * Assimp build. Use #Exporter::GetExportFormatDescription to\n * retrieve infos of a specific export format.\n *\n * This includes built-in exporters as well as exporters registered\n * using #RegisterExporter.\n **/\n size_t GetExportFormatCount() const;\n\n\n // -------------------------------------------------------------------\n /** Returns a description of the nth export file format. Use #\n * #Exporter::GetExportFormatCount to learn how many export\n * formats are supported.\n *\n * The returned pointer is of static storage duration iff the\n * pIndex pertains to a built-in exporter (i.e. one not registered\n * via #RegistrerExporter). It is restricted to the life-time of the\n * #Exporter instance otherwise.\n *\n * @param pIndex Index of the export format to retrieve information\n * for. Valid range is 0 to #Exporter::GetExportFormatCount\n * @return A description of that specific export format.\n * NULL if pIndex is out of range. */\n const aiExportFormatDesc* GetExportFormatDescription( size_t pIndex ) const;\n\n\n // -------------------------------------------------------------------\n /** Register a custom exporter. Custom export formats are limited to\n * to the current #Exporter instance and do not affect the\n * library globally. The indexes under which the format's\n * export format description can be queried are assigned\n * monotonously.\n * @param desc Exporter description.\n * @return aiReturn_SUCCESS if the export format was successfully\n * registered. A common cause that would prevent an exporter\n * from being registered is that its format id is already\n * occupied by another format. */\n aiReturn RegisterExporter(const ExportFormatEntry& desc);\n\n\n // -------------------------------------------------------------------\n /** Remove an export format previously registered with #RegisterExporter\n * from the #Exporter instance (this can also be used to drop\n * builtin exporters because those are implicitly registered\n * using #RegisterExporter).\n * @param id Format id to be unregistered, this refers to the\n * 'id' field of #aiExportFormatDesc.\n * @note Calling this method on a format description not yet registered\n * has no effect.*/\n void UnregisterExporter(const char* id);\n\n\nprotected:\n\n // Just because we don't want you to know how we're hacking around.\n ExporterPimpl* pimpl;\n};\n\n\nclass ASSIMP_API ExportProperties\n{\npublic:\n // Data type to store the key hash\n typedef unsigned int KeyType;\n\n // typedefs for our four configuration maps.\n // We don't need more, so there is no need for a generic solution\n typedef std::map IntPropertyMap;\n typedef std::map FloatPropertyMap;\n typedef std::map StringPropertyMap;\n typedef std::map MatrixPropertyMap;\n\npublic:\n\n /** Standard constructor\n * @see ExportProperties()\n */\n\n ExportProperties();\n\n // -------------------------------------------------------------------\n /** Copy constructor.\n *\n * This copies the configuration properties of another ExportProperties.\n * @see ExportProperties(const ExportProperties& other)\n */\n ExportProperties(const ExportProperties& other);\n\n // -------------------------------------------------------------------\n /** Set an integer configuration property.\n * @param szName Name of the property. All supported properties\n * are defined in the aiConfig.g header (all constants share the\n * prefix AI_CONFIG_XXX and are simple strings).\n * @param iValue New value of the property\n * @return true if the property was set before. The new value replaces\n * the previous value in this case.\n * @note Property of different types (float, int, string ..) are kept\n * on different stacks, so calling SetPropertyInteger() for a\n * floating-point property has no effect - the loader will call\n * GetPropertyFloat() to read the property, but it won't be there.\n */\n bool SetPropertyInteger(const char* szName, int iValue);\n\n // -------------------------------------------------------------------\n /** Set a boolean configuration property. Boolean properties\n * are stored on the integer stack internally so it's possible\n * to set them via #SetPropertyBool and query them with\n * #GetPropertyBool and vice versa.\n * @see SetPropertyInteger()\n */\n bool SetPropertyBool(const char* szName, bool value) {\n return SetPropertyInteger(szName,value);\n }\n\n // -------------------------------------------------------------------\n /** Set a floating-point configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyFloat(const char* szName, float fValue);\n\n // -------------------------------------------------------------------\n /** Set a string configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyString(const char* szName, const std::string& sValue);\n\n // -------------------------------------------------------------------\n /** Set a matrix configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue);\n\n // -------------------------------------------------------------------\n /** Get a configuration property.\n * @param szName Name of the property. All supported properties\n * are defined in the aiConfig.g header (all constants share the\n * prefix AI_CONFIG_XXX).\n * @param iErrorReturn Value that is returned if the property\n * is not found.\n * @return Current value of the property\n * @note Property of different types (float, int, string ..) are kept\n * on different lists, so calling SetPropertyInteger() for a\n * floating-point property has no effect - the loader will call\n * GetPropertyFloat() to read the property, but it won't be there.\n */\n int GetPropertyInteger(const char* szName,\n int iErrorReturn = 0xffffffff) const;\n\n // -------------------------------------------------------------------\n /** Get a boolean configuration property. Boolean properties\n * are stored on the integer stack internally so it's possible\n * to set them via #SetPropertyBool and query them with\n * #GetPropertyBool and vice versa.\n * @see GetPropertyInteger()\n */\n bool GetPropertyBool(const char* szName, bool bErrorReturn = false) const {\n return GetPropertyInteger(szName,bErrorReturn)!=0;\n }\n\n // -------------------------------------------------------------------\n /** Get a floating-point configuration property\n * @see GetPropertyInteger()\n */\n float GetPropertyFloat(const char* szName,\n float fErrorReturn = 10e10f) const;\n\n // -------------------------------------------------------------------\n /** Get a string configuration property\n *\n * The return value remains valid until the property is modified.\n * @see GetPropertyInteger()\n */\n const std::string GetPropertyString(const char* szName,\n const std::string& sErrorReturn = \"\") const;\n\n // -------------------------------------------------------------------\n /** Get a matrix configuration property\n *\n * The return value remains valid until the property is modified.\n * @see GetPropertyInteger()\n */\n const aiMatrix4x4 GetPropertyMatrix(const char* szName,\n const aiMatrix4x4& sErrorReturn = aiMatrix4x4()) const;\n\n // -------------------------------------------------------------------\n /** Determine a integer configuration property has been set.\n * @see HasPropertyInteger()\n */\n bool HasPropertyInteger(const char* szName) const;\n\n /** Determine a boolean configuration property has been set.\n * @see HasPropertyBool()\n */\n bool HasPropertyBool(const char* szName) const;\n\n /** Determine a boolean configuration property has been set.\n * @see HasPropertyFloat()\n */\n bool HasPropertyFloat(const char* szName) const;\n\n /** Determine a String configuration property has been set.\n * @see HasPropertyString()\n */\n bool HasPropertyString(const char* szName) const;\n\n /** Determine a Matrix configuration property has been set.\n * @see HasPropertyMatrix()\n */\n bool HasPropertyMatrix(const char* szName) const;\n\nprotected:\n\n /** List of integer properties */\n IntPropertyMap mIntProperties;\n\n /** List of floating-point properties */\n FloatPropertyMap mFloatProperties;\n\n /** List of string properties */\n StringPropertyMap mStringProperties;\n\n /** List of Matrix properties */\n MatrixPropertyMap mMatrixProperties;\n};\n\n\n// ----------------------------------------------------------------------------------\ninline const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const std::string& pFormatId,unsigned int pPreprocessing, const ExportProperties* pProperties)\n{\n return ExportToBlob(pScene,pFormatId.c_str(),pPreprocessing, pProperties);\n}\n\n// ----------------------------------------------------------------------------------\ninline aiReturn Exporter :: Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing, const ExportProperties* pProperties)\n{\n return Export(pScene,pFormatId.c_str(),pPath.c_str(),pPreprocessing, pProperties);\n}\n\n} // namespace Assimp\n#endif // ASSIMP_BUILD_NO_EXPORT\n#endif // AI_EXPORT_HPP_INC\n"}, {"path": "includes/assimp/IOStream.hpp", "language": "code", "loc": 116, "comment_density": 0.707, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file IOStream.hpp\n * @brief File I/O wrappers for C++.\n */\n\n#ifndef AI_IOSTREAM_H_INC\n#define AI_IOSTREAM_H_INC\n\n#include \"types.h\"\n\n#ifndef __cplusplus\n# error This header requires C++ to be used. aiFileIO.h is the \\\n corresponding C interface.\n#endif\n\nnamespace Assimp {\n\n// ----------------------------------------------------------------------------------\n/** @brief CPP-API: Class to handle file I/O for C++\n *\n * Derive an own implementation from this interface to provide custom IO handling\n * to the Importer. If you implement this interface, be sure to also provide an\n * implementation for IOSystem that creates instances of your custom IO class.\n*/\nclass ASSIMP_API IOStream\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\nprotected:\n /** Constructor protected, use IOSystem::Open() to create an instance. */\n IOStream(void);\n\npublic:\n // -------------------------------------------------------------------\n /** @brief Destructor. Deleting the object closes the underlying file,\n * alternatively you may use IOSystem::Close() to release the file.\n */\n virtual ~IOStream();\n\n // -------------------------------------------------------------------\n /** @brief Read from the file\n *\n * See fread() for more details\n * This fails for write-only files */\n virtual size_t Read(void* pvBuffer,\n size_t pSize,\n size_t pCount) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Write to the file\n *\n * See fwrite() for more details\n * This fails for read-only files */\n virtual size_t Write(const void* pvBuffer,\n size_t pSize,\n size_t pCount) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Set the read/write cursor of the file\n *\n * Note that the offset is _negative_ for aiOrigin_END.\n * See fseek() for more details */\n virtual aiReturn Seek(size_t pOffset,\n aiOrigin pOrigin) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Get the current position of the read/write cursor\n *\n * See ftell() for more details */\n virtual size_t Tell() const = 0;\n\n // -------------------------------------------------------------------\n /** @brief Returns filesize\n * Returns the filesize. */\n virtual size_t FileSize() const = 0;\n\n // -------------------------------------------------------------------\n /** @brief Flush the contents of the file buffer (for writers)\n * See fflush() for more details.\n */\n virtual void Flush() = 0;\n}; //! class IOStream\n\n// ----------------------------------------------------------------------------------\ninline IOStream::IOStream()\n{\n // empty\n}\n\n// ----------------------------------------------------------------------------------\ninline IOStream::~IOStream()\n{\n // empty\n}\n// ----------------------------------------------------------------------------------\n} //!namespace Assimp\n\n#endif //!!AI_IOSTREAM_H_INC\n"}, {"path": "includes/assimp/IOSystem.hpp", "language": "code", "loc": 242, "comment_density": 0.657, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file IOSystem.hpp\n * @brief File system wrapper for C++. Inherit this class to supply\n * custom file handling logic to the Import library.\n*/\n\n#ifndef AI_IOSYSTEM_H_INC\n#define AI_IOSYSTEM_H_INC\n\n#ifndef __cplusplus\n# error This header requires C++ to be used. aiFileIO.h is the \\\n corresponding C interface.\n#endif\n\n#include \"types.h\"\n\n#include \n\nnamespace Assimp {\nclass IOStream;\n\n// ---------------------------------------------------------------------------\n/** @brief CPP-API: Interface to the file system.\n *\n * Derive an own implementation from this interface to supply custom file handling\n * to the importer library. If you implement this interface, you also want to\n * supply a custom implementation for IOStream.\n *\n * @see Importer::SetIOHandler() */\nclass ASSIMP_API IOSystem\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\npublic:\n\n // -------------------------------------------------------------------\n /** @brief Default constructor.\n *\n * Create an instance of your derived class and assign it to an\n * #Assimp::Importer instance by calling Importer::SetIOHandler().\n */\n IOSystem();\n\n // -------------------------------------------------------------------\n /** @brief Virtual destructor.\n *\n * It is safe to be called from within DLL Assimp, we're constructed\n * on Assimp's heap.\n */\n virtual ~IOSystem();\n\n\npublic:\n\n // -------------------------------------------------------------------\n /** @brief For backward compatibility\n * @see Exists(const char*)\n */\n AI_FORCE_INLINE bool Exists( const std::string& pFile) const;\n\n // -------------------------------------------------------------------\n /** @brief Tests for the existence of a file at the given path.\n *\n * @param pFile Path to the file\n * @return true if there is a file with this path, else false.\n */\n virtual bool Exists( const char* pFile) const = 0;\n\n // -------------------------------------------------------------------\n /** @brief Returns the system specific directory separator\n * @return System specific directory separator\n */\n virtual char getOsSeparator() const = 0;\n\n // -------------------------------------------------------------------\n /** @brief Open a new file with a given path.\n *\n * When the access to the file is finished, call Close() to release\n * all associated resources (or the virtual dtor of the IOStream).\n *\n * @param pFile Path to the file\n * @param pMode Desired file I/O mode. Required are: \"wb\", \"w\", \"wt\",\n * \"rb\", \"r\", \"rt\".\n *\n * @return New IOStream interface allowing the lib to access\n * the underlying file.\n * @note When implementing this class to provide custom IO handling,\n * you probably have to supply an own implementation of IOStream as well.\n */\n virtual IOStream* Open(const char* pFile,\n const char* pMode = \"rb\") = 0;\n\n // -------------------------------------------------------------------\n /** @brief For backward compatibility\n * @see Open(const char*, const char*)\n */\n inline IOStream* Open(const std::string& pFile,\n const std::string& pMode = std::string(\"rb\"));\n\n // -------------------------------------------------------------------\n /** @brief Closes the given file and releases all resources\n * associated with it.\n * @param pFile The file instance previously created by Open().\n */\n virtual void Close( IOStream* pFile) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Compares two paths and check whether the point to\n * identical files.\n *\n * The dummy implementation of this virtual member performs a\n * case-insensitive comparison of the given strings. The default IO\n * system implementation uses OS mechanisms to convert relative into\n * absolute paths, so the result can be trusted.\n * @param one First file\n * @param second Second file\n * @return true if the paths point to the same file. The file needn't\n * be existing, however.\n */\n virtual bool ComparePaths (const char* one,\n const char* second) const;\n\n // -------------------------------------------------------------------\n /** @brief For backward compatibility\n * @see ComparePaths(const char*, const char*)\n */\n inline bool ComparePaths (const std::string& one,\n const std::string& second) const;\n\n // -------------------------------------------------------------------\n /** @brief Pushes a new directory onto the directory stack.\n * @param path Path to push onto the stack.\n * @return True, when push was successful, false if path is empty.\n */\n virtual bool PushDirectory( const std::string &path );\n\n // -------------------------------------------------------------------\n /** @brief Returns the top directory from the stack.\n * @return The directory on the top of the stack.\n * Returns empty when no directory was pushed to the stack.\n */\n virtual const std::string &CurrentDirectory() const;\n\n // -------------------------------------------------------------------\n /** @brief Returns the number of directories stored on the stack.\n * @return The number of directories of the stack.\n */\n virtual size_t StackSize() const;\n\n // -------------------------------------------------------------------\n /** @brief Pops the top directory from the stack.\n * @return True, when a directory was on the stack. False if no\n * directory was on the stack.\n */\n virtual bool PopDirectory();\n\nprivate:\n std::vector m_pathStack;\n};\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE IOSystem::IOSystem() :\n m_pathStack()\n{\n // empty\n}\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE IOSystem::~IOSystem()\n{\n // empty\n}\n\n// ----------------------------------------------------------------------------\n// For compatibility, the interface of some functions taking a std::string was\n// changed to const char* to avoid crashes between binary incompatible STL\n// versions. This code her is inlined, so it shouldn't cause any problems.\n// ----------------------------------------------------------------------------\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE IOStream* IOSystem::Open(const std::string& pFile,\n const std::string& pMode)\n{\n // NOTE:\n // For compatibility, interface was changed to const char* to\n // avoid crashes between binary incompatible STL versions\n return Open(pFile.c_str(),pMode.c_str());\n}\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE bool IOSystem::Exists( const std::string& pFile) const\n{\n // NOTE:\n // For compatibility, interface was changed to const char* to\n // avoid crashes between binary incompatible STL versions\n return Exists(pFile.c_str());\n}\n\n// ----------------------------------------------------------------------------\ninline bool IOSystem::ComparePaths (const std::string& one,\n const std::string& second) const\n{\n // NOTE:\n // For compatibility, interface was changed to const char* to\n // avoid crashes between binary incompatible STL versions\n return ComparePaths(one.c_str(),second.c_str());\n}\n\n// ----------------------------------------------------------------------------\ninline bool IOSystem::PushDirectory( const std::string &path ) {\n if ( path.empty() ) {\n return false;\n }\n\n m_pathStack.push_back( path );\n\n return true;\n}\n\n// ----------------------------------------------------------------------------\ninline const std::string &IOSystem::CurrentDirectory() const {\n if ( m_pathStack.empty() ) {\n static const std::string Dummy(\"\");\n return Dummy;\n }\n return m_pathStack[ m_pathStack.size()-1 ];\n}\n\n// ----------------------------------------------------------------------------\ninline size_t IOSystem::StackSize() const {\n return m_pathStack.size();\n}\n\n// ----------------------------------------------------------------------------\ninline bool IOSystem::PopDirectory() {\n if ( m_pathStack.empty() ) {\n return false;\n }\n\n m_pathStack.pop_back();\n\n return true;\n}\n\n// ----------------------------------------------------------------------------\n\n} //!ns Assimp\n\n#endif //AI_IOSYSTEM_H_INC\n"}, {"path": "includes/assimp/Importer.hpp", "language": "code", "loc": 582, "comment_density": 0.828, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file Importer.hpp\n * @brief Defines the C++-API to the Open Asset Import Library.\n */\n#ifndef INCLUDED_AI_ASSIMP_HPP\n#define INCLUDED_AI_ASSIMP_HPP\n\n#ifndef __cplusplus\n# error This header requires C++ to be used. Use assimp.h for plain C.\n#endif\n\n// Public ASSIMP data structures\n#include \"types.h\"\n#include \"config.h\"\n\nnamespace Assimp {\n // =======================================================================\n // Public interface to Assimp\n class Importer;\n class Exporter; // export.hpp\n class IOStream;\n class IOSystem;\n class ProgressHandler;\n\n // =======================================================================\n // Plugin development\n //\n // Include the following headers for the declarations:\n // BaseImporter.h\n // BaseProcess.h\n class BaseImporter;\n class BaseProcess;\n class SharedPostProcessInfo;\n class BatchLoader;\n\n // =======================================================================\n // Holy stuff, only for members of the high council of the Jedi.\n class ImporterPimpl;\n class ExporterPimpl; // export.hpp\n} //! namespace Assimp\n\n#define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff\n\nstruct aiScene;\n\n// importerdesc.h\nstruct aiImporterDesc;\n\n/** @namespace Assimp Assimp's CPP-API and all internal APIs */\nnamespace Assimp {\n\n// ----------------------------------------------------------------------------------\n/** CPP-API: The Importer class forms an C++ interface to the functionality of the\n* Open Asset Import Library.\n*\n* Create an object of this class and call ReadFile() to import a file.\n* If the import succeeds, the function returns a pointer to the imported data.\n* The data remains property of the object, it is intended to be accessed\n* read-only. The imported data will be destroyed along with the Importer\n* object. If the import fails, ReadFile() returns a NULL pointer. In this\n* case you can retrieve a human-readable error description be calling\n* GetErrorString(). You can call ReadFile() multiple times with a single Importer\n* instance. Actually, constructing Importer objects involves quite many\n* allocations and may take some time, so it's better to reuse them as often as\n* possible.\n*\n* If you need the Importer to do custom file handling to access the files,\n* implement IOSystem and IOStream and supply an instance of your custom\n* IOSystem implementation by calling SetIOHandler() before calling ReadFile().\n* If you do not assign a custom IO handler, a default handler using the\n* standard C++ IO logic will be used.\n*\n* @note One Importer instance is not thread-safe. If you use multiple\n* threads for loading, each thread should maintain its own Importer instance.\n*/\nclass ASSIMP_API Importer {\npublic:\n /**\n * @brief The upper limit for hints.\n */\n static const unsigned int MaxLenHint = 200; \n\npublic:\n\n // -------------------------------------------------------------------\n /** Constructor. Creates an empty importer object.\n *\n * Call ReadFile() to start the import process. The configuration\n * property table is initially empty.\n */\n Importer();\n\n // -------------------------------------------------------------------\n /** Copy constructor.\n *\n * This copies the configuration properties of another Importer.\n * If this Importer owns a scene it won't be copied.\n * Call ReadFile() to start the import process.\n */\n Importer(const Importer& other);\n\n // -------------------------------------------------------------------\n /** Destructor. The object kept ownership of the imported data,\n * which now will be destroyed along with the object.\n */\n ~Importer();\n\n\n // -------------------------------------------------------------------\n /** Registers a new loader.\n *\n * @param pImp Importer to be added. The Importer instance takes\n * ownership of the pointer, so it will be automatically deleted\n * with the Importer instance.\n * @return AI_SUCCESS if the loader has been added. The registration\n * fails if there is already a loader for a specific file extension.\n */\n aiReturn RegisterLoader(BaseImporter* pImp);\n\n // -------------------------------------------------------------------\n /** Unregisters a loader.\n *\n * @param pImp Importer to be unregistered.\n * @return AI_SUCCESS if the loader has been removed. The function\n * fails if the loader is currently in use (this could happen\n * if the #Importer instance is used by more than one thread) or\n * if it has not yet been registered.\n */\n aiReturn UnregisterLoader(BaseImporter* pImp);\n\n // -------------------------------------------------------------------\n /** Registers a new post-process step.\n *\n * At the moment, there's a small limitation: new post processing\n * steps are added to end of the list, or in other words, executed\n * last, after all built-in steps.\n * @param pImp Post-process step to be added. The Importer instance\n * takes ownership of the pointer, so it will be automatically\n * deleted with the Importer instance.\n * @return AI_SUCCESS if the step has been added correctly.\n */\n aiReturn RegisterPPStep(BaseProcess* pImp);\n\n // -------------------------------------------------------------------\n /** Unregisters a post-process step.\n *\n * @param pImp Step to be unregistered.\n * @return AI_SUCCESS if the step has been removed. The function\n * fails if the step is currently in use (this could happen\n * if the #Importer instance is used by more than one thread) or\n * if it has not yet been registered.\n */\n aiReturn UnregisterPPStep(BaseProcess* pImp);\n\n\n // -------------------------------------------------------------------\n /** Set an integer configuration property.\n * @param szName Name of the property. All supported properties\n * are defined in the aiConfig.g header (all constants share the\n * prefix AI_CONFIG_XXX and are simple strings).\n * @param iValue New value of the property\n * @return true if the property was set before. The new value replaces\n * the previous value in this case.\n * @note Property of different types (float, int, string ..) are kept\n * on different stacks, so calling SetPropertyInteger() for a\n * floating-point property has no effect - the loader will call\n * GetPropertyFloat() to read the property, but it won't be there.\n */\n bool SetPropertyInteger(const char* szName, int iValue);\n\n // -------------------------------------------------------------------\n /** Set a boolean configuration property. Boolean properties\n * are stored on the integer stack internally so it's possible\n * to set them via #SetPropertyBool and query them with\n * #GetPropertyBool and vice versa.\n * @see SetPropertyInteger()\n */\n bool SetPropertyBool(const char* szName, bool value) {\n return SetPropertyInteger(szName,value);\n }\n\n // -------------------------------------------------------------------\n /** Set a floating-point configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyFloat(const char* szName, float fValue);\n\n // -------------------------------------------------------------------\n /** Set a string configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyString(const char* szName, const std::string& sValue);\n\n // -------------------------------------------------------------------\n /** Set a matrix configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue);\n\n // -------------------------------------------------------------------\n /** Get a configuration property.\n * @param szName Name of the property. All supported properties\n * are defined in the aiConfig.g header (all constants share the\n * prefix AI_CONFIG_XXX).\n * @param iErrorReturn Value that is returned if the property\n * is not found.\n * @return Current value of the property\n * @note Property of different types (float, int, string ..) are kept\n * on different lists, so calling SetPropertyInteger() for a\n * floating-point property has no effect - the loader will call\n * GetPropertyFloat() to read the property, but it won't be there.\n */\n int GetPropertyInteger(const char* szName,\n int iErrorReturn = 0xffffffff) const;\n\n // -------------------------------------------------------------------\n /** Get a boolean configuration property. Boolean properties\n * are stored on the integer stack internally so it's possible\n * to set them via #SetPropertyBool and query them with\n * #GetPropertyBool and vice versa.\n * @see GetPropertyInteger()\n */\n bool GetPropertyBool(const char* szName, bool bErrorReturn = false) const {\n return GetPropertyInteger(szName,bErrorReturn)!=0;\n }\n\n // -------------------------------------------------------------------\n /** Get a floating-point configuration property\n * @see GetPropertyInteger()\n */\n float GetPropertyFloat(const char* szName,\n float fErrorReturn = 10e10f) const;\n\n // -------------------------------------------------------------------\n /** Get a string configuration property\n *\n * The return value remains valid until the property is modified.\n * @see GetPropertyInteger()\n */\n const std::string GetPropertyString(const char* szName,\n const std::string& sErrorReturn = \"\") const;\n\n // -------------------------------------------------------------------\n /** Get a matrix configuration property\n *\n * The return value remains valid until the property is modified.\n * @see GetPropertyInteger()\n */\n const aiMatrix4x4 GetPropertyMatrix(const char* szName,\n const aiMatrix4x4& sErrorReturn = aiMatrix4x4()) const;\n\n // -------------------------------------------------------------------\n /** Supplies a custom IO handler to the importer to use to open and\n * access files. If you need the importer to use custom IO logic to\n * access the files, you need to provide a custom implementation of\n * IOSystem and IOFile to the importer. Then create an instance of\n * your custom IOSystem implementation and supply it by this function.\n *\n * The Importer takes ownership of the object and will destroy it\n * afterwards. The previously assigned handler will be deleted.\n * Pass NULL to take again ownership of your IOSystem and reset Assimp\n * to use its default implementation.\n *\n * @param pIOHandler The IO handler to be used in all file accesses\n * of the Importer.\n */\n void SetIOHandler( IOSystem* pIOHandler);\n\n // -------------------------------------------------------------------\n /** Retrieves the IO handler that is currently set.\n * You can use #IsDefaultIOHandler() to check whether the returned\n * interface is the default IO handler provided by ASSIMP. The default\n * handler is active as long the application doesn't supply its own\n * custom IO handler via #SetIOHandler().\n * @return A valid IOSystem interface, never NULL.\n */\n IOSystem* GetIOHandler() const;\n\n // -------------------------------------------------------------------\n /** Checks whether a default IO handler is active\n * A default handler is active as long the application doesn't\n * supply its own custom IO handler via #SetIOHandler().\n * @return true by default\n */\n bool IsDefaultIOHandler() const;\n\n // -------------------------------------------------------------------\n /** Supplies a custom progress handler to the importer. This\n * interface exposes a #Update() callback, which is called\n * more or less periodically (please don't sue us if it\n * isn't as periodically as you'd like it to have ...).\n * This can be used to implement progress bars and loading\n * timeouts.\n * @param pHandler Progress callback interface. Pass NULL to\n * disable progress reporting.\n * @note Progress handlers can be used to abort the loading\n * at almost any time.*/\n void SetProgressHandler ( ProgressHandler* pHandler );\n\n // -------------------------------------------------------------------\n /** Retrieves the progress handler that is currently set.\n * You can use #IsDefaultProgressHandler() to check whether the returned\n * interface is the default handler provided by ASSIMP. The default\n * handler is active as long the application doesn't supply its own\n * custom handler via #SetProgressHandler().\n * @return A valid ProgressHandler interface, never NULL.\n */\n ProgressHandler* GetProgressHandler() const;\n\n // -------------------------------------------------------------------\n /** Checks whether a default progress handler is active\n * A default handler is active as long the application doesn't\n * supply its own custom progress handler via #SetProgressHandler().\n * @return true by default\n */\n bool IsDefaultProgressHandler() const;\n\n // -------------------------------------------------------------------\n /** @brief Check whether a given set of postprocessing flags\n * is supported.\n *\n * Some flags are mutually exclusive, others are probably\n * not available because your excluded them from your\n * Assimp builds. Calling this function is recommended if\n * you're unsure.\n *\n * @param pFlags Bitwise combination of the aiPostProcess flags.\n * @return true if this flag combination is fine.\n */\n bool ValidateFlags(unsigned int pFlags) const;\n\n // -------------------------------------------------------------------\n /** Reads the given file and returns its contents if successful.\n *\n * If the call succeeds, the contents of the file are returned as a\n * pointer to an aiScene object. The returned data is intended to be\n * read-only, the importer object keeps ownership of the data and will\n * destroy it upon destruction. If the import fails, NULL is returned.\n * A human-readable error description can be retrieved by calling\n * GetErrorString(). The previous scene will be deleted during this call.\n * @param pFile Path and filename to the file to be imported.\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags. If you wish to inspect the imported\n * scene first in order to fine-tune your post-processing setup,\n * consider to use #ApplyPostProcessing().\n * @return A pointer to the imported data, NULL if the import failed.\n * The pointer to the scene remains in possession of the Importer\n * instance. Use GetOrphanedScene() to take ownership of it.\n *\n * @note Assimp is able to determine the file format of a file\n * automatically.\n */\n const aiScene* ReadFile(\n const char* pFile,\n unsigned int pFlags);\n\n // -------------------------------------------------------------------\n /** Reads the given file from a memory buffer and returns its\n * contents if successful.\n *\n * If the call succeeds, the contents of the file are returned as a\n * pointer to an aiScene object. The returned data is intended to be\n * read-only, the importer object keeps ownership of the data and will\n * destroy it upon destruction. If the import fails, NULL is returned.\n * A human-readable error description can be retrieved by calling\n * GetErrorString(). The previous scene will be deleted during this call.\n * Calling this method doesn't affect the active IOSystem.\n * @param pBuffer Pointer to the file data\n * @param pLength Length of pBuffer, in bytes\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags. If you wish to inspect the imported\n * scene first in order to fine-tune your post-processing setup,\n * consider to use #ApplyPostProcessing().\n * @param pHint An additional hint to the library. If this is a non\n * empty string, the library looks for a loader to support\n * the file extension specified by pHint and passes the file to\n * the first matching loader. If this loader is unable to completely\n * the request, the library continues and tries to determine the\n * file format on its own, a task that may or may not be successful.\n * Check the return value, and you'll know ...\n * @return A pointer to the imported data, NULL if the import failed.\n * The pointer to the scene remains in possession of the Importer\n * instance. Use GetOrphanedScene() to take ownership of it.\n *\n * @note This is a straightforward way to decode models from memory\n * buffers, but it doesn't handle model formats that spread their\n * data across multiple files or even directories. Examples include\n * OBJ or MD3, which outsource parts of their material info into\n * external scripts. If you need full functionality, provide\n * a custom IOSystem to make Assimp find these files and use\n * the regular ReadFile() API.\n */\n const aiScene* ReadFileFromMemory(\n const void* pBuffer,\n size_t pLength,\n unsigned int pFlags,\n const char* pHint = \"\");\n\n // -------------------------------------------------------------------\n /** Apply post-processing to an already-imported scene.\n *\n * This is strictly equivalent to calling #ReadFile() with the same\n * flags. However, you can use this separate function to inspect\n * the imported scene first to fine-tune your post-processing setup.\n * @param pFlags Provide a bitwise combination of the\n * #aiPostProcessSteps flags.\n * @return A pointer to the post-processed data. This is still the\n * same as the pointer returned by #ReadFile(). However, if\n * post-processing fails, the scene could now be NULL.\n * That's quite a rare case, post processing steps are not really\n * designed to 'fail'. To be exact, the #aiProcess_ValidateDS\n * flag is currently the only post processing step which can actually\n * cause the scene to be reset to NULL.\n *\n * @note The method does nothing if no scene is currently bound\n * to the #Importer instance. */\n const aiScene* ApplyPostProcessing(unsigned int pFlags);\n\n const aiScene* ApplyCustomizedPostProcessing( BaseProcess *rootProcess, bool requestValidation );\n\n // -------------------------------------------------------------------\n /** @brief Reads the given file and returns its contents if successful.\n *\n * This function is provided for backward compatibility.\n * See the const char* version for detailed docs.\n * @see ReadFile(const char*, pFlags) */\n const aiScene* ReadFile(\n const std::string& pFile,\n unsigned int pFlags);\n\n // -------------------------------------------------------------------\n /** Frees the current scene.\n *\n * The function does nothing if no scene has previously been\n * read via ReadFile(). FreeScene() is called automatically by the\n * destructor and ReadFile() itself. */\n void FreeScene( );\n\n // -------------------------------------------------------------------\n /** Returns an error description of an error that occurred in ReadFile().\n *\n * Returns an empty string if no error occurred.\n * @return A description of the last error, an empty string if no\n * error occurred. The string is never NULL.\n *\n * @note The returned function remains valid until one of the\n * following methods is called: #ReadFile(), #FreeScene(). */\n const char* GetErrorString() const;\n\n // -------------------------------------------------------------------\n /** Returns the scene loaded by the last successful call to ReadFile()\n *\n * @return Current scene or NULL if there is currently no scene loaded */\n const aiScene* GetScene() const;\n\n // -------------------------------------------------------------------\n /** Returns the scene loaded by the last successful call to ReadFile()\n * and releases the scene from the ownership of the Importer\n * instance. The application is now responsible for deleting the\n * scene. Any further calls to GetScene() or GetOrphanedScene()\n * will return NULL - until a new scene has been loaded via ReadFile().\n *\n * @return Current scene or NULL if there is currently no scene loaded\n * @note Use this method with maximal caution, and only if you have to.\n * By design, aiScene's are exclusively maintained, allocated and\n * deallocated by Assimp and no one else. The reasoning behind this\n * is the golden rule that deallocations should always be done\n * by the module that did the original allocation because heaps\n * are not necessarily shared. GetOrphanedScene() enforces you\n * to delete the returned scene by yourself, but this will only\n * be fine if and only if you're using the same heap as assimp.\n * On Windows, it's typically fine provided everything is linked\n * against the multithreaded-dll version of the runtime library.\n * It will work as well for static linkage with Assimp.*/\n aiScene* GetOrphanedScene();\n\n\n\n\n // -------------------------------------------------------------------\n /** Returns whether a given file extension is supported by ASSIMP.\n *\n * @param szExtension Extension to be checked.\n * Must include a trailing dot '.'. Example: \".3ds\", \".md3\".\n * Cases-insensitive.\n * @return true if the extension is supported, false otherwise */\n bool IsExtensionSupported(const char* szExtension) const;\n\n // -------------------------------------------------------------------\n /** @brief Returns whether a given file extension is supported by ASSIMP.\n *\n * This function is provided for backward compatibility.\n * See the const char* version for detailed and up-to-date docs.\n * @see IsExtensionSupported(const char*) */\n inline bool IsExtensionSupported(const std::string& szExtension) const;\n\n // -------------------------------------------------------------------\n /** Get a full list of all file extensions supported by ASSIMP.\n *\n * If a file extension is contained in the list this does of course not\n * mean that ASSIMP is able to load all files with this extension ---\n * it simply means there is an importer loaded which claims to handle\n * files with this file extension.\n * @param szOut String to receive the extension list.\n * Format of the list: \"*.3ds;*.obj;*.dae\". This is useful for\n * use with the WinAPI call GetOpenFileName(Ex). */\n void GetExtensionList(aiString& szOut) const;\n\n // -------------------------------------------------------------------\n /** @brief Get a full list of all file extensions supported by ASSIMP.\n *\n * This function is provided for backward compatibility.\n * See the aiString version for detailed and up-to-date docs.\n * @see GetExtensionList(aiString&)*/\n inline void GetExtensionList(std::string& szOut) const;\n\n // -------------------------------------------------------------------\n /** Get the number of imports currently registered with Assimp. */\n size_t GetImporterCount() const;\n\n // -------------------------------------------------------------------\n /** Get meta data for the importer corresponding to a specific index..\n *\n * For the declaration of #aiImporterDesc, include .\n * @param index Index to query, must be within [0,GetImporterCount())\n * @return Importer meta data structure, NULL if the index does not\n * exist or if the importer doesn't offer meta information (\n * importers may do this at the cost of being hated by their peers).*/\n const aiImporterDesc* GetImporterInfo(size_t index) const;\n\n // -------------------------------------------------------------------\n /** Find the importer corresponding to a specific index.\n *\n * @param index Index to query, must be within [0,GetImporterCount())\n * @return Importer instance. NULL if the index does not\n * exist. */\n BaseImporter* GetImporter(size_t index) const;\n\n // -------------------------------------------------------------------\n /** Find the importer corresponding to a specific file extension.\n *\n * This is quite similar to #IsExtensionSupported except a\n * BaseImporter instance is returned.\n * @param szExtension Extension to check for. The following formats\n * are recognized (BAH being the file extension): \"BAH\" (comparison\n * is case-insensitive), \".bah\", \"*.bah\" (wild card and dot\n * characters at the beginning of the extension are skipped).\n * @return NULL if no importer is found*/\n BaseImporter* GetImporter (const char* szExtension) const;\n\n // -------------------------------------------------------------------\n /** Find the importer index corresponding to a specific file extension.\n *\n * @param szExtension Extension to check for. The following formats\n * are recognized (BAH being the file extension): \"BAH\" (comparison\n * is case-insensitive), \".bah\", \"*.bah\" (wild card and dot\n * characters at the beginning of the extension are skipped).\n * @return (size_t)-1 if no importer is found */\n size_t GetImporterIndex (const char* szExtension) const;\n\n\n\n\n // -------------------------------------------------------------------\n /** Returns the storage allocated by ASSIMP to hold the scene data\n * in memory.\n *\n * This refers to the currently loaded file, see #ReadFile().\n * @param in Data structure to be filled.\n * @note The returned memory statistics refer to the actual\n * size of the use data of the aiScene. Heap-related overhead\n * is (naturally) not included.*/\n void GetMemoryRequirements(aiMemoryInfo& in) const;\n\n // -------------------------------------------------------------------\n /** Enables \"extra verbose\" mode.\n *\n * 'Extra verbose' means the data structure is validated after *every*\n * single post processing step to make sure everyone modifies the data\n * structure in a well-defined manner. This is a debug feature and not\n * intended for use in production environments. */\n void SetExtraVerbose(bool bDo);\n\n\n // -------------------------------------------------------------------\n /** Private, do not use. */\n ImporterPimpl* Pimpl() { return pimpl; }\n const ImporterPimpl* Pimpl() const { return pimpl; }\n\nprotected:\n\n // Just because we don't want you to know how we're hacking around.\n ImporterPimpl* pimpl;\n}; //! class Importer\n\n\n// ----------------------------------------------------------------------------\n// For compatibility, the interface of some functions taking a std::string was\n// changed to const char* to avoid crashes between binary incompatible STL\n// versions. This code her is inlined, so it shouldn't cause any problems.\n// ----------------------------------------------------------------------------\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE const aiScene* Importer::ReadFile( const std::string& pFile,unsigned int pFlags){\n return ReadFile(pFile.c_str(),pFlags);\n}\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE void Importer::GetExtensionList(std::string& szOut) const {\n aiString s;\n GetExtensionList(s);\n szOut = s.data;\n}\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string& szExtension) const {\n return IsExtensionSupported(szExtension.c_str());\n}\n\n} // !namespace Assimp\n#endif // INCLUDED_AI_ASSIMP_HPP\n"}, {"path": "includes/assimp/LogStream.hpp", "language": "code", "loc": 83, "comment_density": 0.747, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file LogStream.hpp\n * @brief Abstract base class 'LogStream', representing an output log stream.\n */\n#ifndef INCLUDED_AI_LOGSTREAM_H\n#define INCLUDED_AI_LOGSTREAM_H\n#include \"types.h\"\nnamespace Assimp {\nclass IOSystem;\n\n// ------------------------------------------------------------------------------------\n/** @brief CPP-API: Abstract interface for log stream implementations.\n *\n * Several default implementations are provided, see #aiDefaultLogStream for more\n * details. Writing your own implementation of LogStream is just necessary if these\n * are not enough for your purpose. */\nclass ASSIMP_API LogStream\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\nprotected:\n /** @brief Default constructor */\n LogStream() {\n }\npublic:\n /** @brief Virtual destructor */\n virtual ~LogStream() {\n }\n\n // -------------------------------------------------------------------\n /** @brief Overwrite this for your own output methods\n *\n * Log messages *may* consist of multiple lines and you shouldn't\n * expect a consistent formatting. If you want custom formatting\n * (e.g. generate HTML), supply a custom instance of Logger to\n * #DefaultLogger:set(). Usually you can *expect* that a log message\n * is exactly one line and terminated with a single \\n character.\n * @param message Message to be written */\n virtual void write(const char* message) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Creates a default log stream\n * @param streams Type of the default stream\n * @param name For aiDefaultLogStream_FILE: name of the output file\n * @param io For aiDefaultLogStream_FILE: IOSystem to be used to open the output\n * file. Pass NULL for the default implementation.\n * @return New LogStream instance. */\n static LogStream* createDefaultStream(aiDefaultLogStream stream,\n const char* name = \"AssimpLog.txt\",\n IOSystem* io = NULL);\n\n}; // !class LogStream\n// ------------------------------------------------------------------------------------\n} // Namespace Assimp\n\n#endif\n"}, {"path": "includes/assimp/Logger.hpp", "language": "code", "loc": 221, "comment_density": 0.661, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file Logger.hpp\n * @brief Abstract base class 'Logger', base of the logging system.\n */\n#ifndef INCLUDED_AI_LOGGER_H\n#define INCLUDED_AI_LOGGER_H\n\n#include \"types.h\"\nnamespace Assimp {\nclass LogStream;\n\n// Maximum length of a log message. Longer messages are rejected.\n#define MAX_LOG_MESSAGE_LENGTH 1024u\n\n// ----------------------------------------------------------------------------------\n/** @brief CPP-API: Abstract interface for logger implementations.\n * Assimp provides a default implementation and uses it for almost all\n * logging stuff ('DefaultLogger'). This class defines just basic logging\n * behaviour and is not of interest for you. Instead, take a look at #DefaultLogger. */\nclass ASSIMP_API Logger\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\npublic:\n\n // ----------------------------------------------------------------------\n /** @enum LogSeverity\n * @brief Log severity to describe the granularity of logging.\n */\n enum LogSeverity\n {\n NORMAL, //!< Normal granularity of logging\n VERBOSE //!< Debug infos will be logged, too\n };\n\n // ----------------------------------------------------------------------\n /** @enum ErrorSeverity\n * @brief Description for severity of a log message.\n *\n * Every LogStream has a bitwise combination of these flags.\n * A LogStream doesn't receive any messages of a specific type\n * if it doesn't specify the corresponding ErrorSeverity flag.\n */\n enum ErrorSeverity\n {\n Debugging = 1, //!< Debug log message\n Info = 2, //!< Info log message\n Warn = 4, //!< Warn log message\n Err = 8 //!< Error log message\n };\n\npublic:\n\n /** @brief Virtual destructor */\n virtual ~Logger();\n\n // ----------------------------------------------------------------------\n /** @brief Writes a debug message\n * @param message Debug message*/\n void debug(const char* message);\n inline void debug(const std::string &message);\n\n // ----------------------------------------------------------------------\n /** @brief Writes a info message\n * @param message Info message*/\n void info(const char* message);\n inline void info(const std::string &message);\n\n // ----------------------------------------------------------------------\n /** @brief Writes a warning message\n * @param message Warn message*/\n void warn(const char* message);\n inline void warn(const std::string &message);\n\n // ----------------------------------------------------------------------\n /** @brief Writes an error message\n * @param message Error message*/\n void error(const char* message);\n inline void error(const std::string &message);\n\n // ----------------------------------------------------------------------\n /** @brief Set a new log severity.\n * @param log_severity New severity for logging*/\n void setLogSeverity(LogSeverity log_severity);\n\n // ----------------------------------------------------------------------\n /** @brief Get the current log severity*/\n LogSeverity getLogSeverity() const;\n\n // ----------------------------------------------------------------------\n /** @brief Attach a new log-stream\n *\n * The logger takes ownership of the stream and is responsible\n * for its destruction (which is done using ::delete when the logger\n * itself is destroyed). Call detachStream to detach a stream and to\n * gain ownership of it again.\n * @param pStream Log-stream to attach\n * @param severity Message filter, specified which types of log\n * messages are dispatched to the stream. Provide a bitwise\n * combination of the ErrorSeverity flags.\n * @return true if the stream has been attached, false otherwise.*/\n virtual bool attachStream(LogStream *pStream,\n unsigned int severity = Debugging | Err | Warn | Info) = 0;\n\n // ----------------------------------------------------------------------\n /** @brief Detach a still attached stream from the logger (or\n * modify the filter flags bits)\n * @param pStream Log-stream instance for detaching\n * @param severity Provide a bitwise combination of the ErrorSeverity\n * flags. This value is &~ed with the current flags of the stream,\n * if the result is 0 the stream is detached from the Logger and\n * the caller retakes the possession of the stream.\n * @return true if the stream has been detached, false otherwise.*/\n virtual bool detachStream(LogStream *pStream,\n unsigned int severity = Debugging | Err | Warn | Info) = 0;\n\nprotected:\n\n /** Default constructor */\n Logger();\n\n /** Construction with a given log severity */\n explicit Logger(LogSeverity severity);\n\n // ----------------------------------------------------------------------\n /** @brief Called as a request to write a specific debug message\n * @param message Debug message. Never longer than\n * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').\n * @note The message string is only valid until the scope of\n * the function is left.\n */\n virtual void OnDebug(const char* message)= 0;\n\n // ----------------------------------------------------------------------\n /** @brief Called as a request to write a specific info message\n * @param message Info message. Never longer than\n * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').\n * @note The message string is only valid until the scope of\n * the function is left.\n */\n virtual void OnInfo(const char* message) = 0;\n\n // ----------------------------------------------------------------------\n /** @brief Called as a request to write a specific warn message\n * @param message Warn message. Never longer than\n * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').\n * @note The message string is only valid until the scope of\n * the function is left.\n */\n virtual void OnWarn(const char* message) = 0;\n\n // ----------------------------------------------------------------------\n /** @brief Called as a request to write a specific error message\n * @param message Error message. Never longer than\n * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').\n * @note The message string is only valid until the scope of\n * the function is left.\n */\n virtual void OnError(const char* message) = 0;\n\nprotected:\n\n //! Logger severity\n LogSeverity m_Severity;\n};\n\n// ----------------------------------------------------------------------------------\n// Default constructor\ninline Logger::Logger() {\n setLogSeverity(NORMAL);\n}\n\n// ----------------------------------------------------------------------------------\n// Virtual destructor\ninline Logger::~Logger()\n{\n}\n\n// ----------------------------------------------------------------------------------\n// Construction with given logging severity\ninline Logger::Logger(LogSeverity severity) {\n setLogSeverity(severity);\n}\n\n// ----------------------------------------------------------------------------------\n// Log severity setter\ninline void Logger::setLogSeverity(LogSeverity log_severity){\n m_Severity = log_severity;\n}\n\n// ----------------------------------------------------------------------------------\n// Log severity getter\ninline Logger::LogSeverity Logger::getLogSeverity() const {\n return m_Severity;\n}\n\n// ----------------------------------------------------------------------------------\ninline void Logger::debug(const std::string &message)\n{\n return debug(message.c_str());\n}\n\n// ----------------------------------------------------------------------------------\ninline void Logger::error(const std::string &message)\n{\n return error(message.c_str());\n}\n\n// ----------------------------------------------------------------------------------\ninline void Logger::warn(const std::string &message)\n{\n return warn(message.c_str());\n}\n\n// ----------------------------------------------------------------------------------\ninline void Logger::info(const std::string &message)\n{\n return info(message.c_str());\n}\n\n// ----------------------------------------------------------------------------------\n\n} // Namespace Assimp\n\n#endif // !! INCLUDED_AI_LOGGER_H\n"}, {"path": "includes/assimp/NullLogger.hpp", "language": "code", "loc": 77, "comment_density": 0.688, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file NullLogger.hpp\n * @brief Dummy logger\n*/\n\n#ifndef INCLUDED_AI_NULLLOGGER_H\n#define INCLUDED_AI_NULLLOGGER_H\n\n#include \"Logger.hpp\"\nnamespace Assimp {\n// ---------------------------------------------------------------------------\n/** @brief CPP-API: Empty logging implementation.\n *\n * Does nothing! Used by default if the application hasn't requested a\n * custom logger via #DefaultLogger::set() or #DefaultLogger::create(); */\nclass ASSIMP_API NullLogger\n : public Logger {\n\npublic:\n\n /** @brief Logs a debug message */\n void OnDebug(const char* message) {\n (void)message; //this avoids compiler warnings\n }\n\n /** @brief Logs an info message */\n void OnInfo(const char* message) {\n (void)message; //this avoids compiler warnings\n }\n\n /** @brief Logs a warning message */\n void OnWarn(const char* message) {\n (void)message; //this avoids compiler warnings\n }\n\n /** @brief Logs an error message */\n void OnError(const char* message) {\n (void)message; //this avoids compiler warnings\n }\n\n /** @brief Detach a still attached stream from logger */\n bool attachStream(LogStream *pStream, unsigned int severity) {\n (void)pStream; (void)severity; //this avoids compiler warnings\n return false;\n }\n\n /** @brief Detach a still attached stream from logger */\n bool detachStream(LogStream *pStream, unsigned int severity) {\n (void)pStream; (void)severity; //this avoids compiler warnings\n return false;\n }\n\nprivate:\n};\n}\n#endif // !! AI_NULLLOGGER_H_INCLUDED\n"}, {"path": "includes/assimp/ProgressHandler.hpp", "language": "code", "loc": 108, "comment_density": 0.787, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file ProgressHandler.hpp\n * @brief Abstract base class 'ProgressHandler'.\n */\n#ifndef INCLUDED_AI_PROGRESSHANDLER_H\n#define INCLUDED_AI_PROGRESSHANDLER_H\n#include \"types.h\"\nnamespace Assimp {\n\n// ------------------------------------------------------------------------------------\n/** @brief CPP-API: Abstract interface for custom progress report receivers.\n *\n * Each #Importer instance maintains its own #ProgressHandler. The default\n * implementation provided by Assimp doesn't do anything at all. */\nclass ASSIMP_API ProgressHandler\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\nprotected:\n /** @brief Default constructor */\n ProgressHandler () {\n }\npublic:\n /** @brief Virtual destructor */\n virtual ~ProgressHandler () {\n }\n\n // -------------------------------------------------------------------\n /** @brief Progress callback.\n * @param percentage An estimate of the current loading progress,\n * in percent. Or -1.f if such an estimate is not available.\n *\n * There are restriction on what you may do from within your\n * implementation of this method: no exceptions may be thrown and no\n * non-const #Importer methods may be called. It is\n * not generally possible to predict the number of callbacks\n * fired during a single import.\n *\n * @return Return false to abort loading at the next possible\n * occasion (loaders and Assimp are generally allowed to perform\n * all needed cleanup tasks prior to returning control to the\n * caller). If the loading is aborted, #Importer::ReadFile()\n * returns always NULL.\n * */\n virtual bool Update(float percentage = -1.f) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Progress callback for file loading steps\n * @param numberOfSteps The number of total post-processing\n * steps\n * @param currentStep The index of the current post-processing\n * step that will run, or equal to numberOfSteps if all of\n * them has finished. This number is always strictly monotone\n * increasing, although not necessarily linearly.\n *\n * @note This is currently only used at the start and the end\n * of the file parsing.\n * */\n virtual void UpdateFileRead(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {\n float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;\n Update( f * 0.5f );\n }\n\n // -------------------------------------------------------------------\n /** @brief Progress callback for post-processing steps\n * @param numberOfSteps The number of total post-processing\n * steps\n * @param currentStep The index of the current post-processing\n * step that will run, or equal to numberOfSteps if all of\n * them has finished. This number is always strictly monotone\n * increasing, although not necessarily linearly.\n * */\n virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {\n float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;\n Update( f * 0.5f + 0.5f );\n }\n\n}; // !class ProgressHandler\n// ------------------------------------------------------------------------------------\n} // Namespace Assimp\n\n#endif\n"}, {"path": "includes/assimp/ai_assert.h", "language": "code", "loc": 42, "comment_density": 0.786, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n#ifndef AI_DEBUG_H_INC\n#define AI_DEBUG_H_INC\n\n#ifdef ASSIMP_BUILD_DEBUG\n# include \n# define ai_assert(expression) assert(expression)\n#else\n# define ai_assert(expression)\n#endif\n\n\n#endif\n"}, {"path": "includes/assimp/anim.h", "language": "code", "loc": 395, "comment_density": 0.448, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file anim.h\n * @brief Defines the data structures in which the imported animations\n * are returned.\n */\n#ifndef AI_ANIM_H_INC\n#define AI_ANIM_H_INC\n\n#include \"types.h\"\n#include \"quaternion.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n/** A time-value pair specifying a certain 3D vector for the given time. */\nstruct aiVectorKey\n{\n /** The time of this key */\n double mTime;\n\n /** The value of this key */\n C_STRUCT aiVector3D mValue;\n\n#ifdef __cplusplus\n\n //! Default constructor\n aiVectorKey(){}\n\n //! Construction from a given time and key value\n aiVectorKey(double time, const aiVector3D& value)\n : mTime (time)\n , mValue (value)\n {}\n\n\n typedef aiVector3D elem_type;\n\n // Comparison operators. For use with std::find();\n bool operator == (const aiVectorKey& o) const {\n return o.mValue == this->mValue;\n }\n bool operator != (const aiVectorKey& o) const {\n return o.mValue != this->mValue;\n }\n\n // Relational operators. For use with std::sort();\n bool operator < (const aiVectorKey& o) const {\n return mTime < o.mTime;\n }\n bool operator > (const aiVectorKey& o) const {\n return mTime > o.mTime;\n }\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** A time-value pair specifying a rotation for the given time.\n * Rotations are expressed with quaternions. */\nstruct aiQuatKey\n{\n /** The time of this key */\n double mTime;\n\n /** The value of this key */\n C_STRUCT aiQuaternion mValue;\n\n#ifdef __cplusplus\n aiQuatKey(){\n }\n\n /** Construction from a given time and key value */\n aiQuatKey(double time, const aiQuaternion& value)\n : mTime (time)\n , mValue (value)\n {}\n\n typedef aiQuaternion elem_type;\n\n // Comparison operators. For use with std::find();\n bool operator == (const aiQuatKey& o) const {\n return o.mValue == this->mValue;\n }\n bool operator != (const aiQuatKey& o) const {\n return o.mValue != this->mValue;\n }\n\n // Relational operators. For use with std::sort();\n bool operator < (const aiQuatKey& o) const {\n return mTime < o.mTime;\n }\n bool operator > (const aiQuatKey& o) const {\n return mTime > o.mTime;\n }\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** Binds a anim mesh to a specific point in time. */\nstruct aiMeshKey\n{\n /** The time of this key */\n double mTime;\n\n /** Index into the aiMesh::mAnimMeshes array of the\n * mesh corresponding to the #aiMeshAnim hosting this\n * key frame. The referenced anim mesh is evaluated\n * according to the rules defined in the docs for #aiAnimMesh.*/\n unsigned int mValue;\n\n#ifdef __cplusplus\n\n aiMeshKey() {\n }\n\n /** Construction from a given time and key value */\n aiMeshKey(double time, const unsigned int value)\n : mTime (time)\n , mValue (value)\n {}\n\n typedef unsigned int elem_type;\n\n // Comparison operators. For use with std::find();\n bool operator == (const aiMeshKey& o) const {\n return o.mValue == this->mValue;\n }\n bool operator != (const aiMeshKey& o) const {\n return o.mValue != this->mValue;\n }\n\n // Relational operators. For use with std::sort();\n bool operator < (const aiMeshKey& o) const {\n return mTime < o.mTime;\n }\n bool operator > (const aiMeshKey& o) const {\n return mTime > o.mTime;\n }\n\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** Defines how an animation channel behaves outside the defined time\n * range. This corresponds to aiNodeAnim::mPreState and\n * aiNodeAnim::mPostState.*/\nenum aiAnimBehaviour\n{\n /** The value from the default node transformation is taken*/\n aiAnimBehaviour_DEFAULT = 0x0,\n\n /** The nearest key value is used without interpolation */\n aiAnimBehaviour_CONSTANT = 0x1,\n\n /** The value of the nearest two keys is linearly\n * extrapolated for the current time value.*/\n aiAnimBehaviour_LINEAR = 0x2,\n\n /** The animation is repeated.\n *\n * If the animation key go from n to m and the current\n * time is t, use the value at (t-n) % (|m-n|).*/\n aiAnimBehaviour_REPEAT = 0x3,\n\n\n\n /** This value is not used, it is just here to force the\n * the compiler to map this enum to a 32 Bit integer */\n#ifndef SWIG\n _aiAnimBehaviour_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** Describes the animation of a single node. The name specifies the\n * bone/node which is affected by this animation channel. The keyframes\n * are given in three separate series of values, one each for position,\n * rotation and scaling. The transformation matrix computed from these\n * values replaces the node's original transformation matrix at a\n * specific time.\n * This means all keys are absolute and not relative to the bone default pose.\n * The order in which the transformations are applied is\n * - as usual - scaling, rotation, translation.\n *\n * @note All keys are returned in their correct, chronological order.\n * Duplicate keys don't pass the validation step. Most likely there\n * will be no negative time values, but they are not forbidden also ( so\n * implementations need to cope with them! ) */\nstruct aiNodeAnim\n{\n /** The name of the node affected by this animation. The node\n * must exist and it must be unique.*/\n C_STRUCT aiString mNodeName;\n\n /** The number of position keys */\n unsigned int mNumPositionKeys;\n\n /** The position keys of this animation channel. Positions are\n * specified as 3D vector. The array is mNumPositionKeys in size.\n *\n * If there are position keys, there will also be at least one\n * scaling and one rotation key.*/\n C_STRUCT aiVectorKey* mPositionKeys;\n\n /** The number of rotation keys */\n unsigned int mNumRotationKeys;\n\n /** The rotation keys of this animation channel. Rotations are\n * given as quaternions, which are 4D vectors. The array is\n * mNumRotationKeys in size.\n *\n * If there are rotation keys, there will also be at least one\n * scaling and one position key. */\n C_STRUCT aiQuatKey* mRotationKeys;\n\n\n /** The number of scaling keys */\n unsigned int mNumScalingKeys;\n\n /** The scaling keys of this animation channel. Scalings are\n * specified as 3D vector. The array is mNumScalingKeys in size.\n *\n * If there are scaling keys, there will also be at least one\n * position and one rotation key.*/\n C_STRUCT aiVectorKey* mScalingKeys;\n\n\n /** Defines how the animation behaves before the first\n * key is encountered.\n *\n * The default value is aiAnimBehaviour_DEFAULT (the original\n * transformation matrix of the affected node is used).*/\n C_ENUM aiAnimBehaviour mPreState;\n\n /** Defines how the animation behaves after the last\n * key was processed.\n *\n * The default value is aiAnimBehaviour_DEFAULT (the original\n * transformation matrix of the affected node is taken).*/\n C_ENUM aiAnimBehaviour mPostState;\n\n#ifdef __cplusplus\n aiNodeAnim()\n {\n mNumPositionKeys = 0; mPositionKeys = NULL;\n mNumRotationKeys = 0; mRotationKeys = NULL;\n mNumScalingKeys = 0; mScalingKeys = NULL;\n\n mPreState = mPostState = aiAnimBehaviour_DEFAULT;\n }\n\n ~aiNodeAnim()\n {\n delete [] mPositionKeys;\n delete [] mRotationKeys;\n delete [] mScalingKeys;\n }\n#endif // __cplusplus\n};\n\n// ---------------------------------------------------------------------------\n/** Describes vertex-based animations for a single mesh or a group of\n * meshes. Meshes carry the animation data for each frame in their\n * aiMesh::mAnimMeshes array. The purpose of aiMeshAnim is to\n * define keyframes linking each mesh attachment to a particular\n * point in time. */\nstruct aiMeshAnim\n{\n /** Name of the mesh to be animated. An empty string is not allowed,\n * animated meshes need to be named (not necessarily uniquely,\n * the name can basically serve as wildcard to select a group\n * of meshes with similar animation setup)*/\n C_STRUCT aiString mName;\n\n /** Size of the #mKeys array. Must be 1, at least. */\n unsigned int mNumKeys;\n\n /** Key frames of the animation. May not be NULL. */\n C_STRUCT aiMeshKey* mKeys;\n\n#ifdef __cplusplus\n\n aiMeshAnim()\n : mNumKeys()\n , mKeys()\n {}\n\n ~aiMeshAnim()\n {\n delete[] mKeys;\n }\n\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** An animation consists of keyframe data for a number of nodes. For\n * each node affected by the animation a separate series of data is given.*/\nstruct aiAnimation\n{\n /** The name of the animation. If the modeling package this data was\n * exported from does support only a single animation channel, this\n * name is usually empty (length is zero). */\n C_STRUCT aiString mName;\n\n /** Duration of the animation in ticks. */\n double mDuration;\n\n /** Ticks per second. 0 if not specified in the imported file */\n double mTicksPerSecond;\n\n /** The number of bone animation channels. Each channel affects\n * a single node. */\n unsigned int mNumChannels;\n\n /** The node animation channels. Each channel affects a single node.\n * The array is mNumChannels in size. */\n C_STRUCT aiNodeAnim** mChannels;\n\n\n /** The number of mesh animation channels. Each channel affects\n * a single mesh and defines vertex-based animation. */\n unsigned int mNumMeshChannels;\n\n /** The mesh animation channels. Each channel affects a single mesh.\n * The array is mNumMeshChannels in size. */\n C_STRUCT aiMeshAnim** mMeshChannels;\n\n#ifdef __cplusplus\n aiAnimation()\n : mDuration(-1.)\n , mTicksPerSecond()\n , mNumChannels()\n , mChannels()\n , mNumMeshChannels()\n , mMeshChannels()\n {\n }\n\n ~aiAnimation()\n {\n // DO NOT REMOVE THIS ADDITIONAL CHECK\n if (mNumChannels && mChannels) {\n for( unsigned int a = 0; a < mNumChannels; a++) {\n delete mChannels[a];\n }\n\n delete [] mChannels;\n }\n if (mNumMeshChannels && mMeshChannels) {\n for( unsigned int a = 0; a < mNumMeshChannels; a++) {\n delete mMeshChannels[a];\n }\n\n delete [] mMeshChannels;\n }\n }\n#endif // __cplusplus\n};\n\n#ifdef __cplusplus\n}\n\n\n// some C++ utilities for inter- and extrapolation\nnamespace Assimp {\n\n// ---------------------------------------------------------------------------\n/** @brief CPP-API: Utility class to simplify interpolations of various data types.\n *\n * The type of interpolation is chosen automatically depending on the\n * types of the arguments. */\ntemplate \nstruct Interpolator\n{\n // ------------------------------------------------------------------\n /** @brief Get the result of the interpolation between a,b.\n *\n * The interpolation algorithm depends on the type of the operands.\n * aiQuaternion's and aiQuatKey's SLERP, the rest does a simple\n * linear interpolation. */\n void operator () (T& out,const T& a, const T& b, float d) const {\n out = a + (b-a)*d;\n }\n}; // ! Interpolator \n\n//! @cond Never\n\ntemplate <>\nstruct Interpolator {\n void operator () (aiQuaternion& out,const aiQuaternion& a,\n const aiQuaternion& b, float d) const\n {\n aiQuaternion::Interpolate(out,a,b,d);\n }\n}; // ! Interpolator \n\ntemplate <>\nstruct Interpolator {\n void operator () (unsigned int& out,unsigned int a,\n unsigned int b, float d) const\n {\n out = d>0.5f ? b : a;\n }\n}; // ! Interpolator \n\ntemplate <>\nstruct Interpolator {\n void operator () (aiVector3D& out,const aiVectorKey& a,\n const aiVectorKey& b, float d) const\n {\n Interpolator ipl;\n ipl(out,a.mValue,b.mValue,d);\n }\n}; // ! Interpolator \n\ntemplate <>\nstruct Interpolator {\n void operator () (aiQuaternion& out, const aiQuatKey& a,\n const aiQuatKey& b, float d) const\n {\n Interpolator ipl;\n ipl(out,a.mValue,b.mValue,d);\n }\n}; // ! Interpolator \n\ntemplate <>\nstruct Interpolator {\n void operator () (unsigned int& out, const aiMeshKey& a,\n const aiMeshKey& b, float d) const\n {\n Interpolator ipl;\n ipl(out,a.mValue,b.mValue,d);\n }\n}; // ! Interpolator \n\n//! @endcond\n} // ! end namespace Assimp\n\n\n\n#endif // __cplusplus\n#endif // AI_ANIM_H_INC\n"}, {"path": "includes/assimp/camera.h", "language": "code", "loc": 187, "comment_density": 0.733, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file camera.h\n * @brief Defines the aiCamera data structure\n */\n\n#ifndef AI_CAMERA_H_INC\n#define AI_CAMERA_H_INC\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n/** Helper structure to describe a virtual camera.\n *\n * Cameras have a representation in the node graph and can be animated.\n * An important aspect is that the camera itself is also part of the\n * scenegraph. This means, any values such as the look-at vector are not\n * *absolute*, they're relative to the coordinate system defined\n * by the node which corresponds to the camera. This allows for camera\n * animations. For static cameras parameters like the 'look-at' or 'up' vectors\n * are usually specified directly in aiCamera, but beware, they could also\n * be encoded in the node transformation. The following (pseudo)code sample\n * shows how to do it:

\n * @code\n * // Get the camera matrix for a camera at a specific time\n * // if the node hierarchy for the camera does not contain\n * // at least one animated node this is a static computation\n * get-camera-matrix (node sceneRoot, camera cam) : matrix\n * {\n * node cnd = find-node-for-camera(cam)\n * matrix cmt = identity()\n *\n * // as usual - get the absolute camera transformation for this frame\n * for each node nd in hierarchy from sceneRoot to cnd\n * matrix cur\n * if (is-animated(nd))\n * cur = eval-animation(nd)\n * else cur = nd->mTransformation;\n * cmt = mult-matrices( cmt, cur )\n * end for\n *\n * // now multiply with the camera's own local transform\n * cam = mult-matrices (cam, get-camera-matrix(cmt) )\n * }\n * @endcode\n *\n * @note some file formats (such as 3DS, ASE) export a \"target point\" -\n * the point the camera is looking at (it can even be animated). Assimp\n * writes the target point as a subnode of the camera's main node,\n * called \".Target\". However this is just additional information\n * then the transformation tracks of the camera main node make the\n * camera already look in the right direction.\n *\n*/\nstruct aiCamera\n{\n /** The name of the camera.\n *\n * There must be a node in the scenegraph with the same name.\n * This node specifies the position of the camera in the scene\n * hierarchy and can be animated.\n */\n C_STRUCT aiString mName;\n\n /** Position of the camera relative to the coordinate space\n * defined by the corresponding node.\n *\n * The default value is 0|0|0.\n */\n C_STRUCT aiVector3D mPosition;\n\n\n /** 'Up' - vector of the camera coordinate system relative to\n * the coordinate space defined by the corresponding node.\n *\n * The 'right' vector of the camera coordinate system is\n * the cross product of the up and lookAt vectors.\n * The default value is 0|1|0. The vector\n * may be normalized, but it needn't.\n */\n C_STRUCT aiVector3D mUp;\n\n\n /** 'LookAt' - vector of the camera coordinate system relative to\n * the coordinate space defined by the corresponding node.\n *\n * This is the viewing direction of the user.\n * The default value is 0|0|1. The vector\n * may be normalized, but it needn't.\n */\n C_STRUCT aiVector3D mLookAt;\n\n\n /** Half horizontal field of view angle, in radians.\n *\n * The field of view angle is the angle between the center\n * line of the screen and the left or right border.\n * The default value is 1/4PI.\n */\n float mHorizontalFOV;\n\n /** Distance of the near clipping plane from the camera.\n *\n * The value may not be 0.f (for arithmetic reasons to prevent\n * a division through zero). The default value is 0.1f.\n */\n float mClipPlaneNear;\n\n /** Distance of the far clipping plane from the camera.\n *\n * The far clipping plane must, of course, be further away than the\n * near clipping plane. The default value is 1000.f. The ratio\n * between the near and the far plane should not be too\n * large (between 1000-10000 should be ok) to avoid floating-point\n * inaccuracies which could lead to z-fighting.\n */\n float mClipPlaneFar;\n\n\n /** Screen aspect ratio.\n *\n * This is the ration between the width and the height of the\n * screen. Typical values are 4/3, 1/2 or 1/1. This value is\n * 0 if the aspect ratio is not defined in the source file.\n * 0 is also the default value.\n */\n float mAspect;\n\n#ifdef __cplusplus\n\n aiCamera()\n : mUp (0.f,1.f,0.f)\n , mLookAt (0.f,0.f,1.f)\n , mHorizontalFOV (0.25f * (float)AI_MATH_PI)\n , mClipPlaneNear (0.1f)\n , mClipPlaneFar (1000.f)\n , mAspect (0.f)\n {}\n\n /** @brief Get a *right-handed* camera matrix from me\n * @param out Camera matrix to be filled\n */\n void GetCameraMatrix (aiMatrix4x4& out) const\n {\n /** todo: test ... should work, but i'm not absolutely sure */\n\n /** We don't know whether these vectors are already normalized ...*/\n aiVector3D zaxis = mLookAt; zaxis.Normalize();\n aiVector3D yaxis = mUp; yaxis.Normalize();\n aiVector3D xaxis = mUp^mLookAt; xaxis.Normalize();\n\n out.a4 = -(xaxis * mPosition);\n out.b4 = -(yaxis * mPosition);\n out.c4 = -(zaxis * mPosition);\n\n out.a1 = xaxis.x;\n out.a2 = xaxis.y;\n out.a3 = xaxis.z;\n\n out.b1 = yaxis.x;\n out.b2 = yaxis.y;\n out.b3 = yaxis.z;\n\n out.c1 = zaxis.x;\n out.c2 = zaxis.y;\n out.c3 = zaxis.z;\n\n out.d1 = out.d2 = out.d3 = 0.f;\n out.d4 = 1.f;\n }\n\n#endif\n};\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // AI_CAMERA_H_INC\n"}, {"path": "includes/assimp/cexport.h", "language": "code", "loc": 222, "comment_density": 0.793, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2011, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\ncopyright notice, this list of conditions and the\nfollowing disclaimer.\n\n* Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the\nfollowing disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\ncontributors may be used to endorse or promote products\nderived from this software without specific prior\nwritten permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file cexport.h\n* @brief Defines the C-API for the Assimp export interface\n*/\n#ifndef AI_EXPORT_H_INC\n#define AI_EXPORT_H_INC\n\n#ifndef ASSIMP_BUILD_NO_EXPORT\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct aiScene; // aiScene.h\nstruct aiFileIO; // aiFileIO.h\n\n// --------------------------------------------------------------------------------\n/** Describes an file format which Assimp can export to. Use #aiGetExportFormatCount() to\n* learn how many export formats the current Assimp build supports and #aiGetExportFormatDescription()\n* to retrieve a description of an export format option.\n*/\nstruct aiExportFormatDesc\n{\n /// a short string ID to uniquely identify the export format. Use this ID string to\n /// specify which file format you want to export to when calling #aiExportScene().\n /// Example: \"dae\" or \"obj\"\n const char* id;\n\n /// A short description of the file format to present to users. Useful if you want\n /// to allow the user to select an export format.\n const char* description;\n\n /// Recommended file extension for the exported file in lower case.\n const char* fileExtension;\n};\n\n\n// --------------------------------------------------------------------------------\n/** Returns the number of export file formats available in the current Assimp build.\n * Use aiGetExportFormatDescription() to retrieve infos of a specific export format.\n */\nASSIMP_API size_t aiGetExportFormatCount(void);\n\n\n// --------------------------------------------------------------------------------\n/** Returns a description of the nth export file format. Use #aiGetExportFormatCount()\n * to learn how many export formats are supported. The description must be released by \n * calling aiReleaseExportFormatDescription afterwards.\n * @param pIndex Index of the export format to retrieve information for. Valid range is\n * 0 to #aiGetExportFormatCount()\n * @return A description of that specific export format. NULL if pIndex is out of range.\n */\nASSIMP_API const C_STRUCT aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex);\n\n// --------------------------------------------------------------------------------\n/** Release a description of the nth export file format. Must be returned by \n* aiGetExportFormatDescription\n* @param desc Pointer to the description\n*/\nASSIMP_API void aiReleaseExportFormatDescription( const C_STRUCT aiExportFormatDesc *desc );\n\n// --------------------------------------------------------------------------------\n/** Create a modifiable copy of a scene.\n * This is useful to import files via Assimp, change their topology and\n * export them again. Since the scene returned by the various importer functions\n * is const, a modifiable copy is needed.\n * @param pIn Valid scene to be copied\n * @param pOut Receives a modifiable copy of the scene. Use aiFreeScene() to\n * delete it again.\n */\nASSIMP_API void aiCopyScene(const C_STRUCT aiScene* pIn,\n C_STRUCT aiScene** pOut);\n\n\n// --------------------------------------------------------------------------------\n/** Frees a scene copy created using aiCopyScene() */\nASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn);\n\n// --------------------------------------------------------------------------------\n/** Exports the given scene to a chosen file format and writes the result file(s) to disk.\n* @param pScene The scene to export. Stays in possession of the caller, is not changed by the function.\n* The scene is expected to conform to Assimp's Importer output format as specified\n* in the @link data Data Structures Page @endlink. In short, this means the model data\n* should use a right-handed coordinate systems, face winding should be counter-clockwise\n* and the UV coordinate origin is assumed to be in the upper left. If your input data\n* uses different conventions, have a look at the last parameter.\n* @param pFormatId ID string to specify to which format you want to export to. Use\n* aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available.\n* @param pFileName Output file to write\n* @param pPreprocessing Accepts any choice of the #aiPostProcessSteps enumerated\n* flags, but in reality only a subset of them makes sense here. Specifying\n* 'preprocessing' flags is useful if the input scene does not conform to\n* Assimp's default conventions as specified in the @link data Data Structures Page @endlink.\n* In short, this means the geometry data should use a right-handed coordinate systems, face\n* winding should be counter-clockwise and the UV coordinate origin is assumed to be in\n* the upper left. The #aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and\n* #aiProcess_FlipWindingOrder flags are used in the import side to allow users\n* to have those defaults automatically adapted to their conventions. Specifying those flags\n* for exporting has the opposite effect, respectively. Some other of the\n* #aiPostProcessSteps enumerated values may be useful as well, but you'll need\n* to try out what their effect on the exported file is. Many formats impose\n* their own restrictions on the structure of the geometry stored therein,\n* so some preprocessing may have little or no effect at all, or may be\n* redundant as exporters would apply them anyhow. A good example\n* is triangulation - whilst you can enforce it by specifying\n* the #aiProcess_Triangulate flag, most export formats support only\n* triangulate data so they would run the step anyway.\n*\n* If assimp detects that the input scene was directly taken from the importer side of\n* the library (i.e. not copied using aiCopyScene and potentially modified afterwards),\n* any postprocessing steps already applied to the scene will not be applied again, unless\n* they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and\n* #aiProcess_FlipWindingOrder).\n* @return a status code indicating the result of the export\n* @note Use aiCopyScene() to get a modifiable copy of a previously\n* imported scene.\n*/\nASSIMP_API aiReturn aiExportScene( const C_STRUCT aiScene* pScene,\n const char* pFormatId,\n const char* pFileName,\n unsigned int pPreprocessing);\n\n\n// --------------------------------------------------------------------------------\n/** Exports the given scene to a chosen file format using custom IO logic supplied by you.\n* @param pScene The scene to export. Stays in possession of the caller, is not changed by the function.\n* @param pFormatId ID string to specify to which format you want to export to. Use\n* aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available.\n* @param pFileName Output file to write\n* @param pIO custom IO implementation to be used. Use this if you use your own storage methods.\n* If none is supplied, a default implementation using standard file IO is used. Note that\n* #aiExportSceneToBlob is provided as convenience function to export to memory buffers.\n* @param pPreprocessing Please see the documentation for #aiExportScene\n* @return a status code indicating the result of the export\n* @note Include for the definition of #aiFileIO.\n* @note Use aiCopyScene() to get a modifiable copy of a previously\n* imported scene.\n*/\nASSIMP_API aiReturn aiExportSceneEx( const C_STRUCT aiScene* pScene,\n const char* pFormatId,\n const char* pFileName,\n C_STRUCT aiFileIO* pIO,\n unsigned int pPreprocessing );\n\n\n// --------------------------------------------------------------------------------\n/** Describes a blob of exported scene data. Use #aiExportSceneToBlob() to create a blob containing an\n* exported scene. The memory referred by this structure is owned by Assimp.\n* to free its resources. Don't try to free the memory on your side - it will crash for most build configurations\n* due to conflicting heaps.\n*\n* Blobs can be nested - each blob may reference another blob, which may in turn reference another blob and so on.\n* This is used when exporters write more than one output file for a given #aiScene. See the remarks for\n* #aiExportDataBlob::name for more information.\n*/\nstruct aiExportDataBlob\n{\n /// Size of the data in bytes\n size_t size;\n\n /// The data.\n void* data;\n\n /** Name of the blob. An empty string always\n indicates the first (and primary) blob,\n which contains the actual file data.\n Any other blobs are auxiliary files produced\n by exporters (i.e. material files). Existence\n of such files depends on the file format. Most\n formats don't split assets across multiple files.\n\n If used, blob names usually contain the file\n extension that should be used when writing\n the data to disc.\n */\n C_STRUCT aiString name;\n\n /** Pointer to the next blob in the chain or NULL if there is none. */\n C_STRUCT aiExportDataBlob * next;\n\n#ifdef __cplusplus\n /// Default constructor\n aiExportDataBlob() { size = 0; data = next = NULL; }\n /// Releases the data\n ~aiExportDataBlob() { delete [] static_cast( data ); delete next; }\n\nprivate:\n // no copying\n aiExportDataBlob(const aiExportDataBlob& );\n aiExportDataBlob& operator= (const aiExportDataBlob& );\n#endif // __cplusplus\n};\n\n// --------------------------------------------------------------------------------\n/** Exports the given scene to a chosen file format. Returns the exported data as a binary blob which\n* you can write into a file or something. When you're done with the data, use #aiReleaseExportBlob()\n* to free the resources associated with the export.\n* @param pScene The scene to export. Stays in possession of the caller, is not changed by the function.\n* @param pFormatId ID string to specify to which format you want to export to. Use\n* #aiGetExportFormatCount() / #aiGetExportFormatDescription() to learn which export formats are available.\n* @param pPreprocessing Please see the documentation for #aiExportScene\n* @return the exported data or NULL in case of error\n*/\nASSIMP_API const C_STRUCT aiExportDataBlob* aiExportSceneToBlob( const C_STRUCT aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing );\n\n\n// --------------------------------------------------------------------------------\n/** Releases the memory associated with the given exported data. Use this function to free a data blob\n* returned by aiExportScene().\n* @param pData the data blob returned by #aiExportSceneToBlob\n*/\nASSIMP_API void aiReleaseExportBlob( const C_STRUCT aiExportDataBlob* pData );\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // ASSIMP_BUILD_NO_EXPORT\n#endif // AI_EXPORT_H_INC\n\n"}, {"path": "includes/assimp/cfileio.h", "language": "code", "loc": 112, "comment_density": 0.688, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file cfileio.h\n * @brief Defines generic C routines to access memory-mapped files\n */\n#ifndef AI_FILEIO_H_INC\n#define AI_FILEIO_H_INC\n\n#include \"types.h\"\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nstruct aiFileIO;\nstruct aiFile;\n\n// aiFile callbacks\ntypedef size_t (*aiFileWriteProc) (C_STRUCT aiFile*, const char*, size_t, size_t);\ntypedef size_t (*aiFileReadProc) (C_STRUCT aiFile*, char*, size_t,size_t);\ntypedef size_t (*aiFileTellProc) (C_STRUCT aiFile*);\ntypedef void (*aiFileFlushProc) (C_STRUCT aiFile*);\ntypedef aiReturn (*aiFileSeek)(C_STRUCT aiFile*, size_t, aiOrigin);\n\n// aiFileIO callbacks\ntypedef aiFile* (*aiFileOpenProc) (C_STRUCT aiFileIO*, const char*, const char*);\ntypedef void (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*);\n\n// Represents user-defined data\ntypedef char* aiUserData;\n\n// ----------------------------------------------------------------------------------\n/** @brief C-API: File system callbacks\n *\n * Provided are functions to open and close files. Supply a custom structure to\n * the import function. If you don't, a default implementation is used. Use custom\n * file systems to enable reading from other sources, such as ZIPs\n * or memory locations. */\nstruct aiFileIO\n{\n /** Function used to open a new file\n */\n aiFileOpenProc OpenProc;\n\n /** Function used to close an existing file\n */\n aiFileCloseProc CloseProc;\n\n /** User-defined, opaque data */\n aiUserData UserData;\n};\n\n// ----------------------------------------------------------------------------------\n/** @brief C-API: File callbacks\n *\n * Actually, it's a data structure to wrap a set of fXXXX (e.g fopen)\n * replacement functions.\n *\n * The default implementation of the functions utilizes the fXXX functions from\n * the CRT. However, you can supply a custom implementation to Assimp by\n * delivering a custom aiFileIO. Use this to enable reading from other sources,\n * such as ZIP archives or memory locations. */\nstruct aiFile\n{\n /** Callback to read from a file */\n aiFileReadProc ReadProc;\n\n /** Callback to write to a file */\n aiFileWriteProc WriteProc;\n\n /** Callback to retrieve the current position of\n * the file cursor (ftell())\n */\n aiFileTellProc TellProc;\n\n /** Callback to retrieve the size of the file,\n * in bytes\n */\n aiFileTellProc FileSizeProc;\n\n /** Callback to set the current position\n * of the file cursor (fseek())\n */\n aiFileSeek SeekProc;\n\n /** Callback to flush the file contents\n */\n aiFileFlushProc FlushProc;\n\n /** User-defined, opaque data\n */\n aiUserData UserData;\n};\n\n#ifdef __cplusplus\n}\n#endif\n#endif // AI_FILEIO_H_INC\n"}, {"path": "includes/assimp/cimport.h", "language": "code", "loc": 508, "comment_density": 0.78, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file cimport.h\n * @brief Defines the C-API to the Open Asset Import Library.\n */\n#ifndef AI_ASSIMP_H_INC\n#define AI_ASSIMP_H_INC\n#include \"types.h\"\n#include \"importerdesc.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct aiScene; // aiScene.h\nstruct aiFileIO; // aiFileIO.h\ntypedef void (*aiLogStreamCallback)(const char* /* message */, char* /* user */);\n\n// --------------------------------------------------------------------------------\n/** C-API: Represents a log stream. A log stream receives all log messages and\n * streams them _somewhere_.\n * @see aiGetPredefinedLogStream\n * @see aiAttachLogStream\n * @see aiDetachLogStream */\n// --------------------------------------------------------------------------------\nstruct aiLogStream\n{\n /** callback to be called */\n aiLogStreamCallback callback;\n\n /** user data to be passed to the callback */\n char* user;\n};\n\n\n// --------------------------------------------------------------------------------\n/** C-API: Represents an opaque set of settings to be used during importing.\n * @see aiCreatePropertyStore\n * @see aiReleasePropertyStore\n * @see aiImportFileExWithProperties\n * @see aiSetPropertyInteger\n * @see aiSetPropertyFloat\n * @see aiSetPropertyString\n * @see aiSetPropertyMatrix\n */\n// --------------------------------------------------------------------------------\nstruct aiPropertyStore { char sentinel; };\n\n/** Our own C boolean type */\ntypedef int aiBool;\n\n#define AI_FALSE 0\n#define AI_TRUE 1\n\n// --------------------------------------------------------------------------------\n/** Reads the given file and returns its content.\n *\n * If the call succeeds, the imported data is returned in an aiScene structure.\n * The data is intended to be read-only, it stays property of the ASSIMP\n * library and will be stable until aiReleaseImport() is called. After you're\n * done with it, call aiReleaseImport() to free the resources associated with\n * this file. If the import fails, NULL is returned instead. Call\n * aiGetErrorString() to retrieve a human-readable error text.\n * @param pFile Path and filename of the file to be imported,\n * expected to be a null-terminated c-string. NULL is not a valid value.\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags.\n * @return Pointer to the imported data or NULL if the import failed.\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFile(\n const char* pFile,\n unsigned int pFlags);\n\n// --------------------------------------------------------------------------------\n/** Reads the given file using user-defined I/O functions and returns\n * its content.\n *\n * If the call succeeds, the imported data is returned in an aiScene structure.\n * The data is intended to be read-only, it stays property of the ASSIMP\n * library and will be stable until aiReleaseImport() is called. After you're\n * done with it, call aiReleaseImport() to free the resources associated with\n * this file. If the import fails, NULL is returned instead. Call\n * aiGetErrorString() to retrieve a human-readable error text.\n * @param pFile Path and filename of the file to be imported,\n * expected to be a null-terminated c-string. NULL is not a valid value.\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags.\n * @param pFS aiFileIO structure. Will be used to open the model file itself\n * and any other files the loader needs to open. Pass NULL to use the default\n * implementation.\n * @return Pointer to the imported data or NULL if the import failed.\n * @note Include for the definition of #aiFileIO.\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFileEx(\n const char* pFile,\n unsigned int pFlags,\n C_STRUCT aiFileIO* pFS);\n\n// --------------------------------------------------------------------------------\n/** Same as #aiImportFileEx, but adds an extra parameter containing importer settings.\n *\n * @param pFile Path and filename of the file to be imported,\n * expected to be a null-terminated c-string. NULL is not a valid value.\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags.\n * @param pFS aiFileIO structure. Will be used to open the model file itself\n * and any other files the loader needs to open. Pass NULL to use the default\n * implementation.\n * @param pProps #aiPropertyStore instance containing import settings.\n * @return Pointer to the imported data or NULL if the import failed.\n * @note Include for the definition of #aiFileIO.\n * @see aiImportFileEx\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFileExWithProperties(\n const char* pFile,\n unsigned int pFlags,\n C_STRUCT aiFileIO* pFS,\n const C_STRUCT aiPropertyStore* pProps);\n\n// --------------------------------------------------------------------------------\n/** Reads the given file from a given memory buffer,\n *\n * If the call succeeds, the contents of the file are returned as a pointer to an\n * aiScene object. The returned data is intended to be read-only, the importer keeps\n * ownership of the data and will destroy it upon destruction. If the import fails,\n * NULL is returned.\n * A human-readable error description can be retrieved by calling aiGetErrorString().\n * @param pBuffer Pointer to the file data\n * @param pLength Length of pBuffer, in bytes\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags. If you wish to inspect the imported\n * scene first in order to fine-tune your post-processing setup,\n * consider to use #aiApplyPostProcessing().\n * @param pHint An additional hint to the library. If this is a non empty string,\n * the library looks for a loader to support the file extension specified by pHint\n * and passes the file to the first matching loader. If this loader is unable to\n * completely the request, the library continues and tries to determine the file\n * format on its own, a task that may or may not be successful.\n * Check the return value, and you'll know ...\n * @return A pointer to the imported data, NULL if the import failed.\n *\n * @note This is a straightforward way to decode models from memory\n * buffers, but it doesn't handle model formats that spread their\n * data across multiple files or even directories. Examples include\n * OBJ or MD3, which outsource parts of their material info into\n * external scripts. If you need full functionality, provide\n * a custom IOSystem to make Assimp find these files and use\n * the regular aiImportFileEx()/aiImportFileExWithProperties() API.\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemory(\n const char* pBuffer,\n unsigned int pLength,\n unsigned int pFlags,\n const char* pHint);\n\n// --------------------------------------------------------------------------------\n/** Same as #aiImportFileFromMemory, but adds an extra parameter containing importer settings.\n *\n * @param pBuffer Pointer to the file data\n * @param pLength Length of pBuffer, in bytes\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags. If you wish to inspect the imported\n * scene first in order to fine-tune your post-processing setup,\n * consider to use #aiApplyPostProcessing().\n * @param pHint An additional hint to the library. If this is a non empty string,\n * the library looks for a loader to support the file extension specified by pHint\n * and passes the file to the first matching loader. If this loader is unable to\n * completely the request, the library continues and tries to determine the file\n * format on its own, a task that may or may not be successful.\n * Check the return value, and you'll know ...\n * @param pProps #aiPropertyStore instance containing import settings.\n * @return A pointer to the imported data, NULL if the import failed.\n *\n * @note This is a straightforward way to decode models from memory\n * buffers, but it doesn't handle model formats that spread their\n * data across multiple files or even directories. Examples include\n * OBJ or MD3, which outsource parts of their material info into\n * external scripts. If you need full functionality, provide\n * a custom IOSystem to make Assimp find these files and use\n * the regular aiImportFileEx()/aiImportFileExWithProperties() API.\n * @see aiImportFileFromMemory\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemoryWithProperties(\n const char* pBuffer,\n unsigned int pLength,\n unsigned int pFlags,\n const char* pHint,\n const C_STRUCT aiPropertyStore* pProps);\n\n// --------------------------------------------------------------------------------\n/** Apply post-processing to an already-imported scene.\n *\n * This is strictly equivalent to calling #aiImportFile()/#aiImportFileEx with the\n * same flags. However, you can use this separate function to inspect the imported\n * scene first to fine-tune your post-processing setup.\n * @param pScene Scene to work on.\n * @param pFlags Provide a bitwise combination of the #aiPostProcessSteps flags.\n * @return A pointer to the post-processed data. Post processing is done in-place,\n * meaning this is still the same #aiScene which you passed for pScene. However,\n * _if_ post-processing failed, the scene could now be NULL. That's quite a rare\n * case, post processing steps are not really designed to 'fail'. To be exact,\n * the #aiProcess_ValidateDataStructure flag is currently the only post processing step\n * which can actually cause the scene to be reset to NULL.\n */\nASSIMP_API const C_STRUCT aiScene* aiApplyPostProcessing(\n const C_STRUCT aiScene* pScene,\n unsigned int pFlags);\n\n// --------------------------------------------------------------------------------\n/** Get one of the predefine log streams. This is the quick'n'easy solution to\n * access Assimp's log system. Attaching a log stream can slightly reduce Assimp's\n * overall import performance.\n *\n * Usage is rather simple (this will stream the log to a file, named log.txt, and\n * the stdout stream of the process:\n * @code\n * struct aiLogStream c;\n * c = aiGetPredefinedLogStream(aiDefaultLogStream_FILE,\"log.txt\");\n * aiAttachLogStream(&c);\n * c = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);\n * aiAttachLogStream(&c);\n * @endcode\n *\n * @param pStreams One of the #aiDefaultLogStream enumerated values.\n * @param file Solely for the #aiDefaultLogStream_FILE flag: specifies the file to write to.\n * Pass NULL for all other flags.\n * @return The log stream. callback is set to NULL if something went wrong.\n */\nASSIMP_API C_STRUCT aiLogStream aiGetPredefinedLogStream(\n C_ENUM aiDefaultLogStream pStreams,\n const char* file);\n\n// --------------------------------------------------------------------------------\n/** Attach a custom log stream to the libraries' logging system.\n *\n * Attaching a log stream can slightly reduce Assimp's overall import\n * performance. Multiple log-streams can be attached.\n * @param stream Describes the new log stream.\n * @note To ensure proper destruction of the logging system, you need to manually\n * call aiDetachLogStream() on every single log stream you attach.\n * Alternatively (for the lazy folks) #aiDetachAllLogStreams is provided.\n */\nASSIMP_API void aiAttachLogStream(\n const C_STRUCT aiLogStream* stream);\n\n// --------------------------------------------------------------------------------\n/** Enable verbose logging. Verbose logging includes debug-related stuff and\n * detailed import statistics. This can have severe impact on import performance\n * and memory consumption. However, it might be useful to find out why a file\n * didn't read correctly.\n * @param d AI_TRUE or AI_FALSE, your decision.\n */\nASSIMP_API void aiEnableVerboseLogging(aiBool d);\n\n// --------------------------------------------------------------------------------\n/** Detach a custom log stream from the libraries' logging system.\n *\n * This is the counterpart of #aiAttachLogStream. If you attached a stream,\n * don't forget to detach it again.\n * @param stream The log stream to be detached.\n * @return AI_SUCCESS if the log stream has been detached successfully.\n * @see aiDetachAllLogStreams\n */\nASSIMP_API C_ENUM aiReturn aiDetachLogStream(\n const C_STRUCT aiLogStream* stream);\n\n// --------------------------------------------------------------------------------\n/** Detach all active log streams from the libraries' logging system.\n * This ensures that the logging system is terminated properly and all\n * resources allocated by it are actually freed. If you attached a stream,\n * don't forget to detach it again.\n * @see aiAttachLogStream\n * @see aiDetachLogStream\n */\nASSIMP_API void aiDetachAllLogStreams(void);\n\n// --------------------------------------------------------------------------------\n/** Releases all resources associated with the given import process.\n *\n * Call this function after you're done with the imported data.\n * @param pScene The imported data to release. NULL is a valid value.\n */\nASSIMP_API void aiReleaseImport(\n const C_STRUCT aiScene* pScene);\n\n// --------------------------------------------------------------------------------\n/** Returns the error text of the last failed import process.\n *\n * @return A textual description of the error that occurred at the last\n * import process. NULL if there was no error. There can't be an error if you\n * got a non-NULL #aiScene from #aiImportFile/#aiImportFileEx/#aiApplyPostProcessing.\n */\nASSIMP_API const char* aiGetErrorString();\n\n// --------------------------------------------------------------------------------\n/** Returns whether a given file extension is supported by ASSIMP\n *\n * @param szExtension Extension for which the function queries support for.\n * Must include a leading dot '.'. Example: \".3ds\", \".md3\"\n * @return AI_TRUE if the file extension is supported.\n */\nASSIMP_API aiBool aiIsExtensionSupported(\n const char* szExtension);\n\n// --------------------------------------------------------------------------------\n/** Get a list of all file extensions supported by ASSIMP.\n *\n * If a file extension is contained in the list this does, of course, not\n * mean that ASSIMP is able to load all files with this extension.\n * @param szOut String to receive the extension list.\n * Format of the list: \"*.3ds;*.obj;*.dae\". NULL is not a valid parameter.\n */\nASSIMP_API void aiGetExtensionList(\n C_STRUCT aiString* szOut);\n\n// --------------------------------------------------------------------------------\n/** Get the approximated storage required by an imported asset\n * @param pIn Input asset.\n * @param in Data structure to be filled.\n */\nASSIMP_API void aiGetMemoryRequirements(\n const C_STRUCT aiScene* pIn,\n C_STRUCT aiMemoryInfo* in);\n\n\n\n// --------------------------------------------------------------------------------\n/** Create an empty property store. Property stores are used to collect import\n * settings.\n * @return New property store. Property stores need to be manually destroyed using\n * the #aiReleasePropertyStore API function.\n */\nASSIMP_API C_STRUCT aiPropertyStore* aiCreatePropertyStore(void);\n\n// --------------------------------------------------------------------------------\n/** Delete a property store.\n * @param p Property store to be deleted.\n */\nASSIMP_API void aiReleasePropertyStore(C_STRUCT aiPropertyStore* p);\n\n// --------------------------------------------------------------------------------\n/** Set an integer property.\n *\n * This is the C-version of #Assimp::Importer::SetPropertyInteger(). In the C\n * interface, properties are always shared by all imports. It is not possible to\n * specify them per import.\n *\n * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.\n * @param szName Name of the configuration property to be set. All supported\n * public properties are defined in the config.h header file (AI_CONFIG_XXX).\n * @param value New value for the property\n */\nASSIMP_API void aiSetImportPropertyInteger(\n C_STRUCT aiPropertyStore* store,\n const char* szName,\n int value);\n\n// --------------------------------------------------------------------------------\n/** Set a floating-point property.\n *\n * This is the C-version of #Assimp::Importer::SetPropertyFloat(). In the C\n * interface, properties are always shared by all imports. It is not possible to\n * specify them per import.\n *\n * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.\n * @param szName Name of the configuration property to be set. All supported\n * public properties are defined in the config.h header file (AI_CONFIG_XXX).\n * @param value New value for the property\n */\nASSIMP_API void aiSetImportPropertyFloat(\n C_STRUCT aiPropertyStore* store,\n const char* szName,\n float value);\n\n// --------------------------------------------------------------------------------\n/** Set a string property.\n *\n * This is the C-version of #Assimp::Importer::SetPropertyString(). In the C\n * interface, properties are always shared by all imports. It is not possible to\n * specify them per import.\n *\n * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.\n * @param szName Name of the configuration property to be set. All supported\n * public properties are defined in the config.h header file (AI_CONFIG_XXX).\n * @param st New value for the property\n */\nASSIMP_API void aiSetImportPropertyString(\n C_STRUCT aiPropertyStore* store,\n const char* szName,\n const C_STRUCT aiString* st);\n\n// --------------------------------------------------------------------------------\n/** Set a matrix property.\n *\n * This is the C-version of #Assimp::Importer::SetPropertyMatrix(). In the C\n * interface, properties are always shared by all imports. It is not possible to\n * specify them per import.\n *\n * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.\n * @param szName Name of the configuration property to be set. All supported\n * public properties are defined in the config.h header file (AI_CONFIG_XXX).\n * @param mat New value for the property\n */\nASSIMP_API void aiSetImportPropertyMatrix(\n C_STRUCT aiPropertyStore* store,\n const char* szName,\n const C_STRUCT aiMatrix4x4* mat);\n\n// --------------------------------------------------------------------------------\n/** Construct a quaternion from a 3x3 rotation matrix.\n * @param quat Receives the output quaternion.\n * @param mat Matrix to 'quaternionize'.\n * @see aiQuaternion(const aiMatrix3x3& pRotMatrix)\n */\nASSIMP_API void aiCreateQuaternionFromMatrix(\n C_STRUCT aiQuaternion* quat,\n const C_STRUCT aiMatrix3x3* mat);\n\n// --------------------------------------------------------------------------------\n/** Decompose a transformation matrix into its rotational, translational and\n * scaling components.\n *\n * @param mat Matrix to decompose\n * @param scaling Receives the scaling component\n * @param rotation Receives the rotational component\n * @param position Receives the translational component.\n * @see aiMatrix4x4::Decompose (aiVector3D&, aiQuaternion&, aiVector3D&) const;\n */\nASSIMP_API void aiDecomposeMatrix(\n const C_STRUCT aiMatrix4x4* mat,\n C_STRUCT aiVector3D* scaling,\n C_STRUCT aiQuaternion* rotation,\n C_STRUCT aiVector3D* position);\n\n// --------------------------------------------------------------------------------\n/** Transpose a 4x4 matrix.\n * @param mat Pointer to the matrix to be transposed\n */\nASSIMP_API void aiTransposeMatrix4(\n C_STRUCT aiMatrix4x4* mat);\n\n// --------------------------------------------------------------------------------\n/** Transpose a 3x3 matrix.\n * @param mat Pointer to the matrix to be transposed\n */\nASSIMP_API void aiTransposeMatrix3(\n C_STRUCT aiMatrix3x3* mat);\n\n// --------------------------------------------------------------------------------\n/** Transform a vector by a 3x3 matrix\n * @param vec Vector to be transformed.\n * @param mat Matrix to transform the vector with.\n */\nASSIMP_API void aiTransformVecByMatrix3(\n C_STRUCT aiVector3D* vec,\n const C_STRUCT aiMatrix3x3* mat);\n\n// --------------------------------------------------------------------------------\n/** Transform a vector by a 4x4 matrix\n * @param vec Vector to be transformed.\n * @param mat Matrix to transform the vector with.\n */\nASSIMP_API void aiTransformVecByMatrix4(\n C_STRUCT aiVector3D* vec,\n const C_STRUCT aiMatrix4x4* mat);\n\n// --------------------------------------------------------------------------------\n/** Multiply two 4x4 matrices.\n * @param dst First factor, receives result.\n * @param src Matrix to be multiplied with 'dst'.\n */\nASSIMP_API void aiMultiplyMatrix4(\n C_STRUCT aiMatrix4x4* dst,\n const C_STRUCT aiMatrix4x4* src);\n\n// --------------------------------------------------------------------------------\n/** Multiply two 3x3 matrices.\n * @param dst First factor, receives result.\n * @param src Matrix to be multiplied with 'dst'.\n */\nASSIMP_API void aiMultiplyMatrix3(\n C_STRUCT aiMatrix3x3* dst,\n const C_STRUCT aiMatrix3x3* src);\n\n// --------------------------------------------------------------------------------\n/** Get a 3x3 identity matrix.\n * @param mat Matrix to receive its personal identity\n */\nASSIMP_API void aiIdentityMatrix3(\n C_STRUCT aiMatrix3x3* mat);\n\n// --------------------------------------------------------------------------------\n/** Get a 4x4 identity matrix.\n * @param mat Matrix to receive its personal identity\n */\nASSIMP_API void aiIdentityMatrix4(\n C_STRUCT aiMatrix4x4* mat);\n\n// --------------------------------------------------------------------------------\n/** Returns the number of import file formats available in the current Assimp build.\n * Use aiGetImportFormatDescription() to retrieve infos of a specific import format.\n */\nASSIMP_API size_t aiGetImportFormatCount(void);\n\n// --------------------------------------------------------------------------------\n/** Returns a description of the nth import file format. Use #aiGetImportFormatCount()\n * to learn how many import formats are supported.\n * @param pIndex Index of the import format to retrieve information for. Valid range is\n * 0 to #aiGetImportFormatCount()\n * @return A description of that specific import format. NULL if pIndex is out of range.\n */\nASSIMP_API const C_STRUCT aiImporterDesc* aiGetImportFormatDescription( size_t pIndex);\n#ifdef __cplusplus\n}\n#endif\n\n#endif // AI_ASSIMP_H_INC\n"}, {"path": "includes/assimp/color4.h", "language": "code", "loc": 82, "comment_density": 0.585, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file color4.h\n * @brief RGBA color structure, including operators when compiling in C++\n */\n#ifndef AI_COLOR4D_H_INC\n#define AI_COLOR4D_H_INC\n\n#include \"./Compiler/pushpack1.h\"\n\n#ifdef __cplusplus\n\n// ----------------------------------------------------------------------------------\n/** Represents a color in Red-Green-Blue space including an\n* alpha component. Color values range from 0 to 1. */\n// ----------------------------------------------------------------------------------\ntemplate \nclass aiColor4t\n{\npublic:\n aiColor4t () : r(), g(), b(), a() {}\n aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a)\n : r(_r), g(_g), b(_b), a(_a) {}\n explicit aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {}\n aiColor4t (const aiColor4t& o)\n : r(o.r), g(o.g), b(o.b), a(o.a) {}\n\npublic:\n // combined operators\n const aiColor4t& operator += (const aiColor4t& o);\n const aiColor4t& operator -= (const aiColor4t& o);\n const aiColor4t& operator *= (TReal f);\n const aiColor4t& operator /= (TReal f);\n\npublic:\n // comparison\n bool operator == (const aiColor4t& other) const;\n bool operator != (const aiColor4t& other) const;\n bool operator < (const aiColor4t& other) const;\n\n // color tuple access, rgba order\n inline TReal operator[](unsigned int i) const;\n inline TReal& operator[](unsigned int i);\n\n /** check whether a color is (close to) black */\n inline bool IsBlack() const;\n\npublic:\n\n // Red, green, blue and alpha color values\n TReal r, g, b, a;\n} PACK_STRUCT; // !struct aiColor4D\n\ntypedef aiColor4t aiColor4D;\n\n#else\n\nstruct aiColor4D {\n float r, g, b, a;\n} PACK_STRUCT;\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#endif // AI_COLOR4D_H_INC\n"}, {"path": "includes/assimp/config.h", "language": "code", "loc": 795, "comment_density": 0.794, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file config.h\n * @brief Defines constants for configurable properties for the library\n *\n * Typically these properties are set via\n * #Assimp::Importer::SetPropertyFloat,\n * #Assimp::Importer::SetPropertyInteger or\n * #Assimp::Importer::SetPropertyString,\n * depending on the data type of a property. All properties have a\n * default value. See the doc for the mentioned methods for more details.\n *\n *

\n * The corresponding functions for use with the plain-c API are:\n * #aiSetImportPropertyInteger,\n * #aiSetImportPropertyFloat,\n * #aiSetImportPropertyString\n */\n#ifndef INCLUDED_AI_CONFIG_H\n#define INCLUDED_AI_CONFIG_H\n\n\n// ###########################################################################\n// LIBRARY SETTINGS\n// General, global settings\n// ###########################################################################\n\n// ---------------------------------------------------------------------------\n/** @brief Enables time measurements.\n *\n * If enabled, measures the time needed for each part of the loading\n * process (i.e. IO time, importing, postprocessing, ..) and dumps\n * these timings to the DefaultLogger. See the @link perf Performance\n * Page@endlink for more information on this topic.\n *\n * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_GLOB_MEASURE_TIME \\\n \"GLOB_MEASURE_TIME\"\n\n\n// ---------------------------------------------------------------------------\n/** @brief Global setting to disable generation of skeleton dummy meshes\n *\n * Skeleton dummy meshes are generated as a visualization aid in cases which\n * the input data contains no geometry, but only animation data.\n * Property data type: bool. Default value: false\n */\n// ---------------------------------------------------------------------------\n#define AI_CONFIG_IMPORT_NO_SKELETON_MESHES \\\n \"IMPORT_NO_SKELETON_MESHES\"\n\n\n\n# if 0 // not implemented yet\n// ---------------------------------------------------------------------------\n/** @brief Set Assimp's multithreading policy.\n *\n * This setting is ignored if Assimp was built without boost.thread\n * support (ASSIMP_BUILD_NO_THREADING, which is implied by ASSIMP_BUILD_BOOST_WORKAROUND).\n * Possible values are: -1 to let Assimp decide what to do, 0 to disable\n * multithreading entirely and any number larger than 0 to force a specific\n * number of threads. Assimp is always free to ignore this settings, which is\n * merely a hint. Usually, the default value (-1) will be fine. However, if\n * Assimp is used concurrently from multiple user threads, it might be useful\n * to limit each Importer instance to a specific number of cores.\n *\n * For more information, see the @link threading Threading page@endlink.\n * Property type: int, default value: -1.\n */\n#define AI_CONFIG_GLOB_MULTITHREADING \\\n \"GLOB_MULTITHREADING\"\n#endif\n\n// ###########################################################################\n// POST PROCESSING SETTINGS\n// Various stuff to fine-tune the behavior of a specific post processing step.\n// ###########################################################################\n\n\n// ---------------------------------------------------------------------------\n/** @brief Maximum bone count per mesh for the SplitbyBoneCount step.\n *\n * Meshes are split until the maximum number of bones is reached. The default\n * value is AI_SBBC_DEFAULT_MAX_BONES, which may be altered at\n * compile-time.\n * Property data type: integer.\n */\n// ---------------------------------------------------------------------------\n#define AI_CONFIG_PP_SBBC_MAX_BONES \\\n \"PP_SBBC_MAX_BONES\"\n\n\n// default limit for bone count\n#if (!defined AI_SBBC_DEFAULT_MAX_BONES)\n# define AI_SBBC_DEFAULT_MAX_BONES 60\n#endif\n\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies the maximum angle that may be between two vertex tangents\n * that their tangents and bi-tangents are smoothed.\n *\n * This applies to the CalcTangentSpace-Step. The angle is specified\n * in degrees. The maximum value is 175.\n * Property type: float. Default value: 45 degrees\n */\n#define AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE \\\n \"PP_CT_MAX_SMOOTHING_ANGLE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Source UV channel for tangent space computation.\n *\n * The specified channel must exist or an error will be raised.\n * Property type: integer. Default value: 0\n */\n// ---------------------------------------------------------------------------\n#define AI_CONFIG_PP_CT_TEXTURE_CHANNEL_INDEX \\\n \"PP_CT_TEXTURE_CHANNEL_INDEX\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies the maximum angle that may be between two face normals\n * at the same vertex position that their are smoothed together.\n *\n * Sometimes referred to as 'crease angle'.\n * This applies to the GenSmoothNormals-Step. The angle is specified\n * in degrees, so 180 is PI. The default value is 175 degrees (all vertex\n * normals are smoothed). The maximum value is 175, too. Property type: float.\n * Warning: setting this option may cause a severe loss of performance. The\n * performance is unaffected if the #AI_CONFIG_FAVOUR_SPEED flag is set but\n * the output quality may be reduced.\n */\n#define AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE \\\n \"PP_GSN_MAX_SMOOTHING_ANGLE\"\n\n\n// ---------------------------------------------------------------------------\n/** @brief Sets the colormap (= palette) to be used to decode embedded\n * textures in MDL (Quake or 3DGS) files.\n *\n * This must be a valid path to a file. The file is 768 (256*3) bytes\n * large and contains RGB triplets for each of the 256 palette entries.\n * The default value is colormap.lmp. If the file is not found,\n * a default palette (from Quake 1) is used.\n * Property type: string.\n */\n#define AI_CONFIG_IMPORT_MDL_COLORMAP \\\n \"IMPORT_MDL_COLORMAP\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_RemoveRedundantMaterials step to\n * keep materials matching a name in a given list.\n *\n * This is a list of 1 to n strings, ' ' serves as delimiter character.\n * Identifiers containing whitespaces must be enclosed in *single*\n * quotation marks. For example:\n * \"keep-me and_me_to anotherMaterialToBeKept \\'name with whitespace\\'\".\n * If a material matches on of these names, it will not be modified or\n * removed by the postprocessing step nor will other materials be replaced\n * by a reference to it.
\n * This option might be useful if you are using some magic material names\n * to pass additional semantics through the content pipeline. This ensures\n * they won't be optimized away, but a general optimization is still\n * performed for materials not contained in the list.\n * Property type: String. Default value: n/a\n * @note Linefeeds, tabs or carriage returns are treated as whitespace.\n * Material names are case sensitive.\n */\n#define AI_CONFIG_PP_RRM_EXCLUDE_LIST \\\n \"PP_RRM_EXCLUDE_LIST\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_PreTransformVertices step to\n * keep the scene hierarchy. Meshes are moved to worldspace, but\n * no optimization is performed (read: meshes with equal materials are not\n * joined. The total number of meshes won't change).\n *\n * This option could be of use for you if the scene hierarchy contains\n * important additional information which you intend to parse.\n * For rendering, you can still render all meshes in the scene without\n * any transformations.\n * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_PP_PTV_KEEP_HIERARCHY \\\n \"PP_PTV_KEEP_HIERARCHY\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_PreTransformVertices step to normalize\n * all vertex components into the [-1,1] range. That is, a bounding box\n * for the whole scene is computed, the maximum component is taken and all\n * meshes are scaled appropriately (uniformly of course!).\n * This might be useful if you don't know the spatial dimension of the input\n * data*/\n#define AI_CONFIG_PP_PTV_NORMALIZE \\\n \"PP_PTV_NORMALIZE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_PreTransformVertices step to use\n * a users defined matrix as the scene root node transformation before\n * transforming vertices.\n * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION \\\n \"PP_PTV_ADD_ROOT_TRANSFORMATION\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_PreTransformVertices step to use\n * a users defined matrix as the scene root node transformation before\n * transforming vertices. This property correspond to the 'a1' component\n * of the transformation matrix.\n * Property type: aiMatrix4x4.\n */\n#define AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION \\\n \"PP_PTV_ROOT_TRANSFORMATION\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_FindDegenerates step to\n * remove degenerated primitives from the import - immediately.\n *\n * The default behaviour converts degenerated triangles to lines and\n * degenerated lines to points. See the documentation to the\n * #aiProcess_FindDegenerates step for a detailed example of the various ways\n * to get rid of these lines and points if you don't want them.\n * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_PP_FD_REMOVE \\\n \"PP_FD_REMOVE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_OptimizeGraph step to preserve nodes\n * matching a name in a given list.\n *\n * This is a list of 1 to n strings, ' ' serves as delimiter character.\n * Identifiers containing whitespaces must be enclosed in *single*\n * quotation marks. For example:\n * \"keep-me and_me_to anotherNodeToBeKept \\'name with whitespace\\'\".\n * If a node matches on of these names, it will not be modified or\n * removed by the postprocessing step.
\n * This option might be useful if you are using some magic node names\n * to pass additional semantics through the content pipeline. This ensures\n * they won't be optimized away, but a general optimization is still\n * performed for nodes not contained in the list.\n * Property type: String. Default value: n/a\n * @note Linefeeds, tabs or carriage returns are treated as whitespace.\n * Node names are case sensitive.\n */\n#define AI_CONFIG_PP_OG_EXCLUDE_LIST \\\n \"PP_OG_EXCLUDE_LIST\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set the maximum number of triangles in a mesh.\n *\n * This is used by the \"SplitLargeMeshes\" PostProcess-Step to determine\n * whether a mesh must be split or not.\n * @note The default value is AI_SLM_DEFAULT_MAX_TRIANGLES\n * Property type: integer.\n */\n#define AI_CONFIG_PP_SLM_TRIANGLE_LIMIT \\\n \"PP_SLM_TRIANGLE_LIMIT\"\n\n// default value for AI_CONFIG_PP_SLM_TRIANGLE_LIMIT\n#if (!defined AI_SLM_DEFAULT_MAX_TRIANGLES)\n# define AI_SLM_DEFAULT_MAX_TRIANGLES 1000000\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Set the maximum number of vertices in a mesh.\n *\n * This is used by the \"SplitLargeMeshes\" PostProcess-Step to determine\n * whether a mesh must be split or not.\n * @note The default value is AI_SLM_DEFAULT_MAX_VERTICES\n * Property type: integer.\n */\n#define AI_CONFIG_PP_SLM_VERTEX_LIMIT \\\n \"PP_SLM_VERTEX_LIMIT\"\n\n// default value for AI_CONFIG_PP_SLM_VERTEX_LIMIT\n#if (!defined AI_SLM_DEFAULT_MAX_VERTICES)\n# define AI_SLM_DEFAULT_MAX_VERTICES 1000000\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Set the maximum number of bones affecting a single vertex\n *\n * This is used by the #aiProcess_LimitBoneWeights PostProcess-Step.\n * @note The default value is AI_LBW_MAX_WEIGHTS\n * Property type: integer.*/\n#define AI_CONFIG_PP_LBW_MAX_WEIGHTS \\\n \"PP_LBW_MAX_WEIGHTS\"\n\n// default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS\n#if (!defined AI_LMW_MAX_WEIGHTS)\n# define AI_LMW_MAX_WEIGHTS 0x4\n#endif // !! AI_LMW_MAX_WEIGHTS\n\n// ---------------------------------------------------------------------------\n/** @brief Lower the deboning threshold in order to remove more bones.\n *\n * This is used by the #aiProcess_Debone PostProcess-Step.\n * @note The default value is AI_DEBONE_THRESHOLD\n * Property type: float.*/\n#define AI_CONFIG_PP_DB_THRESHOLD \\\n \"PP_DB_THRESHOLD\"\n\n// default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS\n#if (!defined AI_DEBONE_THRESHOLD)\n# define AI_DEBONE_THRESHOLD 1.0f\n#endif // !! AI_DEBONE_THRESHOLD\n\n// ---------------------------------------------------------------------------\n/** @brief Require all bones qualify for deboning before removing any\n *\n * This is used by the #aiProcess_Debone PostProcess-Step.\n * @note The default value is 0\n * Property type: bool.*/\n#define AI_CONFIG_PP_DB_ALL_OR_NONE \\\n \"PP_DB_ALL_OR_NONE\"\n\n/** @brief Default value for the #AI_CONFIG_PP_ICL_PTCACHE_SIZE property\n */\n#ifndef PP_ICL_PTCACHE_SIZE\n# define PP_ICL_PTCACHE_SIZE 12\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Set the size of the post-transform vertex cache to optimize the\n * vertices for. This configures the #aiProcess_ImproveCacheLocality step.\n *\n * The size is given in vertices. Of course you can't know how the vertex\n * format will exactly look like after the import returns, but you can still\n * guess what your meshes will probably have.\n * @note The default value is #PP_ICL_PTCACHE_SIZE. That results in slight\n * performance improvements for most nVidia/AMD cards since 2002.\n * Property type: integer.\n */\n#define AI_CONFIG_PP_ICL_PTCACHE_SIZE \"PP_ICL_PTCACHE_SIZE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Enumerates components of the aiScene and aiMesh data structures\n * that can be excluded from the import using the #aiProcess_RemoveComponent step.\n *\n * See the documentation to #aiProcess_RemoveComponent for more details.\n */\nenum aiComponent\n{\n /** Normal vectors */\n#ifdef SWIG\n aiComponent_NORMALS = 0x2,\n#else\n aiComponent_NORMALS = 0x2u,\n#endif\n\n /** Tangents and bitangents go always together ... */\n#ifdef SWIG\n aiComponent_TANGENTS_AND_BITANGENTS = 0x4,\n#else\n aiComponent_TANGENTS_AND_BITANGENTS = 0x4u,\n#endif\n\n /** ALL color sets\n * Use aiComponent_COLORn(N) to specify the N'th set */\n aiComponent_COLORS = 0x8,\n\n /** ALL texture UV sets\n * aiComponent_TEXCOORDn(N) to specify the N'th set */\n aiComponent_TEXCOORDS = 0x10,\n\n /** Removes all bone weights from all meshes.\n * The scenegraph nodes corresponding to the bones are NOT removed.\n * use the #aiProcess_OptimizeGraph step to do this */\n aiComponent_BONEWEIGHTS = 0x20,\n\n /** Removes all node animations (aiScene::mAnimations).\n * The corresponding scenegraph nodes are NOT removed.\n * use the #aiProcess_OptimizeGraph step to do this */\n aiComponent_ANIMATIONS = 0x40,\n\n /** Removes all embedded textures (aiScene::mTextures) */\n aiComponent_TEXTURES = 0x80,\n\n /** Removes all light sources (aiScene::mLights).\n * The corresponding scenegraph nodes are NOT removed.\n * use the #aiProcess_OptimizeGraph step to do this */\n aiComponent_LIGHTS = 0x100,\n\n /** Removes all cameras (aiScene::mCameras).\n * The corresponding scenegraph nodes are NOT removed.\n * use the #aiProcess_OptimizeGraph step to do this */\n aiComponent_CAMERAS = 0x200,\n\n /** Removes all meshes (aiScene::mMeshes). */\n aiComponent_MESHES = 0x400,\n\n /** Removes all materials. One default material will\n * be generated, so aiScene::mNumMaterials will be 1. */\n aiComponent_MATERIALS = 0x800,\n\n\n /** This value is not used. It is just there to force the\n * compiler to map this enum to a 32 Bit integer. */\n#ifndef SWIG\n _aiComponent_Force32Bit = 0x9fffffff\n#endif\n};\n\n// Remove a specific color channel 'n'\n#define aiComponent_COLORSn(n) (1u << (n+20u))\n\n// Remove a specific UV channel 'n'\n#define aiComponent_TEXCOORDSn(n) (1u << (n+25u))\n\n// ---------------------------------------------------------------------------\n/** @brief Input parameter to the #aiProcess_RemoveComponent step:\n * Specifies the parts of the data structure to be removed.\n *\n * See the documentation to this step for further details. The property\n * is expected to be an integer, a bitwise combination of the\n * #aiComponent flags defined above in this header. The default\n * value is 0. Important: if no valid mesh is remaining after the\n * step has been executed (e.g you thought it was funny to specify ALL\n * of the flags defined above) the import FAILS. Mainly because there is\n * no data to work on anymore ...\n */\n#define AI_CONFIG_PP_RVC_FLAGS \\\n \"PP_RVC_FLAGS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Input parameter to the #aiProcess_SortByPType step:\n * Specifies which primitive types are removed by the step.\n *\n * This is a bitwise combination of the aiPrimitiveType flags.\n * Specifying all of them is illegal, of course. A typical use would\n * be to exclude all line and point meshes from the import. This\n * is an integer property, its default value is 0.\n */\n#define AI_CONFIG_PP_SBP_REMOVE \\\n \"PP_SBP_REMOVE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Input parameter to the #aiProcess_FindInvalidData step:\n * Specifies the floating-point accuracy for animation values. The step\n * checks for animation tracks where all frame values are absolutely equal\n * and removes them. This tweakable controls the epsilon for floating-point\n * comparisons - two keys are considered equal if the invariant\n * abs(n0-n1)>epsilon holds true for all vector respectively quaternion\n * components. The default value is 0.f - comparisons are exact then.\n */\n#define AI_CONFIG_PP_FID_ANIM_ACCURACY \\\n \"PP_FID_ANIM_ACCURACY\"\n\n\n// TransformUVCoords evaluates UV scalings\n#define AI_UVTRAFO_SCALING 0x1\n\n// TransformUVCoords evaluates UV rotations\n#define AI_UVTRAFO_ROTATION 0x2\n\n// TransformUVCoords evaluates UV translation\n#define AI_UVTRAFO_TRANSLATION 0x4\n\n// Everything baked together -> default value\n#define AI_UVTRAFO_ALL (AI_UVTRAFO_SCALING | AI_UVTRAFO_ROTATION | AI_UVTRAFO_TRANSLATION)\n\n// ---------------------------------------------------------------------------\n/** @brief Input parameter to the #aiProcess_TransformUVCoords step:\n * Specifies which UV transformations are evaluated.\n *\n * This is a bitwise combination of the AI_UVTRAFO_XXX flags (integer\n * property, of course). By default all transformations are enabled\n * (AI_UVTRAFO_ALL).\n */\n#define AI_CONFIG_PP_TUV_EVALUATE \\\n \"PP_TUV_EVALUATE\"\n\n// ---------------------------------------------------------------------------\n/** @brief A hint to assimp to favour speed against import quality.\n *\n * Enabling this option may result in faster loading, but it needn't.\n * It represents just a hint to loaders and post-processing steps to use\n * faster code paths, if possible.\n * This property is expected to be an integer, != 0 stands for true.\n * The default value is 0.\n */\n#define AI_CONFIG_FAVOUR_SPEED \\\n \"FAVOUR_SPEED\"\n\n\n// ###########################################################################\n// IMPORTER SETTINGS\n// Various stuff to fine-tune the behaviour of specific importer plugins.\n// ###########################################################################\n\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will merge all geometry layers present\n * in the source file or take only the first.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS \\\n \"IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read all materials present in the\n * source file or take only the referenced materials.\n *\n * This is void unless IMPORT_FBX_READ_MATERIALS=1.\n *\n * The default value is false (0)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_ALL_MATERIALS \\\n \"IMPORT_FBX_READ_ALL_MATERIALS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read materials.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_MATERIALS \\\n \"IMPORT_FBX_READ_MATERIALS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read embedded textures.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_TEXTURES \\\n \"IMPORT_FBX_READ_TEXTURES\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read cameras.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_CAMERAS \\\n \"IMPORT_FBX_READ_CAMERAS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read light sources.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_LIGHTS \\\n \"IMPORT_FBX_READ_LIGHTS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read animations.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_ANIMATIONS \\\n \"IMPORT_FBX_READ_ANIMATIONS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will act in strict mode in which only\n * FBX 2013 is supported and any other sub formats are rejected. FBX 2013\n * is the primary target for the importer, so this format is best\n * supported and well-tested.\n *\n * The default value is false (0)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_STRICT_MODE \\\n \"IMPORT_FBX_STRICT_MODE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will preserve pivot points for\n * transformations (as extra nodes). If set to false, pivots and offsets\n * will be evaluated whenever possible.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS \\\n \"IMPORT_FBX_PRESERVE_PIVOTS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies whether the importer will drop empty animation curves or\n * animation curves which match the bind pose transformation over their\n * entire defined range.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES \\\n \"IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES\"\n\n\n\n// ---------------------------------------------------------------------------\n/** @brief Set the vertex animation keyframe to be imported\n *\n * ASSIMP does not support vertex keyframes (only bone animation is supported).\n * The library reads only one frame of models with vertex animations.\n * By default this is the first frame.\n * \\note The default value is 0. This option applies to all importers.\n * However, it is also possible to override the global setting\n * for a specific loader. You can use the AI_CONFIG_IMPORT_XXX_KEYFRAME\n * options (where XXX is a placeholder for the file format for which you\n * want to override the global setting).\n * Property type: integer.\n */\n#define AI_CONFIG_IMPORT_GLOBAL_KEYFRAME \"IMPORT_GLOBAL_KEYFRAME\"\n\n#define AI_CONFIG_IMPORT_MD3_KEYFRAME \"IMPORT_MD3_KEYFRAME\"\n#define AI_CONFIG_IMPORT_MD2_KEYFRAME \"IMPORT_MD2_KEYFRAME\"\n#define AI_CONFIG_IMPORT_MDL_KEYFRAME \"IMPORT_MDL_KEYFRAME\"\n#define AI_CONFIG_IMPORT_MDC_KEYFRAME \"IMPORT_MDC_KEYFRAME\"\n#define AI_CONFIG_IMPORT_SMD_KEYFRAME \"IMPORT_SMD_KEYFRAME\"\n#define AI_CONFIG_IMPORT_UNREAL_KEYFRAME \"IMPORT_UNREAL_KEYFRAME\"\n\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the AC loader to collect all surfaces which have the\n * \"Backface cull\" flag set in separate meshes.\n *\n * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL \\\n \"IMPORT_AC_SEPARATE_BFCULL\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures whether the AC loader evaluates subdivision surfaces (\n * indicated by the presence of the 'subdiv' attribute in the file). By\n * default, Assimp performs the subdivision using the standard\n * Catmull-Clark algorithm\n *\n * * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_AC_EVAL_SUBDIVISION \\\n \"IMPORT_AC_EVAL_SUBDIVISION\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the UNREAL 3D loader to separate faces with different\n * surface flags (e.g. two-sided vs. single-sided).\n *\n * * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS \\\n \"UNREAL_HANDLE_FLAGS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the terragen import plugin to compute uv's for\n * terrains, if not given. Furthermore a default texture is assigned.\n *\n * UV coordinates for terrains are so simple to compute that you'll usually\n * want to compute them on your own, if you need them. This option is intended\n * for model viewers which want to offer an easy way to apply textures to\n * terrains.\n * * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_IMPORT_TER_MAKE_UVS \\\n \"IMPORT_TER_MAKE_UVS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the ASE loader to always reconstruct normal vectors\n * basing on the smoothing groups loaded from the file.\n *\n * Some ASE files have carry invalid normals, other don't.\n * * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS \\\n \"IMPORT_ASE_RECONSTRUCT_NORMALS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the M3D loader to detect and process multi-part\n * Quake player models.\n *\n * These models usually consist of 3 files, lower.md3, upper.md3 and\n * head.md3. If this property is set to true, Assimp will try to load and\n * combine all three files if one of them is loaded.\n * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART \\\n \"IMPORT_MD3_HANDLE_MULTIPART\"\n\n// ---------------------------------------------------------------------------\n/** @brief Tells the MD3 loader which skin files to load.\n *\n * When loading MD3 files, Assimp checks whether a file\n * [md3_file_name]_[skin_name].skin is existing. These files are used by\n * Quake III to be able to assign different skins (e.g. red and blue team)\n * to models. 'default', 'red', 'blue' are typical skin names.\n * Property type: String. Default value: \"default\".\n */\n#define AI_CONFIG_IMPORT_MD3_SKIN_NAME \\\n \"IMPORT_MD3_SKIN_NAME\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specify the Quake 3 shader file to be used for a particular\n * MD3 file. This can also be a search path.\n *\n * By default Assimp's behaviour is as follows: If a MD3 file\n * any_path/models/any_q3_subdir/model_name/file_name.md3 is\n * loaded, the library tries to locate the corresponding shader file in\n * any_path/scripts/model_name.shader. This property overrides this\n * behaviour. It can either specify a full path to the shader to be loaded\n * or alternatively the path (relative or absolute) to the directory where\n * the shaders for all MD3s to be loaded reside. Assimp attempts to open\n * IMPORT_MD3_SHADER_SRC/model_name.shader first, IMPORT_MD3_SHADER_SRC/file_name.shader\n * is the fallback file. Note that IMPORT_MD3_SHADER_SRC should have a terminal (back)slash.\n * Property type: String. Default value: n/a.\n */\n#define AI_CONFIG_IMPORT_MD3_SHADER_SRC \\\n \"IMPORT_MD3_SHADER_SRC\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the LWO loader to load just one layer from the model.\n *\n * LWO files consist of layers and in some cases it could be useful to load\n * only one of them. This property can be either a string - which specifies\n * the name of the layer - or an integer - the index of the layer. If the\n * property is not set the whole LWO model is loaded. Loading fails if the\n * requested layer is not available. The layer index is zero-based and the\n * layer name may not be empty.
\n * Property type: Integer. Default value: all layers are loaded.\n */\n#define AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY \\\n \"IMPORT_LWO_ONE_LAYER_ONLY\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the MD5 loader to not load the MD5ANIM file for\n * a MD5MESH file automatically.\n *\n * The default strategy is to look for a file with the same name but the\n * MD5ANIM extension in the same directory. If it is found, it is loaded\n * and combined with the MD5MESH file. This configuration option can be\n * used to disable this behaviour.\n *\n * * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD \\\n \"IMPORT_MD5_NO_ANIM_AUTOLOAD\"\n\n// ---------------------------------------------------------------------------\n/** @brief Defines the begin of the time range for which the LWS loader\n * evaluates animations and computes aiNodeAnim's.\n *\n * Assimp provides full conversion of LightWave's envelope system, including\n * pre and post conditions. The loader computes linearly subsampled animation\n * channels with the frame rate given in the LWS file. This property defines\n * the start time. Note: animation channels are only generated if a node\n * has at least one envelope with more tan one key assigned. This property.\n * is given in frames, '0' is the first frame. By default, if this property\n * is not set, the importer takes the animation start from the input LWS\n * file ('FirstFrame' line)
\n * Property type: Integer. Default value: taken from file.\n *\n * @see AI_CONFIG_IMPORT_LWS_ANIM_END - end of the imported time range\n */\n#define AI_CONFIG_IMPORT_LWS_ANIM_START \\\n \"IMPORT_LWS_ANIM_START\"\n#define AI_CONFIG_IMPORT_LWS_ANIM_END \\\n \"IMPORT_LWS_ANIM_END\"\n\n// ---------------------------------------------------------------------------\n/** @brief Defines the output frame rate of the IRR loader.\n *\n * IRR animations are difficult to convert for Assimp and there will\n * always be a loss of quality. This setting defines how many keys per second\n * are returned by the converter.
\n * Property type: integer. Default value: 100\n */\n#define AI_CONFIG_IMPORT_IRR_ANIM_FPS \\\n \"IMPORT_IRR_ANIM_FPS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Ogre Importer will try to find referenced materials from this file.\n *\n * Ogre meshes reference with material names, this does not tell Assimp the file\n * where it is located in. Assimp will try to find the source file in the following\n * order: .material, .material and\n * lastly the material name defined by this config property.\n *
\n * Property type: String. Default value: Scene.material.\n */\n#define AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE \\\n \"IMPORT_OGRE_MATERIAL_FILE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Ogre Importer detect the texture usage from its filename.\n *\n * Ogre material texture units do not define texture type, the textures usage\n * depends on the used shader or Ogre's fixed pipeline. If this config property\n * is true Assimp will try to detect the type from the textures filename postfix:\n * _n, _nrm, _nrml, _normal, _normals and _normalmap for normal map, _s, _spec,\n * _specular and _specularmap for specular map, _l, _light, _lightmap, _occ\n * and _occlusion for light map, _disp and _displacement for displacement map.\n * The matching is case insensitive. Post fix is taken between the last\n * underscore and the last period.\n * Default behavior is to detect type from lower cased texture unit name by\n * matching against: normalmap, specularmap, lightmap and displacementmap.\n * For both cases if no match is found aiTextureType_DIFFUSE is used.\n *
\n * Property type: Bool. Default value: false.\n */\n#define AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME \\\n \"IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME\"\n\n/** @brief Specifies whether the IFC loader skips over IfcSpace elements.\n *\n * IfcSpace elements (and their geometric representations) are used to\n * represent, well, free space in a building storey.
\n * Property type: Bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS \"IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS\"\n\n /** @brief Specifies whether the Android JNI asset extraction is supported.\n *\n * Turn on this option if you want to manage assets in native\n * Android application without having to keep the internal directory and asset\n * manager pointer.\n */\n #define AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT \"AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT\"\n\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies whether the IFC loader skips over\n * shape representations of type 'Curve2D'.\n *\n * A lot of files contain both a faceted mesh representation and a outline\n * with a presentation type of 'Curve2D'. Currently Assimp doesn't convert those,\n * so turning this option off just clutters the log with errors.
\n * Property type: Bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_IFC_SKIP_CURVE_REPRESENTATIONS \"IMPORT_IFC_SKIP_CURVE_REPRESENTATIONS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies whether the IFC loader will use its own, custom triangulation\n * algorithm to triangulate wall and floor meshes.\n *\n * If this property is set to false, walls will be either triangulated by\n * #aiProcess_Triangulate or will be passed through as huge polygons with\n * faked holes (i.e. holes that are connected with the outer boundary using\n * a dummy edge). It is highly recommended to set this property to true\n * if you want triangulated data because #aiProcess_Triangulate is known to\n * have problems with the kind of polygons that the IFC loader spits out for\n * complicated meshes.\n * Property type: Bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION \"IMPORT_IFC_CUSTOM_TRIANGULATION\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies whether the Collada loader will ignore the provided up direction.\n *\n * If this property is set to true, the up direction provided in the file header will\n * be ignored and the file will be loaded as is.\n * Property type: Bool. Default value: false.\n */\n#define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION \"IMPORT_COLLADA_IGNORE_UP_DIRECTION\"\n\n// ---------- All the Export defines ------------\n\n/** @brief Specifies the xfile use double for real values of float\n *\n * Property type: Bool. Default value: false.\n */\n\n#define AI_CONFIG_EXPORT_XFILE_64BIT \"EXPORT_XFILE_64BIT\"\n\n#endif // !! AI_CONFIG_H_INC\n"}, {"path": "includes/assimp/defs.h", "language": "code", "loc": 230, "comment_density": 0.587, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file defs.h\n * @brief Assimp build configuration setup. See the notes in the comment\n * blocks to find out how to customize _your_ Assimp build.\n */\n\n#ifndef INCLUDED_AI_DEFINES_H\n#define INCLUDED_AI_DEFINES_H\n\n //////////////////////////////////////////////////////////////////////////\n /* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific\n * file format loader. The loader is be excluded from the\n * build in this case. 'XX' stands for the most common file\n * extension of the file format. E.g.:\n * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader.\n *\n * If you're unsure about that, take a look at the implementation of the\n * import plugin you wish to disable. You'll find the right define in the\n * first lines of the corresponding unit.\n *\n * Other (mixed) configuration switches are listed here:\n * ASSIMP_BUILD_NO_COMPRESSED_X\n * - Disable support for compressed X files (zip)\n * ASSIMP_BUILD_NO_COMPRESSED_BLEND\n * - Disable support for compressed Blender files (zip)\n * ASSIMP_BUILD_NO_COMPRESSED_IFC\n * - Disable support for IFCZIP files (unzip)\n */\n //////////////////////////////////////////////////////////////////////////\n\n#ifndef ASSIMP_BUILD_NO_COMPRESSED_X\n# define ASSIMP_BUILD_NEED_Z_INFLATE\n#endif\n\n#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND\n# define ASSIMP_BUILD_NEED_Z_INFLATE\n#endif\n\n#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC\n# define ASSIMP_BUILD_NEED_Z_INFLATE\n# define ASSIMP_BUILD_NEED_UNZIP\n#endif\n\n#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER\n# define ASSIMP_BUILD_NEED_Z_INFLATE\n# define ASSIMP_BUILD_NEED_UNZIP\n#endif\n\n //////////////////////////////////////////////////////////////////////////\n /* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific\n * post processing step. This is the current list of process names ('XX'):\n * CALCTANGENTS\n * JOINVERTICES\n * TRIANGULATE\n * GENFACENORMALS\n * GENVERTEXNORMALS\n * REMOVEVC\n * SPLITLARGEMESHES\n * PRETRANSFORMVERTICES\n * LIMITBONEWEIGHTS\n * VALIDATEDS\n * IMPROVECACHELOCALITY\n * FIXINFACINGNORMALS\n * REMOVE_REDUNDANTMATERIALS\n * OPTIMIZEGRAPH\n * SORTBYPTYPE\n * FINDINVALIDDATA\n * TRANSFORMTEXCOORDS\n * GENUVCOORDS\n * ENTITYMESHBUILDER\n * MAKELEFTHANDED\n * FLIPUVS\n * FLIPWINDINGORDER\n * OPTIMIZEMESHES\n * OPTIMIZEANIMS\n * OPTIMIZEGRAPH\n * GENENTITYMESHES\n * FIXTEXTUREPATHS */\n //////////////////////////////////////////////////////////////////////////\n\n#ifdef _MSC_VER\n# undef ASSIMP_API\n\n //////////////////////////////////////////////////////////////////////////\n /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */\n //////////////////////////////////////////////////////////////////////////\n# ifdef ASSIMP_BUILD_DLL_EXPORT\n# define ASSIMP_API __declspec(dllexport)\n# define ASSIMP_API_WINONLY __declspec(dllexport)\n# pragma warning (disable : 4251)\n\n //////////////////////////////////////////////////////////////////////////\n /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in\n * an external DLL under Windows. Default is static linkage. */\n //////////////////////////////////////////////////////////////////////////\n# elif (defined ASSIMP_DLL)\n# define ASSIMP_API __declspec(dllimport)\n# define ASSIMP_API_WINONLY __declspec(dllimport)\n# else\n# define ASSIMP_API\n# define ASSIMP_API_WINONLY\n# endif\n\n /* Force the compiler to inline a function, if possible\n */\n# define AI_FORCE_INLINE __forceinline\n\n /* Tells the compiler that a function never returns. Used in code analysis\n * to skip dead paths (e.g. after an assertion evaluated to false). */\n# define AI_WONT_RETURN __declspec(noreturn)\n\n#elif defined(SWIG)\n\n /* Do nothing, the relevant defines are all in AssimpSwigPort.i */\n\n#else\n\n# define AI_WONT_RETURN\n\n# define ASSIMP_API __attribute__ ((visibility(\"default\")))\n# define ASSIMP_API_WINONLY\n# define AI_FORCE_INLINE inline\n#endif // (defined _MSC_VER)\n\n#ifdef __GNUC__\n# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))\n#else\n# define AI_WONT_RETURN_SUFFIX\n#endif // (defined __clang__)\n\n#ifdef __cplusplus\n /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up\n * in doxydocs.\n */\n# define C_STRUCT\n# define C_ENUM\n#else\n //////////////////////////////////////////////////////////////////////////\n /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD\n * is defined by Doxygen's preprocessor. The corresponding\n * entries in the DOXYFILE are: */\n //////////////////////////////////////////////////////////////////////////\n#if 0\n ENABLE_PREPROCESSING = YES\n MACRO_EXPANSION = YES\n EXPAND_ONLY_PREDEF = YES\n SEARCH_INCLUDES = YES\n INCLUDE_PATH =\n INCLUDE_FILE_PATTERNS =\n PREDEFINED = ASSIMP_DOXYGEN_BUILD=1\n EXPAND_AS_DEFINED = C_STRUCT C_ENUM\n SKIP_FUNCTION_MACROS = YES\n#endif\n //////////////////////////////////////////////////////////////////////////\n /* Doxygen gets confused if we use c-struct typedefs to avoid\n * the explicit 'struct' notation. This trick here has the same\n * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need\n * to typedef all structs/enums. */\n //////////////////////////////////////////////////////////////////////////\n# if (defined ASSIMP_DOXYGEN_BUILD)\n# define C_STRUCT\n# define C_ENUM\n# else\n# define C_STRUCT struct\n# define C_ENUM enum\n# endif\n#endif\n\n#if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))\n#error Currently, Borland is unsupported. Feel free to port Assimp.\n\n// \"W8059 Packgr��e der Struktur ge�ndert\"\n\n#endif\n\n\n //////////////////////////////////////////////////////////////////////////\n /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp\n * without threading support. The library doesn't utilize\n * threads then and is itself not threadsafe. */\n //////////////////////////////////////////////////////////////////////////\n#ifndef ASSIMP_BUILD_SINGLETHREADED\n# define ASSIMP_BUILD_SINGLETHREADED\n#endif\n\n#if defined(_DEBUG) || ! defined(NDEBUG)\n# define ASSIMP_BUILD_DEBUG\n#endif\n\n //////////////////////////////////////////////////////////////////////////\n /* Useful constants */\n //////////////////////////////////////////////////////////////////////////\n\n/* This is PI. Hi PI. */\n#define AI_MATH_PI (3.141592653589793238462643383279 )\n#define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)\n#define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)\n\n/* And this is to avoid endless casts to float */\n#define AI_MATH_PI_F (3.1415926538f)\n#define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)\n#define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)\n\n/* Tiny macro to convert from radians to degrees and back */\n#define AI_DEG_TO_RAD(x) ((x)*0.0174532925f)\n#define AI_RAD_TO_DEG(x) ((x)*57.2957795f)\n\n/* Support for big-endian builds */\n#if defined(__BYTE_ORDER__)\n# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)\n# if !defined(__BIG_ENDIAN__)\n# define __BIG_ENDIAN__\n# endif\n# else /* little endian */\n# if defined (__BIG_ENDIAN__)\n# undef __BIG_ENDIAN__\n# endif\n# endif\n#endif\n#if defined(__BIG_ENDIAN__)\n# define AI_BUILD_BIG_ENDIAN\n#endif\n\n\n/* To avoid running out of memory\n * This can be adjusted for specific use cases\n * It's NOT a total limit, just a limit for individual allocations\n */\n#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))\n\n\n#endif // !! INCLUDED_AI_DEFINES_H\n"}, {"path": "includes/assimp/importerdesc.h", "language": "code", "loc": 117, "comment_density": 0.786, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file importerdesc.h\n * @brief #aiImporterFlags, aiImporterDesc implementation.\n */\n#ifndef INCLUDED_AI_IMPORTER_DESC_H\n#define INCLUDED_AI_IMPORTER_DESC_H\n\n\n/** Mixed set of flags for #aiImporterDesc, indicating some features\n * common to many importers*/\nenum aiImporterFlags\n{\n /** Indicates that there is a textual encoding of the\n * file format; and that it is supported.*/\n aiImporterFlags_SupportTextFlavour = 0x1,\n\n /** Indicates that there is a binary encoding of the\n * file format; and that it is supported.*/\n aiImporterFlags_SupportBinaryFlavour = 0x2,\n\n /** Indicates that there is a compressed encoding of the\n * file format; and that it is supported.*/\n aiImporterFlags_SupportCompressedFlavour = 0x4,\n\n /** Indicates that the importer reads only a very particular\n * subset of the file format. This happens commonly for\n * declarative or procedural formats which cannot easily\n * be mapped to #aiScene */\n aiImporterFlags_LimitedSupport = 0x8,\n\n /** Indicates that the importer is highly experimental and\n * should be used with care. This only happens for trunk\n * (i.e. SVN) versions, experimental code is not included\n * in releases. */\n aiImporterFlags_Experimental = 0x10\n};\n\n\n/** Meta information about a particular importer. Importers need to fill\n * this structure, but they can freely decide how talkative they are.\n * A common use case for loader meta info is a user interface\n * in which the user can choose between various import/export file\n * formats. Building such an UI by hand means a lot of maintenance\n * as importers/exporters are added to Assimp, so it might be useful\n * to have a common mechanism to query some rough importer\n * characteristics. */\nstruct aiImporterDesc\n{\n /** Full name of the importer (i.e. Blender3D importer)*/\n const char* mName;\n\n /** Original author (left blank if unknown or whole assimp team) */\n const char* mAuthor;\n\n /** Current maintainer, left blank if the author maintains */\n const char* mMaintainer;\n\n /** Implementation comments, i.e. unimplemented features*/\n const char* mComments;\n\n /** These flags indicate some characteristics common to many\n importers. */\n unsigned int mFlags;\n\n /** Minimum format version that can be loaded im major.minor format,\n both are set to 0 if there is either no version scheme\n or if the loader doesn't care. */\n unsigned int mMinMajor;\n unsigned int mMinMinor;\n\n /** Maximum format version that can be loaded im major.minor format,\n both are set to 0 if there is either no version scheme\n or if the loader doesn't care. Loaders that expect to be\n forward-compatible to potential future format versions should\n indicate zero, otherwise they should specify the current\n maximum version.*/\n unsigned int mMaxMajor;\n unsigned int mMaxMinor;\n\n /** List of file extensions this importer can handle.\n List entries are separated by space characters.\n All entries are lower case without a leading dot (i.e.\n \"xml dae\" would be a valid value. Note that multiple\n importers may respond to the same file extension -\n assimp calls all importers in the order in which they\n are registered and each importer gets the opportunity\n to load the file until one importer \"claims\" the file. Apart\n from file extension checks, importers typically use\n other methods to quickly reject files (i.e. magic\n words) so this does not mean that common or generic\n file extensions such as XML would be tediously slow. */\n const char* mFileExtensions;\n};\n\n/** \\brief Returns the Importer description for a given extension.\n\nWill return a NULL-pointer if no assigned importer desc. was found for the given extension\n \\param extension [in] The extension to look for\n \\return A pointer showing to the ImporterDesc, \\see aiImporterDesc.\n*/\nASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension );\n\n#endif\n"}, {"path": "includes/assimp/light.h", "language": "code", "loc": 218, "comment_density": 0.771, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file light.h\n * @brief Defines the aiLight data structure\n */\n\n#ifndef __AI_LIGHT_H_INC__\n#define __AI_LIGHT_H_INC__\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n/** Enumerates all supported types of light sources.\n */\nenum aiLightSourceType\n{\n aiLightSource_UNDEFINED = 0x0,\n\n //! A directional light source has a well-defined direction\n //! but is infinitely far away. That's quite a good\n //! approximation for sun light.\n aiLightSource_DIRECTIONAL = 0x1,\n\n //! A point light source has a well-defined position\n //! in space but no direction - it emits light in all\n //! directions. A normal bulb is a point light.\n aiLightSource_POINT = 0x2,\n\n //! A spot light source emits light in a specific\n //! angle. It has a position and a direction it is pointing to.\n //! A good example for a spot light is a light spot in\n //! sport arenas.\n aiLightSource_SPOT = 0x3,\n\n //! The generic light level of the world, including the bounces\n //! of all other light sources.\n //! Typically, there's at most one ambient light in a scene.\n //! This light type doesn't have a valid position, direction, or\n //! other properties, just a color.\n aiLightSource_AMBIENT = 0x4,\n\n //! An area light is a rectangle with predefined size that uniformly\n //! emits light from one of its sides. The position is center of the\n //! rectangle and direction is its normal vector.\n aiLightSource_AREA = 0x5,\n\n /** This value is not used. It is just there to force the\n * compiler to map this enum to a 32 Bit integer.\n */\n#ifndef SWIG\n _aiLightSource_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** Helper structure to describe a light source.\n *\n * Assimp supports multiple sorts of light sources, including\n * directional, point and spot lights. All of them are defined with just\n * a single structure and distinguished by their parameters.\n * Note - some file formats (such as 3DS, ASE) export a \"target point\" -\n * the point a spot light is looking at (it can even be animated). Assimp\n * writes the target point as a subnode of a spotlights's main node,\n * called \".Target\". However, this is just additional information\n * then, the transformation tracks of the main node make the\n * spot light already point in the right direction.\n*/\nstruct aiLight\n{\n /** The name of the light source.\n *\n * There must be a node in the scenegraph with the same name.\n * This node specifies the position of the light in the scene\n * hierarchy and can be animated.\n */\n C_STRUCT aiString mName;\n\n /** The type of the light source.\n *\n * aiLightSource_UNDEFINED is not a valid value for this member.\n */\n C_ENUM aiLightSourceType mType;\n\n /** Position of the light source in space. Relative to the\n * transformation of the node corresponding to the light.\n *\n * The position is undefined for directional lights.\n */\n C_STRUCT aiVector3D mPosition;\n\n /** Direction of the light source in space. Relative to the\n * transformation of the node corresponding to the light.\n *\n * The direction is undefined for point lights. The vector\n * may be normalized, but it needn't.\n */\n C_STRUCT aiVector3D mDirection;\n\n /** Up direction of the light source in space. Relative to the\n * transformation of the node corresponding to the light.\n *\n * The direction is undefined for point lights. The vector\n * may be normalized, but it needn't.\n */\n C_STRUCT aiVector3D mUp;\n\n /** Constant light attenuation factor.\n *\n * The intensity of the light source at a given distance 'd' from\n * the light's position is\n * @code\n * Atten = 1/( att0 + att1 * d + att2 * d*d)\n * @endcode\n * This member corresponds to the att0 variable in the equation.\n * Naturally undefined for directional lights.\n */\n float mAttenuationConstant;\n\n /** Linear light attenuation factor.\n *\n * The intensity of the light source at a given distance 'd' from\n * the light's position is\n * @code\n * Atten = 1/( att0 + att1 * d + att2 * d*d)\n * @endcode\n * This member corresponds to the att1 variable in the equation.\n * Naturally undefined for directional lights.\n */\n float mAttenuationLinear;\n\n /** Quadratic light attenuation factor.\n *\n * The intensity of the light source at a given distance 'd' from\n * the light's position is\n * @code\n * Atten = 1/( att0 + att1 * d + att2 * d*d)\n * @endcode\n * This member corresponds to the att2 variable in the equation.\n * Naturally undefined for directional lights.\n */\n float mAttenuationQuadratic;\n\n /** Diffuse color of the light source\n *\n * The diffuse light color is multiplied with the diffuse\n * material color to obtain the final color that contributes\n * to the diffuse shading term.\n */\n C_STRUCT aiColor3D mColorDiffuse;\n\n /** Specular color of the light source\n *\n * The specular light color is multiplied with the specular\n * material color to obtain the final color that contributes\n * to the specular shading term.\n */\n C_STRUCT aiColor3D mColorSpecular;\n\n /** Ambient color of the light source\n *\n * The ambient light color is multiplied with the ambient\n * material color to obtain the final color that contributes\n * to the ambient shading term. Most renderers will ignore\n * this value it, is just a remaining of the fixed-function pipeline\n * that is still supported by quite many file formats.\n */\n C_STRUCT aiColor3D mColorAmbient;\n\n /** Inner angle of a spot light's light cone.\n *\n * The spot light has maximum influence on objects inside this\n * angle. The angle is given in radians. It is 2PI for point\n * lights and undefined for directional lights.\n */\n float mAngleInnerCone;\n\n /** Outer angle of a spot light's light cone.\n *\n * The spot light does not affect objects outside this angle.\n * The angle is given in radians. It is 2PI for point lights and\n * undefined for directional lights. The outer angle must be\n * greater than or equal to the inner angle.\n * It is assumed that the application uses a smooth\n * interpolation between the inner and the outer cone of the\n * spot light.\n */\n float mAngleOuterCone;\n\n /** Size of area light source. */\n C_STRUCT aiVector2D mSize;\n\n#ifdef __cplusplus\n\n aiLight()\n : mType (aiLightSource_UNDEFINED)\n , mAttenuationConstant (0.f)\n , mAttenuationLinear (1.f)\n , mAttenuationQuadratic (0.f)\n , mAngleInnerCone ((float)AI_MATH_TWO_PI)\n , mAngleOuterCone ((float)AI_MATH_TWO_PI)\n , mSize (0.f, 0.f)\n {\n }\n\n#endif\n};\n\n#ifdef __cplusplus\n}\n#endif\n\n\n#endif // !! __AI_LIGHT_H_INC__\n"}, {"path": "includes/assimp/material.h", "language": "code", "loc": 1251, "comment_density": 0.532, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file material.h\n * @brief Defines the material system of the library\n */\n\n#ifndef AI_MATERIAL_H_INC\n#define AI_MATERIAL_H_INC\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// Name for default materials (2nd is used if meshes have UV coords)\n#define AI_DEFAULT_MATERIAL_NAME \"DefaultMaterial\"\n\n// ---------------------------------------------------------------------------\n/** @brief Defines how the Nth texture of a specific type is combined with\n * the result of all previous layers.\n *\n * Example (left: key, right: value):
\n * @code\n * DiffColor0 - gray\n * DiffTextureOp0 - aiTextureOpMultiply\n * DiffTexture0 - tex1.png\n * DiffTextureOp0 - aiTextureOpAdd\n * DiffTexture1 - tex2.png\n * @endcode\n * Written as equation, the final diffuse term for a specific pixel would be:\n * @code\n * diffFinal = DiffColor0 * sampleTex(DiffTexture0,UV0) +\n * sampleTex(DiffTexture1,UV0) * diffContrib;\n * @endcode\n * where 'diffContrib' is the intensity of the incoming light for that pixel.\n */\nenum aiTextureOp\n{\n /** T = T1 * T2 */\n aiTextureOp_Multiply = 0x0,\n\n /** T = T1 + T2 */\n aiTextureOp_Add = 0x1,\n\n /** T = T1 - T2 */\n aiTextureOp_Subtract = 0x2,\n\n /** T = T1 / T2 */\n aiTextureOp_Divide = 0x3,\n\n /** T = (T1 + T2) - (T1 * T2) */\n aiTextureOp_SmoothAdd = 0x4,\n\n /** T = T1 + (T2-0.5) */\n aiTextureOp_SignedAdd = 0x5,\n\n\n#ifndef SWIG\n _aiTextureOp_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** @brief Defines how UV coordinates outside the [0...1] range are handled.\n *\n * Commonly referred to as 'wrapping mode'.\n */\nenum aiTextureMapMode\n{\n /** A texture coordinate u|v is translated to u%1|v%1\n */\n aiTextureMapMode_Wrap = 0x0,\n\n /** Texture coordinates outside [0...1]\n * are clamped to the nearest valid value.\n */\n aiTextureMapMode_Clamp = 0x1,\n\n /** If the texture coordinates for a pixel are outside [0...1]\n * the texture is not applied to that pixel\n */\n aiTextureMapMode_Decal = 0x3,\n\n /** A texture coordinate u|v becomes u%1|v%1 if (u-(u%1))%2 is zero and\n * 1-(u%1)|1-(v%1) otherwise\n */\n aiTextureMapMode_Mirror = 0x2,\n\n#ifndef SWIG\n _aiTextureMapMode_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** @brief Defines how the mapping coords for a texture are generated.\n *\n * Real-time applications typically require full UV coordinates, so the use of\n * the aiProcess_GenUVCoords step is highly recommended. It generates proper\n * UV channels for non-UV mapped objects, as long as an accurate description\n * how the mapping should look like (e.g spherical) is given.\n * See the #AI_MATKEY_MAPPING property for more details.\n */\nenum aiTextureMapping\n{\n /** The mapping coordinates are taken from an UV channel.\n *\n * The #AI_MATKEY_UVWSRC key specifies from which UV channel\n * the texture coordinates are to be taken from (remember,\n * meshes can have more than one UV channel).\n */\n aiTextureMapping_UV = 0x0,\n\n /** Spherical mapping */\n aiTextureMapping_SPHERE = 0x1,\n\n /** Cylindrical mapping */\n aiTextureMapping_CYLINDER = 0x2,\n\n /** Cubic mapping */\n aiTextureMapping_BOX = 0x3,\n\n /** Planar mapping */\n aiTextureMapping_PLANE = 0x4,\n\n /** Undefined mapping. Have fun. */\n aiTextureMapping_OTHER = 0x5,\n\n\n#ifndef SWIG\n _aiTextureMapping_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** @brief Defines the purpose of a texture\n *\n * This is a very difficult topic. Different 3D packages support different\n * kinds of textures. For very common texture types, such as bumpmaps, the\n * rendering results depend on implementation details in the rendering\n * pipelines of these applications. Assimp loads all texture references from\n * the model file and tries to determine which of the predefined texture\n * types below is the best choice to match the original use of the texture\n * as closely as possible.
\n *\n * In content pipelines you'll usually define how textures have to be handled,\n * and the artists working on models have to conform to this specification,\n * regardless which 3D tool they're using.\n */\nenum aiTextureType\n{\n /** Dummy value.\n *\n * No texture, but the value to be used as 'texture semantic'\n * (#aiMaterialProperty::mSemantic) for all material properties\n * *not* related to textures.\n */\n aiTextureType_NONE = 0x0,\n\n\n\n /** The texture is combined with the result of the diffuse\n * lighting equation.\n */\n aiTextureType_DIFFUSE = 0x1,\n\n /** The texture is combined with the result of the specular\n * lighting equation.\n */\n aiTextureType_SPECULAR = 0x2,\n\n /** The texture is combined with the result of the ambient\n * lighting equation.\n */\n aiTextureType_AMBIENT = 0x3,\n\n /** The texture is added to the result of the lighting\n * calculation. It isn't influenced by incoming light.\n */\n aiTextureType_EMISSIVE = 0x4,\n\n /** The texture is a height map.\n *\n * By convention, higher gray-scale values stand for\n * higher elevations from the base height.\n */\n aiTextureType_HEIGHT = 0x5,\n\n /** The texture is a (tangent space) normal-map.\n *\n * Again, there are several conventions for tangent-space\n * normal maps. Assimp does (intentionally) not\n * distinguish here.\n */\n aiTextureType_NORMALS = 0x6,\n\n /** The texture defines the glossiness of the material.\n *\n * The glossiness is in fact the exponent of the specular\n * (phong) lighting equation. Usually there is a conversion\n * function defined to map the linear color values in the\n * texture to a suitable exponent. Have fun.\n */\n aiTextureType_SHININESS = 0x7,\n\n /** The texture defines per-pixel opacity.\n *\n * Usually 'white' means opaque and 'black' means\n * 'transparency'. Or quite the opposite. Have fun.\n */\n aiTextureType_OPACITY = 0x8,\n\n /** Displacement texture\n *\n * The exact purpose and format is application-dependent.\n * Higher color values stand for higher vertex displacements.\n */\n aiTextureType_DISPLACEMENT = 0x9,\n\n /** Lightmap texture (aka Ambient Occlusion)\n *\n * Both 'Lightmaps' and dedicated 'ambient occlusion maps' are\n * covered by this material property. The texture contains a\n * scaling value for the final color value of a pixel. Its\n * intensity is not affected by incoming light.\n */\n aiTextureType_LIGHTMAP = 0xA,\n\n /** Reflection texture\n *\n * Contains the color of a perfect mirror reflection.\n * Rarely used, almost never for real-time applications.\n */\n aiTextureType_REFLECTION = 0xB,\n\n /** Unknown texture\n *\n * A texture reference that does not match any of the definitions\n * above is considered to be 'unknown'. It is still imported,\n * but is excluded from any further postprocessing.\n */\n aiTextureType_UNKNOWN = 0xC,\n\n\n#ifndef SWIG\n _aiTextureType_Force32Bit = INT_MAX\n#endif\n};\n\n#define AI_TEXTURE_TYPE_MAX aiTextureType_UNKNOWN\n\n// ---------------------------------------------------------------------------\n/** @brief Defines all shading models supported by the library\n *\n * The list of shading modes has been taken from Blender.\n * See Blender documentation for more information. The API does\n * not distinguish between \"specular\" and \"diffuse\" shaders (thus the\n * specular term for diffuse shading models like Oren-Nayar remains\n * undefined).
\n * Again, this value is just a hint. Assimp tries to select the shader whose\n * most common implementation matches the original rendering results of the\n * 3D modeller which wrote a particular model as closely as possible.\n */\nenum aiShadingMode\n{\n /** Flat shading. Shading is done on per-face base,\n * diffuse only. Also known as 'faceted shading'.\n */\n aiShadingMode_Flat = 0x1,\n\n /** Simple Gouraud shading.\n */\n aiShadingMode_Gouraud = 0x2,\n\n /** Phong-Shading -\n */\n aiShadingMode_Phong = 0x3,\n\n /** Phong-Blinn-Shading\n */\n aiShadingMode_Blinn = 0x4,\n\n /** Toon-Shading per pixel\n *\n * Also known as 'comic' shader.\n */\n aiShadingMode_Toon = 0x5,\n\n /** OrenNayar-Shading per pixel\n *\n * Extension to standard Lambertian shading, taking the\n * roughness of the material into account\n */\n aiShadingMode_OrenNayar = 0x6,\n\n /** Minnaert-Shading per pixel\n *\n * Extension to standard Lambertian shading, taking the\n * \"darkness\" of the material into account\n */\n aiShadingMode_Minnaert = 0x7,\n\n /** CookTorrance-Shading per pixel\n *\n * Special shader for metallic surfaces.\n */\n aiShadingMode_CookTorrance = 0x8,\n\n /** No shading at all. Constant light influence of 1.0.\n */\n aiShadingMode_NoShading = 0x9,\n\n /** Fresnel shading\n */\n aiShadingMode_Fresnel = 0xa,\n\n\n#ifndef SWIG\n _aiShadingMode_Force32Bit = INT_MAX\n#endif\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief Defines some mixed flags for a particular texture.\n *\n * Usually you'll instruct your cg artists how textures have to look like ...\n * and how they will be processed in your application. However, if you use\n * Assimp for completely generic loading purposes you might also need to\n * process these flags in order to display as many 'unknown' 3D models as\n * possible correctly.\n *\n * This corresponds to the #AI_MATKEY_TEXFLAGS property.\n*/\nenum aiTextureFlags\n{\n /** The texture's color values have to be inverted (componentwise 1-n)\n */\n aiTextureFlags_Invert = 0x1,\n\n /** Explicit request to the application to process the alpha channel\n * of the texture.\n *\n * Mutually exclusive with #aiTextureFlags_IgnoreAlpha. These\n * flags are set if the library can say for sure that the alpha\n * channel is used/is not used. If the model format does not\n * define this, it is left to the application to decide whether\n * the texture alpha channel - if any - is evaluated or not.\n */\n aiTextureFlags_UseAlpha = 0x2,\n\n /** Explicit request to the application to ignore the alpha channel\n * of the texture.\n *\n * Mutually exclusive with #aiTextureFlags_UseAlpha.\n */\n aiTextureFlags_IgnoreAlpha = 0x4,\n\n#ifndef SWIG\n _aiTextureFlags_Force32Bit = INT_MAX\n#endif\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief Defines alpha-blend flags.\n *\n * If you're familiar with OpenGL or D3D, these flags aren't new to you.\n * They define *how* the final color value of a pixel is computed, basing\n * on the previous color at that pixel and the new color value from the\n * material.\n * The blend formula is:\n * @code\n * SourceColor * SourceBlend + DestColor * DestBlend\n * @endcode\n * where DestColor is the previous color in the framebuffer at this\n * position and SourceColor is the material color before the transparency\n * calculation.
\n * This corresponds to the #AI_MATKEY_BLEND_FUNC property.\n*/\nenum aiBlendMode\n{\n /**\n * Formula:\n * @code\n * SourceColor*SourceAlpha + DestColor*(1-SourceAlpha)\n * @endcode\n */\n aiBlendMode_Default = 0x0,\n\n /** Additive blending\n *\n * Formula:\n * @code\n * SourceColor*1 + DestColor*1\n * @endcode\n */\n aiBlendMode_Additive = 0x1,\n\n // we don't need more for the moment, but we might need them\n // in future versions ...\n\n#ifndef SWIG\n _aiBlendMode_Force32Bit = INT_MAX\n#endif\n};\n\n\n#include \"./Compiler/pushpack1.h\"\n\n// ---------------------------------------------------------------------------\n/** @brief Defines how an UV channel is transformed.\n *\n * This is just a helper structure for the #AI_MATKEY_UVTRANSFORM key.\n * See its documentation for more details.\n *\n * Typically you'll want to build a matrix of this information. However,\n * we keep separate scaling/translation/rotation values to make it\n * easier to process and optimize UV transformations internally.\n */\nstruct aiUVTransform\n{\n /** Translation on the u and v axes.\n *\n * The default value is (0|0).\n */\n C_STRUCT aiVector2D mTranslation;\n\n /** Scaling on the u and v axes.\n *\n * The default value is (1|1).\n */\n C_STRUCT aiVector2D mScaling;\n\n /** Rotation - in counter-clockwise direction.\n *\n * The rotation angle is specified in radians. The\n * rotation center is 0.5f|0.5f. The default value\n * 0.f.\n */\n float mRotation;\n\n\n#ifdef __cplusplus\n aiUVTransform()\n : mScaling (1.f,1.f)\n , mRotation (0.f)\n {\n // nothing to be done here ...\n }\n#endif\n\n} PACK_STRUCT;\n\n#include \"./Compiler/poppack1.h\"\n\n//! @cond AI_DOX_INCLUDE_INTERNAL\n// ---------------------------------------------------------------------------\n/** @brief A very primitive RTTI system for the contents of material\n * properties.\n */\nenum aiPropertyTypeInfo\n{\n /** Array of single-precision (32 Bit) floats\n *\n * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API\n * aiMaterial::Get()) to query properties stored in floating-point format.\n * The material system performs the type conversion automatically.\n */\n aiPTI_Float = 0x1,\n\n /** The material property is an aiString.\n *\n * Arrays of strings aren't possible, aiGetMaterialString() (or the\n * C++-API aiMaterial::Get()) *must* be used to query a string property.\n */\n aiPTI_String = 0x3,\n\n /** Array of (32 Bit) integers\n *\n * It is possible to use aiGetMaterialFloat[Array]() (or the C++-API\n * aiMaterial::Get()) to query properties stored in integer format.\n * The material system performs the type conversion automatically.\n */\n aiPTI_Integer = 0x4,\n\n\n /** Simple binary buffer, content undefined. Not convertible to anything.\n */\n aiPTI_Buffer = 0x5,\n\n\n /** This value is not used. It is just there to force the\n * compiler to map this enum to a 32 Bit integer.\n */\n#ifndef SWIG\n _aiPTI_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** @brief Data structure for a single material property\n *\n * As an user, you'll probably never need to deal with this data structure.\n * Just use the provided aiGetMaterialXXX() or aiMaterial::Get() family\n * of functions to query material properties easily. Processing them\n * manually is faster, but it is not the recommended way. It isn't worth\n * the effort.
\n * Material property names follow a simple scheme:\n * @code\n * $\n * ?\n * A public property, there must be corresponding AI_MATKEY_XXX define\n * 2nd: Public, but ignored by the #aiProcess_RemoveRedundantMaterials\n * post-processing step.\n * ~\n * A temporary property for internal use.\n * @endcode\n * @see aiMaterial\n */\nstruct aiMaterialProperty\n{\n /** Specifies the name of the property (key)\n * Keys are generally case insensitive.\n */\n C_STRUCT aiString mKey;\n\n /** Textures: Specifies their exact usage semantic.\n * For non-texture properties, this member is always 0\n * (or, better-said, #aiTextureType_NONE).\n */\n unsigned int mSemantic;\n\n /** Textures: Specifies the index of the texture.\n * For non-texture properties, this member is always 0.\n */\n unsigned int mIndex;\n\n /** Size of the buffer mData is pointing to, in bytes.\n * This value may not be 0.\n */\n unsigned int mDataLength;\n\n /** Type information for the property.\n *\n * Defines the data layout inside the data buffer. This is used\n * by the library internally to perform debug checks and to\n * utilize proper type conversions.\n * (It's probably a hacky solution, but it works.)\n */\n C_ENUM aiPropertyTypeInfo mType;\n\n /** Binary buffer to hold the property's value.\n * The size of the buffer is always mDataLength.\n */\n char* mData;\n\n#ifdef __cplusplus\n\n aiMaterialProperty()\n : mSemantic( 0 )\n , mIndex( 0 )\n , mDataLength( 0 )\n , mType( aiPTI_Float )\n , mData( NULL )\n {\n }\n\n ~aiMaterialProperty() {\n delete[] mData;\n }\n\n#endif\n};\n//! @endcond\n\n#ifdef __cplusplus\n} // We need to leave the \"C\" block here to allow template member functions\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Data structure for a material\n*\n* Material data is stored using a key-value structure. A single key-value\n* pair is called a 'material property'. C++ users should use the provided\n* member functions of aiMaterial to process material properties, C users\n* have to stick with the aiMaterialGetXXX family of unbound functions.\n* The library defines a set of standard keys (AI_MATKEY_XXX).\n*/\n#ifdef __cplusplus\nstruct ASSIMP_API aiMaterial\n#else\nstruct aiMaterial\n#endif\n{\n\n#ifdef __cplusplus\n\npublic:\n\n aiMaterial();\n ~aiMaterial();\n\n // -------------------------------------------------------------------\n /** @brief Retrieve an array of Type values with a specific key\n * from the material\n *\n * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n * @param type .. set by AI_MATKEY_XXX\n * @param idx .. set by AI_MATKEY_XXX\n * @param pOut Pointer to a buffer to receive the result.\n * @param pMax Specifies the size of the given buffer, in Type's.\n * Receives the number of values (not bytes!) read.\n * NULL is a valid value for this parameter.\n */\n template \n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, Type* pOut, unsigned int* pMax) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, int* pOut, unsigned int* pMax) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, float* pOut, unsigned int* pMax) const;\n\n // -------------------------------------------------------------------\n /** @brief Retrieve a Type value with a specific key\n * from the material\n *\n * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n * @param type Specifies the type of the texture to be retrieved (\n * e.g. diffuse, specular, height map ...)\n * @param idx Index of the texture to be retrieved.\n * @param pOut Reference to receive the output value\n */\n template \n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx,Type& pOut) const;\n\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, int& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, float& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, aiString& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, aiColor3D& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, aiColor4D& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, aiUVTransform& pOut) const;\n\n // -------------------------------------------------------------------\n /** Get the number of textures for a particular texture type.\n * @param type Texture type to check for\n * @return Number of textures for this type.\n * @note A texture can be easily queried using #GetTexture() */\n unsigned int GetTextureCount(aiTextureType type) const;\n\n // -------------------------------------------------------------------\n /** Helper function to get all parameters pertaining to a\n * particular texture slot from a material.\n *\n * This function is provided just for convenience, you could also\n * read the single material properties manually.\n * @param type Specifies the type of the texture to be retrieved (\n * e.g. diffuse, specular, height map ...)\n * @param index Index of the texture to be retrieved. The function fails\n * if there is no texture of that type with this index.\n * #GetTextureCount() can be used to determine the number of textures\n * per texture type.\n * @param path Receives the path to the texture.\n * NULL is a valid value.\n * @param mapping The texture mapping.\n * NULL is allowed as value.\n * @param uvindex Receives the UV index of the texture.\n * NULL is a valid value.\n * @param blend Receives the blend factor for the texture\n * NULL is a valid value.\n * @param op Receives the texture operation to be performed between\n * this texture and the previous texture. NULL is allowed as value.\n * @param mapmode Receives the mapping modes to be used for the texture.\n * The parameter may be NULL but if it is a valid pointer it MUST\n * point to an array of 3 aiTextureMapMode's (one for each\n * axis: UVW order (=XYZ)).\n */\n // -------------------------------------------------------------------\n aiReturn GetTexture(aiTextureType type,\n unsigned int index,\n C_STRUCT aiString* path,\n aiTextureMapping* mapping = NULL,\n unsigned int* uvindex = NULL,\n float* blend = NULL,\n aiTextureOp* op = NULL,\n aiTextureMapMode* mapmode = NULL) const;\n\n\n // Setters\n\n\n // ------------------------------------------------------------------------------\n /** @brief Add a property with a given key and type info to the material\n * structure\n *\n * @param pInput Pointer to input data\n * @param pSizeInBytes Size of input data\n * @param pKey Key/Usage of the property (AI_MATKEY_XXX)\n * @param type Set by the AI_MATKEY_XXX macro\n * @param index Set by the AI_MATKEY_XXX macro\n * @param pType Type information hint */\n aiReturn AddBinaryProperty (const void* pInput,\n unsigned int pSizeInBytes,\n const char* pKey,\n unsigned int type ,\n unsigned int index ,\n aiPropertyTypeInfo pType);\n\n // ------------------------------------------------------------------------------\n /** @brief Add a string property with a given key and type info to the\n * material structure\n *\n * @param pInput Input string\n * @param pKey Key/Usage of the property (AI_MATKEY_XXX)\n * @param type Set by the AI_MATKEY_XXX macro\n * @param index Set by the AI_MATKEY_XXX macro */\n aiReturn AddProperty (const aiString* pInput,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n // ------------------------------------------------------------------------------\n /** @brief Add a property with a given key to the material structure\n * @param pInput Pointer to the input data\n * @param pNumValues Number of values in the array\n * @param pKey Key/Usage of the property (AI_MATKEY_XXX)\n * @param type Set by the AI_MATKEY_XXX macro\n * @param index Set by the AI_MATKEY_XXX macro */\n template\n aiReturn AddProperty (const TYPE* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const aiVector3D* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const aiColor3D* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const aiColor4D* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const int* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const float* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const aiUVTransform* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n // ------------------------------------------------------------------------------\n /** @brief Remove a given key from the list.\n *\n * The function fails if the key isn't found\n * @param pKey Key to be deleted\n * @param type Set by the AI_MATKEY_XXX macro\n * @param index Set by the AI_MATKEY_XXX macro */\n aiReturn RemoveProperty (const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n // ------------------------------------------------------------------------------\n /** @brief Removes all properties from the material.\n *\n * The data array remains allocated so adding new properties is quite fast. */\n void Clear();\n\n // ------------------------------------------------------------------------------\n /** Copy the property list of a material\n * @param pcDest Destination material\n * @param pcSrc Source material\n */\n static void CopyPropertyList(aiMaterial* pcDest,\n const aiMaterial* pcSrc);\n\n\n#endif\n\n /** List of all material properties loaded. */\n C_STRUCT aiMaterialProperty** mProperties;\n\n /** Number of properties in the data base */\n unsigned int mNumProperties;\n\n /** Storage allocated */\n unsigned int mNumAllocated;\n};\n\n// Go back to extern \"C\" again\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_NAME \"?mat.name\",0,0\n#define AI_MATKEY_TWOSIDED \"$mat.twosided\",0,0\n#define AI_MATKEY_SHADING_MODEL \"$mat.shadingm\",0,0\n#define AI_MATKEY_ENABLE_WIREFRAME \"$mat.wireframe\",0,0\n#define AI_MATKEY_BLEND_FUNC \"$mat.blend\",0,0\n#define AI_MATKEY_OPACITY \"$mat.opacity\",0,0\n#define AI_MATKEY_BUMPSCALING \"$mat.bumpscaling\",0,0\n#define AI_MATKEY_SHININESS \"$mat.shininess\",0,0\n#define AI_MATKEY_REFLECTIVITY \"$mat.reflectivity\",0,0\n#define AI_MATKEY_SHININESS_STRENGTH \"$mat.shinpercent\",0,0\n#define AI_MATKEY_REFRACTI \"$mat.refracti\",0,0\n#define AI_MATKEY_COLOR_DIFFUSE \"$clr.diffuse\",0,0\n#define AI_MATKEY_COLOR_AMBIENT \"$clr.ambient\",0,0\n#define AI_MATKEY_COLOR_SPECULAR \"$clr.specular\",0,0\n#define AI_MATKEY_COLOR_EMISSIVE \"$clr.emissive\",0,0\n#define AI_MATKEY_COLOR_TRANSPARENT \"$clr.transparent\",0,0\n#define AI_MATKEY_COLOR_REFLECTIVE \"$clr.reflective\",0,0\n#define AI_MATKEY_GLOBAL_BACKGROUND_IMAGE \"?bg.global\",0,0\n\n// ---------------------------------------------------------------------------\n// Pure key names for all texture-related properties\n//! @cond MATS_DOC_FULL\n#define _AI_MATKEY_TEXTURE_BASE \"$tex.file\"\n#define _AI_MATKEY_UVWSRC_BASE \"$tex.uvwsrc\"\n#define _AI_MATKEY_TEXOP_BASE \"$tex.op\"\n#define _AI_MATKEY_MAPPING_BASE \"$tex.mapping\"\n#define _AI_MATKEY_TEXBLEND_BASE \"$tex.blend\"\n#define _AI_MATKEY_MAPPINGMODE_U_BASE \"$tex.mapmodeu\"\n#define _AI_MATKEY_MAPPINGMODE_V_BASE \"$tex.mapmodev\"\n#define _AI_MATKEY_TEXMAP_AXIS_BASE \"$tex.mapaxis\"\n#define _AI_MATKEY_UVTRANSFORM_BASE \"$tex.uvtrafo\"\n#define _AI_MATKEY_TEXFLAGS_BASE \"$tex.flags\"\n//! @endcond\n\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXTURE(type, N) _AI_MATKEY_TEXTURE_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXTURE_DIFFUSE(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXTURE_SPECULAR(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXTURE_AMBIENT(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXTURE_EMISSIVE(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXTURE_NORMALS(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXTURE_HEIGHT(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXTURE_SHININESS(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXTURE_OPACITY(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXTURE_DISPLACEMENT(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXTURE_LIGHTMAP(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXTURE_REFLECTION(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_REFLECTION,N)\n\n//! @endcond\n\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_UVWSRC(type, N) _AI_MATKEY_UVWSRC_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_UVWSRC_DIFFUSE(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_UVWSRC_SPECULAR(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_UVWSRC_AMBIENT(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_UVWSRC_EMISSIVE(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_UVWSRC_NORMALS(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_UVWSRC_HEIGHT(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_UVWSRC_SHININESS(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_UVWSRC_OPACITY(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_UVWSRC_DISPLACEMENT(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_UVWSRC_LIGHTMAP(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_UVWSRC_REFLECTION(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXOP(type, N) _AI_MATKEY_TEXOP_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXOP_DIFFUSE(N) \\\n AI_MATKEY_TEXOP(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXOP_SPECULAR(N) \\\n AI_MATKEY_TEXOP(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXOP_AMBIENT(N) \\\n AI_MATKEY_TEXOP(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXOP_EMISSIVE(N) \\\n AI_MATKEY_TEXOP(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXOP_NORMALS(N) \\\n AI_MATKEY_TEXOP(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXOP_HEIGHT(N) \\\n AI_MATKEY_TEXOP(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXOP_SHININESS(N) \\\n AI_MATKEY_TEXOP(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXOP_OPACITY(N) \\\n AI_MATKEY_TEXOP(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXOP_DISPLACEMENT(N) \\\n AI_MATKEY_TEXOP(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXOP_LIGHTMAP(N) \\\n AI_MATKEY_TEXOP(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXOP_REFLECTION(N) \\\n AI_MATKEY_TEXOP(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_MAPPING(type, N) _AI_MATKEY_MAPPING_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_MAPPING_DIFFUSE(N) \\\n AI_MATKEY_MAPPING(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_MAPPING_SPECULAR(N) \\\n AI_MATKEY_MAPPING(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_MAPPING_AMBIENT(N) \\\n AI_MATKEY_MAPPING(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_MAPPING_EMISSIVE(N) \\\n AI_MATKEY_MAPPING(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_MAPPING_NORMALS(N) \\\n AI_MATKEY_MAPPING(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_MAPPING_HEIGHT(N) \\\n AI_MATKEY_MAPPING(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_MAPPING_SHININESS(N) \\\n AI_MATKEY_MAPPING(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_MAPPING_OPACITY(N) \\\n AI_MATKEY_MAPPING(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_MAPPING_DISPLACEMENT(N) \\\n AI_MATKEY_MAPPING(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_MAPPING_LIGHTMAP(N) \\\n AI_MATKEY_MAPPING(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_MAPPING_REFLECTION(N) \\\n AI_MATKEY_MAPPING(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXBLEND(type, N) _AI_MATKEY_TEXBLEND_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXBLEND_DIFFUSE(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXBLEND_SPECULAR(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXBLEND_AMBIENT(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXBLEND_EMISSIVE(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXBLEND_NORMALS(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXBLEND_HEIGHT(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXBLEND_SHININESS(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXBLEND_OPACITY(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXBLEND_DISPLACEMENT(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXBLEND_LIGHTMAP(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXBLEND_REFLECTION(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_MAPPINGMODE_U(type, N) _AI_MATKEY_MAPPINGMODE_U_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_MAPPINGMODE_U_DIFFUSE(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_SPECULAR(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_AMBIENT(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_EMISSIVE(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_NORMALS(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_HEIGHT(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_SHININESS(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_OPACITY(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_DISPLACEMENT(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_LIGHTMAP(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_REFLECTION(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_MAPPINGMODE_V(type, N) _AI_MATKEY_MAPPINGMODE_V_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_MAPPINGMODE_V_DIFFUSE(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_SPECULAR(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_AMBIENT(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_EMISSIVE(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_NORMALS(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_HEIGHT(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_SHININESS(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_OPACITY(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_DISPLACEMENT(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_LIGHTMAP(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_REFLECTION(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXMAP_AXIS(type, N) _AI_MATKEY_TEXMAP_AXIS_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXMAP_AXIS_DIFFUSE(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_SPECULAR(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_AMBIENT(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_EMISSIVE(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_NORMALS(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_HEIGHT(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_SHININESS(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_OPACITY(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_DISPLACEMENT(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_LIGHTMAP(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_REFLECTION(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_UVTRANSFORM(type, N) _AI_MATKEY_UVTRANSFORM_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_UVTRANSFORM_DIFFUSE(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_UVTRANSFORM_SPECULAR(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_UVTRANSFORM_AMBIENT(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_UVTRANSFORM_EMISSIVE(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_UVTRANSFORM_NORMALS(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_UVTRANSFORM_HEIGHT(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_UVTRANSFORM_SHININESS(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_UVTRANSFORM_OPACITY(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_UVTRANSFORM_DISPLACEMENT(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_UVTRANSFORM_LIGHTMAP(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_UVTRANSFORM_REFLECTION(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_REFLECTION,N)\n\n#define AI_MATKEY_UVTRANSFORM_UNKNOWN(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_UNKNOWN,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXFLAGS(type, N) _AI_MATKEY_TEXFLAGS_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXFLAGS_DIFFUSE(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXFLAGS_SPECULAR(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXFLAGS_AMBIENT(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXFLAGS_EMISSIVE(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXFLAGS_NORMALS(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXFLAGS_HEIGHT(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXFLAGS_SHININESS(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXFLAGS_OPACITY(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXFLAGS_DISPLACEMENT(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXFLAGS_LIGHTMAP(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXFLAGS_REFLECTION(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_REFLECTION,N)\n\n#define AI_MATKEY_TEXFLAGS_UNKNOWN(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_UNKNOWN,N)\n\n//! @endcond\n//!\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a material property with a specific key from the material\n *\n * @param pMat Pointer to the input material. May not be NULL\n * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n * @param type Specifies the type of the texture to be retrieved (\n * e.g. diffuse, specular, height map ...)\n * @param index Index of the texture to be retrieved.\n * @param pPropOut Pointer to receive a pointer to a valid aiMaterialProperty\n * structure or NULL if the key has not been found. */\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialProperty(\n const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n const C_STRUCT aiMaterialProperty** pPropOut);\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve an array of float values with a specific key\n * from the material\n *\n * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the\n * example reads the #AI_MATKEY_UVTRANSFORM property of the first diffuse texture)\n * @code\n * aiUVTransform trafo;\n * unsigned int max = sizeof(aiUVTransform);\n * if (AI_SUCCESS != aiGetMaterialFloatArray(mat, AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,0),\n * (float*)&trafo, &max) || sizeof(aiUVTransform) != max)\n * {\n * // error handling\n * }\n * @endcode\n *\n * @param pMat Pointer to the input material. May not be NULL\n * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n * @param pOut Pointer to a buffer to receive the result.\n * @param pMax Specifies the size of the given buffer, in float's.\n * Receives the number of values (not bytes!) read.\n * @param type (see the code sample above)\n * @param index (see the code sample above)\n * @return Specifies whether the key has been found. If not, the output\n * arrays remains unmodified and pMax is set to 0.*/\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray(\n const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n float* pOut,\n unsigned int* pMax);\n\n\n#ifdef __cplusplus\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a single float property with a specific key from the material.\n*\n* Pass one of the AI_MATKEY_XXX constants for the last three parameters (the\n* example reads the #AI_MATKEY_SHININESS_STRENGTH property of the first diffuse texture)\n* @code\n* float specStrength = 1.f; // default value, remains unmodified if we fail.\n* aiGetMaterialFloat(mat, AI_MATKEY_SHININESS_STRENGTH,\n* (float*)&specStrength);\n* @endcode\n*\n* @param pMat Pointer to the input material. May not be NULL\n* @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n* @param pOut Receives the output float.\n* @param type (see the code sample above)\n* @param index (see the code sample above)\n* @return Specifies whether the key has been found. If not, the output\n* float remains unmodified.*/\n// ---------------------------------------------------------------------------\ninline aiReturn aiGetMaterialFloat(const aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n float* pOut)\n{\n return aiGetMaterialFloatArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0);\n}\n\n#else\n\n// Use our friend, the C preprocessor\n#define aiGetMaterialFloat (pMat, type, index, pKey, pOut) \\\n aiGetMaterialFloatArray(pMat, type, index, pKey, pOut, NULL)\n\n#endif //!__cplusplus\n\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve an array of integer values with a specific key\n * from a material\n *\n * See the sample for aiGetMaterialFloatArray for more information.*/\nASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n int* pOut,\n unsigned int* pMax);\n\n\n#ifdef __cplusplus\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve an integer property with a specific key from a material\n *\n * See the sample for aiGetMaterialFloat for more information.*/\n// ---------------------------------------------------------------------------\ninline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n int* pOut)\n{\n return aiGetMaterialIntegerArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0);\n}\n\n#else\n\n// use our friend, the C preprocessor\n#define aiGetMaterialInteger (pMat, type, index, pKey, pOut) \\\n aiGetMaterialIntegerArray(pMat, type, index, pKey, pOut, NULL)\n\n#endif //!__cplusplus\n\n\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a color value from the material property table\n*\n* See the sample for aiGetMaterialFloat for more information*/\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n C_STRUCT aiColor4D* pOut);\n\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a aiUVTransform value from the material property table\n*\n* See the sample for aiGetMaterialFloat for more information*/\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialUVTransform(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n C_STRUCT aiUVTransform* pOut);\n\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a string from the material property table\n*\n* See the sample for aiGetMaterialFloat for more information.*/\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialString(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n C_STRUCT aiString* pOut);\n\n// ---------------------------------------------------------------------------\n/** Get the number of textures for a particular texture type.\n * @param[in] pMat Pointer to the input material. May not be NULL\n * @param type Texture type to check for\n * @return Number of textures for this type.\n * @note A texture can be easily queried using #aiGetMaterialTexture() */\n// ---------------------------------------------------------------------------\nASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMat,\n C_ENUM aiTextureType type);\n\n// ---------------------------------------------------------------------------\n/** @brief Helper function to get all values pertaining to a particular\n * texture slot from a material structure.\n *\n * This function is provided just for convenience. You could also read the\n * texture by parsing all of its properties manually. This function bundles\n * all of them in a huge function monster.\n *\n * @param[in] mat Pointer to the input material. May not be NULL\n * @param[in] type Specifies the texture stack to read from (e.g. diffuse,\n * specular, height map ...).\n * @param[in] index Index of the texture. The function fails if the\n * requested index is not available for this texture type.\n * #aiGetMaterialTextureCount() can be used to determine the number of\n * textures in a particular texture stack.\n * @param[out] path Receives the output path\n * This parameter must be non-null.\n * @param mapping The texture mapping mode to be used.\n * Pass NULL if you're not interested in this information.\n * @param[out] uvindex For UV-mapped textures: receives the index of the UV\n * source channel. Unmodified otherwise.\n * Pass NULL if you're not interested in this information.\n * @param[out] blend Receives the blend factor for the texture\n * Pass NULL if you're not interested in this information.\n * @param[out] op Receives the texture blend operation to be perform between\n * this texture and the previous texture.\n * Pass NULL if you're not interested in this information.\n * @param[out] mapmode Receives the mapping modes to be used for the texture.\n * Pass NULL if you're not interested in this information. Otherwise,\n * pass a pointer to an array of two aiTextureMapMode's (one for each\n * axis, UV order).\n * @param[out] flags Receives the texture flags.\n * @return AI_SUCCESS on success, otherwise something else. Have fun.*/\n// ---------------------------------------------------------------------------\n#ifdef __cplusplus\nASSIMP_API aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,\n aiTextureType type,\n unsigned int index,\n aiString* path,\n aiTextureMapping* mapping = NULL,\n unsigned int* uvindex = NULL,\n float* blend = NULL,\n aiTextureOp* op = NULL,\n aiTextureMapMode* mapmode = NULL,\n unsigned int* flags = NULL);\n#else\nC_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,\n C_ENUM aiTextureType type,\n unsigned int index,\n C_STRUCT aiString* path,\n C_ENUM aiTextureMapping* mapping /*= NULL*/,\n unsigned int* uvindex /*= NULL*/,\n float* blend /*= NULL*/,\n C_ENUM aiTextureOp* op /*= NULL*/,\n C_ENUM aiTextureMapMode* mapmode /*= NULL*/,\n unsigned int* flags /*= NULL*/);\n#endif // !#ifdef __cplusplus\n\n#ifdef __cplusplus\n}\n\n#include \"material.inl\"\n\n#endif //!__cplusplus\n#endif //!!AI_MATERIAL_H_INC\n"}, {"path": "includes/assimp/matrix3x3.h", "language": "code", "loc": 147, "comment_density": 0.619, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file matrix3x3.h\n * @brief Definition of a 3x3 matrix, including operators when compiling in C++\n */\n#ifndef AI_MATRIX3x3_H_INC\n#define AI_MATRIX3x3_H_INC\n\n#include \"./Compiler/pushpack1.h\"\n\n#ifdef __cplusplus\n\ntemplate class aiMatrix4x4t;\ntemplate class aiVector2t;\n\n// ---------------------------------------------------------------------------\n/** @brief Represents a row-major 3x3 matrix\n *\n * There's much confusion about matrix layouts (column vs. row order).\n * This is *always* a row-major matrix. Not even with the\n * #aiProcess_ConvertToLeftHanded flag, which absolutely does not affect\n * matrix order - it just affects the handedness of the coordinate system\n * defined thereby.\n */\ntemplate \nclass aiMatrix3x3t\n{\npublic:\n\n aiMatrix3x3t () :\n a1(static_cast(1.0f)), a2(), a3(),\n b1(), b2(static_cast(1.0f)), b3(),\n c1(), c2(), c3(static_cast(1.0f)) {}\n\n aiMatrix3x3t ( TReal _a1, TReal _a2, TReal _a3,\n TReal _b1, TReal _b2, TReal _b3,\n TReal _c1, TReal _c2, TReal _c3) :\n a1(_a1), a2(_a2), a3(_a3),\n b1(_b1), b2(_b2), b3(_b3),\n c1(_c1), c2(_c2), c3(_c3)\n {}\n\npublic:\n\n // matrix multiplication.\n aiMatrix3x3t& operator *= (const aiMatrix3x3t& m);\n aiMatrix3x3t operator * (const aiMatrix3x3t& m) const;\n\n // array access operators\n TReal* operator[] (unsigned int p_iIndex);\n const TReal* operator[] (unsigned int p_iIndex) const;\n\n // comparison operators\n bool operator== (const aiMatrix4x4t& m) const;\n bool operator!= (const aiMatrix4x4t& m) const;\n\n bool Equal(const aiMatrix4x4t& m, TReal epsilon = 1e-6) const;\n\n template \n operator aiMatrix3x3t () const;\n\npublic:\n\n // -------------------------------------------------------------------\n /** @brief Construction from a 4x4 matrix. The remaining parts\n * of the matrix are ignored.\n */\n explicit aiMatrix3x3t( const aiMatrix4x4t& pMatrix);\n\n // -------------------------------------------------------------------\n /** @brief Transpose the matrix\n */\n aiMatrix3x3t& Transpose();\n\n // -------------------------------------------------------------------\n /** @brief Invert the matrix.\n * If the matrix is not invertible all elements are set to qnan.\n * Beware, use (f != f) to check whether a TReal f is qnan.\n */\n aiMatrix3x3t& Inverse();\n TReal Determinant() const;\n\npublic:\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around z\n * @param a Rotation angle, in radians\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix3x3t& RotationZ(TReal a, aiMatrix3x3t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around\n * an arbitrary axis.\n *\n * @param a Rotation angle, in radians\n * @param axis Axis to rotate around\n * @param out To be filled\n */\n static aiMatrix3x3t& Rotation( TReal a,\n const aiVector3t& axis, aiMatrix3x3t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a translation matrix\n * @param v Translation vector\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix3x3t& Translation( const aiVector2t& v, aiMatrix3x3t& out);\n\n // -------------------------------------------------------------------\n /** @brief A function for creating a rotation matrix that rotates a\n * vector called \"from\" into another vector called \"to\".\n * Input : from[3], to[3] which both must be *normalized* non-zero vectors\n * Output: mtx[3][3] -- a 3x3 matrix in column-major form\n * Authors: Tomas M�ller, John Hughes\n * \"Efficiently Building a Matrix to Rotate One Vector to Another\"\n * Journal of Graphics Tools, 4(4):1-4, 1999\n */\n static aiMatrix3x3t& FromToMatrix(const aiVector3t& from,\n const aiVector3t& to, aiMatrix3x3t& out);\n\npublic:\n TReal a1, a2, a3;\n TReal b1, b2, b3;\n TReal c1, c2, c3;\n} PACK_STRUCT;\n\ntypedef aiMatrix3x3t aiMatrix3x3;\n\n#else\n\nstruct aiMatrix3x3 {\n float a1, a2, a3;\n float b1, b2, b3;\n float c1, c2, c3;\n} PACK_STRUCT;\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#endif // AI_MATRIX3x3_H_INC\n"}, {"path": "includes/assimp/matrix4x4.h", "language": "code", "loc": 201, "comment_density": 0.677, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file matrix4x4.h\n * @brief 4x4 matrix structure, including operators when compiling in C++\n */\n#ifndef AI_MATRIX4X4_H_INC\n#define AI_MATRIX4X4_H_INC\n\n#include \"vector3.h\"\n#include \"./Compiler/pushpack1.h\"\n\n#ifdef __cplusplus\n\ntemplate class aiMatrix3x3t;\ntemplate class aiQuaterniont;\n\n// ---------------------------------------------------------------------------\n/** @brief Represents a row-major 4x4 matrix, use this for homogeneous\n * coordinates.\n *\n * There's much confusion about matrix layouts (column vs. row order).\n * This is *always* a row-major matrix. Not even with the\n * #aiProcess_ConvertToLeftHanded flag, which absolutely does not affect\n * matrix order - it just affects the handedness of the coordinate system\n * defined thereby.\n */\ntemplate\nclass aiMatrix4x4t\n{\npublic:\n\n /** set to identity */\n aiMatrix4x4t ();\n\n /** construction from single values */\n aiMatrix4x4t ( TReal _a1, TReal _a2, TReal _a3, TReal _a4,\n TReal _b1, TReal _b2, TReal _b3, TReal _b4,\n TReal _c1, TReal _c2, TReal _c3, TReal _c4,\n TReal _d1, TReal _d2, TReal _d3, TReal _d4);\n\n\n /** construction from 3x3 matrix, remaining elements are set to identity */\n explicit aiMatrix4x4t( const aiMatrix3x3t& m);\n\n /** construction from position, rotation and scaling components\n * @param scaling The scaling for the x,y,z axes\n * @param rotation The rotation as a hamilton quaternion\n * @param position The position for the x,y,z axes\n */\n aiMatrix4x4t(const aiVector3t& scaling, const aiQuaterniont& rotation,\n const aiVector3t& position);\n\npublic:\n\n // array access operators\n TReal* operator[] (unsigned int p_iIndex);\n const TReal* operator[] (unsigned int p_iIndex) const;\n\n // comparison operators\n bool operator== (const aiMatrix4x4t& m) const;\n bool operator!= (const aiMatrix4x4t& m) const;\n\n bool Equal(const aiMatrix4x4t& m, TReal epsilon = 1e-6) const;\n\n // matrix multiplication.\n aiMatrix4x4t& operator *= (const aiMatrix4x4t& m);\n aiMatrix4x4t operator * (const aiMatrix4x4t& m) const;\n\n template \n operator aiMatrix4x4t () const;\n\npublic:\n\n // -------------------------------------------------------------------\n /** @brief Transpose the matrix */\n aiMatrix4x4t& Transpose();\n\n // -------------------------------------------------------------------\n /** @brief Invert the matrix.\n * If the matrix is not invertible all elements are set to qnan.\n * Beware, use (f != f) to check whether a TReal f is qnan.\n */\n aiMatrix4x4t& Inverse();\n TReal Determinant() const;\n\n\n // -------------------------------------------------------------------\n /** @brief Returns true of the matrix is the identity matrix.\n * The check is performed against a not so small epsilon.\n */\n inline bool IsIdentity() const;\n\n // -------------------------------------------------------------------\n /** @brief Decompose a trafo matrix into its original components\n * @param scaling Receives the output scaling for the x,y,z axes\n * @param rotation Receives the output rotation as a hamilton\n * quaternion\n * @param position Receives the output position for the x,y,z axes\n */\n void Decompose (aiVector3t& scaling, aiQuaterniont& rotation,\n aiVector3t& position) const;\n\n // -------------------------------------------------------------------\n /** @brief Decompose a trafo matrix with no scaling into its\n * original components\n * @param rotation Receives the output rotation as a hamilton\n * quaternion\n * @param position Receives the output position for the x,y,z axes\n */\n void DecomposeNoScaling (aiQuaterniont& rotation,\n aiVector3t& position) const;\n\n\n // -------------------------------------------------------------------\n /** @brief Creates a trafo matrix from a set of euler angles\n * @param x Rotation angle for the x-axis, in radians\n * @param y Rotation angle for the y-axis, in radians\n * @param z Rotation angle for the z-axis, in radians\n */\n aiMatrix4x4t& FromEulerAnglesXYZ(TReal x, TReal y, TReal z);\n aiMatrix4x4t& FromEulerAnglesXYZ(const aiVector3t& blubb);\n\npublic:\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around the x axis\n * @param a Rotation angle, in radians\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& RotationX(TReal a, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around the y axis\n * @param a Rotation angle, in radians\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& RotationY(TReal a, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around the z axis\n * @param a Rotation angle, in radians\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& RotationZ(TReal a, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** Returns a rotation matrix for a rotation around an arbitrary axis.\n * @param a Rotation angle, in radians\n * @param axis Rotation axis, should be a normalized vector.\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& Rotation(TReal a, const aiVector3t& axis,\n aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a translation matrix\n * @param v Translation vector\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& Translation( const aiVector3t& v, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a scaling matrix\n * @param v Scaling vector\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& Scaling( const aiVector3t& v, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief A function for creating a rotation matrix that rotates a\n * vector called \"from\" into another vector called \"to\".\n * Input : from[3], to[3] which both must be *normalized* non-zero vectors\n * Output: mtx[3][3] -- a 3x3 matrix in column-major form\n * Authors: Tomas Mueller, John Hughes\n * \"Efficiently Building a Matrix to Rotate One Vector to Another\"\n * Journal of Graphics Tools, 4(4):1-4, 1999\n */\n static aiMatrix4x4t& FromToMatrix(const aiVector3t& from,\n const aiVector3t& to, aiMatrix4x4t& out);\n\npublic:\n TReal a1, a2, a3, a4;\n TReal b1, b2, b3, b4;\n TReal c1, c2, c3, c4;\n TReal d1, d2, d3, d4;\n} PACK_STRUCT;\n\ntypedef aiMatrix4x4t aiMatrix4x4;\n\n#else\n\nstruct aiMatrix4x4 {\n float a1, a2, a3, a4;\n float b1, b2, b3, b4;\n float c1, c2, c3, c4;\n float d1, d2, d3, d4;\n} PACK_STRUCT;\n\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#endif // AI_MATRIX4X4_H_INC\n"}, {"path": "includes/assimp/mesh.h", "language": "code", "loc": 625, "comment_density": 0.549, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file mesh.h\n * @brief Declares the data structures in which the imported geometry is\n returned by ASSIMP: aiMesh, aiFace and aiBone data structures.\n */\n#ifndef INCLUDED_AI_MESH_H\n#define INCLUDED_AI_MESH_H\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n// Limits. These values are required to match the settings Assimp was\n// compiled against. Therefore, do not redefine them unless you build the\n// library from source using the same definitions.\n// ---------------------------------------------------------------------------\n\n/** @def AI_MAX_FACE_INDICES\n * Maximum number of indices per face (polygon). */\n\n#ifndef AI_MAX_FACE_INDICES\n# define AI_MAX_FACE_INDICES 0x7fff\n#endif\n\n/** @def AI_MAX_BONE_WEIGHTS\n * Maximum number of indices per face (polygon). */\n\n#ifndef AI_MAX_BONE_WEIGHTS\n# define AI_MAX_BONE_WEIGHTS 0x7fffffff\n#endif\n\n/** @def AI_MAX_VERTICES\n * Maximum number of vertices per mesh. */\n\n#ifndef AI_MAX_VERTICES\n# define AI_MAX_VERTICES 0x7fffffff\n#endif\n\n/** @def AI_MAX_FACES\n * Maximum number of faces per mesh. */\n\n#ifndef AI_MAX_FACES\n# define AI_MAX_FACES 0x7fffffff\n#endif\n\n/** @def AI_MAX_NUMBER_OF_COLOR_SETS\n * Supported number of vertex color sets per mesh. */\n\n#ifndef AI_MAX_NUMBER_OF_COLOR_SETS\n# define AI_MAX_NUMBER_OF_COLOR_SETS 0x8\n#endif // !! AI_MAX_NUMBER_OF_COLOR_SETS\n\n/** @def AI_MAX_NUMBER_OF_TEXTURECOORDS\n * Supported number of texture coord sets (UV(W) channels) per mesh */\n\n#ifndef AI_MAX_NUMBER_OF_TEXTURECOORDS\n# define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8\n#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS\n\n// ---------------------------------------------------------------------------\n/** @brief A single face in a mesh, referring to multiple vertices.\n *\n * If mNumIndices is 3, we call the face 'triangle', for mNumIndices > 3\n * it's called 'polygon' (hey, that's just a definition!).\n *
\n * aiMesh::mPrimitiveTypes can be queried to quickly examine which types of\n * primitive are actually present in a mesh. The #aiProcess_SortByPType flag\n * executes a special post-processing algorithm which splits meshes with\n * *different* primitive types mixed up (e.g. lines and triangles) in several\n * 'clean' submeshes. Furthermore there is a configuration option (\n * #AI_CONFIG_PP_SBP_REMOVE) to force #aiProcess_SortByPType to remove\n * specific kinds of primitives from the imported scene, completely and forever.\n * In many cases you'll probably want to set this setting to\n * @code\n * aiPrimitiveType_LINE|aiPrimitiveType_POINT\n * @endcode\n * Together with the #aiProcess_Triangulate flag you can then be sure that\n * #aiFace::mNumIndices is always 3.\n * @note Take a look at the @link data Data Structures page @endlink for\n * more information on the layout and winding order of a face.\n */\nstruct aiFace\n{\n //! Number of indices defining this face.\n //! The maximum value for this member is #AI_MAX_FACE_INDICES.\n unsigned int mNumIndices;\n\n //! Pointer to the indices array. Size of the array is given in numIndices.\n unsigned int* mIndices;\n\n#ifdef __cplusplus\n\n //! Default constructor\n aiFace()\n : mNumIndices( 0 )\n , mIndices( NULL )\n {\n }\n\n //! Default destructor. Delete the index array\n ~aiFace()\n {\n delete [] mIndices;\n }\n\n //! Copy constructor. Copy the index array\n aiFace( const aiFace& o)\n : mIndices( NULL )\n {\n *this = o;\n }\n\n //! Assignment operator. Copy the index array\n aiFace& operator = ( const aiFace& o)\n {\n if (&o == this)\n return *this;\n\n delete[] mIndices;\n mNumIndices = o.mNumIndices;\n if (mNumIndices) {\n mIndices = new unsigned int[mNumIndices];\n ::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));\n }\n else {\n mIndices = NULL;\n }\n return *this;\n }\n\n //! Comparison operator. Checks whether the index array\n //! of two faces is identical\n bool operator== (const aiFace& o) const\n {\n if (mIndices == o.mIndices)return true;\n else if (mIndices && mNumIndices == o.mNumIndices)\n {\n for (unsigned int i = 0;i < this->mNumIndices;++i)\n if (mIndices[i] != o.mIndices[i])return false;\n return true;\n }\n return false;\n }\n\n //! Inverse comparison operator. Checks whether the index\n //! array of two faces is NOT identical\n bool operator != (const aiFace& o) const\n {\n return !(*this == o);\n }\n#endif // __cplusplus\n}; // struct aiFace\n\n\n// ---------------------------------------------------------------------------\n/** @brief A single influence of a bone on a vertex.\n */\nstruct aiVertexWeight\n{\n //! Index of the vertex which is influenced by the bone.\n unsigned int mVertexId;\n\n //! The strength of the influence in the range (0...1).\n //! The influence from all bones at one vertex amounts to 1.\n float mWeight;\n\n#ifdef __cplusplus\n\n //! Default constructor\n aiVertexWeight() { }\n\n //! Initialisation from a given index and vertex weight factor\n //! \\param pID ID\n //! \\param pWeight Vertex weight factor\n aiVertexWeight( unsigned int pID, float pWeight)\n : mVertexId( pID), mWeight( pWeight)\n { /* nothing to do here */ }\n\n#endif // __cplusplus\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief A single bone of a mesh.\n *\n * A bone has a name by which it can be found in the frame hierarchy and by\n * which it can be addressed by animations. In addition it has a number of\n * influences on vertices.\n */\nstruct aiBone\n{\n //! The name of the bone.\n C_STRUCT aiString mName;\n\n //! The number of vertices affected by this bone\n //! The maximum value for this member is #AI_MAX_BONE_WEIGHTS.\n unsigned int mNumWeights;\n\n //! The vertices affected by this bone\n C_STRUCT aiVertexWeight* mWeights;\n\n //! Matrix that transforms from mesh space to bone space in bind pose\n C_STRUCT aiMatrix4x4 mOffsetMatrix;\n\n#ifdef __cplusplus\n\n //! Default constructor\n aiBone()\n : mName()\n , mNumWeights( 0 )\n , mWeights( NULL )\n {\n }\n\n //! Copy constructor\n aiBone(const aiBone& other)\n : mName( other.mName )\n , mNumWeights( other.mNumWeights )\n , mOffsetMatrix( other.mOffsetMatrix )\n {\n if (other.mWeights && other.mNumWeights)\n {\n mWeights = new aiVertexWeight[mNumWeights];\n ::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));\n }\n }\n\n //! Destructor - deletes the array of vertex weights\n ~aiBone()\n {\n delete [] mWeights;\n }\n#endif // __cplusplus\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief Enumerates the types of geometric primitives supported by Assimp.\n *\n * @see aiFace Face data structure\n * @see aiProcess_SortByPType Per-primitive sorting of meshes\n * @see aiProcess_Triangulate Automatic triangulation\n * @see AI_CONFIG_PP_SBP_REMOVE Removal of specific primitive types.\n */\nenum aiPrimitiveType\n{\n /** A point primitive.\n *\n * This is just a single vertex in the virtual world,\n * #aiFace contains just one index for such a primitive.\n */\n aiPrimitiveType_POINT = 0x1,\n\n /** A line primitive.\n *\n * This is a line defined through a start and an end position.\n * #aiFace contains exactly two indices for such a primitive.\n */\n aiPrimitiveType_LINE = 0x2,\n\n /** A triangular primitive.\n *\n * A triangle consists of three indices.\n */\n aiPrimitiveType_TRIANGLE = 0x4,\n\n /** A higher-level polygon with more than 3 edges.\n *\n * A triangle is a polygon, but polygon in this context means\n * \"all polygons that are not triangles\". The \"Triangulate\"-Step\n * is provided for your convenience, it splits all polygons in\n * triangles (which are much easier to handle).\n */\n aiPrimitiveType_POLYGON = 0x8,\n\n\n /** This value is not used. It is just here to force the\n * compiler to map this enum to a 32 Bit integer.\n */\n#ifndef SWIG\n _aiPrimitiveType_Force32Bit = INT_MAX\n#endif\n}; //! enum aiPrimitiveType\n\n// Get the #aiPrimitiveType flag for a specific number of face indices\n#define AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) \\\n ((n) > 3 ? aiPrimitiveType_POLYGON : (aiPrimitiveType)(1u << ((n)-1)))\n\n\n\n// ---------------------------------------------------------------------------\n/** @brief NOT CURRENTLY IN USE. An AnimMesh is an attachment to an #aiMesh stores per-vertex\n * animations for a particular frame.\n *\n * You may think of an #aiAnimMesh as a `patch` for the host mesh, which\n * replaces only certain vertex data streams at a particular time.\n * Each mesh stores n attached meshes (#aiMesh::mAnimMeshes).\n * The actual relationship between the time line and anim meshes is\n * established by #aiMeshAnim, which references singular mesh attachments\n * by their ID and binds them to a time offset.\n*/\nstruct aiAnimMesh\n{\n /** Replacement for aiMesh::mVertices. If this array is non-NULL,\n * it *must* contain mNumVertices entries. The corresponding\n * array in the host mesh must be non-NULL as well - animation\n * meshes may neither add or nor remove vertex components (if\n * a replacement array is NULL and the corresponding source\n * array is not, the source data is taken instead)*/\n C_STRUCT aiVector3D* mVertices;\n\n /** Replacement for aiMesh::mNormals. */\n C_STRUCT aiVector3D* mNormals;\n\n /** Replacement for aiMesh::mTangents. */\n C_STRUCT aiVector3D* mTangents;\n\n /** Replacement for aiMesh::mBitangents. */\n C_STRUCT aiVector3D* mBitangents;\n\n /** Replacement for aiMesh::mColors */\n C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];\n\n /** Replacement for aiMesh::mTextureCoords */\n C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];\n\n /** The number of vertices in the aiAnimMesh, and thus the length of all\n * the member arrays.\n *\n * This has always the same value as the mNumVertices property in the\n * corresponding aiMesh. It is duplicated here merely to make the length\n * of the member arrays accessible even if the aiMesh is not known, e.g.\n * from language bindings.\n */\n unsigned int mNumVertices;\n\n#ifdef __cplusplus\n\n aiAnimMesh()\n : mVertices( NULL )\n , mNormals( NULL )\n , mTangents( NULL )\n , mBitangents( NULL )\n , mNumVertices( 0 )\n {\n // fixme consider moving this to the ctor initializer list as well\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++){\n mTextureCoords[a] = NULL;\n }\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {\n mColors[a] = NULL;\n }\n }\n\n ~aiAnimMesh()\n {\n delete [] mVertices;\n delete [] mNormals;\n delete [] mTangents;\n delete [] mBitangents;\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {\n delete [] mTextureCoords[a];\n }\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {\n delete [] mColors[a];\n }\n }\n\n /** Check whether the anim mesh overrides the vertex positions\n * of its host mesh*/\n bool HasPositions() const {\n return mVertices != NULL;\n }\n\n /** Check whether the anim mesh overrides the vertex normals\n * of its host mesh*/\n bool HasNormals() const {\n return mNormals != NULL;\n }\n\n /** Check whether the anim mesh overrides the vertex tangents\n * and bitangents of its host mesh. As for aiMesh,\n * tangents and bitangents always go together. */\n bool HasTangentsAndBitangents() const {\n return mTangents != NULL;\n }\n\n /** Check whether the anim mesh overrides a particular\n * set of vertex colors on his host mesh.\n * @param pIndex 0= AI_MAX_NUMBER_OF_COLOR_SETS ? false : mColors[pIndex] != NULL;\n }\n\n /** Check whether the anim mesh overrides a particular\n * set of texture coordinates on his host mesh.\n * @param pIndex 0= AI_MAX_NUMBER_OF_TEXTURECOORDS ? false : mTextureCoords[pIndex] != NULL;\n }\n\n#endif\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief A mesh represents a geometry or model with a single material.\n*\n* It usually consists of a number of vertices and a series of primitives/faces\n* referencing the vertices. In addition there might be a series of bones, each\n* of them addressing a number of vertices with a certain weight. Vertex data\n* is presented in channels with each channel containing a single per-vertex\n* information such as a set of texture coords or a normal vector.\n* If a data pointer is non-null, the corresponding data stream is present.\n* From C++-programs you can also use the comfort functions Has*() to\n* test for the presence of various data streams.\n*\n* A Mesh uses only a single material which is referenced by a material ID.\n* @note The mPositions member is usually not optional. However, vertex positions\n* *could* be missing if the #AI_SCENE_FLAGS_INCOMPLETE flag is set in\n* @code\n* aiScene::mFlags\n* @endcode\n*/\nstruct aiMesh\n{\n /** Bitwise combination of the members of the #aiPrimitiveType enum.\n * This specifies which types of primitives are present in the mesh.\n * The \"SortByPrimitiveType\"-Step can be used to make sure the\n * output meshes consist of one primitive type each.\n */\n unsigned int mPrimitiveTypes;\n\n /** The number of vertices in this mesh.\n * This is also the size of all of the per-vertex data arrays.\n * The maximum value for this member is #AI_MAX_VERTICES.\n */\n unsigned int mNumVertices;\n\n /** The number of primitives (triangles, polygons, lines) in this mesh.\n * This is also the size of the mFaces array.\n * The maximum value for this member is #AI_MAX_FACES.\n */\n unsigned int mNumFaces;\n\n /** Vertex positions.\n * This array is always present in a mesh. The array is\n * mNumVertices in size.\n */\n C_STRUCT aiVector3D* mVertices;\n\n /** Vertex normals.\n * The array contains normalized vectors, NULL if not present.\n * The array is mNumVertices in size. Normals are undefined for\n * point and line primitives. A mesh consisting of points and\n * lines only may not have normal vectors. Meshes with mixed\n * primitive types (i.e. lines and triangles) may have normals,\n * but the normals for vertices that are only referenced by\n * point or line primitives are undefined and set to QNaN (WARN:\n * qNaN compares to inequal to *everything*, even to qNaN itself.\n * Using code like this to check whether a field is qnan is:\n * @code\n * #define IS_QNAN(f) (f != f)\n * @endcode\n * still dangerous because even 1.f == 1.f could evaluate to false! (\n * remember the subtleties of IEEE754 arithmetics). Use stuff like\n * @c fpclassify instead.\n * @note Normal vectors computed by Assimp are always unit-length.\n * However, this needn't apply for normals that have been taken\n * directly from the model file.\n */\n C_STRUCT aiVector3D* mNormals;\n\n /** Vertex tangents.\n * The tangent of a vertex points in the direction of the positive\n * X texture axis. The array contains normalized vectors, NULL if\n * not present. The array is mNumVertices in size. A mesh consisting\n * of points and lines only may not have normal vectors. Meshes with\n * mixed primitive types (i.e. lines and triangles) may have\n * normals, but the normals for vertices that are only referenced by\n * point or line primitives are undefined and set to qNaN. See\n * the #mNormals member for a detailed discussion of qNaNs.\n * @note If the mesh contains tangents, it automatically also\n * contains bitangents.\n */\n C_STRUCT aiVector3D* mTangents;\n\n /** Vertex bitangents.\n * The bitangent of a vertex points in the direction of the positive\n * Y texture axis. The array contains normalized vectors, NULL if not\n * present. The array is mNumVertices in size.\n * @note If the mesh contains tangents, it automatically also contains\n * bitangents.\n */\n C_STRUCT aiVector3D* mBitangents;\n\n /** Vertex color sets.\n * A mesh may contain 0 to #AI_MAX_NUMBER_OF_COLOR_SETS vertex\n * colors per vertex. NULL if not present. Each array is\n * mNumVertices in size if present.\n */\n C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];\n\n /** Vertex texture coords, also known as UV channels.\n * A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per\n * vertex. NULL if not present. The array is mNumVertices in size.\n */\n C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];\n\n /** Specifies the number of components for a given UV channel.\n * Up to three channels are supported (UVW, for accessing volume\n * or cube maps). If the value is 2 for a given channel n, the\n * component p.z of mTextureCoords[n][p] is set to 0.0f.\n * If the value is 1 for a given channel, p.y is set to 0.0f, too.\n * @note 4D coords are not supported\n */\n unsigned int mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];\n\n /** The faces the mesh is constructed from.\n * Each face refers to a number of vertices by their indices.\n * This array is always present in a mesh, its size is given\n * in mNumFaces. If the #AI_SCENE_FLAGS_NON_VERBOSE_FORMAT\n * is NOT set each face references an unique set of vertices.\n */\n C_STRUCT aiFace* mFaces;\n\n /** The number of bones this mesh contains.\n * Can be 0, in which case the mBones array is NULL.\n */\n unsigned int mNumBones;\n\n /** The bones of this mesh.\n * A bone consists of a name by which it can be found in the\n * frame hierarchy and a set of vertex weights.\n */\n C_STRUCT aiBone** mBones;\n\n /** The material used by this mesh.\n * A mesh uses only a single material. If an imported model uses\n * multiple materials, the import splits up the mesh. Use this value\n * as index into the scene's material list.\n */\n unsigned int mMaterialIndex;\n\n /** Name of the mesh. Meshes can be named, but this is not a\n * requirement and leaving this field empty is totally fine.\n * There are mainly three uses for mesh names:\n * - some formats name nodes and meshes independently.\n * - importers tend to split meshes up to meet the\n * one-material-per-mesh requirement. Assigning\n * the same (dummy) name to each of the result meshes\n * aids the caller at recovering the original mesh\n * partitioning.\n * - Vertex animations refer to meshes by their names.\n **/\n C_STRUCT aiString mName;\n\n\n /** NOT CURRENTLY IN USE. The number of attachment meshes */\n unsigned int mNumAnimMeshes;\n\n /** NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation.\n * Attachment meshes carry replacement data for some of the\n * mesh's vertex components (usually positions, normals). */\n C_STRUCT aiAnimMesh** mAnimMeshes;\n\n\n#ifdef __cplusplus\n\n //! Default constructor. Initializes all members to 0\n aiMesh()\n : mPrimitiveTypes( 0 )\n , mNumVertices( 0 )\n , mNumFaces( 0 )\n , mVertices( NULL )\n , mNormals( NULL )\n , mTangents( NULL )\n , mBitangents( NULL )\n , mFaces( NULL )\n , mNumBones( 0 )\n , mBones( NULL )\n , mMaterialIndex( 0 )\n , mNumAnimMeshes( 0 )\n , mAnimMeshes( NULL )\n {\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++)\n {\n mNumUVComponents[a] = 0;\n mTextureCoords[a] = NULL;\n }\n\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++)\n mColors[a] = NULL;\n }\n\n //! Deletes all storage allocated for the mesh\n ~aiMesh()\n {\n delete [] mVertices;\n delete [] mNormals;\n delete [] mTangents;\n delete [] mBitangents;\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {\n delete [] mTextureCoords[a];\n }\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {\n delete [] mColors[a];\n }\n\n // DO NOT REMOVE THIS ADDITIONAL CHECK\n if (mNumBones && mBones) {\n for( unsigned int a = 0; a < mNumBones; a++) {\n delete mBones[a];\n }\n delete [] mBones;\n }\n\n if (mNumAnimMeshes && mAnimMeshes) {\n for( unsigned int a = 0; a < mNumAnimMeshes; a++) {\n delete mAnimMeshes[a];\n }\n delete [] mAnimMeshes;\n }\n\n delete [] mFaces;\n }\n\n //! Check whether the mesh contains positions. Provided no special\n //! scene flags are set, this will always be true\n bool HasPositions() const\n { return mVertices != NULL && mNumVertices > 0; }\n\n //! Check whether the mesh contains faces. If no special scene flags\n //! are set this should always return true\n bool HasFaces() const\n { return mFaces != NULL && mNumFaces > 0; }\n\n //! Check whether the mesh contains normal vectors\n bool HasNormals() const\n { return mNormals != NULL && mNumVertices > 0; }\n\n //! Check whether the mesh contains tangent and bitangent vectors\n //! It is not possible that it contains tangents and no bitangents\n //! (or the other way round). The existence of one of them\n //! implies that the second is there, too.\n bool HasTangentsAndBitangents() const\n { return mTangents != NULL && mBitangents != NULL && mNumVertices > 0; }\n\n //! Check whether the mesh contains a vertex color set\n //! \\param pIndex Index of the vertex color set\n bool HasVertexColors( unsigned int pIndex) const\n {\n if( pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS)\n return false;\n else\n return mColors[pIndex] != NULL && mNumVertices > 0;\n }\n\n //! Check whether the mesh contains a texture coordinate set\n //! \\param pIndex Index of the texture coordinates set\n bool HasTextureCoords( unsigned int pIndex) const\n {\n if( pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS)\n return false;\n else\n return mTextureCoords[pIndex] != NULL && mNumVertices > 0;\n }\n\n //! Get the number of UV channels the mesh contains\n unsigned int GetNumUVChannels() const\n {\n unsigned int n = 0;\n while (n < AI_MAX_NUMBER_OF_TEXTURECOORDS && mTextureCoords[n])++n;\n return n;\n }\n\n //! Get the number of vertex color channels the mesh contains\n unsigned int GetNumColorChannels() const\n {\n unsigned int n = 0;\n while (n < AI_MAX_NUMBER_OF_COLOR_SETS && mColors[n])++n;\n return n;\n }\n\n //! Check whether the mesh contains bones\n inline bool HasBones() const\n { return mBones != NULL && mNumBones > 0; }\n\n#endif // __cplusplus\n};\n\n\n#ifdef __cplusplus\n}\n#endif //! extern \"C\"\n#endif // __AI_MESH_H_INC\n\n"}, {"path": "includes/assimp/metadata.h", "language": "code", "loc": 199, "comment_density": 0.407, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file metadata.h\n * @brief Defines the data structures for holding node meta information.\n */\n#ifndef __AI_METADATA_H_INC__\n#define __AI_METADATA_H_INC__\n\n#include \n\n#if defined(_MSC_VER) && (_MSC_VER <= 1500)\n#include \"Compiler/pstdint.h\"\n#else\n#include \n#include \n#endif\n\n\n\n// -------------------------------------------------------------------------------\n/**\n * Enum used to distinguish data types\n */\n // -------------------------------------------------------------------------------\ntypedef enum aiMetadataType\n{\n AI_BOOL = 0,\n AI_INT = 1,\n AI_UINT64 = 2,\n AI_FLOAT = 3,\n AI_AISTRING = 4,\n AI_AIVECTOR3D = 5,\n\n#ifndef SWIG\n FORCE_32BIT = INT_MAX\n#endif\n} aiMetadataType;\n\n\n\n// -------------------------------------------------------------------------------\n/**\n * Metadata entry\n *\n * The type field uniquely identifies the underlying type of the data field\n */\n // -------------------------------------------------------------------------------\nstruct aiMetadataEntry\n{\n aiMetadataType mType;\n void* mData;\n};\n\n\n\n#ifdef __cplusplus\n\n#include \n\n\n\n// -------------------------------------------------------------------------------\n/**\n * Helper functions to get the aiType enum entry for a type\n */\n // -------------------------------------------------------------------------------\ninline aiMetadataType GetAiType( bool ) { return AI_BOOL; }\ninline aiMetadataType GetAiType( int ) { return AI_INT; }\ninline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; }\ninline aiMetadataType GetAiType( float ) { return AI_FLOAT; }\ninline aiMetadataType GetAiType( aiString ) { return AI_AISTRING; }\ninline aiMetadataType GetAiType( aiVector3D ) { return AI_AIVECTOR3D; }\n\n\n\n#endif\n\n\n\n// -------------------------------------------------------------------------------\n/**\n * Container for holding metadata.\n *\n * Metadata is a key-value store using string keys and values.\n */\n // -------------------------------------------------------------------------------\nstruct aiMetadata\n{\n /** Length of the mKeys and mValues arrays, respectively */\n unsigned int mNumProperties;\n\n /** Arrays of keys, may not be NULL. Entries in this array may not be NULL as well. */\n C_STRUCT aiString* mKeys;\n\n /** Arrays of values, may not be NULL. Entries in this array may be NULL if the\n * corresponding property key has no assigned value. */\n C_STRUCT aiMetadataEntry* mValues;\n\n#ifdef __cplusplus\n\n /** Constructor */\n aiMetadata()\n // set all members to zero by default\n : mNumProperties(0)\n , mKeys(NULL)\n , mValues(NULL)\n {}\n\n\n /** Destructor */\n ~aiMetadata()\n {\n delete[] mKeys;\n mKeys = NULL;\n if (mValues)\n {\n // Delete each metadata entry\n for (unsigned i=0; i(data);\n break;\n case AI_INT:\n delete static_cast(data);\n break;\n case AI_UINT64:\n delete static_cast(data);\n break;\n case AI_FLOAT:\n delete static_cast(data);\n break;\n case AI_AISTRING:\n delete static_cast(data);\n break;\n case AI_AIVECTOR3D:\n delete static_cast(data);\n break;\n#ifndef SWIG\n case FORCE_32BIT:\n#endif\n default:\n assert(false);\n break;\n }\n }\n\n // Delete the metadata array\n delete [] mValues;\n mValues = NULL;\n }\n }\n\n\n\n template\n inline void Set( unsigned index, const std::string& key, const T& value )\n {\n // In range assertion\n assert(index < mNumProperties);\n\n // Set metadata key\n mKeys[index] = key;\n\n // Set metadata type\n mValues[index].mType = GetAiType(value);\n // Copy the given value to the dynamic storage\n mValues[index].mData = new T(value);\n }\n\n template\n inline bool Get( unsigned index, T& value )\n {\n // In range assertion\n assert(index < mNumProperties);\n\n // Return false if the output data type does\n // not match the found value's data type\n if ( GetAiType( value ) != mValues[ index ].mType ) {\n return false;\n }\n\n // Otherwise, output the found value and\n // return true\n value = *static_cast(mValues[index].mData);\n return true;\n }\n\n template\n inline bool Get( const aiString& key, T& value )\n {\n // Search for the given key\n for (unsigned i=0; i\n inline bool Get( const std::string& key, T& value ) {\n return Get(aiString(key), value);\n }\n\n#endif // __cplusplus\n\n};\n\n#endif // __AI_METADATA_H_INC__\n\n\n"}, {"path": "includes/assimp/postprocess.h", "language": "code", "loc": 585, "comment_density": 0.88, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file postprocess.h\n * @brief Definitions for import post processing steps\n */\n#ifndef AI_POSTPROCESS_H_INC\n#define AI_POSTPROCESS_H_INC\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// -----------------------------------------------------------------------------------\n/** @enum aiPostProcessSteps\n * @brief Defines the flags for all possible post processing steps.\n *\n * @note Some steps are influenced by properties set on the Assimp::Importer itself\n *\n * @see Assimp::Importer::ReadFile()\n * @see Assimp::Importer::SetPropertyInteger()\n * @see aiImportFile\n * @see aiImportFileEx\n */\n// -----------------------------------------------------------------------------------\nenum aiPostProcessSteps\n{\n\n // -------------------------------------------------------------------------\n /**
Calculates the tangents and bitangents for the imported meshes.\n *\n * Does nothing if a mesh does not have normals. You might want this post\n * processing step to be executed if you plan to use tangent space calculations\n * such as normal mapping applied to the meshes. There's an importer property,\n * #AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE, which allows you to specify\n * a maximum smoothing angle for the algorithm. However, usually you'll\n * want to leave it at the default value.\n */\n aiProcess_CalcTangentSpace = 0x1,\n\n // -------------------------------------------------------------------------\n /**
Identifies and joins identical vertex data sets within all\n * imported meshes.\n *\n * After this step is run, each mesh contains unique vertices,\n * so a vertex may be used by multiple faces. You usually want\n * to use this post processing step. If your application deals with\n * indexed geometry, this step is compulsory or you'll just waste rendering\n * time. If this flag is not specified, no vertices are referenced by\n * more than one face and no index buffer is required for rendering.\n */\n aiProcess_JoinIdenticalVertices = 0x2,\n\n // -------------------------------------------------------------------------\n /**
Converts all the imported data to a left-handed coordinate space.\n *\n * By default the data is returned in a right-handed coordinate space (which\n * OpenGL prefers). In this space, +X points to the right,\n * +Z points towards the viewer, and +Y points upwards. In the DirectX\n * coordinate space +X points to the right, +Y points upwards, and +Z points\n * away from the viewer.\n *\n * You'll probably want to consider this flag if you use Direct3D for\n * rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this\n * setting and bundles all conversions typically required for D3D-based\n * applications.\n */\n aiProcess_MakeLeftHanded = 0x4,\n\n // -------------------------------------------------------------------------\n /**
Triangulates all faces of all meshes.\n *\n * By default the imported mesh data might contain faces with more than 3\n * indices. For rendering you'll usually want all faces to be triangles.\n * This post processing step splits up faces with more than 3 indices into\n * triangles. Line and point primitives are *not* modified! If you want\n * 'triangles only' with no other kinds of primitives, try the following\n * solution:\n *
    \n *
  • Specify both #aiProcess_Triangulate and #aiProcess_SortByPType
  • \n *
  • Ignore all point and line meshes when you process assimp's output
  • \n *
\n */\n aiProcess_Triangulate = 0x8,\n\n // -------------------------------------------------------------------------\n /**
Removes some parts of the data structure (animations, materials,\n * light sources, cameras, textures, vertex components).\n *\n * The components to be removed are specified in a separate\n * importer property, #AI_CONFIG_PP_RVC_FLAGS. This is quite useful\n * if you don't need all parts of the output structure. Vertex colors\n * are rarely used today for example... Calling this step to remove unneeded\n * data from the pipeline as early as possible results in increased\n * performance and a more optimized output data structure.\n * This step is also useful if you want to force Assimp to recompute\n * normals or tangents. The corresponding steps don't recompute them if\n * they're already there (loaded from the source asset). By using this\n * step you can make sure they are NOT there.\n *\n * This flag is a poor one, mainly because its purpose is usually\n * misunderstood. Consider the following case: a 3D model has been exported\n * from a CAD app, and it has per-face vertex colors. Vertex positions can't be\n * shared, thus the #aiProcess_JoinIdenticalVertices step fails to\n * optimize the data because of these nasty little vertex colors.\n * Most apps don't even process them, so it's all for nothing. By using\n * this step, unneeded components are excluded as early as possible\n * thus opening more room for internal optimizations.\n */\n aiProcess_RemoveComponent = 0x10,\n\n // -------------------------------------------------------------------------\n /**
Generates normals for all faces of all meshes.\n *\n * This is ignored if normals are already there at the time this flag\n * is evaluated. Model importers try to load them from the source file, so\n * they're usually already there. Face normals are shared between all points\n * of a single face, so a single point can have multiple normals, which\n * forces the library to duplicate vertices in some cases.\n * #aiProcess_JoinIdenticalVertices is *senseless* then.\n *\n * This flag may not be specified together with #aiProcess_GenSmoothNormals.\n */\n aiProcess_GenNormals = 0x20,\n\n // -------------------------------------------------------------------------\n /**
Generates smooth normals for all vertices in the mesh.\n *\n * This is ignored if normals are already there at the time this flag\n * is evaluated. Model importers try to load them from the source file, so\n * they're usually already there.\n *\n * This flag may not be specified together with\n * #aiProcess_GenNormals. There's a importer property,\n * #AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE which allows you to specify\n * an angle maximum for the normal smoothing algorithm. Normals exceeding\n * this limit are not smoothed, resulting in a 'hard' seam between two faces.\n * Using a decent angle here (e.g. 80 degrees) results in very good visual\n * appearance.\n */\n aiProcess_GenSmoothNormals = 0x40,\n\n // -------------------------------------------------------------------------\n /**
Splits large meshes into smaller sub-meshes.\n *\n * This is quite useful for real-time rendering, where the number of triangles\n * which can be maximally processed in a single draw-call is limited\n * by the video driver/hardware. The maximum vertex buffer is usually limited\n * too. Both requirements can be met with this step: you may specify both a\n * triangle and vertex limit for a single mesh.\n *\n * The split limits can (and should!) be set through the\n * #AI_CONFIG_PP_SLM_VERTEX_LIMIT and #AI_CONFIG_PP_SLM_TRIANGLE_LIMIT\n * importer properties. The default values are #AI_SLM_DEFAULT_MAX_VERTICES and\n * #AI_SLM_DEFAULT_MAX_TRIANGLES.\n *\n * Note that splitting is generally a time-consuming task, but only if there's\n * something to split. The use of this step is recommended for most users.\n */\n aiProcess_SplitLargeMeshes = 0x80,\n\n // -------------------------------------------------------------------------\n /**
Removes the node graph and pre-transforms all vertices with\n * the local transformation matrices of their nodes.\n *\n * The output scene still contains nodes, however there is only a\n * root node with children, each one referencing only one mesh,\n * and each mesh referencing one material. For rendering, you can\n * simply render all meshes in order - you don't need to pay\n * attention to local transformations and the node hierarchy.\n * Animations are removed during this step.\n * This step is intended for applications without a scenegraph.\n * The step CAN cause some problems: if e.g. a mesh of the asset\n * contains normals and another, using the same material index, does not,\n * they will be brought together, but the first meshes's part of\n * the normal list is zeroed. However, these artifacts are rare.\n * @note The #AI_CONFIG_PP_PTV_NORMALIZE configuration property\n * can be set to normalize the scene's spatial dimension to the -1...1\n * range.\n */\n aiProcess_PreTransformVertices = 0x100,\n\n // -------------------------------------------------------------------------\n /**
Limits the number of bones simultaneously affecting a single vertex\n * to a maximum value.\n *\n * If any vertex is affected by more than the maximum number of bones, the least\n * important vertex weights are removed and the remaining vertex weights are\n * renormalized so that the weights still sum up to 1.\n * The default bone weight limit is 4 (defined as #AI_LMW_MAX_WEIGHTS in\n * config.h), but you can use the #AI_CONFIG_PP_LBW_MAX_WEIGHTS importer\n * property to supply your own limit to the post processing step.\n *\n * If you intend to perform the skinning in hardware, this post processing\n * step might be of interest to you.\n */\n aiProcess_LimitBoneWeights = 0x200,\n\n // -------------------------------------------------------------------------\n /**
Validates the imported scene data structure.\n * This makes sure that all indices are valid, all animations and\n * bones are linked correctly, all material references are correct .. etc.\n *\n * It is recommended that you capture Assimp's log output if you use this flag,\n * so you can easily find out what's wrong if a file fails the\n * validation. The validator is quite strict and will find *all*\n * inconsistencies in the data structure... It is recommended that plugin\n * developers use it to debug their loaders. There are two types of\n * validation failures:\n *
    \n *
  • Error: There's something wrong with the imported data. Further\n * postprocessing is not possible and the data is not usable at all.\n * The import fails. #Importer::GetErrorString() or #aiGetErrorString()\n * carry the error message around.
  • \n *
  • Warning: There are some minor issues (e.g. 1000000 animation\n * keyframes with the same time), but further postprocessing and use\n * of the data structure is still safe. Warning details are written\n * to the log file, #AI_SCENE_FLAGS_VALIDATION_WARNING is set\n * in #aiScene::mFlags
  • \n *
\n *\n * This post-processing step is not time-consuming. Its use is not\n * compulsory, but recommended.\n */\n aiProcess_ValidateDataStructure = 0x400,\n\n // -------------------------------------------------------------------------\n /**
Reorders triangles for better vertex cache locality.\n *\n * The step tries to improve the ACMR (average post-transform vertex cache\n * miss ratio) for all meshes. The implementation runs in O(n) and is\n * roughly based on the 'tipsify' algorithm (see this\n * paper).\n *\n * If you intend to render huge models in hardware, this step might\n * be of interest to you. The #AI_CONFIG_PP_ICL_PTCACHE_SIZE\n * importer property can be used to fine-tune the cache optimization.\n */\n aiProcess_ImproveCacheLocality = 0x800,\n\n // -------------------------------------------------------------------------\n /**
Searches for redundant/unreferenced materials and removes them.\n *\n * This is especially useful in combination with the\n * #aiProcess_PreTransformVertices and #aiProcess_OptimizeMeshes flags.\n * Both join small meshes with equal characteristics, but they can't do\n * their work if two meshes have different materials. Because several\n * material settings are lost during Assimp's import filters,\n * (and because many exporters don't check for redundant materials), huge\n * models often have materials which are defined several times with\n * exactly the same settings.\n *\n * Several material settings not contributing to the final appearance of\n * a surface are ignored in all comparisons (e.g. the material name).\n * So, if you're passing additional information through the\n * content pipeline (probably using *magic* material names), don't\n * specify this flag. Alternatively take a look at the\n * #AI_CONFIG_PP_RRM_EXCLUDE_LIST importer property.\n */\n aiProcess_RemoveRedundantMaterials = 0x1000,\n\n // -------------------------------------------------------------------------\n /**
This step tries to determine which meshes have normal vectors\n * that are facing inwards and inverts them.\n *\n * The algorithm is simple but effective:\n * the bounding box of all vertices + their normals is compared against\n * the volume of the bounding box of all vertices without their normals.\n * This works well for most objects, problems might occur with planar\n * surfaces. However, the step tries to filter such cases.\n * The step inverts all in-facing normals. Generally it is recommended\n * to enable this step, although the result is not always correct.\n */\n aiProcess_FixInfacingNormals = 0x2000,\n\n // -------------------------------------------------------------------------\n /**
This step splits meshes with more than one primitive type in\n * homogeneous sub-meshes.\n *\n * The step is executed after the triangulation step. After the step\n * returns, just one bit is set in aiMesh::mPrimitiveTypes. This is\n * especially useful for real-time rendering where point and line\n * primitives are often ignored or rendered separately.\n * You can use the #AI_CONFIG_PP_SBP_REMOVE importer property to\n * specify which primitive types you need. This can be used to easily\n * exclude lines and points, which are rarely used, from the import.\n */\n aiProcess_SortByPType = 0x8000,\n\n // -------------------------------------------------------------------------\n /**
This step searches all meshes for degenerate primitives and\n * converts them to proper lines or points.\n *\n * A face is 'degenerate' if one or more of its points are identical.\n * To have the degenerate stuff not only detected and collapsed but\n * removed, try one of the following procedures:\n *
1. (if you support lines and points for rendering but don't\n * want the degenerates)
\n *
    \n *
  • Specify the #aiProcess_FindDegenerates flag.\n *
  • \n *
  • Set the #AI_CONFIG_PP_FD_REMOVE importer property to\n * 1. This will cause the step to remove degenerate triangles from the\n * import as soon as they're detected. They won't pass any further\n * pipeline steps.\n *
  • \n *
\n *
2.(if you don't support lines and points at all)
\n *
    \n *
  • Specify the #aiProcess_FindDegenerates flag.\n *
  • \n *
  • Specify the #aiProcess_SortByPType flag. This moves line and\n * point primitives to separate meshes.\n *
  • \n *
  • Set the #AI_CONFIG_PP_SBP_REMOVE importer property to\n * @code aiPrimitiveType_POINTS | aiPrimitiveType_LINES\n * @endcode to cause SortByPType to reject point\n * and line meshes from the scene.\n *
  • \n *
\n * @note Degenerate polygons are not necessarily evil and that's why\n * they're not removed by default. There are several file formats which\n * don't support lines or points, and some exporters bypass the\n * format specification and write them as degenerate triangles instead.\n */\n aiProcess_FindDegenerates = 0x10000,\n\n // -------------------------------------------------------------------------\n /**
This step searches all meshes for invalid data, such as zeroed\n * normal vectors or invalid UV coords and removes/fixes them. This is\n * intended to get rid of some common exporter errors.\n *\n * This is especially useful for normals. If they are invalid, and\n * the step recognizes this, they will be removed and can later\n * be recomputed, i.e. by the #aiProcess_GenSmoothNormals flag.
\n * The step will also remove meshes that are infinitely small and reduce\n * animation tracks consisting of hundreds if redundant keys to a single\n * key. The AI_CONFIG_PP_FID_ANIM_ACCURACY config property decides\n * the accuracy of the check for duplicate animation tracks.\n */\n aiProcess_FindInvalidData = 0x20000,\n\n // -------------------------------------------------------------------------\n /**
This step converts non-UV mappings (such as spherical or\n * cylindrical mapping) to proper texture coordinate channels.\n *\n * Most applications will support UV mapping only, so you will\n * probably want to specify this step in every case. Note that Assimp is not\n * always able to match the original mapping implementation of the\n * 3D app which produced a model perfectly. It's always better to let the\n * modelling app compute the UV channels - 3ds max, Maya, Blender,\n * LightWave, and Modo do this for example.\n *\n * @note If this step is not requested, you'll need to process the\n * #AI_MATKEY_MAPPING material property in order to display all assets\n * properly.\n */\n aiProcess_GenUVCoords = 0x40000,\n\n // -------------------------------------------------------------------------\n /**
This step applies per-texture UV transformations and bakes\n * them into stand-alone vtexture coordinate channels.\n *\n * UV transformations are specified per-texture - see the\n * #AI_MATKEY_UVTRANSFORM material key for more information.\n * This step processes all textures with\n * transformed input UV coordinates and generates a new (pre-transformed) UV channel\n * which replaces the old channel. Most applications won't support UV\n * transformations, so you will probably want to specify this step.\n *\n * @note UV transformations are usually implemented in real-time apps by\n * transforming texture coordinates at vertex shader stage with a 3x3\n * (homogenous) transformation matrix.\n */\n aiProcess_TransformUVCoords = 0x80000,\n\n // -------------------------------------------------------------------------\n /**
This step searches for duplicate meshes and replaces them\n * with references to the first mesh.\n *\n * This step takes a while, so don't use it if speed is a concern.\n * Its main purpose is to workaround the fact that many export\n * file formats don't support instanced meshes, so exporters need to\n * duplicate meshes. This step removes the duplicates again. Please\n * note that Assimp does not currently support per-node material\n * assignment to meshes, which means that identical meshes with\n * different materials are currently *not* joined, although this is\n * planned for future versions.\n */\n aiProcess_FindInstances = 0x100000,\n\n // -------------------------------------------------------------------------\n /**
A postprocessing step to reduce the number of meshes.\n *\n * This will, in fact, reduce the number of draw calls.\n *\n * This is a very effective optimization and is recommended to be used\n * together with #aiProcess_OptimizeGraph, if possible. The flag is fully\n * compatible with both #aiProcess_SplitLargeMeshes and #aiProcess_SortByPType.\n */\n aiProcess_OptimizeMeshes = 0x200000,\n\n\n // -------------------------------------------------------------------------\n /**
A postprocessing step to optimize the scene hierarchy.\n *\n * Nodes without animations, bones, lights or cameras assigned are\n * collapsed and joined.\n *\n * Node names can be lost during this step. If you use special 'tag nodes'\n * to pass additional information through your content pipeline, use the\n * #AI_CONFIG_PP_OG_EXCLUDE_LIST importer property to specify a\n * list of node names you want to be kept. Nodes matching one of the names\n * in this list won't be touched or modified.\n *\n * Use this flag with caution. Most simple files will be collapsed to a\n * single node, so complex hierarchies are usually completely lost. This is not\n * useful for editor environments, but probably a very effective\n * optimization if you just want to get the model data, convert it to your\n * own format, and render it as fast as possible.\n *\n * This flag is designed to be used with #aiProcess_OptimizeMeshes for best\n * results.\n *\n * @note 'Crappy' scenes with thousands of extremely small meshes packed\n * in deeply nested nodes exist for almost all file formats.\n * #aiProcess_OptimizeMeshes in combination with #aiProcess_OptimizeGraph\n * usually fixes them all and makes them renderable.\n */\n aiProcess_OptimizeGraph = 0x400000,\n\n // -------------------------------------------------------------------------\n /**
This step flips all UV coordinates along the y-axis and adjusts\n * material settings and bitangents accordingly.\n *\n * Output UV coordinate system:\n * @code\n * 0y|0y ---------- 1x|0y\n * | |\n * | |\n * | |\n * 0x|1y ---------- 1x|1y\n * @endcode\n *\n * You'll probably want to consider this flag if you use Direct3D for\n * rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this\n * setting and bundles all conversions typically required for D3D-based\n * applications.\n */\n aiProcess_FlipUVs = 0x800000,\n\n // -------------------------------------------------------------------------\n /**
This step adjusts the output face winding order to be CW.\n *\n * The default face winding order is counter clockwise (CCW).\n *\n * Output face order:\n * @code\n * x2\n *\n * x0\n * x1\n * @endcode\n */\n aiProcess_FlipWindingOrder = 0x1000000,\n\n // -------------------------------------------------------------------------\n /**
This step splits meshes with many bones into sub-meshes so that each\n * su-bmesh has fewer or as many bones as a given limit.\n */\n aiProcess_SplitByBoneCount = 0x2000000,\n\n // -------------------------------------------------------------------------\n /**
This step removes bones losslessly or according to some threshold.\n *\n * In some cases (i.e. formats that require it) exporters are forced to\n * assign dummy bone weights to otherwise static meshes assigned to\n * animated meshes. Full, weight-based skinning is expensive while\n * animating nodes is extremely cheap, so this step is offered to clean up\n * the data in that regard.\n *\n * Use #AI_CONFIG_PP_DB_THRESHOLD to control this.\n * Use #AI_CONFIG_PP_DB_ALL_OR_NONE if you want bones removed if and\n * only if all bones within the scene qualify for removal.\n */\n aiProcess_Debone = 0x4000000\n\n // aiProcess_GenEntityMeshes = 0x100000,\n // aiProcess_OptimizeAnimations = 0x200000\n // aiProcess_FixTexturePaths = 0x200000\n};\n\n\n// ---------------------------------------------------------------------------------------\n/** @def aiProcess_ConvertToLeftHanded\n * @brief Shortcut flag for Direct3D-based applications.\n *\n * Supersedes the #aiProcess_MakeLeftHanded and #aiProcess_FlipUVs and\n * #aiProcess_FlipWindingOrder flags.\n * The output data matches Direct3D's conventions: left-handed geometry, upper-left\n * origin for UV coordinates and finally clockwise face order, suitable for CCW culling.\n *\n * @deprecated\n */\n#define aiProcess_ConvertToLeftHanded ( \\\n aiProcess_MakeLeftHanded | \\\n aiProcess_FlipUVs | \\\n aiProcess_FlipWindingOrder | \\\n 0 )\n\n\n// ---------------------------------------------------------------------------------------\n/** @def aiProcessPreset_TargetRealtime_Fast\n * @brief Default postprocess configuration optimizing the data for real-time rendering.\n *\n * Applications would want to use this preset to load models on end-user PCs,\n * maybe for direct use in game.\n *\n * If you're using DirectX, don't forget to combine this value with\n * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations\n * in your application apply the #aiProcess_TransformUVCoords step, too.\n * @note Please take the time to read the docs for the steps enabled by this preset.\n * Some of them offer further configurable properties, while some of them might not be of\n * use for you so it might be better to not specify them.\n */\n#define aiProcessPreset_TargetRealtime_Fast ( \\\n aiProcess_CalcTangentSpace | \\\n aiProcess_GenNormals | \\\n aiProcess_JoinIdenticalVertices | \\\n aiProcess_Triangulate | \\\n aiProcess_GenUVCoords | \\\n aiProcess_SortByPType | \\\n 0 )\n\n // ---------------------------------------------------------------------------------------\n /** @def aiProcessPreset_TargetRealtime_Quality\n * @brief Default postprocess configuration optimizing the data for real-time rendering.\n *\n * Unlike #aiProcessPreset_TargetRealtime_Fast, this configuration\n * performs some extra optimizations to improve rendering speed and\n * to minimize memory usage. It could be a good choice for a level editor\n * environment where import speed is not so important.\n *\n * If you're using DirectX, don't forget to combine this value with\n * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations\n * in your application apply the #aiProcess_TransformUVCoords step, too.\n * @note Please take the time to read the docs for the steps enabled by this preset.\n * Some of them offer further configurable properties, while some of them might not be\n * of use for you so it might be better to not specify them.\n */\n#define aiProcessPreset_TargetRealtime_Quality ( \\\n aiProcess_CalcTangentSpace | \\\n aiProcess_GenSmoothNormals | \\\n aiProcess_JoinIdenticalVertices | \\\n aiProcess_ImproveCacheLocality | \\\n aiProcess_LimitBoneWeights | \\\n aiProcess_RemoveRedundantMaterials | \\\n aiProcess_SplitLargeMeshes | \\\n aiProcess_Triangulate | \\\n aiProcess_GenUVCoords | \\\n aiProcess_SortByPType | \\\n aiProcess_FindDegenerates | \\\n aiProcess_FindInvalidData | \\\n 0 )\n\n // ---------------------------------------------------------------------------------------\n /** @def aiProcessPreset_TargetRealtime_MaxQuality\n * @brief Default postprocess configuration optimizing the data for real-time rendering.\n *\n * This preset enables almost every optimization step to achieve perfectly\n * optimized data. It's your choice for level editor environments where import speed\n * is not important.\n *\n * If you're using DirectX, don't forget to combine this value with\n * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations\n * in your application, apply the #aiProcess_TransformUVCoords step, too.\n * @note Please take the time to read the docs for the steps enabled by this preset.\n * Some of them offer further configurable properties, while some of them might not be\n * of use for you so it might be better to not specify them.\n */\n#define aiProcessPreset_TargetRealtime_MaxQuality ( \\\n aiProcessPreset_TargetRealtime_Quality | \\\n aiProcess_FindInstances | \\\n aiProcess_ValidateDataStructure | \\\n aiProcess_OptimizeMeshes | \\\n 0 )\n\n\n#ifdef __cplusplus\n} // end of extern \"C\"\n#endif\n\n#endif // AI_POSTPROCESS_H_INC\n"}, {"path": "includes/assimp/quaternion.h", "language": "code", "loc": 92, "comment_density": 0.587, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file quaternion.h\n * @brief Quaternion structure, including operators when compiling in C++\n */\n#ifndef AI_QUATERNION_H_INC\n#define AI_QUATERNION_H_INC\n\n#ifdef __cplusplus\n\ntemplate class aiVector3t;\ntemplate class aiMatrix3x3t;\n\n// ---------------------------------------------------------------------------\n/** Represents a quaternion in a 4D vector. */\ntemplate \nclass aiQuaterniont\n{\npublic:\n aiQuaterniont() : w(1.0), x(), y(), z() {}\n aiQuaterniont(TReal pw, TReal px, TReal py, TReal pz)\n : w(pw), x(px), y(py), z(pz) {}\n\n /** Construct from rotation matrix. Result is undefined if the matrix is not orthonormal. */\n explicit aiQuaterniont( const aiMatrix3x3t& pRotMatrix);\n\n /** Construct from euler angles */\n aiQuaterniont( TReal rotx, TReal roty, TReal rotz);\n\n /** Construct from an axis-angle pair */\n aiQuaterniont( aiVector3t axis, TReal angle);\n\n /** Construct from a normalized quaternion stored in a vec3 */\n explicit aiQuaterniont( aiVector3t normalized);\n\n /** Returns a matrix representation of the quaternion */\n aiMatrix3x3t GetMatrix() const;\n\npublic:\n\n bool operator== (const aiQuaterniont& o) const;\n bool operator!= (const aiQuaterniont& o) const;\n\n bool Equal(const aiQuaterniont& o, TReal epsilon = 1e-6) const;\n\npublic:\n\n /** Normalize the quaternion */\n aiQuaterniont& Normalize();\n\n /** Compute quaternion conjugate */\n aiQuaterniont& Conjugate ();\n\n /** Rotate a point by this quaternion */\n aiVector3t Rotate (const aiVector3t& in);\n\n /** Multiply two quaternions */\n aiQuaterniont operator* (const aiQuaterniont& two) const;\n\npublic:\n\n /** Performs a spherical interpolation between two quaternions and writes the result into the third.\n * @param pOut Target object to received the interpolated rotation.\n * @param pStart Start rotation of the interpolation at factor == 0.\n * @param pEnd End rotation, factor == 1.\n * @param pFactor Interpolation factor between 0 and 1. Values outside of this range yield undefined results.\n */\n static void Interpolate( aiQuaterniont& pOut, const aiQuaterniont& pStart,\n const aiQuaterniont& pEnd, TReal pFactor);\n\npublic:\n\n //! w,x,y,z components of the quaternion\n TReal w, x, y, z;\n} ;\n\ntypedef aiQuaterniont aiQuaternion;\n\n#else\n\nstruct aiQuaternion {\n float w, x, y, z;\n};\n\n#endif\n\n\n#endif // AI_QUATERNION_H_INC\n"}, {"path": "includes/assimp/scene.h", "language": "code", "loc": 349, "comment_density": 0.622, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file scene.h\n * @brief Defines the data structures in which the imported scene is returned.\n */\n#ifndef __AI_SCENE_H_INC__\n#define __AI_SCENE_H_INC__\n\n#include \"types.h\"\n#include \"texture.h\"\n#include \"mesh.h\"\n#include \"light.h\"\n#include \"camera.h\"\n#include \"material.h\"\n#include \"anim.h\"\n#include \"metadata.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n// -------------------------------------------------------------------------------\n/** A node in the imported hierarchy.\n *\n * Each node has name, a parent node (except for the root node),\n * a transformation relative to its parent and possibly several child nodes.\n * Simple file formats don't support hierarchical structures - for these formats\n * the imported scene does consist of only a single root node without children.\n */\n// -------------------------------------------------------------------------------\nstruct aiNode\n{\n /** The name of the node.\n *\n * The name might be empty (length of zero) but all nodes which\n * need to be referenced by either bones or animations are named.\n * Multiple nodes may have the same name, except for nodes which are referenced\n * by bones (see #aiBone and #aiMesh::mBones). Their names *must* be unique.\n *\n * Cameras and lights reference a specific node by name - if there\n * are multiple nodes with this name, they are assigned to each of them.\n *
\n * There are no limitations with regard to the characters contained in\n * the name string as it is usually taken directly from the source file.\n *\n * Implementations should be able to handle tokens such as whitespace, tabs,\n * line feeds, quotation marks, ampersands etc.\n *\n * Sometimes assimp introduces new nodes not present in the source file\n * into the hierarchy (usually out of necessity because sometimes the\n * source hierarchy format is simply not compatible). Their names are\n * surrounded by @verbatim <> @endverbatim e.g.\n * @verbatim @endverbatim.\n */\n C_STRUCT aiString mName;\n\n /** The transformation relative to the node's parent. */\n C_STRUCT aiMatrix4x4 mTransformation;\n\n /** Parent node. NULL if this node is the root node. */\n C_STRUCT aiNode* mParent;\n\n /** The number of child nodes of this node. */\n unsigned int mNumChildren;\n\n /** The child nodes of this node. NULL if mNumChildren is 0. */\n C_STRUCT aiNode** mChildren;\n\n /** The number of meshes of this node. */\n unsigned int mNumMeshes;\n\n /** The meshes of this node. Each entry is an index into the \n * mesh list of the #aiScene.\n */\n unsigned int* mMeshes;\n\n /** Metadata associated with this node or NULL if there is no metadata.\n * Whether any metadata is generated depends on the source file format. See the\n * @link importer_notes @endlink page for more information on every source file\n * format. Importers that don't document any metadata don't write any.\n */\n C_STRUCT aiMetadata* mMetaData;\n\n#ifdef __cplusplus\n /** Constructor */\n aiNode()\n // set all members to zero by default\n : mName(\"\")\n , mParent(NULL)\n , mNumChildren(0)\n , mChildren(NULL)\n , mNumMeshes(0)\n , mMeshes(NULL)\n , mMetaData(NULL)\n {\n }\n\n\n /** Construction from a specific name */\n explicit aiNode(const std::string& name)\n // set all members to zero by default\n : mName(name)\n , mParent(NULL)\n , mNumChildren(0)\n , mChildren(NULL)\n , mNumMeshes(0)\n , mMeshes(NULL)\n , mMetaData(NULL)\n {\n }\n\n /** Destructor */\n ~aiNode()\n {\n // delete all children recursively\n // to make sure we won't crash if the data is invalid ...\n if (mChildren && mNumChildren)\n {\n for( unsigned int a = 0; a < mNumChildren; a++)\n delete mChildren[a];\n }\n delete [] mChildren;\n delete [] mMeshes;\n delete mMetaData;\n }\n\n\n /** Searches for a node with a specific name, beginning at this\n * nodes. Normally you will call this method on the root node\n * of the scene.\n *\n * @param name Name to search for\n * @return NULL or a valid Node if the search was successful.\n */\n inline const aiNode* FindNode(const aiString& name) const\n {\n return FindNode(name.data);\n }\n\n\n inline aiNode* FindNode(const aiString& name)\n {\n return FindNode(name.data);\n }\n\n\n inline const aiNode* FindNode(const char* name) const\n {\n if (!::strcmp( mName.data,name))return this;\n for (unsigned int i = 0; i < mNumChildren;++i)\n {\n const aiNode* const p = mChildren[i]->FindNode(name);\n if (p) {\n return p;\n }\n }\n // there is definitely no sub-node with this name\n return NULL;\n }\n\n inline aiNode* FindNode(const char* name)\n {\n if (!::strcmp( mName.data,name))return this;\n for (unsigned int i = 0; i < mNumChildren;++i)\n {\n aiNode* const p = mChildren[i]->FindNode(name);\n if (p) {\n return p;\n }\n }\n // there is definitely no sub-node with this name\n return NULL;\n }\n\n#endif // __cplusplus\n};\n\n\n// -------------------------------------------------------------------------------\n/**\n * Specifies that the scene data structure that was imported is not complete.\n * This flag bypasses some internal validations and allows the import\n * of animation skeletons, material libraries or camera animation paths\n * using Assimp. Most applications won't support such data.\n */\n#define AI_SCENE_FLAGS_INCOMPLETE 0x1\n\n/**\n * This flag is set by the validation postprocess-step (aiPostProcess_ValidateDS)\n * if the validation is successful. In a validated scene you can be sure that\n * any cross references in the data structure (e.g. vertex indices) are valid.\n */\n#define AI_SCENE_FLAGS_VALIDATED 0x2\n\n/**\n * This flag is set by the validation postprocess-step (aiPostProcess_ValidateDS)\n * if the validation is successful but some issues have been found.\n * This can for example mean that a texture that does not exist is referenced\n * by a material or that the bone weights for a vertex don't sum to 1.0 ... .\n * In most cases you should still be able to use the import. This flag could\n * be useful for applications which don't capture Assimp's log output.\n */\n#define AI_SCENE_FLAGS_VALIDATION_WARNING 0x4\n\n/**\n * This flag is currently only set by the aiProcess_JoinIdenticalVertices step.\n * It indicates that the vertices of the output meshes aren't in the internal\n * verbose format anymore. In the verbose format all vertices are unique,\n * no vertex is ever referenced by more than one face.\n */\n#define AI_SCENE_FLAGS_NON_VERBOSE_FORMAT 0x8\n\n /**\n * Denotes pure height-map terrain data. Pure terrains usually consist of quads,\n * sometimes triangles, in a regular grid. The x,y coordinates of all vertex\n * positions refer to the x,y coordinates on the terrain height map, the z-axis\n * stores the elevation at a specific point.\n *\n * TER (Terragen) and HMP (3D Game Studio) are height map formats.\n * @note Assimp is probably not the best choice for loading *huge* terrains -\n * fully triangulated data takes extremely much free store and should be avoided\n * as long as possible (typically you'll do the triangulation when you actually\n * need to render it).\n */\n#define AI_SCENE_FLAGS_TERRAIN 0x10\n\n\n// -------------------------------------------------------------------------------\n/** The root structure of the imported data.\n *\n * Everything that was imported from the given file can be accessed from here.\n * Objects of this class are generally maintained and owned by Assimp, not\n * by the caller. You shouldn't want to instance it, nor should you ever try to\n * delete a given scene on your own.\n */\n// -------------------------------------------------------------------------------\nstruct aiScene\n{\n\n /** Any combination of the AI_SCENE_FLAGS_XXX flags. By default\n * this value is 0, no flags are set. Most applications will\n * want to reject all scenes with the AI_SCENE_FLAGS_INCOMPLETE\n * bit set.\n */\n unsigned int mFlags;\n\n\n /** The root node of the hierarchy.\n *\n * There will always be at least the root node if the import\n * was successful (and no special flags have been set).\n * Presence of further nodes depends on the format and content\n * of the imported file.\n */\n C_STRUCT aiNode* mRootNode;\n\n\n\n /** The number of meshes in the scene. */\n unsigned int mNumMeshes;\n\n /** The array of meshes.\n *\n * Use the indices given in the aiNode structure to access\n * this array. The array is mNumMeshes in size. If the\n * AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always\n * be at least ONE material.\n */\n C_STRUCT aiMesh** mMeshes;\n\n\n\n /** The number of materials in the scene. */\n unsigned int mNumMaterials;\n\n /** The array of materials.\n *\n * Use the index given in each aiMesh structure to access this\n * array. The array is mNumMaterials in size. If the\n * AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always\n * be at least ONE material.\n */\n C_STRUCT aiMaterial** mMaterials;\n\n\n\n /** The number of animations in the scene. */\n unsigned int mNumAnimations;\n\n /** The array of animations.\n *\n * All animations imported from the given file are listed here.\n * The array is mNumAnimations in size.\n */\n C_STRUCT aiAnimation** mAnimations;\n\n\n\n /** The number of textures embedded into the file */\n unsigned int mNumTextures;\n\n /** The array of embedded textures.\n *\n * Not many file formats embed their textures into the file.\n * An example is Quake's MDL format (which is also used by\n * some GameStudio versions)\n */\n C_STRUCT aiTexture** mTextures;\n\n\n /** The number of light sources in the scene. Light sources\n * are fully optional, in most cases this attribute will be 0\n */\n unsigned int mNumLights;\n\n /** The array of light sources.\n *\n * All light sources imported from the given file are\n * listed here. The array is mNumLights in size.\n */\n C_STRUCT aiLight** mLights;\n\n\n /** The number of cameras in the scene. Cameras\n * are fully optional, in most cases this attribute will be 0\n */\n unsigned int mNumCameras;\n\n /** The array of cameras.\n *\n * All cameras imported from the given file are listed here.\n * The array is mNumCameras in size. The first camera in the\n * array (if existing) is the default camera view into\n * the scene.\n */\n C_STRUCT aiCamera** mCameras;\n\n#ifdef __cplusplus\n\n //! Default constructor - set everything to 0/NULL\n ASSIMP_API aiScene();\n\n //! Destructor\n ASSIMP_API ~aiScene();\n\n //! Check whether the scene contains meshes\n //! Unless no special scene flags are set this will always be true.\n inline bool HasMeshes() const\n { return mMeshes != NULL && mNumMeshes > 0; }\n\n //! Check whether the scene contains materials\n //! Unless no special scene flags are set this will always be true.\n inline bool HasMaterials() const\n { return mMaterials != NULL && mNumMaterials > 0; }\n\n //! Check whether the scene contains lights\n inline bool HasLights() const\n { return mLights != NULL && mNumLights > 0; }\n\n //! Check whether the scene contains textures\n inline bool HasTextures() const\n { return mTextures != NULL && mNumTextures > 0; }\n\n //! Check whether the scene contains cameras\n inline bool HasCameras() const\n { return mCameras != NULL && mNumCameras > 0; }\n\n //! Check whether the scene contains animations\n inline bool HasAnimations() const\n { return mAnimations != NULL && mNumAnimations > 0; }\n\n#endif // __cplusplus\n\n\n /** Internal data, do not touch */\n#ifdef __cplusplus\n void* mPrivate;\n#else\n char* mPrivate;\n#endif\n\n};\n\n#ifdef __cplusplus\n} //! namespace Assimp\n#endif\n\n#endif // __AI_SCENE_H_INC__\n"}, {"path": "includes/assimp/texture.h", "language": "code", "loc": 169, "comment_density": 0.657, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file texture.h\n * @brief Defines texture helper structures for the library\n *\n * Used for file formats which embed their textures into the model file.\n * Supported are both normal textures, which are stored as uncompressed\n * pixels, and \"compressed\" textures, which are stored in a file format\n * such as PNG or TGA.\n */\n\n#ifndef AI_TEXTURE_H_INC\n#define AI_TEXTURE_H_INC\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n// --------------------------------------------------------------------------------\n/** @def AI_MAKE_EMBEDDED_TEXNAME\n * Used to build the reserved path name used by the material system to\n * reference textures that are embedded into their corresponding\n * model files. The parameter specifies the index of the texture\n * (zero-based, in the aiScene::mTextures array)\n */\n#if (!defined AI_MAKE_EMBEDDED_TEXNAME)\n# define AI_MAKE_EMBEDDED_TEXNAME(_n_) \"*\" # _n_\n#endif\n\n\n#include \"./Compiler/pushpack1.h\"\n\n// --------------------------------------------------------------------------------\n/** @brief Helper structure to represent a texel in a ARGB8888 format\n*\n* Used by aiTexture.\n*/\nstruct aiTexel\n{\n unsigned char b,g,r,a;\n\n#ifdef __cplusplus\n //! Comparison operator\n bool operator== (const aiTexel& other) const\n {\n return b == other.b && r == other.r &&\n g == other.g && a == other.a;\n }\n\n //! Inverse comparison operator\n bool operator!= (const aiTexel& other) const\n {\n return b != other.b || r != other.r ||\n g != other.g || a != other.a;\n }\n\n //! Conversion to a floating-point 4d color\n operator aiColor4D() const\n {\n return aiColor4D(r/255.f,g/255.f,b/255.f,a/255.f);\n }\n#endif // __cplusplus\n\n} PACK_STRUCT;\n\n#include \"./Compiler/poppack1.h\"\n\n// --------------------------------------------------------------------------------\n/** Helper structure to describe an embedded texture\n *\n * Normally textures are contained in external files but some file formats embed\n * them directly in the model file. There are two types of embedded textures:\n * 1. Uncompressed textures. The color data is given in an uncompressed format.\n * 2. Compressed textures stored in a file format like png or jpg. The raw file\n * bytes are given so the application must utilize an image decoder (e.g. DevIL) to\n * get access to the actual color data.\n *\n * Embedded textures are referenced from materials using strings like \"*0\", \"*1\", etc.\n * as the texture paths (a single asterisk character followed by the\n * zero-based index of the texture in the aiScene::mTextures array).\n */\nstruct aiTexture\n{\n /** Width of the texture, in pixels\n *\n * If mHeight is zero the texture is compressed in a format\n * like JPEG. In this case mWidth specifies the size of the\n * memory area pcData is pointing to, in bytes.\n */\n unsigned int mWidth;\n\n /** Height of the texture, in pixels\n *\n * If this value is zero, pcData points to an compressed texture\n * in any format (e.g. JPEG).\n */\n unsigned int mHeight;\n\n /** A hint from the loader to make it easier for applications\n * to determine the type of embedded compressed textures.\n *\n * If mHeight != 0 this member is undefined. Otherwise it\n * is set to '\\\\0\\\\0\\\\0\\\\0' if the loader has no additional\n * information about the texture file format used OR the\n * file extension of the format without a trailing dot. If there\n * are multiple file extensions for a format, the shortest\n * extension is chosen (JPEG maps to 'jpg', not to 'jpeg').\n * E.g. 'dds\\\\0', 'pcx\\\\0', 'jpg\\\\0'. All characters are lower-case.\n * The fourth character will always be '\\\\0'.\n */\n char achFormatHint[4];\n\n /** Data of the texture.\n *\n * Points to an array of mWidth * mHeight aiTexel's.\n * The format of the texture data is always ARGB8888 to\n * make the implementation for user of the library as easy\n * as possible. If mHeight = 0 this is a pointer to a memory\n * buffer of size mWidth containing the compressed texture\n * data. Good luck, have fun!\n */\n C_STRUCT aiTexel* pcData;\n\n#ifdef __cplusplus\n\n //! For compressed textures (mHeight == 0): compare the\n //! format hint against a given string.\n //! @param s Input string. 3 characters are maximally processed.\n //! Example values: \"jpg\", \"png\"\n //! @return true if the given string matches the format hint\n bool CheckFormat(const char* s) const\n {\n return (0 == ::strncmp(achFormatHint,s,3));\n }\n\n // Construction\n aiTexture ()\n : mWidth (0)\n , mHeight (0)\n , pcData (NULL)\n {\n achFormatHint[0] = achFormatHint[1] = 0;\n achFormatHint[2] = achFormatHint[3] = 0;\n }\n\n // Destruction\n ~aiTexture ()\n {\n delete[] pcData;\n }\n#endif\n};\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // AI_TEXTURE_H_INC\n"}, {"path": "includes/assimp/types.h", "language": "code", "loc": 426, "comment_density": 0.467, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file types.h\n * Basic data types and primitives, such as vectors or colors.\n */\n#ifndef AI_TYPES_H_INC\n#define AI_TYPES_H_INC\n\n// Some runtime headers\n#include \n#include \n#include \n#include \n#include \n\n// Our compile configuration\n#include \"defs.h\"\n\n// Some types moved to separate header due to size of operators\n#include \"vector3.h\"\n#include \"vector2.h\"\n#include \"color4.h\"\n#include \"matrix3x3.h\"\n#include \"matrix4x4.h\"\n#include \"quaternion.h\"\n\n#ifdef __cplusplus\n#include \n#include // for std::nothrow_t\n#include // for aiString::Set(const std::string&)\n\nnamespace Assimp {\n //! @cond never\nnamespace Intern {\n // --------------------------------------------------------------------\n /** @brief Internal helper class to utilize our internal new/delete\n * routines for allocating object of this and derived classes.\n *\n * By doing this you can safely share class objects between Assimp\n * and the application - it works even over DLL boundaries. A good\n * example is the #IOSystem where the application allocates its custom\n * #IOSystem, then calls #Importer::SetIOSystem(). When the Importer\n * destructs, Assimp calls operator delete on the stored #IOSystem.\n * If it lies on a different heap than Assimp is working with,\n * the application is determined to crash.\n */\n // --------------------------------------------------------------------\n#ifndef SWIG\n struct ASSIMP_API AllocateFromAssimpHeap {\n // http://www.gotw.ca/publications/mill15.htm\n\n // new/delete overload\n void *operator new ( size_t num_bytes) /* throw( std::bad_alloc ) */;\n void *operator new ( size_t num_bytes, const std::nothrow_t& ) throw();\n void operator delete ( void* data);\n\n // array new/delete overload\n void *operator new[] ( size_t num_bytes) /* throw( std::bad_alloc ) */;\n void *operator new[] ( size_t num_bytes, const std::nothrow_t& ) throw();\n void operator delete[] ( void* data);\n\n }; // struct AllocateFromAssimpHeap\n#endif\n} // namespace Intern\n //! @endcond\n} // namespace Assimp\n\nextern \"C\" {\n#endif\n\n/** Maximum dimension for strings, ASSIMP strings are zero terminated. */\n#ifdef __cplusplus\nconst size_t MAXLEN = 1024;\n#else\n# define MAXLEN 1024\n#endif\n\n#include \"./Compiler/pushpack1.h\"\n\n// ----------------------------------------------------------------------------------\n/** Represents a plane in a three-dimensional, euclidean space\n*/\nstruct aiPlane\n{\n#ifdef __cplusplus\n aiPlane () : a(0.f), b(0.f), c(0.f), d(0.f) {}\n aiPlane (float _a, float _b, float _c, float _d)\n : a(_a), b(_b), c(_c), d(_d) {}\n\n aiPlane (const aiPlane& o) : a(o.a), b(o.b), c(o.c), d(o.d) {}\n\n#endif // !__cplusplus\n\n //! Plane equation\n float a,b,c,d;\n} PACK_STRUCT; // !struct aiPlane\n\n// ----------------------------------------------------------------------------------\n/** Represents a ray\n*/\nstruct aiRay\n{\n#ifdef __cplusplus\n aiRay () {}\n aiRay (const aiVector3D& _pos, const aiVector3D& _dir)\n : pos(_pos), dir(_dir) {}\n\n aiRay (const aiRay& o) : pos (o.pos), dir (o.dir) {}\n\n#endif // !__cplusplus\n\n //! Position and direction of the ray\n C_STRUCT aiVector3D pos, dir;\n} PACK_STRUCT; // !struct aiRay\n\n// ----------------------------------------------------------------------------------\n/** Represents a color in Red-Green-Blue space.\n*/\nstruct aiColor3D\n{\n#ifdef __cplusplus\n aiColor3D () : r(0.0f), g(0.0f), b(0.0f) {}\n aiColor3D (float _r, float _g, float _b) : r(_r), g(_g), b(_b) {}\n explicit aiColor3D (float _r) : r(_r), g(_r), b(_r) {}\n aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {}\n\n /** Component-wise comparison */\n // TODO: add epsilon?\n bool operator == (const aiColor3D& other) const\n {return r == other.r && g == other.g && b == other.b;}\n\n /** Component-wise inverse comparison */\n // TODO: add epsilon?\n bool operator != (const aiColor3D& other) const\n {return r != other.r || g != other.g || b != other.b;}\n\n /** Component-wise comparison */\n // TODO: add epsilon?\n bool operator < (const aiColor3D& other) const {\n return r < other.r || (\n r == other.r && (g < other.g ||\n (g == other.g && b < other.b)\n )\n );\n }\n\n /** Component-wise addition */\n aiColor3D operator+(const aiColor3D& c) const {\n return aiColor3D(r+c.r,g+c.g,b+c.b);\n }\n\n /** Component-wise subtraction */\n aiColor3D operator-(const aiColor3D& c) const {\n return aiColor3D(r-c.r,g-c.g,b-c.b);\n }\n\n /** Component-wise multiplication */\n aiColor3D operator*(const aiColor3D& c) const {\n return aiColor3D(r*c.r,g*c.g,b*c.b);\n }\n\n /** Multiply with a scalar */\n aiColor3D operator*(float f) const {\n return aiColor3D(r*f,g*f,b*f);\n }\n\n /** Access a specific color component */\n float operator[](unsigned int i) const {\n return *(&r + i);\n }\n\n /** Access a specific color component */\n float& operator[](unsigned int i) {\n return *(&r + i);\n }\n\n /** Check whether a color is black */\n bool IsBlack() const {\n static const float epsilon = 10e-3f;\n return std::fabs( r ) < epsilon && std::fabs( g ) < epsilon && std::fabs( b ) < epsilon;\n }\n\n#endif // !__cplusplus\n\n //! Red, green and blue color values\n float r, g, b;\n} PACK_STRUCT; // !struct aiColor3D\n#include \"./Compiler/poppack1.h\"\n\n// ----------------------------------------------------------------------------------\n/** Represents an UTF-8 string, zero byte terminated.\n *\n * The character set of an aiString is explicitly defined to be UTF-8. This Unicode\n * transformation was chosen in the belief that most strings in 3d files are limited\n * to ASCII, thus the character set needed to be strictly ASCII compatible.\n *\n * Most text file loaders provide proper Unicode input file handling, special unicode\n * characters are correctly transcoded to UTF8 and are kept throughout the libraries'\n * import pipeline.\n *\n * For most applications, it will be absolutely sufficient to interpret the\n * aiString as ASCII data and work with it as one would work with a plain char*.\n * Windows users in need of proper support for i.e asian characters can use the\n * MultiByteToWideChar(), WideCharToMultiByte() WinAPI functionality to convert the\n * UTF-8 strings to their working character set (i.e. MBCS, WideChar).\n *\n * We use this representation instead of std::string to be C-compatible. The\n * (binary) length of such a string is limited to MAXLEN characters (including the\n * the terminating zero).\n*/\nstruct aiString\n{\n#ifdef __cplusplus\n /** Default constructor, the string is set to have zero length */\n aiString() :\n length(0)\n {\n data[0] = '\\0';\n\n#ifdef ASSIMP_BUILD_DEBUG\n // Debug build: overwrite the string on its full length with ESC (27)\n memset(data+1,27,MAXLEN-1);\n#endif\n }\n\n /** Copy constructor */\n aiString(const aiString& rOther) :\n length(rOther.length)\n {\n // Crop the string to the maximum length\n length = length>=MAXLEN?MAXLEN-1:length;\n memcpy( data, rOther.data, length);\n data[length] = '\\0';\n }\n\n /** Constructor from std::string */\n explicit aiString(const std::string& pString) :\n length(pString.length())\n {\n length = length>=MAXLEN?MAXLEN-1:length;\n memcpy( data, pString.c_str(), length);\n data[length] = '\\0';\n }\n\n /** Copy a std::string to the aiString */\n void Set( const std::string& pString) {\n if( pString.length() > MAXLEN - 1) {\n return;\n }\n length = pString.length();\n memcpy( data, pString.c_str(), length);\n data[length] = 0;\n }\n\n /** Copy a const char* to the aiString */\n void Set( const char* sz) {\n const size_t len = ::strlen(sz);\n if( len > MAXLEN - 1) {\n return;\n }\n length = len;\n memcpy( data, sz, len);\n data[len] = 0;\n }\n\n /** Assign a const char* to the string */\n aiString& operator = (const char* sz) {\n Set(sz);\n return *this;\n }\n\n /** Assign a cstd::string to the string */\n aiString& operator = ( const std::string& pString) {\n Set(pString);\n return *this;\n }\n\n /** Comparison operator */\n bool operator==(const aiString& other) const {\n return (length == other.length && 0 == memcmp(data,other.data,length));\n }\n\n /** Inverse comparison operator */\n bool operator!=(const aiString& other) const {\n return (length != other.length || 0 != memcmp(data,other.data,length));\n }\n\n /** Append a string to the string */\n void Append (const char* app) {\n const size_t len = ::strlen(app);\n if (!len) {\n return;\n }\n if (length + len >= MAXLEN) {\n return;\n }\n\n memcpy(&data[length],app,len+1);\n length += len;\n }\n\n /** Clear the string - reset its length to zero */\n void Clear () {\n length = 0;\n data[0] = '\\0';\n\n#ifdef ASSIMP_BUILD_DEBUG\n // Debug build: overwrite the string on its full length with ESC (27)\n memset(data+1,27,MAXLEN-1);\n#endif\n }\n\n /** Returns a pointer to the underlying zero-terminated array of characters */\n const char* C_Str() const {\n return data;\n }\n\n#endif // !__cplusplus\n\n /** Binary length of the string excluding the terminal 0. This is NOT the\n * logical length of strings containing UTF-8 multibyte sequences! It's\n * the number of bytes from the beginning of the string to its end.*/\n size_t length;\n\n /** String buffer. Size limit is MAXLEN */\n char data[MAXLEN];\n} ; // !struct aiString\n\n\n// ----------------------------------------------------------------------------------\n/** Standard return type for some library functions.\n * Rarely used, and if, mostly in the C API.\n */\ntypedef enum aiReturn\n{\n /** Indicates that a function was successful */\n aiReturn_SUCCESS = 0x0,\n\n /** Indicates that a function failed */\n aiReturn_FAILURE = -0x1,\n\n /** Indicates that not enough memory was available\n * to perform the requested operation\n */\n aiReturn_OUTOFMEMORY = -0x3,\n\n /** @cond never\n * Force 32-bit size enum\n */\n _AI_ENFORCE_ENUM_SIZE = 0x7fffffff\n\n /// @endcond\n} aiReturn; // !enum aiReturn\n\n// just for backwards compatibility, don't use these constants anymore\n#define AI_SUCCESS aiReturn_SUCCESS\n#define AI_FAILURE aiReturn_FAILURE\n#define AI_OUTOFMEMORY aiReturn_OUTOFMEMORY\n\n// ----------------------------------------------------------------------------------\n/** Seek origins (for the virtual file system API).\n * Much cooler than using SEEK_SET, SEEK_CUR or SEEK_END.\n */\nenum aiOrigin\n{\n /** Beginning of the file */\n aiOrigin_SET = 0x0,\n\n /** Current position of the file pointer */\n aiOrigin_CUR = 0x1,\n\n /** End of the file, offsets must be negative */\n aiOrigin_END = 0x2,\n\n /** @cond never\n * Force 32-bit size enum\n */\n _AI_ORIGIN_ENFORCE_ENUM_SIZE = 0x7fffffff\n\n /// @endcond\n}; // !enum aiOrigin\n\n// ----------------------------------------------------------------------------------\n/** @brief Enumerates predefined log streaming destinations.\n * Logging to these streams can be enabled with a single call to\n * #LogStream::createDefaultStream.\n */\nenum aiDefaultLogStream\n{\n /** Stream the log to a file */\n aiDefaultLogStream_FILE = 0x1,\n\n /** Stream the log to std::cout */\n aiDefaultLogStream_STDOUT = 0x2,\n\n /** Stream the log to std::cerr */\n aiDefaultLogStream_STDERR = 0x4,\n\n /** MSVC only: Stream the log the debugger\n * (this relies on OutputDebugString from the Win32 SDK)\n */\n aiDefaultLogStream_DEBUGGER = 0x8,\n\n /** @cond never\n * Force 32-bit size enum\n */\n _AI_DLS_ENFORCE_ENUM_SIZE = 0x7fffffff\n /// @endcond\n}; // !enum aiDefaultLogStream\n\n// just for backwards compatibility, don't use these constants anymore\n#define DLS_FILE aiDefaultLogStream_FILE\n#define DLS_STDOUT aiDefaultLogStream_STDOUT\n#define DLS_STDERR aiDefaultLogStream_STDERR\n#define DLS_DEBUGGER aiDefaultLogStream_DEBUGGER\n\n// ----------------------------------------------------------------------------------\n/** Stores the memory requirements for different components (e.g. meshes, materials,\n * animations) of an import. All sizes are in bytes.\n * @see Importer::GetMemoryRequirements()\n*/\nstruct aiMemoryInfo\n{\n#ifdef __cplusplus\n\n /** Default constructor */\n aiMemoryInfo()\n : textures (0)\n , materials (0)\n , meshes (0)\n , nodes (0)\n , animations (0)\n , cameras (0)\n , lights (0)\n , total (0)\n {}\n\n#endif\n\n /** Storage allocated for texture data */\n unsigned int textures;\n\n /** Storage allocated for material data */\n unsigned int materials;\n\n /** Storage allocated for mesh data */\n unsigned int meshes;\n\n /** Storage allocated for node data */\n unsigned int nodes;\n\n /** Storage allocated for animation data */\n unsigned int animations;\n\n /** Storage allocated for camera data */\n unsigned int cameras;\n\n /** Storage allocated for light data */\n unsigned int lights;\n\n /** Total storage allocated for the full import. */\n unsigned int total;\n}; // !struct aiMemoryInfo\n\n#ifdef __cplusplus\n}\n#endif //! __cplusplus\n\n// Include implementation files\n#include \"vector2.inl\"\n#include \"vector3.inl\"\n#include \"color4.inl\"\n#include \"quaternion.inl\"\n#include \"matrix3x3.inl\"\n#include \"matrix4x4.inl\"\n#endif\n"}, {"path": "includes/assimp/vector2.h", "language": "code", "loc": 85, "comment_density": 0.482, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file vector2.h\n * @brief 2D vector structure, including operators when compiling in C++\n */\n#ifndef AI_VECTOR2D_H_INC\n#define AI_VECTOR2D_H_INC\n\n#ifdef __cplusplus\n# include \n#else\n# include \n#endif\n\n#include \"./Compiler/pushpack1.h\"\n\n// ----------------------------------------------------------------------------------\n/** Represents a two-dimensional vector.\n */\n\n#ifdef __cplusplus\ntemplate \nclass aiVector2t\n{\npublic:\n\n aiVector2t () : x(), y() {}\n aiVector2t (TReal _x, TReal _y) : x(_x), y(_y) {}\n explicit aiVector2t (TReal _xyz) : x(_xyz), y(_xyz) {}\n aiVector2t (const aiVector2t& o) : x(o.x), y(o.y) {}\n\npublic:\n\n void Set( TReal pX, TReal pY);\n TReal SquareLength() const ;\n TReal Length() const ;\n aiVector2t& Normalize();\n\npublic:\n\n const aiVector2t& operator += (const aiVector2t& o);\n const aiVector2t& operator -= (const aiVector2t& o);\n const aiVector2t& operator *= (TReal f);\n const aiVector2t& operator /= (TReal f);\n\n TReal operator[](unsigned int i) const;\n TReal& operator[](unsigned int i);\n\n bool operator== (const aiVector2t& other) const;\n bool operator!= (const aiVector2t& other) const;\n\n bool Equal(const aiVector2t& other, TReal epsilon = 1e-6) const;\n\n aiVector2t& operator= (TReal f);\n const aiVector2t SymMul(const aiVector2t& o);\n\n template \n operator aiVector2t () const;\n\n TReal x, y;\n} PACK_STRUCT;\n\ntypedef aiVector2t aiVector2D;\n\n#else\n\nstruct aiVector2D {\n float x, y;\n};\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#endif // AI_VECTOR2D_H_INC\n"}, {"path": "includes/assimp/vector3.h", "language": "code", "loc": 109, "comment_density": 0.541, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file vector3.h\n * @brief 3D vector structure, including operators when compiling in C++\n */\n#ifndef AI_VECTOR3D_H_INC\n#define AI_VECTOR3D_H_INC\n\n#ifdef __cplusplus\n# include \n#else\n# include \n#endif\n\n#include \"./Compiler/pushpack1.h\"\n\n#ifdef __cplusplus\n\ntemplate class aiMatrix3x3t;\ntemplate class aiMatrix4x4t;\n\n// ---------------------------------------------------------------------------\n/** Represents a three-dimensional vector. */\ntemplate \nclass aiVector3t\n{\npublic:\n\n aiVector3t () : x(), y(), z() {}\n aiVector3t (TReal _x, TReal _y, TReal _z) : x(_x), y(_y), z(_z) {}\n explicit aiVector3t (TReal _xyz) : x(_xyz), y(_xyz), z(_xyz) {}\n aiVector3t (const aiVector3t& o) : x(o.x), y(o.y), z(o.z) {}\n\npublic:\n\n // combined operators\n const aiVector3t& operator += (const aiVector3t& o);\n const aiVector3t& operator -= (const aiVector3t& o);\n const aiVector3t& operator *= (TReal f);\n const aiVector3t& operator /= (TReal f);\n\n // transform vector by matrix\n aiVector3t& operator *= (const aiMatrix3x3t& mat);\n aiVector3t& operator *= (const aiMatrix4x4t& mat);\n\n // access a single element\n TReal operator[](unsigned int i) const;\n TReal& operator[](unsigned int i);\n\n // comparison\n bool operator== (const aiVector3t& other) const;\n bool operator!= (const aiVector3t& other) const;\n bool operator < (const aiVector3t& other) const;\n\n bool Equal(const aiVector3t& other, TReal epsilon = 1e-6) const;\n\n template \n operator aiVector3t () const;\n\npublic:\n\n /** @brief Set the components of a vector\n * @param pX X component\n * @param pY Y component\n * @param pZ Z component */\n void Set( TReal pX, TReal pY, TReal pZ);\n\n /** @brief Get the squared length of the vector\n * @return Square length */\n TReal SquareLength() const;\n\n\n /** @brief Get the length of the vector\n * @return length */\n TReal Length() const;\n\n\n /** @brief Normalize the vector */\n aiVector3t& Normalize();\n\n /** @brief Normalize the vector with extra check for zero vectors */\n aiVector3t& NormalizeSafe();\n\n /** @brief Componentwise multiplication of two vectors\n *\n * Note that vec*vec yields the dot product.\n * @param o Second factor */\n const aiVector3t SymMul(const aiVector3t& o);\n\n TReal x, y, z;\n} PACK_STRUCT;\n\n\ntypedef aiVector3t aiVector3D;\n\n#else\n\nstruct aiVector3D {\n float x, y, z;\n} PACK_STRUCT;\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#ifdef __cplusplus\n\n\n\n#endif // __cplusplus\n\n#endif // AI_VECTOR3D_H_INC\n"}, {"path": "includes/assimp/version.h", "language": "code", "loc": 86, "comment_density": 0.791, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file version.h\n * @brief Functions to query the version of the Assimp runtime, check\n * compile flags, ...\n */\n#ifndef INCLUDED_AI_VERSION_H\n#define INCLUDED_AI_VERSION_H\n\n#include \"defs.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Returns a string with legal copyright and licensing information\n * about Assimp. The string may include multiple lines.\n * @return Pointer to static string.\n */\nASSIMP_API const char* aiGetLegalString (void);\n\n// ---------------------------------------------------------------------------\n/** @brief Returns the current minor version number of Assimp.\n * @return Minor version of the Assimp runtime the application was\n * linked/built against\n */\nASSIMP_API unsigned int aiGetVersionMinor (void);\n\n// ---------------------------------------------------------------------------\n/** @brief Returns the current major version number of Assimp.\n * @return Major version of the Assimp runtime the application was\n * linked/built against\n */\nASSIMP_API unsigned int aiGetVersionMajor (void);\n\n// ---------------------------------------------------------------------------\n/** @brief Returns the repository revision of the Assimp runtime.\n * @return SVN Repository revision number of the Assimp runtime the\n * application was linked/built against.\n */\nASSIMP_API unsigned int aiGetVersionRevision (void);\n\n//! Assimp was compiled as a shared object (Windows: DLL)\n#define ASSIMP_CFLAGS_SHARED 0x1\n//! Assimp was compiled against STLport\n#define ASSIMP_CFLAGS_STLPORT 0x2\n//! Assimp was compiled as a debug build\n#define ASSIMP_CFLAGS_DEBUG 0x4\n\n//! Assimp was compiled with ASSIMP_BUILD_BOOST_WORKAROUND defined\n#define ASSIMP_CFLAGS_NOBOOST 0x8\n//! Assimp was compiled with ASSIMP_BUILD_SINGLETHREADED defined\n#define ASSIMP_CFLAGS_SINGLETHREADED 0x10\n\n// ---------------------------------------------------------------------------\n/** @brief Returns assimp's compile flags\n * @return Any bitwise combination of the ASSIMP_CFLAGS_xxx constants.\n */\nASSIMP_API unsigned int aiGetCompileFlags (void);\n\n#ifdef __cplusplus\n} // end extern \"C\"\n#endif\n\n#endif // !! #ifndef INCLUDED_AI_VERSION_H\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.669, "dedup_hash": "09606277dbd5eeb2", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_assimp_compiler", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Compiler", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/assimp/Compiler/poppack1.h", "language": "code", "loc": 18, "comment_density": 0.556, "code": "\n// ===============================================================================\n// May be included multiple times - resets structure packing to the defaults \n// for all supported compilers. Reverts the changes made by #include \n//\n// Currently this works on the following compilers:\n// MSVC 7,8,9\n// GCC\n// BORLAND (complains about 'pack state changed but not reverted', but works)\n// ===============================================================================\n\n#ifndef AI_PUSHPACK_IS_DEFINED\n#\terror pushpack1.h must be included after poppack1.h\n#endif\n\n// reset packing to the original value\n#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)\n#\tpragma pack( pop )\n#endif\n#undef PACK_STRUCT\n\n#undef AI_PUSHPACK_IS_DEFINED\n"}, {"path": "includes/assimp/Compiler/pstdint.h", "language": "code", "loc": 856, "comment_density": 0.303, "code": "/* A portable stdint.h\n ****************************************************************************\n * BSD License:\n ****************************************************************************\n *\n * Copyright (c) 2005-2016 Paul Hsieh\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n ****************************************************************************\n *\n * Version 0.1.15.4\n *\n * The ANSI C standard committee, for the C99 standard, specified the\n * inclusion of a new standard include file called stdint.h. This is\n * a very useful and long desired include file which contains several\n * very precise definitions for integer scalar types that is\n * critically important for making portable several classes of\n * applications including cryptography, hashing, variable length\n * integer libraries and so on. But for most developers its likely\n * useful just for programming sanity.\n *\n * The problem is that some compiler vendors chose to ignore the C99\n * standard and some older compilers have no opportunity to be updated.\n * Because of this situation, simply including stdint.h in your code\n * makes it unportable.\n *\n * So that's what this file is all about. Its an attempt to build a\n * single universal include file that works on as many platforms as\n * possible to deliver what stdint.h is supposed to. Even compilers\n * that already come with stdint.h can use this file instead without\n * any loss of functionality. A few things that should be noted about\n * this file:\n *\n * 1) It is not guaranteed to be portable and/or present an identical\n * interface on all platforms. The extreme variability of the\n * ANSI C standard makes this an impossibility right from the\n * very get go. Its really only meant to be useful for the vast\n * majority of platforms that possess the capability of\n * implementing usefully and precisely defined, standard sized\n * integer scalars. Systems which are not intrinsically 2s\n * complement may produce invalid constants.\n *\n * 2) There is an unavoidable use of non-reserved symbols.\n *\n * 3) Other standard include files are invoked.\n *\n * 4) This file may come in conflict with future platforms that do\n * include stdint.h. The hope is that one or the other can be\n * used with no real difference.\n *\n * 5) In the current version, if your platform can't represent\n * int32_t, int16_t and int8_t, it just dumps out with a compiler\n * error.\n *\n * 6) 64 bit integers may or may not be defined. Test for their\n * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.\n * Note that this is different from the C99 specification which\n * requires the existence of 64 bit support in the compiler. If\n * this is not defined for your platform, yet it is capable of\n * dealing with 64 bits then it is because this file has not yet\n * been extended to cover all of your system's capabilities.\n *\n * 7) (u)intptr_t may or may not be defined. Test for its presence\n * with the test: #ifdef PTRDIFF_MAX. If this is not defined\n * for your platform, then it is because this file has not yet\n * been extended to cover all of your system's capabilities, not\n * because its optional.\n *\n * 8) The following might not been defined even if your platform is\n * capable of defining it:\n *\n * WCHAR_MIN\n * WCHAR_MAX\n * (u)int64_t\n * PTRDIFF_MIN\n * PTRDIFF_MAX\n * (u)intptr_t\n *\n * 9) The following have not been defined:\n *\n * WINT_MIN\n * WINT_MAX\n *\n * 10) The criteria for defining (u)int_least(*)_t isn't clear,\n * except for systems which don't have a type that precisely\n * defined 8, 16, or 32 bit types (which this include file does\n * not support anyways). Default definitions have been given.\n *\n * 11) The criteria for defining (u)int_fast(*)_t isn't something I\n * would trust to any particular compiler vendor or the ANSI C\n * committee. It is well known that \"compatible systems\" are\n * commonly created that have very different performance\n * characteristics from the systems they are compatible with,\n * especially those whose vendors make both the compiler and the\n * system. Default definitions have been given, but its strongly\n * recommended that users never use these definitions for any\n * reason (they do *NOT* deliver any serious guarantee of\n * improved performance -- not in this file, nor any vendor's\n * stdint.h).\n *\n * 12) The following macros:\n *\n * PRINTF_INTMAX_MODIFIER\n * PRINTF_INT64_MODIFIER\n * PRINTF_INT32_MODIFIER\n * PRINTF_INT16_MODIFIER\n * PRINTF_LEAST64_MODIFIER\n * PRINTF_LEAST32_MODIFIER\n * PRINTF_LEAST16_MODIFIER\n * PRINTF_INTPTR_MODIFIER\n *\n * are strings which have been defined as the modifiers required\n * for the \"d\", \"u\" and \"x\" printf formats to correctly output\n * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,\n * (u)least32_t, (u)least16_t and (u)intptr_t types respectively.\n * PRINTF_INTPTR_MODIFIER is not defined for some systems which\n * provide their own stdint.h. PRINTF_INT64_MODIFIER is not\n * defined if INT64_MAX is not defined. These are an extension\n * beyond what C99 specifies must be in stdint.h.\n *\n * In addition, the following macros are defined:\n *\n * PRINTF_INTMAX_HEX_WIDTH\n * PRINTF_INT64_HEX_WIDTH\n * PRINTF_INT32_HEX_WIDTH\n * PRINTF_INT16_HEX_WIDTH\n * PRINTF_INT8_HEX_WIDTH\n * PRINTF_INTMAX_DEC_WIDTH\n * PRINTF_INT64_DEC_WIDTH\n * PRINTF_INT32_DEC_WIDTH\n * PRINTF_INT16_DEC_WIDTH\n * PRINTF_UINT8_DEC_WIDTH\n * PRINTF_UINTMAX_DEC_WIDTH\n * PRINTF_UINT64_DEC_WIDTH\n * PRINTF_UINT32_DEC_WIDTH\n * PRINTF_UINT16_DEC_WIDTH\n * PRINTF_UINT8_DEC_WIDTH\n *\n * Which specifies the maximum number of characters required to\n * print the number of that type in either hexadecimal or decimal.\n * These are an extension beyond what C99 specifies must be in\n * stdint.h.\n *\n * Compilers tested (all with 0 warnings at their highest respective\n * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32\n * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio\n * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3\n *\n * This file should be considered a work in progress. Suggestions for\n * improvements, especially those which increase coverage are strongly\n * encouraged.\n *\n * Acknowledgements\n *\n * The following people have made significant contributions to the\n * development and testing of this file:\n *\n * Chris Howie\n * John Steele Scott\n * Dave Thorup\n * John Dill\n * Florian Wobbe\n * Christopher Sean Morrison\n * Mikkel Fahnoe Jorgensen\n *\n */\n\n#include \n#include \n#include \n\n/*\n * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and\n * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.\n */\n\n#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)\n#include \n#define _PSTDINT_H_INCLUDED\n# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__))\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"l\"\n# endif\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n# else\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"ll\"\n# endif\n# ifndef PRINTF_INT32_MODIFIER\n# if (UINT_MAX == UINT32_MAX)\n# define PRINTF_INT32_MODIFIER \"\"\n# else\n# define PRINTF_INT32_MODIFIER \"l\"\n# endif\n# endif\n# endif\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"h\"\n# endif\n# ifndef PRINTF_INTMAX_MODIFIER\n# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER\n# endif\n# ifndef PRINTF_INT64_HEX_WIDTH\n# define PRINTF_INT64_HEX_WIDTH \"16\"\n# endif\n# ifndef PRINTF_UINT64_HEX_WIDTH\n# define PRINTF_UINT64_HEX_WIDTH \"16\"\n# endif\n# ifndef PRINTF_INT32_HEX_WIDTH\n# define PRINTF_INT32_HEX_WIDTH \"8\"\n# endif\n# ifndef PRINTF_UINT32_HEX_WIDTH\n# define PRINTF_UINT32_HEX_WIDTH \"8\"\n# endif\n# ifndef PRINTF_INT16_HEX_WIDTH\n# define PRINTF_INT16_HEX_WIDTH \"4\"\n# endif\n# ifndef PRINTF_UINT16_HEX_WIDTH\n# define PRINTF_UINT16_HEX_WIDTH \"4\"\n# endif\n# ifndef PRINTF_INT8_HEX_WIDTH\n# define PRINTF_INT8_HEX_WIDTH \"2\"\n# endif\n# ifndef PRINTF_UINT8_HEX_WIDTH\n# define PRINTF_UINT8_HEX_WIDTH \"2\"\n# endif\n# ifndef PRINTF_INT64_DEC_WIDTH\n# define PRINTF_INT64_DEC_WIDTH \"19\"\n# endif\n# ifndef PRINTF_UINT64_DEC_WIDTH\n# define PRINTF_UINT64_DEC_WIDTH \"20\"\n# endif\n# ifndef PRINTF_INT32_DEC_WIDTH\n# define PRINTF_INT32_DEC_WIDTH \"10\"\n# endif\n# ifndef PRINTF_UINT32_DEC_WIDTH\n# define PRINTF_UINT32_DEC_WIDTH \"10\"\n# endif\n# ifndef PRINTF_INT16_DEC_WIDTH\n# define PRINTF_INT16_DEC_WIDTH \"5\"\n# endif\n# ifndef PRINTF_UINT16_DEC_WIDTH\n# define PRINTF_UINT16_DEC_WIDTH \"5\"\n# endif\n# ifndef PRINTF_INT8_DEC_WIDTH\n# define PRINTF_INT8_DEC_WIDTH \"3\"\n# endif\n# ifndef PRINTF_UINT8_DEC_WIDTH\n# define PRINTF_UINT8_DEC_WIDTH \"3\"\n# endif\n# ifndef PRINTF_INTMAX_HEX_WIDTH\n# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH\n# endif\n# ifndef PRINTF_UINTMAX_HEX_WIDTH\n# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH\n# endif\n# ifndef PRINTF_INTMAX_DEC_WIDTH\n# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH\n# endif\n# ifndef PRINTF_UINTMAX_DEC_WIDTH\n# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH\n# endif\n\n/*\n * Something really weird is going on with Open Watcom. Just pull some of\n * these duplicated definitions from Open Watcom's stdint.h file for now.\n */\n\n# if defined (__WATCOMC__) && __WATCOMC__ >= 1250\n# if !defined (INT64_C)\n# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))\n# endif\n# if !defined (UINT64_C)\n# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))\n# endif\n# if !defined (INT32_C)\n# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))\n# endif\n# if !defined (UINT32_C)\n# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))\n# endif\n# if !defined (INT16_C)\n# define INT16_C(x) (x)\n# endif\n# if !defined (UINT16_C)\n# define UINT16_C(x) (x)\n# endif\n# if !defined (INT8_C)\n# define INT8_C(x) (x)\n# endif\n# if !defined (UINT8_C)\n# define UINT8_C(x) (x)\n# endif\n# if !defined (UINT64_MAX)\n# define UINT64_MAX 18446744073709551615ULL\n# endif\n# if !defined (INT64_MAX)\n# define INT64_MAX 9223372036854775807LL\n# endif\n# if !defined (UINT32_MAX)\n# define UINT32_MAX 4294967295UL\n# endif\n# if !defined (INT32_MAX)\n# define INT32_MAX 2147483647L\n# endif\n# if !defined (INTMAX_MAX)\n# define INTMAX_MAX INT64_MAX\n# endif\n# if !defined (INTMAX_MIN)\n# define INTMAX_MIN INT64_MIN\n# endif\n# endif\n#endif\n\n/*\n * I have no idea what is the truly correct thing to do on older Solaris.\n * From some online discussions, this seems to be what is being\n * recommended. For people who actually are developing on older Solaris,\n * what I would like to know is, does this define all of the relevant\n * macros of a complete stdint.h? Remember, in pstdint.h 64 bit is\n * considered optional.\n */\n\n#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED)\n#include \n#define _PSTDINT_H_INCLUDED\n#endif\n\n#ifndef _PSTDINT_H_INCLUDED\n#define _PSTDINT_H_INCLUDED\n\n#ifndef SIZE_MAX\n# define SIZE_MAX (~(size_t)0)\n#endif\n\n/*\n * Deduce the type assignments from limits.h under the assumption that\n * integer sizes in bits are powers of 2, and follow the ANSI\n * definitions.\n */\n\n#ifndef UINT8_MAX\n# define UINT8_MAX 0xff\n#endif\n#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks)\n# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)\n typedef unsigned char uint8_t;\n# define UINT8_C(v) ((uint8_t) v)\n# else\n# error \"Platform not supported\"\n# endif\n#endif\n\n#ifndef INT8_MAX\n# define INT8_MAX 0x7f\n#endif\n#ifndef INT8_MIN\n# define INT8_MIN INT8_C(0x80)\n#endif\n#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks)\n# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)\n typedef signed char int8_t;\n# define INT8_C(v) ((int8_t) v)\n# else\n# error \"Platform not supported\"\n# endif\n#endif\n\n#ifndef UINT16_MAX\n# define UINT16_MAX 0xffff\n#endif\n#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks)\n#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)\n typedef unsigned int uint16_t;\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"\"\n# endif\n# define UINT16_C(v) ((uint16_t) (v))\n#elif (USHRT_MAX == UINT16_MAX)\n typedef unsigned short uint16_t;\n# define UINT16_C(v) ((uint16_t) (v))\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"h\"\n# endif\n#else\n#error \"Platform not supported\"\n#endif\n#endif\n\n#ifndef INT16_MAX\n# define INT16_MAX 0x7fff\n#endif\n#ifndef INT16_MIN\n# define INT16_MIN INT16_C(0x8000)\n#endif\n#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks)\n#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)\n typedef signed int int16_t;\n# define INT16_C(v) ((int16_t) (v))\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"\"\n# endif\n#elif (SHRT_MAX == INT16_MAX)\n typedef signed short int16_t;\n# define INT16_C(v) ((int16_t) (v))\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"h\"\n# endif\n#else\n#error \"Platform not supported\"\n#endif\n#endif\n\n#ifndef UINT32_MAX\n# define UINT32_MAX (0xffffffffUL)\n#endif\n#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks)\n#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)\n typedef unsigned long uint32_t;\n# define UINT32_C(v) v ## UL\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"l\"\n# endif\n#elif (UINT_MAX == UINT32_MAX)\n typedef unsigned int uint32_t;\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n# define UINT32_C(v) v ## U\n#elif (USHRT_MAX == UINT32_MAX)\n typedef unsigned short uint32_t;\n# define UINT32_C(v) ((unsigned short) (v))\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n#else\n#error \"Platform not supported\"\n#endif\n#endif\n\n#ifndef INT32_MAX\n# define INT32_MAX (0x7fffffffL)\n#endif\n#ifndef INT32_MIN\n# define INT32_MIN INT32_C(0x80000000)\n#endif\n#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks)\n#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)\n typedef signed long int32_t;\n# define INT32_C(v) v ## L\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"l\"\n# endif\n#elif (INT_MAX == INT32_MAX)\n typedef signed int int32_t;\n# define INT32_C(v) v\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n#elif (SHRT_MAX == INT32_MAX)\n typedef signed short int32_t;\n# define INT32_C(v) ((short) (v))\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n#else\n#error \"Platform not supported\"\n#endif\n#endif\n\n/*\n * The macro stdint_int64_defined is temporarily used to record\n * whether or not 64 integer support is available. It must be\n * defined for any 64 integer extensions for new platforms that are\n * added.\n */\n\n#undef stdint_int64_defined\n#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)\n# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)\n# define stdint_int64_defined\n typedef long long int64_t;\n typedef unsigned long long uint64_t;\n# define UINT64_C(v) v ## ULL\n# define INT64_C(v) v ## LL\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"ll\"\n# endif\n# endif\n#endif\n\n#if !defined (stdint_int64_defined)\n# if defined(__GNUC__) && !defined(vxWorks)\n# define stdint_int64_defined\n __extension__ typedef long long int64_t;\n __extension__ typedef unsigned long long uint64_t;\n# define UINT64_C(v) v ## ULL\n# define INT64_C(v) v ## LL\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"ll\"\n# endif\n# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)\n# define stdint_int64_defined\n typedef long long int64_t;\n typedef unsigned long long uint64_t;\n# define UINT64_C(v) v ## ULL\n# define INT64_C(v) v ## LL\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"ll\"\n# endif\n# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)\n# define stdint_int64_defined\n typedef __int64 int64_t;\n typedef unsigned __int64 uint64_t;\n# define UINT64_C(v) v ## UI64\n# define INT64_C(v) v ## I64\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"I64\"\n# endif\n# endif\n#endif\n\n#if !defined (LONG_LONG_MAX) && defined (INT64_C)\n# define LONG_LONG_MAX INT64_C (9223372036854775807)\n#endif\n#ifndef ULONG_LONG_MAX\n# define ULONG_LONG_MAX UINT64_C (18446744073709551615)\n#endif\n\n#if !defined (INT64_MAX) && defined (INT64_C)\n# define INT64_MAX INT64_C (9223372036854775807)\n#endif\n#if !defined (INT64_MIN) && defined (INT64_C)\n# define INT64_MIN INT64_C (-9223372036854775808)\n#endif\n#if !defined (UINT64_MAX) && defined (INT64_C)\n# define UINT64_MAX UINT64_C (18446744073709551615)\n#endif\n\n/*\n * Width of hexadecimal for number field.\n */\n\n#ifndef PRINTF_INT64_HEX_WIDTH\n# define PRINTF_INT64_HEX_WIDTH \"16\"\n#endif\n#ifndef PRINTF_INT32_HEX_WIDTH\n# define PRINTF_INT32_HEX_WIDTH \"8\"\n#endif\n#ifndef PRINTF_INT16_HEX_WIDTH\n# define PRINTF_INT16_HEX_WIDTH \"4\"\n#endif\n#ifndef PRINTF_INT8_HEX_WIDTH\n# define PRINTF_INT8_HEX_WIDTH \"2\"\n#endif\n#ifndef PRINTF_INT64_DEC_WIDTH\n# define PRINTF_INT64_DEC_WIDTH \"19\"\n#endif\n#ifndef PRINTF_INT32_DEC_WIDTH\n# define PRINTF_INT32_DEC_WIDTH \"10\"\n#endif\n#ifndef PRINTF_INT16_DEC_WIDTH\n# define PRINTF_INT16_DEC_WIDTH \"5\"\n#endif\n#ifndef PRINTF_INT8_DEC_WIDTH\n# define PRINTF_INT8_DEC_WIDTH \"3\"\n#endif\n#ifndef PRINTF_UINT64_DEC_WIDTH\n# define PRINTF_UINT64_DEC_WIDTH \"20\"\n#endif\n#ifndef PRINTF_UINT32_DEC_WIDTH\n# define PRINTF_UINT32_DEC_WIDTH \"10\"\n#endif\n#ifndef PRINTF_UINT16_DEC_WIDTH\n# define PRINTF_UINT16_DEC_WIDTH \"5\"\n#endif\n#ifndef PRINTF_UINT8_DEC_WIDTH\n# define PRINTF_UINT8_DEC_WIDTH \"3\"\n#endif\n\n/*\n * Ok, lets not worry about 128 bit integers for now. Moore's law says\n * we don't need to worry about that until about 2040 at which point\n * we'll have bigger things to worry about.\n */\n\n#ifdef stdint_int64_defined\n typedef int64_t intmax_t;\n typedef uint64_t uintmax_t;\n# define INTMAX_MAX INT64_MAX\n# define INTMAX_MIN INT64_MIN\n# define UINTMAX_MAX UINT64_MAX\n# define UINTMAX_C(v) UINT64_C(v)\n# define INTMAX_C(v) INT64_C(v)\n# ifndef PRINTF_INTMAX_MODIFIER\n# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER\n# endif\n# ifndef PRINTF_INTMAX_HEX_WIDTH\n# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH\n# endif\n# ifndef PRINTF_INTMAX_DEC_WIDTH\n# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH\n# endif\n#else\n typedef int32_t intmax_t;\n typedef uint32_t uintmax_t;\n# define INTMAX_MAX INT32_MAX\n# define UINTMAX_MAX UINT32_MAX\n# define UINTMAX_C(v) UINT32_C(v)\n# define INTMAX_C(v) INT32_C(v)\n# ifndef PRINTF_INTMAX_MODIFIER\n# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER\n# endif\n# ifndef PRINTF_INTMAX_HEX_WIDTH\n# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH\n# endif\n# ifndef PRINTF_INTMAX_DEC_WIDTH\n# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH\n# endif\n#endif\n\n/*\n * Because this file currently only supports platforms which have\n * precise powers of 2 as bit sizes for the default integers, the\n * least definitions are all trivial. Its possible that a future\n * version of this file could have different definitions.\n */\n\n#ifndef stdint_least_defined\n typedef int8_t int_least8_t;\n typedef uint8_t uint_least8_t;\n typedef int16_t int_least16_t;\n typedef uint16_t uint_least16_t;\n typedef int32_t int_least32_t;\n typedef uint32_t uint_least32_t;\n# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER\n# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER\n# define UINT_LEAST8_MAX UINT8_MAX\n# define INT_LEAST8_MAX INT8_MAX\n# define UINT_LEAST16_MAX UINT16_MAX\n# define INT_LEAST16_MAX INT16_MAX\n# define UINT_LEAST32_MAX UINT32_MAX\n# define INT_LEAST32_MAX INT32_MAX\n# define INT_LEAST8_MIN INT8_MIN\n# define INT_LEAST16_MIN INT16_MIN\n# define INT_LEAST32_MIN INT32_MIN\n# ifdef stdint_int64_defined\n typedef int64_t int_least64_t;\n typedef uint64_t uint_least64_t;\n# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER\n# define UINT_LEAST64_MAX UINT64_MAX\n# define INT_LEAST64_MAX INT64_MAX\n# define INT_LEAST64_MIN INT64_MIN\n# endif\n#endif\n#undef stdint_least_defined\n\n/*\n * The ANSI C committee pretending to know or specify anything about\n * performance is the epitome of misguided arrogance. The mandate of\n * this file is to *ONLY* ever support that absolute minimum\n * definition of the fast integer types, for compatibility purposes.\n * No extensions, and no attempt to suggest what may or may not be a\n * faster integer type will ever be made in this file. Developers are\n * warned to stay away from these types when using this or any other\n * stdint.h.\n */\n\ntypedef int_least8_t int_fast8_t;\ntypedef uint_least8_t uint_fast8_t;\ntypedef int_least16_t int_fast16_t;\ntypedef uint_least16_t uint_fast16_t;\ntypedef int_least32_t int_fast32_t;\ntypedef uint_least32_t uint_fast32_t;\n#define UINT_FAST8_MAX UINT_LEAST8_MAX\n#define INT_FAST8_MAX INT_LEAST8_MAX\n#define UINT_FAST16_MAX UINT_LEAST16_MAX\n#define INT_FAST16_MAX INT_LEAST16_MAX\n#define UINT_FAST32_MAX UINT_LEAST32_MAX\n#define INT_FAST32_MAX INT_LEAST32_MAX\n#define INT_FAST8_MIN INT_LEAST8_MIN\n#define INT_FAST16_MIN INT_LEAST16_MIN\n#define INT_FAST32_MIN INT_LEAST32_MIN\n#ifdef stdint_int64_defined\n typedef int_least64_t int_fast64_t;\n typedef uint_least64_t uint_fast64_t;\n# define UINT_FAST64_MAX UINT_LEAST64_MAX\n# define INT_FAST64_MAX INT_LEAST64_MAX\n# define INT_FAST64_MIN INT_LEAST64_MIN\n#endif\n\n#undef stdint_int64_defined\n\n/*\n * Whatever piecemeal, per compiler thing we can do about the wchar_t\n * type limits.\n */\n\n#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks)\n# include \n# ifndef WCHAR_MIN\n# define WCHAR_MIN 0\n# endif\n# ifndef WCHAR_MAX\n# define WCHAR_MAX ((wchar_t)-1)\n# endif\n#endif\n\n/*\n * Whatever piecemeal, per compiler/platform thing we can do about the\n * (u)intptr_t types and limits.\n */\n\n#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T)\n# define STDINT_H_UINTPTR_T_DEFINED\n#endif\n\n#ifndef STDINT_H_UINTPTR_T_DEFINED\n# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__)\n# define stdint_intptr_bits 64\n# elif defined (__WATCOMC__) || defined (__TURBOC__)\n# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)\n# define stdint_intptr_bits 16\n# else\n# define stdint_intptr_bits 32\n# endif\n# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__)\n# define stdint_intptr_bits 32\n# elif defined (__INTEL_COMPILER)\n/* TODO -- what did Intel do about x86-64? */\n# else\n/* #error \"This platform might not be supported yet\" */\n# endif\n\n# ifdef stdint_intptr_bits\n# define stdint_intptr_glue3_i(a,b,c) a##b##c\n# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)\n# ifndef PRINTF_INTPTR_MODIFIER\n# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)\n# endif\n# ifndef PTRDIFF_MAX\n# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)\n# endif\n# ifndef PTRDIFF_MIN\n# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)\n# endif\n# ifndef UINTPTR_MAX\n# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)\n# endif\n# ifndef INTPTR_MAX\n# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)\n# endif\n# ifndef INTPTR_MIN\n# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)\n# endif\n# ifndef INTPTR_C\n# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)\n# endif\n# ifndef UINTPTR_C\n# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)\n# endif\n typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;\n typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;\n# else\n/* TODO -- This following is likely wrong for some platforms, and does\n nothing for the definition of uintptr_t. */\n typedef ptrdiff_t intptr_t;\n# endif\n# define STDINT_H_UINTPTR_T_DEFINED\n#endif\n\n/*\n * Assumes sig_atomic_t is signed and we have a 2s complement machine.\n */\n\n#ifndef SIG_ATOMIC_MAX\n# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)\n#endif\n\n#endif\n\n#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)\n\n/*\n * Please compile with the maximum warning settings to make sure macros are\n * not defined more than once.\n */\n\n#include \n#include \n#include \n\n#define glue3_aux(x,y,z) x ## y ## z\n#define glue3(x,y,z) glue3_aux(x,y,z)\n\n#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0);\n#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0);\n\n#define DECL(us,bits) glue3(DECL,us,) (bits)\n\n#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf (\"Something wrong with UINT%d_MAX\\n\", bits)\n\n#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; }\n\nint main () {\n\tint err_n = 0;\n\tint err_first = 0;\n\tDECL(I,8)\n\tDECL(U,8)\n\tDECL(I,16)\n\tDECL(U,16)\n\tDECL(I,32)\n\tDECL(U,32)\n#ifdef INT64_MAX\n\tDECL(I,64)\n\tDECL(U,64)\n#endif\n\tintmax_t imax = INTMAX_C(0);\n\tuintmax_t umax = UINTMAX_C(0);\n\tchar str0[256], str1[256];\n\n\tsprintf (str0, \"%\" PRINTF_INT32_MODIFIER \"d\", INT32_C(2147483647));\n\tif (0 != strcmp (str0, \"2147483647\")) REPORTERROR ((\"Something wrong with PRINTF_INT32_MODIFIER : %s\\n\", str0));\n\tif (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR ((\"Something wrong with PRINTF_INT32_DEC_WIDTH : %s\\n\", PRINTF_INT32_DEC_WIDTH));\n\tsprintf (str0, \"%\" PRINTF_INT32_MODIFIER \"u\", UINT32_C(4294967295));\n\tif (0 != strcmp (str0, \"4294967295\")) REPORTERROR ((\"Something wrong with PRINTF_INT32_MODIFIER : %s\\n\", str0));\n\tif (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR ((\"Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\\n\", PRINTF_UINT32_DEC_WIDTH));\n#ifdef INT64_MAX\n\tsprintf (str1, \"%\" PRINTF_INT64_MODIFIER \"d\", INT64_C(9223372036854775807));\n\tif (0 != strcmp (str1, \"9223372036854775807\")) REPORTERROR ((\"Something wrong with PRINTF_INT32_MODIFIER : %s\\n\", str1));\n\tif (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR ((\"Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\\n\", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1)));\n\tsprintf (str1, \"%\" PRINTF_INT64_MODIFIER \"u\", UINT64_C(18446744073709550591));\n\tif (0 != strcmp (str1, \"18446744073709550591\")) REPORTERROR ((\"Something wrong with PRINTF_INT32_MODIFIER : %s\\n\", str1));\n\tif (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR ((\"Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\\n\", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1)));\n#endif\n\n\tsprintf (str0, \"%d %x\\n\", 0, ~0);\n\n\tsprintf (str1, \"%d %x\\n\", i8, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with i8 : %s\\n\", str1));\n\tsprintf (str1, \"%u %x\\n\", u8, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with u8 : %s\\n\", str1));\n\tsprintf (str1, \"%d %x\\n\", i16, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with i16 : %s\\n\", str1));\n\tsprintf (str1, \"%u %x\\n\", u16, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with u16 : %s\\n\", str1));\n\tsprintf (str1, \"%\" PRINTF_INT32_MODIFIER \"d %x\\n\", i32, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with i32 : %s\\n\", str1));\n\tsprintf (str1, \"%\" PRINTF_INT32_MODIFIER \"u %x\\n\", u32, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with u32 : %s\\n\", str1));\n#ifdef INT64_MAX\n\tsprintf (str1, \"%\" PRINTF_INT64_MODIFIER \"d %x\\n\", i64, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with i64 : %s\\n\", str1));\n#endif\n\tsprintf (str1, \"%\" PRINTF_INTMAX_MODIFIER \"d %x\\n\", imax, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with imax : %s\\n\", str1));\n\tsprintf (str1, \"%\" PRINTF_INTMAX_MODIFIER \"u %x\\n\", umax, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with umax : %s\\n\", str1));\n\n\tTESTUMAX(8);\n\tTESTUMAX(16);\n\tTESTUMAX(32);\n#ifdef INT64_MAX\n\tTESTUMAX(64);\n#endif\n\n#define STR(v) #v\n#define Q(v) printf (\"sizeof \" STR(v) \" = %u\\n\", (unsigned) sizeof (v));\n\tif (err_n) {\n\t\tprintf (\"pstdint.h is not correct. Please use sizes below to correct it:\\n\");\n\t}\n\n\tQ(int)\n\tQ(unsigned)\n\tQ(long int)\n\tQ(short int)\n\tQ(int8_t)\n\tQ(int16_t)\n\tQ(int32_t)\n#ifdef INT64_MAX\n\tQ(int64_t)\n#endif\n\n\treturn EXIT_SUCCESS;\n}\n\n#endif\n"}, {"path": "includes/assimp/Compiler/pushpack1.h", "language": "code", "loc": 37, "comment_density": 0.486, "code": "\n\n// ===============================================================================\n// May be included multiple times - sets structure packing to 1 \n// for all supported compilers. #include reverts the changes.\n//\n// Currently this works on the following compilers:\n// MSVC 7,8,9\n// GCC\n// BORLAND (complains about 'pack state changed but not reverted', but works)\n// Clang\n//\n//\n// USAGE:\n//\n// struct StructToBePacked {\n// } PACK_STRUCT;\n//\n// ===============================================================================\n\n#ifdef AI_PUSHPACK_IS_DEFINED\n#\terror poppack1.h must be included after pushpack1.h\n#endif\n\n#if defined(_MSC_VER) || defined(__BORLANDC__) ||\tdefined (__BCPLUSPLUS__)\n#\tpragma pack(push,1)\n#\tdefine PACK_STRUCT\n#elif defined( __GNUC__ )\n#\tif !defined(HOST_MINGW)\n#\t\tdefine PACK_STRUCT\t__attribute__((__packed__))\n#\telse\n#\t\tdefine PACK_STRUCT\t__attribute__((gcc_struct, __packed__))\n#\tendif\n#else\n#\terror Compiler not supported\n#endif\n\n#if defined(_MSC_VER)\n\n// C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop\n#\tpragma warning (disable : 4103) \n#endif\n\n#define AI_PUSHPACK_IS_DEFINED\n\n\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.448, "dedup_hash": "a018dd264b0fc5da", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_assimp_port_androidjni", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Androidjni", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/assimp/port/AndroidJNI/AndroidJNIIOSystem.h", "language": "code", "loc": 70, "comment_density": 0.714, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file Android implementation of IOSystem using the standard C file functions.\n * Aimed to ease the access to android assets */\n\n#if __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)\n#ifndef AI_ANDROIDJNIIOSYSTEM_H_INC\n#define AI_ANDROIDJNIIOSYSTEM_H_INC\n\n#include \"../code/DefaultIOSystem.h\"\n#include \n#include \n#include \n\nnamespace Assimp\t{\n\n// ---------------------------------------------------------------------------\n/** Android extension to DefaultIOSystem using the standard C file functions */\nclass ASSIMP_API AndroidJNIIOSystem : public DefaultIOSystem\n{\npublic:\n\n\t/** Initialize android activity data */\n\tstd::string mApkWorkspacePath;\n\tAAssetManager* mApkAssetManager;\n\n\t/** Constructor. */\n\tAndroidJNIIOSystem(ANativeActivity* activity);\n\n\t/** Destructor. */\n\t~AndroidJNIIOSystem();\n\n\t// -------------------------------------------------------------------\n\t/** Tests for the existence of a file at the given path. */\n\tbool Exists( const char* pFile) const;\n\n\t// -------------------------------------------------------------------\n\t/** Opens a file at the given path, with given mode */\n\tIOStream* Open( const char* strFile, const char* strMode);\n\n\t// ------------------------------------------------------------------------------------------------\n\t// Inits Android extractor\n\tvoid AndroidActivityInit(ANativeActivity* activity);\n\n\t// ------------------------------------------------------------------------------------------------\n\t// Extracts android asset\n\tbool AndroidExtractAsset(std::string name);\n\n};\n\n} //!ns Assimp\n\n#endif //AI_ANDROIDJNIIOSYSTEM_H_INC\n#endif //__ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.714, "dedup_hash": "480014569876aa85", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_freetype", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Freetype", "api": "OpenGL Core", "glsl_version": null, "topic": "raymarching/shadows/bumpmapping/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "includes/freetype/freetype.h", "language": "code", "loc": 4579, "comment_density": 0.894, "code": "/****************************************************************************\n *\n * freetype.h\n *\n * FreeType high-level API and common types (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FREETYPE_H_\n#define FREETYPE_H_\n\n\n#ifndef FT_FREETYPE_H\n#error \"`ft2build.h' hasn't been included yet!\"\n#error \"Please always use macros to include FreeType header files.\"\n#error \"Example:\"\n#error \" #include \"\n#error \" #include FT_FREETYPE_H\"\n#endif\n\n\n#include \n#include FT_CONFIG_CONFIG_H\n#include FT_TYPES_H\n#include FT_ERRORS_H\n\n\nFT_BEGIN_HEADER\n\n\n\n /**************************************************************************\n *\n * @section:\n * header_inclusion\n *\n * @title:\n * FreeType's header inclusion scheme\n *\n * @abstract:\n * How client applications should include FreeType header files.\n *\n * @description:\n * To be as flexible as possible (and for historical reasons), FreeType\n * uses a very special inclusion scheme to load header files, for example\n *\n * ```\n * #include \n *\n * #include FT_FREETYPE_H\n * #include FT_OUTLINE_H\n * ```\n *\n * A compiler and its preprocessor only needs an include path to find the\n * file `ft2build.h`; the exact locations and names of the other FreeType\n * header files are hidden by @header_file_macros, loaded by\n * `ft2build.h`. The API documentation always gives the header macro\n * name needed for a particular function.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * user_allocation\n *\n * @title:\n * User allocation\n *\n * @abstract:\n * How client applications should allocate FreeType data structures.\n *\n * @description:\n * FreeType assumes that structures allocated by the user and passed as\n * arguments are zeroed out except for the actual data. In other words,\n * it is recommended to use `calloc` (or variants of it) instead of\n * `malloc` for allocation.\n *\n */\n\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* B A S I C T Y P E S */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @section:\n * base_interface\n *\n * @title:\n * Base Interface\n *\n * @abstract:\n * The FreeType~2 base font interface.\n *\n * @description:\n * This section describes the most important public high-level API\n * functions of FreeType~2.\n *\n * @order:\n * FT_Library\n * FT_Face\n * FT_Size\n * FT_GlyphSlot\n * FT_CharMap\n * FT_Encoding\n * FT_ENC_TAG\n *\n * FT_FaceRec\n *\n * FT_FACE_FLAG_SCALABLE\n * FT_FACE_FLAG_FIXED_SIZES\n * FT_FACE_FLAG_FIXED_WIDTH\n * FT_FACE_FLAG_HORIZONTAL\n * FT_FACE_FLAG_VERTICAL\n * FT_FACE_FLAG_COLOR\n * FT_FACE_FLAG_SFNT\n * FT_FACE_FLAG_CID_KEYED\n * FT_FACE_FLAG_TRICKY\n * FT_FACE_FLAG_KERNING\n * FT_FACE_FLAG_MULTIPLE_MASTERS\n * FT_FACE_FLAG_VARIATION\n * FT_FACE_FLAG_GLYPH_NAMES\n * FT_FACE_FLAG_EXTERNAL_STREAM\n * FT_FACE_FLAG_HINTER\n *\n * FT_HAS_HORIZONTAL\n * FT_HAS_VERTICAL\n * FT_HAS_KERNING\n * FT_HAS_FIXED_SIZES\n * FT_HAS_GLYPH_NAMES\n * FT_HAS_COLOR\n * FT_HAS_MULTIPLE_MASTERS\n *\n * FT_IS_SFNT\n * FT_IS_SCALABLE\n * FT_IS_FIXED_WIDTH\n * FT_IS_CID_KEYED\n * FT_IS_TRICKY\n * FT_IS_NAMED_INSTANCE\n * FT_IS_VARIATION\n *\n * FT_STYLE_FLAG_BOLD\n * FT_STYLE_FLAG_ITALIC\n *\n * FT_SizeRec\n * FT_Size_Metrics\n *\n * FT_GlyphSlotRec\n * FT_Glyph_Metrics\n * FT_SubGlyph\n *\n * FT_Bitmap_Size\n *\n * FT_Init_FreeType\n * FT_Done_FreeType\n *\n * FT_New_Face\n * FT_Done_Face\n * FT_Reference_Face\n * FT_New_Memory_Face\n * FT_Face_Properties\n * FT_Open_Face\n * FT_Open_Args\n * FT_Parameter\n * FT_Attach_File\n * FT_Attach_Stream\n *\n * FT_Set_Char_Size\n * FT_Set_Pixel_Sizes\n * FT_Request_Size\n * FT_Select_Size\n * FT_Size_Request_Type\n * FT_Size_RequestRec\n * FT_Size_Request\n * FT_Set_Transform\n * FT_Load_Glyph\n * FT_Get_Char_Index\n * FT_Get_First_Char\n * FT_Get_Next_Char\n * FT_Get_Name_Index\n * FT_Load_Char\n *\n * FT_OPEN_MEMORY\n * FT_OPEN_STREAM\n * FT_OPEN_PATHNAME\n * FT_OPEN_DRIVER\n * FT_OPEN_PARAMS\n *\n * FT_LOAD_DEFAULT\n * FT_LOAD_RENDER\n * FT_LOAD_MONOCHROME\n * FT_LOAD_LINEAR_DESIGN\n * FT_LOAD_NO_SCALE\n * FT_LOAD_NO_HINTING\n * FT_LOAD_NO_BITMAP\n * FT_LOAD_NO_AUTOHINT\n * FT_LOAD_COLOR\n *\n * FT_LOAD_VERTICAL_LAYOUT\n * FT_LOAD_IGNORE_TRANSFORM\n * FT_LOAD_FORCE_AUTOHINT\n * FT_LOAD_NO_RECURSE\n * FT_LOAD_PEDANTIC\n *\n * FT_LOAD_TARGET_NORMAL\n * FT_LOAD_TARGET_LIGHT\n * FT_LOAD_TARGET_MONO\n * FT_LOAD_TARGET_LCD\n * FT_LOAD_TARGET_LCD_V\n *\n * FT_LOAD_TARGET_MODE\n *\n * FT_Render_Glyph\n * FT_Render_Mode\n * FT_Get_Kerning\n * FT_Kerning_Mode\n * FT_Get_Track_Kerning\n * FT_Get_Glyph_Name\n * FT_Get_Postscript_Name\n *\n * FT_CharMapRec\n * FT_Select_Charmap\n * FT_Set_Charmap\n * FT_Get_Charmap_Index\n *\n * FT_Get_FSType_Flags\n * FT_Get_SubGlyph_Info\n *\n * FT_Face_Internal\n * FT_Size_Internal\n * FT_Slot_Internal\n *\n * FT_FACE_FLAG_XXX\n * FT_STYLE_FLAG_XXX\n * FT_OPEN_XXX\n * FT_LOAD_XXX\n * FT_LOAD_TARGET_XXX\n * FT_SUBGLYPH_FLAG_XXX\n * FT_FSTYPE_XXX\n *\n * FT_HAS_FAST_GLYPHS\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Glyph_Metrics\n *\n * @description:\n * A structure to model the metrics of a single glyph. The values are\n * expressed in 26.6 fractional pixel format; if the flag\n * @FT_LOAD_NO_SCALE has been used while loading the glyph, values are\n * expressed in font units instead.\n *\n * @fields:\n * width ::\n * The glyph's width.\n *\n * height ::\n * The glyph's height.\n *\n * horiBearingX ::\n * Left side bearing for horizontal layout.\n *\n * horiBearingY ::\n * Top side bearing for horizontal layout.\n *\n * horiAdvance ::\n * Advance width for horizontal layout.\n *\n * vertBearingX ::\n * Left side bearing for vertical layout.\n *\n * vertBearingY ::\n * Top side bearing for vertical layout. Larger positive values mean\n * further below the vertical glyph origin.\n *\n * vertAdvance ::\n * Advance height for vertical layout. Positive values mean the glyph\n * has a positive advance downward.\n *\n * @note:\n * If not disabled with @FT_LOAD_NO_HINTING, the values represent\n * dimensions of the hinted glyph (in case hinting is applicable).\n *\n * Stroking a glyph with an outside border does not increase\n * `horiAdvance` or `vertAdvance`; you have to manually adjust these\n * values to account for the added width and height.\n *\n * FreeType doesn't use the 'VORG' table data for CFF fonts because it\n * doesn't have an interface to quickly retrieve the glyph height. The\n * y~coordinate of the vertical origin can be simply computed as\n * `vertBearingY + height` after loading a glyph.\n */\n typedef struct FT_Glyph_Metrics_\n {\n FT_Pos width;\n FT_Pos height;\n\n FT_Pos horiBearingX;\n FT_Pos horiBearingY;\n FT_Pos horiAdvance;\n\n FT_Pos vertBearingX;\n FT_Pos vertBearingY;\n FT_Pos vertAdvance;\n\n } FT_Glyph_Metrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Bitmap_Size\n *\n * @description:\n * This structure models the metrics of a bitmap strike (i.e., a set of\n * glyphs for a given point size and resolution) in a bitmap font. It is\n * used for the `available_sizes` field of @FT_Face.\n *\n * @fields:\n * height ::\n * The vertical distance, in pixels, between two consecutive baselines.\n * It is always positive.\n *\n * width ::\n * The average width, in pixels, of all glyphs in the strike.\n *\n * size ::\n * The nominal size of the strike in 26.6 fractional points. This\n * field is not very useful.\n *\n * x_ppem ::\n * The horizontal ppem (nominal width) in 26.6 fractional pixels.\n *\n * y_ppem ::\n * The vertical ppem (nominal height) in 26.6 fractional pixels.\n *\n * @note:\n * Windows FNT:\n * The nominal size given in a FNT font is not reliable. If the driver\n * finds it incorrect, it sets `size` to some calculated values, and\n * `x_ppem` and `y_ppem` to the pixel width and height given in the\n * font, respectively.\n *\n * TrueType embedded bitmaps:\n * `size`, `width`, and `height` values are not contained in the bitmap\n * strike itself. They are computed from the global font parameters.\n */\n typedef struct FT_Bitmap_Size_\n {\n FT_Short height;\n FT_Short width;\n\n FT_Pos size;\n\n FT_Pos x_ppem;\n FT_Pos y_ppem;\n\n } FT_Bitmap_Size;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* O B J E C T C L A S S E S */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n /**************************************************************************\n *\n * @type:\n * FT_Library\n *\n * @description:\n * A handle to a FreeType library instance. Each 'library' is completely\n * independent from the others; it is the 'root' of a set of objects like\n * fonts, faces, sizes, etc.\n *\n * It also embeds a memory manager (see @FT_Memory), as well as a\n * scan-line converter object (see @FT_Raster).\n *\n * [Since 2.5.6] In multi-threaded applications it is easiest to use one\n * `FT_Library` object per thread. In case this is too cumbersome, a\n * single `FT_Library` object across threads is possible also, as long as\n * a mutex lock is used around @FT_New_Face and @FT_Done_Face.\n *\n * @note:\n * Library objects are normally created by @FT_Init_FreeType, and\n * destroyed with @FT_Done_FreeType. If you need reference-counting\n * (cf. @FT_Reference_Library), use @FT_New_Library and @FT_Done_Library.\n */\n typedef struct FT_LibraryRec_ *FT_Library;\n\n\n /**************************************************************************\n *\n * @section:\n * module_management\n *\n */\n\n /**************************************************************************\n *\n * @type:\n * FT_Module\n *\n * @description:\n * A handle to a given FreeType module object. A module can be a font\n * driver, a renderer, or anything else that provides services to the\n * former.\n */\n typedef struct FT_ModuleRec_* FT_Module;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Driver\n *\n * @description:\n * A handle to a given FreeType font driver object. A font driver is a\n * module capable of creating faces from font files.\n */\n typedef struct FT_DriverRec_* FT_Driver;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Renderer\n *\n * @description:\n * A handle to a given FreeType renderer. A renderer is a module in\n * charge of converting a glyph's outline image to a bitmap. It supports\n * a single glyph image format, and one or more target surface depths.\n */\n typedef struct FT_RendererRec_* FT_Renderer;\n\n\n /**************************************************************************\n *\n * @section:\n * base_interface\n *\n */\n\n /**************************************************************************\n *\n * @type:\n * FT_Face\n *\n * @description:\n * A handle to a typographic face object. A face object models a given\n * typeface, in a given style.\n *\n * @note:\n * A face object also owns a single @FT_GlyphSlot object, as well as one\n * or more @FT_Size objects.\n *\n * Use @FT_New_Face or @FT_Open_Face to create a new face object from a\n * given filepath or a custom input stream.\n *\n * Use @FT_Done_Face to destroy it (along with its slot and sizes).\n *\n * An `FT_Face` object can only be safely used from one thread at a time.\n * Similarly, creation and destruction of `FT_Face` with the same\n * @FT_Library object can only be done from one thread at a time. On the\n * other hand, functions like @FT_Load_Glyph and its siblings are\n * thread-safe and do not need the lock to be held as long as the same\n * `FT_Face` object is not used from multiple threads at the same time.\n *\n * @also:\n * See @FT_FaceRec for the publicly accessible fields of a given face\n * object.\n */\n typedef struct FT_FaceRec_* FT_Face;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Size\n *\n * @description:\n * A handle to an object that models a face scaled to a given character\n * size.\n *\n * @note:\n * An @FT_Face has one _active_ @FT_Size object that is used by functions\n * like @FT_Load_Glyph to determine the scaling transformation that in\n * turn is used to load and hint glyphs and metrics.\n *\n * You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size\n * or even @FT_Select_Size to change the content (i.e., the scaling\n * values) of the active @FT_Size.\n *\n * You can use @FT_New_Size to create additional size objects for a given\n * @FT_Face, but they won't be used by other functions until you activate\n * it through @FT_Activate_Size. Only one size can be activated at any\n * given time per face.\n *\n * @also:\n * See @FT_SizeRec for the publicly accessible fields of a given size\n * object.\n */\n typedef struct FT_SizeRec_* FT_Size;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_GlyphSlot\n *\n * @description:\n * A handle to a given 'glyph slot'. A slot is a container that can hold\n * any of the glyphs contained in its parent face.\n *\n * In other words, each time you call @FT_Load_Glyph or @FT_Load_Char,\n * the slot's content is erased by the new glyph data, i.e., the glyph's\n * metrics, its image (bitmap or outline), and other control information.\n *\n * @also:\n * See @FT_GlyphSlotRec for the publicly accessible glyph fields.\n */\n typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_CharMap\n *\n * @description:\n * A handle to a character map (usually abbreviated to 'charmap'). A\n * charmap is used to translate character codes in a given encoding into\n * glyph indexes for its parent's face. Some font formats may provide\n * several charmaps per font.\n *\n * Each face object owns zero or more charmaps, but only one of them can\n * be 'active', providing the data used by @FT_Get_Char_Index or\n * @FT_Load_Char.\n *\n * The list of available charmaps in a face is available through the\n * `face->num_charmaps` and `face->charmaps` fields of @FT_FaceRec.\n *\n * The currently active charmap is available as `face->charmap`. You\n * should call @FT_Set_Charmap to change it.\n *\n * @note:\n * When a new face is created (either through @FT_New_Face or\n * @FT_Open_Face), the library looks for a Unicode charmap within the\n * list and automatically activates it. If there is no Unicode charmap,\n * FreeType doesn't set an 'active' charmap.\n *\n * @also:\n * See @FT_CharMapRec for the publicly accessible fields of a given\n * character map.\n */\n typedef struct FT_CharMapRec_* FT_CharMap;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ENC_TAG\n *\n * @description:\n * This macro converts four-letter tags into an unsigned long. It is\n * used to define 'encoding' identifiers (see @FT_Encoding).\n *\n * @note:\n * Since many 16-bit compilers don't like 32-bit enumerations, you should\n * redefine this macro in case of problems to something like this:\n *\n * ```\n * #define FT_ENC_TAG( value, a, b, c, d ) value\n * ```\n *\n * to get a simple enumeration without assigning special numbers.\n */\n\n#ifndef FT_ENC_TAG\n#define FT_ENC_TAG( value, a, b, c, d ) \\\n value = ( ( (FT_UInt32)(a) << 24 ) | \\\n ( (FT_UInt32)(b) << 16 ) | \\\n ( (FT_UInt32)(c) << 8 ) | \\\n (FT_UInt32)(d) )\n\n#endif /* FT_ENC_TAG */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Encoding\n *\n * @description:\n * An enumeration to specify character sets supported by charmaps. Used\n * in the @FT_Select_Charmap API function.\n *\n * @note:\n * Despite the name, this enumeration lists specific character\n * repertories (i.e., charsets), and not text encoding methods (e.g.,\n * UTF-8, UTF-16, etc.).\n *\n * Other encodings might be defined in the future.\n *\n * @values:\n * FT_ENCODING_NONE ::\n * The encoding value~0 is reserved for all formats except BDF, PCF,\n * and Windows FNT; see below for more information.\n *\n * FT_ENCODING_UNICODE ::\n * The Unicode character set. This value covers all versions of the\n * Unicode repertoire, including ASCII and Latin-1. Most fonts include\n * a Unicode charmap, but not all of them.\n *\n * For example, if you want to access Unicode value U+1F028 (and the\n * font contains it), use value 0x1F028 as the input value for\n * @FT_Get_Char_Index.\n *\n * FT_ENCODING_MS_SYMBOL ::\n * Microsoft Symbol encoding, used to encode mathematical symbols and\n * wingdings. For more information, see\n * 'https://www.microsoft.com/typography/otspec/recom.htm#non-standard-symbol-fonts',\n * 'http://www.kostis.net/charsets/symbol.htm', and\n * 'http://www.kostis.net/charsets/wingding.htm'.\n *\n * This encoding uses character codes from the PUA (Private Unicode\n * Area) in the range U+F020-U+F0FF.\n *\n * FT_ENCODING_SJIS ::\n * Shift JIS encoding for Japanese. More info at\n * 'https://en.wikipedia.org/wiki/Shift_JIS'. See note on multi-byte\n * encodings below.\n *\n * FT_ENCODING_PRC ::\n * Corresponds to encoding systems mainly for Simplified Chinese as\n * used in People's Republic of China (PRC). The encoding layout is\n * based on GB~2312 and its supersets GBK and GB~18030.\n *\n * FT_ENCODING_BIG5 ::\n * Corresponds to an encoding system for Traditional Chinese as used in\n * Taiwan and Hong Kong.\n *\n * FT_ENCODING_WANSUNG ::\n * Corresponds to the Korean encoding system known as Extended Wansung\n * (MS Windows code page 949). For more information see\n * 'https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'.\n *\n * FT_ENCODING_JOHAB ::\n * The Korean standard character set (KS~C 5601-1992), which\n * corresponds to MS Windows code page 1361. This character set\n * includes all possible Hangul character combinations.\n *\n * FT_ENCODING_ADOBE_LATIN_1 ::\n * Corresponds to a Latin-1 encoding as defined in a Type~1 PostScript\n * font. It is limited to 256 character codes.\n *\n * FT_ENCODING_ADOBE_STANDARD ::\n * Adobe Standard encoding, as found in Type~1, CFF, and OpenType/CFF\n * fonts. It is limited to 256 character codes.\n *\n * FT_ENCODING_ADOBE_EXPERT ::\n * Adobe Expert encoding, as found in Type~1, CFF, and OpenType/CFF\n * fonts. It is limited to 256 character codes.\n *\n * FT_ENCODING_ADOBE_CUSTOM ::\n * Corresponds to a custom encoding, as found in Type~1, CFF, and\n * OpenType/CFF fonts. It is limited to 256 character codes.\n *\n * FT_ENCODING_APPLE_ROMAN ::\n * Apple roman encoding. Many TrueType and OpenType fonts contain a\n * charmap for this 8-bit encoding, since older versions of Mac OS are\n * able to use it.\n *\n * FT_ENCODING_OLD_LATIN_2 ::\n * This value is deprecated and was neither used nor reported by\n * FreeType. Don't use or test for it.\n *\n * FT_ENCODING_MS_SJIS ::\n * Same as FT_ENCODING_SJIS. Deprecated.\n *\n * FT_ENCODING_MS_GB2312 ::\n * Same as FT_ENCODING_PRC. Deprecated.\n *\n * FT_ENCODING_MS_BIG5 ::\n * Same as FT_ENCODING_BIG5. Deprecated.\n *\n * FT_ENCODING_MS_WANSUNG ::\n * Same as FT_ENCODING_WANSUNG. Deprecated.\n *\n * FT_ENCODING_MS_JOHAB ::\n * Same as FT_ENCODING_JOHAB. Deprecated.\n *\n * @note:\n * By default, FreeType enables a Unicode charmap and tags it with\n * `FT_ENCODING_UNICODE` when it is either provided or can be generated\n * from PostScript glyph name dictionaries in the font file. All other\n * encodings are considered legacy and tagged only if explicitly defined\n * in the font file. Otherwise, `FT_ENCODING_NONE` is used.\n *\n * `FT_ENCODING_NONE` is set by the BDF and PCF drivers if the charmap is\n * neither Unicode nor ISO-8859-1 (otherwise it is set to\n * `FT_ENCODING_UNICODE`). Use @FT_Get_BDF_Charset_ID to find out which\n * encoding is really present. If, for example, the `cs_registry` field\n * is 'KOI8' and the `cs_encoding` field is 'R', the font is encoded in\n * KOI8-R.\n *\n * `FT_ENCODING_NONE` is always set (with a single exception) by the\n * winfonts driver. Use @FT_Get_WinFNT_Header and examine the `charset`\n * field of the @FT_WinFNT_HeaderRec structure to find out which encoding\n * is really present. For example, @FT_WinFNT_ID_CP1251 (204) means\n * Windows code page 1251 (for Russian).\n *\n * `FT_ENCODING_NONE` is set if `platform_id` is @TT_PLATFORM_MACINTOSH\n * and `encoding_id` is not `TT_MAC_ID_ROMAN` (otherwise it is set to\n * `FT_ENCODING_APPLE_ROMAN`).\n *\n * If `platform_id` is @TT_PLATFORM_MACINTOSH, use the function\n * @FT_Get_CMap_Language_ID to query the Mac language ID that may be\n * needed to be able to distinguish Apple encoding variants. See\n *\n * https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt\n *\n * to get an idea how to do that. Basically, if the language ID is~0,\n * don't use it, otherwise subtract 1 from the language ID. Then examine\n * `encoding_id`. If, for example, `encoding_id` is `TT_MAC_ID_ROMAN`\n * and the language ID (minus~1) is `TT_MAC_LANGID_GREEK`, it is the\n * Greek encoding, not Roman. `TT_MAC_ID_ARABIC` with\n * `TT_MAC_LANGID_FARSI` means the Farsi variant the Arabic encoding.\n */\n typedef enum FT_Encoding_\n {\n FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),\n\n FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),\n FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),\n\n FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),\n FT_ENC_TAG( FT_ENCODING_PRC, 'g', 'b', ' ', ' ' ),\n FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),\n FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),\n FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),\n\n /* for backward compatibility */\n FT_ENCODING_GB2312 = FT_ENCODING_PRC,\n FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,\n FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC,\n FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,\n FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,\n FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,\n\n FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),\n FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),\n FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),\n FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),\n\n FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),\n\n FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )\n\n } FT_Encoding;\n\n\n /* these constants are deprecated; use the corresponding `FT_Encoding` */\n /* values instead */\n#define ft_encoding_none FT_ENCODING_NONE\n#define ft_encoding_unicode FT_ENCODING_UNICODE\n#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL\n#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1\n#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2\n#define ft_encoding_sjis FT_ENCODING_SJIS\n#define ft_encoding_gb2312 FT_ENCODING_PRC\n#define ft_encoding_big5 FT_ENCODING_BIG5\n#define ft_encoding_wansung FT_ENCODING_WANSUNG\n#define ft_encoding_johab FT_ENCODING_JOHAB\n\n#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD\n#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT\n#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM\n#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_CharMapRec\n *\n * @description:\n * The base charmap structure.\n *\n * @fields:\n * face ::\n * A handle to the parent face object.\n *\n * encoding ::\n * An @FT_Encoding tag identifying the charmap. Use this with\n * @FT_Select_Charmap.\n *\n * platform_id ::\n * An ID number describing the platform for the following encoding ID.\n * This comes directly from the TrueType specification and gets\n * emulated for other formats.\n *\n * encoding_id ::\n * A platform-specific encoding number. This also comes from the\n * TrueType specification and gets emulated similarly.\n */\n typedef struct FT_CharMapRec_\n {\n FT_Face face;\n FT_Encoding encoding;\n FT_UShort platform_id;\n FT_UShort encoding_id;\n\n } FT_CharMapRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* B A S E O B J E C T C L A S S E S */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Face_Internal\n *\n * @description:\n * An opaque handle to an `FT_Face_InternalRec` structure that models the\n * private data of a given @FT_Face object.\n *\n * This structure might change between releases of FreeType~2 and is not\n * generally available to client applications.\n */\n typedef struct FT_Face_InternalRec_* FT_Face_Internal;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_FaceRec\n *\n * @description:\n * FreeType root face class structure. A face object models a typeface\n * in a font file.\n *\n * @fields:\n * num_faces ::\n * The number of faces in the font file. Some font formats can have\n * multiple faces in a single font file.\n *\n * face_index ::\n * This field holds two different values. Bits 0-15 are the index of\n * the face in the font file (starting with value~0). They are set\n * to~0 if there is only one face in the font file.\n *\n * [Since 2.6.1] Bits 16-30 are relevant to GX and OpenType variation\n * fonts only, holding the named instance index for the current face\n * index (starting with value~1; value~0 indicates font access without\n * a named instance). For non-variation fonts, bits 16-30 are ignored.\n * If we have the third named instance of face~4, say, `face_index` is\n * set to 0x00030004.\n *\n * Bit 31 is always zero (this is, `face_index` is always a positive\n * value).\n *\n * [Since 2.9] Changing the design coordinates with\n * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does\n * not influence the named instance index value (only\n * @FT_Set_Named_Instance does that).\n *\n * face_flags ::\n * A set of bit flags that give important information about the face;\n * see @FT_FACE_FLAG_XXX for the details.\n *\n * style_flags ::\n * The lower 16~bits contain a set of bit flags indicating the style of\n * the face; see @FT_STYLE_FLAG_XXX for the details.\n *\n * [Since 2.6.1] Bits 16-30 hold the number of named instances\n * available for the current face if we have a GX or OpenType variation\n * (sub)font. Bit 31 is always zero (this is, `style_flags` is always\n * a positive value). Note that a variation font has always at least\n * one named instance, namely the default instance.\n *\n * num_glyphs ::\n * The number of glyphs in the face. If the face is scalable and has\n * sbits (see `num_fixed_sizes`), it is set to the number of outline\n * glyphs.\n *\n * For CID-keyed fonts (not in an SFNT wrapper) this value gives the\n * highest CID used in the font.\n *\n * family_name ::\n * The face's family name. This is an ASCII string, usually in\n * English, that describes the typeface's family (like 'Times New\n * Roman', 'Bodoni', 'Garamond', etc). This is a least common\n * denominator used to list fonts. Some formats (TrueType & OpenType)\n * provide localized and Unicode versions of this string. Applications\n * should use the format-specific interface to access them. Can be\n * `NULL` (e.g., in fonts embedded in a PDF file).\n *\n * In case the font doesn't provide a specific family name entry,\n * FreeType tries to synthesize one, deriving it from other name\n * entries.\n *\n * style_name ::\n * The face's style name. This is an ASCII string, usually in English,\n * that describes the typeface's style (like 'Italic', 'Bold',\n * 'Condensed', etc). Not all font formats provide a style name, so\n * this field is optional, and can be set to `NULL`. As for\n * `family_name`, some formats provide localized and Unicode versions\n * of this string. Applications should use the format-specific\n * interface to access them.\n *\n * num_fixed_sizes ::\n * The number of bitmap strikes in the face. Even if the face is\n * scalable, there might still be bitmap strikes, which are called\n * 'sbits' in that case.\n *\n * available_sizes ::\n * An array of @FT_Bitmap_Size for all bitmap strikes in the face. It\n * is set to `NULL` if there is no bitmap strike.\n *\n * Note that FreeType tries to sanitize the strike data since they are\n * sometimes sloppy or incorrect, but this can easily fail.\n *\n * num_charmaps ::\n * The number of charmaps in the face.\n *\n * charmaps ::\n * An array of the charmaps of the face.\n *\n * generic ::\n * A field reserved for client uses. See the @FT_Generic type\n * description.\n *\n * bbox ::\n * The font bounding box. Coordinates are expressed in font units (see\n * `units_per_EM`). The box is large enough to contain any glyph from\n * the font. Thus, `bbox.yMax` can be seen as the 'maximum ascender',\n * and `bbox.yMin` as the 'minimum descender'. Only relevant for\n * scalable formats.\n *\n * Note that the bounding box might be off by (at least) one pixel for\n * hinted fonts. See @FT_Size_Metrics for further discussion.\n *\n * units_per_EM ::\n * The number of font units per EM square for this face. This is\n * typically 2048 for TrueType fonts, and 1000 for Type~1 fonts. Only\n * relevant for scalable formats.\n *\n * ascender ::\n * The typographic ascender of the face, expressed in font units. For\n * font formats not having this information, it is set to `bbox.yMax`.\n * Only relevant for scalable formats.\n *\n * descender ::\n * The typographic descender of the face, expressed in font units. For\n * font formats not having this information, it is set to `bbox.yMin`.\n * Note that this field is negative for values below the baseline.\n * Only relevant for scalable formats.\n *\n * height ::\n * This value is the vertical distance between two consecutive\n * baselines, expressed in font units. It is always positive. Only\n * relevant for scalable formats.\n *\n * If you want the global glyph height, use `ascender - descender`.\n *\n * max_advance_width ::\n * The maximum advance width, in font units, for all glyphs in this\n * face. This can be used to make word wrapping computations faster.\n * Only relevant for scalable formats.\n *\n * max_advance_height ::\n * The maximum advance height, in font units, for all glyphs in this\n * face. This is only relevant for vertical layouts, and is set to\n * `height` for fonts that do not provide vertical metrics. Only\n * relevant for scalable formats.\n *\n * underline_position ::\n * The position, in font units, of the underline line for this face.\n * It is the center of the underlining stem. Only relevant for\n * scalable formats.\n *\n * underline_thickness ::\n * The thickness, in font units, of the underline for this face. Only\n * relevant for scalable formats.\n *\n * glyph ::\n * The face's associated glyph slot(s).\n *\n * size ::\n * The current active size for this face.\n *\n * charmap ::\n * The current active charmap for this face.\n *\n * @note:\n * Fields may be changed after a call to @FT_Attach_File or\n * @FT_Attach_Stream.\n *\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `ascender`, `descender`, `height`,\n * `underline_position`, and `underline_thickness`.\n *\n * Especially for TrueType fonts see also the documentation for\n * @FT_Size_Metrics.\n */\n typedef struct FT_FaceRec_\n {\n FT_Long num_faces;\n FT_Long face_index;\n\n FT_Long face_flags;\n FT_Long style_flags;\n\n FT_Long num_glyphs;\n\n FT_String* family_name;\n FT_String* style_name;\n\n FT_Int num_fixed_sizes;\n FT_Bitmap_Size* available_sizes;\n\n FT_Int num_charmaps;\n FT_CharMap* charmaps;\n\n FT_Generic generic;\n\n /*# The following member variables (down to `underline_thickness`) */\n /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */\n /*# for bitmap fonts. */\n FT_BBox bbox;\n\n FT_UShort units_per_EM;\n FT_Short ascender;\n FT_Short descender;\n FT_Short height;\n\n FT_Short max_advance_width;\n FT_Short max_advance_height;\n\n FT_Short underline_position;\n FT_Short underline_thickness;\n\n FT_GlyphSlot glyph;\n FT_Size size;\n FT_CharMap charmap;\n\n /*@private begin */\n\n FT_Driver driver;\n FT_Memory memory;\n FT_Stream stream;\n\n FT_ListRec sizes_list;\n\n FT_Generic autohint; /* face-specific auto-hinter data */\n void* extensions; /* unused */\n\n FT_Face_Internal internal;\n\n /*@private end */\n\n } FT_FaceRec;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_FACE_FLAG_XXX\n *\n * @description:\n * A list of bit flags used in the `face_flags` field of the @FT_FaceRec\n * structure. They inform client applications of properties of the\n * corresponding face.\n *\n * @values:\n * FT_FACE_FLAG_SCALABLE ::\n * The face contains outline glyphs. Note that a face can contain\n * bitmap strikes also, i.e., a face can have both this flag and\n * @FT_FACE_FLAG_FIXED_SIZES set.\n *\n * FT_FACE_FLAG_FIXED_SIZES ::\n * The face contains bitmap strikes. See also the `num_fixed_sizes`\n * and `available_sizes` fields of @FT_FaceRec.\n *\n * FT_FACE_FLAG_FIXED_WIDTH ::\n * The face contains fixed-width characters (like Courier, Lucida,\n * MonoType, etc.).\n *\n * FT_FACE_FLAG_SFNT ::\n * The face uses the SFNT storage scheme. For now, this means TrueType\n * and OpenType.\n *\n * FT_FACE_FLAG_HORIZONTAL ::\n * The face contains horizontal glyph metrics. This should be set for\n * all common formats.\n *\n * FT_FACE_FLAG_VERTICAL ::\n * The face contains vertical glyph metrics. This is only available in\n * some formats, not all of them.\n *\n * FT_FACE_FLAG_KERNING ::\n * The face contains kerning information. If set, the kerning distance\n * can be retrieved using the function @FT_Get_Kerning. Otherwise the\n * function always return the vector (0,0). Note that FreeType doesn't\n * handle kerning data from the SFNT 'GPOS' table (as present in many\n * OpenType fonts).\n *\n * FT_FACE_FLAG_FAST_GLYPHS ::\n * THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT.\n *\n * FT_FACE_FLAG_MULTIPLE_MASTERS ::\n * The face contains multiple masters and is capable of interpolating\n * between them. Supported formats are Adobe MM, TrueType GX, and\n * OpenType variation fonts.\n *\n * See section @multiple_masters for API details.\n *\n * FT_FACE_FLAG_GLYPH_NAMES ::\n * The face contains glyph names, which can be retrieved using\n * @FT_Get_Glyph_Name. Note that some TrueType fonts contain broken\n * glyph name tables. Use the function @FT_Has_PS_Glyph_Names when\n * needed.\n *\n * FT_FACE_FLAG_EXTERNAL_STREAM ::\n * Used internally by FreeType to indicate that a face's stream was\n * provided by the client application and should not be destroyed when\n * @FT_Done_Face is called. Don't read or test this flag.\n *\n * FT_FACE_FLAG_HINTER ::\n * The font driver has a hinting machine of its own. For example, with\n * TrueType fonts, it makes sense to use data from the SFNT 'gasp'\n * table only if the native TrueType hinting engine (with the bytecode\n * interpreter) is available and active.\n *\n * FT_FACE_FLAG_CID_KEYED ::\n * The face is CID-keyed. In that case, the face is not accessed by\n * glyph indices but by CID values. For subsetted CID-keyed fonts this\n * has the consequence that not all index values are a valid argument\n * to @FT_Load_Glyph. Only the CID values for which corresponding\n * glyphs in the subsetted font exist make `FT_Load_Glyph` return\n * successfully; in all other cases you get an\n * `FT_Err_Invalid_Argument` error.\n *\n * Note that CID-keyed fonts that are in an SFNT wrapper (this is, all\n * OpenType/CFF fonts) don't have this flag set since the glyphs are\n * accessed in the normal way (using contiguous indices); the\n * 'CID-ness' isn't visible to the application.\n *\n * FT_FACE_FLAG_TRICKY ::\n * The face is 'tricky', this is, it always needs the font format's\n * native hinting engine to get a reasonable result. A typical example\n * is the old Chinese font `mingli.ttf` (but not `mingliu.ttc`) that\n * uses TrueType bytecode instructions to move and scale all of its\n * subglyphs.\n *\n * It is not possible to auto-hint such fonts using\n * @FT_LOAD_FORCE_AUTOHINT; it will also ignore @FT_LOAD_NO_HINTING.\n * You have to set both @FT_LOAD_NO_HINTING and @FT_LOAD_NO_AUTOHINT to\n * really disable hinting; however, you probably never want this except\n * for demonstration purposes.\n *\n * Currently, there are about a dozen TrueType fonts in the list of\n * tricky fonts; they are hard-coded in file `ttobjs.c`.\n *\n * FT_FACE_FLAG_COLOR ::\n * [Since 2.5.1] The face has color glyph tables. See @FT_LOAD_COLOR\n * for more information.\n *\n * FT_FACE_FLAG_VARIATION ::\n * [Since 2.9] Set if the current face (or named instance) has been\n * altered with @FT_Set_MM_Design_Coordinates,\n * @FT_Set_Var_Design_Coordinates, or @FT_Set_Var_Blend_Coordinates.\n * This flag is unset by a call to @FT_Set_Named_Instance.\n */\n#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )\n#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )\n#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )\n#define FT_FACE_FLAG_SFNT ( 1L << 3 )\n#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )\n#define FT_FACE_FLAG_VERTICAL ( 1L << 5 )\n#define FT_FACE_FLAG_KERNING ( 1L << 6 )\n#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )\n#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )\n#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )\n#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )\n#define FT_FACE_FLAG_HINTER ( 1L << 11 )\n#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )\n#define FT_FACE_FLAG_TRICKY ( 1L << 13 )\n#define FT_FACE_FLAG_COLOR ( 1L << 14 )\n#define FT_FACE_FLAG_VARIATION ( 1L << 15 )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_HORIZONTAL\n *\n * @description:\n * A macro that returns true whenever a face object contains horizontal\n * metrics (this is true for all font formats though).\n *\n * @also:\n * @FT_HAS_VERTICAL can be used to check for vertical metrics.\n *\n */\n#define FT_HAS_HORIZONTAL( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_VERTICAL\n *\n * @description:\n * A macro that returns true whenever a face object contains real\n * vertical metrics (and not only synthesized ones).\n *\n */\n#define FT_HAS_VERTICAL( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_VERTICAL ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_KERNING\n *\n * @description:\n * A macro that returns true whenever a face object contains kerning data\n * that can be accessed with @FT_Get_Kerning.\n *\n */\n#define FT_HAS_KERNING( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_KERNING ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_SCALABLE\n *\n * @description:\n * A macro that returns true whenever a face object contains a scalable\n * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, and\n * PFR font formats).\n *\n */\n#define FT_IS_SCALABLE( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_SCALABLE ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_SFNT\n *\n * @description:\n * A macro that returns true whenever a face object contains a font whose\n * format is based on the SFNT storage scheme. This usually means:\n * TrueType fonts, OpenType fonts, as well as SFNT-based embedded bitmap\n * fonts.\n *\n * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and\n * @FT_TRUETYPE_TABLES_H are available.\n *\n */\n#define FT_IS_SFNT( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_SFNT ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_FIXED_WIDTH\n *\n * @description:\n * A macro that returns true whenever a face object contains a font face\n * that contains fixed-width (or 'monospace', 'fixed-pitch', etc.)\n * glyphs.\n *\n */\n#define FT_IS_FIXED_WIDTH( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_FIXED_SIZES\n *\n * @description:\n * A macro that returns true whenever a face object contains some\n * embedded bitmaps. See the `available_sizes` field of the @FT_FaceRec\n * structure.\n *\n */\n#define FT_HAS_FIXED_SIZES( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_FAST_GLYPHS\n *\n * @description:\n * Deprecated.\n *\n */\n#define FT_HAS_FAST_GLYPHS( face ) 0\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_GLYPH_NAMES\n *\n * @description:\n * A macro that returns true whenever a face object contains some glyph\n * names that can be accessed through @FT_Get_Glyph_Name.\n *\n */\n#define FT_HAS_GLYPH_NAMES( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_MULTIPLE_MASTERS\n *\n * @description:\n * A macro that returns true whenever a face object contains some\n * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H\n * are then available to choose the exact design you want.\n *\n */\n#define FT_HAS_MULTIPLE_MASTERS( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_NAMED_INSTANCE\n *\n * @description:\n * A macro that returns true whenever a face object is a named instance\n * of a GX or OpenType variation font.\n *\n * [Since 2.9] Changing the design coordinates with\n * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does\n * not influence the return value of this macro (only\n * @FT_Set_Named_Instance does that).\n *\n * @since:\n * 2.7\n *\n */\n#define FT_IS_NAMED_INSTANCE( face ) \\\n ( !!( (face)->face_index & 0x7FFF0000L ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_VARIATION\n *\n * @description:\n * A macro that returns true whenever a face object has been altered by\n * @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or\n * @FT_Set_Var_Blend_Coordinates.\n *\n * @since:\n * 2.9\n *\n */\n#define FT_IS_VARIATION( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_VARIATION ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_CID_KEYED\n *\n * @description:\n * A macro that returns true whenever a face object contains a CID-keyed\n * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more details.\n *\n * If this macro is true, all functions defined in @FT_CID_H are\n * available.\n *\n */\n#define FT_IS_CID_KEYED( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_CID_KEYED ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_TRICKY\n *\n * @description:\n * A macro that returns true whenever a face represents a 'tricky' font.\n * See the discussion of @FT_FACE_FLAG_TRICKY for more details.\n *\n */\n#define FT_IS_TRICKY( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_TRICKY ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_COLOR\n *\n * @description:\n * A macro that returns true whenever a face object contains tables for\n * color glyphs.\n *\n * @since:\n * 2.5.1\n *\n */\n#define FT_HAS_COLOR( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_STYLE_FLAG_XXX\n *\n * @description:\n * A list of bit flags to indicate the style of a given face. These are\n * used in the `style_flags` field of @FT_FaceRec.\n *\n * @values:\n * FT_STYLE_FLAG_ITALIC ::\n * The face style is italic or oblique.\n *\n * FT_STYLE_FLAG_BOLD ::\n * The face is bold.\n *\n * @note:\n * The style information as provided by FreeType is very basic. More\n * details are beyond the scope and should be done on a higher level (for\n * example, by analyzing various fields of the 'OS/2' table in SFNT based\n * fonts).\n */\n#define FT_STYLE_FLAG_ITALIC ( 1 << 0 )\n#define FT_STYLE_FLAG_BOLD ( 1 << 1 )\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Size_Internal\n *\n * @description:\n * An opaque handle to an `FT_Size_InternalRec` structure, used to model\n * private data of a given @FT_Size object.\n */\n typedef struct FT_Size_InternalRec_* FT_Size_Internal;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Size_Metrics\n *\n * @description:\n * The size metrics structure gives the metrics of a size object.\n *\n * @fields:\n * x_ppem ::\n * The width of the scaled EM square in pixels, hence the term 'ppem'\n * (pixels per EM). It is also referred to as 'nominal width'.\n *\n * y_ppem ::\n * The height of the scaled EM square in pixels, hence the term 'ppem'\n * (pixels per EM). It is also referred to as 'nominal height'.\n *\n * x_scale ::\n * A 16.16 fractional scaling value to convert horizontal metrics from\n * font units to 26.6 fractional pixels. Only relevant for scalable\n * font formats.\n *\n * y_scale ::\n * A 16.16 fractional scaling value to convert vertical metrics from\n * font units to 26.6 fractional pixels. Only relevant for scalable\n * font formats.\n *\n * ascender ::\n * The ascender in 26.6 fractional pixels, rounded up to an integer\n * value. See @FT_FaceRec for the details.\n *\n * descender ::\n * The descender in 26.6 fractional pixels, rounded down to an integer\n * value. See @FT_FaceRec for the details.\n *\n * height ::\n * The height in 26.6 fractional pixels, rounded to an integer value.\n * See @FT_FaceRec for the details.\n *\n * max_advance ::\n * The maximum advance width in 26.6 fractional pixels, rounded to an\n * integer value. See @FT_FaceRec for the details.\n *\n * @note:\n * The scaling values, if relevant, are determined first during a size\n * changing operation. The remaining fields are then set by the driver.\n * For scalable formats, they are usually set to scaled values of the\n * corresponding fields in @FT_FaceRec. Some values like ascender or\n * descender are rounded for historical reasons; more precise values (for\n * outline fonts) can be derived by scaling the corresponding @FT_FaceRec\n * values manually, with code similar to the following.\n *\n * ```\n * scaled_ascender = FT_MulFix( face->ascender,\n * size_metrics->y_scale );\n * ```\n *\n * Note that due to glyph hinting and the selected rendering mode these\n * values are usually not exact; consequently, they must be treated as\n * unreliable with an error margin of at least one pixel!\n *\n * Indeed, the only way to get the exact metrics is to render _all_\n * glyphs. As this would be a definite performance hit, it is up to\n * client applications to perform such computations.\n *\n * The `FT_Size_Metrics` structure is valid for bitmap fonts also.\n *\n *\n * **TrueType fonts with native bytecode hinting**\n *\n * All applications that handle TrueType fonts with native hinting must\n * be aware that TTFs expect different rounding of vertical font\n * dimensions. The application has to cater for this, especially if it\n * wants to rely on a TTF's vertical data (for example, to properly align\n * box characters vertically).\n *\n * Only the application knows _in advance_ that it is going to use native\n * hinting for TTFs! FreeType, on the other hand, selects the hinting\n * mode not at the time of creating an @FT_Size object but much later,\n * namely while calling @FT_Load_Glyph.\n *\n * Here is some pseudo code that illustrates a possible solution.\n *\n * ```\n * font_format = FT_Get_Font_Format( face );\n *\n * if ( !strcmp( font_format, \"TrueType\" ) &&\n * do_native_bytecode_hinting )\n * {\n * ascender = ROUND( FT_MulFix( face->ascender,\n * size_metrics->y_scale ) );\n * descender = ROUND( FT_MulFix( face->descender,\n * size_metrics->y_scale ) );\n * }\n * else\n * {\n * ascender = size_metrics->ascender;\n * descender = size_metrics->descender;\n * }\n *\n * height = size_metrics->height;\n * max_advance = size_metrics->max_advance;\n * ```\n */\n typedef struct FT_Size_Metrics_\n {\n FT_UShort x_ppem; /* horizontal pixels per EM */\n FT_UShort y_ppem; /* vertical pixels per EM */\n\n FT_Fixed x_scale; /* scaling values used to convert font */\n FT_Fixed y_scale; /* units to 26.6 fractional pixels */\n\n FT_Pos ascender; /* ascender in 26.6 frac. pixels */\n FT_Pos descender; /* descender in 26.6 frac. pixels */\n FT_Pos height; /* text height in 26.6 frac. pixels */\n FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */\n\n } FT_Size_Metrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_SizeRec\n *\n * @description:\n * FreeType root size class structure. A size object models a face\n * object at a given size.\n *\n * @fields:\n * face ::\n * Handle to the parent face object.\n *\n * generic ::\n * A typeless pointer, unused by the FreeType library or any of its\n * drivers. It can be used by client applications to link their own\n * data to each size object.\n *\n * metrics ::\n * Metrics for this size object. This field is read-only.\n */\n typedef struct FT_SizeRec_\n {\n FT_Face face; /* parent face object */\n FT_Generic generic; /* generic pointer for client uses */\n FT_Size_Metrics metrics; /* size metrics */\n FT_Size_Internal internal;\n\n } FT_SizeRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_SubGlyph\n *\n * @description:\n * The subglyph structure is an internal object used to describe\n * subglyphs (for example, in the case of composites).\n *\n * @note:\n * The subglyph implementation is not part of the high-level API, hence\n * the forward structure declaration.\n *\n * You can however retrieve subglyph information with\n * @FT_Get_SubGlyph_Info.\n */\n typedef struct FT_SubGlyphRec_* FT_SubGlyph;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Slot_Internal\n *\n * @description:\n * An opaque handle to an `FT_Slot_InternalRec` structure, used to model\n * private data of a given @FT_GlyphSlot object.\n */\n typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_GlyphSlotRec\n *\n * @description:\n * FreeType root glyph slot class structure. A glyph slot is a container\n * where individual glyphs can be loaded, be they in outline or bitmap\n * format.\n *\n * @fields:\n * library ::\n * A handle to the FreeType library instance this slot belongs to.\n *\n * face ::\n * A handle to the parent face object.\n *\n * next ::\n * In some cases (like some font tools), several glyph slots per face\n * object can be a good thing. As this is rare, the glyph slots are\n * listed through a direct, single-linked list using its `next` field.\n *\n * glyph_index ::\n * [Since 2.10] The glyph index passed as an argument to @FT_Load_Glyph\n * while initializing the glyph slot.\n *\n * generic ::\n * A typeless pointer unused by the FreeType library or any of its\n * drivers. It can be used by client applications to link their own\n * data to each glyph slot object.\n *\n * metrics ::\n * The metrics of the last loaded glyph in the slot. The returned\n * values depend on the last load flags (see the @FT_Load_Glyph API\n * function) and can be expressed either in 26.6 fractional pixels or\n * font units.\n *\n * Note that even when the glyph image is transformed, the metrics are\n * not.\n *\n * linearHoriAdvance ::\n * The advance width of the unhinted glyph. Its value is expressed in\n * 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when\n * loading the glyph. This field can be important to perform correct\n * WYSIWYG layout. Only relevant for outline glyphs.\n *\n * linearVertAdvance ::\n * The advance height of the unhinted glyph. Its value is expressed in\n * 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when\n * loading the glyph. This field can be important to perform correct\n * WYSIWYG layout. Only relevant for outline glyphs.\n *\n * advance ::\n * This shorthand is, depending on @FT_LOAD_IGNORE_TRANSFORM, the\n * transformed (hinted) advance width for the glyph, in 26.6 fractional\n * pixel format. As specified with @FT_LOAD_VERTICAL_LAYOUT, it uses\n * either the `horiAdvance` or the `vertAdvance` value of `metrics`\n * field.\n *\n * format ::\n * This field indicates the format of the image contained in the glyph\n * slot. Typically @FT_GLYPH_FORMAT_BITMAP, @FT_GLYPH_FORMAT_OUTLINE,\n * or @FT_GLYPH_FORMAT_COMPOSITE, but other values are possible.\n *\n * bitmap ::\n * This field is used as a bitmap descriptor. Note that the address\n * and content of the bitmap buffer can change between calls of\n * @FT_Load_Glyph and a few other functions.\n *\n * bitmap_left ::\n * The bitmap's left bearing expressed in integer pixels.\n *\n * bitmap_top ::\n * The bitmap's top bearing expressed in integer pixels. This is the\n * distance from the baseline to the top-most glyph scanline, upwards\n * y~coordinates being **positive**.\n *\n * outline ::\n * The outline descriptor for the current glyph image if its format is\n * @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is loaded, `outline` can be\n * transformed, distorted, emboldened, etc. However, it must not be\n * freed.\n *\n * [Since 2.10.1] If @FT_LOAD_NO_SCALE is set, outline coordinates of\n * OpenType variation fonts for a selected instance are internally\n * handled as 26.6 fractional font units but returned as (rounded)\n * integers, as expected. To get unrounded font units, don't use\n * @FT_LOAD_NO_SCALE but load the glyph with @FT_LOAD_NO_HINTING and\n * scale it, using the font's `units_per_EM` value as the ppem.\n *\n * num_subglyphs ::\n * The number of subglyphs in a composite glyph. This field is only\n * valid for the composite glyph format that should normally only be\n * loaded with the @FT_LOAD_NO_RECURSE flag.\n *\n * subglyphs ::\n * An array of subglyph descriptors for composite glyphs. There are\n * `num_subglyphs` elements in there. Currently internal to FreeType.\n *\n * control_data ::\n * Certain font drivers can also return the control data for a given\n * glyph image (e.g. TrueType bytecode, Type~1 charstrings, etc.).\n * This field is a pointer to such data; it is currently internal to\n * FreeType.\n *\n * control_len ::\n * This is the length in bytes of the control data. Currently internal\n * to FreeType.\n *\n * other ::\n * Reserved.\n *\n * lsb_delta ::\n * The difference between hinted and unhinted left side bearing while\n * auto-hinting is active. Zero otherwise.\n *\n * rsb_delta ::\n * The difference between hinted and unhinted right side bearing while\n * auto-hinting is active. Zero otherwise.\n *\n * @note:\n * If @FT_Load_Glyph is called with default flags (see @FT_LOAD_DEFAULT)\n * the glyph image is loaded in the glyph slot in its native format\n * (e.g., an outline glyph for TrueType and Type~1 formats). [Since 2.9]\n * The prospective bitmap metrics are calculated according to\n * @FT_LOAD_TARGET_XXX and other flags even for the outline glyph, even\n * if @FT_LOAD_RENDER is not set.\n *\n * This image can later be converted into a bitmap by calling\n * @FT_Render_Glyph. This function searches the current renderer for the\n * native image's format, then invokes it.\n *\n * The renderer is in charge of transforming the native image through the\n * slot's face transformation fields, then converting it into a bitmap\n * that is returned in `slot->bitmap`.\n *\n * Note that `slot->bitmap_left` and `slot->bitmap_top` are also used to\n * specify the position of the bitmap relative to the current pen\n * position (e.g., coordinates (0,0) on the baseline). Of course,\n * `slot->format` is also changed to @FT_GLYPH_FORMAT_BITMAP.\n *\n * Here is a small pseudo code fragment that shows how to use `lsb_delta`\n * and `rsb_delta` to do fractional positioning of glyphs:\n *\n * ```\n * FT_GlyphSlot slot = face->glyph;\n * FT_Pos origin_x = 0;\n *\n *\n * for all glyphs do\n * \n *\n * FT_Outline_Translate( slot->outline, origin_x & 63, 0 );\n *\n * \n *\n * \n *\n * origin_x += slot->advance.x;\n * origin_x += slot->lsb_delta - slot->rsb_delta;\n * endfor\n * ```\n *\n * Here is another small pseudo code fragment that shows how to use\n * `lsb_delta` and `rsb_delta` to improve integer positioning of glyphs:\n *\n * ```\n * FT_GlyphSlot slot = face->glyph;\n * FT_Pos origin_x = 0;\n * FT_Pos prev_rsb_delta = 0;\n *\n *\n * for all glyphs do\n * \n *\n * \n *\n * if ( prev_rsb_delta - slot->lsb_delta > 32 )\n * origin_x -= 64;\n * else if ( prev_rsb_delta - slot->lsb_delta < -31 )\n * origin_x += 64;\n *\n * prev_rsb_delta = slot->rsb_delta;\n *\n * \n *\n * origin_x += slot->advance.x;\n * endfor\n * ```\n *\n * If you use strong auto-hinting, you **must** apply these delta values!\n * Otherwise you will experience far too large inter-glyph spacing at\n * small rendering sizes in most cases. Note that it doesn't harm to use\n * the above code for other hinting modes also, since the delta values\n * are zero then.\n */\n typedef struct FT_GlyphSlotRec_\n {\n FT_Library library;\n FT_Face face;\n FT_GlyphSlot next;\n FT_UInt glyph_index; /* new in 2.10; was reserved previously */\n FT_Generic generic;\n\n FT_Glyph_Metrics metrics;\n FT_Fixed linearHoriAdvance;\n FT_Fixed linearVertAdvance;\n FT_Vector advance;\n\n FT_Glyph_Format format;\n\n FT_Bitmap bitmap;\n FT_Int bitmap_left;\n FT_Int bitmap_top;\n\n FT_Outline outline;\n\n FT_UInt num_subglyphs;\n FT_SubGlyph subglyphs;\n\n void* control_data;\n long control_len;\n\n FT_Pos lsb_delta;\n FT_Pos rsb_delta;\n\n void* other;\n\n FT_Slot_Internal internal;\n\n } FT_GlyphSlotRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* F U N C T I O N S */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Init_FreeType\n *\n * @description:\n * Initialize a new FreeType library object. The set of modules that are\n * registered by this function is determined at build time.\n *\n * @output:\n * alibrary ::\n * A handle to a new library object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * In case you want to provide your own memory allocating routines, use\n * @FT_New_Library instead, followed by a call to @FT_Add_Default_Modules\n * (or a series of calls to @FT_Add_Module) and\n * @FT_Set_Default_Properties.\n *\n * See the documentation of @FT_Library and @FT_Face for multi-threading\n * issues.\n *\n * If you need reference-counting (cf. @FT_Reference_Library), use\n * @FT_New_Library and @FT_Done_Library.\n *\n * If compilation option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES` is\n * set, this function reads the `FREETYPE_PROPERTIES` environment\n * variable to control driver properties. See section @properties for\n * more.\n */\n FT_EXPORT( FT_Error )\n FT_Init_FreeType( FT_Library *alibrary );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_FreeType\n *\n * @description:\n * Destroy a given FreeType library object and all of its children,\n * including resources, drivers, faces, sizes, etc.\n *\n * @input:\n * library ::\n * A handle to the target library object.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Done_FreeType( FT_Library library );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_OPEN_XXX\n *\n * @description:\n * A list of bit field constants used within the `flags` field of the\n * @FT_Open_Args structure.\n *\n * @values:\n * FT_OPEN_MEMORY ::\n * This is a memory-based stream.\n *\n * FT_OPEN_STREAM ::\n * Copy the stream from the `stream` field.\n *\n * FT_OPEN_PATHNAME ::\n * Create a new input stream from a C~path name.\n *\n * FT_OPEN_DRIVER ::\n * Use the `driver` field.\n *\n * FT_OPEN_PARAMS ::\n * Use the `num_params` and `params` fields.\n *\n * @note:\n * The `FT_OPEN_MEMORY`, `FT_OPEN_STREAM`, and `FT_OPEN_PATHNAME` flags\n * are mutually exclusive.\n */\n#define FT_OPEN_MEMORY 0x1\n#define FT_OPEN_STREAM 0x2\n#define FT_OPEN_PATHNAME 0x4\n#define FT_OPEN_DRIVER 0x8\n#define FT_OPEN_PARAMS 0x10\n\n\n /* these constants are deprecated; use the corresponding `FT_OPEN_XXX` */\n /* values instead */\n#define ft_open_memory FT_OPEN_MEMORY\n#define ft_open_stream FT_OPEN_STREAM\n#define ft_open_pathname FT_OPEN_PATHNAME\n#define ft_open_driver FT_OPEN_DRIVER\n#define ft_open_params FT_OPEN_PARAMS\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Parameter\n *\n * @description:\n * A simple structure to pass more or less generic parameters to\n * @FT_Open_Face and @FT_Face_Properties.\n *\n * @fields:\n * tag ::\n * A four-byte identification tag.\n *\n * data ::\n * A pointer to the parameter data.\n *\n * @note:\n * The ID and function of parameters are driver-specific. See section\n * @parameter_tags for more information.\n */\n typedef struct FT_Parameter_\n {\n FT_ULong tag;\n FT_Pointer data;\n\n } FT_Parameter;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Open_Args\n *\n * @description:\n * A structure to indicate how to open a new font file or stream. A\n * pointer to such a structure can be used as a parameter for the\n * functions @FT_Open_Face and @FT_Attach_Stream.\n *\n * @fields:\n * flags ::\n * A set of bit flags indicating how to use the structure.\n *\n * memory_base ::\n * The first byte of the file in memory.\n *\n * memory_size ::\n * The size in bytes of the file in memory.\n *\n * pathname ::\n * A pointer to an 8-bit file pathname. The pointer is not owned by\n * FreeType.\n *\n * stream ::\n * A handle to a source stream object.\n *\n * driver ::\n * This field is exclusively used by @FT_Open_Face; it simply specifies\n * the font driver to use for opening the face. If set to `NULL`,\n * FreeType tries to load the face with each one of the drivers in its\n * list.\n *\n * num_params ::\n * The number of extra parameters.\n *\n * params ::\n * Extra parameters passed to the font driver when opening a new face.\n *\n * @note:\n * The stream type is determined by the contents of `flags` that are\n * tested in the following order by @FT_Open_Face:\n *\n * If the @FT_OPEN_MEMORY bit is set, assume that this is a memory file\n * of `memory_size` bytes, located at `memory_address`. The data are not\n * copied, and the client is responsible for releasing and destroying\n * them _after_ the corresponding call to @FT_Done_Face.\n *\n * Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a custom\n * input stream `stream` is used.\n *\n * Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this is a\n * normal file and use `pathname` to open it.\n *\n * If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to open\n * the file with the driver whose handler is in `driver`.\n *\n * If the @FT_OPEN_PARAMS bit is set, the parameters given by\n * `num_params` and `params` is used. They are ignored otherwise.\n *\n * Ideally, both the `pathname` and `params` fields should be tagged as\n * 'const'; this is missing for API backward compatibility. In other\n * words, applications should treat them as read-only.\n */\n typedef struct FT_Open_Args_\n {\n FT_UInt flags;\n const FT_Byte* memory_base;\n FT_Long memory_size;\n FT_String* pathname;\n FT_Stream stream;\n FT_Module driver;\n FT_Int num_params;\n FT_Parameter* params;\n\n } FT_Open_Args;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Face\n *\n * @description:\n * Call @FT_Open_Face to open a font by its pathname.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * pathname ::\n * A path to the font file.\n *\n * face_index ::\n * See @FT_Open_Face for a detailed description of this parameter.\n *\n * @output:\n * aface ::\n * A handle to a new face object. If `face_index` is greater than or\n * equal to zero, it must be non-`NULL`.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Use @FT_Done_Face to destroy the created @FT_Face object (along with\n * its slot and sizes).\n */\n FT_EXPORT( FT_Error )\n FT_New_Face( FT_Library library,\n const char* filepathname,\n FT_Long face_index,\n FT_Face *aface );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Memory_Face\n *\n * @description:\n * Call @FT_Open_Face to open a font that has been loaded into memory.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * file_base ::\n * A pointer to the beginning of the font data.\n *\n * file_size ::\n * The size of the memory chunk used by the font data.\n *\n * face_index ::\n * See @FT_Open_Face for a detailed description of this parameter.\n *\n * @output:\n * aface ::\n * A handle to a new face object. If `face_index` is greater than or\n * equal to zero, it must be non-`NULL`.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You must not deallocate the memory before calling @FT_Done_Face.\n */\n FT_EXPORT( FT_Error )\n FT_New_Memory_Face( FT_Library library,\n const FT_Byte* file_base,\n FT_Long file_size,\n FT_Long face_index,\n FT_Face *aface );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Open_Face\n *\n * @description:\n * Create a face object from a given resource described by @FT_Open_Args.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * args ::\n * A pointer to an `FT_Open_Args` structure that must be filled by the\n * caller.\n *\n * face_index ::\n * This field holds two different values. Bits 0-15 are the index of\n * the face in the font file (starting with value~0). Set it to~0 if\n * there is only one face in the font file.\n *\n * [Since 2.6.1] Bits 16-30 are relevant to GX and OpenType variation\n * fonts only, specifying the named instance index for the current face\n * index (starting with value~1; value~0 makes FreeType ignore named\n * instances). For non-variation fonts, bits 16-30 are ignored.\n * Assuming that you want to access the third named instance in face~4,\n * `face_index` should be set to 0x00030004. If you want to access\n * face~4 without variation handling, simply set `face_index` to\n * value~4.\n *\n * `FT_Open_Face` and its siblings can be used to quickly check whether\n * the font format of a given font resource is supported by FreeType.\n * In general, if the `face_index` argument is negative, the function's\n * return value is~0 if the font format is recognized, or non-zero\n * otherwise. The function allocates a more or less empty face handle\n * in `*aface` (if `aface` isn't `NULL`); the only two useful fields in\n * this special case are `face->num_faces` and `face->style_flags`.\n * For any negative value of `face_index`, `face->num_faces` gives the\n * number of faces within the font file. For the negative value\n * '-(N+1)' (with 'N' a non-negative 16-bit value), bits 16-30 in\n * `face->style_flags` give the number of named instances in face 'N'\n * if we have a variation font (or zero otherwise). After examination,\n * the returned @FT_Face structure should be deallocated with a call to\n * @FT_Done_Face.\n *\n * @output:\n * aface ::\n * A handle to a new face object. If `face_index` is greater than or\n * equal to zero, it must be non-`NULL`.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Unlike FreeType 1.x, this function automatically creates a glyph slot\n * for the face object that can be accessed directly through\n * `face->glyph`.\n *\n * Each new face object created with this function also owns a default\n * @FT_Size object, accessible as `face->size`.\n *\n * One @FT_Library instance can have multiple face objects, this is,\n * @FT_Open_Face and its siblings can be called multiple times using the\n * same `library` argument.\n *\n * See the discussion of reference counters in the description of\n * @FT_Reference_Face.\n *\n * @example:\n * To loop over all faces, use code similar to the following snippet\n * (omitting the error handling).\n *\n * ```\n * ...\n * FT_Face face;\n * FT_Long i, num_faces;\n *\n *\n * error = FT_Open_Face( library, args, -1, &face );\n * if ( error ) { ... }\n *\n * num_faces = face->num_faces;\n * FT_Done_Face( face );\n *\n * for ( i = 0; i < num_faces; i++ )\n * {\n * ...\n * error = FT_Open_Face( library, args, i, &face );\n * ...\n * FT_Done_Face( face );\n * ...\n * }\n * ```\n *\n * To loop over all valid values for `face_index`, use something similar\n * to the following snippet, again without error handling. The code\n * accesses all faces immediately (thus only a single call of\n * `FT_Open_Face` within the do-loop), with and without named instances.\n *\n * ```\n * ...\n * FT_Face face;\n *\n * FT_Long num_faces = 0;\n * FT_Long num_instances = 0;\n *\n * FT_Long face_idx = 0;\n * FT_Long instance_idx = 0;\n *\n *\n * do\n * {\n * FT_Long id = ( instance_idx << 16 ) + face_idx;\n *\n *\n * error = FT_Open_Face( library, args, id, &face );\n * if ( error ) { ... }\n *\n * num_faces = face->num_faces;\n * num_instances = face->style_flags >> 16;\n *\n * ...\n *\n * FT_Done_Face( face );\n *\n * if ( instance_idx < num_instances )\n * instance_idx++;\n * else\n * {\n * face_idx++;\n * instance_idx = 0;\n * }\n *\n * } while ( face_idx < num_faces )\n * ```\n */\n FT_EXPORT( FT_Error )\n FT_Open_Face( FT_Library library,\n const FT_Open_Args* args,\n FT_Long face_index,\n FT_Face *aface );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Attach_File\n *\n * @description:\n * Call @FT_Attach_Stream to attach a file.\n *\n * @inout:\n * face ::\n * The target face object.\n *\n * @input:\n * filepathname ::\n * The pathname.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Attach_File( FT_Face face,\n const char* filepathname );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Attach_Stream\n *\n * @description:\n * 'Attach' data to a face object. Normally, this is used to read\n * additional information for the face object. For example, you can\n * attach an AFM file that comes with a Type~1 font to get the kerning\n * values and other metrics.\n *\n * @inout:\n * face ::\n * The target face object.\n *\n * @input:\n * parameters ::\n * A pointer to @FT_Open_Args that must be filled by the caller.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The meaning of the 'attach' (i.e., what really happens when the new\n * file is read) is not fixed by FreeType itself. It really depends on\n * the font format (and thus the font driver).\n *\n * Client applications are expected to know what they are doing when\n * invoking this function. Most drivers simply do not implement file or\n * stream attachments.\n */\n FT_EXPORT( FT_Error )\n FT_Attach_Stream( FT_Face face,\n FT_Open_Args* parameters );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Reference_Face\n *\n * @description:\n * A counter gets initialized to~1 at the time an @FT_Face structure is\n * created. This function increments the counter. @FT_Done_Face then\n * only destroys a face if the counter is~1, otherwise it simply\n * decrements the counter.\n *\n * This function helps in managing life-cycles of structures that\n * reference @FT_Face objects.\n *\n * @input:\n * face ::\n * A handle to a target face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.4.2\n */\n FT_EXPORT( FT_Error )\n FT_Reference_Face( FT_Face face );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Face\n *\n * @description:\n * Discard a given face object, as well as all of its child slots and\n * sizes.\n *\n * @input:\n * face ::\n * A handle to a target face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * See the discussion of reference counters in the description of\n * @FT_Reference_Face.\n */\n FT_EXPORT( FT_Error )\n FT_Done_Face( FT_Face face );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Select_Size\n *\n * @description:\n * Select a bitmap strike. To be more precise, this function sets the\n * scaling factors of the active @FT_Size object in a face so that\n * bitmaps from this particular strike are taken by @FT_Load_Glyph and\n * friends.\n *\n * @inout:\n * face ::\n * A handle to a target face object.\n *\n * @input:\n * strike_index ::\n * The index of the bitmap strike in the `available_sizes` field of\n * @FT_FaceRec structure.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * For bitmaps embedded in outline fonts it is common that only a subset\n * of the available glyphs at a given ppem value is available. FreeType\n * silently uses outlines if there is no bitmap for a given glyph index.\n *\n * For GX and OpenType variation fonts, a bitmap strike makes sense only\n * if the default instance is active (this is, no glyph variation takes\n * place); otherwise, FreeType simply ignores bitmap strikes. The same\n * is true for all named instances that are different from the default\n * instance.\n *\n * Don't use this function if you are using the FreeType cache API.\n */\n FT_EXPORT( FT_Error )\n FT_Select_Size( FT_Face face,\n FT_Int strike_index );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Size_Request_Type\n *\n * @description:\n * An enumeration type that lists the supported size request types, i.e.,\n * what input size (in font units) maps to the requested output size (in\n * pixels, as computed from the arguments of @FT_Size_Request).\n *\n * @values:\n * FT_SIZE_REQUEST_TYPE_NOMINAL ::\n * The nominal size. The `units_per_EM` field of @FT_FaceRec is used\n * to determine both scaling values.\n *\n * This is the standard scaling found in most applications. In\n * particular, use this size request type for TrueType fonts if they\n * provide optical scaling or something similar. Note, however, that\n * `units_per_EM` is a rather abstract value which bears no relation to\n * the actual size of the glyphs in a font.\n *\n * FT_SIZE_REQUEST_TYPE_REAL_DIM ::\n * The real dimension. The sum of the `ascender` and (minus of) the\n * `descender` fields of @FT_FaceRec is used to determine both scaling\n * values.\n *\n * FT_SIZE_REQUEST_TYPE_BBOX ::\n * The font bounding box. The width and height of the `bbox` field of\n * @FT_FaceRec are used to determine the horizontal and vertical\n * scaling value, respectively.\n *\n * FT_SIZE_REQUEST_TYPE_CELL ::\n * The `max_advance_width` field of @FT_FaceRec is used to determine\n * the horizontal scaling value; the vertical scaling value is\n * determined the same way as @FT_SIZE_REQUEST_TYPE_REAL_DIM does.\n * Finally, both scaling values are set to the smaller one. This type\n * is useful if you want to specify the font size for, say, a window of\n * a given dimension and 80x24 cells.\n *\n * FT_SIZE_REQUEST_TYPE_SCALES ::\n * Specify the scaling values directly.\n *\n * @note:\n * The above descriptions only apply to scalable formats. For bitmap\n * formats, the behaviour is up to the driver.\n *\n * See the note section of @FT_Size_Metrics if you wonder how size\n * requesting relates to scaling values.\n */\n typedef enum FT_Size_Request_Type_\n {\n FT_SIZE_REQUEST_TYPE_NOMINAL,\n FT_SIZE_REQUEST_TYPE_REAL_DIM,\n FT_SIZE_REQUEST_TYPE_BBOX,\n FT_SIZE_REQUEST_TYPE_CELL,\n FT_SIZE_REQUEST_TYPE_SCALES,\n\n FT_SIZE_REQUEST_TYPE_MAX\n\n } FT_Size_Request_Type;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Size_RequestRec\n *\n * @description:\n * A structure to model a size request.\n *\n * @fields:\n * type ::\n * See @FT_Size_Request_Type.\n *\n * width ::\n * The desired width, given as a 26.6 fractional point value (with 72pt\n * = 1in).\n *\n * height ::\n * The desired height, given as a 26.6 fractional point value (with\n * 72pt = 1in).\n *\n * horiResolution ::\n * The horizontal resolution (dpi, i.e., pixels per inch). If set to\n * zero, `width` is treated as a 26.6 fractional **pixel** value, which\n * gets internally rounded to an integer.\n *\n * vertResolution ::\n * The vertical resolution (dpi, i.e., pixels per inch). If set to\n * zero, `height` is treated as a 26.6 fractional **pixel** value,\n * which gets internally rounded to an integer.\n *\n * @note:\n * If `width` is zero, the horizontal scaling value is set equal to the\n * vertical scaling value, and vice versa.\n *\n * If `type` is `FT_SIZE_REQUEST_TYPE_SCALES`, `width` and `height` are\n * interpreted directly as 16.16 fractional scaling values, without any\n * further modification, and both `horiResolution` and `vertResolution`\n * are ignored.\n */\n typedef struct FT_Size_RequestRec_\n {\n FT_Size_Request_Type type;\n FT_Long width;\n FT_Long height;\n FT_UInt horiResolution;\n FT_UInt vertResolution;\n\n } FT_Size_RequestRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Size_Request\n *\n * @description:\n * A handle to a size request structure.\n */\n typedef struct FT_Size_RequestRec_ *FT_Size_Request;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Request_Size\n *\n * @description:\n * Resize the scale of the active @FT_Size object in a face.\n *\n * @inout:\n * face ::\n * A handle to a target face object.\n *\n * @input:\n * req ::\n * A pointer to a @FT_Size_RequestRec.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Although drivers may select the bitmap strike matching the request,\n * you should not rely on this if you intend to select a particular\n * bitmap strike. Use @FT_Select_Size instead in that case.\n *\n * The relation between the requested size and the resulting glyph size\n * is dependent entirely on how the size is defined in the source face.\n * The font designer chooses the final size of each glyph relative to\n * this size. For more information refer to\n * 'https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'.\n *\n * Contrary to @FT_Set_Char_Size, this function doesn't have special code\n * to normalize zero-valued widths, heights, or resolutions (which lead\n * to errors in most cases).\n *\n * Don't use this function if you are using the FreeType cache API.\n */\n FT_EXPORT( FT_Error )\n FT_Request_Size( FT_Face face,\n FT_Size_Request req );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Char_Size\n *\n * @description:\n * Call @FT_Request_Size to request the nominal size (in points).\n *\n * @inout:\n * face ::\n * A handle to a target face object.\n *\n * @input:\n * char_width ::\n * The nominal width, in 26.6 fractional points.\n *\n * char_height ::\n * The nominal height, in 26.6 fractional points.\n *\n * horz_resolution ::\n * The horizontal resolution in dpi.\n *\n * vert_resolution ::\n * The vertical resolution in dpi.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * While this function allows fractional points as input values, the\n * resulting ppem value for the given resolution is always rounded to the\n * nearest integer.\n *\n * If either the character width or height is zero, it is set equal to\n * the other value.\n *\n * If either the horizontal or vertical resolution is zero, it is set\n * equal to the other value.\n *\n * A character width or height smaller than 1pt is set to 1pt; if both\n * resolution values are zero, they are set to 72dpi.\n *\n * Don't use this function if you are using the FreeType cache API.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Char_Size( FT_Face face,\n FT_F26Dot6 char_width,\n FT_F26Dot6 char_height,\n FT_UInt horz_resolution,\n FT_UInt vert_resolution );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Pixel_Sizes\n *\n * @description:\n * Call @FT_Request_Size to request the nominal size (in pixels).\n *\n * @inout:\n * face ::\n * A handle to the target face object.\n *\n * @input:\n * pixel_width ::\n * The nominal width, in pixels.\n *\n * pixel_height ::\n * The nominal height, in pixels.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should not rely on the resulting glyphs matching or being\n * constrained to this pixel size. Refer to @FT_Request_Size to\n * understand how requested sizes relate to actual sizes.\n *\n * Don't use this function if you are using the FreeType cache API.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Pixel_Sizes( FT_Face face,\n FT_UInt pixel_width,\n FT_UInt pixel_height );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Load_Glyph\n *\n * @description:\n * Load a glyph into the glyph slot of a face object.\n *\n * @inout:\n * face ::\n * A handle to the target face object where the glyph is loaded.\n *\n * @input:\n * glyph_index ::\n * The index of the glyph in the font file. For CID-keyed fonts\n * (either in PS or in CFF format) this argument specifies the CID\n * value.\n *\n * load_flags ::\n * A flag indicating what to load for this glyph. The @FT_LOAD_XXX\n * constants can be used to control the glyph loading process (e.g.,\n * whether the outline should be scaled, whether to load bitmaps or\n * not, whether to hint the outline, etc).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The loaded glyph may be transformed. See @FT_Set_Transform for the\n * details.\n *\n * For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument` is returned\n * for invalid CID values (this is, for CID values that don't have a\n * corresponding glyph in the font). See the discussion of the\n * @FT_FACE_FLAG_CID_KEYED flag for more details.\n *\n * If you receive `FT_Err_Glyph_Too_Big`, try getting the glyph outline\n * at EM size, then scale it manually and fill it as a graphics\n * operation.\n */\n FT_EXPORT( FT_Error )\n FT_Load_Glyph( FT_Face face,\n FT_UInt glyph_index,\n FT_Int32 load_flags );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Load_Char\n *\n * @description:\n * Load a glyph into the glyph slot of a face object, accessed by its\n * character code.\n *\n * @inout:\n * face ::\n * A handle to a target face object where the glyph is loaded.\n *\n * @input:\n * char_code ::\n * The glyph's character code, according to the current charmap used in\n * the face.\n *\n * load_flags ::\n * A flag indicating what to load for this glyph. The @FT_LOAD_XXX\n * constants can be used to control the glyph loading process (e.g.,\n * whether the outline should be scaled, whether to load bitmaps or\n * not, whether to hint the outline, etc).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph.\n *\n * Many fonts contain glyphs that can't be loaded by this function since\n * its glyph indices are not listed in any of the font's charmaps.\n *\n * If no active cmap is set up (i.e., `face->charmap` is zero), the call\n * to @FT_Get_Char_Index is omitted, and the function behaves identically\n * to @FT_Load_Glyph.\n */\n FT_EXPORT( FT_Error )\n FT_Load_Char( FT_Face face,\n FT_ULong char_code,\n FT_Int32 load_flags );\n\n\n /**********************"}, {"path": "includes/freetype/ftadvanc.h", "language": "code", "loc": 167, "comment_density": 0.862, "code": "/****************************************************************************\n *\n * ftadvanc.h\n *\n * Quick computation of advance widths (specification only).\n *\n * Copyright (C) 2008-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTADVANC_H_\n#define FTADVANC_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * quick_advance\n *\n * @title:\n * Quick retrieval of advance values\n *\n * @abstract:\n * Retrieve horizontal and vertical advance values without processing\n * glyph outlines, if possible.\n *\n * @description:\n * This section contains functions to quickly extract advance values\n * without handling glyph outlines, if possible.\n *\n * @order:\n * FT_Get_Advance\n * FT_Get_Advances\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_ADVANCE_FLAG_FAST_ONLY\n *\n * @description:\n * A bit-flag to be OR-ed with the `flags` parameter of the\n * @FT_Get_Advance and @FT_Get_Advances functions.\n *\n * If set, it indicates that you want these functions to fail if the\n * corresponding hinting mode or font driver doesn't allow for very quick\n * advance computation.\n *\n * Typically, glyphs that are either unscaled, unhinted, bitmapped, or\n * light-hinted can have their advance width computed very quickly.\n *\n * Normal and bytecode hinted modes that require loading, scaling, and\n * hinting of the glyph outline, are extremely slow by comparison.\n */\n#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000L\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Advance\n *\n * @description:\n * Retrieve the advance value of a given glyph outline in an @FT_Face.\n *\n * @input:\n * face ::\n * The source @FT_Face handle.\n *\n * gindex ::\n * The glyph index.\n *\n * load_flags ::\n * A set of bit flags similar to those used when calling\n * @FT_Load_Glyph, used to determine what kind of advances you need.\n * @output:\n * padvance ::\n * The advance value. If scaling is performed (based on the value of\n * `load_flags`), the advance value is in 16.16 format. Otherwise, it\n * is in font units.\n *\n * If @FT_LOAD_VERTICAL_LAYOUT is set, this is the vertical advance\n * corresponding to a vertical layout. Otherwise, it is the horizontal\n * advance in a horizontal layout.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if\n * the corresponding font backend doesn't have a quick way to retrieve\n * the advances.\n *\n * A scaled advance is returned in 16.16 format but isn't transformed by\n * the affine transformation specified by @FT_Set_Transform.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Advance( FT_Face face,\n FT_UInt gindex,\n FT_Int32 load_flags,\n FT_Fixed *padvance );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Advances\n *\n * @description:\n * Retrieve the advance values of several glyph outlines in an @FT_Face.\n *\n * @input:\n * face ::\n * The source @FT_Face handle.\n *\n * start ::\n * The first glyph index.\n *\n * count ::\n * The number of advance values you want to retrieve.\n *\n * load_flags ::\n * A set of bit flags similar to those used when calling\n * @FT_Load_Glyph.\n *\n * @output:\n * padvance ::\n * The advance values. This array, to be provided by the caller, must\n * contain at least `count` elements.\n *\n * If scaling is performed (based on the value of `load_flags`), the\n * advance values are in 16.16 format. Otherwise, they are in font\n * units.\n *\n * If @FT_LOAD_VERTICAL_LAYOUT is set, these are the vertical advances\n * corresponding to a vertical layout. Otherwise, they are the\n * horizontal advances in a horizontal layout.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if\n * the corresponding font backend doesn't have a quick way to retrieve\n * the advances.\n *\n * Scaled advances are returned in 16.16 format but aren't transformed by\n * the affine transformation specified by @FT_Set_Transform.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Advances( FT_Face face,\n FT_UInt start,\n FT_UInt count,\n FT_Int32 load_flags,\n FT_Fixed *padvances );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTADVANC_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftbbox.h", "language": "code", "loc": 81, "comment_density": 0.827, "code": "/****************************************************************************\n *\n * ftbbox.h\n *\n * FreeType exact bbox computation (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This component has a _single_ role: to compute exact outline bounding\n * boxes.\n *\n * It is separated from the rest of the engine for various technical\n * reasons. It may well be integrated in 'ftoutln' later.\n *\n */\n\n\n#ifndef FTBBOX_H_\n#define FTBBOX_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * outline_processing\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Get_BBox\n *\n * @description:\n * Compute the exact bounding box of an outline. This is slower than\n * computing the control box. However, it uses an advanced algorithm\n * that returns _very_ quickly when the two boxes coincide. Otherwise,\n * the outline Bezier arcs are traversed to extract their extrema.\n *\n * @input:\n * outline ::\n * A pointer to the source outline.\n *\n * @output:\n * abbox ::\n * The outline's exact bounding box.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If the font is tricky and the glyph has been loaded with\n * @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get\n * reasonable values for the BBox it is necessary to load the glyph at a\n * large ppem value (so that the hinting instructions can properly shift\n * and scale the subglyphs), then extracting the BBox, which can be\n * eventually converted back to font units.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Get_BBox( FT_Outline* outline,\n FT_BBox *abbox );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTBBOX_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftbdf.h", "language": "code", "loc": 187, "comment_density": 0.807, "code": "/****************************************************************************\n *\n * ftbdf.h\n *\n * FreeType API for accessing BDF-specific strings (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTBDF_H_\n#define FTBDF_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * bdf_fonts\n *\n * @title:\n * BDF and PCF Files\n *\n * @abstract:\n * BDF and PCF specific API.\n *\n * @description:\n * This section contains the declaration of functions specific to BDF and\n * PCF fonts.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * BDF_PropertyType\n *\n * @description:\n * A list of BDF property types.\n *\n * @values:\n * BDF_PROPERTY_TYPE_NONE ::\n * Value~0 is used to indicate a missing property.\n *\n * BDF_PROPERTY_TYPE_ATOM ::\n * Property is a string atom.\n *\n * BDF_PROPERTY_TYPE_INTEGER ::\n * Property is a 32-bit signed integer.\n *\n * BDF_PROPERTY_TYPE_CARDINAL ::\n * Property is a 32-bit unsigned integer.\n */\n typedef enum BDF_PropertyType_\n {\n BDF_PROPERTY_TYPE_NONE = 0,\n BDF_PROPERTY_TYPE_ATOM = 1,\n BDF_PROPERTY_TYPE_INTEGER = 2,\n BDF_PROPERTY_TYPE_CARDINAL = 3\n\n } BDF_PropertyType;\n\n\n /**************************************************************************\n *\n * @type:\n * BDF_Property\n *\n * @description:\n * A handle to a @BDF_PropertyRec structure to model a given BDF/PCF\n * property.\n */\n typedef struct BDF_PropertyRec_* BDF_Property;\n\n\n /**************************************************************************\n *\n * @struct:\n * BDF_PropertyRec\n *\n * @description:\n * This structure models a given BDF/PCF property.\n *\n * @fields:\n * type ::\n * The property type.\n *\n * u.atom ::\n * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be\n * `NULL`, indicating an empty string.\n *\n * u.integer ::\n * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.\n *\n * u.cardinal ::\n * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.\n */\n typedef struct BDF_PropertyRec_\n {\n BDF_PropertyType type;\n union {\n const char* atom;\n FT_Int32 integer;\n FT_UInt32 cardinal;\n\n } u;\n\n } BDF_PropertyRec;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_BDF_Charset_ID\n *\n * @description:\n * Retrieve a BDF font character set identity, according to the BDF\n * specification.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * @output:\n * acharset_encoding ::\n * Charset encoding, as a C~string, owned by the face.\n *\n * acharset_registry ::\n * Charset registry, as a C~string, owned by the face.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with BDF faces, returning an error otherwise.\n */\n FT_EXPORT( FT_Error )\n FT_Get_BDF_Charset_ID( FT_Face face,\n const char* *acharset_encoding,\n const char* *acharset_registry );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_BDF_Property\n *\n * @description:\n * Retrieve a BDF property from a BDF or PCF font file.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * name ::\n * The property name.\n *\n * @output:\n * aproperty ::\n * The property.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function works with BDF _and_ PCF fonts. It returns an error\n * otherwise. It also returns an error if the property is not in the\n * font.\n *\n * A 'property' is a either key-value pair within the STARTPROPERTIES\n * ... ENDPROPERTIES block of a BDF font or a key-value pair from the\n * `info->props` array within a `FontRec` structure of a PCF font.\n *\n * Integer properties are always stored as 'signed' within PCF fonts;\n * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value\n * for BDF fonts only.\n *\n * In case of error, `aproperty->type` is always set to\n * @BDF_PROPERTY_TYPE_NONE.\n */\n FT_EXPORT( FT_Error )\n FT_Get_BDF_Property( FT_Face face,\n const char* prop_name,\n BDF_PropertyRec *aproperty );\n\n /* */\n\nFT_END_HEADER\n\n#endif /* FTBDF_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftbitmap.h", "language": "code", "loc": 298, "comment_density": 0.859, "code": "/****************************************************************************\n *\n * ftbitmap.h\n *\n * FreeType utility functions for bitmaps (specification).\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTBITMAP_H_\n#define FTBITMAP_H_\n\n\n#include \n#include FT_FREETYPE_H\n#include FT_COLOR_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * bitmap_handling\n *\n * @title:\n * Bitmap Handling\n *\n * @abstract:\n * Handling FT_Bitmap objects.\n *\n * @description:\n * This section contains functions for handling @FT_Bitmap objects,\n * automatically adjusting the target's bitmap buffer size as needed.\n *\n * Note that none of the functions changes the bitmap's 'flow' (as\n * indicated by the sign of the `pitch` field in @FT_Bitmap).\n *\n * To set the flow, assign an appropriate positive or negative value to\n * the `pitch` field of the target @FT_Bitmap object after calling\n * @FT_Bitmap_Init but before calling any of the other functions\n * described here.\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Init\n *\n * @description:\n * Initialize a pointer to an @FT_Bitmap structure.\n *\n * @inout:\n * abitmap ::\n * A pointer to the bitmap structure.\n *\n * @note:\n * A deprecated name for the same function is `FT_Bitmap_New`.\n */\n FT_EXPORT( void )\n FT_Bitmap_Init( FT_Bitmap *abitmap );\n\n\n /* deprecated */\n FT_EXPORT( void )\n FT_Bitmap_New( FT_Bitmap *abitmap );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Copy\n *\n * @description:\n * Copy a bitmap into another one.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * source ::\n * A handle to the source bitmap.\n *\n * @output:\n * target ::\n * A handle to the target bitmap.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * `source->buffer` and `target->buffer` must neither be equal nor\n * overlap.\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Copy( FT_Library library,\n const FT_Bitmap *source,\n FT_Bitmap *target );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Embolden\n *\n * @description:\n * Embolden a bitmap. The new bitmap will be about `xStrength` pixels\n * wider and `yStrength` pixels higher. The left and bottom borders are\n * kept unchanged.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * xStrength ::\n * How strong the glyph is emboldened horizontally. Expressed in 26.6\n * pixel format.\n *\n * yStrength ::\n * How strong the glyph is emboldened vertically. Expressed in 26.6\n * pixel format.\n *\n * @inout:\n * bitmap ::\n * A handle to the target bitmap.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The current implementation restricts `xStrength` to be less than or\n * equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.\n *\n * If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, you\n * should call @FT_GlyphSlot_Own_Bitmap on the slot first.\n *\n * Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format are\n * converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp).\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Embolden( FT_Library library,\n FT_Bitmap* bitmap,\n FT_Pos xStrength,\n FT_Pos yStrength );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Convert\n *\n * @description:\n * Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp to\n * a bitmap object with depth 8bpp, making the number of used bytes per\n * line (a.k.a. the 'pitch') a multiple of `alignment`.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * source ::\n * The source bitmap.\n *\n * alignment ::\n * The pitch of the bitmap is a multiple of this argument. Common\n * values are 1, 2, or 4.\n *\n * @output:\n * target ::\n * The target bitmap.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * It is possible to call @FT_Bitmap_Convert multiple times without\n * calling @FT_Bitmap_Done (the memory is simply reallocated).\n *\n * Use @FT_Bitmap_Done to finally remove the bitmap object.\n *\n * The `library` argument is taken to have access to FreeType's memory\n * handling functions.\n *\n * `source->buffer` and `target->buffer` must neither be equal nor\n * overlap.\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Convert( FT_Library library,\n const FT_Bitmap *source,\n FT_Bitmap *target,\n FT_Int alignment );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Blend\n *\n * @description:\n * Blend a bitmap onto another bitmap, using a given color.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * source ::\n * The source bitmap, which can have any @FT_Pixel_Mode format.\n *\n * source_offset ::\n * The offset vector to the upper left corner of the source bitmap in\n * 26.6 pixel format. It should represent an integer offset; the\n * function will set the lowest six bits to zero to enforce that.\n *\n * color ::\n * The color used to draw `source` onto `target`.\n *\n * @inout:\n * target ::\n * A handle to an `FT_Bitmap` object. It should be either initialized\n * as empty with a call to @FT_Bitmap_Init, or it should be of type\n * @FT_PIXEL_MODE_BGRA.\n *\n * atarget_offset ::\n * The offset vector to the upper left corner of the target bitmap in\n * 26.6 pixel format. It should represent an integer offset; the\n * function will set the lowest six bits to zero to enforce that.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function doesn't perform clipping.\n *\n * The bitmap in `target` gets allocated or reallocated as needed; the\n * vector `atarget_offset` is updated accordingly.\n *\n * In case of allocation or reallocation, the bitmap's pitch is set to\n * `4 * width`. Both `source` and `target` must have the same bitmap\n * flow (as indicated by the sign of the `pitch` field).\n *\n * `source->buffer` and `target->buffer` must neither be equal nor\n * overlap.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Blend( FT_Library library,\n const FT_Bitmap* source,\n const FT_Vector source_offset,\n FT_Bitmap* target,\n FT_Vector *atarget_offset,\n FT_Color color );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_GlyphSlot_Own_Bitmap\n *\n * @description:\n * Make sure that a glyph slot owns `slot->bitmap`.\n *\n * @input:\n * slot ::\n * The glyph slot.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function is to be used in combination with @FT_Bitmap_Embolden.\n */\n FT_EXPORT( FT_Error )\n FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Done\n *\n * @description:\n * Destroy a bitmap object initialized with @FT_Bitmap_Init.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * bitmap ::\n * The bitmap object to be freed.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The `library` argument is taken to have access to FreeType's memory\n * handling functions.\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Done( FT_Library library,\n FT_Bitmap *bitmap );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTBITMAP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftbzip2.h", "language": "code", "loc": 87, "comment_density": 0.839, "code": "/****************************************************************************\n *\n * ftbzip2.h\n *\n * Bzip2-compressed stream support.\n *\n * Copyright (C) 2010-2020 by\n * Joel Klinghed.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTBZIP2_H_\n#define FTBZIP2_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * bzip2\n *\n * @title:\n * BZIP2 Streams\n *\n * @abstract:\n * Using bzip2-compressed font files.\n *\n * @description:\n * This section contains the declaration of Bzip2-specific functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stream_OpenBzip2\n *\n * @description:\n * Open a new stream to parse bzip2-compressed font files. This is\n * mainly used to support the compressed `*.pcf.bz2` fonts that come with\n * XFree86.\n *\n * @input:\n * stream ::\n * The target embedding stream.\n *\n * source ::\n * The source stream.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source stream must be opened _before_ calling this function.\n *\n * Calling the internal function `FT_Stream_Close` on the new stream will\n * **not** call `FT_Stream_Close` on the source stream. None of the\n * stream objects will be released to the heap.\n *\n * The stream implementation is very basic and resets the decompression\n * process each time seeking backwards is needed within the stream.\n *\n * In certain builds of the library, bzip2 compression recognition is\n * automatically handled when calling @FT_New_Face or @FT_Open_Face.\n * This means that if no font driver is capable of handling the raw\n * compressed file, the library will try to open a bzip2 compressed\n * stream from it and re-open the face with it.\n *\n * This function may return `FT_Err_Unimplemented_Feature` if your build\n * of FreeType was not compiled with bzip2 support.\n */\n FT_EXPORT( FT_Error )\n FT_Stream_OpenBzip2( FT_Stream stream,\n FT_Stream source );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTBZIP2_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftcache.h", "language": "code", "loc": 1002, "comment_density": 0.881, "code": "/****************************************************************************\n *\n * ftcache.h\n *\n * FreeType Cache subsystem (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTCACHE_H_\n#define FTCACHE_H_\n\n\n#include \n#include FT_GLYPH_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * cache_subsystem\n *\n * @title:\n * Cache Sub-System\n *\n * @abstract:\n * How to cache face, size, and glyph data with FreeType~2.\n *\n * @description:\n * This section describes the FreeType~2 cache sub-system, which is used\n * to limit the number of concurrently opened @FT_Face and @FT_Size\n * objects, as well as caching information like character maps and glyph\n * images while limiting their maximum memory usage.\n *\n * Note that all types and functions begin with the `FTC_` prefix.\n *\n * The cache is highly portable and thus doesn't know anything about the\n * fonts installed on your system, or how to access them. This implies\n * the following scheme:\n *\n * First, available or installed font faces are uniquely identified by\n * @FTC_FaceID values, provided to the cache by the client. Note that\n * the cache only stores and compares these values, and doesn't try to\n * interpret them in any way.\n *\n * Second, the cache calls, only when needed, a client-provided function\n * to convert an @FTC_FaceID into a new @FT_Face object. The latter is\n * then completely managed by the cache, including its termination\n * through @FT_Done_Face. To monitor termination of face objects, the\n * finalizer callback in the `generic` field of the @FT_Face object can\n * be used, which might also be used to store the @FTC_FaceID of the\n * face.\n *\n * Clients are free to map face IDs to anything else. The most simple\n * usage is to associate them to a (pathname,face_index) pair that is\n * used to call @FT_New_Face. However, more complex schemes are also\n * possible.\n *\n * Note that for the cache to work correctly, the face ID values must be\n * **persistent**, which means that the contents they point to should not\n * change at runtime, or that their value should not become invalid.\n *\n * If this is unavoidable (e.g., when a font is uninstalled at runtime),\n * you should call @FTC_Manager_RemoveFaceID as soon as possible, to let\n * the cache get rid of any references to the old @FTC_FaceID it may keep\n * internally. Failure to do so will lead to incorrect behaviour or even\n * crashes.\n *\n * To use the cache, start with calling @FTC_Manager_New to create a new\n * @FTC_Manager object, which models a single cache instance. You can\n * then look up @FT_Face and @FT_Size objects with\n * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively.\n *\n * If you want to use the charmap caching, call @FTC_CMapCache_New, then\n * later use @FTC_CMapCache_Lookup to perform the equivalent of\n * @FT_Get_Char_Index, only much faster.\n *\n * If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then\n * later use @FTC_ImageCache_Lookup to retrieve the corresponding\n * @FT_Glyph objects from the cache.\n *\n * If you need lots of small bitmaps, it is much more memory efficient to\n * call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This\n * returns @FTC_SBitRec structures, which are used to store small bitmaps\n * directly. (A small bitmap is one whose metrics and dimensions all fit\n * into 8-bit integers).\n *\n * We hope to also provide a kerning cache in the near future.\n *\n *\n * @order:\n * FTC_Manager\n * FTC_FaceID\n * FTC_Face_Requester\n *\n * FTC_Manager_New\n * FTC_Manager_Reset\n * FTC_Manager_Done\n * FTC_Manager_LookupFace\n * FTC_Manager_LookupSize\n * FTC_Manager_RemoveFaceID\n *\n * FTC_Node\n * FTC_Node_Unref\n *\n * FTC_ImageCache\n * FTC_ImageCache_New\n * FTC_ImageCache_Lookup\n *\n * FTC_SBit\n * FTC_SBitCache\n * FTC_SBitCache_New\n * FTC_SBitCache_Lookup\n *\n * FTC_CMapCache\n * FTC_CMapCache_New\n * FTC_CMapCache_Lookup\n *\n *************************************************************************/\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** BASIC TYPE DEFINITIONS *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_FaceID\n *\n * @description:\n * An opaque pointer type that is used to identity face objects. The\n * contents of such objects is application-dependent.\n *\n * These pointers are typically used to point to a user-defined structure\n * containing a font file path, and face index.\n *\n * @note:\n * Never use `NULL` as a valid @FTC_FaceID.\n *\n * Face IDs are passed by the client to the cache manager that calls,\n * when needed, the @FTC_Face_Requester to translate them into new\n * @FT_Face objects.\n *\n * If the content of a given face ID changes at runtime, or if the value\n * becomes invalid (e.g., when uninstalling a font), you should\n * immediately call @FTC_Manager_RemoveFaceID before any other cache\n * function.\n *\n * Failure to do so will result in incorrect behaviour or even memory\n * leaks and crashes.\n */\n typedef FT_Pointer FTC_FaceID;\n\n\n /**************************************************************************\n *\n * @functype:\n * FTC_Face_Requester\n *\n * @description:\n * A callback function provided by client applications. It is used by\n * the cache manager to translate a given @FTC_FaceID into a new valid\n * @FT_Face object, on demand.\n *\n * @input:\n * face_id ::\n * The face ID to resolve.\n *\n * library ::\n * A handle to a FreeType library object.\n *\n * req_data ::\n * Application-provided request data (see note below).\n *\n * @output:\n * aface ::\n * A new @FT_Face handle.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The third parameter `req_data` is the same as the one passed by the\n * client when @FTC_Manager_New is called.\n *\n * The face requester should not perform funny things on the returned\n * face object, like creating a new @FT_Size for it, or setting a\n * transformation through @FT_Set_Transform!\n */\n typedef FT_Error\n (*FTC_Face_Requester)( FTC_FaceID face_id,\n FT_Library library,\n FT_Pointer req_data,\n FT_Face* aface );\n\n /* */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** CACHE MANAGER OBJECT *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_Manager\n *\n * @description:\n * This object corresponds to one instance of the cache-subsystem. It is\n * used to cache one or more @FT_Face objects, along with corresponding\n * @FT_Size objects.\n *\n * The manager intentionally limits the total number of opened @FT_Face\n * and @FT_Size objects to control memory usage. See the `max_faces` and\n * `max_sizes` parameters of @FTC_Manager_New.\n *\n * The manager is also used to cache 'nodes' of various types while\n * limiting their total memory usage.\n *\n * All limitations are enforced by keeping lists of managed objects in\n * most-recently-used order, and flushing old nodes to make room for new\n * ones.\n */\n typedef struct FTC_ManagerRec_* FTC_Manager;\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_Node\n *\n * @description:\n * An opaque handle to a cache node object. Each cache node is\n * reference-counted. A node with a count of~0 might be flushed out of a\n * full cache whenever a lookup request is performed.\n *\n * If you look up nodes, you have the ability to 'acquire' them, i.e., to\n * increment their reference count. This will prevent the node from\n * being flushed out of the cache until you explicitly 'release' it (see\n * @FTC_Node_Unref).\n *\n * See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup.\n */\n typedef struct FTC_NodeRec_* FTC_Node;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_New\n *\n * @description:\n * Create a new cache manager.\n *\n * @input:\n * library ::\n * The parent FreeType library handle to use.\n *\n * max_faces ::\n * Maximum number of opened @FT_Face objects managed by this cache\n * instance. Use~0 for defaults.\n *\n * max_sizes ::\n * Maximum number of opened @FT_Size objects managed by this cache\n * instance. Use~0 for defaults.\n *\n * max_bytes ::\n * Maximum number of bytes to use for cached data nodes. Use~0 for\n * defaults. Note that this value does not account for managed\n * @FT_Face and @FT_Size objects.\n *\n * requester ::\n * An application-provided callback used to translate face IDs into\n * real @FT_Face objects.\n *\n * req_data ::\n * A generic pointer that is passed to the requester each time it is\n * called (see @FTC_Face_Requester).\n *\n * @output:\n * amanager ::\n * A handle to a new manager object. 0~in case of failure.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FTC_Manager_New( FT_Library library,\n FT_UInt max_faces,\n FT_UInt max_sizes,\n FT_ULong max_bytes,\n FTC_Face_Requester requester,\n FT_Pointer req_data,\n FTC_Manager *amanager );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_Reset\n *\n * @description:\n * Empty a given cache manager. This simply gets rid of all the\n * currently cached @FT_Face and @FT_Size objects within the manager.\n *\n * @inout:\n * manager ::\n * A handle to the manager.\n */\n FT_EXPORT( void )\n FTC_Manager_Reset( FTC_Manager manager );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_Done\n *\n * @description:\n * Destroy a given manager after emptying it.\n *\n * @input:\n * manager ::\n * A handle to the target cache manager object.\n */\n FT_EXPORT( void )\n FTC_Manager_Done( FTC_Manager manager );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_LookupFace\n *\n * @description:\n * Retrieve the @FT_Face object that corresponds to a given face ID\n * through a cache manager.\n *\n * @input:\n * manager ::\n * A handle to the cache manager.\n *\n * face_id ::\n * The ID of the face object.\n *\n * @output:\n * aface ::\n * A handle to the face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The returned @FT_Face object is always owned by the manager. You\n * should never try to discard it yourself.\n *\n * The @FT_Face object doesn't necessarily have a current size object\n * (i.e., face->size can be~0). If you need a specific 'font size', use\n * @FTC_Manager_LookupSize instead.\n *\n * Never change the face's transformation matrix (i.e., never call the\n * @FT_Set_Transform function) on a returned face! If you need to\n * transform glyphs, do it yourself after glyph loading.\n *\n * When you perform a lookup, out-of-memory errors are detected _within_\n * the lookup and force incremental flushes of the cache until enough\n * memory is released for the lookup to succeed.\n *\n * If a lookup fails with `FT_Err_Out_Of_Memory` the cache has already\n * been completely flushed, and still no memory was available for the\n * operation.\n */\n FT_EXPORT( FT_Error )\n FTC_Manager_LookupFace( FTC_Manager manager,\n FTC_FaceID face_id,\n FT_Face *aface );\n\n\n /**************************************************************************\n *\n * @struct:\n * FTC_ScalerRec\n *\n * @description:\n * A structure used to describe a given character size in either pixels\n * or points to the cache manager. See @FTC_Manager_LookupSize.\n *\n * @fields:\n * face_id ::\n * The source face ID.\n *\n * width ::\n * The character width.\n *\n * height ::\n * The character height.\n *\n * pixel ::\n * A Boolean. If 1, the `width` and `height` fields are interpreted as\n * integer pixel character sizes. Otherwise, they are expressed as\n * 1/64th of points.\n *\n * x_res ::\n * Only used when `pixel` is value~0 to indicate the horizontal\n * resolution in dpi.\n *\n * y_res ::\n * Only used when `pixel` is value~0 to indicate the vertical\n * resolution in dpi.\n *\n * @note:\n * This type is mainly used to retrieve @FT_Size objects through the\n * cache manager.\n */\n typedef struct FTC_ScalerRec_\n {\n FTC_FaceID face_id;\n FT_UInt width;\n FT_UInt height;\n FT_Int pixel;\n FT_UInt x_res;\n FT_UInt y_res;\n\n } FTC_ScalerRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FTC_Scaler\n *\n * @description:\n * A handle to an @FTC_ScalerRec structure.\n */\n typedef struct FTC_ScalerRec_* FTC_Scaler;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_LookupSize\n *\n * @description:\n * Retrieve the @FT_Size object that corresponds to a given\n * @FTC_ScalerRec pointer through a cache manager.\n *\n * @input:\n * manager ::\n * A handle to the cache manager.\n *\n * scaler ::\n * A scaler handle.\n *\n * @output:\n * asize ::\n * A handle to the size object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The returned @FT_Size object is always owned by the manager. You\n * should never try to discard it by yourself.\n *\n * You can access the parent @FT_Face object simply as `size->face` if\n * you need it. Note that this object is also owned by the manager.\n *\n * @note:\n * When you perform a lookup, out-of-memory errors are detected _within_\n * the lookup and force incremental flushes of the cache until enough\n * memory is released for the lookup to succeed.\n *\n * If a lookup fails with `FT_Err_Out_Of_Memory` the cache has already\n * been completely flushed, and still no memory is available for the\n * operation.\n */\n FT_EXPORT( FT_Error )\n FTC_Manager_LookupSize( FTC_Manager manager,\n FTC_Scaler scaler,\n FT_Size *asize );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Node_Unref\n *\n * @description:\n * Decrement a cache node's internal reference count. When the count\n * reaches 0, it is not destroyed but becomes eligible for subsequent\n * cache flushes.\n *\n * @input:\n * node ::\n * The cache node handle.\n *\n * manager ::\n * The cache manager handle.\n */\n FT_EXPORT( void )\n FTC_Node_Unref( FTC_Node node,\n FTC_Manager manager );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_RemoveFaceID\n *\n * @description:\n * A special function used to indicate to the cache manager that a given\n * @FTC_FaceID is no longer valid, either because its content changed, or\n * because it was deallocated or uninstalled.\n *\n * @input:\n * manager ::\n * The cache manager handle.\n *\n * face_id ::\n * The @FTC_FaceID to be removed.\n *\n * @note:\n * This function flushes all nodes from the cache corresponding to this\n * `face_id`, with the exception of nodes with a non-null reference\n * count.\n *\n * Such nodes are however modified internally so as to never appear in\n * later lookups with the same `face_id` value, and to be immediately\n * destroyed when released by all their users.\n *\n */\n FT_EXPORT( void )\n FTC_Manager_RemoveFaceID( FTC_Manager manager,\n FTC_FaceID face_id );\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_CMapCache\n *\n * @description:\n * An opaque handle used to model a charmap cache. This cache is to hold\n * character codes -> glyph indices mappings.\n *\n */\n typedef struct FTC_CMapCacheRec_* FTC_CMapCache;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_CMapCache_New\n *\n * @description:\n * Create a new charmap cache.\n *\n * @input:\n * manager ::\n * A handle to the cache manager.\n *\n * @output:\n * acache ::\n * A new cache handle. `NULL` in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Like all other caches, this one will be destroyed with the cache\n * manager.\n *\n */\n FT_EXPORT( FT_Error )\n FTC_CMapCache_New( FTC_Manager manager,\n FTC_CMapCache *acache );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_CMapCache_Lookup\n *\n * @description:\n * Translate a character code into a glyph index, using the charmap\n * cache.\n *\n * @input:\n * cache ::\n * A charmap cache handle.\n *\n * face_id ::\n * The source face ID.\n *\n * cmap_index ::\n * The index of the charmap in the source face. Any negative value\n * means to use the cache @FT_Face's default charmap.\n *\n * char_code ::\n * The character code (in the corresponding charmap).\n *\n * @return:\n * Glyph index. 0~means 'no glyph'.\n *\n */\n FT_EXPORT( FT_UInt )\n FTC_CMapCache_Lookup( FTC_CMapCache cache,\n FTC_FaceID face_id,\n FT_Int cmap_index,\n FT_UInt32 char_code );\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** IMAGE CACHE OBJECT *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * FTC_ImageTypeRec\n *\n * @description:\n * A structure used to model the type of images in a glyph cache.\n *\n * @fields:\n * face_id ::\n * The face ID.\n *\n * width ::\n * The width in pixels.\n *\n * height ::\n * The height in pixels.\n *\n * flags ::\n * The load flags, as in @FT_Load_Glyph.\n *\n */\n typedef struct FTC_ImageTypeRec_\n {\n FTC_FaceID face_id;\n FT_UInt width;\n FT_UInt height;\n FT_Int32 flags;\n\n } FTC_ImageTypeRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_ImageType\n *\n * @description:\n * A handle to an @FTC_ImageTypeRec structure.\n *\n */\n typedef struct FTC_ImageTypeRec_* FTC_ImageType;\n\n\n /* */\n\n\n#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \\\n ( (d1)->face_id == (d2)->face_id && \\\n (d1)->width == (d2)->width && \\\n (d1)->flags == (d2)->flags )\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_ImageCache\n *\n * @description:\n * A handle to a glyph image cache object. They are designed to hold\n * many distinct glyph images while not exceeding a certain memory\n * threshold.\n */\n typedef struct FTC_ImageCacheRec_* FTC_ImageCache;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_ImageCache_New\n *\n * @description:\n * Create a new glyph image cache.\n *\n * @input:\n * manager ::\n * The parent manager for the image cache.\n *\n * @output:\n * acache ::\n * A handle to the new glyph image cache object.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FTC_ImageCache_New( FTC_Manager manager,\n FTC_ImageCache *acache );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_ImageCache_Lookup\n *\n * @description:\n * Retrieve a given glyph image from a glyph image cache.\n *\n * @input:\n * cache ::\n * A handle to the source glyph image cache.\n *\n * type ::\n * A pointer to a glyph image type descriptor.\n *\n * gindex ::\n * The glyph index to retrieve.\n *\n * @output:\n * aglyph ::\n * The corresponding @FT_Glyph object. 0~in case of failure.\n *\n * anode ::\n * Used to return the address of the corresponding cache node after\n * incrementing its reference count (see note below).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The returned glyph is owned and managed by the glyph image cache.\n * Never try to transform or discard it manually! You can however create\n * a copy with @FT_Glyph_Copy and modify the new one.\n *\n * If `anode` is _not_ `NULL`, it receives the address of the cache node\n * containing the glyph image, after increasing its reference count.\n * This ensures that the node (as well as the @FT_Glyph) will always be\n * kept in the cache until you call @FTC_Node_Unref to 'release' it.\n *\n * If `anode` is `NULL`, the cache node is left unchanged, which means\n * that the @FT_Glyph could be flushed out of the cache on the next call\n * to one of the caching sub-system APIs. Don't assume that it is\n * persistent!\n */\n FT_EXPORT( FT_Error )\n FTC_ImageCache_Lookup( FTC_ImageCache cache,\n FTC_ImageType type,\n FT_UInt gindex,\n FT_Glyph *aglyph,\n FTC_Node *anode );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_ImageCache_LookupScaler\n *\n * @description:\n * A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec to\n * specify the face ID and its size.\n *\n * @input:\n * cache ::\n * A handle to the source glyph image cache.\n *\n * scaler ::\n * A pointer to a scaler descriptor.\n *\n * load_flags ::\n * The corresponding load flags.\n *\n * gindex ::\n * The glyph index to retrieve.\n *\n * @output:\n * aglyph ::\n * The corresponding @FT_Glyph object. 0~in case of failure.\n *\n * anode ::\n * Used to return the address of the corresponding cache node after\n * incrementing its reference count (see note below).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The returned glyph is owned and managed by the glyph image cache.\n * Never try to transform or discard it manually! You can however create\n * a copy with @FT_Glyph_Copy and modify the new one.\n *\n * If `anode` is _not_ `NULL`, it receives the address of the cache node\n * containing the glyph image, after increasing its reference count.\n * This ensures that the node (as well as the @FT_Glyph) will always be\n * kept in the cache until you call @FTC_Node_Unref to 'release' it.\n *\n * If `anode` is `NULL`, the cache node is left unchanged, which means\n * that the @FT_Glyph could be flushed out of the cache on the next call\n * to one of the caching sub-system APIs. Don't assume that it is\n * persistent!\n *\n * Calls to @FT_Set_Char_Size and friends have no effect on cached\n * glyphs; you should always use the FreeType cache API instead.\n */\n FT_EXPORT( FT_Error )\n FTC_ImageCache_LookupScaler( FTC_ImageCache cache,\n FTC_Scaler scaler,\n FT_ULong load_flags,\n FT_UInt gindex,\n FT_Glyph *aglyph,\n FTC_Node *anode );\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_SBit\n *\n * @description:\n * A handle to a small bitmap descriptor. See the @FTC_SBitRec structure\n * for details.\n */\n typedef struct FTC_SBitRec_* FTC_SBit;\n\n\n /**************************************************************************\n *\n * @struct:\n * FTC_SBitRec\n *\n * @description:\n * A very compact structure used to describe a small glyph bitmap.\n *\n * @fields:\n * width ::\n * The bitmap width in pixels.\n *\n * height ::\n * The bitmap height in pixels.\n *\n * left ::\n * The horizontal distance from the pen position to the left bitmap\n * border (a.k.a. 'left side bearing', or 'lsb').\n *\n * top ::\n * The vertical distance from the pen position (on the baseline) to the\n * upper bitmap border (a.k.a. 'top side bearing'). The distance is\n * positive for upwards y~coordinates.\n *\n * format ::\n * The format of the glyph bitmap (monochrome or gray).\n *\n * max_grays ::\n * Maximum gray level value (in the range 1 to~255).\n *\n * pitch ::\n * The number of bytes per bitmap line. May be positive or negative.\n *\n * xadvance ::\n * The horizontal advance width in pixels.\n *\n * yadvance ::\n * The vertical advance height in pixels.\n *\n * buffer ::\n * A pointer to the bitmap pixels.\n */\n typedef struct FTC_SBitRec_\n {\n FT_Byte width;\n FT_Byte height;\n FT_Char left;\n FT_Char top;\n\n FT_Byte format;\n FT_Byte max_grays;\n FT_Short pitch;\n FT_Char xadvance;\n FT_Char yadvance;\n\n FT_Byte* buffer;\n\n } FTC_SBitRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_SBitCache\n *\n * @description:\n * A handle to a small bitmap cache. These are special cache objects\n * used to store small glyph bitmaps (and anti-aliased pixmaps) in a much\n * more efficient way than the traditional glyph image cache implemented\n * by @FTC_ImageCache.\n */\n typedef struct FTC_SBitCacheRec_* FTC_SBitCache;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_SBitCache_New\n *\n * @description:\n * Create a new cache to store small glyph bitmaps.\n *\n * @input:\n * manager ::\n * A handle to the source cache manager.\n *\n * @output:\n * acache ::\n * A handle to the new sbit cache. `NULL` in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FTC_SBitCache_New( FTC_Manager manager,\n FTC_SBitCache *acache );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_SBitCache_Lookup\n *\n * @description:\n * Look up a given small glyph bitmap in a given sbit cache and 'lock' it\n * to prevent its flushing from the cache until needed.\n *\n * @input:\n * cache ::\n * A handle to the source sbit cache.\n *\n * type ::\n * A pointer to the glyph image type descriptor.\n *\n * gindex ::\n * The glyph index.\n *\n * @output:\n * sbit ::\n * A handle to a small bitmap descriptor.\n *\n * anode ::\n * Used to return the address of the corresponding cache node after\n * incrementing its reference count (see note below).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The small bitmap descriptor and its bit buffer are owned by the cache\n * and should never be freed by the application. They might as well\n * disappear from memory on the next cache lookup, so don't treat them as\n * persistent data.\n *\n * The descriptor's `buffer` field is set to~0 to indicate a missing\n * glyph bitmap.\n *\n * If `anode` is _not_ `NULL`, it receives the address of the cache node\n * containing the bitmap, after increasing its reference count. This\n * ensures that the node (as well as the image) will always be kept in\n * the cache until you call @FTC_Node_Unref to 'release' it.\n *\n * If `anode` is `NULL`, the cache node is left unchanged, which means\n * that the bitmap could be flushed out of the cache on the next call to\n * one of the caching sub-system APIs. Don't assume that it is\n * persistent!\n */\n FT_EXPORT( FT_Error )\n FTC_SBitCache_Lookup( FTC_SBitCache cache,\n FTC_ImageType type,\n FT_UInt gindex,\n FTC_SBit *sbit,\n FTC_Node *anode );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_SBitCache_LookupScaler\n *\n * @description:\n * A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec to\n * specify the face ID and its size.\n *\n * @input:\n * cache ::\n * A handle to the source sbit cache.\n *\n * scaler ::\n * A pointer to the scaler descriptor.\n *\n * load_flags ::\n * The corresponding load flags.\n *\n * gindex ::\n * The glyph index.\n *\n * @output:\n * sbit ::\n * A handle to a small bitmap descriptor.\n *\n * anode ::\n * Used to return the address of the corresponding cache node after\n * incrementing its reference count (see note below).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The small bitmap descriptor and its bit buffer are owned by the cache\n * and should never be freed by the application. They might as well\n * disappear from memory on the next cache lookup, so don't treat them as\n * persistent data.\n *\n * The descriptor's `buffer` field is set to~0 to indicate a missing\n * glyph bitmap.\n *\n * If `anode` is _not_ `NULL`, it receives the address of the cache node\n * containing the bitmap, after increasing its reference count. This\n * ensures that the node (as well as the image) will always be kept in\n * the cache until you call @FTC_Node_Unref to 'release' it.\n *\n * If `anode` is `NULL`, the cache node is left unchanged, which means\n * that the bitmap could be flushed out of the cache on the next call to\n * one of the caching sub-system APIs. Don't assume that it is\n * persistent!\n */\n FT_EXPORT( FT_Error )\n FTC_SBitCache_LookupScaler( FTC_SBitCache cache,\n FTC_Scaler scaler,\n FT_ULong load_flags,\n FT_UInt gindex,\n FTC_SBit *sbit,\n FTC_Node *anode );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTCACHE_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftchapters.h", "language": "code", "loc": 129, "comment_density": 1.0, "code": "/****************************************************************************\n *\n * This file defines the structure of the FreeType reference.\n * It is used by the python script that generates the HTML files.\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * general_remarks\n *\n * @title:\n * General Remarks\n *\n * @sections:\n * header_inclusion\n * user_allocation\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * core_api\n *\n * @title:\n * Core API\n *\n * @sections:\n * version\n * basic_types\n * base_interface\n * glyph_variants\n * color_management\n * layer_management\n * glyph_management\n * mac_specific\n * sizes_management\n * header_file_macros\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * format_specific\n *\n * @title:\n * Format-Specific API\n *\n * @sections:\n * multiple_masters\n * truetype_tables\n * type1_tables\n * sfnt_names\n * bdf_fonts\n * cid_fonts\n * pfr_fonts\n * winfnt_fonts\n * font_formats\n * gasp_table\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * module_specific\n *\n * @title:\n * Controlling FreeType Modules\n *\n * @sections:\n * auto_hinter\n * cff_driver\n * t1_cid_driver\n * tt_driver\n * pcf_driver\n * properties\n * parameter_tags\n * lcd_rendering\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * cache_subsystem\n *\n * @title:\n * Cache Sub-System\n *\n * @sections:\n * cache_subsystem\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * support_api\n *\n * @title:\n * Support API\n *\n * @sections:\n * computations\n * list_processing\n * outline_processing\n * quick_advance\n * bitmap_handling\n * raster\n * glyph_stroker\n * system_interface\n * module_management\n * gzip\n * lzw\n * bzip2\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * error_codes\n *\n * @title:\n * Error Codes\n *\n * @sections:\n * error_enumerations\n * error_code_values\n *\n */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftcid.h", "language": "code", "loc": 148, "comment_density": 0.845, "code": "/****************************************************************************\n *\n * ftcid.h\n *\n * FreeType API for accessing CID font information (specification).\n *\n * Copyright (C) 2007-2020 by\n * Dereg Clegg and Michael Toftdal.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTCID_H_\n#define FTCID_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * cid_fonts\n *\n * @title:\n * CID Fonts\n *\n * @abstract:\n * CID-keyed font-specific API.\n *\n * @description:\n * This section contains the declaration of CID-keyed font-specific\n * functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CID_Registry_Ordering_Supplement\n *\n * @description:\n * Retrieve the Registry/Ordering/Supplement triple (also known as the\n * \"R/O/S\") from a CID-keyed font.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * @output:\n * registry ::\n * The registry, as a C~string, owned by the face.\n *\n * ordering ::\n * The ordering, as a C~string, owned by the face.\n *\n * supplement ::\n * The supplement.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with CID faces, returning an error\n * otherwise.\n *\n * @since:\n * 2.3.6\n */\n FT_EXPORT( FT_Error )\n FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,\n const char* *registry,\n const char* *ordering,\n FT_Int *supplement );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CID_Is_Internally_CID_Keyed\n *\n * @description:\n * Retrieve the type of the input face, CID keyed or not. In contrast\n * to the @FT_IS_CID_KEYED macro this function returns successfully also\n * for CID-keyed fonts in an SFNT wrapper.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * @output:\n * is_cid ::\n * The type of the face as an @FT_Bool.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with CID faces and OpenType fonts, returning\n * an error otherwise.\n *\n * @since:\n * 2.3.9\n */\n FT_EXPORT( FT_Error )\n FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,\n FT_Bool *is_cid );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CID_From_Glyph_Index\n *\n * @description:\n * Retrieve the CID of the input glyph index.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * glyph_index ::\n * The input glyph index.\n *\n * @output:\n * cid ::\n * The CID as an @FT_UInt.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with CID faces and OpenType fonts, returning\n * an error otherwise.\n *\n * @since:\n * 2.3.9\n */\n FT_EXPORT( FT_Error )\n FT_Get_CID_From_Glyph_Index( FT_Face face,\n FT_UInt glyph_index,\n FT_UInt *cid );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTCID_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftcolor.h", "language": "code", "loc": 285, "comment_density": 0.87, "code": "/****************************************************************************\n *\n * ftcolor.h\n *\n * FreeType's glyph color management (specification).\n *\n * Copyright (C) 2018-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTCOLOR_H_\n#define FTCOLOR_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * color_management\n *\n * @title:\n * Glyph Color Management\n *\n * @abstract:\n * Retrieving and manipulating OpenType's 'CPAL' table data.\n *\n * @description:\n * The functions described here allow access and manipulation of color\n * palette entries in OpenType's 'CPAL' tables.\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Color\n *\n * @description:\n * This structure models a BGRA color value of a 'CPAL' palette entry.\n *\n * The used color space is sRGB; the colors are not pre-multiplied, and\n * alpha values must be explicitly set.\n *\n * @fields:\n * blue ::\n * Blue value.\n *\n * green ::\n * Green value.\n *\n * red ::\n * Red value.\n *\n * alpha ::\n * Alpha value, giving the red, green, and blue color's opacity.\n *\n * @since:\n * 2.10\n */\n typedef struct FT_Color_\n {\n FT_Byte blue;\n FT_Byte green;\n FT_Byte red;\n FT_Byte alpha;\n\n } FT_Color;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PALETTE_XXX\n *\n * @description:\n * A list of bit field constants used in the `palette_flags` array of the\n * @FT_Palette_Data structure to indicate for which background a palette\n * with a given index is usable.\n *\n * @values:\n * FT_PALETTE_FOR_LIGHT_BACKGROUND ::\n * The palette is appropriate to use when displaying the font on a\n * light background such as white.\n *\n * FT_PALETTE_FOR_DARK_BACKGROUND ::\n * The palette is appropriate to use when displaying the font on a dark\n * background such as black.\n *\n * @since:\n * 2.10\n */\n#define FT_PALETTE_FOR_LIGHT_BACKGROUND 0x01\n#define FT_PALETTE_FOR_DARK_BACKGROUND 0x02\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Palette_Data\n *\n * @description:\n * This structure holds the data of the 'CPAL' table.\n *\n * @fields:\n * num_palettes ::\n * The number of palettes.\n *\n * palette_name_ids ::\n * An optional read-only array of palette name IDs with `num_palettes`\n * elements, corresponding to entries like 'dark' or 'light' in the\n * font's 'name' table.\n *\n * An empty name ID in the 'CPAL' table gets represented as value\n * 0xFFFF.\n *\n * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.\n *\n * palette_flags ::\n * An optional read-only array of palette flags with `num_palettes`\n * elements. Possible values are an ORed combination of\n * @FT_PALETTE_FOR_LIGHT_BACKGROUND and\n * @FT_PALETTE_FOR_DARK_BACKGROUND.\n *\n * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.\n *\n * num_palette_entries ::\n * The number of entries in a single palette. All palettes have the\n * same size.\n *\n * palette_entry_name_ids ::\n * An optional read-only array of palette entry name IDs with\n * `num_palette_entries`. In each palette, entries with the same index\n * have the same function. For example, index~0 might correspond to\n * string 'outline' in the font's 'name' table to indicate that this\n * palette entry is used for outlines, index~1 might correspond to\n * 'fill' to indicate the filling color palette entry, etc.\n *\n * An empty entry name ID in the 'CPAL' table gets represented as value\n * 0xFFFF.\n *\n * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.\n *\n * @note:\n * Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to\n * name strings.\n *\n * Use function @FT_Palette_Select to get the colors associated with a\n * palette entry.\n *\n * @since:\n * 2.10\n */\n typedef struct FT_Palette_Data_ {\n FT_UShort num_palettes;\n const FT_UShort* palette_name_ids;\n const FT_UShort* palette_flags;\n\n FT_UShort num_palette_entries;\n const FT_UShort* palette_entry_name_ids;\n\n } FT_Palette_Data;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Palette_Data_Get\n *\n * @description:\n * Retrieve the face's color palette data.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * @output:\n * apalette ::\n * A pointer to an @FT_Palette_Data structure.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * All arrays in the returned @FT_Palette_Data structure are read-only.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Palette_Data_Get( FT_Face face,\n FT_Palette_Data *apalette );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Palette_Select\n *\n * @description:\n * This function has two purposes.\n *\n * (1) It activates a palette for rendering color glyphs, and\n *\n * (2) it retrieves all (unmodified) color entries of this palette. This\n * function returns a read-write array, which means that a calling\n * application can modify the palette entries on demand.\n *\n * A corollary of (2) is that calling the function, then modifying some\n * values, then calling the function again with the same arguments resets\n * all color entries to the original 'CPAL' values; all user modifications\n * are lost.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * palette_index ::\n * The palette index.\n *\n * @output:\n * apalette ::\n * An array of color entries for a palette with index `palette_index`,\n * having `num_palette_entries` elements (as found in the\n * `FT_Palette_Data` structure). If `apalette` is set to `NULL`, no\n * array gets returned (and no color entries can be modified).\n *\n * In case the font doesn't support color palettes, `NULL` is returned.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The array pointed to by `apalette_entries` is owned and managed by\n * FreeType.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Palette_Select( FT_Face face,\n FT_UShort palette_index,\n FT_Color* *apalette );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Palette_Set_Foreground_Color\n *\n * @description:\n * 'COLR' uses palette index 0xFFFF to indicate a 'text foreground\n * color'. This function sets this value.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * foreground_color ::\n * An `FT_Color` structure to define the text foreground color.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If this function isn't called, the text foreground color is set to\n * white opaque (BGRA value 0xFFFFFFFF) if\n * @FT_PALETTE_FOR_DARK_BACKGROUND is present for the current palette,\n * and black opaque (BGRA value 0x000000FF) otherwise, including the case\n * that no palette types are available in the 'CPAL' table.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Palette_Set_Foreground_Color( FT_Face face,\n FT_Color foreground_color );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTCOLOR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftdriver.h", "language": "code", "loc": 1171, "comment_density": 0.972, "code": "/****************************************************************************\n *\n * ftdriver.h\n *\n * FreeType API for controlling driver modules (specification only).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTDRIVER_H_\n#define FTDRIVER_H_\n\n#include \n#include FT_FREETYPE_H\n#include FT_PARAMETER_TAGS_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * auto_hinter\n *\n * @title:\n * The auto-hinter\n *\n * @abstract:\n * Controlling the auto-hinting module.\n *\n * @description:\n * While FreeType's auto-hinter doesn't expose API functions by itself,\n * it is possible to control its behaviour with @FT_Property_Set and\n * @FT_Property_Get. The following lists the available properties\n * together with the necessary macros and structures.\n *\n * Note that the auto-hinter's module name is 'autofitter' for historical\n * reasons.\n *\n * Available properties are @increase-x-height, @no-stem-darkening\n * (experimental), @darkening-parameters (experimental), @warping\n * (experimental), @glyph-to-script-map (experimental), @fallback-script\n * (experimental), and @default-script (experimental), as documented in\n * the @properties section.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * cff_driver\n *\n * @title:\n * The CFF driver\n *\n * @abstract:\n * Controlling the CFF driver module.\n *\n * @description:\n * While FreeType's CFF driver doesn't expose API functions by itself, it\n * is possible to control its behaviour with @FT_Property_Set and\n * @FT_Property_Get.\n *\n * The CFF driver's module name is 'cff'.\n *\n * Available properties are @hinting-engine, @no-stem-darkening,\n * @darkening-parameters, and @random-seed, as documented in the\n * @properties section.\n *\n *\n * **Hinting and antialiasing principles of the new engine**\n *\n * The rasterizer is positioning horizontal features (e.g., ascender\n * height & x-height, or crossbars) on the pixel grid and minimizing the\n * amount of antialiasing applied to them, while placing vertical\n * features (vertical stems) on the pixel grid without hinting, thus\n * representing the stem position and weight accurately. Sometimes the\n * vertical stems may be only partially black. In this context,\n * 'antialiasing' means that stems are not positioned exactly on pixel\n * borders, causing a fuzzy appearance.\n *\n * There are two principles behind this approach.\n *\n * 1) No hinting in the horizontal direction: Unlike 'superhinted'\n * TrueType, which changes glyph widths to accommodate regular\n * inter-glyph spacing, Adobe's approach is 'faithful to the design' in\n * representing both the glyph width and the inter-glyph spacing designed\n * for the font. This makes the screen display as close as it can be to\n * the result one would get with infinite resolution, while preserving\n * what is considered the key characteristics of each glyph. Note that\n * the distances between unhinted and grid-fitted positions at small\n * sizes are comparable to kerning values and thus would be noticeable\n * (and distracting) while reading if hinting were applied.\n *\n * One of the reasons to not hint horizontally is antialiasing for LCD\n * screens: The pixel geometry of modern displays supplies three vertical\n * subpixels as the eye moves horizontally across each visible pixel. On\n * devices where we can be certain this characteristic is present a\n * rasterizer can take advantage of the subpixels to add increments of\n * weight. In Western writing systems this turns out to be the more\n * critical direction anyway; the weights and spacing of vertical stems\n * (see above) are central to Armenian, Cyrillic, Greek, and Latin type\n * designs. Even when the rasterizer uses greyscale antialiasing instead\n * of color (a necessary compromise when one doesn't know the screen\n * characteristics), the unhinted vertical features preserve the design's\n * weight and spacing much better than aliased type would.\n *\n * 2) Alignment in the vertical direction: Weights and spacing along the\n * y~axis are less critical; what is much more important is the visual\n * alignment of related features (like cap-height and x-height). The\n * sense of alignment for these is enhanced by the sharpness of grid-fit\n * edges, while the cruder vertical resolution (full pixels instead of\n * 1/3 pixels) is less of a problem.\n *\n * On the technical side, horizontal alignment zones for ascender,\n * x-height, and other important height values (traditionally called\n * 'blue zones') as defined in the font are positioned independently,\n * each being rounded to the nearest pixel edge, taking care of overshoot\n * suppression at small sizes, stem darkening, and scaling.\n *\n * Hstems (this is, hint values defined in the font to help align\n * horizontal features) that fall within a blue zone are said to be\n * 'captured' and are aligned to that zone. Uncaptured stems are moved\n * in one of four ways, top edge up or down, bottom edge up or down.\n * Unless there are conflicting hstems, the smallest movement is taken to\n * minimize distortion.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * pcf_driver\n *\n * @title:\n * The PCF driver\n *\n * @abstract:\n * Controlling the PCF driver module.\n *\n * @description:\n * While FreeType's PCF driver doesn't expose API functions by itself, it\n * is possible to control its behaviour with @FT_Property_Set and\n * @FT_Property_Get. Right now, there is a single property\n * @no-long-family-names available if FreeType is compiled with\n * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES.\n *\n * The PCF driver's module name is 'pcf'.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * t1_cid_driver\n *\n * @title:\n * The Type 1 and CID drivers\n *\n * @abstract:\n * Controlling the Type~1 and CID driver modules.\n *\n * @description:\n * It is possible to control the behaviour of FreeType's Type~1 and\n * Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get.\n *\n * Behind the scenes, both drivers use the Adobe CFF engine for hinting;\n * however, the used properties must be specified separately.\n *\n * The Type~1 driver's module name is 'type1'; the CID driver's module\n * name is 't1cid'.\n *\n * Available properties are @hinting-engine, @no-stem-darkening,\n * @darkening-parameters, and @random-seed, as documented in the\n * @properties section.\n *\n * Please see the @cff_driver section for more details on the new hinting\n * engine.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * tt_driver\n *\n * @title:\n * The TrueType driver\n *\n * @abstract:\n * Controlling the TrueType driver module.\n *\n * @description:\n * While FreeType's TrueType driver doesn't expose API functions by\n * itself, it is possible to control its behaviour with @FT_Property_Set\n * and @FT_Property_Get. The following lists the available properties\n * together with the necessary macros and structures.\n *\n * The TrueType driver's module name is 'truetype'.\n *\n * A single property @interpreter-version is available, as documented in\n * the @properties section.\n *\n * We start with a list of definitions, kindly provided by Greg\n * Hitchcock.\n *\n * _Bi-Level Rendering_\n *\n * Monochromatic rendering, exclusively used in the early days of\n * TrueType by both Apple and Microsoft. Microsoft's GDI interface\n * supported hinting of the right-side bearing point, such that the\n * advance width could be non-linear. Most often this was done to\n * achieve some level of glyph symmetry. To enable reasonable\n * performance (e.g., not having to run hinting on all glyphs just to get\n * the widths) there was a bit in the head table indicating if the side\n * bearing was hinted, and additional tables, 'hdmx' and 'LTSH', to cache\n * hinting widths across multiple sizes and device aspect ratios.\n *\n * _Font Smoothing_\n *\n * Microsoft's GDI implementation of anti-aliasing. Not traditional\n * anti-aliasing as the outlines were hinted before the sampling. The\n * widths matched the bi-level rendering.\n *\n * _ClearType Rendering_\n *\n * Technique that uses physical subpixels to improve rendering on LCD\n * (and other) displays. Because of the higher resolution, many methods\n * of improving symmetry in glyphs through hinting the right-side bearing\n * were no longer necessary. This lead to what GDI calls 'natural\n * widths' ClearType, see\n * http://rastertragedy.com/RTRCh4.htm#Sec21. Since hinting\n * has extra resolution, most non-linearity went away, but it is still\n * possible for hints to change the advance widths in this mode.\n *\n * _ClearType Compatible Widths_\n *\n * One of the earliest challenges with ClearType was allowing the\n * implementation in GDI to be selected without requiring all UI and\n * documents to reflow. To address this, a compatible method of\n * rendering ClearType was added where the font hints are executed once\n * to determine the width in bi-level rendering, and then re-run in\n * ClearType, with the difference in widths being absorbed in the font\n * hints for ClearType (mostly in the white space of hints); see\n * http://rastertragedy.com/RTRCh4.htm#Sec20. Somewhat by\n * definition, compatible width ClearType allows for non-linear widths,\n * but only when the bi-level version has non-linear widths.\n *\n * _ClearType Subpixel Positioning_\n *\n * One of the nice benefits of ClearType is the ability to more crisply\n * display fractional widths; unfortunately, the GDI model of integer\n * bitmaps did not support this. However, the WPF and Direct Write\n * frameworks do support fractional widths. DWrite calls this 'natural\n * mode', not to be confused with GDI's 'natural widths'. Subpixel\n * positioning, in the current implementation of Direct Write,\n * unfortunately does not support hinted advance widths, see\n * http://rastertragedy.com/RTRCh4.htm#Sec22. Note that the\n * TrueType interpreter fully allows the advance width to be adjusted in\n * this mode, just the DWrite client will ignore those changes.\n *\n * _ClearType Backward Compatibility_\n *\n * This is a set of exceptions made in the TrueType interpreter to\n * minimize hinting techniques that were problematic with the extra\n * resolution of ClearType; see\n * http://rastertragedy.com/RTRCh4.htm#Sec1 and\n * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx.\n * This technique is not to be confused with ClearType compatible widths.\n * ClearType backward compatibility has no direct impact on changing\n * advance widths, but there might be an indirect impact on disabling\n * some deltas. This could be worked around in backward compatibility\n * mode.\n *\n * _Native ClearType Mode_\n *\n * (Not to be confused with 'natural widths'.) This mode removes all the\n * exceptions in the TrueType interpreter when running with ClearType.\n * Any issues on widths would still apply, though.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * properties\n *\n * @title:\n * Driver properties\n *\n * @abstract:\n * Controlling driver modules.\n *\n * @description:\n * Driver modules can be controlled by setting and unsetting properties,\n * using the functions @FT_Property_Set and @FT_Property_Get. This\n * section documents the available properties, together with auxiliary\n * macros and structures.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_HINTING_XXX\n *\n * @description:\n * A list of constants used for the @hinting-engine property to select\n * the hinting engine for CFF, Type~1, and CID fonts.\n *\n * @values:\n * FT_HINTING_FREETYPE ::\n * Use the old FreeType hinting engine.\n *\n * FT_HINTING_ADOBE ::\n * Use the hinting engine contributed by Adobe.\n *\n * @since:\n * 2.9\n *\n */\n#define FT_HINTING_FREETYPE 0\n#define FT_HINTING_ADOBE 1\n\n /* these constants (introduced in 2.4.12) are deprecated */\n#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE\n#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE\n\n\n /**************************************************************************\n *\n * @property:\n * hinting-engine\n *\n * @description:\n * Thanks to Adobe, which contributed a new hinting (and parsing) engine,\n * an application can select between 'freetype' and 'adobe' if compiled\n * with `CFF_CONFIG_OPTION_OLD_ENGINE`. If this configuration macro\n * isn't defined, 'hinting-engine' does nothing.\n *\n * The same holds for the Type~1 and CID modules if compiled with\n * `T1_CONFIG_OPTION_OLD_ENGINE`.\n *\n * For the 'cff' module, the default engine is 'freetype' if\n * `CFF_CONFIG_OPTION_OLD_ENGINE` is defined, and 'adobe' otherwise.\n *\n * For both the 'type1' and 't1cid' modules, the default engine is\n * 'freetype' if `T1_CONFIG_OPTION_OLD_ENGINE` is defined, and 'adobe'\n * otherwise.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values 'adobe' or 'freetype').\n *\n * @example:\n * The following example code demonstrates how to select Adobe's hinting\n * engine for the 'cff' module (omitting the error handling).\n *\n * ```\n * FT_Library library;\n * FT_UInt hinting_engine = FT_HINTING_ADOBE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"cff\",\n * \"hinting-engine\", &hinting_engine );\n * ```\n *\n * @since:\n * 2.4.12 (for 'cff' module)\n *\n * 2.9 (for 'type1' and 't1cid' modules)\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * no-stem-darkening\n *\n * @description:\n * All glyphs that pass through the auto-hinter will be emboldened unless\n * this property is set to TRUE. The same is true for the CFF, Type~1,\n * and CID font modules if the 'Adobe' engine is selected (which is the\n * default).\n *\n * Stem darkening emboldens glyphs at smaller sizes to make them more\n * readable on common low-DPI screens when using linear alpha blending\n * and gamma correction, see @FT_Render_Glyph. When not using linear\n * alpha blending and gamma correction, glyphs will appear heavy and\n * fuzzy!\n *\n * Gamma correction essentially lightens fonts since shades of grey are\n * shifted to higher pixel values (=~higher brightness) to match the\n * original intention to the reality of our screens. The side-effect is\n * that glyphs 'thin out'. Mac OS~X and Adobe's proprietary font\n * rendering library implement a counter-measure: stem darkening at\n * smaller sizes where shades of gray dominate. By emboldening a glyph\n * slightly in relation to its pixel size, individual pixels get higher\n * coverage of filled-in outlines and are therefore 'blacker'. This\n * counteracts the 'thinning out' of glyphs, making text remain readable\n * at smaller sizes.\n *\n * By default, the Adobe engines for CFF, Type~1, and CID fonts darken\n * stems at smaller sizes, regardless of hinting, to enhance contrast.\n * Setting this property, stem darkening gets switched off.\n *\n * For the auto-hinter, stem-darkening is experimental currently and thus\n * switched off by default (this is, `no-stem-darkening` is set to TRUE\n * by default). Total consistency with the CFF driver is not achieved\n * right now because the emboldening method differs and glyphs must be\n * scaled down on the Y-axis to keep outline points inside their\n * precomputed blue zones. The smaller the size (especially 9ppem and\n * down), the higher the loss of emboldening versus the CFF driver.\n *\n * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values 1 and 0 for 'on' and 'off', respectively). It\n * can also be set per face using @FT_Face_Properties with\n * @FT_PARAM_TAG_STEM_DARKENING.\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_Bool no_stem_darkening = TRUE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"cff\",\n * \"no-stem-darkening\", &no_stem_darkening );\n * ```\n *\n * @since:\n * 2.4.12 (for 'cff' module)\n *\n * 2.6.2 (for 'autofitter' module)\n *\n * 2.9 (for 'type1' and 't1cid' modules)\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * darkening-parameters\n *\n * @description:\n * By default, the Adobe hinting engine, as used by the CFF, Type~1, and\n * CID font drivers, darkens stems as follows (if the `no-stem-darkening`\n * property isn't set):\n *\n * ```\n * stem width <= 0.5px: darkening amount = 0.4px\n * stem width = 1px: darkening amount = 0.275px\n * stem width = 1.667px: darkening amount = 0.275px\n * stem width >= 2.333px: darkening amount = 0px\n * ```\n *\n * and piecewise linear in-between. At configuration time, these four\n * control points can be set with the macro\n * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS`; the CFF, Type~1, and CID\n * drivers share these values. At runtime, the control points can be\n * changed using the `darkening-parameters` property (see the example\n * below that demonstrates this for the Type~1 driver).\n *\n * The x~values give the stem width, and the y~values the darkening\n * amount. The unit is 1000th of pixels. All coordinate values must be\n * positive; the x~values must be monotonically increasing; the y~values\n * must be monotonically decreasing and smaller than or equal to 500\n * (corresponding to half a pixel); the slope of each linear piece must\n * be shallower than -1 (e.g., -.4).\n *\n * The auto-hinter provides this property, too, as an experimental\n * feature. See @no-stem-darkening for more.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable, using eight comma-separated integers without spaces. Here\n * the above example, using `\\` to break the line for readability.\n *\n * ```\n * FREETYPE_PROPERTIES=\\\n * type1:darkening-parameters=500,300,1000,200,1500,100,2000,0\n * ```\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_Int darken_params[8] = { 500, 300, // x1, y1\n * 1000, 200, // x2, y2\n * 1500, 100, // x3, y3\n * 2000, 0 }; // x4, y4\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"type1\",\n * \"darkening-parameters\", darken_params );\n * ```\n *\n * @since:\n * 2.5.1 (for 'cff' module)\n *\n * 2.6.2 (for 'autofitter' module)\n *\n * 2.9 (for 'type1' and 't1cid' modules)\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * random-seed\n *\n * @description:\n * By default, the seed value for the CFF 'random' operator and the\n * similar '0 28 callothersubr pop' command for the Type~1 and CID\n * drivers is set to a random value. However, mainly for debugging\n * purposes, it is often necessary to use a known value as a seed so that\n * the pseudo-random number sequences generated by 'random' are\n * repeatable.\n *\n * The `random-seed` property does that. Its argument is a signed 32bit\n * integer; if the value is zero or negative, the seed given by the\n * `intitialRandomSeed` private DICT operator in a CFF file gets used (or\n * a default value if there is no such operator). If the value is\n * positive, use it instead of `initialRandomSeed`, which is consequently\n * ignored.\n *\n * @note:\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable. It can also be set per face using @FT_Face_Properties with\n * @FT_PARAM_TAG_RANDOM_SEED.\n *\n * @since:\n * 2.8 (for 'cff' module)\n *\n * 2.9 (for 'type1' and 't1cid' modules)\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * no-long-family-names\n *\n * @description:\n * If `PCF_CONFIG_OPTION_LONG_FAMILY_NAMES` is active while compiling\n * FreeType, the PCF driver constructs long family names.\n *\n * There are many PCF fonts just called 'Fixed' which look completely\n * different, and which have nothing to do with each other. When\n * selecting 'Fixed' in KDE or Gnome one gets results that appear rather\n * random, the style changes often if one changes the size and one cannot\n * select some fonts at all. The improve this situation, the PCF module\n * prepends the foundry name (plus a space) to the family name. It also\n * checks whether there are 'wide' characters; all put together, family\n * names like 'Sony Fixed' or 'Misc Fixed Wide' are constructed.\n *\n * If `no-long-family-names` is set, this feature gets switched off.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values 1 and 0 for 'on' and 'off', respectively).\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_Bool no_long_family_names = TRUE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"pcf\",\n * \"no-long-family-names\",\n * &no_long_family_names );\n * ```\n *\n * @since:\n * 2.8\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_INTERPRETER_VERSION_XXX\n *\n * @description:\n * A list of constants used for the @interpreter-version property to\n * select the hinting engine for Truetype fonts.\n *\n * The numeric value in the constant names represents the version number\n * as returned by the 'GETINFO' bytecode instruction.\n *\n * @values:\n * TT_INTERPRETER_VERSION_35 ::\n * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in\n * Windows~98; only grayscale and B/W rasterizing is supported.\n *\n * TT_INTERPRETER_VERSION_38 ::\n * Version~38 corresponds to MS rasterizer v.1.9; it is roughly\n * equivalent to the hinting provided by DirectWrite ClearType (as can\n * be found, for example, in the Internet Explorer~9 running on\n * Windows~7). It is used in FreeType to select the 'Infinality'\n * subpixel hinting code. The code may be removed in a future version.\n *\n * TT_INTERPRETER_VERSION_40 ::\n * Version~40 corresponds to MS rasterizer v.2.1; it is roughly\n * equivalent to the hinting provided by DirectWrite ClearType (as can\n * be found, for example, in Microsoft's Edge Browser on Windows~10).\n * It is used in FreeType to select the 'minimal' subpixel hinting\n * code, a stripped-down and higher performance version of the\n * 'Infinality' code.\n *\n * @note:\n * This property controls the behaviour of the bytecode interpreter and\n * thus how outlines get hinted. It does **not** control how glyph get\n * rasterized! In particular, it does not control subpixel color\n * filtering.\n *\n * If FreeType has not been compiled with the configuration option\n * `TT_CONFIG_OPTION_SUBPIXEL_HINTING`, selecting version~38 or~40 causes\n * an `FT_Err_Unimplemented_Feature` error.\n *\n * Depending on the graphics framework, Microsoft uses different bytecode\n * and rendering engines. As a consequence, the version numbers returned\n * by a call to the 'GETINFO' bytecode instruction are more convoluted\n * than desired.\n *\n * Here are two tables that try to shed some light on the possible values\n * for the MS rasterizer engine, together with the additional features\n * introduced by it.\n *\n * ```\n * GETINFO framework version feature\n * -------------------------------------------------------------------\n * 3 GDI (Win 3.1), v1.0 16-bit, first version\n * TrueImage\n * 33 GDI (Win NT 3.1), v1.5 32-bit\n * HP Laserjet\n * 34 GDI (Win 95) v1.6 font smoothing,\n * new SCANTYPE opcode\n * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET\n * bits in composite glyphs\n * 36 MGDI (Win CE 2) v1.6+ classic ClearType\n * 37 GDI (XP and later), v1.8 ClearType\n * GDI+ old (before Vista)\n * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType,\n * WPF Y-direction ClearType,\n * additional error checking\n * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags\n * in GETINFO opcode,\n * bug fixes\n * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag\n * DWrite (Win 8) in GETINFO opcode,\n * Gray ClearType\n * ```\n *\n * The 'version' field gives a rough orientation only, since some\n * applications provided certain features much earlier (as an example,\n * Microsoft Reader used subpixel and Y-direction ClearType already in\n * Windows 2000). Similarly, updates to a given framework might include\n * improved hinting support.\n *\n * ```\n * version sampling rendering comment\n * x y x y\n * --------------------------------------------------------------\n * v1.0 normal normal B/W B/W bi-level\n * v1.6 high high gray gray grayscale\n * v1.8 high normal color-filter B/W (GDI) ClearType\n * v1.9 high high color-filter gray Color ClearType\n * v2.1 high normal gray B/W Gray ClearType\n * v2.1 high high gray gray Gray ClearType\n * ```\n *\n * Color and Gray ClearType are the two available variants of\n * 'Y-direction ClearType', meaning grayscale rasterization along the\n * Y-direction; the name used in the TrueType specification for this\n * feature is 'symmetric smoothing'. 'Classic ClearType' is the original\n * algorithm used before introducing a modified version in Win~XP.\n * Another name for v1.6's grayscale rendering is 'font smoothing', and\n * 'Color ClearType' is sometimes also called 'DWrite ClearType'. To\n * differentiate between today's Color ClearType and the earlier\n * ClearType variant with B/W rendering along the vertical axis, the\n * latter is sometimes called 'GDI ClearType'.\n *\n * 'Normal' and 'high' sampling describe the (virtual) resolution to\n * access the rasterized outline after the hinting process. 'Normal'\n * means 1 sample per grid line (i.e., B/W). In the current Microsoft\n * implementation, 'high' means an extra virtual resolution of 16x16 (or\n * 16x1) grid lines per pixel for bytecode instructions like 'MIRP'.\n * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid\n * lines for color filtering if Color ClearType is activated.\n *\n * Note that 'Gray ClearType' is essentially the same as v1.6's grayscale\n * rendering. However, the GETINFO instruction handles it differently:\n * v1.6 returns bit~12 (hinting for grayscale), while v2.1 returns\n * bits~13 (hinting for ClearType), 18 (symmetrical smoothing), and~19\n * (Gray ClearType). Also, this mode respects bits 2 and~3 for the\n * version~1 gasp table exclusively (like Color ClearType), while v1.6\n * only respects the values of version~0 (bits 0 and~1).\n *\n * Keep in mind that the features of the above interpreter versions might\n * not map exactly to FreeType features or behavior because it is a\n * fundamentally different library with different internals.\n *\n */\n#define TT_INTERPRETER_VERSION_35 35\n#define TT_INTERPRETER_VERSION_38 38\n#define TT_INTERPRETER_VERSION_40 40\n\n\n /**************************************************************************\n *\n * @property:\n * interpreter-version\n *\n * @description:\n * Currently, three versions are available, two representing the bytecode\n * interpreter with subpixel hinting support (old 'Infinality' code and\n * new stripped-down and higher performance 'minimal' code) and one\n * without, respectively. The default is subpixel support if\n * `TT_CONFIG_OPTION_SUBPIXEL_HINTING` is defined, and no subpixel\n * support otherwise (since it isn't available then).\n *\n * If subpixel hinting is on, many TrueType bytecode instructions behave\n * differently compared to B/W or grayscale rendering (except if 'native\n * ClearType' is selected by the font). Microsoft's main idea is to\n * render at a much increased horizontal resolution, then sampling down\n * the created output to subpixel precision. However, many older fonts\n * are not suited to this and must be specially taken care of by applying\n * (hardcoded) tweaks in Microsoft's interpreter.\n *\n * Details on subpixel hinting and some of the necessary tweaks can be\n * found in Greg Hitchcock's whitepaper at\n * 'https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'.\n * Note that FreeType currently doesn't really 'subpixel hint' (6x1, 6x2,\n * or 6x5 supersampling) like discussed in the paper. Depending on the\n * chosen interpreter, it simply ignores instructions on vertical stems\n * to arrive at very similar results.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values '35', '38', or '40').\n *\n * @example:\n * The following example code demonstrates how to deactivate subpixel\n * hinting (omitting the error handling).\n *\n * ```\n * FT_Library library;\n * FT_Face face;\n * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"truetype\",\n * \"interpreter-version\",\n * &interpreter_version );\n * ```\n *\n * @since:\n * 2.5\n */\n\n\n /**************************************************************************\n *\n * @property:\n * glyph-to-script-map\n *\n * @description:\n * **Experimental only**\n *\n * The auto-hinter provides various script modules to hint glyphs.\n * Examples of supported scripts are Latin or CJK. Before a glyph is\n * auto-hinted, the Unicode character map of the font gets examined, and\n * the script is then determined based on Unicode character ranges, see\n * below.\n *\n * OpenType fonts, however, often provide much more glyphs than character\n * codes (small caps, superscripts, ligatures, swashes, etc.), to be\n * controlled by so-called 'features'. Handling OpenType features can be\n * quite complicated and thus needs a separate library on top of\n * FreeType.\n *\n * The mapping between glyph indices and scripts (in the auto-hinter\n * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an array\n * with `num_glyphs` elements, as found in the font's @FT_Face structure.\n * The `glyph-to-script-map` property returns a pointer to this array,\n * which can be modified as needed. Note that the modification should\n * happen before the first glyph gets processed by the auto-hinter so\n * that the global analysis of the font shapes actually uses the modified\n * mapping.\n *\n * @example:\n * The following example code demonstrates how to access it (omitting the\n * error handling).\n *\n * ```\n * FT_Library library;\n * FT_Face face;\n * FT_Prop_GlyphToScriptMap prop;\n *\n *\n * FT_Init_FreeType( &library );\n * FT_New_Face( library, \"foo.ttf\", 0, &face );\n *\n * prop.face = face;\n *\n * FT_Property_Get( library, \"autofitter\",\n * \"glyph-to-script-map\", &prop );\n *\n * // adjust `prop.map' as needed right here\n *\n * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT );\n * ```\n *\n * @since:\n * 2.4.11\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_AUTOHINTER_SCRIPT_XXX\n *\n * @description:\n * **Experimental only**\n *\n * A list of constants used for the @glyph-to-script-map property to\n * specify the script submodule the auto-hinter should use for hinting a\n * particular glyph.\n *\n * @values:\n * FT_AUTOHINTER_SCRIPT_NONE ::\n * Don't auto-hint this glyph.\n *\n * FT_AUTOHINTER_SCRIPT_LATIN ::\n * Apply the latin auto-hinter. For the auto-hinter, 'latin' is a very\n * broad term, including Cyrillic and Greek also since characters from\n * those scripts share the same design constraints.\n *\n * By default, characters from the following Unicode ranges are\n * assigned to this submodule.\n *\n * ```\n * U+0020 - U+007F // Basic Latin (no control characters)\n * U+00A0 - U+00FF // Latin-1 Supplement (no control characters)\n * U+0100 - U+017F // Latin Extended-A\n * U+0180 - U+024F // Latin Extended-B\n * U+0250 - U+02AF // IPA Extensions\n * U+02B0 - U+02FF // Spacing Modifier Letters\n * U+0300 - U+036F // Combining Diacritical Marks\n * U+0370 - U+03FF // Greek and Coptic\n * U+0400 - U+04FF // Cyrillic\n * U+0500 - U+052F // Cyrillic Supplement\n * U+1D00 - U+1D7F // Phonetic Extensions\n * U+1D80 - U+1DBF // Phonetic Extensions Supplement\n * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement\n * U+1E00 - U+1EFF // Latin Extended Additional\n * U+1F00 - U+1FFF // Greek Extended\n * U+2000 - U+206F // General Punctuation\n * U+2070 - U+209F // Superscripts and Subscripts\n * U+20A0 - U+20CF // Currency Symbols\n * U+2150 - U+218F // Number Forms\n * U+2460 - U+24FF // Enclosed Alphanumerics\n * U+2C60 - U+2C7F // Latin Extended-C\n * U+2DE0 - U+2DFF // Cyrillic Extended-A\n * U+2E00 - U+2E7F // Supplemental Punctuation\n * U+A640 - U+A69F // Cyrillic Extended-B\n * U+A720 - U+A7FF // Latin Extended-D\n * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures)\n * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols\n * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement\n * ```\n *\n * FT_AUTOHINTER_SCRIPT_CJK ::\n * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old\n * Vietnamese, and some other scripts.\n *\n * By default, characters from the following Unicode ranges are\n * assigned to this submodule.\n *\n * ```\n * U+1100 - U+11FF // Hangul Jamo\n * U+2E80 - U+2EFF // CJK Radicals Supplement\n * U+2F00 - U+2FDF // Kangxi Radicals\n * U+2FF0 - U+2FFF // Ideographic Description Characters\n * U+3000 - U+303F // CJK Symbols and Punctuation\n * U+3040 - U+309F // Hiragana\n * U+30A0 - U+30FF // Katakana\n * U+3100 - U+312F // Bopomofo\n * U+3130 - U+318F // Hangul Compatibility Jamo\n * U+3190 - U+319F // Kanbun\n * U+31A0 - U+31BF // Bopomofo Extended\n * U+31C0 - U+31EF // CJK Strokes\n * U+31F0 - U+31FF // Katakana Phonetic Extensions\n * U+3200 - U+32FF // Enclosed CJK Letters and Months\n * U+3300 - U+33FF // CJK Compatibility\n * U+3400 - U+4DBF // CJK Unified Ideographs Extension A\n * U+4DC0 - U+4DFF // Yijing Hexagram Symbols\n * U+4E00 - U+9FFF // CJK Unified Ideographs\n * U+A960 - U+A97F // Hangul Jamo Extended-A\n * U+AC00 - U+D7AF // Hangul Syllables\n * U+D7B0 - U+D7FF // Hangul Jamo Extended-B\n * U+F900 - U+FAFF // CJK Compatibility Ideographs\n * U+FE10 - U+FE1F // Vertical forms\n * U+FE30 - U+FE4F // CJK Compatibility Forms\n * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms\n * U+1B000 - U+1B0FF // Kana Supplement\n * U+1D300 - U+1D35F // Tai Xuan Hing Symbols\n * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement\n * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B\n * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C\n * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D\n * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement\n * ```\n *\n * FT_AUTOHINTER_SCRIPT_INDIC ::\n * Apply the indic auto-hinter, covering all major scripts from the\n * Indian sub-continent and some other related scripts like Thai, Lao,\n * or Tibetan.\n *\n * By default, characters from the following Unicode ranges are\n * assigned to this submodule.\n *\n * ```\n * U+0900 - U+0DFF // Indic Range\n * U+0F00 - U+0FFF // Tibetan\n * U+1900 - U+194F // Limbu\n * U+1B80 - U+1BBF // Sundanese\n * U+A800 - U+A82F // Syloti Nagri\n * U+ABC0 - U+ABFF // Meetei Mayek\n * U+11800 - U+118DF // Sharada\n * ```\n *\n * Note that currently Indic support is rudimentary only, missing blue\n * zone support.\n *\n * @since:\n * 2.4.11\n *\n */\n#define FT_AUTOHINTER_SCRIPT_NONE 0\n#define FT_AUTOHINTER_SCRIPT_LATIN 1\n#define FT_AUTOHINTER_SCRIPT_CJK 2\n#define FT_AUTOHINTER_SCRIPT_INDIC 3\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Prop_GlyphToScriptMap\n *\n * @description:\n * **Experimental only**\n *\n * The data exchange structure for the @glyph-to-script-map property.\n *\n * @since:\n * 2.4.11\n *\n */\n typedef struct FT_Prop_GlyphToScriptMap_\n {\n FT_Face face;\n FT_UShort* map;\n\n } FT_Prop_GlyphToScriptMap;\n\n\n /**************************************************************************\n *\n * @property:\n * fallback-script\n *\n * @description:\n * **Experimental only**\n *\n * If no auto-hinter script module can be assigned to a glyph, a fallback\n * script gets assigned to it (see also the @glyph-to-script-map\n * property). By default, this is @FT_AUTOHINTER_SCRIPT_CJK. Using the\n * `fallback-script` property, this fallback value can be changed.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * It's important to use the right timing for changing this value: The\n * creation of the glyph-to-script map that eventually uses the fallback\n * script value gets triggered either by setting or reading a\n * face-specific property like @glyph-to-script-map, or by auto-hinting\n * any glyph from that face. In particular, if you have already created\n * an @FT_Face structure but not loaded any glyph (using the\n * auto-hinter), a change of the fallback script will affect this face.\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"autofitter\",\n * \"fallback-script\", &fallback_script );\n * ```\n *\n * @since:\n * 2.4.11\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * default-script\n *\n * @description:\n * **Experimental only**\n *\n * If FreeType gets compiled with `FT_CONFIG_OPTION_USE_HARFBUZZ` to make\n * the HarfBuzz library access OpenType features for getting better glyph\n * coverages, this property sets the (auto-fitter) script to be used for\n * the default (OpenType) script data of a font's GSUB table. Features\n * for the default script are intended for all scripts not explicitly\n * handled in GSUB; an example is a 'dlig' feature, containing the\n * combination of the characters 'T', 'E', and 'L' to form a 'TEL'\n * ligature.\n *\n * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the\n * `default-script` property, this default value can be changed.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * It's important to use the right timing for changing this value: The\n * creation of the glyph-to-script map that eventually uses the default\n * script value gets triggered either by setting or reading a\n * face-specific property like @glyph-to-script-map, or by auto-hinting\n * any glyph from that face. In particular, if you have already created\n * an @FT_Face structure but not loaded any glyph (using the\n * auto-hinter), a change of the default script will affect this face.\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"autofitter\",\n * \"default-script\", &default_script );\n * ```\n *\n * @since:\n * 2.5.3\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * increase-x-height\n *\n * @description:\n * For ppem values in the range 6~<= ppem <= `increase-x-height`, round\n * up the font's x~height much more often than normally. If the value is\n * set to~0, which is the default, this feature is switched off. Use\n * this property to improve the legibility of small font sizes if\n * necessary.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * Set this value right after calling @FT_Set_Char_Size, but before\n * loading any glyph (using the auto-hinter).\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_Face face;\n * FT_Prop_IncreaseXHeight prop;\n *\n *\n * FT_Init_FreeType( &library );\n * FT_New_Face( library, \"foo.ttf\", 0, &face );\n * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 );\n *\n * prop.face = face;\n * prop.limit = 14;\n *\n * FT_Property_Set( library, \"autofitter\",\n * \"increase-x-height\", &prop );\n * ```\n *\n * @since:\n * 2.4.11\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Prop_IncreaseXHeight\n *\n * @description:\n * The data exchange structure for the @increase-x-height property.\n *\n */\n typedef struct FT_Prop_IncreaseXHeight_\n {\n FT_Face face;\n FT_UInt limit;\n\n } FT_Prop_IncreaseXHeight;\n\n\n /**************************************************************************\n *\n * @property:\n * warping\n *\n * @description:\n * **Experimental only**\n *\n * If FreeType gets compiled with option `AF_CONFIG_OPTION_USE_WARPER` to\n * activate the warp hinting code in the auto-hinter, this property\n * switches warping on and off.\n *\n * Warping only works in 'normal' auto-hinting mode replacing it. The\n * idea of the code is to slightly scale and shift a glyph along the\n * non-hinted dimension (which is usually the horizontal axis) so that as\n * much of its segments are aligned (more or less) to the grid. To find\n * out a glyph's optimal scaling and shifting value, various parameter\n * combinations are tried and scored.\n *\n * By default, warping is off.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values 1 and 0 for 'on' and 'off', respectively).\n *\n * The warping code can also change advance widths. Have a look at the\n * `lsb_delta` and `rsb_delta` fields in the @FT_GlyphSlotRec structure\n * for details on improving inter-glyph distances while rendering.\n *\n * Since warping is a global property of the auto-hinter it is best to\n * change its value before rendering any face. Otherwise, you should\n * reload all faces that get auto-hinted in 'normal' hinting mode.\n *\n * @example:\n * This example shows how to switch on warping (omitting the error\n * handling).\n *\n * ```\n * FT_Library library;\n * FT_Bool warping = 1;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"autofitter\", \"warping\", &warping );\n * ```\n *\n * @since:\n * 2.6\n *\n */\n\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* FTDRIVER_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/fterrdef.h", "language": "code", "loc": 249, "comment_density": 0.253, "code": "/****************************************************************************\n *\n * fterrdef.h\n *\n * FreeType error codes (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * error_code_values\n *\n * @title:\n * Error Code Values\n *\n * @abstract:\n * All possible error codes returned by FreeType functions.\n *\n * @description:\n * The list below is taken verbatim from the file `fterrdef.h` (loaded\n * automatically by including `FT_FREETYPE_H`). The first argument of the\n * `FT_ERROR_DEF_` macro is the error label; by default, the prefix\n * `FT_Err_` gets added so that you get error names like\n * `FT_Err_Cannot_Open_Resource`. The second argument is the error code,\n * and the last argument an error string, which is not used by FreeType.\n *\n * Within your application you should **only** use error names and\n * **never** its numeric values! The latter might (and actually do)\n * change in forthcoming FreeType versions.\n *\n * Macro `FT_NOERRORDEF_` defines `FT_Err_Ok`, which is always zero. See\n * the 'Error Enumerations' subsection how to automatically generate a\n * list of error strings.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Err_XXX\n *\n */\n\n /* generic errors */\n\n FT_NOERRORDEF_( Ok, 0x00,\n \"no error\" )\n\n FT_ERRORDEF_( Cannot_Open_Resource, 0x01,\n \"cannot open resource\" )\n FT_ERRORDEF_( Unknown_File_Format, 0x02,\n \"unknown file format\" )\n FT_ERRORDEF_( Invalid_File_Format, 0x03,\n \"broken file\" )\n FT_ERRORDEF_( Invalid_Version, 0x04,\n \"invalid FreeType version\" )\n FT_ERRORDEF_( Lower_Module_Version, 0x05,\n \"module version is too low\" )\n FT_ERRORDEF_( Invalid_Argument, 0x06,\n \"invalid argument\" )\n FT_ERRORDEF_( Unimplemented_Feature, 0x07,\n \"unimplemented feature\" )\n FT_ERRORDEF_( Invalid_Table, 0x08,\n \"broken table\" )\n FT_ERRORDEF_( Invalid_Offset, 0x09,\n \"broken offset within table\" )\n FT_ERRORDEF_( Array_Too_Large, 0x0A,\n \"array allocation size too large\" )\n FT_ERRORDEF_( Missing_Module, 0x0B,\n \"missing module\" )\n FT_ERRORDEF_( Missing_Property, 0x0C,\n \"missing property\" )\n\n /* glyph/character errors */\n\n FT_ERRORDEF_( Invalid_Glyph_Index, 0x10,\n \"invalid glyph index\" )\n FT_ERRORDEF_( Invalid_Character_Code, 0x11,\n \"invalid character code\" )\n FT_ERRORDEF_( Invalid_Glyph_Format, 0x12,\n \"unsupported glyph image format\" )\n FT_ERRORDEF_( Cannot_Render_Glyph, 0x13,\n \"cannot render this glyph format\" )\n FT_ERRORDEF_( Invalid_Outline, 0x14,\n \"invalid outline\" )\n FT_ERRORDEF_( Invalid_Composite, 0x15,\n \"invalid composite glyph\" )\n FT_ERRORDEF_( Too_Many_Hints, 0x16,\n \"too many hints\" )\n FT_ERRORDEF_( Invalid_Pixel_Size, 0x17,\n \"invalid pixel size\" )\n\n /* handle errors */\n\n FT_ERRORDEF_( Invalid_Handle, 0x20,\n \"invalid object handle\" )\n FT_ERRORDEF_( Invalid_Library_Handle, 0x21,\n \"invalid library handle\" )\n FT_ERRORDEF_( Invalid_Driver_Handle, 0x22,\n \"invalid module handle\" )\n FT_ERRORDEF_( Invalid_Face_Handle, 0x23,\n \"invalid face handle\" )\n FT_ERRORDEF_( Invalid_Size_Handle, 0x24,\n \"invalid size handle\" )\n FT_ERRORDEF_( Invalid_Slot_Handle, 0x25,\n \"invalid glyph slot handle\" )\n FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26,\n \"invalid charmap handle\" )\n FT_ERRORDEF_( Invalid_Cache_Handle, 0x27,\n \"invalid cache manager handle\" )\n FT_ERRORDEF_( Invalid_Stream_Handle, 0x28,\n \"invalid stream handle\" )\n\n /* driver errors */\n\n FT_ERRORDEF_( Too_Many_Drivers, 0x30,\n \"too many modules\" )\n FT_ERRORDEF_( Too_Many_Extensions, 0x31,\n \"too many extensions\" )\n\n /* memory errors */\n\n FT_ERRORDEF_( Out_Of_Memory, 0x40,\n \"out of memory\" )\n FT_ERRORDEF_( Unlisted_Object, 0x41,\n \"unlisted object\" )\n\n /* stream errors */\n\n FT_ERRORDEF_( Cannot_Open_Stream, 0x51,\n \"cannot open stream\" )\n FT_ERRORDEF_( Invalid_Stream_Seek, 0x52,\n \"invalid stream seek\" )\n FT_ERRORDEF_( Invalid_Stream_Skip, 0x53,\n \"invalid stream skip\" )\n FT_ERRORDEF_( Invalid_Stream_Read, 0x54,\n \"invalid stream read\" )\n FT_ERRORDEF_( Invalid_Stream_Operation, 0x55,\n \"invalid stream operation\" )\n FT_ERRORDEF_( Invalid_Frame_Operation, 0x56,\n \"invalid frame operation\" )\n FT_ERRORDEF_( Nested_Frame_Access, 0x57,\n \"nested frame access\" )\n FT_ERRORDEF_( Invalid_Frame_Read, 0x58,\n \"invalid frame read\" )\n\n /* raster errors */\n\n FT_ERRORDEF_( Raster_Uninitialized, 0x60,\n \"raster uninitialized\" )\n FT_ERRORDEF_( Raster_Corrupted, 0x61,\n \"raster corrupted\" )\n FT_ERRORDEF_( Raster_Overflow, 0x62,\n \"raster overflow\" )\n FT_ERRORDEF_( Raster_Negative_Height, 0x63,\n \"negative height while rastering\" )\n\n /* cache errors */\n\n FT_ERRORDEF_( Too_Many_Caches, 0x70,\n \"too many registered caches\" )\n\n /* TrueType and SFNT errors */\n\n FT_ERRORDEF_( Invalid_Opcode, 0x80,\n \"invalid opcode\" )\n FT_ERRORDEF_( Too_Few_Arguments, 0x81,\n \"too few arguments\" )\n FT_ERRORDEF_( Stack_Overflow, 0x82,\n \"stack overflow\" )\n FT_ERRORDEF_( Code_Overflow, 0x83,\n \"code overflow\" )\n FT_ERRORDEF_( Bad_Argument, 0x84,\n \"bad argument\" )\n FT_ERRORDEF_( Divide_By_Zero, 0x85,\n \"division by zero\" )\n FT_ERRORDEF_( Invalid_Reference, 0x86,\n \"invalid reference\" )\n FT_ERRORDEF_( Debug_OpCode, 0x87,\n \"found debug opcode\" )\n FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88,\n \"found ENDF opcode in execution stream\" )\n FT_ERRORDEF_( Nested_DEFS, 0x89,\n \"nested DEFS\" )\n FT_ERRORDEF_( Invalid_CodeRange, 0x8A,\n \"invalid code range\" )\n FT_ERRORDEF_( Execution_Too_Long, 0x8B,\n \"execution context too long\" )\n FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C,\n \"too many function definitions\" )\n FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D,\n \"too many instruction definitions\" )\n FT_ERRORDEF_( Table_Missing, 0x8E,\n \"SFNT font table missing\" )\n FT_ERRORDEF_( Horiz_Header_Missing, 0x8F,\n \"horizontal header (hhea) table missing\" )\n FT_ERRORDEF_( Locations_Missing, 0x90,\n \"locations (loca) table missing\" )\n FT_ERRORDEF_( Name_Table_Missing, 0x91,\n \"name table missing\" )\n FT_ERRORDEF_( CMap_Table_Missing, 0x92,\n \"character map (cmap) table missing\" )\n FT_ERRORDEF_( Hmtx_Table_Missing, 0x93,\n \"horizontal metrics (hmtx) table missing\" )\n FT_ERRORDEF_( Post_Table_Missing, 0x94,\n \"PostScript (post) table missing\" )\n FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95,\n \"invalid horizontal metrics\" )\n FT_ERRORDEF_( Invalid_CharMap_Format, 0x96,\n \"invalid character map (cmap) format\" )\n FT_ERRORDEF_( Invalid_PPem, 0x97,\n \"invalid ppem value\" )\n FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98,\n \"invalid vertical metrics\" )\n FT_ERRORDEF_( Could_Not_Find_Context, 0x99,\n \"could not find context\" )\n FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A,\n \"invalid PostScript (post) table format\" )\n FT_ERRORDEF_( Invalid_Post_Table, 0x9B,\n \"invalid PostScript (post) table\" )\n FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C,\n \"found FDEF or IDEF opcode in glyf bytecode\" )\n FT_ERRORDEF_( Missing_Bitmap, 0x9D,\n \"missing bitmap in strike\" )\n\n /* CFF, CID, and Type 1 errors */\n\n FT_ERRORDEF_( Syntax_Error, 0xA0,\n \"opcode syntax error\" )\n FT_ERRORDEF_( Stack_Underflow, 0xA1,\n \"argument stack underflow\" )\n FT_ERRORDEF_( Ignore, 0xA2,\n \"ignore\" )\n FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3,\n \"no Unicode glyph name found\" )\n FT_ERRORDEF_( Glyph_Too_Big, 0xA4,\n \"glyph too big for hinting\" )\n\n /* BDF errors */\n\n FT_ERRORDEF_( Missing_Startfont_Field, 0xB0,\n \"`STARTFONT' field missing\" )\n FT_ERRORDEF_( Missing_Font_Field, 0xB1,\n \"`FONT' field missing\" )\n FT_ERRORDEF_( Missing_Size_Field, 0xB2,\n \"`SIZE' field missing\" )\n FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3,\n \"`FONTBOUNDINGBOX' field missing\" )\n FT_ERRORDEF_( Missing_Chars_Field, 0xB4,\n \"`CHARS' field missing\" )\n FT_ERRORDEF_( Missing_Startchar_Field, 0xB5,\n \"`STARTCHAR' field missing\" )\n FT_ERRORDEF_( Missing_Encoding_Field, 0xB6,\n \"`ENCODING' field missing\" )\n FT_ERRORDEF_( Missing_Bbx_Field, 0xB7,\n \"`BBX' field missing\" )\n FT_ERRORDEF_( Bbx_Too_Big, 0xB8,\n \"`BBX' too big\" )\n FT_ERRORDEF_( Corrupted_Font_Header, 0xB9,\n \"Font header corrupted or missing fields\" )\n FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA,\n \"Font glyphs corrupted or missing fields\" )\n\n /* */\n\n\n/* END */\n"}, {"path": "includes/freetype/fterrors.h", "language": "code", "loc": 237, "comment_density": 0.764, "code": "/****************************************************************************\n *\n * fterrors.h\n *\n * FreeType error code handling (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * error_enumerations\n *\n * @title:\n * Error Enumerations\n *\n * @abstract:\n * How to handle errors and error strings.\n *\n * @description:\n * The header file `fterrors.h` (which is automatically included by\n * `freetype.h` defines the handling of FreeType's enumeration\n * constants. It can also be used to generate error message strings\n * with a small macro trick explained below.\n *\n * **Error Formats**\n *\n * The configuration macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` can be\n * defined in `ftoption.h` in order to make the higher byte indicate the\n * module where the error has happened (this is not compatible with\n * standard builds of FreeType~2, however). See the file `ftmoderr.h`\n * for more details.\n *\n * **Error Message Strings**\n *\n * Error definitions are set up with special macros that allow client\n * applications to build a table of error message strings. The strings\n * are not included in a normal build of FreeType~2 to save space (most\n * client applications do not use them).\n *\n * To do so, you have to define the following macros before including\n * this file.\n *\n * ```\n * FT_ERROR_START_LIST\n * ```\n *\n * This macro is called before anything else to define the start of the\n * error list. It is followed by several `FT_ERROR_DEF` calls.\n *\n * ```\n * FT_ERROR_DEF( e, v, s )\n * ```\n *\n * This macro is called to define one single error. 'e' is the error\n * code identifier (e.g., `Invalid_Argument`), 'v' is the error's\n * numerical value, and 's' is the corresponding error string.\n *\n * ```\n * FT_ERROR_END_LIST\n * ```\n *\n * This macro ends the list.\n *\n * Additionally, you have to undefine `FTERRORS_H_` before #including\n * this file.\n *\n * Here is a simple example.\n *\n * ```\n * #undef FTERRORS_H_\n * #define FT_ERRORDEF( e, v, s ) { e, s },\n * #define FT_ERROR_START_LIST {\n * #define FT_ERROR_END_LIST { 0, NULL } };\n *\n * const struct\n * {\n * int err_code;\n * const char* err_msg;\n * } ft_errors[] =\n *\n * #include FT_ERRORS_H\n * ```\n *\n * An alternative to using an array is a switch statement.\n *\n * ```\n * #undef FTERRORS_H_\n * #define FT_ERROR_START_LIST switch ( error_code ) {\n * #define FT_ERRORDEF( e, v, s ) case v: return s;\n * #define FT_ERROR_END_LIST }\n * ```\n *\n * If you use `FT_CONFIG_OPTION_USE_MODULE_ERRORS`, `error_code` should\n * be replaced with `FT_ERROR_BASE(error_code)` in the last example.\n */\n\n /* */\n\n /* In previous FreeType versions we used `__FTERRORS_H__`. However, */\n /* using two successive underscores in a non-system symbol name */\n /* violates the C (and C++) standard, so it was changed to the */\n /* current form. In spite of this, we have to make */\n /* */\n /* ``` */\n /* #undefine __FTERRORS_H__ */\n /* ``` */\n /* */\n /* work for backward compatibility. */\n /* */\n#if !( defined( FTERRORS_H_ ) && defined ( __FTERRORS_H__ ) )\n#define FTERRORS_H_\n#define __FTERRORS_H__\n\n\n /* include module base error codes */\n#include FT_MODULE_ERRORS_H\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** SETUP MACROS *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n\n#undef FT_NEED_EXTERN_C\n\n\n /* FT_ERR_PREFIX is used as a prefix for error identifiers. */\n /* By default, we use `FT_Err_`. */\n /* */\n#ifndef FT_ERR_PREFIX\n#define FT_ERR_PREFIX FT_Err_\n#endif\n\n\n /* FT_ERR_BASE is used as the base for module-specific errors. */\n /* */\n#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS\n\n#ifndef FT_ERR_BASE\n#define FT_ERR_BASE FT_Mod_Err_Base\n#endif\n\n#else\n\n#undef FT_ERR_BASE\n#define FT_ERR_BASE 0\n\n#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */\n\n\n /* If FT_ERRORDEF is not defined, we need to define a simple */\n /* enumeration type. */\n /* */\n#ifndef FT_ERRORDEF\n\n#define FT_INCLUDE_ERR_PROTOS\n\n#define FT_ERRORDEF( e, v, s ) e = v,\n#define FT_ERROR_START_LIST enum {\n#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };\n\n#ifdef __cplusplus\n#define FT_NEED_EXTERN_C\n extern \"C\" {\n#endif\n\n#endif /* !FT_ERRORDEF */\n\n\n /* this macro is used to define an error */\n#define FT_ERRORDEF_( e, v, s ) \\\n FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )\n\n /* this is only used for _Err_Ok, which must be 0! */\n#define FT_NOERRORDEF_( e, v, s ) \\\n FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )\n\n\n#ifdef FT_ERROR_START_LIST\n FT_ERROR_START_LIST\n#endif\n\n\n /* now include the error codes */\n#include FT_ERROR_DEFINITIONS_H\n\n\n#ifdef FT_ERROR_END_LIST\n FT_ERROR_END_LIST\n#endif\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** SIMPLE CLEANUP *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n#ifdef FT_NEED_EXTERN_C\n }\n#endif\n\n#undef FT_ERROR_START_LIST\n#undef FT_ERROR_END_LIST\n\n#undef FT_ERRORDEF\n#undef FT_ERRORDEF_\n#undef FT_NOERRORDEF_\n\n#undef FT_NEED_EXTERN_C\n#undef FT_ERR_BASE\n\n /* FT_ERR_PREFIX is needed internally */\n#ifndef FT2_BUILD_LIBRARY\n#undef FT_ERR_PREFIX\n#endif\n\n /* FT_INCLUDE_ERR_PROTOS: Control if function prototypes should be */\n /* included with `#include FT_ERRORS_H'. This is */\n /* only true where `FT_ERRORDEF` is undefined. */\n /* FT_ERR_PROTOS_DEFINED: Actual multiple-inclusion protection of */\n /* `fterrors.h`. */\n#ifdef FT_INCLUDE_ERR_PROTOS\n#undef FT_INCLUDE_ERR_PROTOS\n\n#ifndef FT_ERR_PROTOS_DEFINED\n#define FT_ERR_PROTOS_DEFINED\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @function:\n * FT_Error_String\n *\n * @description:\n * Retrieve the description of a valid FreeType error code.\n *\n * @input:\n * error_code ::\n * A valid FreeType error code.\n *\n * @return:\n * A C~string or `NULL`, if any error occurred.\n *\n * @note:\n * FreeType has to be compiled with `FT_CONFIG_OPTION_ERROR_STRINGS` or\n * `FT_DEBUG_LEVEL_ERROR` to get meaningful descriptions.\n * 'error_string' will be `NULL` otherwise.\n *\n * Module identification will be ignored:\n *\n * ```c\n * strcmp( FT_Error_String( FT_Err_Unknown_File_Format ),\n * FT_Error_String( BDF_Err_Unknown_File_Format ) ) == 0;\n * ```\n */\n FT_EXPORT( const char* )\n FT_Error_String( FT_Error error_code );\n\nFT_END_HEADER\n\n\n#endif /* FT_ERR_PROTOS_DEFINED */\n\n#endif /* FT_INCLUDE_ERR_PROTOS */\n\n#endif /* !(FTERRORS_H_ && __FTERRORS_H__) */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftfntfmt.h", "language": "code", "loc": 75, "comment_density": 0.8, "code": "/****************************************************************************\n *\n * ftfntfmt.h\n *\n * Support functions for font formats.\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTFNTFMT_H_\n#define FTFNTFMT_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * font_formats\n *\n * @title:\n * Font Formats\n *\n * @abstract:\n * Getting the font format.\n *\n * @description:\n * The single function in this section can be used to get the font format.\n * Note that this information is not needed normally; however, there are\n * special cases (like in PDF devices) where it is important to\n * differentiate, in spite of FreeType's uniform API.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Font_Format\n *\n * @description:\n * Return a string describing the format of a given face. Possible values\n * are 'TrueType', 'Type~1', 'BDF', 'PCF', 'Type~42', 'CID~Type~1', 'CFF',\n * 'PFR', and 'Windows~FNT'.\n *\n * The return value is suitable to be used as an X11 FONT_PROPERTY.\n *\n * @input:\n * face ::\n * Input face handle.\n *\n * @return:\n * Font format string. `NULL` in case of error.\n *\n * @note:\n * A deprecated name for the same function is `FT_Get_X11_Font_Format`.\n */\n FT_EXPORT( const char* )\n FT_Get_Font_Format( FT_Face face );\n\n\n /* deprecated */\n FT_EXPORT( const char* )\n FT_Get_X11_Font_Format( FT_Face face );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTFNTFMT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftgasp.h", "language": "code", "loc": 127, "comment_density": 0.85, "code": "/****************************************************************************\n *\n * ftgasp.h\n *\n * Access of TrueType's 'gasp' table (specification).\n *\n * Copyright (C) 2007-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTGASP_H_\n#define FTGASP_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * gasp_table\n *\n * @title:\n * Gasp Table\n *\n * @abstract:\n * Retrieving TrueType 'gasp' table entries.\n *\n * @description:\n * The function @FT_Get_Gasp can be used to query a TrueType or OpenType\n * font for specific entries in its 'gasp' table, if any. This is mainly\n * useful when implementing native TrueType hinting with the bytecode\n * interpreter to duplicate the Windows text rendering results.\n */\n\n /**************************************************************************\n *\n * @enum:\n * FT_GASP_XXX\n *\n * @description:\n * A list of values and/or bit-flags returned by the @FT_Get_Gasp\n * function.\n *\n * @values:\n * FT_GASP_NO_TABLE ::\n * This special value means that there is no GASP table in this face.\n * It is up to the client to decide what to do.\n *\n * FT_GASP_DO_GRIDFIT ::\n * Grid-fitting and hinting should be performed at the specified ppem.\n * This **really** means TrueType bytecode interpretation. If this bit\n * is not set, no hinting gets applied.\n *\n * FT_GASP_DO_GRAY ::\n * Anti-aliased rendering should be performed at the specified ppem.\n * If not set, do monochrome rendering.\n *\n * FT_GASP_SYMMETRIC_SMOOTHING ::\n * If set, smoothing along multiple axes must be used with ClearType.\n *\n * FT_GASP_SYMMETRIC_GRIDFIT ::\n * Grid-fitting must be used with ClearType's symmetric smoothing.\n *\n * @note:\n * The bit-flags `FT_GASP_DO_GRIDFIT` and `FT_GASP_DO_GRAY` are to be\n * used for standard font rasterization only. Independently of that,\n * `FT_GASP_SYMMETRIC_SMOOTHING` and `FT_GASP_SYMMETRIC_GRIDFIT` are to\n * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT` and\n * `FT_GASP_DO_GRAY` are consequently ignored).\n *\n * 'ClearType' is Microsoft's implementation of LCD rendering, partly\n * protected by patents.\n *\n * @since:\n * 2.3.0\n */\n#define FT_GASP_NO_TABLE -1\n#define FT_GASP_DO_GRIDFIT 0x01\n#define FT_GASP_DO_GRAY 0x02\n#define FT_GASP_SYMMETRIC_GRIDFIT 0x04\n#define FT_GASP_SYMMETRIC_SMOOTHING 0x08\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Gasp\n *\n * @description:\n * For a TrueType or OpenType font file, return the rasterizer behaviour\n * flags from the font's 'gasp' table corresponding to a given character\n * pixel size.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * ppem ::\n * The vertical character pixel size.\n *\n * @return:\n * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no\n * 'gasp' table in the face.\n *\n * @note:\n * If you want to use the MM functionality of OpenType variation fonts\n * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this\n * function **after** setting an instance since the return values can\n * change.\n *\n * @since:\n * 2.3.0\n */\n FT_EXPORT( FT_Int )\n FT_Get_Gasp( FT_Face face,\n FT_UInt ppem );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGASP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftglyph.h", "language": "code", "loc": 602, "comment_density": 0.872, "code": "/****************************************************************************\n *\n * ftglyph.h\n *\n * FreeType convenience functions to handle glyphs (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file contains the definition of several convenience functions that\n * can be used by client applications to easily retrieve glyph bitmaps and\n * outlines from a given face.\n *\n * These functions should be optional if you are writing a font server or\n * text layout engine on top of FreeType. However, they are pretty handy\n * for many other simple uses of the library.\n *\n */\n\n\n#ifndef FTGLYPH_H_\n#define FTGLYPH_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * glyph_management\n *\n * @title:\n * Glyph Management\n *\n * @abstract:\n * Generic interface to manage individual glyph data.\n *\n * @description:\n * This section contains definitions used to manage glyph data through\n * generic @FT_Glyph objects. Each of them can contain a bitmap,\n * a vector outline, or even images in other formats. These objects are\n * detached from @FT_Face, contrary to @FT_GlyphSlot.\n *\n */\n\n\n /* forward declaration to a private type */\n typedef struct FT_Glyph_Class_ FT_Glyph_Class;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Glyph\n *\n * @description:\n * Handle to an object used to model generic glyph images. It is a\n * pointer to the @FT_GlyphRec structure and can contain a glyph bitmap\n * or pointer.\n *\n * @note:\n * Glyph objects are not owned by the library. You must thus release\n * them manually (through @FT_Done_Glyph) _before_ calling\n * @FT_Done_FreeType.\n */\n typedef struct FT_GlyphRec_* FT_Glyph;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_GlyphRec\n *\n * @description:\n * The root glyph structure contains a given glyph image plus its advance\n * width in 16.16 fixed-point format.\n *\n * @fields:\n * library ::\n * A handle to the FreeType library object.\n *\n * clazz ::\n * A pointer to the glyph's class. Private.\n *\n * format ::\n * The format of the glyph's image.\n *\n * advance ::\n * A 16.16 vector that gives the glyph's advance width.\n */\n typedef struct FT_GlyphRec_\n {\n FT_Library library;\n const FT_Glyph_Class* clazz;\n FT_Glyph_Format format;\n FT_Vector advance;\n\n } FT_GlyphRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_BitmapGlyph\n *\n * @description:\n * A handle to an object used to model a bitmap glyph image. This is a\n * sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.\n */\n typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_BitmapGlyphRec\n *\n * @description:\n * A structure used for bitmap glyph images. This really is a\n * 'sub-class' of @FT_GlyphRec.\n *\n * @fields:\n * root ::\n * The root @FT_Glyph fields.\n *\n * left ::\n * The left-side bearing, i.e., the horizontal distance from the\n * current pen position to the left border of the glyph bitmap.\n *\n * top ::\n * The top-side bearing, i.e., the vertical distance from the current\n * pen position to the top border of the glyph bitmap. This distance\n * is positive for upwards~y!\n *\n * bitmap ::\n * A descriptor for the bitmap.\n *\n * @note:\n * You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have\n * `glyph->format == FT_GLYPH_FORMAT_BITMAP`. This lets you access the\n * bitmap's contents easily.\n *\n * The corresponding pixel buffer is always owned by @FT_BitmapGlyph and\n * is thus created and destroyed with it.\n */\n typedef struct FT_BitmapGlyphRec_\n {\n FT_GlyphRec root;\n FT_Int left;\n FT_Int top;\n FT_Bitmap bitmap;\n\n } FT_BitmapGlyphRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_OutlineGlyph\n *\n * @description:\n * A handle to an object used to model an outline glyph image. This is a\n * sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec.\n */\n typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_OutlineGlyphRec\n *\n * @description:\n * A structure used for outline (vectorial) glyph images. This really is\n * a 'sub-class' of @FT_GlyphRec.\n *\n * @fields:\n * root ::\n * The root @FT_Glyph fields.\n *\n * outline ::\n * A descriptor for the outline.\n *\n * @note:\n * You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have\n * `glyph->format == FT_GLYPH_FORMAT_OUTLINE`. This lets you access the\n * outline's content easily.\n *\n * As the outline is extracted from a glyph slot, its coordinates are\n * expressed normally in 26.6 pixels, unless the flag @FT_LOAD_NO_SCALE\n * was used in @FT_Load_Glyph or @FT_Load_Char.\n *\n * The outline's tables are always owned by the object and are destroyed\n * with it.\n */\n typedef struct FT_OutlineGlyphRec_\n {\n FT_GlyphRec root;\n FT_Outline outline;\n\n } FT_OutlineGlyphRec;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Glyph\n *\n * @description:\n * A function used to create a new empty glyph image. Note that the\n * created @FT_Glyph object must be released with @FT_Done_Glyph.\n *\n * @input:\n * library ::\n * A handle to the FreeType library object.\n *\n * format ::\n * The format of the glyph's image.\n *\n * @output:\n * aglyph ::\n * A handle to the glyph object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_New_Glyph( FT_Library library,\n FT_Glyph_Format format,\n FT_Glyph *aglyph );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Glyph\n *\n * @description:\n * A function used to extract a glyph image from a slot. Note that the\n * created @FT_Glyph object must be released with @FT_Done_Glyph.\n *\n * @input:\n * slot ::\n * A handle to the source glyph slot.\n *\n * @output:\n * aglyph ::\n * A handle to the glyph object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Because `*aglyph->advance.x` and `*aglyph->advance.y` are 16.16\n * fixed-point numbers, `slot->advance.x` and `slot->advance.y` (which\n * are in 26.6 fixed-point format) must be in the range ]-32768;32768[.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Glyph( FT_GlyphSlot slot,\n FT_Glyph *aglyph );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_Copy\n *\n * @description:\n * A function used to copy a glyph image. Note that the created\n * @FT_Glyph object must be released with @FT_Done_Glyph.\n *\n * @input:\n * source ::\n * A handle to the source glyph object.\n *\n * @output:\n * target ::\n * A handle to the target glyph object. 0~in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_Copy( FT_Glyph source,\n FT_Glyph *target );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_Transform\n *\n * @description:\n * Transform a glyph image if its format is scalable.\n *\n * @inout:\n * glyph ::\n * A handle to the target glyph object.\n *\n * @input:\n * matrix ::\n * A pointer to a 2x2 matrix to apply.\n *\n * delta ::\n * A pointer to a 2d vector to apply. Coordinates are expressed in\n * 1/64th of a pixel.\n *\n * @return:\n * FreeType error code (if not 0, the glyph format is not scalable).\n *\n * @note:\n * The 2x2 transformation matrix is also applied to the glyph's advance\n * vector.\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_Transform( FT_Glyph glyph,\n FT_Matrix* matrix,\n FT_Vector* delta );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Glyph_BBox_Mode\n *\n * @description:\n * The mode how the values of @FT_Glyph_Get_CBox are returned.\n *\n * @values:\n * FT_GLYPH_BBOX_UNSCALED ::\n * Return unscaled font units.\n *\n * FT_GLYPH_BBOX_SUBPIXELS ::\n * Return unfitted 26.6 coordinates.\n *\n * FT_GLYPH_BBOX_GRIDFIT ::\n * Return grid-fitted 26.6 coordinates.\n *\n * FT_GLYPH_BBOX_TRUNCATE ::\n * Return coordinates in integer pixels.\n *\n * FT_GLYPH_BBOX_PIXELS ::\n * Return grid-fitted pixel coordinates.\n */\n typedef enum FT_Glyph_BBox_Mode_\n {\n FT_GLYPH_BBOX_UNSCALED = 0,\n FT_GLYPH_BBOX_SUBPIXELS = 0,\n FT_GLYPH_BBOX_GRIDFIT = 1,\n FT_GLYPH_BBOX_TRUNCATE = 2,\n FT_GLYPH_BBOX_PIXELS = 3\n\n } FT_Glyph_BBox_Mode;\n\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_Glyph_BBox_Mode` values instead */\n#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED\n#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS\n#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT\n#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE\n#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_Get_CBox\n *\n * @description:\n * Return a glyph's 'control box'. The control box encloses all the\n * outline's points, including Bezier control points. Though it\n * coincides with the exact bounding box for most glyphs, it can be\n * slightly larger in some situations (like when rotating an outline that\n * contains Bezier outside arcs).\n *\n * Computing the control box is very fast, while getting the bounding box\n * can take much more time as it needs to walk over all segments and arcs\n * in the outline. To get the latter, you can use the 'ftbbox'\n * component, which is dedicated to this single task.\n *\n * @input:\n * glyph ::\n * A handle to the source glyph object.\n *\n * mode ::\n * The mode that indicates how to interpret the returned bounding box\n * values.\n *\n * @output:\n * acbox ::\n * The glyph coordinate bounding box. Coordinates are expressed in\n * 1/64th of pixels if it is grid-fitted.\n *\n * @note:\n * Coordinates are relative to the glyph origin, using the y~upwards\n * convention.\n *\n * If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode` must\n * be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font units in 26.6\n * pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS is another name for\n * this constant.\n *\n * If the font is tricky and the glyph has been loaded with\n * @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get\n * reasonable values for the CBox it is necessary to load the glyph at a\n * large ppem value (so that the hinting instructions can properly shift\n * and scale the subglyphs), then extracting the CBox, which can be\n * eventually converted back to font units.\n *\n * Note that the maximum coordinates are exclusive, which means that one\n * can compute the width and height of the glyph image (be it in integer\n * or 26.6 pixels) as:\n *\n * ```\n * width = bbox.xMax - bbox.xMin;\n * height = bbox.yMax - bbox.yMin;\n * ```\n *\n * Note also that for 26.6 coordinates, if `bbox_mode` is set to\n * @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted,\n * which corresponds to:\n *\n * ```\n * bbox.xMin = FLOOR(bbox.xMin);\n * bbox.yMin = FLOOR(bbox.yMin);\n * bbox.xMax = CEILING(bbox.xMax);\n * bbox.yMax = CEILING(bbox.yMax);\n * ```\n *\n * To get the bbox in pixel coordinates, set `bbox_mode` to\n * @FT_GLYPH_BBOX_TRUNCATE.\n *\n * To get the bbox in grid-fitted pixel coordinates, set `bbox_mode` to\n * @FT_GLYPH_BBOX_PIXELS.\n */\n FT_EXPORT( void )\n FT_Glyph_Get_CBox( FT_Glyph glyph,\n FT_UInt bbox_mode,\n FT_BBox *acbox );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_To_Bitmap\n *\n * @description:\n * Convert a given glyph object to a bitmap glyph object.\n *\n * @inout:\n * the_glyph ::\n * A pointer to a handle to the target glyph.\n *\n * @input:\n * render_mode ::\n * An enumeration that describes how the data is rendered.\n *\n * origin ::\n * A pointer to a vector used to translate the glyph image before\n * rendering. Can be~0 (if no translation). The origin is expressed\n * in 26.6 pixels.\n *\n * destroy ::\n * A boolean that indicates that the original glyph image should be\n * destroyed by this function. It is never destroyed in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function does nothing if the glyph format isn't scalable.\n *\n * The glyph image is translated with the `origin` vector before\n * rendering.\n *\n * The first parameter is a pointer to an @FT_Glyph handle, that will be\n * _replaced_ by this function (with newly allocated data). Typically,\n * you would use (omitting error handling):\n *\n * ```\n * FT_Glyph glyph;\n * FT_BitmapGlyph glyph_bitmap;\n *\n *\n * // load glyph\n * error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT );\n *\n * // extract glyph image\n * error = FT_Get_Glyph( face->glyph, &glyph );\n *\n * // convert to a bitmap (default render mode + destroying old)\n * if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )\n * {\n * error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,\n * 0, 1 );\n * if ( error ) // `glyph' unchanged\n * ...\n * }\n *\n * // access bitmap content by typecasting\n * glyph_bitmap = (FT_BitmapGlyph)glyph;\n *\n * // do funny stuff with it, like blitting/drawing\n * ...\n *\n * // discard glyph image (bitmap or not)\n * FT_Done_Glyph( glyph );\n * ```\n *\n * Here is another example, again without error handling:\n *\n * ```\n * FT_Glyph glyphs[MAX_GLYPHS]\n *\n *\n * ...\n *\n * for ( idx = 0; i < MAX_GLYPHS; i++ )\n * error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||\n * FT_Get_Glyph ( face->glyph, &glyphs[idx] );\n *\n * ...\n *\n * for ( idx = 0; i < MAX_GLYPHS; i++ )\n * {\n * FT_Glyph bitmap = glyphs[idx];\n *\n *\n * ...\n *\n * // after this call, `bitmap' no longer points into\n * // the `glyphs' array (and the old value isn't destroyed)\n * FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );\n *\n * ...\n *\n * FT_Done_Glyph( bitmap );\n * }\n *\n * ...\n *\n * for ( idx = 0; i < MAX_GLYPHS; i++ )\n * FT_Done_Glyph( glyphs[idx] );\n * ```\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,\n FT_Render_Mode render_mode,\n FT_Vector* origin,\n FT_Bool destroy );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Glyph\n *\n * @description:\n * Destroy a given glyph.\n *\n * @input:\n * glyph ::\n * A handle to the target glyph object.\n */\n FT_EXPORT( void )\n FT_Done_Glyph( FT_Glyph glyph );\n\n /* */\n\n\n /* other helpful functions */\n\n /**************************************************************************\n *\n * @section:\n * computations\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Matrix_Multiply\n *\n * @description:\n * Perform the matrix operation `b = a*b`.\n *\n * @input:\n * a ::\n * A pointer to matrix `a`.\n *\n * @inout:\n * b ::\n * A pointer to matrix `b`.\n *\n * @note:\n * The result is undefined if either `a` or `b` is zero.\n *\n * Since the function uses wrap-around arithmetic, results become\n * meaningless if the arguments are very large.\n */\n FT_EXPORT( void )\n FT_Matrix_Multiply( const FT_Matrix* a,\n FT_Matrix* b );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Matrix_Invert\n *\n * @description:\n * Invert a 2x2 matrix. Return an error if it can't be inverted.\n *\n * @inout:\n * matrix ::\n * A pointer to the target matrix. Remains untouched in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Matrix_Invert( FT_Matrix* matrix );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGLYPH_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftgxval.h", "language": "code", "loc": 319, "comment_density": 0.799, "code": "/****************************************************************************\n *\n * ftgxval.h\n *\n * FreeType API for validating TrueTypeGX/AAT tables (specification).\n *\n * Copyright (C) 2004-2020 by\n * Masatake YAMATO, Redhat K.K,\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n/****************************************************************************\n *\n * gxvalid is derived from both gxlayout module and otvalid module.\n * Development of gxlayout is supported by the Information-technology\n * Promotion Agency(IPA), Japan.\n *\n */\n\n\n#ifndef FTGXVAL_H_\n#define FTGXVAL_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * gx_validation\n *\n * @title:\n * TrueTypeGX/AAT Validation\n *\n * @abstract:\n * An API to validate TrueTypeGX/AAT tables.\n *\n * @description:\n * This section contains the declaration of functions to validate some\n * TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, trak,\n * prop, lcar).\n *\n * @order:\n * FT_TrueTypeGX_Validate\n * FT_TrueTypeGX_Free\n *\n * FT_ClassicKern_Validate\n * FT_ClassicKern_Free\n *\n * FT_VALIDATE_GX_LENGTH\n * FT_VALIDATE_GXXXX\n * FT_VALIDATE_CKERNXXX\n *\n */\n\n /**************************************************************************\n *\n *\n * Warning: Use `FT_VALIDATE_XXX` to validate a table.\n * Following definitions are for gxvalid developers.\n *\n *\n */\n\n#define FT_VALIDATE_feat_INDEX 0\n#define FT_VALIDATE_mort_INDEX 1\n#define FT_VALIDATE_morx_INDEX 2\n#define FT_VALIDATE_bsln_INDEX 3\n#define FT_VALIDATE_just_INDEX 4\n#define FT_VALIDATE_kern_INDEX 5\n#define FT_VALIDATE_opbd_INDEX 6\n#define FT_VALIDATE_trak_INDEX 7\n#define FT_VALIDATE_prop_INDEX 8\n#define FT_VALIDATE_lcar_INDEX 9\n#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_VALIDATE_GX_LENGTH\n *\n * @description:\n * The number of tables checked in this module. Use it as a parameter\n * for the `table-length` argument of function @FT_TrueTypeGX_Validate.\n */\n#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 )\n\n /* */\n\n /* Up to 0x1000 is used by otvalid.\n Ox2xxx is reserved for feature OT extension. */\n#define FT_VALIDATE_GX_START 0x4000\n#define FT_VALIDATE_GX_BITFIELD( tag ) \\\n ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_VALIDATE_GXXXX\n *\n * @description:\n * A list of bit-field constants used with @FT_TrueTypeGX_Validate to\n * indicate which TrueTypeGX/AAT Type tables should be validated.\n *\n * @values:\n * FT_VALIDATE_feat ::\n * Validate 'feat' table.\n *\n * FT_VALIDATE_mort ::\n * Validate 'mort' table.\n *\n * FT_VALIDATE_morx ::\n * Validate 'morx' table.\n *\n * FT_VALIDATE_bsln ::\n * Validate 'bsln' table.\n *\n * FT_VALIDATE_just ::\n * Validate 'just' table.\n *\n * FT_VALIDATE_kern ::\n * Validate 'kern' table.\n *\n * FT_VALIDATE_opbd ::\n * Validate 'opbd' table.\n *\n * FT_VALIDATE_trak ::\n * Validate 'trak' table.\n *\n * FT_VALIDATE_prop ::\n * Validate 'prop' table.\n *\n * FT_VALIDATE_lcar ::\n * Validate 'lcar' table.\n *\n * FT_VALIDATE_GX ::\n * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,\n * opbd, trak, prop and lcar).\n *\n */\n\n#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )\n#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )\n#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )\n#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )\n#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )\n#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )\n#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )\n#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )\n#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )\n#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )\n\n#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \\\n FT_VALIDATE_mort | \\\n FT_VALIDATE_morx | \\\n FT_VALIDATE_bsln | \\\n FT_VALIDATE_just | \\\n FT_VALIDATE_kern | \\\n FT_VALIDATE_opbd | \\\n FT_VALIDATE_trak | \\\n FT_VALIDATE_prop | \\\n FT_VALIDATE_lcar )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_TrueTypeGX_Validate\n *\n * @description:\n * Validate various TrueTypeGX tables to assure that all offsets and\n * indices are valid. The idea is that a higher-level library that\n * actually does the text layout can access those tables without error\n * checking (which can be quite time consuming).\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * validation_flags ::\n * A bit field that specifies the tables to be validated. See\n * @FT_VALIDATE_GXXXX for possible values.\n *\n * table_length ::\n * The size of the `tables` array. Normally, @FT_VALIDATE_GX_LENGTH\n * should be passed.\n *\n * @output:\n * tables ::\n * The array where all validated sfnt tables are stored. The array\n * itself must be allocated by a client.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with TrueTypeGX fonts, returning an error\n * otherwise.\n *\n * After use, the application should deallocate the buffers pointed to by\n * each `tables` element, by calling @FT_TrueTypeGX_Free. A `NULL` value\n * indicates that the table either doesn't exist in the font, the\n * application hasn't asked for validation, or the validator doesn't have\n * the ability to validate the sfnt table.\n */\n FT_EXPORT( FT_Error )\n FT_TrueTypeGX_Validate( FT_Face face,\n FT_UInt validation_flags,\n FT_Bytes tables[FT_VALIDATE_GX_LENGTH],\n FT_UInt table_length );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_TrueTypeGX_Free\n *\n * @description:\n * Free the buffer allocated by TrueTypeGX validator.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * table ::\n * The pointer to the buffer allocated by @FT_TrueTypeGX_Validate.\n *\n * @note:\n * This function must be used to free the buffer allocated by\n * @FT_TrueTypeGX_Validate only.\n */\n FT_EXPORT( void )\n FT_TrueTypeGX_Free( FT_Face face,\n FT_Bytes table );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_VALIDATE_CKERNXXX\n *\n * @description:\n * A list of bit-field constants used with @FT_ClassicKern_Validate to\n * indicate the classic kern dialect or dialects. If the selected type\n * doesn't fit, @FT_ClassicKern_Validate regards the table as invalid.\n *\n * @values:\n * FT_VALIDATE_MS ::\n * Handle the 'kern' table as a classic Microsoft kern table.\n *\n * FT_VALIDATE_APPLE ::\n * Handle the 'kern' table as a classic Apple kern table.\n *\n * FT_VALIDATE_CKERN ::\n * Handle the 'kern' as either classic Apple or Microsoft kern table.\n */\n#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )\n#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )\n\n#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_ClassicKern_Validate\n *\n * @description:\n * Validate classic (16-bit format) kern table to assure that the\n * offsets and indices are valid. The idea is that a higher-level\n * library that actually does the text layout can access those tables\n * without error checking (which can be quite time consuming).\n *\n * The 'kern' table validator in @FT_TrueTypeGX_Validate deals with both\n * the new 32-bit format and the classic 16-bit format, while\n * FT_ClassicKern_Validate only supports the classic 16-bit format.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * validation_flags ::\n * A bit field that specifies the dialect to be validated. See\n * @FT_VALIDATE_CKERNXXX for possible values.\n *\n * @output:\n * ckern_table ::\n * A pointer to the kern table.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * After use, the application should deallocate the buffers pointed to by\n * `ckern_table`, by calling @FT_ClassicKern_Free. A `NULL` value\n * indicates that the table doesn't exist in the font.\n */\n FT_EXPORT( FT_Error )\n FT_ClassicKern_Validate( FT_Face face,\n FT_UInt validation_flags,\n FT_Bytes *ckern_table );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_ClassicKern_Free\n *\n * @description:\n * Free the buffer allocated by classic Kern validator.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * table ::\n * The pointer to the buffer that is allocated by\n * @FT_ClassicKern_Validate.\n *\n * @note:\n * This function must be used to free the buffer allocated by\n * @FT_ClassicKern_Validate only.\n */\n FT_EXPORT( void )\n FT_ClassicKern_Free( FT_Face face,\n FT_Bytes table );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGXVAL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftgzip.h", "language": "code", "loc": 134, "comment_density": 0.851, "code": "/****************************************************************************\n *\n * ftgzip.h\n *\n * Gzip-compressed stream support.\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTGZIP_H_\n#define FTGZIP_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * gzip\n *\n * @title:\n * GZIP Streams\n *\n * @abstract:\n * Using gzip-compressed font files.\n *\n * @description:\n * This section contains the declaration of Gzip-specific functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stream_OpenGzip\n *\n * @description:\n * Open a new stream to parse gzip-compressed font files. This is mainly\n * used to support the compressed `*.pcf.gz` fonts that come with\n * XFree86.\n *\n * @input:\n * stream ::\n * The target embedding stream.\n *\n * source ::\n * The source stream.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source stream must be opened _before_ calling this function.\n *\n * Calling the internal function `FT_Stream_Close` on the new stream will\n * **not** call `FT_Stream_Close` on the source stream. None of the\n * stream objects will be released to the heap.\n *\n * The stream implementation is very basic and resets the decompression\n * process each time seeking backwards is needed within the stream.\n *\n * In certain builds of the library, gzip compression recognition is\n * automatically handled when calling @FT_New_Face or @FT_Open_Face.\n * This means that if no font driver is capable of handling the raw\n * compressed file, the library will try to open a gzipped stream from it\n * and re-open the face with it.\n *\n * This function may return `FT_Err_Unimplemented_Feature` if your build\n * of FreeType was not compiled with zlib support.\n */\n FT_EXPORT( FT_Error )\n FT_Stream_OpenGzip( FT_Stream stream,\n FT_Stream source );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Gzip_Uncompress\n *\n * @description:\n * Decompress a zipped input buffer into an output buffer. This function\n * is modeled after zlib's `uncompress` function.\n *\n * @input:\n * memory ::\n * A FreeType memory handle.\n *\n * input ::\n * The input buffer.\n *\n * input_len ::\n * The length of the input buffer.\n *\n * @output:\n * output ::\n * The output buffer.\n *\n * @inout:\n * output_len ::\n * Before calling the function, this is the total size of the output\n * buffer, which must be large enough to hold the entire uncompressed\n * data (so the size of the uncompressed data must be known in\n * advance). After calling the function, `output_len` is the size of\n * the used data in `output`.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function may return `FT_Err_Unimplemented_Feature` if your build\n * of FreeType was not compiled with zlib support.\n *\n * @since:\n * 2.5.1\n */\n FT_EXPORT( FT_Error )\n FT_Gzip_Uncompress( FT_Memory memory,\n FT_Byte* output,\n FT_ULong* output_len,\n const FT_Byte* input,\n FT_ULong input_len );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGZIP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftimage.h", "language": "code", "loc": 1113, "comment_density": 0.827, "code": "/****************************************************************************\n *\n * ftimage.h\n *\n * FreeType glyph image formats and default raster interface\n * (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n /**************************************************************************\n *\n * Note: A 'raster' is simply a scan-line converter, used to render\n * FT_Outlines into FT_Bitmaps.\n *\n */\n\n\n#ifndef FTIMAGE_H_\n#define FTIMAGE_H_\n\n\n /* STANDALONE_ is from ftgrays.c */\n#ifndef STANDALONE_\n#include \n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * basic_types\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Pos\n *\n * @description:\n * The type FT_Pos is used to store vectorial coordinates. Depending on\n * the context, these can represent distances in integer font units, or\n * 16.16, or 26.6 fixed-point pixel coordinates.\n */\n typedef signed long FT_Pos;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Vector\n *\n * @description:\n * A simple structure used to store a 2D vector; coordinates are of the\n * FT_Pos type.\n *\n * @fields:\n * x ::\n * The horizontal coordinate.\n * y ::\n * The vertical coordinate.\n */\n typedef struct FT_Vector_\n {\n FT_Pos x;\n FT_Pos y;\n\n } FT_Vector;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_BBox\n *\n * @description:\n * A structure used to hold an outline's bounding box, i.e., the\n * coordinates of its extrema in the horizontal and vertical directions.\n *\n * @fields:\n * xMin ::\n * The horizontal minimum (left-most).\n *\n * yMin ::\n * The vertical minimum (bottom-most).\n *\n * xMax ::\n * The horizontal maximum (right-most).\n *\n * yMax ::\n * The vertical maximum (top-most).\n *\n * @note:\n * The bounding box is specified with the coordinates of the lower left\n * and the upper right corner. In PostScript, those values are often\n * called (llx,lly) and (urx,ury), respectively.\n *\n * If `yMin` is negative, this value gives the glyph's descender.\n * Otherwise, the glyph doesn't descend below the baseline. Similarly,\n * if `ymax` is positive, this value gives the glyph's ascender.\n *\n * `xMin` gives the horizontal distance from the glyph's origin to the\n * left edge of the glyph's bounding box. If `xMin` is negative, the\n * glyph extends to the left of the origin.\n */\n typedef struct FT_BBox_\n {\n FT_Pos xMin, yMin;\n FT_Pos xMax, yMax;\n\n } FT_BBox;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Pixel_Mode\n *\n * @description:\n * An enumeration type used to describe the format of pixels in a given\n * bitmap. Note that additional formats may be added in the future.\n *\n * @values:\n * FT_PIXEL_MODE_NONE ::\n * Value~0 is reserved.\n *\n * FT_PIXEL_MODE_MONO ::\n * A monochrome bitmap, using 1~bit per pixel. Note that pixels are\n * stored in most-significant order (MSB), which means that the\n * left-most pixel in a byte has value 128.\n *\n * FT_PIXEL_MODE_GRAY ::\n * An 8-bit bitmap, generally used to represent anti-aliased glyph\n * images. Each pixel is stored in one byte. Note that the number of\n * 'gray' levels is stored in the `num_grays` field of the @FT_Bitmap\n * structure (it generally is 256).\n *\n * FT_PIXEL_MODE_GRAY2 ::\n * A 2-bit per pixel bitmap, used to represent embedded anti-aliased\n * bitmaps in font files according to the OpenType specification. We\n * haven't found a single font using this format, however.\n *\n * FT_PIXEL_MODE_GRAY4 ::\n * A 4-bit per pixel bitmap, representing embedded anti-aliased bitmaps\n * in font files according to the OpenType specification. We haven't\n * found a single font using this format, however.\n *\n * FT_PIXEL_MODE_LCD ::\n * An 8-bit bitmap, representing RGB or BGR decimated glyph images used\n * for display on LCD displays; the bitmap is three times wider than\n * the original glyph image. See also @FT_RENDER_MODE_LCD.\n *\n * FT_PIXEL_MODE_LCD_V ::\n * An 8-bit bitmap, representing RGB or BGR decimated glyph images used\n * for display on rotated LCD displays; the bitmap is three times\n * taller than the original glyph image. See also\n * @FT_RENDER_MODE_LCD_V.\n *\n * FT_PIXEL_MODE_BGRA ::\n * [Since 2.5] An image with four 8-bit channels per pixel,\n * representing a color image (such as emoticons) with alpha channel.\n * For each pixel, the format is BGRA, which means, the blue channel\n * comes first in memory. The color channels are pre-multiplied and in\n * the sRGB colorspace. For example, full red at half-translucent\n * opacity will be represented as '00,00,80,80', not '00,00,FF,80'.\n * See also @FT_LOAD_COLOR.\n */\n typedef enum FT_Pixel_Mode_\n {\n FT_PIXEL_MODE_NONE = 0,\n FT_PIXEL_MODE_MONO,\n FT_PIXEL_MODE_GRAY,\n FT_PIXEL_MODE_GRAY2,\n FT_PIXEL_MODE_GRAY4,\n FT_PIXEL_MODE_LCD,\n FT_PIXEL_MODE_LCD_V,\n FT_PIXEL_MODE_BGRA,\n\n FT_PIXEL_MODE_MAX /* do not remove */\n\n } FT_Pixel_Mode;\n\n\n /* these constants are deprecated; use the corresponding `FT_Pixel_Mode` */\n /* values instead. */\n#define ft_pixel_mode_none FT_PIXEL_MODE_NONE\n#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO\n#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY\n#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2\n#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Bitmap\n *\n * @description:\n * A structure used to describe a bitmap or pixmap to the raster. Note\n * that we now manage pixmaps of various depths through the `pixel_mode`\n * field.\n *\n * @fields:\n * rows ::\n * The number of bitmap rows.\n *\n * width ::\n * The number of pixels in bitmap row.\n *\n * pitch ::\n * The pitch's absolute value is the number of bytes taken by one\n * bitmap row, including padding. However, the pitch is positive when\n * the bitmap has a 'down' flow, and negative when it has an 'up' flow.\n * In all cases, the pitch is an offset to add to a bitmap pointer in\n * order to go down one row.\n *\n * Note that 'padding' means the alignment of a bitmap to a byte\n * border, and FreeType functions normally align to the smallest\n * possible integer value.\n *\n * For the B/W rasterizer, `pitch` is always an even number.\n *\n * To change the pitch of a bitmap (say, to make it a multiple of 4),\n * use @FT_Bitmap_Convert. Alternatively, you might use callback\n * functions to directly render to the application's surface; see the\n * file `example2.cpp` in the tutorial for a demonstration.\n *\n * buffer ::\n * A typeless pointer to the bitmap buffer. This value should be\n * aligned on 32-bit boundaries in most cases.\n *\n * num_grays ::\n * This field is only used with @FT_PIXEL_MODE_GRAY; it gives the\n * number of gray levels used in the bitmap.\n *\n * pixel_mode ::\n * The pixel mode, i.e., how pixel bits are stored. See @FT_Pixel_Mode\n * for possible values.\n *\n * palette_mode ::\n * This field is intended for paletted pixel modes; it indicates how\n * the palette is stored. Not used currently.\n *\n * palette ::\n * A typeless pointer to the bitmap palette; this field is intended for\n * paletted pixel modes. Not used currently.\n */\n typedef struct FT_Bitmap_\n {\n unsigned int rows;\n unsigned int width;\n int pitch;\n unsigned char* buffer;\n unsigned short num_grays;\n unsigned char pixel_mode;\n unsigned char palette_mode;\n void* palette;\n\n } FT_Bitmap;\n\n\n /**************************************************************************\n *\n * @section:\n * outline_processing\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Outline\n *\n * @description:\n * This structure is used to describe an outline to the scan-line\n * converter.\n *\n * @fields:\n * n_contours ::\n * The number of contours in the outline.\n *\n * n_points ::\n * The number of points in the outline.\n *\n * points ::\n * A pointer to an array of `n_points` @FT_Vector elements, giving the\n * outline's point coordinates.\n *\n * tags ::\n * A pointer to an array of `n_points` chars, giving each outline\n * point's type.\n *\n * If bit~0 is unset, the point is 'off' the curve, i.e., a Bezier\n * control point, while it is 'on' if set.\n *\n * Bit~1 is meaningful for 'off' points only. If set, it indicates a\n * third-order Bezier arc control point; and a second-order control\n * point if unset.\n *\n * If bit~2 is set, bits 5-7 contain the drop-out mode (as defined in\n * the OpenType specification; the value is the same as the argument to\n * the 'SCANMODE' instruction).\n *\n * Bits 3 and~4 are reserved for internal purposes.\n *\n * contours ::\n * An array of `n_contours` shorts, giving the end point of each\n * contour within the outline. For example, the first contour is\n * defined by the points '0' to `contours[0]`, the second one is\n * defined by the points `contours[0]+1` to `contours[1]`, etc.\n *\n * flags ::\n * A set of bit flags used to characterize the outline and give hints\n * to the scan-converter and hinter on how to convert/grid-fit it. See\n * @FT_OUTLINE_XXX.\n *\n * @note:\n * The B/W rasterizer only checks bit~2 in the `tags` array for the first\n * point of each contour. The drop-out mode as given with\n * @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and\n * @FT_OUTLINE_INCLUDE_STUBS in `flags` is then overridden.\n */\n typedef struct FT_Outline_\n {\n short n_contours; /* number of contours in glyph */\n short n_points; /* number of points in the glyph */\n\n FT_Vector* points; /* the outline's points */\n char* tags; /* the points flags */\n short* contours; /* the contour end points */\n\n int flags; /* outline masks */\n\n } FT_Outline;\n\n /* */\n\n /* Following limits must be consistent with */\n /* FT_Outline.{n_contours,n_points} */\n#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX\n#define FT_OUTLINE_POINTS_MAX SHRT_MAX\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_OUTLINE_XXX\n *\n * @description:\n * A list of bit-field constants used for the flags in an outline's\n * `flags` field.\n *\n * @values:\n * FT_OUTLINE_NONE ::\n * Value~0 is reserved.\n *\n * FT_OUTLINE_OWNER ::\n * If set, this flag indicates that the outline's field arrays (i.e.,\n * `points`, `flags`, and `contours`) are 'owned' by the outline\n * object, and should thus be freed when it is destroyed.\n *\n * FT_OUTLINE_EVEN_ODD_FILL ::\n * By default, outlines are filled using the non-zero winding rule. If\n * set to 1, the outline will be filled using the even-odd fill rule\n * (only works with the smooth rasterizer).\n *\n * FT_OUTLINE_REVERSE_FILL ::\n * By default, outside contours of an outline are oriented in\n * clock-wise direction, as defined in the TrueType specification.\n * This flag is set if the outline uses the opposite direction\n * (typically for Type~1 fonts). This flag is ignored by the scan\n * converter.\n *\n * FT_OUTLINE_IGNORE_DROPOUTS ::\n * By default, the scan converter will try to detect drop-outs in an\n * outline and correct the glyph bitmap to ensure consistent shape\n * continuity. If set, this flag hints the scan-line converter to\n * ignore such cases. See below for more information.\n *\n * FT_OUTLINE_SMART_DROPOUTS ::\n * Select smart dropout control. If unset, use simple dropout control.\n * Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more\n * information.\n *\n * FT_OUTLINE_INCLUDE_STUBS ::\n * If set, turn pixels on for 'stubs', otherwise exclude them. Ignored\n * if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more\n * information.\n *\n * FT_OUTLINE_HIGH_PRECISION ::\n * This flag indicates that the scan-line converter should try to\n * convert this outline to bitmaps with the highest possible quality.\n * It is typically set for small character sizes. Note that this is\n * only a hint that might be completely ignored by a given\n * scan-converter.\n *\n * FT_OUTLINE_SINGLE_PASS ::\n * This flag is set to force a given scan-converter to only use a\n * single pass over the outline to render a bitmap glyph image.\n * Normally, it is set for very large character sizes. It is only a\n * hint that might be completely ignored by a given scan-converter.\n *\n * @note:\n * The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and\n * @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth rasterizer.\n *\n * There exists a second mechanism to pass the drop-out mode to the B/W\n * rasterizer; see the `tags` field in @FT_Outline.\n *\n * Please refer to the description of the 'SCANTYPE' instruction in the\n * OpenType specification (in file `ttinst1.doc`) how simple drop-outs,\n * smart drop-outs, and stubs are defined.\n */\n#define FT_OUTLINE_NONE 0x0\n#define FT_OUTLINE_OWNER 0x1\n#define FT_OUTLINE_EVEN_ODD_FILL 0x2\n#define FT_OUTLINE_REVERSE_FILL 0x4\n#define FT_OUTLINE_IGNORE_DROPOUTS 0x8\n#define FT_OUTLINE_SMART_DROPOUTS 0x10\n#define FT_OUTLINE_INCLUDE_STUBS 0x20\n\n#define FT_OUTLINE_HIGH_PRECISION 0x100\n#define FT_OUTLINE_SINGLE_PASS 0x200\n\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_OUTLINE_XXX` values instead */\n#define ft_outline_none FT_OUTLINE_NONE\n#define ft_outline_owner FT_OUTLINE_OWNER\n#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL\n#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL\n#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS\n#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION\n#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS\n\n /* */\n\n#define FT_CURVE_TAG( flag ) ( flag & 0x03 )\n\n /* see the `tags` field in `FT_Outline` for a description of the values */\n#define FT_CURVE_TAG_ON 0x01\n#define FT_CURVE_TAG_CONIC 0x00\n#define FT_CURVE_TAG_CUBIC 0x02\n\n#define FT_CURVE_TAG_HAS_SCANMODE 0x04\n\n#define FT_CURVE_TAG_TOUCH_X 0x08 /* reserved for TrueType hinter */\n#define FT_CURVE_TAG_TOUCH_Y 0x10 /* reserved for TrueType hinter */\n\n#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \\\n FT_CURVE_TAG_TOUCH_Y )\n /* values 0x20, 0x40, and 0x80 are reserved */\n\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_CURVE_TAG_XXX` values instead */\n#define FT_Curve_Tag_On FT_CURVE_TAG_ON\n#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC\n#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC\n#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X\n#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Outline_MoveToFunc\n *\n * @description:\n * A function pointer type used to describe the signature of a 'move to'\n * function during outline walking/decomposition.\n *\n * A 'move to' is emitted to start a new contour in an outline.\n *\n * @input:\n * to ::\n * A pointer to the target point of the 'move to'.\n *\n * user ::\n * A typeless pointer, which is passed from the caller of the\n * decomposition function.\n *\n * @return:\n * Error code. 0~means success.\n */\n typedef int\n (*FT_Outline_MoveToFunc)( const FT_Vector* to,\n void* user );\n\n#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Outline_LineToFunc\n *\n * @description:\n * A function pointer type used to describe the signature of a 'line to'\n * function during outline walking/decomposition.\n *\n * A 'line to' is emitted to indicate a segment in the outline.\n *\n * @input:\n * to ::\n * A pointer to the target point of the 'line to'.\n *\n * user ::\n * A typeless pointer, which is passed from the caller of the\n * decomposition function.\n *\n * @return:\n * Error code. 0~means success.\n */\n typedef int\n (*FT_Outline_LineToFunc)( const FT_Vector* to,\n void* user );\n\n#define FT_Outline_LineTo_Func FT_Outline_LineToFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Outline_ConicToFunc\n *\n * @description:\n * A function pointer type used to describe the signature of a 'conic to'\n * function during outline walking or decomposition.\n *\n * A 'conic to' is emitted to indicate a second-order Bezier arc in the\n * outline.\n *\n * @input:\n * control ::\n * An intermediate control point between the last position and the new\n * target in `to`.\n *\n * to ::\n * A pointer to the target end point of the conic arc.\n *\n * user ::\n * A typeless pointer, which is passed from the caller of the\n * decomposition function.\n *\n * @return:\n * Error code. 0~means success.\n */\n typedef int\n (*FT_Outline_ConicToFunc)( const FT_Vector* control,\n const FT_Vector* to,\n void* user );\n\n#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Outline_CubicToFunc\n *\n * @description:\n * A function pointer type used to describe the signature of a 'cubic to'\n * function during outline walking or decomposition.\n *\n * A 'cubic to' is emitted to indicate a third-order Bezier arc.\n *\n * @input:\n * control1 ::\n * A pointer to the first Bezier control point.\n *\n * control2 ::\n * A pointer to the second Bezier control point.\n *\n * to ::\n * A pointer to the target end point.\n *\n * user ::\n * A typeless pointer, which is passed from the caller of the\n * decomposition function.\n *\n * @return:\n * Error code. 0~means success.\n */\n typedef int\n (*FT_Outline_CubicToFunc)( const FT_Vector* control1,\n const FT_Vector* control2,\n const FT_Vector* to,\n void* user );\n\n#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Outline_Funcs\n *\n * @description:\n * A structure to hold various function pointers used during outline\n * decomposition in order to emit segments, conic, and cubic Beziers.\n *\n * @fields:\n * move_to ::\n * The 'move to' emitter.\n *\n * line_to ::\n * The segment emitter.\n *\n * conic_to ::\n * The second-order Bezier arc emitter.\n *\n * cubic_to ::\n * The third-order Bezier arc emitter.\n *\n * shift ::\n * The shift that is applied to coordinates before they are sent to the\n * emitter.\n *\n * delta ::\n * The delta that is applied to coordinates before they are sent to the\n * emitter, but after the shift.\n *\n * @note:\n * The point coordinates sent to the emitters are the transformed version\n * of the original coordinates (this is important for high accuracy\n * during scan-conversion). The transformation is simple:\n *\n * ```\n * x' = (x << shift) - delta\n * y' = (y << shift) - delta\n * ```\n *\n * Set the values of `shift` and `delta` to~0 to get the original point\n * coordinates.\n */\n typedef struct FT_Outline_Funcs_\n {\n FT_Outline_MoveToFunc move_to;\n FT_Outline_LineToFunc line_to;\n FT_Outline_ConicToFunc conic_to;\n FT_Outline_CubicToFunc cubic_to;\n\n int shift;\n FT_Pos delta;\n\n } FT_Outline_Funcs;\n\n\n /**************************************************************************\n *\n * @section:\n * basic_types\n *\n */\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IMAGE_TAG\n *\n * @description:\n * This macro converts four-letter tags to an unsigned long type.\n *\n * @note:\n * Since many 16-bit compilers don't like 32-bit enumerations, you should\n * redefine this macro in case of problems to something like this:\n *\n * ```\n * #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value\n * ```\n *\n * to get a simple enumeration without assigning special numbers.\n */\n#ifndef FT_IMAGE_TAG\n#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \\\n value = ( ( (unsigned long)_x1 << 24 ) | \\\n ( (unsigned long)_x2 << 16 ) | \\\n ( (unsigned long)_x3 << 8 ) | \\\n (unsigned long)_x4 )\n#endif /* FT_IMAGE_TAG */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Glyph_Format\n *\n * @description:\n * An enumeration type used to describe the format of a given glyph\n * image. Note that this version of FreeType only supports two image\n * formats, even though future font drivers will be able to register\n * their own format.\n *\n * @values:\n * FT_GLYPH_FORMAT_NONE ::\n * The value~0 is reserved.\n *\n * FT_GLYPH_FORMAT_COMPOSITE ::\n * The glyph image is a composite of several other images. This format\n * is _only_ used with @FT_LOAD_NO_RECURSE, and is used to report\n * compound glyphs (like accented characters).\n *\n * FT_GLYPH_FORMAT_BITMAP ::\n * The glyph image is a bitmap, and can be described as an @FT_Bitmap.\n * You generally need to access the `bitmap` field of the\n * @FT_GlyphSlotRec structure to read it.\n *\n * FT_GLYPH_FORMAT_OUTLINE ::\n * The glyph image is a vectorial outline made of line segments and\n * Bezier arcs; it can be described as an @FT_Outline; you generally\n * want to access the `outline` field of the @FT_GlyphSlotRec structure\n * to read it.\n *\n * FT_GLYPH_FORMAT_PLOTTER ::\n * The glyph image is a vectorial path with no inside and outside\n * contours. Some Type~1 fonts, like those in the Hershey family,\n * contain glyphs in this format. These are described as @FT_Outline,\n * but FreeType isn't currently capable of rendering them correctly.\n */\n typedef enum FT_Glyph_Format_\n {\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),\n\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )\n\n } FT_Glyph_Format;\n\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_Glyph_Format` values instead. */\n#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE\n#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE\n#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP\n#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE\n#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** R A S T E R D E F I N I T I O N S *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * A raster is a scan converter, in charge of rendering an outline into a\n * bitmap. This section contains the public API for rasters.\n *\n * Note that in FreeType 2, all rasters are now encapsulated within\n * specific modules called 'renderers'. See `ftrender.h` for more details\n * on renderers.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * raster\n *\n * @title:\n * Scanline Converter\n *\n * @abstract:\n * How vectorial outlines are converted into bitmaps and pixmaps.\n *\n * @description:\n * This section contains technical definitions.\n *\n * @order:\n * FT_Raster\n * FT_Span\n * FT_SpanFunc\n *\n * FT_Raster_Params\n * FT_RASTER_FLAG_XXX\n *\n * FT_Raster_NewFunc\n * FT_Raster_DoneFunc\n * FT_Raster_ResetFunc\n * FT_Raster_SetModeFunc\n * FT_Raster_RenderFunc\n * FT_Raster_Funcs\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Raster\n *\n * @description:\n * An opaque handle (pointer) to a raster object. Each object can be\n * used independently to convert an outline into a bitmap or pixmap.\n */\n typedef struct FT_RasterRec_* FT_Raster;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Span\n *\n * @description:\n * A structure used to model a single span of gray pixels when rendering\n * an anti-aliased bitmap.\n *\n * @fields:\n * x ::\n * The span's horizontal start position.\n *\n * len ::\n * The span's length in pixels.\n *\n * coverage ::\n * The span color/coverage, ranging from 0 (background) to 255\n * (foreground).\n *\n * @note:\n * This structure is used by the span drawing callback type named\n * @FT_SpanFunc that takes the y~coordinate of the span as a parameter.\n *\n * The coverage value is always between 0 and 255. If you want less gray\n * values, the callback function has to reduce them.\n */\n typedef struct FT_Span_\n {\n short x;\n unsigned short len;\n unsigned char coverage;\n\n } FT_Span;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_SpanFunc\n *\n * @description:\n * A function used as a call-back by the anti-aliased renderer in order\n * to let client applications draw themselves the gray pixel spans on\n * each scan line.\n *\n * @input:\n * y ::\n * The scanline's upward y~coordinate.\n *\n * count ::\n * The number of spans to draw on this scanline.\n *\n * spans ::\n * A table of `count` spans to draw on the scanline.\n *\n * user ::\n * User-supplied data that is passed to the callback.\n *\n * @note:\n * This callback allows client applications to directly render the gray\n * spans of the anti-aliased bitmap to any kind of surfaces.\n *\n * This can be used to write anti-aliased outlines directly to a given\n * background bitmap, and even perform translucency.\n */\n typedef void\n (*FT_SpanFunc)( int y,\n int count,\n const FT_Span* spans,\n void* user );\n\n#define FT_Raster_Span_Func FT_SpanFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_BitTest_Func\n *\n * @description:\n * Deprecated, unimplemented.\n */\n typedef int\n (*FT_Raster_BitTest_Func)( int y,\n int x,\n void* user );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_BitSet_Func\n *\n * @description:\n * Deprecated, unimplemented.\n */\n typedef void\n (*FT_Raster_BitSet_Func)( int y,\n int x,\n void* user );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_RASTER_FLAG_XXX\n *\n * @description:\n * A list of bit flag constants as used in the `flags` field of a\n * @FT_Raster_Params structure.\n *\n * @values:\n * FT_RASTER_FLAG_DEFAULT ::\n * This value is 0.\n *\n * FT_RASTER_FLAG_AA ::\n * This flag is set to indicate that an anti-aliased glyph image should\n * be generated. Otherwise, it will be monochrome (1-bit).\n *\n * FT_RASTER_FLAG_DIRECT ::\n * This flag is set to indicate direct rendering. In this mode, client\n * applications must provide their own span callback. This lets them\n * directly draw or compose over an existing bitmap. If this bit is\n * _not_ set, the target pixmap's buffer _must_ be zeroed before\n * rendering and the output will be clipped to its size.\n *\n * Direct rendering is only possible with anti-aliased glyphs.\n *\n * FT_RASTER_FLAG_CLIP ::\n * This flag is only used in direct rendering mode. If set, the output\n * will be clipped to a box specified in the `clip_box` field of the\n * @FT_Raster_Params structure. Otherwise, the `clip_box` is\n * effectively set to the bounding box and all spans are generated.\n */\n#define FT_RASTER_FLAG_DEFAULT 0x0\n#define FT_RASTER_FLAG_AA 0x1\n#define FT_RASTER_FLAG_DIRECT 0x2\n#define FT_RASTER_FLAG_CLIP 0x4\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_RASTER_FLAG_XXX` values instead */\n#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT\n#define ft_raster_flag_aa FT_RASTER_FLAG_AA\n#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT\n#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Raster_Params\n *\n * @description:\n * A structure to hold the parameters used by a raster's render function,\n * passed as an argument to @FT_Outline_Render.\n *\n * @fields:\n * target ::\n * The target bitmap.\n *\n * source ::\n * A pointer to the source glyph image (e.g., an @FT_Outline).\n *\n * flags ::\n * The rendering flags.\n *\n * gray_spans ::\n * The gray span drawing callback.\n *\n * black_spans ::\n * Unused.\n *\n * bit_test ::\n * Unused.\n *\n * bit_set ::\n * Unused.\n *\n * user ::\n * User-supplied data that is passed to each drawing callback.\n *\n * clip_box ::\n * An optional clipping box. It is only used in direct rendering mode.\n * Note that coordinates here should be expressed in _integer_ pixels\n * (and not in 26.6 fixed-point units).\n *\n * @note:\n * An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA bit\n * flag is set in the `flags` field, otherwise a monochrome bitmap is\n * generated.\n *\n * If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags`, the raster\n * will call the `gray_spans` callback to draw gray pixel spans. This\n * allows direct composition over a preexisting bitmap through\n * user-provided callbacks to perform the span drawing and composition.\n * Not supported by the monochrome rasterizer.\n */\n typedef struct FT_Raster_Params_\n {\n const FT_Bitmap* target;\n const void* source;\n int flags;\n FT_SpanFunc gray_spans;\n FT_SpanFunc black_spans; /* unused */\n FT_Raster_BitTest_Func bit_test; /* unused */\n FT_Raster_BitSet_Func bit_set; /* unused */\n void* user;\n FT_BBox clip_box;\n\n } FT_Raster_Params;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_NewFunc\n *\n * @description:\n * A function used to create a new raster object.\n *\n * @input:\n * memory ::\n * A handle to the memory allocator.\n *\n * @output:\n * raster ::\n * A handle to the new raster object.\n *\n * @return:\n * Error code. 0~means success.\n *\n * @note:\n * The `memory` parameter is a typeless pointer in order to avoid\n * un-wanted dependencies on the rest of the FreeType code. In practice,\n * it is an @FT_Memory object, i.e., a handle to the standard FreeType\n * memory allocator. However, this field can be completely ignored by a\n * given raster implementation.\n */\n typedef int\n (*FT_Raster_NewFunc)( void* memory,\n FT_Raster* raster );\n\n#define FT_Raster_New_Func FT_Raster_NewFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_DoneFunc\n *\n * @description:\n * A function used to destroy a given raster object.\n *\n * @input:\n * raster ::\n * A handle to the raster object.\n */\n typedef void\n (*FT_Raster_DoneFunc)( FT_Raster raster );\n\n#define FT_Raster_Done_Func FT_Raster_DoneFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_ResetFunc\n *\n * @description:\n * FreeType used to provide an area of memory called the 'render pool'\n * available to all registered rasterizers. This was not thread safe,\n * however, and now FreeType never allocates this pool.\n *\n * This function is called after a new raster object is created.\n *\n * @input:\n * raster ::\n * A handle to the new raster object.\n *\n * pool_base ::\n * Previously, the address in memory of the render pool. Set this to\n * `NULL`.\n *\n * pool_size ::\n * Previously, the size in bytes of the render pool. Set this to 0.\n *\n * @note:\n * Rasterizers should rely on dynamic or stack allocation if they want to\n * (a handle to the memory allocator is passed to the rasterizer\n * constructor).\n */\n typedef void\n (*FT_Raster_ResetFunc)( FT_Raster raster,\n unsigned char* pool_base,\n unsigned long pool_size );\n\n#define FT_Raster_Reset_Func FT_Raster_ResetFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_SetModeFunc\n *\n * @description:\n * This function is a generic facility to change modes or attributes in a\n * given raster. This can be used for debugging purposes, or simply to\n * allow implementation-specific 'features' in a given raster module.\n *\n * @input:\n * raster ::\n * A handle to the new raster object.\n *\n * mode ::\n * A 4-byte tag used to name the mode or property.\n *\n * args ::\n * A pointer to the new mode/property to use.\n */\n typedef int\n (*FT_Raster_SetModeFunc)( FT_Raster raster,\n unsigned long mode,\n void* args );\n\n#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_RenderFunc\n *\n * @description:\n * Invoke a given raster to scan-convert a given glyph image into a\n * target bitmap.\n *\n * @input:\n * raster ::\n * A handle to the raster object.\n *\n * params ::\n * A pointer to an @FT_Raster_Params structure used to store the\n * rendering parameters.\n *\n * @return:\n * Error code. 0~means success.\n *\n * @note:\n * The exact format of the source image depends on the raster's glyph\n * format defined in its @FT_Raster_Funcs structure. It can be an\n * @FT_Outline or anything else in order to support a large array of\n * glyph formats.\n *\n * Note also that the render function can fail and return a\n * `FT_Err_Unimplemented_Feature` error code if the raster used does not\n * support direct composition.\n */\n typedef int\n (*FT_Raster_RenderFunc)( FT_Raster raster,\n const FT_Raster_Params* params );\n\n#define FT_Raster_Render_Func FT_Raster_RenderFunc\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Raster_Funcs\n *\n * @description:\n * A structure used to describe a given raster class to the library.\n *\n * @fields:\n * glyph_format ::\n * The supported glyph format for this raster.\n *\n * raster_new ::\n * The raster constructor.\n *\n * raster_reset ::\n * Used to reset the render pool within the raster.\n *\n * raster_render ::\n * A function to render a glyph into a given bitmap.\n *\n * raster_done ::\n * The raster destructor.\n */\n typedef struct FT_Raster_Funcs_\n {\n FT_Glyph_Format glyph_format;\n\n FT_Raster_NewFunc raster_new;\n FT_Raster_ResetFunc raster_reset;\n FT_Raster_SetModeFunc raster_set_mode;\n FT_Raster_RenderFunc raster_render;\n FT_Raster_DoneFunc raster_done;\n\n } FT_Raster_Funcs;\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTIMAGE_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftincrem.h", "language": "code", "loc": 309, "comment_density": 0.854, "code": "/****************************************************************************\n *\n * ftincrem.h\n *\n * FreeType incremental loading (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTINCREM_H_\n#define FTINCREM_H_\n\n#include \n#include FT_FREETYPE_H\n#include FT_PARAMETER_TAGS_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * incremental\n *\n * @title:\n * Incremental Loading\n *\n * @abstract:\n * Custom Glyph Loading.\n *\n * @description:\n * This section contains various functions used to perform so-called\n * 'incremental' glyph loading. This is a mode where all glyphs loaded\n * from a given @FT_Face are provided by the client application.\n *\n * Apart from that, all other tables are loaded normally from the font\n * file. This mode is useful when FreeType is used within another\n * engine, e.g., a PostScript Imaging Processor.\n *\n * To enable this mode, you must use @FT_Open_Face, passing an\n * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an\n * @FT_Incremental_Interface value. See the comments for\n * @FT_Incremental_InterfaceRec for an example.\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental\n *\n * @description:\n * An opaque type describing a user-provided object used to implement\n * 'incremental' glyph loading within FreeType. This is used to support\n * embedded fonts in certain environments (e.g., PostScript\n * interpreters), where the glyph data isn't in the font file, or must be\n * overridden by different values.\n *\n * @note:\n * It is up to client applications to create and implement\n * @FT_Incremental objects, as long as they provide implementations for\n * the methods @FT_Incremental_GetGlyphDataFunc,\n * @FT_Incremental_FreeGlyphDataFunc and\n * @FT_Incremental_GetGlyphMetricsFunc.\n *\n * See the description of @FT_Incremental_InterfaceRec to understand how\n * to use incremental objects with FreeType.\n *\n */\n typedef struct FT_IncrementalRec_* FT_Incremental;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Incremental_MetricsRec\n *\n * @description:\n * A small structure used to contain the basic glyph metrics returned by\n * the @FT_Incremental_GetGlyphMetricsFunc method.\n *\n * @fields:\n * bearing_x ::\n * Left bearing, in font units.\n *\n * bearing_y ::\n * Top bearing, in font units.\n *\n * advance ::\n * Horizontal component of glyph advance, in font units.\n *\n * advance_v ::\n * Vertical component of glyph advance, in font units.\n *\n * @note:\n * These correspond to horizontal or vertical metrics depending on the\n * value of the `vertical` argument to the function\n * @FT_Incremental_GetGlyphMetricsFunc.\n *\n */\n typedef struct FT_Incremental_MetricsRec_\n {\n FT_Long bearing_x;\n FT_Long bearing_y;\n FT_Long advance;\n FT_Long advance_v; /* since 2.3.12 */\n\n } FT_Incremental_MetricsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Incremental_Metrics\n *\n * @description:\n * A handle to an @FT_Incremental_MetricsRec structure.\n *\n */\n typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental_GetGlyphDataFunc\n *\n * @description:\n * A function called by FreeType to access a given glyph's data bytes\n * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is\n * enabled.\n *\n * Note that the format of the glyph's data bytes depends on the font\n * file format. For TrueType, it must correspond to the raw bytes within\n * the 'glyf' table. For PostScript formats, it must correspond to the\n * **unencrypted** charstring bytes, without any `lenIV` header. It is\n * undefined for any other format.\n *\n * @input:\n * incremental ::\n * Handle to an opaque @FT_Incremental handle provided by the client\n * application.\n *\n * glyph_index ::\n * Index of relevant glyph.\n *\n * @output:\n * adata ::\n * A structure describing the returned glyph data bytes (which will be\n * accessed as a read-only byte block).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If this function returns successfully the method\n * @FT_Incremental_FreeGlyphDataFunc will be called later to release the\n * data bytes.\n *\n * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for\n * compound glyphs.\n *\n */\n typedef FT_Error\n (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental,\n FT_UInt glyph_index,\n FT_Data* adata );\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental_FreeGlyphDataFunc\n *\n * @description:\n * A function used to release the glyph data bytes returned by a\n * successful call to @FT_Incremental_GetGlyphDataFunc.\n *\n * @input:\n * incremental ::\n * A handle to an opaque @FT_Incremental handle provided by the client\n * application.\n *\n * data ::\n * A structure describing the glyph data bytes (which will be accessed\n * as a read-only byte block).\n *\n */\n typedef void\n (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental,\n FT_Data* data );\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental_GetGlyphMetricsFunc\n *\n * @description:\n * A function used to retrieve the basic metrics of a given glyph index\n * before accessing its data. This is necessary because, in certain\n * formats like TrueType, the metrics are stored in a different place\n * from the glyph images proper.\n *\n * @input:\n * incremental ::\n * A handle to an opaque @FT_Incremental handle provided by the client\n * application.\n *\n * glyph_index ::\n * Index of relevant glyph.\n *\n * vertical ::\n * If true, return vertical metrics.\n *\n * ametrics ::\n * This parameter is used for both input and output. The original\n * glyph metrics, if any, in font units. If metrics are not available\n * all the values must be set to zero.\n *\n * @output:\n * ametrics ::\n * The replacement glyph metrics in font units.\n *\n */\n typedef FT_Error\n (*FT_Incremental_GetGlyphMetricsFunc)\n ( FT_Incremental incremental,\n FT_UInt glyph_index,\n FT_Bool vertical,\n FT_Incremental_MetricsRec *ametrics );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Incremental_FuncsRec\n *\n * @description:\n * A table of functions for accessing fonts that load data incrementally.\n * Used in @FT_Incremental_InterfaceRec.\n *\n * @fields:\n * get_glyph_data ::\n * The function to get glyph data. Must not be null.\n *\n * free_glyph_data ::\n * The function to release glyph data. Must not be null.\n *\n * get_glyph_metrics ::\n * The function to get glyph metrics. May be null if the font does not\n * provide overriding glyph metrics.\n *\n */\n typedef struct FT_Incremental_FuncsRec_\n {\n FT_Incremental_GetGlyphDataFunc get_glyph_data;\n FT_Incremental_FreeGlyphDataFunc free_glyph_data;\n FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics;\n\n } FT_Incremental_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Incremental_InterfaceRec\n *\n * @description:\n * A structure to be used with @FT_Open_Face to indicate that the user\n * wants to support incremental glyph loading. You should use it with\n * @FT_PARAM_TAG_INCREMENTAL as in the following example:\n *\n * ```\n * FT_Incremental_InterfaceRec inc_int;\n * FT_Parameter parameter;\n * FT_Open_Args open_args;\n *\n *\n * // set up incremental descriptor\n * inc_int.funcs = my_funcs;\n * inc_int.object = my_object;\n *\n * // set up optional parameter\n * parameter.tag = FT_PARAM_TAG_INCREMENTAL;\n * parameter.data = &inc_int;\n *\n * // set up FT_Open_Args structure\n * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;\n * open_args.pathname = my_font_pathname;\n * open_args.num_params = 1;\n * open_args.params = ¶meter; // we use one optional argument\n *\n * // open the font\n * error = FT_Open_Face( library, &open_args, index, &face );\n * ...\n * ```\n *\n */\n typedef struct FT_Incremental_InterfaceRec_\n {\n const FT_Incremental_FuncsRec* funcs;\n FT_Incremental object;\n\n } FT_Incremental_InterfaceRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental_Interface\n *\n * @description:\n * A pointer to an @FT_Incremental_InterfaceRec structure.\n *\n */\n typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface;\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTINCREM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftlcdfil.h", "language": "code", "loc": 302, "comment_density": 0.897, "code": "/****************************************************************************\n *\n * ftlcdfil.h\n *\n * FreeType API for color filtering of subpixel bitmap glyphs\n * (specification).\n *\n * Copyright (C) 2006-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTLCDFIL_H_\n#define FTLCDFIL_H_\n\n#include \n#include FT_FREETYPE_H\n#include FT_PARAMETER_TAGS_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * lcd_rendering\n *\n * @title:\n * Subpixel Rendering\n *\n * @abstract:\n * API to control subpixel rendering.\n *\n * @description:\n * FreeType provides two alternative subpixel rendering technologies. \n * Should you define `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` in your\n * `ftoption.h` file, this enables patented ClearType-style rendering. \n * Otherwise, Harmony LCD rendering is enabled. These technologies are\n * controlled differently and API described below, although always\n * available, performs its function when appropriate method is enabled\n * and does nothing otherwise.\n *\n * ClearType-style LCD rendering exploits the color-striped structure of\n * LCD pixels, increasing the available resolution in the direction of\n * the stripe (usually horizontal RGB) by a factor of~3. Using the\n * subpixels coverages unfiltered can create severe color fringes\n * especially when rendering thin features. Indeed, to produce\n * black-on-white text, the nearby color subpixels must be dimmed\n * equally.\n *\n * A good 5-tap FIR filter should be applied to subpixel coverages\n * regardless of pixel boundaries and should have these properties:\n *\n * 1. It should be symmetrical, like {~a, b, c, b, a~}, to avoid\n * any shifts in appearance.\n *\n * 2. It should be color-balanced, meaning a~+ b~=~c, to reduce color\n * fringes by distributing the computed coverage for one subpixel to\n * all subpixels equally.\n *\n * 3. It should be normalized, meaning 2a~+ 2b~+ c~=~1.0 to maintain\n * overall brightness.\n *\n * Boxy 3-tap filter {0, 1/3, 1/3, 1/3, 0} is sharper but is less\n * forgiving of non-ideal gamma curves of a screen (and viewing angles),\n * beveled filters are fuzzier but more tolerant.\n *\n * Use the @FT_Library_SetLcdFilter or @FT_Library_SetLcdFilterWeights\n * API to specify a low-pass filter, which is then applied to\n * subpixel-rendered bitmaps generated through @FT_Render_Glyph.\n *\n * Harmony LCD rendering is suitable to panels with any regular subpixel\n * structure, not just monitors with 3 color striped subpixels, as long\n * as the color subpixels have fixed positions relative to the pixel\n * center. In this case, each color channel is then rendered separately\n * after shifting the outline opposite to the subpixel shift so that the\n * coverage maps are aligned. This method is immune to color fringes\n * because the shifts do not change integral coverage.\n *\n * The subpixel geometry must be specified by xy-coordinates for each\n * subpixel. By convention they may come in the RGB order: {{-1/3, 0},\n * {0, 0}, {1/3, 0}} for standard RGB striped panel or {{-1/6, 1/4},\n * {-1/6, -1/4}, {1/3, 0}} for a certain PenTile panel.\n *\n * Use the @FT_Library_SetLcdGeometry API to specify subpixel positions.\n * If one follows the RGB order convention, the same order applies to the\n * resulting @FT_PIXEL_MODE_LCD and @FT_PIXEL_MODE_LCD_V bitmaps. Note,\n * however, that the coordinate frame for the latter must be rotated\n * clockwise. Harmony with default LCD geometry is equivalent to\n * ClearType with light filter.\n *\n * As a result of ClearType filtering or Harmony rendering, the\n * dimensions of LCD bitmaps can be either wider or taller than the\n * dimensions of the corresponding outline with regard to the pixel grid.\n * For example, for @FT_RENDER_MODE_LCD, the filter adds 2~subpixels to\n * the left, and 2~subpixels to the right. The bitmap offset values are\n * adjusted accordingly, so clients shouldn't need to modify their layout\n * and glyph positioning code when enabling the filter.\n *\n * The ClearType and Harmony rendering is applicable to glyph bitmaps\n * rendered through @FT_Render_Glyph, @FT_Load_Glyph, @FT_Load_Char, and\n * @FT_Glyph_To_Bitmap, when @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V\n * is specified. This API does not control @FT_Outline_Render and\n * @FT_Outline_Get_Bitmap.\n *\n * The described algorithms can completely remove color artefacts when\n * combined with gamma-corrected alpha blending in linear space. Each of\n * the 3~alpha values (subpixels) must by independently used to blend one\n * color channel. That is, red alpha blends the red channel of the text\n * color with the red channel of the background pixel.\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_LcdFilter\n *\n * @description:\n * A list of values to identify various types of LCD filters.\n *\n * @values:\n * FT_LCD_FILTER_NONE ::\n * Do not perform filtering. When used with subpixel rendering, this\n * results in sometimes severe color fringes.\n *\n * FT_LCD_FILTER_DEFAULT ::\n * This is a beveled, normalized, and color-balanced five-tap filter\n * with weights of [0x08 0x4D 0x56 0x4D 0x08] in 1/256th units.\n *\n * FT_LCD_FILTER_LIGHT ::\n * this is a boxy, normalized, and color-balanced three-tap filter with\n * weights of [0x00 0x55 0x56 0x55 0x00] in 1/256th units.\n *\n * FT_LCD_FILTER_LEGACY ::\n * FT_LCD_FILTER_LEGACY1 ::\n * This filter corresponds to the original libXft color filter. It\n * provides high contrast output but can exhibit really bad color\n * fringes if glyphs are not extremely well hinted to the pixel grid.\n * This filter is only provided for comparison purposes, and might be\n * disabled or stay unsupported in the future. The second value is\n * provided for compatibility with FontConfig, which historically used\n * different enumeration, sometimes incorrectly forwarded to FreeType.\n *\n * @since:\n * 2.3.0 (`FT_LCD_FILTER_LEGACY1` since 2.6.2)\n */\n typedef enum FT_LcdFilter_\n {\n FT_LCD_FILTER_NONE = 0,\n FT_LCD_FILTER_DEFAULT = 1,\n FT_LCD_FILTER_LIGHT = 2,\n FT_LCD_FILTER_LEGACY1 = 3,\n FT_LCD_FILTER_LEGACY = 16,\n\n FT_LCD_FILTER_MAX /* do not remove */\n\n } FT_LcdFilter;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Library_SetLcdFilter\n *\n * @description:\n * This function is used to apply color filtering to LCD decimated\n * bitmaps, like the ones used when calling @FT_Render_Glyph with\n * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.\n *\n * @input:\n * library ::\n * A handle to the target library instance.\n *\n * filter ::\n * The filter type.\n *\n * You can use @FT_LCD_FILTER_NONE here to disable this feature, or\n * @FT_LCD_FILTER_DEFAULT to use a default filter that should work well\n * on most LCD screens.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This feature is always disabled by default. Clients must make an\n * explicit call to this function with a `filter` value other than\n * @FT_LCD_FILTER_NONE in order to enable it.\n *\n * Due to **PATENTS** covering subpixel rendering, this function doesn't\n * do anything except returning `FT_Err_Unimplemented_Feature` if the\n * configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is not\n * defined in your build of the library, which should correspond to all\n * default builds of FreeType.\n *\n * @since:\n * 2.3.0\n */\n FT_EXPORT( FT_Error )\n FT_Library_SetLcdFilter( FT_Library library,\n FT_LcdFilter filter );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Library_SetLcdFilterWeights\n *\n * @description:\n * This function can be used to enable LCD filter with custom weights,\n * instead of using presets in @FT_Library_SetLcdFilter.\n *\n * @input:\n * library ::\n * A handle to the target library instance.\n *\n * weights ::\n * A pointer to an array; the function copies the first five bytes and\n * uses them to specify the filter weights in 1/256th units.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Due to **PATENTS** covering subpixel rendering, this function doesn't\n * do anything except returning `FT_Err_Unimplemented_Feature` if the\n * configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is not\n * defined in your build of the library, which should correspond to all\n * default builds of FreeType.\n *\n * LCD filter weights can also be set per face using @FT_Face_Properties\n * with @FT_PARAM_TAG_LCD_FILTER_WEIGHTS.\n *\n * @since:\n * 2.4.0\n */\n FT_EXPORT( FT_Error )\n FT_Library_SetLcdFilterWeights( FT_Library library,\n unsigned char *weights );\n\n\n /**************************************************************************\n *\n * @type:\n * FT_LcdFiveTapFilter\n *\n * @description:\n * A typedef for passing the five LCD filter weights to\n * @FT_Face_Properties within an @FT_Parameter structure.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_LCD_FILTER_FIVE_TAPS 5\n\n typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS];\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Library_SetLcdGeometry\n *\n * @description:\n * This function can be used to modify default positions of color\n * subpixels, which controls Harmony LCD rendering.\n *\n * @input:\n * library ::\n * A handle to the target library instance.\n *\n * sub ::\n * A pointer to an array of 3 vectors in 26.6 fractional pixel format;\n * the function modifies the default values, see the note below.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Subpixel geometry examples:\n *\n * - {{-21, 0}, {0, 0}, {21, 0}} is the default, corresponding to 3 color\n * stripes shifted by a third of a pixel. This could be an RGB panel.\n *\n * - {{21, 0}, {0, 0}, {-21, 0}} looks the same as the default but can\n * specify a BGR panel instead, while keeping the bitmap in the same\n * RGB888 format.\n *\n * - {{0, 21}, {0, 0}, {0, -21}} is the vertical RGB, but the bitmap\n * stays RGB888 as a result.\n *\n * - {{-11, 16}, {-11, -16}, {22, 0}} is a certain PenTile arrangement.\n *\n * This function does nothing and returns `FT_Err_Unimplemented_Feature`\n * in the context of ClearType-style subpixel rendering when\n * `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is defined in your build of the\n * library.\n *\n * @since:\n * 2.10.0\n */\n FT_EXPORT( FT_Error )\n FT_Library_SetLcdGeometry( FT_Library library,\n FT_Vector sub[3] );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTLCDFIL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftlist.h", "language": "code", "loc": 262, "comment_density": 0.84, "code": "/****************************************************************************\n *\n * ftlist.h\n *\n * Generic list support for FreeType (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file implements functions relative to list processing. Its data\n * structures are defined in `freetype.h`.\n *\n */\n\n\n#ifndef FTLIST_H_\n#define FTLIST_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * list_processing\n *\n * @title:\n * List Processing\n *\n * @abstract:\n * Simple management of lists.\n *\n * @description:\n * This section contains various definitions related to list processing\n * using doubly-linked nodes.\n *\n * @order:\n * FT_List\n * FT_ListNode\n * FT_ListRec\n * FT_ListNodeRec\n *\n * FT_List_Add\n * FT_List_Insert\n * FT_List_Find\n * FT_List_Remove\n * FT_List_Up\n * FT_List_Iterate\n * FT_List_Iterator\n * FT_List_Finalize\n * FT_List_Destructor\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Find\n *\n * @description:\n * Find the list node for a given listed object.\n *\n * @input:\n * list ::\n * A pointer to the parent list.\n * data ::\n * The address of the listed object.\n *\n * @return:\n * List node. `NULL` if it wasn't found.\n */\n FT_EXPORT( FT_ListNode )\n FT_List_Find( FT_List list,\n void* data );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Add\n *\n * @description:\n * Append an element to the end of a list.\n *\n * @inout:\n * list ::\n * A pointer to the parent list.\n * node ::\n * The node to append.\n */\n FT_EXPORT( void )\n FT_List_Add( FT_List list,\n FT_ListNode node );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Insert\n *\n * @description:\n * Insert an element at the head of a list.\n *\n * @inout:\n * list ::\n * A pointer to parent list.\n * node ::\n * The node to insert.\n */\n FT_EXPORT( void )\n FT_List_Insert( FT_List list,\n FT_ListNode node );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Remove\n *\n * @description:\n * Remove a node from a list. This function doesn't check whether the\n * node is in the list!\n *\n * @input:\n * node ::\n * The node to remove.\n *\n * @inout:\n * list ::\n * A pointer to the parent list.\n */\n FT_EXPORT( void )\n FT_List_Remove( FT_List list,\n FT_ListNode node );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Up\n *\n * @description:\n * Move a node to the head/top of a list. Used to maintain LRU lists.\n *\n * @inout:\n * list ::\n * A pointer to the parent list.\n * node ::\n * The node to move.\n */\n FT_EXPORT( void )\n FT_List_Up( FT_List list,\n FT_ListNode node );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_List_Iterator\n *\n * @description:\n * An FT_List iterator function that is called during a list parse by\n * @FT_List_Iterate.\n *\n * @input:\n * node ::\n * The current iteration list node.\n *\n * user ::\n * A typeless pointer passed to @FT_List_Iterate. Can be used to point\n * to the iteration's state.\n */\n typedef FT_Error\n (*FT_List_Iterator)( FT_ListNode node,\n void* user );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Iterate\n *\n * @description:\n * Parse a list and calls a given iterator function on each element.\n * Note that parsing is stopped as soon as one of the iterator calls\n * returns a non-zero value.\n *\n * @input:\n * list ::\n * A handle to the list.\n * iterator ::\n * An iterator function, called on each node of the list.\n * user ::\n * A user-supplied field that is passed as the second argument to the\n * iterator.\n *\n * @return:\n * The result (a FreeType error code) of the last iterator call.\n */\n FT_EXPORT( FT_Error )\n FT_List_Iterate( FT_List list,\n FT_List_Iterator iterator,\n void* user );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_List_Destructor\n *\n * @description:\n * An @FT_List iterator function that is called during a list\n * finalization by @FT_List_Finalize to destroy all elements in a given\n * list.\n *\n * @input:\n * system ::\n * The current system object.\n *\n * data ::\n * The current object to destroy.\n *\n * user ::\n * A typeless pointer passed to @FT_List_Iterate. It can be used to\n * point to the iteration's state.\n */\n typedef void\n (*FT_List_Destructor)( FT_Memory memory,\n void* data,\n void* user );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Finalize\n *\n * @description:\n * Destroy all elements in the list as well as the list itself.\n *\n * @input:\n * list ::\n * A handle to the list.\n *\n * destroy ::\n * A list destructor that will be applied to each element of the list.\n * Set this to `NULL` if not needed.\n *\n * memory ::\n * The current memory object that handles deallocation.\n *\n * user ::\n * A user-supplied field that is passed as the last argument to the\n * destructor.\n *\n * @note:\n * This function expects that all nodes added by @FT_List_Add or\n * @FT_List_Insert have been dynamically allocated.\n */\n FT_EXPORT( void )\n FT_List_Finalize( FT_List list,\n FT_List_Destructor destroy,\n FT_Memory memory,\n void* user );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTLIST_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftlzw.h", "language": "code", "loc": 86, "comment_density": 0.837, "code": "/****************************************************************************\n *\n * ftlzw.h\n *\n * LZW-compressed stream support.\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTLZW_H_\n#define FTLZW_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * lzw\n *\n * @title:\n * LZW Streams\n *\n * @abstract:\n * Using LZW-compressed font files.\n *\n * @description:\n * This section contains the declaration of LZW-specific functions.\n *\n */\n\n /**************************************************************************\n *\n * @function:\n * FT_Stream_OpenLZW\n *\n * @description:\n * Open a new stream to parse LZW-compressed font files. This is mainly\n * used to support the compressed `*.pcf.Z` fonts that come with XFree86.\n *\n * @input:\n * stream ::\n * The target embedding stream.\n *\n * source ::\n * The source stream.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source stream must be opened _before_ calling this function.\n *\n * Calling the internal function `FT_Stream_Close` on the new stream will\n * **not** call `FT_Stream_Close` on the source stream. None of the\n * stream objects will be released to the heap.\n *\n * The stream implementation is very basic and resets the decompression\n * process each time seeking backwards is needed within the stream\n *\n * In certain builds of the library, LZW compression recognition is\n * automatically handled when calling @FT_New_Face or @FT_Open_Face.\n * This means that if no font driver is capable of handling the raw\n * compressed file, the library will try to open a LZW stream from it and\n * re-open the face with it.\n *\n * This function may return `FT_Err_Unimplemented_Feature` if your build\n * of FreeType was not compiled with LZW support.\n */\n FT_EXPORT( FT_Error )\n FT_Stream_OpenLZW( FT_Stream stream,\n FT_Stream source );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTLZW_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftmac.h", "language": "code", "loc": 259, "comment_density": 0.815, "code": "/****************************************************************************\n *\n * ftmac.h\n *\n * Additional Mac-specific API.\n *\n * Copyright (C) 1996-2020 by\n * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n/****************************************************************************\n *\n * NOTE: Include this file after `FT_FREETYPE_H` and after any\n * Mac-specific headers (because this header uses Mac types such as\n * 'Handle', 'FSSpec', 'FSRef', etc.)\n *\n */\n\n\n#ifndef FTMAC_H_\n#define FTMAC_H_\n\n\n#include \n\n\nFT_BEGIN_HEADER\n\n\n /* gcc-3.1 and later can warn about functions tagged as deprecated */\n#ifndef FT_DEPRECATED_ATTRIBUTE\n#if defined( __GNUC__ ) && \\\n ( ( __GNUC__ >= 4 ) || \\\n ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) )\n#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated ))\n#else\n#define FT_DEPRECATED_ATTRIBUTE\n#endif\n#endif\n\n\n /**************************************************************************\n *\n * @section:\n * mac_specific\n *\n * @title:\n * Mac Specific Interface\n *\n * @abstract:\n * Only available on the Macintosh.\n *\n * @description:\n * The following definitions are only available if FreeType is compiled\n * on a Macintosh.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Face_From_FOND\n *\n * @description:\n * Create a new face object from a FOND resource.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * fond ::\n * A FOND resource.\n *\n * face_index ::\n * Only supported for the -1 'sanity check' special case.\n *\n * @output:\n * aface ::\n * A handle to a new face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @example:\n * This function can be used to create @FT_Face objects from fonts that\n * are installed in the system as follows.\n *\n * ```\n * fond = GetResource( 'FOND', fontName );\n * error = FT_New_Face_From_FOND( library, fond, 0, &face );\n * ```\n */\n FT_EXPORT( FT_Error )\n FT_New_Face_From_FOND( FT_Library library,\n Handle fond,\n FT_Long face_index,\n FT_Face *aface )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_GetFile_From_Mac_Name\n *\n * @description:\n * Return an FSSpec for the disk file containing the named font.\n *\n * @input:\n * fontName ::\n * Mac OS name of the font (e.g., Times New Roman Bold).\n *\n * @output:\n * pathSpec ::\n * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec.\n *\n * face_index ::\n * Index of the face. For passing to @FT_New_Face_From_FSSpec.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_GetFile_From_Mac_Name( const char* fontName,\n FSSpec* pathSpec,\n FT_Long* face_index )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_GetFile_From_Mac_ATS_Name\n *\n * @description:\n * Return an FSSpec for the disk file containing the named font.\n *\n * @input:\n * fontName ::\n * Mac OS name of the font in ATS framework.\n *\n * @output:\n * pathSpec ::\n * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec.\n *\n * face_index ::\n * Index of the face. For passing to @FT_New_Face_From_FSSpec.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_GetFile_From_Mac_ATS_Name( const char* fontName,\n FSSpec* pathSpec,\n FT_Long* face_index )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_GetFilePath_From_Mac_ATS_Name\n *\n * @description:\n * Return a pathname of the disk file and face index for given font name\n * that is handled by ATS framework.\n *\n * @input:\n * fontName ::\n * Mac OS name of the font in ATS framework.\n *\n * @output:\n * path ::\n * Buffer to store pathname of the file. For passing to @FT_New_Face.\n * The client must allocate this buffer before calling this function.\n *\n * maxPathSize ::\n * Lengths of the buffer `path` that client allocated.\n *\n * face_index ::\n * Index of the face. For passing to @FT_New_Face.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_GetFilePath_From_Mac_ATS_Name( const char* fontName,\n UInt8* path,\n UInt32 maxPathSize,\n FT_Long* face_index )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Face_From_FSSpec\n *\n * @description:\n * Create a new face object from a given resource and typeface index\n * using an FSSpec to the font file.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * spec ::\n * FSSpec to the font file.\n *\n * face_index ::\n * The index of the face within the resource. The first face has\n * index~0.\n * @output:\n * aface ::\n * A handle to a new face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * @FT_New_Face_From_FSSpec is identical to @FT_New_Face except it\n * accepts an FSSpec instead of a path.\n */\n FT_EXPORT( FT_Error )\n FT_New_Face_From_FSSpec( FT_Library library,\n const FSSpec *spec,\n FT_Long face_index,\n FT_Face *aface )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Face_From_FSRef\n *\n * @description:\n * Create a new face object from a given resource and typeface index\n * using an FSRef to the font file.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * spec ::\n * FSRef to the font file.\n *\n * face_index ::\n * The index of the face within the resource. The first face has\n * index~0.\n * @output:\n * aface ::\n * A handle to a new face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * @FT_New_Face_From_FSRef is identical to @FT_New_Face except it accepts\n * an FSRef instead of a path.\n */\n FT_EXPORT( FT_Error )\n FT_New_Face_From_FSRef( FT_Library library,\n const FSRef *ref,\n FT_Long face_index,\n FT_Face *aface )\n FT_DEPRECATED_ATTRIBUTE;\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* FTMAC_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftmm.h", "language": "code", "loc": 692, "comment_density": 0.866, "code": "/****************************************************************************\n *\n * ftmm.h\n *\n * FreeType Multiple Master font interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTMM_H_\n#define FTMM_H_\n\n\n#include \n#include FT_TYPE1_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * multiple_masters\n *\n * @title:\n * Multiple Masters\n *\n * @abstract:\n * How to manage Multiple Masters fonts.\n *\n * @description:\n * The following types and functions are used to manage Multiple Master\n * fonts, i.e., the selection of specific design instances by setting\n * design axis coordinates.\n *\n * Besides Adobe MM fonts, the interface supports Apple's TrueType GX and\n * OpenType variation fonts. Some of the routines only work with Adobe\n * MM fonts, others will work with all three types. They are similar\n * enough that a consistent interface makes sense.\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_MM_Axis\n *\n * @description:\n * A structure to model a given axis in design space for Multiple Masters\n * fonts.\n *\n * This structure can't be used for TrueType GX or OpenType variation\n * fonts.\n *\n * @fields:\n * name ::\n * The axis's name.\n *\n * minimum ::\n * The axis's minimum design coordinate.\n *\n * maximum ::\n * The axis's maximum design coordinate.\n */\n typedef struct FT_MM_Axis_\n {\n FT_String* name;\n FT_Long minimum;\n FT_Long maximum;\n\n } FT_MM_Axis;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Multi_Master\n *\n * @description:\n * A structure to model the axes and space of a Multiple Masters font.\n *\n * This structure can't be used for TrueType GX or OpenType variation\n * fonts.\n *\n * @fields:\n * num_axis ::\n * Number of axes. Cannot exceed~4.\n *\n * num_designs ::\n * Number of designs; should be normally 2^num_axis even though the\n * Type~1 specification strangely allows for intermediate designs to be\n * present. This number cannot exceed~16.\n *\n * axis ::\n * A table of axis descriptors.\n */\n typedef struct FT_Multi_Master_\n {\n FT_UInt num_axis;\n FT_UInt num_designs;\n FT_MM_Axis axis[T1_MAX_MM_AXIS];\n\n } FT_Multi_Master;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Var_Axis\n *\n * @description:\n * A structure to model a given axis in design space for Multiple\n * Masters, TrueType GX, and OpenType variation fonts.\n *\n * @fields:\n * name ::\n * The axis's name. Not always meaningful for TrueType GX or OpenType\n * variation fonts.\n *\n * minimum ::\n * The axis's minimum design coordinate.\n *\n * def ::\n * The axis's default design coordinate. FreeType computes meaningful\n * default values for Adobe MM fonts.\n *\n * maximum ::\n * The axis's maximum design coordinate.\n *\n * tag ::\n * The axis's tag (the equivalent to 'name' for TrueType GX and\n * OpenType variation fonts). FreeType provides default values for\n * Adobe MM fonts if possible.\n *\n * strid ::\n * The axis name entry in the font's 'name' table. This is another\n * (and often better) version of the 'name' field for TrueType GX or\n * OpenType variation fonts. Not meaningful for Adobe MM fonts.\n *\n * @note:\n * The fields `minimum`, `def`, and `maximum` are 16.16 fractional values\n * for TrueType GX and OpenType variation fonts. For Adobe MM fonts, the\n * values are integers.\n */\n typedef struct FT_Var_Axis_\n {\n FT_String* name;\n\n FT_Fixed minimum;\n FT_Fixed def;\n FT_Fixed maximum;\n\n FT_ULong tag;\n FT_UInt strid;\n\n } FT_Var_Axis;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Var_Named_Style\n *\n * @description:\n * A structure to model a named instance in a TrueType GX or OpenType\n * variation font.\n *\n * This structure can't be used for Adobe MM fonts.\n *\n * @fields:\n * coords ::\n * The design coordinates for this instance. This is an array with one\n * entry for each axis.\n *\n * strid ::\n * The entry in 'name' table identifying this instance.\n *\n * psid ::\n * The entry in 'name' table identifying a PostScript name for this\n * instance. Value 0xFFFF indicates a missing entry.\n */\n typedef struct FT_Var_Named_Style_\n {\n FT_Fixed* coords;\n FT_UInt strid;\n FT_UInt psid; /* since 2.7.1 */\n\n } FT_Var_Named_Style;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_MM_Var\n *\n * @description:\n * A structure to model the axes and space of an Adobe MM, TrueType GX,\n * or OpenType variation font.\n *\n * Some fields are specific to one format and not to the others.\n *\n * @fields:\n * num_axis ::\n * The number of axes. The maximum value is~4 for Adobe MM fonts; no\n * limit in TrueType GX or OpenType variation fonts.\n *\n * num_designs ::\n * The number of designs; should be normally 2^num_axis for Adobe MM\n * fonts. Not meaningful for TrueType GX or OpenType variation fonts\n * (where every glyph could have a different number of designs).\n *\n * num_namedstyles ::\n * The number of named styles; a 'named style' is a tuple of design\n * coordinates that has a string ID (in the 'name' table) associated\n * with it. The font can tell the user that, for example,\n * [Weight=1.5,Width=1.1] is 'Bold'. Another name for 'named style' is\n * 'named instance'.\n *\n * For Adobe Multiple Masters fonts, this value is always zero because\n * the format does not support named styles.\n *\n * axis ::\n * An axis descriptor table. TrueType GX and OpenType variation fonts\n * contain slightly more data than Adobe MM fonts. Memory management\n * of this pointer is done internally by FreeType.\n *\n * namedstyle ::\n * A named style (instance) table. Only meaningful for TrueType GX and\n * OpenType variation fonts. Memory management of this pointer is done\n * internally by FreeType.\n */\n typedef struct FT_MM_Var_\n {\n FT_UInt num_axis;\n FT_UInt num_designs;\n FT_UInt num_namedstyles;\n FT_Var_Axis* axis;\n FT_Var_Named_Style* namedstyle;\n\n } FT_MM_Var;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Multi_Master\n *\n * @description:\n * Retrieve a variation descriptor of a given Adobe MM font.\n *\n * This function can't be used with TrueType GX or OpenType variation\n * fonts.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * @output:\n * amaster ::\n * The Multiple Masters descriptor.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Multi_Master( FT_Face face,\n FT_Multi_Master *amaster );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_MM_Var\n *\n * @description:\n * Retrieve a variation descriptor for a given font.\n *\n * This function works with all supported variation formats.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * @output:\n * amaster ::\n * The variation descriptor. Allocates a data structure, which the\n * user must deallocate with a call to @FT_Done_MM_Var after use.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Get_MM_Var( FT_Face face,\n FT_MM_Var* *amaster );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_MM_Var\n *\n * @description:\n * Free the memory allocated by @FT_Get_MM_Var.\n *\n * @input:\n * library ::\n * A handle of the face's parent library object that was used in the\n * call to @FT_Get_MM_Var to create `amaster`.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Done_MM_Var( FT_Library library,\n FT_MM_Var *amaster );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_MM_Design_Coordinates\n *\n * @description:\n * For Adobe MM fonts, choose an interpolated font design through design\n * coordinates.\n *\n * This function can't be used with TrueType GX or OpenType variation\n * fonts.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * @input:\n * num_coords ::\n * The number of available design coordinates. If it is larger than\n * the number of axes, ignore the excess values. If it is smaller than\n * the number of axes, use default values for the remaining axes.\n *\n * coords ::\n * An array of design coordinates.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * [Since 2.8.1] To reset all axes to the default values, call the\n * function with `num_coords` set to zero and `coords` set to `NULL`.\n *\n * [Since 2.9] If `num_coords` is larger than zero, this function sets\n * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field\n * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero,\n * this bit flag gets unset.\n */\n FT_EXPORT( FT_Error )\n FT_Set_MM_Design_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Long* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Var_Design_Coordinates\n *\n * @description:\n * Choose an interpolated font design through design coordinates.\n *\n * This function works with all supported variation formats.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * @input:\n * num_coords ::\n * The number of available design coordinates. If it is larger than\n * the number of axes, ignore the excess values. If it is smaller than\n * the number of axes, use default values for the remaining axes.\n *\n * coords ::\n * An array of design coordinates.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * [Since 2.8.1] To reset all axes to the default values, call the\n * function with `num_coords` set to zero and `coords` set to `NULL`.\n * [Since 2.9] 'Default values' means the currently selected named\n * instance (or the base font if no named instance is selected).\n *\n * [Since 2.9] If `num_coords` is larger than zero, this function sets\n * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field\n * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero,\n * this bit flag gets unset.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Var_Design_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Var_Design_Coordinates\n *\n * @description:\n * Get the design coordinates of the currently selected interpolated\n * font.\n *\n * This function works with all supported variation formats.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * num_coords ::\n * The number of design coordinates to retrieve. If it is larger than\n * the number of axes, set the excess values to~0.\n *\n * @output:\n * coords ::\n * The design coordinates array.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.7.1\n */\n FT_EXPORT( FT_Error )\n FT_Get_Var_Design_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_MM_Blend_Coordinates\n *\n * @description:\n * Choose an interpolated font design through normalized blend\n * coordinates.\n *\n * This function works with all supported variation formats.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * @input:\n * num_coords ::\n * The number of available design coordinates. If it is larger than\n * the number of axes, ignore the excess values. If it is smaller than\n * the number of axes, use default values for the remaining axes.\n *\n * coords ::\n * The design coordinates array (each element must be between 0 and 1.0\n * for Adobe MM fonts, and between -1.0 and 1.0 for TrueType GX and\n * OpenType variation fonts).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * [Since 2.8.1] To reset all axes to the default values, call the\n * function with `num_coords` set to zero and `coords` set to `NULL`.\n * [Since 2.9] 'Default values' means the currently selected named\n * instance (or the base font if no named instance is selected).\n *\n * [Since 2.9] If `num_coords` is larger than zero, this function sets\n * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field\n * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero,\n * this bit flag gets unset.\n */\n FT_EXPORT( FT_Error )\n FT_Set_MM_Blend_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_MM_Blend_Coordinates\n *\n * @description:\n * Get the normalized blend coordinates of the currently selected\n * interpolated font.\n *\n * This function works with all supported variation formats.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * num_coords ::\n * The number of normalized blend coordinates to retrieve. If it is\n * larger than the number of axes, set the excess values to~0.5 for\n * Adobe MM fonts, and to~0 for TrueType GX and OpenType variation\n * fonts.\n *\n * @output:\n * coords ::\n * The normalized blend coordinates array.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.7.1\n */\n FT_EXPORT( FT_Error )\n FT_Get_MM_Blend_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Var_Blend_Coordinates\n *\n * @description:\n * This is another name of @FT_Set_MM_Blend_Coordinates.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Var_Blend_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Var_Blend_Coordinates\n *\n * @description:\n * This is another name of @FT_Get_MM_Blend_Coordinates.\n *\n * @since:\n * 2.7.1\n */\n FT_EXPORT( FT_Error )\n FT_Get_Var_Blend_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_MM_WeightVector\n *\n * @description:\n * For Adobe MM fonts, choose an interpolated font design by directly\n * setting the weight vector.\n *\n * This function can't be used with TrueType GX or OpenType variation\n * fonts.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * @input:\n * len ::\n * The length of the weight vector array. If it is larger than the\n * number of designs, the extra values are ignored. If it is less than\n * the number of designs, the remaining values are set to zero.\n *\n * weightvector ::\n * An array representing the weight vector.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Adobe Multiple Master fonts limit the number of designs, and thus the\n * length of the weight vector to~16.\n *\n * If `len` is zero and `weightvector` is `NULL`, the weight vector array\n * is reset to the default values.\n *\n * The Adobe documentation also states that the values in the\n * WeightVector array must total 1.0 +/-~0.001. In practice this does\n * not seem to be enforced, so is not enforced here, either.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Set_MM_WeightVector( FT_Face face,\n FT_UInt len,\n FT_Fixed* weightvector );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_MM_WeightVector\n *\n * @description:\n * For Adobe MM fonts, retrieve the current weight vector of the font.\n *\n * This function can't be used with TrueType GX or OpenType variation\n * fonts.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * len ::\n * A pointer to the size of the array to be filled. If the size of the\n * array is less than the number of designs, `FT_Err_Invalid_Argument`\n * is returned, and `len` is set to the required size (the number of\n * designs). If the size of the array is greater than the number of\n * designs, the remaining entries are set to~0. On successful\n * completion, `len` is set to the number of designs (i.e., the number\n * of values written to the array).\n *\n * @output:\n * weightvector ::\n * An array to be filled.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Adobe Multiple Master fonts limit the number of designs, and thus the\n * length of the WeightVector to~16.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Get_MM_WeightVector( FT_Face face,\n FT_UInt* len,\n FT_Fixed* weightvector );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_VAR_AXIS_FLAG_XXX\n *\n * @description:\n * A list of bit flags used in the return value of\n * @FT_Get_Var_Axis_Flags.\n *\n * @values:\n * FT_VAR_AXIS_FLAG_HIDDEN ::\n * The variation axis should not be exposed to user interfaces.\n *\n * @since:\n * 2.8.1\n */\n#define FT_VAR_AXIS_FLAG_HIDDEN 1\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Var_Axis_Flags\n *\n * @description:\n * Get the 'flags' field of an OpenType Variation Axis Record.\n *\n * Not meaningful for Adobe MM fonts (`*flags` is always zero).\n *\n * @input:\n * master ::\n * The variation descriptor.\n *\n * axis_index ::\n * The index of the requested variation axis.\n *\n * @output:\n * flags ::\n * The 'flags' field. See @FT_VAR_AXIS_FLAG_XXX for possible values.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.8.1\n */\n FT_EXPORT( FT_Error )\n FT_Get_Var_Axis_Flags( FT_MM_Var* master,\n FT_UInt axis_index,\n FT_UInt* flags );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Named_Instance\n *\n * @description:\n * Set or change the current named instance.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * instance_index ::\n * The index of the requested instance, starting with value 1. If set\n * to value 0, FreeType switches to font access without a named\n * instance.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The function uses the value of `instance_index` to set bits 16-30 of\n * the face's `face_index` field. It also resets any variation applied\n * to the font, and the @FT_FACE_FLAG_VARIATION bit of the face's\n * `face_flags` field gets reset to zero (i.e., @FT_IS_VARIATION will\n * return false).\n *\n * For Adobe MM fonts (which don't have named instances) this function\n * simply resets the current face to the default instance.\n *\n * @since:\n * 2.9\n */\n FT_EXPORT( FT_Error )\n FT_Set_Named_Instance( FT_Face face,\n FT_UInt instance_index );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTMM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftmodapi.h", "language": "code", "loc": 717, "comment_density": 0.883, "code": "/****************************************************************************\n *\n * ftmodapi.h\n *\n * FreeType modules public interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTMODAPI_H_\n#define FTMODAPI_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * module_management\n *\n * @title:\n * Module Management\n *\n * @abstract:\n * How to add, upgrade, remove, and control modules from FreeType.\n *\n * @description:\n * The definitions below are used to manage modules within FreeType.\n * Modules can be added, upgraded, and removed at runtime. Additionally,\n * some module properties can be controlled also.\n *\n * Here is a list of possible values of the `module_name` field in the\n * @FT_Module_Class structure.\n *\n * ```\n * autofitter\n * bdf\n * cff\n * gxvalid\n * otvalid\n * pcf\n * pfr\n * psaux\n * pshinter\n * psnames\n * raster1\n * sfnt\n * smooth, smooth-lcd, smooth-lcdv\n * truetype\n * type1\n * type42\n * t1cid\n * winfonts\n * ```\n *\n * Note that the FreeType Cache sub-system is not a FreeType module.\n *\n * @order:\n * FT_Module\n * FT_Module_Constructor\n * FT_Module_Destructor\n * FT_Module_Requester\n * FT_Module_Class\n *\n * FT_Add_Module\n * FT_Get_Module\n * FT_Remove_Module\n * FT_Add_Default_Modules\n *\n * FT_Property_Set\n * FT_Property_Get\n * FT_Set_Default_Properties\n *\n * FT_New_Library\n * FT_Done_Library\n * FT_Reference_Library\n *\n * FT_Renderer\n * FT_Renderer_Class\n *\n * FT_Get_Renderer\n * FT_Set_Renderer\n *\n * FT_Set_Debug_Hook\n *\n */\n\n\n /* module bit flags */\n#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */\n#define FT_MODULE_RENDERER 2 /* this module is a renderer */\n#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */\n#define FT_MODULE_STYLER 8 /* this module is a styler */\n\n#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */\n /* scalable fonts */\n#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */\n /* support vector outlines */\n#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */\n /* own hinter */\n#define FT_MODULE_DRIVER_HINTS_LIGHTLY 0x800 /* the driver's hinter */\n /* produces LIGHT hints */\n\n\n /* deprecated values */\n#define ft_module_font_driver FT_MODULE_FONT_DRIVER\n#define ft_module_renderer FT_MODULE_RENDERER\n#define ft_module_hinter FT_MODULE_HINTER\n#define ft_module_styler FT_MODULE_STYLER\n\n#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE\n#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES\n#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER\n#define ft_module_driver_hints_lightly FT_MODULE_DRIVER_HINTS_LIGHTLY\n\n\n typedef FT_Pointer FT_Module_Interface;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Module_Constructor\n *\n * @description:\n * A function used to initialize (not create) a new module object.\n *\n * @input:\n * module ::\n * The module to initialize.\n */\n typedef FT_Error\n (*FT_Module_Constructor)( FT_Module module );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Module_Destructor\n *\n * @description:\n * A function used to finalize (not destroy) a given module object.\n *\n * @input:\n * module ::\n * The module to finalize.\n */\n typedef void\n (*FT_Module_Destructor)( FT_Module module );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Module_Requester\n *\n * @description:\n * A function used to query a given module for a specific interface.\n *\n * @input:\n * module ::\n * The module to be searched.\n *\n * name ::\n * The name of the interface in the module.\n */\n typedef FT_Module_Interface\n (*FT_Module_Requester)( FT_Module module,\n const char* name );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Module_Class\n *\n * @description:\n * The module class descriptor. While being a public structure necessary\n * for FreeType's module bookkeeping, most of the fields are essentially\n * internal, not to be used directly by an application.\n *\n * @fields:\n * module_flags ::\n * Bit flags describing the module.\n *\n * module_size ::\n * The size of one module object/instance in bytes.\n *\n * module_name ::\n * The name of the module.\n *\n * module_version ::\n * The version, as a 16.16 fixed number (major.minor).\n *\n * module_requires ::\n * The version of FreeType this module requires, as a 16.16 fixed\n * number (major.minor). Starts at version 2.0, i.e., 0x20000.\n *\n * module_interface ::\n * A typeless pointer to a structure (which varies between different\n * modules) that holds the module's interface functions. This is\n * essentially what `get_interface` returns.\n *\n * module_init ::\n * The initializing function.\n *\n * module_done ::\n * The finalizing function.\n *\n * get_interface ::\n * The interface requesting function.\n */\n typedef struct FT_Module_Class_\n {\n FT_ULong module_flags;\n FT_Long module_size;\n const FT_String* module_name;\n FT_Fixed module_version;\n FT_Fixed module_requires;\n\n const void* module_interface;\n\n FT_Module_Constructor module_init;\n FT_Module_Destructor module_done;\n FT_Module_Requester get_interface;\n\n } FT_Module_Class;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Add_Module\n *\n * @description:\n * Add a new module to a given library instance.\n *\n * @inout:\n * library ::\n * A handle to the library object.\n *\n * @input:\n * clazz ::\n * A pointer to class descriptor for the module.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * An error will be returned if a module already exists by that name, or\n * if the module requires a version of FreeType that is too great.\n */\n FT_EXPORT( FT_Error )\n FT_Add_Module( FT_Library library,\n const FT_Module_Class* clazz );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Module\n *\n * @description:\n * Find a module by its name.\n *\n * @input:\n * library ::\n * A handle to the library object.\n *\n * module_name ::\n * The module's name (as an ASCII string).\n *\n * @return:\n * A module handle. 0~if none was found.\n *\n * @note:\n * FreeType's internal modules aren't documented very well, and you\n * should look up the source code for details.\n */\n FT_EXPORT( FT_Module )\n FT_Get_Module( FT_Library library,\n const char* module_name );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Remove_Module\n *\n * @description:\n * Remove a given module from a library instance.\n *\n * @inout:\n * library ::\n * A handle to a library object.\n *\n * @input:\n * module ::\n * A handle to a module object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The module object is destroyed by the function in case of success.\n */\n FT_EXPORT( FT_Error )\n FT_Remove_Module( FT_Library library,\n FT_Module module );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Property_Set\n *\n * @description:\n * Set a property for a given module.\n *\n * @input:\n * library ::\n * A handle to the library the module is part of.\n *\n * module_name ::\n * The module name.\n *\n * property_name ::\n * The property name. Properties are described in section\n * @properties.\n *\n * Note that only a few modules have properties.\n *\n * value ::\n * A generic pointer to a variable or structure that gives the new\n * value of the property. The exact definition of `value` is\n * dependent on the property; see section @properties.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If `module_name` isn't a valid module name, or `property_name`\n * doesn't specify a valid property, or if `value` doesn't represent a\n * valid value for the given property, an error is returned.\n *\n * The following example sets property 'bar' (a simple integer) in\n * module 'foo' to value~1.\n *\n * ```\n * FT_UInt bar;\n *\n *\n * bar = 1;\n * FT_Property_Set( library, \"foo\", \"bar\", &bar );\n * ```\n *\n * Note that the FreeType Cache sub-system doesn't recognize module\n * property changes. To avoid glyph lookup confusion within the cache\n * you should call @FTC_Manager_Reset to completely flush the cache if a\n * module property gets changed after @FTC_Manager_New has been called.\n *\n * It is not possible to set properties of the FreeType Cache sub-system\n * itself with FT_Property_Set; use @FTC_Property_Set instead.\n *\n * @since:\n * 2.4.11\n *\n */\n FT_EXPORT( FT_Error )\n FT_Property_Set( FT_Library library,\n const FT_String* module_name,\n const FT_String* property_name,\n const void* value );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Property_Get\n *\n * @description:\n * Get a module's property value.\n *\n * @input:\n * library ::\n * A handle to the library the module is part of.\n *\n * module_name ::\n * The module name.\n *\n * property_name ::\n * The property name. Properties are described in section\n * @properties.\n *\n * @inout:\n * value ::\n * A generic pointer to a variable or structure that gives the value\n * of the property. The exact definition of `value` is dependent on\n * the property; see section @properties.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If `module_name` isn't a valid module name, or `property_name`\n * doesn't specify a valid property, or if `value` doesn't represent a\n * valid value for the given property, an error is returned.\n *\n * The following example gets property 'baz' (a range) in module 'foo'.\n *\n * ```\n * typedef range_\n * {\n * FT_Int32 min;\n * FT_Int32 max;\n *\n * } range;\n *\n * range baz;\n *\n *\n * FT_Property_Get( library, \"foo\", \"baz\", &baz );\n * ```\n *\n * It is not possible to retrieve properties of the FreeType Cache\n * sub-system with FT_Property_Get; use @FTC_Property_Get instead.\n *\n * @since:\n * 2.4.11\n *\n */\n FT_EXPORT( FT_Error )\n FT_Property_Get( FT_Library library,\n const FT_String* module_name,\n const FT_String* property_name,\n void* value );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Default_Properties\n *\n * @description:\n * If compilation option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES` is\n * set, this function reads the `FREETYPE_PROPERTIES` environment\n * variable to control driver properties. See section @properties for\n * more.\n *\n * If the compilation option is not set, this function does nothing.\n *\n * `FREETYPE_PROPERTIES` has the following syntax form (broken here into\n * multiple lines for better readability).\n *\n * ```\n * \n * ':'\n * '=' \n * \n * ':'\n * '=' \n * ...\n * ```\n *\n * Example:\n *\n * ```\n * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \\\n * cff:no-stem-darkening=1 \\\n * autofitter:warping=1\n * ```\n *\n * @inout:\n * library ::\n * A handle to a new library object.\n *\n * @since:\n * 2.8\n */\n FT_EXPORT( void )\n FT_Set_Default_Properties( FT_Library library );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Reference_Library\n *\n * @description:\n * A counter gets initialized to~1 at the time an @FT_Library structure\n * is created. This function increments the counter. @FT_Done_Library\n * then only destroys a library if the counter is~1, otherwise it simply\n * decrements the counter.\n *\n * This function helps in managing life-cycles of structures that\n * reference @FT_Library objects.\n *\n * @input:\n * library ::\n * A handle to a target library object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.4.2\n */\n FT_EXPORT( FT_Error )\n FT_Reference_Library( FT_Library library );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Library\n *\n * @description:\n * This function is used to create a new FreeType library instance from a\n * given memory object. It is thus possible to use libraries with\n * distinct memory allocators within the same program. Note, however,\n * that the used @FT_Memory structure is expected to remain valid for the\n * life of the @FT_Library object.\n *\n * Normally, you would call this function (followed by a call to\n * @FT_Add_Default_Modules or a series of calls to @FT_Add_Module, and a\n * call to @FT_Set_Default_Properties) instead of @FT_Init_FreeType to\n * initialize the FreeType library.\n *\n * Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a library\n * instance.\n *\n * @input:\n * memory ::\n * A handle to the original memory object.\n *\n * @output:\n * alibrary ::\n * A pointer to handle of a new library object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * See the discussion of reference counters in the description of\n * @FT_Reference_Library.\n */\n FT_EXPORT( FT_Error )\n FT_New_Library( FT_Memory memory,\n FT_Library *alibrary );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Library\n *\n * @description:\n * Discard a given library object. This closes all drivers and discards\n * all resource objects.\n *\n * @input:\n * library ::\n * A handle to the target library.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * See the discussion of reference counters in the description of\n * @FT_Reference_Library.\n */\n FT_EXPORT( FT_Error )\n FT_Done_Library( FT_Library library );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_DebugHook_Func\n *\n * @description:\n * A drop-in replacement (or rather a wrapper) for the bytecode or\n * charstring interpreter's main loop function.\n *\n * Its job is essentially\n *\n * - to activate debug mode to enforce single-stepping,\n *\n * - to call the main loop function to interpret the next opcode, and\n *\n * - to show the changed context to the user.\n *\n * An example for such a main loop function is `TT_RunIns` (declared in\n * FreeType's internal header file `src/truetype/ttinterp.h`).\n *\n * Have a look at the source code of the `ttdebug` FreeType demo program\n * for an example of a drop-in replacement.\n *\n * @inout:\n * arg ::\n * A typeless pointer, to be cast to the main loop function's data\n * structure (which depends on the font module). For TrueType fonts\n * it is bytecode interpreter's execution context, `TT_ExecContext`,\n * which is declared in FreeType's internal header file `tttypes.h`.\n */\n typedef FT_Error\n (*FT_DebugHook_Func)( void* arg );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_DEBUG_HOOK_XXX\n *\n * @description:\n * A list of named debug hook indices.\n *\n * @values:\n * FT_DEBUG_HOOK_TRUETYPE::\n * This hook index identifies the TrueType bytecode debugger.\n */\n#define FT_DEBUG_HOOK_TRUETYPE 0\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Debug_Hook\n *\n * @description:\n * Set a debug hook function for debugging the interpreter of a font\n * format.\n *\n * While this is a public API function, an application needs access to\n * FreeType's internal header files to do something useful.\n *\n * Have a look at the source code of the `ttdebug` FreeType demo program\n * for an example of its usage.\n *\n * @inout:\n * library ::\n * A handle to the library object.\n *\n * @input:\n * hook_index ::\n * The index of the debug hook. You should use defined enumeration\n * macros like @FT_DEBUG_HOOK_TRUETYPE.\n *\n * debug_hook ::\n * The function used to debug the interpreter.\n *\n * @note:\n * Currently, four debug hook slots are available, but only one (for the\n * TrueType interpreter) is defined.\n */\n FT_EXPORT( void )\n FT_Set_Debug_Hook( FT_Library library,\n FT_UInt hook_index,\n FT_DebugHook_Func debug_hook );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Add_Default_Modules\n *\n * @description:\n * Add the set of default drivers to a given library object. This is\n * only useful when you create a library object with @FT_New_Library\n * (usually to plug a custom memory manager).\n *\n * @inout:\n * library ::\n * A handle to a new library object.\n */\n FT_EXPORT( void )\n FT_Add_Default_Modules( FT_Library library );\n\n\n\n /**************************************************************************\n *\n * @section:\n * truetype_engine\n *\n * @title:\n * The TrueType Engine\n *\n * @abstract:\n * TrueType bytecode support.\n *\n * @description:\n * This section contains a function used to query the level of TrueType\n * bytecode support compiled in this version of the library.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_TrueTypeEngineType\n *\n * @description:\n * A list of values describing which kind of TrueType bytecode engine is\n * implemented in a given FT_Library instance. It is used by the\n * @FT_Get_TrueType_Engine_Type function.\n *\n * @values:\n * FT_TRUETYPE_ENGINE_TYPE_NONE ::\n * The library doesn't implement any kind of bytecode interpreter.\n *\n * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::\n * Deprecated and removed.\n *\n * FT_TRUETYPE_ENGINE_TYPE_PATENTED ::\n * The library implements a bytecode interpreter that covers the full\n * instruction set of the TrueType virtual machine (this was governed\n * by patents until May 2010, hence the name).\n *\n * @since:\n * 2.2\n *\n */\n typedef enum FT_TrueTypeEngineType_\n {\n FT_TRUETYPE_ENGINE_TYPE_NONE = 0,\n FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,\n FT_TRUETYPE_ENGINE_TYPE_PATENTED\n\n } FT_TrueTypeEngineType;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_TrueType_Engine_Type\n *\n * @description:\n * Return an @FT_TrueTypeEngineType value to indicate which level of the\n * TrueType virtual machine a given library instance supports.\n *\n * @input:\n * library ::\n * A library instance.\n *\n * @return:\n * A value indicating which level is supported.\n *\n * @since:\n * 2.2\n *\n */\n FT_EXPORT( FT_TrueTypeEngineType )\n FT_Get_TrueType_Engine_Type( FT_Library library );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTMODAPI_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftmoderr.h", "language": "code", "loc": 173, "comment_density": 0.705, "code": "/****************************************************************************\n *\n * ftmoderr.h\n *\n * FreeType module error offsets (specification).\n *\n * Copyright (C) 2001-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file is used to define the FreeType module error codes.\n *\n * If the macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` in `ftoption.h` is\n * set, the lower byte of an error value identifies the error code as\n * usual. In addition, the higher byte identifies the module. For\n * example, the error `FT_Err_Invalid_File_Format` has value 0x0003, the\n * error `TT_Err_Invalid_File_Format` has value 0x1303, the error\n * `T1_Err_Invalid_File_Format` has value 0x1403, etc.\n *\n * Note that `FT_Err_Ok`, `TT_Err_Ok`, etc. are always equal to zero,\n * including the high byte.\n *\n * If `FT_CONFIG_OPTION_USE_MODULE_ERRORS` isn't set, the higher byte of an\n * error value is set to zero.\n *\n * To hide the various `XXX_Err_` prefixes in the source code, FreeType\n * provides some macros in `fttypes.h`.\n *\n * FT_ERR( err )\n *\n * Add current error module prefix (as defined with the `FT_ERR_PREFIX`\n * macro) to `err`. For example, in the BDF module the line\n *\n * ```\n * error = FT_ERR( Invalid_Outline );\n * ```\n *\n * expands to\n *\n * ```\n * error = BDF_Err_Invalid_Outline;\n * ```\n *\n * For simplicity, you can always use `FT_Err_Ok` directly instead of\n * `FT_ERR( Ok )`.\n *\n * FT_ERR_EQ( errcode, err )\n * FT_ERR_NEQ( errcode, err )\n *\n * Compare error code `errcode` with the error `err` for equality and\n * inequality, respectively. Example:\n *\n * ```\n * if ( FT_ERR_EQ( error, Invalid_Outline ) )\n * ...\n * ```\n *\n * Using this macro you don't have to think about error prefixes. Of\n * course, if module errors are not active, the above example is the\n * same as\n *\n * ```\n * if ( error == FT_Err_Invalid_Outline )\n * ...\n * ```\n *\n * FT_ERROR_BASE( errcode )\n * FT_ERROR_MODULE( errcode )\n *\n * Get base error and module error code, respectively.\n *\n * It can also be used to create a module error message table easily with\n * something like\n *\n * ```\n * #undef FTMODERR_H_\n * #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s },\n * #define FT_MODERR_START_LIST {\n * #define FT_MODERR_END_LIST { 0, 0 } };\n *\n * const struct\n * {\n * int mod_err_offset;\n * const char* mod_err_msg\n * } ft_mod_errors[] =\n *\n * #include FT_MODULE_ERRORS_H\n * ```\n *\n */\n\n\n#ifndef FTMODERR_H_\n#define FTMODERR_H_\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** SETUP MACROS *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n\n#undef FT_NEED_EXTERN_C\n\n#ifndef FT_MODERRDEF\n\n#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS\n#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,\n#else\n#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,\n#endif\n\n#define FT_MODERR_START_LIST enum {\n#define FT_MODERR_END_LIST FT_Mod_Err_Max };\n\n#ifdef __cplusplus\n#define FT_NEED_EXTERN_C\n extern \"C\" {\n#endif\n\n#endif /* !FT_MODERRDEF */\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** LIST MODULE ERROR BASES *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n\n#ifdef FT_MODERR_START_LIST\n FT_MODERR_START_LIST\n#endif\n\n\n FT_MODERRDEF( Base, 0x000, \"base module\" )\n FT_MODERRDEF( Autofit, 0x100, \"autofitter module\" )\n FT_MODERRDEF( BDF, 0x200, \"BDF module\" )\n FT_MODERRDEF( Bzip2, 0x300, \"Bzip2 module\" )\n FT_MODERRDEF( Cache, 0x400, \"cache module\" )\n FT_MODERRDEF( CFF, 0x500, \"CFF module\" )\n FT_MODERRDEF( CID, 0x600, \"CID module\" )\n FT_MODERRDEF( Gzip, 0x700, \"Gzip module\" )\n FT_MODERRDEF( LZW, 0x800, \"LZW module\" )\n FT_MODERRDEF( OTvalid, 0x900, \"OpenType validation module\" )\n FT_MODERRDEF( PCF, 0xA00, \"PCF module\" )\n FT_MODERRDEF( PFR, 0xB00, \"PFR module\" )\n FT_MODERRDEF( PSaux, 0xC00, \"PS auxiliary module\" )\n FT_MODERRDEF( PShinter, 0xD00, \"PS hinter module\" )\n FT_MODERRDEF( PSnames, 0xE00, \"PS names module\" )\n FT_MODERRDEF( Raster, 0xF00, \"raster module\" )\n FT_MODERRDEF( SFNT, 0x1000, \"SFNT module\" )\n FT_MODERRDEF( Smooth, 0x1100, \"smooth raster module\" )\n FT_MODERRDEF( TrueType, 0x1200, \"TrueType module\" )\n FT_MODERRDEF( Type1, 0x1300, \"Type 1 module\" )\n FT_MODERRDEF( Type42, 0x1400, \"Type 42 module\" )\n FT_MODERRDEF( Winfonts, 0x1500, \"Windows FON/FNT module\" )\n FT_MODERRDEF( GXvalid, 0x1600, \"GX validation module\" )\n\n\n#ifdef FT_MODERR_END_LIST\n FT_MODERR_END_LIST\n#endif\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** CLEANUP *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n\n#ifdef FT_NEED_EXTERN_C\n }\n#endif\n\n#undef FT_MODERR_START_LIST\n#undef FT_MODERR_END_LIST\n#undef FT_MODERRDEF\n#undef FT_NEED_EXTERN_C\n\n\n#endif /* FTMODERR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftotval.h", "language": "code", "loc": 183, "comment_density": 0.814, "code": "/****************************************************************************\n *\n * ftotval.h\n *\n * FreeType API for validating OpenType tables (specification).\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n/****************************************************************************\n *\n *\n * Warning: This module might be moved to a different library in the\n * future to avoid a tight dependency between FreeType and the\n * OpenType specification.\n *\n *\n */\n\n\n#ifndef FTOTVAL_H_\n#define FTOTVAL_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * ot_validation\n *\n * @title:\n * OpenType Validation\n *\n * @abstract:\n * An API to validate OpenType tables.\n *\n * @description:\n * This section contains the declaration of functions to validate some\n * OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).\n *\n * @order:\n * FT_OpenType_Validate\n * FT_OpenType_Free\n *\n * FT_VALIDATE_OTXXX\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_VALIDATE_OTXXX\n *\n * @description:\n * A list of bit-field constants used with @FT_OpenType_Validate to\n * indicate which OpenType tables should be validated.\n *\n * @values:\n * FT_VALIDATE_BASE ::\n * Validate BASE table.\n *\n * FT_VALIDATE_GDEF ::\n * Validate GDEF table.\n *\n * FT_VALIDATE_GPOS ::\n * Validate GPOS table.\n *\n * FT_VALIDATE_GSUB ::\n * Validate GSUB table.\n *\n * FT_VALIDATE_JSTF ::\n * Validate JSTF table.\n *\n * FT_VALIDATE_MATH ::\n * Validate MATH table.\n *\n * FT_VALIDATE_OT ::\n * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).\n *\n */\n#define FT_VALIDATE_BASE 0x0100\n#define FT_VALIDATE_GDEF 0x0200\n#define FT_VALIDATE_GPOS 0x0400\n#define FT_VALIDATE_GSUB 0x0800\n#define FT_VALIDATE_JSTF 0x1000\n#define FT_VALIDATE_MATH 0x2000\n\n#define FT_VALIDATE_OT ( FT_VALIDATE_BASE | \\\n FT_VALIDATE_GDEF | \\\n FT_VALIDATE_GPOS | \\\n FT_VALIDATE_GSUB | \\\n FT_VALIDATE_JSTF | \\\n FT_VALIDATE_MATH )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_OpenType_Validate\n *\n * @description:\n * Validate various OpenType tables to assure that all offsets and\n * indices are valid. The idea is that a higher-level library that\n * actually does the text layout can access those tables without error\n * checking (which can be quite time consuming).\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * validation_flags ::\n * A bit field that specifies the tables to be validated. See\n * @FT_VALIDATE_OTXXX for possible values.\n *\n * @output:\n * BASE_table ::\n * A pointer to the BASE table.\n *\n * GDEF_table ::\n * A pointer to the GDEF table.\n *\n * GPOS_table ::\n * A pointer to the GPOS table.\n *\n * GSUB_table ::\n * A pointer to the GSUB table.\n *\n * JSTF_table ::\n * A pointer to the JSTF table.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with OpenType fonts, returning an error\n * otherwise.\n *\n * After use, the application should deallocate the five tables with\n * @FT_OpenType_Free. A `NULL` value indicates that the table either\n * doesn't exist in the font, or the application hasn't asked for\n * validation.\n */\n FT_EXPORT( FT_Error )\n FT_OpenType_Validate( FT_Face face,\n FT_UInt validation_flags,\n FT_Bytes *BASE_table,\n FT_Bytes *GDEF_table,\n FT_Bytes *GPOS_table,\n FT_Bytes *GSUB_table,\n FT_Bytes *JSTF_table );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_OpenType_Free\n *\n * @description:\n * Free the buffer allocated by OpenType validator.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * table ::\n * The pointer to the buffer that is allocated by\n * @FT_OpenType_Validate.\n *\n * @note:\n * This function must be used to free the buffer allocated by\n * @FT_OpenType_Validate only.\n */\n FT_EXPORT( void )\n FT_OpenType_Free( FT_Face face,\n FT_Bytes table );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTOTVAL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftoutln.h", "language": "code", "loc": 544, "comment_density": 0.881, "code": "/****************************************************************************\n *\n * ftoutln.h\n *\n * Support for the FT_Outline type used to store glyph shapes of\n * most scalable font formats (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTOUTLN_H_\n#define FTOUTLN_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * outline_processing\n *\n * @title:\n * Outline Processing\n *\n * @abstract:\n * Functions to create, transform, and render vectorial glyph images.\n *\n * @description:\n * This section contains routines used to create and destroy scalable\n * glyph images known as 'outlines'. These can also be measured,\n * transformed, and converted into bitmaps and pixmaps.\n *\n * @order:\n * FT_Outline\n * FT_Outline_New\n * FT_Outline_Done\n * FT_Outline_Copy\n * FT_Outline_Translate\n * FT_Outline_Transform\n * FT_Outline_Embolden\n * FT_Outline_EmboldenXY\n * FT_Outline_Reverse\n * FT_Outline_Check\n *\n * FT_Outline_Get_CBox\n * FT_Outline_Get_BBox\n *\n * FT_Outline_Get_Bitmap\n * FT_Outline_Render\n * FT_Outline_Decompose\n * FT_Outline_Funcs\n * FT_Outline_MoveToFunc\n * FT_Outline_LineToFunc\n * FT_Outline_ConicToFunc\n * FT_Outline_CubicToFunc\n *\n * FT_Orientation\n * FT_Outline_Get_Orientation\n *\n * FT_OUTLINE_XXX\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Decompose\n *\n * @description:\n * Walk over an outline's structure to decompose it into individual\n * segments and Bezier arcs. This function also emits 'move to'\n * operations to indicate the start of new contours in the outline.\n *\n * @input:\n * outline ::\n * A pointer to the source target.\n *\n * func_interface ::\n * A table of 'emitters', i.e., function pointers called during\n * decomposition to indicate path operations.\n *\n * @inout:\n * user ::\n * A typeless pointer that is passed to each emitter during the\n * decomposition. It can be used to store the state during the\n * decomposition.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * A contour that contains a single point only is represented by a 'move\n * to' operation followed by 'line to' to the same point. In most cases,\n * it is best to filter this out before using the outline for stroking\n * purposes (otherwise it would result in a visible dot when round caps\n * are used).\n *\n * Similarly, the function returns success for an empty outline also\n * (doing nothing, this is, not calling any emitter); if necessary, you\n * should filter this out, too.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Decompose( FT_Outline* outline,\n const FT_Outline_Funcs* func_interface,\n void* user );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_New\n *\n * @description:\n * Create a new outline of a given size.\n *\n * @input:\n * library ::\n * A handle to the library object from where the outline is allocated.\n * Note however that the new outline will **not** necessarily be\n * **freed**, when destroying the library, by @FT_Done_FreeType.\n *\n * numPoints ::\n * The maximum number of points within the outline. Must be smaller\n * than or equal to 0xFFFF (65535).\n *\n * numContours ::\n * The maximum number of contours within the outline. This value must\n * be in the range 0 to `numPoints`.\n *\n * @output:\n * anoutline ::\n * A handle to the new outline.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The reason why this function takes a `library` parameter is simply to\n * use the library's memory allocator.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_New( FT_Library library,\n FT_UInt numPoints,\n FT_Int numContours,\n FT_Outline *anoutline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Done\n *\n * @description:\n * Destroy an outline created with @FT_Outline_New.\n *\n * @input:\n * library ::\n * A handle of the library object used to allocate the outline.\n *\n * outline ::\n * A pointer to the outline object to be discarded.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If the outline's 'owner' field is not set, only the outline descriptor\n * will be released.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Done( FT_Library library,\n FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Check\n *\n * @description:\n * Check the contents of an outline descriptor.\n *\n * @input:\n * outline ::\n * A handle to a source outline.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * An empty outline, or an outline with a single point only is also\n * valid.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Check( FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Get_CBox\n *\n * @description:\n * Return an outline's 'control box'. The control box encloses all the\n * outline's points, including Bezier control points. Though it\n * coincides with the exact bounding box for most glyphs, it can be\n * slightly larger in some situations (like when rotating an outline that\n * contains Bezier outside arcs).\n *\n * Computing the control box is very fast, while getting the bounding box\n * can take much more time as it needs to walk over all segments and arcs\n * in the outline. To get the latter, you can use the 'ftbbox'\n * component, which is dedicated to this single task.\n *\n * @input:\n * outline ::\n * A pointer to the source outline descriptor.\n *\n * @output:\n * acbox ::\n * The outline's control box.\n *\n * @note:\n * See @FT_Glyph_Get_CBox for a discussion of tricky fonts.\n */\n FT_EXPORT( void )\n FT_Outline_Get_CBox( const FT_Outline* outline,\n FT_BBox *acbox );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Translate\n *\n * @description:\n * Apply a simple translation to the points of an outline.\n *\n * @inout:\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * @input:\n * xOffset ::\n * The horizontal offset.\n *\n * yOffset ::\n * The vertical offset.\n */\n FT_EXPORT( void )\n FT_Outline_Translate( const FT_Outline* outline,\n FT_Pos xOffset,\n FT_Pos yOffset );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Copy\n *\n * @description:\n * Copy an outline into another one. Both objects must have the same\n * sizes (number of points & number of contours) when this function is\n * called.\n *\n * @input:\n * source ::\n * A handle to the source outline.\n *\n * @output:\n * target ::\n * A handle to the target outline.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Copy( const FT_Outline* source,\n FT_Outline *target );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Transform\n *\n * @description:\n * Apply a simple 2x2 matrix to all of an outline's points. Useful for\n * applying rotations, slanting, flipping, etc.\n *\n * @inout:\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * @input:\n * matrix ::\n * A pointer to the transformation matrix.\n *\n * @note:\n * You can use @FT_Outline_Translate if you need to translate the\n * outline's points.\n */\n FT_EXPORT( void )\n FT_Outline_Transform( const FT_Outline* outline,\n const FT_Matrix* matrix );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Embolden\n *\n * @description:\n * Embolden an outline. The new outline will be at most 4~times\n * `strength` pixels wider and higher. You may think of the left and\n * bottom borders as unchanged.\n *\n * Negative `strength` values to reduce the outline thickness are\n * possible also.\n *\n * @inout:\n * outline ::\n * A handle to the target outline.\n *\n * @input:\n * strength ::\n * How strong the glyph is emboldened. Expressed in 26.6 pixel format.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The used algorithm to increase or decrease the thickness of the glyph\n * doesn't change the number of points; this means that certain\n * situations like acute angles or intersections are sometimes handled\n * incorrectly.\n *\n * If you need 'better' metrics values you should call\n * @FT_Outline_Get_CBox or @FT_Outline_Get_BBox.\n *\n * To get meaningful results, font scaling values must be set with\n * functions like @FT_Set_Char_Size before calling FT_Render_Glyph.\n *\n * @example:\n * ```\n * FT_Load_Glyph( face, index, FT_LOAD_DEFAULT );\n *\n * if ( face->glyph->format == FT_GLYPH_FORMAT_OUTLINE )\n * FT_Outline_Embolden( &face->glyph->outline, strength );\n * ```\n *\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Embolden( FT_Outline* outline,\n FT_Pos strength );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_EmboldenXY\n *\n * @description:\n * Embolden an outline. The new outline will be `xstrength` pixels wider\n * and `ystrength` pixels higher. Otherwise, it is similar to\n * @FT_Outline_Embolden, which uses the same strength in both directions.\n *\n * @since:\n * 2.4.10\n */\n FT_EXPORT( FT_Error )\n FT_Outline_EmboldenXY( FT_Outline* outline,\n FT_Pos xstrength,\n FT_Pos ystrength );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Reverse\n *\n * @description:\n * Reverse the drawing direction of an outline. This is used to ensure\n * consistent fill conventions for mirrored glyphs.\n *\n * @inout:\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * @note:\n * This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in the\n * outline's `flags` field.\n *\n * It shouldn't be used by a normal client application, unless it knows\n * what it is doing.\n */\n FT_EXPORT( void )\n FT_Outline_Reverse( FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Get_Bitmap\n *\n * @description:\n * Render an outline within a bitmap. The outline's image is simply\n * OR-ed to the target bitmap.\n *\n * @input:\n * library ::\n * A handle to a FreeType library object.\n *\n * outline ::\n * A pointer to the source outline descriptor.\n *\n * @inout:\n * abitmap ::\n * A pointer to the target bitmap descriptor.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function does **not create** the bitmap, it only renders an\n * outline image within the one you pass to it! Consequently, the\n * various fields in `abitmap` should be set accordingly.\n *\n * It will use the raster corresponding to the default glyph format.\n *\n * The value of the `num_grays` field in `abitmap` is ignored. If you\n * select the gray-level rasterizer, and you want less than 256 gray\n * levels, you have to use @FT_Outline_Render directly.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Get_Bitmap( FT_Library library,\n FT_Outline* outline,\n const FT_Bitmap *abitmap );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Render\n *\n * @description:\n * Render an outline within a bitmap using the current scan-convert.\n *\n * @input:\n * library ::\n * A handle to a FreeType library object.\n *\n * outline ::\n * A pointer to the source outline descriptor.\n *\n * @inout:\n * params ::\n * A pointer to an @FT_Raster_Params structure used to describe the\n * rendering operation.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This advanced function uses @FT_Raster_Params as an argument,\n * allowing FreeType rasterizer to be used for direct composition,\n * translucency, etc. You should know how to set up @FT_Raster_Params\n * for this function to work.\n *\n * The field `params.source` will be set to `outline` before the scan\n * converter is called, which means that the value you give to it is\n * actually ignored.\n *\n * The gray-level rasterizer always uses 256 gray levels. If you want\n * less gray levels, you have to provide your own span callback. See the\n * @FT_RASTER_FLAG_DIRECT value of the `flags` field in the\n * @FT_Raster_Params structure for more details.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Render( FT_Library library,\n FT_Outline* outline,\n FT_Raster_Params* params );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Orientation\n *\n * @description:\n * A list of values used to describe an outline's contour orientation.\n *\n * The TrueType and PostScript specifications use different conventions\n * to determine whether outline contours should be filled or unfilled.\n *\n * @values:\n * FT_ORIENTATION_TRUETYPE ::\n * According to the TrueType specification, clockwise contours must be\n * filled, and counter-clockwise ones must be unfilled.\n *\n * FT_ORIENTATION_POSTSCRIPT ::\n * According to the PostScript specification, counter-clockwise\n * contours must be filled, and clockwise ones must be unfilled.\n *\n * FT_ORIENTATION_FILL_RIGHT ::\n * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to\n * remember that in TrueType, everything that is to the right of the\n * drawing direction of a contour must be filled.\n *\n * FT_ORIENTATION_FILL_LEFT ::\n * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to\n * remember that in PostScript, everything that is to the left of the\n * drawing direction of a contour must be filled.\n *\n * FT_ORIENTATION_NONE ::\n * The orientation cannot be determined. That is, different parts of\n * the glyph have different orientation.\n *\n */\n typedef enum FT_Orientation_\n {\n FT_ORIENTATION_TRUETYPE = 0,\n FT_ORIENTATION_POSTSCRIPT = 1,\n FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,\n FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT,\n FT_ORIENTATION_NONE\n\n } FT_Orientation;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Get_Orientation\n *\n * @description:\n * This function analyzes a glyph outline and tries to compute its fill\n * orientation (see @FT_Orientation). This is done by integrating the\n * total area covered by the outline. The positive integral corresponds\n * to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT is\n * returned. The negative integral corresponds to the counter-clockwise\n * orientation and @FT_ORIENTATION_TRUETYPE is returned.\n *\n * Note that this will return @FT_ORIENTATION_TRUETYPE for empty\n * outlines.\n *\n * @input:\n * outline ::\n * A handle to the source outline.\n *\n * @return:\n * The orientation.\n *\n */\n FT_EXPORT( FT_Orientation )\n FT_Outline_Get_Orientation( FT_Outline* outline );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTOUTLN_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftparams.h", "language": "code", "loc": 170, "comment_density": 0.829, "code": "/****************************************************************************\n *\n * ftparams.h\n *\n * FreeType API for possible FT_Parameter tags (specification only).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTPARAMS_H_\n#define FTPARAMS_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * parameter_tags\n *\n * @title:\n * Parameter Tags\n *\n * @abstract:\n * Macros for driver property and font loading parameter tags.\n *\n * @description:\n * This section contains macros for the @FT_Parameter structure that are\n * used with various functions to activate some special functionality or\n * different behaviour of various components of FreeType.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY\n *\n * @description:\n * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic\n * family names in the 'name' table (introduced in OpenType version 1.4).\n * Use this for backward compatibility with legacy systems that have a\n * four-faces-per-family restriction.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \\\n FT_MAKE_TAG( 'i', 'g', 'p', 'f' )\n\n\n /* this constant is deprecated */\n#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \\\n FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY\n *\n * @description:\n * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic\n * subfamily names in the 'name' table (introduced in OpenType version\n * 1.4). Use this for backward compatibility with legacy systems that\n * have a four-faces-per-family restriction.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \\\n FT_MAKE_TAG( 'i', 'g', 'p', 's' )\n\n\n /* this constant is deprecated */\n#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \\\n FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_INCREMENTAL\n *\n * @description:\n * An @FT_Parameter tag to be used with @FT_Open_Face to indicate\n * incremental glyph loading.\n *\n */\n#define FT_PARAM_TAG_INCREMENTAL \\\n FT_MAKE_TAG( 'i', 'n', 'c', 'r' )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_LCD_FILTER_WEIGHTS\n *\n * @description:\n * An @FT_Parameter tag to be used with @FT_Face_Properties. The\n * corresponding argument specifies the five LCD filter weights for a\n * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding the\n * global default values or the values set up with\n * @FT_Library_SetLcdFilterWeights.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \\\n FT_MAKE_TAG( 'l', 'c', 'd', 'f' )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_RANDOM_SEED\n *\n * @description:\n * An @FT_Parameter tag to be used with @FT_Face_Properties. The\n * corresponding 32bit signed integer argument overrides the font\n * driver's random seed value with a face-specific one; see @random-seed.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_RANDOM_SEED \\\n FT_MAKE_TAG( 's', 'e', 'e', 'd' )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_STEM_DARKENING\n *\n * @description:\n * An @FT_Parameter tag to be used with @FT_Face_Properties. The\n * corresponding Boolean argument specifies whether to apply stem\n * darkening, overriding the global default values or the values set up\n * with @FT_Property_Set (see @no-stem-darkening).\n *\n * This is a passive setting that only takes effect if the font driver or\n * autohinter honors it, which the CFF, Type~1, and CID drivers always\n * do, but the autohinter only in 'light' hinting mode (as of version\n * 2.9).\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_STEM_DARKENING \\\n FT_MAKE_TAG( 'd', 'a', 'r', 'k' )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_UNPATENTED_HINTING\n *\n * @description:\n * Deprecated, no effect.\n *\n * Previously: A constant used as the tag of an @FT_Parameter structure\n * to indicate that unpatented methods only should be used by the\n * TrueType bytecode interpreter for a typeface opened by @FT_Open_Face.\n *\n */\n#define FT_PARAM_TAG_UNPATENTED_HINTING \\\n FT_MAKE_TAG( 'u', 'n', 'p', 'a' )\n\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* FTPARAMS_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftpfr.h", "language": "code", "loc": 160, "comment_density": 0.838, "code": "/****************************************************************************\n *\n * ftpfr.h\n *\n * FreeType API for accessing PFR-specific data (specification only).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTPFR_H_\n#define FTPFR_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * pfr_fonts\n *\n * @title:\n * PFR Fonts\n *\n * @abstract:\n * PFR/TrueDoc-specific API.\n *\n * @description:\n * This section contains the declaration of PFR-specific functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PFR_Metrics\n *\n * @description:\n * Return the outline and metrics resolutions of a given PFR face.\n *\n * @input:\n * face ::\n * Handle to the input face. It can be a non-PFR face.\n *\n * @output:\n * aoutline_resolution ::\n * Outline resolution. This is equivalent to `face->units_per_EM` for\n * non-PFR fonts. Optional (parameter can be `NULL`).\n *\n * ametrics_resolution ::\n * Metrics resolution. This is equivalent to `outline_resolution` for\n * non-PFR fonts. Optional (parameter can be `NULL`).\n *\n * ametrics_x_scale ::\n * A 16.16 fixed-point number used to scale distance expressed in\n * metrics units to device subpixels. This is equivalent to\n * `face->size->x_scale`, but for metrics only. Optional (parameter\n * can be `NULL`).\n *\n * ametrics_y_scale ::\n * Same as `ametrics_x_scale` but for the vertical direction.\n * optional (parameter can be `NULL`).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If the input face is not a PFR, this function will return an error.\n * However, in all cases, it will return valid values.\n */\n FT_EXPORT( FT_Error )\n FT_Get_PFR_Metrics( FT_Face face,\n FT_UInt *aoutline_resolution,\n FT_UInt *ametrics_resolution,\n FT_Fixed *ametrics_x_scale,\n FT_Fixed *ametrics_y_scale );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PFR_Kerning\n *\n * @description:\n * Return the kerning pair corresponding to two glyphs in a PFR face.\n * The distance is expressed in metrics units, unlike the result of\n * @FT_Get_Kerning.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * left ::\n * Index of the left glyph.\n *\n * right ::\n * Index of the right glyph.\n *\n * @output:\n * avector ::\n * A kerning vector.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function always return distances in original PFR metrics units.\n * This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED mode,\n * which always returns distances converted to outline units.\n *\n * You can use the value of the `x_scale` and `y_scale` parameters\n * returned by @FT_Get_PFR_Metrics to scale these to device subpixels.\n */\n FT_EXPORT( FT_Error )\n FT_Get_PFR_Kerning( FT_Face face,\n FT_UInt left,\n FT_UInt right,\n FT_Vector *avector );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PFR_Advance\n *\n * @description:\n * Return a given glyph advance, expressed in original metrics units,\n * from a PFR font.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * gindex ::\n * The glyph index.\n *\n * @output:\n * aadvance ::\n * The glyph advance in metrics units.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You can use the `x_scale` or `y_scale` results of @FT_Get_PFR_Metrics\n * to convert the advance to device subpixels (i.e., 1/64th of pixels).\n */\n FT_EXPORT( FT_Error )\n FT_Get_PFR_Advance( FT_Face face,\n FT_UInt gindex,\n FT_Pos *aadvance );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTPFR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftrender.h", "language": "code", "loc": 202, "comment_density": 0.594, "code": "/****************************************************************************\n *\n * ftrender.h\n *\n * FreeType renderer modules public interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTRENDER_H_\n#define FTRENDER_H_\n\n\n#include \n#include FT_MODULE_H\n#include FT_GLYPH_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * module_management\n *\n */\n\n\n /* create a new glyph object */\n typedef FT_Error\n (*FT_Glyph_InitFunc)( FT_Glyph glyph,\n FT_GlyphSlot slot );\n\n /* destroys a given glyph object */\n typedef void\n (*FT_Glyph_DoneFunc)( FT_Glyph glyph );\n\n typedef void\n (*FT_Glyph_TransformFunc)( FT_Glyph glyph,\n const FT_Matrix* matrix,\n const FT_Vector* delta );\n\n typedef void\n (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph,\n FT_BBox* abbox );\n\n typedef FT_Error\n (*FT_Glyph_CopyFunc)( FT_Glyph source,\n FT_Glyph target );\n\n typedef FT_Error\n (*FT_Glyph_PrepareFunc)( FT_Glyph glyph,\n FT_GlyphSlot slot );\n\n/* deprecated */\n#define FT_Glyph_Init_Func FT_Glyph_InitFunc\n#define FT_Glyph_Done_Func FT_Glyph_DoneFunc\n#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc\n#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc\n#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc\n#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc\n\n\n struct FT_Glyph_Class_\n {\n FT_Long glyph_size;\n FT_Glyph_Format glyph_format;\n\n FT_Glyph_InitFunc glyph_init;\n FT_Glyph_DoneFunc glyph_done;\n FT_Glyph_CopyFunc glyph_copy;\n FT_Glyph_TransformFunc glyph_transform;\n FT_Glyph_GetBBoxFunc glyph_bbox;\n FT_Glyph_PrepareFunc glyph_prepare;\n };\n\n\n typedef FT_Error\n (*FT_Renderer_RenderFunc)( FT_Renderer renderer,\n FT_GlyphSlot slot,\n FT_Render_Mode mode,\n const FT_Vector* origin );\n\n typedef FT_Error\n (*FT_Renderer_TransformFunc)( FT_Renderer renderer,\n FT_GlyphSlot slot,\n const FT_Matrix* matrix,\n const FT_Vector* delta );\n\n\n typedef void\n (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer,\n FT_GlyphSlot slot,\n FT_BBox* cbox );\n\n\n typedef FT_Error\n (*FT_Renderer_SetModeFunc)( FT_Renderer renderer,\n FT_ULong mode_tag,\n FT_Pointer mode_ptr );\n\n/* deprecated identifiers */\n#define FTRenderer_render FT_Renderer_RenderFunc\n#define FTRenderer_transform FT_Renderer_TransformFunc\n#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc\n#define FTRenderer_setMode FT_Renderer_SetModeFunc\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Renderer_Class\n *\n * @description:\n * The renderer module class descriptor.\n *\n * @fields:\n * root ::\n * The root @FT_Module_Class fields.\n *\n * glyph_format ::\n * The glyph image format this renderer handles.\n *\n * render_glyph ::\n * A method used to render the image that is in a given glyph slot into\n * a bitmap.\n *\n * transform_glyph ::\n * A method used to transform the image that is in a given glyph slot.\n *\n * get_glyph_cbox ::\n * A method used to access the glyph's cbox.\n *\n * set_mode ::\n * A method used to pass additional parameters.\n *\n * raster_class ::\n * For @FT_GLYPH_FORMAT_OUTLINE renderers only. This is a pointer to\n * its raster's class.\n */\n typedef struct FT_Renderer_Class_\n {\n FT_Module_Class root;\n\n FT_Glyph_Format glyph_format;\n\n FT_Renderer_RenderFunc render_glyph;\n FT_Renderer_TransformFunc transform_glyph;\n FT_Renderer_GetCBoxFunc get_glyph_cbox;\n FT_Renderer_SetModeFunc set_mode;\n\n FT_Raster_Funcs* raster_class;\n\n } FT_Renderer_Class;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Renderer\n *\n * @description:\n * Retrieve the current renderer for a given glyph format.\n *\n * @input:\n * library ::\n * A handle to the library object.\n *\n * format ::\n * The glyph format.\n *\n * @return:\n * A renderer handle. 0~if none found.\n *\n * @note:\n * An error will be returned if a module already exists by that name, or\n * if the module requires a version of FreeType that is too great.\n *\n * To add a new renderer, simply use @FT_Add_Module. To retrieve a\n * renderer by its name, use @FT_Get_Module.\n */\n FT_EXPORT( FT_Renderer )\n FT_Get_Renderer( FT_Library library,\n FT_Glyph_Format format );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Renderer\n *\n * @description:\n * Set the current renderer to use, and set additional mode.\n *\n * @inout:\n * library ::\n * A handle to the library object.\n *\n * @input:\n * renderer ::\n * A handle to the renderer object.\n *\n * num_params ::\n * The number of additional parameters.\n *\n * parameters ::\n * Additional parameters.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * In case of success, the renderer will be used to convert glyph images\n * in the renderer's known format into bitmaps.\n *\n * This doesn't change the current renderer for other formats.\n *\n * Currently, no FreeType renderer module uses `parameters`; you should\n * thus always pass `NULL` as the value.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Renderer( FT_Library library,\n FT_Renderer renderer,\n FT_UInt num_params,\n FT_Parameter* parameters );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTRENDER_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftsizes.h", "language": "code", "loc": 137, "comment_density": 0.869, "code": "/****************************************************************************\n *\n * ftsizes.h\n *\n * FreeType size objects management (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * Typical application would normally not need to use these functions.\n * However, they have been placed in a public API for the rare cases where\n * they are needed.\n *\n */\n\n\n#ifndef FTSIZES_H_\n#define FTSIZES_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * sizes_management\n *\n * @title:\n * Size Management\n *\n * @abstract:\n * Managing multiple sizes per face.\n *\n * @description:\n * When creating a new face object (e.g., with @FT_New_Face), an @FT_Size\n * object is automatically created and used to store all pixel-size\n * dependent information, available in the `face->size` field.\n *\n * It is however possible to create more sizes for a given face, mostly\n * in order to manage several character pixel sizes of the same font\n * family and style. See @FT_New_Size and @FT_Done_Size.\n *\n * Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only modify the\n * contents of the current 'active' size; you thus need to use\n * @FT_Activate_Size to change it.\n *\n * 99% of applications won't need the functions provided here, especially\n * if they use the caching sub-system, so be cautious when using these.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Size\n *\n * @description:\n * Create a new size object from a given face object.\n *\n * @input:\n * face ::\n * A handle to a parent face object.\n *\n * @output:\n * asize ::\n * A handle to a new size object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You need to call @FT_Activate_Size in order to select the new size for\n * upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size,\n * @FT_Load_Glyph, @FT_Load_Char, etc.\n */\n FT_EXPORT( FT_Error )\n FT_New_Size( FT_Face face,\n FT_Size* size );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Size\n *\n * @description:\n * Discard a given size object. Note that @FT_Done_Face automatically\n * discards all size objects allocated with @FT_New_Size.\n *\n * @input:\n * size ::\n * A handle to a target size object.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Done_Size( FT_Size size );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Activate_Size\n *\n * @description:\n * Even though it is possible to create several size objects for a given\n * face (see @FT_New_Size for details), functions like @FT_Load_Glyph or\n * @FT_Load_Char only use the one that has been activated last to\n * determine the 'current character pixel size'.\n *\n * This function can be used to 'activate' a previously created size\n * object.\n *\n * @input:\n * size ::\n * A handle to a target size object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If `face` is the size's parent face object, this function changes the\n * value of `face->size` to the input size handle.\n */\n FT_EXPORT( FT_Error )\n FT_Activate_Size( FT_Size size );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTSIZES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftsnames.h", "language": "code", "loc": 244, "comment_density": 0.869, "code": "/****************************************************************************\n *\n * ftsnames.h\n *\n * Simple interface to access SFNT 'name' tables (which are used\n * to hold font names, copyright info, notices, etc.) (specification).\n *\n * This is _not_ used to retrieve glyph names!\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTSNAMES_H_\n#define FTSNAMES_H_\n\n\n#include \n#include FT_FREETYPE_H\n#include FT_PARAMETER_TAGS_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * sfnt_names\n *\n * @title:\n * SFNT Names\n *\n * @abstract:\n * Access the names embedded in TrueType and OpenType files.\n *\n * @description:\n * The TrueType and OpenType specifications allow the inclusion of a\n * special names table ('name') in font files. This table contains\n * textual (and internationalized) information regarding the font, like\n * family name, copyright, version, etc.\n *\n * The definitions below are used to access them if available.\n *\n * Note that this has nothing to do with glyph names!\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_SfntName\n *\n * @description:\n * A structure used to model an SFNT 'name' table entry.\n *\n * @fields:\n * platform_id ::\n * The platform ID for `string`. See @TT_PLATFORM_XXX for possible\n * values.\n *\n * encoding_id ::\n * The encoding ID for `string`. See @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX,\n * @TT_ISO_ID_XXX, @TT_MS_ID_XXX, and @TT_ADOBE_ID_XXX for possible\n * values.\n *\n * language_id ::\n * The language ID for `string`. See @TT_MAC_LANGID_XXX and\n * @TT_MS_LANGID_XXX for possible values.\n *\n * Registered OpenType values for `language_id` are always smaller than\n * 0x8000; values equal or larger than 0x8000 usually indicate a\n * language tag string (introduced in OpenType version 1.6). Use\n * function @FT_Get_Sfnt_LangTag with `language_id` as its argument to\n * retrieve the associated language tag.\n *\n * name_id ::\n * An identifier for `string`. See @TT_NAME_ID_XXX for possible\n * values.\n *\n * string ::\n * The 'name' string. Note that its format differs depending on the\n * (platform,encoding) pair, being either a string of bytes (without a\n * terminating `NULL` byte) or containing UTF-16BE entities.\n *\n * string_len ::\n * The length of `string` in bytes.\n *\n * @note:\n * Please refer to the TrueType or OpenType specification for more\n * details.\n */\n typedef struct FT_SfntName_\n {\n FT_UShort platform_id;\n FT_UShort encoding_id;\n FT_UShort language_id;\n FT_UShort name_id;\n\n FT_Byte* string; /* this string is *not* null-terminated! */\n FT_UInt string_len; /* in bytes */\n\n } FT_SfntName;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Sfnt_Name_Count\n *\n * @description:\n * Retrieve the number of name strings in the SFNT 'name' table.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * @return:\n * The number of strings in the 'name' table.\n *\n * @note:\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.\n */\n FT_EXPORT( FT_UInt )\n FT_Get_Sfnt_Name_Count( FT_Face face );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Sfnt_Name\n *\n * @description:\n * Retrieve a string of the SFNT 'name' table for a given index.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * idx ::\n * The index of the 'name' string.\n *\n * @output:\n * aname ::\n * The indexed @FT_SfntName structure.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The `string` array returned in the `aname` structure is not\n * null-terminated. Note that you don't have to deallocate `string` by\n * yourself; FreeType takes care of it if you call @FT_Done_Face.\n *\n * Use @FT_Get_Sfnt_Name_Count to get the total number of available\n * 'name' table entries, then do a loop until you get the right platform,\n * encoding, and name ID.\n *\n * 'name' table format~1 entries can use language tags also, see\n * @FT_Get_Sfnt_LangTag.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Sfnt_Name( FT_Face face,\n FT_UInt idx,\n FT_SfntName *aname );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_SfntLangTag\n *\n * @description:\n * A structure to model a language tag entry from an SFNT 'name' table.\n *\n * @fields:\n * string ::\n * The language tag string, encoded in UTF-16BE (without trailing\n * `NULL` bytes).\n *\n * string_len ::\n * The length of `string` in **bytes**.\n *\n * @note:\n * Please refer to the TrueType or OpenType specification for more\n * details.\n *\n * @since:\n * 2.8\n */\n typedef struct FT_SfntLangTag_\n {\n FT_Byte* string; /* this string is *not* null-terminated! */\n FT_UInt string_len; /* in bytes */\n\n } FT_SfntLangTag;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Sfnt_LangTag\n *\n * @description:\n * Retrieve the language tag associated with a language ID of an SFNT\n * 'name' table entry.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * langID ::\n * The language ID, as returned by @FT_Get_Sfnt_Name. This is always a\n * value larger than 0x8000.\n *\n * @output:\n * alangTag ::\n * The language tag associated with the 'name' table entry's language\n * ID.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The `string` array returned in the `alangTag` structure is not\n * null-terminated. Note that you don't have to deallocate `string` by\n * yourself; FreeType takes care of it if you call @FT_Done_Face.\n *\n * Only 'name' table format~1 supports language tags. For format~0\n * tables, this function always returns FT_Err_Invalid_Table. For\n * invalid format~1 language ID values, FT_Err_Invalid_Argument is\n * returned.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.\n *\n * @since:\n * 2.8\n */\n FT_EXPORT( FT_Error )\n FT_Get_Sfnt_LangTag( FT_Face face,\n FT_UInt langID,\n FT_SfntLangTag *alangTag );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTSNAMES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftstroke.h", "language": "code", "loc": 713, "comment_density": 0.872, "code": "/****************************************************************************\n *\n * ftstroke.h\n *\n * FreeType path stroker (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTSTROKE_H_\n#define FTSTROKE_H_\n\n#include \n#include FT_OUTLINE_H\n#include FT_GLYPH_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * glyph_stroker\n *\n * @title:\n * Glyph Stroker\n *\n * @abstract:\n * Generating bordered and stroked glyphs.\n *\n * @description:\n * This component generates stroked outlines of a given vectorial glyph.\n * It also allows you to retrieve the 'outside' and/or the 'inside'\n * borders of the stroke.\n *\n * This can be useful to generate 'bordered' glyph, i.e., glyphs\n * displayed with a coloured (and anti-aliased) border around their\n * shape.\n *\n * @order:\n * FT_Stroker\n *\n * FT_Stroker_LineJoin\n * FT_Stroker_LineCap\n * FT_StrokerBorder\n *\n * FT_Outline_GetInsideBorder\n * FT_Outline_GetOutsideBorder\n *\n * FT_Glyph_Stroke\n * FT_Glyph_StrokeBorder\n *\n * FT_Stroker_New\n * FT_Stroker_Set\n * FT_Stroker_Rewind\n * FT_Stroker_ParseOutline\n * FT_Stroker_Done\n *\n * FT_Stroker_BeginSubPath\n * FT_Stroker_EndSubPath\n *\n * FT_Stroker_LineTo\n * FT_Stroker_ConicTo\n * FT_Stroker_CubicTo\n *\n * FT_Stroker_GetBorderCounts\n * FT_Stroker_ExportBorder\n * FT_Stroker_GetCounts\n * FT_Stroker_Export\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Stroker\n *\n * @description:\n * Opaque handle to a path stroker object.\n */\n typedef struct FT_StrokerRec_* FT_Stroker;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Stroker_LineJoin\n *\n * @description:\n * These values determine how two joining lines are rendered in a\n * stroker.\n *\n * @values:\n * FT_STROKER_LINEJOIN_ROUND ::\n * Used to render rounded line joins. Circular arcs are used to join\n * two lines smoothly.\n *\n * FT_STROKER_LINEJOIN_BEVEL ::\n * Used to render beveled line joins. The outer corner of the joined\n * lines is filled by enclosing the triangular region of the corner\n * with a straight line between the outer corners of each stroke.\n *\n * FT_STROKER_LINEJOIN_MITER_FIXED ::\n * Used to render mitered line joins, with fixed bevels if the miter\n * limit is exceeded. The outer edges of the strokes for the two\n * segments are extended until they meet at an angle. A bevel join\n * (see above) is used if the segments meet at too sharp an angle and\n * the outer edges meet beyond a distance corresponding to the meter\n * limit. This prevents long spikes being created.\n * `FT_STROKER_LINEJOIN_MITER_FIXED` generates a miter line join as\n * used in PostScript and PDF.\n *\n * FT_STROKER_LINEJOIN_MITER_VARIABLE ::\n * FT_STROKER_LINEJOIN_MITER ::\n * Used to render mitered line joins, with variable bevels if the miter\n * limit is exceeded. The intersection of the strokes is clipped\n * perpendicularly to the bisector, at a distance corresponding to\n * the miter limit. This prevents long spikes being created.\n * `FT_STROKER_LINEJOIN_MITER_VARIABLE` generates a mitered line join\n * as used in XPS. `FT_STROKER_LINEJOIN_MITER` is an alias for\n * `FT_STROKER_LINEJOIN_MITER_VARIABLE`, retained for backward\n * compatibility.\n */\n typedef enum FT_Stroker_LineJoin_\n {\n FT_STROKER_LINEJOIN_ROUND = 0,\n FT_STROKER_LINEJOIN_BEVEL = 1,\n FT_STROKER_LINEJOIN_MITER_VARIABLE = 2,\n FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE,\n FT_STROKER_LINEJOIN_MITER_FIXED = 3\n\n } FT_Stroker_LineJoin;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Stroker_LineCap\n *\n * @description:\n * These values determine how the end of opened sub-paths are rendered in\n * a stroke.\n *\n * @values:\n * FT_STROKER_LINECAP_BUTT ::\n * The end of lines is rendered as a full stop on the last point\n * itself.\n *\n * FT_STROKER_LINECAP_ROUND ::\n * The end of lines is rendered as a half-circle around the last point.\n *\n * FT_STROKER_LINECAP_SQUARE ::\n * The end of lines is rendered as a square around the last point.\n */\n typedef enum FT_Stroker_LineCap_\n {\n FT_STROKER_LINECAP_BUTT = 0,\n FT_STROKER_LINECAP_ROUND,\n FT_STROKER_LINECAP_SQUARE\n\n } FT_Stroker_LineCap;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_StrokerBorder\n *\n * @description:\n * These values are used to select a given stroke border in\n * @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.\n *\n * @values:\n * FT_STROKER_BORDER_LEFT ::\n * Select the left border, relative to the drawing direction.\n *\n * FT_STROKER_BORDER_RIGHT ::\n * Select the right border, relative to the drawing direction.\n *\n * @note:\n * Applications are generally interested in the 'inside' and 'outside'\n * borders. However, there is no direct mapping between these and the\n * 'left' and 'right' ones, since this really depends on the glyph's\n * drawing orientation, which varies between font formats.\n *\n * You can however use @FT_Outline_GetInsideBorder and\n * @FT_Outline_GetOutsideBorder to get these.\n */\n typedef enum FT_StrokerBorder_\n {\n FT_STROKER_BORDER_LEFT = 0,\n FT_STROKER_BORDER_RIGHT\n\n } FT_StrokerBorder;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_GetInsideBorder\n *\n * @description:\n * Retrieve the @FT_StrokerBorder value corresponding to the 'inside'\n * borders of a given outline.\n *\n * @input:\n * outline ::\n * The source outline handle.\n *\n * @return:\n * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid\n * outlines.\n */\n FT_EXPORT( FT_StrokerBorder )\n FT_Outline_GetInsideBorder( FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_GetOutsideBorder\n *\n * @description:\n * Retrieve the @FT_StrokerBorder value corresponding to the 'outside'\n * borders of a given outline.\n *\n * @input:\n * outline ::\n * The source outline handle.\n *\n * @return:\n * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid\n * outlines.\n */\n FT_EXPORT( FT_StrokerBorder )\n FT_Outline_GetOutsideBorder( FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_New\n *\n * @description:\n * Create a new stroker object.\n *\n * @input:\n * library ::\n * FreeType library handle.\n *\n * @output:\n * astroker ::\n * A new stroker object handle. `NULL` in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_New( FT_Library library,\n FT_Stroker *astroker );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_Set\n *\n * @description:\n * Reset a stroker object's attributes.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * radius ::\n * The border radius.\n *\n * line_cap ::\n * The line cap style.\n *\n * line_join ::\n * The line join style.\n *\n * miter_limit ::\n * The maximum reciprocal sine of half-angle at the miter join,\n * expressed as 16.16 fixed point value.\n *\n * @note:\n * The `radius` is expressed in the same units as the outline\n * coordinates.\n *\n * The `miter_limit` multiplied by the `radius` gives the maximum size\n * of a miter spike, at which it is clipped for\n * @FT_STROKER_LINEJOIN_MITER_VARIABLE or replaced with a bevel join for\n * @FT_STROKER_LINEJOIN_MITER_FIXED.\n *\n * This function calls @FT_Stroker_Rewind automatically.\n */\n FT_EXPORT( void )\n FT_Stroker_Set( FT_Stroker stroker,\n FT_Fixed radius,\n FT_Stroker_LineCap line_cap,\n FT_Stroker_LineJoin line_join,\n FT_Fixed miter_limit );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_Rewind\n *\n * @description:\n * Reset a stroker object without changing its attributes. You should\n * call this function before beginning a new series of calls to\n * @FT_Stroker_BeginSubPath or @FT_Stroker_EndSubPath.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n */\n FT_EXPORT( void )\n FT_Stroker_Rewind( FT_Stroker stroker );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_ParseOutline\n *\n * @description:\n * A convenience function used to parse a whole outline with the stroker.\n * The resulting outline(s) can be retrieved later by functions like\n * @FT_Stroker_GetCounts and @FT_Stroker_Export.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * outline ::\n * The source outline.\n *\n * opened ::\n * A boolean. If~1, the outline is treated as an open path instead of\n * a closed one.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If `opened` is~0 (the default), the outline is treated as a closed\n * path, and the stroker generates two distinct 'border' outlines.\n *\n * If `opened` is~1, the outline is processed as an open path, and the\n * stroker generates a single 'stroke' outline.\n *\n * This function calls @FT_Stroker_Rewind automatically.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_ParseOutline( FT_Stroker stroker,\n FT_Outline* outline,\n FT_Bool opened );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_BeginSubPath\n *\n * @description:\n * Start a new sub-path in the stroker.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * to ::\n * A pointer to the start vector.\n *\n * open ::\n * A boolean. If~1, the sub-path is treated as an open one.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function is useful when you need to stroke a path that is not\n * stored as an @FT_Outline object.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_BeginSubPath( FT_Stroker stroker,\n FT_Vector* to,\n FT_Bool open );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_EndSubPath\n *\n * @description:\n * Close the current sub-path in the stroker.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should call this function after @FT_Stroker_BeginSubPath. If the\n * subpath was not 'opened', this function 'draws' a single line segment\n * to the start position when needed.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_EndSubPath( FT_Stroker stroker );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_LineTo\n *\n * @description:\n * 'Draw' a single line segment in the stroker's current sub-path, from\n * the last position.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * to ::\n * A pointer to the destination point.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should call this function between @FT_Stroker_BeginSubPath and\n * @FT_Stroker_EndSubPath.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_LineTo( FT_Stroker stroker,\n FT_Vector* to );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_ConicTo\n *\n * @description:\n * 'Draw' a single quadratic Bezier in the stroker's current sub-path,\n * from the last position.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * control ::\n * A pointer to a Bezier control point.\n *\n * to ::\n * A pointer to the destination point.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should call this function between @FT_Stroker_BeginSubPath and\n * @FT_Stroker_EndSubPath.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_ConicTo( FT_Stroker stroker,\n FT_Vector* control,\n FT_Vector* to );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_CubicTo\n *\n * @description:\n * 'Draw' a single cubic Bezier in the stroker's current sub-path, from\n * the last position.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * control1 ::\n * A pointer to the first Bezier control point.\n *\n * control2 ::\n * A pointer to second Bezier control point.\n *\n * to ::\n * A pointer to the destination point.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should call this function between @FT_Stroker_BeginSubPath and\n * @FT_Stroker_EndSubPath.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_CubicTo( FT_Stroker stroker,\n FT_Vector* control1,\n FT_Vector* control2,\n FT_Vector* to );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_GetBorderCounts\n *\n * @description:\n * Call this function once you have finished parsing your paths with the\n * stroker. It returns the number of points and contours necessary to\n * export one of the 'border' or 'stroke' outlines generated by the\n * stroker.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * border ::\n * The border index.\n *\n * @output:\n * anum_points ::\n * The number of points.\n *\n * anum_contours ::\n * The number of contours.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * When an outline, or a sub-path, is 'closed', the stroker generates two\n * independent 'border' outlines, named 'left' and 'right'.\n *\n * When the outline, or a sub-path, is 'opened', the stroker merges the\n * 'border' outlines with caps. The 'left' border receives all points,\n * while the 'right' border becomes empty.\n *\n * Use the function @FT_Stroker_GetCounts instead if you want to retrieve\n * the counts associated to both borders.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_GetBorderCounts( FT_Stroker stroker,\n FT_StrokerBorder border,\n FT_UInt *anum_points,\n FT_UInt *anum_contours );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_ExportBorder\n *\n * @description:\n * Call this function after @FT_Stroker_GetBorderCounts to export the\n * corresponding border to your own @FT_Outline structure.\n *\n * Note that this function appends the border points and contours to your\n * outline, but does not try to resize its arrays.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * border ::\n * The border index.\n *\n * outline ::\n * The target outline handle.\n *\n * @note:\n * Always call this function after @FT_Stroker_GetBorderCounts to get\n * sure that there is enough room in your @FT_Outline object to receive\n * all new data.\n *\n * When an outline, or a sub-path, is 'closed', the stroker generates two\n * independent 'border' outlines, named 'left' and 'right'.\n *\n * When the outline, or a sub-path, is 'opened', the stroker merges the\n * 'border' outlines with caps. The 'left' border receives all points,\n * while the 'right' border becomes empty.\n *\n * Use the function @FT_Stroker_Export instead if you want to retrieve\n * all borders at once.\n */\n FT_EXPORT( void )\n FT_Stroker_ExportBorder( FT_Stroker stroker,\n FT_StrokerBorder border,\n FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_GetCounts\n *\n * @description:\n * Call this function once you have finished parsing your paths with the\n * stroker. It returns the number of points and contours necessary to\n * export all points/borders from the stroked outline/path.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * @output:\n * anum_points ::\n * The number of points.\n *\n * anum_contours ::\n * The number of contours.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_GetCounts( FT_Stroker stroker,\n FT_UInt *anum_points,\n FT_UInt *anum_contours );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_Export\n *\n * @description:\n * Call this function after @FT_Stroker_GetBorderCounts to export all\n * borders to your own @FT_Outline structure.\n *\n * Note that this function appends the border points and contours to your\n * outline, but does not try to resize its arrays.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * outline ::\n * The target outline handle.\n */\n FT_EXPORT( void )\n FT_Stroker_Export( FT_Stroker stroker,\n FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_Done\n *\n * @description:\n * Destroy a stroker object.\n *\n * @input:\n * stroker ::\n * A stroker handle. Can be `NULL`.\n */\n FT_EXPORT( void )\n FT_Stroker_Done( FT_Stroker stroker );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_Stroke\n *\n * @description:\n * Stroke a given outline glyph object with a given stroker.\n *\n * @inout:\n * pglyph ::\n * Source glyph handle on input, new glyph handle on output.\n *\n * @input:\n * stroker ::\n * A stroker handle.\n *\n * destroy ::\n * A Boolean. If~1, the source glyph object is destroyed on success.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source glyph is untouched in case of error.\n *\n * Adding stroke may yield a significantly wider and taller glyph\n * depending on how large of a radius was used to stroke the glyph. You\n * may need to manually adjust horizontal and vertical advance amounts to\n * account for this added size.\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_Stroke( FT_Glyph *pglyph,\n FT_Stroker stroker,\n FT_Bool destroy );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_StrokeBorder\n *\n * @description:\n * Stroke a given outline glyph object with a given stroker, but only\n * return either its inside or outside border.\n *\n * @inout:\n * pglyph ::\n * Source glyph handle on input, new glyph handle on output.\n *\n * @input:\n * stroker ::\n * A stroker handle.\n *\n * inside ::\n * A Boolean. If~1, return the inside border, otherwise the outside\n * border.\n *\n * destroy ::\n * A Boolean. If~1, the source glyph object is destroyed on success.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source glyph is untouched in case of error.\n *\n * Adding stroke may yield a significantly wider and taller glyph\n * depending on how large of a radius was used to stroke the glyph. You\n * may need to manually adjust horizontal and vertical advance amounts to\n * account for this added size.\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_StrokeBorder( FT_Glyph *pglyph,\n FT_Stroker stroker,\n FT_Bool inside,\n FT_Bool destroy );\n\n /* */\n\nFT_END_HEADER\n\n#endif /* FTSTROKE_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftsynth.h", "language": "code", "loc": 65, "comment_density": 0.769, "code": "/****************************************************************************\n *\n * ftsynth.h\n *\n * FreeType synthesizing code for emboldening and slanting\n * (specification).\n *\n * Copyright (C) 2000-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /********* *********/\n /********* WARNING, THIS IS ALPHA CODE! THIS API *********/\n /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/\n /********* FREETYPE DEVELOPMENT TEAM *********/\n /********* *********/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /* Main reason for not lifting the functions in this module to a */\n /* 'standard' API is that the used parameters for emboldening and */\n /* slanting are not configurable. Consider the functions as a */\n /* code resource that should be copied into the application and */\n /* adapted to the particular needs. */\n\n\n#ifndef FTSYNTH_H_\n#define FTSYNTH_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /* Embolden a glyph by a 'reasonable' value (which is highly a matter of */\n /* taste). This function is actually a convenience function, providing */\n /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */\n /* */\n /* For emboldened outlines the height, width, and advance metrics are */\n /* increased by the strength of the emboldening -- this even affects */\n /* mono-width fonts! */\n /* */\n /* You can also call @FT_Outline_Get_CBox to get precise values. */\n FT_EXPORT( void )\n FT_GlyphSlot_Embolden( FT_GlyphSlot slot );\n\n /* Slant an outline glyph to the right by about 12 degrees. */\n FT_EXPORT( void )\n FT_GlyphSlot_Oblique( FT_GlyphSlot slot );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTSYNTH_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftsystem.h", "language": "code", "loc": 311, "comment_density": 0.839, "code": "/****************************************************************************\n *\n * ftsystem.h\n *\n * FreeType low-level system interface definition (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTSYSTEM_H_\n#define FTSYSTEM_H_\n\n\n#include \n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * system_interface\n *\n * @title:\n * System Interface\n *\n * @abstract:\n * How FreeType manages memory and i/o.\n *\n * @description:\n * This section contains various definitions related to memory management\n * and i/o access. You need to understand this information if you want to\n * use a custom memory manager or you own i/o streams.\n *\n */\n\n\n /**************************************************************************\n *\n * M E M O R Y M A N A G E M E N T\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Memory\n *\n * @description:\n * A handle to a given memory manager object, defined with an\n * @FT_MemoryRec structure.\n *\n */\n typedef struct FT_MemoryRec_* FT_Memory;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Alloc_Func\n *\n * @description:\n * A function used to allocate `size` bytes from `memory`.\n *\n * @input:\n * memory ::\n * A handle to the source memory manager.\n *\n * size ::\n * The size in bytes to allocate.\n *\n * @return:\n * Address of new memory block. 0~in case of failure.\n *\n */\n typedef void*\n (*FT_Alloc_Func)( FT_Memory memory,\n long size );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Free_Func\n *\n * @description:\n * A function used to release a given block of memory.\n *\n * @input:\n * memory ::\n * A handle to the source memory manager.\n *\n * block ::\n * The address of the target memory block.\n *\n */\n typedef void\n (*FT_Free_Func)( FT_Memory memory,\n void* block );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Realloc_Func\n *\n * @description:\n * A function used to re-allocate a given block of memory.\n *\n * @input:\n * memory ::\n * A handle to the source memory manager.\n *\n * cur_size ::\n * The block's current size in bytes.\n *\n * new_size ::\n * The block's requested new size.\n *\n * block ::\n * The block's current address.\n *\n * @return:\n * New block address. 0~in case of memory shortage.\n *\n * @note:\n * In case of error, the old block must still be available.\n *\n */\n typedef void*\n (*FT_Realloc_Func)( FT_Memory memory,\n long cur_size,\n long new_size,\n void* block );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_MemoryRec\n *\n * @description:\n * A structure used to describe a given memory manager to FreeType~2.\n *\n * @fields:\n * user ::\n * A generic typeless pointer for user data.\n *\n * alloc ::\n * A pointer type to an allocation function.\n *\n * free ::\n * A pointer type to an memory freeing function.\n *\n * realloc ::\n * A pointer type to a reallocation function.\n *\n */\n struct FT_MemoryRec_\n {\n void* user;\n FT_Alloc_Func alloc;\n FT_Free_Func free;\n FT_Realloc_Func realloc;\n };\n\n\n /**************************************************************************\n *\n * I / O M A N A G E M E N T\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Stream\n *\n * @description:\n * A handle to an input stream.\n *\n * @also:\n * See @FT_StreamRec for the publicly accessible fields of a given stream\n * object.\n *\n */\n typedef struct FT_StreamRec_* FT_Stream;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_StreamDesc\n *\n * @description:\n * A union type used to store either a long or a pointer. This is used\n * to store a file descriptor or a `FILE*` in an input stream.\n *\n */\n typedef union FT_StreamDesc_\n {\n long value;\n void* pointer;\n\n } FT_StreamDesc;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Stream_IoFunc\n *\n * @description:\n * A function used to seek and read data from a given input stream.\n *\n * @input:\n * stream ::\n * A handle to the source stream.\n *\n * offset ::\n * The offset of read in stream (always from start).\n *\n * buffer ::\n * The address of the read buffer.\n *\n * count ::\n * The number of bytes to read from the stream.\n *\n * @return:\n * The number of bytes effectively read by the stream.\n *\n * @note:\n * This function might be called to perform a seek or skip operation with\n * a `count` of~0. A non-zero return value then indicates an error.\n *\n */\n typedef unsigned long\n (*FT_Stream_IoFunc)( FT_Stream stream,\n unsigned long offset,\n unsigned char* buffer,\n unsigned long count );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Stream_CloseFunc\n *\n * @description:\n * A function used to close a given input stream.\n *\n * @input:\n * stream ::\n * A handle to the target stream.\n *\n */\n typedef void\n (*FT_Stream_CloseFunc)( FT_Stream stream );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_StreamRec\n *\n * @description:\n * A structure used to describe an input stream.\n *\n * @input:\n * base ::\n * For memory-based streams, this is the address of the first stream\n * byte in memory. This field should always be set to `NULL` for\n * disk-based streams.\n *\n * size ::\n * The stream size in bytes.\n *\n * In case of compressed streams where the size is unknown before\n * actually doing the decompression, the value is set to 0x7FFFFFFF.\n * (Note that this size value can occur for normal streams also; it is\n * thus just a hint.)\n *\n * pos ::\n * The current position within the stream.\n *\n * descriptor ::\n * This field is a union that can hold an integer or a pointer. It is\n * used by stream implementations to store file descriptors or `FILE*`\n * pointers.\n *\n * pathname ::\n * This field is completely ignored by FreeType. However, it is often\n * useful during debugging to use it to store the stream's filename\n * (where available).\n *\n * read ::\n * The stream's input function.\n *\n * close ::\n * The stream's close function.\n *\n * memory ::\n * The memory manager to use to preload frames. This is set internally\n * by FreeType and shouldn't be touched by stream implementations.\n *\n * cursor ::\n * This field is set and used internally by FreeType when parsing\n * frames. In particular, the `FT_GET_XXX` macros use this instead of\n * the `pos` field.\n *\n * limit ::\n * This field is set and used internally by FreeType when parsing\n * frames.\n *\n */\n typedef struct FT_StreamRec_\n {\n unsigned char* base;\n unsigned long size;\n unsigned long pos;\n\n FT_StreamDesc descriptor;\n FT_StreamDesc pathname;\n FT_Stream_IoFunc read;\n FT_Stream_CloseFunc close;\n\n FT_Memory memory;\n unsigned char* cursor;\n unsigned char* limit;\n\n } FT_StreamRec;\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTSYSTEM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/fttrigon.h", "language": "code", "loc": 306, "comment_density": 0.859, "code": "/****************************************************************************\n *\n * fttrigon.h\n *\n * FreeType trigonometric functions (specification).\n *\n * Copyright (C) 2001-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTTRIGON_H_\n#define FTTRIGON_H_\n\n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * computations\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Angle\n *\n * @description:\n * This type is used to model angle values in FreeType. Note that the\n * angle is a 16.16 fixed-point value expressed in degrees.\n *\n */\n typedef FT_Fixed FT_Angle;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ANGLE_PI\n *\n * @description:\n * The angle pi expressed in @FT_Angle units.\n *\n */\n#define FT_ANGLE_PI ( 180L << 16 )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ANGLE_2PI\n *\n * @description:\n * The angle 2*pi expressed in @FT_Angle units.\n *\n */\n#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ANGLE_PI2\n *\n * @description:\n * The angle pi/2 expressed in @FT_Angle units.\n *\n */\n#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ANGLE_PI4\n *\n * @description:\n * The angle pi/4 expressed in @FT_Angle units.\n *\n */\n#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Sin\n *\n * @description:\n * Return the sinus of a given angle in fixed-point format.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n * @return:\n * The sinus value.\n *\n * @note:\n * If you need both the sinus and cosinus for a given angle, use the\n * function @FT_Vector_Unit.\n *\n */\n FT_EXPORT( FT_Fixed )\n FT_Sin( FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Cos\n *\n * @description:\n * Return the cosinus of a given angle in fixed-point format.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n * @return:\n * The cosinus value.\n *\n * @note:\n * If you need both the sinus and cosinus for a given angle, use the\n * function @FT_Vector_Unit.\n *\n */\n FT_EXPORT( FT_Fixed )\n FT_Cos( FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Tan\n *\n * @description:\n * Return the tangent of a given angle in fixed-point format.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n * @return:\n * The tangent value.\n *\n */\n FT_EXPORT( FT_Fixed )\n FT_Tan( FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Atan2\n *\n * @description:\n * Return the arc-tangent corresponding to a given vector (x,y) in the 2d\n * plane.\n *\n * @input:\n * x ::\n * The horizontal vector coordinate.\n *\n * y ::\n * The vertical vector coordinate.\n *\n * @return:\n * The arc-tangent value (i.e. angle).\n *\n */\n FT_EXPORT( FT_Angle )\n FT_Atan2( FT_Fixed x,\n FT_Fixed y );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Angle_Diff\n *\n * @description:\n * Return the difference between two angles. The result is always\n * constrained to the ]-PI..PI] interval.\n *\n * @input:\n * angle1 ::\n * First angle.\n *\n * angle2 ::\n * Second angle.\n *\n * @return:\n * Constrained value of `angle2-angle1`.\n *\n */\n FT_EXPORT( FT_Angle )\n FT_Angle_Diff( FT_Angle angle1,\n FT_Angle angle2 );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_Unit\n *\n * @description:\n * Return the unit vector corresponding to a given angle. After the\n * call, the value of `vec.x` will be `cos(angle)`, and the value of\n * `vec.y` will be `sin(angle)`.\n *\n * This function is useful to retrieve both the sinus and cosinus of a\n * given angle quickly.\n *\n * @output:\n * vec ::\n * The address of target vector.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n */\n FT_EXPORT( void )\n FT_Vector_Unit( FT_Vector* vec,\n FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_Rotate\n *\n * @description:\n * Rotate a vector by a given angle.\n *\n * @inout:\n * vec ::\n * The address of target vector.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n */\n FT_EXPORT( void )\n FT_Vector_Rotate( FT_Vector* vec,\n FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_Length\n *\n * @description:\n * Return the length of a given vector.\n *\n * @input:\n * vec ::\n * The address of target vector.\n *\n * @return:\n * The vector length, expressed in the same units that the original\n * vector coordinates.\n *\n */\n FT_EXPORT( FT_Fixed )\n FT_Vector_Length( FT_Vector* vec );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_Polarize\n *\n * @description:\n * Compute both the length and angle of a given vector.\n *\n * @input:\n * vec ::\n * The address of source vector.\n *\n * @output:\n * length ::\n * The vector length.\n *\n * angle ::\n * The vector angle.\n *\n */\n FT_EXPORT( void )\n FT_Vector_Polarize( FT_Vector* vec,\n FT_Fixed *length,\n FT_Angle *angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_From_Polar\n *\n * @description:\n * Compute vector coordinates from a length and angle.\n *\n * @output:\n * vec ::\n * The address of source vector.\n *\n * @input:\n * length ::\n * The vector length.\n *\n * angle ::\n * The vector angle.\n *\n */\n FT_EXPORT( void )\n FT_Vector_From_Polar( FT_Vector* vec,\n FT_Fixed length,\n FT_Angle angle );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTTRIGON_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/fttypes.h", "language": "code", "loc": 521, "comment_density": 0.848, "code": "/****************************************************************************\n *\n * fttypes.h\n *\n * FreeType simple types definitions (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTTYPES_H_\n#define FTTYPES_H_\n\n\n#include \n#include FT_CONFIG_CONFIG_H\n#include FT_SYSTEM_H\n#include FT_IMAGE_H\n\n#include \n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * basic_types\n *\n * @title:\n * Basic Data Types\n *\n * @abstract:\n * The basic data types defined by the library.\n *\n * @description:\n * This section contains the basic data types defined by FreeType~2,\n * ranging from simple scalar types to bitmap descriptors. More\n * font-specific structures are defined in a different section.\n *\n * @order:\n * FT_Byte\n * FT_Bytes\n * FT_Char\n * FT_Int\n * FT_UInt\n * FT_Int16\n * FT_UInt16\n * FT_Int32\n * FT_UInt32\n * FT_Int64\n * FT_UInt64\n * FT_Short\n * FT_UShort\n * FT_Long\n * FT_ULong\n * FT_Bool\n * FT_Offset\n * FT_PtrDist\n * FT_String\n * FT_Tag\n * FT_Error\n * FT_Fixed\n * FT_Pointer\n * FT_Pos\n * FT_Vector\n * FT_BBox\n * FT_Matrix\n * FT_FWord\n * FT_UFWord\n * FT_F2Dot14\n * FT_UnitVector\n * FT_F26Dot6\n * FT_Data\n *\n * FT_MAKE_TAG\n *\n * FT_Generic\n * FT_Generic_Finalizer\n *\n * FT_Bitmap\n * FT_Pixel_Mode\n * FT_Palette_Mode\n * FT_Glyph_Format\n * FT_IMAGE_TAG\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Bool\n *\n * @description:\n * A typedef of unsigned char, used for simple booleans. As usual,\n * values 1 and~0 represent true and false, respectively.\n */\n typedef unsigned char FT_Bool;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_FWord\n *\n * @description:\n * A signed 16-bit integer used to store a distance in original font\n * units.\n */\n typedef signed short FT_FWord; /* distance in FUnits */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UFWord\n *\n * @description:\n * An unsigned 16-bit integer used to store a distance in original font\n * units.\n */\n typedef unsigned short FT_UFWord; /* unsigned distance */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Char\n *\n * @description:\n * A simple typedef for the _signed_ char type.\n */\n typedef signed char FT_Char;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Byte\n *\n * @description:\n * A simple typedef for the _unsigned_ char type.\n */\n typedef unsigned char FT_Byte;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Bytes\n *\n * @description:\n * A typedef for constant memory areas.\n */\n typedef const FT_Byte* FT_Bytes;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Tag\n *\n * @description:\n * A typedef for 32-bit tags (as used in the SFNT format).\n */\n typedef FT_UInt32 FT_Tag;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_String\n *\n * @description:\n * A simple typedef for the char type, usually used for strings.\n */\n typedef char FT_String;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Short\n *\n * @description:\n * A typedef for signed short.\n */\n typedef signed short FT_Short;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UShort\n *\n * @description:\n * A typedef for unsigned short.\n */\n typedef unsigned short FT_UShort;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Int\n *\n * @description:\n * A typedef for the int type.\n */\n typedef signed int FT_Int;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UInt\n *\n * @description:\n * A typedef for the unsigned int type.\n */\n typedef unsigned int FT_UInt;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Long\n *\n * @description:\n * A typedef for signed long.\n */\n typedef signed long FT_Long;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_ULong\n *\n * @description:\n * A typedef for unsigned long.\n */\n typedef unsigned long FT_ULong;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_F2Dot14\n *\n * @description:\n * A signed 2.14 fixed-point type used for unit vectors.\n */\n typedef signed short FT_F2Dot14;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_F26Dot6\n *\n * @description:\n * A signed 26.6 fixed-point type used for vectorial pixel coordinates.\n */\n typedef signed long FT_F26Dot6;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Fixed\n *\n * @description:\n * This type is used to store 16.16 fixed-point values, like scaling\n * values or matrix coefficients.\n */\n typedef signed long FT_Fixed;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Error\n *\n * @description:\n * The FreeType error code type. A value of~0 is always interpreted as a\n * successful operation.\n */\n typedef int FT_Error;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Pointer\n *\n * @description:\n * A simple typedef for a typeless pointer.\n */\n typedef void* FT_Pointer;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Offset\n *\n * @description:\n * This is equivalent to the ANSI~C `size_t` type, i.e., the largest\n * _unsigned_ integer type used to express a file size or position, or a\n * memory block size.\n */\n typedef size_t FT_Offset;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_PtrDist\n *\n * @description:\n * This is equivalent to the ANSI~C `ptrdiff_t` type, i.e., the largest\n * _signed_ integer type used to express the distance between two\n * pointers.\n */\n typedef ft_ptrdiff_t FT_PtrDist;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_UnitVector\n *\n * @description:\n * A simple structure used to store a 2D vector unit vector. Uses\n * FT_F2Dot14 types.\n *\n * @fields:\n * x ::\n * Horizontal coordinate.\n *\n * y ::\n * Vertical coordinate.\n */\n typedef struct FT_UnitVector_\n {\n FT_F2Dot14 x;\n FT_F2Dot14 y;\n\n } FT_UnitVector;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Matrix\n *\n * @description:\n * A simple structure used to store a 2x2 matrix. Coefficients are in\n * 16.16 fixed-point format. The computation performed is:\n *\n * ```\n * x' = x*xx + y*xy\n * y' = x*yx + y*yy\n * ```\n *\n * @fields:\n * xx ::\n * Matrix coefficient.\n *\n * xy ::\n * Matrix coefficient.\n *\n * yx ::\n * Matrix coefficient.\n *\n * yy ::\n * Matrix coefficient.\n */\n typedef struct FT_Matrix_\n {\n FT_Fixed xx, xy;\n FT_Fixed yx, yy;\n\n } FT_Matrix;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Data\n *\n * @description:\n * Read-only binary data represented as a pointer and a length.\n *\n * @fields:\n * pointer ::\n * The data.\n *\n * length ::\n * The length of the data in bytes.\n */\n typedef struct FT_Data_\n {\n const FT_Byte* pointer;\n FT_Int length;\n\n } FT_Data;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Generic_Finalizer\n *\n * @description:\n * Describe a function used to destroy the 'client' data of any FreeType\n * object. See the description of the @FT_Generic type for details of\n * usage.\n *\n * @input:\n * The address of the FreeType object that is under finalization. Its\n * client data is accessed through its `generic` field.\n */\n typedef void (*FT_Generic_Finalizer)( void* object );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Generic\n *\n * @description:\n * Client applications often need to associate their own data to a\n * variety of FreeType core objects. For example, a text layout API\n * might want to associate a glyph cache to a given size object.\n *\n * Some FreeType object contains a `generic` field, of type `FT_Generic`,\n * which usage is left to client applications and font servers.\n *\n * It can be used to store a pointer to client-specific data, as well as\n * the address of a 'finalizer' function, which will be called by\n * FreeType when the object is destroyed (for example, the previous\n * client example would put the address of the glyph cache destructor in\n * the `finalizer` field).\n *\n * @fields:\n * data ::\n * A typeless pointer to any client-specified data. This field is\n * completely ignored by the FreeType library.\n *\n * finalizer ::\n * A pointer to a 'generic finalizer' function, which will be called\n * when the object is destroyed. If this field is set to `NULL`, no\n * code will be called.\n */\n typedef struct FT_Generic_\n {\n void* data;\n FT_Generic_Finalizer finalizer;\n\n } FT_Generic;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MAKE_TAG\n *\n * @description:\n * This macro converts four-letter tags that are used to label TrueType\n * tables into an unsigned long, to be used within FreeType.\n *\n * @note:\n * The produced values **must** be 32-bit integers. Don't redefine this\n * macro.\n */\n#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \\\n (FT_Tag) \\\n ( ( (FT_ULong)_x1 << 24 ) | \\\n ( (FT_ULong)_x2 << 16 ) | \\\n ( (FT_ULong)_x3 << 8 ) | \\\n (FT_ULong)_x4 )\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* L I S T M A N A G E M E N T */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @section:\n * list_processing\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_ListNode\n *\n * @description:\n * Many elements and objects in FreeType are listed through an @FT_List\n * record (see @FT_ListRec). As its name suggests, an FT_ListNode is a\n * handle to a single list element.\n */\n typedef struct FT_ListNodeRec_* FT_ListNode;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_List\n *\n * @description:\n * A handle to a list record (see @FT_ListRec).\n */\n typedef struct FT_ListRec_* FT_List;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_ListNodeRec\n *\n * @description:\n * A structure used to hold a single list element.\n *\n * @fields:\n * prev ::\n * The previous element in the list. `NULL` if first.\n *\n * next ::\n * The next element in the list. `NULL` if last.\n *\n * data ::\n * A typeless pointer to the listed object.\n */\n typedef struct FT_ListNodeRec_\n {\n FT_ListNode prev;\n FT_ListNode next;\n void* data;\n\n } FT_ListNodeRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_ListRec\n *\n * @description:\n * A structure used to hold a simple doubly-linked list. These are used\n * in many parts of FreeType.\n *\n * @fields:\n * head ::\n * The head (first element) of doubly-linked list.\n *\n * tail ::\n * The tail (last element) of doubly-linked list.\n */\n typedef struct FT_ListRec_\n {\n FT_ListNode head;\n FT_ListNode tail;\n\n } FT_ListRec;\n\n /* */\n\n\n#define FT_IS_EMPTY( list ) ( (list).head == 0 )\n#define FT_BOOL( x ) ( (FT_Bool)( (x) != 0 ) )\n\n /* concatenate C tokens */\n#define FT_ERR_XCAT( x, y ) x ## y\n#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )\n\n /* see `ftmoderr.h` for descriptions of the following macros */\n\n#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )\n\n#define FT_ERROR_BASE( x ) ( (x) & 0xFF )\n#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )\n\n#define FT_ERR_EQ( x, e ) \\\n ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )\n#define FT_ERR_NEQ( x, e ) \\\n ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )\n\n\nFT_END_HEADER\n\n#endif /* FTTYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftwinfnt.h", "language": "code", "loc": 251, "comment_density": 0.709, "code": "/****************************************************************************\n *\n * ftwinfnt.h\n *\n * FreeType API for accessing Windows fnt-specific data.\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTWINFNT_H_\n#define FTWINFNT_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * winfnt_fonts\n *\n * @title:\n * Window FNT Files\n *\n * @abstract:\n * Windows FNT-specific API.\n *\n * @description:\n * This section contains the declaration of Windows FNT-specific\n * functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_WinFNT_ID_XXX\n *\n * @description:\n * A list of valid values for the `charset` byte in @FT_WinFNT_HeaderRec. \n * Exact mapping tables for the various 'cpXXXX' encodings (except for\n * 'cp1361') can be found at 'ftp://ftp.unicode.org/Public/' in the\n * `MAPPINGS/VENDORS/MICSFT/WINDOWS` subdirectory. 'cp1361' is roughly a\n * superset of `MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT`.\n *\n * @values:\n * FT_WinFNT_ID_DEFAULT ::\n * This is used for font enumeration and font creation as a 'don't\n * care' value. Valid font files don't contain this value. When\n * querying for information about the character set of the font that is\n * currently selected into a specified device context, this return\n * value (of the related Windows API) simply denotes failure.\n *\n * FT_WinFNT_ID_SYMBOL ::\n * There is no known mapping table available.\n *\n * FT_WinFNT_ID_MAC ::\n * Mac Roman encoding.\n *\n * FT_WinFNT_ID_OEM ::\n * From Michael Poettgen :\n *\n * The 'Windows Font Mapping' article says that `FT_WinFNT_ID_OEM` is\n * used for the charset of vector fonts, like `modern.fon`,\n * `roman.fon`, and `script.fon` on Windows.\n *\n * The 'CreateFont' documentation says: The `FT_WinFNT_ID_OEM` value\n * specifies a character set that is operating-system dependent.\n *\n * The 'IFIMETRICS' documentation from the 'Windows Driver Development\n * Kit' says: This font supports an OEM-specific character set. The\n * OEM character set is system dependent.\n *\n * In general OEM, as opposed to ANSI (i.e., 'cp1252'), denotes the\n * second default codepage that most international versions of Windows\n * have. It is one of the OEM codepages from\n *\n * https://docs.microsoft.com/en-us/windows/desktop/intl/code-page-identifiers\n * ,\n *\n * and is used for the 'DOS boxes', to support legacy applications. A\n * German Windows version for example usually uses ANSI codepage 1252\n * and OEM codepage 850.\n *\n * FT_WinFNT_ID_CP874 ::\n * A superset of Thai TIS 620 and ISO 8859-11.\n *\n * FT_WinFNT_ID_CP932 ::\n * A superset of Japanese Shift-JIS (with minor deviations).\n *\n * FT_WinFNT_ID_CP936 ::\n * A superset of simplified Chinese GB 2312-1980 (with different\n * ordering and minor deviations).\n *\n * FT_WinFNT_ID_CP949 ::\n * A superset of Korean Hangul KS~C 5601-1987 (with different ordering\n * and minor deviations).\n *\n * FT_WinFNT_ID_CP950 ::\n * A superset of traditional Chinese Big~5 ETen (with different\n * ordering and minor deviations).\n *\n * FT_WinFNT_ID_CP1250 ::\n * A superset of East European ISO 8859-2 (with slightly different\n * ordering).\n *\n * FT_WinFNT_ID_CP1251 ::\n * A superset of Russian ISO 8859-5 (with different ordering).\n *\n * FT_WinFNT_ID_CP1252 ::\n * ANSI encoding. A superset of ISO 8859-1.\n *\n * FT_WinFNT_ID_CP1253 ::\n * A superset of Greek ISO 8859-7 (with minor modifications).\n *\n * FT_WinFNT_ID_CP1254 ::\n * A superset of Turkish ISO 8859-9.\n *\n * FT_WinFNT_ID_CP1255 ::\n * A superset of Hebrew ISO 8859-8 (with some modifications).\n *\n * FT_WinFNT_ID_CP1256 ::\n * A superset of Arabic ISO 8859-6 (with different ordering).\n *\n * FT_WinFNT_ID_CP1257 ::\n * A superset of Baltic ISO 8859-13 (with some deviations).\n *\n * FT_WinFNT_ID_CP1258 ::\n * For Vietnamese. This encoding doesn't cover all necessary\n * characters.\n *\n * FT_WinFNT_ID_CP1361 ::\n * Korean (Johab).\n */\n\n#define FT_WinFNT_ID_CP1252 0\n#define FT_WinFNT_ID_DEFAULT 1\n#define FT_WinFNT_ID_SYMBOL 2\n#define FT_WinFNT_ID_MAC 77\n#define FT_WinFNT_ID_CP932 128\n#define FT_WinFNT_ID_CP949 129\n#define FT_WinFNT_ID_CP1361 130\n#define FT_WinFNT_ID_CP936 134\n#define FT_WinFNT_ID_CP950 136\n#define FT_WinFNT_ID_CP1253 161\n#define FT_WinFNT_ID_CP1254 162\n#define FT_WinFNT_ID_CP1258 163\n#define FT_WinFNT_ID_CP1255 177\n#define FT_WinFNT_ID_CP1256 178\n#define FT_WinFNT_ID_CP1257 186\n#define FT_WinFNT_ID_CP1251 204\n#define FT_WinFNT_ID_CP874 222\n#define FT_WinFNT_ID_CP1250 238\n#define FT_WinFNT_ID_OEM 255\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_WinFNT_HeaderRec\n *\n * @description:\n * Windows FNT Header info.\n */\n typedef struct FT_WinFNT_HeaderRec_\n {\n FT_UShort version;\n FT_ULong file_size;\n FT_Byte copyright[60];\n FT_UShort file_type;\n FT_UShort nominal_point_size;\n FT_UShort vertical_resolution;\n FT_UShort horizontal_resolution;\n FT_UShort ascent;\n FT_UShort internal_leading;\n FT_UShort external_leading;\n FT_Byte italic;\n FT_Byte underline;\n FT_Byte strike_out;\n FT_UShort weight;\n FT_Byte charset;\n FT_UShort pixel_width;\n FT_UShort pixel_height;\n FT_Byte pitch_and_family;\n FT_UShort avg_width;\n FT_UShort max_width;\n FT_Byte first_char;\n FT_Byte last_char;\n FT_Byte default_char;\n FT_Byte break_char;\n FT_UShort bytes_per_row;\n FT_ULong device_offset;\n FT_ULong face_name_offset;\n FT_ULong bits_pointer;\n FT_ULong bits_offset;\n FT_Byte reserved;\n FT_ULong flags;\n FT_UShort A_space;\n FT_UShort B_space;\n FT_UShort C_space;\n FT_UShort color_table_offset;\n FT_ULong reserved1[4];\n\n } FT_WinFNT_HeaderRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_WinFNT_Header\n *\n * @description:\n * A handle to an @FT_WinFNT_HeaderRec structure.\n */\n typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_WinFNT_Header\n *\n * @description:\n * Retrieve a Windows FNT font info header.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * @output:\n * aheader ::\n * The WinFNT header.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with Windows FNT faces, returning an error\n * otherwise.\n */\n FT_EXPORT( FT_Error )\n FT_Get_WinFNT_Header( FT_Face face,\n FT_WinFNT_HeaderRec *aheader );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTWINFNT_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/t1tables.h", "language": "code", "loc": 667, "comment_density": 0.735, "code": "/****************************************************************************\n *\n * t1tables.h\n *\n * Basic Type 1/Type 2 tables definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef T1TABLES_H_\n#define T1TABLES_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * type1_tables\n *\n * @title:\n * Type 1 Tables\n *\n * @abstract:\n * Type~1-specific font tables.\n *\n * @description:\n * This section contains the definition of Type~1-specific tables,\n * including structures related to other PostScript font formats.\n *\n * @order:\n * PS_FontInfoRec\n * PS_FontInfo\n * PS_PrivateRec\n * PS_Private\n *\n * CID_FaceDictRec\n * CID_FaceDict\n * CID_FaceInfoRec\n * CID_FaceInfo\n *\n * FT_Has_PS_Glyph_Names\n * FT_Get_PS_Font_Info\n * FT_Get_PS_Font_Private\n * FT_Get_PS_Font_Value\n *\n * T1_Blend_Flags\n * T1_EncodingType\n * PS_Dict_Keys\n *\n */\n\n\n /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */\n /* structures in order to support Multiple Master fonts. */\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_FontInfoRec\n *\n * @description:\n * A structure used to model a Type~1 or Type~2 FontInfo dictionary.\n * Note that for Multiple Master fonts, each instance has its own\n * FontInfo dictionary.\n */\n typedef struct PS_FontInfoRec_\n {\n FT_String* version;\n FT_String* notice;\n FT_String* full_name;\n FT_String* family_name;\n FT_String* weight;\n FT_Long italic_angle;\n FT_Bool is_fixed_pitch;\n FT_Short underline_position;\n FT_UShort underline_thickness;\n\n } PS_FontInfoRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_FontInfo\n *\n * @description:\n * A handle to a @PS_FontInfoRec structure.\n */\n typedef struct PS_FontInfoRec_* PS_FontInfo;\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_FontInfo\n *\n * @description:\n * This type is equivalent to @PS_FontInfoRec. It is deprecated but kept\n * to maintain source compatibility between various versions of FreeType.\n */\n typedef PS_FontInfoRec T1_FontInfo;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_PrivateRec\n *\n * @description:\n * A structure used to model a Type~1 or Type~2 private dictionary. Note\n * that for Multiple Master fonts, each instance has its own Private\n * dictionary.\n */\n typedef struct PS_PrivateRec_\n {\n FT_Int unique_id;\n FT_Int lenIV;\n\n FT_Byte num_blue_values;\n FT_Byte num_other_blues;\n FT_Byte num_family_blues;\n FT_Byte num_family_other_blues;\n\n FT_Short blue_values[14];\n FT_Short other_blues[10];\n\n FT_Short family_blues [14];\n FT_Short family_other_blues[10];\n\n FT_Fixed blue_scale;\n FT_Int blue_shift;\n FT_Int blue_fuzz;\n\n FT_UShort standard_width[1];\n FT_UShort standard_height[1];\n\n FT_Byte num_snap_widths;\n FT_Byte num_snap_heights;\n FT_Bool force_bold;\n FT_Bool round_stem_up;\n\n FT_Short snap_widths [13]; /* including std width */\n FT_Short snap_heights[13]; /* including std height */\n\n FT_Fixed expansion_factor;\n\n FT_Long language_group;\n FT_Long password;\n\n FT_Short min_feature[2];\n\n } PS_PrivateRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_Private\n *\n * @description:\n * A handle to a @PS_PrivateRec structure.\n */\n typedef struct PS_PrivateRec_* PS_Private;\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_Private\n *\n * @description:\n * This type is equivalent to @PS_PrivateRec. It is deprecated but kept\n * to maintain source compatibility between various versions of FreeType.\n */\n typedef PS_PrivateRec T1_Private;\n\n\n /**************************************************************************\n *\n * @enum:\n * T1_Blend_Flags\n *\n * @description:\n * A set of flags used to indicate which fields are present in a given\n * blend dictionary (font info or private). Used to support Multiple\n * Masters fonts.\n *\n * @values:\n * T1_BLEND_UNDERLINE_POSITION ::\n * T1_BLEND_UNDERLINE_THICKNESS ::\n * T1_BLEND_ITALIC_ANGLE ::\n * T1_BLEND_BLUE_VALUES ::\n * T1_BLEND_OTHER_BLUES ::\n * T1_BLEND_STANDARD_WIDTH ::\n * T1_BLEND_STANDARD_HEIGHT ::\n * T1_BLEND_STEM_SNAP_WIDTHS ::\n * T1_BLEND_STEM_SNAP_HEIGHTS ::\n * T1_BLEND_BLUE_SCALE ::\n * T1_BLEND_BLUE_SHIFT ::\n * T1_BLEND_FAMILY_BLUES ::\n * T1_BLEND_FAMILY_OTHER_BLUES ::\n * T1_BLEND_FORCE_BOLD ::\n */\n typedef enum T1_Blend_Flags_\n {\n /* required fields in a FontInfo blend dictionary */\n T1_BLEND_UNDERLINE_POSITION = 0,\n T1_BLEND_UNDERLINE_THICKNESS,\n T1_BLEND_ITALIC_ANGLE,\n\n /* required fields in a Private blend dictionary */\n T1_BLEND_BLUE_VALUES,\n T1_BLEND_OTHER_BLUES,\n T1_BLEND_STANDARD_WIDTH,\n T1_BLEND_STANDARD_HEIGHT,\n T1_BLEND_STEM_SNAP_WIDTHS,\n T1_BLEND_STEM_SNAP_HEIGHTS,\n T1_BLEND_BLUE_SCALE,\n T1_BLEND_BLUE_SHIFT,\n T1_BLEND_FAMILY_BLUES,\n T1_BLEND_FAMILY_OTHER_BLUES,\n T1_BLEND_FORCE_BOLD,\n\n T1_BLEND_MAX /* do not remove */\n\n } T1_Blend_Flags;\n\n\n /* these constants are deprecated; use the corresponding */\n /* `T1_Blend_Flags` values instead */\n#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION\n#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS\n#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE\n#define t1_blend_blue_values T1_BLEND_BLUE_VALUES\n#define t1_blend_other_blues T1_BLEND_OTHER_BLUES\n#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH\n#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT\n#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS\n#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS\n#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE\n#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT\n#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES\n#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES\n#define t1_blend_force_bold T1_BLEND_FORCE_BOLD\n#define t1_blend_max T1_BLEND_MAX\n\n /* */\n\n\n /* maximum number of Multiple Masters designs, as defined in the spec */\n#define T1_MAX_MM_DESIGNS 16\n\n /* maximum number of Multiple Masters axes, as defined in the spec */\n#define T1_MAX_MM_AXIS 4\n\n /* maximum number of elements in a design map */\n#define T1_MAX_MM_MAP_POINTS 20\n\n\n /* this structure is used to store the BlendDesignMap entry for an axis */\n typedef struct PS_DesignMap_\n {\n FT_Byte num_points;\n FT_Long* design_points;\n FT_Fixed* blend_points;\n\n } PS_DesignMapRec, *PS_DesignMap;\n\n /* backward compatible definition */\n typedef PS_DesignMapRec T1_DesignMap;\n\n\n typedef struct PS_BlendRec_\n {\n FT_UInt num_designs;\n FT_UInt num_axis;\n\n FT_String* axis_names[T1_MAX_MM_AXIS];\n FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];\n PS_DesignMapRec design_map[T1_MAX_MM_AXIS];\n\n FT_Fixed* weight_vector;\n FT_Fixed* default_weight_vector;\n\n PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1];\n PS_Private privates [T1_MAX_MM_DESIGNS + 1];\n\n FT_ULong blend_bitflags;\n\n FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1];\n\n /* since 2.3.0 */\n\n /* undocumented, optional: the default design instance; */\n /* corresponds to default_weight_vector -- */\n /* num_default_design_vector == 0 means it is not present */\n /* in the font and associated metrics files */\n FT_UInt default_design_vector[T1_MAX_MM_DESIGNS];\n FT_UInt num_default_design_vector;\n\n } PS_BlendRec, *PS_Blend;\n\n\n /* backward compatible definition */\n typedef PS_BlendRec T1_Blend;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FaceDictRec\n *\n * @description:\n * A structure used to represent data in a CID top-level dictionary. In\n * most cases, they are part of the font's '/FDArray' array. Within a\n * CID font file, such (internal) subfont dictionaries are enclosed by\n * '%ADOBeginFontDict' and '%ADOEndFontDict' comments.\n *\n * Note that `CID_FaceDictRec` misses a field for the '/FontName'\n * keyword, specifying the subfont's name (the top-level font name is\n * given by the '/CIDFontName' keyword). This is an oversight, but it\n * doesn't limit the 'cid' font module's functionality because FreeType\n * neither needs this entry nor gives access to CID subfonts.\n */\n typedef struct CID_FaceDictRec_\n {\n PS_PrivateRec private_dict;\n\n FT_UInt len_buildchar;\n FT_Fixed forcebold_threshold;\n FT_Pos stroke_width;\n FT_Fixed expansion_factor; /* this is a duplicate of */\n /* `private_dict->expansion_factor' */\n FT_Byte paint_type;\n FT_Byte font_type;\n FT_Matrix font_matrix;\n FT_Vector font_offset;\n\n FT_UInt num_subrs;\n FT_ULong subrmap_offset;\n FT_Int sd_bytes;\n\n } CID_FaceDictRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FaceDict\n *\n * @description:\n * A handle to a @CID_FaceDictRec structure.\n */\n typedef struct CID_FaceDictRec_* CID_FaceDict;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FontDict\n *\n * @description:\n * This type is equivalent to @CID_FaceDictRec. It is deprecated but\n * kept to maintain source compatibility between various versions of\n * FreeType.\n */\n typedef CID_FaceDictRec CID_FontDict;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FaceInfoRec\n *\n * @description:\n * A structure used to represent CID Face information.\n */\n typedef struct CID_FaceInfoRec_\n {\n FT_String* cid_font_name;\n FT_Fixed cid_version;\n FT_Int cid_font_type;\n\n FT_String* registry;\n FT_String* ordering;\n FT_Int supplement;\n\n PS_FontInfoRec font_info;\n FT_BBox font_bbox;\n FT_ULong uid_base;\n\n FT_Int num_xuid;\n FT_ULong xuid[16];\n\n FT_ULong cidmap_offset;\n FT_Int fd_bytes;\n FT_Int gd_bytes;\n FT_ULong cid_count;\n\n FT_Int num_dicts;\n CID_FaceDict font_dicts;\n\n FT_ULong data_offset;\n\n } CID_FaceInfoRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FaceInfo\n *\n * @description:\n * A handle to a @CID_FaceInfoRec structure.\n */\n typedef struct CID_FaceInfoRec_* CID_FaceInfo;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_Info\n *\n * @description:\n * This type is equivalent to @CID_FaceInfoRec. It is deprecated but kept\n * to maintain source compatibility between various versions of FreeType.\n */\n typedef CID_FaceInfoRec CID_Info;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Has_PS_Glyph_Names\n *\n * @description:\n * Return true if a given face provides reliable PostScript glyph names.\n * This is similar to using the @FT_HAS_GLYPH_NAMES macro, except that\n * certain fonts (mostly TrueType) contain incorrect glyph name tables.\n *\n * When this function returns true, the caller is sure that the glyph\n * names returned by @FT_Get_Glyph_Name are reliable.\n *\n * @input:\n * face ::\n * face handle\n *\n * @return:\n * Boolean. True if glyph names are reliable.\n *\n */\n FT_EXPORT( FT_Int )\n FT_Has_PS_Glyph_Names( FT_Face face );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PS_Font_Info\n *\n * @description:\n * Retrieve the @PS_FontInfoRec structure corresponding to a given\n * PostScript font.\n *\n * @input:\n * face ::\n * PostScript face handle.\n *\n * @output:\n * afont_info ::\n * Output font info structure pointer.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * String pointers within the @PS_FontInfoRec structure are owned by the\n * face and don't need to be freed by the caller. Missing entries in\n * the font's FontInfo dictionary are represented by `NULL` pointers.\n *\n * If the font's format is not PostScript-based, this function will\n * return the `FT_Err_Invalid_Argument` error code.\n *\n */\n FT_EXPORT( FT_Error )\n FT_Get_PS_Font_Info( FT_Face face,\n PS_FontInfo afont_info );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PS_Font_Private\n *\n * @description:\n * Retrieve the @PS_PrivateRec structure corresponding to a given\n * PostScript font.\n *\n * @input:\n * face ::\n * PostScript face handle.\n *\n * @output:\n * afont_private ::\n * Output private dictionary structure pointer.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The string pointers within the @PS_PrivateRec structure are owned by\n * the face and don't need to be freed by the caller.\n *\n * If the font's format is not PostScript-based, this function returns\n * the `FT_Err_Invalid_Argument` error code.\n *\n */\n FT_EXPORT( FT_Error )\n FT_Get_PS_Font_Private( FT_Face face,\n PS_Private afont_private );\n\n\n /**************************************************************************\n *\n * @enum:\n * T1_EncodingType\n *\n * @description:\n * An enumeration describing the 'Encoding' entry in a Type 1 dictionary.\n *\n * @values:\n * T1_ENCODING_TYPE_NONE ::\n * T1_ENCODING_TYPE_ARRAY ::\n * T1_ENCODING_TYPE_STANDARD ::\n * T1_ENCODING_TYPE_ISOLATIN1 ::\n * T1_ENCODING_TYPE_EXPERT ::\n *\n * @since:\n * 2.4.8\n */\n typedef enum T1_EncodingType_\n {\n T1_ENCODING_TYPE_NONE = 0,\n T1_ENCODING_TYPE_ARRAY,\n T1_ENCODING_TYPE_STANDARD,\n T1_ENCODING_TYPE_ISOLATIN1,\n T1_ENCODING_TYPE_EXPERT\n\n } T1_EncodingType;\n\n\n /**************************************************************************\n *\n * @enum:\n * PS_Dict_Keys\n *\n * @description:\n * An enumeration used in calls to @FT_Get_PS_Font_Value to identify the\n * Type~1 dictionary entry to retrieve.\n *\n * @values:\n * PS_DICT_FONT_TYPE ::\n * PS_DICT_FONT_MATRIX ::\n * PS_DICT_FONT_BBOX ::\n * PS_DICT_PAINT_TYPE ::\n * PS_DICT_FONT_NAME ::\n * PS_DICT_UNIQUE_ID ::\n * PS_DICT_NUM_CHAR_STRINGS ::\n * PS_DICT_CHAR_STRING_KEY ::\n * PS_DICT_CHAR_STRING ::\n * PS_DICT_ENCODING_TYPE ::\n * PS_DICT_ENCODING_ENTRY ::\n * PS_DICT_NUM_SUBRS ::\n * PS_DICT_SUBR ::\n * PS_DICT_STD_HW ::\n * PS_DICT_STD_VW ::\n * PS_DICT_NUM_BLUE_VALUES ::\n * PS_DICT_BLUE_VALUE ::\n * PS_DICT_BLUE_FUZZ ::\n * PS_DICT_NUM_OTHER_BLUES ::\n * PS_DICT_OTHER_BLUE ::\n * PS_DICT_NUM_FAMILY_BLUES ::\n * PS_DICT_FAMILY_BLUE ::\n * PS_DICT_NUM_FAMILY_OTHER_BLUES ::\n * PS_DICT_FAMILY_OTHER_BLUE ::\n * PS_DICT_BLUE_SCALE ::\n * PS_DICT_BLUE_SHIFT ::\n * PS_DICT_NUM_STEM_SNAP_H ::\n * PS_DICT_STEM_SNAP_H ::\n * PS_DICT_NUM_STEM_SNAP_V ::\n * PS_DICT_STEM_SNAP_V ::\n * PS_DICT_FORCE_BOLD ::\n * PS_DICT_RND_STEM_UP ::\n * PS_DICT_MIN_FEATURE ::\n * PS_DICT_LEN_IV ::\n * PS_DICT_PASSWORD ::\n * PS_DICT_LANGUAGE_GROUP ::\n * PS_DICT_VERSION ::\n * PS_DICT_NOTICE ::\n * PS_DICT_FULL_NAME ::\n * PS_DICT_FAMILY_NAME ::\n * PS_DICT_WEIGHT ::\n * PS_DICT_IS_FIXED_PITCH ::\n * PS_DICT_UNDERLINE_POSITION ::\n * PS_DICT_UNDERLINE_THICKNESS ::\n * PS_DICT_FS_TYPE ::\n * PS_DICT_ITALIC_ANGLE ::\n *\n * @since:\n * 2.4.8\n */\n typedef enum PS_Dict_Keys_\n {\n /* conventionally in the font dictionary */\n PS_DICT_FONT_TYPE, /* FT_Byte */\n PS_DICT_FONT_MATRIX, /* FT_Fixed */\n PS_DICT_FONT_BBOX, /* FT_Fixed */\n PS_DICT_PAINT_TYPE, /* FT_Byte */\n PS_DICT_FONT_NAME, /* FT_String* */\n PS_DICT_UNIQUE_ID, /* FT_Int */\n PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */\n PS_DICT_CHAR_STRING_KEY, /* FT_String* */\n PS_DICT_CHAR_STRING, /* FT_String* */\n PS_DICT_ENCODING_TYPE, /* T1_EncodingType */\n PS_DICT_ENCODING_ENTRY, /* FT_String* */\n\n /* conventionally in the font Private dictionary */\n PS_DICT_NUM_SUBRS, /* FT_Int */\n PS_DICT_SUBR, /* FT_String* */\n PS_DICT_STD_HW, /* FT_UShort */\n PS_DICT_STD_VW, /* FT_UShort */\n PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */\n PS_DICT_BLUE_VALUE, /* FT_Short */\n PS_DICT_BLUE_FUZZ, /* FT_Int */\n PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */\n PS_DICT_OTHER_BLUE, /* FT_Short */\n PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */\n PS_DICT_FAMILY_BLUE, /* FT_Short */\n PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */\n PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */\n PS_DICT_BLUE_SCALE, /* FT_Fixed */\n PS_DICT_BLUE_SHIFT, /* FT_Int */\n PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */\n PS_DICT_STEM_SNAP_H, /* FT_Short */\n PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */\n PS_DICT_STEM_SNAP_V, /* FT_Short */\n PS_DICT_FORCE_BOLD, /* FT_Bool */\n PS_DICT_RND_STEM_UP, /* FT_Bool */\n PS_DICT_MIN_FEATURE, /* FT_Short */\n PS_DICT_LEN_IV, /* FT_Int */\n PS_DICT_PASSWORD, /* FT_Long */\n PS_DICT_LANGUAGE_GROUP, /* FT_Long */\n\n /* conventionally in the font FontInfo dictionary */\n PS_DICT_VERSION, /* FT_String* */\n PS_DICT_NOTICE, /* FT_String* */\n PS_DICT_FULL_NAME, /* FT_String* */\n PS_DICT_FAMILY_NAME, /* FT_String* */\n PS_DICT_WEIGHT, /* FT_String* */\n PS_DICT_IS_FIXED_PITCH, /* FT_Bool */\n PS_DICT_UNDERLINE_POSITION, /* FT_Short */\n PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */\n PS_DICT_FS_TYPE, /* FT_UShort */\n PS_DICT_ITALIC_ANGLE, /* FT_Long */\n\n PS_DICT_MAX = PS_DICT_ITALIC_ANGLE\n\n } PS_Dict_Keys;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PS_Font_Value\n *\n * @description:\n * Retrieve the value for the supplied key from a PostScript font.\n *\n * @input:\n * face ::\n * PostScript face handle.\n *\n * key ::\n * An enumeration value representing the dictionary key to retrieve.\n *\n * idx ::\n * For array values, this specifies the index to be returned.\n *\n * value ::\n * A pointer to memory into which to write the value.\n *\n * valen_len ::\n * The size, in bytes, of the memory supplied for the value.\n *\n * @output:\n * value ::\n * The value matching the above key, if it exists.\n *\n * @return:\n * The amount of memory (in bytes) required to hold the requested value\n * (if it exists, -1 otherwise).\n *\n * @note:\n * The values returned are not pointers into the internal structures of\n * the face, but are 'fresh' copies, so that the memory containing them\n * belongs to the calling application. This also enforces the\n * 'read-only' nature of these values, i.e., this function cannot be\n * used to manipulate the face.\n *\n * `value` is a void pointer because the values returned can be of\n * various types.\n *\n * If either `value` is `NULL` or `value_len` is too small, just the\n * required memory size for the requested entry is returned.\n *\n * The `idx` parameter is used, not only to retrieve elements of, for\n * example, the FontMatrix or FontBBox, but also to retrieve name keys\n * from the CharStrings dictionary, and the charstrings themselves. It\n * is ignored for atomic values.\n *\n * `PS_DICT_BLUE_SCALE` returns a value that is scaled up by 1000. To\n * get the value as in the font stream, you need to divide by 65536000.0\n * (to remove the FT_Fixed scale, and the x1000 scale).\n *\n * IMPORTANT: Only key/value pairs read by the FreeType interpreter can\n * be retrieved. So, for example, PostScript procedures such as NP, ND,\n * and RD are not available. Arbitrary keys are, obviously, not be\n * available either.\n *\n * If the font's format is not PostScript-based, this function returns\n * the `FT_Err_Invalid_Argument` error code.\n *\n * @since:\n * 2.4.8\n *\n */\n FT_EXPORT( FT_Long )\n FT_Get_PS_Font_Value( FT_Face face,\n PS_Dict_Keys key,\n FT_UInt idx,\n void *value,\n FT_Long value_len );\n\n /* */\n\nFT_END_HEADER\n\n#endif /* T1TABLES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ttnameid.h", "language": "code", "loc": 1168, "comment_density": 0.543, "code": "/****************************************************************************\n *\n * ttnameid.h\n *\n * TrueType name ID definitions (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef TTNAMEID_H_\n#define TTNAMEID_H_\n\n\n#include \n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * truetype_tables\n */\n\n\n /**************************************************************************\n *\n * Possible values for the 'platform' identifier code in the name records\n * of an SFNT 'name' table.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_PLATFORM_XXX\n *\n * @description:\n * A list of valid values for the `platform_id` identifier code in\n * @FT_CharMapRec and @FT_SfntName structures.\n *\n * @values:\n * TT_PLATFORM_APPLE_UNICODE ::\n * Used by Apple to indicate a Unicode character map and/or name entry.\n * See @TT_APPLE_ID_XXX for corresponding `encoding_id` values. Note\n * that name entries in this format are coded as big-endian UCS-2\n * character codes _only_.\n *\n * TT_PLATFORM_MACINTOSH ::\n * Used by Apple to indicate a MacOS-specific charmap and/or name\n * entry. See @TT_MAC_ID_XXX for corresponding `encoding_id` values.\n * Note that most TrueType fonts contain an Apple roman charmap to be\n * usable on MacOS systems (even if they contain a Microsoft charmap as\n * well).\n *\n * TT_PLATFORM_ISO ::\n * This value was used to specify ISO/IEC 10646 charmaps. It is\n * however now deprecated. See @TT_ISO_ID_XXX for a list of\n * corresponding `encoding_id` values.\n *\n * TT_PLATFORM_MICROSOFT ::\n * Used by Microsoft to indicate Windows-specific charmaps. See\n * @TT_MS_ID_XXX for a list of corresponding `encoding_id` values.\n * Note that most fonts contain a Unicode charmap using\n * (`TT_PLATFORM_MICROSOFT`, @TT_MS_ID_UNICODE_CS).\n *\n * TT_PLATFORM_CUSTOM ::\n * Used to indicate application-specific charmaps.\n *\n * TT_PLATFORM_ADOBE ::\n * This value isn't part of any font format specification, but is used\n * by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec\n * structure. See @TT_ADOBE_ID_XXX.\n */\n\n#define TT_PLATFORM_APPLE_UNICODE 0\n#define TT_PLATFORM_MACINTOSH 1\n#define TT_PLATFORM_ISO 2 /* deprecated */\n#define TT_PLATFORM_MICROSOFT 3\n#define TT_PLATFORM_CUSTOM 4\n#define TT_PLATFORM_ADOBE 7 /* artificial */\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_APPLE_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for\n * @TT_PLATFORM_APPLE_UNICODE charmaps and name entries.\n *\n * @values:\n * TT_APPLE_ID_DEFAULT ::\n * Unicode version 1.0.\n *\n * TT_APPLE_ID_UNICODE_1_1 ::\n * Unicode 1.1; specifies Hangul characters starting at U+34xx.\n *\n * TT_APPLE_ID_ISO_10646 ::\n * Deprecated (identical to preceding).\n *\n * TT_APPLE_ID_UNICODE_2_0 ::\n * Unicode 2.0 and beyond (UTF-16 BMP only).\n *\n * TT_APPLE_ID_UNICODE_32 ::\n * Unicode 3.1 and beyond, using UTF-32.\n *\n * TT_APPLE_ID_VARIANT_SELECTOR ::\n * From Adobe, not Apple. Not a normal cmap. Specifies variations on\n * a real cmap.\n *\n * TT_APPLE_ID_FULL_UNICODE ::\n * Used for fallback fonts that provide complete Unicode coverage with\n * a type~13 cmap.\n */\n\n#define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */\n#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */\n#define TT_APPLE_ID_ISO_10646 2 /* deprecated */\n#define TT_APPLE_ID_UNICODE_2_0 3 /* or later */\n#define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */\n#define TT_APPLE_ID_VARIANT_SELECTOR 5 /* variation selector data */\n#define TT_APPLE_ID_FULL_UNICODE 6 /* used with type 13 cmaps */\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_MAC_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for\n * @TT_PLATFORM_MACINTOSH charmaps and name entries.\n */\n\n#define TT_MAC_ID_ROMAN 0\n#define TT_MAC_ID_JAPANESE 1\n#define TT_MAC_ID_TRADITIONAL_CHINESE 2\n#define TT_MAC_ID_KOREAN 3\n#define TT_MAC_ID_ARABIC 4\n#define TT_MAC_ID_HEBREW 5\n#define TT_MAC_ID_GREEK 6\n#define TT_MAC_ID_RUSSIAN 7\n#define TT_MAC_ID_RSYMBOL 8\n#define TT_MAC_ID_DEVANAGARI 9\n#define TT_MAC_ID_GURMUKHI 10\n#define TT_MAC_ID_GUJARATI 11\n#define TT_MAC_ID_ORIYA 12\n#define TT_MAC_ID_BENGALI 13\n#define TT_MAC_ID_TAMIL 14\n#define TT_MAC_ID_TELUGU 15\n#define TT_MAC_ID_KANNADA 16\n#define TT_MAC_ID_MALAYALAM 17\n#define TT_MAC_ID_SINHALESE 18\n#define TT_MAC_ID_BURMESE 19\n#define TT_MAC_ID_KHMER 20\n#define TT_MAC_ID_THAI 21\n#define TT_MAC_ID_LAOTIAN 22\n#define TT_MAC_ID_GEORGIAN 23\n#define TT_MAC_ID_ARMENIAN 24\n#define TT_MAC_ID_MALDIVIAN 25\n#define TT_MAC_ID_SIMPLIFIED_CHINESE 25\n#define TT_MAC_ID_TIBETAN 26\n#define TT_MAC_ID_MONGOLIAN 27\n#define TT_MAC_ID_GEEZ 28\n#define TT_MAC_ID_SLAVIC 29\n#define TT_MAC_ID_VIETNAMESE 30\n#define TT_MAC_ID_SINDHI 31\n#define TT_MAC_ID_UNINTERP 32\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_ISO_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for @TT_PLATFORM_ISO\n * charmaps and name entries.\n *\n * Their use is now deprecated.\n *\n * @values:\n * TT_ISO_ID_7BIT_ASCII ::\n * ASCII.\n * TT_ISO_ID_10646 ::\n * ISO/10646.\n * TT_ISO_ID_8859_1 ::\n * Also known as Latin-1.\n */\n\n#define TT_ISO_ID_7BIT_ASCII 0\n#define TT_ISO_ID_10646 1\n#define TT_ISO_ID_8859_1 2\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_MS_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for\n * @TT_PLATFORM_MICROSOFT charmaps and name entries.\n *\n * @values:\n * TT_MS_ID_SYMBOL_CS ::\n * Microsoft symbol encoding. See @FT_ENCODING_MS_SYMBOL.\n *\n * TT_MS_ID_UNICODE_CS ::\n * Microsoft WGL4 charmap, matching Unicode. See @FT_ENCODING_UNICODE.\n *\n * TT_MS_ID_SJIS ::\n * Shift JIS Japanese encoding. See @FT_ENCODING_SJIS.\n *\n * TT_MS_ID_PRC ::\n * Chinese encodings as used in the People's Republic of China (PRC).\n * This means the encodings GB~2312 and its supersets GBK and GB~18030.\n * See @FT_ENCODING_PRC.\n *\n * TT_MS_ID_BIG_5 ::\n * Traditional Chinese as used in Taiwan and Hong Kong. See\n * @FT_ENCODING_BIG5.\n *\n * TT_MS_ID_WANSUNG ::\n * Korean Extended Wansung encoding. See @FT_ENCODING_WANSUNG.\n *\n * TT_MS_ID_JOHAB ::\n * Korean Johab encoding. See @FT_ENCODING_JOHAB.\n *\n * TT_MS_ID_UCS_4 ::\n * UCS-4 or UTF-32 charmaps. This has been added to the OpenType\n * specification version 1.4 (mid-2001).\n */\n\n#define TT_MS_ID_SYMBOL_CS 0\n#define TT_MS_ID_UNICODE_CS 1\n#define TT_MS_ID_SJIS 2\n#define TT_MS_ID_PRC 3\n#define TT_MS_ID_BIG_5 4\n#define TT_MS_ID_WANSUNG 5\n#define TT_MS_ID_JOHAB 6\n#define TT_MS_ID_UCS_4 10\n\n /* this value is deprecated */\n#define TT_MS_ID_GB2312 TT_MS_ID_PRC\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_ADOBE_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for @TT_PLATFORM_ADOBE\n * charmaps. This is a FreeType-specific extension!\n *\n * @values:\n * TT_ADOBE_ID_STANDARD ::\n * Adobe standard encoding.\n * TT_ADOBE_ID_EXPERT ::\n * Adobe expert encoding.\n * TT_ADOBE_ID_CUSTOM ::\n * Adobe custom encoding.\n * TT_ADOBE_ID_LATIN_1 ::\n * Adobe Latin~1 encoding.\n */\n\n#define TT_ADOBE_ID_STANDARD 0\n#define TT_ADOBE_ID_EXPERT 1\n#define TT_ADOBE_ID_CUSTOM 2\n#define TT_ADOBE_ID_LATIN_1 3\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_MAC_LANGID_XXX\n *\n * @description:\n * Possible values of the language identifier field in the name records\n * of the SFNT 'name' table if the 'platform' identifier code is\n * @TT_PLATFORM_MACINTOSH. These values are also used as return values\n * for function @FT_Get_CMap_Language_ID.\n *\n * The canonical source for Apple's IDs is\n *\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html\n */\n\n#define TT_MAC_LANGID_ENGLISH 0\n#define TT_MAC_LANGID_FRENCH 1\n#define TT_MAC_LANGID_GERMAN 2\n#define TT_MAC_LANGID_ITALIAN 3\n#define TT_MAC_LANGID_DUTCH 4\n#define TT_MAC_LANGID_SWEDISH 5\n#define TT_MAC_LANGID_SPANISH 6\n#define TT_MAC_LANGID_DANISH 7\n#define TT_MAC_LANGID_PORTUGUESE 8\n#define TT_MAC_LANGID_NORWEGIAN 9\n#define TT_MAC_LANGID_HEBREW 10\n#define TT_MAC_LANGID_JAPANESE 11\n#define TT_MAC_LANGID_ARABIC 12\n#define TT_MAC_LANGID_FINNISH 13\n#define TT_MAC_LANGID_GREEK 14\n#define TT_MAC_LANGID_ICELANDIC 15\n#define TT_MAC_LANGID_MALTESE 16\n#define TT_MAC_LANGID_TURKISH 17\n#define TT_MAC_LANGID_CROATIAN 18\n#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19\n#define TT_MAC_LANGID_URDU 20\n#define TT_MAC_LANGID_HINDI 21\n#define TT_MAC_LANGID_THAI 22\n#define TT_MAC_LANGID_KOREAN 23\n#define TT_MAC_LANGID_LITHUANIAN 24\n#define TT_MAC_LANGID_POLISH 25\n#define TT_MAC_LANGID_HUNGARIAN 26\n#define TT_MAC_LANGID_ESTONIAN 27\n#define TT_MAC_LANGID_LETTISH 28\n#define TT_MAC_LANGID_SAAMISK 29\n#define TT_MAC_LANGID_FAEROESE 30\n#define TT_MAC_LANGID_FARSI 31\n#define TT_MAC_LANGID_RUSSIAN 32\n#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33\n#define TT_MAC_LANGID_FLEMISH 34\n#define TT_MAC_LANGID_IRISH 35\n#define TT_MAC_LANGID_ALBANIAN 36\n#define TT_MAC_LANGID_ROMANIAN 37\n#define TT_MAC_LANGID_CZECH 38\n#define TT_MAC_LANGID_SLOVAK 39\n#define TT_MAC_LANGID_SLOVENIAN 40\n#define TT_MAC_LANGID_YIDDISH 41\n#define TT_MAC_LANGID_SERBIAN 42\n#define TT_MAC_LANGID_MACEDONIAN 43\n#define TT_MAC_LANGID_BULGARIAN 44\n#define TT_MAC_LANGID_UKRAINIAN 45\n#define TT_MAC_LANGID_BYELORUSSIAN 46\n#define TT_MAC_LANGID_UZBEK 47\n#define TT_MAC_LANGID_KAZAKH 48\n#define TT_MAC_LANGID_AZERBAIJANI 49\n#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49\n#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50\n#define TT_MAC_LANGID_ARMENIAN 51\n#define TT_MAC_LANGID_GEORGIAN 52\n#define TT_MAC_LANGID_MOLDAVIAN 53\n#define TT_MAC_LANGID_KIRGHIZ 54\n#define TT_MAC_LANGID_TAJIKI 55\n#define TT_MAC_LANGID_TURKMEN 56\n#define TT_MAC_LANGID_MONGOLIAN 57\n#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57\n#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58\n#define TT_MAC_LANGID_PASHTO 59\n#define TT_MAC_LANGID_KURDISH 60\n#define TT_MAC_LANGID_KASHMIRI 61\n#define TT_MAC_LANGID_SINDHI 62\n#define TT_MAC_LANGID_TIBETAN 63\n#define TT_MAC_LANGID_NEPALI 64\n#define TT_MAC_LANGID_SANSKRIT 65\n#define TT_MAC_LANGID_MARATHI 66\n#define TT_MAC_LANGID_BENGALI 67\n#define TT_MAC_LANGID_ASSAMESE 68\n#define TT_MAC_LANGID_GUJARATI 69\n#define TT_MAC_LANGID_PUNJABI 70\n#define TT_MAC_LANGID_ORIYA 71\n#define TT_MAC_LANGID_MALAYALAM 72\n#define TT_MAC_LANGID_KANNADA 73\n#define TT_MAC_LANGID_TAMIL 74\n#define TT_MAC_LANGID_TELUGU 75\n#define TT_MAC_LANGID_SINHALESE 76\n#define TT_MAC_LANGID_BURMESE 77\n#define TT_MAC_LANGID_KHMER 78\n#define TT_MAC_LANGID_LAO 79\n#define TT_MAC_LANGID_VIETNAMESE 80\n#define TT_MAC_LANGID_INDONESIAN 81\n#define TT_MAC_LANGID_TAGALOG 82\n#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83\n#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84\n#define TT_MAC_LANGID_AMHARIC 85\n#define TT_MAC_LANGID_TIGRINYA 86\n#define TT_MAC_LANGID_GALLA 87\n#define TT_MAC_LANGID_SOMALI 88\n#define TT_MAC_LANGID_SWAHILI 89\n#define TT_MAC_LANGID_RUANDA 90\n#define TT_MAC_LANGID_RUNDI 91\n#define TT_MAC_LANGID_CHEWA 92\n#define TT_MAC_LANGID_MALAGASY 93\n#define TT_MAC_LANGID_ESPERANTO 94\n#define TT_MAC_LANGID_WELSH 128\n#define TT_MAC_LANGID_BASQUE 129\n#define TT_MAC_LANGID_CATALAN 130\n#define TT_MAC_LANGID_LATIN 131\n#define TT_MAC_LANGID_QUECHUA 132\n#define TT_MAC_LANGID_GUARANI 133\n#define TT_MAC_LANGID_AYMARA 134\n#define TT_MAC_LANGID_TATAR 135\n#define TT_MAC_LANGID_UIGHUR 136\n#define TT_MAC_LANGID_DZONGKHA 137\n#define TT_MAC_LANGID_JAVANESE 138\n#define TT_MAC_LANGID_SUNDANESE 139\n\n /* The following codes are new as of 2000-03-10 */\n#define TT_MAC_LANGID_GALICIAN 140\n#define TT_MAC_LANGID_AFRIKAANS 141\n#define TT_MAC_LANGID_BRETON 142\n#define TT_MAC_LANGID_INUKTITUT 143\n#define TT_MAC_LANGID_SCOTTISH_GAELIC 144\n#define TT_MAC_LANGID_MANX_GAELIC 145\n#define TT_MAC_LANGID_IRISH_GAELIC 146\n#define TT_MAC_LANGID_TONGAN 147\n#define TT_MAC_LANGID_GREEK_POLYTONIC 148\n#define TT_MAC_LANGID_GREELANDIC 149\n#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_MS_LANGID_XXX\n *\n * @description:\n * Possible values of the language identifier field in the name records\n * of the SFNT 'name' table if the 'platform' identifier code is\n * @TT_PLATFORM_MICROSOFT. These values are also used as return values\n * for function @FT_Get_CMap_Language_ID.\n *\n * The canonical source for Microsoft's IDs is\n *\n * https://docs.microsoft.com/en-us/windows/desktop/Intl/language-identifier-constants-and-strings ,\n *\n * however, we only provide macros for language identifiers present in\n * the OpenType specification: Microsoft has abandoned the concept of\n * LCIDs (language code identifiers), and format~1 of the 'name' table\n * provides a better mechanism for languages not covered here.\n *\n * More legacy values not listed in the reference can be found in the\n * @FT_TRUETYPE_IDS_H header file.\n */\n\n#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401\n#define TT_MS_LANGID_ARABIC_IRAQ 0x0801\n#define TT_MS_LANGID_ARABIC_EGYPT 0x0C01\n#define TT_MS_LANGID_ARABIC_LIBYA 0x1001\n#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401\n#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801\n#define TT_MS_LANGID_ARABIC_TUNISIA 0x1C01\n#define TT_MS_LANGID_ARABIC_OMAN 0x2001\n#define TT_MS_LANGID_ARABIC_YEMEN 0x2401\n#define TT_MS_LANGID_ARABIC_SYRIA 0x2801\n#define TT_MS_LANGID_ARABIC_JORDAN 0x2C01\n#define TT_MS_LANGID_ARABIC_LEBANON 0x3001\n#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401\n#define TT_MS_LANGID_ARABIC_UAE 0x3801\n#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3C01\n#define TT_MS_LANGID_ARABIC_QATAR 0x4001\n#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402\n#define TT_MS_LANGID_CATALAN_CATALAN 0x0403\n#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404\n#define TT_MS_LANGID_CHINESE_PRC 0x0804\n#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0C04\n#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004\n#define TT_MS_LANGID_CHINESE_MACAO 0x1404\n#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405\n#define TT_MS_LANGID_DANISH_DENMARK 0x0406\n#define TT_MS_LANGID_GERMAN_GERMANY 0x0407\n#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807\n#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0C07\n#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007\n#define TT_MS_LANGID_GERMAN_LIECHTENSTEIN 0x1407\n#define TT_MS_LANGID_GREEK_GREECE 0x0408\n#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409\n#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809\n#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0C09\n#define TT_MS_LANGID_ENGLISH_CANADA 0x1009\n#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409\n#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809\n#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1C09\n#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009\n#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409\n#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809\n#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2C09\n#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009\n#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409\n#define TT_MS_LANGID_ENGLISH_INDIA 0x4009\n#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409\n#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809\n#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040A\n#define TT_MS_LANGID_SPANISH_MEXICO 0x080A\n#define TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT 0x0C0A\n#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100A\n#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140A\n#define TT_MS_LANGID_SPANISH_PANAMA 0x180A\n#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1C0A\n#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200A\n#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240A\n#define TT_MS_LANGID_SPANISH_PERU 0x280A\n#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2C0A\n#define TT_MS_LANGID_SPANISH_ECUADOR 0x300A\n#define TT_MS_LANGID_SPANISH_CHILE 0x340A\n#define TT_MS_LANGID_SPANISH_URUGUAY 0x380A\n#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3C0A\n#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400A\n#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440A\n#define TT_MS_LANGID_SPANISH_HONDURAS 0x480A\n#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4C0A\n#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500A\n#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540A\n#define TT_MS_LANGID_FINNISH_FINLAND 0x040B\n#define TT_MS_LANGID_FRENCH_FRANCE 0x040C\n#define TT_MS_LANGID_FRENCH_BELGIUM 0x080C\n#define TT_MS_LANGID_FRENCH_CANADA 0x0C0C\n#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100C\n#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140C\n#define TT_MS_LANGID_FRENCH_MONACO 0x180C\n#define TT_MS_LANGID_HEBREW_ISRAEL 0x040D\n#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040E\n#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040F\n#define TT_MS_LANGID_ITALIAN_ITALY 0x0410\n#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810\n#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411\n#define TT_MS_LANGID_KOREAN_KOREA 0x0412\n#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413\n#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813\n#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414\n#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814\n#define TT_MS_LANGID_POLISH_POLAND 0x0415\n#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416\n#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816\n#define TT_MS_LANGID_ROMANSH_SWITZERLAND 0x0417\n#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418\n#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419\n#define TT_MS_LANGID_CROATIAN_CROATIA 0x041A\n#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081A\n#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0C1A\n#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101A\n#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141A\n#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181A\n#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x1C1A\n#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC 0x201A\n#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041B\n#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041C\n#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041D\n#define TT_MS_LANGID_SWEDISH_FINLAND 0x081D\n#define TT_MS_LANGID_THAI_THAILAND 0x041E\n#define TT_MS_LANGID_TURKISH_TURKEY 0x041F\n#define TT_MS_LANGID_URDU_PAKISTAN 0x0420\n#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421\n#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422\n#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423\n#define TT_MS_LANGID_SLOVENIAN_SLOVENIA 0x0424\n#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425\n#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426\n#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427\n#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428\n#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042A\n#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042B\n#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042C\n#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082C\n#define TT_MS_LANGID_BASQUE_BASQUE 0x042D\n#define TT_MS_LANGID_UPPER_SORBIAN_GERMANY 0x042E\n#define TT_MS_LANGID_LOWER_SORBIAN_GERMANY 0x082E\n#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042F\n#define TT_MS_LANGID_SETSWANA_SOUTH_AFRICA 0x0432\n#define TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA 0x0434\n#define TT_MS_LANGID_ISIZULU_SOUTH_AFRICA 0x0435\n#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436\n#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437\n#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438\n#define TT_MS_LANGID_HINDI_INDIA 0x0439\n#define TT_MS_LANGID_MALTESE_MALTA 0x043A\n#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043B\n#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083B\n#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3B\n#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103B\n#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143B\n#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183B\n#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3B\n#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203B\n#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243B\n#define TT_MS_LANGID_IRISH_IRELAND 0x083C\n#define TT_MS_LANGID_MALAY_MALAYSIA 0x043E\n#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083E\n#define TT_MS_LANGID_KAZAKH_KAZAKHSTAN 0x043F\n#define TT_MS_LANGID_KYRGYZ_KYRGYZSTAN /* Cyrillic*/ 0x0440\n#define TT_MS_LANGID_KISWAHILI_KENYA 0x0441\n#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442\n#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443\n#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843\n#define TT_MS_LANGID_TATAR_RUSSIA 0x0444\n#define TT_MS_LANGID_BENGALI_INDIA 0x0445\n#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845\n#define TT_MS_LANGID_PUNJABI_INDIA 0x0446\n#define TT_MS_LANGID_GUJARATI_INDIA 0x0447\n#define TT_MS_LANGID_ODIA_INDIA 0x0448\n#define TT_MS_LANGID_TAMIL_INDIA 0x0449\n#define TT_MS_LANGID_TELUGU_INDIA 0x044A\n#define TT_MS_LANGID_KANNADA_INDIA 0x044B\n#define TT_MS_LANGID_MALAYALAM_INDIA 0x044C\n#define TT_MS_LANGID_ASSAMESE_INDIA 0x044D\n#define TT_MS_LANGID_MARATHI_INDIA 0x044E\n#define TT_MS_LANGID_SANSKRIT_INDIA 0x044F\n#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450\n#define TT_MS_LANGID_MONGOLIAN_PRC 0x0850\n#define TT_MS_LANGID_TIBETAN_PRC 0x0451\n#define TT_MS_LANGID_WELSH_UNITED_KINGDOM 0x0452\n#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453\n#define TT_MS_LANGID_LAO_LAOS 0x0454\n#define TT_MS_LANGID_GALICIAN_GALICIAN 0x0456\n#define TT_MS_LANGID_KONKANI_INDIA 0x0457\n#define TT_MS_LANGID_SYRIAC_SYRIA 0x045A\n#define TT_MS_LANGID_SINHALA_SRI_LANKA 0x045B\n#define TT_MS_LANGID_INUKTITUT_CANADA 0x045D\n#define TT_MS_LANGID_INUKTITUT_CANADA_LATIN 0x085D\n#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045E\n#define TT_MS_LANGID_TAMAZIGHT_ALGERIA 0x085F\n#define TT_MS_LANGID_NEPALI_NEPAL 0x0461\n#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462\n#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463\n#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464\n#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465\n#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468\n#define TT_MS_LANGID_YORUBA_NIGERIA 0x046A\n#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046B\n#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086B\n#define TT_MS_LANGID_QUECHUA_PERU 0x0C6B\n#define TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA 0x046C\n#define TT_MS_LANGID_BASHKIR_RUSSIA 0x046D\n#define TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG 0x046E\n#define TT_MS_LANGID_GREENLANDIC_GREENLAND 0x046F\n#define TT_MS_LANGID_IGBO_NIGERIA 0x0470\n#define TT_MS_LANGID_YI_PRC 0x0478\n#define TT_MS_LANGID_MAPUDUNGUN_CHILE 0x047A\n#define TT_MS_LANGID_MOHAWK_MOHAWK 0x047C\n#define TT_MS_LANGID_BRETON_FRANCE 0x047E\n#define TT_MS_LANGID_UIGHUR_PRC 0x0480\n#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481\n#define TT_MS_LANGID_OCCITAN_FRANCE 0x0482\n#define TT_MS_LANGID_CORSICAN_FRANCE 0x0483\n#define TT_MS_LANGID_ALSATIAN_FRANCE 0x0484\n#define TT_MS_LANGID_YAKUT_RUSSIA 0x0485\n#define TT_MS_LANGID_KICHE_GUATEMALA 0x0486\n#define TT_MS_LANGID_KINYARWANDA_RWANDA 0x0487\n#define TT_MS_LANGID_WOLOF_SENEGAL 0x0488\n#define TT_MS_LANGID_DARI_AFGHANISTAN 0x048C\n\n /* */\n\n\n /* legacy macro definitions not present in OpenType 1.8.1 */\n#define TT_MS_LANGID_ARABIC_GENERAL 0x0001\n#define TT_MS_LANGID_CATALAN_SPAIN \\\n TT_MS_LANGID_CATALAN_CATALAN\n#define TT_MS_LANGID_CHINESE_GENERAL 0x0004\n#define TT_MS_LANGID_CHINESE_MACAU \\\n TT_MS_LANGID_CHINESE_MACAO\n#define TT_MS_LANGID_GERMAN_LIECHTENSTEI \\\n TT_MS_LANGID_GERMAN_LIECHTENSTEIN\n#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009\n#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809\n#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3C09\n#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT \\\n TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT\n#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40AU\n#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1C0C\n#define TT_MS_LANGID_FRENCH_REUNION 0x200C\n#define TT_MS_LANGID_FRENCH_CONGO 0x240C\n /* which was formerly: */\n#define TT_MS_LANGID_FRENCH_ZAIRE \\\n TT_MS_LANGID_FRENCH_CONGO\n#define TT_MS_LANGID_FRENCH_SENEGAL 0x280C\n#define TT_MS_LANGID_FRENCH_CAMEROON 0x2C0C\n#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300C\n#define TT_MS_LANGID_FRENCH_MALI 0x340C\n#define TT_MS_LANGID_FRENCH_MOROCCO 0x380C\n#define TT_MS_LANGID_FRENCH_HAITI 0x3C0C\n#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40CU\n#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA \\\n TT_MS_LANGID_KOREAN_KOREA\n#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812\n#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND \\\n TT_MS_LANGID_ROMANSH_SWITZERLAND\n#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818\n#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819\n#define TT_MS_LANGID_URDU_INDIA 0x0820\n#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827\n#define TT_MS_LANGID_SLOVENE_SLOVENIA \\\n TT_MS_LANGID_SLOVENIAN_SLOVENIA\n#define TT_MS_LANGID_FARSI_IRAN 0x0429\n#define TT_MS_LANGID_BASQUE_SPAIN \\\n TT_MS_LANGID_BASQUE_BASQUE\n#define TT_MS_LANGID_SORBIAN_GERMANY \\\n TT_MS_LANGID_UPPER_SORBIAN_GERMANY\n#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430\n#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431\n#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA \\\n TT_MS_LANGID_SETSWANA_SOUTH_AFRICA\n#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433\n#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA \\\n TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA\n#define TT_MS_LANGID_ZULU_SOUTH_AFRICA \\\n TT_MS_LANGID_ISIZULU_SOUTH_AFRICA\n#define TT_MS_LANGID_SAAMI_LAPONIA 0x043B\n /* the next two values are incorrectly inverted */\n#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043C\n#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083C\n#define TT_MS_LANGID_YIDDISH_GERMANY 0x043D\n#define TT_MS_LANGID_KAZAK_KAZAKSTAN \\\n TT_MS_LANGID_KAZAKH_KAZAKHSTAN\n#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \\\n TT_MS_LANGID_KYRGYZ_KYRGYZSTAN\n#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN \\\n TT_MS_LANGID_KYRGYZ_KYRGYZSTAN\n#define TT_MS_LANGID_SWAHILI_KENYA \\\n TT_MS_LANGID_KISWAHILI_KENYA\n#define TT_MS_LANGID_TATAR_TATARSTAN \\\n TT_MS_LANGID_TATAR_RUSSIA\n#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846\n#define TT_MS_LANGID_ORIYA_INDIA \\\n TT_MS_LANGID_ODIA_INDIA\n#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN \\\n TT_MS_LANGID_MONGOLIAN_PRC\n#define TT_MS_LANGID_TIBETAN_CHINA \\\n TT_MS_LANGID_TIBETAN_PRC\n#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851\n#define TT_MS_LANGID_TIBETAN_BHUTAN \\\n TT_MS_LANGID_DZONGHKA_BHUTAN\n#define TT_MS_LANGID_WELSH_WALES \\\n TT_MS_LANGID_WELSH_UNITED_KINGDOM\n#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455\n#define TT_MS_LANGID_GALICIAN_SPAIN \\\n TT_MS_LANGID_GALICIAN_GALICIAN\n#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458\n#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459\n#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859\n#define TT_MS_LANGID_SINHALESE_SRI_LANKA \\\n TT_MS_LANGID_SINHALA_SRI_LANKA\n#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045C\n#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045F\n#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN \\\n TT_MS_LANGID_TAMAZIGHT_ALGERIA\n#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460\n#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860\n#define TT_MS_LANGID_KASHMIRI_INDIA \\\n TT_MS_LANGID_KASHMIRI_SASIA\n#define TT_MS_LANGID_NEPALI_INDIA 0x0861\n#define TT_MS_LANGID_DIVEHI_MALDIVES \\\n TT_MS_LANGID_DHIVEHI_MALDIVES\n#define TT_MS_LANGID_EDO_NIGERIA 0x0466\n#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467\n#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469\n#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA \\\n TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA\n#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \\\n TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA\n#define TT_MS_LANGID_KANURI_NIGERIA 0x0471\n#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472\n#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473\n#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873\n#define TT_MS_LANGID_TIGRIGNA_ERYTREA \\\n TT_MS_LANGID_TIGRIGNA_ERYTHREA\n#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474\n#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475\n#define TT_MS_LANGID_LATIN 0x0476\n#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477\n#define TT_MS_LANGID_YI_CHINA \\\n TT_MS_LANGID_YI_PRC\n#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479\n#define TT_MS_LANGID_UIGHUR_CHINA \\\n TT_MS_LANGID_UIGHUR_PRC\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_NAME_ID_XXX\n *\n * @description:\n * Possible values of the 'name' identifier field in the name records of\n * an SFNT 'name' table. These values are platform independent.\n */\n\n#define TT_NAME_ID_COPYRIGHT 0\n#define TT_NAME_ID_FONT_FAMILY 1\n#define TT_NAME_ID_FONT_SUBFAMILY 2\n#define TT_NAME_ID_UNIQUE_ID 3\n#define TT_NAME_ID_FULL_NAME 4\n#define TT_NAME_ID_VERSION_STRING 5\n#define TT_NAME_ID_PS_NAME 6\n#define TT_NAME_ID_TRADEMARK 7\n\n /* the following values are from the OpenType spec */\n#define TT_NAME_ID_MANUFACTURER 8\n#define TT_NAME_ID_DESIGNER 9\n#define TT_NAME_ID_DESCRIPTION 10\n#define TT_NAME_ID_VENDOR_URL 11\n#define TT_NAME_ID_DESIGNER_URL 12\n#define TT_NAME_ID_LICENSE 13\n#define TT_NAME_ID_LICENSE_URL 14\n /* number 15 is reserved */\n#define TT_NAME_ID_TYPOGRAPHIC_FAMILY 16\n#define TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY 17\n#define TT_NAME_ID_MAC_FULL_NAME 18\n\n /* The following code is new as of 2000-01-21 */\n#define TT_NAME_ID_SAMPLE_TEXT 19\n\n /* This is new in OpenType 1.3 */\n#define TT_NAME_ID_CID_FINDFONT_NAME 20\n\n /* This is new in OpenType 1.5 */\n#define TT_NAME_ID_WWS_FAMILY 21\n#define TT_NAME_ID_WWS_SUBFAMILY 22\n\n /* This is new in OpenType 1.7 */\n#define TT_NAME_ID_LIGHT_BACKGROUND 23\n#define TT_NAME_ID_DARK_BACKGROUND 24\n\n /* This is new in OpenType 1.8 */\n#define TT_NAME_ID_VARIATIONS_PREFIX 25\n\n /* these two values are deprecated */\n#define TT_NAME_ID_PREFERRED_FAMILY TT_NAME_ID_TYPOGRAPHIC_FAMILY\n#define TT_NAME_ID_PREFERRED_SUBFAMILY TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_UCR_XXX\n *\n * @description:\n * Possible bit mask values for the `ulUnicodeRangeX` fields in an SFNT\n * 'OS/2' table.\n */\n\n /* ulUnicodeRange1 */\n /* --------------- */\n\n /* Bit 0 Basic Latin */\n#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */\n /* Bit 1 C1 Controls and Latin-1 Supplement */\n#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */\n /* Bit 2 Latin Extended-A */\n#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */\n /* Bit 3 Latin Extended-B */\n#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */\n /* Bit 4 IPA Extensions */\n /* Phonetic Extensions */\n /* Phonetic Extensions Supplement */\n#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */\n /* U+1D00-U+1D7F */\n /* U+1D80-U+1DBF */\n /* Bit 5 Spacing Modifier Letters */\n /* Modifier Tone Letters */\n#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */\n /* U+A700-U+A71F */\n /* Bit 6 Combining Diacritical Marks */\n /* Combining Diacritical Marks Supplement */\n#define TT_UCR_COMBINING_DIACRITICAL_MARKS (1L << 6) /* U+0300-U+036F */\n /* U+1DC0-U+1DFF */\n /* Bit 7 Greek and Coptic */\n#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */\n /* Bit 8 Coptic */\n#define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */\n /* Bit 9 Cyrillic */\n /* Cyrillic Supplement */\n /* Cyrillic Extended-A */\n /* Cyrillic Extended-B */\n#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */\n /* U+0500-U+052F */\n /* U+2DE0-U+2DFF */\n /* U+A640-U+A69F */\n /* Bit 10 Armenian */\n#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */\n /* Bit 11 Hebrew */\n#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */\n /* Bit 12 Vai */\n#define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */\n /* Bit 13 Arabic */\n /* Arabic Supplement */\n#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */\n /* U+0750-U+077F */\n /* Bit 14 NKo */\n#define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */\n /* Bit 15 Devanagari */\n#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */\n /* Bit 16 Bengali */\n#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */\n /* Bit 17 Gurmukhi */\n#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */\n /* Bit 18 Gujarati */\n#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */\n /* Bit 19 Oriya */\n#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */\n /* Bit 20 Tamil */\n#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */\n /* Bit 21 Telugu */\n#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */\n /* Bit 22 Kannada */\n#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */\n /* Bit 23 Malayalam */\n#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */\n /* Bit 24 Thai */\n#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */\n /* Bit 25 Lao */\n#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */\n /* Bit 26 Georgian */\n /* Georgian Supplement */\n#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */\n /* U+2D00-U+2D2F */\n /* Bit 27 Balinese */\n#define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */\n /* Bit 28 Hangul Jamo */\n#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */\n /* Bit 29 Latin Extended Additional */\n /* Latin Extended-C */\n /* Latin Extended-D */\n#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */\n /* U+2C60-U+2C7F */\n /* U+A720-U+A7FF */\n /* Bit 30 Greek Extended */\n#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */\n /* Bit 31 General Punctuation */\n /* Supplemental Punctuation */\n#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */\n /* U+2E00-U+2E7F */\n\n /* ulUnicodeRange2 */\n /* --------------- */\n\n /* Bit 32 Superscripts And Subscripts */\n#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */\n /* Bit 33 Currency Symbols */\n#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */\n /* Bit 34 Combining Diacritical Marks For Symbols */\n#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \\\n (1L << 2) /* U+20D0-U+20FF */\n /* Bit 35 Letterlike Symbols */\n#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */\n /* Bit 36 Number Forms */\n#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */\n /* Bit 37 Arrows */\n /* Supplemental Arrows-A */\n /* Supplemental Arrows-B */\n /* Miscellaneous Symbols and Arrows */\n#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */\n /* U+27F0-U+27FF */\n /* U+2900-U+297F */\n /* U+2B00-U+2BFF */\n /* Bit 38 Mathematical Operators */\n /* Supplemental Mathematical Operators */\n /* Miscellaneous Mathematical Symbols-A */\n /* Miscellaneous Mathematical Symbols-B */\n#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */\n /* U+2A00-U+2AFF */\n /* U+27C0-U+27EF */\n /* U+2980-U+29FF */\n /* Bit 39 Miscellaneous Technical */\n#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */\n /* Bit 40 Control Pictures */\n#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */\n /* Bit 41 Optical Character Recognition */\n#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */\n /* Bit 42 Enclosed Alphanumerics */\n#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */\n /* Bit 43 Box Drawing */\n#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */\n /* Bit 44 Block Elements */\n#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */\n /* Bit 45 Geometric Shapes */\n#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */\n /* Bit 46 Miscellaneous Symbols */\n#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */\n /* Bit 47 Dingbats */\n#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */\n /* Bit 48 CJK Symbols and Punctuation */\n#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */\n /* Bit 49 Hiragana */\n#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */\n /* Bit 50 Katakana */\n /* Katakana Phonetic Extensions */\n#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */\n /* U+31F0-U+31FF */\n /* Bit 51 Bopomofo */\n /* Bopomofo Extended */\n#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */\n /* U+31A0-U+31BF */\n /* Bit 52 Hangul Compatibility Jamo */\n#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */\n /* Bit 53 Phags-Pa */\n#define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */\n#define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */\n#define TT_UCR_PHAGSPA\n /* Bit 54 Enclosed CJK Letters and Months */\n#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */\n /* Bit 55 CJK Compatibility */\n#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */\n /* Bit 56 Hangul Syllables */\n#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */\n /* Bit 57 High Surrogates */\n /* High Private Use Surrogates */\n /* Low Surrogates */\n\n /* According to OpenType specs v.1.3+, */\n /* setting bit 57 implies that there is */\n /* at least one codepoint beyond the */\n /* Basic Multilingual Plane that is */\n /* supported by this font. So it really */\n /* means >= U+10000. */\n#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */\n /* U+DB80-U+DBFF */\n /* U+DC00-U+DFFF */\n#define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES\n /* Bit 58 Phoenician */\n#define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/\n /* Bit 59 CJK Unified Ideographs */\n /* CJK Radicals Supplement */\n /* Kangxi Radicals */\n /* Ideographic Description Characters */\n /* CJK Unified Ideographs Extension A */\n /* CJK Unified Ideographs Extension B */\n /* Kanbun */\n#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */\n /* U+2E80-U+2EFF */\n /* U+2F00-U+2FDF */\n /* U+2FF0-U+2FFF */\n /* U+3400-U+4DB5 */\n /*U+20000-U+2A6DF*/\n /* U+3190-U+319F */\n /* Bit 60 Private Use */\n#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */\n /* Bit 61 CJK Strokes */\n /* CJK Compatibility Ideographs */\n /* CJK Compatibility Ideographs Supplement */\n#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */\n /* U+F900-U+FAFF */\n /*U+2F800-U+2FA1F*/\n /* Bit 62 Alphabetic Presentation Forms */\n#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */\n /* Bit 63 Arabic Presentation Forms-A */\n#define TT_UCR_ARABIC_PRESENTATION_FORMS_A (1L << 31) /* U+FB50-U+FDFF */\n\n /* ulUnicodeRange3 */\n /* --------------- */\n\n /* Bit 64 Combining Half Marks */\n#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */\n /* Bit 65 Vertical forms */\n /* CJK Compatibility Forms */\n#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */\n /* U+FE30-U+FE4F */\n /* Bit 66 Small Form Variants */\n#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */\n /* Bit 67 Arabic Presentation Forms-B */\n#define TT_UCR_ARABIC_PRESENTATION_FORMS_B (1L << 3) /* U+FE70-U+FEFE */\n /* Bit 68 Halfwidth and Fullwidth Forms */\n#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */\n /* Bit 69 Specials */\n#define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */\n /* Bit 70 Tibetan */\n#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */\n /* Bit 71 Syriac */\n#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */\n /* Bit 72 Thaana */\n#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */\n /* Bit 73 Sinhala */\n#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */\n /* Bit 74 Myanmar */\n#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */\n /* Bit 75 Ethiopic */\n /* Ethiopic Supplement */\n /* Ethiopic Extended */\n#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */\n /* U+1380-U+139F */\n /* U+2D80-U+2DDF */\n /* Bit 76 Cherokee */\n#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */\n /* Bit 77 Unified Canadian Aboriginal Syllabics */\n#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */\n /* Bit 78 Ogham */\n#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */\n /* Bit 79 Runic */\n#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */\n /* Bit 80 Khmer */\n /* Khmer Symbols */\n#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */\n /* U+19E0-U+19FF */\n /* Bit 81 Mongolian */\n#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */\n /* Bit 82 Braille Patterns */\n#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */\n /* Bit 83 Yi Syllables */\n /* Yi Radicals */\n#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */\n /* U+A490-U+A4CF */\n /* Bit 84 Tagalog */\n /* Hanunoo */\n /* Buhid */\n /* Tagbanwa */\n#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */\n /* U+1720-U+173F */\n /* U+1740-U+175F */\n /* U+1760-U+177F */\n /* Bit 85 Old Italic */\n#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/\n /* Bit 86 Gothic */\n#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/\n /* Bit 87 Deseret */\n#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/\n /* Bit 88 Byzantine Musical Symbols */\n /* Musical Symbols */\n /* Ancient Greek Musical Notation */\n#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/\n /*U+1D100-U+1D1FF*/\n /*U+1D200-U+1D24F*/\n /* Bit 89 Mathematical Alphanumeric Symbols */\n#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/\n /* Bit 90 Private Use (plane 15) */\n /* Private Use (plane 16) */\n#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/\n /*U+100000-U+10FFFD*/\n /* Bit 91 Variation Selectors */\n /* Variation Selectors Supplement */\n#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */\n /*U+E0100-U+E01EF*/\n /* Bit 92 Tags */\n#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/\n /* Bit 93 Limbu */\n#define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */\n /* Bit 94 Tai Le */\n#define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */\n /* Bit 95 New Tai Lue */\n#define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */\n\n /* ulUnicodeRange4 */\n /* --------------- */\n\n /* Bit 96 Buginese */\n#define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */\n /* Bit 97 Glagolitic */\n#define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */\n /* Bit 98 Tifinagh */\n#define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */\n /* Bit 99 Yijing Hexagram Symbols */\n#define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */\n /* Bit 100 Syloti Nagri */\n#define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */\n /* Bit 101 Linear B Syllabary */\n /* Linear B Ideograms */\n /* Aegean Numbers */\n#define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/\n /*U+10080-U+100FF*/\n /*U+10100-U+1013F*/\n /* Bit 102 Ancient Greek Numbers */\n#define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/\n /* Bit 103 Ugaritic */\n#define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/\n /* Bit 104 Old Persian */\n#define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/\n /* Bit 105 Shavian */\n#define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/\n /* Bit 106 Osmanya */\n#define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/\n /* Bit 107 Cypriot Syllabary */\n#define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/\n /* Bit 108 Kharoshthi */\n#define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/\n /* Bit 109 Tai Xuan Jing Symbols */\n#define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/\n /* Bit 110 Cuneiform */\n /* Cuneiform Numbers and Punctuation */\n#define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/\n /*U+12400-U+1247F*/\n /* Bit 111 Counting Rod Numerals */\n#define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/\n /* Bit 112 Sundanese */\n#define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */\n /* Bit 113 Lepcha */\n#define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */\n /* Bit 114 Ol Chiki */\n#define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */\n /* Bit 115 Saurashtra */\n#define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */\n /* Bit 116 Kayah Li */\n#define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */\n /* Bit 117 Rejang */\n#define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */\n /* Bit 118 Cham */\n#define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */\n /* Bit 119 Ancient Symbols */\n#define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/\n /* Bit 120 Phaistos Disc */\n#define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/\n /* Bit 121 Carian */\n /* Lycian */\n /* Lydian */\n#define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/\n /*U+10280-U+1029F*/\n /*U+10920-U+1093F*/\n /* Bit 122 Domino Tiles */\n /* Mahjong Tiles */\n#define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/\n /*U+1F000-U+1F02F*/\n /* Bit 123-127 Reserved for process-internal usage */\n\n /* */\n\n /* for backward compatibility with older FreeType versions */\n#define TT_UCR_ARABIC_PRESENTATION_A \\\n TT_UCR_ARABIC_PRESENTATION_FORMS_A\n#define TT_UCR_ARABIC_PRESENTATION_B \\\n TT_UCR_ARABIC_PRESENTATION_FORMS_B\n\n#define TT_UCR_COMBINING_DIACRITICS \\\n TT_UCR_COMBINING_DIACRITICAL_MARKS\n#define TT_UCR_COMBINING_DIACRITICS_SYMB \\\n TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB\n\n\nFT_END_HEADER\n\n#endif /* TTNAMEID_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/tttables.h", "language": "code", "loc": 776, "comment_density": 0.771, "code": "/****************************************************************************\n *\n * tttables.h\n *\n * Basic SFNT/TrueType tables definitions and interface\n * (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef TTTABLES_H_\n#define TTTABLES_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * truetype_tables\n *\n * @title:\n * TrueType Tables\n *\n * @abstract:\n * TrueType-specific table types and functions.\n *\n * @description:\n * This section contains definitions of some basic tables specific to\n * TrueType and OpenType as well as some routines used to access and\n * process them.\n *\n * @order:\n * TT_Header\n * TT_HoriHeader\n * TT_VertHeader\n * TT_OS2\n * TT_Postscript\n * TT_PCLT\n * TT_MaxProfile\n *\n * FT_Sfnt_Tag\n * FT_Get_Sfnt_Table\n * FT_Load_Sfnt_Table\n * FT_Sfnt_Table_Info\n *\n * FT_Get_CMap_Language_ID\n * FT_Get_CMap_Format\n *\n * FT_PARAM_TAG_UNPATENTED_HINTING\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Header\n *\n * @description:\n * A structure to model a TrueType font header table. All fields follow\n * the OpenType specification. The 64-bit timestamps are stored in\n * two-element arrays `Created` and `Modified`, first the upper then\n * the lower 32~bits.\n */\n typedef struct TT_Header_\n {\n FT_Fixed Table_Version;\n FT_Fixed Font_Revision;\n\n FT_Long CheckSum_Adjust;\n FT_Long Magic_Number;\n\n FT_UShort Flags;\n FT_UShort Units_Per_EM;\n\n FT_ULong Created [2];\n FT_ULong Modified[2];\n\n FT_Short xMin;\n FT_Short yMin;\n FT_Short xMax;\n FT_Short yMax;\n\n FT_UShort Mac_Style;\n FT_UShort Lowest_Rec_PPEM;\n\n FT_Short Font_Direction;\n FT_Short Index_To_Loc_Format;\n FT_Short Glyph_Data_Format;\n\n } TT_Header;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_HoriHeader\n *\n * @description:\n * A structure to model a TrueType horizontal header, the 'hhea' table,\n * as well as the corresponding horizontal metrics table, 'hmtx'.\n *\n * @fields:\n * Version ::\n * The table version.\n *\n * Ascender ::\n * The font's ascender, i.e., the distance from the baseline to the\n * top-most of all glyph points found in the font.\n *\n * This value is invalid in many fonts, as it is usually set by the\n * font designer, and often reflects only a portion of the glyphs found\n * in the font (maybe ASCII).\n *\n * You should use the `sTypoAscender` field of the 'OS/2' table instead\n * if you want the correct one.\n *\n * Descender ::\n * The font's descender, i.e., the distance from the baseline to the\n * bottom-most of all glyph points found in the font. It is negative.\n *\n * This value is invalid in many fonts, as it is usually set by the\n * font designer, and often reflects only a portion of the glyphs found\n * in the font (maybe ASCII).\n *\n * You should use the `sTypoDescender` field of the 'OS/2' table\n * instead if you want the correct one.\n *\n * Line_Gap ::\n * The font's line gap, i.e., the distance to add to the ascender and\n * descender to get the BTB, i.e., the baseline-to-baseline distance\n * for the font.\n *\n * advance_Width_Max ::\n * This field is the maximum of all advance widths found in the font.\n * It can be used to compute the maximum width of an arbitrary string\n * of text.\n *\n * min_Left_Side_Bearing ::\n * The minimum left side bearing of all glyphs within the font.\n *\n * min_Right_Side_Bearing ::\n * The minimum right side bearing of all glyphs within the font.\n *\n * xMax_Extent ::\n * The maximum horizontal extent (i.e., the 'width' of a glyph's\n * bounding box) for all glyphs in the font.\n *\n * caret_Slope_Rise ::\n * The rise coefficient of the cursor's slope of the cursor\n * (slope=rise/run).\n *\n * caret_Slope_Run ::\n * The run coefficient of the cursor's slope.\n *\n * caret_Offset ::\n * The cursor's offset for slanted fonts.\n *\n * Reserved ::\n * 8~reserved bytes.\n *\n * metric_Data_Format ::\n * Always~0.\n *\n * number_Of_HMetrics ::\n * Number of HMetrics entries in the 'hmtx' table -- this value can be\n * smaller than the total number of glyphs in the font.\n *\n * long_metrics ::\n * A pointer into the 'hmtx' table.\n *\n * short_metrics ::\n * A pointer into the 'hmtx' table.\n *\n * @note:\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `caret_Slope_Rise`,\n * `caret_Slope_Run`, and `caret_Offset`.\n */\n typedef struct TT_HoriHeader_\n {\n FT_Fixed Version;\n FT_Short Ascender;\n FT_Short Descender;\n FT_Short Line_Gap;\n\n FT_UShort advance_Width_Max; /* advance width maximum */\n\n FT_Short min_Left_Side_Bearing; /* minimum left-sb */\n FT_Short min_Right_Side_Bearing; /* minimum right-sb */\n FT_Short xMax_Extent; /* xmax extents */\n FT_Short caret_Slope_Rise;\n FT_Short caret_Slope_Run;\n FT_Short caret_Offset;\n\n FT_Short Reserved[4];\n\n FT_Short metric_Data_Format;\n FT_UShort number_Of_HMetrics;\n\n /* The following fields are not defined by the OpenType specification */\n /* but they are used to connect the metrics header to the relevant */\n /* 'hmtx' table. */\n\n void* long_metrics;\n void* short_metrics;\n\n } TT_HoriHeader;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_VertHeader\n *\n * @description:\n * A structure used to model a TrueType vertical header, the 'vhea'\n * table, as well as the corresponding vertical metrics table, 'vmtx'.\n *\n * @fields:\n * Version ::\n * The table version.\n *\n * Ascender ::\n * The font's ascender, i.e., the distance from the baseline to the\n * top-most of all glyph points found in the font.\n *\n * This value is invalid in many fonts, as it is usually set by the\n * font designer, and often reflects only a portion of the glyphs found\n * in the font (maybe ASCII).\n *\n * You should use the `sTypoAscender` field of the 'OS/2' table instead\n * if you want the correct one.\n *\n * Descender ::\n * The font's descender, i.e., the distance from the baseline to the\n * bottom-most of all glyph points found in the font. It is negative.\n *\n * This value is invalid in many fonts, as it is usually set by the\n * font designer, and often reflects only a portion of the glyphs found\n * in the font (maybe ASCII).\n *\n * You should use the `sTypoDescender` field of the 'OS/2' table\n * instead if you want the correct one.\n *\n * Line_Gap ::\n * The font's line gap, i.e., the distance to add to the ascender and\n * descender to get the BTB, i.e., the baseline-to-baseline distance\n * for the font.\n *\n * advance_Height_Max ::\n * This field is the maximum of all advance heights found in the font.\n * It can be used to compute the maximum height of an arbitrary string\n * of text.\n *\n * min_Top_Side_Bearing ::\n * The minimum top side bearing of all glyphs within the font.\n *\n * min_Bottom_Side_Bearing ::\n * The minimum bottom side bearing of all glyphs within the font.\n *\n * yMax_Extent ::\n * The maximum vertical extent (i.e., the 'height' of a glyph's\n * bounding box) for all glyphs in the font.\n *\n * caret_Slope_Rise ::\n * The rise coefficient of the cursor's slope of the cursor\n * (slope=rise/run).\n *\n * caret_Slope_Run ::\n * The run coefficient of the cursor's slope.\n *\n * caret_Offset ::\n * The cursor's offset for slanted fonts.\n *\n * Reserved ::\n * 8~reserved bytes.\n *\n * metric_Data_Format ::\n * Always~0.\n *\n * number_Of_VMetrics ::\n * Number of VMetrics entries in the 'vmtx' table -- this value can be\n * smaller than the total number of glyphs in the font.\n *\n * long_metrics ::\n * A pointer into the 'vmtx' table.\n *\n * short_metrics ::\n * A pointer into the 'vmtx' table.\n *\n * @note:\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `Ascender`, `Descender`,\n * `Line_Gap`, `caret_Slope_Rise`, `caret_Slope_Run`, and `caret_Offset`.\n */\n typedef struct TT_VertHeader_\n {\n FT_Fixed Version;\n FT_Short Ascender;\n FT_Short Descender;\n FT_Short Line_Gap;\n\n FT_UShort advance_Height_Max; /* advance height maximum */\n\n FT_Short min_Top_Side_Bearing; /* minimum top-sb */\n FT_Short min_Bottom_Side_Bearing; /* minimum bottom-sb */\n FT_Short yMax_Extent; /* ymax extents */\n FT_Short caret_Slope_Rise;\n FT_Short caret_Slope_Run;\n FT_Short caret_Offset;\n\n FT_Short Reserved[4];\n\n FT_Short metric_Data_Format;\n FT_UShort number_Of_VMetrics;\n\n /* The following fields are not defined by the OpenType specification */\n /* but they are used to connect the metrics header to the relevant */\n /* 'vmtx' table. */\n\n void* long_metrics;\n void* short_metrics;\n\n } TT_VertHeader;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_OS2\n *\n * @description:\n * A structure to model a TrueType 'OS/2' table. All fields comply to\n * the OpenType specification.\n *\n * Note that we now support old Mac fonts that do not include an 'OS/2'\n * table. In this case, the `version` field is always set to 0xFFFF.\n *\n * @note:\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `sCapHeight`, `sTypoAscender`,\n * `sTypoDescender`, `sTypoLineGap`, `sxHeight`, `usWinAscent`,\n * `usWinDescent`, `yStrikeoutPosition`, `yStrikeoutSize`,\n * `ySubscriptXOffset`, `ySubScriptXSize`, `ySubscriptYOffset`,\n * `ySubscriptYSize`, `ySuperscriptXOffset`, `ySuperscriptXSize`,\n * `ySuperscriptYOffset`, and `ySuperscriptYSize`.\n *\n * Possible values for bits in the `ulUnicodeRangeX` fields are given by\n * the @TT_UCR_XXX macros.\n */\n\n typedef struct TT_OS2_\n {\n FT_UShort version; /* 0x0001 - more or 0xFFFF */\n FT_Short xAvgCharWidth;\n FT_UShort usWeightClass;\n FT_UShort usWidthClass;\n FT_UShort fsType;\n FT_Short ySubscriptXSize;\n FT_Short ySubscriptYSize;\n FT_Short ySubscriptXOffset;\n FT_Short ySubscriptYOffset;\n FT_Short ySuperscriptXSize;\n FT_Short ySuperscriptYSize;\n FT_Short ySuperscriptXOffset;\n FT_Short ySuperscriptYOffset;\n FT_Short yStrikeoutSize;\n FT_Short yStrikeoutPosition;\n FT_Short sFamilyClass;\n\n FT_Byte panose[10];\n\n FT_ULong ulUnicodeRange1; /* Bits 0-31 */\n FT_ULong ulUnicodeRange2; /* Bits 32-63 */\n FT_ULong ulUnicodeRange3; /* Bits 64-95 */\n FT_ULong ulUnicodeRange4; /* Bits 96-127 */\n\n FT_Char achVendID[4];\n\n FT_UShort fsSelection;\n FT_UShort usFirstCharIndex;\n FT_UShort usLastCharIndex;\n FT_Short sTypoAscender;\n FT_Short sTypoDescender;\n FT_Short sTypoLineGap;\n FT_UShort usWinAscent;\n FT_UShort usWinDescent;\n\n /* only version 1 and higher: */\n\n FT_ULong ulCodePageRange1; /* Bits 0-31 */\n FT_ULong ulCodePageRange2; /* Bits 32-63 */\n\n /* only version 2 and higher: */\n\n FT_Short sxHeight;\n FT_Short sCapHeight;\n FT_UShort usDefaultChar;\n FT_UShort usBreakChar;\n FT_UShort usMaxContext;\n\n /* only version 5 and higher: */\n\n FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */\n FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */\n\n } TT_OS2;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Postscript\n *\n * @description:\n * A structure to model a TrueType 'post' table. All fields comply to\n * the OpenType specification. This structure does not reference a\n * font's PostScript glyph names; use @FT_Get_Glyph_Name to retrieve\n * them.\n *\n * @note:\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `underlinePosition` and\n * `underlineThickness`.\n */\n typedef struct TT_Postscript_\n {\n FT_Fixed FormatType;\n FT_Fixed italicAngle;\n FT_Short underlinePosition;\n FT_Short underlineThickness;\n FT_ULong isFixedPitch;\n FT_ULong minMemType42;\n FT_ULong maxMemType42;\n FT_ULong minMemType1;\n FT_ULong maxMemType1;\n\n /* Glyph names follow in the 'post' table, but we don't */\n /* load them by default. */\n\n } TT_Postscript;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_PCLT\n *\n * @description:\n * A structure to model a TrueType 'PCLT' table. All fields comply to\n * the OpenType specification.\n */\n typedef struct TT_PCLT_\n {\n FT_Fixed Version;\n FT_ULong FontNumber;\n FT_UShort Pitch;\n FT_UShort xHeight;\n FT_UShort Style;\n FT_UShort TypeFamily;\n FT_UShort CapHeight;\n FT_UShort SymbolSet;\n FT_Char TypeFace[16];\n FT_Char CharacterComplement[8];\n FT_Char FileName[6];\n FT_Char StrokeWeight;\n FT_Char WidthType;\n FT_Byte SerifStyle;\n FT_Byte Reserved;\n\n } TT_PCLT;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_MaxProfile\n *\n * @description:\n * The maximum profile ('maxp') table contains many max values, which can\n * be used to pre-allocate arrays for speeding up glyph loading and\n * hinting.\n *\n * @fields:\n * version ::\n * The version number.\n *\n * numGlyphs ::\n * The number of glyphs in this TrueType font.\n *\n * maxPoints ::\n * The maximum number of points in a non-composite TrueType glyph. See\n * also `maxCompositePoints`.\n *\n * maxContours ::\n * The maximum number of contours in a non-composite TrueType glyph.\n * See also `maxCompositeContours`.\n *\n * maxCompositePoints ::\n * The maximum number of points in a composite TrueType glyph. See\n * also `maxPoints`.\n *\n * maxCompositeContours ::\n * The maximum number of contours in a composite TrueType glyph. See\n * also `maxContours`.\n *\n * maxZones ::\n * The maximum number of zones used for glyph hinting.\n *\n * maxTwilightPoints ::\n * The maximum number of points in the twilight zone used for glyph\n * hinting.\n *\n * maxStorage ::\n * The maximum number of elements in the storage area used for glyph\n * hinting.\n *\n * maxFunctionDefs ::\n * The maximum number of function definitions in the TrueType bytecode\n * for this font.\n *\n * maxInstructionDefs ::\n * The maximum number of instruction definitions in the TrueType\n * bytecode for this font.\n *\n * maxStackElements ::\n * The maximum number of stack elements used during bytecode\n * interpretation.\n *\n * maxSizeOfInstructions ::\n * The maximum number of TrueType opcodes used for glyph hinting.\n *\n * maxComponentElements ::\n * The maximum number of simple (i.e., non-composite) glyphs in a\n * composite glyph.\n *\n * maxComponentDepth ::\n * The maximum nesting depth of composite glyphs.\n *\n * @note:\n * This structure is only used during font loading.\n */\n typedef struct TT_MaxProfile_\n {\n FT_Fixed version;\n FT_UShort numGlyphs;\n FT_UShort maxPoints;\n FT_UShort maxContours;\n FT_UShort maxCompositePoints;\n FT_UShort maxCompositeContours;\n FT_UShort maxZones;\n FT_UShort maxTwilightPoints;\n FT_UShort maxStorage;\n FT_UShort maxFunctionDefs;\n FT_UShort maxInstructionDefs;\n FT_UShort maxStackElements;\n FT_UShort maxSizeOfInstructions;\n FT_UShort maxComponentElements;\n FT_UShort maxComponentDepth;\n\n } TT_MaxProfile;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Sfnt_Tag\n *\n * @description:\n * An enumeration to specify indices of SFNT tables loaded and parsed by\n * FreeType during initialization of an SFNT font. Used in the\n * @FT_Get_Sfnt_Table API function.\n *\n * @values:\n * FT_SFNT_HEAD ::\n * To access the font's @TT_Header structure.\n *\n * FT_SFNT_MAXP ::\n * To access the font's @TT_MaxProfile structure.\n *\n * FT_SFNT_OS2 ::\n * To access the font's @TT_OS2 structure.\n *\n * FT_SFNT_HHEA ::\n * To access the font's @TT_HoriHeader structure.\n *\n * FT_SFNT_VHEA ::\n * To access the font's @TT_VertHeader structure.\n *\n * FT_SFNT_POST ::\n * To access the font's @TT_Postscript structure.\n *\n * FT_SFNT_PCLT ::\n * To access the font's @TT_PCLT structure.\n */\n typedef enum FT_Sfnt_Tag_\n {\n FT_SFNT_HEAD,\n FT_SFNT_MAXP,\n FT_SFNT_OS2,\n FT_SFNT_HHEA,\n FT_SFNT_VHEA,\n FT_SFNT_POST,\n FT_SFNT_PCLT,\n\n FT_SFNT_MAX\n\n } FT_Sfnt_Tag;\n\n /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag` */\n /* values instead */\n#define ft_sfnt_head FT_SFNT_HEAD\n#define ft_sfnt_maxp FT_SFNT_MAXP\n#define ft_sfnt_os2 FT_SFNT_OS2\n#define ft_sfnt_hhea FT_SFNT_HHEA\n#define ft_sfnt_vhea FT_SFNT_VHEA\n#define ft_sfnt_post FT_SFNT_POST\n#define ft_sfnt_pclt FT_SFNT_PCLT\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Sfnt_Table\n *\n * @description:\n * Return a pointer to a given SFNT table stored within a face.\n *\n * @input:\n * face ::\n * A handle to the source.\n *\n * tag ::\n * The index of the SFNT table.\n *\n * @return:\n * A type-less pointer to the table. This will be `NULL` in case of\n * error, or if the corresponding table was not found **OR** loaded from\n * the file.\n *\n * Use a typecast according to `tag` to access the structure elements.\n *\n * @note:\n * The table is owned by the face object and disappears with it.\n *\n * This function is only useful to access SFNT tables that are loaded by\n * the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for a\n * list.\n *\n * @example:\n * Here is an example demonstrating access to the 'vhea' table.\n *\n * ```\n * TT_VertHeader* vert_header;\n *\n *\n * vert_header =\n * (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA );\n * ```\n */\n FT_EXPORT( void* )\n FT_Get_Sfnt_Table( FT_Face face,\n FT_Sfnt_Tag tag );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Load_Sfnt_Table\n *\n * @description:\n * Load any SFNT font table into client memory.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * tag ::\n * The four-byte tag of the table to load. Use value~0 if you want to\n * access the whole font file. Otherwise, you can use one of the\n * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new\n * one with @FT_MAKE_TAG.\n *\n * offset ::\n * The starting offset in the table (or file if tag~==~0).\n *\n * @output:\n * buffer ::\n * The target buffer address. The client must ensure that the memory\n * array is big enough to hold the data.\n *\n * @inout:\n * length ::\n * If the `length` parameter is `NULL`, try to load the whole table.\n * Return an error code if it fails.\n *\n * Else, if `*length` is~0, exit immediately while returning the\n * table's (or file) full size in it.\n *\n * Else the number of bytes to read from the table or file, from the\n * starting offset.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If you need to determine the table's length you should first call this\n * function with `*length` set to~0, as in the following example:\n *\n * ```\n * FT_ULong length = 0;\n *\n *\n * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );\n * if ( error ) { ... table does not exist ... }\n *\n * buffer = malloc( length );\n * if ( buffer == NULL ) { ... not enough memory ... }\n *\n * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length );\n * if ( error ) { ... could not load table ... }\n * ```\n *\n * Note that structures like @TT_Header or @TT_OS2 can't be used with\n * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that\n * those structures depend on the processor architecture, with varying\n * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian).\n *\n */\n FT_EXPORT( FT_Error )\n FT_Load_Sfnt_Table( FT_Face face,\n FT_ULong tag,\n FT_Long offset,\n FT_Byte* buffer,\n FT_ULong* length );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Sfnt_Table_Info\n *\n * @description:\n * Return information on an SFNT table.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * table_index ::\n * The index of an SFNT table. The function returns\n * FT_Err_Table_Missing for an invalid value.\n *\n * @inout:\n * tag ::\n * The name tag of the SFNT table. If the value is `NULL`,\n * `table_index` is ignored, and `length` returns the number of SFNT\n * tables in the font.\n *\n * @output:\n * length ::\n * The length of the SFNT table (or the number of SFNT tables,\n * depending on `tag`).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * While parsing fonts, FreeType handles SFNT tables with length zero as\n * missing.\n *\n */\n FT_EXPORT( FT_Error )\n FT_Sfnt_Table_Info( FT_Face face,\n FT_UInt table_index,\n FT_ULong *tag,\n FT_ULong *length );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CMap_Language_ID\n *\n * @description:\n * Return cmap language ID as specified in the OpenType standard.\n * Definitions of language ID values are in file @FT_TRUETYPE_IDS_H.\n *\n * @input:\n * charmap ::\n * The target charmap.\n *\n * @return:\n * The language ID of `charmap`. If `charmap` doesn't belong to an SFNT\n * face, just return~0 as the default value.\n *\n * For a format~14 cmap (to access Unicode IVS), the return value is\n * 0xFFFFFFFF.\n */\n FT_EXPORT( FT_ULong )\n FT_Get_CMap_Language_ID( FT_CharMap charmap );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CMap_Format\n *\n * @description:\n * Return the format of an SFNT 'cmap' table.\n *\n * @input:\n * charmap ::\n * The target charmap.\n *\n * @return:\n * The format of `charmap`. If `charmap` doesn't belong to an SFNT face,\n * return -1.\n */\n FT_EXPORT( FT_Long )\n FT_Get_CMap_Format( FT_CharMap charmap );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* TTTABLES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/tttags.h", "language": "code", "loc": 108, "comment_density": 0.185, "code": "/****************************************************************************\n *\n * tttags.h\n *\n * Tags for TrueType and OpenType tables (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef TTAGS_H_\n#define TTAGS_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' )\n#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' )\n#define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' )\n#define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' )\n#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' )\n#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' )\n#define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' )\n#define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' )\n#define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' )\n#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' )\n#define TTAG_CFF2 FT_MAKE_TAG( 'C', 'F', 'F', '2' )\n#define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' )\n#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' )\n#define TTAG_COLR FT_MAKE_TAG( 'C', 'O', 'L', 'R' )\n#define TTAG_CPAL FT_MAKE_TAG( 'C', 'P', 'A', 'L' )\n#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' )\n#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' )\n#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' )\n#define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' )\n#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' )\n#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' )\n#define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' )\n#define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' )\n#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' )\n#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' )\n#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' )\n#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' )\n#define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' )\n#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' )\n#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' )\n#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' )\n#define TTAG_HVAR FT_MAKE_TAG( 'H', 'V', 'A', 'R' )\n#define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' )\n#define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' )\n#define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' )\n#define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' )\n#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' )\n#define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' )\n#define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' )\n#define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' )\n#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' )\n#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' )\n#define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' )\n#define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' )\n#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' )\n#define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' )\n#define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' )\n#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' )\n#define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' )\n#define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' )\n#define TTAG_MVAR FT_MAKE_TAG( 'M', 'V', 'A', 'R' )\n#define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' )\n#define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' )\n#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' )\n#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' )\n#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' )\n#define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' )\n#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' )\n#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' )\n#define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' )\n#define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' )\n#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' )\n#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' )\n#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' )\n#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' )\n#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' )\n#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' )\n#define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' )\n#define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' )\n#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' )\n#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' )\n#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' )\n#define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' )\n#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' )\n#define TTAG_wOF2 FT_MAKE_TAG( 'w', 'O', 'F', '2' )\n\n/* used by \"Keyboard.dfont\" on legacy Mac OS X */\n#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' )\n\n/* used by \"LastResort.dfont\" on legacy Mac OS X */\n#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' )\n\n\nFT_END_HEADER\n\n#endif /* TTAGS_H_ */\n\n\n/* END */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.8, "dedup_hash": "41e3b20185205a1c", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_freetype_config", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Config", "api": "OpenGL Core", "glsl_version": null, "topic": "shadows", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "includes/freetype/config/ftconfig.h", "language": "code", "loc": 452, "comment_density": 0.569, "code": "/****************************************************************************\n *\n * ftconfig.h\n *\n * ANSI-specific configuration file (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This header file contains a number of macro definitions that are used by\n * the rest of the engine. Most of the macros here are automatically\n * determined at compile time, and you should not need to change it to port\n * FreeType, except to compile the library with a non-ANSI compiler.\n *\n * Note however that if some specific modifications are needed, we advise\n * you to place a modified copy in your build directory.\n *\n * The build directory is usually `builds/`, and contains\n * system-specific files that are always included first when building the\n * library.\n *\n * This ANSI version should stay in `include/config/`.\n *\n */\n\n#ifndef FTCONFIG_H_\n#define FTCONFIG_H_\n\n#include \n#include FT_CONFIG_OPTIONS_H\n#include FT_CONFIG_STANDARD_LIBRARY_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * PLATFORM-SPECIFIC CONFIGURATION MACROS\n *\n * These macros can be toggled to suit a specific system. The current ones\n * are defaults used to compile FreeType in an ANSI C environment (16bit\n * compilers are also supported). Copy this file to your own\n * `builds/` directory, and edit it to port the engine.\n *\n */\n\n\n /* There are systems (like the Texas Instruments 'C54x) where a `char` */\n /* has 16~bits. ANSI~C says that `sizeof(char)` is always~1. Since an */\n /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */\n /* is probably unexpected. */\n /* */\n /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a */\n /* `char` type. */\n\n#ifndef FT_CHAR_BIT\n#define FT_CHAR_BIT CHAR_BIT\n#endif\n\n\n /* The size of an `int` type. */\n#if FT_UINT_MAX == 0xFFFFUL\n#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT )\n#elif FT_UINT_MAX == 0xFFFFFFFFUL\n#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT )\n#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL\n#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT )\n#else\n#error \"Unsupported size of `int' type!\"\n#endif\n\n /* The size of a `long` type. A five-byte `long` (as used e.g. on the */\n /* DM642) is recognized but avoided. */\n#if FT_ULONG_MAX == 0xFFFFFFFFUL\n#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )\n#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL\n#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )\n#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL\n#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT )\n#else\n#error \"Unsupported size of `long' type!\"\n#endif\n\n\n /* `FT_UNUSED` indicates that a given parameter is not used -- */\n /* this is only used to get rid of unpleasant compiler warnings. */\n#ifndef FT_UNUSED\n#define FT_UNUSED( arg ) ( (arg) = (arg) )\n#endif\n\n\n /**************************************************************************\n *\n * AUTOMATIC CONFIGURATION MACROS\n *\n * These macros are computed from the ones defined above. Don't touch\n * their definition, unless you know precisely what you are doing. No\n * porter should need to mess with them.\n *\n */\n\n\n /**************************************************************************\n *\n * Mac support\n *\n * This is the only necessary change, so it is defined here instead\n * providing a new configuration file.\n */\n#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )\n /* No Carbon frameworks for 64bit 10.4.x. */\n /* `AvailabilityMacros.h` is available since Mac OS X 10.2, */\n /* so guess the system version by maximum errno before inclusion. */\n#include \n#ifdef ECANCELED /* defined since 10.2 */\n#include \"AvailabilityMacros.h\"\n#endif\n#if defined( __LP64__ ) && \\\n ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )\n#undef FT_MACINTOSH\n#endif\n\n#elif defined( __SC__ ) || defined( __MRC__ )\n /* Classic MacOS compilers */\n#include \"ConditionalMacros.h\"\n#if TARGET_OS_MAC\n#define FT_MACINTOSH 1\n#endif\n\n#endif\n\n\n /* Fix compiler warning with sgi compiler. */\n#if defined( __sgi ) && !defined( __GNUC__ )\n#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )\n#pragma set woff 3505\n#endif\n#endif\n\n\n /**************************************************************************\n *\n * @section:\n * basic_types\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Int16\n *\n * @description:\n * A typedef for a 16bit signed integer type.\n */\n typedef signed short FT_Int16;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UInt16\n *\n * @description:\n * A typedef for a 16bit unsigned integer type.\n */\n typedef unsigned short FT_UInt16;\n\n /* */\n\n\n /* this #if 0 ... #endif clause is for documentation purposes */\n#if 0\n\n /**************************************************************************\n *\n * @type:\n * FT_Int32\n *\n * @description:\n * A typedef for a 32bit signed integer type. The size depends on the\n * configuration.\n */\n typedef signed XXX FT_Int32;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UInt32\n *\n * A typedef for a 32bit unsigned integer type. The size depends on the\n * configuration.\n */\n typedef unsigned XXX FT_UInt32;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Int64\n *\n * A typedef for a 64bit signed integer type. The size depends on the\n * configuration. Only defined if there is real 64bit support;\n * otherwise, it gets emulated with a structure (if necessary).\n */\n typedef signed XXX FT_Int64;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UInt64\n *\n * A typedef for a 64bit unsigned integer type. The size depends on the\n * configuration. Only defined if there is real 64bit support;\n * otherwise, it gets emulated with a structure (if necessary).\n */\n typedef unsigned XXX FT_UInt64;\n\n /* */\n\n#endif\n\n#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )\n\n typedef signed int FT_Int32;\n typedef unsigned int FT_UInt32;\n\n#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )\n\n typedef signed long FT_Int32;\n typedef unsigned long FT_UInt32;\n\n#else\n#error \"no 32bit type found -- please check your configuration files\"\n#endif\n\n\n /* look up an integer type that is at least 32~bits */\n#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )\n\n typedef int FT_Fast;\n typedef unsigned int FT_UFast;\n\n#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )\n\n typedef long FT_Fast;\n typedef unsigned long FT_UFast;\n\n#endif\n\n\n /* determine whether we have a 64-bit `int` type for platforms without */\n /* Autoconf */\n#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )\n\n /* `FT_LONG64` must be defined if a 64-bit type is available */\n#define FT_LONG64\n#define FT_INT64 long\n#define FT_UINT64 unsigned long\n\n /**************************************************************************\n *\n * A 64-bit data type may create compilation problems if you compile in\n * strict ANSI mode. To avoid them, we disable other 64-bit data types if\n * `__STDC__` is defined. You can however ignore this rule by defining the\n * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.\n */\n#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )\n\n#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L\n\n#define FT_LONG64\n#define FT_INT64 long long int\n#define FT_UINT64 unsigned long long int\n\n#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */\n\n /* this compiler provides the `__int64` type */\n#define FT_LONG64\n#define FT_INT64 __int64\n#define FT_UINT64 unsigned __int64\n\n#elif defined( __BORLANDC__ ) /* Borland C++ */\n\n /* XXXX: We should probably check the value of `__BORLANDC__` in order */\n /* to test the compiler version. */\n\n /* this compiler provides the `__int64` type */\n#define FT_LONG64\n#define FT_INT64 __int64\n#define FT_UINT64 unsigned __int64\n\n#elif defined( __WATCOMC__ ) /* Watcom C++ */\n\n /* Watcom doesn't provide 64-bit data types */\n\n#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */\n\n#define FT_LONG64\n#define FT_INT64 long long int\n#define FT_UINT64 unsigned long long int\n\n#elif defined( __GNUC__ )\n\n /* GCC provides the `long long` type */\n#define FT_LONG64\n#define FT_INT64 long long int\n#define FT_UINT64 unsigned long long int\n\n#endif /* __STDC_VERSION__ >= 199901L */\n\n#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */\n\n#ifdef FT_LONG64\n typedef FT_INT64 FT_Int64;\n typedef FT_UINT64 FT_UInt64;\n#endif\n\n\n#ifdef _WIN64\n /* only 64bit Windows uses the LLP64 data model, i.e., */\n /* 32bit integers, 64bit pointers */\n#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)\n#else\n#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)\n#endif\n\n\n /**************************************************************************\n *\n * miscellaneous\n *\n */\n\n\n#define FT_BEGIN_STMNT do {\n#define FT_END_STMNT } while ( 0 )\n#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT\n\n\n /* `typeof` condition taken from gnulib's `intprops.h` header file */\n#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \\\n ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \\\n defined( __IBM__TYPEOF__ ) ) || \\\n ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )\n#define FT_TYPEOF( type ) ( __typeof__ ( type ) )\n#else\n#define FT_TYPEOF( type ) /* empty */\n#endif\n\n\n /* Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define, */\n /* respectively, a function that gets used only within the scope of a */\n /* module. Normally, both the header and source code files for such a */\n /* function are within a single module directory. */\n /* */\n /* Intra-module arrays should be tagged with `FT_LOCAL_ARRAY` and */\n /* `FT_LOCAL_ARRAY_DEF`. */\n /* */\n#ifdef FT_MAKE_OPTION_SINGLE_OBJECT\n\n#define FT_LOCAL( x ) static x\n#define FT_LOCAL_DEF( x ) static x\n\n#else\n\n#ifdef __cplusplus\n#define FT_LOCAL( x ) extern \"C\" x\n#define FT_LOCAL_DEF( x ) extern \"C\" x\n#else\n#define FT_LOCAL( x ) extern x\n#define FT_LOCAL_DEF( x ) x\n#endif\n\n#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */\n\n#define FT_LOCAL_ARRAY( x ) extern const x\n#define FT_LOCAL_ARRAY_DEF( x ) const x\n\n\n /* Use `FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, */\n /* functions that are used in more than a single module. In the */\n /* current setup this implies that the declaration is in a header file */\n /* in the `include/freetype/internal` directory, and the function body */\n /* is in a file in `src/base`. */\n /* */\n#ifndef FT_BASE\n\n#ifdef __cplusplus\n#define FT_BASE( x ) extern \"C\" x\n#else\n#define FT_BASE( x ) extern x\n#endif\n\n#endif /* !FT_BASE */\n\n\n#ifndef FT_BASE_DEF\n\n#ifdef __cplusplus\n#define FT_BASE_DEF( x ) x\n#else\n#define FT_BASE_DEF( x ) x\n#endif\n\n#endif /* !FT_BASE_DEF */\n\n\n /* When compiling FreeType as a DLL or DSO with hidden visibility */\n /* some systems/compilers need a special attribute in front OR after */\n /* the return type of function declarations. */\n /* */\n /* Two macros are used within the FreeType source code to define */\n /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`. */\n /* */\n /* - `FT_EXPORT( return_type )` */\n /* */\n /* is used in a function declaration, as in */\n /* */\n /* ``` */\n /* FT_EXPORT( FT_Error ) */\n /* FT_Init_FreeType( FT_Library* alibrary ); */\n /* ``` */\n /* */\n /* - `FT_EXPORT_DEF( return_type )` */\n /* */\n /* is used in a function definition, as in */\n /* */\n /* ``` */\n /* FT_EXPORT_DEF( FT_Error ) */\n /* FT_Init_FreeType( FT_Library* alibrary ) */\n /* { */\n /* ... some code ... */\n /* return FT_Err_Ok; */\n /* } */\n /* ``` */\n /* */\n /* You can provide your own implementation of `FT_EXPORT` and */\n /* `FT_EXPORT_DEF` here if you want. */\n /* */\n /* To export a variable, use `FT_EXPORT_VAR`. */\n /* */\n#ifndef FT_EXPORT\n\n#ifdef FT2_BUILD_LIBRARY\n\n#if defined( _WIN32 ) && defined( DLL_EXPORT )\n#define FT_EXPORT( x ) __declspec( dllexport ) x\n#elif defined( __GNUC__ ) && __GNUC__ >= 4\n#define FT_EXPORT( x ) __attribute__(( visibility( \"default\" ) )) x\n#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550\n#define FT_EXPORT( x ) __global x\n#elif defined( __cplusplus )\n#define FT_EXPORT( x ) extern \"C\" x\n#else\n#define FT_EXPORT( x ) extern x\n#endif\n\n#else\n\n#if defined( _WIN32 ) && defined( DLL_IMPORT )\n#define FT_EXPORT( x ) __declspec( dllimport ) x\n#elif defined( __cplusplus )\n#define FT_EXPORT( x ) extern \"C\" x\n#else\n#define FT_EXPORT( x ) extern x\n#endif\n\n#endif\n\n#endif /* !FT_EXPORT */\n\n\n#ifndef FT_EXPORT_DEF\n\n#ifdef __cplusplus\n#define FT_EXPORT_DEF( x ) extern \"C\" x\n#else\n#define FT_EXPORT_DEF( x ) extern x\n#endif\n\n#endif /* !FT_EXPORT_DEF */\n\n\n#ifndef FT_EXPORT_VAR\n\n#ifdef __cplusplus\n#define FT_EXPORT_VAR( x ) extern \"C\" x\n#else\n#define FT_EXPORT_VAR( x ) extern x\n#endif\n\n#endif /* !FT_EXPORT_VAR */\n\n\n /* The following macros are needed to compile the library with a */\n /* C++ compiler and with 16bit compilers. */\n /* */\n\n /* This is special. Within C++, you must specify `extern \"C\"` for */\n /* functions which are used via function pointers, and you also */\n /* must do that for structures which contain function pointers to */\n /* assure C linkage -- it's not possible to have (local) anonymous */\n /* functions which are accessed by (global) function pointers. */\n /* */\n /* */\n /* FT_CALLBACK_DEF is used to _define_ a callback function, */\n /* located in the same source code file as the structure that uses */\n /* it. */\n /* */\n /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */\n /* and define a callback function, respectively, in a similar way */\n /* as FT_BASE and FT_BASE_DEF work. */\n /* */\n /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */\n /* contains pointers to callback functions. */\n /* */\n /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */\n /* that contains pointers to callback functions. */\n /* */\n /* */\n /* Some 16bit compilers have to redefine these macros to insert */\n /* the infamous `_cdecl` or `__fastcall` declarations. */\n /* */\n#ifndef FT_CALLBACK_DEF\n#ifdef __cplusplus\n#define FT_CALLBACK_DEF( x ) extern \"C\" x\n#else\n#define FT_CALLBACK_DEF( x ) static x\n#endif\n#endif /* FT_CALLBACK_DEF */\n\n#ifndef FT_BASE_CALLBACK\n#ifdef __cplusplus\n#define FT_BASE_CALLBACK( x ) extern \"C\" x\n#define FT_BASE_CALLBACK_DEF( x ) extern \"C\" x\n#else\n#define FT_BASE_CALLBACK( x ) extern x\n#define FT_BASE_CALLBACK_DEF( x ) x\n#endif\n#endif /* FT_BASE_CALLBACK */\n\n#ifndef FT_CALLBACK_TABLE\n#ifdef __cplusplus\n#define FT_CALLBACK_TABLE extern \"C\"\n#define FT_CALLBACK_TABLE_DEF extern \"C\"\n#else\n#define FT_CALLBACK_TABLE extern\n#define FT_CALLBACK_TABLE_DEF /* nothing */\n#endif\n#endif /* FT_CALLBACK_TABLE */\n\n\nFT_END_HEADER\n\n\n#endif /* FTCONFIG_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/config/ftheader.h", "language": "code", "loc": 693, "comment_density": 0.877, "code": "/****************************************************************************\n *\n * ftheader.h\n *\n * Build macros of the FreeType 2 library.\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n#ifndef FTHEADER_H_\n#define FTHEADER_H_\n\n\n /*@***********************************************************************/\n /* */\n /* */\n /* FT_BEGIN_HEADER */\n /* */\n /* */\n /* This macro is used in association with @FT_END_HEADER in header */\n /* files to ensure that the declarations within are properly */\n /* encapsulated in an `extern \"C\" { .. }` block when included from a */\n /* C++ compiler. */\n /* */\n#ifdef __cplusplus\n#define FT_BEGIN_HEADER extern \"C\" {\n#else\n#define FT_BEGIN_HEADER /* nothing */\n#endif\n\n\n /*@***********************************************************************/\n /* */\n /* */\n /* FT_END_HEADER */\n /* */\n /* */\n /* This macro is used in association with @FT_BEGIN_HEADER in header */\n /* files to ensure that the declarations within are properly */\n /* encapsulated in an `extern \"C\" { .. }` block when included from a */\n /* C++ compiler. */\n /* */\n#ifdef __cplusplus\n#define FT_END_HEADER }\n#else\n#define FT_END_HEADER /* nothing */\n#endif\n\n\n /**************************************************************************\n *\n * Aliases for the FreeType 2 public and configuration files.\n *\n */\n\n /**************************************************************************\n *\n * @section:\n * header_file_macros\n *\n * @title:\n * Header File Macros\n *\n * @abstract:\n * Macro definitions used to `#include` specific header files.\n *\n * @description:\n * The following macros are defined to the name of specific FreeType~2\n * header files. They can be used directly in `#include` statements as\n * in:\n *\n * ```\n * #include FT_FREETYPE_H\n * #include FT_MULTIPLE_MASTERS_H\n * #include FT_GLYPH_H\n * ```\n *\n * There are several reasons why we are now using macros to name public\n * header files. The first one is that such macros are not limited to\n * the infamous 8.3~naming rule required by DOS (and\n * `FT_MULTIPLE_MASTERS_H` is a lot more meaningful than `ftmm.h`).\n *\n * The second reason is that it allows for more flexibility in the way\n * FreeType~2 is installed on a given system.\n *\n */\n\n\n /* configuration files */\n\n /**************************************************************************\n *\n * @macro:\n * FT_CONFIG_CONFIG_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * FreeType~2 configuration data.\n *\n */\n#ifndef FT_CONFIG_CONFIG_H\n#define FT_CONFIG_CONFIG_H \n#endif\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CONFIG_STANDARD_LIBRARY_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * FreeType~2 interface to the standard C library functions.\n *\n */\n#ifndef FT_CONFIG_STANDARD_LIBRARY_H\n#define FT_CONFIG_STANDARD_LIBRARY_H \n#endif\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CONFIG_OPTIONS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * FreeType~2 project-specific configuration options.\n *\n */\n#ifndef FT_CONFIG_OPTIONS_H\n#define FT_CONFIG_OPTIONS_H \n#endif\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CONFIG_MODULES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * list of FreeType~2 modules that are statically linked to new library\n * instances in @FT_Init_FreeType.\n *\n */\n#ifndef FT_CONFIG_MODULES_H\n#define FT_CONFIG_MODULES_H \n#endif\n\n /* */\n\n /* public headers */\n\n /**************************************************************************\n *\n * @macro:\n * FT_FREETYPE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * base FreeType~2 API.\n *\n */\n#define FT_FREETYPE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ERRORS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * list of FreeType~2 error codes (and messages).\n *\n * It is included by @FT_FREETYPE_H.\n *\n */\n#define FT_ERRORS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MODULE_ERRORS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * list of FreeType~2 module error offsets (and messages).\n *\n */\n#define FT_MODULE_ERRORS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SYSTEM_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 interface to low-level operations (i.e., memory management\n * and stream i/o).\n *\n * It is included by @FT_FREETYPE_H.\n *\n */\n#define FT_SYSTEM_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IMAGE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing type\n * definitions related to glyph images (i.e., bitmaps, outlines,\n * scan-converter parameters).\n *\n * It is included by @FT_FREETYPE_H.\n *\n */\n#define FT_IMAGE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TYPES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * basic data types defined by FreeType~2.\n *\n * It is included by @FT_FREETYPE_H.\n *\n */\n#define FT_TYPES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_LIST_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * list management API of FreeType~2.\n *\n * (Most applications will never need to include this file.)\n *\n */\n#define FT_LIST_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_OUTLINE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * scalable outline management API of FreeType~2.\n *\n */\n#define FT_OUTLINE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SIZES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API which manages multiple @FT_Size objects per face.\n *\n */\n#define FT_SIZES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MODULE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * module management API of FreeType~2.\n *\n */\n#define FT_MODULE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_RENDER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * renderer module management API of FreeType~2.\n *\n */\n#define FT_RENDER_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DRIVER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the driver modules.\n *\n */\n#define FT_DRIVER_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_AUTOHINTER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the auto-hinting module.\n *\n * Deprecated since version~2.9; use @FT_DRIVER_H instead.\n *\n */\n#define FT_AUTOHINTER_H FT_DRIVER_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CFF_DRIVER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the CFF driver module.\n *\n * Deprecated since version~2.9; use @FT_DRIVER_H instead.\n *\n */\n#define FT_CFF_DRIVER_H FT_DRIVER_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRUETYPE_DRIVER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the TrueType driver module.\n *\n * Deprecated since version~2.9; use @FT_DRIVER_H instead.\n *\n */\n#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_PCF_DRIVER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the PCF driver module.\n *\n * Deprecated since version~2.9; use @FT_DRIVER_H instead.\n *\n */\n#define FT_PCF_DRIVER_H FT_DRIVER_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TYPE1_TABLES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * types and API specific to the Type~1 format.\n *\n */\n#define FT_TYPE1_TABLES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRUETYPE_IDS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * enumeration values which identify name strings, languages, encodings,\n * etc. This file really contains a _large_ set of constant macro\n * definitions, taken from the TrueType and OpenType specifications.\n *\n */\n#define FT_TRUETYPE_IDS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRUETYPE_TABLES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * types and API specific to the TrueType (as well as OpenType) format.\n *\n */\n#define FT_TRUETYPE_TABLES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRUETYPE_TAGS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of TrueType four-byte 'tags' which identify blocks in\n * SFNT-based font formats (i.e., TrueType and OpenType).\n *\n */\n#define FT_TRUETYPE_TAGS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_BDF_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which accesses BDF-specific strings from a face.\n *\n */\n#define FT_BDF_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CID_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which access CID font information from a face.\n *\n */\n#define FT_CID_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_GZIP_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which supports gzip-compressed files.\n *\n */\n#define FT_GZIP_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_LZW_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which supports LZW-compressed files.\n *\n */\n#define FT_LZW_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_BZIP2_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which supports bzip2-compressed files.\n *\n */\n#define FT_BZIP2_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_WINFONTS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which supports Windows FNT files.\n *\n */\n#define FT_WINFONTS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_GLYPH_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API of the optional glyph management component.\n *\n */\n#define FT_GLYPH_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_BITMAP_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API of the optional bitmap conversion component.\n *\n */\n#define FT_BITMAP_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_BBOX_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API of the optional exact bounding box computation routines.\n *\n */\n#define FT_BBOX_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CACHE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API of the optional FreeType~2 cache sub-system.\n *\n */\n#define FT_CACHE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MAC_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * Macintosh-specific FreeType~2 API. The latter is used to access fonts\n * embedded in resource forks.\n *\n * This header file must be explicitly included by client applications\n * compiled on the Mac (note that the base API still works though).\n *\n */\n#define FT_MAC_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MULTIPLE_MASTERS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * optional multiple-masters management API of FreeType~2.\n *\n */\n#define FT_MULTIPLE_MASTERS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SFNT_NAMES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * optional FreeType~2 API which accesses embedded 'name' strings in\n * SFNT-based font formats (i.e., TrueType and OpenType).\n *\n */\n#define FT_SFNT_NAMES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_OPENTYPE_VALIDATE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * optional FreeType~2 API which validates OpenType tables ('BASE',\n * 'GDEF', 'GPOS', 'GSUB', 'JSTF').\n *\n */\n#define FT_OPENTYPE_VALIDATE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_GX_VALIDATE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * optional FreeType~2 API which validates TrueTypeGX/AAT tables ('feat',\n * 'mort', 'morx', 'bsln', 'just', 'kern', 'opbd', 'trak', 'prop').\n *\n */\n#define FT_GX_VALIDATE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_PFR_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which accesses PFR-specific data.\n *\n */\n#define FT_PFR_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_STROKER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which provides functions to stroke outline paths.\n */\n#define FT_STROKER_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SYNTHESIS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which performs artificial obliquing and emboldening.\n */\n#define FT_SYNTHESIS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_FONT_FORMATS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which provides functions specific to font formats.\n */\n#define FT_FONT_FORMATS_H \n\n /* deprecated */\n#define FT_XFREE86_H FT_FONT_FORMATS_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRIGONOMETRY_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which performs trigonometric computations (e.g.,\n * cosines and arc tangents).\n */\n#define FT_TRIGONOMETRY_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_LCD_FILTER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which performs color filtering for subpixel rendering.\n */\n#define FT_LCD_FILTER_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_INCREMENTAL_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which performs incremental glyph loading.\n */\n#define FT_INCREMENTAL_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_GASP_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which returns entries from the TrueType GASP table.\n */\n#define FT_GASP_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ADVANCES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which returns individual and ranged glyph advances.\n */\n#define FT_ADVANCES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_COLOR_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which handles the OpenType 'CPAL' table.\n */\n#define FT_COLOR_H \n\n\n /* */\n\n /* These header files don't need to be included by the user. */\n#define FT_ERROR_DEFINITIONS_H \n#define FT_PARAMETER_TAGS_H \n\n /* Deprecated macros. */\n#define FT_UNPATENTED_HINTING_H \n#define FT_TRUETYPE_UNPATENTED_H \n\n /* `FT_CACHE_H` is the only header file needed for the cache subsystem. */\n#define FT_CACHE_IMAGE_H FT_CACHE_H\n#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H\n#define FT_CACHE_CHARMAP_H FT_CACHE_H\n\n /* The internals of the cache sub-system are no longer exposed. We */\n /* default to `FT_CACHE_H` at the moment just in case, but we know */\n /* of no rogue client that uses them. */\n /* */\n#define FT_CACHE_MANAGER_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H\n\n\n /*\n * Include internal headers definitions from `` only when\n * building the library.\n */\n#ifdef FT2_BUILD_LIBRARY\n#define FT_INTERNAL_INTERNAL_H \n#include FT_INTERNAL_INTERNAL_H\n#endif /* FT2_BUILD_LIBRARY */\n\n\n#endif /* FTHEADER_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/config/ftmodule.h", "language": "code", "loc": 30, "comment_density": 0.4, "code": "/*\n * This file registers the FreeType modules compiled into the library.\n *\n * If you use GNU make, this file IS NOT USED! Instead, it is created in\n * the objects directory (normally `/objs/`) based on information\n * from `/modules.cfg`.\n *\n * Please read `docs/INSTALL.ANY` and `docs/CUSTOMIZE` how to compile\n * FreeType without GNU make.\n *\n */\n\nFT_USE_MODULE( FT_Module_Class, autofit_module_class )\nFT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )\nFT_USE_MODULE( FT_Module_Class, psaux_module_class )\nFT_USE_MODULE( FT_Module_Class, psnames_module_class )\nFT_USE_MODULE( FT_Module_Class, pshinter_module_class )\nFT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )\nFT_USE_MODULE( FT_Module_Class, sfnt_module_class )\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )\nFT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )\n\n/* EOF */\n"}, {"path": "includes/freetype/config/ftoption.h", "language": "code", "loc": 865, "comment_density": 0.892, "code": "/****************************************************************************\n *\n * ftoption.h\n *\n * User-selectable configuration macros (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTOPTION_H_\n#define FTOPTION_H_\n\n\n#include \n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * USER-SELECTABLE CONFIGURATION MACROS\n *\n * This file contains the default configuration macro definitions for a\n * standard build of the FreeType library. There are three ways to use\n * this file to build project-specific versions of the library:\n *\n * - You can modify this file by hand, but this is not recommended in\n * cases where you would like to build several versions of the library\n * from a single source directory.\n *\n * - You can put a copy of this file in your build directory, more\n * precisely in `$BUILD/freetype/config/ftoption.h`, where `$BUILD` is\n * the name of a directory that is included _before_ the FreeType include\n * path during compilation.\n *\n * The default FreeType Makefiles and Jamfiles use the build directory\n * `builds/` by default, but you can easily change that for your\n * own projects.\n *\n * - Copy the file to `$BUILD/ft2build.h` and modify it\n * slightly to pre-define the macro `FT_CONFIG_OPTIONS_H` used to locate\n * this file during the build. For example,\n *\n * ```\n * #define FT_CONFIG_OPTIONS_H \n * #include \n * ```\n *\n * will use `$BUILD/myftoptions.h` instead of this file for macro\n * definitions.\n *\n * Note also that you can similarly pre-define the macro\n * `FT_CONFIG_MODULES_H` used to locate the file listing of the modules\n * that are statically linked to the library at compile time. By\n * default, this file is ``.\n *\n * We highly recommend using the third method whenever possible.\n *\n */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /*#************************************************************************\n *\n * If you enable this configuration option, FreeType recognizes an\n * environment variable called `FREETYPE_PROPERTIES`, which can be used to\n * control the various font drivers and modules. The controllable\n * properties are listed in the section @properties.\n *\n * You have to undefine this configuration option on platforms that lack\n * the concept of environment variables (and thus don't have the `getenv`\n * function), for example Windows CE.\n *\n * `FREETYPE_PROPERTIES` has the following syntax form (broken here into\n * multiple lines for better readability).\n *\n * ```\n * \n * ':'\n * '=' \n * \n * ':'\n * '=' \n * ...\n * ```\n *\n * Example:\n *\n * ```\n * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \\\n * cff:no-stem-darkening=1 \\\n * autofitter:warping=1\n * ```\n *\n */\n#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES\n\n\n /**************************************************************************\n *\n * Uncomment the line below if you want to activate LCD rendering\n * technology similar to ClearType in this build of the library. This\n * technology triples the resolution in the direction color subpixels. To\n * mitigate color fringes inherent to this technology, you also need to\n * explicitly set up LCD filtering.\n *\n * Note that this feature is covered by several Microsoft patents and\n * should not be activated in any default build of the library. When this\n * macro is not defined, FreeType offers alternative LCD rendering\n * technology that produces excellent output without LCD filtering.\n */\n/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\n\n\n /**************************************************************************\n *\n * Many compilers provide a non-ANSI 64-bit data type that can be used by\n * FreeType to speed up some computations. However, this will create some\n * problems when compiling the library in strict ANSI mode.\n *\n * For this reason, the use of 64-bit integers is normally disabled when\n * the `__STDC__` macro is defined. You can however disable this by\n * defining the macro `FT_CONFIG_OPTION_FORCE_INT64` here.\n *\n * For most compilers, this will only create compilation warnings when\n * building the library.\n *\n * ObNote: The compiler-specific 64-bit integers are detected in the\n * file `ftconfig.h` either statically or through the `configure`\n * script on supported platforms.\n */\n#undef FT_CONFIG_OPTION_FORCE_INT64\n\n\n /**************************************************************************\n *\n * If this macro is defined, do not try to use an assembler version of\n * performance-critical functions (e.g., @FT_MulFix). You should only do\n * that to verify that the assembler function works properly, or to execute\n * benchmark tests of the various implementations.\n */\n/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */\n\n\n /**************************************************************************\n *\n * If this macro is defined, try to use an inlined assembler version of the\n * @FT_MulFix function, which is a 'hotspot' when loading and hinting\n * glyphs, and which should be executed as fast as possible.\n *\n * Note that if your compiler or CPU is not supported, this will default to\n * the standard and portable implementation found in `ftcalc.c`.\n */\n#define FT_CONFIG_OPTION_INLINE_MULFIX\n\n\n /**************************************************************************\n *\n * LZW-compressed file support.\n *\n * FreeType now handles font files that have been compressed with the\n * `compress` program. This is mostly used to parse many of the PCF\n * files that come with various X11 distributions. The implementation\n * uses NetBSD's `zopen` to partially uncompress the file on the fly (see\n * `src/lzw/ftgzip.c`).\n *\n * Define this macro if you want to enable this 'feature'.\n */\n#define FT_CONFIG_OPTION_USE_LZW\n\n\n /**************************************************************************\n *\n * Gzip-compressed file support.\n *\n * FreeType now handles font files that have been compressed with the\n * `gzip` program. This is mostly used to parse many of the PCF files\n * that come with XFree86. The implementation uses 'zlib' to partially\n * uncompress the file on the fly (see `src/gzip/ftgzip.c`).\n *\n * Define this macro if you want to enable this 'feature'. See also the\n * macro `FT_CONFIG_OPTION_SYSTEM_ZLIB` below.\n */\n#define FT_CONFIG_OPTION_USE_ZLIB\n\n\n /**************************************************************************\n *\n * ZLib library selection\n *\n * This macro is only used when `FT_CONFIG_OPTION_USE_ZLIB` is defined.\n * It allows FreeType's 'ftgzip' component to link to the system's\n * installation of the ZLib library. This is useful on systems like\n * Unix or VMS where it generally is already available.\n *\n * If you let it undefined, the component will use its own copy of the\n * zlib sources instead. These have been modified to be included\n * directly within the component and **not** export external function\n * names. This allows you to link any program with FreeType _and_ ZLib\n * without linking conflicts.\n *\n * Do not `#undef` this macro here since the build system might define\n * it for certain configurations only.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */\n\n\n /**************************************************************************\n *\n * Bzip2-compressed file support.\n *\n * FreeType now handles font files that have been compressed with the\n * `bzip2` program. This is mostly used to parse many of the PCF files\n * that come with XFree86. The implementation uses `libbz2` to partially\n * uncompress the file on the fly (see `src/bzip2/ftbzip2.c`). Contrary\n * to gzip, bzip2 currently is not included and need to use the system\n * available bzip2 implementation.\n *\n * Define this macro if you want to enable this 'feature'.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_USE_BZIP2 */\n\n\n /**************************************************************************\n *\n * Define to disable the use of file stream functions and types, `FILE`,\n * `fopen`, etc. Enables the use of smaller system libraries on embedded\n * systems that have multiple system libraries, some with or without file\n * stream support, in the cases where file stream support is not necessary\n * such as memory loading of font files.\n */\n/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */\n\n\n /**************************************************************************\n *\n * PNG bitmap support.\n *\n * FreeType now handles loading color bitmap glyphs in the PNG format.\n * This requires help from the external libpng library. Uncompressed\n * color bitmaps do not need any external libraries and will be supported\n * regardless of this configuration.\n *\n * Define this macro if you want to enable this 'feature'.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_USE_PNG */\n\n\n /**************************************************************************\n *\n * HarfBuzz support.\n *\n * FreeType uses the HarfBuzz library to improve auto-hinting of OpenType\n * fonts. If available, many glyphs not directly addressable by a font's\n * character map will be hinted also.\n *\n * Define this macro if you want to enable this 'feature'.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */\n\n\n /**************************************************************************\n *\n * Brotli support.\n *\n * FreeType uses the Brotli library to provide support for decompressing\n * WOFF2 streams.\n *\n * Define this macro if you want to enable this 'feature'.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_USE_BROTLI */\n\n\n /**************************************************************************\n *\n * Glyph Postscript Names handling\n *\n * By default, FreeType 2 is compiled with the 'psnames' module. This\n * module is in charge of converting a glyph name string into a Unicode\n * value, or return a Macintosh standard glyph name for the use with the\n * TrueType 'post' table.\n *\n * Undefine this macro if you do not want 'psnames' compiled in your\n * build of FreeType. This has the following effects:\n *\n * - The TrueType driver will provide its own set of glyph names, if you\n * build it to support postscript names in the TrueType 'post' table,\n * but will not synthesize a missing Unicode charmap.\n *\n * - The Type~1 driver will not be able to synthesize a Unicode charmap\n * out of the glyphs found in the fonts.\n *\n * You would normally undefine this configuration macro when building a\n * version of FreeType that doesn't contain a Type~1 or CFF driver.\n */\n#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES\n\n\n /**************************************************************************\n *\n * Postscript Names to Unicode Values support\n *\n * By default, FreeType~2 is built with the 'psnames' module compiled in.\n * Among other things, the module is used to convert a glyph name into a\n * Unicode value. This is especially useful in order to synthesize on\n * the fly a Unicode charmap from the CFF/Type~1 driver through a big\n * table named the 'Adobe Glyph List' (AGL).\n *\n * Undefine this macro if you do not want the Adobe Glyph List compiled\n * in your 'psnames' module. The Type~1 driver will not be able to\n * synthesize a Unicode charmap out of the glyphs found in the fonts.\n */\n#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n\n\n /**************************************************************************\n *\n * Support for Mac fonts\n *\n * Define this macro if you want support for outline fonts in Mac format\n * (mac dfont, mac resource, macbinary containing a mac resource) on\n * non-Mac platforms.\n *\n * Note that the 'FOND' resource isn't checked.\n */\n#define FT_CONFIG_OPTION_MAC_FONTS\n\n\n /**************************************************************************\n *\n * Guessing methods to access embedded resource forks\n *\n * Enable extra Mac fonts support on non-Mac platforms (e.g., GNU/Linux).\n *\n * Resource forks which include fonts data are stored sometimes in\n * locations which users or developers don't expected. In some cases,\n * resource forks start with some offset from the head of a file. In\n * other cases, the actual resource fork is stored in file different from\n * what the user specifies. If this option is activated, FreeType tries\n * to guess whether such offsets or different file names must be used.\n *\n * Note that normal, direct access of resource forks is controlled via\n * the `FT_CONFIG_OPTION_MAC_FONTS` option.\n */\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\n#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\n#endif\n\n\n /**************************************************************************\n *\n * Allow the use of `FT_Incremental_Interface` to load typefaces that\n * contain no glyph data, but supply it via a callback function. This is\n * required by clients supporting document formats which supply font data\n * incrementally as the document is parsed, such as the Ghostscript\n * interpreter for the PostScript language.\n */\n#define FT_CONFIG_OPTION_INCREMENTAL\n\n\n /**************************************************************************\n *\n * The size in bytes of the render pool used by the scan-line converter to\n * do all of its work.\n */\n#define FT_RENDER_POOL_SIZE 16384L\n\n\n /**************************************************************************\n *\n * FT_MAX_MODULES\n *\n * The maximum number of modules that can be registered in a single\n * FreeType library object. 32~is the default.\n */\n#define FT_MAX_MODULES 32\n\n\n /**************************************************************************\n *\n * Debug level\n *\n * FreeType can be compiled in debug or trace mode. In debug mode,\n * errors are reported through the 'ftdebug' component. In trace mode,\n * additional messages are sent to the standard output during execution.\n *\n * Define `FT_DEBUG_LEVEL_ERROR` to build the library in debug mode.\n * Define `FT_DEBUG_LEVEL_TRACE` to build it in trace mode.\n *\n * Don't define any of these macros to compile in 'release' mode!\n *\n * Do not `#undef` these macros here since the build system might define\n * them for certain configurations only.\n */\n/* #define FT_DEBUG_LEVEL_ERROR */\n/* #define FT_DEBUG_LEVEL_TRACE */\n\n\n /**************************************************************************\n *\n * Autofitter debugging\n *\n * If `FT_DEBUG_AUTOFIT` is defined, FreeType provides some means to\n * control the autofitter behaviour for debugging purposes with global\n * boolean variables (consequently, you should **never** enable this\n * while compiling in 'release' mode):\n *\n * ```\n * _af_debug_disable_horz_hints\n * _af_debug_disable_vert_hints\n * _af_debug_disable_blue_hints\n * ```\n *\n * Additionally, the following functions provide dumps of various\n * internal autofit structures to stdout (using `printf`):\n *\n * ```\n * af_glyph_hints_dump_points\n * af_glyph_hints_dump_segments\n * af_glyph_hints_dump_edges\n * af_glyph_hints_get_num_segments\n * af_glyph_hints_get_segment_offset\n * ```\n *\n * As an argument, they use another global variable:\n *\n * ```\n * _af_debug_hints\n * ```\n *\n * Please have a look at the `ftgrid` demo program to see how those\n * variables and macros should be used.\n *\n * Do not `#undef` these macros here since the build system might define\n * them for certain configurations only.\n */\n/* #define FT_DEBUG_AUTOFIT */\n\n\n /**************************************************************************\n *\n * Memory Debugging\n *\n * FreeType now comes with an integrated memory debugger that is capable\n * of detecting simple errors like memory leaks or double deletes. To\n * compile it within your build of the library, you should define\n * `FT_DEBUG_MEMORY` here.\n *\n * Note that the memory debugger is only activated at runtime when when\n * the _environment_ variable `FT2_DEBUG_MEMORY` is defined also!\n *\n * Do not `#undef` this macro here since the build system might define it\n * for certain configurations only.\n */\n/* #define FT_DEBUG_MEMORY */\n\n\n /**************************************************************************\n *\n * Module errors\n *\n * If this macro is set (which is _not_ the default), the higher byte of\n * an error code gives the module in which the error has occurred, while\n * the lower byte is the real error code.\n *\n * Setting this macro makes sense for debugging purposes only, since it\n * would break source compatibility of certain programs that use\n * FreeType~2.\n *\n * More details can be found in the files `ftmoderr.h` and `fterrors.h`.\n */\n#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS\n\n\n /**************************************************************************\n *\n * Error Strings\n *\n * If this macro is set, `FT_Error_String` will return meaningful\n * descriptions. This is not enabled by default to reduce the overall\n * size of FreeType.\n *\n * More details can be found in the file `fterrors.h`.\n */\n/* #define FT_CONFIG_OPTION_ERROR_STRINGS */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** S F N T D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_EMBEDDED_BITMAPS` if you want to support\n * embedded bitmaps in all formats using the 'sfnt' module (namely\n * TrueType~& OpenType).\n */\n#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support coloured\n * outlines (from the 'COLR'/'CPAL' tables) in all formats using the 'sfnt'\n * module (namely TrueType~& OpenType).\n */\n#define TT_CONFIG_OPTION_COLOR_LAYERS\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_POSTSCRIPT_NAMES` if you want to be able to\n * load and enumerate the glyph Postscript names in a TrueType or OpenType\n * file.\n *\n * Note that when you do not compile the 'psnames' module by undefining the\n * above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES`, the 'sfnt' module will\n * contain additional code used to read the PS Names table from a font.\n *\n * (By default, the module uses 'psnames' to extract glyph names.)\n */\n#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_SFNT_NAMES` if your applications need to access\n * the internal name table in a SFNT-based format like TrueType or\n * OpenType. The name table contains various strings used to describe the\n * font, like family name, copyright, version, etc. It does not contain\n * any glyph name though.\n *\n * Accessing SFNT names is done through the functions declared in\n * `ftsnames.h`.\n */\n#define TT_CONFIG_OPTION_SFNT_NAMES\n\n\n /**************************************************************************\n *\n * TrueType CMap support\n *\n * Here you can fine-tune which TrueType CMap table format shall be\n * supported.\n */\n#define TT_CONFIG_CMAP_FORMAT_0\n#define TT_CONFIG_CMAP_FORMAT_2\n#define TT_CONFIG_CMAP_FORMAT_4\n#define TT_CONFIG_CMAP_FORMAT_6\n#define TT_CONFIG_CMAP_FORMAT_8\n#define TT_CONFIG_CMAP_FORMAT_10\n#define TT_CONFIG_CMAP_FORMAT_12\n#define TT_CONFIG_CMAP_FORMAT_13\n#define TT_CONFIG_CMAP_FORMAT_14\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` if you want to compile a\n * bytecode interpreter in the TrueType driver.\n *\n * By undefining this, you will only compile the code necessary to load\n * TrueType glyphs without hinting.\n *\n * Do not `#undef` this macro here, since the build system might define it\n * for certain configurations only.\n */\n#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_SUBPIXEL_HINTING` if you want to compile\n * subpixel hinting support into the TrueType driver. This modifies the\n * TrueType hinting mechanism when anything but `FT_RENDER_MODE_MONO` is\n * requested.\n *\n * In particular, it modifies the bytecode interpreter to interpret (or\n * not) instructions in a certain way so that all TrueType fonts look like\n * they do in a Windows ClearType (DirectWrite) environment. See [1] for a\n * technical overview on what this means. See `ttinterp.h` for more\n * details on the LEAN option.\n *\n * There are three possible values.\n *\n * Value 1:\n * This value is associated with the 'Infinality' moniker, contributed by\n * an individual nicknamed Infinality with the goal of making TrueType\n * fonts render better than on Windows. A high amount of configurability\n * and flexibility, down to rules for single glyphs in fonts, but also\n * very slow. Its experimental and slow nature and the original\n * developer losing interest meant that this option was never enabled in\n * default builds.\n *\n * The corresponding interpreter version is v38.\n *\n * Value 2:\n * The new default mode for the TrueType driver. The Infinality code\n * base was stripped to the bare minimum and all configurability removed\n * in the name of speed and simplicity. The configurability was mainly\n * aimed at legacy fonts like 'Arial', 'Times New Roman', or 'Courier'.\n * Legacy fonts are fonts that modify vertical stems to achieve clean\n * black-and-white bitmaps. The new mode focuses on applying a minimal\n * set of rules to all fonts indiscriminately so that modern and web\n * fonts render well while legacy fonts render okay.\n *\n * The corresponding interpreter version is v40.\n *\n * Value 3:\n * Compile both, making both v38 and v40 available (the latter is the\n * default).\n *\n * By undefining these, you get rendering behavior like on Windows without\n * ClearType, i.e., Windows XP without ClearType enabled and Win9x\n * (interpreter version v35). Or not, depending on how much hinting blood\n * and testing tears the font designer put into a given font. If you\n * define one or both subpixel hinting options, you can switch between\n * between v35 and the ones you define (using `FT_Property_Set`).\n *\n * This option requires `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` to be\n * defined.\n *\n * [1]\n * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx\n */\n/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */\n#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2\n/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED` to compile the\n * TrueType glyph loader to use Apple's definition of how to handle\n * component offsets in composite glyphs.\n *\n * Apple and MS disagree on the default behavior of component offsets in\n * composites. Apple says that they should be scaled by the scaling\n * factors in the transformation matrix (roughly, it's more complex) while\n * MS says they should not. OpenType defines two bits in the composite\n * flags array which can be used to disambiguate, but old fonts will not\n * have them.\n *\n * https://www.microsoft.com/typography/otspec/glyf.htm\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html\n */\n#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_GX_VAR_SUPPORT` if you want to include support\n * for Apple's distortable font technology ('fvar', 'gvar', 'cvar', and\n * 'avar' tables). Tagged 'Font Variations', this is now part of OpenType\n * also. This has many similarities to Type~1 Multiple Masters support.\n */\n#define TT_CONFIG_OPTION_GX_VAR_SUPPORT\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_BDF` if you want to include support for an\n * embedded 'BDF~' table within SFNT-based bitmap formats.\n */\n#define TT_CONFIG_OPTION_BDF\n\n\n /**************************************************************************\n *\n * Option `TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES` controls the maximum\n * number of bytecode instructions executed for a single run of the\n * bytecode interpreter, needed to prevent infinite loops. You don't want\n * to change this except for very special situations (e.g., making a\n * library fuzzer spend less time to handle broken fonts).\n *\n * It is not expected that this value is ever modified by a configuring\n * script; instead, it gets surrounded with `#ifndef ... #endif` so that\n * the value can be set as a preprocessor option on the compiler's command\n * line.\n */\n#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES\n#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L\n#endif\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * `T1_MAX_DICT_DEPTH` is the maximum depth of nest dictionaries and arrays\n * in the Type~1 stream (see `t1load.c`). A minimum of~4 is required.\n */\n#define T1_MAX_DICT_DEPTH 5\n\n\n /**************************************************************************\n *\n * `T1_MAX_SUBRS_CALLS` details the maximum number of nested sub-routine\n * calls during glyph loading.\n */\n#define T1_MAX_SUBRS_CALLS 16\n\n\n /**************************************************************************\n *\n * `T1_MAX_CHARSTRING_OPERANDS` is the charstring stack's capacity. A\n * minimum of~16 is required.\n *\n * The Chinese font 'MingTiEG-Medium' (covering the CNS 11643 character\n * set) needs 256.\n */\n#define T1_MAX_CHARSTRINGS_OPERANDS 256\n\n\n /**************************************************************************\n *\n * Define this configuration macro if you want to prevent the compilation\n * of the 't1afm' module, which is in charge of reading Type~1 AFM files\n * into an existing face. Note that if set, the Type~1 driver will be\n * unable to produce kerning distances.\n */\n#undef T1_CONFIG_OPTION_NO_AFM\n\n\n /**************************************************************************\n *\n * Define this configuration macro if you want to prevent the compilation\n * of the Multiple Masters font support in the Type~1 driver.\n */\n#undef T1_CONFIG_OPTION_NO_MM_SUPPORT\n\n\n /**************************************************************************\n *\n * `T1_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe Type~1\n * engine gets compiled into FreeType. If defined, it is possible to\n * switch between the two engines using the `hinting-engine` property of\n * the 'type1' driver module.\n */\n/* #define T1_CONFIG_OPTION_OLD_ENGINE */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** C F F D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * Using `CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}` it is\n * possible to set up the default values of the four control points that\n * define the stem darkening behaviour of the (new) CFF engine. For more\n * details please read the documentation of the `darkening-parameters`\n * property (file `ftdriver.h`), which allows the control at run-time.\n *\n * Do **not** undefine these macros!\n */\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400\n\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275\n\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275\n\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0\n\n\n /**************************************************************************\n *\n * `CFF_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe CFF engine\n * gets compiled into FreeType. If defined, it is possible to switch\n * between the two engines using the `hinting-engine` property of the 'cff'\n * driver module.\n */\n/* #define CFF_CONFIG_OPTION_OLD_ENGINE */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** P C F D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * There are many PCF fonts just called 'Fixed' which look completely\n * different, and which have nothing to do with each other. When selecting\n * 'Fixed' in KDE or Gnome one gets results that appear rather random, the\n * style changes often if one changes the size and one cannot select some\n * fonts at all. This option makes the 'pcf' module prepend the foundry\n * name (plus a space) to the family name.\n *\n * We also check whether we have 'wide' characters; all put together, we\n * get family names like 'Sony Fixed' or 'Misc Fixed Wide'.\n *\n * If this option is activated, it can be controlled with the\n * `no-long-family-names` property of the 'pcf' driver module.\n */\n/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * Compile 'autofit' module with CJK (Chinese, Japanese, Korean) script\n * support.\n */\n#define AF_CONFIG_OPTION_CJK\n\n\n /**************************************************************************\n *\n * Compile 'autofit' module with fallback Indic script support, covering\n * some scripts that the 'latin' submodule of the 'autofit' module doesn't\n * (yet) handle. Currently, this needs option `AF_CONFIG_OPTION_CJK`.\n */\n#ifdef AF_CONFIG_OPTION_CJK\n#define AF_CONFIG_OPTION_INDIC\n#endif\n\n\n /**************************************************************************\n *\n * Compile 'autofit' module with warp hinting. The idea of the warping\n * code is to slightly scale and shift a glyph within a single dimension so\n * that as much of its segments are aligned (more or less) on the grid. To\n * find out the optimal scaling and shifting value, various parameter\n * combinations are tried and scored.\n *\n * You can switch warping on and off with the `warping` property of the\n * auto-hinter (see file `ftdriver.h` for more information; by default it\n * is switched off).\n *\n * This experimental option is not active if the rendering mode is\n * `FT_RENDER_MODE_LIGHT`.\n */\n#define AF_CONFIG_OPTION_USE_WARPER\n\n\n /**************************************************************************\n *\n * Use TrueType-like size metrics for 'light' auto-hinting.\n *\n * It is strongly recommended to avoid this option, which exists only to\n * help some legacy applications retain its appearance and behaviour with\n * respect to auto-hinted TrueType fonts.\n *\n * The very reason this option exists at all are GNU/Linux distributions\n * like Fedora that did not un-patch the following change (which was\n * present in FreeType between versions 2.4.6 and 2.7.1, inclusive).\n *\n * ```\n * 2011-07-16 Steven Chu \n *\n * [truetype] Fix metrics on size request for scalable fonts.\n * ```\n *\n * This problematic commit is now reverted (more or less).\n */\n/* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */\n\n /* */\n\n\n /*\n * This macro is obsolete. Support has been removed in FreeType version\n * 2.5.\n */\n/* #define FT_CONFIG_OPTION_OLD_INTERNALS */\n\n\n /*\n * The next three macros are defined if native TrueType hinting is\n * requested by the definitions above. Don't change this.\n */\n#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER\n#define TT_USE_BYTECODE_INTERPRETER\n\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\n#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1\n#define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY\n#endif\n\n#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2\n#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL\n#endif\n#endif\n#endif\n\n\n /*\n * Check CFF darkening parameters. The checks are the same as in function\n * `cff_property_set` in file `cffdrivr.c`.\n */\n#if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \\\n \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \\\n \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \\\n \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500\n#error \"Invalid CFF darkening parameters!\"\n#endif\n\nFT_END_HEADER\n\n\n#endif /* FTOPTION_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/config/ftstdlib.h", "language": "code", "loc": 127, "comment_density": 0.638, "code": "/****************************************************************************\n *\n * ftstdlib.h\n *\n * ANSI-specific library and header configuration file (specification\n * only).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file is used to group all `#includes` to the ANSI~C library that\n * FreeType normally requires. It also defines macros to rename the\n * standard functions within the FreeType source code.\n *\n * Load a file which defines `FTSTDLIB_H_` before this one to override it.\n *\n */\n\n\n#ifndef FTSTDLIB_H_\n#define FTSTDLIB_H_\n\n\n#include \n\n#define ft_ptrdiff_t ptrdiff_t\n\n\n /**************************************************************************\n *\n * integer limits\n *\n * `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of\n * `int` and `long` in bytes at compile-time. So far, this works for all\n * platforms the library has been tested on.\n *\n * Note that on the extremely rare platforms that do not provide integer\n * types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where\n * `int` is 36~bits), we do not make any guarantee about the correct\n * behaviour of FreeType~2 with all fonts.\n *\n * In these cases, `ftconfig.h` will refuse to compile anyway with a\n * message like 'couldn't find 32-bit type' or something similar.\n *\n */\n\n\n#include \n\n#define FT_CHAR_BIT CHAR_BIT\n#define FT_USHORT_MAX USHRT_MAX\n#define FT_INT_MAX INT_MAX\n#define FT_INT_MIN INT_MIN\n#define FT_UINT_MAX UINT_MAX\n#define FT_LONG_MIN LONG_MIN\n#define FT_LONG_MAX LONG_MAX\n#define FT_ULONG_MAX ULONG_MAX\n\n\n /**************************************************************************\n *\n * character and string processing\n *\n */\n\n\n#include \n\n#define ft_memchr memchr\n#define ft_memcmp memcmp\n#define ft_memcpy memcpy\n#define ft_memmove memmove\n#define ft_memset memset\n#define ft_strcat strcat\n#define ft_strcmp strcmp\n#define ft_strcpy strcpy\n#define ft_strlen strlen\n#define ft_strncmp strncmp\n#define ft_strncpy strncpy\n#define ft_strrchr strrchr\n#define ft_strstr strstr\n\n\n /**************************************************************************\n *\n * file handling\n *\n */\n\n\n#include \n\n#define FT_FILE FILE\n#define ft_fclose fclose\n#define ft_fopen fopen\n#define ft_fread fread\n#define ft_fseek fseek\n#define ft_ftell ftell\n#define ft_sprintf sprintf\n\n\n /**************************************************************************\n *\n * sorting\n *\n */\n\n\n#include \n\n#define ft_qsort qsort\n\n\n /**************************************************************************\n *\n * memory allocation\n *\n */\n\n\n#define ft_scalloc calloc\n#define ft_sfree free\n#define ft_smalloc malloc\n#define ft_srealloc realloc\n\n\n /**************************************************************************\n *\n * miscellaneous\n *\n */\n\n\n#define ft_strtol strtol\n#define ft_getenv getenv\n\n\n /**************************************************************************\n *\n * execution control\n *\n */\n\n\n#include \n\n#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */\n /* `jmp_buf` is defined as a macro */\n /* on certain platforms */\n\n#define ft_longjmp longjmp\n#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */\n\n\n /* The following is only used for debugging purposes, i.e., if */\n /* `FT_DEBUG_LEVEL_ERROR` or `FT_DEBUG_LEVEL_TRACE` are defined. */\n\n#include \n\n\n#endif /* FTSTDLIB_H_ */\n\n\n/* END */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.675, "dedup_hash": "52640847ed7a1ac7", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_freetype_internal", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Internal", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/freetype/internal/autohint.h", "language": "code", "loc": 202, "comment_density": 0.777, "code": "/****************************************************************************\n *\n * autohint.h\n *\n * High-level 'autohint' module-specific interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * The auto-hinter is used to load and automatically hint glyphs if a\n * format-specific hinter isn't available.\n *\n */\n\n\n#ifndef AUTOHINT_H_\n#define AUTOHINT_H_\n\n\n /**************************************************************************\n *\n * A small technical note regarding automatic hinting in order to clarify\n * this module interface.\n *\n * An automatic hinter might compute two kinds of data for a given face:\n *\n * - global hints: Usually some metrics that describe global properties\n * of the face. It is computed by scanning more or less\n * aggressively the glyphs in the face, and thus can be\n * very slow to compute (even if the size of global hints\n * is really small).\n *\n * - glyph hints: These describe some important features of the glyph\n * outline, as well as how to align them. They are\n * generally much faster to compute than global hints.\n *\n * The current FreeType auto-hinter does a pretty good job while performing\n * fast computations for both global and glyph hints. However, we might be\n * interested in introducing more complex and powerful algorithms in the\n * future, like the one described in the John D. Hobby paper, which\n * unfortunately requires a lot more horsepower.\n *\n * Because a sufficiently sophisticated font management system would\n * typically implement an LRU cache of opened face objects to reduce memory\n * usage, it is a good idea to be able to avoid recomputing global hints\n * every time the same face is re-opened.\n *\n * We thus provide the ability to cache global hints outside of the face\n * object, in order to speed up font re-opening time. Of course, this\n * feature is purely optional, so most client programs won't even notice\n * it.\n *\n * I initially thought that it would be a good idea to cache the glyph\n * hints too. However, my general idea now is that if you really need to\n * cache these too, you are simply in need of a new font format, where all\n * this information could be stored within the font file and decoded on the\n * fly.\n *\n */\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n typedef struct FT_AutoHinterRec_ *FT_AutoHinter;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_AutoHinter_GlobalGetFunc\n *\n * @description:\n * Retrieve the global hints computed for a given face object. The\n * resulting data is dissociated from the face and will survive a call to\n * FT_Done_Face(). It must be discarded through the API\n * FT_AutoHinter_GlobalDoneFunc().\n *\n * @input:\n * hinter ::\n * A handle to the source auto-hinter.\n *\n * face ::\n * A handle to the source face object.\n *\n * @output:\n * global_hints ::\n * A typeless pointer to the global hints.\n *\n * global_len ::\n * The size in bytes of the global hints.\n */\n typedef void\n (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter,\n FT_Face face,\n void** global_hints,\n long* global_len );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_AutoHinter_GlobalDoneFunc\n *\n * @description:\n * Discard the global hints retrieved through\n * FT_AutoHinter_GlobalGetFunc(). This is the only way these hints are\n * freed from memory.\n *\n * @input:\n * hinter ::\n * A handle to the auto-hinter module.\n *\n * global ::\n * A pointer to retrieved global hints to discard.\n */\n typedef void\n (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter,\n void* global );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_AutoHinter_GlobalResetFunc\n *\n * @description:\n * This function is used to recompute the global metrics in a given font.\n * This is useful when global font data changes (e.g. Multiple Masters\n * fonts where blend coordinates change).\n *\n * @input:\n * hinter ::\n * A handle to the source auto-hinter.\n *\n * face ::\n * A handle to the face.\n */\n typedef void\n (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter,\n FT_Face face );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_AutoHinter_GlyphLoadFunc\n *\n * @description:\n * This function is used to load, scale, and automatically hint a glyph\n * from a given face.\n *\n * @input:\n * face ::\n * A handle to the face.\n *\n * glyph_index ::\n * The glyph index.\n *\n * load_flags ::\n * The load flags.\n *\n * @note:\n * This function is capable of loading composite glyphs by hinting each\n * sub-glyph independently (which improves quality).\n *\n * It will call the font driver with @FT_Load_Glyph, with\n * @FT_LOAD_NO_SCALE set.\n */\n typedef FT_Error\n (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter,\n FT_GlyphSlot slot,\n FT_Size size,\n FT_UInt glyph_index,\n FT_Int32 load_flags );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_AutoHinter_InterfaceRec\n *\n * @description:\n * The auto-hinter module's interface.\n */\n typedef struct FT_AutoHinter_InterfaceRec_\n {\n FT_AutoHinter_GlobalResetFunc reset_face;\n FT_AutoHinter_GlobalGetFunc get_global_hints;\n FT_AutoHinter_GlobalDoneFunc done_global_hints;\n FT_AutoHinter_GlyphLoadFunc load_glyph;\n\n } FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;\n\n\n#define FT_DEFINE_AUTOHINTER_INTERFACE( \\\n class_, \\\n reset_face_, \\\n get_global_hints_, \\\n done_global_hints_, \\\n load_glyph_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_AutoHinter_InterfaceRec class_ = \\\n { \\\n reset_face_, \\\n get_global_hints_, \\\n done_global_hints_, \\\n load_glyph_ \\\n };\n\n\nFT_END_HEADER\n\n#endif /* AUTOHINT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/cffotypes.h", "language": "code", "loc": 81, "comment_density": 0.605, "code": "/****************************************************************************\n *\n * cffotypes.h\n *\n * Basic OpenType/CFF object type definitions (specification).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef CFFOTYPES_H_\n#define CFFOTYPES_H_\n\n#include \n#include FT_INTERNAL_OBJECTS_H\n#include FT_INTERNAL_CFF_TYPES_H\n#include FT_INTERNAL_TRUETYPE_TYPES_H\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\n\n\nFT_BEGIN_HEADER\n\n\n typedef TT_Face CFF_Face;\n\n\n /**************************************************************************\n *\n * @type:\n * CFF_Size\n *\n * @description:\n * A handle to an OpenType size object.\n */\n typedef struct CFF_SizeRec_\n {\n FT_SizeRec root;\n FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */\n\n } CFF_SizeRec, *CFF_Size;\n\n\n /**************************************************************************\n *\n * @type:\n * CFF_GlyphSlot\n *\n * @description:\n * A handle to an OpenType glyph slot object.\n */\n typedef struct CFF_GlyphSlotRec_\n {\n FT_GlyphSlotRec root;\n\n FT_Bool hint;\n FT_Bool scaled;\n\n FT_Fixed x_scale;\n FT_Fixed y_scale;\n\n } CFF_GlyphSlotRec, *CFF_GlyphSlot;\n\n\n /**************************************************************************\n *\n * @type:\n * CFF_Internal\n *\n * @description:\n * The interface to the 'internal' field of `FT_Size`.\n */\n typedef struct CFF_InternalRec_\n {\n PSH_Globals topfont;\n PSH_Globals subfonts[CFF_MAX_CID_FONTS];\n\n } CFF_InternalRec, *CFF_Internal;\n\n\n /**************************************************************************\n *\n * Subglyph transformation record.\n */\n typedef struct CFF_Transform_\n {\n FT_Fixed xx, xy; /* transformation matrix coefficients */\n FT_Fixed yx, yy;\n FT_F26Dot6 ox, oy; /* offsets */\n\n } CFF_Transform;\n\n\nFT_END_HEADER\n\n\n#endif /* CFFOTYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/cfftypes.h", "language": "code", "loc": 322, "comment_density": 0.407, "code": "/****************************************************************************\n *\n * cfftypes.h\n *\n * Basic OpenType/CFF type definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef CFFTYPES_H_\n#define CFFTYPES_H_\n\n\n#include \n#include FT_FREETYPE_H\n#include FT_TYPE1_TABLES_H\n#include FT_INTERNAL_SERVICE_H\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\n#include FT_INTERNAL_TYPE1_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @struct:\n * CFF_IndexRec\n *\n * @description:\n * A structure used to model a CFF Index table.\n *\n * @fields:\n * stream ::\n * The source input stream.\n *\n * start ::\n * The position of the first index byte in the input stream.\n *\n * count ::\n * The number of elements in the index.\n *\n * off_size ::\n * The size in bytes of object offsets in index.\n *\n * data_offset ::\n * The position of first data byte in the index's bytes.\n *\n * data_size ::\n * The size of the data table in this index.\n *\n * offsets ::\n * A table of element offsets in the index. Must be loaded explicitly.\n *\n * bytes ::\n * If the index is loaded in memory, its bytes.\n */\n typedef struct CFF_IndexRec_\n {\n FT_Stream stream;\n FT_ULong start;\n FT_UInt hdr_size;\n FT_UInt count;\n FT_Byte off_size;\n FT_ULong data_offset;\n FT_ULong data_size;\n\n FT_ULong* offsets;\n FT_Byte* bytes;\n\n } CFF_IndexRec, *CFF_Index;\n\n\n typedef struct CFF_EncodingRec_\n {\n FT_UInt format;\n FT_ULong offset;\n\n FT_UInt count;\n FT_UShort sids [256]; /* avoid dynamic allocations */\n FT_UShort codes[256];\n\n } CFF_EncodingRec, *CFF_Encoding;\n\n\n typedef struct CFF_CharsetRec_\n {\n\n FT_UInt format;\n FT_ULong offset;\n\n FT_UShort* sids;\n FT_UShort* cids; /* the inverse mapping of `sids'; only needed */\n /* for CID-keyed fonts */\n FT_UInt max_cid;\n FT_UInt num_glyphs;\n\n } CFF_CharsetRec, *CFF_Charset;\n\n\n /* cf. similar fields in file `ttgxvar.h' from the `truetype' module */\n\n typedef struct CFF_VarData_\n {\n#if 0\n FT_UInt itemCount; /* not used; always zero */\n FT_UInt shortDeltaCount; /* not used; always zero */\n#endif\n\n FT_UInt regionIdxCount; /* number of region indexes */\n FT_UInt* regionIndices; /* array of `regionIdxCount' indices; */\n /* these index `varRegionList' */\n } CFF_VarData;\n\n\n /* contribution of one axis to a region */\n typedef struct CFF_AxisCoords_\n {\n FT_Fixed startCoord;\n FT_Fixed peakCoord; /* zero peak means no effect (factor = 1) */\n FT_Fixed endCoord;\n\n } CFF_AxisCoords;\n\n\n typedef struct CFF_VarRegion_\n {\n CFF_AxisCoords* axisList; /* array of axisCount records */\n\n } CFF_VarRegion;\n\n\n typedef struct CFF_VStoreRec_\n {\n FT_UInt dataCount;\n CFF_VarData* varData; /* array of dataCount records */\n /* vsindex indexes this array */\n FT_UShort axisCount;\n FT_UInt regionCount; /* total number of regions defined */\n CFF_VarRegion* varRegionList;\n\n } CFF_VStoreRec, *CFF_VStore;\n\n\n /* forward reference */\n typedef struct CFF_FontRec_* CFF_Font;\n\n\n /* This object manages one cached blend vector. */\n /* */\n /* There is a BlendRec for Private DICT parsing in each subfont */\n /* and a BlendRec for charstrings in CF2_Font instance data. */\n /* A cached BV may be used across DICTs or Charstrings if inputs */\n /* have not changed. */\n /* */\n /* `usedBV' is reset at the start of each parse or charstring. */\n /* vsindex cannot be changed after a BV is used. */\n /* */\n /* Note: NDV is long (32/64 bit), while BV is 16.16 (FT_Int32). */\n typedef struct CFF_BlendRec_\n {\n FT_Bool builtBV; /* blendV has been built */\n FT_Bool usedBV; /* blendV has been used */\n CFF_Font font; /* top level font struct */\n FT_UInt lastVsindex; /* last vsindex used */\n FT_UInt lenNDV; /* normDV length (aka numAxes) */\n FT_Fixed* lastNDV; /* last NDV used */\n FT_UInt lenBV; /* BlendV length (aka numMasters) */\n FT_Int32* BV; /* current blendV (per DICT/glyph) */\n\n } CFF_BlendRec, *CFF_Blend;\n\n\n typedef struct CFF_FontRecDictRec_\n {\n FT_UInt version;\n FT_UInt notice;\n FT_UInt copyright;\n FT_UInt full_name;\n FT_UInt family_name;\n FT_UInt weight;\n FT_Bool is_fixed_pitch;\n FT_Fixed italic_angle;\n FT_Fixed underline_position;\n FT_Fixed underline_thickness;\n FT_Int paint_type;\n FT_Int charstring_type;\n FT_Matrix font_matrix;\n FT_Bool has_font_matrix;\n FT_ULong units_per_em; /* temporarily used as scaling value also */\n FT_Vector font_offset;\n FT_ULong unique_id;\n FT_BBox font_bbox;\n FT_Pos stroke_width;\n FT_ULong charset_offset;\n FT_ULong encoding_offset;\n FT_ULong charstrings_offset;\n FT_ULong private_offset;\n FT_ULong private_size;\n FT_Long synthetic_base;\n FT_UInt embedded_postscript;\n\n /* these should only be used for the top-level font dictionary */\n FT_UInt cid_registry;\n FT_UInt cid_ordering;\n FT_Long cid_supplement;\n\n FT_Long cid_font_version;\n FT_Long cid_font_revision;\n FT_Long cid_font_type;\n FT_ULong cid_count;\n FT_ULong cid_uid_base;\n FT_ULong cid_fd_array_offset;\n FT_ULong cid_fd_select_offset;\n FT_UInt cid_font_name;\n\n /* the next fields come from the data of the deprecated */\n /* `MultipleMaster' operator; they are needed to parse the (also */\n /* deprecated) `blend' operator in Type 2 charstrings */\n FT_UShort num_designs;\n FT_UShort num_axes;\n\n /* fields for CFF2 */\n FT_ULong vstore_offset;\n FT_UInt maxstack;\n\n } CFF_FontRecDictRec, *CFF_FontRecDict;\n\n\n /* forward reference */\n typedef struct CFF_SubFontRec_* CFF_SubFont;\n\n\n typedef struct CFF_PrivateRec_\n {\n FT_Byte num_blue_values;\n FT_Byte num_other_blues;\n FT_Byte num_family_blues;\n FT_Byte num_family_other_blues;\n\n FT_Pos blue_values[14];\n FT_Pos other_blues[10];\n FT_Pos family_blues[14];\n FT_Pos family_other_blues[10];\n\n FT_Fixed blue_scale;\n FT_Pos blue_shift;\n FT_Pos blue_fuzz;\n FT_Pos standard_width;\n FT_Pos standard_height;\n\n FT_Byte num_snap_widths;\n FT_Byte num_snap_heights;\n FT_Pos snap_widths[13];\n FT_Pos snap_heights[13];\n FT_Bool force_bold;\n FT_Fixed force_bold_threshold;\n FT_Int lenIV;\n FT_Int language_group;\n FT_Fixed expansion_factor;\n FT_Long initial_random_seed;\n FT_ULong local_subrs_offset;\n FT_Pos default_width;\n FT_Pos nominal_width;\n\n /* fields for CFF2 */\n FT_UInt vsindex;\n CFF_SubFont subfont;\n\n } CFF_PrivateRec, *CFF_Private;\n\n\n typedef struct CFF_FDSelectRec_\n {\n FT_Byte format;\n FT_UInt range_count;\n\n /* that's the table, taken from the file `as is' */\n FT_Byte* data;\n FT_UInt data_size;\n\n /* small cache for format 3 only */\n FT_UInt cache_first;\n FT_UInt cache_count;\n FT_Byte cache_fd;\n\n } CFF_FDSelectRec, *CFF_FDSelect;\n\n\n /* A SubFont packs a font dict and a private dict together. They are */\n /* needed to support CID-keyed CFF fonts. */\n typedef struct CFF_SubFontRec_\n {\n CFF_FontRecDictRec font_dict;\n CFF_PrivateRec private_dict;\n\n /* fields for CFF2 */\n CFF_BlendRec blend; /* current blend vector */\n FT_UInt lenNDV; /* current length NDV or zero */\n FT_Fixed* NDV; /* ptr to current NDV or NULL */\n\n /* `blend_stack' is a writable buffer to hold blend results. */\n /* This buffer is to the side of the normal cff parser stack; */\n /* `cff_parse_blend' and `cff_blend_doBlend' push blend results here. */\n /* The normal stack then points to these values instead of the DICT */\n /* because all other operators in Private DICT clear the stack. */\n /* `blend_stack' could be cleared at each operator other than blend. */\n /* Blended values are stored as 5-byte fixed point values. */\n\n FT_Byte* blend_stack; /* base of stack allocation */\n FT_Byte* blend_top; /* first empty slot */\n FT_UInt blend_used; /* number of bytes in use */\n FT_UInt blend_alloc; /* number of bytes allocated */\n\n CFF_IndexRec local_subrs_index;\n FT_Byte** local_subrs; /* array of pointers */\n /* into Local Subrs INDEX data */\n\n FT_UInt32 random;\n\n } CFF_SubFontRec;\n\n\n#define CFF_MAX_CID_FONTS 256\n\n\n typedef struct CFF_FontRec_\n {\n FT_Library library;\n FT_Stream stream;\n FT_Memory memory; /* TODO: take this from stream->memory? */\n FT_ULong base_offset; /* offset to start of CFF */\n FT_UInt num_faces;\n FT_UInt num_glyphs;\n\n FT_Byte version_major;\n FT_Byte version_minor;\n FT_Byte header_size;\n\n FT_UInt top_dict_length; /* cff2 only */\n\n FT_Bool cff2;\n\n CFF_IndexRec name_index;\n CFF_IndexRec top_dict_index;\n CFF_IndexRec global_subrs_index;\n\n CFF_EncodingRec encoding;\n CFF_CharsetRec charset;\n\n CFF_IndexRec charstrings_index;\n CFF_IndexRec font_dict_index;\n CFF_IndexRec private_index;\n CFF_IndexRec local_subrs_index;\n\n FT_String* font_name;\n\n /* array of pointers into Global Subrs INDEX data */\n FT_Byte** global_subrs;\n\n /* array of pointers into String INDEX data stored at string_pool */\n FT_UInt num_strings;\n FT_Byte** strings;\n FT_Byte* string_pool;\n FT_ULong string_pool_size;\n\n CFF_SubFontRec top_font;\n FT_UInt num_subfonts;\n CFF_SubFont subfonts[CFF_MAX_CID_FONTS];\n\n CFF_FDSelectRec fd_select;\n\n /* interface to PostScript hinter */\n PSHinter_Service pshinter;\n\n /* interface to Postscript Names service */\n FT_Service_PsCMaps psnames;\n\n /* interface to CFFLoad service */\n const void* cffload;\n\n /* since version 2.3.0 */\n PS_FontInfoRec* font_info; /* font info dictionary */\n\n /* since version 2.3.6 */\n FT_String* registry;\n FT_String* ordering;\n\n /* since version 2.4.12 */\n FT_Generic cf2_instance;\n\n /* since version 2.7.1 */\n CFF_VStoreRec vstore; /* parsed vstore structure */\n\n /* since version 2.9 */\n PS_FontExtraRec* font_extra;\n\n } CFF_FontRec;\n\n\nFT_END_HEADER\n\n#endif /* CFFTYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftcalc.h", "language": "code", "loc": 391, "comment_density": 0.45, "code": "/****************************************************************************\n *\n * ftcalc.h\n *\n * Arithmetic computations (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTCALC_H_\n#define FTCALC_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * FT_MulDiv() and FT_MulFix() are declared in freetype.h.\n *\n */\n\n#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER\n /* Provide assembler fragments for performance-critical functions. */\n /* These must be defined `static __inline__' with GCC. */\n\n#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_arm\n\n /* documentation is in freetype.h */\n\n static __inline FT_Int32\n FT_MulFix_arm( FT_Int32 a,\n FT_Int32 b )\n {\n FT_Int32 t, t2;\n\n\n __asm\n {\n smull t2, t, b, a /* (lo=t2,hi=t) = a*b */\n mov a, t, asr #31 /* a = (hi >> 31) */\n add a, a, #0x8000 /* a += 0x8000 */\n adds t2, t2, a /* t2 += a */\n adc t, t, #0 /* t += carry */\n mov a, t2, lsr #16 /* a = t2 >> 16 */\n orr a, a, t, lsl #16 /* a |= t << 16 */\n }\n return a;\n }\n\n#endif /* __CC_ARM || __ARMCC__ */\n\n\n#ifdef __GNUC__\n\n#if defined( __arm__ ) && \\\n ( !defined( __thumb__ ) || defined( __thumb2__ ) ) && \\\n !( defined( __CC_ARM ) || defined( __ARMCC__ ) )\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_arm\n\n /* documentation is in freetype.h */\n\n static __inline__ FT_Int32\n FT_MulFix_arm( FT_Int32 a,\n FT_Int32 b )\n {\n FT_Int32 t, t2;\n\n\n __asm__ __volatile__ (\n \"smull %1, %2, %4, %3\\n\\t\" /* (lo=%1,hi=%2) = a*b */\n \"mov %0, %2, asr #31\\n\\t\" /* %0 = (hi >> 31) */\n#if defined( __clang__ ) && defined( __thumb2__ )\n \"add.w %0, %0, #0x8000\\n\\t\" /* %0 += 0x8000 */\n#else\n \"add %0, %0, #0x8000\\n\\t\" /* %0 += 0x8000 */\n#endif\n \"adds %1, %1, %0\\n\\t\" /* %1 += %0 */\n \"adc %2, %2, #0\\n\\t\" /* %2 += carry */\n \"mov %0, %1, lsr #16\\n\\t\" /* %0 = %1 >> 16 */\n \"orr %0, %0, %2, lsl #16\\n\\t\" /* %0 |= %2 << 16 */\n : \"=r\"(a), \"=&r\"(t2), \"=&r\"(t)\n : \"r\"(a), \"r\"(b)\n : \"cc\" );\n return a;\n }\n\n#endif /* __arm__ && */\n /* ( __thumb2__ || !__thumb__ ) && */\n /* !( __CC_ARM || __ARMCC__ ) */\n\n\n#if defined( __i386__ )\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_i386\n\n /* documentation is in freetype.h */\n\n static __inline__ FT_Int32\n FT_MulFix_i386( FT_Int32 a,\n FT_Int32 b )\n {\n FT_Int32 result;\n\n\n __asm__ __volatile__ (\n \"imul %%edx\\n\"\n \"movl %%edx, %%ecx\\n\"\n \"sarl $31, %%ecx\\n\"\n \"addl $0x8000, %%ecx\\n\"\n \"addl %%ecx, %%eax\\n\"\n \"adcl $0, %%edx\\n\"\n \"shrl $16, %%eax\\n\"\n \"shll $16, %%edx\\n\"\n \"addl %%edx, %%eax\\n\"\n : \"=a\"(result), \"=d\"(b)\n : \"a\"(a), \"d\"(b)\n : \"%ecx\", \"cc\" );\n return result;\n }\n\n#endif /* i386 */\n\n#endif /* __GNUC__ */\n\n\n#ifdef _MSC_VER /* Visual C++ */\n\n#ifdef _M_IX86\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_i386\n\n /* documentation is in freetype.h */\n\n static __inline FT_Int32\n FT_MulFix_i386( FT_Int32 a,\n FT_Int32 b )\n {\n FT_Int32 result;\n\n __asm\n {\n mov eax, a\n mov edx, b\n imul edx\n mov ecx, edx\n sar ecx, 31\n add ecx, 8000h\n add eax, ecx\n adc edx, 0\n shr eax, 16\n shl edx, 16\n add eax, edx\n mov result, eax\n }\n return result;\n }\n\n#endif /* _M_IX86 */\n\n#endif /* _MSC_VER */\n\n\n#if defined( __GNUC__ ) && defined( __x86_64__ )\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_x86_64\n\n static __inline__ FT_Int32\n FT_MulFix_x86_64( FT_Int32 a,\n FT_Int32 b )\n {\n /* Temporarily disable the warning that C90 doesn't support */\n /* `long long'. */\n#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 )\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wlong-long\"\n#endif\n\n#if 1\n /* Technically not an assembly fragment, but GCC does a really good */\n /* job at inlining it and generating good machine code for it. */\n long long ret, tmp;\n\n\n ret = (long long)a * b;\n tmp = ret >> 63;\n ret += 0x8000 + tmp;\n\n return (FT_Int32)( ret >> 16 );\n#else\n\n /* For some reason, GCC 4.6 on Ubuntu 12.04 generates invalid machine */\n /* code from the lines below. The main issue is that `wide_a' is not */\n /* properly initialized by sign-extending `a'. Instead, the generated */\n /* machine code assumes that the register that contains `a' on input */\n /* can be used directly as a 64-bit value, which is wrong most of the */\n /* time. */\n long long wide_a = (long long)a;\n long long wide_b = (long long)b;\n long long result;\n\n\n __asm__ __volatile__ (\n \"imul %2, %1\\n\"\n \"mov %1, %0\\n\"\n \"sar $63, %0\\n\"\n \"lea 0x8000(%1, %0), %0\\n\"\n \"sar $16, %0\\n\"\n : \"=&r\"(result), \"=&r\"(wide_a)\n : \"r\"(wide_b)\n : \"cc\" );\n\n return (FT_Int32)result;\n#endif\n\n#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 )\n#pragma GCC diagnostic pop\n#endif\n }\n\n#endif /* __GNUC__ && __x86_64__ */\n\n#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */\n\n\n#ifdef FT_CONFIG_OPTION_INLINE_MULFIX\n#ifdef FT_MULFIX_ASSEMBLER\n#define FT_MulFix( a, b ) FT_MULFIX_ASSEMBLER( (FT_Int32)(a), (FT_Int32)(b) )\n#endif\n#endif\n\n\n /**************************************************************************\n *\n * @function:\n * FT_MulDiv_No_Round\n *\n * @description:\n * A very simple function used to perform the computation '(a*b)/c'\n * (without rounding) with maximum accuracy (it uses a 64-bit\n * intermediate integer whenever necessary).\n *\n * This function isn't necessarily as fast as some processor-specific\n * operations, but is at least completely portable.\n *\n * @input:\n * a ::\n * The first multiplier.\n * b ::\n * The second multiplier.\n * c ::\n * The divisor.\n *\n * @return:\n * The result of '(a*b)/c'. This function never traps when trying to\n * divide by zero; it simply returns 'MaxInt' or 'MinInt' depending on\n * the signs of 'a' and 'b'.\n */\n FT_BASE( FT_Long )\n FT_MulDiv_No_Round( FT_Long a,\n FT_Long b,\n FT_Long c );\n\n\n /*\n * A variant of FT_Matrix_Multiply which scales its result afterwards. The\n * idea is that both `a' and `b' are scaled by factors of 10 so that the\n * values are as precise as possible to get a correct result during the\n * 64bit multiplication. Let `sa' and `sb' be the scaling factors of `a'\n * and `b', respectively, then the scaling factor of the result is `sa*sb'.\n */\n FT_BASE( void )\n FT_Matrix_Multiply_Scaled( const FT_Matrix* a,\n FT_Matrix *b,\n FT_Long scaling );\n\n\n /*\n * Check a matrix. If the transformation would lead to extreme shear or\n * extreme scaling, for example, return 0. If everything is OK, return 1.\n *\n * Based on geometric considerations we use the following inequality to\n * identify a degenerate matrix.\n *\n * 50 * abs(xx*yy - xy*yx) < xx^2 + xy^2 + yx^2 + yy^2\n *\n * Value 50 is heuristic.\n */\n FT_BASE( FT_Bool )\n FT_Matrix_Check( const FT_Matrix* matrix );\n\n\n /*\n * A variant of FT_Vector_Transform. See comments for\n * FT_Matrix_Multiply_Scaled.\n */\n FT_BASE( void )\n FT_Vector_Transform_Scaled( FT_Vector* vector,\n const FT_Matrix* matrix,\n FT_Long scaling );\n\n\n /*\n * This function normalizes a vector and returns its original length. The\n * normalized vector is a 16.16 fixed-point unit vector with length close\n * to 0x10000. The accuracy of the returned length is limited to 16 bits\n * also. The function utilizes quick inverse square root approximation\n * without divisions and square roots relying on Newton's iterations\n * instead.\n */\n FT_BASE( FT_UInt32 )\n FT_Vector_NormLen( FT_Vector* vector );\n\n\n /*\n * Return -1, 0, or +1, depending on the orientation of a given corner. We\n * use the Cartesian coordinate system, with positive vertical values going\n * upwards. The function returns +1 if the corner turns to the left, -1 to\n * the right, and 0 for undecidable cases.\n */\n FT_BASE( FT_Int )\n ft_corner_orientation( FT_Pos in_x,\n FT_Pos in_y,\n FT_Pos out_x,\n FT_Pos out_y );\n\n\n /*\n * Return TRUE if a corner is flat or nearly flat. This is equivalent to\n * saying that the corner point is close to its neighbors, or inside an\n * ellipse defined by the neighbor focal points to be more precise.\n */\n FT_BASE( FT_Int )\n ft_corner_is_flat( FT_Pos in_x,\n FT_Pos in_y,\n FT_Pos out_x,\n FT_Pos out_y );\n\n\n /*\n * Return the most significant bit index.\n */\n\n#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER\n\n#if defined( __GNUC__ ) && \\\n ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4 ) )\n\n#if FT_SIZEOF_INT == 4\n\n#define FT_MSB( x ) ( 31 - __builtin_clz( x ) )\n\n#elif FT_SIZEOF_LONG == 4\n\n#define FT_MSB( x ) ( 31 - __builtin_clzl( x ) )\n\n#endif /* __GNUC__ */\n\n\n#elif defined( _MSC_VER ) && ( _MSC_VER >= 1400 )\n\n#if FT_SIZEOF_INT == 4\n\n#include \n#pragma intrinsic( _BitScanReverse )\n\n static __inline FT_Int32\n FT_MSB_i386( FT_UInt32 x )\n {\n unsigned long where;\n\n\n _BitScanReverse( &where, x );\n\n return (FT_Int32)where;\n }\n\n#define FT_MSB( x ) ( FT_MSB_i386( x ) )\n\n#endif\n\n#endif /* _MSC_VER */\n\n\n#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */\n\n#ifndef FT_MSB\n\n FT_BASE( FT_Int )\n FT_MSB( FT_UInt32 z );\n\n#endif\n\n\n /*\n * Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses\n * two fixed-point arguments instead.\n */\n FT_BASE( FT_Fixed )\n FT_Hypot( FT_Fixed x,\n FT_Fixed y );\n\n\n#if 0\n\n /**************************************************************************\n *\n * @function:\n * FT_SqrtFixed\n *\n * @description:\n * Computes the square root of a 16.16 fixed-point value.\n *\n * @input:\n * x ::\n * The value to compute the root for.\n *\n * @return:\n * The result of 'sqrt(x)'.\n *\n * @note:\n * This function is not very fast.\n */\n FT_BASE( FT_Int32 )\n FT_SqrtFixed( FT_Int32 x );\n\n#endif /* 0 */\n\n\n#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 ) /* << 6 */\n#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) * 16384 ) /* << 14 */\n#define INT_TO_FIXED( x ) ( (FT_Long)(x) * 65536 ) /* << 16 */\n#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 ) /* << 2 */\n#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 )\n\n#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \\\n : ( -( ( 32 - (x) ) & -64 ) ) )\n\n /*\n * The following macros have two purposes.\n *\n * - Tag places where overflow is expected and harmless.\n *\n * - Avoid run-time sanitizer errors.\n *\n * Use with care!\n */\n#define ADD_INT( a, b ) \\\n (FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) )\n#define SUB_INT( a, b ) \\\n (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) )\n#define MUL_INT( a, b ) \\\n (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) )\n#define NEG_INT( a ) \\\n (FT_Int)( (FT_UInt)0 - (FT_UInt)(a) )\n\n#define ADD_LONG( a, b ) \\\n (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) )\n#define SUB_LONG( a, b ) \\\n (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) )\n#define MUL_LONG( a, b ) \\\n (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) )\n#define NEG_LONG( a ) \\\n (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) )\n\n#define ADD_INT32( a, b ) \\\n (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) )\n#define SUB_INT32( a, b ) \\\n (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) )\n#define MUL_INT32( a, b ) \\\n (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) )\n#define NEG_INT32( a ) \\\n (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) )\n\n#ifdef FT_LONG64\n\n#define ADD_INT64( a, b ) \\\n (FT_Int64)( (FT_UInt64)(a) + (FT_UInt64)(b) )\n#define SUB_INT64( a, b ) \\\n (FT_Int64)( (FT_UInt64)(a) - (FT_UInt64)(b) )\n#define MUL_INT64( a, b ) \\\n (FT_Int64)( (FT_UInt64)(a) * (FT_UInt64)(b) )\n#define NEG_INT64( a ) \\\n (FT_Int64)( (FT_UInt64)0 - (FT_UInt64)(a) )\n\n#endif /* FT_LONG64 */\n\n\nFT_END_HEADER\n\n#endif /* FTCALC_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftdebug.h", "language": "code", "loc": 216, "comment_density": 0.653, "code": "/****************************************************************************\n *\n * ftdebug.h\n *\n * Debugging and logging component (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n *\n * IMPORTANT: A description of FreeType's debugging support can be\n * found in 'docs/DEBUG.TXT'. Read it if you need to use or\n * understand this code.\n *\n */\n\n\n#ifndef FTDEBUG_H_\n#define FTDEBUG_H_\n\n\n#include \n#include FT_CONFIG_CONFIG_H\n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */\n /* is already defined; this simplifies the following #ifdefs */\n /* */\n#ifdef FT_DEBUG_LEVEL_TRACE\n#undef FT_DEBUG_LEVEL_ERROR\n#define FT_DEBUG_LEVEL_ERROR\n#endif\n\n\n /**************************************************************************\n *\n * Define the trace enums as well as the trace levels array when they are\n * needed.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_TRACE\n\n#define FT_TRACE_DEF( x ) trace_ ## x ,\n\n /* defining the enumeration */\n typedef enum FT_Trace_\n {\n#include FT_INTERNAL_TRACE_H\n trace_count\n\n } FT_Trace;\n\n\n /* a pointer to the array of trace levels, */\n /* provided by `src/base/ftdebug.c' */\n extern int* ft_trace_levels;\n\n#undef FT_TRACE_DEF\n\n#endif /* FT_DEBUG_LEVEL_TRACE */\n\n\n /**************************************************************************\n *\n * Define the FT_TRACE macro\n *\n * IMPORTANT!\n *\n * Each component must define the macro FT_COMPONENT to a valid FT_Trace\n * value before using any TRACE macro.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_TRACE\n\n /* we need two macros here to make cpp expand `FT_COMPONENT' */\n#define FT_TRACE_COMP( x ) FT_TRACE_COMP_( x )\n#define FT_TRACE_COMP_( x ) trace_ ## x\n\n#define FT_TRACE( level, varformat ) \\\n do \\\n { \\\n if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] >= level ) \\\n FT_Message varformat; \\\n } while ( 0 )\n\n#else /* !FT_DEBUG_LEVEL_TRACE */\n\n#define FT_TRACE( level, varformat ) do { } while ( 0 ) /* nothing */\n\n#endif /* !FT_DEBUG_LEVEL_TRACE */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Trace_Get_Count\n *\n * @description:\n * Return the number of available trace components.\n *\n * @return:\n * The number of trace components. 0 if FreeType 2 is not built with\n * FT_DEBUG_LEVEL_TRACE definition.\n *\n * @note:\n * This function may be useful if you want to access elements of the\n * internal trace levels array by an index.\n */\n FT_BASE( FT_Int )\n FT_Trace_Get_Count( void );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Trace_Get_Name\n *\n * @description:\n * Return the name of a trace component.\n *\n * @input:\n * The index of the trace component.\n *\n * @return:\n * The name of the trace component. This is a statically allocated\n * C~string, so do not free it after use. `NULL` if FreeType is not\n * built with FT_DEBUG_LEVEL_TRACE definition.\n *\n * @note:\n * Use @FT_Trace_Get_Count to get the number of available trace\n * components.\n */\n FT_BASE( const char* )\n FT_Trace_Get_Name( FT_Int idx );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Trace_Disable\n *\n * @description:\n * Switch off tracing temporarily. It can be activated again with\n * @FT_Trace_Enable.\n */\n FT_BASE( void )\n FT_Trace_Disable( void );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Trace_Enable\n *\n * @description:\n * Activate tracing. Use it after tracing has been switched off with\n * @FT_Trace_Disable.\n */\n FT_BASE( void )\n FT_Trace_Enable( void );\n\n\n /**************************************************************************\n *\n * You need two opening and closing parentheses!\n *\n * Example: FT_TRACE0(( \"Value is %i\", foo ))\n *\n * Output of the FT_TRACEX macros is sent to stderr.\n *\n */\n\n#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )\n#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )\n#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat )\n#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat )\n#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat )\n#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat )\n#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )\n#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )\n\n\n /**************************************************************************\n *\n * Define the FT_ERROR macro.\n *\n * Output of this macro is sent to stderr.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_ERROR\n\n#define FT_ERROR( varformat ) FT_Message varformat\n\n#else /* !FT_DEBUG_LEVEL_ERROR */\n\n#define FT_ERROR( varformat ) do { } while ( 0 ) /* nothing */\n\n#endif /* !FT_DEBUG_LEVEL_ERROR */\n\n\n /**************************************************************************\n *\n * Define the FT_ASSERT and FT_THROW macros. The call to `FT_Throw` makes\n * it possible to easily set a breakpoint at this function.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_ERROR\n\n#define FT_ASSERT( condition ) \\\n do \\\n { \\\n if ( !( condition ) ) \\\n FT_Panic( \"assertion failed on line %d of file %s\\n\", \\\n __LINE__, __FILE__ ); \\\n } while ( 0 )\n\n#define FT_THROW( e ) \\\n ( FT_Throw( FT_ERR_CAT( FT_ERR_PREFIX, e ), \\\n __LINE__, \\\n __FILE__ ) | \\\n FT_ERR_CAT( FT_ERR_PREFIX, e ) )\n\n#else /* !FT_DEBUG_LEVEL_ERROR */\n\n#define FT_ASSERT( condition ) do { } while ( 0 )\n\n#define FT_THROW( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )\n\n#endif /* !FT_DEBUG_LEVEL_ERROR */\n\n\n /**************************************************************************\n *\n * Define `FT_Message` and `FT_Panic` when needed.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_ERROR\n\n#include \"stdio.h\" /* for vfprintf() */\n\n /* print a message */\n FT_BASE( void )\n FT_Message( const char* fmt,\n ... );\n\n /* print a message and exit */\n FT_BASE( void )\n FT_Panic( const char* fmt,\n ... );\n\n /* report file name and line number of an error */\n FT_BASE( int )\n FT_Throw( FT_Error error,\n int line,\n const char* file );\n\n#endif /* FT_DEBUG_LEVEL_ERROR */\n\n\n FT_BASE( void )\n ft_debug_init( void );\n\nFT_END_HEADER\n\n#endif /* FTDEBUG_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftdrv.h", "language": "code", "loc": 245, "comment_density": 0.469, "code": "/****************************************************************************\n *\n * ftdrv.h\n *\n * FreeType internal font driver interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTDRV_H_\n#define FTDRV_H_\n\n\n#include \n#include FT_MODULE_H\n\n\nFT_BEGIN_HEADER\n\n\n typedef FT_Error\n (*FT_Face_InitFunc)( FT_Stream stream,\n FT_Face face,\n FT_Int typeface_index,\n FT_Int num_params,\n FT_Parameter* parameters );\n\n typedef void\n (*FT_Face_DoneFunc)( FT_Face face );\n\n\n typedef FT_Error\n (*FT_Size_InitFunc)( FT_Size size );\n\n typedef void\n (*FT_Size_DoneFunc)( FT_Size size );\n\n\n typedef FT_Error\n (*FT_Slot_InitFunc)( FT_GlyphSlot slot );\n\n typedef void\n (*FT_Slot_DoneFunc)( FT_GlyphSlot slot );\n\n\n typedef FT_Error\n (*FT_Size_RequestFunc)( FT_Size size,\n FT_Size_Request req );\n\n typedef FT_Error\n (*FT_Size_SelectFunc)( FT_Size size,\n FT_ULong size_index );\n\n typedef FT_Error\n (*FT_Slot_LoadFunc)( FT_GlyphSlot slot,\n FT_Size size,\n FT_UInt glyph_index,\n FT_Int32 load_flags );\n\n\n typedef FT_Error\n (*FT_Face_GetKerningFunc)( FT_Face face,\n FT_UInt left_glyph,\n FT_UInt right_glyph,\n FT_Vector* kerning );\n\n\n typedef FT_Error\n (*FT_Face_AttachFunc)( FT_Face face,\n FT_Stream stream );\n\n\n typedef FT_Error\n (*FT_Face_GetAdvancesFunc)( FT_Face face,\n FT_UInt first,\n FT_UInt count,\n FT_Int32 flags,\n FT_Fixed* advances );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Driver_ClassRec\n *\n * @description:\n * The font driver class. This structure mostly contains pointers to\n * driver methods.\n *\n * @fields:\n * root ::\n * The parent module.\n *\n * face_object_size ::\n * The size of a face object in bytes.\n *\n * size_object_size ::\n * The size of a size object in bytes.\n *\n * slot_object_size ::\n * The size of a glyph object in bytes.\n *\n * init_face ::\n * The format-specific face constructor.\n *\n * done_face ::\n * The format-specific face destructor.\n *\n * init_size ::\n * The format-specific size constructor.\n *\n * done_size ::\n * The format-specific size destructor.\n *\n * init_slot ::\n * The format-specific slot constructor.\n *\n * done_slot ::\n * The format-specific slot destructor.\n *\n *\n * load_glyph ::\n * A function handle to load a glyph to a slot. This field is\n * mandatory!\n *\n * get_kerning ::\n * A function handle to return the unscaled kerning for a given pair of\n * glyphs. Can be set to 0 if the format doesn't support kerning.\n *\n * attach_file ::\n * This function handle is used to read additional data for a face from\n * another file/stream. For example, this can be used to add data from\n * AFM or PFM files on a Type 1 face, or a CIDMap on a CID-keyed face.\n *\n * get_advances ::\n * A function handle used to return advance widths of 'count' glyphs\n * (in font units), starting at 'first'. The 'vertical' flag must be\n * set to get vertical advance heights. The 'advances' buffer is\n * caller-allocated. The idea of this function is to be able to\n * perform device-independent text layout without loading a single\n * glyph image.\n *\n * request_size ::\n * A handle to a function used to request the new character size. Can\n * be set to 0 if the scaling done in the base layer suffices.\n *\n * select_size ::\n * A handle to a function used to select a new fixed size. It is used\n * only if @FT_FACE_FLAG_FIXED_SIZES is set. Can be set to 0 if the\n * scaling done in the base layer suffices.\n * @note:\n * Most function pointers, with the exception of `load_glyph`, can be set\n * to 0 to indicate a default behaviour.\n */\n typedef struct FT_Driver_ClassRec_\n {\n FT_Module_Class root;\n\n FT_Long face_object_size;\n FT_Long size_object_size;\n FT_Long slot_object_size;\n\n FT_Face_InitFunc init_face;\n FT_Face_DoneFunc done_face;\n\n FT_Size_InitFunc init_size;\n FT_Size_DoneFunc done_size;\n\n FT_Slot_InitFunc init_slot;\n FT_Slot_DoneFunc done_slot;\n\n FT_Slot_LoadFunc load_glyph;\n\n FT_Face_GetKerningFunc get_kerning;\n FT_Face_AttachFunc attach_file;\n FT_Face_GetAdvancesFunc get_advances;\n\n /* since version 2.2 */\n FT_Size_RequestFunc request_size;\n FT_Size_SelectFunc select_size;\n\n } FT_Driver_ClassRec, *FT_Driver_Class;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DECLARE_DRIVER\n *\n * @description:\n * Used to create a forward declaration of an FT_Driver_ClassRec struct\n * instance.\n *\n * @macro:\n * FT_DEFINE_DRIVER\n *\n * @description:\n * Used to initialize an instance of FT_Driver_ClassRec struct.\n *\n * `ftinit.c` (ft_create_default_module_classes) already contains a\n * mechanism to call these functions for the default modules described in\n * `ftmodule.h`.\n *\n * The struct will be allocated in the global scope (or the scope where\n * the macro is used).\n */\n#define FT_DECLARE_DRIVER( class_ ) \\\n FT_CALLBACK_TABLE \\\n const FT_Driver_ClassRec class_;\n\n#define FT_DEFINE_DRIVER( \\\n class_, \\\n flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_, \\\n face_object_size_, \\\n size_object_size_, \\\n slot_object_size_, \\\n init_face_, \\\n done_face_, \\\n init_size_, \\\n done_size_, \\\n init_slot_, \\\n done_slot_, \\\n load_glyph_, \\\n get_kerning_, \\\n attach_file_, \\\n get_advances_, \\\n request_size_, \\\n select_size_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_Driver_ClassRec class_ = \\\n { \\\n FT_DEFINE_ROOT_MODULE( flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_ ) \\\n \\\n face_object_size_, \\\n size_object_size_, \\\n slot_object_size_, \\\n \\\n init_face_, \\\n done_face_, \\\n \\\n init_size_, \\\n done_size_, \\\n \\\n init_slot_, \\\n done_slot_, \\\n \\\n load_glyph_, \\\n \\\n get_kerning_, \\\n attach_file_, \\\n get_advances_, \\\n \\\n request_size_, \\\n select_size_ \\\n };\n\n\nFT_END_HEADER\n\n#endif /* FTDRV_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftgloadr.h", "language": "code", "loc": 111, "comment_density": 0.405, "code": "/****************************************************************************\n *\n * ftgloadr.h\n *\n * The FreeType glyph loader (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTGLOADR_H_\n#define FTGLOADR_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_GlyphLoader\n *\n * @description:\n * The glyph loader is an internal object used to load several glyphs\n * together (for example, in the case of composites).\n */\n typedef struct FT_SubGlyphRec_\n {\n FT_Int index;\n FT_UShort flags;\n FT_Int arg1;\n FT_Int arg2;\n FT_Matrix transform;\n\n } FT_SubGlyphRec;\n\n\n typedef struct FT_GlyphLoadRec_\n {\n FT_Outline outline; /* outline */\n FT_Vector* extra_points; /* extra points table */\n FT_Vector* extra_points2; /* second extra points table */\n FT_UInt num_subglyphs; /* number of subglyphs */\n FT_SubGlyph subglyphs; /* subglyphs */\n\n } FT_GlyphLoadRec, *FT_GlyphLoad;\n\n\n typedef struct FT_GlyphLoaderRec_\n {\n FT_Memory memory;\n FT_UInt max_points;\n FT_UInt max_contours;\n FT_UInt max_subglyphs;\n FT_Bool use_extra;\n\n FT_GlyphLoadRec base;\n FT_GlyphLoadRec current;\n\n void* other; /* for possible future extension? */\n\n } FT_GlyphLoaderRec, *FT_GlyphLoader;\n\n\n /* create new empty glyph loader */\n FT_BASE( FT_Error )\n FT_GlyphLoader_New( FT_Memory memory,\n FT_GlyphLoader *aloader );\n\n /* add an extra points table to a glyph loader */\n FT_BASE( FT_Error )\n FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader );\n\n /* destroy a glyph loader */\n FT_BASE( void )\n FT_GlyphLoader_Done( FT_GlyphLoader loader );\n\n /* reset a glyph loader (frees everything int it) */\n FT_BASE( void )\n FT_GlyphLoader_Reset( FT_GlyphLoader loader );\n\n /* rewind a glyph loader */\n FT_BASE( void )\n FT_GlyphLoader_Rewind( FT_GlyphLoader loader );\n\n /* check that there is enough space to add `n_points' and `n_contours' */\n /* to the glyph loader */\n FT_BASE( FT_Error )\n FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,\n FT_UInt n_points,\n FT_UInt n_contours );\n\n\n#define FT_GLYPHLOADER_CHECK_P( _loader, _count ) \\\n ( (_count) == 0 || \\\n ( (FT_UInt)(_loader)->base.outline.n_points + \\\n (FT_UInt)(_loader)->current.outline.n_points + \\\n (FT_UInt)(_count) ) <= (_loader)->max_points )\n\n#define FT_GLYPHLOADER_CHECK_C( _loader, _count ) \\\n ( (_count) == 0 || \\\n ( (FT_UInt)(_loader)->base.outline.n_contours + \\\n (FT_UInt)(_loader)->current.outline.n_contours + \\\n (FT_UInt)(_count) ) <= (_loader)->max_contours )\n\n#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points, _contours ) \\\n ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points ) && \\\n FT_GLYPHLOADER_CHECK_C( _loader, _contours ) ) \\\n ? 0 \\\n : FT_GlyphLoader_CheckPoints( (_loader), \\\n (FT_UInt)(_points), \\\n (FT_UInt)(_contours) ) )\n\n\n /* check that there is enough space to add `n_subs' sub-glyphs to */\n /* a glyph loader */\n FT_BASE( FT_Error )\n FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,\n FT_UInt n_subs );\n\n /* prepare a glyph loader, i.e. empty the current glyph */\n FT_BASE( void )\n FT_GlyphLoader_Prepare( FT_GlyphLoader loader );\n\n /* add the current glyph to the base glyph */\n FT_BASE( void )\n FT_GlyphLoader_Add( FT_GlyphLoader loader );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGLOADR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/fthash.h", "language": "code", "loc": 97, "comment_density": 0.402, "code": "/****************************************************************************\n *\n * fthash.h\n *\n * Hashing functions (specification).\n *\n */\n\n/*\n * Copyright 2000 Computing Research Labs, New Mexico State University\n * Copyright 2001-2015\n * Francesco Zappa Nardelli\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT\n * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n /**************************************************************************\n *\n * This file is based on code from bdf.c,v 1.22 2000/03/16 20:08:50\n *\n * taken from Mark Leisher's xmbdfed package\n *\n */\n\n\n#ifndef FTHASH_H_\n#define FTHASH_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n typedef union FT_Hashkey_\n {\n FT_Int num;\n const char* str;\n\n } FT_Hashkey;\n\n\n typedef struct FT_HashnodeRec_\n {\n FT_Hashkey key;\n size_t data;\n\n } FT_HashnodeRec;\n\n typedef struct FT_HashnodeRec_ *FT_Hashnode;\n\n\n typedef FT_ULong\n (*FT_Hash_LookupFunc)( FT_Hashkey* key );\n\n typedef FT_Bool\n (*FT_Hash_CompareFunc)( FT_Hashkey* a,\n FT_Hashkey* b );\n\n\n typedef struct FT_HashRec_\n {\n FT_UInt limit;\n FT_UInt size;\n FT_UInt used;\n\n FT_Hash_LookupFunc lookup;\n FT_Hash_CompareFunc compare;\n\n FT_Hashnode* table;\n\n } FT_HashRec;\n\n typedef struct FT_HashRec_ *FT_Hash;\n\n\n FT_Error\n ft_hash_str_init( FT_Hash hash,\n FT_Memory memory );\n\n FT_Error\n ft_hash_num_init( FT_Hash hash,\n FT_Memory memory );\n\n void\n ft_hash_str_free( FT_Hash hash,\n FT_Memory memory );\n\n#define ft_hash_num_free ft_hash_str_free\n\n FT_Error\n ft_hash_str_insert( const char* key,\n size_t data,\n FT_Hash hash,\n FT_Memory memory );\n\n FT_Error\n ft_hash_num_insert( FT_Int num,\n size_t data,\n FT_Hash hash,\n FT_Memory memory );\n\n size_t*\n ft_hash_str_lookup( const char* key,\n FT_Hash hash );\n\n size_t*\n ft_hash_num_lookup( FT_Int num,\n FT_Hash hash );\n\n\nFT_END_HEADER\n\n\n#endif /* FTHASH_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftmemory.h", "language": "code", "loc": 295, "comment_density": 0.244, "code": "/****************************************************************************\n *\n * ftmemory.h\n *\n * The FreeType memory management macros (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTMEMORY_H_\n#define FTMEMORY_H_\n\n\n#include \n#include FT_CONFIG_CONFIG_H\n#include FT_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SET_ERROR\n *\n * @description:\n * This macro is used to set an implicit 'error' variable to a given\n * expression's value (usually a function call), and convert it to a\n * boolean which is set whenever the value is != 0.\n */\n#undef FT_SET_ERROR\n#define FT_SET_ERROR( expression ) \\\n ( ( error = (expression) ) != 0 )\n\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** M E M O R Y ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /* The calculation `NULL + n' is undefined in C. Even if the resulting */\n /* pointer doesn't get dereferenced, this causes warnings with */\n /* sanitizers. */\n /* */\n /* We thus provide a macro that should be used if `base' can be NULL. */\n#define FT_OFFSET( base, count ) ( (base) ? (base) + (count) : NULL )\n\n\n /*\n * C++ refuses to handle statements like p = (void*)anything, with `p' a\n * typed pointer. Since we don't have a `typeof' operator in standard C++,\n * we have to use a template to emulate it.\n */\n\n#ifdef __cplusplus\n\nextern \"C++\"\n{\n template inline T*\n cplusplus_typeof( T*,\n void *v )\n {\n return static_cast ( v );\n }\n}\n\n#define FT_ASSIGNP( p, val ) (p) = cplusplus_typeof( (p), (val) )\n\n#else\n\n#define FT_ASSIGNP( p, val ) (p) = (val)\n\n#endif\n\n\n\n#ifdef FT_DEBUG_MEMORY\n\n FT_BASE( const char* ) _ft_debug_file;\n FT_BASE( long ) _ft_debug_lineno;\n\n#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \\\n _ft_debug_lineno = __LINE__, \\\n (exp) )\n\n#define FT_ASSIGNP_INNER( p, exp ) ( _ft_debug_file = __FILE__, \\\n _ft_debug_lineno = __LINE__, \\\n FT_ASSIGNP( p, exp ) )\n\n#else /* !FT_DEBUG_MEMORY */\n\n#define FT_DEBUG_INNER( exp ) (exp)\n#define FT_ASSIGNP_INNER( p, exp ) FT_ASSIGNP( p, exp )\n\n#endif /* !FT_DEBUG_MEMORY */\n\n\n /*\n * The allocation functions return a pointer, and the error code is written\n * to through the `p_error' parameter.\n */\n\n /* The `q' variants of the functions below (`q' for `quick') don't fill */\n /* the allocated or reallocated memory with zero bytes. */\n\n FT_BASE( FT_Pointer )\n ft_mem_alloc( FT_Memory memory,\n FT_Long size,\n FT_Error *p_error );\n\n FT_BASE( FT_Pointer )\n ft_mem_qalloc( FT_Memory memory,\n FT_Long size,\n FT_Error *p_error );\n\n FT_BASE( FT_Pointer )\n ft_mem_realloc( FT_Memory memory,\n FT_Long item_size,\n FT_Long cur_count,\n FT_Long new_count,\n void* block,\n FT_Error *p_error );\n\n FT_BASE( FT_Pointer )\n ft_mem_qrealloc( FT_Memory memory,\n FT_Long item_size,\n FT_Long cur_count,\n FT_Long new_count,\n void* block,\n FT_Error *p_error );\n\n FT_BASE( void )\n ft_mem_free( FT_Memory memory,\n const void* P );\n\n\n /* The `Q' variants of the macros below (`Q' for `quick') don't fill */\n /* the allocated or reallocated memory with zero bytes. */\n\n#define FT_MEM_ALLOC( ptr, size ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \\\n (FT_Long)(size), \\\n &error ) )\n\n#define FT_MEM_FREE( ptr ) \\\n FT_BEGIN_STMNT \\\n FT_DEBUG_INNER( ft_mem_free( memory, (ptr) ) ); \\\n (ptr) = NULL; \\\n FT_END_STMNT\n\n#define FT_MEM_NEW( ptr ) \\\n FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )\n\n#define FT_MEM_REALLOC( ptr, cursz, newsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n 1, \\\n (FT_Long)(cursz), \\\n (FT_Long)(newsz), \\\n (ptr), \\\n &error ) )\n\n#define FT_MEM_QALLOC( ptr, size ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \\\n (FT_Long)(size), \\\n &error ) )\n\n#define FT_MEM_QNEW( ptr ) \\\n FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )\n\n#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n 1, \\\n (FT_Long)(cursz), \\\n (FT_Long)(newsz), \\\n (ptr), \\\n &error ) )\n\n#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n (FT_Long)(item_size), \\\n 0, \\\n (FT_Long)(count), \\\n NULL, \\\n &error ) )\n\n#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n (FT_Long)(itmsz), \\\n (FT_Long)(oldcnt), \\\n (FT_Long)(newcnt), \\\n (ptr), \\\n &error ) )\n\n#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n (FT_Long)(item_size), \\\n 0, \\\n (FT_Long)(count), \\\n NULL, \\\n &error ) )\n\n#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n (FT_Long)(itmsz), \\\n (FT_Long)(oldcnt), \\\n (FT_Long)(newcnt), \\\n (ptr), \\\n &error ) )\n\n\n#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )\n\n\n#define FT_MEM_SET( dest, byte, count ) \\\n ft_memset( dest, byte, (FT_Offset)(count) )\n\n#define FT_MEM_COPY( dest, source, count ) \\\n ft_memcpy( dest, source, (FT_Offset)(count) )\n\n#define FT_MEM_MOVE( dest, source, count ) \\\n ft_memmove( dest, source, (FT_Offset)(count) )\n\n\n#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )\n\n#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )\n\n\n#define FT_ARRAY_ZERO( dest, count ) \\\n FT_MEM_ZERO( dest, \\\n (FT_Offset)(count) * sizeof ( *(dest) ) )\n\n#define FT_ARRAY_COPY( dest, source, count ) \\\n FT_MEM_COPY( dest, \\\n source, \\\n (FT_Offset)(count) * sizeof ( *(dest) ) )\n\n#define FT_ARRAY_MOVE( dest, source, count ) \\\n FT_MEM_MOVE( dest, \\\n source, \\\n (FT_Offset)(count) * sizeof ( *(dest) ) )\n\n\n /*\n * Return the maximum number of addressable elements in an array. We limit\n * ourselves to INT_MAX, rather than UINT_MAX, to avoid any problems.\n */\n#define FT_ARRAY_MAX( ptr ) ( FT_INT_MAX / sizeof ( *(ptr) ) )\n\n#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX( ptr ) )\n\n\n /**************************************************************************\n *\n * The following functions macros expect that their pointer argument is\n * _typed_ in order to automatically compute array element sizes.\n */\n\n#define FT_MEM_NEW_ARRAY( ptr, count ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n sizeof ( *(ptr) ), \\\n 0, \\\n (FT_Long)(count), \\\n NULL, \\\n &error ) )\n\n#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n sizeof ( *(ptr) ), \\\n (FT_Long)(cursz), \\\n (FT_Long)(newsz), \\\n (ptr), \\\n &error ) )\n\n#define FT_MEM_QNEW_ARRAY( ptr, count ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n sizeof ( *(ptr) ), \\\n 0, \\\n (FT_Long)(count), \\\n NULL, \\\n &error ) )\n\n#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n sizeof ( *(ptr) ), \\\n (FT_Long)(cursz), \\\n (FT_Long)(newsz), \\\n (ptr), \\\n &error ) )\n\n#define FT_ALLOC( ptr, size ) \\\n FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )\n\n#define FT_REALLOC( ptr, cursz, newsz ) \\\n FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )\n\n#define FT_ALLOC_MULT( ptr, count, item_size ) \\\n FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )\n\n#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \\\n FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt, \\\n newcnt, itmsz ) )\n\n#define FT_QALLOC( ptr, size ) \\\n FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )\n\n#define FT_QREALLOC( ptr, cursz, newsz ) \\\n FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )\n\n#define FT_QALLOC_MULT( ptr, count, item_size ) \\\n FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )\n\n#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \\\n FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt, \\\n newcnt, itmsz ) )\n\n#define FT_FREE( ptr ) FT_MEM_FREE( ptr )\n\n#define FT_NEW( ptr ) FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )\n\n#define FT_NEW_ARRAY( ptr, count ) \\\n FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )\n\n#define FT_RENEW_ARRAY( ptr, curcnt, newcnt ) \\\n FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )\n\n#define FT_QNEW( ptr ) \\\n FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )\n\n#define FT_QNEW_ARRAY( ptr, count ) \\\n FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )\n\n#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt ) \\\n FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )\n\n\n FT_BASE( FT_Pointer )\n ft_mem_strdup( FT_Memory memory,\n const char* str,\n FT_Error *p_error );\n\n FT_BASE( FT_Pointer )\n ft_mem_dup( FT_Memory memory,\n const void* address,\n FT_ULong size,\n FT_Error *p_error );\n\n\n#define FT_MEM_STRDUP( dst, str ) \\\n (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )\n\n#define FT_STRDUP( dst, str ) \\\n FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )\n\n#define FT_MEM_DUP( dst, address, size ) \\\n (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )\n\n#define FT_DUP( dst, address, size ) \\\n FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )\n\n\n /* Return >= 1 if a truncation occurs. */\n /* Return 0 if the source string fits the buffer. */\n /* This is *not* the same as strlcpy(). */\n FT_BASE( FT_Int )\n ft_mem_strcpyn( char* dst,\n const char* src,\n FT_ULong size );\n\n#define FT_STRCPYN( dst, src, size ) \\\n ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTMEMORY_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftobjs.h", "language": "code", "loc": 1042, "comment_density": 0.525, "code": "/****************************************************************************\n *\n * ftobjs.h\n *\n * The FreeType private base classes (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file contains the definition of all internal FreeType classes.\n *\n */\n\n\n#ifndef FTOBJS_H_\n#define FTOBJS_H_\n\n#include \n#include FT_RENDER_H\n#include FT_SIZES_H\n#include FT_LCD_FILTER_H\n#include FT_INTERNAL_MEMORY_H\n#include FT_INTERNAL_GLYPH_LOADER_H\n#include FT_INTERNAL_DRIVER_H\n#include FT_INTERNAL_AUTOHINT_H\n#include FT_INTERNAL_SERVICE_H\n#include FT_INTERNAL_CALC_H\n\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\n#include FT_INCREMENTAL_H\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * Some generic definitions.\n */\n#ifndef TRUE\n#define TRUE 1\n#endif\n\n#ifndef FALSE\n#define FALSE 0\n#endif\n\n#ifndef NULL\n#define NULL (void*)0\n#endif\n\n\n /**************************************************************************\n *\n * The min and max functions missing in C. As usual, be careful not to\n * write things like FT_MIN( a++, b++ ) to avoid side effects.\n */\n#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )\n#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )\n\n#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )\n\n /*\n * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' algorithm.\n * We use alpha = 1, beta = 3/8, giving us results with a largest error\n * less than 7% compared to the exact value.\n */\n#define FT_HYPOT( x, y ) \\\n ( x = FT_ABS( x ), \\\n y = FT_ABS( y ), \\\n x > y ? x + ( 3 * y >> 3 ) \\\n : y + ( 3 * x >> 3 ) )\n\n /* we use FT_TYPEOF to suppress signedness compilation warnings */\n#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) )\n#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n) / 2, n )\n#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n) - 1, n )\n\n#define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )\n#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )\n#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )\n\n /* specialized versions (for signed values) */\n /* that don't produce run-time errors due to integer overflow */\n#define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \\\n n )\n#define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \\\n n )\n#define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) )\n#define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) )\n\n#define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \\\n n )\n#define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \\\n n )\n#define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) )\n#define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) )\n\n\n /*\n * character classification functions -- since these are used to parse font\n * files, we must not use those in which are locale-dependent\n */\n#define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U )\n\n#define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \\\n ( (unsigned)(x) - 'a' ) < 6U || \\\n ( (unsigned)(x) - 'A' ) < 6U )\n\n /* the next two macros assume ASCII representation */\n#define ft_isupper( x ) ( ( (unsigned)(x) - 'A' ) < 26U )\n#define ft_islower( x ) ( ( (unsigned)(x) - 'a' ) < 26U )\n\n#define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) )\n#define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) )\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** C H A R M A P S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n /* handle to internal charmap object */\n typedef struct FT_CMapRec_* FT_CMap;\n\n /* handle to charmap class structure */\n typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;\n\n /* internal charmap object structure */\n typedef struct FT_CMapRec_\n {\n FT_CharMapRec charmap;\n FT_CMap_Class clazz;\n\n } FT_CMapRec;\n\n /* typecast any pointer to a charmap handle */\n#define FT_CMAP( x ) ( (FT_CMap)( x ) )\n\n /* obvious macros */\n#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id\n#define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id\n#define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding\n#define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face\n\n\n /* class method definitions */\n typedef FT_Error\n (*FT_CMap_InitFunc)( FT_CMap cmap,\n FT_Pointer init_data );\n\n typedef void\n (*FT_CMap_DoneFunc)( FT_CMap cmap );\n\n typedef FT_UInt\n (*FT_CMap_CharIndexFunc)( FT_CMap cmap,\n FT_UInt32 char_code );\n\n typedef FT_UInt\n (*FT_CMap_CharNextFunc)( FT_CMap cmap,\n FT_UInt32 *achar_code );\n\n typedef FT_UInt\n (*FT_CMap_CharVarIndexFunc)( FT_CMap cmap,\n FT_CMap unicode_cmap,\n FT_UInt32 char_code,\n FT_UInt32 variant_selector );\n\n typedef FT_Int\n (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap cmap,\n FT_UInt32 char_code,\n FT_UInt32 variant_selector );\n\n typedef FT_UInt32 *\n (*FT_CMap_VariantListFunc)( FT_CMap cmap,\n FT_Memory mem );\n\n typedef FT_UInt32 *\n (*FT_CMap_CharVariantListFunc)( FT_CMap cmap,\n FT_Memory mem,\n FT_UInt32 char_code );\n\n typedef FT_UInt32 *\n (*FT_CMap_VariantCharListFunc)( FT_CMap cmap,\n FT_Memory mem,\n FT_UInt32 variant_selector );\n\n\n typedef struct FT_CMap_ClassRec_\n {\n FT_ULong size;\n\n FT_CMap_InitFunc init;\n FT_CMap_DoneFunc done;\n FT_CMap_CharIndexFunc char_index;\n FT_CMap_CharNextFunc char_next;\n\n /* Subsequent entries are special ones for format 14 -- the variant */\n /* selector subtable which behaves like no other */\n\n FT_CMap_CharVarIndexFunc char_var_index;\n FT_CMap_CharVarIsDefaultFunc char_var_default;\n FT_CMap_VariantListFunc variant_list;\n FT_CMap_CharVariantListFunc charvariant_list;\n FT_CMap_VariantCharListFunc variantchar_list;\n\n } FT_CMap_ClassRec;\n\n\n#define FT_DECLARE_CMAP_CLASS( class_ ) \\\n FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;\n\n#define FT_DEFINE_CMAP_CLASS( \\\n class_, \\\n size_, \\\n init_, \\\n done_, \\\n char_index_, \\\n char_next_, \\\n char_var_index_, \\\n char_var_default_, \\\n variant_list_, \\\n charvariant_list_, \\\n variantchar_list_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_CMap_ClassRec class_ = \\\n { \\\n size_, \\\n init_, \\\n done_, \\\n char_index_, \\\n char_next_, \\\n char_var_index_, \\\n char_var_default_, \\\n variant_list_, \\\n charvariant_list_, \\\n variantchar_list_ \\\n };\n\n\n /* create a new charmap and add it to charmap->face */\n FT_BASE( FT_Error )\n FT_CMap_New( FT_CMap_Class clazz,\n FT_Pointer init_data,\n FT_CharMap charmap,\n FT_CMap *acmap );\n\n /* destroy a charmap and remove it from face's list */\n FT_BASE( void )\n FT_CMap_Done( FT_CMap cmap );\n\n\n /* add LCD padding to CBox */\n FT_BASE( void )\n ft_lcd_padding( FT_BBox* cbox,\n FT_GlyphSlot slot,\n FT_Render_Mode mode );\n\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\n\n typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,\n FT_Byte* weights );\n\n\n /* This is the default LCD filter, an in-place, 5-tap FIR filter. */\n FT_BASE( void )\n ft_lcd_filter_fir( FT_Bitmap* bitmap,\n FT_LcdFiveTapFilter weights );\n\n#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\n\n /**************************************************************************\n *\n * @struct:\n * FT_Face_InternalRec\n *\n * @description:\n * This structure contains the internal fields of each FT_Face object.\n * These fields may change between different releases of FreeType.\n *\n * @fields:\n * max_points ::\n * The maximum number of points used to store the vectorial outline of\n * any glyph in this face. If this value cannot be known in advance,\n * or if the face isn't scalable, this should be set to 0. Only\n * relevant for scalable formats.\n *\n * max_contours ::\n * The maximum number of contours used to store the vectorial outline\n * of any glyph in this face. If this value cannot be known in\n * advance, or if the face isn't scalable, this should be set to 0.\n * Only relevant for scalable formats.\n *\n * transform_matrix ::\n * A 2x2 matrix of 16.16 coefficients used to transform glyph outlines\n * after they are loaded from the font. Only used by the convenience\n * functions.\n *\n * transform_delta ::\n * A translation vector used to transform glyph outlines after they are\n * loaded from the font. Only used by the convenience functions.\n *\n * transform_flags ::\n * Some flags used to classify the transform. Only used by the\n * convenience functions.\n *\n * services ::\n * A cache for frequently used services. It should be only accessed\n * with the macro `FT_FACE_LOOKUP_SERVICE`.\n *\n * incremental_interface ::\n * If non-null, the interface through which glyph data and metrics are\n * loaded incrementally for faces that do not provide all of this data\n * when first opened. This field exists only if\n * @FT_CONFIG_OPTION_INCREMENTAL is defined.\n *\n * no_stem_darkening ::\n * Overrides the module-level default, see @stem-darkening[cff], for\n * example. FALSE and TRUE toggle stem darkening on and off,\n * respectively, value~-1 means to use the module/driver default.\n *\n * random_seed ::\n * If positive, override the seed value for the CFF 'random' operator.\n * Value~0 means to use the font's value. Value~-1 means to use the\n * CFF driver's default.\n *\n * lcd_weights ::\n * lcd_filter_func ::\n * These fields specify the LCD filtering weights and callback function\n * for ClearType-style subpixel rendering.\n *\n * refcount ::\n * A counter initialized to~1 at the time an @FT_Face structure is\n * created. @FT_Reference_Face increments this counter, and\n * @FT_Done_Face only destroys a face if the counter is~1, otherwise it\n * simply decrements it.\n */\n typedef struct FT_Face_InternalRec_\n {\n FT_Matrix transform_matrix;\n FT_Vector transform_delta;\n FT_Int transform_flags;\n\n FT_ServiceCacheRec services;\n\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\n FT_Incremental_InterfaceRec* incremental_interface;\n#endif\n\n FT_Char no_stem_darkening;\n FT_Int32 random_seed;\n\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\n FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */\n FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */\n#endif\n\n FT_Int refcount;\n\n } FT_Face_InternalRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Slot_InternalRec\n *\n * @description:\n * This structure contains the internal fields of each FT_GlyphSlot\n * object. These fields may change between different releases of\n * FreeType.\n *\n * @fields:\n * loader ::\n * The glyph loader object used to load outlines into the glyph slot.\n *\n * flags ::\n * Possible values are zero or FT_GLYPH_OWN_BITMAP. The latter\n * indicates that the FT_GlyphSlot structure owns the bitmap buffer.\n *\n * glyph_transformed ::\n * Boolean. Set to TRUE when the loaded glyph must be transformed\n * through a specific font transformation. This is _not_ the same as\n * the face transform set through FT_Set_Transform().\n *\n * glyph_matrix ::\n * The 2x2 matrix corresponding to the glyph transformation, if\n * necessary.\n *\n * glyph_delta ::\n * The 2d translation vector corresponding to the glyph transformation,\n * if necessary.\n *\n * glyph_hints ::\n * Format-specific glyph hints management.\n *\n * load_flags ::\n * The load flags passed as an argument to @FT_Load_Glyph while\n * initializing the glyph slot.\n */\n\n#define FT_GLYPH_OWN_BITMAP 0x1U\n\n typedef struct FT_Slot_InternalRec_\n {\n FT_GlyphLoader loader;\n FT_UInt flags;\n FT_Bool glyph_transformed;\n FT_Matrix glyph_matrix;\n FT_Vector glyph_delta;\n void* glyph_hints;\n\n FT_Int32 load_flags;\n\n } FT_GlyphSlot_InternalRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Size_InternalRec\n *\n * @description:\n * This structure contains the internal fields of each FT_Size object.\n *\n * @fields:\n * module_data ::\n * Data specific to a driver module.\n *\n * autohint_mode ::\n * The used auto-hinting mode.\n *\n * autohint_metrics ::\n * Metrics used by the auto-hinter.\n *\n */\n\n typedef struct FT_Size_InternalRec_\n {\n void* module_data;\n\n FT_Render_Mode autohint_mode;\n FT_Size_Metrics autohint_metrics;\n\n } FT_Size_InternalRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** M O D U L E S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_ModuleRec\n *\n * @description:\n * A module object instance.\n *\n * @fields:\n * clazz ::\n * A pointer to the module's class.\n *\n * library ::\n * A handle to the parent library object.\n *\n * memory ::\n * A handle to the memory manager.\n */\n typedef struct FT_ModuleRec_\n {\n FT_Module_Class* clazz;\n FT_Library library;\n FT_Memory memory;\n\n } FT_ModuleRec;\n\n\n /* typecast an object to an FT_Module */\n#define FT_MODULE( x ) ( (FT_Module)(x) )\n\n#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz\n#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library\n#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory\n\n\n#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_FONT_DRIVER )\n\n#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_RENDERER )\n\n#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_HINTER )\n\n#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_STYLER )\n\n#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_DRIVER_SCALABLE )\n\n#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_DRIVER_NO_OUTLINES )\n\n#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_DRIVER_HAS_HINTER )\n\n#define FT_DRIVER_HINTS_LIGHTLY( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_DRIVER_HINTS_LIGHTLY )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Module_Interface\n *\n * @description:\n * Finds a module and returns its specific interface as a typeless\n * pointer.\n *\n * @input:\n * library ::\n * A handle to the library object.\n *\n * module_name ::\n * The module's name (as an ASCII string).\n *\n * @return:\n * A module-specific interface if available, 0 otherwise.\n *\n * @note:\n * You should better be familiar with FreeType internals to know which\n * module to look for, and what its interface is :-)\n */\n FT_BASE( const void* )\n FT_Get_Module_Interface( FT_Library library,\n const char* mod_name );\n\n FT_BASE( FT_Pointer )\n ft_module_get_service( FT_Module module,\n const char* service_id,\n FT_Bool global );\n\n#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES\n FT_BASE( FT_Error )\n ft_property_string_set( FT_Library library,\n const FT_String* module_name,\n const FT_String* property_name,\n FT_String* value );\n#endif\n\n /* */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n /* a few macros used to perform easy typecasts with minimal brain damage */\n\n#define FT_FACE( x ) ( (FT_Face)(x) )\n#define FT_SIZE( x ) ( (FT_Size)(x) )\n#define FT_SLOT( x ) ( (FT_GlyphSlot)(x) )\n\n#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver\n#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library\n#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory\n#define FT_FACE_STREAM( x ) FT_FACE( x )->stream\n\n#define FT_SIZE_FACE( x ) FT_SIZE( x )->face\n#define FT_SLOT_FACE( x ) FT_SLOT( x )->face\n\n#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph\n#define FT_FACE_SIZE( x ) FT_FACE( x )->size\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_GlyphSlot\n *\n * @description:\n * It is sometimes useful to have more than one glyph slot for a given\n * face object. This function is used to create additional slots. All\n * of them are automatically discarded when the face is destroyed.\n *\n * @input:\n * face ::\n * A handle to a parent face object.\n *\n * @output:\n * aslot ::\n * A handle to a new glyph slot object.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n FT_BASE( FT_Error )\n FT_New_GlyphSlot( FT_Face face,\n FT_GlyphSlot *aslot );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_GlyphSlot\n *\n * @description:\n * Destroys a given glyph slot. Remember however that all slots are\n * automatically destroyed with its parent. Using this function is not\n * always mandatory.\n *\n * @input:\n * slot ::\n * A handle to a target glyph slot.\n */\n FT_BASE( void )\n FT_Done_GlyphSlot( FT_GlyphSlot slot );\n\n /* */\n\n#define FT_REQUEST_WIDTH( req ) \\\n ( (req)->horiResolution \\\n ? ( (req)->width * (FT_Pos)(req)->horiResolution + 36 ) / 72 \\\n : (req)->width )\n\n#define FT_REQUEST_HEIGHT( req ) \\\n ( (req)->vertResolution \\\n ? ( (req)->height * (FT_Pos)(req)->vertResolution + 36 ) / 72 \\\n : (req)->height )\n\n\n /* Set the metrics according to a bitmap strike. */\n FT_BASE( void )\n FT_Select_Metrics( FT_Face face,\n FT_ULong strike_index );\n\n\n /* Set the metrics according to a size request. */\n FT_BASE( void )\n FT_Request_Metrics( FT_Face face,\n FT_Size_Request req );\n\n\n /* Match a size request against `available_sizes'. */\n FT_BASE( FT_Error )\n FT_Match_Size( FT_Face face,\n FT_Size_Request req,\n FT_Bool ignore_width,\n FT_ULong* size_index );\n\n\n /* Use the horizontal metrics to synthesize the vertical metrics. */\n /* If `advance' is zero, it is also synthesized. */\n FT_BASE( void )\n ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,\n FT_Pos advance );\n\n\n /* Free the bitmap of a given glyphslot when needed (i.e., only when it */\n /* was allocated with ft_glyphslot_alloc_bitmap). */\n FT_BASE( void )\n ft_glyphslot_free_bitmap( FT_GlyphSlot slot );\n\n\n /* Preset bitmap metrics of an outline glyphslot prior to rendering */\n /* and check whether the truncated bbox is too large for rendering. */\n FT_BASE( FT_Bool )\n ft_glyphslot_preset_bitmap( FT_GlyphSlot slot,\n FT_Render_Mode mode,\n const FT_Vector* origin );\n\n /* Allocate a new bitmap buffer in a glyph slot. */\n FT_BASE( FT_Error )\n ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,\n FT_ULong size );\n\n\n /* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */\n /* will not be freed by a later call to ft_glyphslot_free_bitmap. */\n FT_BASE( void )\n ft_glyphslot_set_bitmap( FT_GlyphSlot slot,\n FT_Byte* buffer );\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** R E N D E R E R S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n#define FT_RENDERER( x ) ( (FT_Renderer)(x) )\n#define FT_GLYPH( x ) ( (FT_Glyph)(x) )\n#define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) )\n#define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) )\n\n\n typedef struct FT_RendererRec_\n {\n FT_ModuleRec root;\n FT_Renderer_Class* clazz;\n FT_Glyph_Format glyph_format;\n FT_Glyph_Class glyph_class;\n\n FT_Raster raster;\n FT_Raster_Render_Func raster_render;\n FT_Renderer_RenderFunc render;\n\n } FT_RendererRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** F O N T D R I V E R S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /* typecast a module into a driver easily */\n#define FT_DRIVER( x ) ( (FT_Driver)(x) )\n\n /* typecast a module as a driver, and get its driver class */\n#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_DriverRec\n *\n * @description:\n * The root font driver class. A font driver is responsible for managing\n * and loading font files of a given format.\n *\n * @fields:\n * root ::\n * Contains the fields of the root module class.\n *\n * clazz ::\n * A pointer to the font driver's class. Note that this is NOT\n * root.clazz. 'class' wasn't used as it is a reserved word in C++.\n *\n * faces_list ::\n * The list of faces currently opened by this driver.\n *\n * glyph_loader ::\n * Unused. Used to be glyph loader for all faces managed by this\n * driver.\n */\n typedef struct FT_DriverRec_\n {\n FT_ModuleRec root;\n FT_Driver_Class clazz;\n FT_ListRec faces_list;\n FT_GlyphLoader glyph_loader;\n\n } FT_DriverRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** L I B R A R I E S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_LibraryRec\n *\n * @description:\n * The FreeType library class. This is the root of all FreeType data.\n * Use FT_New_Library() to create a library object, and FT_Done_Library()\n * to discard it and all child objects.\n *\n * @fields:\n * memory ::\n * The library's memory object. Manages memory allocation.\n *\n * version_major ::\n * The major version number of the library.\n *\n * version_minor ::\n * The minor version number of the library.\n *\n * version_patch ::\n * The current patch level of the library.\n *\n * num_modules ::\n * The number of modules currently registered within this library.\n * This is set to 0 for new libraries. New modules are added through\n * the FT_Add_Module() API function.\n *\n * modules ::\n * A table used to store handles to the currently registered\n * modules. Note that each font driver contains a list of its opened\n * faces.\n *\n * renderers ::\n * The list of renderers currently registered within the library.\n *\n * cur_renderer ::\n * The current outline renderer. This is a shortcut used to avoid\n * parsing the list on each call to FT_Outline_Render(). It is a\n * handle to the current renderer for the FT_GLYPH_FORMAT_OUTLINE\n * format.\n *\n * auto_hinter ::\n * The auto-hinter module interface.\n *\n * debug_hooks ::\n * An array of four function pointers that allow debuggers to hook into\n * a font format's interpreter. Currently, only the TrueType bytecode\n * debugger uses this.\n *\n * lcd_weights ::\n * The LCD filter weights for ClearType-style subpixel rendering.\n *\n * lcd_filter_func ::\n * The LCD filtering callback function for ClearType-style subpixel\n * rendering.\n *\n * lcd_geometry ::\n * This array specifies LCD subpixel geometry and controls Harmony LCD\n * rendering technique, alternative to ClearType.\n *\n * pic_container ::\n * Contains global structs and tables, instead of defining them\n * globally.\n *\n * refcount ::\n * A counter initialized to~1 at the time an @FT_Library structure is\n * created. @FT_Reference_Library increments this counter, and\n * @FT_Done_Library only destroys a library if the counter is~1,\n * otherwise it simply decrements it.\n */\n typedef struct FT_LibraryRec_\n {\n FT_Memory memory; /* library's memory manager */\n\n FT_Int version_major;\n FT_Int version_minor;\n FT_Int version_patch;\n\n FT_UInt num_modules;\n FT_Module modules[FT_MAX_MODULES]; /* module objects */\n\n FT_ListRec renderers; /* list of renderers */\n FT_Renderer cur_renderer; /* current outline renderer */\n FT_Module auto_hinter;\n\n FT_DebugHook_Func debug_hooks[4];\n\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\n FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */\n FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */\n#else\n FT_Vector lcd_geometry[3]; /* RGB subpixel positions */\n#endif\n\n FT_Int refcount;\n\n } FT_LibraryRec;\n\n\n FT_BASE( FT_Renderer )\n FT_Lookup_Renderer( FT_Library library,\n FT_Glyph_Format format,\n FT_ListNode* node );\n\n FT_BASE( FT_Error )\n FT_Render_Glyph_Internal( FT_Library library,\n FT_GlyphSlot slot,\n FT_Render_Mode render_mode );\n\n typedef const char*\n (*FT_Face_GetPostscriptNameFunc)( FT_Face face );\n\n typedef FT_Error\n (*FT_Face_GetGlyphNameFunc)( FT_Face face,\n FT_UInt glyph_index,\n FT_Pointer buffer,\n FT_UInt buffer_max );\n\n typedef FT_UInt\n (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face,\n const FT_String* glyph_name );\n\n\n#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Memory\n *\n * @description:\n * Creates a new memory object.\n *\n * @return:\n * A pointer to the new memory object. 0 in case of error.\n */\n FT_BASE( FT_Memory )\n FT_New_Memory( void );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Memory\n *\n * @description:\n * Discards memory manager.\n *\n * @input:\n * memory ::\n * A handle to the memory manager.\n */\n FT_BASE( void )\n FT_Done_Memory( FT_Memory memory );\n\n#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */\n\n\n /* Define default raster's interface. The default raster is located in */\n /* `src/base/ftraster.c'. */\n /* */\n /* Client applications can register new rasters through the */\n /* FT_Set_Raster() API. */\n\n#ifndef FT_NO_DEFAULT_RASTER\n FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;\n#endif\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DEFINE_OUTLINE_FUNCS\n *\n * @description:\n * Used to initialize an instance of FT_Outline_Funcs struct. The struct\n * will be allocated in the global scope (or the scope where the macro is\n * used).\n */\n#define FT_DEFINE_OUTLINE_FUNCS( \\\n class_, \\\n move_to_, \\\n line_to_, \\\n conic_to_, \\\n cubic_to_, \\\n shift_, \\\n delta_ ) \\\n static const FT_Outline_Funcs class_ = \\\n { \\\n move_to_, \\\n line_to_, \\\n conic_to_, \\\n cubic_to_, \\\n shift_, \\\n delta_ \\\n };\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DEFINE_RASTER_FUNCS\n *\n * @description:\n * Used to initialize an instance of FT_Raster_Funcs struct. The struct\n * will be allocated in the global scope (or the scope where the macro is\n * used).\n */\n#define FT_DEFINE_RASTER_FUNCS( \\\n class_, \\\n glyph_format_, \\\n raster_new_, \\\n raster_reset_, \\\n raster_set_mode_, \\\n raster_render_, \\\n raster_done_ ) \\\n const FT_Raster_Funcs class_ = \\\n { \\\n glyph_format_, \\\n raster_new_, \\\n raster_reset_, \\\n raster_set_mode_, \\\n raster_render_, \\\n raster_done_ \\\n };\n\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DEFINE_GLYPH\n *\n * @description:\n * The struct will be allocated in the global scope (or the scope where\n * the macro is used).\n */\n#define FT_DEFINE_GLYPH( \\\n class_, \\\n size_, \\\n format_, \\\n init_, \\\n done_, \\\n copy_, \\\n transform_, \\\n bbox_, \\\n prepare_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_Glyph_Class class_ = \\\n { \\\n size_, \\\n format_, \\\n init_, \\\n done_, \\\n copy_, \\\n transform_, \\\n bbox_, \\\n prepare_ \\\n };\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DECLARE_RENDERER\n *\n * @description:\n * Used to create a forward declaration of a FT_Renderer_Class struct\n * instance.\n *\n * @macro:\n * FT_DEFINE_RENDERER\n *\n * @description:\n * Used to initialize an instance of FT_Renderer_Class struct.\n *\n * The struct will be allocated in the global scope (or the scope where\n * the macro is used).\n */\n#define FT_DECLARE_RENDERER( class_ ) \\\n FT_EXPORT_VAR( const FT_Renderer_Class ) class_;\n\n#define FT_DEFINE_RENDERER( \\\n class_, \\\n flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_, \\\n glyph_format_, \\\n render_glyph_, \\\n transform_glyph_, \\\n get_glyph_cbox_, \\\n set_mode_, \\\n raster_class_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_Renderer_Class class_ = \\\n { \\\n FT_DEFINE_ROOT_MODULE( flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_ ) \\\n glyph_format_, \\\n \\\n render_glyph_, \\\n transform_glyph_, \\\n get_glyph_cbox_, \\\n set_mode_, \\\n \\\n raster_class_ \\\n };\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DECLARE_MODULE\n *\n * @description:\n * Used to create a forward declaration of a FT_Module_Class struct\n * instance.\n *\n * @macro:\n * FT_DEFINE_MODULE\n *\n * @description:\n * Used to initialize an instance of an FT_Module_Class struct.\n *\n * The struct will be allocated in the global scope (or the scope where\n * the macro is used).\n *\n * @macro:\n * FT_DEFINE_ROOT_MODULE\n *\n * @description:\n * Used to initialize an instance of an FT_Module_Class struct inside\n * another struct that contains it or in a function that initializes that\n * containing struct.\n */\n#define FT_DECLARE_MODULE( class_ ) \\\n FT_CALLBACK_TABLE \\\n const FT_Module_Class class_;\n\n#define FT_DEFINE_ROOT_MODULE( \\\n flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_ ) \\\n { \\\n flags_, \\\n size_, \\\n \\\n name_, \\\n version_, \\\n requires_, \\\n \\\n interface_, \\\n \\\n init_, \\\n done_, \\\n get_interface_, \\\n },\n\n#define FT_DEFINE_MODULE( \\\n class_, \\\n flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_Module_Class class_ = \\\n { \\\n flags_, \\\n size_, \\\n \\\n name_, \\\n version_, \\\n requires_, \\\n \\\n interface_, \\\n \\\n init_, \\\n done_, \\\n get_interface_, \\\n };\n\n\nFT_END_HEADER\n\n#endif /* FTOBJS_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftpsprop.h", "language": "code", "loc": 33, "comment_density": 0.606, "code": "/****************************************************************************\n *\n * ftpsprop.h\n *\n * Get and set properties of PostScript drivers (specification).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTPSPROP_H_\n#define FTPSPROP_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n FT_BASE_CALLBACK( FT_Error )\n ps_property_set( FT_Module module, /* PS_Driver */\n const char* property_name,\n const void* value,\n FT_Bool value_is_string );\n\n FT_BASE_CALLBACK( FT_Error )\n ps_property_get( FT_Module module, /* PS_Driver */\n const char* property_name,\n void* value );\n\n\nFT_END_HEADER\n\n\n#endif /* FTPSPROP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftrfork.h", "language": "code", "loc": 215, "comment_density": 0.707, "code": "/****************************************************************************\n *\n * ftrfork.h\n *\n * Embedded resource forks accessor (specification).\n *\n * Copyright (C) 2004-2020 by\n * Masatake YAMATO and Redhat K.K.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n/****************************************************************************\n * Development of the code in this file is support of\n * Information-technology Promotion Agency, Japan.\n */\n\n\n#ifndef FTRFORK_H_\n#define FTRFORK_H_\n\n\n#include \n#include FT_INTERNAL_OBJECTS_H\n\n\nFT_BEGIN_HEADER\n\n\n /* Number of guessing rules supported in `FT_Raccess_Guess'. */\n /* Don't forget to increment the number if you add a new guessing rule. */\n#define FT_RACCESS_N_RULES 9\n\n\n /* A structure to describe a reference in a resource by its resource ID */\n /* and internal offset. The `POST' resource expects to be concatenated */\n /* by the order of resource IDs instead of its appearance in the file. */\n\n typedef struct FT_RFork_Ref_\n {\n FT_Short res_id;\n FT_Long offset;\n\n } FT_RFork_Ref;\n\n\n#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\n typedef FT_Error\n (*ft_raccess_guess_func)( FT_Library library,\n FT_Stream stream,\n char *base_file_name,\n char **result_file_name,\n FT_Long *result_offset );\n\n typedef enum FT_RFork_Rule_ {\n FT_RFork_Rule_invalid = -2,\n FT_RFork_Rule_uknown, /* -1 */\n FT_RFork_Rule_apple_double,\n FT_RFork_Rule_apple_single,\n FT_RFork_Rule_darwin_ufs_export,\n FT_RFork_Rule_darwin_newvfs,\n FT_RFork_Rule_darwin_hfsplus,\n FT_RFork_Rule_vfat,\n FT_RFork_Rule_linux_cap,\n FT_RFork_Rule_linux_double,\n FT_RFork_Rule_linux_netatalk\n } FT_RFork_Rule;\n\n /* For fast translation between rule index and rule type,\n * the macros FT_RFORK_xxx should be kept consistent with the\n * raccess_guess_funcs table\n */\n typedef struct ft_raccess_guess_rec_ {\n ft_raccess_guess_func func;\n FT_RFork_Rule type;\n } ft_raccess_guess_rec;\n\n\n#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \\\n static const type name[] = {\n#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \\\n { raccess_guess_ ## func_suffix, \\\n FT_RFork_Rule_ ## type_suffix },\n /* this array is a storage, thus a final `;' is needed */\n#define CONST_FT_RFORK_RULE_ARRAY_END };\n\n#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Raccess_Guess\n *\n * @description:\n * Guess a file name and offset where the actual resource fork is stored.\n * The macro FT_RACCESS_N_RULES holds the number of guessing rules; the\n * guessed result for the Nth rule is represented as a triplet: a new\n * file name (new_names[N]), a file offset (offsets[N]), and an error\n * code (errors[N]).\n *\n * @input:\n * library ::\n * A FreeType library instance.\n *\n * stream ::\n * A file stream containing the resource fork.\n *\n * base_name ::\n * The (base) file name of the resource fork used for some guessing\n * rules.\n *\n * @output:\n * new_names ::\n * An array of guessed file names in which the resource forks may\n * exist. If 'new_names[N]' is `NULL`, the guessed file name is equal\n * to `base_name`.\n *\n * offsets ::\n * An array of guessed file offsets. 'offsets[N]' holds the file\n * offset of the possible start of the resource fork in file\n * 'new_names[N]'.\n *\n * errors ::\n * An array of FreeType error codes. 'errors[N]' is the error code of\n * Nth guessing rule function. If 'errors[N]' is not FT_Err_Ok,\n * 'new_names[N]' and 'offsets[N]' are meaningless.\n */\n FT_BASE( void )\n FT_Raccess_Guess( FT_Library library,\n FT_Stream stream,\n char* base_name,\n char** new_names,\n FT_Long* offsets,\n FT_Error* errors );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Raccess_Get_HeaderInfo\n *\n * @description:\n * Get the information from the header of resource fork. The information\n * includes the file offset where the resource map starts, and the file\n * offset where the resource data starts. `FT_Raccess_Get_DataOffsets`\n * requires these two data.\n *\n * @input:\n * library ::\n * A FreeType library instance.\n *\n * stream ::\n * A file stream containing the resource fork.\n *\n * rfork_offset ::\n * The file offset where the resource fork starts.\n *\n * @output:\n * map_offset ::\n * The file offset where the resource map starts.\n *\n * rdata_pos ::\n * The file offset where the resource data starts.\n *\n * @return:\n * FreeType error code. FT_Err_Ok means success.\n */\n FT_BASE( FT_Error )\n FT_Raccess_Get_HeaderInfo( FT_Library library,\n FT_Stream stream,\n FT_Long rfork_offset,\n FT_Long *map_offset,\n FT_Long *rdata_pos );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Raccess_Get_DataOffsets\n *\n * @description:\n * Get the data offsets for a tag in a resource fork. Offsets are stored\n * in an array because, in some cases, resources in a resource fork have\n * the same tag.\n *\n * @input:\n * library ::\n * A FreeType library instance.\n *\n * stream ::\n * A file stream containing the resource fork.\n *\n * map_offset ::\n * The file offset where the resource map starts.\n *\n * rdata_pos ::\n * The file offset where the resource data starts.\n *\n * tag ::\n * The resource tag.\n *\n * sort_by_res_id ::\n * A Boolean to sort the fragmented resource by their ids. The\n * fragmented resources for 'POST' resource should be sorted to restore\n * Type1 font properly. For 'sfnt' resources, sorting may induce a\n * different order of the faces in comparison to that by QuickDraw API.\n *\n * @output:\n * offsets ::\n * The stream offsets for the resource data specified by 'tag'. This\n * array is allocated by the function, so you have to call @ft_mem_free\n * after use.\n *\n * count ::\n * The length of offsets array.\n *\n * @return:\n * FreeType error code. FT_Err_Ok means success.\n *\n * @note:\n * Normally you should use `FT_Raccess_Get_HeaderInfo` to get the value\n * for `map_offset` and `rdata_pos`.\n */\n FT_BASE( FT_Error )\n FT_Raccess_Get_DataOffsets( FT_Library library,\n FT_Stream stream,\n FT_Long map_offset,\n FT_Long rdata_pos,\n FT_Long tag,\n FT_Bool sort_by_res_id,\n FT_Long **offsets,\n FT_Long *count );\n\n\nFT_END_HEADER\n\n#endif /* FTRFORK_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftserv.h", "language": "code", "loc": 464, "comment_density": 0.384, "code": "/****************************************************************************\n *\n * ftserv.h\n *\n * The FreeType services (specification only).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n /**************************************************************************\n *\n * Each module can export one or more 'services'. Each service is\n * identified by a constant string and modeled by a pointer; the latter\n * generally corresponds to a structure containing function pointers.\n *\n * Note that a service's data cannot be a mere function pointer because in\n * C it is possible that function pointers might be implemented differently\n * than data pointers (e.g. 48 bits instead of 32).\n *\n */\n\n\n#ifndef FTSERV_H_\n#define FTSERV_H_\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @macro:\n * FT_FACE_FIND_SERVICE\n *\n * @description:\n * This macro is used to look up a service from a face's driver module.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * id ::\n * A string describing the service as defined in the service's header\n * files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to\n * 'multi-masters'). It is automatically prefixed with\n * `FT_SERVICE_ID_`.\n *\n * @output:\n * ptr ::\n * A variable that receives the service pointer. Will be `NULL` if not\n * found.\n */\n#ifdef __cplusplus\n\n#define FT_FACE_FIND_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \\\n FT_Pointer _tmp_ = NULL; \\\n FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \\\n \\\n \\\n if ( module->clazz->get_interface ) \\\n _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \\\n *_pptr_ = _tmp_; \\\n FT_END_STMNT\n\n#else /* !C++ */\n\n#define FT_FACE_FIND_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \\\n FT_Pointer _tmp_ = NULL; \\\n \\\n if ( module->clazz->get_interface ) \\\n _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \\\n ptr = _tmp_; \\\n FT_END_STMNT\n\n#endif /* !C++ */\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_FACE_FIND_GLOBAL_SERVICE\n *\n * @description:\n * This macro is used to look up a service from all modules.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * id ::\n * A string describing the service as defined in the service's header\n * files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to\n * 'multi-masters'). It is automatically prefixed with\n * `FT_SERVICE_ID_`.\n *\n * @output:\n * ptr ::\n * A variable that receives the service pointer. Will be `NULL` if not\n * found.\n */\n#ifdef __cplusplus\n\n#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \\\n FT_Pointer _tmp_; \\\n FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \\\n \\\n \\\n _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id, 1 ); \\\n *_pptr_ = _tmp_; \\\n FT_END_STMNT\n\n#else /* !C++ */\n\n#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \\\n FT_Pointer _tmp_; \\\n \\\n \\\n _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id, 1 ); \\\n ptr = _tmp_; \\\n FT_END_STMNT\n\n#endif /* !C++ */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** S E R V I C E D E S C R I P T O R S *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n /*\n * The following structure is used to _describe_ a given service to the\n * library. This is useful to build simple static service lists.\n */\n typedef struct FT_ServiceDescRec_\n {\n const char* serv_id; /* service name */\n const void* serv_data; /* service pointer/data */\n\n } FT_ServiceDescRec;\n\n typedef const FT_ServiceDescRec* FT_ServiceDesc;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DEFINE_SERVICEDESCREC1\n * FT_DEFINE_SERVICEDESCREC2\n * FT_DEFINE_SERVICEDESCREC3\n * FT_DEFINE_SERVICEDESCREC4\n * FT_DEFINE_SERVICEDESCREC5\n * FT_DEFINE_SERVICEDESCREC6\n * FT_DEFINE_SERVICEDESCREC7\n * FT_DEFINE_SERVICEDESCREC8\n * FT_DEFINE_SERVICEDESCREC9\n * FT_DEFINE_SERVICEDESCREC10\n *\n * @description:\n * Used to initialize an array of FT_ServiceDescRec structures.\n *\n * The array will be allocated in the global scope (or the scope where\n * the macro is used).\n */\n#define FT_DEFINE_SERVICEDESCREC1( class_, \\\n serv_id_1, serv_data_1 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC2( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC3( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC4( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC5( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC6( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC7( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6, \\\n serv_id_7, serv_data_7 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { serv_id_7, serv_data_7 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC8( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6, \\\n serv_id_7, serv_data_7, \\\n serv_id_8, serv_data_8 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { serv_id_7, serv_data_7 }, \\\n { serv_id_8, serv_data_8 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC9( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6, \\\n serv_id_7, serv_data_7, \\\n serv_id_8, serv_data_8, \\\n serv_id_9, serv_data_9 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { serv_id_7, serv_data_7 }, \\\n { serv_id_8, serv_data_8 }, \\\n { serv_id_9, serv_data_9 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC10( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6, \\\n serv_id_7, serv_data_7, \\\n serv_id_8, serv_data_8, \\\n serv_id_9, serv_data_9, \\\n serv_id_10, serv_data_10 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { serv_id_7, serv_data_7 }, \\\n { serv_id_8, serv_data_8 }, \\\n { serv_id_9, serv_data_9 }, \\\n { serv_id_10, serv_data_10 }, \\\n { NULL, NULL } \\\n };\n\n\n /*\n * Parse a list of FT_ServiceDescRec descriptors and look for a specific\n * service by ID. Note that the last element in the array must be { NULL,\n * NULL }, and that the function should return NULL if the service isn't\n * available.\n *\n * This function can be used by modules to implement their `get_service'\n * method.\n */\n FT_BASE( FT_Pointer )\n ft_service_list_lookup( FT_ServiceDesc service_descriptors,\n const char* service_id );\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** S E R V I C E S C A C H E *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n /*\n * This structure is used to store a cache for several frequently used\n * services. It is the type of `face->internal->services'. You should\n * only use FT_FACE_LOOKUP_SERVICE to access it.\n *\n * All fields should have the type FT_Pointer to relax compilation\n * dependencies. We assume the developer isn't completely stupid.\n *\n * Each field must be named `service_XXXX' where `XXX' corresponds to the\n * correct FT_SERVICE_ID_XXXX macro. See the definition of\n * FT_FACE_LOOKUP_SERVICE below how this is implemented.\n *\n */\n typedef struct FT_ServiceCacheRec_\n {\n FT_Pointer service_POSTSCRIPT_FONT_NAME;\n FT_Pointer service_MULTI_MASTERS;\n FT_Pointer service_METRICS_VARIATIONS;\n FT_Pointer service_GLYPH_DICT;\n FT_Pointer service_PFR_METRICS;\n FT_Pointer service_WINFNT;\n\n } FT_ServiceCacheRec, *FT_ServiceCache;\n\n\n /*\n * A magic number used within the services cache.\n */\n\n /* ensure that value `1' has the same width as a pointer */\n#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~(FT_PtrDist)1)\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_FACE_LOOKUP_SERVICE\n *\n * @description:\n * This macro is used to look up a service from a face's driver module\n * using its cache.\n *\n * @input:\n * face ::\n * The source face handle containing the cache.\n *\n * field ::\n * The field name in the cache.\n *\n * id ::\n * The service ID.\n *\n * @output:\n * ptr ::\n * A variable receiving the service data. `NULL` if not available.\n */\n#ifdef __cplusplus\n\n#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Pointer svc; \\\n FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \\\n \\\n \\\n svc = FT_FACE( face )->internal->services. service_ ## id; \\\n if ( svc == FT_SERVICE_UNAVAILABLE ) \\\n svc = NULL; \\\n else if ( svc == NULL ) \\\n { \\\n FT_FACE_FIND_SERVICE( face, svc, id ); \\\n \\\n FT_FACE( face )->internal->services. service_ ## id = \\\n (FT_Pointer)( svc != NULL ? svc \\\n : FT_SERVICE_UNAVAILABLE ); \\\n } \\\n *Pptr = svc; \\\n FT_END_STMNT\n\n#else /* !C++ */\n\n#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Pointer svc; \\\n \\\n \\\n svc = FT_FACE( face )->internal->services. service_ ## id; \\\n if ( svc == FT_SERVICE_UNAVAILABLE ) \\\n svc = NULL; \\\n else if ( svc == NULL ) \\\n { \\\n FT_FACE_FIND_SERVICE( face, svc, id ); \\\n \\\n FT_FACE( face )->internal->services. service_ ## id = \\\n (FT_Pointer)( svc != NULL ? svc \\\n : FT_SERVICE_UNAVAILABLE ); \\\n } \\\n ptr = svc; \\\n FT_END_STMNT\n\n#endif /* !C++ */\n\n /*\n * A macro used to define new service structure types.\n */\n\n#define FT_DEFINE_SERVICE( name ) \\\n typedef struct FT_Service_ ## name ## Rec_ \\\n FT_Service_ ## name ## Rec ; \\\n typedef struct FT_Service_ ## name ## Rec_ \\\n const * FT_Service_ ## name ; \\\n struct FT_Service_ ## name ## Rec_\n\n /* */\n\n /*\n * The header files containing the services.\n */\n\n#define FT_SERVICE_BDF_H \n#define FT_SERVICE_CFF_TABLE_LOAD_H \n#define FT_SERVICE_CID_H \n#define FT_SERVICE_FONT_FORMAT_H \n#define FT_SERVICE_GLYPH_DICT_H \n#define FT_SERVICE_GX_VALIDATE_H \n#define FT_SERVICE_KERNING_H \n#define FT_SERVICE_METRICS_VARIATIONS_H \n#define FT_SERVICE_MULTIPLE_MASTERS_H \n#define FT_SERVICE_OPENTYPE_VALIDATE_H \n#define FT_SERVICE_PFR_H \n#define FT_SERVICE_POSTSCRIPT_CMAPS_H \n#define FT_SERVICE_POSTSCRIPT_INFO_H \n#define FT_SERVICE_POSTSCRIPT_NAME_H \n#define FT_SERVICE_PROPERTIES_H \n#define FT_SERVICE_SFNT_H \n#define FT_SERVICE_TRUETYPE_ENGINE_H \n#define FT_SERVICE_TRUETYPE_GLYF_H \n#define FT_SERVICE_TT_CMAP_H \n#define FT_SERVICE_WINFNT_H \n\n /* */\n\nFT_END_HEADER\n\n#endif /* FTSERV_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftstream.h", "language": "code", "loc": 438, "comment_density": 0.283, "code": "/****************************************************************************\n *\n * ftstream.h\n *\n * Stream handling (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTSTREAM_H_\n#define FTSTREAM_H_\n\n\n#include \n#include FT_SYSTEM_H\n#include FT_INTERNAL_OBJECTS_H\n\n\nFT_BEGIN_HEADER\n\n\n /* format of an 8-bit frame_op value: */\n /* */\n /* bit 76543210 */\n /* xxxxxxes */\n /* */\n /* s is set to 1 if the value is signed. */\n /* e is set to 1 if the value is little-endian. */\n /* xxx is a command. */\n\n#define FT_FRAME_OP_SHIFT 2\n#define FT_FRAME_OP_SIGNED 1\n#define FT_FRAME_OP_LITTLE 2\n#define FT_FRAME_OP_COMMAND( x ) ( x >> FT_FRAME_OP_SHIFT )\n\n#define FT_MAKE_FRAME_OP( command, little, sign ) \\\n ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )\n\n#define FT_FRAME_OP_END 0\n#define FT_FRAME_OP_START 1 /* start a new frame */\n#define FT_FRAME_OP_BYTE 2 /* read 1-byte value */\n#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */\n#define FT_FRAME_OP_LONG 4 /* read 4-byte value */\n#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */\n#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */\n\n\n typedef enum FT_Frame_Op_\n {\n ft_frame_end = 0,\n ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),\n\n ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ),\n ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ),\n\n ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),\n ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),\n ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),\n ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),\n\n ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),\n ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),\n ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),\n ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),\n\n ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),\n ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),\n ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),\n ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),\n\n ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),\n ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )\n\n } FT_Frame_Op;\n\n\n typedef struct FT_Frame_Field_\n {\n FT_Byte value;\n FT_Byte size;\n FT_UShort offset;\n\n } FT_Frame_Field;\n\n\n /* Construct an FT_Frame_Field out of a structure type and a field name. */\n /* The structure type must be set in the FT_STRUCTURE macro before */\n /* calling the FT_FRAME_START() macro. */\n /* */\n#define FT_FIELD_SIZE( f ) \\\n (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )\n\n#define FT_FIELD_SIZE_DELTA( f ) \\\n (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )\n\n#define FT_FIELD_OFFSET( f ) \\\n (FT_UShort)( offsetof( FT_STRUCTURE, f ) )\n\n#define FT_FRAME_FIELD( frame_op, field ) \\\n { \\\n frame_op, \\\n FT_FIELD_SIZE( field ), \\\n FT_FIELD_OFFSET( field ) \\\n }\n\n#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 }\n\n#define FT_FRAME_START( size ) { ft_frame_start, 0, size }\n#define FT_FRAME_END { ft_frame_end, 0, 0 }\n\n#define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f )\n#define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f )\n#define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f )\n#define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f )\n#define FT_FRAME_OFF3( f ) FT_FRAME_FIELD( ft_frame_off3_be, f )\n#define FT_FRAME_UOFF3( f ) FT_FRAME_FIELD( ft_frame_uoff3_be, f )\n#define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f )\n#define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f )\n\n#define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f )\n#define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f )\n#define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f )\n#define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f )\n#define FT_FRAME_OFF3_LE( f ) FT_FRAME_FIELD( ft_frame_off3_le, f )\n#define FT_FRAME_UOFF3_LE( f ) FT_FRAME_FIELD( ft_frame_uoff3_le, f )\n\n#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 }\n#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }\n#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }\n\n#define FT_FRAME_BYTES( field, count ) \\\n { \\\n ft_frame_bytes, \\\n count, \\\n FT_FIELD_OFFSET( field ) \\\n }\n\n#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 }\n\n\n /**************************************************************************\n *\n * Integer extraction macros -- the 'buffer' parameter must ALWAYS be of\n * type 'char*' or equivalent (1-byte elements).\n */\n\n#define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] )\n\n#define FT_INT16( x ) ( (FT_Int16)(x) )\n#define FT_UINT16( x ) ( (FT_UInt16)(x) )\n#define FT_INT32( x ) ( (FT_Int32)(x) )\n#define FT_UINT32( x ) ( (FT_UInt32)(x) )\n\n\n#define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )\n#define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )\n\n\n /*\n * function acts on increases does range for emits\n * pointer checking frames error\n * -------------------------------------------------------------------\n * FT_PEEK_XXX buffer pointer no no no no\n * FT_NEXT_XXX buffer pointer yes no no no\n * FT_GET_XXX stream->cursor yes yes yes no\n * FT_READ_XXX stream->pos yes yes no yes\n */\n\n\n /*\n * `FT_PEEK_XXX' are generic macros to get data from a buffer position. No\n * safety checks are performed.\n */\n#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8 ) | \\\n FT_BYTE_U16( p, 1, 0 ) )\n\n#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \\\n FT_BYTE_U16( p, 1, 0 ) )\n\n#define FT_PEEK_LONG( p ) FT_INT32( FT_BYTE_U32( p, 0, 24 ) | \\\n FT_BYTE_U32( p, 1, 16 ) | \\\n FT_BYTE_U32( p, 2, 8 ) | \\\n FT_BYTE_U32( p, 3, 0 ) )\n\n#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \\\n FT_BYTE_U32( p, 1, 16 ) | \\\n FT_BYTE_U32( p, 2, 8 ) | \\\n FT_BYTE_U32( p, 3, 0 ) )\n\n#define FT_PEEK_OFF3( p ) FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 2, 0 ) )\n\n#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 2, 0 ) )\n\n#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_BYTE_U16( p, 1, 8 ) | \\\n FT_BYTE_U16( p, 0, 0 ) )\n\n#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \\\n FT_BYTE_U16( p, 0, 0 ) )\n\n#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_BYTE_U32( p, 3, 24 ) | \\\n FT_BYTE_U32( p, 2, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 0, 0 ) )\n\n#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \\\n FT_BYTE_U32( p, 2, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 0, 0 ) )\n\n#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 0, 0 ) )\n\n#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 0, 0 ) )\n\n /*\n * `FT_NEXT_XXX' are generic macros to get data from a buffer position\n * which is then increased appropriately. No safety checks are performed.\n */\n#define FT_NEXT_CHAR( buffer ) \\\n ( (signed char)*buffer++ )\n\n#define FT_NEXT_BYTE( buffer ) \\\n ( (unsigned char)*buffer++ )\n\n#define FT_NEXT_SHORT( buffer ) \\\n ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )\n\n#define FT_NEXT_USHORT( buffer ) \\\n ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )\n\n#define FT_NEXT_OFF3( buffer ) \\\n ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )\n\n#define FT_NEXT_UOFF3( buffer ) \\\n ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )\n\n#define FT_NEXT_LONG( buffer ) \\\n ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )\n\n#define FT_NEXT_ULONG( buffer ) \\\n ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )\n\n\n#define FT_NEXT_SHORT_LE( buffer ) \\\n ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )\n\n#define FT_NEXT_USHORT_LE( buffer ) \\\n ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )\n\n#define FT_NEXT_OFF3_LE( buffer ) \\\n ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )\n\n#define FT_NEXT_UOFF3_LE( buffer ) \\\n ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )\n\n#define FT_NEXT_LONG_LE( buffer ) \\\n ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )\n\n#define FT_NEXT_ULONG_LE( buffer ) \\\n ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )\n\n\n /**************************************************************************\n *\n * The `FT_GET_XXX` macros use an implicit 'stream' variable.\n *\n * Note that a call to `FT_STREAM_SEEK` or `FT_STREAM_POS` has **no**\n * effect on `FT_GET_XXX`! They operate on `stream->pos`, while\n * `FT_GET_XXX` use `stream->cursor`.\n */\n#if 0\n#define FT_GET_MACRO( type ) FT_NEXT_ ## type ( stream->cursor )\n\n#define FT_GET_CHAR() FT_GET_MACRO( CHAR )\n#define FT_GET_BYTE() FT_GET_MACRO( BYTE )\n#define FT_GET_SHORT() FT_GET_MACRO( SHORT )\n#define FT_GET_USHORT() FT_GET_MACRO( USHORT )\n#define FT_GET_OFF3() FT_GET_MACRO( OFF3 )\n#define FT_GET_UOFF3() FT_GET_MACRO( UOFF3 )\n#define FT_GET_LONG() FT_GET_MACRO( LONG )\n#define FT_GET_ULONG() FT_GET_MACRO( ULONG )\n#define FT_GET_TAG4() FT_GET_MACRO( ULONG )\n\n#define FT_GET_SHORT_LE() FT_GET_MACRO( SHORT_LE )\n#define FT_GET_USHORT_LE() FT_GET_MACRO( USHORT_LE )\n#define FT_GET_LONG_LE() FT_GET_MACRO( LONG_LE )\n#define FT_GET_ULONG_LE() FT_GET_MACRO( ULONG_LE )\n\n#else\n#define FT_GET_MACRO( func, type ) ( (type)func( stream ) )\n\n#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char )\n#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )\n#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_Short )\n#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )\n#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )\n#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )\n#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetULong, FT_Long )\n#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )\n#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )\n\n#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short )\n#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort )\n#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long )\n#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong )\n#endif\n\n\n#define FT_READ_MACRO( func, type, var ) \\\n ( var = (type)func( stream, &error ), \\\n error != FT_Err_Ok )\n\n /*\n * The `FT_READ_XXX' macros use implicit `stream' and `error' variables.\n *\n * `FT_READ_XXX' can be controlled with `FT_STREAM_SEEK' and\n * `FT_STREAM_POS'. They use the full machinery to check whether a read is\n * valid.\n */\n#define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )\n#define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )\n#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var )\n#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )\n#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )\n#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )\n#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )\n#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )\n\n#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var )\n#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var )\n#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var )\n#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var )\n\n\n#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM\n\n /* initialize a stream for reading a regular system stream */\n FT_BASE( FT_Error )\n FT_Stream_Open( FT_Stream stream,\n const char* filepathname );\n\n#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */\n\n\n /* create a new (input) stream from an FT_Open_Args structure */\n FT_BASE( FT_Error )\n FT_Stream_New( FT_Library library,\n const FT_Open_Args* args,\n FT_Stream *astream );\n\n /* free a stream */\n FT_BASE( void )\n FT_Stream_Free( FT_Stream stream,\n FT_Int external );\n\n /* initialize a stream for reading in-memory data */\n FT_BASE( void )\n FT_Stream_OpenMemory( FT_Stream stream,\n const FT_Byte* base,\n FT_ULong size );\n\n /* close a stream (does not destroy the stream structure) */\n FT_BASE( void )\n FT_Stream_Close( FT_Stream stream );\n\n\n /* seek within a stream. position is relative to start of stream */\n FT_BASE( FT_Error )\n FT_Stream_Seek( FT_Stream stream,\n FT_ULong pos );\n\n /* skip bytes in a stream */\n FT_BASE( FT_Error )\n FT_Stream_Skip( FT_Stream stream,\n FT_Long distance );\n\n /* return current stream position */\n FT_BASE( FT_ULong )\n FT_Stream_Pos( FT_Stream stream );\n\n /* read bytes from a stream into a user-allocated buffer, returns an */\n /* error if not all bytes could be read. */\n FT_BASE( FT_Error )\n FT_Stream_Read( FT_Stream stream,\n FT_Byte* buffer,\n FT_ULong count );\n\n /* read bytes from a stream at a given position */\n FT_BASE( FT_Error )\n FT_Stream_ReadAt( FT_Stream stream,\n FT_ULong pos,\n FT_Byte* buffer,\n FT_ULong count );\n\n /* try to read bytes at the end of a stream; return number of bytes */\n /* really available */\n FT_BASE( FT_ULong )\n FT_Stream_TryRead( FT_Stream stream,\n FT_Byte* buffer,\n FT_ULong count );\n\n /* Enter a frame of `count' consecutive bytes in a stream. Returns an */\n /* error if the frame could not be read/accessed. The caller can use */\n /* the `FT_Stream_GetXXX' functions to retrieve frame data without */\n /* error checks. */\n /* */\n /* You must _always_ call `FT_Stream_ExitFrame' once you have entered */\n /* a stream frame! */\n /* */\n /* Nested frames are not permitted. */\n /* */\n FT_BASE( FT_Error )\n FT_Stream_EnterFrame( FT_Stream stream,\n FT_ULong count );\n\n /* exit a stream frame */\n FT_BASE( void )\n FT_Stream_ExitFrame( FT_Stream stream );\n\n\n /* Extract a stream frame. If the stream is disk-based, a heap block */\n /* is allocated and the frame bytes are read into it. If the stream */\n /* is memory-based, this function simply sets a pointer to the data. */\n /* */\n /* Useful to optimize access to memory-based streams transparently. */\n /* */\n /* `FT_Stream_GetXXX' functions can't be used. */\n /* */\n /* An extracted frame must be `freed' with a call to the function */\n /* `FT_Stream_ReleaseFrame'. */\n /* */\n FT_BASE( FT_Error )\n FT_Stream_ExtractFrame( FT_Stream stream,\n FT_ULong count,\n FT_Byte** pbytes );\n\n /* release an extract frame (see `FT_Stream_ExtractFrame') */\n FT_BASE( void )\n FT_Stream_ReleaseFrame( FT_Stream stream,\n FT_Byte** pbytes );\n\n\n /* read a byte from an entered frame */\n FT_BASE( FT_Char )\n FT_Stream_GetChar( FT_Stream stream );\n\n /* read a 16-bit big-endian unsigned integer from an entered frame */\n FT_BASE( FT_UShort )\n FT_Stream_GetUShort( FT_Stream stream );\n\n /* read a 24-bit big-endian unsigned integer from an entered frame */\n FT_BASE( FT_ULong )\n FT_Stream_GetUOffset( FT_Stream stream );\n\n /* read a 32-bit big-endian unsigned integer from an entered frame */\n FT_BASE( FT_ULong )\n FT_Stream_GetULong( FT_Stream stream );\n\n /* read a 16-bit little-endian unsigned integer from an entered frame */\n FT_BASE( FT_UShort )\n FT_Stream_GetUShortLE( FT_Stream stream );\n\n /* read a 32-bit little-endian unsigned integer from an entered frame */\n FT_BASE( FT_ULong )\n FT_Stream_GetULongLE( FT_Stream stream );\n\n\n /* read a byte from a stream */\n FT_BASE( FT_Char )\n FT_Stream_ReadChar( FT_Stream stream,\n FT_Error* error );\n\n /* read a 16-bit big-endian unsigned integer from a stream */\n FT_BASE( FT_UShort )\n FT_Stream_ReadUShort( FT_Stream stream,\n FT_Error* error );\n\n /* read a 24-bit big-endian unsigned integer from a stream */\n FT_BASE( FT_ULong )\n FT_Stream_ReadUOffset( FT_Stream stream,\n FT_Error* error );\n\n /* read a 32-bit big-endian integer from a stream */\n FT_BASE( FT_ULong )\n FT_Stream_ReadULong( FT_Stream stream,\n FT_Error* error );\n\n /* read a 16-bit little-endian unsigned integer from a stream */\n FT_BASE( FT_UShort )\n FT_Stream_ReadUShortLE( FT_Stream stream,\n FT_Error* error );\n\n /* read a 32-bit little-endian unsigned integer from a stream */\n FT_BASE( FT_ULong )\n FT_Stream_ReadULongLE( FT_Stream stream,\n FT_Error* error );\n\n /* Read a structure from a stream. The structure must be described */\n /* by an array of FT_Frame_Field records. */\n FT_BASE( FT_Error )\n FT_Stream_ReadFields( FT_Stream stream,\n const FT_Frame_Field* fields,\n void* structure );\n\n\n#define FT_STREAM_POS() \\\n FT_Stream_Pos( stream )\n\n#define FT_STREAM_SEEK( position ) \\\n FT_SET_ERROR( FT_Stream_Seek( stream, \\\n (FT_ULong)(position) ) )\n\n#define FT_STREAM_SKIP( distance ) \\\n FT_SET_ERROR( FT_Stream_Skip( stream, \\\n (FT_Long)(distance) ) )\n\n#define FT_STREAM_READ( buffer, count ) \\\n FT_SET_ERROR( FT_Stream_Read( stream, \\\n (FT_Byte*)(buffer), \\\n (FT_ULong)(count) ) )\n\n#define FT_STREAM_READ_AT( position, buffer, count ) \\\n FT_SET_ERROR( FT_Stream_ReadAt( stream, \\\n (FT_ULong)(position), \\\n (FT_Byte*)(buffer), \\\n (FT_ULong)(count) ) )\n\n#define FT_STREAM_READ_FIELDS( fields, object ) \\\n FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )\n\n\n#define FT_FRAME_ENTER( size ) \\\n FT_SET_ERROR( \\\n FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, \\\n (FT_ULong)(size) ) ) )\n\n#define FT_FRAME_EXIT() \\\n FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )\n\n#define FT_FRAME_EXTRACT( size, bytes ) \\\n FT_SET_ERROR( \\\n FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, \\\n (FT_ULong)(size), \\\n (FT_Byte**)&(bytes) ) ) )\n\n#define FT_FRAME_RELEASE( bytes ) \\\n FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, \\\n (FT_Byte**)&(bytes) ) )\n\n\nFT_END_HEADER\n\n#endif /* FTSTREAM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/fttrace.h", "language": "code", "loc": 135, "comment_density": 0.548, "code": "/****************************************************************************\n *\n * fttrace.h\n *\n * Tracing handling (specification only).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /* definitions of trace levels for FreeType 2 */\n\n /* the first level must always be `trace_any' */\nFT_TRACE_DEF( any )\n\n /* base components */\nFT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */\nFT_TRACE_DEF( gloader ) /* glyph loader (ftgloadr.c) */\nFT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */\nFT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */\nFT_TRACE_DEF( init ) /* initialization (ftinit.c) */\nFT_TRACE_DEF( io ) /* i/o interface (ftsystem.c) */\nFT_TRACE_DEF( list ) /* list management (ftlist.c) */\nFT_TRACE_DEF( objs ) /* base objects (ftobjs.c) */\nFT_TRACE_DEF( outline ) /* outline management (ftoutln.c) */\nFT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */\n\nFT_TRACE_DEF( bitmap ) /* bitmap manipulation (ftbitmap.c) */\nFT_TRACE_DEF( checksum ) /* bitmap checksum (ftobjs.c) */\nFT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */\nFT_TRACE_DEF( psprops ) /* PS driver properties (ftpsprop.c) */\nFT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */\nFT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */\nFT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */\nFT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */\n\n /* Cache sub-system */\nFT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */\n\n /* SFNT driver components */\nFT_TRACE_DEF( sfdriver ) /* SFNT font driver (sfdriver.c) */\nFT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */\nFT_TRACE_DEF( sfwoff ) /* WOFF format handler (sfwoff.c) */\nFT_TRACE_DEF( sfwoff2 ) /* WOFF2 format handler (sfwoff2.c) */\nFT_TRACE_DEF( ttbdf ) /* TrueType embedded BDF (ttbdf.c) */\nFT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */\nFT_TRACE_DEF( ttcolr ) /* glyph layer table (ttcolr.c) */\nFT_TRACE_DEF( ttcpal ) /* color palette table (ttcpal.c) */\nFT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */\nFT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */\nFT_TRACE_DEF( ttmtx ) /* metrics-related tables (ttmtx.c) */\nFT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */\nFT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */\n\n /* TrueType driver components */\nFT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */\nFT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */\nFT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */\nFT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */\nFT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */\nFT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */\n\n /* Type 1 driver components */\nFT_TRACE_DEF( t1afm )\nFT_TRACE_DEF( t1driver )\nFT_TRACE_DEF( t1gload )\nFT_TRACE_DEF( t1load )\nFT_TRACE_DEF( t1objs )\nFT_TRACE_DEF( t1parse )\n\n /* PostScript helper module `psaux' */\nFT_TRACE_DEF( cffdecode )\nFT_TRACE_DEF( psconv )\nFT_TRACE_DEF( psobjs )\nFT_TRACE_DEF( t1decode )\n\n /* PostScript hinting module `pshinter' */\nFT_TRACE_DEF( pshalgo )\nFT_TRACE_DEF( pshrec )\n\n /* Type 2 driver components */\nFT_TRACE_DEF( cffdriver )\nFT_TRACE_DEF( cffgload )\nFT_TRACE_DEF( cffload )\nFT_TRACE_DEF( cffobjs )\nFT_TRACE_DEF( cffparse )\n\nFT_TRACE_DEF( cf2blues )\nFT_TRACE_DEF( cf2hints )\nFT_TRACE_DEF( cf2interp )\n\n /* Type 42 driver component */\nFT_TRACE_DEF( t42 )\n\n /* CID driver components */\nFT_TRACE_DEF( ciddriver )\nFT_TRACE_DEF( cidgload )\nFT_TRACE_DEF( cidload )\nFT_TRACE_DEF( cidobjs )\nFT_TRACE_DEF( cidparse )\n\n /* Windows font component */\nFT_TRACE_DEF( winfnt )\n\n /* PCF font components */\nFT_TRACE_DEF( pcfdriver )\nFT_TRACE_DEF( pcfread )\n\n /* BDF font components */\nFT_TRACE_DEF( bdfdriver )\nFT_TRACE_DEF( bdflib )\n\n /* PFR font component */\nFT_TRACE_DEF( pfr )\n\n /* OpenType validation components */\nFT_TRACE_DEF( otvcommon )\nFT_TRACE_DEF( otvbase )\nFT_TRACE_DEF( otvgdef )\nFT_TRACE_DEF( otvgpos )\nFT_TRACE_DEF( otvgsub )\nFT_TRACE_DEF( otvjstf )\nFT_TRACE_DEF( otvmath )\nFT_TRACE_DEF( otvmodule )\n\n /* TrueTypeGX/AAT validation components */\nFT_TRACE_DEF( gxvbsln )\nFT_TRACE_DEF( gxvcommon )\nFT_TRACE_DEF( gxvfeat )\nFT_TRACE_DEF( gxvjust )\nFT_TRACE_DEF( gxvkern )\nFT_TRACE_DEF( gxvmodule )\nFT_TRACE_DEF( gxvmort )\nFT_TRACE_DEF( gxvmorx )\nFT_TRACE_DEF( gxvlcar )\nFT_TRACE_DEF( gxvopbd )\nFT_TRACE_DEF( gxvprop )\nFT_TRACE_DEF( gxvtrak )\n\n /* autofit components */\nFT_TRACE_DEF( afcjk )\nFT_TRACE_DEF( afglobal )\nFT_TRACE_DEF( afhints )\nFT_TRACE_DEF( afmodule )\nFT_TRACE_DEF( aflatin )\nFT_TRACE_DEF( aflatin2 )\nFT_TRACE_DEF( afshaper )\nFT_TRACE_DEF( afwarp )\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftvalid.h", "language": "code", "loc": 125, "comment_density": 0.648, "code": "/****************************************************************************\n *\n * ftvalid.h\n *\n * FreeType validation support (specification).\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTVALID_H_\n#define FTVALID_H_\n\n#include \n#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */\n\n\nFT_BEGIN_HEADER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** V A L I D A T I O N ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n /* handle to a validation object */\n typedef struct FT_ValidatorRec_ volatile* FT_Validator;\n\n\n /**************************************************************************\n *\n * There are three distinct validation levels defined here:\n *\n * FT_VALIDATE_DEFAULT ::\n * A table that passes this validation level can be used reliably by\n * FreeType. It generally means that all offsets have been checked to\n * prevent out-of-bound reads, that array counts are correct, etc.\n *\n * FT_VALIDATE_TIGHT ::\n * A table that passes this validation level can be used reliably and\n * doesn't contain invalid data. For example, a charmap table that\n * returns invalid glyph indices will not pass, even though it can be\n * used with FreeType in default mode (the library will simply return an\n * error later when trying to load the glyph).\n *\n * It also checks that fields which must be a multiple of 2, 4, or 8,\n * don't have incorrect values, etc.\n *\n * FT_VALIDATE_PARANOID ::\n * Only for font debugging. Checks that a table follows the\n * specification by 100%. Very few fonts will be able to pass this level\n * anyway but it can be useful for certain tools like font\n * editors/converters.\n */\n typedef enum FT_ValidationLevel_\n {\n FT_VALIDATE_DEFAULT = 0,\n FT_VALIDATE_TIGHT,\n FT_VALIDATE_PARANOID\n\n } FT_ValidationLevel;\n\n\n#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */\n /* We disable the warning `structure was padded due to */\n /* __declspec(align())' in order to compile cleanly with */\n /* the maximum level of warnings. */\n#pragma warning( push )\n#pragma warning( disable : 4324 )\n#endif /* _MSC_VER */\n\n /* validator structure */\n typedef struct FT_ValidatorRec_\n {\n ft_jmp_buf jump_buffer; /* used for exception handling */\n\n const FT_Byte* base; /* address of table in memory */\n const FT_Byte* limit; /* `base' + sizeof(table) in memory */\n FT_ValidationLevel level; /* validation level */\n FT_Error error; /* error returned. 0 means success */\n\n } FT_ValidatorRec;\n\n#if defined( _MSC_VER )\n#pragma warning( pop )\n#endif\n\n#define FT_VALIDATOR( x ) ( (FT_Validator)( x ) )\n\n\n FT_BASE( void )\n ft_validator_init( FT_Validator valid,\n const FT_Byte* base,\n const FT_Byte* limit,\n FT_ValidationLevel level );\n\n /* Do not use this. It's broken and will cause your validator to crash */\n /* if you run it on an invalid font. */\n FT_BASE( FT_Int )\n ft_validator_run( FT_Validator valid );\n\n /* Sets the error field in a validator, then calls `longjmp' to return */\n /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */\n /* error checks within the validation routines. */\n /* */\n FT_BASE( void )\n ft_validator_error( FT_Validator valid,\n FT_Error error );\n\n\n /* Calls ft_validate_error. Assumes that the `valid' local variable */\n /* holds a pointer to the current validator object. */\n /* */\n#define FT_INVALID( _error ) FT_INVALID_( _error )\n#define FT_INVALID_( _error ) \\\n ft_validator_error( valid, FT_THROW( _error ) )\n\n /* called when a broken table is detected */\n#define FT_INVALID_TOO_SHORT \\\n FT_INVALID( Invalid_Table )\n\n /* called when an invalid offset is detected */\n#define FT_INVALID_OFFSET \\\n FT_INVALID( Invalid_Offset )\n\n /* called when an invalid format/value is detected */\n#define FT_INVALID_FORMAT \\\n FT_INVALID( Invalid_Table )\n\n /* called when an invalid glyph index is detected */\n#define FT_INVALID_GLYPH_ID \\\n FT_INVALID( Invalid_Glyph_Index )\n\n /* called when an invalid field value is detected */\n#define FT_INVALID_DATA \\\n FT_INVALID( Invalid_Table )\n\n\nFT_END_HEADER\n\n#endif /* FTVALID_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/internal.h", "language": "code", "loc": 53, "comment_density": 0.566, "code": "/****************************************************************************\n *\n * internal.h\n *\n * Internal header files (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file is automatically included by `ft2build.h`. Do not include it\n * manually!\n *\n */\n\n\n#define FT_INTERNAL_OBJECTS_H \n#define FT_INTERNAL_STREAM_H \n#define FT_INTERNAL_MEMORY_H \n#define FT_INTERNAL_DEBUG_H \n#define FT_INTERNAL_CALC_H \n#define FT_INTERNAL_HASH_H \n#define FT_INTERNAL_DRIVER_H \n#define FT_INTERNAL_TRACE_H \n#define FT_INTERNAL_GLYPH_LOADER_H \n#define FT_INTERNAL_SFNT_H \n#define FT_INTERNAL_SERVICE_H \n#define FT_INTERNAL_RFORK_H \n#define FT_INTERNAL_VALIDATE_H \n\n#define FT_INTERNAL_TRUETYPE_TYPES_H \n#define FT_INTERNAL_TYPE1_TYPES_H \n#define FT_INTERNAL_WOFF_TYPES_H \n\n#define FT_INTERNAL_POSTSCRIPT_AUX_H \n#define FT_INTERNAL_POSTSCRIPT_HINTS_H \n#define FT_INTERNAL_POSTSCRIPT_PROPS_H \n\n#define FT_INTERNAL_AUTOHINT_H \n\n#define FT_INTERNAL_CFF_TYPES_H \n#define FT_INTERNAL_CFF_OBJECTS_TYPES_H \n\n\n#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */\n\n /* We disable the warning `conditional expression is constant' here */\n /* in order to compile cleanly with the maximum level of warnings. */\n /* In particular, the warning complains about stuff like `while(0)' */\n /* which is very useful in macro definitions. There is no benefit */\n /* in having it enabled. */\n#pragma warning( disable : 4127 )\n\n#endif /* _MSC_VER */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/psaux.h", "language": "code", "loc": 1143, "comment_density": 0.434, "code": "/****************************************************************************\n *\n * psaux.h\n *\n * Auxiliary functions and data structures related to PostScript fonts\n * (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef PSAUX_H_\n#define PSAUX_H_\n\n\n#include \n#include FT_INTERNAL_OBJECTS_H\n#include FT_INTERNAL_TYPE1_TYPES_H\n#include FT_INTERNAL_HASH_H\n#include FT_INTERNAL_TRUETYPE_TYPES_H\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\n#include FT_INTERNAL_CFF_TYPES_H\n#include FT_INTERNAL_CFF_OBJECTS_TYPES_H\n\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * PostScript modules driver class.\n */\n typedef struct PS_DriverRec_\n {\n FT_DriverRec root;\n\n FT_UInt hinting_engine;\n FT_Bool no_stem_darkening;\n FT_Int darken_params[8];\n FT_Int32 random_seed;\n\n } PS_DriverRec, *PS_Driver;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1_TABLE *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct PS_TableRec_* PS_Table;\n typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_Table_FuncsRec\n *\n * @description:\n * A set of function pointers to manage PS_Table objects.\n *\n * @fields:\n * table_init ::\n * Used to initialize a table.\n *\n * table_done ::\n * Finalizes resp. destroy a given table.\n *\n * table_add ::\n * Adds a new object to a table.\n *\n * table_release ::\n * Releases table data, then finalizes it.\n */\n typedef struct PS_Table_FuncsRec_\n {\n FT_Error\n (*init)( PS_Table table,\n FT_Int count,\n FT_Memory memory );\n\n void\n (*done)( PS_Table table );\n\n FT_Error\n (*add)( PS_Table table,\n FT_Int idx,\n const void* object,\n FT_UInt length );\n\n void\n (*release)( PS_Table table );\n\n } PS_Table_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_TableRec\n *\n * @description:\n * A PS_Table is a simple object used to store an array of objects in a\n * single memory block.\n *\n * @fields:\n * block ::\n * The address in memory of the growheap's block. This can change\n * between two object adds, due to reallocation.\n *\n * cursor ::\n * The current top of the grow heap within its block.\n *\n * capacity ::\n * The current size of the heap block. Increments by 1kByte chunks.\n *\n * init ::\n * Set to 0xDEADBEEF if 'elements' and 'lengths' have been allocated.\n *\n * max_elems ::\n * The maximum number of elements in table.\n *\n * num_elems ::\n * The current number of elements in table.\n *\n * elements ::\n * A table of element addresses within the block.\n *\n * lengths ::\n * A table of element sizes within the block.\n *\n * memory ::\n * The object used for memory operations (alloc/realloc).\n *\n * funcs ::\n * A table of method pointers for this object.\n */\n typedef struct PS_TableRec_\n {\n FT_Byte* block; /* current memory block */\n FT_Offset cursor; /* current cursor in memory block */\n FT_Offset capacity; /* current size of memory block */\n FT_ULong init;\n\n FT_Int max_elems;\n FT_Int num_elems;\n FT_Byte** elements; /* addresses of table elements */\n FT_UInt* lengths; /* lengths of table elements */\n\n FT_Memory memory;\n PS_Table_FuncsRec funcs;\n\n } PS_TableRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1 FIELDS & TOKENS *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct PS_ParserRec_* PS_Parser;\n\n typedef struct T1_TokenRec_* T1_Token;\n\n typedef struct T1_FieldRec_* T1_Field;\n\n\n /* simple enumeration type used to identify token types */\n typedef enum T1_TokenType_\n {\n T1_TOKEN_TYPE_NONE = 0,\n T1_TOKEN_TYPE_ANY,\n T1_TOKEN_TYPE_STRING,\n T1_TOKEN_TYPE_ARRAY,\n T1_TOKEN_TYPE_KEY, /* aka `name' */\n\n /* do not remove */\n T1_TOKEN_TYPE_MAX\n\n } T1_TokenType;\n\n\n /* a simple structure used to identify tokens */\n typedef struct T1_TokenRec_\n {\n FT_Byte* start; /* first character of token in input stream */\n FT_Byte* limit; /* first character after the token */\n T1_TokenType type; /* type of token */\n\n } T1_TokenRec;\n\n\n /* enumeration type used to identify object fields */\n typedef enum T1_FieldType_\n {\n T1_FIELD_TYPE_NONE = 0,\n T1_FIELD_TYPE_BOOL,\n T1_FIELD_TYPE_INTEGER,\n T1_FIELD_TYPE_FIXED,\n T1_FIELD_TYPE_FIXED_1000,\n T1_FIELD_TYPE_STRING,\n T1_FIELD_TYPE_KEY,\n T1_FIELD_TYPE_BBOX,\n T1_FIELD_TYPE_MM_BBOX,\n T1_FIELD_TYPE_INTEGER_ARRAY,\n T1_FIELD_TYPE_FIXED_ARRAY,\n T1_FIELD_TYPE_CALLBACK,\n\n /* do not remove */\n T1_FIELD_TYPE_MAX\n\n } T1_FieldType;\n\n\n typedef enum T1_FieldLocation_\n {\n T1_FIELD_LOCATION_CID_INFO,\n T1_FIELD_LOCATION_FONT_DICT,\n T1_FIELD_LOCATION_FONT_EXTRA,\n T1_FIELD_LOCATION_FONT_INFO,\n T1_FIELD_LOCATION_PRIVATE,\n T1_FIELD_LOCATION_BBOX,\n T1_FIELD_LOCATION_LOADER,\n T1_FIELD_LOCATION_FACE,\n T1_FIELD_LOCATION_BLEND,\n\n /* do not remove */\n T1_FIELD_LOCATION_MAX\n\n } T1_FieldLocation;\n\n\n typedef void\n (*T1_Field_ParseFunc)( FT_Face face,\n FT_Pointer parser );\n\n\n /* structure type used to model object fields */\n typedef struct T1_FieldRec_\n {\n const char* ident; /* field identifier */\n T1_FieldLocation location;\n T1_FieldType type; /* type of field */\n T1_Field_ParseFunc reader;\n FT_UInt offset; /* offset of field in object */\n FT_Byte size; /* size of field in bytes */\n FT_UInt array_max; /* maximum number of elements for */\n /* array */\n FT_UInt count_offset; /* offset of element count for */\n /* arrays; must not be zero if in */\n /* use -- in other words, a */\n /* `num_FOO' element must not */\n /* start the used structure if we */\n /* parse a `FOO' array */\n FT_UInt dict; /* where we expect it */\n } T1_FieldRec;\n\n#define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */\n#define T1_FIELD_DICT_PRIVATE ( 1 << 1 )\n\n\n\n#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \\\n { \\\n _ident, T1CODE, _type, \\\n 0, \\\n FT_FIELD_OFFSET( _fname ), \\\n FT_FIELD_SIZE( _fname ), \\\n 0, 0, \\\n _dict \\\n },\n\n#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \\\n { \\\n _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \\\n (T1_Field_ParseFunc)_reader, \\\n 0, 0, \\\n 0, 0, \\\n _dict \\\n },\n\n#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \\\n { \\\n _ident, T1CODE, _type, \\\n 0, \\\n FT_FIELD_OFFSET( _fname ), \\\n FT_FIELD_SIZE_DELTA( _fname ), \\\n _max, \\\n FT_FIELD_OFFSET( num_ ## _fname ), \\\n _dict \\\n },\n\n#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \\\n { \\\n _ident, T1CODE, _type, \\\n 0, \\\n FT_FIELD_OFFSET( _fname ), \\\n FT_FIELD_SIZE_DELTA( _fname ), \\\n _max, 0, \\\n _dict \\\n },\n\n\n#define T1_FIELD_BOOL( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )\n\n#define T1_FIELD_NUM( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )\n\n#define T1_FIELD_FIXED( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )\n\n#define T1_FIELD_FIXED_1000( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \\\n _dict )\n\n#define T1_FIELD_STRING( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )\n\n#define T1_FIELD_KEY( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )\n\n#define T1_FIELD_BBOX( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )\n\n\n#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict ) \\\n T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \\\n _fname, _fmax, _dict )\n\n#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict ) \\\n T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \\\n _fname, _fmax, _dict )\n\n#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict ) \\\n T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \\\n _fname, _fmax, _dict )\n\n#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict ) \\\n T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \\\n _fname, _fmax, _dict )\n\n#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \\\n T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1 PARSER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs;\n\n typedef struct PS_Parser_FuncsRec_\n {\n void\n (*init)( PS_Parser parser,\n FT_Byte* base,\n FT_Byte* limit,\n FT_Memory memory );\n\n void\n (*done)( PS_Parser parser );\n\n void\n (*skip_spaces)( PS_Parser parser );\n void\n (*skip_PS_token)( PS_Parser parser );\n\n FT_Long\n (*to_int)( PS_Parser parser );\n FT_Fixed\n (*to_fixed)( PS_Parser parser,\n FT_Int power_ten );\n\n FT_Error\n (*to_bytes)( PS_Parser parser,\n FT_Byte* bytes,\n FT_Offset max_bytes,\n FT_ULong* pnum_bytes,\n FT_Bool delimiters );\n\n FT_Int\n (*to_coord_array)( PS_Parser parser,\n FT_Int max_coords,\n FT_Short* coords );\n FT_Int\n (*to_fixed_array)( PS_Parser parser,\n FT_Int max_values,\n FT_Fixed* values,\n FT_Int power_ten );\n\n void\n (*to_token)( PS_Parser parser,\n T1_Token token );\n void\n (*to_token_array)( PS_Parser parser,\n T1_Token tokens,\n FT_UInt max_tokens,\n FT_Int* pnum_tokens );\n\n FT_Error\n (*load_field)( PS_Parser parser,\n const T1_Field field,\n void** objects,\n FT_UInt max_objects,\n FT_ULong* pflags );\n\n FT_Error\n (*load_field_table)( PS_Parser parser,\n const T1_Field field,\n void** objects,\n FT_UInt max_objects,\n FT_ULong* pflags );\n\n } PS_Parser_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_ParserRec\n *\n * @description:\n * A PS_Parser is an object used to parse a Type 1 font very quickly.\n *\n * @fields:\n * cursor ::\n * The current position in the text.\n *\n * base ::\n * Start of the processed text.\n *\n * limit ::\n * End of the processed text.\n *\n * error ::\n * The last error returned.\n *\n * memory ::\n * The object used for memory operations (alloc/realloc).\n *\n * funcs ::\n * A table of functions for the parser.\n */\n typedef struct PS_ParserRec_\n {\n FT_Byte* cursor;\n FT_Byte* base;\n FT_Byte* limit;\n FT_Error error;\n FT_Memory memory;\n\n PS_Parser_FuncsRec funcs;\n\n } PS_ParserRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PS BUILDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct PS_Builder_ PS_Builder;\n typedef const struct PS_Builder_FuncsRec_* PS_Builder_Funcs;\n\n typedef struct PS_Builder_FuncsRec_\n {\n void\n (*init)( PS_Builder* ps_builder,\n void* builder,\n FT_Bool is_t1 );\n\n void\n (*done)( PS_Builder* builder );\n\n } PS_Builder_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_Builder\n *\n * @description:\n * A structure used during glyph loading to store its outline.\n *\n * @fields:\n * memory ::\n * The current memory object.\n *\n * face ::\n * The current face object.\n *\n * glyph ::\n * The current glyph slot.\n *\n * loader ::\n * XXX\n *\n * base ::\n * The base glyph outline.\n *\n * current ::\n * The current glyph outline.\n *\n * pos_x ::\n * The horizontal translation (if composite glyph).\n *\n * pos_y ::\n * The vertical translation (if composite glyph).\n *\n * left_bearing ::\n * The left side bearing point.\n *\n * advance ::\n * The horizontal advance vector.\n *\n * bbox ::\n * Unused.\n *\n * path_begun ::\n * A flag which indicates that a new path has begun.\n *\n * load_points ::\n * If this flag is not set, no points are loaded.\n *\n * no_recurse ::\n * Set but not used.\n *\n * metrics_only ::\n * A boolean indicating that we only want to compute the metrics of a\n * given glyph, not load all of its points.\n *\n * is_t1 ::\n * Set if current font type is Type 1.\n *\n * funcs ::\n * An array of function pointers for the builder.\n */\n struct PS_Builder_\n {\n FT_Memory memory;\n FT_Face face;\n CFF_GlyphSlot glyph;\n FT_GlyphLoader loader;\n FT_Outline* base;\n FT_Outline* current;\n\n FT_Pos* pos_x;\n FT_Pos* pos_y;\n\n FT_Vector* left_bearing;\n FT_Vector* advance;\n\n FT_BBox* bbox; /* bounding box */\n FT_Bool path_begun;\n FT_Bool load_points;\n FT_Bool no_recurse;\n\n FT_Bool metrics_only;\n FT_Bool is_t1;\n\n PS_Builder_FuncsRec funcs;\n\n };\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PS DECODER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n#define PS_MAX_OPERANDS 48\n#define PS_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */\n /* only 10 are allowed but there exist */\n /* fonts like `HiraKakuProN-W3.ttf' */\n /* (Hiragino Kaku Gothic ProN W3; */\n /* 8.2d6e1; 2014-12-19) that exceed */\n /* this limit */\n\n /* execution context charstring zone */\n\n typedef struct PS_Decoder_Zone_\n {\n FT_Byte* base;\n FT_Byte* limit;\n FT_Byte* cursor;\n\n } PS_Decoder_Zone;\n\n\n typedef FT_Error\n (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face,\n FT_UInt glyph_index,\n FT_Byte** pointer,\n FT_ULong* length );\n\n typedef void\n (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face,\n FT_Byte** pointer,\n FT_ULong length );\n\n\n typedef struct PS_Decoder_\n {\n PS_Builder builder;\n\n FT_Fixed stack[PS_MAX_OPERANDS + 1];\n FT_Fixed* top;\n\n PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1];\n PS_Decoder_Zone* zone;\n\n FT_Int flex_state;\n FT_Int num_flex_vectors;\n FT_Vector flex_vectors[7];\n\n CFF_Font cff;\n CFF_SubFont current_subfont; /* for current glyph_index */\n FT_Generic* cf2_instance;\n\n FT_Pos* glyph_width;\n FT_Bool width_only;\n FT_Int num_hints;\n\n FT_UInt num_locals;\n FT_UInt num_globals;\n\n FT_Int locals_bias;\n FT_Int globals_bias;\n\n FT_Byte** locals;\n FT_Byte** globals;\n\n FT_Byte** glyph_names; /* for pure CFF fonts only */\n FT_UInt num_glyphs; /* number of glyphs in font */\n\n FT_Render_Mode hint_mode;\n\n FT_Bool seac;\n\n CFF_Decoder_Get_Glyph_Callback get_glyph_callback;\n CFF_Decoder_Free_Glyph_Callback free_glyph_callback;\n\n /* Type 1 stuff */\n FT_Service_PsCMaps psnames; /* for seac */\n\n FT_Int lenIV; /* internal for sub routine calls */\n FT_UInt* locals_len; /* array of subrs length (optional) */\n FT_Hash locals_hash; /* used if `num_subrs' was massaged */\n\n FT_Matrix font_matrix;\n FT_Vector font_offset;\n\n PS_Blend blend; /* for multiple master support */\n\n FT_Long* buildchar;\n FT_UInt len_buildchar;\n\n } PS_Decoder;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1 BUILDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct T1_BuilderRec_* T1_Builder;\n\n\n typedef FT_Error\n (*T1_Builder_Check_Points_Func)( T1_Builder builder,\n FT_Int count );\n\n typedef void\n (*T1_Builder_Add_Point_Func)( T1_Builder builder,\n FT_Pos x,\n FT_Pos y,\n FT_Byte flag );\n\n typedef FT_Error\n (*T1_Builder_Add_Point1_Func)( T1_Builder builder,\n FT_Pos x,\n FT_Pos y );\n\n typedef FT_Error\n (*T1_Builder_Add_Contour_Func)( T1_Builder builder );\n\n typedef FT_Error\n (*T1_Builder_Start_Point_Func)( T1_Builder builder,\n FT_Pos x,\n FT_Pos y );\n\n typedef void\n (*T1_Builder_Close_Contour_Func)( T1_Builder builder );\n\n\n typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs;\n\n typedef struct T1_Builder_FuncsRec_\n {\n void\n (*init)( T1_Builder builder,\n FT_Face face,\n FT_Size size,\n FT_GlyphSlot slot,\n FT_Bool hinting );\n\n void\n (*done)( T1_Builder builder );\n\n T1_Builder_Check_Points_Func check_points;\n T1_Builder_Add_Point_Func add_point;\n T1_Builder_Add_Point1_Func add_point1;\n T1_Builder_Add_Contour_Func add_contour;\n T1_Builder_Start_Point_Func start_point;\n T1_Builder_Close_Contour_Func close_contour;\n\n } T1_Builder_FuncsRec;\n\n\n /* an enumeration type to handle charstring parsing states */\n typedef enum T1_ParseState_\n {\n T1_Parse_Start,\n T1_Parse_Have_Width,\n T1_Parse_Have_Moveto,\n T1_Parse_Have_Path\n\n } T1_ParseState;\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_BuilderRec\n *\n * @description:\n * A structure used during glyph loading to store its outline.\n *\n * @fields:\n * memory ::\n * The current memory object.\n *\n * face ::\n * The current face object.\n *\n * glyph ::\n * The current glyph slot.\n *\n * loader ::\n * XXX\n *\n * base ::\n * The base glyph outline.\n *\n * current ::\n * The current glyph outline.\n *\n * max_points ::\n * maximum points in builder outline\n *\n * max_contours ::\n * Maximum number of contours in builder outline.\n *\n * pos_x ::\n * The horizontal translation (if composite glyph).\n *\n * pos_y ::\n * The vertical translation (if composite glyph).\n *\n * left_bearing ::\n * The left side bearing point.\n *\n * advance ::\n * The horizontal advance vector.\n *\n * bbox ::\n * Unused.\n *\n * parse_state ::\n * An enumeration which controls the charstring parsing state.\n *\n * load_points ::\n * If this flag is not set, no points are loaded.\n *\n * no_recurse ::\n * Set but not used.\n *\n * metrics_only ::\n * A boolean indicating that we only want to compute the metrics of a\n * given glyph, not load all of its points.\n *\n * funcs ::\n * An array of function pointers for the builder.\n */\n typedef struct T1_BuilderRec_\n {\n FT_Memory memory;\n FT_Face face;\n FT_GlyphSlot glyph;\n FT_GlyphLoader loader;\n FT_Outline* base;\n FT_Outline* current;\n\n FT_Pos pos_x;\n FT_Pos pos_y;\n\n FT_Vector left_bearing;\n FT_Vector advance;\n\n FT_BBox bbox; /* bounding box */\n T1_ParseState parse_state;\n FT_Bool load_points;\n FT_Bool no_recurse;\n\n FT_Bool metrics_only;\n\n void* hints_funcs; /* hinter-specific */\n void* hints_globals; /* hinter-specific */\n\n T1_Builder_FuncsRec funcs;\n\n } T1_BuilderRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1 DECODER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n#if 0\n\n /**************************************************************************\n *\n * T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine\n * calls during glyph loading.\n */\n#define T1_MAX_SUBRS_CALLS 8\n\n\n /**************************************************************************\n *\n * T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A\n * minimum of 16 is required.\n */\n#define T1_MAX_CHARSTRINGS_OPERANDS 32\n\n#endif /* 0 */\n\n\n typedef struct T1_Decoder_ZoneRec_\n {\n FT_Byte* cursor;\n FT_Byte* base;\n FT_Byte* limit;\n\n } T1_Decoder_ZoneRec, *T1_Decoder_Zone;\n\n\n typedef struct T1_DecoderRec_* T1_Decoder;\n typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs;\n\n\n typedef FT_Error\n (*T1_Decoder_Callback)( T1_Decoder decoder,\n FT_UInt glyph_index );\n\n\n typedef struct T1_Decoder_FuncsRec_\n {\n FT_Error\n (*init)( T1_Decoder decoder,\n FT_Face face,\n FT_Size size,\n FT_GlyphSlot slot,\n FT_Byte** glyph_names,\n PS_Blend blend,\n FT_Bool hinting,\n FT_Render_Mode hint_mode,\n T1_Decoder_Callback callback );\n\n void\n (*done)( T1_Decoder decoder );\n\n#ifdef T1_CONFIG_OPTION_OLD_ENGINE\n FT_Error\n (*parse_charstrings_old)( T1_Decoder decoder,\n FT_Byte* base,\n FT_UInt len );\n#else\n FT_Error\n (*parse_metrics)( T1_Decoder decoder,\n FT_Byte* base,\n FT_UInt len );\n#endif\n\n FT_Error\n (*parse_charstrings)( PS_Decoder* decoder,\n FT_Byte* charstring_base,\n FT_ULong charstring_len );\n\n\n } T1_Decoder_FuncsRec;\n\n\n typedef struct T1_DecoderRec_\n {\n T1_BuilderRec builder;\n\n FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];\n FT_Long* top;\n\n T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];\n T1_Decoder_Zone zone;\n\n FT_Service_PsCMaps psnames; /* for seac */\n FT_UInt num_glyphs;\n FT_Byte** glyph_names;\n\n FT_Int lenIV; /* internal for sub routine calls */\n FT_Int num_subrs;\n FT_Byte** subrs;\n FT_UInt* subrs_len; /* array of subrs length (optional) */\n FT_Hash subrs_hash; /* used if `num_subrs' was massaged */\n\n FT_Matrix font_matrix;\n FT_Vector font_offset;\n\n FT_Int flex_state;\n FT_Int num_flex_vectors;\n FT_Vector flex_vectors[7];\n\n PS_Blend blend; /* for multiple master support */\n\n FT_Render_Mode hint_mode;\n\n T1_Decoder_Callback parse_callback;\n T1_Decoder_FuncsRec funcs;\n\n FT_Long* buildchar;\n FT_UInt len_buildchar;\n\n FT_Bool seac;\n\n FT_Generic cf2_instance;\n\n } T1_DecoderRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** CFF BUILDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct CFF_Builder_ CFF_Builder;\n\n\n typedef FT_Error\n (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder,\n FT_Int count );\n\n typedef void\n (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder,\n FT_Pos x,\n FT_Pos y,\n FT_Byte flag );\n typedef FT_Error\n (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder,\n FT_Pos x,\n FT_Pos y );\n typedef FT_Error\n (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder,\n FT_Pos x,\n FT_Pos y );\n typedef void\n (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder );\n\n typedef FT_Error\n (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder );\n\n typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs;\n\n typedef struct CFF_Builder_FuncsRec_\n {\n void\n (*init)( CFF_Builder* builder,\n TT_Face face,\n CFF_Size size,\n CFF_GlyphSlot glyph,\n FT_Bool hinting );\n\n void\n (*done)( CFF_Builder* builder );\n\n CFF_Builder_Check_Points_Func check_points;\n CFF_Builder_Add_Point_Func add_point;\n CFF_Builder_Add_Point1_Func add_point1;\n CFF_Builder_Add_Contour_Func add_contour;\n CFF_Builder_Start_Point_Func start_point;\n CFF_Builder_Close_Contour_Func close_contour;\n\n } CFF_Builder_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * CFF_Builder\n *\n * @description:\n * A structure used during glyph loading to store its outline.\n *\n * @fields:\n * memory ::\n * The current memory object.\n *\n * face ::\n * The current face object.\n *\n * glyph ::\n * The current glyph slot.\n *\n * loader ::\n * The current glyph loader.\n *\n * base ::\n * The base glyph outline.\n *\n * current ::\n * The current glyph outline.\n *\n * pos_x ::\n * The horizontal translation (if composite glyph).\n *\n * pos_y ::\n * The vertical translation (if composite glyph).\n *\n * left_bearing ::\n * The left side bearing point.\n *\n * advance ::\n * The horizontal advance vector.\n *\n * bbox ::\n * Unused.\n *\n * path_begun ::\n * A flag which indicates that a new path has begun.\n *\n * load_points ::\n * If this flag is not set, no points are loaded.\n *\n * no_recurse ::\n * Set but not used.\n *\n * metrics_only ::\n * A boolean indicating that we only want to compute the metrics of a\n * given glyph, not load all of its points.\n *\n * hints_funcs ::\n * Auxiliary pointer for hinting.\n *\n * hints_globals ::\n * Auxiliary pointer for hinting.\n *\n * funcs ::\n * A table of method pointers for this object.\n */\n struct CFF_Builder_\n {\n FT_Memory memory;\n TT_Face face;\n CFF_GlyphSlot glyph;\n FT_GlyphLoader loader;\n FT_Outline* base;\n FT_Outline* current;\n\n FT_Pos pos_x;\n FT_Pos pos_y;\n\n FT_Vector left_bearing;\n FT_Vector advance;\n\n FT_BBox bbox; /* bounding box */\n\n FT_Bool path_begun;\n FT_Bool load_points;\n FT_Bool no_recurse;\n\n FT_Bool metrics_only;\n\n void* hints_funcs; /* hinter-specific */\n void* hints_globals; /* hinter-specific */\n\n CFF_Builder_FuncsRec funcs;\n };\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** CFF DECODER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n#define CFF_MAX_OPERANDS 48\n#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */\n /* only 10 are allowed but there exist */\n /* fonts like `HiraKakuProN-W3.ttf' */\n /* (Hiragino Kaku Gothic ProN W3; */\n /* 8.2d6e1; 2014-12-19) that exceed */\n /* this limit */\n#define CFF_MAX_TRANS_ELEMENTS 32\n\n /* execution context charstring zone */\n\n typedef struct CFF_Decoder_Zone_\n {\n FT_Byte* base;\n FT_Byte* limit;\n FT_Byte* cursor;\n\n } CFF_Decoder_Zone;\n\n\n typedef struct CFF_Decoder_\n {\n CFF_Builder builder;\n CFF_Font cff;\n\n FT_Fixed stack[CFF_MAX_OPERANDS + 1];\n FT_Fixed* top;\n\n CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];\n CFF_Decoder_Zone* zone;\n\n FT_Int flex_state;\n FT_Int num_flex_vectors;\n FT_Vector flex_vectors[7];\n\n FT_Pos glyph_width;\n FT_Pos nominal_width;\n\n FT_Bool read_width;\n FT_Bool width_only;\n FT_Int num_hints;\n FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];\n\n FT_UInt num_locals;\n FT_UInt num_globals;\n\n FT_Int locals_bias;\n FT_Int globals_bias;\n\n FT_Byte** locals;\n FT_Byte** globals;\n\n FT_Byte** glyph_names; /* for pure CFF fonts only */\n FT_UInt num_glyphs; /* number of glyphs in font */\n\n FT_Render_Mode hint_mode;\n\n FT_Bool seac;\n\n CFF_SubFont current_subfont; /* for current glyph_index */\n\n CFF_Decoder_Get_Glyph_Callback get_glyph_callback;\n CFF_Decoder_Free_Glyph_Callback free_glyph_callback;\n\n } CFF_Decoder;\n\n\n typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs;\n\n typedef struct CFF_Decoder_FuncsRec_\n {\n void\n (*init)( CFF_Decoder* decoder,\n TT_Face face,\n CFF_Size size,\n CFF_GlyphSlot slot,\n FT_Bool hinting,\n FT_Render_Mode hint_mode,\n CFF_Decoder_Get_Glyph_Callback get_callback,\n CFF_Decoder_Free_Glyph_Callback free_callback );\n\n FT_Error\n (*prepare)( CFF_Decoder* decoder,\n CFF_Size size,\n FT_UInt glyph_index );\n\n#ifdef CFF_CONFIG_OPTION_OLD_ENGINE\n FT_Error\n (*parse_charstrings_old)( CFF_Decoder* decoder,\n FT_Byte* charstring_base,\n FT_ULong charstring_len,\n FT_Bool in_dict );\n#endif\n\n FT_Error\n (*parse_charstrings)( PS_Decoder* decoder,\n FT_Byte* charstring_base,\n FT_ULong charstring_len );\n\n } CFF_Decoder_FuncsRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** AFM PARSER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct AFM_ParserRec_* AFM_Parser;\n\n typedef struct AFM_Parser_FuncsRec_\n {\n FT_Error\n (*init)( AFM_Parser parser,\n FT_Memory memory,\n FT_Byte* base,\n FT_Byte* limit );\n\n void\n (*done)( AFM_Parser parser );\n\n FT_Error\n (*parse)( AFM_Parser parser );\n\n } AFM_Parser_FuncsRec;\n\n\n typedef struct AFM_StreamRec_* AFM_Stream;\n\n\n /**************************************************************************\n *\n * @struct:\n * AFM_ParserRec\n *\n * @description:\n * An AFM_Parser is a parser for the AFM files.\n *\n * @fields:\n * memory ::\n * The object used for memory operations (alloc and realloc).\n *\n * stream ::\n * This is an opaque object.\n *\n * FontInfo ::\n * The result will be stored here.\n *\n * get_index ::\n * A user provided function to get a glyph index by its name.\n */\n typedef struct AFM_ParserRec_\n {\n FT_Memory memory;\n AFM_Stream stream;\n\n AFM_FontInfo FontInfo;\n\n FT_Int\n (*get_index)( const char* name,\n FT_Offset len,\n void* user_data );\n\n void* user_data;\n\n } AFM_ParserRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** TYPE1 CHARMAPS *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes;\n\n typedef struct T1_CMap_ClassesRec_\n {\n FT_CMap_Class standard;\n FT_CMap_Class expert;\n FT_CMap_Class custom;\n FT_CMap_Class unicode;\n\n } T1_CMap_ClassesRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PSAux Module Interface *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct PSAux_ServiceRec_\n {\n /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */\n const PS_Table_FuncsRec* ps_table_funcs;\n const PS_Parser_FuncsRec* ps_parser_funcs;\n const T1_Builder_FuncsRec* t1_builder_funcs;\n const T1_Decoder_FuncsRec* t1_decoder_funcs;\n\n void\n (*t1_decrypt)( FT_Byte* buffer,\n FT_Offset length,\n FT_UShort seed );\n\n FT_UInt32\n (*cff_random)( FT_UInt32 r );\n\n void\n (*ps_decoder_init)( PS_Decoder* ps_decoder,\n void* decoder,\n FT_Bool is_t1 );\n\n void\n (*t1_make_subfont)( FT_Face face,\n PS_Private priv,\n CFF_SubFont subfont );\n\n T1_CMap_Classes t1_cmap_classes;\n\n /* fields after this comment line were added after version 2.1.10 */\n const AFM_Parser_FuncsRec* afm_parser_funcs;\n\n const CFF_Decoder_FuncsRec* cff_decoder_funcs;\n\n } PSAux_ServiceRec, *PSAux_Service;\n\n /* backward compatible type definition */\n typedef PSAux_ServiceRec PSAux_Interface;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** Some convenience functions *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n#define IS_PS_NEWLINE( ch ) \\\n ( (ch) == '\\r' || \\\n (ch) == '\\n' )\n\n#define IS_PS_SPACE( ch ) \\\n ( (ch) == ' ' || \\\n IS_PS_NEWLINE( ch ) || \\\n (ch) == '\\t' || \\\n (ch) == '\\f' || \\\n (ch) == '\\0' )\n\n#define IS_PS_SPECIAL( ch ) \\\n ( (ch) == '/' || \\\n (ch) == '(' || (ch) == ')' || \\\n (ch) == '<' || (ch) == '>' || \\\n (ch) == '[' || (ch) == ']' || \\\n (ch) == '{' || (ch) == '}' || \\\n (ch) == '%' )\n\n#define IS_PS_DELIM( ch ) \\\n ( IS_PS_SPACE( ch ) || \\\n IS_PS_SPECIAL( ch ) )\n\n#define IS_PS_DIGIT( ch ) \\\n ( (ch) >= '0' && (ch) <= '9' )\n\n#define IS_PS_XDIGIT( ch ) \\\n ( IS_PS_DIGIT( ch ) || \\\n ( (ch) >= 'A' && (ch) <= 'F' ) || \\\n ( (ch) >= 'a' && (ch) <= 'f' ) )\n\n#define IS_PS_BASE85( ch ) \\\n ( (ch) >= '!' && (ch) <= 'u' )\n\n#define IS_PS_TOKEN( cur, limit, token ) \\\n ( (char)(cur)[0] == (token)[0] && \\\n ( (cur) + sizeof ( (token) ) == (limit) || \\\n ( (cur) + sizeof( (token) ) < (limit) && \\\n IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) ) && \\\n ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )\n\n\nFT_END_HEADER\n\n#endif /* PSAUX_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/pshints.h", "language": "code", "loc": 632, "comment_density": 0.821, "code": "/****************************************************************************\n *\n * pshints.h\n *\n * Interface to Postscript-specific (Type 1 and Type 2) hints\n * recorders (specification only). These are used to support native\n * T1/T2 hints in the 'type1', 'cid', and 'cff' font drivers.\n *\n * Copyright (C) 2001-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef PSHINTS_H_\n#define PSHINTS_H_\n\n\n#include \n#include FT_FREETYPE_H\n#include FT_TYPE1_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** INTERNAL REPRESENTATION OF GLOBALS *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct PSH_GlobalsRec_* PSH_Globals;\n\n typedef FT_Error\n (*PSH_Globals_NewFunc)( FT_Memory memory,\n T1_Private* private_dict,\n PSH_Globals* aglobals );\n\n typedef void\n (*PSH_Globals_SetScaleFunc)( PSH_Globals globals,\n FT_Fixed x_scale,\n FT_Fixed y_scale,\n FT_Fixed x_delta,\n FT_Fixed y_delta );\n\n typedef void\n (*PSH_Globals_DestroyFunc)( PSH_Globals globals );\n\n\n typedef struct PSH_Globals_FuncsRec_\n {\n PSH_Globals_NewFunc create;\n PSH_Globals_SetScaleFunc set_scale;\n PSH_Globals_DestroyFunc destroy;\n\n } PSH_Globals_FuncsRec, *PSH_Globals_Funcs;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PUBLIC TYPE 1 HINTS RECORDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n /**************************************************************************\n *\n * @type:\n * T1_Hints\n *\n * @description:\n * This is a handle to an opaque structure used to record glyph hints\n * from a Type 1 character glyph character string.\n *\n * The methods used to operate on this object are defined by the\n * @T1_Hints_FuncsRec structure. Recording glyph hints is normally\n * achieved through the following scheme:\n *\n * - Open a new hint recording session by calling the 'open' method.\n * This rewinds the recorder and prepare it for new input.\n *\n * - For each hint found in the glyph charstring, call the corresponding\n * method ('stem', 'stem3', or 'reset'). Note that these functions do\n * not return an error code.\n *\n * - Close the recording session by calling the 'close' method. It\n * returns an error code if the hints were invalid or something strange\n * happened (e.g., memory shortage).\n *\n * The hints accumulated in the object can later be used by the\n * PostScript hinter.\n *\n */\n typedef struct T1_HintsRec_* T1_Hints;\n\n\n /**************************************************************************\n *\n * @type:\n * T1_Hints_Funcs\n *\n * @description:\n * A pointer to the @T1_Hints_FuncsRec structure that defines the API of\n * a given @T1_Hints object.\n *\n */\n typedef const struct T1_Hints_FuncsRec_* T1_Hints_Funcs;\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_OpenFunc\n *\n * @description:\n * A method of the @T1_Hints class used to prepare it for a new Type 1\n * hints recording session.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * @note:\n * You should always call the @T1_Hints_CloseFunc method in order to\n * close an opened recording session.\n *\n */\n typedef void\n (*T1_Hints_OpenFunc)( T1_Hints hints );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_SetStemFunc\n *\n * @description:\n * A method of the @T1_Hints class used to record a new horizontal or\n * vertical stem. This corresponds to the Type 1 'hstem' and 'vstem'\n * operators.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * dimension ::\n * 0 for horizontal stems (hstem), 1 for vertical ones (vstem).\n *\n * coords ::\n * Array of 2 coordinates in 16.16 format, used as (position,length)\n * stem descriptor.\n *\n * @note:\n * Use vertical coordinates (y) for horizontal stems (dim=0). Use\n * horizontal coordinates (x) for vertical stems (dim=1).\n *\n * 'coords[0]' is the absolute stem position (lowest coordinate);\n * 'coords[1]' is the length.\n *\n * The length can be negative, in which case it must be either -20 or\n * -21. It is interpreted as a 'ghost' stem, according to the Type 1\n * specification.\n *\n * If the length is -21 (corresponding to a bottom ghost stem), then the\n * real stem position is 'coords[0]+coords[1]'.\n *\n */\n typedef void\n (*T1_Hints_SetStemFunc)( T1_Hints hints,\n FT_UInt dimension,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_SetStem3Func\n *\n * @description:\n * A method of the @T1_Hints class used to record three\n * counter-controlled horizontal or vertical stems at once.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * dimension ::\n * 0 for horizontal stems, 1 for vertical ones.\n *\n * coords ::\n * An array of 6 values in 16.16 format, holding 3 (position,length)\n * pairs for the counter-controlled stems.\n *\n * @note:\n * Use vertical coordinates (y) for horizontal stems (dim=0). Use\n * horizontal coordinates (x) for vertical stems (dim=1).\n *\n * The lengths cannot be negative (ghost stems are never\n * counter-controlled).\n *\n */\n typedef void\n (*T1_Hints_SetStem3Func)( T1_Hints hints,\n FT_UInt dimension,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_ResetFunc\n *\n * @description:\n * A method of the @T1_Hints class used to reset the stems hints in a\n * recording session.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * end_point ::\n * The index of the last point in the input glyph in which the\n * previously defined hints apply.\n *\n */\n typedef void\n (*T1_Hints_ResetFunc)( T1_Hints hints,\n FT_UInt end_point );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_CloseFunc\n *\n * @description:\n * A method of the @T1_Hints class used to close a hint recording\n * session.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * end_point ::\n * The index of the last point in the input glyph.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The error code is set to indicate that an error occurred during the\n * recording session.\n *\n */\n typedef FT_Error\n (*T1_Hints_CloseFunc)( T1_Hints hints,\n FT_UInt end_point );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_ApplyFunc\n *\n * @description:\n * A method of the @T1_Hints class used to apply hints to the\n * corresponding glyph outline. Must be called once all hints have been\n * recorded.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * globals ::\n * The hinter globals for this font.\n *\n * hint_mode ::\n * Hinting information.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * On input, all points within the outline are in font coordinates. On\n * output, they are in 1/64th of pixels.\n *\n * The scaling transformation is taken from the 'globals' object which\n * must correspond to the same font as the glyph.\n *\n */\n typedef FT_Error\n (*T1_Hints_ApplyFunc)( T1_Hints hints,\n FT_Outline* outline,\n PSH_Globals globals,\n FT_Render_Mode hint_mode );\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_Hints_FuncsRec\n *\n * @description:\n * The structure used to provide the API to @T1_Hints objects.\n *\n * @fields:\n * hints ::\n * A handle to the T1 Hints recorder.\n *\n * open ::\n * The function to open a recording session.\n *\n * close ::\n * The function to close a recording session.\n *\n * stem ::\n * The function to set a simple stem.\n *\n * stem3 ::\n * The function to set counter-controlled stems.\n *\n * reset ::\n * The function to reset stem hints.\n *\n * apply ::\n * The function to apply the hints to the corresponding glyph outline.\n *\n */\n typedef struct T1_Hints_FuncsRec_\n {\n T1_Hints hints;\n T1_Hints_OpenFunc open;\n T1_Hints_CloseFunc close;\n T1_Hints_SetStemFunc stem;\n T1_Hints_SetStem3Func stem3;\n T1_Hints_ResetFunc reset;\n T1_Hints_ApplyFunc apply;\n\n } T1_Hints_FuncsRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PUBLIC TYPE 2 HINTS RECORDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n /**************************************************************************\n *\n * @type:\n * T2_Hints\n *\n * @description:\n * This is a handle to an opaque structure used to record glyph hints\n * from a Type 2 character glyph character string.\n *\n * The methods used to operate on this object are defined by the\n * @T2_Hints_FuncsRec structure. Recording glyph hints is normally\n * achieved through the following scheme:\n *\n * - Open a new hint recording session by calling the 'open' method.\n * This rewinds the recorder and prepare it for new input.\n *\n * - For each hint found in the glyph charstring, call the corresponding\n * method ('stems', 'hintmask', 'counters'). Note that these functions\n * do not return an error code.\n *\n * - Close the recording session by calling the 'close' method. It\n * returns an error code if the hints were invalid or something strange\n * happened (e.g., memory shortage).\n *\n * The hints accumulated in the object can later be used by the\n * Postscript hinter.\n *\n */\n typedef struct T2_HintsRec_* T2_Hints;\n\n\n /**************************************************************************\n *\n * @type:\n * T2_Hints_Funcs\n *\n * @description:\n * A pointer to the @T2_Hints_FuncsRec structure that defines the API of\n * a given @T2_Hints object.\n *\n */\n typedef const struct T2_Hints_FuncsRec_* T2_Hints_Funcs;\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_OpenFunc\n *\n * @description:\n * A method of the @T2_Hints class used to prepare it for a new Type 2\n * hints recording session.\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * @note:\n * You should always call the @T2_Hints_CloseFunc method in order to\n * close an opened recording session.\n *\n */\n typedef void\n (*T2_Hints_OpenFunc)( T2_Hints hints );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_StemsFunc\n *\n * @description:\n * A method of the @T2_Hints class used to set the table of stems in\n * either the vertical or horizontal dimension. Equivalent to the\n * 'hstem', 'vstem', 'hstemhm', and 'vstemhm' Type 2 operators.\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * dimension ::\n * 0 for horizontal stems (hstem), 1 for vertical ones (vstem).\n *\n * count ::\n * The number of stems.\n *\n * coords ::\n * An array of 'count' (position,length) pairs in 16.16 format.\n *\n * @note:\n * Use vertical coordinates (y) for horizontal stems (dim=0). Use\n * horizontal coordinates (x) for vertical stems (dim=1).\n *\n * There are '2*count' elements in the 'coords' array. Each even element\n * is an absolute position in font units, each odd element is a length in\n * font units.\n *\n * A length can be negative, in which case it must be either -20 or -21.\n * It is interpreted as a 'ghost' stem, according to the Type 1\n * specification.\n *\n */\n typedef void\n (*T2_Hints_StemsFunc)( T2_Hints hints,\n FT_UInt dimension,\n FT_Int count,\n FT_Fixed* coordinates );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_MaskFunc\n *\n * @description:\n * A method of the @T2_Hints class used to set a given hintmask (this\n * corresponds to the 'hintmask' Type 2 operator).\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * end_point ::\n * The glyph index of the last point to which the previously defined or\n * activated hints apply.\n *\n * bit_count ::\n * The number of bits in the hint mask.\n *\n * bytes ::\n * An array of bytes modelling the hint mask.\n *\n * @note:\n * If the hintmask starts the charstring (before any glyph point\n * definition), the value of `end_point` should be 0.\n *\n * `bit_count` is the number of meaningful bits in the 'bytes' array; it\n * must be equal to the total number of hints defined so far (i.e.,\n * horizontal+verticals).\n *\n * The 'bytes' array can come directly from the Type 2 charstring and\n * respects the same format.\n *\n */\n typedef void\n (*T2_Hints_MaskFunc)( T2_Hints hints,\n FT_UInt end_point,\n FT_UInt bit_count,\n const FT_Byte* bytes );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_CounterFunc\n *\n * @description:\n * A method of the @T2_Hints class used to set a given counter mask (this\n * corresponds to the 'hintmask' Type 2 operator).\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * end_point ::\n * A glyph index of the last point to which the previously defined or\n * active hints apply.\n *\n * bit_count ::\n * The number of bits in the hint mask.\n *\n * bytes ::\n * An array of bytes modelling the hint mask.\n *\n * @note:\n * If the hintmask starts the charstring (before any glyph point\n * definition), the value of `end_point` should be 0.\n *\n * `bit_count` is the number of meaningful bits in the 'bytes' array; it\n * must be equal to the total number of hints defined so far (i.e.,\n * horizontal+verticals).\n *\n * The 'bytes' array can come directly from the Type 2 charstring and\n * respects the same format.\n *\n */\n typedef void\n (*T2_Hints_CounterFunc)( T2_Hints hints,\n FT_UInt bit_count,\n const FT_Byte* bytes );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_CloseFunc\n *\n * @description:\n * A method of the @T2_Hints class used to close a hint recording\n * session.\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * end_point ::\n * The index of the last point in the input glyph.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The error code is set to indicate that an error occurred during the\n * recording session.\n *\n */\n typedef FT_Error\n (*T2_Hints_CloseFunc)( T2_Hints hints,\n FT_UInt end_point );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_ApplyFunc\n *\n * @description:\n * A method of the @T2_Hints class used to apply hints to the\n * corresponding glyph outline. Must be called after the 'close' method.\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * globals ::\n * The hinter globals for this font.\n *\n * hint_mode ::\n * Hinting information.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * On input, all points within the outline are in font coordinates. On\n * output, they are in 1/64th of pixels.\n *\n * The scaling transformation is taken from the 'globals' object which\n * must correspond to the same font than the glyph.\n *\n */\n typedef FT_Error\n (*T2_Hints_ApplyFunc)( T2_Hints hints,\n FT_Outline* outline,\n PSH_Globals globals,\n FT_Render_Mode hint_mode );\n\n\n /**************************************************************************\n *\n * @struct:\n * T2_Hints_FuncsRec\n *\n * @description:\n * The structure used to provide the API to @T2_Hints objects.\n *\n * @fields:\n * hints ::\n * A handle to the T2 hints recorder object.\n *\n * open ::\n * The function to open a recording session.\n *\n * close ::\n * The function to close a recording session.\n *\n * stems ::\n * The function to set the dimension's stems table.\n *\n * hintmask ::\n * The function to set hint masks.\n *\n * counter ::\n * The function to set counter masks.\n *\n * apply ::\n * The function to apply the hints on the corresponding glyph outline.\n *\n */\n typedef struct T2_Hints_FuncsRec_\n {\n T2_Hints hints;\n T2_Hints_OpenFunc open;\n T2_Hints_CloseFunc close;\n T2_Hints_StemsFunc stems;\n T2_Hints_MaskFunc hintmask;\n T2_Hints_CounterFunc counter;\n T2_Hints_ApplyFunc apply;\n\n } T2_Hints_FuncsRec;\n\n\n /* */\n\n\n typedef struct PSHinter_Interface_\n {\n PSH_Globals_Funcs (*get_globals_funcs)( FT_Module module );\n T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module );\n T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module );\n\n } PSHinter_Interface;\n\n typedef PSHinter_Interface* PSHinter_Service;\n\n\n#define FT_DEFINE_PSHINTER_INTERFACE( \\\n class_, \\\n get_globals_funcs_, \\\n get_t1_funcs_, \\\n get_t2_funcs_ ) \\\n static const PSHinter_Interface class_ = \\\n { \\\n get_globals_funcs_, \\\n get_t1_funcs_, \\\n get_t2_funcs_ \\\n };\n\n\nFT_END_HEADER\n\n#endif /* PSHINTS_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/sfnt.h", "language": "code", "loc": 800, "comment_density": 0.72, "code": "/****************************************************************************\n *\n * sfnt.h\n *\n * High-level 'sfnt' driver interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SFNT_H_\n#define SFNT_H_\n\n\n#include \n#include FT_INTERNAL_DRIVER_H\n#include FT_INTERNAL_TRUETYPE_TYPES_H\n#include FT_INTERNAL_WOFF_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Init_Face_Func\n *\n * @description:\n * First part of the SFNT face object initialization. This finds the\n * face in a SFNT file or collection, and load its format tag in\n * face->format_tag.\n *\n * @input:\n * stream ::\n * The input stream.\n *\n * face ::\n * A handle to the target face object.\n *\n * face_index ::\n * The index of the TrueType font, if we are opening a collection, in\n * bits 0-15. The numbered instance index~+~1 of a GX (sub)font, if\n * applicable, in bits 16-30.\n *\n * num_params ::\n * The number of additional parameters.\n *\n * params ::\n * Optional additional parameters.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The stream cursor must be at the font file's origin.\n *\n * This function recognizes fonts embedded in a 'TrueType collection'.\n *\n * Once the format tag has been validated by the font driver, it should\n * then call the TT_Load_Face_Func() callback to read the rest of the\n * SFNT tables in the object.\n */\n typedef FT_Error\n (*TT_Init_Face_Func)( FT_Stream stream,\n TT_Face face,\n FT_Int face_index,\n FT_Int num_params,\n FT_Parameter* params );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Face_Func\n *\n * @description:\n * Second part of the SFNT face object initialization. This loads the\n * common SFNT tables (head, OS/2, maxp, metrics, etc.) in the face\n * object.\n *\n * @input:\n * stream ::\n * The input stream.\n *\n * face ::\n * A handle to the target face object.\n *\n * face_index ::\n * The index of the TrueType font, if we are opening a collection, in\n * bits 0-15. The numbered instance index~+~1 of a GX (sub)font, if\n * applicable, in bits 16-30.\n *\n * num_params ::\n * The number of additional parameters.\n *\n * params ::\n * Optional additional parameters.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * This function must be called after TT_Init_Face_Func().\n */\n typedef FT_Error\n (*TT_Load_Face_Func)( FT_Stream stream,\n TT_Face face,\n FT_Int face_index,\n FT_Int num_params,\n FT_Parameter* params );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Done_Face_Func\n *\n * @description:\n * A callback used to delete the common SFNT data from a face.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * @note:\n * This function does NOT destroy the face object.\n */\n typedef void\n (*TT_Done_Face_Func)( TT_Face face );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Any_Func\n *\n * @description:\n * Load any font table into client memory.\n *\n * @input:\n * face ::\n * The face object to look for.\n *\n * tag ::\n * The tag of table to load. Use the value 0 if you want to access the\n * whole font file, else set this parameter to a valid TrueType table\n * tag that you can forge with the MAKE_TT_TAG macro.\n *\n * offset ::\n * The starting offset in the table (or the file if tag == 0).\n *\n * length ::\n * The address of the decision variable:\n *\n * If `length == NULL`: Loads the whole table. Returns an error if\n * 'offset' == 0!\n *\n * If `*length == 0`: Exits immediately; returning the length of the\n * given table or of the font file, depending on the value of 'tag'.\n *\n * If `*length != 0`: Loads the next 'length' bytes of table or font,\n * starting at offset 'offset' (in table or font too).\n *\n * @output:\n * buffer ::\n * The address of target buffer.\n *\n * @return:\n * TrueType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Load_Any_Func)( TT_Face face,\n FT_ULong tag,\n FT_Long offset,\n FT_Byte *buffer,\n FT_ULong* length );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Find_SBit_Image_Func\n *\n * @description:\n * Check whether an embedded bitmap (an 'sbit') exists for a given glyph,\n * at a given strike.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * glyph_index ::\n * The glyph index.\n *\n * strike_index ::\n * The current strike index.\n *\n * @output:\n * arange ::\n * The SBit range containing the glyph index.\n *\n * astrike ::\n * The SBit strike containing the glyph index.\n *\n * aglyph_offset ::\n * The offset of the glyph data in 'EBDT' table.\n *\n * @return:\n * FreeType error code. 0 means success. Returns\n * SFNT_Err_Invalid_Argument if no sbit exists for the requested glyph.\n */\n typedef FT_Error\n (*TT_Find_SBit_Image_Func)( TT_Face face,\n FT_UInt glyph_index,\n FT_ULong strike_index,\n TT_SBit_Range *arange,\n TT_SBit_Strike *astrike,\n FT_ULong *aglyph_offset );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_SBit_Metrics_Func\n *\n * @description:\n * Get the big metrics for a given embedded bitmap.\n *\n * @input:\n * stream ::\n * The input stream.\n *\n * range ::\n * The SBit range containing the glyph.\n *\n * @output:\n * big_metrics ::\n * A big SBit metrics structure for the glyph.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The stream cursor must be positioned at the glyph's offset within the\n * 'EBDT' table before the call.\n *\n * If the image format uses variable metrics, the stream cursor is\n * positioned just after the metrics header in the 'EBDT' table on\n * function exit.\n */\n typedef FT_Error\n (*TT_Load_SBit_Metrics_Func)( FT_Stream stream,\n TT_SBit_Range range,\n TT_SBit_Metrics metrics );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_SBit_Image_Func\n *\n * @description:\n * Load a given glyph sbit image from the font resource. This also\n * returns its metrics.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * strike_index ::\n * The strike index.\n *\n * glyph_index ::\n * The current glyph index.\n *\n * load_flags ::\n * The current load flags.\n *\n * stream ::\n * The input stream.\n *\n * @output:\n * amap ::\n * The target pixmap.\n *\n * ametrics ::\n * A big sbit metrics structure for the glyph image.\n *\n * @return:\n * FreeType error code. 0 means success. Returns an error if no glyph\n * sbit exists for the index.\n *\n * @note:\n * The `map.buffer` field is always freed before the glyph is loaded.\n */\n typedef FT_Error\n (*TT_Load_SBit_Image_Func)( TT_Face face,\n FT_ULong strike_index,\n FT_UInt glyph_index,\n FT_UInt load_flags,\n FT_Stream stream,\n FT_Bitmap *amap,\n TT_SBit_MetricsRec *ametrics );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Set_SBit_Strike_Func\n *\n * @description:\n * Select an sbit strike for a given size request.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * req ::\n * The size request.\n *\n * @output:\n * astrike_index ::\n * The index of the sbit strike.\n *\n * @return:\n * FreeType error code. 0 means success. Returns an error if no sbit\n * strike exists for the selected ppem values.\n */\n typedef FT_Error\n (*TT_Set_SBit_Strike_Func)( TT_Face face,\n FT_Size_Request req,\n FT_ULong* astrike_index );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Strike_Metrics_Func\n *\n * @description:\n * Load the metrics of a given strike.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * strike_index ::\n * The strike index.\n *\n * @output:\n * metrics ::\n * the metrics of the strike.\n *\n * @return:\n * FreeType error code. 0 means success. Returns an error if no such\n * sbit strike exists.\n */\n typedef FT_Error\n (*TT_Load_Strike_Metrics_Func)( TT_Face face,\n FT_ULong strike_index,\n FT_Size_Metrics* metrics );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_PS_Name_Func\n *\n * @description:\n * Get the PostScript glyph name of a glyph.\n *\n * @input:\n * idx ::\n * The glyph index.\n *\n * PSname ::\n * The address of a string pointer. Will be `NULL` in case of error,\n * otherwise it is a pointer to the glyph name.\n *\n * You must not modify the returned string!\n *\n * @output:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Get_PS_Name_Func)( TT_Face face,\n FT_UInt idx,\n FT_String** PSname );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Metrics_Func\n *\n * @description:\n * Load a metrics table, which is a table with a horizontal and a\n * vertical version.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * stream ::\n * The input stream.\n *\n * vertical ::\n * A boolean flag. If set, load the vertical one.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Load_Metrics_Func)( TT_Face face,\n FT_Stream stream,\n FT_Bool vertical );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_Metrics_Func\n *\n * @description:\n * Load the horizontal or vertical header in a face object.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * vertical ::\n * A boolean flag. If set, load vertical metrics.\n *\n * gindex ::\n * The glyph index.\n *\n * @output:\n * abearing ::\n * The horizontal (or vertical) bearing. Set to zero in case of error.\n *\n * aadvance ::\n * The horizontal (or vertical) advance. Set to zero in case of error.\n */\n typedef void\n (*TT_Get_Metrics_Func)( TT_Face face,\n FT_Bool vertical,\n FT_UInt gindex,\n FT_Short* abearing,\n FT_UShort* aadvance );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Set_Palette_Func\n *\n * @description:\n * Load the colors into `face->palette` for a given palette index.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * idx ::\n * The palette index.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Set_Palette_Func)( TT_Face face,\n FT_UInt idx );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_Colr_Layer_Func\n *\n * @description:\n * Iteratively get the color layer data of a given glyph index.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * base_glyph ::\n * The glyph index the colored glyph layers are associated with.\n *\n * @inout:\n * iterator ::\n * An @FT_LayerIterator object. For the first call you should set\n * `iterator->p` to `NULL`. For all following calls, simply use the\n * same object again.\n *\n * @output:\n * aglyph_index ::\n * The glyph index of the current layer.\n *\n * acolor_index ::\n * The color index into the font face's color palette of the current\n * layer. The value 0xFFFF is special; it doesn't reference a palette\n * entry but indicates that the text foreground color should be used\n * instead (to be set up by the application outside of FreeType).\n *\n * @return:\n * Value~1 if everything is OK. If there are no more layers (or if there\n * are no layers at all), value~0 gets returned. In case of an error,\n * value~0 is returned also.\n */\n typedef FT_Bool\n (*TT_Get_Colr_Layer_Func)( TT_Face face,\n FT_UInt base_glyph,\n FT_UInt *aglyph_index,\n FT_UInt *acolor_index,\n FT_LayerIterator* iterator );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Blend_Colr_Func\n *\n * @description:\n * Blend the bitmap in `new_glyph` into `base_glyph` using the color\n * specified by `color_index`. If `color_index` is 0xFFFF, use\n * `face->foreground_color` if `face->have_foreground_color` is set.\n * Otherwise check `face->palette_data.palette_flags`: If present and\n * @FT_PALETTE_FOR_DARK_BACKGROUND is set, use BGRA value 0xFFFFFFFF\n * (white opaque). Otherwise use BGRA value 0x000000FF (black opaque).\n *\n * @input:\n * face ::\n * The target face object.\n *\n * color_index ::\n * Color index from the COLR table.\n *\n * base_glyph ::\n * Slot for bitmap to be merged into. The underlying bitmap may get\n * reallocated.\n *\n * new_glyph ::\n * Slot to be incooperated into `base_glyph`.\n *\n * @return:\n * FreeType error code. 0 means success. Returns an error if\n * color_index is invalid or reallocation fails.\n */\n typedef FT_Error\n (*TT_Blend_Colr_Func)( TT_Face face,\n FT_UInt color_index,\n FT_GlyphSlot base_glyph,\n FT_GlyphSlot new_glyph );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_Name_Func\n *\n * @description:\n * From the 'name' table, return a given ENGLISH name record in ASCII.\n *\n * @input:\n * face ::\n * A handle to the source face object.\n *\n * nameid ::\n * The name id of the name record to return.\n *\n * @inout:\n * name ::\n * The address of an allocated string pointer. `NULL` if no name is\n * present.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Get_Name_Func)( TT_Face face,\n FT_UShort nameid,\n FT_String** name );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_Name_ID_Func\n *\n * @description:\n * Search whether an ENGLISH version for a given name ID is in the 'name'\n * table.\n *\n * @input:\n * face ::\n * A handle to the source face object.\n *\n * nameid ::\n * The name id of the name record to return.\n *\n * @output:\n * win ::\n * If non-negative, an index into the 'name' table with the\n * corresponding (3,1) or (3,0) Windows entry.\n *\n * apple ::\n * If non-negative, an index into the 'name' table with the\n * corresponding (1,0) Apple entry.\n *\n * @return:\n * 1 if there is either a win or apple entry (or both), 0 otheriwse.\n */\n typedef FT_Bool\n (*TT_Get_Name_ID_Func)( TT_Face face,\n FT_UShort nameid,\n FT_Int *win,\n FT_Int *apple );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Table_Func\n *\n * @description:\n * Load a given TrueType table.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * stream ::\n * The input stream.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The function uses `face->goto_table` to seek the stream to the start\n * of the table, except while loading the font directory.\n */\n typedef FT_Error\n (*TT_Load_Table_Func)( TT_Face face,\n FT_Stream stream );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Free_Table_Func\n *\n * @description:\n * Free a given TrueType table.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n */\n typedef void\n (*TT_Free_Table_Func)( TT_Face face );\n\n\n /*\n * @functype:\n * TT_Face_GetKerningFunc\n *\n * @description:\n * Return the horizontal kerning value between two glyphs.\n *\n * @input:\n * face ::\n * A handle to the source face object.\n *\n * left_glyph ::\n * The left glyph index.\n *\n * right_glyph ::\n * The right glyph index.\n *\n * @return:\n * The kerning value in font units.\n */\n typedef FT_Int\n (*TT_Face_GetKerningFunc)( TT_Face face,\n FT_UInt left_glyph,\n FT_UInt right_glyph );\n\n\n /**************************************************************************\n *\n * @struct:\n * SFNT_Interface\n *\n * @description:\n * This structure holds pointers to the functions used to load and free\n * the basic tables that are required in a 'sfnt' font file.\n *\n * @fields:\n * Check the various xxx_Func() descriptions for details.\n */\n typedef struct SFNT_Interface_\n {\n TT_Loader_GotoTableFunc goto_table;\n\n TT_Init_Face_Func init_face;\n TT_Load_Face_Func load_face;\n TT_Done_Face_Func done_face;\n FT_Module_Requester get_interface;\n\n TT_Load_Any_Func load_any;\n\n /* these functions are called by `load_face' but they can also */\n /* be called from external modules, if there is a need to do so */\n TT_Load_Table_Func load_head;\n TT_Load_Metrics_Func load_hhea;\n TT_Load_Table_Func load_cmap;\n TT_Load_Table_Func load_maxp;\n TT_Load_Table_Func load_os2;\n TT_Load_Table_Func load_post;\n\n TT_Load_Table_Func load_name;\n TT_Free_Table_Func free_name;\n\n /* this field was called `load_kerning' up to version 2.1.10 */\n TT_Load_Table_Func load_kern;\n\n TT_Load_Table_Func load_gasp;\n TT_Load_Table_Func load_pclt;\n\n /* see `ttload.h'; this field was called `load_bitmap_header' up to */\n /* version 2.1.10 */\n TT_Load_Table_Func load_bhed;\n\n TT_Load_SBit_Image_Func load_sbit_image;\n\n /* see `ttpost.h' */\n TT_Get_PS_Name_Func get_psname;\n TT_Free_Table_Func free_psnames;\n\n /* starting here, the structure differs from version 2.1.7 */\n\n /* this field was introduced in version 2.1.8, named `get_psname' */\n TT_Face_GetKerningFunc get_kerning;\n\n /* new elements introduced after version 2.1.10 */\n\n /* load the font directory, i.e., the offset table and */\n /* the table directory */\n TT_Load_Table_Func load_font_dir;\n TT_Load_Metrics_Func load_hmtx;\n\n TT_Load_Table_Func load_eblc;\n TT_Free_Table_Func free_eblc;\n\n TT_Set_SBit_Strike_Func set_sbit_strike;\n TT_Load_Strike_Metrics_Func load_strike_metrics;\n\n TT_Load_Table_Func load_cpal;\n TT_Load_Table_Func load_colr;\n TT_Free_Table_Func free_cpal;\n TT_Free_Table_Func free_colr;\n TT_Set_Palette_Func set_palette;\n TT_Get_Colr_Layer_Func get_colr_layer;\n TT_Blend_Colr_Func colr_blend;\n\n TT_Get_Metrics_Func get_metrics;\n\n TT_Get_Name_Func get_name;\n TT_Get_Name_ID_Func get_name_id;\n\n } SFNT_Interface;\n\n\n /* transitional */\n typedef SFNT_Interface* SFNT_Service;\n\n\n#define FT_DEFINE_SFNT_INTERFACE( \\\n class_, \\\n goto_table_, \\\n init_face_, \\\n load_face_, \\\n done_face_, \\\n get_interface_, \\\n load_any_, \\\n load_head_, \\\n load_hhea_, \\\n load_cmap_, \\\n load_maxp_, \\\n load_os2_, \\\n load_post_, \\\n load_name_, \\\n free_name_, \\\n load_kern_, \\\n load_gasp_, \\\n load_pclt_, \\\n load_bhed_, \\\n load_sbit_image_, \\\n get_psname_, \\\n free_psnames_, \\\n get_kerning_, \\\n load_font_dir_, \\\n load_hmtx_, \\\n load_eblc_, \\\n free_eblc_, \\\n set_sbit_strike_, \\\n load_strike_metrics_, \\\n load_cpal_, \\\n load_colr_, \\\n free_cpal_, \\\n free_colr_, \\\n set_palette_, \\\n get_colr_layer_, \\\n colr_blend_, \\\n get_metrics_, \\\n get_name_, \\\n get_name_id_ ) \\\n static const SFNT_Interface class_ = \\\n { \\\n goto_table_, \\\n init_face_, \\\n load_face_, \\\n done_face_, \\\n get_interface_, \\\n load_any_, \\\n load_head_, \\\n load_hhea_, \\\n load_cmap_, \\\n load_maxp_, \\\n load_os2_, \\\n load_post_, \\\n load_name_, \\\n free_name_, \\\n load_kern_, \\\n load_gasp_, \\\n load_pclt_, \\\n load_bhed_, \\\n load_sbit_image_, \\\n get_psname_, \\\n free_psnames_, \\\n get_kerning_, \\\n load_font_dir_, \\\n load_hmtx_, \\\n load_eblc_, \\\n free_eblc_, \\\n set_sbit_strike_, \\\n load_strike_metrics_, \\\n load_cpal_, \\\n load_colr_, \\\n free_cpal_, \\\n free_colr_, \\\n set_palette_, \\\n get_colr_layer_, \\\n colr_blend_, \\\n get_metrics_, \\\n get_name_, \\\n get_name_id_ \\\n };\n\n\nFT_END_HEADER\n\n#endif /* SFNT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/t1types.h", "language": "code", "loc": 204, "comment_density": 0.49, "code": "/****************************************************************************\n *\n * t1types.h\n *\n * Basic Type1/Type2 type definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef T1TYPES_H_\n#define T1TYPES_H_\n\n\n#include \n#include FT_TYPE1_TABLES_H\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\n#include FT_INTERNAL_SERVICE_H\n#include FT_INTERNAL_HASH_H\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\n\n\nFT_BEGIN_HEADER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_EncodingRec\n *\n * @description:\n * A structure modeling a custom encoding.\n *\n * @fields:\n * num_chars ::\n * The number of character codes in the encoding. Usually 256.\n *\n * code_first ::\n * The lowest valid character code in the encoding.\n *\n * code_last ::\n * The highest valid character code in the encoding + 1. When equal to\n * code_first there are no valid character codes.\n *\n * char_index ::\n * An array of corresponding glyph indices.\n *\n * char_name ::\n * An array of corresponding glyph names.\n */\n typedef struct T1_EncodingRecRec_\n {\n FT_Int num_chars;\n FT_Int code_first;\n FT_Int code_last;\n\n FT_UShort* char_index;\n const FT_String** char_name;\n\n } T1_EncodingRec, *T1_Encoding;\n\n\n /* used to hold extra data of PS_FontInfoRec that\n * cannot be stored in the publicly defined structure.\n *\n * Note these can't be blended with multiple-masters.\n */\n typedef struct PS_FontExtraRec_\n {\n FT_UShort fs_type;\n\n } PS_FontExtraRec;\n\n\n typedef struct T1_FontRec_\n {\n PS_FontInfoRec font_info; /* font info dictionary */\n PS_FontExtraRec font_extra; /* font info extra fields */\n PS_PrivateRec private_dict; /* private dictionary */\n FT_String* font_name; /* top-level dictionary */\n\n T1_EncodingType encoding_type;\n T1_EncodingRec encoding;\n\n FT_Byte* subrs_block;\n FT_Byte* charstrings_block;\n FT_Byte* glyph_names_block;\n\n FT_Int num_subrs;\n FT_Byte** subrs;\n FT_UInt* subrs_len;\n FT_Hash subrs_hash;\n\n FT_Int num_glyphs;\n FT_String** glyph_names; /* array of glyph names */\n FT_Byte** charstrings; /* array of glyph charstrings */\n FT_UInt* charstrings_len;\n\n FT_Byte paint_type;\n FT_Byte font_type;\n FT_Matrix font_matrix;\n FT_Vector font_offset;\n FT_BBox font_bbox;\n FT_Long font_id;\n\n FT_Fixed stroke_width;\n\n } T1_FontRec, *T1_Font;\n\n\n typedef struct CID_SubrsRec_\n {\n FT_Int num_subrs;\n FT_Byte** code;\n\n } CID_SubrsRec, *CID_Subrs;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** AFM FONT INFORMATION STRUCTURES ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct AFM_TrackKernRec_\n {\n FT_Int degree;\n FT_Fixed min_ptsize;\n FT_Fixed min_kern;\n FT_Fixed max_ptsize;\n FT_Fixed max_kern;\n\n } AFM_TrackKernRec, *AFM_TrackKern;\n\n typedef struct AFM_KernPairRec_\n {\n FT_UInt index1;\n FT_UInt index2;\n FT_Int x;\n FT_Int y;\n\n } AFM_KernPairRec, *AFM_KernPair;\n\n typedef struct AFM_FontInfoRec_\n {\n FT_Bool IsCIDFont;\n FT_BBox FontBBox;\n FT_Fixed Ascender;\n FT_Fixed Descender;\n AFM_TrackKern TrackKerns; /* free if non-NULL */\n FT_UInt NumTrackKern;\n AFM_KernPair KernPairs; /* free if non-NULL */\n FT_UInt NumKernPair;\n\n } AFM_FontInfoRec, *AFM_FontInfo;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** ORIGINAL T1_FACE CLASS DEFINITION ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct T1_FaceRec_* T1_Face;\n typedef struct CID_FaceRec_* CID_Face;\n\n\n typedef struct T1_FaceRec_\n {\n FT_FaceRec root;\n T1_FontRec type1;\n const void* psnames;\n const void* psaux;\n const void* afm_data;\n FT_CharMapRec charmaprecs[2];\n FT_CharMap charmaps[2];\n\n /* support for Multiple Masters fonts */\n PS_Blend blend;\n\n /* undocumented, optional: indices of subroutines that express */\n /* the NormalizeDesignVector and the ConvertDesignVector procedure, */\n /* respectively, as Type 2 charstrings; -1 if keywords not present */\n FT_Int ndv_idx;\n FT_Int cdv_idx;\n\n /* undocumented, optional: has the same meaning as len_buildchar */\n /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */\n FT_UInt len_buildchar;\n FT_Long* buildchar;\n\n /* since version 2.1 - interface to PostScript hinter */\n const void* pshinter;\n\n } T1_FaceRec;\n\n\n typedef struct CID_FaceRec_\n {\n FT_FaceRec root;\n void* psnames;\n void* psaux;\n CID_FaceInfoRec cid;\n PS_FontExtraRec font_extra;\n#if 0\n void* afm_data;\n#endif\n CID_Subrs subrs;\n\n /* since version 2.1 - interface to PostScript hinter */\n void* pshinter;\n\n /* since version 2.1.8, but was originally positioned after `afm_data' */\n FT_Byte* binary_data; /* used if hex data has been converted */\n FT_Stream cid_stream;\n\n } CID_FaceRec;\n\n\nFT_END_HEADER\n\n#endif /* T1TYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/tttypes.h", "language": "code", "loc": 1569, "comment_density": 0.788, "code": "/****************************************************************************\n *\n * tttypes.h\n *\n * Basic SFNT/TrueType type definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef TTTYPES_H_\n#define TTTYPES_H_\n\n\n#include \n#include FT_TRUETYPE_TABLES_H\n#include FT_INTERNAL_OBJECTS_H\n#include FT_COLOR_H\n\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\n#include FT_MULTIPLE_MASTERS_H\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * TTC_HeaderRec\n *\n * @description:\n * TrueType collection header. This table contains the offsets of the\n * font headers of each distinct TrueType face in the file.\n *\n * @fields:\n * tag ::\n * Must be 'ttc~' to indicate a TrueType collection.\n *\n * version ::\n * The version number.\n *\n * count ::\n * The number of faces in the collection. The specification says this\n * should be an unsigned long, but we use a signed long since we need\n * the value -1 for specific purposes.\n *\n * offsets ::\n * The offsets of the font headers, one per face.\n */\n typedef struct TTC_HeaderRec_\n {\n FT_ULong tag;\n FT_Fixed version;\n FT_Long count;\n FT_ULong* offsets;\n\n } TTC_HeaderRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * SFNT_HeaderRec\n *\n * @description:\n * SFNT file format header.\n *\n * @fields:\n * format_tag ::\n * The font format tag.\n *\n * num_tables ::\n * The number of tables in file.\n *\n * search_range ::\n * Must be '16 * (max power of 2 <= num_tables)'.\n *\n * entry_selector ::\n * Must be log2 of 'search_range / 16'.\n *\n * range_shift ::\n * Must be 'num_tables * 16 - search_range'.\n */\n typedef struct SFNT_HeaderRec_\n {\n FT_ULong format_tag;\n FT_UShort num_tables;\n FT_UShort search_range;\n FT_UShort entry_selector;\n FT_UShort range_shift;\n\n FT_ULong offset; /* not in file */\n\n } SFNT_HeaderRec, *SFNT_Header;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_TableRec\n *\n * @description:\n * This structure describes a given table of a TrueType font.\n *\n * @fields:\n * Tag ::\n * A four-bytes tag describing the table.\n *\n * CheckSum ::\n * The table checksum. This value can be ignored.\n *\n * Offset ::\n * The offset of the table from the start of the TrueType font in its\n * resource.\n *\n * Length ::\n * The table length (in bytes).\n */\n typedef struct TT_TableRec_\n {\n FT_ULong Tag; /* table type */\n FT_ULong CheckSum; /* table checksum */\n FT_ULong Offset; /* table file offset */\n FT_ULong Length; /* table length */\n\n } TT_TableRec, *TT_Table;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_LongMetricsRec\n *\n * @description:\n * A structure modeling the long metrics of the 'hmtx' and 'vmtx'\n * TrueType tables. The values are expressed in font units.\n *\n * @fields:\n * advance ::\n * The advance width or height for the glyph.\n *\n * bearing ::\n * The left-side or top-side bearing for the glyph.\n */\n typedef struct TT_LongMetricsRec_\n {\n FT_UShort advance;\n FT_Short bearing;\n\n } TT_LongMetricsRec, *TT_LongMetrics;\n\n\n /**************************************************************************\n *\n * @type:\n * TT_ShortMetrics\n *\n * @description:\n * A simple type to model the short metrics of the 'hmtx' and 'vmtx'\n * tables.\n */\n typedef FT_Short TT_ShortMetrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_NameRec\n *\n * @description:\n * A structure modeling TrueType name records. Name records are used to\n * store important strings like family name, style name, copyright,\n * etc. in _localized_ versions (i.e., language, encoding, etc).\n *\n * @fields:\n * platformID ::\n * The ID of the name's encoding platform.\n *\n * encodingID ::\n * The platform-specific ID for the name's encoding.\n *\n * languageID ::\n * The platform-specific ID for the name's language.\n *\n * nameID ::\n * The ID specifying what kind of name this is.\n *\n * stringLength ::\n * The length of the string in bytes.\n *\n * stringOffset ::\n * The offset to the string in the 'name' table.\n *\n * string ::\n * A pointer to the string's bytes. Note that these are usually UTF-16\n * encoded characters.\n */\n typedef struct TT_NameRec_\n {\n FT_UShort platformID;\n FT_UShort encodingID;\n FT_UShort languageID;\n FT_UShort nameID;\n FT_UShort stringLength;\n FT_ULong stringOffset;\n\n /* this last field is not defined in the spec */\n /* but used by the FreeType engine */\n\n FT_Byte* string;\n\n } TT_NameRec, *TT_Name;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_LangTagRec\n *\n * @description:\n * A structure modeling language tag records in SFNT 'name' tables,\n * introduced in OpenType version 1.6.\n *\n * @fields:\n * stringLength ::\n * The length of the string in bytes.\n *\n * stringOffset ::\n * The offset to the string in the 'name' table.\n *\n * string ::\n * A pointer to the string's bytes. Note that these are UTF-16BE\n * encoded characters.\n */\n typedef struct TT_LangTagRec_\n {\n FT_UShort stringLength;\n FT_ULong stringOffset;\n\n /* this last field is not defined in the spec */\n /* but used by the FreeType engine */\n\n FT_Byte* string;\n\n } TT_LangTagRec, *TT_LangTag;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_NameTableRec\n *\n * @description:\n * A structure modeling the TrueType name table.\n *\n * @fields:\n * format ::\n * The format of the name table.\n *\n * numNameRecords ::\n * The number of names in table.\n *\n * storageOffset ::\n * The offset of the name table in the 'name' TrueType table.\n *\n * names ::\n * An array of name records.\n *\n * numLangTagRecords ::\n * The number of language tags in table.\n *\n * langTags ::\n * An array of language tag records.\n *\n * stream ::\n * The file's input stream.\n */\n typedef struct TT_NameTableRec_\n {\n FT_UShort format;\n FT_UInt numNameRecords;\n FT_UInt storageOffset;\n TT_NameRec* names;\n FT_UInt numLangTagRecords;\n TT_LangTagRec* langTags;\n FT_Stream stream;\n\n } TT_NameTableRec, *TT_NameTable;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_GaspRangeRec\n *\n * @description:\n * A tiny structure used to model a gasp range according to the TrueType\n * specification.\n *\n * @fields:\n * maxPPEM ::\n * The maximum ppem value to which `gaspFlag` applies.\n *\n * gaspFlag ::\n * A flag describing the grid-fitting and anti-aliasing modes to be\n * used.\n */\n typedef struct TT_GaspRangeRec_\n {\n FT_UShort maxPPEM;\n FT_UShort gaspFlag;\n\n } TT_GaspRangeRec, *TT_GaspRange;\n\n\n#define TT_GASP_GRIDFIT 0x01\n#define TT_GASP_DOGRAY 0x02\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_GaspRec\n *\n * @description:\n * A structure modeling the TrueType 'gasp' table used to specify\n * grid-fitting and anti-aliasing behaviour.\n *\n * @fields:\n * version ::\n * The version number.\n *\n * numRanges ::\n * The number of gasp ranges in table.\n *\n * gaspRanges ::\n * An array of gasp ranges.\n */\n typedef struct TT_Gasp_\n {\n FT_UShort version;\n FT_UShort numRanges;\n TT_GaspRange gaspRanges;\n\n } TT_GaspRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** EMBEDDED BITMAPS SUPPORT ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_MetricsRec\n *\n * @description:\n * A structure used to hold the big metrics of a given glyph bitmap in a\n * TrueType or OpenType font. These are usually found in the 'EBDT'\n * (Microsoft) or 'bloc' (Apple) table.\n *\n * @fields:\n * height ::\n * The glyph height in pixels.\n *\n * width ::\n * The glyph width in pixels.\n *\n * horiBearingX ::\n * The horizontal left bearing.\n *\n * horiBearingY ::\n * The horizontal top bearing.\n *\n * horiAdvance ::\n * The horizontal advance.\n *\n * vertBearingX ::\n * The vertical left bearing.\n *\n * vertBearingY ::\n * The vertical top bearing.\n *\n * vertAdvance ::\n * The vertical advance.\n */\n typedef struct TT_SBit_MetricsRec_\n {\n FT_UShort height;\n FT_UShort width;\n\n FT_Short horiBearingX;\n FT_Short horiBearingY;\n FT_UShort horiAdvance;\n\n FT_Short vertBearingX;\n FT_Short vertBearingY;\n FT_UShort vertAdvance;\n\n } TT_SBit_MetricsRec, *TT_SBit_Metrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_SmallMetricsRec\n *\n * @description:\n * A structure used to hold the small metrics of a given glyph bitmap in\n * a TrueType or OpenType font. These are usually found in the 'EBDT'\n * (Microsoft) or the 'bdat' (Apple) table.\n *\n * @fields:\n * height ::\n * The glyph height in pixels.\n *\n * width ::\n * The glyph width in pixels.\n *\n * bearingX ::\n * The left-side bearing.\n *\n * bearingY ::\n * The top-side bearing.\n *\n * advance ::\n * The advance width or height.\n */\n typedef struct TT_SBit_Small_Metrics_\n {\n FT_Byte height;\n FT_Byte width;\n\n FT_Char bearingX;\n FT_Char bearingY;\n FT_Byte advance;\n\n } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_LineMetricsRec\n *\n * @description:\n * A structure used to describe the text line metrics of a given bitmap\n * strike, for either a horizontal or vertical layout.\n *\n * @fields:\n * ascender ::\n * The ascender in pixels.\n *\n * descender ::\n * The descender in pixels.\n *\n * max_width ::\n * The maximum glyph width in pixels.\n *\n * caret_slope_enumerator ::\n * Rise of the caret slope, typically set to 1 for non-italic fonts.\n *\n * caret_slope_denominator ::\n * Rise of the caret slope, typically set to 0 for non-italic fonts.\n *\n * caret_offset ::\n * Offset in pixels to move the caret for proper positioning.\n *\n * min_origin_SB ::\n * Minimum of horiBearingX (resp. vertBearingY).\n * min_advance_SB ::\n * Minimum of\n *\n * horizontal advance - ( horiBearingX + width )\n *\n * resp.\n *\n * vertical advance - ( vertBearingY + height )\n *\n * max_before_BL ::\n * Maximum of horiBearingY (resp. vertBearingY).\n *\n * min_after_BL ::\n * Minimum of\n *\n * horiBearingY - height\n *\n * resp.\n *\n * vertBearingX - width\n *\n * pads ::\n * Unused (to make the size of the record a multiple of 32 bits.\n */\n typedef struct TT_SBit_LineMetricsRec_\n {\n FT_Char ascender;\n FT_Char descender;\n FT_Byte max_width;\n FT_Char caret_slope_numerator;\n FT_Char caret_slope_denominator;\n FT_Char caret_offset;\n FT_Char min_origin_SB;\n FT_Char min_advance_SB;\n FT_Char max_before_BL;\n FT_Char min_after_BL;\n FT_Char pads[2];\n\n } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_RangeRec\n *\n * @description:\n * A TrueType/OpenType subIndexTable as defined in the 'EBLC' (Microsoft)\n * or 'bloc' (Apple) tables.\n *\n * @fields:\n * first_glyph ::\n * The first glyph index in the range.\n *\n * last_glyph ::\n * The last glyph index in the range.\n *\n * index_format ::\n * The format of index table. Valid values are 1 to 5.\n *\n * image_format ::\n * The format of 'EBDT' image data.\n *\n * image_offset ::\n * The offset to image data in 'EBDT'.\n *\n * image_size ::\n * For index formats 2 and 5. This is the size in bytes of each glyph\n * bitmap.\n *\n * big_metrics ::\n * For index formats 2 and 5. This is the big metrics for each glyph\n * bitmap.\n *\n * num_glyphs ::\n * For index formats 4 and 5. This is the number of glyphs in the code\n * array.\n *\n * glyph_offsets ::\n * For index formats 1 and 3.\n *\n * glyph_codes ::\n * For index formats 4 and 5.\n *\n * table_offset ::\n * The offset of the index table in the 'EBLC' table. Only used during\n * strike loading.\n */\n typedef struct TT_SBit_RangeRec_\n {\n FT_UShort first_glyph;\n FT_UShort last_glyph;\n\n FT_UShort index_format;\n FT_UShort image_format;\n FT_ULong image_offset;\n\n FT_ULong image_size;\n TT_SBit_MetricsRec metrics;\n FT_ULong num_glyphs;\n\n FT_ULong* glyph_offsets;\n FT_UShort* glyph_codes;\n\n FT_ULong table_offset;\n\n } TT_SBit_RangeRec, *TT_SBit_Range;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_StrikeRec\n *\n * @description:\n * A structure used describe a given bitmap strike in the 'EBLC'\n * (Microsoft) or 'bloc' (Apple) tables.\n *\n * @fields:\n * num_index_ranges ::\n * The number of index ranges.\n *\n * index_ranges ::\n * An array of glyph index ranges.\n *\n * color_ref ::\n * Unused. `color_ref` is put in for future enhancements, but these\n * fields are already in use by other platforms (e.g. Newton). For\n * details, please see\n *\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bloc.html\n *\n * hori ::\n * The line metrics for horizontal layouts.\n *\n * vert ::\n * The line metrics for vertical layouts.\n *\n * start_glyph ::\n * The lowest glyph index for this strike.\n *\n * end_glyph ::\n * The highest glyph index for this strike.\n *\n * x_ppem ::\n * The number of horizontal pixels per EM.\n *\n * y_ppem ::\n * The number of vertical pixels per EM.\n *\n * bit_depth ::\n * The bit depth. Valid values are 1, 2, 4, and 8.\n *\n * flags ::\n * Is this a vertical or horizontal strike? For details, please see\n *\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bloc.html\n */\n typedef struct TT_SBit_StrikeRec_\n {\n FT_Int num_ranges;\n TT_SBit_Range sbit_ranges;\n FT_ULong ranges_offset;\n\n FT_ULong color_ref;\n\n TT_SBit_LineMetricsRec hori;\n TT_SBit_LineMetricsRec vert;\n\n FT_UShort start_glyph;\n FT_UShort end_glyph;\n\n FT_Byte x_ppem;\n FT_Byte y_ppem;\n\n FT_Byte bit_depth;\n FT_Char flags;\n\n } TT_SBit_StrikeRec, *TT_SBit_Strike;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_ComponentRec\n *\n * @description:\n * A simple structure to describe a compound sbit element.\n *\n * @fields:\n * glyph_code ::\n * The element's glyph index.\n *\n * x_offset ::\n * The element's left bearing.\n *\n * y_offset ::\n * The element's top bearing.\n */\n typedef struct TT_SBit_ComponentRec_\n {\n FT_UShort glyph_code;\n FT_Char x_offset;\n FT_Char y_offset;\n\n } TT_SBit_ComponentRec, *TT_SBit_Component;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_ScaleRec\n *\n * @description:\n * A structure used describe a given bitmap scaling table, as defined in\n * the 'EBSC' table.\n *\n * @fields:\n * hori ::\n * The horizontal line metrics.\n *\n * vert ::\n * The vertical line metrics.\n *\n * x_ppem ::\n * The number of horizontal pixels per EM.\n *\n * y_ppem ::\n * The number of vertical pixels per EM.\n *\n * x_ppem_substitute ::\n * Substitution x_ppem value.\n *\n * y_ppem_substitute ::\n * Substitution y_ppem value.\n */\n typedef struct TT_SBit_ScaleRec_\n {\n TT_SBit_LineMetricsRec hori;\n TT_SBit_LineMetricsRec vert;\n\n FT_Byte x_ppem;\n FT_Byte y_ppem;\n\n FT_Byte x_ppem_substitute;\n FT_Byte y_ppem_substitute;\n\n } TT_SBit_ScaleRec, *TT_SBit_Scale;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Post_20Rec\n *\n * @description:\n * Postscript names sub-table, format 2.0. Stores the PS name of each\n * glyph in the font face.\n *\n * @fields:\n * num_glyphs ::\n * The number of named glyphs in the table.\n *\n * num_names ::\n * The number of PS names stored in the table.\n *\n * glyph_indices ::\n * The indices of the glyphs in the names arrays.\n *\n * glyph_names ::\n * The PS names not in Mac Encoding.\n */\n typedef struct TT_Post_20Rec_\n {\n FT_UShort num_glyphs;\n FT_UShort num_names;\n FT_UShort* glyph_indices;\n FT_Char** glyph_names;\n\n } TT_Post_20Rec, *TT_Post_20;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Post_25Rec\n *\n * @description:\n * Postscript names sub-table, format 2.5. Stores the PS name of each\n * glyph in the font face.\n *\n * @fields:\n * num_glyphs ::\n * The number of glyphs in the table.\n *\n * offsets ::\n * An array of signed offsets in a normal Mac Postscript name encoding.\n */\n typedef struct TT_Post_25_\n {\n FT_UShort num_glyphs;\n FT_Char* offsets;\n\n } TT_Post_25Rec, *TT_Post_25;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Post_NamesRec\n *\n * @description:\n * Postscript names table, either format 2.0 or 2.5.\n *\n * @fields:\n * loaded ::\n * A flag to indicate whether the PS names are loaded.\n *\n * format_20 ::\n * The sub-table used for format 2.0.\n *\n * format_25 ::\n * The sub-table used for format 2.5.\n */\n typedef struct TT_Post_NamesRec_\n {\n FT_Bool loaded;\n\n union\n {\n TT_Post_20Rec format_20;\n TT_Post_25Rec format_25;\n\n } names;\n\n } TT_Post_NamesRec, *TT_Post_Names;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** GX VARIATION TABLE SUPPORT ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\n typedef struct GX_BlendRec_ *GX_Blend;\n#endif\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** EMBEDDED BDF PROPERTIES TABLE SUPPORT ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n /*\n * These types are used to support a `BDF ' table that isn't part of the\n * official TrueType specification. It is mainly used in SFNT-based bitmap\n * fonts that were generated from a set of BDF fonts.\n *\n * The format of the table is as follows.\n *\n * USHORT version `BDF ' table version number, should be 0x0001. USHORT\n * strikeCount Number of strikes (bitmap sizes) in this table. ULONG\n * stringTable Offset (from start of BDF table) to string\n * table.\n *\n * This is followed by an array of `strikeCount' descriptors, having the\n * following format.\n *\n * USHORT ppem Vertical pixels per EM for this strike. USHORT numItems\n * Number of items for this strike (properties and\n * atoms). Maximum is 255.\n *\n * This array in turn is followed by `strikeCount' value sets. Each `value\n * set' is an array of `numItems' items with the following format.\n *\n * ULONG item_name Offset in string table to item name.\n * USHORT item_type The item type. Possible values are\n * 0 => string (e.g., COMMENT)\n * 1 => atom (e.g., FONT or even SIZE)\n * 2 => int32\n * 3 => uint32\n * 0x10 => A flag to indicate a properties. This\n * is ORed with the above values.\n * ULONG item_value For strings => Offset into string table without\n * the corresponding double quotes.\n * For atoms => Offset into string table.\n * For integers => Direct value.\n *\n * All strings in the string table consist of bytes and are\n * zero-terminated.\n *\n */\n\n#ifdef TT_CONFIG_OPTION_BDF\n\n typedef struct TT_BDFRec_\n {\n FT_Byte* table;\n FT_Byte* table_end;\n FT_Byte* strings;\n FT_ULong strings_size;\n FT_UInt num_strikes;\n FT_Bool loaded;\n\n } TT_BDFRec, *TT_BDF;\n\n#endif /* TT_CONFIG_OPTION_BDF */\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** ORIGINAL TT_FACE CLASS DEFINITION ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * This structure/class is defined here because it is common to the\n * following formats: TTF, OpenType-TT, and OpenType-CFF.\n *\n * Note, however, that the classes TT_Size and TT_GlyphSlot are not shared\n * between font drivers, and are thus defined in `ttobjs.h`.\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * TT_Face\n *\n * @description:\n * A handle to a TrueType face/font object. A TT_Face encapsulates the\n * resolution and scaling independent parts of a TrueType font resource.\n *\n * @note:\n * The TT_Face structure is also used as a 'parent class' for the\n * OpenType-CFF class (T2_Face).\n */\n typedef struct TT_FaceRec_* TT_Face;\n\n\n /* a function type used for the truetype bytecode interpreter hooks */\n typedef FT_Error\n (*TT_Interpreter)( void* exec_context );\n\n /* forward declaration */\n typedef struct TT_LoaderRec_* TT_Loader;\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Loader_GotoTableFunc\n *\n * @description:\n * Seeks a stream to the start of a given TrueType table.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * tag ::\n * A 4-byte tag used to name the table.\n *\n * stream ::\n * The input stream.\n *\n * @output:\n * length ::\n * The length of the table in bytes. Set to 0 if not needed.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The stream cursor must be at the font file's origin.\n */\n typedef FT_Error\n (*TT_Loader_GotoTableFunc)( TT_Face face,\n FT_ULong tag,\n FT_Stream stream,\n FT_ULong* length );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Loader_StartGlyphFunc\n *\n * @description:\n * Seeks a stream to the start of a given glyph element, and opens a\n * frame for it.\n *\n * @input:\n * loader ::\n * The current TrueType glyph loader object.\n *\n * glyph index :: The index of the glyph to access.\n *\n * offset ::\n * The offset of the glyph according to the 'locations' table.\n *\n * byte_count ::\n * The size of the frame in bytes.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * This function is normally equivalent to FT_STREAM_SEEK(offset)\n * followed by FT_FRAME_ENTER(byte_count) with the loader's stream, but\n * alternative formats (e.g. compressed ones) might use something\n * different.\n */\n typedef FT_Error\n (*TT_Loader_StartGlyphFunc)( TT_Loader loader,\n FT_UInt glyph_index,\n FT_ULong offset,\n FT_UInt byte_count );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Loader_ReadGlyphFunc\n *\n * @description:\n * Reads one glyph element (its header, a simple glyph, or a composite)\n * from the loader's current stream frame.\n *\n * @input:\n * loader ::\n * The current TrueType glyph loader object.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Loader_ReadGlyphFunc)( TT_Loader loader );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Loader_EndGlyphFunc\n *\n * @description:\n * Closes the current loader stream frame for the glyph.\n *\n * @input:\n * loader ::\n * The current TrueType glyph loader object.\n */\n typedef void\n (*TT_Loader_EndGlyphFunc)( TT_Loader loader );\n\n\n typedef enum TT_SbitTableType_\n {\n TT_SBIT_TABLE_TYPE_NONE = 0,\n TT_SBIT_TABLE_TYPE_EBLC, /* `EBLC' (Microsoft), */\n /* `bloc' (Apple) */\n TT_SBIT_TABLE_TYPE_CBLC, /* `CBLC' (Google) */\n TT_SBIT_TABLE_TYPE_SBIX, /* `sbix' (Apple) */\n\n /* do not remove */\n TT_SBIT_TABLE_TYPE_MAX\n\n } TT_SbitTableType;\n\n\n /* OpenType 1.8 brings new tables for variation font support; */\n /* to make the old MM and GX fonts still work we need to check */\n /* the presence (and validity) of the functionality provided */\n /* by those tables. The following flag macros are for the */\n /* field `variation_support'. */\n /* */\n /* Note that `fvar' gets checked immediately at font loading, */\n /* while the other features are only loaded if MM support is */\n /* actually requested. */\n\n /* FVAR */\n#define TT_FACE_FLAG_VAR_FVAR ( 1 << 0 )\n\n /* HVAR */\n#define TT_FACE_FLAG_VAR_HADVANCE ( 1 << 1 )\n#define TT_FACE_FLAG_VAR_LSB ( 1 << 2 )\n#define TT_FACE_FLAG_VAR_RSB ( 1 << 3 )\n\n /* VVAR */\n#define TT_FACE_FLAG_VAR_VADVANCE ( 1 << 4 )\n#define TT_FACE_FLAG_VAR_TSB ( 1 << 5 )\n#define TT_FACE_FLAG_VAR_BSB ( 1 << 6 )\n#define TT_FACE_FLAG_VAR_VORG ( 1 << 7 )\n\n /* MVAR */\n#define TT_FACE_FLAG_VAR_MVAR ( 1 << 8 )\n\n\n /**************************************************************************\n *\n * TrueType Face Type\n *\n * @struct:\n * TT_Face\n *\n * @description:\n * The TrueType face class. These objects model the resolution and\n * point-size independent data found in a TrueType font file.\n *\n * @fields:\n * root ::\n * The base FT_Face structure, managed by the base layer.\n *\n * ttc_header ::\n * The TrueType collection header, used when the file is a 'ttc' rather\n * than a 'ttf'. For ordinary font files, the field `ttc_header.count`\n * is set to 0.\n *\n * format_tag ::\n * The font format tag.\n *\n * num_tables ::\n * The number of TrueType tables in this font file.\n *\n * dir_tables ::\n * The directory of TrueType tables for this font file.\n *\n * header ::\n * The font's font header ('head' table). Read on font opening.\n *\n * horizontal ::\n * The font's horizontal header ('hhea' table). This field also\n * contains the associated horizontal metrics table ('hmtx').\n *\n * max_profile ::\n * The font's maximum profile table. Read on font opening. Note that\n * some maximum values cannot be taken directly from this table. We\n * thus define additional fields below to hold the computed maxima.\n *\n * vertical_info ::\n * A boolean which is set when the font file contains vertical metrics.\n * If not, the value of the 'vertical' field is undefined.\n *\n * vertical ::\n * The font's vertical header ('vhea' table). This field also contains\n * the associated vertical metrics table ('vmtx'), if found.\n * IMPORTANT: The contents of this field is undefined if the\n * `vertical_info` field is unset.\n *\n * num_names ::\n * The number of name records within this TrueType font.\n *\n * name_table ::\n * The table of name records ('name').\n *\n * os2 ::\n * The font's OS/2 table ('OS/2').\n *\n * postscript ::\n * The font's PostScript table ('post' table). The PostScript glyph\n * names are not loaded by the driver on face opening. See the\n * 'ttpost' module for more details.\n *\n * cmap_table ::\n * Address of the face's 'cmap' SFNT table in memory (it's an extracted\n * frame).\n *\n * cmap_size ::\n * The size in bytes of the `cmap_table` described above.\n *\n * goto_table ::\n * A function called by each TrueType table loader to position a\n * stream's cursor to the start of a given table according to its tag.\n * It defaults to TT_Goto_Face but can be different for strange formats\n * (e.g. Type 42).\n *\n * access_glyph_frame ::\n * A function used to access the frame of a given glyph within the\n * face's font file.\n *\n * forget_glyph_frame ::\n * A function used to forget the frame of a given glyph when all data\n * has been loaded.\n *\n * read_glyph_header ::\n * A function used to read a glyph header. It must be called between\n * an 'access' and 'forget'.\n *\n * read_simple_glyph ::\n * A function used to read a simple glyph. It must be called after the\n * header was read, and before the 'forget'.\n *\n * read_composite_glyph ::\n * A function used to read a composite glyph. It must be called after\n * the header was read, and before the 'forget'.\n *\n * sfnt ::\n * A pointer to the SFNT service.\n *\n * psnames ::\n * A pointer to the PostScript names service.\n *\n * mm ::\n * A pointer to the Multiple Masters service.\n *\n * var ::\n * A pointer to the Metrics Variations service.\n *\n * hdmx ::\n * The face's horizontal device metrics ('hdmx' table). This table is\n * optional in TrueType/OpenType fonts.\n *\n * gasp ::\n * The grid-fitting and scaling properties table ('gasp'). This table\n * is optional in TrueType/OpenType fonts.\n *\n * pclt ::\n * The 'pclt' SFNT table.\n *\n * num_sbit_scales ::\n * The number of sbit scales for this font.\n *\n * sbit_scales ::\n * Array of sbit scales embedded in this font. This table is optional\n * in a TrueType/OpenType font.\n *\n * postscript_names ::\n * A table used to store the Postscript names of the glyphs for this\n * font. See the file `ttconfig.h` for comments on the\n * TT_CONFIG_OPTION_POSTSCRIPT_NAMES option.\n *\n * palette_data ::\n * Some fields from the 'CPAL' table that are directly indexed.\n *\n * palette_index ::\n * The current palette index, as set by @FT_Palette_Select.\n *\n * palette ::\n * An array containing the current palette's colors.\n *\n * have_foreground_color ::\n * There was a call to @FT_Palette_Set_Foreground_Color.\n *\n * foreground_color ::\n * The current foreground color corresponding to 'CPAL' color index\n * 0xFFFF. Only valid if `have_foreground_color` is set.\n *\n * font_program_size ::\n * Size in bytecodes of the face's font program. 0 if none defined.\n * Ignored for Type 2 fonts.\n *\n * font_program ::\n * The face's font program (bytecode stream) executed at load time,\n * also used during glyph rendering. Comes from the 'fpgm' table.\n * Ignored for Type 2 font fonts.\n *\n * cvt_program_size ::\n * The size in bytecodes of the face's cvt program. Ignored for Type 2\n * fonts.\n *\n * cvt_program ::\n * The face's cvt program (bytecode stream) executed each time an\n * instance/size is changed/reset. Comes from the 'prep' table.\n * Ignored for Type 2 fonts.\n *\n * cvt_size ::\n * Size of the control value table (in entries). Ignored for Type 2\n * fonts.\n *\n * cvt ::\n * The face's original control value table. Coordinates are expressed\n * in unscaled font units (in 26.6 format). Comes from the 'cvt~'\n * table. Ignored for Type 2 fonts.\n *\n * If varied by the `CVAR' table, non-integer values are possible.\n *\n * interpreter ::\n * A pointer to the TrueType bytecode interpreters field is also used\n * to hook the debugger in 'ttdebug'.\n *\n * extra ::\n * Reserved for third-party font drivers.\n *\n * postscript_name ::\n * The PS name of the font. Used by the postscript name service.\n *\n * glyf_len ::\n * The length of the 'glyf' table. Needed for malformed 'loca' tables.\n *\n * glyf_offset ::\n * The file offset of the 'glyf' table.\n *\n * is_cff2 ::\n * Set if the font format is CFF2.\n *\n * doblend ::\n * A boolean which is set if the font should be blended (this is for GX\n * var).\n *\n * blend ::\n * Contains the data needed to control GX variation tables (rather like\n * Multiple Master data).\n *\n * variation_support ::\n * Flags that indicate which OpenType functionality related to font\n * variation support is present, valid, and usable. For example,\n * TT_FACE_FLAG_VAR_FVAR is only set if we have at least one design\n * axis.\n *\n * var_postscript_prefix ::\n * The PostScript name prefix needed for constructing a variation font\n * instance's PS name .\n *\n * var_postscript_prefix_len ::\n * The length of the `var_postscript_prefix` string.\n *\n * horz_metrics_size ::\n * The size of the 'hmtx' table.\n *\n * vert_metrics_size ::\n * The size of the 'vmtx' table.\n *\n * num_locations ::\n * The number of glyph locations in this TrueType file. This should be\n * identical to the number of glyphs. Ignored for Type 2 fonts.\n *\n * glyph_locations ::\n * An array of longs. These are offsets to glyph data within the\n * 'glyf' table. Ignored for Type 2 font faces.\n *\n * hdmx_table ::\n * A pointer to the 'hdmx' table.\n *\n * hdmx_table_size ::\n * The size of the 'hdmx' table.\n *\n * hdmx_record_count ::\n * The number of hdmx records.\n *\n * hdmx_record_size ::\n * The size of a single hdmx record.\n *\n * hdmx_record_sizes ::\n * An array holding the ppem sizes available in the 'hdmx' table.\n *\n * sbit_table ::\n * A pointer to the font's embedded bitmap location table.\n *\n * sbit_table_size ::\n * The size of `sbit_table`.\n *\n * sbit_table_type ::\n * The sbit table type (CBLC, sbix, etc.).\n *\n * sbit_num_strikes ::\n * The number of sbit strikes exposed by FreeType's API, omitting\n * invalid strikes.\n *\n * sbit_strike_map ::\n * A mapping between the strike indices exposed by the API and the\n * indices used in the font's sbit table.\n *\n * cpal ::\n * A pointer to data related to the 'CPAL' table. `NULL` if the table\n * is not available.\n *\n * colr ::\n * A pointer to data related to the 'COLR' table. `NULL` if the table\n * is not available.\n *\n * kern_table ::\n * A pointer to the 'kern' table.\n *\n * kern_table_size ::\n * The size of the 'kern' table.\n *\n * num_kern_tables ::\n * The number of supported kern subtables (up to 32; FreeType\n * recognizes only horizontal ones with format 0).\n *\n * kern_avail_bits ::\n * The availability status of kern subtables; if bit n is set, table n\n * is available.\n *\n * kern_order_bits ::\n * The sortedness status of kern subtables; if bit n is set, table n is\n * sorted.\n *\n * bdf ::\n * Data related to an SFNT font's 'bdf' table; see `tttypes.h`.\n *\n * horz_metrics_offset ::\n * The file offset of the 'hmtx' table.\n *\n * vert_metrics_offset ::\n * The file offset of the 'vmtx' table.\n *\n * sph_found_func_flags ::\n * Flags identifying special bytecode functions (used by the v38\n * implementation of the bytecode interpreter).\n *\n * sph_compatibility_mode ::\n * This flag is set if we are in ClearType backward compatibility mode\n * (used by the v38 implementation of the bytecode interpreter).\n *\n * ebdt_start ::\n * The file offset of the sbit data table (CBDT, bdat, etc.).\n *\n * ebdt_size ::\n * The size of the sbit data table.\n */\n typedef struct TT_FaceRec_\n {\n FT_FaceRec root;\n\n TTC_HeaderRec ttc_header;\n\n FT_ULong format_tag;\n FT_UShort num_tables;\n TT_Table dir_tables;\n\n TT_Header header; /* TrueType header table */\n TT_HoriHeader horizontal; /* TrueType horizontal header */\n\n TT_MaxProfile max_profile;\n\n FT_Bool vertical_info;\n TT_VertHeader vertical; /* TT Vertical header, if present */\n\n FT_UShort num_names; /* number of name records */\n TT_NameTableRec name_table; /* name table */\n\n TT_OS2 os2; /* TrueType OS/2 table */\n TT_Postscript postscript; /* TrueType Postscript table */\n\n FT_Byte* cmap_table; /* extracted `cmap' table */\n FT_ULong cmap_size;\n\n TT_Loader_GotoTableFunc goto_table;\n\n TT_Loader_StartGlyphFunc access_glyph_frame;\n TT_Loader_EndGlyphFunc forget_glyph_frame;\n TT_Loader_ReadGlyphFunc read_glyph_header;\n TT_Loader_ReadGlyphFunc read_simple_glyph;\n TT_Loader_ReadGlyphFunc read_composite_glyph;\n\n /* a typeless pointer to the SFNT_Interface table used to load */\n /* the basic TrueType tables in the face object */\n void* sfnt;\n\n /* a typeless pointer to the FT_Service_PsCMapsRec table used to */\n /* handle glyph names <-> unicode & Mac values */\n void* psnames;\n\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\n /* a typeless pointer to the FT_Service_MultiMasters table used to */\n /* handle variation fonts */\n void* mm;\n\n /* a typeless pointer to the FT_Service_MetricsVariationsRec table */\n /* used to handle the HVAR, VVAR, and MVAR OpenType tables */\n void* var;\n#endif\n\n /* a typeless pointer to the PostScript Aux service */\n void* psaux;\n\n\n /************************************************************************\n *\n * Optional TrueType/OpenType tables\n *\n */\n\n /* grid-fitting and scaling table */\n TT_GaspRec gasp; /* the `gasp' table */\n\n /* PCL 5 table */\n TT_PCLT pclt;\n\n /* embedded bitmaps support */\n FT_ULong num_sbit_scales;\n TT_SBit_Scale sbit_scales;\n\n /* postscript names table */\n TT_Post_NamesRec postscript_names;\n\n /* glyph colors */\n FT_Palette_Data palette_data; /* since 2.10 */\n FT_UShort palette_index;\n FT_Color* palette;\n FT_Bool have_foreground_color;\n FT_Color foreground_color;\n\n\n /************************************************************************\n *\n * TrueType-specific fields (ignored by the CFF driver)\n *\n */\n\n /* the font program, if any */\n FT_ULong font_program_size;\n FT_Byte* font_program;\n\n /* the cvt program, if any */\n FT_ULong cvt_program_size;\n FT_Byte* cvt_program;\n\n /* the original, unscaled, control value table */\n FT_ULong cvt_size;\n FT_Int32* cvt;\n\n /* A pointer to the bytecode interpreter to use. This is also */\n /* used to hook the debugger for the `ttdebug' utility. */\n TT_Interpreter interpreter;\n\n\n /************************************************************************\n *\n * Other tables or fields. This is used by derivative formats like\n * OpenType.\n *\n */\n\n FT_Generic extra;\n\n const char* postscript_name;\n\n FT_ULong glyf_len;\n FT_ULong glyf_offset; /* since 2.7.1 */\n\n FT_Bool is_cff2; /* since 2.7.1 */\n\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\n FT_Bool doblend;\n GX_Blend blend;\n\n FT_UInt32 variation_support; /* since 2.7.1 */\n\n const char* var_postscript_prefix; /* since 2.7.2 */\n FT_UInt var_postscript_prefix_len; /* since 2.7.2 */\n\n#endif\n\n /* since version 2.2 */\n\n FT_ULong horz_metrics_size;\n FT_ULong vert_metrics_size;\n\n FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */\n FT_Byte* glyph_locations;\n\n FT_Byte* hdmx_table;\n FT_ULong hdmx_table_size;\n FT_UInt hdmx_record_count;\n FT_ULong hdmx_record_size;\n FT_Byte* hdmx_record_sizes;\n\n FT_Byte* sbit_table;\n FT_ULong sbit_table_size;\n TT_SbitTableType sbit_table_type;\n FT_UInt sbit_num_strikes;\n FT_UInt* sbit_strike_map;\n\n FT_Byte* kern_table;\n FT_ULong kern_table_size;\n FT_UInt num_kern_tables;\n FT_UInt32 kern_avail_bits;\n FT_UInt32 kern_order_bits;\n\n#ifdef TT_CONFIG_OPTION_BDF\n TT_BDFRec bdf;\n#endif /* TT_CONFIG_OPTION_BDF */\n\n /* since 2.3.0 */\n FT_ULong horz_metrics_offset;\n FT_ULong vert_metrics_offset;\n\n#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY\n /* since 2.4.12 */\n FT_ULong sph_found_func_flags; /* special functions found */\n /* for this face */\n FT_Bool sph_compatibility_mode;\n#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */\n\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\n /* since 2.7 */\n FT_ULong ebdt_start; /* either `CBDT', `EBDT', or `bdat' */\n FT_ULong ebdt_size;\n#endif\n\n /* since 2.10 */\n void* cpal;\n void* colr;\n\n } TT_FaceRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_GlyphZoneRec\n *\n * @description:\n * A glyph zone is used to load, scale and hint glyph outline\n * coordinates.\n *\n * @fields:\n * memory ::\n * A handle to the memory manager.\n *\n * max_points ::\n * The maximum size in points of the zone.\n *\n * max_contours ::\n * Max size in links contours of the zone.\n *\n * n_points ::\n * The current number of points in the zone.\n *\n * n_contours ::\n * The current number of contours in the zone.\n *\n * org ::\n * The original glyph coordinates (font units/scaled).\n *\n * cur ::\n * The current glyph coordinates (scaled/hinted).\n *\n * tags ::\n * The point control tags.\n *\n * contours ::\n * The contours end points.\n *\n * first_point ::\n * Offset of the current subglyph's first point.\n */\n typedef struct TT_GlyphZoneRec_\n {\n FT_Memory memory;\n FT_UShort max_points;\n FT_Short max_contours;\n FT_UShort n_points; /* number of points in zone */\n FT_Short n_contours; /* number of contours */\n\n FT_Vector* org; /* original point coordinates */\n FT_Vector* cur; /* current point coordinates */\n FT_Vector* orus; /* original (unscaled) point coordinates */\n\n FT_Byte* tags; /* current touch flags */\n FT_UShort* contours; /* contour end points */\n\n FT_UShort first_point; /* offset of first (#0) point */\n\n } TT_GlyphZoneRec, *TT_GlyphZone;\n\n\n /* handle to execution context */\n typedef struct TT_ExecContextRec_* TT_ExecContext;\n\n\n /**************************************************************************\n *\n * @type:\n * TT_Size\n *\n * @description:\n * A handle to a TrueType size object.\n */\n typedef struct TT_SizeRec_* TT_Size;\n\n\n /* glyph loader structure */\n typedef struct TT_LoaderRec_\n {\n TT_Face face;\n TT_Size size;\n FT_GlyphSlot glyph;\n FT_GlyphLoader gloader;\n\n FT_ULong load_flags;\n FT_UInt glyph_index;\n\n FT_Stream stream;\n FT_Int byte_len;\n\n FT_Short n_contours;\n FT_BBox bbox;\n FT_Int left_bearing;\n FT_Int advance;\n FT_Int linear;\n FT_Bool linear_def;\n FT_Vector pp1;\n FT_Vector pp2;\n\n /* the zone where we load our glyphs */\n TT_GlyphZoneRec base;\n TT_GlyphZoneRec zone;\n\n TT_ExecContext exec;\n FT_Byte* instructions;\n FT_ULong ins_pos;\n\n /* for possible extensibility in other formats */\n void* other;\n\n /* since version 2.1.8 */\n FT_Int top_bearing;\n FT_Int vadvance;\n FT_Vector pp3;\n FT_Vector pp4;\n\n /* since version 2.2.1 */\n FT_Byte* cursor;\n FT_Byte* limit;\n\n /* since version 2.6.2 */\n FT_ListRec composites;\n\n } TT_LoaderRec;\n\n\nFT_END_HEADER\n\n#endif /* TTTYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/wofftypes.h", "language": "code", "loc": 274, "comment_density": 0.741, "code": "/****************************************************************************\n *\n * wofftypes.h\n *\n * Basic WOFF/WOFF2 type definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef WOFFTYPES_H_\n#define WOFFTYPES_H_\n\n\n#include \n#include FT_TRUETYPE_TABLES_H\n#include FT_INTERNAL_OBJECTS_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF_HeaderRec\n *\n * @description:\n * WOFF file format header.\n *\n * @fields:\n * See\n *\n * https://www.w3.org/TR/WOFF/#WOFFHeader\n */\n typedef struct WOFF_HeaderRec_\n {\n FT_ULong signature;\n FT_ULong flavor;\n FT_ULong length;\n FT_UShort num_tables;\n FT_UShort reserved;\n FT_ULong totalSfntSize;\n FT_UShort majorVersion;\n FT_UShort minorVersion;\n FT_ULong metaOffset;\n FT_ULong metaLength;\n FT_ULong metaOrigLength;\n FT_ULong privOffset;\n FT_ULong privLength;\n\n } WOFF_HeaderRec, *WOFF_Header;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF_TableRec\n *\n * @description:\n * This structure describes a given table of a WOFF font.\n *\n * @fields:\n * Tag ::\n * A four-bytes tag describing the table.\n *\n * Offset ::\n * The offset of the table from the start of the WOFF font in its\n * resource.\n *\n * CompLength ::\n * Compressed table length (in bytes).\n *\n * OrigLength ::\n * Uncompressed table length (in bytes).\n *\n * CheckSum ::\n * The table checksum. This value can be ignored.\n *\n * OrigOffset ::\n * The uncompressed table file offset. This value gets computed while\n * constructing the (uncompressed) SFNT header. It is not contained in\n * the WOFF file.\n */\n typedef struct WOFF_TableRec_\n {\n FT_ULong Tag; /* table ID */\n FT_ULong Offset; /* table file offset */\n FT_ULong CompLength; /* compressed table length */\n FT_ULong OrigLength; /* uncompressed table length */\n FT_ULong CheckSum; /* uncompressed checksum */\n\n FT_ULong OrigOffset; /* uncompressed table file offset */\n /* (not in the WOFF file) */\n } WOFF_TableRec, *WOFF_Table;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_TtcFontRec\n *\n * @description:\n * Metadata for a TTC font entry in WOFF2.\n *\n * @fields:\n * flavor ::\n * TTC font flavor.\n *\n * num_tables ::\n * Number of tables in TTC, indicating number of elements in\n * `table_indices`.\n *\n * table_indices ::\n * Array of table indices for each TTC font.\n */\n typedef struct WOFF2_TtcFontRec_\n {\n FT_ULong flavor;\n FT_UShort num_tables;\n FT_UShort* table_indices;\n\n } WOFF2_TtcFontRec, *WOFF2_TtcFont;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_HeaderRec\n *\n * @description:\n * WOFF2 file format header.\n *\n * @fields:\n * See\n *\n * https://www.w3.org/TR/WOFF2/#woff20Header\n *\n * @note:\n * We don't care about the fields `reserved`, `majorVersion` and\n * `minorVersion`, so they are not included. The `totalSfntSize` field\n * does not necessarily represent the actual size of the uncompressed\n * SFNT font stream, so that is used as a reference value instead.\n */\n typedef struct WOFF2_HeaderRec_\n {\n FT_ULong signature;\n FT_ULong flavor;\n FT_ULong length;\n FT_UShort num_tables;\n FT_ULong totalSfntSize;\n FT_ULong totalCompressedSize;\n FT_ULong metaOffset;\n FT_ULong metaLength;\n FT_ULong metaOrigLength;\n FT_ULong privOffset;\n FT_ULong privLength;\n\n FT_ULong uncompressed_size; /* uncompressed brotli stream size */\n FT_ULong compressed_offset; /* compressed stream offset */\n FT_ULong header_version; /* version of original TTC Header */\n FT_UShort num_fonts; /* number of fonts in TTC */\n FT_ULong actual_sfnt_size; /* actual size of sfnt stream */\n\n WOFF2_TtcFont ttc_fonts; /* metadata for fonts in a TTC */\n\n } WOFF2_HeaderRec, *WOFF2_Header;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_TableRec\n *\n * @description:\n * This structure describes a given table of a WOFF2 font.\n *\n * @fields:\n * See\n *\n * https://www.w3.org/TR/WOFF2/#table_dir_format\n */\n typedef struct WOFF2_TableRec_\n {\n FT_Byte FlagByte; /* table type and flags */\n FT_ULong Tag; /* table file offset */\n FT_ULong dst_length; /* uncompressed table length */\n FT_ULong TransformLength; /* transformed length */\n\n FT_ULong flags; /* calculated flags */\n FT_ULong src_offset; /* compressed table offset */\n FT_ULong src_length; /* compressed table length */\n FT_ULong dst_offset; /* uncompressed table offset */\n\n } WOFF2_TableRec, *WOFF2_Table;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_InfoRec\n *\n * @description:\n * Metadata for WOFF2 font that may be required for reconstruction of\n * sfnt tables.\n *\n * @fields:\n * header_checksum ::\n * Checksum of SFNT offset table.\n *\n * num_glyphs ::\n * Number of glyphs in the font.\n *\n * num_hmetrics ::\n * `numberOfHMetrics` field in the 'hhea' table.\n *\n * x_mins ::\n * `xMin` values of glyph bounding box.\n *\n * glyf_table ::\n * A pointer to the `glyf' table record.\n *\n * loca_table ::\n * A pointer to the `loca' table record.\n *\n * head_table ::\n * A pointer to the `head' table record.\n */\n typedef struct WOFF2_InfoRec_\n {\n FT_ULong header_checksum;\n FT_UShort num_glyphs;\n FT_UShort num_hmetrics;\n FT_Short* x_mins;\n\n WOFF2_Table glyf_table;\n WOFF2_Table loca_table;\n WOFF2_Table head_table;\n\n } WOFF2_InfoRec, *WOFF2_Info;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_SubstreamRec\n *\n * @description:\n * This structure stores information about a substream in the transformed\n * 'glyf' table in a WOFF2 stream.\n *\n * @fields:\n * start ::\n * Beginning of the substream relative to uncompressed table stream.\n *\n * offset ::\n * Offset of the substream relative to uncompressed table stream.\n *\n * size ::\n * Size of the substream.\n */\n typedef struct WOFF2_SubstreamRec_\n {\n FT_ULong start;\n FT_ULong offset;\n FT_ULong size;\n\n } WOFF2_SubstreamRec, *WOFF2_Substream;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_PointRec\n *\n * @description:\n * This structure stores information about a point in the transformed\n * 'glyf' table in a WOFF2 stream.\n *\n * @fields:\n * x ::\n * x-coordinate of point.\n *\n * y ::\n * y-coordinate of point.\n *\n * on_curve ::\n * Set if point is on-curve.\n */\n typedef struct WOFF2_PointRec_\n {\n FT_Int x;\n FT_Int y;\n FT_Bool on_curve;\n\n } WOFF2_PointRec, *WOFF2_Point;\n\n\nFT_END_HEADER\n\n#endif /* WOFFTYPES_H_ */\n\n\n/* END */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.551, "dedup_hash": "aaed5779475365f8", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_freetype_internal_services", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Services", "api": "OpenGL Core", "glsl_version": null, "topic": "shadows", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "includes/freetype/internal/services/svbdf.h", "language": "code", "loc": 46, "comment_density": 0.413, "code": "/****************************************************************************\n *\n * svbdf.h\n *\n * The FreeType BDF services (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVBDF_H_\n#define SVBDF_H_\n\n#include FT_BDF_H\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_BDF \"bdf\"\n\n typedef FT_Error\n (*FT_BDF_GetCharsetIdFunc)( FT_Face face,\n const char* *acharset_encoding,\n const char* *acharset_registry );\n\n typedef FT_Error\n (*FT_BDF_GetPropertyFunc)( FT_Face face,\n const char* prop_name,\n BDF_PropertyRec *aproperty );\n\n\n FT_DEFINE_SERVICE( BDF )\n {\n FT_BDF_GetCharsetIdFunc get_charset_id;\n FT_BDF_GetPropertyFunc get_property;\n };\n\n\n#define FT_DEFINE_SERVICE_BDFRec( class_, \\\n get_charset_id_, \\\n get_property_ ) \\\n static const FT_Service_BDFRec class_ = \\\n { \\\n get_charset_id_, get_property_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVBDF_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svcfftl.h", "language": "code", "loc": 67, "comment_density": 0.254, "code": "/****************************************************************************\n *\n * svcfftl.h\n *\n * The FreeType CFF tables loader service (specification).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVCFFTL_H_\n#define SVCFFTL_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_INTERNAL_CFF_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_CFF_LOAD \"cff-load\"\n\n\n typedef FT_UShort\n (*FT_Get_Standard_Encoding_Func)( FT_UInt charcode );\n\n typedef FT_Error\n (*FT_Load_Private_Dict_Func)( CFF_Font font,\n CFF_SubFont subfont,\n FT_UInt lenNDV,\n FT_Fixed* NDV );\n\n typedef FT_Byte\n (*FT_FD_Select_Get_Func)( CFF_FDSelect fdselect,\n FT_UInt glyph_index );\n\n typedef FT_Bool\n (*FT_Blend_Check_Vector_Func)( CFF_Blend blend,\n FT_UInt vsindex,\n FT_UInt lenNDV,\n FT_Fixed* NDV );\n\n typedef FT_Error\n (*FT_Blend_Build_Vector_Func)( CFF_Blend blend,\n FT_UInt vsindex,\n FT_UInt lenNDV,\n FT_Fixed* NDV );\n\n\n FT_DEFINE_SERVICE( CFFLoad )\n {\n FT_Get_Standard_Encoding_Func get_standard_encoding;\n FT_Load_Private_Dict_Func load_private_dict;\n FT_FD_Select_Get_Func fd_select_get;\n FT_Blend_Check_Vector_Func blend_check_vector;\n FT_Blend_Build_Vector_Func blend_build_vector;\n };\n\n\n#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \\\n get_standard_encoding_, \\\n load_private_dict_, \\\n fd_select_get_, \\\n blend_check_vector_, \\\n blend_build_vector_ ) \\\n static const FT_Service_CFFLoadRec class_ = \\\n { \\\n get_standard_encoding_, \\\n load_private_dict_, \\\n fd_select_get_, \\\n blend_check_vector_, \\\n blend_build_vector_ \\\n };\n\n\nFT_END_HEADER\n\n\n#endif\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svcid.h", "language": "code", "loc": 51, "comment_density": 0.373, "code": "/****************************************************************************\n *\n * svcid.h\n *\n * The FreeType CID font services (specification).\n *\n * Copyright (C) 2007-2020 by\n * Derek Clegg and Michael Toftdal.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVCID_H_\n#define SVCID_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_CID \"CID\"\n\n typedef FT_Error\n (*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face face,\n const char* *registry,\n const char* *ordering,\n FT_Int *supplement );\n typedef FT_Error\n (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face face,\n FT_Bool *is_cid );\n typedef FT_Error\n (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face face,\n FT_UInt glyph_index,\n FT_UInt *cid );\n\n FT_DEFINE_SERVICE( CID )\n {\n FT_CID_GetRegistryOrderingSupplementFunc get_ros;\n FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid;\n FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index;\n };\n\n\n#define FT_DEFINE_SERVICE_CIDREC( class_, \\\n get_ros_, \\\n get_is_cid_, \\\n get_cid_from_glyph_index_ ) \\\n static const FT_Service_CIDRec class_ = \\\n { \\\n get_ros_, get_is_cid_, get_cid_from_glyph_index_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVCID_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svfntfmt.h", "language": "code", "loc": 39, "comment_density": 0.615, "code": "/****************************************************************************\n *\n * svfntfmt.h\n *\n * The FreeType font format service (specification only).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVFNTFMT_H_\n#define SVFNTFMT_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * A trivial service used to return the name of a face's font driver,\n * according to the XFree86 nomenclature. Note that the service data is a\n * simple constant string pointer.\n */\n\n#define FT_SERVICE_ID_FONT_FORMAT \"font-format\"\n\n#define FT_FONT_FORMAT_TRUETYPE \"TrueType\"\n#define FT_FONT_FORMAT_TYPE_1 \"Type 1\"\n#define FT_FONT_FORMAT_BDF \"BDF\"\n#define FT_FONT_FORMAT_PCF \"PCF\"\n#define FT_FONT_FORMAT_TYPE_42 \"Type 42\"\n#define FT_FONT_FORMAT_CID \"CID Type 1\"\n#define FT_FONT_FORMAT_CFF \"CFF\"\n#define FT_FONT_FORMAT_PFR \"PFR\"\n#define FT_FONT_FORMAT_WINFNT \"Windows FNT\"\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVFNTFMT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svgldict.h", "language": "code", "loc": 50, "comment_density": 0.5, "code": "/****************************************************************************\n *\n * svgldict.h\n *\n * The FreeType glyph dictionary services (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVGLDICT_H_\n#define SVGLDICT_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * A service used to retrieve glyph names, as well as to find the index of\n * a given glyph name in a font.\n *\n */\n\n#define FT_SERVICE_ID_GLYPH_DICT \"glyph-dict\"\n\n\n typedef FT_Error\n (*FT_GlyphDict_GetNameFunc)( FT_Face face,\n FT_UInt glyph_index,\n FT_Pointer buffer,\n FT_UInt buffer_max );\n\n typedef FT_UInt\n (*FT_GlyphDict_NameIndexFunc)( FT_Face face,\n const FT_String* glyph_name );\n\n\n FT_DEFINE_SERVICE( GlyphDict )\n {\n FT_GlyphDict_GetNameFunc get_name;\n FT_GlyphDict_NameIndexFunc name_index; /* optional */\n };\n\n\n#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \\\n get_name_, \\\n name_index_ ) \\\n static const FT_Service_GlyphDictRec class_ = \\\n { \\\n get_name_, name_index_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVGLDICT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svgxval.h", "language": "code", "loc": 52, "comment_density": 0.519, "code": "/****************************************************************************\n *\n * svgxval.h\n *\n * FreeType API for validating TrueTypeGX/AAT tables (specification).\n *\n * Copyright (C) 2004-2020 by\n * Masatake YAMATO, Red Hat K.K.,\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n/****************************************************************************\n *\n * gxvalid is derived from both gxlayout module and otvalid module.\n * Development of gxlayout is supported by the Information-technology\n * Promotion Agency(IPA), Japan.\n *\n */\n\n\n#ifndef SVGXVAL_H_\n#define SVGXVAL_H_\n\n#include FT_GX_VALIDATE_H\n#include FT_INTERNAL_VALIDATE_H\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_GX_VALIDATE \"truetypegx-validate\"\n#define FT_SERVICE_ID_CLASSICKERN_VALIDATE \"classickern-validate\"\n\n typedef FT_Error\n (*gxv_validate_func)( FT_Face face,\n FT_UInt gx_flags,\n FT_Bytes tables[FT_VALIDATE_GX_LENGTH],\n FT_UInt table_length );\n\n\n typedef FT_Error\n (*ckern_validate_func)( FT_Face face,\n FT_UInt ckern_flags,\n FT_Bytes *ckern_table );\n\n\n FT_DEFINE_SERVICE( GXvalidate )\n {\n gxv_validate_func validate;\n };\n\n FT_DEFINE_SERVICE( CKERNvalidate )\n {\n ckern_validate_func validate;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVGXVAL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svkern.h", "language": "code", "loc": 35, "comment_density": 0.543, "code": "/****************************************************************************\n *\n * svkern.h\n *\n * The FreeType Kerning service (specification).\n *\n * Copyright (C) 2006-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVKERN_H_\n#define SVKERN_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_TRUETYPE_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n#define FT_SERVICE_ID_KERNING \"kerning\"\n\n\n typedef FT_Error\n (*FT_Kerning_TrackGetFunc)( FT_Face face,\n FT_Fixed point_size,\n FT_Int degree,\n FT_Fixed* akerning );\n\n FT_DEFINE_SERVICE( Kerning )\n {\n FT_Kerning_TrackGetFunc get_track;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVKERN_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svmetric.h", "language": "code", "loc": 93, "comment_density": 0.28, "code": "/****************************************************************************\n *\n * svmetric.h\n *\n * The FreeType services for metrics variations (specification).\n *\n * Copyright (C) 2016-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVMETRIC_H_\n#define SVMETRIC_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * A service to manage the `HVAR, `MVAR', and `VVAR' OpenType tables.\n *\n */\n\n#define FT_SERVICE_ID_METRICS_VARIATIONS \"metrics-variations\"\n\n\n /* HVAR */\n\n typedef FT_Error\n (*FT_HAdvance_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_LSB_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_RSB_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n /* VVAR */\n\n typedef FT_Error\n (*FT_VAdvance_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_TSB_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_BSB_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_VOrg_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n /* MVAR */\n\n typedef void\n (*FT_Metrics_Adjust_Func)( FT_Face face );\n\n\n FT_DEFINE_SERVICE( MetricsVariations )\n {\n FT_HAdvance_Adjust_Func hadvance_adjust;\n FT_LSB_Adjust_Func lsb_adjust;\n FT_RSB_Adjust_Func rsb_adjust;\n\n FT_VAdvance_Adjust_Func vadvance_adjust;\n FT_TSB_Adjust_Func tsb_adjust;\n FT_BSB_Adjust_Func bsb_adjust;\n FT_VOrg_Adjust_Func vorg_adjust;\n\n FT_Metrics_Adjust_Func metrics_adjust;\n };\n\n\n#define FT_DEFINE_SERVICE_METRICSVARIATIONSREC( class_, \\\n hadvance_adjust_, \\\n lsb_adjust_, \\\n rsb_adjust_, \\\n vadvance_adjust_, \\\n tsb_adjust_, \\\n bsb_adjust_, \\\n vorg_adjust_, \\\n metrics_adjust_ ) \\\n static const FT_Service_MetricsVariationsRec class_ = \\\n { \\\n hadvance_adjust_, \\\n lsb_adjust_, \\\n rsb_adjust_, \\\n vadvance_adjust_, \\\n tsb_adjust_, \\\n bsb_adjust_, \\\n vorg_adjust_, \\\n metrics_adjust_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* SVMETRIC_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svmm.h", "language": "code", "loc": 124, "comment_density": 0.242, "code": "/****************************************************************************\n *\n * svmm.h\n *\n * The FreeType Multiple Masters and GX var services (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVMM_H_\n#define SVMM_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * A service used to manage multiple-masters data in a given face.\n *\n * See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).\n *\n */\n\n#define FT_SERVICE_ID_MULTI_MASTERS \"multi-masters\"\n\n\n typedef FT_Error\n (*FT_Get_MM_Func)( FT_Face face,\n FT_Multi_Master* master );\n\n typedef FT_Error\n (*FT_Get_MM_Var_Func)( FT_Face face,\n FT_MM_Var* *master );\n\n typedef FT_Error\n (*FT_Set_MM_Design_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Long* coords );\n\n /* use return value -1 to indicate that the new coordinates */\n /* are equal to the current ones; no changes are thus needed */\n typedef FT_Error\n (*FT_Set_Var_Design_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n /* use return value -1 to indicate that the new coordinates */\n /* are equal to the current ones; no changes are thus needed */\n typedef FT_Error\n (*FT_Set_MM_Blend_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Long* coords );\n\n typedef FT_Error\n (*FT_Get_Var_Design_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n typedef FT_Error\n (*FT_Set_Instance_Func)( FT_Face face,\n FT_UInt instance_index );\n\n typedef FT_Error\n (*FT_Get_MM_Blend_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Long* coords );\n\n typedef FT_Error\n (*FT_Get_Var_Blend_Func)( FT_Face face,\n FT_UInt *num_coords,\n FT_Fixed* *coords,\n FT_Fixed* *normalizedcoords,\n FT_MM_Var* *mm_var );\n\n typedef void\n (*FT_Done_Blend_Func)( FT_Face );\n\n typedef FT_Error\n (*FT_Set_MM_WeightVector_Func)( FT_Face face,\n FT_UInt len,\n FT_Fixed* weight_vector );\n\n typedef FT_Error\n (*FT_Get_MM_WeightVector_Func)( FT_Face face,\n FT_UInt* len,\n FT_Fixed* weight_vector );\n\n\n FT_DEFINE_SERVICE( MultiMasters )\n {\n FT_Get_MM_Func get_mm;\n FT_Set_MM_Design_Func set_mm_design;\n FT_Set_MM_Blend_Func set_mm_blend;\n FT_Get_MM_Blend_Func get_mm_blend;\n FT_Get_MM_Var_Func get_mm_var;\n FT_Set_Var_Design_Func set_var_design;\n FT_Get_Var_Design_Func get_var_design;\n FT_Set_Instance_Func set_instance;\n FT_Set_MM_WeightVector_Func set_mm_weightvector;\n FT_Get_MM_WeightVector_Func get_mm_weightvector;\n\n /* for internal use; only needed for code sharing between modules */\n FT_Get_Var_Blend_Func get_var_blend;\n FT_Done_Blend_Func done_blend;\n };\n\n\n#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \\\n get_mm_, \\\n set_mm_design_, \\\n set_mm_blend_, \\\n get_mm_blend_, \\\n get_mm_var_, \\\n set_var_design_, \\\n get_var_design_, \\\n set_instance_, \\\n set_weightvector_, \\\n get_weightvector_, \\\n get_var_blend_, \\\n done_blend_ ) \\\n static const FT_Service_MultiMastersRec class_ = \\\n { \\\n get_mm_, \\\n set_mm_design_, \\\n set_mm_blend_, \\\n get_mm_blend_, \\\n get_mm_var_, \\\n set_var_design_, \\\n get_var_design_, \\\n set_instance_, \\\n set_weightvector_, \\\n get_weightvector_, \\\n get_var_blend_, \\\n done_blend_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* SVMM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svotval.h", "language": "code", "loc": 38, "comment_density": 0.5, "code": "/****************************************************************************\n *\n * svotval.h\n *\n * The FreeType OpenType validation service (specification).\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVOTVAL_H_\n#define SVOTVAL_H_\n\n#include FT_OPENTYPE_VALIDATE_H\n#include FT_INTERNAL_VALIDATE_H\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_OPENTYPE_VALIDATE \"opentype-validate\"\n\n\n typedef FT_Error\n (*otv_validate_func)( FT_Face volatile face,\n FT_UInt ot_flags,\n FT_Bytes *base,\n FT_Bytes *gdef,\n FT_Bytes *gpos,\n FT_Bytes *gsub,\n FT_Bytes *jstf );\n\n\n FT_DEFINE_SERVICE( OTvalidate )\n {\n otv_validate_func validate;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVOTVAL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svpfr.h", "language": "code", "loc": 47, "comment_density": 0.404, "code": "/****************************************************************************\n *\n * svpfr.h\n *\n * Internal PFR service functions (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPFR_H_\n#define SVPFR_H_\n\n#include FT_PFR_H\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_PFR_METRICS \"pfr-metrics\"\n\n\n typedef FT_Error\n (*FT_PFR_GetMetricsFunc)( FT_Face face,\n FT_UInt *aoutline,\n FT_UInt *ametrics,\n FT_Fixed *ax_scale,\n FT_Fixed *ay_scale );\n\n typedef FT_Error\n (*FT_PFR_GetKerningFunc)( FT_Face face,\n FT_UInt left,\n FT_UInt right,\n FT_Vector *avector );\n\n typedef FT_Error\n (*FT_PFR_GetAdvanceFunc)( FT_Face face,\n FT_UInt gindex,\n FT_Pos *aadvance );\n\n\n FT_DEFINE_SERVICE( PfrMetrics )\n {\n FT_PFR_GetMetricsFunc get_metrics;\n FT_PFR_GetKerningFunc get_kerning;\n FT_PFR_GetAdvanceFunc get_advance;\n\n };\n\n /* */\n\nFT_END_HEADER\n\n#endif /* SVPFR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svpostnm.h", "language": "code", "loc": 45, "comment_density": 0.622, "code": "/****************************************************************************\n *\n * svpostnm.h\n *\n * The FreeType PostScript name services (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPOSTNM_H_\n#define SVPOSTNM_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n /*\n * A trivial service used to retrieve the PostScript name of a given font\n * when available. The `get_name' field should never be `NULL`.\n *\n * The corresponding function can return `NULL` to indicate that the\n * PostScript name is not available.\n *\n * The name is owned by the face and will be destroyed with it.\n */\n\n#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME \"postscript-font-name\"\n\n\n typedef const char*\n (*FT_PsName_GetFunc)( FT_Face face );\n\n\n FT_DEFINE_SERVICE( PsFontName )\n {\n FT_PsName_GetFunc get_ps_font_name;\n };\n\n\n#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \\\n static const FT_Service_PsFontNameRec class_ = \\\n { \\\n get_ps_font_name_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVPOSTNM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svprop.h", "language": "code", "loc": 46, "comment_density": 0.413, "code": "/****************************************************************************\n *\n * svprop.h\n *\n * The FreeType property service (specification).\n *\n * Copyright (C) 2012-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPROP_H_\n#define SVPROP_H_\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_PROPERTIES \"properties\"\n\n\n typedef FT_Error\n (*FT_Properties_SetFunc)( FT_Module module,\n const char* property_name,\n const void* value,\n FT_Bool value_is_string );\n\n typedef FT_Error\n (*FT_Properties_GetFunc)( FT_Module module,\n const char* property_name,\n void* value );\n\n\n FT_DEFINE_SERVICE( Properties )\n {\n FT_Properties_SetFunc set_property;\n FT_Properties_GetFunc get_property;\n };\n\n\n#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \\\n set_property_, \\\n get_property_ ) \\\n static const FT_Service_PropertiesRec class_ = \\\n { \\\n set_property_, \\\n get_property_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVPROP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svpscmap.h", "language": "code", "loc": 108, "comment_density": 0.37, "code": "/****************************************************************************\n *\n * svpscmap.h\n *\n * The FreeType PostScript charmap service (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPSCMAP_H_\n#define SVPSCMAP_H_\n\n#include FT_INTERNAL_OBJECTS_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_POSTSCRIPT_CMAPS \"postscript-cmaps\"\n\n\n /*\n * Adobe glyph name to unicode value.\n */\n typedef FT_UInt32\n (*PS_Unicode_ValueFunc)( const char* glyph_name );\n\n /*\n * Macintosh name id to glyph name. `NULL` if invalid index.\n */\n typedef const char*\n (*PS_Macintosh_NameFunc)( FT_UInt name_index );\n\n /*\n * Adobe standard string ID to glyph name. `NULL` if invalid index.\n */\n typedef const char*\n (*PS_Adobe_Std_StringsFunc)( FT_UInt string_index );\n\n\n /*\n * Simple unicode -> glyph index charmap built from font glyph names table.\n */\n typedef struct PS_UniMap_\n {\n FT_UInt32 unicode; /* bit 31 set: is glyph variant */\n FT_UInt glyph_index;\n\n } PS_UniMap;\n\n\n typedef struct PS_UnicodesRec_* PS_Unicodes;\n\n typedef struct PS_UnicodesRec_\n {\n FT_CMapRec cmap;\n FT_UInt num_maps;\n PS_UniMap* maps;\n\n } PS_UnicodesRec;\n\n\n /*\n * A function which returns a glyph name for a given index. Returns\n * `NULL` if invalid index.\n */\n typedef const char*\n (*PS_GetGlyphNameFunc)( FT_Pointer data,\n FT_UInt string_index );\n\n /*\n * A function used to release the glyph name returned by\n * PS_GetGlyphNameFunc, when needed\n */\n typedef void\n (*PS_FreeGlyphNameFunc)( FT_Pointer data,\n const char* name );\n\n typedef FT_Error\n (*PS_Unicodes_InitFunc)( FT_Memory memory,\n PS_Unicodes unicodes,\n FT_UInt num_glyphs,\n PS_GetGlyphNameFunc get_glyph_name,\n PS_FreeGlyphNameFunc free_glyph_name,\n FT_Pointer glyph_data );\n\n typedef FT_UInt\n (*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes,\n FT_UInt32 unicode );\n\n typedef FT_UInt32\n (*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes,\n FT_UInt32 *unicode );\n\n\n FT_DEFINE_SERVICE( PsCMaps )\n {\n PS_Unicode_ValueFunc unicode_value;\n\n PS_Unicodes_InitFunc unicodes_init;\n PS_Unicodes_CharIndexFunc unicodes_char_index;\n PS_Unicodes_CharNextFunc unicodes_char_next;\n\n PS_Macintosh_NameFunc macintosh_name;\n PS_Adobe_Std_StringsFunc adobe_std_strings;\n const unsigned short* adobe_std_encoding;\n const unsigned short* adobe_expert_encoding;\n };\n\n\n#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \\\n unicode_value_, \\\n unicodes_init_, \\\n unicodes_char_index_, \\\n unicodes_char_next_, \\\n macintosh_name_, \\\n adobe_std_strings_, \\\n adobe_std_encoding_, \\\n adobe_expert_encoding_ ) \\\n static const FT_Service_PsCMapsRec class_ = \\\n { \\\n unicode_value_, unicodes_init_, \\\n unicodes_char_index_, unicodes_char_next_, macintosh_name_, \\\n adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVPSCMAP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svpsinfo.h", "language": "code", "loc": 62, "comment_density": 0.306, "code": "/****************************************************************************\n *\n * svpsinfo.h\n *\n * The FreeType PostScript info service (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPSINFO_H_\n#define SVPSINFO_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_INTERNAL_TYPE1_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_POSTSCRIPT_INFO \"postscript-info\"\n\n\n typedef FT_Error\n (*PS_GetFontInfoFunc)( FT_Face face,\n PS_FontInfoRec* afont_info );\n\n typedef FT_Error\n (*PS_GetFontExtraFunc)( FT_Face face,\n PS_FontExtraRec* afont_extra );\n\n typedef FT_Int\n (*PS_HasGlyphNamesFunc)( FT_Face face );\n\n typedef FT_Error\n (*PS_GetFontPrivateFunc)( FT_Face face,\n PS_PrivateRec* afont_private );\n\n typedef FT_Long\n (*PS_GetFontValueFunc)( FT_Face face,\n PS_Dict_Keys key,\n FT_UInt idx,\n void *value,\n FT_Long value_len );\n\n\n FT_DEFINE_SERVICE( PsInfo )\n {\n PS_GetFontInfoFunc ps_get_font_info;\n PS_GetFontExtraFunc ps_get_font_extra;\n PS_HasGlyphNamesFunc ps_has_glyph_names;\n PS_GetFontPrivateFunc ps_get_font_private;\n PS_GetFontValueFunc ps_get_font_value;\n };\n\n\n#define FT_DEFINE_SERVICE_PSINFOREC( class_, \\\n get_font_info_, \\\n ps_get_font_extra_, \\\n has_glyph_names_, \\\n get_font_private_, \\\n get_font_value_ ) \\\n static const FT_Service_PsInfoRec class_ = \\\n { \\\n get_font_info_, ps_get_font_extra_, has_glyph_names_, \\\n get_font_private_, get_font_value_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVPSINFO_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svsfnt.h", "language": "code", "loc": 64, "comment_density": 0.484, "code": "/****************************************************************************\n *\n * svsfnt.h\n *\n * The FreeType SFNT table loading service (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVSFNT_H_\n#define SVSFNT_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_TRUETYPE_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * SFNT table loading service.\n */\n\n#define FT_SERVICE_ID_SFNT_TABLE \"sfnt-table\"\n\n\n /*\n * Used to implement FT_Load_Sfnt_Table().\n */\n typedef FT_Error\n (*FT_SFNT_TableLoadFunc)( FT_Face face,\n FT_ULong tag,\n FT_Long offset,\n FT_Byte* buffer,\n FT_ULong* length );\n\n /*\n * Used to implement FT_Get_Sfnt_Table().\n */\n typedef void*\n (*FT_SFNT_TableGetFunc)( FT_Face face,\n FT_Sfnt_Tag tag );\n\n\n /*\n * Used to implement FT_Sfnt_Table_Info().\n */\n typedef FT_Error\n (*FT_SFNT_TableInfoFunc)( FT_Face face,\n FT_UInt idx,\n FT_ULong *tag,\n FT_ULong *offset,\n FT_ULong *length );\n\n\n FT_DEFINE_SERVICE( SFNT_Table )\n {\n FT_SFNT_TableLoadFunc load_table;\n FT_SFNT_TableGetFunc get_table;\n FT_SFNT_TableInfoFunc table_info;\n };\n\n\n#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \\\n static const FT_Service_SFNT_TableRec class_ = \\\n { \\\n load_, get_, info_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVSFNT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svttcmap.h", "language": "code", "loc": 68, "comment_density": 0.647, "code": "/****************************************************************************\n *\n * svttcmap.h\n *\n * The FreeType TrueType/sfnt cmap extra information service.\n *\n * Copyright (C) 2003-2020 by\n * Masatake YAMATO, Redhat K.K.,\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n/* Development of this service is support of\n Information-technology Promotion Agency, Japan. */\n\n#ifndef SVTTCMAP_H_\n#define SVTTCMAP_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_TRUETYPE_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_TT_CMAP \"tt-cmaps\"\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_CMapInfo\n *\n * @description:\n * A structure used to store TrueType/sfnt specific cmap information\n * which is not covered by the generic @FT_CharMap structure. This\n * structure can be accessed with the @FT_Get_TT_CMap_Info function.\n *\n * @fields:\n * language ::\n * The language ID used in Mac fonts. Definitions of values are in\n * `ttnameid.h`.\n *\n * format ::\n * The cmap format. OpenType 1.6 defines the formats 0 (byte encoding\n * table), 2~(high-byte mapping through table), 4~(segment mapping to\n * delta values), 6~(trimmed table mapping), 8~(mixed 16-bit and 32-bit\n * coverage), 10~(trimmed array), 12~(segmented coverage), 13~(last\n * resort font), and 14 (Unicode Variation Sequences).\n */\n typedef struct TT_CMapInfo_\n {\n FT_ULong language;\n FT_Long format;\n\n } TT_CMapInfo;\n\n\n typedef FT_Error\n (*TT_CMap_Info_GetFunc)( FT_CharMap charmap,\n TT_CMapInfo *cmap_info );\n\n\n FT_DEFINE_SERVICE( TTCMaps )\n {\n TT_CMap_Info_GetFunc get_cmap_info;\n };\n\n\n#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \\\n static const FT_Service_TTCMapsRec class_ = \\\n { \\\n get_cmap_info_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* SVTTCMAP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svtteng.h", "language": "code", "loc": 36, "comment_density": 0.694, "code": "/****************************************************************************\n *\n * svtteng.h\n *\n * The FreeType TrueType engine query service (specification).\n *\n * Copyright (C) 2006-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVTTENG_H_\n#define SVTTENG_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_MODULE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * SFNT table loading service.\n */\n\n#define FT_SERVICE_ID_TRUETYPE_ENGINE \"truetype-engine\"\n\n /*\n * Used to implement FT_Get_TrueType_Engine_Type\n */\n\n FT_DEFINE_SERVICE( TrueTypeEngine )\n {\n FT_TrueTypeEngineType engine_type;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVTTENG_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svttglyf.h", "language": "code", "loc": 39, "comment_density": 0.487, "code": "/****************************************************************************\n *\n * svttglyf.h\n *\n * The FreeType TrueType glyph service.\n *\n * Copyright (C) 2007-2020 by\n * David Turner.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n#ifndef SVTTGLYF_H_\n#define SVTTGLYF_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_TRUETYPE_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_TT_GLYF \"tt-glyf\"\n\n\n typedef FT_ULong\n (*TT_Glyf_GetLocationFunc)( FT_Face face,\n FT_UInt gindex,\n FT_ULong *psize );\n\n FT_DEFINE_SERVICE( TTGlyf )\n {\n TT_Glyf_GetLocationFunc get_location;\n };\n\n\n#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \\\n static const FT_Service_TTGlyfRec class_ = \\\n { \\\n get_location_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* SVTTGLYF_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svwinfnt.h", "language": "code", "loc": 33, "comment_density": 0.576, "code": "/****************************************************************************\n *\n * svwinfnt.h\n *\n * The FreeType Windows FNT/FONT service (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVWINFNT_H_\n#define SVWINFNT_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_WINFONTS_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_WINFNT \"winfonts\"\n\n typedef FT_Error\n (*FT_WinFnt_GetHeaderFunc)( FT_Face face,\n FT_WinFNT_HeaderRec *aheader );\n\n\n FT_DEFINE_SERVICE( WinFnt )\n {\n FT_WinFnt_GetHeaderFunc get_header;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVWINFNT_H_ */\n\n\n/* END */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.462, "dedup_hash": "1e65b5b4a99da384", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_gl", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Gl", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/GL/glew.h", "language": "code", "loc": 14144, "comment_density": 0.075, "code": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits \n** Copyright (C) 2002-2008, Marcelo E. Magallon \n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n** this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n** this list of conditions and the following disclaimer in the documentation \n** and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n** derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n * Mesa 3-D graphics library\n * Version: 7.0\n *\n * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __glew_h__\n#define __glew_h__\n#define __GLEW_H__\n\n#if defined(__gl_h_) || defined(__GL_H__) || defined(__X_GL_H)\n#error gl.h included before glew.h\n#endif\n#if defined(__REGAL_H__)\n#error Regal.h included before glew.h\n#endif\n#if defined(__glext_h_) || defined(__GLEXT_H_)\n#error glext.h included before glew.h\n#endif\n#if defined(__gl_ATI_h_)\n#error glATI.h included before glew.h\n#endif\n\n#define __gl_h_\n#define __GL_H__\n#define __REGAL_H__\n#define __X_GL_H\n#define __glext_h_\n#define __GLEXT_H_\n#define __gl_ATI_h_\n\n#if defined(_WIN32)\n\n/*\n * GLEW does not include to avoid name space pollution.\n * GL needs GLAPI and GLAPIENTRY, GLU needs APIENTRY, CALLBACK, and wchar_t\n * defined properly.\n */\n/* */\n#ifndef APIENTRY\n#define GLEW_APIENTRY_DEFINED\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n# define APIENTRY __stdcall\n# elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)\n# define APIENTRY __stdcall\n# else\n# define APIENTRY\n# endif\n#endif\n#ifndef GLAPI\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n# define GLAPI extern\n# endif\n#endif\n/* */\n#ifndef CALLBACK\n#define GLEW_CALLBACK_DEFINED\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n# define CALLBACK __attribute__ ((__stdcall__))\n# elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)\n# define CALLBACK __stdcall\n# else\n# define CALLBACK\n# endif\n#endif\n/* and */\n#ifndef WINGDIAPI\n#define GLEW_WINGDIAPI_DEFINED\n#define WINGDIAPI __declspec(dllimport)\n#endif\n/* */\n#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(_WCHAR_T_DEFINED)\ntypedef unsigned short wchar_t;\n# define _WCHAR_T_DEFINED\n#endif\n/* */\n#if !defined(_W64)\n# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && defined(_MSC_VER) && _MSC_VER >= 1300\n# define _W64 __w64\n# else\n# define _W64\n# endif\n#endif\n#if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_) && !defined(__MINGW64__)\n# ifdef _WIN64\ntypedef __int64 ptrdiff_t;\n# else\ntypedef _W64 int ptrdiff_t;\n# endif\n# define _PTRDIFF_T_DEFINED\n# define _PTRDIFF_T_\n#endif\n\n#ifndef GLAPI\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n# define GLAPI extern\n# else\n# define GLAPI WINGDIAPI\n# endif\n#endif\n\n#ifndef GLAPIENTRY\n#define GLAPIENTRY APIENTRY\n#endif\n\n#ifndef GLEWAPIENTRY\n#define GLEWAPIENTRY APIENTRY\n#endif\n\n/*\n * GLEW_STATIC is defined for static library.\n * GLEW_BUILD is defined for building the DLL library.\n */\n\n#ifdef GLEW_STATIC\n# define GLEWAPI extern\n#else\n# ifdef GLEW_BUILD\n# define GLEWAPI extern __declspec(dllexport)\n# else\n# define GLEWAPI extern __declspec(dllimport)\n# endif\n#endif\n\n#else /* _UNIX */\n\n/*\n * Needed for ptrdiff_t in turn needed by VBO. This is defined by ISO\n * C. On my system, this amounts to _3 lines_ of included code, all of\n * them pretty much harmless. If you know of a way of detecting 32 vs\n * 64 _targets_ at compile time you are free to replace this with\n * something that's portable. For now, _this_ is the portable solution.\n * (mem, 2004-01-04)\n */\n\n#include \n\n/* SGI MIPSPro doesn't like stdint.h in C++ mode */\n/* ID: 3376260 Solaris 9 has inttypes.h, but not stdint.h */\n\n#if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__)\n#include \n#else\n#include \n#endif\n\n#define GLEW_APIENTRY_DEFINED\n#define APIENTRY\n\n/*\n * GLEW_STATIC is defined for static library.\n */\n\n#ifdef GLEW_STATIC\n# define GLEWAPI extern\n#else\n# if defined(__GNUC__) && __GNUC__>=4\n# define GLEWAPI extern __attribute__ ((visibility(\"default\")))\n# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)\n# define GLEWAPI extern __global\n# else\n# define GLEWAPI extern\n# endif\n#endif\n\n/* */\n#ifndef GLAPI\n#define GLAPI extern\n#endif\n\n#ifndef GLAPIENTRY\n#define GLAPIENTRY\n#endif\n\n#ifndef GLEWAPIENTRY\n#define GLEWAPIENTRY\n#endif\n\n#endif /* _WIN32 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* ----------------------------- GL_VERSION_1_1 ---------------------------- */\n\n#ifndef GL_VERSION_1_1\n#define GL_VERSION_1_1 1\n\ntypedef unsigned int GLenum;\ntypedef unsigned int GLbitfield;\ntypedef unsigned int GLuint;\ntypedef int GLint;\ntypedef int GLsizei;\ntypedef unsigned char GLboolean;\ntypedef signed char GLbyte;\ntypedef short GLshort;\ntypedef unsigned char GLubyte;\ntypedef unsigned short GLushort;\ntypedef unsigned long GLulong;\ntypedef float GLfloat;\ntypedef float GLclampf;\ntypedef double GLdouble;\ntypedef double GLclampd;\ntypedef void GLvoid;\n#if defined(_MSC_VER) && _MSC_VER < 1400\ntypedef __int64 GLint64EXT;\ntypedef unsigned __int64 GLuint64EXT;\n#elif defined(_MSC_VER) || defined(__BORLANDC__)\ntypedef signed long long GLint64EXT;\ntypedef unsigned long long GLuint64EXT;\n#else\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n#include \n# endif\ntypedef int64_t GLint64EXT;\ntypedef uint64_t GLuint64EXT;\n#endif\ntypedef GLint64EXT GLint64;\ntypedef GLuint64EXT GLuint64;\ntypedef struct __GLsync *GLsync;\n\ntypedef char GLchar;\n\n#define GL_ZERO 0\n#define GL_FALSE 0\n#define GL_LOGIC_OP 0x0BF1\n#define GL_NONE 0\n#define GL_TEXTURE_COMPONENTS 0x1003\n#define GL_NO_ERROR 0\n#define GL_POINTS 0x0000\n#define GL_CURRENT_BIT 0x00000001\n#define GL_TRUE 1\n#define GL_ONE 1\n#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001\n#define GL_LINES 0x0001\n#define GL_LINE_LOOP 0x0002\n#define GL_POINT_BIT 0x00000002\n#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002\n#define GL_LINE_STRIP 0x0003\n#define GL_LINE_BIT 0x00000004\n#define GL_TRIANGLES 0x0004\n#define GL_TRIANGLE_STRIP 0x0005\n#define GL_TRIANGLE_FAN 0x0006\n#define GL_QUADS 0x0007\n#define GL_QUAD_STRIP 0x0008\n#define GL_POLYGON_BIT 0x00000008\n#define GL_POLYGON 0x0009\n#define GL_POLYGON_STIPPLE_BIT 0x00000010\n#define GL_PIXEL_MODE_BIT 0x00000020\n#define GL_LIGHTING_BIT 0x00000040\n#define GL_FOG_BIT 0x00000080\n#define GL_DEPTH_BUFFER_BIT 0x00000100\n#define GL_ACCUM 0x0100\n#define GL_LOAD 0x0101\n#define GL_RETURN 0x0102\n#define GL_MULT 0x0103\n#define GL_ADD 0x0104\n#define GL_NEVER 0x0200\n#define GL_ACCUM_BUFFER_BIT 0x00000200\n#define GL_LESS 0x0201\n#define GL_EQUAL 0x0202\n#define GL_LEQUAL 0x0203\n#define GL_GREATER 0x0204\n#define GL_NOTEQUAL 0x0205\n#define GL_GEQUAL 0x0206\n#define GL_ALWAYS 0x0207\n#define GL_SRC_COLOR 0x0300\n#define GL_ONE_MINUS_SRC_COLOR 0x0301\n#define GL_SRC_ALPHA 0x0302\n#define GL_ONE_MINUS_SRC_ALPHA 0x0303\n#define GL_DST_ALPHA 0x0304\n#define GL_ONE_MINUS_DST_ALPHA 0x0305\n#define GL_DST_COLOR 0x0306\n#define GL_ONE_MINUS_DST_COLOR 0x0307\n#define GL_SRC_ALPHA_SATURATE 0x0308\n#define GL_STENCIL_BUFFER_BIT 0x00000400\n#define GL_FRONT_LEFT 0x0400\n#define GL_FRONT_RIGHT 0x0401\n#define GL_BACK_LEFT 0x0402\n#define GL_BACK_RIGHT 0x0403\n#define GL_FRONT 0x0404\n#define GL_BACK 0x0405\n#define GL_LEFT 0x0406\n#define GL_RIGHT 0x0407\n#define GL_FRONT_AND_BACK 0x0408\n#define GL_AUX0 0x0409\n#define GL_AUX1 0x040A\n#define GL_AUX2 0x040B\n#define GL_AUX3 0x040C\n#define GL_INVALID_ENUM 0x0500\n#define GL_INVALID_VALUE 0x0501\n#define GL_INVALID_OPERATION 0x0502\n#define GL_STACK_OVERFLOW 0x0503\n#define GL_STACK_UNDERFLOW 0x0504\n#define GL_OUT_OF_MEMORY 0x0505\n#define GL_2D 0x0600\n#define GL_3D 0x0601\n#define GL_3D_COLOR 0x0602\n#define GL_3D_COLOR_TEXTURE 0x0603\n#define GL_4D_COLOR_TEXTURE 0x0604\n#define GL_PASS_THROUGH_TOKEN 0x0700\n#define GL_POINT_TOKEN 0x0701\n#define GL_LINE_TOKEN 0x0702\n#define GL_POLYGON_TOKEN 0x0703\n#define GL_BITMAP_TOKEN 0x0704\n#define GL_DRAW_PIXEL_TOKEN 0x0705\n#define GL_COPY_PIXEL_TOKEN 0x0706\n#define GL_LINE_RESET_TOKEN 0x0707\n#define GL_EXP 0x0800\n#define GL_VIEWPORT_BIT 0x00000800\n#define GL_EXP2 0x0801\n#define GL_CW 0x0900\n#define GL_CCW 0x0901\n#define GL_COEFF 0x0A00\n#define GL_ORDER 0x0A01\n#define GL_DOMAIN 0x0A02\n#define GL_CURRENT_COLOR 0x0B00\n#define GL_CURRENT_INDEX 0x0B01\n#define GL_CURRENT_NORMAL 0x0B02\n#define GL_CURRENT_TEXTURE_COORDS 0x0B03\n#define GL_CURRENT_RASTER_COLOR 0x0B04\n#define GL_CURRENT_RASTER_INDEX 0x0B05\n#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06\n#define GL_CURRENT_RASTER_POSITION 0x0B07\n#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08\n#define GL_CURRENT_RASTER_DISTANCE 0x0B09\n#define GL_POINT_SMOOTH 0x0B10\n#define GL_POINT_SIZE 0x0B11\n#define GL_POINT_SIZE_RANGE 0x0B12\n#define GL_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_LINE_SMOOTH 0x0B20\n#define GL_LINE_WIDTH 0x0B21\n#define GL_LINE_WIDTH_RANGE 0x0B22\n#define GL_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_LINE_STIPPLE 0x0B24\n#define GL_LINE_STIPPLE_PATTERN 0x0B25\n#define GL_LINE_STIPPLE_REPEAT 0x0B26\n#define GL_LIST_MODE 0x0B30\n#define GL_MAX_LIST_NESTING 0x0B31\n#define GL_LIST_BASE 0x0B32\n#define GL_LIST_INDEX 0x0B33\n#define GL_POLYGON_MODE 0x0B40\n#define GL_POLYGON_SMOOTH 0x0B41\n#define GL_POLYGON_STIPPLE 0x0B42\n#define GL_EDGE_FLAG 0x0B43\n#define GL_CULL_FACE 0x0B44\n#define GL_CULL_FACE_MODE 0x0B45\n#define GL_FRONT_FACE 0x0B46\n#define GL_LIGHTING 0x0B50\n#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51\n#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52\n#define GL_LIGHT_MODEL_AMBIENT 0x0B53\n#define GL_SHADE_MODEL 0x0B54\n#define GL_COLOR_MATERIAL_FACE 0x0B55\n#define GL_COLOR_MATERIAL_PARAMETER 0x0B56\n#define GL_COLOR_MATERIAL 0x0B57\n#define GL_FOG 0x0B60\n#define GL_FOG_INDEX 0x0B61\n#define GL_FOG_DENSITY 0x0B62\n#define GL_FOG_START 0x0B63\n#define GL_FOG_END 0x0B64\n#define GL_FOG_MODE 0x0B65\n#define GL_FOG_COLOR 0x0B66\n#define GL_DEPTH_RANGE 0x0B70\n#define GL_DEPTH_TEST 0x0B71\n#define GL_DEPTH_WRITEMASK 0x0B72\n#define GL_DEPTH_CLEAR_VALUE 0x0B73\n#define GL_DEPTH_FUNC 0x0B74\n#define GL_ACCUM_CLEAR_VALUE 0x0B80\n#define GL_STENCIL_TEST 0x0B90\n#define GL_STENCIL_CLEAR_VALUE 0x0B91\n#define GL_STENCIL_FUNC 0x0B92\n#define GL_STENCIL_VALUE_MASK 0x0B93\n#define GL_STENCIL_FAIL 0x0B94\n#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95\n#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96\n#define GL_STENCIL_REF 0x0B97\n#define GL_STENCIL_WRITEMASK 0x0B98\n#define GL_MATRIX_MODE 0x0BA0\n#define GL_NORMALIZE 0x0BA1\n#define GL_VIEWPORT 0x0BA2\n#define GL_MODELVIEW_STACK_DEPTH 0x0BA3\n#define GL_PROJECTION_STACK_DEPTH 0x0BA4\n#define GL_TEXTURE_STACK_DEPTH 0x0BA5\n#define GL_MODELVIEW_MATRIX 0x0BA6\n#define GL_PROJECTION_MATRIX 0x0BA7\n#define GL_TEXTURE_MATRIX 0x0BA8\n#define GL_ATTRIB_STACK_DEPTH 0x0BB0\n#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1\n#define GL_ALPHA_TEST 0x0BC0\n#define GL_ALPHA_TEST_FUNC 0x0BC1\n#define GL_ALPHA_TEST_REF 0x0BC2\n#define GL_DITHER 0x0BD0\n#define GL_BLEND_DST 0x0BE0\n#define GL_BLEND_SRC 0x0BE1\n#define GL_BLEND 0x0BE2\n#define GL_LOGIC_OP_MODE 0x0BF0\n#define GL_INDEX_LOGIC_OP 0x0BF1\n#define GL_COLOR_LOGIC_OP 0x0BF2\n#define GL_AUX_BUFFERS 0x0C00\n#define GL_DRAW_BUFFER 0x0C01\n#define GL_READ_BUFFER 0x0C02\n#define GL_SCISSOR_BOX 0x0C10\n#define GL_SCISSOR_TEST 0x0C11\n#define GL_INDEX_CLEAR_VALUE 0x0C20\n#define GL_INDEX_WRITEMASK 0x0C21\n#define GL_COLOR_CLEAR_VALUE 0x0C22\n#define GL_COLOR_WRITEMASK 0x0C23\n#define GL_INDEX_MODE 0x0C30\n#define GL_RGBA_MODE 0x0C31\n#define GL_DOUBLEBUFFER 0x0C32\n#define GL_STEREO 0x0C33\n#define GL_RENDER_MODE 0x0C40\n#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50\n#define GL_POINT_SMOOTH_HINT 0x0C51\n#define GL_LINE_SMOOTH_HINT 0x0C52\n#define GL_POLYGON_SMOOTH_HINT 0x0C53\n#define GL_FOG_HINT 0x0C54\n#define GL_TEXTURE_GEN_S 0x0C60\n#define GL_TEXTURE_GEN_T 0x0C61\n#define GL_TEXTURE_GEN_R 0x0C62\n#define GL_TEXTURE_GEN_Q 0x0C63\n#define GL_PIXEL_MAP_I_TO_I 0x0C70\n#define GL_PIXEL_MAP_S_TO_S 0x0C71\n#define GL_PIXEL_MAP_I_TO_R 0x0C72\n#define GL_PIXEL_MAP_I_TO_G 0x0C73\n#define GL_PIXEL_MAP_I_TO_B 0x0C74\n#define GL_PIXEL_MAP_I_TO_A 0x0C75\n#define GL_PIXEL_MAP_R_TO_R 0x0C76\n#define GL_PIXEL_MAP_G_TO_G 0x0C77\n#define GL_PIXEL_MAP_B_TO_B 0x0C78\n#define GL_PIXEL_MAP_A_TO_A 0x0C79\n#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0\n#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1\n#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2\n#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3\n#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4\n#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5\n#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6\n#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7\n#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8\n#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9\n#define GL_UNPACK_SWAP_BYTES 0x0CF0\n#define GL_UNPACK_LSB_FIRST 0x0CF1\n#define GL_UNPACK_ROW_LENGTH 0x0CF2\n#define GL_UNPACK_SKIP_ROWS 0x0CF3\n#define GL_UNPACK_SKIP_PIXELS 0x0CF4\n#define GL_UNPACK_ALIGNMENT 0x0CF5\n#define GL_PACK_SWAP_BYTES 0x0D00\n#define GL_PACK_LSB_FIRST 0x0D01\n#define GL_PACK_ROW_LENGTH 0x0D02\n#define GL_PACK_SKIP_ROWS 0x0D03\n#define GL_PACK_SKIP_PIXELS 0x0D04\n#define GL_PACK_ALIGNMENT 0x0D05\n#define GL_MAP_COLOR 0x0D10\n#define GL_MAP_STENCIL 0x0D11\n#define GL_INDEX_SHIFT 0x0D12\n#define GL_INDEX_OFFSET 0x0D13\n#define GL_RED_SCALE 0x0D14\n#define GL_RED_BIAS 0x0D15\n#define GL_ZOOM_X 0x0D16\n#define GL_ZOOM_Y 0x0D17\n#define GL_GREEN_SCALE 0x0D18\n#define GL_GREEN_BIAS 0x0D19\n#define GL_BLUE_SCALE 0x0D1A\n#define GL_BLUE_BIAS 0x0D1B\n#define GL_ALPHA_SCALE 0x0D1C\n#define GL_ALPHA_BIAS 0x0D1D\n#define GL_DEPTH_SCALE 0x0D1E\n#define GL_DEPTH_BIAS 0x0D1F\n#define GL_MAX_EVAL_ORDER 0x0D30\n#define GL_MAX_LIGHTS 0x0D31\n#define GL_MAX_CLIP_PLANES 0x0D32\n#define GL_MAX_TEXTURE_SIZE 0x0D33\n#define GL_MAX_PIXEL_MAP_TABLE 0x0D34\n#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35\n#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36\n#define GL_MAX_NAME_STACK_DEPTH 0x0D37\n#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38\n#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39\n#define GL_MAX_VIEWPORT_DIMS 0x0D3A\n#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B\n#define GL_SUBPIXEL_BITS 0x0D50\n#define GL_INDEX_BITS 0x0D51\n#define GL_RED_BITS 0x0D52\n#define GL_GREEN_BITS 0x0D53\n#define GL_BLUE_BITS 0x0D54\n#define GL_ALPHA_BITS 0x0D55\n#define GL_DEPTH_BITS 0x0D56\n#define GL_STENCIL_BITS 0x0D57\n#define GL_ACCUM_RED_BITS 0x0D58\n#define GL_ACCUM_GREEN_BITS 0x0D59\n#define GL_ACCUM_BLUE_BITS 0x0D5A\n#define GL_ACCUM_ALPHA_BITS 0x0D5B\n#define GL_NAME_STACK_DEPTH 0x0D70\n#define GL_AUTO_NORMAL 0x0D80\n#define GL_MAP1_COLOR_4 0x0D90\n#define GL_MAP1_INDEX 0x0D91\n#define GL_MAP1_NORMAL 0x0D92\n#define GL_MAP1_TEXTURE_COORD_1 0x0D93\n#define GL_MAP1_TEXTURE_COORD_2 0x0D94\n#define GL_MAP1_TEXTURE_COORD_3 0x0D95\n#define GL_MAP1_TEXTURE_COORD_4 0x0D96\n#define GL_MAP1_VERTEX_3 0x0D97\n#define GL_MAP1_VERTEX_4 0x0D98\n#define GL_MAP2_COLOR_4 0x0DB0\n#define GL_MAP2_INDEX 0x0DB1\n#define GL_MAP2_NORMAL 0x0DB2\n#define GL_MAP2_TEXTURE_COORD_1 0x0DB3\n#define GL_MAP2_TEXTURE_COORD_2 0x0DB4\n#define GL_MAP2_TEXTURE_COORD_3 0x0DB5\n#define GL_MAP2_TEXTURE_COORD_4 0x0DB6\n#define GL_MAP2_VERTEX_3 0x0DB7\n#define GL_MAP2_VERTEX_4 0x0DB8\n#define GL_MAP1_GRID_DOMAIN 0x0DD0\n#define GL_MAP1_GRID_SEGMENTS 0x0DD1\n#define GL_MAP2_GRID_DOMAIN 0x0DD2\n#define GL_MAP2_GRID_SEGMENTS 0x0DD3\n#define GL_TEXTURE_1D 0x0DE0\n#define GL_TEXTURE_2D 0x0DE1\n#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0\n#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1\n#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2\n#define GL_SELECTION_BUFFER_POINTER 0x0DF3\n#define GL_SELECTION_BUFFER_SIZE 0x0DF4\n#define GL_TEXTURE_WIDTH 0x1000\n#define GL_TRANSFORM_BIT 0x00001000\n#define GL_TEXTURE_HEIGHT 0x1001\n#define GL_TEXTURE_INTERNAL_FORMAT 0x1003\n#define GL_TEXTURE_BORDER_COLOR 0x1004\n#define GL_TEXTURE_BORDER 0x1005\n#define GL_DONT_CARE 0x1100\n#define GL_FASTEST 0x1101\n#define GL_NICEST 0x1102\n#define GL_AMBIENT 0x1200\n#define GL_DIFFUSE 0x1201\n#define GL_SPECULAR 0x1202\n#define GL_POSITION 0x1203\n#define GL_SPOT_DIRECTION 0x1204\n#define GL_SPOT_EXPONENT 0x1205\n#define GL_SPOT_CUTOFF 0x1206\n#define GL_CONSTANT_ATTENUATION 0x1207\n#define GL_LINEAR_ATTENUATION 0x1208\n#define GL_QUADRATIC_ATTENUATION 0x1209\n#define GL_COMPILE 0x1300\n#define GL_COMPILE_AND_EXECUTE 0x1301\n#define GL_BYTE 0x1400\n#define GL_UNSIGNED_BYTE 0x1401\n#define GL_SHORT 0x1402\n#define GL_UNSIGNED_SHORT 0x1403\n#define GL_INT 0x1404\n#define GL_UNSIGNED_INT 0x1405\n#define GL_FLOAT 0x1406\n#define GL_2_BYTES 0x1407\n#define GL_3_BYTES 0x1408\n#define GL_4_BYTES 0x1409\n#define GL_DOUBLE 0x140A\n#define GL_CLEAR 0x1500\n#define GL_AND 0x1501\n#define GL_AND_REVERSE 0x1502\n#define GL_COPY 0x1503\n#define GL_AND_INVERTED 0x1504\n#define GL_NOOP 0x1505\n#define GL_XOR 0x1506\n#define GL_OR 0x1507\n#define GL_NOR 0x1508\n#define GL_EQUIV 0x1509\n#define GL_INVERT 0x150A\n#define GL_OR_REVERSE 0x150B\n#define GL_COPY_INVERTED 0x150C\n#define GL_OR_INVERTED 0x150D\n#define GL_NAND 0x150E\n#define GL_SET 0x150F\n#define GL_EMISSION 0x1600\n#define GL_SHININESS 0x1601\n#define GL_AMBIENT_AND_DIFFUSE 0x1602\n#define GL_COLOR_INDEXES 0x1603\n#define GL_MODELVIEW 0x1700\n#define GL_PROJECTION 0x1701\n#define GL_TEXTURE 0x1702\n#define GL_COLOR 0x1800\n#define GL_DEPTH 0x1801\n#define GL_STENCIL 0x1802\n#define GL_COLOR_INDEX 0x1900\n#define GL_STENCIL_INDEX 0x1901\n#define GL_DEPTH_COMPONENT 0x1902\n#define GL_RED 0x1903\n#define GL_GREEN 0x1904\n#define GL_BLUE 0x1905\n#define GL_ALPHA 0x1906\n#define GL_RGB 0x1907\n#define GL_RGBA 0x1908\n#define GL_LUMINANCE 0x1909\n#define GL_LUMINANCE_ALPHA 0x190A\n#define GL_BITMAP 0x1A00\n#define GL_POINT 0x1B00\n#define GL_LINE 0x1B01\n#define GL_FILL 0x1B02\n#define GL_RENDER 0x1C00\n#define GL_FEEDBACK 0x1C01\n#define GL_SELECT 0x1C02\n#define GL_FLAT 0x1D00\n#define GL_SMOOTH 0x1D01\n#define GL_KEEP 0x1E00\n#define GL_REPLACE 0x1E01\n#define GL_INCR 0x1E02\n#define GL_DECR 0x1E03\n#define GL_VENDOR 0x1F00\n#define GL_RENDERER 0x1F01\n#define GL_VERSION 0x1F02\n#define GL_EXTENSIONS 0x1F03\n#define GL_S 0x2000\n#define GL_ENABLE_BIT 0x00002000\n#define GL_T 0x2001\n#define GL_R 0x2002\n#define GL_Q 0x2003\n#define GL_MODULATE 0x2100\n#define GL_DECAL 0x2101\n#define GL_TEXTURE_ENV_MODE 0x2200\n#define GL_TEXTURE_ENV_COLOR 0x2201\n#define GL_TEXTURE_ENV 0x2300\n#define GL_EYE_LINEAR 0x2400\n#define GL_OBJECT_LINEAR 0x2401\n#define GL_SPHERE_MAP 0x2402\n#define GL_TEXTURE_GEN_MODE 0x2500\n#define GL_OBJECT_PLANE 0x2501\n#define GL_EYE_PLANE 0x2502\n#define GL_NEAREST 0x2600\n#define GL_LINEAR 0x2601\n#define GL_NEAREST_MIPMAP_NEAREST 0x2700\n#define GL_LINEAR_MIPMAP_NEAREST 0x2701\n#define GL_NEAREST_MIPMAP_LINEAR 0x2702\n#define GL_LINEAR_MIPMAP_LINEAR 0x2703\n#define GL_TEXTURE_MAG_FILTER 0x2800\n#define GL_TEXTURE_MIN_FILTER 0x2801\n#define GL_TEXTURE_WRAP_S 0x2802\n#define GL_TEXTURE_WRAP_T 0x2803\n#define GL_CLAMP 0x2900\n#define GL_REPEAT 0x2901\n#define GL_POLYGON_OFFSET_UNITS 0x2A00\n#define GL_POLYGON_OFFSET_POINT 0x2A01\n#define GL_POLYGON_OFFSET_LINE 0x2A02\n#define GL_R3_G3_B2 0x2A10\n#define GL_V2F 0x2A20\n#define GL_V3F 0x2A21\n#define GL_C4UB_V2F 0x2A22\n#define GL_C4UB_V3F 0x2A23\n#define GL_C3F_V3F 0x2A24\n#define GL_N3F_V3F 0x2A25\n#define GL_C4F_N3F_V3F 0x2A26\n#define GL_T2F_V3F 0x2A27\n#define GL_T4F_V4F 0x2A28\n#define GL_T2F_C4UB_V3F 0x2A29\n#define GL_T2F_C3F_V3F 0x2A2A\n#define GL_T2F_N3F_V3F 0x2A2B\n#define GL_T2F_C4F_N3F_V3F 0x2A2C\n#define GL_T4F_C4F_N3F_V4F 0x2A2D\n#define GL_CLIP_PLANE0 0x3000\n#define GL_CLIP_PLANE1 0x3001\n#define GL_CLIP_PLANE2 0x3002\n#define GL_CLIP_PLANE3 0x3003\n#define GL_CLIP_PLANE4 0x3004\n#define GL_CLIP_PLANE5 0x3005\n#define GL_LIGHT0 0x4000\n#define GL_COLOR_BUFFER_BIT 0x00004000\n#define GL_LIGHT1 0x4001\n#define GL_LIGHT2 0x4002\n#define GL_LIGHT3 0x4003\n#define GL_LIGHT4 0x4004\n#define GL_LIGHT5 0x4005\n#define GL_LIGHT6 0x4006\n#define GL_LIGHT7 0x4007\n#define GL_HINT_BIT 0x00008000\n#define GL_POLYGON_OFFSET_FILL 0x8037\n#define GL_POLYGON_OFFSET_FACTOR 0x8038\n#define GL_ALPHA4 0x803B\n#define GL_ALPHA8 0x803C\n#define GL_ALPHA12 0x803D\n#define GL_ALPHA16 0x803E\n#define GL_LUMINANCE4 0x803F\n#define GL_LUMINANCE8 0x8040\n#define GL_LUMINANCE12 0x8041\n#define GL_LUMINANCE16 0x8042\n#define GL_LUMINANCE4_ALPHA4 0x8043\n#define GL_LUMINANCE6_ALPHA2 0x8044\n#define GL_LUMINANCE8_ALPHA8 0x8045\n#define GL_LUMINANCE12_ALPHA4 0x8046\n#define GL_LUMINANCE12_ALPHA12 0x8047\n#define GL_LUMINANCE16_ALPHA16 0x8048\n#define GL_INTENSITY 0x8049\n#define GL_INTENSITY4 0x804A\n#define GL_INTENSITY8 0x804B\n#define GL_INTENSITY12 0x804C\n#define GL_INTENSITY16 0x804D\n#define GL_RGB4 0x804F\n#define GL_RGB5 0x8050\n#define GL_RGB8 0x8051\n#define GL_RGB10 0x8052\n#define GL_RGB12 0x8053\n#define GL_RGB16 0x8054\n#define GL_RGBA2 0x8055\n#define GL_RGBA4 0x8056\n#define GL_RGB5_A1 0x8057\n#define GL_RGBA8 0x8058\n#define GL_RGB10_A2 0x8059\n#define GL_RGBA12 0x805A\n#define GL_RGBA16 0x805B\n#define GL_TEXTURE_RED_SIZE 0x805C\n#define GL_TEXTURE_GREEN_SIZE 0x805D\n#define GL_TEXTURE_BLUE_SIZE 0x805E\n#define GL_TEXTURE_ALPHA_SIZE 0x805F\n#define GL_TEXTURE_LUMINANCE_SIZE 0x8060\n#define GL_TEXTURE_INTENSITY_SIZE 0x8061\n#define GL_PROXY_TEXTURE_1D 0x8063\n#define GL_PROXY_TEXTURE_2D 0x8064\n#define GL_TEXTURE_PRIORITY 0x8066\n#define GL_TEXTURE_RESIDENT 0x8067\n#define GL_TEXTURE_BINDING_1D 0x8068\n#define GL_TEXTURE_BINDING_2D 0x8069\n#define GL_VERTEX_ARRAY 0x8074\n#define GL_NORMAL_ARRAY 0x8075\n#define GL_COLOR_ARRAY 0x8076\n#define GL_INDEX_ARRAY 0x8077\n#define GL_TEXTURE_COORD_ARRAY 0x8078\n#define GL_EDGE_FLAG_ARRAY 0x8079\n#define GL_VERTEX_ARRAY_SIZE 0x807A\n#define GL_VERTEX_ARRAY_TYPE 0x807B\n#define GL_VERTEX_ARRAY_STRIDE 0x807C\n#define GL_NORMAL_ARRAY_TYPE 0x807E\n#define GL_NORMAL_ARRAY_STRIDE 0x807F\n#define GL_COLOR_ARRAY_SIZE 0x8081\n#define GL_COLOR_ARRAY_TYPE 0x8082\n#define GL_COLOR_ARRAY_STRIDE 0x8083\n#define GL_INDEX_ARRAY_TYPE 0x8085\n#define GL_INDEX_ARRAY_STRIDE 0x8086\n#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088\n#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089\n#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A\n#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C\n#define GL_VERTEX_ARRAY_POINTER 0x808E\n#define GL_NORMAL_ARRAY_POINTER 0x808F\n#define GL_COLOR_ARRAY_POINTER 0x8090\n#define GL_INDEX_ARRAY_POINTER 0x8091\n#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092\n#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093\n#define GL_COLOR_INDEX1_EXT 0x80E2\n#define GL_COLOR_INDEX2_EXT 0x80E3\n#define GL_COLOR_INDEX4_EXT 0x80E4\n#define GL_COLOR_INDEX8_EXT 0x80E5\n#define GL_COLOR_INDEX12_EXT 0x80E6\n#define GL_COLOR_INDEX16_EXT 0x80E7\n#define GL_EVAL_BIT 0x00010000\n#define GL_LIST_BIT 0x00020000\n#define GL_TEXTURE_BIT 0x00040000\n#define GL_SCISSOR_BIT 0x00080000\n#define GL_ALL_ATTRIB_BITS 0x000fffff\n#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff\n\nGLAPI void GLAPIENTRY glAccum (GLenum op, GLfloat value);\nGLAPI void GLAPIENTRY glAlphaFunc (GLenum func, GLclampf ref);\nGLAPI GLboolean GLAPIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences);\nGLAPI void GLAPIENTRY glArrayElement (GLint i);\nGLAPI void GLAPIENTRY glBegin (GLenum mode);\nGLAPI void GLAPIENTRY glBindTexture (GLenum target, GLuint texture);\nGLAPI void GLAPIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);\nGLAPI void GLAPIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);\nGLAPI void GLAPIENTRY glCallList (GLuint list);\nGLAPI void GLAPIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists);\nGLAPI void GLAPIENTRY glClear (GLbitfield mask);\nGLAPI void GLAPIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI void GLAPIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\nGLAPI void GLAPIENTRY glClearDepth (GLclampd depth);\nGLAPI void GLAPIENTRY glClearIndex (GLfloat c);\nGLAPI void GLAPIENTRY glClearStencil (GLint s);\nGLAPI void GLAPIENTRY glClipPlane (GLenum plane, const GLdouble *equation);\nGLAPI void GLAPIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue);\nGLAPI void GLAPIENTRY glColor3bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue);\nGLAPI void GLAPIENTRY glColor3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue);\nGLAPI void GLAPIENTRY glColor3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glColor3i (GLint red, GLint green, GLint blue);\nGLAPI void GLAPIENTRY glColor3iv (const GLint *v);\nGLAPI void GLAPIENTRY glColor3s (GLshort red, GLshort green, GLshort blue);\nGLAPI void GLAPIENTRY glColor3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue);\nGLAPI void GLAPIENTRY glColor3ubv (const GLubyte *v);\nGLAPI void GLAPIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue);\nGLAPI void GLAPIENTRY glColor3uiv (const GLuint *v);\nGLAPI void GLAPIENTRY glColor3us (GLushort red, GLushort green, GLushort blue);\nGLAPI void GLAPIENTRY glColor3usv (const GLushort *v);\nGLAPI void GLAPIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);\nGLAPI void GLAPIENTRY glColor4bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);\nGLAPI void GLAPIENTRY glColor4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI void GLAPIENTRY glColor4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha);\nGLAPI void GLAPIENTRY glColor4iv (const GLint *v);\nGLAPI void GLAPIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha);\nGLAPI void GLAPIENTRY glColor4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);\nGLAPI void GLAPIENTRY glColor4ubv (const GLubyte *v);\nGLAPI void GLAPIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha);\nGLAPI void GLAPIENTRY glColor4uiv (const GLuint *v);\nGLAPI void GLAPIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha);\nGLAPI void GLAPIENTRY glColor4usv (const GLushort *v);\nGLAPI void GLAPIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\nGLAPI void GLAPIENTRY glColorMaterial (GLenum face, GLenum mode);\nGLAPI void GLAPIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);\nGLAPI void GLAPIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);\nGLAPI void GLAPIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\nGLAPI void GLAPIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\nGLAPI void GLAPIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI void GLAPIENTRY glCullFace (GLenum mode);\nGLAPI void GLAPIENTRY glDeleteLists (GLuint list, GLsizei range);\nGLAPI void GLAPIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);\nGLAPI void GLAPIENTRY glDepthFunc (GLenum func);\nGLAPI void GLAPIENTRY glDepthMask (GLboolean flag);\nGLAPI void GLAPIENTRY glDepthRange (GLclampd zNear, GLclampd zFar);\nGLAPI void GLAPIENTRY glDisable (GLenum cap);\nGLAPI void GLAPIENTRY glDisableClientState (GLenum array);\nGLAPI void GLAPIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);\nGLAPI void GLAPIENTRY glDrawBuffer (GLenum mode);\nGLAPI void GLAPIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);\nGLAPI void GLAPIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glEdgeFlag (GLboolean flag);\nGLAPI void GLAPIENTRY glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glEdgeFlagv (const GLboolean *flag);\nGLAPI void GLAPIENTRY glEnable (GLenum cap);\nGLAPI void GLAPIENTRY glEnableClientState (GLenum array);\nGLAPI void GLAPIENTRY glEnd (void);\nGLAPI void GLAPIENTRY glEndList (void);\nGLAPI void GLAPIENTRY glEvalCoord1d (GLdouble u);\nGLAPI void GLAPIENTRY glEvalCoord1dv (const GLdouble *u);\nGLAPI void GLAPIENTRY glEvalCoord1f (GLfloat u);\nGLAPI void GLAPIENTRY glEvalCoord1fv (const GLfloat *u);\nGLAPI void GLAPIENTRY glEvalCoord2d (GLdouble u, GLdouble v);\nGLAPI void GLAPIENTRY glEvalCoord2dv (const GLdouble *u);\nGLAPI void GLAPIENTRY glEvalCoord2f (GLfloat u, GLfloat v);\nGLAPI void GLAPIENTRY glEvalCoord2fv (const GLfloat *u);\nGLAPI void GLAPIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2);\nGLAPI void GLAPIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);\nGLAPI void GLAPIENTRY glEvalPoint1 (GLint i);\nGLAPI void GLAPIENTRY glEvalPoint2 (GLint i, GLint j);\nGLAPI void GLAPIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer);\nGLAPI void GLAPIENTRY glFinish (void);\nGLAPI void GLAPIENTRY glFlush (void);\nGLAPI void GLAPIENTRY glFogf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glFogfv (GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glFogi (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glFogiv (GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glFrontFace (GLenum mode);\nGLAPI void GLAPIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\nGLAPI GLuint GLAPIENTRY glGenLists (GLsizei range);\nGLAPI void GLAPIENTRY glGenTextures (GLsizei n, GLuint *textures);\nGLAPI void GLAPIENTRY glGetBooleanv (GLenum pname, GLboolean *params);\nGLAPI void GLAPIENTRY glGetClipPlane (GLenum plane, GLdouble *equation);\nGLAPI void GLAPIENTRY glGetDoublev (GLenum pname, GLdouble *params);\nGLAPI GLenum GLAPIENTRY glGetError (void);\nGLAPI void GLAPIENTRY glGetFloatv (GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetIntegerv (GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v);\nGLAPI void GLAPIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v);\nGLAPI void GLAPIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v);\nGLAPI void GLAPIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetPixelMapfv (GLenum map, GLfloat *values);\nGLAPI void GLAPIENTRY glGetPixelMapuiv (GLenum map, GLuint *values);\nGLAPI void GLAPIENTRY glGetPixelMapusv (GLenum map, GLushort *values);\nGLAPI void GLAPIENTRY glGetPointerv (GLenum pname, GLvoid* *params);\nGLAPI void GLAPIENTRY glGetPolygonStipple (GLubyte *mask);\nGLAPI const GLubyte * GLAPIENTRY glGetString (GLenum name);\nGLAPI void GLAPIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params);\nGLAPI void GLAPIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);\nGLAPI void GLAPIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glHint (GLenum target, GLenum mode);\nGLAPI void GLAPIENTRY glIndexMask (GLuint mask);\nGLAPI void GLAPIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glIndexd (GLdouble c);\nGLAPI void GLAPIENTRY glIndexdv (const GLdouble *c);\nGLAPI void GLAPIENTRY glIndexf (GLfloat c);\nGLAPI void GLAPIENTRY glIndexfv (const GLfloat *c);\nGLAPI void GLAPIENTRY glIndexi (GLint c);\nGLAPI void GLAPIENTRY glIndexiv (const GLint *c);\nGLAPI void GLAPIENTRY glIndexs (GLshort c);\nGLAPI void GLAPIENTRY glIndexsv (const GLshort *c);\nGLAPI void GLAPIENTRY glIndexub (GLubyte c);\nGLAPI void GLAPIENTRY glIndexubv (const GLubyte *c);\nGLAPI void GLAPIENTRY glInitNames (void);\nGLAPI void GLAPIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer);\nGLAPI GLboolean GLAPIENTRY glIsEnabled (GLenum cap);\nGLAPI GLboolean GLAPIENTRY glIsList (GLuint list);\nGLAPI GLboolean GLAPIENTRY glIsTexture (GLuint texture);\nGLAPI void GLAPIENTRY glLightModelf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glLightModelfv (GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glLightModeli (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glLightModeliv (GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glLighti (GLenum light, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glLineStipple (GLint factor, GLushort pattern);\nGLAPI void GLAPIENTRY glLineWidth (GLfloat width);\nGLAPI void GLAPIENTRY glListBase (GLuint base);\nGLAPI void GLAPIENTRY glLoadIdentity (void);\nGLAPI void GLAPIENTRY glLoadMatrixd (const GLdouble *m);\nGLAPI void GLAPIENTRY glLoadMatrixf (const GLfloat *m);\nGLAPI void GLAPIENTRY glLoadName (GLuint name);\nGLAPI void GLAPIENTRY glLogicOp (GLenum opcode);\nGLAPI void GLAPIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);\nGLAPI void GLAPIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);\nGLAPI void GLAPIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);\nGLAPI void GLAPIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);\nGLAPI void GLAPIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2);\nGLAPI void GLAPIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2);\nGLAPI void GLAPIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);\nGLAPI void GLAPIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);\nGLAPI void GLAPIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glMateriali (GLenum face, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glMatrixMode (GLenum mode);\nGLAPI void GLAPIENTRY glMultMatrixd (const GLdouble *m);\nGLAPI void GLAPIENTRY glMultMatrixf (const GLfloat *m);\nGLAPI void GLAPIENTRY glNewList (GLuint list, GLenum mode);\nGLAPI void GLAPIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz);\nGLAPI void GLAPIENTRY glNormal3bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz);\nGLAPI void GLAPIENTRY glNormal3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);\nGLAPI void GLAPIENTRY glNormal3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glNormal3i (GLint nx, GLint ny, GLint nz);\nGLAPI void GLAPIENTRY glNormal3iv (const GLint *v);\nGLAPI void GLAPIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz);\nGLAPI void GLAPIENTRY glNormal3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\nGLAPI void GLAPIENTRY glPassThrough (GLfloat token);\nGLAPI void GLAPIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values);\nGLAPI void GLAPIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values);\nGLAPI void GLAPIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values);\nGLAPI void GLAPIENTRY glPixelStoref (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glPixelStorei (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glPixelTransferf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glPixelTransferi (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor);\nGLAPI void GLAPIENTRY glPointSize (GLfloat size);\nGLAPI void GLAPIENTRY glPolygonMode (GLenum face, GLenum mode);\nGLAPI void GLAPIENTRY glPolygonOffset (GLfloat factor, GLfloat units);\nGLAPI void GLAPIENTRY glPolygonStipple (const GLubyte *mask);\nGLAPI void GLAPIENTRY glPopAttrib (void);\nGLAPI void GLAPIENTRY glPopClientAttrib (void);\nGLAPI void GLAPIENTRY glPopMatrix (void);\nGLAPI void GLAPIENTRY glPopName (void);\nGLAPI void GLAPIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities);\nGLAPI void GLAPIENTRY glPushAttrib (GLbitfield mask);\nGLAPI void GLAPIENTRY glPushClientAttrib (GLbitfield mask);\nGLAPI void GLAPIENTRY glPushMatrix (void);\nGLAPI void GLAPIENTRY glPushName (GLuint name);\nGLAPI void GLAPIENTRY glRasterPos2d (GLdouble x, GLdouble y);\nGLAPI void GLAPIENTRY glRasterPos2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos2f (GLfloat x, GLfloat y);\nGLAPI void GLAPIENTRY glRasterPos2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos2i (GLint x, GLint y);\nGLAPI void GLAPIENTRY glRasterPos2iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos2s (GLshort x, GLshort y);\nGLAPI void GLAPIENTRY glRasterPos2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glRasterPos3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glRasterPos3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos3i (GLint x, GLint y, GLint z);\nGLAPI void GLAPIENTRY glRasterPos3iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z);\nGLAPI void GLAPIENTRY glRasterPos3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nGLAPI void GLAPIENTRY glRasterPos4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nGLAPI void GLAPIENTRY glRasterPos4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w);\nGLAPI void GLAPIENTRY glRasterPos4iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w);\nGLAPI void GLAPIENTRY glRasterPos4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glReadBuffer (GLenum mode);\nGLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);\nGLAPI void GLAPIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);\nGLAPI void GLAPIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2);\nGLAPI void GLAPIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);\nGLAPI void GLAPIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2);\nGLAPI void GLAPIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2);\nGLAPI void GLAPIENTRY glRectiv (const GLint *v1, const GLint *v2);\nGLAPI void GLAPIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2);\nGLAPI void GLAPIENTRY glRectsv (const GLshort *v1, const GLshort *v2);\nGLAPI GLint GLAPIENTRY glRenderMode (GLenum mode);\nGLAPI void GLAPIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI void GLAPIENTRY glSelectBuffer (GLsizei size, GLuint *buffer);\nGLAPI void GLAPIENTRY glShadeModel (GLenum mode);\nGLAPI void GLAPIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);\nGLAPI void GLAPIENTRY glStencilMask (GLuint mask);\nGLAPI void GLAPIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);\nGLAPI void GLAPIENTRY glTexCoord1d (GLdouble s);\nGLAPI void GLAPIENTRY glTexCoord1dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord1f (GLfloat s);\nGLAPI void GLAPIENTRY glTexCoord1fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord1i (GLint s);\nGLAPI void GLAPIENTRY glTexCoord1iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord1s (GLshort s);\nGLAPI void GLAPIENTRY glTexCoord1sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord2d (GLdouble s, GLdouble t);\nGLAPI void GLAPIENTRY glTexCoord2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord2f (GLfloat s, GLfloat t);\nGLAPI void GLAPIENTRY glTexCoord2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord2i (GLint s, GLint t);\nGLAPI void GLAPIENTRY glTexCoord2iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord2s (GLshort s, GLshort t);\nGLAPI void GLAPIENTRY glTexCoord2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r);\nGLAPI void GLAPIENTRY glTexCoord3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r);\nGLAPI void GLAPIENTRY glTexCoord3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord3i (GLint s, GLint t, GLint r);\nGLAPI void GLAPIENTRY glTexCoord3iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r);\nGLAPI void GLAPIENTRY glTexCoord3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q);\nGLAPI void GLAPIENTRY glTexCoord4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q);\nGLAPI void GLAPIENTRY glTexCoord4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q);\nGLAPI void GLAPIENTRY glTexCoord4iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q);\nGLAPI void GLAPIENTRY glTexCoord4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param);\nGLAPI void GLAPIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params);\nGLAPI void GLAPIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glVertex2d (GLdouble x, GLdouble y);\nGLAPI void GLAPIENTRY glVertex2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex2f (GLfloat x, GLfloat y);\nGLAPI void GLAPIENTRY glVertex2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex2i (GLint x, GLint y);\nGLAPI void GLAPIENTRY glVertex2iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex2s (GLshort x, GLshort y);\nGLAPI void GLAPIENTRY glVertex2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glVertex3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glVertex3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex3i (GLint x, GLint y, GLint z);\nGLAPI void GLAPIENTRY glVertex3iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex3s (GLshort x, GLshort y, GLshort z);\nGLAPI void GLAPIENTRY glVertex3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nGLAPI void GLAPIENTRY glVertex4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nGLAPI void GLAPIENTRY glVertex4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w);\nGLAPI void GLAPIENTRY glVertex4iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w);\nGLAPI void GLAPIENTRY glVertex4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);\n\n#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1)\n\n#endif /* GL_VERSION_1_1 */\n\n/* ---------------------------------- GLU ---------------------------------- */\n\n#ifndef GLEW_NO_GLU\n/* this is where we can safely include GLU */\n# if defined(__APPLE__) && defined(__MACH__)\n# include \n# else\n# include \n# endif\n#endif\n\n/* ----------------------------- GL_VERSION_1_2 ---------------------------- */\n\n#ifndef GL_VERSION_1_2\n#define GL_VERSION_1_2 1\n\n#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12\n#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22\n#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_UNSIGNED_BYTE_3_3_2 0x8032\n#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033\n#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034\n#define GL_UNSIGNED_INT_8_8_8_8 0x8035\n#define GL_UNSIGNED_INT_10_10_10_2 0x8036\n#define GL_RESCALE_NORMAL 0x803A\n#define GL_TEXTURE_BINDING_3D 0x806A\n#define GL_PACK_SKIP_IMAGES 0x806B\n#define GL_PACK_IMAGE_HEIGHT 0x806C\n#define GL_UNPACK_SKIP_IMAGES 0x806D\n#define GL_UNPACK_IMAGE_HEIGHT 0x806E\n#define GL_TEXTURE_3D 0x806F\n#define GL_PROXY_TEXTURE_3D 0x8070\n#define GL_TEXTURE_DEPTH 0x8071\n#define GL_TEXTURE_WRAP_R 0x8072\n#define GL_MAX_3D_TEXTURE_SIZE 0x8073\n#define GL_BGR 0x80E0\n#define GL_BGRA 0x80E1\n#define GL_MAX_ELEMENTS_VERTICES 0x80E8\n#define GL_MAX_ELEMENTS_INDICES 0x80E9\n#define GL_CLAMP_TO_EDGE 0x812F\n#define GL_TEXTURE_MIN_LOD 0x813A\n#define GL_TEXTURE_MAX_LOD 0x813B\n#define GL_TEXTURE_BASE_LEVEL 0x813C\n#define GL_TEXTURE_MAX_LEVEL 0x813D\n#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8\n#define GL_SINGLE_COLOR 0x81F9\n#define GL_SEPARATE_SPECULAR_COLOR 0x81FA\n#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362\n#define GL_UNSIGNED_SHORT_5_6_5 0x8363\n#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364\n#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365\n#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366\n#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367\n#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368\n#define GL_ALIASED_POINT_SIZE_RANGE 0x846D\n#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E\n\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\n\n#define glCopyTexSubImage3D GLEW_GET_FUN(__glewCopyTexSubImage3D)\n#define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements)\n#define glTexImage3D GLEW_GET_FUN(__glewTexImage3D)\n#define glTexSubImage3D GLEW_GET_FUN(__glewTexSubImage3D)\n\n#define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2)\n\n#endif /* GL_VERSION_1_2 */\n\n/* ---------------------------- GL_VERSION_1_2_1 --------------------------- */\n\n#ifndef GL_VERSION_1_2_1\n#define GL_VERSION_1_2_1 1\n\n#define GLEW_VERSION_1_2_1 GLEW_GET_VAR(__GLEW_VERSION_1_2_1)\n\n#endif /* GL_VERSION_1_2_1 */\n\n/* ----------------------------- GL_VERSION_1_3 ---------------------------- */\n\n#ifndef GL_VERSION_1_3\n#define GL_VERSION_1_3 1\n\n#define GL_MULTISAMPLE 0x809D\n#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E\n#define GL_SAMPLE_ALPHA_TO_ONE 0x809F\n#define GL_SAMPLE_COVERAGE 0x80A0\n#define GL_SAMPLE_BUFFERS 0x80A8\n#define GL_SAMPLES 0x80A9\n#define GL_SAMPLE_COVERAGE_VALUE 0x80AA\n#define GL_SAMPLE_COVERAGE_INVERT 0x80AB\n#define GL_CLAMP_TO_BORDER 0x812D\n#define GL_TEXTURE0 0x84C0\n#define GL_TEXTURE1 0x84C1\n#define GL_TEXTURE2 0x84C2\n#define GL_TEXTURE3 0x84C3\n#define GL_TEXTURE4 0x84C4\n#define GL_TEXTURE5 0x84C5\n#define GL_TEXTURE6 0x84C6\n#define GL_TEXTURE7 0x84C7\n#define GL_TEXTURE8 0x84C8\n#define GL_TEXTURE9 0x84C9\n#define GL_TEXTURE10 0x84CA\n#define GL_TEXTURE11 0x84CB\n#define GL_TEXTURE12 0x84CC\n#define GL_TEXTURE13 0x84CD\n#define GL_TEXTURE14 0x84CE\n#define GL_TEXTURE15 0x84CF\n#define GL_TEXTURE16 0x84D0\n#define GL_TEXTURE17 0x84D1\n#define GL_TEXTURE18 0x84D2\n#define GL_TEXTURE19 0x84D3\n#define GL_TEXTURE20 0x84D4\n#define GL_TEXTURE21 0x84D5\n#define GL_TEXTURE22 0x84D6\n#define GL_TEXTURE23 0x84D7\n#define GL_TEXTURE24 0x84D8\n#define GL_TEXTURE25 0x84D9\n#define GL_TEXTURE26 0x84DA\n#define GL_TEXTURE27 0x84DB\n#define GL_TEXTURE28 0x84DC\n#define GL_TEXTURE29 0x84DD\n#define GL_TEXTURE30 0x84DE\n#define GL_TEXTURE31 0x84DF\n#define GL_ACTIVE_TEXTURE 0x84E0\n#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1\n#define GL_MAX_TEXTURE_UNITS 0x84E2\n#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3\n#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4\n#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5\n#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6\n#define GL_SUBTRACT 0x84E7\n#define GL_COMPRESSED_ALPHA 0x84E9\n#define GL_COMPRESSED_LUMINANCE 0x84EA\n#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB\n#define GL_COMPRESSED_INTENSITY 0x84EC\n#define GL_COMPRESSED_RGB 0x84ED\n#define GL_COMPRESSED_RGBA 0x84EE\n#define GL_TEXTURE_COMPRESSION_HINT 0x84EF\n#define GL_NORMAL_MAP 0x8511\n#define GL_REFLECTION_MAP 0x8512\n#define GL_TEXTURE_CUBE_MAP 0x8513\n#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A\n#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C\n#define GL_COMBINE 0x8570\n#define GL_COMBINE_RGB 0x8571\n#define GL_COMBINE_ALPHA 0x8572\n#define GL_RGB_SCALE 0x8573\n#define GL_ADD_SIGNED 0x8574\n#define GL_INTERPOLATE 0x8575\n#define GL_CONSTANT 0x8576\n#define GL_PRIMARY_COLOR 0x8577\n#define GL_PREVIOUS 0x8578\n#define GL_SOURCE0_RGB 0x8580\n#define GL_SOURCE1_RGB 0x8581\n#define GL_SOURCE2_RGB 0x8582\n#define GL_SOURCE0_ALPHA 0x8588\n#define GL_SOURCE1_ALPHA 0x8589\n#define GL_SOURCE2_ALPHA 0x858A\n#define GL_OPERAND0_RGB 0x8590\n#define GL_OPERAND1_RGB 0x8591\n#define GL_OPERAND2_RGB 0x8592\n#define GL_OPERAND0_ALPHA 0x8598\n#define GL_OPERAND1_ALPHA 0x8599\n#define GL_OPERAND2_ALPHA 0x859A\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0\n#define GL_TEXTURE_COMPRESSED 0x86A1\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2\n#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3\n#define GL_DOT3_RGB 0x86AE\n#define GL_DOT3_RGBA 0x86AF\n#define GL_MULTISAMPLE_BIT 0x20000000\n\ntypedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture);\ntypedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLvoid *img);\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);\n\n#define glActiveTexture GLEW_GET_FUN(__glewActiveTexture)\n#define glClientActiveTexture GLEW_GET_FUN(__glewClientActiveTexture)\n#define glCompressedTexImage1D GLEW_GET_FUN(__glewCompressedTexImage1D)\n#define glCompressedTexImage2D GLEW_GET_FUN(__glewCompressedTexImage2D)\n#define glCompressedTexImage3D GLEW_GET_FUN(__glewCompressedTexImage3D)\n#define glCompressedTexSubImage1D GLEW_GET_FUN(__glewCompressedTexSubImage1D)\n#define glCompressedTexSubImage2D GLEW_GET_FUN(__glewCompressedTexSubImage2D)\n#define glCompressedTexSubImage3D GLEW_GET_FUN(__glewCompressedTexSubImage3D)\n#define glGetCompressedTexImage GLEW_GET_FUN(__glewGetCompressedTexImage)\n#define glLoadTransposeMatrixd GLEW_GET_FUN(__glewLoadTransposeMatrixd)\n#define glLoadTransposeMatrixf GLEW_GET_FUN(__glewLoadTransposeMatrixf)\n#define glMultTransposeMatrixd GLEW_GET_FUN(__glewMultTransposeMatrixd)\n#define glMultTransposeMatrixf GLEW_GET_FUN(__glewMultTransposeMatrixf)\n#define glMultiTexCoord1d GLEW_GET_FUN(__glewMultiTexCoord1d)\n#define glMultiTexCoord1dv GLEW_GET_FUN(__glewMultiTexCoord1dv)\n#define glMultiTexCoord1f GLEW_GET_FUN(__glewMultiTexCoord1f)\n#define glMultiTexCoord1fv GLEW_GET_FUN(__glewMultiTexCoord1fv)\n#define glMultiTexCoord1i GLEW_GET_FUN(__glewMultiTexCoord1i)\n#define glMultiTexCoord1iv GLEW_GET_FUN(__glewMultiTexCoord1iv)\n#define glMultiTexCoord1s GLEW_GET_FUN(__glewMultiTexCoord1s)\n#define glMultiTexCoord1sv GLEW_GET_FUN(__glewMultiTexCoord1sv)\n#define glMultiTexCoord2d GLEW_GET_FUN(__glewMultiTexCoord2d)\n#define glMultiTexCoord2dv GLEW_GET_FUN(__glewMultiTexCoord2dv)\n#define glMultiTexCoord2f GLEW_GET_FUN(__glewMultiTexCoord2f)\n#define glMultiTexCoord2fv GLEW_GET_FUN(__glewMultiTexCoord2fv)\n#define glMultiTexCoord2i GLEW_GET_FUN(__glewMultiTexCoord2i)\n#define glMultiTexCoord2iv GLEW_GET_FUN(__glewMultiTexCoord2iv)\n#define glMultiTexCoord2s GLEW_GET_FUN(__glewMultiTexCoord2s)\n#define glMultiTexCoord2sv GLEW_GET_FUN(__glewMultiTexCoord2sv)\n#define glMultiTexCoord3d GLEW_GET_FUN(__glewMultiTexCoord3d)\n#define glMultiTexCoord3dv GLEW_GET_FUN(__glewMultiTexCoord3dv)\n#define glMultiTexCoord3f GLEW_GET_FUN(__glewMultiTexCoord3f)\n#define glMultiTexCoord3fv GLEW_GET_FUN(__glewMultiTexCoord3fv)\n#define glMultiTexCoord3i GLEW_GET_FUN(__glewMultiTexCoord3i)\n#define glMultiTexCoord3iv GLEW_GET_FUN(__glewMultiTexCoord3iv)\n#define glMultiTexCoord3s GLEW_GET_FUN(__glewMultiTexCoord3s)\n#define glMultiTexCoord3sv GLEW_GET_FUN(__glewMultiTexCoord3sv)\n#define glMultiTexCoord4d GLEW_GET_FUN(__glewMultiTexCoord4d)\n#define glMultiTexCoord4dv GLEW_GET_FUN(__glewMultiTexCoord4dv)\n#define glMultiTexCoord4f GLEW_GET_FUN(__glewMultiTexCoord4f)\n#define glMultiTexCoord4fv GLEW_GET_FUN(__glewMultiTexCoord4fv)\n#define glMultiTexCoord4i GLEW_GET_FUN(__glewMultiTexCoord4i)\n#define glMultiTexCoord4iv GLEW_GET_FUN(__glewMultiTexCoord4iv)\n#define glMultiTexCoord4s GLEW_GET_FUN(__glewMultiTexCoord4s)\n#define glMultiTexCoord4sv GLEW_GET_FUN(__glewMultiTexCoord4sv)\n#define glSampleCoverage GLEW_GET_FUN(__glewSampleCoverage)\n\n#define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3)\n\n#endif /* GL_VERSION_1_3 */\n\n/* ----------------------------- GL_VERSION_1_4 ---------------------------- */\n\n#ifndef GL_VERSION_1_4\n#define GL_VERSION_1_4 1\n\n#define GL_BLEND_DST_RGB 0x80C8\n#define GL_BLEND_SRC_RGB 0x80C9\n#define GL_BLEND_DST_ALPHA 0x80CA\n#define GL_BLEND_SRC_ALPHA 0x80CB\n#define GL_POINT_SIZE_MIN 0x8126\n#define GL_POINT_SIZE_MAX 0x8127\n#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128\n#define GL_POINT_DISTANCE_ATTENUATION 0x8129\n#define GL_GENERATE_MIPMAP 0x8191\n#define GL_GENERATE_MIPMAP_HINT 0x8192\n#define GL_DEPTH_COMPONENT16 0x81A5\n#define GL_DEPTH_COMPONENT24 0x81A6\n#define GL_DEPTH_COMPONENT32 0x81A7\n#define GL_MIRRORED_REPEAT 0x8370\n#define GL_FOG_COORDINATE_SOURCE 0x8450\n#define GL_FOG_COORDINATE 0x8451\n#define GL_FRAGMENT_DEPTH 0x8452\n#define GL_CURRENT_FOG_COORDINATE 0x8453\n#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454\n#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455\n#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456\n#define GL_FOG_COORDINATE_ARRAY 0x8457\n#define GL_COLOR_SUM 0x8458\n#define GL_CURRENT_SECONDARY_COLOR 0x8459\n#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A\n#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C\n#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D\n#define GL_SECONDARY_COLOR_ARRAY 0x845E\n#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD\n#define GL_TEXTURE_FILTER_CONTROL 0x8500\n#define GL_TEXTURE_LOD_BIAS 0x8501\n#define GL_INCR_WRAP 0x8507\n#define GL_DECR_WRAP 0x8508\n#define GL_TEXTURE_DEPTH_SIZE 0x884A\n#define GL_DEPTH_TEXTURE_MODE 0x884B\n#define GL_TEXTURE_COMPARE_MODE 0x884C\n#define GL_TEXTURE_COMPARE_FUNC 0x884D\n#define GL_COMPARE_R_TO_TEXTURE 0x884E\n\ntypedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei drawcount);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *p);\n\n#define glBlendColor GLEW_GET_FUN(__glewBlendColor)\n#define glBlendEquation GLEW_GET_FUN(__glewBlendEquation)\n#define glBlendFuncSeparate GLEW_GET_FUN(__glewBlendFuncSeparate)\n#define glFogCoordPointer GLEW_GET_FUN(__glewFogCoordPointer)\n#define glFogCoordd GLEW_GET_FUN(__glewFogCoordd)\n#define glFogCoorddv GLEW_GET_FUN(__glewFogCoorddv)\n#define glFogCoordf GLEW_GET_FUN(__glewFogCoordf)\n#define glFogCoordfv GLEW_GET_FUN(__glewFogCoordfv)\n#define glMultiDrawArrays GLEW_GET_FUN(__glewMultiDrawArrays)\n#define glMultiDrawElements GLEW_GET_FUN(__glewMultiDrawElements)\n#define glPointParameterf GLEW_GET_FUN(__glewPointParameterf)\n#define glPointParameterfv GLEW_GET_FUN(__glewPointParameterfv)\n#define glPointParameteri GLEW_GET_FUN(__glewPointParameteri)\n#define glPointParameteriv GLEW_GET_FUN(__glewPointParameteriv)\n#define glSecondaryColor3b GLEW_GET_FUN(__glewSecondaryColor3b)\n#define glSecondaryColor3bv GLEW_GET_FUN(__glewSecondaryColor3bv)\n#define glSecondaryColor3d GLEW_GET_FUN(__glewSecondaryColor3d)\n#define glSecondaryColor3dv GLEW_GET_FUN(__glewSecondaryColor3dv)\n#define glSecondaryColor3f GLEW_GET_FUN(__glewSecondaryColor3f)\n#define glSecondaryColor3fv GLEW_GET_FUN(__glewSecondaryColor3fv)\n#define glSecondaryColor3i GLEW_GET_FUN(__glewSecondaryColor3i)\n#define glSecondaryColor3iv GLEW_GET_FUN(__glewSecondaryColor3iv)\n#define glSecondaryColor3s GLEW_GET_FUN(__glewSecondaryColor3s)\n#define glSecondaryColor3sv GLEW_GET_FUN(__glewSecondaryColor3sv)\n#define glSecondaryColor3ub GLEW_GET_FUN(__glewSecondaryColor3ub)\n#define glSecondaryColor3ubv GLEW_GET_FUN(__glewSecondaryColor3ubv)\n#define glSecondaryColor3ui GLEW_GET_FUN(__glewSecondaryColor3ui)\n#define glSecondaryColor3uiv GLEW_GET_FUN(__glewSecondaryColor3uiv)\n#define glSecondaryColor3us GLEW_GET_FUN(__glewSecondaryColor3us)\n#define glSecondaryColor3usv GLEW_GET_FUN(__glewSecondaryColor3usv)\n#define glSecondaryColorPointer GLEW_GET_FUN(__glewSecondaryColorPointer)\n#define glWindowPos2d GLEW_GET_FUN(__glewWindowPos2d)\n#define glWindowPos2dv GLEW_GET_FUN(__glewWindowPos2dv)\n#define glWindowPos2f GLEW_GET_FUN(__glewWindowPos2f)\n#define glWindowPos2fv GLEW_GET_FUN(__glewWindowPos2fv)\n#define glWindowPos2i GLEW_GET_FUN(__glewWindowPos2i)\n#define glWindowPos2iv GLEW_GET_FUN(__glewWindowPos2iv)\n#define glWindowPos2s GLEW_GET_FUN(__glewWindowPos2s)\n#define glWindowPos2sv GLEW_GET_FUN(__glewWindowPos2sv)\n#define glWindowPos3d GLEW_GET_FUN(__glewWindowPos3d)\n#define glWindowPos3dv GLEW_GET_FUN(__glewWindowPos3dv)\n#define glWindowPos3f GLEW_GET_FUN(__glewWindowPos3f)\n#define glWindowPos3fv GLEW_GET_FUN(__glewWindowPos3fv)\n#define glWindowPos3i GLEW_GET_FUN(__glewWindowPos3i)\n#define glWindowPos3iv GLEW_GET_FUN(__glewWindowPos3iv)\n#define glWindowPos3s GLEW_GET_FUN(__glewWindowPos3s)\n#define glWindowPos3sv GLEW_GET_FUN(__glewWindowPos3sv)\n\n#define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4)\n\n#endif /* GL_VERSION_1_4 */\n\n/* ----------------------------- GL_VERSION_1_5 ---------------------------- */\n\n#ifndef GL_VERSION_1_5\n#define GL_VERSION_1_5 1\n\n#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE\n#define GL_FOG_COORD GL_FOG_COORDINATE\n#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY\n#define GL_SRC0_RGB GL_SOURCE0_RGB\n#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER\n#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE\n#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA\n#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE\n#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE\n#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA\n#define GL_SRC1_RGB GL_SOURCE1_RGB\n#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING\n#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA\n#define GL_SRC2_RGB GL_SOURCE2_RGB\n#define GL_BUFFER_SIZE 0x8764\n#define GL_BUFFER_USAGE 0x8765\n#define GL_QUERY_COUNTER_BITS 0x8864\n#define GL_CURRENT_QUERY 0x8865\n#define GL_QUERY_RESULT 0x8866\n#define GL_QUERY_RESULT_AVAILABLE 0x8867\n#define GL_ARRAY_BUFFER 0x8892\n#define GL_ELEMENT_ARRAY_BUFFER 0x8893\n#define GL_ARRAY_BUFFER_BINDING 0x8894\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895\n#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896\n#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897\n#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898\n#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F\n#define GL_READ_ONLY 0x88B8\n#define GL_WRITE_ONLY 0x88B9\n#define GL_READ_WRITE 0x88BA\n#define GL_BUFFER_ACCESS 0x88BB\n#define GL_BUFFER_MAPPED 0x88BC\n#define GL_BUFFER_MAP_POINTER 0x88BD\n#define GL_STREAM_DRAW 0x88E0\n#define GL_STREAM_READ 0x88E1\n#define GL_STREAM_COPY 0x88E2\n#define GL_STATIC_DRAW 0x88E4\n#define GL_STATIC_READ 0x88E5\n#define GL_STATIC_COPY 0x88E6\n#define GL_DYNAMIC_DRAW 0x88E8\n#define GL_DYNAMIC_READ 0x88E9\n#define GL_DYNAMIC_COPY 0x88EA\n#define GL_SAMPLES_PASSED 0x8914\n\ntypedef ptrdiff_t GLintptr;\ntypedef ptrdiff_t GLsizeiptr;\n\ntypedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);\ntypedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers);\ntypedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);\ntypedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid** params);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISBUFFERPROC) (GLuint buffer);\ntypedef GLboolean (GLAPIENTRY * PFNGLISQUERYPROC) (GLuint id);\ntypedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);\ntypedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target);\n\n#define glBeginQuery GLEW_GET_FUN(__glewBeginQuery)\n#define glBindBuffer GLEW_GET_FUN(__glewBindBuffer)\n#define glBufferData GLEW_GET_FUN(__glewBufferData)\n#define glBufferSubData GLEW_GET_FUN(__glewBufferSubData)\n#define glDeleteBuffers GLEW_GET_FUN(__glewDeleteBuffers)\n#define glDeleteQueries GLEW_GET_FUN(__glewDeleteQueries)\n#define glEndQuery GLEW_GET_FUN(__glewEndQuery)\n#define glGenBuffers GLEW_GET_FUN(__glewGenBuffers)\n#define glGenQueries GLEW_GET_FUN(__glewGenQueries)\n#define glGetBufferParameteriv GLEW_GET_FUN(__glewGetBufferParameteriv)\n#define glGetBufferPointerv GLEW_GET_FUN(__glewGetBufferPointerv)\n#define glGetBufferSubData GLEW_GET_FUN(__glewGetBufferSubData)\n#define glGetQueryObjectiv GLEW_GET_FUN(__glewGetQueryObjectiv)\n#define glGetQueryObjectuiv GLEW_GET_FUN(__glewGetQueryObjectuiv)\n#define glGetQueryiv GLEW_GET_FUN(__glewGetQueryiv)\n#define glIsBuffer GLEW_GET_FUN(__glewIsBuffer)\n#define glIsQuery GLEW_GET_FUN(__glewIsQuery)\n#define glMapBuffer GLEW_GET_FUN(__glewMapBuffer)\n#define glUnmapBuffer GLEW_GET_FUN(__glewUnmapBuffer)\n\n#define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5)\n\n#endif /* GL_VERSION_1_5 */\n\n/* ----------------------------- GL_VERSION_2_0 ---------------------------- */\n\n#ifndef GL_VERSION_2_0\n#define GL_VERSION_2_0 1\n\n#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625\n#define GL_CURRENT_VERTEX_ATTRIB 0x8626\n#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642\n#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645\n#define GL_STENCIL_BACK_FUNC 0x8800\n#define GL_STENCIL_BACK_FAIL 0x8801\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803\n#define GL_MAX_DRAW_BUFFERS 0x8824\n#define GL_DRAW_BUFFER0 0x8825\n#define GL_DRAW_BUFFER1 0x8826\n#define GL_DRAW_BUFFER2 0x8827\n#define GL_DRAW_BUFFER3 0x8828\n#define GL_DRAW_BUFFER4 0x8829\n#define GL_DRAW_BUFFER5 0x882A\n#define GL_DRAW_BUFFER6 0x882B\n#define GL_DRAW_BUFFER7 0x882C\n#define GL_DRAW_BUFFER8 0x882D\n#define GL_DRAW_BUFFER9 0x882E\n#define GL_DRAW_BUFFER10 0x882F\n#define GL_DRAW_BUFFER11 0x8830\n#define GL_DRAW_BUFFER12 0x8831\n#define GL_DRAW_BUFFER13 0x8832\n#define GL_DRAW_BUFFER14 0x8833\n#define GL_DRAW_BUFFER15 0x8834\n#define GL_BLEND_EQUATION_ALPHA 0x883D\n#define GL_POINT_SPRITE 0x8861\n#define GL_COORD_REPLACE 0x8862\n#define GL_MAX_VERTEX_ATTRIBS 0x8869\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A\n#define GL_MAX_TEXTURE_COORDS 0x8871\n#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872\n#define GL_FRAGMENT_SHADER 0x8B30\n#define GL_VERTEX_SHADER 0x8B31\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A\n#define GL_MAX_VARYING_FLOATS 0x8B4B\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D\n#define GL_SHADER_TYPE 0x8B4F\n#define GL_FLOAT_VEC2 0x8B50\n#define GL_FLOAT_VEC3 0x8B51\n#define GL_FLOAT_VEC4 0x8B52\n#define GL_INT_VEC2 0x8B53\n#define GL_INT_VEC3 0x8B54\n#define GL_INT_VEC4 0x8B55\n#define GL_BOOL 0x8B56\n#define GL_BOOL_VEC2 0x8B57\n#define GL_BOOL_VEC3 0x8B58\n#define GL_BOOL_VEC4 0x8B59\n#define GL_FLOAT_MAT2 0x8B5A\n#define GL_FLOAT_MAT3 0x8B5B\n#define GL_FLOAT_MAT4 0x8B5C\n#define GL_SAMPLER_1D 0x8B5D\n#define GL_SAMPLER_2D 0x8B5E\n#define GL_SAMPLER_3D 0x8B5F\n#define GL_SAMPLER_CUBE 0x8B60\n#define GL_SAMPLER_1D_SHADOW 0x8B61\n#define GL_SAMPLER_2D_SHADOW 0x8B62\n#define GL_DELETE_STATUS 0x8B80\n#define GL_COMPILE_STATUS 0x8B81\n#define GL_LINK_STATUS 0x8B82\n#define GL_VALIDATE_STATUS 0x8B83\n#define GL_INFO_LOG_LENGTH 0x8B84\n#define GL_ATTACHED_SHADERS 0x8B85\n#define GL_ACTIVE_UNIFORMS 0x8B86\n#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87\n#define GL_SHADER_SOURCE_LENGTH 0x8B88\n#define GL_ACTIVE_ATTRIBUTES 0x8B89\n#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B\n#define GL_SHADING_LANGUAGE_VERSION 0x8B8C\n#define GL_CURRENT_PROGRAM 0x8B8D\n#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0\n#define GL_LOWER_LEFT 0x8CA1\n#define GL_UPPER_LEFT 0x8CA2\n#define GL_STENCIL_BACK_REF 0x8CA3\n#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4\n#define GL_STENCIL_BACK_WRITEMASK 0x8CA5\n\ntypedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum, GLenum);\ntypedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader);\ntypedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void);\ntypedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type);\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs);\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders);\ntypedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLuint obj, GLsizei maxLength, GLsizei* length, GLchar* source);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param);\ntypedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint, GLenum, GLvoid**);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVPROC) (GLuint, GLenum, GLdouble*);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVPROC) (GLuint, GLenum, GLint*);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program);\ntypedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar** strings, const GLint* lengths);\ntypedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);\ntypedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum, GLuint);\ntypedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);\n\n#define glAttachShader GLEW_GET_FUN(__glewAttachShader)\n#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation)\n#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate)\n#define glCompileShader GLEW_GET_FUN(__glewCompileShader)\n#define glCreateProgram GLEW_GET_FUN(__glewCreateProgram)\n#define glCreateShader GLEW_GET_FUN(__glewCreateShader)\n#define glDeleteProgram GLEW_GET_FUN(__glewDeleteProgram)\n#define glDeleteShader GLEW_GET_FUN(__glewDeleteShader)\n#define glDetachShader GLEW_GET_FUN(__glewDetachShader)\n#define glDisableVertexAttribArray GLEW_GET_FUN(__glewDisableVertexAttribArray)\n#define glDrawBuffers GLEW_GET_FUN(__glewDrawBuffers)\n#define glEnableVertexAttribArray GLEW_GET_FUN(__glewEnableVertexAttribArray)\n#define glGetActiveAttrib GLEW_GET_FUN(__glewGetActiveAttrib)\n#define glGetActiveUniform GLEW_GET_FUN(__glewGetActiveUniform)\n#define glGetAttachedShaders GLEW_GET_FUN(__glewGetAttachedShaders)\n#define glGetAttribLocation GLEW_GET_FUN(__glewGetAttribLocation)\n#define glGetProgramInfoLog GLEW_GET_FUN(__glewGetProgramInfoLog)\n#define glGetProgramiv GLEW_GET_FUN(__glewGetProgramiv)\n#define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog)\n#define glGetShaderSource GLEW_GET_FUN(__glewGetShaderSource)\n#define glGetShaderiv GLEW_GET_FUN(__glewGetShaderiv)\n#define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation)\n#define glGetUniformfv GLEW_GET_FUN(__glewGetUniformfv)\n#define glGetUniformiv GLEW_GET_FUN(__glewGetUniformiv)\n#define glGetVertexAttribPointerv GLEW_GET_FUN(__glewGetVertexAttribPointerv)\n#define glGetVertexAttribdv GLEW_GET_FUN(__glewGetVertexAttribdv)\n#define glGetVertexAttribfv GLEW_GET_FUN(__glewGetVertexAttribfv)\n#define glGetVertexAttribiv GLEW_GET_FUN(__glewGetVertexAttribiv)\n#define glIsProgram GLEW_GET_FUN(__glewIsProgram)\n#define glIsShader GLEW_GET_FUN(__glewIsShader)\n#define glLinkProgram GLEW_GET_FUN(__glewLinkProgram)\n#define glShaderSource GLEW_GET_FUN(__glewShaderSource)\n#define glStencilFuncSeparate GLEW_GET_FUN(__glewStencilFuncSeparate)\n#define glStencilMaskSeparate GLEW_GET_FUN(__glewStencilMaskSeparate)\n#define glStencilOpSeparate GLEW_GET_FUN(__glewStencilOpSeparate)\n#define glUniform1f GLEW_GET_FUN(__glewUniform1f)\n#define glUniform1fv GLEW_GET_FUN(__glewUniform1fv)\n#define glUniform1i GLEW_GET_FUN(__glewUniform1i)\n#define glUniform1iv GLEW_GET_FUN(__glewUniform1iv)\n#define glUniform2f GLEW_GET_FUN(__glewUniform2f)\n#define glUniform2fv GLEW_GET_FUN(__glewUniform2fv)\n#define glUniform2i GLEW_GET_FUN(__glewUniform2i)\n#define glUniform2iv GLEW_GET_FUN(__glewUniform2iv)\n#define glUniform3f GLEW_GET_FUN(__glewUniform3f)\n#define glUniform3fv GLEW_GET_FUN(__glewUniform3fv)\n#define glUniform3i GLEW_GET_FUN(__glewUniform3i)\n#define glUniform3iv GLEW_GET_FUN(__glewUniform3iv)\n#define glUniform4f GLEW_GET_FUN(__glewUniform4f)\n#define glUniform4fv GLEW_GET_FUN(__glewUniform4fv)\n#define glUniform4i GLEW_GET_FUN(__glewUniform4i)\n#define glUniform4iv GLEW_GET_FUN(__glewUniform4iv)\n#define glUniformMatrix2fv GLEW_GET_FUN(__glewUniformMatrix2fv)\n#define glUniformMatrix3fv GLEW_GET_FUN(__glewUniformMatrix3fv)\n#define glUniformMatrix4fv GLEW_GET_FUN(__glewUniformMatrix4fv)\n#define glUseProgram GLEW_GET_FUN(__glewUseProgram)\n#define glValidateProgram GLEW_GET_FUN(__glewValidateProgram)\n#define glVertexAttrib1d GLEW_GET_FUN(__glewVertexAttrib1d)\n#define glVertexAttrib1dv GLEW_GET_FUN(__glewVertexAttrib1dv)\n#define glVertexAttrib1f GLEW_GET_FUN(__glewVertexAttrib1f)\n#define glVertexAttrib1fv GLEW_GET_FUN(__glewVertexAttrib1fv)\n#define glVertexAttrib1s GLEW_GET_FUN(__glewVertexAttrib1s)\n#define glVertexAttrib1sv GLEW_GET_FUN(__glewVertexAttrib1sv)\n#define glVertexAttrib2d GLEW_GET_FUN(__glewVertexAttrib2d)\n#define glVertexAttrib2dv GLEW_GET_FUN(__glewVertexAttrib2dv)\n#define glVertexAttrib2f GLEW_GET_FUN(__glewVertexAttrib2f)\n#define glVertexAttrib2fv GLEW_GET_FUN(__glewVertexAttrib2fv)\n#define glVertexAttrib2s GLEW_GET_FUN(__glewVertexAttrib2s)\n#define glVertexAttrib2sv GLEW_GET_FUN(__glewVertexAttrib2sv)\n#define glVertexAttrib3d GLEW_GET_FUN(__glewVertexAttrib3d)\n#define glVertexAttrib3dv GLEW_GET_FUN(__glewVertexAttrib3dv)\n#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f)\n#define glVertexAttrib3fv GLEW_GET_FUN(__glewVertexAttrib3fv)\n#define glVertexAttrib3s GLEW_GET_FUN(__glewVertexAttrib3s)\n#define glVertexAttrib3sv GLEW_GET_FUN(__glewVertexAttrib3sv)\n#define glVertexAttrib4Nbv GLEW_GET_FUN(__glewVertexAttrib4Nbv)\n#define glVertexAttrib4Niv GLEW_GET_FUN(__glewVertexAttrib4Niv)\n#define glVertexAttrib4Nsv GLEW_GET_FUN(__glewVertexAttrib4Nsv)\n#define glVertexAttrib4Nub GLEW_GET_FUN(__glewVertexAttrib4Nub)\n#define glVertexAttrib4Nubv GLEW_GET_FUN(__glewVertexAttrib4Nubv)\n#define glVertexAttrib4Nuiv GLEW_GET_FUN(__glewVertexAttrib4Nuiv)\n#define glVertexAttrib4Nusv GLEW_GET_FUN(__glewVertexAttrib4Nusv)\n#define glVertexAttrib4bv GLEW_GET_FUN(__glewVertexAttrib4bv)\n#define glVertexAttrib4d GLEW_GET_FUN(__glewVertexAttrib4d)\n#define glVertexAttrib4dv GLEW_GET_FUN(__glewVertexAttrib4dv)\n#define glVertexAttrib4f GLEW_GET_FUN(__glewVertexAttrib4f)\n#define glVertexAttrib4fv GLEW_GET_FUN(__glewVertexAttrib4fv)\n#define glVertexAttrib4iv GLEW_GET_FUN(__glewVertexAttrib4iv)\n#define glVertexAttrib4s GLEW_GET_FUN(__glewVertexAttrib4s)\n#define glVertexAttrib4sv GLEW_GET_FUN(__glewVertexAttrib4sv)\n#define glVertexAttrib4ubv GLEW_GET_FUN(__glewVertexAttrib4ubv)\n#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv)\n#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv)\n#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer)\n\n#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)\n\n#endif /* GL_VERSION_2_0 */\n\n/* ----------------------------- GL_VERSION_2_1 ---------------------------- */\n\n#ifndef GL_VERSION_2_1\n#define GL_VERSION_2_1 1\n\n#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F\n#define GL_PIXEL_PACK_BUFFER 0x88EB\n#define GL_PIXEL_UNPACK_BUFFER 0x88EC\n#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED\n#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF\n#define GL_FLOAT_MAT2x3 0x8B65\n#define GL_FLOAT_MAT2x4 0x8B66\n#define GL_FLOAT_MAT3x2 0x8B67\n#define GL_FLOAT_MAT3x4 0x8B68\n#define GL_FLOAT_MAT4x2 0x8B69\n#define GL_FLOAT_MAT4x3 0x8B6A\n#define GL_SRGB 0x8C40\n#define GL_SRGB8 0x8C41\n#define GL_SRGB_ALPHA 0x8C42\n#define GL_SRGB8_ALPHA"}, {"path": "includes/GL/glxew.h", "language": "code", "loc": 1201, "comment_density": 0.177, "code": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits \n** Copyright (C) 2002-2008, Marcelo E. Magallon \n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n** this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n** this list of conditions and the following disclaimer in the documentation \n** and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n** derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n * Mesa 3-D graphics library\n * Version: 7.0\n *\n * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __glxew_h__\n#define __glxew_h__\n#define __GLXEW_H__\n\n#ifdef __glxext_h_\n#error glxext.h included before glxew.h\n#endif\n\n#if defined(GLX_H) || defined(__GLX_glx_h__) || defined(__glx_h__)\n#error glx.h included before glxew.h\n#endif\n\n#define __glxext_h_\n\n#define GLX_H\n#define __GLX_glx_h__\n#define __glx_h__\n\n#include \n#include \n#include \n#include \n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* ---------------------------- GLX_VERSION_1_0 --------------------------- */\n\n#ifndef GLX_VERSION_1_0\n#define GLX_VERSION_1_0 1\n\n#define GLX_USE_GL 1\n#define GLX_BUFFER_SIZE 2\n#define GLX_LEVEL 3\n#define GLX_RGBA 4\n#define GLX_DOUBLEBUFFER 5\n#define GLX_STEREO 6\n#define GLX_AUX_BUFFERS 7\n#define GLX_RED_SIZE 8\n#define GLX_GREEN_SIZE 9\n#define GLX_BLUE_SIZE 10\n#define GLX_ALPHA_SIZE 11\n#define GLX_DEPTH_SIZE 12\n#define GLX_STENCIL_SIZE 13\n#define GLX_ACCUM_RED_SIZE 14\n#define GLX_ACCUM_GREEN_SIZE 15\n#define GLX_ACCUM_BLUE_SIZE 16\n#define GLX_ACCUM_ALPHA_SIZE 17\n#define GLX_BAD_SCREEN 1\n#define GLX_BAD_ATTRIBUTE 2\n#define GLX_NO_EXTENSION 3\n#define GLX_BAD_VISUAL 4\n#define GLX_BAD_CONTEXT 5\n#define GLX_BAD_VALUE 6\n#define GLX_BAD_ENUM 7\n\ntypedef XID GLXDrawable;\ntypedef XID GLXPixmap;\n#ifdef __sun\ntypedef struct __glXContextRec *GLXContext;\n#else\ntypedef struct __GLXcontextRec *GLXContext;\n#endif\n\ntypedef unsigned int GLXVideoDeviceNV; \n\nextern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase);\nextern Bool glXQueryVersion (Display *dpy, int *major, int *minor);\nextern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value);\nextern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList);\nextern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap);\nextern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix);\nextern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);\nextern void glXDestroyContext (Display *dpy, GLXContext ctx);\nextern Bool glXIsDirect (Display *dpy, GLXContext ctx);\nextern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, GLulong mask);\nextern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx);\nextern GLXContext glXGetCurrentContext (void);\nextern GLXDrawable glXGetCurrentDrawable (void);\nextern void glXWaitGL (void);\nextern void glXWaitX (void);\nextern void glXSwapBuffers (Display *dpy, GLXDrawable drawable);\nextern void glXUseXFont (Font font, int first, int count, int listBase);\n\n#define GLXEW_VERSION_1_0 GLXEW_GET_VAR(__GLXEW_VERSION_1_0)\n\n#endif /* GLX_VERSION_1_0 */\n\n/* ---------------------------- GLX_VERSION_1_1 --------------------------- */\n\n#ifndef GLX_VERSION_1_1\n#define GLX_VERSION_1_1\n\n#define GLX_VENDOR 0x1\n#define GLX_VERSION 0x2\n#define GLX_EXTENSIONS 0x3\n\nextern const char* glXQueryExtensionsString (Display *dpy, int screen);\nextern const char* glXGetClientString (Display *dpy, int name);\nextern const char* glXQueryServerString (Display *dpy, int screen, int name);\n\n#define GLXEW_VERSION_1_1 GLXEW_GET_VAR(__GLXEW_VERSION_1_1)\n\n#endif /* GLX_VERSION_1_1 */\n\n/* ---------------------------- GLX_VERSION_1_2 ---------------------------- */\n\n#ifndef GLX_VERSION_1_2\n#define GLX_VERSION_1_2 1\n\ntypedef Display* ( * PFNGLXGETCURRENTDISPLAYPROC) (void);\n\n#define glXGetCurrentDisplay GLXEW_GET_FUN(__glewXGetCurrentDisplay)\n\n#define GLXEW_VERSION_1_2 GLXEW_GET_VAR(__GLXEW_VERSION_1_2)\n\n#endif /* GLX_VERSION_1_2 */\n\n/* ---------------------------- GLX_VERSION_1_3 ---------------------------- */\n\n#ifndef GLX_VERSION_1_3\n#define GLX_VERSION_1_3 1\n\n#define GLX_RGBA_BIT 0x00000001\n#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001\n#define GLX_WINDOW_BIT 0x00000001\n#define GLX_COLOR_INDEX_BIT 0x00000002\n#define GLX_PIXMAP_BIT 0x00000002\n#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002\n#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004\n#define GLX_PBUFFER_BIT 0x00000004\n#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008\n#define GLX_AUX_BUFFERS_BIT 0x00000010\n#define GLX_CONFIG_CAVEAT 0x20\n#define GLX_DEPTH_BUFFER_BIT 0x00000020\n#define GLX_X_VISUAL_TYPE 0x22\n#define GLX_TRANSPARENT_TYPE 0x23\n#define GLX_TRANSPARENT_INDEX_VALUE 0x24\n#define GLX_TRANSPARENT_RED_VALUE 0x25\n#define GLX_TRANSPARENT_GREEN_VALUE 0x26\n#define GLX_TRANSPARENT_BLUE_VALUE 0x27\n#define GLX_TRANSPARENT_ALPHA_VALUE 0x28\n#define GLX_STENCIL_BUFFER_BIT 0x00000040\n#define GLX_ACCUM_BUFFER_BIT 0x00000080\n#define GLX_NONE 0x8000\n#define GLX_SLOW_CONFIG 0x8001\n#define GLX_TRUE_COLOR 0x8002\n#define GLX_DIRECT_COLOR 0x8003\n#define GLX_PSEUDO_COLOR 0x8004\n#define GLX_STATIC_COLOR 0x8005\n#define GLX_GRAY_SCALE 0x8006\n#define GLX_STATIC_GRAY 0x8007\n#define GLX_TRANSPARENT_RGB 0x8008\n#define GLX_TRANSPARENT_INDEX 0x8009\n#define GLX_VISUAL_ID 0x800B\n#define GLX_SCREEN 0x800C\n#define GLX_NON_CONFORMANT_CONFIG 0x800D\n#define GLX_DRAWABLE_TYPE 0x8010\n#define GLX_RENDER_TYPE 0x8011\n#define GLX_X_RENDERABLE 0x8012\n#define GLX_FBCONFIG_ID 0x8013\n#define GLX_RGBA_TYPE 0x8014\n#define GLX_COLOR_INDEX_TYPE 0x8015\n#define GLX_MAX_PBUFFER_WIDTH 0x8016\n#define GLX_MAX_PBUFFER_HEIGHT 0x8017\n#define GLX_MAX_PBUFFER_PIXELS 0x8018\n#define GLX_PRESERVED_CONTENTS 0x801B\n#define GLX_LARGEST_PBUFFER 0x801C\n#define GLX_WIDTH 0x801D\n#define GLX_HEIGHT 0x801E\n#define GLX_EVENT_MASK 0x801F\n#define GLX_DAMAGED 0x8020\n#define GLX_SAVED 0x8021\n#define GLX_WINDOW 0x8022\n#define GLX_PBUFFER 0x8023\n#define GLX_PBUFFER_HEIGHT 0x8040\n#define GLX_PBUFFER_WIDTH 0x8041\n#define GLX_PBUFFER_CLOBBER_MASK 0x08000000\n#define GLX_DONT_CARE 0xFFFFFFFF\n\ntypedef XID GLXFBConfigID;\ntypedef XID GLXPbuffer;\ntypedef XID GLXWindow;\ntypedef struct __GLXFBConfigRec *GLXFBConfig;\n\ntypedef struct {\n int event_type; \n int draw_type; \n unsigned long serial; \n Bool send_event; \n Display *display; \n GLXDrawable drawable; \n unsigned int buffer_mask; \n unsigned int aux_buffer; \n int x, y; \n int width, height; \n int count; \n} GLXPbufferClobberEvent;\ntypedef union __GLXEvent {\n GLXPbufferClobberEvent glxpbufferclobber; \n long pad[24]; \n} GLXEvent;\n\ntypedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);\ntypedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);\ntypedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);\ntypedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);\ntypedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);\ntypedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);\ntypedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);\ntypedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);\ntypedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);\ntypedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);\ntypedef GLXFBConfig* ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);\ntypedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);\ntypedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);\ntypedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx);\ntypedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);\ntypedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);\ntypedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);\n\n#define glXChooseFBConfig GLXEW_GET_FUN(__glewXChooseFBConfig)\n#define glXCreateNewContext GLXEW_GET_FUN(__glewXCreateNewContext)\n#define glXCreatePbuffer GLXEW_GET_FUN(__glewXCreatePbuffer)\n#define glXCreatePixmap GLXEW_GET_FUN(__glewXCreatePixmap)\n#define glXCreateWindow GLXEW_GET_FUN(__glewXCreateWindow)\n#define glXDestroyPbuffer GLXEW_GET_FUN(__glewXDestroyPbuffer)\n#define glXDestroyPixmap GLXEW_GET_FUN(__glewXDestroyPixmap)\n#define glXDestroyWindow GLXEW_GET_FUN(__glewXDestroyWindow)\n#define glXGetCurrentReadDrawable GLXEW_GET_FUN(__glewXGetCurrentReadDrawable)\n#define glXGetFBConfigAttrib GLXEW_GET_FUN(__glewXGetFBConfigAttrib)\n#define glXGetFBConfigs GLXEW_GET_FUN(__glewXGetFBConfigs)\n#define glXGetSelectedEvent GLXEW_GET_FUN(__glewXGetSelectedEvent)\n#define glXGetVisualFromFBConfig GLXEW_GET_FUN(__glewXGetVisualFromFBConfig)\n#define glXMakeContextCurrent GLXEW_GET_FUN(__glewXMakeContextCurrent)\n#define glXQueryContext GLXEW_GET_FUN(__glewXQueryContext)\n#define glXQueryDrawable GLXEW_GET_FUN(__glewXQueryDrawable)\n#define glXSelectEvent GLXEW_GET_FUN(__glewXSelectEvent)\n\n#define GLXEW_VERSION_1_3 GLXEW_GET_VAR(__GLXEW_VERSION_1_3)\n\n#endif /* GLX_VERSION_1_3 */\n\n/* ---------------------------- GLX_VERSION_1_4 ---------------------------- */\n\n#ifndef GLX_VERSION_1_4\n#define GLX_VERSION_1_4 1\n\n#define GLX_SAMPLE_BUFFERS 100000\n#define GLX_SAMPLES 100001\n\nextern void ( * glXGetProcAddress (const GLubyte *procName)) (void);\n\n#define GLXEW_VERSION_1_4 GLXEW_GET_VAR(__GLXEW_VERSION_1_4)\n\n#endif /* GLX_VERSION_1_4 */\n\n/* -------------------------- GLX_3DFX_multisample ------------------------- */\n\n#ifndef GLX_3DFX_multisample\n#define GLX_3DFX_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_3DFX 0x8050\n#define GLX_SAMPLES_3DFX 0x8051\n\n#define GLXEW_3DFX_multisample GLXEW_GET_VAR(__GLXEW_3DFX_multisample)\n\n#endif /* GLX_3DFX_multisample */\n\n/* ------------------------ GLX_AMD_gpu_association ------------------------ */\n\n#ifndef GLX_AMD_gpu_association\n#define GLX_AMD_gpu_association 1\n\n#define GLX_GPU_VENDOR_AMD 0x1F00\n#define GLX_GPU_RENDERER_STRING_AMD 0x1F01\n#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define GLX_GPU_RAM_AMD 0x21A3\n#define GLX_GPU_CLOCK_AMD 0x21A4\n#define GLX_GPU_NUM_PIPES_AMD 0x21A5\n#define GLX_GPU_NUM_SIMD_AMD 0x21A6\n#define GLX_GPU_NUM_RB_AMD 0x21A7\n#define GLX_GPU_NUM_SPI_AMD 0x21A8\n\n#define GLXEW_AMD_gpu_association GLXEW_GET_VAR(__GLXEW_AMD_gpu_association)\n\n#endif /* GLX_AMD_gpu_association */\n\n/* ------------------------- GLX_ARB_create_context ------------------------ */\n\n#ifndef GLX_ARB_create_context\n#define GLX_ARB_create_context 1\n\n#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001\n#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002\n#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define GLX_CONTEXT_FLAGS_ARB 0x2094\n\ntypedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);\n\n#define glXCreateContextAttribsARB GLXEW_GET_FUN(__glewXCreateContextAttribsARB)\n\n#define GLXEW_ARB_create_context GLXEW_GET_VAR(__GLXEW_ARB_create_context)\n\n#endif /* GLX_ARB_create_context */\n\n/* --------------------- GLX_ARB_create_context_profile -------------------- */\n\n#ifndef GLX_ARB_create_context_profile\n#define GLX_ARB_create_context_profile 1\n\n#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126\n\n#define GLXEW_ARB_create_context_profile GLXEW_GET_VAR(__GLXEW_ARB_create_context_profile)\n\n#endif /* GLX_ARB_create_context_profile */\n\n/* ------------------- GLX_ARB_create_context_robustness ------------------- */\n\n#ifndef GLX_ARB_create_context_robustness\n#define GLX_ARB_create_context_robustness 1\n\n#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261\n\n#define GLXEW_ARB_create_context_robustness GLXEW_GET_VAR(__GLXEW_ARB_create_context_robustness)\n\n#endif /* GLX_ARB_create_context_robustness */\n\n/* ------------------------- GLX_ARB_fbconfig_float ------------------------ */\n\n#ifndef GLX_ARB_fbconfig_float\n#define GLX_ARB_fbconfig_float 1\n\n#define GLX_RGBA_FLOAT_BIT 0x00000004\n#define GLX_RGBA_FLOAT_TYPE 0x20B9\n\n#define GLXEW_ARB_fbconfig_float GLXEW_GET_VAR(__GLXEW_ARB_fbconfig_float)\n\n#endif /* GLX_ARB_fbconfig_float */\n\n/* ------------------------ GLX_ARB_framebuffer_sRGB ----------------------- */\n\n#ifndef GLX_ARB_framebuffer_sRGB\n#define GLX_ARB_framebuffer_sRGB 1\n\n#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2\n\n#define GLXEW_ARB_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_ARB_framebuffer_sRGB)\n\n#endif /* GLX_ARB_framebuffer_sRGB */\n\n/* ------------------------ GLX_ARB_get_proc_address ----------------------- */\n\n#ifndef GLX_ARB_get_proc_address\n#define GLX_ARB_get_proc_address 1\n\nextern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void);\n\n#define GLXEW_ARB_get_proc_address GLXEW_GET_VAR(__GLXEW_ARB_get_proc_address)\n\n#endif /* GLX_ARB_get_proc_address */\n\n/* -------------------------- GLX_ARB_multisample -------------------------- */\n\n#ifndef GLX_ARB_multisample\n#define GLX_ARB_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_ARB 100000\n#define GLX_SAMPLES_ARB 100001\n\n#define GLXEW_ARB_multisample GLXEW_GET_VAR(__GLXEW_ARB_multisample)\n\n#endif /* GLX_ARB_multisample */\n\n/* ---------------- GLX_ARB_robustness_application_isolation --------------- */\n\n#ifndef GLX_ARB_robustness_application_isolation\n#define GLX_ARB_robustness_application_isolation 1\n\n#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n\n#define GLXEW_ARB_robustness_application_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_application_isolation)\n\n#endif /* GLX_ARB_robustness_application_isolation */\n\n/* ---------------- GLX_ARB_robustness_share_group_isolation --------------- */\n\n#ifndef GLX_ARB_robustness_share_group_isolation\n#define GLX_ARB_robustness_share_group_isolation 1\n\n#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n\n#define GLXEW_ARB_robustness_share_group_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_share_group_isolation)\n\n#endif /* GLX_ARB_robustness_share_group_isolation */\n\n/* ---------------------- GLX_ARB_vertex_buffer_object --------------------- */\n\n#ifndef GLX_ARB_vertex_buffer_object\n#define GLX_ARB_vertex_buffer_object 1\n\n#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095\n\n#define GLXEW_ARB_vertex_buffer_object GLXEW_GET_VAR(__GLXEW_ARB_vertex_buffer_object)\n\n#endif /* GLX_ARB_vertex_buffer_object */\n\n/* ----------------------- GLX_ATI_pixel_format_float ---------------------- */\n\n#ifndef GLX_ATI_pixel_format_float\n#define GLX_ATI_pixel_format_float 1\n\n#define GLX_RGBA_FLOAT_ATI_BIT 0x00000100\n\n#define GLXEW_ATI_pixel_format_float GLXEW_GET_VAR(__GLXEW_ATI_pixel_format_float)\n\n#endif /* GLX_ATI_pixel_format_float */\n\n/* ------------------------- GLX_ATI_render_texture ------------------------ */\n\n#ifndef GLX_ATI_render_texture\n#define GLX_ATI_render_texture 1\n\n#define GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800\n#define GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801\n#define GLX_TEXTURE_FORMAT_ATI 0x9802\n#define GLX_TEXTURE_TARGET_ATI 0x9803\n#define GLX_MIPMAP_TEXTURE_ATI 0x9804\n#define GLX_TEXTURE_RGB_ATI 0x9805\n#define GLX_TEXTURE_RGBA_ATI 0x9806\n#define GLX_NO_TEXTURE_ATI 0x9807\n#define GLX_TEXTURE_CUBE_MAP_ATI 0x9808\n#define GLX_TEXTURE_1D_ATI 0x9809\n#define GLX_TEXTURE_2D_ATI 0x980A\n#define GLX_MIPMAP_LEVEL_ATI 0x980B\n#define GLX_CUBE_MAP_FACE_ATI 0x980C\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812\n#define GLX_FRONT_LEFT_ATI 0x9813\n#define GLX_FRONT_RIGHT_ATI 0x9814\n#define GLX_BACK_LEFT_ATI 0x9815\n#define GLX_BACK_RIGHT_ATI 0x9816\n#define GLX_AUX0_ATI 0x9817\n#define GLX_AUX1_ATI 0x9818\n#define GLX_AUX2_ATI 0x9819\n#define GLX_AUX3_ATI 0x981A\n#define GLX_AUX4_ATI 0x981B\n#define GLX_AUX5_ATI 0x981C\n#define GLX_AUX6_ATI 0x981D\n#define GLX_AUX7_ATI 0x981E\n#define GLX_AUX8_ATI 0x981F\n#define GLX_AUX9_ATI 0x9820\n#define GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821\n#define GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822\n\ntypedef void ( * PFNGLXBINDTEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);\ntypedef void ( * PFNGLXDRAWABLEATTRIBATIPROC) (Display *dpy, GLXDrawable draw, const int *attrib_list);\ntypedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);\n\n#define glXBindTexImageATI GLXEW_GET_FUN(__glewXBindTexImageATI)\n#define glXDrawableAttribATI GLXEW_GET_FUN(__glewXDrawableAttribATI)\n#define glXReleaseTexImageATI GLXEW_GET_FUN(__glewXReleaseTexImageATI)\n\n#define GLXEW_ATI_render_texture GLXEW_GET_VAR(__GLXEW_ATI_render_texture)\n\n#endif /* GLX_ATI_render_texture */\n\n/* ------------------- GLX_EXT_create_context_es2_profile ------------------ */\n\n#ifndef GLX_EXT_create_context_es2_profile\n#define GLX_EXT_create_context_es2_profile 1\n\n#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n\n#define GLXEW_EXT_create_context_es2_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es2_profile)\n\n#endif /* GLX_EXT_create_context_es2_profile */\n\n/* ------------------- GLX_EXT_create_context_es_profile ------------------- */\n\n#ifndef GLX_EXT_create_context_es_profile\n#define GLX_EXT_create_context_es_profile 1\n\n#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n\n#define GLXEW_EXT_create_context_es_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es_profile)\n\n#endif /* GLX_EXT_create_context_es_profile */\n\n/* --------------------- GLX_EXT_fbconfig_packed_float --------------------- */\n\n#ifndef GLX_EXT_fbconfig_packed_float\n#define GLX_EXT_fbconfig_packed_float 1\n\n#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008\n#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1\n\n#define GLXEW_EXT_fbconfig_packed_float GLXEW_GET_VAR(__GLXEW_EXT_fbconfig_packed_float)\n\n#endif /* GLX_EXT_fbconfig_packed_float */\n\n/* ------------------------ GLX_EXT_framebuffer_sRGB ----------------------- */\n\n#ifndef GLX_EXT_framebuffer_sRGB\n#define GLX_EXT_framebuffer_sRGB 1\n\n#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2\n\n#define GLXEW_EXT_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_EXT_framebuffer_sRGB)\n\n#endif /* GLX_EXT_framebuffer_sRGB */\n\n/* ------------------------- GLX_EXT_import_context ------------------------ */\n\n#ifndef GLX_EXT_import_context\n#define GLX_EXT_import_context 1\n\n#define GLX_SHARE_CONTEXT_EXT 0x800A\n#define GLX_VISUAL_ID_EXT 0x800B\n#define GLX_SCREEN_EXT 0x800C\n\ntypedef XID GLXContextID;\n\ntypedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context);\ntypedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);\ntypedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID);\ntypedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value);\n\n#define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT)\n#define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT)\n#define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT)\n#define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT)\n\n#define GLXEW_EXT_import_context GLXEW_GET_VAR(__GLXEW_EXT_import_context)\n\n#endif /* GLX_EXT_import_context */\n\n/* -------------------------- GLX_EXT_scene_marker ------------------------- */\n\n#ifndef GLX_EXT_scene_marker\n#define GLX_EXT_scene_marker 1\n\n#define GLXEW_EXT_scene_marker GLXEW_GET_VAR(__GLXEW_EXT_scene_marker)\n\n#endif /* GLX_EXT_scene_marker */\n\n/* -------------------------- GLX_EXT_swap_control ------------------------- */\n\n#ifndef GLX_EXT_swap_control\n#define GLX_EXT_swap_control 1\n\n#define GLX_SWAP_INTERVAL_EXT 0x20F1\n#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2\n\ntypedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, int interval);\n\n#define glXSwapIntervalEXT GLXEW_GET_FUN(__glewXSwapIntervalEXT)\n\n#define GLXEW_EXT_swap_control GLXEW_GET_VAR(__GLXEW_EXT_swap_control)\n\n#endif /* GLX_EXT_swap_control */\n\n/* ----------------------- GLX_EXT_swap_control_tear ----------------------- */\n\n#ifndef GLX_EXT_swap_control_tear\n#define GLX_EXT_swap_control_tear 1\n\n#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3\n\n#define GLXEW_EXT_swap_control_tear GLXEW_GET_VAR(__GLXEW_EXT_swap_control_tear)\n\n#endif /* GLX_EXT_swap_control_tear */\n\n/* ---------------------- GLX_EXT_texture_from_pixmap ---------------------- */\n\n#ifndef GLX_EXT_texture_from_pixmap\n#define GLX_EXT_texture_from_pixmap 1\n\n#define GLX_TEXTURE_1D_BIT_EXT 0x00000001\n#define GLX_TEXTURE_2D_BIT_EXT 0x00000002\n#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004\n#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0\n#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1\n#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2\n#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3\n#define GLX_Y_INVERTED_EXT 0x20D4\n#define GLX_TEXTURE_FORMAT_EXT 0x20D5\n#define GLX_TEXTURE_TARGET_EXT 0x20D6\n#define GLX_MIPMAP_TEXTURE_EXT 0x20D7\n#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8\n#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9\n#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA\n#define GLX_TEXTURE_1D_EXT 0x20DB\n#define GLX_TEXTURE_2D_EXT 0x20DC\n#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD\n#define GLX_FRONT_LEFT_EXT 0x20DE\n#define GLX_FRONT_RIGHT_EXT 0x20DF\n#define GLX_BACK_LEFT_EXT 0x20E0\n#define GLX_BACK_RIGHT_EXT 0x20E1\n#define GLX_AUX0_EXT 0x20E2\n#define GLX_AUX1_EXT 0x20E3\n#define GLX_AUX2_EXT 0x20E4\n#define GLX_AUX3_EXT 0x20E5\n#define GLX_AUX4_EXT 0x20E6\n#define GLX_AUX5_EXT 0x20E7\n#define GLX_AUX6_EXT 0x20E8\n#define GLX_AUX7_EXT 0x20E9\n#define GLX_AUX8_EXT 0x20EA\n#define GLX_AUX9_EXT 0x20EB\n\ntypedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer, const int *attrib_list);\ntypedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer);\n\n#define glXBindTexImageEXT GLXEW_GET_FUN(__glewXBindTexImageEXT)\n#define glXReleaseTexImageEXT GLXEW_GET_FUN(__glewXReleaseTexImageEXT)\n\n#define GLXEW_EXT_texture_from_pixmap GLXEW_GET_VAR(__GLXEW_EXT_texture_from_pixmap)\n\n#endif /* GLX_EXT_texture_from_pixmap */\n\n/* -------------------------- GLX_EXT_visual_info -------------------------- */\n\n#ifndef GLX_EXT_visual_info\n#define GLX_EXT_visual_info 1\n\n#define GLX_X_VISUAL_TYPE_EXT 0x22\n#define GLX_TRANSPARENT_TYPE_EXT 0x23\n#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24\n#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25\n#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26\n#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27\n#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28\n#define GLX_NONE_EXT 0x8000\n#define GLX_TRUE_COLOR_EXT 0x8002\n#define GLX_DIRECT_COLOR_EXT 0x8003\n#define GLX_PSEUDO_COLOR_EXT 0x8004\n#define GLX_STATIC_COLOR_EXT 0x8005\n#define GLX_GRAY_SCALE_EXT 0x8006\n#define GLX_STATIC_GRAY_EXT 0x8007\n#define GLX_TRANSPARENT_RGB_EXT 0x8008\n#define GLX_TRANSPARENT_INDEX_EXT 0x8009\n\n#define GLXEW_EXT_visual_info GLXEW_GET_VAR(__GLXEW_EXT_visual_info)\n\n#endif /* GLX_EXT_visual_info */\n\n/* ------------------------- GLX_EXT_visual_rating ------------------------- */\n\n#ifndef GLX_EXT_visual_rating\n#define GLX_EXT_visual_rating 1\n\n#define GLX_VISUAL_CAVEAT_EXT 0x20\n#define GLX_SLOW_VISUAL_EXT 0x8001\n#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D\n\n#define GLXEW_EXT_visual_rating GLXEW_GET_VAR(__GLXEW_EXT_visual_rating)\n\n#endif /* GLX_EXT_visual_rating */\n\n/* -------------------------- GLX_INTEL_swap_event ------------------------- */\n\n#ifndef GLX_INTEL_swap_event\n#define GLX_INTEL_swap_event 1\n\n#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180\n#define GLX_COPY_COMPLETE_INTEL 0x8181\n#define GLX_FLIP_COMPLETE_INTEL 0x8182\n#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000\n\n#define GLXEW_INTEL_swap_event GLXEW_GET_VAR(__GLXEW_INTEL_swap_event)\n\n#endif /* GLX_INTEL_swap_event */\n\n/* -------------------------- GLX_MESA_agp_offset -------------------------- */\n\n#ifndef GLX_MESA_agp_offset\n#define GLX_MESA_agp_offset 1\n\ntypedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void* pointer);\n\n#define glXGetAGPOffsetMESA GLXEW_GET_FUN(__glewXGetAGPOffsetMESA)\n\n#define GLXEW_MESA_agp_offset GLXEW_GET_VAR(__GLXEW_MESA_agp_offset)\n\n#endif /* GLX_MESA_agp_offset */\n\n/* ------------------------ GLX_MESA_copy_sub_buffer ----------------------- */\n\n#ifndef GLX_MESA_copy_sub_buffer\n#define GLX_MESA_copy_sub_buffer 1\n\ntypedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawable, int x, int y, int width, int height);\n\n#define glXCopySubBufferMESA GLXEW_GET_FUN(__glewXCopySubBufferMESA)\n\n#define GLXEW_MESA_copy_sub_buffer GLXEW_GET_VAR(__GLXEW_MESA_copy_sub_buffer)\n\n#endif /* GLX_MESA_copy_sub_buffer */\n\n/* ------------------------ GLX_MESA_pixmap_colormap ----------------------- */\n\n#ifndef GLX_MESA_pixmap_colormap\n#define GLX_MESA_pixmap_colormap 1\n\ntypedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);\n\n#define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA)\n\n#define GLXEW_MESA_pixmap_colormap GLXEW_GET_VAR(__GLXEW_MESA_pixmap_colormap)\n\n#endif /* GLX_MESA_pixmap_colormap */\n\n/* ------------------------ GLX_MESA_release_buffers ----------------------- */\n\n#ifndef GLX_MESA_release_buffers\n#define GLX_MESA_release_buffers 1\n\ntypedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d);\n\n#define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA)\n\n#define GLXEW_MESA_release_buffers GLXEW_GET_VAR(__GLXEW_MESA_release_buffers)\n\n#endif /* GLX_MESA_release_buffers */\n\n/* ------------------------- GLX_MESA_set_3dfx_mode ------------------------ */\n\n#ifndef GLX_MESA_set_3dfx_mode\n#define GLX_MESA_set_3dfx_mode 1\n\n#define GLX_3DFX_WINDOW_MODE_MESA 0x1\n#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2\n\ntypedef GLboolean ( * PFNGLXSET3DFXMODEMESAPROC) (GLint mode);\n\n#define glXSet3DfxModeMESA GLXEW_GET_FUN(__glewXSet3DfxModeMESA)\n\n#define GLXEW_MESA_set_3dfx_mode GLXEW_GET_VAR(__GLXEW_MESA_set_3dfx_mode)\n\n#endif /* GLX_MESA_set_3dfx_mode */\n\n/* ------------------------- GLX_MESA_swap_control ------------------------- */\n\n#ifndef GLX_MESA_swap_control\n#define GLX_MESA_swap_control 1\n\ntypedef int ( * PFNGLXGETSWAPINTERVALMESAPROC) (void);\ntypedef int ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval);\n\n#define glXGetSwapIntervalMESA GLXEW_GET_FUN(__glewXGetSwapIntervalMESA)\n#define glXSwapIntervalMESA GLXEW_GET_FUN(__glewXSwapIntervalMESA)\n\n#define GLXEW_MESA_swap_control GLXEW_GET_VAR(__GLXEW_MESA_swap_control)\n\n#endif /* GLX_MESA_swap_control */\n\n/* --------------------------- GLX_NV_copy_image --------------------------- */\n\n#ifndef GLX_NV_copy_image\n#define GLX_NV_copy_image 1\n\ntypedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n\n#define glXCopyImageSubDataNV GLXEW_GET_FUN(__glewXCopyImageSubDataNV)\n\n#define GLXEW_NV_copy_image GLXEW_GET_VAR(__GLXEW_NV_copy_image)\n\n#endif /* GLX_NV_copy_image */\n\n/* -------------------------- GLX_NV_float_buffer -------------------------- */\n\n#ifndef GLX_NV_float_buffer\n#define GLX_NV_float_buffer 1\n\n#define GLX_FLOAT_COMPONENTS_NV 0x20B0\n\n#define GLXEW_NV_float_buffer GLXEW_GET_VAR(__GLXEW_NV_float_buffer)\n\n#endif /* GLX_NV_float_buffer */\n\n/* ---------------------- GLX_NV_multisample_coverage ---------------------- */\n\n#ifndef GLX_NV_multisample_coverage\n#define GLX_NV_multisample_coverage 1\n\n#define GLX_COLOR_SAMPLES_NV 0x20B3\n#define GLX_COVERAGE_SAMPLES_NV 100001\n\n#define GLXEW_NV_multisample_coverage GLXEW_GET_VAR(__GLXEW_NV_multisample_coverage)\n\n#endif /* GLX_NV_multisample_coverage */\n\n/* -------------------------- GLX_NV_present_video ------------------------- */\n\n#ifndef GLX_NV_present_video\n#define GLX_NV_present_video 1\n\n#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0\n\ntypedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);\ntypedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);\n\n#define glXBindVideoDeviceNV GLXEW_GET_FUN(__glewXBindVideoDeviceNV)\n#define glXEnumerateVideoDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoDevicesNV)\n\n#define GLXEW_NV_present_video GLXEW_GET_VAR(__GLXEW_NV_present_video)\n\n#endif /* GLX_NV_present_video */\n\n/* --------------------------- GLX_NV_swap_group --------------------------- */\n\n#ifndef GLX_NV_swap_group\n#define GLX_NV_swap_group 1\n\ntypedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display* dpy, GLuint group, GLuint barrier);\ntypedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint group);\ntypedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint *count);\ntypedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);\ntypedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);\ntypedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display* dpy, int screen);\n\n#define glXBindSwapBarrierNV GLXEW_GET_FUN(__glewXBindSwapBarrierNV)\n#define glXJoinSwapGroupNV GLXEW_GET_FUN(__glewXJoinSwapGroupNV)\n#define glXQueryFrameCountNV GLXEW_GET_FUN(__glewXQueryFrameCountNV)\n#define glXQueryMaxSwapGroupsNV GLXEW_GET_FUN(__glewXQueryMaxSwapGroupsNV)\n#define glXQuerySwapGroupNV GLXEW_GET_FUN(__glewXQuerySwapGroupNV)\n#define glXResetFrameCountNV GLXEW_GET_FUN(__glewXResetFrameCountNV)\n\n#define GLXEW_NV_swap_group GLXEW_GET_VAR(__GLXEW_NV_swap_group)\n\n#endif /* GLX_NV_swap_group */\n\n/* ----------------------- GLX_NV_vertex_array_range ----------------------- */\n\n#ifndef GLX_NV_vertex_array_range\n#define GLX_NV_vertex_array_range 1\n\ntypedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);\ntypedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer);\n\n#define glXAllocateMemoryNV GLXEW_GET_FUN(__glewXAllocateMemoryNV)\n#define glXFreeMemoryNV GLXEW_GET_FUN(__glewXFreeMemoryNV)\n\n#define GLXEW_NV_vertex_array_range GLXEW_GET_VAR(__GLXEW_NV_vertex_array_range)\n\n#endif /* GLX_NV_vertex_array_range */\n\n/* -------------------------- GLX_NV_video_capture ------------------------- */\n\n#ifndef GLX_NV_video_capture\n#define GLX_NV_video_capture 1\n\n#define GLX_DEVICE_ID_NV 0x20CD\n#define GLX_UNIQUE_ID_NV 0x20CE\n#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\ntypedef XID GLXVideoCaptureDeviceNV;\n\ntypedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);\ntypedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements);\ntypedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);\ntypedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);\ntypedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);\n\n#define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV)\n#define glXEnumerateVideoCaptureDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoCaptureDevicesNV)\n#define glXLockVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXLockVideoCaptureDeviceNV)\n#define glXQueryVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXQueryVideoCaptureDeviceNV)\n#define glXReleaseVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoCaptureDeviceNV)\n\n#define GLXEW_NV_video_capture GLXEW_GET_VAR(__GLXEW_NV_video_capture)\n\n#endif /* GLX_NV_video_capture */\n\n/* ---------------------------- GLX_NV_video_out --------------------------- */\n\n#ifndef GLX_NV_video_out\n#define GLX_NV_video_out 1\n\n#define GLX_VIDEO_OUT_COLOR_NV 0x20C3\n#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4\n#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5\n#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define GLX_VIDEO_OUT_FRAME_NV 0x20C8\n#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9\n#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA\n#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB\n#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC\n\ntypedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display* dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);\ntypedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);\ntypedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\ntypedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice);\ntypedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display* dpy, GLXPbuffer pbuf);\ntypedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);\n\n#define glXBindVideoImageNV GLXEW_GET_FUN(__glewXBindVideoImageNV)\n#define glXGetVideoDeviceNV GLXEW_GET_FUN(__glewXGetVideoDeviceNV)\n#define glXGetVideoInfoNV GLXEW_GET_FUN(__glewXGetVideoInfoNV)\n#define glXReleaseVideoDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoDeviceNV)\n#define glXReleaseVideoImageNV GLXEW_GET_FUN(__glewXReleaseVideoImageNV)\n#define glXSendPbufferToVideoNV GLXEW_GET_FUN(__glewXSendPbufferToVideoNV)\n\n#define GLXEW_NV_video_out GLXEW_GET_VAR(__GLXEW_NV_video_out)\n\n#endif /* GLX_NV_video_out */\n\n/* -------------------------- GLX_OML_swap_method -------------------------- */\n\n#ifndef GLX_OML_swap_method\n#define GLX_OML_swap_method 1\n\n#define GLX_SWAP_METHOD_OML 0x8060\n#define GLX_SWAP_EXCHANGE_OML 0x8061\n#define GLX_SWAP_COPY_OML 0x8062\n#define GLX_SWAP_UNDEFINED_OML 0x8063\n\n#define GLXEW_OML_swap_method GLXEW_GET_VAR(__GLXEW_OML_swap_method)\n\n#endif /* GLX_OML_swap_method */\n\n/* -------------------------- GLX_OML_sync_control ------------------------- */\n\n#ifndef GLX_OML_sync_control\n#define GLX_OML_sync_control 1\n\ntypedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator);\ntypedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc);\ntypedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);\ntypedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc);\ntypedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_sbc, int64_t* ust, int64_t* msc, int64_t* sbc);\n\n#define glXGetMscRateOML GLXEW_GET_FUN(__glewXGetMscRateOML)\n#define glXGetSyncValuesOML GLXEW_GET_FUN(__glewXGetSyncValuesOML)\n#define glXSwapBuffersMscOML GLXEW_GET_FUN(__glewXSwapBuffersMscOML)\n#define glXWaitForMscOML GLXEW_GET_FUN(__glewXWaitForMscOML)\n#define glXWaitForSbcOML GLXEW_GET_FUN(__glewXWaitForSbcOML)\n\n#define GLXEW_OML_sync_control GLXEW_GET_VAR(__GLXEW_OML_sync_control)\n\n#endif /* GLX_OML_sync_control */\n\n/* ------------------------ GLX_SGIS_blended_overlay ----------------------- */\n\n#ifndef GLX_SGIS_blended_overlay\n#define GLX_SGIS_blended_overlay 1\n\n#define GLX_BLENDED_RGBA_SGIS 0x8025\n\n#define GLXEW_SGIS_blended_overlay GLXEW_GET_VAR(__GLXEW_SGIS_blended_overlay)\n\n#endif /* GLX_SGIS_blended_overlay */\n\n/* -------------------------- GLX_SGIS_color_range ------------------------- */\n\n#ifndef GLX_SGIS_color_range\n#define GLX_SGIS_color_range 1\n\n#define GLX_MIN_RED_SGIS 0\n#define GLX_MAX_GREEN_SGIS 0\n#define GLX_MIN_BLUE_SGIS 0\n#define GLX_MAX_ALPHA_SGIS 0\n#define GLX_MIN_GREEN_SGIS 0\n#define GLX_MIN_ALPHA_SGIS 0\n#define GLX_MAX_RED_SGIS 0\n#define GLX_EXTENDED_RANGE_SGIS 0\n#define GLX_MAX_BLUE_SGIS 0\n\n#define GLXEW_SGIS_color_range GLXEW_GET_VAR(__GLXEW_SGIS_color_range)\n\n#endif /* GLX_SGIS_color_range */\n\n/* -------------------------- GLX_SGIS_multisample ------------------------- */\n\n#ifndef GLX_SGIS_multisample\n#define GLX_SGIS_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_SGIS 100000\n#define GLX_SAMPLES_SGIS 100001\n\n#define GLXEW_SGIS_multisample GLXEW_GET_VAR(__GLXEW_SGIS_multisample)\n\n#endif /* GLX_SGIS_multisample */\n\n/* ---------------------- GLX_SGIS_shared_multisample ---------------------- */\n\n#ifndef GLX_SGIS_shared_multisample\n#define GLX_SGIS_shared_multisample 1\n\n#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026\n#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027\n\n#define GLXEW_SGIS_shared_multisample GLXEW_GET_VAR(__GLXEW_SGIS_shared_multisample)\n\n#endif /* GLX_SGIS_shared_multisample */\n\n/* --------------------------- GLX_SGIX_fbconfig --------------------------- */\n\n#ifndef GLX_SGIX_fbconfig\n#define GLX_SGIX_fbconfig 1\n\n#define GLX_WINDOW_BIT_SGIX 0x00000001\n#define GLX_RGBA_BIT_SGIX 0x00000001\n#define GLX_PIXMAP_BIT_SGIX 0x00000002\n#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002\n#define GLX_SCREEN_EXT 0x800C\n#define GLX_DRAWABLE_TYPE_SGIX 0x8010\n#define GLX_RENDER_TYPE_SGIX 0x8011\n#define GLX_X_RENDERABLE_SGIX 0x8012\n#define GLX_FBCONFIG_ID_SGIX 0x8013\n#define GLX_RGBA_TYPE_SGIX 0x8014\n#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015\n\ntypedef XID GLXFBConfigIDSGIX;\ntypedef struct __GLXFBConfigRec *GLXFBConfigSGIX;\n\ntypedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);\ntypedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);\ntypedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap);\ntypedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value);\ntypedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis);\ntypedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config);\n\n#define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX)\n#define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX)\n#define glXCreateGLXPixmapWithConfigSGIX GLXEW_GET_FUN(__glewXCreateGLXPixmapWithConfigSGIX)\n#define glXGetFBConfigAttribSGIX GLXEW_GET_FUN(__glewXGetFBConfigAttribSGIX)\n#define glXGetFBConfigFromVisualSGIX GLXEW_GET_FUN(__glewXGetFBConfigFromVisualSGIX)\n#define glXGetVisualFromFBConfigSGIX GLXEW_GET_FUN(__glewXGetVisualFromFBConfigSGIX)\n\n#define GLXEW_SGIX_fbconfig GLXEW_GET_VAR(__GLXEW_SGIX_fbconfig)\n\n#endif /* GLX_SGIX_fbconfig */\n\n/* --------------------------- GLX_SGIX_hyperpipe -------------------------- */\n\n#ifndef GLX_SGIX_hyperpipe\n#define GLX_SGIX_hyperpipe 1\n\n#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001\n#define GLX_PIPE_RECT_SGIX 0x00000001\n#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002\n#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002\n#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003\n#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004\n#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80\n#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91\n#define GLX_BAD_HYPERPIPE_SGIX 92\n#define GLX_HYPERPIPE_ID_SGIX 0x8030\n\ntypedef struct {\n char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n int networkId; \n} GLXHyperpipeNetworkSGIX;\ntypedef struct {\n char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n int XOrigin; \n int YOrigin; \n int maxHeight; \n int maxWidth; \n} GLXPipeRectLimits;\ntypedef struct {\n char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n int channel; \n unsigned int participationType; \n int timeSlice; \n} GLXHyperpipeConfigSGIX;\ntypedef struct {\n char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n int srcXOrigin; \n int srcYOrigin; \n int srcWidth; \n int srcHeight; \n int destXOrigin; \n int destYOrigin; \n int destWidth; \n int destHeight; \n} GLXPipeRect;\n\ntypedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);\ntypedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);\ntypedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);\ntypedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);\ntypedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);\ntypedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);\ntypedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);\ntypedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);\n\n#define glXBindHyperpipeSGIX GLXEW_GET_FUN(__glewXBindHyperpipeSGIX)\n#define glXDestroyHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXDestroyHyperpipeConfigSGIX)\n#define glXHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXHyperpipeAttribSGIX)\n#define glXHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXHyperpipeConfigSGIX)\n#define glXQueryHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeAttribSGIX)\n#define glXQueryHyperpipeBestAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeBestAttribSGIX)\n#define glXQueryHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeConfigSGIX)\n#define glXQueryHyperpipeNetworkSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeNetworkSGIX)\n\n#define GLXEW_SGIX_hyperpipe GLXEW_GET_VAR(__GLXEW_SGIX_hyperpipe)\n\n#endif /* GLX_SGIX_hyperpipe */\n\n/* ---------------------------- GLX_SGIX_pbuffer --------------------------- */\n\n#ifndef GLX_SGIX_pbuffer\n#define GLX_SGIX_pbuffer 1\n\n#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001\n#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002\n#define GLX_PBUFFER_BIT_SGIX 0x00000004\n#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004\n#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008\n#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010\n#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020\n#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040\n#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080\n#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100\n#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016\n#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017\n#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018\n#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019\n#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A\n#define GLX_PRESERVED_CONTENTS_SGIX 0x801B\n#define GLX_LARGEST_PBUFFER_SGIX 0x801C\n#define GLX_WIDTH_SGIX 0x801D\n#define GLX_HEIGHT_SGIX 0x801E\n#define GLX_EVENT_MASK_SGIX 0x801F\n#define GLX_DAMAGED_SGIX 0x8020\n#define GLX_SAVED_SGIX 0x8021\n#define GLX_WINDOW_SGIX 0x8022\n#define GLX_PBUFFER_SGIX 0x8023\n#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000\n\ntypedef XID GLXPbufferSGIX;\ntypedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX;\n\ntypedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list);\ntypedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf);\ntypedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask);\ntypedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value);\ntypedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask);\n\n#define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX)\n#define glXDestroyGLXPbufferSGIX GLXEW_GET_FUN(__glewXDestroyGLXPbufferSGIX)\n#define glXGetSelectedEventSGIX GLXEW_GET_FUN(__glewXGetSelectedEventSGIX)\n#define glXQueryGLXPbufferSGIX GLXEW_GET_FUN(__glewXQueryGLXPbufferSGIX)\n#define glXSelectEventSGIX GLXEW_GET_FUN(__glewXSelectEventSGIX)\n\n#define GLXEW_SGIX_pbuffer GLXEW_GET_VAR(__GLXEW_SGIX_pbuffer)\n\n#endif /* GLX_SGIX_pbuffer */\n\n/* ------------------------- GLX_SGIX_swap_barrier ------------------------- */\n\n#ifndef GLX_SGIX_swap_barrier\n#define GLX_SGIX_swap_barrier 1\n\ntypedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);\ntypedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);\n\n#define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX)\n#define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX)\n\n#define GLXEW_SGIX_swap_barrier GLXEW_GET_VAR(__GLXEW_SGIX_swap_barrier)\n\n#endif /* GLX_SGIX_swap_barrier */\n\n/* -------------------------- GLX_SGIX_swap_group -------------------------- */\n\n#ifndef GLX_SGIX_swap_group\n#define GLX_SGIX_swap_group 1\n\ntypedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);\n\n#define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX)\n\n#define GLXEW_SGIX_swap_group GLXEW_GET_VAR(__GLXEW_SGIX_swap_group)\n\n#endif /* GLX_SGIX_swap_group */\n\n/* ------------------------- GLX_SGIX_video_resize ------------------------- */\n\n#ifndef GLX_SGIX_video_resize\n#define GLX_SGIX_video_resize 1\n\n#define GLX_SYNC_FRAME_SGIX 0x00000000\n#define GLX_SYNC_SWAP_SGIX 0x00000001\n\ntypedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window);\ntypedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h);\ntypedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype);\ntypedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h);\ntypedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);\n\n#define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX)\n#define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX)\n#define glXChannelRectSyncSGIX GLXEW_GET_FUN(__glewXChannelRectSyncSGIX)\n#define glXQueryChannelDeltasSGIX GLXEW_GET_FUN(__glewXQueryChannelDeltasSGIX)\n#define glXQueryChannelRectSGIX GLXEW_GET_FUN(__glewXQueryChannelRectSGIX)\n\n#define GLXEW_SGIX_video_resize GLXEW_GET_VAR(__GLXEW_SGIX_video_resize)\n\n#endif /* GLX_SGIX_video_resize */\n\n/* ---------------------- GLX_SGIX_visual_select_group --------------------- */\n\n#ifndef GLX_SGIX_visual_select_group\n#define GLX_SGIX_visual_select_group 1\n\n#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028\n\n#define GLXEW_SGIX_visual_select_group GLXEW_GET_VAR(__GLXEW_SGIX_visual_select_group)\n\n#endif /* GLX_SGIX_visual_select_group */\n\n/* ---------------------------- GLX_SGI_cushion ---------------------------- */\n\n#ifndef GLX_SGI_cushion\n#define GLX_SGI_cushion 1\n\ntypedef void ( * PFNGLXCUSHIONSGIPROC) (Display* dpy, Window window, float cushion);\n\n#define glXCushionSGI GLXEW_GET_FUN(__glewXCushionSGI)\n\n#define GLXEW_SGI_cushion GLXEW_GET_VAR(__GLXEW_SGI_cushion)\n\n#endif /* GLX_SGI_cushion */\n\n/* ----------------------- GLX_SGI_make_current_read ----------------------- */\n\n#ifndef GLX_SGI_make_current_read\n#define GLX_SGI_make_current_read 1\n\ntypedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);\ntypedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);\n\n#define glXGetCurrentReadDrawableSGI GLXEW_GET_FUN(__glewXGetCurrentReadDrawableSGI)\n#define glXMakeCurrentReadSGI GLXEW_GET_FUN(__glewXMakeCurrentReadSGI)\n\n#define GLXEW_SGI_make_current_read GLXEW_GET_VAR(__GLXEW_SGI_make_current_read)\n\n#endif /* GLX_SGI_make_current_read */\n\n/* -------------------------- GLX_SGI_swap_control ------------------------- */\n\n#ifndef GLX_SGI_swap_control\n#define GLX_SGI_swap_control 1\n\ntypedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);\n\n#define glXSwapIntervalSGI GLXEW_GET_FUN(__glewXSwapIntervalSGI)\n\n#define GLXEW_SGI_swap_control GLXEW_GET_VAR(__GLXEW_SGI_swap_control)\n\n#endif /* GLX_SGI_swap_control */\n\n/* --------------------------- GLX_SGI_video_sync -------------------------- */\n\n#ifndef GLX_SGI_video_sync\n#define GLX_SGI_video_sync 1\n\ntypedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int* count);\ntypedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int* count);\n\n#define glXGetVideoSyncSGI GLXEW_GET_FUN(__glewXGetVideoSyncSGI)\n#define glXWaitVideoSyncSGI GLXEW_GET_FUN(__glewXWaitVideoSyncSGI)\n\n#define GLXEW_SGI_video_sync GLXEW_GET_VAR(__GLXEW_SGI_video_sync)\n\n#endif /* GLX_SGI_video_sync */\n\n/* --------------------- GLX_SUN_get_transparent_index --------------------- */\n\n#ifndef GLX_SUN_get_transparent_index\n#define GLX_SUN_get_transparent_index 1\n\ntypedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex);\n\n#define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN)\n\n#define GLXEW_SUN_get_transparent_index GLXEW_GET_VAR(__GLXEW_SUN_get_transparent_index)\n\n#endif /* GLX_SUN_get_transparent_index */\n\n/* -------------------------- GLX_SUN_video_resize ------------------------- */\n\n#ifndef GLX_SUN_video_resize\n#define GLX_SUN_video_resize 1\n\n#define GLX_VIDEO_RESIZE_SUN 0x8171\n#define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD\n\ntypedef int ( * PFNGLXGETVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float* factor);\ntypedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float factor);\n\n#define glXGetVideoResizeSUN GLXEW_GET_FUN(__glewXGetVideoResizeSUN)\n#define glXVideoResizeSUN GLXEW_GET_FUN(__glewXVideoResizeSUN)\n\n#define GLXEW_SUN_video_resize GLXEW_GET_VAR(__GLXEW_SUN_video_resize)\n\n#endif /* GLX_SUN_video_resize */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define GLXEW_FUN_EXPORT\n#define GLXEW_VAR_EXPORT\n#else\n#define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT\n#define GLXEW_VAR_EXPORT GLEW_VAR_EXPORT\n#endif /* GLEW_MX */\n\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay;\n\nGLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig;\nGLXEW_FUN_EXPORT PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext;\nGLXEW_FUN_EXPORT PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer;\nGLXEW_FUN_EXPORT PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap;\nGLXEW_FUN_EXPORT PFNGLXCREATEWINDOWPROC __glewXCreateWindow;\nGLXEW_FUN_EXPORT PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer;\nGLXEW_FUN_EXPORT PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap;\nGLXEW_FUN_EXPORT PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow;\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs;\nGLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent;\nGLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig;\nGLXEW_FUN_EXPORT PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent;\nGLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTPROC __glewXQueryContext;\nGLXEW_FUN_EXPORT PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable;\nGLXEW_FUN_EXPORT PFNGLXSELECTEVENTPROC __glewXSelectEvent;\n\nGLXEW_FUN_EXPORT PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB;\n\nGLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI;\nGLXEW_FUN_EXPORT PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI;\nGLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI;\n\nGLXEW_FUN_EXPORT PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT;\nGLXEW_FUN_EXPORT PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT;\nGLXEW_FUN_EXPORT PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT;\nGLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT;\n\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT;\n\nGLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT;\nGLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT;\n\nGLXEW_FUN_EXPORT PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA;\n\nGLXEW_FUN_EXPORT PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA;\n\nGLXEW_FUN_EXPORT PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA;\n\nGLXEW_FUN_EXPORT PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA;\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV;\nGLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV;\nGLXEW_FUN_EXPORT PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV;\n\nGLXEW_FUN_EXPORT PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV;\nGLXEW_FUN_EXPORT PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV;\nGLXEW_FUN_EXPORT PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV;\nGLXEW_FUN_EXPORT PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV;\nGLXEW_FUN_EXPORT PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV;\n\nGLXEW_FUN_EXPORT PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML;\nGLXEW_FUN_EXPORT PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML;\nGLXEW_FUN_EXPORT PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML;\nGLXEW_FUN_EXPORT PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML;\nGLXEW_FUN_EXPORT PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML;\n\nGLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX;\nGLXEW_FUN_EXPORT PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX;\nGLXEW_FUN_EXPORT PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX;\nGLXEW_FUN_EXPORT PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXCUSHIONSGIPROC __glewXCushionSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI;\nGLXEW_FUN_EXPORT PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI;\n\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI;\nGLXEW_FUN_EXPORT PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN;\n\nGLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN;\nGLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN;\n\n#if defined(GLEW_MX)\nstruct GLXEWContextStruct\n{\n#endif /* GLEW_MX */\n\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_3;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_4;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_3DFX_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_AMD_gpu_association;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_robustness;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_fbconfig_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_framebuffer_sRGB;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_get_proc_address;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_application_isolation;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_share_group_isolation;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_vertex_buffer_object;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_pixel_format_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_render_texture;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es2_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_fbconfig_packed_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_framebuffer_sRGB;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_import_context;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control_tear;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_texture_from_pixmap;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_info;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_rating;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_INTEL_swap_event;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_agp_offset;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_copy_sub_buffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_pixmap_colormap;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_release_buffers;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_set_3dfx_mode;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_image;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_float_buffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multisample_coverage;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_present_video;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_swap_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_vertex_array_range;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_capture;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_out;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_OML_swap_method;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_OML_sync_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_blended_overlay;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_color_range;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_shared_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_fbconfig;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_hyperpipe;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_pbuffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_barrier;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_video_resize;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_visual_select_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_cushion;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_make_current_read;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_video_sync;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_get_transparent_index;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_video_resize;\n\n#ifdef GLEW_MX\n}; /* GLXEWContextStruct */\n#endif /* GLEW_MX */\n\n/* ------------------------------------------------------------------------ */\n\n#ifdef GLEW_MX\n\ntypedef struct GLXEWContextStruct GLXEWContext;\nGLEWAPI GLenum GLEWAPIENTRY glxewContextInit (GLXEWContext *ctx);\nGLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx, const char *name);\n\n#define glxewInit() glxewContextInit(glxewGetContext())\n#define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x)\n\n#define GLXEW_GET_VAR(x) (*(const GLboolean*)&(glxewGetContext()->x))\n#define GLXEW_GET_FUN(x) x\n\n#else /* GLEW_MX */\n\n#define GLXEW_GET_VAR(x) (*(const GLboolean*)&x)\n#define GLXEW_GET_FUN(x) x\n\nGLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);\n\n#endif /* GLEW_MX */\n\nGLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* __glxew_h__ */\n"}, {"path": "includes/GL/wglew.h", "language": "code", "loc": 1039, "comment_density": 0.159, "code": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits \n** Copyright (C) 2002-2008, Marcelo E. Magallon \n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n** this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n** this list of conditions and the following disclaimer in the documentation \n** and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n** derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __wglew_h__\n#define __wglew_h__\n#define __WGLEW_H__\n\n#ifdef __wglext_h_\n#error wglext.h included before wglew.h\n#endif\n\n#define __wglext_h_\n\n#if !defined(WINAPI)\n# ifndef WIN32_LEAN_AND_MEAN\n# define WIN32_LEAN_AND_MEAN 1\n# endif\n#include \n# undef WIN32_LEAN_AND_MEAN\n#endif\n\n/*\n * GLEW_STATIC needs to be set when using the static version.\n * GLEW_BUILD is set when building the DLL version.\n */\n#ifdef GLEW_STATIC\n# define GLEWAPI extern\n#else\n# ifdef GLEW_BUILD\n# define GLEWAPI extern __declspec(dllexport)\n# else\n# define GLEWAPI extern __declspec(dllimport)\n# endif\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* -------------------------- WGL_3DFX_multisample ------------------------- */\n\n#ifndef WGL_3DFX_multisample\n#define WGL_3DFX_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_3DFX 0x2060\n#define WGL_SAMPLES_3DFX 0x2061\n\n#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample)\n\n#endif /* WGL_3DFX_multisample */\n\n/* ------------------------- WGL_3DL_stereo_control ------------------------ */\n\n#ifndef WGL_3DL_stereo_control\n#define WGL_3DL_stereo_control 1\n\n#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055\n#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056\n#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057\n#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058\n\ntypedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);\n\n#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL)\n\n#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control)\n\n#endif /* WGL_3DL_stereo_control */\n\n/* ------------------------ WGL_AMD_gpu_association ------------------------ */\n\n#ifndef WGL_AMD_gpu_association\n#define WGL_AMD_gpu_association 1\n\n#define WGL_GPU_VENDOR_AMD 0x1F00\n#define WGL_GPU_RENDERER_STRING_AMD 0x1F01\n#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define WGL_GPU_RAM_AMD 0x21A3\n#define WGL_GPU_CLOCK_AMD 0x21A4\n#define WGL_GPU_NUM_PIPES_AMD 0x21A5\n#define WGL_GPU_NUM_SIMD_AMD 0x21A6\n#define WGL_GPU_NUM_RB_AMD 0x21A7\n#define WGL_GPU_NUM_SPI_AMD 0x21A8\n\ntypedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\ntypedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);\ntypedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList);\ntypedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);\ntypedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);\ntypedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);\ntypedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids);\ntypedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data);\ntypedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);\n\n#define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD)\n#define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD)\n#define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD)\n#define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD)\n#define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD)\n#define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD)\n#define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD)\n#define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD)\n#define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD)\n\n#define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association)\n\n#endif /* WGL_AMD_gpu_association */\n\n/* ------------------------- WGL_ARB_buffer_region ------------------------- */\n\n#ifndef WGL_ARB_buffer_region\n#define WGL_ARB_buffer_region 1\n\n#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001\n#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002\n#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004\n#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008\n\ntypedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);\ntypedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);\ntypedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\ntypedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);\n\n#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB)\n#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB)\n#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB)\n#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB)\n\n#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region)\n\n#endif /* WGL_ARB_buffer_region */\n\n/* ------------------------- WGL_ARB_create_context ------------------------ */\n\n#ifndef WGL_ARB_create_context\n#define WGL_ARB_create_context 1\n\n#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001\n#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002\n#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093\n#define WGL_CONTEXT_FLAGS_ARB 0x2094\n#define ERROR_INVALID_VERSION_ARB 0x2095\n#define ERROR_INVALID_PROFILE_ARB 0x2096\n\ntypedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList);\n\n#define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB)\n\n#define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context)\n\n#endif /* WGL_ARB_create_context */\n\n/* --------------------- WGL_ARB_create_context_profile -------------------- */\n\n#ifndef WGL_ARB_create_context_profile\n#define WGL_ARB_create_context_profile 1\n\n#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126\n\n#define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile)\n\n#endif /* WGL_ARB_create_context_profile */\n\n/* ------------------- WGL_ARB_create_context_robustness ------------------- */\n\n#ifndef WGL_ARB_create_context_robustness\n#define WGL_ARB_create_context_robustness 1\n\n#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261\n\n#define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness)\n\n#endif /* WGL_ARB_create_context_robustness */\n\n/* ----------------------- WGL_ARB_extensions_string ----------------------- */\n\n#ifndef WGL_ARB_extensions_string\n#define WGL_ARB_extensions_string 1\n\ntypedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);\n\n#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB)\n\n#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string)\n\n#endif /* WGL_ARB_extensions_string */\n\n/* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */\n\n#ifndef WGL_ARB_framebuffer_sRGB\n#define WGL_ARB_framebuffer_sRGB 1\n\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9\n\n#define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB)\n\n#endif /* WGL_ARB_framebuffer_sRGB */\n\n/* ----------------------- WGL_ARB_make_current_read ----------------------- */\n\n#ifndef WGL_ARB_make_current_read\n#define WGL_ARB_make_current_read 1\n\n#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043\n#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054\n\ntypedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\n#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB)\n#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB)\n\n#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read)\n\n#endif /* WGL_ARB_make_current_read */\n\n/* -------------------------- WGL_ARB_multisample -------------------------- */\n\n#ifndef WGL_ARB_multisample\n#define WGL_ARB_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_ARB 0x2041\n#define WGL_SAMPLES_ARB 0x2042\n\n#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample)\n\n#endif /* WGL_ARB_multisample */\n\n/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */\n\n#ifndef WGL_ARB_pbuffer\n#define WGL_ARB_pbuffer 1\n\n#define WGL_DRAW_TO_PBUFFER_ARB 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030\n#define WGL_PBUFFER_LARGEST_ARB 0x2033\n#define WGL_PBUFFER_WIDTH_ARB 0x2034\n#define WGL_PBUFFER_HEIGHT_ARB 0x2035\n#define WGL_PBUFFER_LOST_ARB 0x2036\n\nDECLARE_HANDLE(HPBUFFERARB);\n\ntypedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);\ntypedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);\ntypedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);\ntypedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);\ntypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);\n\n#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)\n#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)\n#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)\n#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)\n#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)\n\n#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)\n\n#endif /* WGL_ARB_pbuffer */\n\n/* -------------------------- WGL_ARB_pixel_format ------------------------- */\n\n#ifndef WGL_ARB_pixel_format\n#define WGL_ARB_pixel_format 1\n\n#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000\n#define WGL_DRAW_TO_WINDOW_ARB 0x2001\n#define WGL_DRAW_TO_BITMAP_ARB 0x2002\n#define WGL_ACCELERATION_ARB 0x2003\n#define WGL_NEED_PALETTE_ARB 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006\n#define WGL_SWAP_METHOD_ARB 0x2007\n#define WGL_NUMBER_OVERLAYS_ARB 0x2008\n#define WGL_NUMBER_UNDERLAYS_ARB 0x2009\n#define WGL_TRANSPARENT_ARB 0x200A\n#define WGL_SHARE_DEPTH_ARB 0x200C\n#define WGL_SHARE_STENCIL_ARB 0x200D\n#define WGL_SHARE_ACCUM_ARB 0x200E\n#define WGL_SUPPORT_GDI_ARB 0x200F\n#define WGL_SUPPORT_OPENGL_ARB 0x2010\n#define WGL_DOUBLE_BUFFER_ARB 0x2011\n#define WGL_STEREO_ARB 0x2012\n#define WGL_PIXEL_TYPE_ARB 0x2013\n#define WGL_COLOR_BITS_ARB 0x2014\n#define WGL_RED_BITS_ARB 0x2015\n#define WGL_RED_SHIFT_ARB 0x2016\n#define WGL_GREEN_BITS_ARB 0x2017\n#define WGL_GREEN_SHIFT_ARB 0x2018\n#define WGL_BLUE_BITS_ARB 0x2019\n#define WGL_BLUE_SHIFT_ARB 0x201A\n#define WGL_ALPHA_BITS_ARB 0x201B\n#define WGL_ALPHA_SHIFT_ARB 0x201C\n#define WGL_ACCUM_BITS_ARB 0x201D\n#define WGL_ACCUM_RED_BITS_ARB 0x201E\n#define WGL_ACCUM_GREEN_BITS_ARB 0x201F\n#define WGL_ACCUM_BLUE_BITS_ARB 0x2020\n#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021\n#define WGL_DEPTH_BITS_ARB 0x2022\n#define WGL_STENCIL_BITS_ARB 0x2023\n#define WGL_AUX_BUFFERS_ARB 0x2024\n#define WGL_NO_ACCELERATION_ARB 0x2025\n#define WGL_GENERIC_ACCELERATION_ARB 0x2026\n#define WGL_FULL_ACCELERATION_ARB 0x2027\n#define WGL_SWAP_EXCHANGE_ARB 0x2028\n#define WGL_SWAP_COPY_ARB 0x2029\n#define WGL_SWAP_UNDEFINED_ARB 0x202A\n#define WGL_TYPE_RGBA_ARB 0x202B\n#define WGL_TYPE_COLORINDEX_ARB 0x202C\n#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037\n#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038\n#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039\n#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A\n#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B\n\ntypedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues);\n\n#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB)\n#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB)\n#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB)\n\n#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format)\n\n#endif /* WGL_ARB_pixel_format */\n\n/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */\n\n#ifndef WGL_ARB_pixel_format_float\n#define WGL_ARB_pixel_format_float 1\n\n#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0\n\n#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float)\n\n#endif /* WGL_ARB_pixel_format_float */\n\n/* ------------------------- WGL_ARB_render_texture ------------------------ */\n\n#ifndef WGL_ARB_render_texture\n#define WGL_ARB_render_texture 1\n\n#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070\n#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071\n#define WGL_TEXTURE_FORMAT_ARB 0x2072\n#define WGL_TEXTURE_TARGET_ARB 0x2073\n#define WGL_MIPMAP_TEXTURE_ARB 0x2074\n#define WGL_TEXTURE_RGB_ARB 0x2075\n#define WGL_TEXTURE_RGBA_ARB 0x2076\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078\n#define WGL_TEXTURE_1D_ARB 0x2079\n#define WGL_TEXTURE_2D_ARB 0x207A\n#define WGL_MIPMAP_LEVEL_ARB 0x207B\n#define WGL_CUBE_MAP_FACE_ARB 0x207C\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082\n#define WGL_FRONT_LEFT_ARB 0x2083\n#define WGL_FRONT_RIGHT_ARB 0x2084\n#define WGL_BACK_LEFT_ARB 0x2085\n#define WGL_BACK_RIGHT_ARB 0x2086\n#define WGL_AUX0_ARB 0x2087\n#define WGL_AUX1_ARB 0x2088\n#define WGL_AUX2_ARB 0x2089\n#define WGL_AUX3_ARB 0x208A\n#define WGL_AUX4_ARB 0x208B\n#define WGL_AUX5_ARB 0x208C\n#define WGL_AUX6_ARB 0x208D\n#define WGL_AUX7_ARB 0x208E\n#define WGL_AUX8_ARB 0x208F\n#define WGL_AUX9_ARB 0x2090\n\ntypedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\ntypedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\ntypedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList);\n\n#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB)\n#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB)\n#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB)\n\n#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture)\n\n#endif /* WGL_ARB_render_texture */\n\n/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */\n\n#ifndef WGL_ATI_pixel_format_float\n#define WGL_ATI_pixel_format_float 1\n\n#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0\n#define GL_RGBA_FLOAT_MODE_ATI 0x8820\n#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835\n\n#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float)\n\n#endif /* WGL_ATI_pixel_format_float */\n\n/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */\n\n#ifndef WGL_ATI_render_texture_rectangle\n#define WGL_ATI_render_texture_rectangle 1\n\n#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5\n\n#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle)\n\n#endif /* WGL_ATI_render_texture_rectangle */\n\n/* ------------------- WGL_EXT_create_context_es2_profile ------------------ */\n\n#ifndef WGL_EXT_create_context_es2_profile\n#define WGL_EXT_create_context_es2_profile 1\n\n#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n\n#define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile)\n\n#endif /* WGL_EXT_create_context_es2_profile */\n\n/* ------------------- WGL_EXT_create_context_es_profile ------------------- */\n\n#ifndef WGL_EXT_create_context_es_profile\n#define WGL_EXT_create_context_es_profile 1\n\n#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n\n#define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile)\n\n#endif /* WGL_EXT_create_context_es_profile */\n\n/* -------------------------- WGL_EXT_depth_float -------------------------- */\n\n#ifndef WGL_EXT_depth_float\n#define WGL_EXT_depth_float 1\n\n#define WGL_DEPTH_FLOAT_EXT 0x2040\n\n#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float)\n\n#endif /* WGL_EXT_depth_float */\n\n/* ---------------------- WGL_EXT_display_color_table ---------------------- */\n\n#ifndef WGL_EXT_display_color_table\n#define WGL_EXT_display_color_table 1\n\ntypedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length);\n\n#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT)\n#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT)\n#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT)\n#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT)\n\n#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table)\n\n#endif /* WGL_EXT_display_color_table */\n\n/* ----------------------- WGL_EXT_extensions_string ----------------------- */\n\n#ifndef WGL_EXT_extensions_string\n#define WGL_EXT_extensions_string 1\n\ntypedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);\n\n#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT)\n\n#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string)\n\n#endif /* WGL_EXT_extensions_string */\n\n/* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */\n\n#ifndef WGL_EXT_framebuffer_sRGB\n#define WGL_EXT_framebuffer_sRGB 1\n\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9\n\n#define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB)\n\n#endif /* WGL_EXT_framebuffer_sRGB */\n\n/* ----------------------- WGL_EXT_make_current_read ----------------------- */\n\n#ifndef WGL_EXT_make_current_read\n#define WGL_EXT_make_current_read 1\n\n#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043\n\ntypedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\n#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT)\n#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT)\n\n#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read)\n\n#endif /* WGL_EXT_make_current_read */\n\n/* -------------------------- WGL_EXT_multisample -------------------------- */\n\n#ifndef WGL_EXT_multisample\n#define WGL_EXT_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_EXT 0x2041\n#define WGL_SAMPLES_EXT 0x2042\n\n#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample)\n\n#endif /* WGL_EXT_multisample */\n\n/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */\n\n#ifndef WGL_EXT_pbuffer\n#define WGL_EXT_pbuffer 1\n\n#define WGL_DRAW_TO_PBUFFER_EXT 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030\n#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031\n#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032\n#define WGL_PBUFFER_LARGEST_EXT 0x2033\n#define WGL_PBUFFER_WIDTH_EXT 0x2034\n#define WGL_PBUFFER_HEIGHT_EXT 0x2035\n\nDECLARE_HANDLE(HPBUFFEREXT);\n\ntypedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);\ntypedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);\ntypedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);\ntypedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue);\ntypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);\n\n#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT)\n#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT)\n#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT)\n#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT)\n#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT)\n\n#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer)\n\n#endif /* WGL_EXT_pbuffer */\n\n/* -------------------------- WGL_EXT_pixel_format ------------------------- */\n\n#ifndef WGL_EXT_pixel_format\n#define WGL_EXT_pixel_format 1\n\n#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000\n#define WGL_DRAW_TO_WINDOW_EXT 0x2001\n#define WGL_DRAW_TO_BITMAP_EXT 0x2002\n#define WGL_ACCELERATION_EXT 0x2003\n#define WGL_NEED_PALETTE_EXT 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006\n#define WGL_SWAP_METHOD_EXT 0x2007\n#define WGL_NUMBER_OVERLAYS_EXT 0x2008\n#define WGL_NUMBER_UNDERLAYS_EXT 0x2009\n#define WGL_TRANSPARENT_EXT 0x200A\n#define WGL_TRANSPARENT_VALUE_EXT 0x200B\n#define WGL_SHARE_DEPTH_EXT 0x200C\n#define WGL_SHARE_STENCIL_EXT 0x200D\n#define WGL_SHARE_ACCUM_EXT 0x200E\n#define WGL_SUPPORT_GDI_EXT 0x200F\n#define WGL_SUPPORT_OPENGL_EXT 0x2010\n#define WGL_DOUBLE_BUFFER_EXT 0x2011\n#define WGL_STEREO_EXT 0x2012\n#define WGL_PIXEL_TYPE_EXT 0x2013\n#define WGL_COLOR_BITS_EXT 0x2014\n#define WGL_RED_BITS_EXT 0x2015\n#define WGL_RED_SHIFT_EXT 0x2016\n#define WGL_GREEN_BITS_EXT 0x2017\n#define WGL_GREEN_SHIFT_EXT 0x2018\n#define WGL_BLUE_BITS_EXT 0x2019\n#define WGL_BLUE_SHIFT_EXT 0x201A\n#define WGL_ALPHA_BITS_EXT 0x201B\n#define WGL_ALPHA_SHIFT_EXT 0x201C\n#define WGL_ACCUM_BITS_EXT 0x201D\n#define WGL_ACCUM_RED_BITS_EXT 0x201E\n#define WGL_ACCUM_GREEN_BITS_EXT 0x201F\n#define WGL_ACCUM_BLUE_BITS_EXT 0x2020\n#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021\n#define WGL_DEPTH_BITS_EXT 0x2022\n#define WGL_STENCIL_BITS_EXT 0x2023\n#define WGL_AUX_BUFFERS_EXT 0x2024\n#define WGL_NO_ACCELERATION_EXT 0x2025\n#define WGL_GENERIC_ACCELERATION_EXT 0x2026\n#define WGL_FULL_ACCELERATION_EXT 0x2027\n#define WGL_SWAP_EXCHANGE_EXT 0x2028\n#define WGL_SWAP_COPY_EXT 0x2029\n#define WGL_SWAP_UNDEFINED_EXT 0x202A\n#define WGL_TYPE_RGBA_EXT 0x202B\n#define WGL_TYPE_COLORINDEX_EXT 0x202C\n\ntypedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);\n\n#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT)\n#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT)\n#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT)\n\n#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format)\n\n#endif /* WGL_EXT_pixel_format */\n\n/* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */\n\n#ifndef WGL_EXT_pixel_format_packed_float\n#define WGL_EXT_pixel_format_packed_float 1\n\n#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8\n\n#define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float)\n\n#endif /* WGL_EXT_pixel_format_packed_float */\n\n/* -------------------------- WGL_EXT_swap_control ------------------------- */\n\n#ifndef WGL_EXT_swap_control\n#define WGL_EXT_swap_control 1\n\ntypedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);\n\n#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT)\n#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT)\n\n#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control)\n\n#endif /* WGL_EXT_swap_control */\n\n/* ----------------------- WGL_EXT_swap_control_tear ----------------------- */\n\n#ifndef WGL_EXT_swap_control_tear\n#define WGL_EXT_swap_control_tear 1\n\n#define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear)\n\n#endif /* WGL_EXT_swap_control_tear */\n\n/* --------------------- WGL_I3D_digital_video_control --------------------- */\n\n#ifndef WGL_I3D_digital_video_control\n#define WGL_I3D_digital_video_control 1\n\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051\n#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052\n#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053\n\ntypedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);\n\n#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D)\n#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D)\n\n#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control)\n\n#endif /* WGL_I3D_digital_video_control */\n\n/* ----------------------------- WGL_I3D_gamma ----------------------------- */\n\n#ifndef WGL_I3D_gamma\n#define WGL_I3D_gamma 1\n\n#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E\n#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F\n\ntypedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue);\ntypedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue);\ntypedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);\n\n#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D)\n#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D)\n#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D)\n#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D)\n\n#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma)\n\n#endif /* WGL_I3D_gamma */\n\n/* ---------------------------- WGL_I3D_genlock ---------------------------- */\n\n#ifndef WGL_I3D_genlock\n#define WGL_I3D_genlock 1\n\n#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044\n#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045\n#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046\n#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047\n#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048\n#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049\n#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A\n#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B\n#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C\n\ntypedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);\ntypedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource);\ntypedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag);\ntypedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay);\n\n#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D)\n#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D)\n#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D)\n#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D)\n#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D)\n#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D)\n#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D)\n#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D)\n#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D)\n#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D)\n#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D)\n#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D)\n\n#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock)\n\n#endif /* WGL_I3D_genlock */\n\n/* -------------------------- WGL_I3D_image_buffer ------------------------- */\n\n#ifndef WGL_I3D_image_buffer\n#define WGL_I3D_image_buffer 1\n\n#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001\n#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002\n\ntypedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count);\ntypedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);\ntypedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);\ntypedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count);\n\n#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D)\n#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D)\n#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D)\n#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D)\n\n#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer)\n\n#endif /* WGL_I3D_image_buffer */\n\n/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */\n\n#ifndef WGL_I3D_swap_frame_lock\n#define WGL_I3D_swap_frame_lock 1\n\ntypedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag);\n\n#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D)\n#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D)\n#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D)\n#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D)\n\n#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock)\n\n#endif /* WGL_I3D_swap_frame_lock */\n\n/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */\n\n#ifndef WGL_I3D_swap_frame_usage\n#define WGL_I3D_swap_frame_usage 1\n\ntypedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n\n#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D)\n#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D)\n#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D)\n#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D)\n\n#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage)\n\n#endif /* WGL_I3D_swap_frame_usage */\n\n/* --------------------------- WGL_NV_DX_interop --------------------------- */\n\n#ifndef WGL_NV_DX_interop\n#define WGL_NV_DX_interop 1\n\n#define WGL_ACCESS_READ_ONLY_NV 0x0000\n#define WGL_ACCESS_READ_WRITE_NV 0x0001\n#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002\n\ntypedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);\ntypedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);\ntypedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);\ntypedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice);\ntypedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access);\ntypedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle);\ntypedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);\ntypedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);\n\n#define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV)\n#define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV)\n#define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV)\n#define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV)\n#define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV)\n#define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV)\n#define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV)\n#define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV)\n\n#define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop)\n\n#endif /* WGL_NV_DX_interop */\n\n/* --------------------------- WGL_NV_DX_interop2 -------------------------- */\n\n#ifndef WGL_NV_DX_interop2\n#define WGL_NV_DX_interop2 1\n\n#define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2)\n\n#endif /* WGL_NV_DX_interop2 */\n\n/* --------------------------- WGL_NV_copy_image --------------------------- */\n\n#ifndef WGL_NV_copy_image\n#define WGL_NV_copy_image 1\n\ntypedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n\n#define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV)\n\n#define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image)\n\n#endif /* WGL_NV_copy_image */\n\n/* -------------------------- WGL_NV_float_buffer -------------------------- */\n\n#ifndef WGL_NV_float_buffer\n#define WGL_NV_float_buffer 1\n\n#define WGL_FLOAT_COMPONENTS_NV 0x20B0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4\n#define WGL_TEXTURE_FLOAT_R_NV 0x20B5\n#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6\n#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7\n#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8\n\n#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer)\n\n#endif /* WGL_NV_float_buffer */\n\n/* -------------------------- WGL_NV_gpu_affinity -------------------------- */\n\n#ifndef WGL_NV_gpu_affinity\n#define WGL_NV_gpu_affinity 1\n\n#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0\n#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1\n\nDECLARE_HANDLE(HGPUNV);\ntypedef struct _GPU_DEVICE {\n DWORD cb; \n CHAR DeviceName[32]; \n CHAR DeviceString[128]; \n DWORD Flags; \n RECT rcVirtualScreen; \n} GPU_DEVICE, *PGPU_DEVICE;\n\ntypedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);\ntypedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);\n\n#define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV)\n#define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV)\n#define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV)\n#define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV)\n#define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV)\n\n#define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity)\n\n#endif /* WGL_NV_gpu_affinity */\n\n/* ---------------------- WGL_NV_multisample_coverage ---------------------- */\n\n#ifndef WGL_NV_multisample_coverage\n#define WGL_NV_multisample_coverage 1\n\n#define WGL_COVERAGE_SAMPLES_NV 0x2042\n#define WGL_COLOR_SAMPLES_NV 0x20B9\n\n#define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage)\n\n#endif /* WGL_NV_multisample_coverage */\n\n/* -------------------------- WGL_NV_present_video ------------------------- */\n\n#ifndef WGL_NV_present_video\n#define WGL_NV_present_video 1\n\n#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0\n\nDECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList);\ntypedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList);\ntypedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue);\n\n#define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV)\n#define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV)\n#define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV)\n\n#define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video)\n\n#endif /* WGL_NV_present_video */\n\n/* ---------------------- WGL_NV_render_depth_texture ---------------------- */\n\n#ifndef WGL_NV_render_depth_texture\n#define WGL_NV_render_depth_texture 1\n\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4\n#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5\n#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6\n#define WGL_DEPTH_COMPONENT_NV 0x20A7\n\n#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture)\n\n#endif /* WGL_NV_render_depth_texture */\n\n/* -------------------- WGL_NV_render_texture_rectangle -------------------- */\n\n#ifndef WGL_NV_render_texture_rectangle\n#define WGL_NV_render_texture_rectangle 1\n\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1\n#define WGL_TEXTURE_RECTANGLE_NV 0x20A2\n\n#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle)\n\n#endif /* WGL_NV_render_texture_rectangle */\n\n/* --------------------------- WGL_NV_swap_group --------------------------- */\n\n#ifndef WGL_NV_swap_group\n#define WGL_NV_swap_group 1\n\ntypedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);\ntypedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count);\ntypedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers);\ntypedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier);\ntypedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);\n\n#define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV)\n#define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV)\n#define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV)\n#define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV)\n#define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV)\n#define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV)\n\n#define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group)\n\n#endif /* WGL_NV_swap_group */\n\n/* ----------------------- WGL_NV_vertex_array_range ----------------------- */\n\n#ifndef WGL_NV_vertex_array_range\n#define WGL_NV_vertex_array_range 1\n\ntypedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);\ntypedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);\n\n#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV)\n#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV)\n\n#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range)\n\n#endif /* WGL_NV_vertex_array_range */\n\n/* -------------------------- WGL_NV_video_capture ------------------------- */\n\n#ifndef WGL_NV_video_capture\n#define WGL_NV_video_capture 1\n\n#define WGL_UNIQUE_ID_NV 0x20CE\n#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\nDECLARE_HANDLE(HVIDEOINPUTDEVICENV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\ntypedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList);\ntypedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\ntypedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\n#define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV)\n#define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV)\n#define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV)\n#define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV)\n#define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV)\n\n#define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture)\n\n#endif /* WGL_NV_video_capture */\n\n/* -------------------------- WGL_NV_video_output -------------------------- */\n\n#ifndef WGL_NV_video_output\n#define WGL_NV_video_output 1\n\n#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0\n#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1\n#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2\n#define WGL_VIDEO_OUT_COLOR_NV 0x20C3\n#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4\n#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5\n#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define WGL_VIDEO_OUT_FRAME 0x20C8\n#define WGL_VIDEO_OUT_FIELD_1 0x20C9\n#define WGL_VIDEO_OUT_FIELD_2 0x20CA\n#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB\n#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC\n\nDECLARE_HANDLE(HPVIDEODEV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\ntypedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice);\ntypedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);\ntypedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock);\n\n#define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV)\n#define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV)\n#define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV)\n#define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV)\n#define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV)\n#define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV)\n\n#define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output)\n\n#endif /* WGL_NV_video_output */\n\n/* -------------------------- WGL_OML_sync_control ------------------------- */\n\n#ifndef WGL_OML_sync_control\n#define WGL_OML_sync_control 1\n\ntypedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator);\ntypedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc);\ntypedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\ntypedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\ntypedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc);\ntypedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc);\n\n#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML)\n#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML)\n#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML)\n#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML)\n#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML)\n#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML)\n\n#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control)\n\n#endif /* WGL_OML_sync_control */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define WGLEW_FUN_EXPORT\n#define WGLEW_VAR_EXPORT\n#else\n#define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT\n#define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT\n#endif /* GLEW_MX */\n\n#ifdef GLEW_MX\nstruct WGLEWContextStruct\n{\n#endif /* GLEW_MX */\n\nWGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL;\n\nWGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD;\nWGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD;\nWGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD;\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD;\nWGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD;\nWGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB;\n\nWGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB;\n\nWGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB;\n\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB;\nWGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB;\nWGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB;\nWGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB;\nWGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB;\nWGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB;\n\nWGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB;\n\nWGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB;\nWGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB;\nWGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB;\n\nWGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT;\nWGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT;\nWGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT;\n\nWGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT;\nWGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D;\nWGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D;\n\nWGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D;\nWGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D;\nWGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D;\nWGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D;\n\nWGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D;\nWGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D;\nWGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D;\nWGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D;\n\nWGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D;\nWGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D;\nWGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV;\nWGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV;\nWGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV;\nWGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV;\nWGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV;\nWGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV;\n\nWGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV;\nWGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV;\nWGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV;\nWGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV;\n\nWGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV;\nWGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV;\nWGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV;\nWGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV;\n\nWGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML;\nWGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML;\nWGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML;\nWGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML;\nWGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML;\nWGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control;\n\n#ifdef GLEW_MX\n}; /* WGLEWContextStruct */\n#endif /* GLEW_MX */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n\ntypedef struct WGLEWContextStruct WGLEWContext;\nGLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx);\nGLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name);\n\n#define wglewInit() wglewContextInit(wglewGetContext())\n#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x)\n\n#define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x))\n#define WGLEW_GET_FUN(x) wglewGetContext()->x\n\n#else /* GLEW_MX */\n\n#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x)\n#define WGLEW_GET_FUN(x) x\n\nGLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);\n\n#endif /* GLEW_MX */\n\nGLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name);\n\n#ifdef __cplusplus\n}\n#endif\n\n#undef GLEWAPI\n\n#endif /* __wglew_h__ */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.137, "dedup_hash": "157141cd0f51f5d3", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glad", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Glad", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glad/glad.h", "language": "code", "loc": 5226, "comment_density": 0.004, "code": "/*\n\n OpenGL loader generated by glad 0.1.13a0 on Sun Apr 2 14:54:18 2017.\n\n Language/Generator: C/C++\n Specification: gl\n APIs: gl=4.5\n Profile: compatibility\n Extensions:\n GL_KHR_debug\n Loader: True\n Local files: False\n Omit khrplatform: False\n\n Commandline:\n --profile=\"compatibility\" --api=\"gl=4.5\" --generator=\"c\" --spec=\"gl\" --extensions=\"GL_KHR_debug\"\n Online:\n http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.5&extensions=GL_KHR_debug\n*/\n\n\n#ifndef __glad_h_\n#define __glad_h_\n\n#ifdef __gl_h_\n#error OpenGL header already included, remove this include, glad already provides it\n#endif\n#define __gl_h_\n\n#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN 1\n#endif\n#include \n#endif\n\n#ifndef APIENTRY\n#define APIENTRY\n#endif\n#ifndef APIENTRYP\n#define APIENTRYP APIENTRY *\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct gladGLversionStruct {\n int major;\n int minor;\n};\n\ntypedef void* (* GLADloadproc)(const char *name);\n\n#ifndef GLAPI\n# if defined(GLAD_GLAPI_EXPORT)\n# if defined(WIN32) || defined(__CYGWIN__)\n# if defined(GLAD_GLAPI_EXPORT_BUILD)\n# if defined(__GNUC__)\n# define GLAPI __attribute__ ((dllexport)) extern\n# else\n# define GLAPI __declspec(dllexport) extern\n# endif\n# else\n# if defined(__GNUC__)\n# define GLAPI __attribute__ ((dllimport)) extern\n# else\n# define GLAPI __declspec(dllimport) extern\n# endif\n# endif\n# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD)\n# define GLAPI __attribute__ ((visibility (\"default\"))) extern\n# else\n# define GLAPI extern\n# endif\n# else\n# define GLAPI extern\n# endif\n#endif\n\nGLAPI struct gladGLversionStruct GLVersion;\n\nGLAPI int gladLoadGL(void);\n\nGLAPI int gladLoadGLLoader(GLADloadproc);\n\n#include \n#include \n#ifndef GLEXT_64_TYPES_DEFINED\n/* This code block is duplicated in glxext.h, so must be protected */\n#define GLEXT_64_TYPES_DEFINED\n/* Define int32_t, int64_t, and uint64_t types for UST/MSC */\n/* (as used in the GL_EXT_timer_query extension). */\n#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n#include \n#elif defined(__sun__) || defined(__digital__)\n#include \n#if defined(__STDC__)\n#if defined(__arch64__) || defined(_LP64)\ntypedef long int int64_t;\ntypedef unsigned long int uint64_t;\n#else\ntypedef long long int int64_t;\ntypedef unsigned long long int uint64_t;\n#endif /* __arch64__ */\n#endif /* __STDC__ */\n#elif defined( __VMS ) || defined(__sgi)\n#include \n#elif defined(__SCO__) || defined(__USLC__)\n#include \n#elif defined(__UNIXOS2__) || defined(__SOL64__)\ntypedef long int int32_t;\ntypedef long long int int64_t;\ntypedef unsigned long long int uint64_t;\n#elif defined(_WIN32) && defined(__GNUC__)\n#include \n#elif defined(_WIN32)\ntypedef __int32 int32_t;\ntypedef __int64 int64_t;\ntypedef unsigned __int64 uint64_t;\n#else\n/* Fallback if nothing above works */\n#include \n#endif\n#endif\ntypedef unsigned int GLenum;\ntypedef unsigned char GLboolean;\ntypedef unsigned int GLbitfield;\ntypedef void GLvoid;\ntypedef signed char GLbyte;\ntypedef short GLshort;\ntypedef int GLint;\ntypedef int GLclampx;\ntypedef unsigned char GLubyte;\ntypedef unsigned short GLushort;\ntypedef unsigned int GLuint;\ntypedef int GLsizei;\ntypedef float GLfloat;\ntypedef float GLclampf;\ntypedef double GLdouble;\ntypedef double GLclampd;\ntypedef void *GLeglImageOES;\ntypedef char GLchar;\ntypedef char GLcharARB;\n#ifdef __APPLE__\ntypedef void *GLhandleARB;\n#else\ntypedef unsigned int GLhandleARB;\n#endif\ntypedef unsigned short GLhalfARB;\ntypedef unsigned short GLhalf;\ntypedef GLint GLfixed;\n#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)\ntypedef long GLintptr;\n#else\ntypedef ptrdiff_t GLintptr;\n#endif\n#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)\ntypedef long GLsizeiptr;\n#else\ntypedef ptrdiff_t GLsizeiptr;\n#endif\ntypedef int64_t GLint64;\ntypedef uint64_t GLuint64;\n#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)\ntypedef long GLintptrARB;\n#else\ntypedef ptrdiff_t GLintptrARB;\n#endif\n#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)\ntypedef long GLsizeiptrARB;\n#else\ntypedef ptrdiff_t GLsizeiptrARB;\n#endif\ntypedef int64_t GLint64EXT;\ntypedef uint64_t GLuint64EXT;\ntypedef struct __GLsync *GLsync;\nstruct _cl_context;\nstruct _cl_event;\ntypedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);\ntypedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);\ntypedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);\ntypedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);\ntypedef unsigned short GLhalfNV;\ntypedef GLintptr GLvdpauSurfaceNV;\n#define GL_DEPTH_BUFFER_BIT 0x00000100\n#define GL_STENCIL_BUFFER_BIT 0x00000400\n#define GL_COLOR_BUFFER_BIT 0x00004000\n#define GL_FALSE 0\n#define GL_TRUE 1\n#define GL_POINTS 0x0000\n#define GL_LINES 0x0001\n#define GL_LINE_LOOP 0x0002\n#define GL_LINE_STRIP 0x0003\n#define GL_TRIANGLES 0x0004\n#define GL_TRIANGLE_STRIP 0x0005\n#define GL_TRIANGLE_FAN 0x0006\n#define GL_QUADS 0x0007\n#define GL_NEVER 0x0200\n#define GL_LESS 0x0201\n#define GL_EQUAL 0x0202\n#define GL_LEQUAL 0x0203\n#define GL_GREATER 0x0204\n#define GL_NOTEQUAL 0x0205\n#define GL_GEQUAL 0x0206\n#define GL_ALWAYS 0x0207\n#define GL_ZERO 0\n#define GL_ONE 1\n#define GL_SRC_COLOR 0x0300\n#define GL_ONE_MINUS_SRC_COLOR 0x0301\n#define GL_SRC_ALPHA 0x0302\n#define GL_ONE_MINUS_SRC_ALPHA 0x0303\n#define GL_DST_ALPHA 0x0304\n#define GL_ONE_MINUS_DST_ALPHA 0x0305\n#define GL_DST_COLOR 0x0306\n#define GL_ONE_MINUS_DST_COLOR 0x0307\n#define GL_SRC_ALPHA_SATURATE 0x0308\n#define GL_NONE 0\n#define GL_FRONT_LEFT 0x0400\n#define GL_FRONT_RIGHT 0x0401\n#define GL_BACK_LEFT 0x0402\n#define GL_BACK_RIGHT 0x0403\n#define GL_FRONT 0x0404\n#define GL_BACK 0x0405\n#define GL_LEFT 0x0406\n#define GL_RIGHT 0x0407\n#define GL_FRONT_AND_BACK 0x0408\n#define GL_NO_ERROR 0\n#define GL_INVALID_ENUM 0x0500\n#define GL_INVALID_VALUE 0x0501\n#define GL_INVALID_OPERATION 0x0502\n#define GL_OUT_OF_MEMORY 0x0505\n#define GL_CW 0x0900\n#define GL_CCW 0x0901\n#define GL_POINT_SIZE 0x0B11\n#define GL_POINT_SIZE_RANGE 0x0B12\n#define GL_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_LINE_SMOOTH 0x0B20\n#define GL_LINE_WIDTH 0x0B21\n#define GL_LINE_WIDTH_RANGE 0x0B22\n#define GL_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_POLYGON_MODE 0x0B40\n#define GL_POLYGON_SMOOTH 0x0B41\n#define GL_CULL_FACE 0x0B44\n#define GL_CULL_FACE_MODE 0x0B45\n#define GL_FRONT_FACE 0x0B46\n#define GL_DEPTH_RANGE 0x0B70\n#define GL_DEPTH_TEST 0x0B71\n#define GL_DEPTH_WRITEMASK 0x0B72\n#define GL_DEPTH_CLEAR_VALUE 0x0B73\n#define GL_DEPTH_FUNC 0x0B74\n#define GL_STENCIL_TEST 0x0B90\n#define GL_STENCIL_CLEAR_VALUE 0x0B91\n#define GL_STENCIL_FUNC 0x0B92\n#define GL_STENCIL_VALUE_MASK 0x0B93\n#define GL_STENCIL_FAIL 0x0B94\n#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95\n#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96\n#define GL_STENCIL_REF 0x0B97\n#define GL_STENCIL_WRITEMASK 0x0B98\n#define GL_VIEWPORT 0x0BA2\n#define GL_DITHER 0x0BD0\n#define GL_BLEND_DST 0x0BE0\n#define GL_BLEND_SRC 0x0BE1\n#define GL_BLEND 0x0BE2\n#define GL_LOGIC_OP_MODE 0x0BF0\n#define GL_COLOR_LOGIC_OP 0x0BF2\n#define GL_DRAW_BUFFER 0x0C01\n#define GL_READ_BUFFER 0x0C02\n#define GL_SCISSOR_BOX 0x0C10\n#define GL_SCISSOR_TEST 0x0C11\n#define GL_COLOR_CLEAR_VALUE 0x0C22\n#define GL_COLOR_WRITEMASK 0x0C23\n#define GL_DOUBLEBUFFER 0x0C32\n#define GL_STEREO 0x0C33\n#define GL_LINE_SMOOTH_HINT 0x0C52\n#define GL_POLYGON_SMOOTH_HINT 0x0C53\n#define GL_UNPACK_SWAP_BYTES 0x0CF0\n#define GL_UNPACK_LSB_FIRST 0x0CF1\n#define GL_UNPACK_ROW_LENGTH 0x0CF2\n#define GL_UNPACK_SKIP_ROWS 0x0CF3\n#define GL_UNPACK_SKIP_PIXELS 0x0CF4\n#define GL_UNPACK_ALIGNMENT 0x0CF5\n#define GL_PACK_SWAP_BYTES 0x0D00\n#define GL_PACK_LSB_FIRST 0x0D01\n#define GL_PACK_ROW_LENGTH 0x0D02\n#define GL_PACK_SKIP_ROWS 0x0D03\n#define GL_PACK_SKIP_PIXELS 0x0D04\n#define GL_PACK_ALIGNMENT 0x0D05\n#define GL_MAX_TEXTURE_SIZE 0x0D33\n#define GL_MAX_VIEWPORT_DIMS 0x0D3A\n#define GL_SUBPIXEL_BITS 0x0D50\n#define GL_TEXTURE_1D 0x0DE0\n#define GL_TEXTURE_2D 0x0DE1\n#define GL_POLYGON_OFFSET_UNITS 0x2A00\n#define GL_POLYGON_OFFSET_POINT 0x2A01\n#define GL_POLYGON_OFFSET_LINE 0x2A02\n#define GL_POLYGON_OFFSET_FILL 0x8037\n#define GL_POLYGON_OFFSET_FACTOR 0x8038\n#define GL_TEXTURE_BINDING_1D 0x8068\n#define GL_TEXTURE_BINDING_2D 0x8069\n#define GL_TEXTURE_WIDTH 0x1000\n#define GL_TEXTURE_HEIGHT 0x1001\n#define GL_TEXTURE_INTERNAL_FORMAT 0x1003\n#define GL_TEXTURE_BORDER_COLOR 0x1004\n#define GL_TEXTURE_RED_SIZE 0x805C\n#define GL_TEXTURE_GREEN_SIZE 0x805D\n#define GL_TEXTURE_BLUE_SIZE 0x805E\n#define GL_TEXTURE_ALPHA_SIZE 0x805F\n#define GL_DONT_CARE 0x1100\n#define GL_FASTEST 0x1101\n#define GL_NICEST 0x1102\n#define GL_BYTE 0x1400\n#define GL_UNSIGNED_BYTE 0x1401\n#define GL_SHORT 0x1402\n#define GL_UNSIGNED_SHORT 0x1403\n#define GL_INT 0x1404\n#define GL_UNSIGNED_INT 0x1405\n#define GL_FLOAT 0x1406\n#define GL_DOUBLE 0x140A\n#define GL_STACK_OVERFLOW 0x0503\n#define GL_STACK_UNDERFLOW 0x0504\n#define GL_CLEAR 0x1500\n#define GL_AND 0x1501\n#define GL_AND_REVERSE 0x1502\n#define GL_COPY 0x1503\n#define GL_AND_INVERTED 0x1504\n#define GL_NOOP 0x1505\n#define GL_XOR 0x1506\n#define GL_OR 0x1507\n#define GL_NOR 0x1508\n#define GL_EQUIV 0x1509\n#define GL_INVERT 0x150A\n#define GL_OR_REVERSE 0x150B\n#define GL_COPY_INVERTED 0x150C\n#define GL_OR_INVERTED 0x150D\n#define GL_NAND 0x150E\n#define GL_SET 0x150F\n#define GL_TEXTURE 0x1702\n#define GL_COLOR 0x1800\n#define GL_DEPTH 0x1801\n#define GL_STENCIL 0x1802\n#define GL_STENCIL_INDEX 0x1901\n#define GL_DEPTH_COMPONENT 0x1902\n#define GL_RED 0x1903\n#define GL_GREEN 0x1904\n#define GL_BLUE 0x1905\n#define GL_ALPHA 0x1906\n#define GL_RGB 0x1907\n#define GL_RGBA 0x1908\n#define GL_POINT 0x1B00\n#define GL_LINE 0x1B01\n#define GL_FILL 0x1B02\n#define GL_KEEP 0x1E00\n#define GL_REPLACE 0x1E01\n#define GL_INCR 0x1E02\n#define GL_DECR 0x1E03\n#define GL_VENDOR 0x1F00\n#define GL_RENDERER 0x1F01\n#define GL_VERSION 0x1F02\n#define GL_EXTENSIONS 0x1F03\n#define GL_NEAREST 0x2600\n#define GL_LINEAR 0x2601\n#define GL_NEAREST_MIPMAP_NEAREST 0x2700\n#define GL_LINEAR_MIPMAP_NEAREST 0x2701\n#define GL_NEAREST_MIPMAP_LINEAR 0x2702\n#define GL_LINEAR_MIPMAP_LINEAR 0x2703\n#define GL_TEXTURE_MAG_FILTER 0x2800\n#define GL_TEXTURE_MIN_FILTER 0x2801\n#define GL_TEXTURE_WRAP_S 0x2802\n#define GL_TEXTURE_WRAP_T 0x2803\n#define GL_PROXY_TEXTURE_1D 0x8063\n#define GL_PROXY_TEXTURE_2D 0x8064\n#define GL_REPEAT 0x2901\n#define GL_R3_G3_B2 0x2A10\n#define GL_RGB4 0x804F\n#define GL_RGB5 0x8050\n#define GL_RGB8 0x8051\n#define GL_RGB10 0x8052\n#define GL_RGB12 0x8053\n#define GL_RGB16 0x8054\n#define GL_RGBA2 0x8055\n#define GL_RGBA4 0x8056\n#define GL_RGB5_A1 0x8057\n#define GL_RGBA8 0x8058\n#define GL_RGB10_A2 0x8059\n#define GL_RGBA12 0x805A\n#define GL_RGBA16 0x805B\n#define GL_CURRENT_BIT 0x00000001\n#define GL_POINT_BIT 0x00000002\n#define GL_LINE_BIT 0x00000004\n#define GL_POLYGON_BIT 0x00000008\n#define GL_POLYGON_STIPPLE_BIT 0x00000010\n#define GL_PIXEL_MODE_BIT 0x00000020\n#define GL_LIGHTING_BIT 0x00000040\n#define GL_FOG_BIT 0x00000080\n#define GL_ACCUM_BUFFER_BIT 0x00000200\n#define GL_VIEWPORT_BIT 0x00000800\n#define GL_TRANSFORM_BIT 0x00001000\n#define GL_ENABLE_BIT 0x00002000\n#define GL_HINT_BIT 0x00008000\n#define GL_EVAL_BIT 0x00010000\n#define GL_LIST_BIT 0x00020000\n#define GL_TEXTURE_BIT 0x00040000\n#define GL_SCISSOR_BIT 0x00080000\n#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF\n#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001\n#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002\n#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF\n#define GL_QUAD_STRIP 0x0008\n#define GL_POLYGON 0x0009\n#define GL_ACCUM 0x0100\n#define GL_LOAD 0x0101\n#define GL_RETURN 0x0102\n#define GL_MULT 0x0103\n#define GL_ADD 0x0104\n#define GL_AUX0 0x0409\n#define GL_AUX1 0x040A\n#define GL_AUX2 0x040B\n#define GL_AUX3 0x040C\n#define GL_2D 0x0600\n#define GL_3D 0x0601\n#define GL_3D_COLOR 0x0602\n#define GL_3D_COLOR_TEXTURE 0x0603\n#define GL_4D_COLOR_TEXTURE 0x0604\n#define GL_PASS_THROUGH_TOKEN 0x0700\n#define GL_POINT_TOKEN 0x0701\n#define GL_LINE_TOKEN 0x0702\n#define GL_POLYGON_TOKEN 0x0703\n#define GL_BITMAP_TOKEN 0x0704\n#define GL_DRAW_PIXEL_TOKEN 0x0705\n#define GL_COPY_PIXEL_TOKEN 0x0706\n#define GL_LINE_RESET_TOKEN 0x0707\n#define GL_EXP 0x0800\n#define GL_EXP2 0x0801\n#define GL_COEFF 0x0A00\n#define GL_ORDER 0x0A01\n#define GL_DOMAIN 0x0A02\n#define GL_PIXEL_MAP_I_TO_I 0x0C70\n#define GL_PIXEL_MAP_S_TO_S 0x0C71\n#define GL_PIXEL_MAP_I_TO_R 0x0C72\n#define GL_PIXEL_MAP_I_TO_G 0x0C73\n#define GL_PIXEL_MAP_I_TO_B 0x0C74\n#define GL_PIXEL_MAP_I_TO_A 0x0C75\n#define GL_PIXEL_MAP_R_TO_R 0x0C76\n#define GL_PIXEL_MAP_G_TO_G 0x0C77\n#define GL_PIXEL_MAP_B_TO_B 0x0C78\n#define GL_PIXEL_MAP_A_TO_A 0x0C79\n#define GL_VERTEX_ARRAY_POINTER 0x808E\n#define GL_NORMAL_ARRAY_POINTER 0x808F\n#define GL_COLOR_ARRAY_POINTER 0x8090\n#define GL_INDEX_ARRAY_POINTER 0x8091\n#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092\n#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093\n#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0\n#define GL_SELECTION_BUFFER_POINTER 0x0DF3\n#define GL_CURRENT_COLOR 0x0B00\n#define GL_CURRENT_INDEX 0x0B01\n#define GL_CURRENT_NORMAL 0x0B02\n#define GL_CURRENT_TEXTURE_COORDS 0x0B03\n#define GL_CURRENT_RASTER_COLOR 0x0B04\n#define GL_CURRENT_RASTER_INDEX 0x0B05\n#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06\n#define GL_CURRENT_RASTER_POSITION 0x0B07\n#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08\n#define GL_CURRENT_RASTER_DISTANCE 0x0B09\n#define GL_POINT_SMOOTH 0x0B10\n#define GL_LINE_STIPPLE 0x0B24\n#define GL_LINE_STIPPLE_PATTERN 0x0B25\n#define GL_LINE_STIPPLE_REPEAT 0x0B26\n#define GL_LIST_MODE 0x0B30\n#define GL_MAX_LIST_NESTING 0x0B31\n#define GL_LIST_BASE 0x0B32\n#define GL_LIST_INDEX 0x0B33\n#define GL_POLYGON_STIPPLE 0x0B42\n#define GL_EDGE_FLAG 0x0B43\n#define GL_LIGHTING 0x0B50\n#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51\n#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52\n#define GL_LIGHT_MODEL_AMBIENT 0x0B53\n#define GL_SHADE_MODEL 0x0B54\n#define GL_COLOR_MATERIAL_FACE 0x0B55\n#define GL_COLOR_MATERIAL_PARAMETER 0x0B56\n#define GL_COLOR_MATERIAL 0x0B57\n#define GL_FOG 0x0B60\n#define GL_FOG_INDEX 0x0B61\n#define GL_FOG_DENSITY 0x0B62\n#define GL_FOG_START 0x0B63\n#define GL_FOG_END 0x0B64\n#define GL_FOG_MODE 0x0B65\n#define GL_FOG_COLOR 0x0B66\n#define GL_ACCUM_CLEAR_VALUE 0x0B80\n#define GL_MATRIX_MODE 0x0BA0\n#define GL_NORMALIZE 0x0BA1\n#define GL_MODELVIEW_STACK_DEPTH 0x0BA3\n#define GL_PROJECTION_STACK_DEPTH 0x0BA4\n#define GL_TEXTURE_STACK_DEPTH 0x0BA5\n#define GL_MODELVIEW_MATRIX 0x0BA6\n#define GL_PROJECTION_MATRIX 0x0BA7\n#define GL_TEXTURE_MATRIX 0x0BA8\n#define GL_ATTRIB_STACK_DEPTH 0x0BB0\n#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1\n#define GL_ALPHA_TEST 0x0BC0\n#define GL_ALPHA_TEST_FUNC 0x0BC1\n#define GL_ALPHA_TEST_REF 0x0BC2\n#define GL_INDEX_LOGIC_OP 0x0BF1\n#define GL_LOGIC_OP 0x0BF1\n#define GL_AUX_BUFFERS 0x0C00\n#define GL_INDEX_CLEAR_VALUE 0x0C20\n#define GL_INDEX_WRITEMASK 0x0C21\n#define GL_INDEX_MODE 0x0C30\n#define GL_RGBA_MODE 0x0C31\n#define GL_RENDER_MODE 0x0C40\n#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50\n#define GL_POINT_SMOOTH_HINT 0x0C51\n#define GL_FOG_HINT 0x0C54\n#define GL_TEXTURE_GEN_S 0x0C60\n#define GL_TEXTURE_GEN_T 0x0C61\n#define GL_TEXTURE_GEN_R 0x0C62\n#define GL_TEXTURE_GEN_Q 0x0C63\n#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0\n#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1\n#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2\n#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3\n#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4\n#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5\n#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6\n#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7\n#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8\n#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9\n#define GL_MAP_COLOR 0x0D10\n#define GL_MAP_STENCIL 0x0D11\n#define GL_INDEX_SHIFT 0x0D12\n#define GL_INDEX_OFFSET 0x0D13\n#define GL_RED_SCALE 0x0D14\n#define GL_RED_BIAS 0x0D15\n#define GL_ZOOM_X 0x0D16\n#define GL_ZOOM_Y 0x0D17\n#define GL_GREEN_SCALE 0x0D18\n#define GL_GREEN_BIAS 0x0D19\n#define GL_BLUE_SCALE 0x0D1A\n#define GL_BLUE_BIAS 0x0D1B\n#define GL_ALPHA_SCALE 0x0D1C\n#define GL_ALPHA_BIAS 0x0D1D\n#define GL_DEPTH_SCALE 0x0D1E\n#define GL_DEPTH_BIAS 0x0D1F\n#define GL_MAX_EVAL_ORDER 0x0D30\n#define GL_MAX_LIGHTS 0x0D31\n#define GL_MAX_CLIP_PLANES 0x0D32\n#define GL_MAX_PIXEL_MAP_TABLE 0x0D34\n#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35\n#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36\n#define GL_MAX_NAME_STACK_DEPTH 0x0D37\n#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38\n#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39\n#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B\n#define GL_INDEX_BITS 0x0D51\n#define GL_RED_BITS 0x0D52\n#define GL_GREEN_BITS 0x0D53\n#define GL_BLUE_BITS 0x0D54\n#define GL_ALPHA_BITS 0x0D55\n#define GL_DEPTH_BITS 0x0D56\n#define GL_STENCIL_BITS 0x0D57\n#define GL_ACCUM_RED_BITS 0x0D58\n#define GL_ACCUM_GREEN_BITS 0x0D59\n#define GL_ACCUM_BLUE_BITS 0x0D5A\n#define GL_ACCUM_ALPHA_BITS 0x0D5B\n#define GL_NAME_STACK_DEPTH 0x0D70\n#define GL_AUTO_NORMAL 0x0D80\n#define GL_MAP1_COLOR_4 0x0D90\n#define GL_MAP1_INDEX 0x0D91\n#define GL_MAP1_NORMAL 0x0D92\n#define GL_MAP1_TEXTURE_COORD_1 0x0D93\n#define GL_MAP1_TEXTURE_COORD_2 0x0D94\n#define GL_MAP1_TEXTURE_COORD_3 0x0D95\n#define GL_MAP1_TEXTURE_COORD_4 0x0D96\n#define GL_MAP1_VERTEX_3 0x0D97\n#define GL_MAP1_VERTEX_4 0x0D98\n#define GL_MAP2_COLOR_4 0x0DB0\n#define GL_MAP2_INDEX 0x0DB1\n#define GL_MAP2_NORMAL 0x0DB2\n#define GL_MAP2_TEXTURE_COORD_1 0x0DB3\n#define GL_MAP2_TEXTURE_COORD_2 0x0DB4\n#define GL_MAP2_TEXTURE_COORD_3 0x0DB5\n#define GL_MAP2_TEXTURE_COORD_4 0x0DB6\n#define GL_MAP2_VERTEX_3 0x0DB7\n#define GL_MAP2_VERTEX_4 0x0DB8\n#define GL_MAP1_GRID_DOMAIN 0x0DD0\n#define GL_MAP1_GRID_SEGMENTS 0x0DD1\n#define GL_MAP2_GRID_DOMAIN 0x0DD2\n#define GL_MAP2_GRID_SEGMENTS 0x0DD3\n#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1\n#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2\n#define GL_SELECTION_BUFFER_SIZE 0x0DF4\n#define GL_VERTEX_ARRAY 0x8074\n#define GL_NORMAL_ARRAY 0x8075\n#define GL_COLOR_ARRAY 0x8076\n#define GL_INDEX_ARRAY 0x8077\n#define GL_TEXTURE_COORD_ARRAY 0x8078\n#define GL_EDGE_FLAG_ARRAY 0x8079\n#define GL_VERTEX_ARRAY_SIZE 0x807A\n#define GL_VERTEX_ARRAY_TYPE 0x807B\n#define GL_VERTEX_ARRAY_STRIDE 0x807C\n#define GL_NORMAL_ARRAY_TYPE 0x807E\n#define GL_NORMAL_ARRAY_STRIDE 0x807F\n#define GL_COLOR_ARRAY_SIZE 0x8081\n#define GL_COLOR_ARRAY_TYPE 0x8082\n#define GL_COLOR_ARRAY_STRIDE 0x8083\n#define GL_INDEX_ARRAY_TYPE 0x8085\n#define GL_INDEX_ARRAY_STRIDE 0x8086\n#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088\n#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089\n#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A\n#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C\n#define GL_TEXTURE_COMPONENTS 0x1003\n#define GL_TEXTURE_BORDER 0x1005\n#define GL_TEXTURE_LUMINANCE_SIZE 0x8060\n#define GL_TEXTURE_INTENSITY_SIZE 0x8061\n#define GL_TEXTURE_PRIORITY 0x8066\n#define GL_TEXTURE_RESIDENT 0x8067\n#define GL_AMBIENT 0x1200\n#define GL_DIFFUSE 0x1201\n#define GL_SPECULAR 0x1202\n#define GL_POSITION 0x1203\n#define GL_SPOT_DIRECTION 0x1204\n#define GL_SPOT_EXPONENT 0x1205\n#define GL_SPOT_CUTOFF 0x1206\n#define GL_CONSTANT_ATTENUATION 0x1207\n#define GL_LINEAR_ATTENUATION 0x1208\n#define GL_QUADRATIC_ATTENUATION 0x1209\n#define GL_COMPILE 0x1300\n#define GL_COMPILE_AND_EXECUTE 0x1301\n#define GL_2_BYTES 0x1407\n#define GL_3_BYTES 0x1408\n#define GL_4_BYTES 0x1409\n#define GL_EMISSION 0x1600\n#define GL_SHININESS 0x1601\n#define GL_AMBIENT_AND_DIFFUSE 0x1602\n#define GL_COLOR_INDEXES 0x1603\n#define GL_MODELVIEW 0x1700\n#define GL_PROJECTION 0x1701\n#define GL_COLOR_INDEX 0x1900\n#define GL_LUMINANCE 0x1909\n#define GL_LUMINANCE_ALPHA 0x190A\n#define GL_BITMAP 0x1A00\n#define GL_RENDER 0x1C00\n#define GL_FEEDBACK 0x1C01\n#define GL_SELECT 0x1C02\n#define GL_FLAT 0x1D00\n#define GL_SMOOTH 0x1D01\n#define GL_S 0x2000\n#define GL_T 0x2001\n#define GL_R 0x2002\n#define GL_Q 0x2003\n#define GL_MODULATE 0x2100\n#define GL_DECAL 0x2101\n#define GL_TEXTURE_ENV_MODE 0x2200\n#define GL_TEXTURE_ENV_COLOR 0x2201\n#define GL_TEXTURE_ENV 0x2300\n#define GL_EYE_LINEAR 0x2400\n#define GL_OBJECT_LINEAR 0x2401\n#define GL_SPHERE_MAP 0x2402\n#define GL_TEXTURE_GEN_MODE 0x2500\n#define GL_OBJECT_PLANE 0x2501\n#define GL_EYE_PLANE 0x2502\n#define GL_CLAMP 0x2900\n#define GL_ALPHA4 0x803B\n#define GL_ALPHA8 0x803C\n#define GL_ALPHA12 0x803D\n#define GL_ALPHA16 0x803E\n#define GL_LUMINANCE4 0x803F\n#define GL_LUMINANCE8 0x8040\n#define GL_LUMINANCE12 0x8041\n#define GL_LUMINANCE16 0x8042\n#define GL_LUMINANCE4_ALPHA4 0x8043\n#define GL_LUMINANCE6_ALPHA2 0x8044\n#define GL_LUMINANCE8_ALPHA8 0x8045\n#define GL_LUMINANCE12_ALPHA4 0x8046\n#define GL_LUMINANCE12_ALPHA12 0x8047\n#define GL_LUMINANCE16_ALPHA16 0x8048\n#define GL_INTENSITY 0x8049\n#define GL_INTENSITY4 0x804A\n#define GL_INTENSITY8 0x804B\n#define GL_INTENSITY12 0x804C\n#define GL_INTENSITY16 0x804D\n#define GL_V2F 0x2A20\n#define GL_V3F 0x2A21\n#define GL_C4UB_V2F 0x2A22\n#define GL_C4UB_V3F 0x2A23\n#define GL_C3F_V3F 0x2A24\n#define GL_N3F_V3F 0x2A25\n#define GL_C4F_N3F_V3F 0x2A26\n#define GL_T2F_V3F 0x2A27\n#define GL_T4F_V4F 0x2A28\n#define GL_T2F_C4UB_V3F 0x2A29\n#define GL_T2F_C3F_V3F 0x2A2A\n#define GL_T2F_N3F_V3F 0x2A2B\n#define GL_T2F_C4F_N3F_V3F 0x2A2C\n#define GL_T4F_C4F_N3F_V4F 0x2A2D\n#define GL_CLIP_PLANE0 0x3000\n#define GL_CLIP_PLANE1 0x3001\n#define GL_CLIP_PLANE2 0x3002\n#define GL_CLIP_PLANE3 0x3003\n#define GL_CLIP_PLANE4 0x3004\n#define GL_CLIP_PLANE5 0x3005\n#define GL_LIGHT0 0x4000\n#define GL_LIGHT1 0x4001\n#define GL_LIGHT2 0x4002\n#define GL_LIGHT3 0x4003\n#define GL_LIGHT4 0x4004\n#define GL_LIGHT5 0x4005\n#define GL_LIGHT6 0x4006\n#define GL_LIGHT7 0x4007\n#define GL_UNSIGNED_BYTE_3_3_2 0x8032\n#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033\n#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034\n#define GL_UNSIGNED_INT_8_8_8_8 0x8035\n#define GL_UNSIGNED_INT_10_10_10_2 0x8036\n#define GL_TEXTURE_BINDING_3D 0x806A\n#define GL_PACK_SKIP_IMAGES 0x806B\n#define GL_PACK_IMAGE_HEIGHT 0x806C\n#define GL_UNPACK_SKIP_IMAGES 0x806D\n#define GL_UNPACK_IMAGE_HEIGHT 0x806E\n#define GL_TEXTURE_3D 0x806F\n#define GL_PROXY_TEXTURE_3D 0x8070\n#define GL_TEXTURE_DEPTH 0x8071\n#define GL_TEXTURE_WRAP_R 0x8072\n#define GL_MAX_3D_TEXTURE_SIZE 0x8073\n#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362\n#define GL_UNSIGNED_SHORT_5_6_5 0x8363\n#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364\n#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365\n#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366\n#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367\n#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368\n#define GL_BGR 0x80E0\n#define GL_BGRA 0x80E1\n#define GL_MAX_ELEMENTS_VERTICES 0x80E8\n#define GL_MAX_ELEMENTS_INDICES 0x80E9\n#define GL_CLAMP_TO_EDGE 0x812F\n#define GL_TEXTURE_MIN_LOD 0x813A\n#define GL_TEXTURE_MAX_LOD 0x813B\n#define GL_TEXTURE_BASE_LEVEL 0x813C\n#define GL_TEXTURE_MAX_LEVEL 0x813D\n#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12\n#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22\n#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E\n#define GL_RESCALE_NORMAL 0x803A\n#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8\n#define GL_SINGLE_COLOR 0x81F9\n#define GL_SEPARATE_SPECULAR_COLOR 0x81FA\n#define GL_ALIASED_POINT_SIZE_RANGE 0x846D\n#define GL_TEXTURE0 0x84C0\n#define GL_TEXTURE1 0x84C1\n#define GL_TEXTURE2 0x84C2\n#define GL_TEXTURE3 0x84C3\n#define GL_TEXTURE4 0x84C4\n#define GL_TEXTURE5 0x84C5\n#define GL_TEXTURE6 0x84C6\n#define GL_TEXTURE7 0x84C7\n#define GL_TEXTURE8 0x84C8\n#define GL_TEXTURE9 0x84C9\n#define GL_TEXTURE10 0x84CA\n#define GL_TEXTURE11 0x84CB\n#define GL_TEXTURE12 0x84CC\n#define GL_TEXTURE13 0x84CD\n#define GL_TEXTURE14 0x84CE\n#define GL_TEXTURE15 0x84CF\n#define GL_TEXTURE16 0x84D0\n#define GL_TEXTURE17 0x84D1\n#define GL_TEXTURE18 0x84D2\n#define GL_TEXTURE19 0x84D3\n#define GL_TEXTURE20 0x84D4\n#define GL_TEXTURE21 0x84D5\n#define GL_TEXTURE22 0x84D6\n#define GL_TEXTURE23 0x84D7\n#define GL_TEXTURE24 0x84D8\n#define GL_TEXTURE25 0x84D9\n#define GL_TEXTURE26 0x84DA\n#define GL_TEXTURE27 0x84DB\n#define GL_TEXTURE28 0x84DC\n#define GL_TEXTURE29 0x84DD\n#define GL_TEXTURE30 0x84DE\n#define GL_TEXTURE31 0x84DF\n#define GL_ACTIVE_TEXTURE 0x84E0\n#define GL_MULTISAMPLE 0x809D\n#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E\n#define GL_SAMPLE_ALPHA_TO_ONE 0x809F\n#define GL_SAMPLE_COVERAGE 0x80A0\n#define GL_SAMPLE_BUFFERS 0x80A8\n#define GL_SAMPLES 0x80A9\n#define GL_SAMPLE_COVERAGE_VALUE 0x80AA\n#define GL_SAMPLE_COVERAGE_INVERT 0x80AB\n#define GL_TEXTURE_CUBE_MAP 0x8513\n#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A\n#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C\n#define GL_COMPRESSED_RGB 0x84ED\n#define GL_COMPRESSED_RGBA 0x84EE\n#define GL_TEXTURE_COMPRESSION_HINT 0x84EF\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0\n#define GL_TEXTURE_COMPRESSED 0x86A1\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2\n#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3\n#define GL_CLAMP_TO_BORDER 0x812D\n#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1\n#define GL_MAX_TEXTURE_UNITS 0x84E2\n#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3\n#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4\n#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5\n#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6\n#define GL_MULTISAMPLE_BIT 0x20000000\n#define GL_NORMAL_MAP 0x8511\n#define GL_REFLECTION_MAP 0x8512\n#define GL_COMPRESSED_ALPHA 0x84E9\n#define GL_COMPRESSED_LUMINANCE 0x84EA\n#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB\n#define GL_COMPRESSED_INTENSITY 0x84EC\n#define GL_COMBINE 0x8570\n#define GL_COMBINE_RGB 0x8571\n#define GL_COMBINE_ALPHA 0x8572\n#define GL_SOURCE0_RGB 0x8580\n#define GL_SOURCE1_RGB 0x8581\n#define GL_SOURCE2_RGB 0x8582\n#define GL_SOURCE0_ALPHA 0x8588\n#define GL_SOURCE1_ALPHA 0x8589\n#define GL_SOURCE2_ALPHA 0x858A\n#define GL_OPERAND0_RGB 0x8590\n#define GL_OPERAND1_RGB 0x8591\n#define GL_OPERAND2_RGB 0x8592\n#define GL_OPERAND0_ALPHA 0x8598\n#define GL_OPERAND1_ALPHA 0x8599\n#define GL_OPERAND2_ALPHA 0x859A\n#define GL_RGB_SCALE 0x8573\n#define GL_ADD_SIGNED 0x8574\n#define GL_INTERPOLATE 0x8575\n#define GL_SUBTRACT 0x84E7\n#define GL_CONSTANT 0x8576\n#define GL_PRIMARY_COLOR 0x8577\n#define GL_PREVIOUS 0x8578\n#define GL_DOT3_RGB 0x86AE\n#define GL_DOT3_RGBA 0x86AF\n#define GL_BLEND_DST_RGB 0x80C8\n#define GL_BLEND_SRC_RGB 0x80C9\n#define GL_BLEND_DST_ALPHA 0x80CA\n#define GL_BLEND_SRC_ALPHA 0x80CB\n#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128\n#define GL_DEPTH_COMPONENT16 0x81A5\n#define GL_DEPTH_COMPONENT24 0x81A6\n#define GL_DEPTH_COMPONENT32 0x81A7\n#define GL_MIRRORED_REPEAT 0x8370\n#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD\n#define GL_TEXTURE_LOD_BIAS 0x8501\n#define GL_INCR_WRAP 0x8507\n#define GL_DECR_WRAP 0x8508\n#define GL_TEXTURE_DEPTH_SIZE 0x884A\n#define GL_TEXTURE_COMPARE_MODE 0x884C\n#define GL_TEXTURE_COMPARE_FUNC 0x884D\n#define GL_POINT_SIZE_MIN 0x8126\n#define GL_POINT_SIZE_MAX 0x8127\n#define GL_POINT_DISTANCE_ATTENUATION 0x8129\n#define GL_GENERATE_MIPMAP 0x8191\n#define GL_GENERATE_MIPMAP_HINT 0x8192\n#define GL_FOG_COORDINATE_SOURCE 0x8450\n#define GL_FOG_COORDINATE 0x8451\n#define GL_FRAGMENT_DEPTH 0x8452\n#define GL_CURRENT_FOG_COORDINATE 0x8453\n#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454\n#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455\n#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456\n#define GL_FOG_COORDINATE_ARRAY 0x8457\n#define GL_COLOR_SUM 0x8458\n#define GL_CURRENT_SECONDARY_COLOR 0x8459\n#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A\n#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C\n#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D\n#define GL_SECONDARY_COLOR_ARRAY 0x845E\n#define GL_TEXTURE_FILTER_CONTROL 0x8500\n#define GL_DEPTH_TEXTURE_MODE 0x884B\n#define GL_COMPARE_R_TO_TEXTURE 0x884E\n#define GL_FUNC_ADD 0x8006\n#define GL_FUNC_SUBTRACT 0x800A\n#define GL_FUNC_REVERSE_SUBTRACT 0x800B\n#define GL_MIN 0x8007\n#define GL_MAX 0x8008\n#define GL_CONSTANT_COLOR 0x8001\n#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002\n#define GL_CONSTANT_ALPHA 0x8003\n#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004\n#define GL_BUFFER_SIZE 0x8764\n#define GL_BUFFER_USAGE 0x8765\n#define GL_QUERY_COUNTER_BITS 0x8864\n#define GL_CURRENT_QUERY 0x8865\n#define GL_QUERY_RESULT 0x8866\n#define GL_QUERY_RESULT_AVAILABLE 0x8867\n#define GL_ARRAY_BUFFER 0x8892\n#define GL_ELEMENT_ARRAY_BUFFER 0x8893\n#define GL_ARRAY_BUFFER_BINDING 0x8894\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F\n#define GL_READ_ONLY 0x88B8\n#define GL_WRITE_ONLY 0x88B9\n#define GL_READ_WRITE 0x88BA\n#define GL_BUFFER_ACCESS 0x88BB\n#define GL_BUFFER_MAPPED 0x88BC\n#define GL_BUFFER_MAP_POINTER 0x88BD\n#define GL_STREAM_DRAW 0x88E0\n#define GL_STREAM_READ 0x88E1\n#define GL_STREAM_COPY 0x88E2\n#define GL_STATIC_DRAW 0x88E4\n#define GL_STATIC_READ 0x88E5\n#define GL_STATIC_COPY 0x88E6\n#define GL_DYNAMIC_DRAW 0x88E8\n#define GL_DYNAMIC_READ 0x88E9\n#define GL_DYNAMIC_COPY 0x88EA\n#define GL_SAMPLES_PASSED 0x8914\n#define GL_SRC1_ALPHA 0x8589\n#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896\n#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897\n#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898\n#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E\n#define GL_FOG_COORD_SRC 0x8450\n#define GL_FOG_COORD 0x8451\n#define GL_CURRENT_FOG_COORD 0x8453\n#define GL_FOG_COORD_ARRAY_TYPE 0x8454\n#define GL_FOG_COORD_ARRAY_STRIDE 0x8455\n#define GL_FOG_COORD_ARRAY_POINTER 0x8456\n#define GL_FOG_COORD_ARRAY 0x8457\n#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D\n#define GL_SRC0_RGB 0x8580\n#define GL_SRC1_RGB 0x8581\n#define GL_SRC2_RGB 0x8582\n#define GL_SRC0_ALPHA 0x8588\n#define GL_SRC2_ALPHA 0x858A\n#define GL_BLEND_EQUATION_RGB 0x8009\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625\n#define GL_CURRENT_VERTEX_ATTRIB 0x8626\n#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645\n#define GL_STENCIL_BACK_FUNC 0x8800\n#define GL_STENCIL_BACK_FAIL 0x8801\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803\n#define GL_MAX_DRAW_BUFFERS 0x8824\n#define GL_DRAW_BUFFER0 0x8825\n#define GL_DRAW_BUFFER1 0x8826\n#define GL_DRAW_BUFFER2 0x8827\n#define GL_DRAW_BUFFER3 0x8828\n#define GL_DRAW_BUFFER4 0x8829\n#define GL_DRAW_BUFFER5 0x882A\n#define GL_DRAW_BUFFER6 0x882B\n#define GL_DRAW_BUFFER7 0x882C\n#define GL_DRAW_BUFFER8 0x882D\n#define GL_DRAW_BUFFER9 0x882E\n#define GL_DRAW_BUFFER10 0x882F\n#define GL_DRAW_BUFFER11 0x8830\n#define GL_DRAW_BUFFER12 0x8831\n#define GL_DRAW_BUFFER13 0x8832\n#define GL_DRAW_BUFFER14 0x8833\n#define GL_DRAW_BUFFER15 0x8834\n#define GL_BLEND_EQUATION_ALPHA 0x883D\n#define GL_MAX_VERTEX_ATTRIBS 0x8869\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A\n#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872\n#define GL_FRAGMENT_SHADER 0x8B30\n#define GL_VERTEX_SHADER 0x8B31\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A\n#define GL_MAX_VARYING_FLOATS 0x8B4B\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D\n#define GL_SHADER_TYPE 0x8B4F\n#define GL_FLOAT_VEC2 0x8B50\n#define GL_FLOAT_VEC3 0x8B51\n#define GL_FLOAT_VEC4 0x8B52\n#define GL_INT_VEC2 0x8B53\n#define GL_INT_VEC3 0x8B54\n#define GL_INT_VEC4 0x8B55\n#define GL_BOOL 0x8B56\n#define GL_BOOL_VEC2 0x8B57\n#define GL_BOOL_VEC3 0x8B58\n#define GL_BOOL_VEC4 0x8B59\n#define GL_FLOAT_MAT2 0x8B5A\n#define GL_FLOAT_MAT3 0x8B5B\n#define GL_FLOAT_MAT4 0x8B5C\n#define GL_SAMPLER_1D 0x8B5D\n#define GL_SAMPLER_2D 0x8B5E\n#define GL_SAMPLER_3D 0x8B5F\n#define GL_SAMPLER_CUBE 0x8B60\n#define GL_SAMPLER_1D_SHADOW 0x8B61\n#define GL_SAMPLER_2D_SHADOW 0x8B62\n#define GL_DELETE_STATUS 0x8B80\n#define GL_COMPILE_STATUS 0x8B81\n#define GL_LINK_STATUS 0x8B82\n#define GL_VALIDATE_STATUS 0x8B83\n#define GL_INFO_LOG_LENGTH 0x8B84\n#define GL_ATTACHED_SHADERS 0x8B85\n#define GL_ACTIVE_UNIFORMS 0x8B86\n#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87\n#define GL_SHADER_SOURCE_LENGTH 0x8B88\n#define GL_ACTIVE_ATTRIBUTES 0x8B89\n#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B\n#define GL_SHADING_LANGUAGE_VERSION 0x8B8C\n#define GL_CURRENT_PROGRAM 0x8B8D\n#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0\n#define GL_LOWER_LEFT 0x8CA1\n#define GL_UPPER_LEFT 0x8CA2\n#define GL_STENCIL_BACK_REF 0x8CA3\n#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4\n#define GL_STENCIL_BACK_WRITEMASK 0x8CA5\n#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643\n#define GL_POINT_SPRITE 0x8861\n#define GL_COORD_REPLACE 0x8862\n#define GL_MAX_TEXTURE_COORDS 0x8871\n#define GL_PIXEL_PACK_BUFFER 0x88EB\n#define GL_PIXEL_UNPACK_BUFFER 0x88EC\n#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED\n#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF\n#define GL_FLOAT_MAT2x3 0x8B65\n#define GL_FLOAT_MAT2x4 0x8B66\n#define GL_FLOAT_MAT3x2 0x8B67\n#define GL_FLOAT_MAT3x4 0x8B68\n#define GL_FLOAT_MAT4x2 0x8B69\n#define GL_FLOAT_MAT4x3 0x8B6A\n#define GL_SRGB 0x8C40\n#define GL_SRGB8 0x8C41\n#define GL_SRGB_ALPHA 0x8C42\n#define GL_SRGB8_ALPHA8 0x8C43\n#define GL_COMPRESSED_SRGB 0x8C48\n#define GL_COMPRESSED_SRGB_ALPHA 0x8C49\n#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F\n#define GL_SLUMINANCE_ALPHA 0x8C44\n#define GL_SLUMINANCE8_ALPHA8 0x8C45\n#define GL_SLUMINANCE 0x8C46\n#define GL_SLUMINANCE8 0x8C47\n#define GL_COMPRESSED_SLUMINANCE 0x8C4A\n#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B\n#define GL_COMPARE_REF_TO_TEXTURE 0x884E\n#define GL_CLIP_DISTANCE0 0x3000\n#define GL_CLIP_DISTANCE1 0x3001\n#define GL_CLIP_DISTANCE2 0x3002\n#define GL_CLIP_DISTANCE3 0x3003\n#define GL_CLIP_DISTANCE4 0x3004\n#define GL_CLIP_DISTANCE5 0x3005\n#define GL_CLIP_DISTANCE6 0x3006\n#define GL_CLIP_DISTANCE7 0x3007\n#define GL_MAX_CLIP_DISTANCES 0x0D32\n#define GL_MAJOR_VERSION 0x821B\n#define GL_MINOR_VERSION 0x821C\n#define GL_NUM_EXTENSIONS 0x821D\n#define GL_CONTEXT_FLAGS 0x821E\n#define GL_COMPRESSED_RED 0x8225\n#define GL_COMPRESSED_RG 0x8226\n#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001\n#define GL_RGBA32F 0x8814\n#define GL_RGB32F 0x8815\n#define GL_RGBA16F 0x881A\n#define GL_RGB16F 0x881B\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD\n#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF\n#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904\n#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905\n#define GL_CLAMP_READ_COLOR 0x891C\n#define GL_FIXED_ONLY 0x891D\n#define GL_MAX_VARYING_COMPONENTS 0x8B4B\n#define GL_TEXTURE_1D_ARRAY 0x8C18\n#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19\n#define GL_TEXTURE_2D_ARRAY 0x8C1A\n#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B\n#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C\n#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D\n#define GL_R11F_G11F_B10F 0x8C3A\n#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B\n#define GL_RGB9_E5 0x8C3D\n#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E\n#define GL_TEXTURE_SHARED_SIZE 0x8C3F\n#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80\n#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85\n#define GL_PRIMITIVES_GENERATED 0x8C87\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88\n#define GL_RASTERIZER_DISCARD 0x8C89\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B\n#define GL_INTERLEAVED_ATTRIBS 0x8C8C\n#define GL_SEPARATE_ATTRIBS 0x8C8D\n#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F\n#define GL_RGBA32UI 0x8D70\n#define GL_RGB32UI 0x8D71\n#define GL_RGBA16UI 0x8D76\n#define GL_RGB16UI 0x8D77\n#define GL_RGBA8UI 0x8D7C\n#define GL_RGB8UI 0x8D7D\n#define GL_RGBA32I 0x8D82\n#define GL_RGB32I 0x8D83\n#define GL_RGBA16I 0x8D88\n#define GL_RGB16I 0x8D89\n#define GL_RGBA8I 0x8D8E\n#define GL_RGB8I 0x8D8F\n#define GL_RED_INTEGER 0x8D94\n#define GL_GREEN_INTEGER 0x8D95\n#define GL_BLUE_INTEGER 0x8D96\n#define GL_RGB_INTEGER 0x8D98\n#define GL_RGBA_INTEGER 0x8D99\n#define GL_BGR_INTEGER 0x8D9A\n#define GL_BGRA_INTEGER 0x8D9B\n#define GL_SAMPLER_1D_ARRAY 0x8DC0\n#define GL_SAMPLER_2D_ARRAY 0x8DC1\n#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3\n#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4\n#define GL_SAMPLER_CUBE_SHADOW 0x8DC5\n#define GL_UNSIGNED_INT_VEC2 0x8DC6\n#define GL_UNSIGNED_INT_VEC3 0x8DC7\n#define GL_UNSIGNED_INT_VEC4 0x8DC8\n#define GL_INT_SAMPLER_1D 0x8DC9\n#define GL_INT_SAMPLER_2D 0x8DCA\n#define GL_INT_SAMPLER_3D 0x8DCB\n#define GL_INT_SAMPLER_CUBE 0x8DCC\n#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE\n#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF\n#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1\n#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2\n#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3\n#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4\n#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6\n#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7\n#define GL_QUERY_WAIT 0x8E13\n#define GL_QUERY_NO_WAIT 0x8E14\n#define GL_QUERY_BY_REGION_WAIT 0x8E15\n#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16\n#define GL_BUFFER_ACCESS_FLAGS 0x911F\n#define GL_BUFFER_MAP_LENGTH 0x9120\n#define GL_BUFFER_MAP_OFFSET 0x9121\n#define GL_DEPTH_COMPONENT32F 0x8CAC\n#define GL_DEPTH32F_STENCIL8 0x8CAD\n#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD\n#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506\n#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210\n#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211\n#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212\n#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213\n#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214\n#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215\n#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216\n#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217\n#define GL_FRAMEBUFFER_DEFAULT 0x8218\n#define GL_FRAMEBUFFER_UNDEFINED 0x8219\n#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A\n#define GL_MAX_RENDERBUFFER_SIZE 0x84E8\n#define GL_DEPTH_STENCIL 0x84F9\n#define GL_UNSIGNED_INT_24_8 0x84FA\n#define GL_DEPTH24_STENCIL8 0x88F0\n#define GL_TEXTURE_STENCIL_SIZE 0x88F1\n#define GL_TEXTURE_RED_TYPE 0x8C10\n#define GL_TEXTURE_GREEN_TYPE 0x8C11\n#define GL_TEXTURE_BLUE_TYPE 0x8C12\n#define GL_TEXTURE_ALPHA_TYPE 0x8C13\n#define GL_TEXTURE_DEPTH_TYPE 0x8C16\n#define GL_UNSIGNED_NORMALIZED 0x8C17\n#define GL_FRAMEBUFFER_BINDING 0x8CA6\n#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6\n#define GL_RENDERBUFFER_BINDING 0x8CA7\n#define GL_READ_FRAMEBUFFER 0x8CA8\n#define GL_DRAW_FRAMEBUFFER 0x8CA9\n#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA\n#define GL_RENDERBUFFER_SAMPLES 0x8CAB\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4\n#define GL_FRAMEBUFFER_COMPLETE 0x8CD5\n#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6\n#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7\n#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB\n#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC\n#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD\n#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF\n#define GL_COLOR_ATTACHMENT0 0x8CE0\n#define GL_COLOR_ATTACHMENT1 0x8CE1\n#define GL_COLOR_ATTACHMENT2 0x8CE2\n#define GL_COLOR_ATTACHMENT3 0x8CE3\n#define GL_COLOR_ATTACHMENT4 0x8CE4\n#define GL_COLOR_ATTACHMENT5 0x8CE5\n#define GL_COLOR_ATTACHMENT6 0x8CE6\n#define GL_COLOR_ATTACHMENT7 0x8CE7\n#define GL_COLOR_ATTACHMENT8 0x8CE8\n#define GL_COLOR_ATTACHMENT9 0x8CE9\n#define GL_COLOR_ATTACHMENT10 0x8CEA\n#define GL_COLOR_ATTACHMENT11 0x8CEB\n#define GL_COLOR_ATTACHMENT12 0x8CEC\n#define GL_COLOR_ATTACHMENT13 0x8CED\n#define GL_COLOR_ATTACHMENT14 0x8CEE\n#define GL_COLOR_ATTACHMENT15 0x8CEF\n#define GL_COLOR_ATTACHMENT16 0x8CF0\n#define GL_COLOR_ATTACHMENT17 0x8CF1\n#define GL_COLOR_ATTACHMENT18 0x8CF2\n#define GL_COLOR_ATTACHMENT19 0x8CF3\n#define GL_COLOR_ATTACHMENT20 0x8CF4\n#define GL_COLOR_ATTACHMENT21 0x8CF5\n#define GL_COLOR_ATTACHMENT22 0x8CF6\n#define GL_COLOR_ATTACHMENT23 0x8CF7\n#define GL_COLOR_ATTACHMENT24 0x8CF8\n#define GL_COLOR_ATTACHMENT25 0x8CF9\n#define GL_COLOR_ATTACHMENT26 0x8CFA\n#define GL_COLOR_ATTACHMENT27 0x8CFB\n#define GL_COLOR_ATTACHMENT28 0x8CFC\n#define GL_COLOR_ATTACHMENT29 0x8CFD\n#define GL_COLOR_ATTACHMENT30 0x8CFE\n#define GL_COLOR_ATTACHMENT31 0x8CFF\n#define GL_DEPTH_ATTACHMENT 0x8D00\n#define GL_STENCIL_ATTACHMENT 0x8D20\n#define GL_FRAMEBUFFER 0x8D40\n#define GL_RENDERBUFFER 0x8D41\n#define GL_RENDERBUFFER_WIDTH 0x8D42\n#define GL_RENDERBUFFER_HEIGHT 0x8D43\n#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44\n#define GL_STENCIL_INDEX1 0x8D46\n#define GL_STENCIL_INDEX4 0x8D47\n#define GL_STENCIL_INDEX8 0x8D48\n#define GL_STENCIL_INDEX16 0x8D49\n#define GL_RENDERBUFFER_RED_SIZE 0x8D50\n#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51\n#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52\n#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53\n#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54\n#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55\n#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56\n#define GL_MAX_SAMPLES 0x8D57\n#define GL_INDEX 0x8222\n#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14\n#define GL_TEXTURE_INTENSITY_TYPE 0x8C15\n#define GL_FRAMEBUFFER_SRGB 0x8DB9\n#define GL_HALF_FLOAT 0x140B\n#define GL_MAP_READ_BIT 0x0001\n#define GL_MAP_WRITE_BIT 0x0002\n#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004\n#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008\n#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010\n#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020\n#define GL_COMPRESSED_RED_RGTC1 0x8DBB\n#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC\n#define GL_COMPRESSED_RG_RGTC2 0x8DBD\n#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE\n#define GL_RG 0x8227\n#define GL_RG_INTEGER 0x8228\n#define GL_R8 0x8229\n#define GL_R16 0x822A\n#define GL_RG8 0x822B\n#define GL_RG16 0x822C\n#define GL_R16F 0x822D\n#define GL_R32F 0x822E\n#define GL_RG16F 0x822F\n#define GL_RG32F 0x8230\n#define GL_R8I 0x8231\n#define GL_R8UI 0x8232\n#define GL_R16I 0x8233\n#define GL_R16UI 0x8234\n#define GL_R32I 0x8235\n#define GL_R32UI 0x8236\n#define GL_RG8I 0x8237\n#define GL_RG8UI 0x8238\n#define GL_RG16I 0x8239\n#define GL_RG16UI 0x823A\n#define GL_RG32I 0x823B\n#define GL_RG32UI 0x823C\n#define GL_VERTEX_ARRAY_BINDING 0x85B5\n#define GL_CLAMP_VERTEX_COLOR 0x891A\n#define GL_CLAMP_FRAGMENT_COLOR 0x891B\n#define GL_ALPHA_INTEGER 0x8D97\n#define GL_SAMPLER_2D_RECT 0x8B63\n#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64\n#define GL_SAMPLER_BUFFER 0x8DC2\n#define GL_INT_SAMPLER_2D_RECT 0x8DCD\n#define GL_INT_SAMPLER_BUFFER 0x8DD0\n#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8\n#define GL_TEXTURE_BUFFER 0x8C2A\n#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B\n#define GL_TEXTURE_BINDING_BUFFER 0x8C2C\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D\n#define GL_TEXTURE_RECTANGLE 0x84F5\n#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6\n#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8\n#define GL_R8_SNORM 0x8F94\n#define GL_RG8_SNORM 0x8F95\n#define GL_RGB8_SNORM 0x8F96\n#define GL_RGBA8_SNORM 0x8F97\n#define GL_R16_SNORM 0x8F98\n#define GL_RG16_SNORM 0x8F99\n#define GL_RGB16_SNORM 0x8F9A\n#define GL_RGBA16_SNORM 0x8F9B\n#define GL_SIGNED_NORMALIZED 0x8F9C\n#define GL_PRIMITIVE_RESTART 0x8F9D\n#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E\n#define GL_COPY_READ_BUFFER 0x8F36\n#define GL_COPY_WRITE_BUFFER 0x8F37\n#define GL_UNIFORM_BUFFER 0x8A11\n#define GL_UNIFORM_BUFFER_BINDING 0x8A28\n#define GL_UNIFORM_BUFFER_START 0x8A29\n#define GL_UNIFORM_BUFFER_SIZE 0x8A2A\n#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B\n#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C\n#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D\n#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E\n#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F\n#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30\n#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31\n#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32\n#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33\n#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34\n#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35\n#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36\n#define GL_UNIFORM_TYPE 0x8A37\n#define GL_UNIFORM_SIZE 0x8A38\n#define GL_UNIFORM_NAME_LENGTH 0x8A39\n#define GL_UNIFORM_BLOCK_INDEX 0x8A3A\n#define GL_UNIFORM_OFFSET 0x8A3B\n#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C\n#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D\n#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E\n#define GL_UNIFORM_BLOCK_BINDING 0x8A3F\n#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40\n#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46\n#define GL_INVALID_INDEX 0xFFFFFFFF\n#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001\n#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002\n#define GL_LINES_ADJACENCY 0x000A\n#define GL_LINE_STRIP_ADJACENCY 0x000B\n#define GL_TRIANGLES_ADJACENCY 0x000C\n#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D\n#define GL_PROGRAM_POINT_SIZE 0x8642\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8\n#define GL_GEOMETRY_SHADER 0x8DD9\n#define GL_GEOMETRY_VERTICES_OUT 0x8916\n#define GL_GEOMETRY_INPUT_TYPE 0x8917\n#define GL_GEOMETRY_OUTPUT_TYPE 0x8918\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1\n#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122\n#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123\n#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124\n#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125\n#define GL_CONTEXT_PROFILE_MASK 0x9126\n#define GL_DEPTH_CLAMP 0x864F\n#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C\n#define GL_FIRST_VERTEX_CONVENTION 0x8E4D\n#define GL_LAST_VERTEX_CONVENTION 0x8E4E\n#define GL_PROVOKING_VERTEX 0x8E4F\n#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F\n#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111\n#define GL_OBJECT_TYPE 0x9112\n#define GL_SYNC_CONDITION 0x9113\n#define GL_SYNC_STATUS 0x9114\n#define GL_SYNC_FLAGS 0x9115\n#define GL_SYNC_FENCE 0x9116\n#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117\n#define GL_UNSIGNALED 0x9118\n#define GL_SIGNALED 0x9119\n#define GL_ALREADY_SIGNALED 0x911A\n#define GL_TIMEOUT_EXPIRED 0x911B\n#define GL_CONDITION_SATISFIED 0x911C\n#define GL_WAIT_FAILED 0x911D\n#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF\n#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001\n#define GL_SAMPLE_POSITION 0x8E50\n#define GL_SAMPLE_MASK 0x8E51\n#define GL_SAMPLE_MASK_VALUE 0x8E52\n#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59\n#define GL_TEXTURE_2D_MULTISAMPLE 0x9100\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101\n#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105\n#define GL_TEXTURE_SAMPLES 0x9106\n#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107\n#define GL_SAMPLER_2D_MULTISAMPLE 0x9108\n#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A\n#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B\n#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D\n#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E\n#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F\n#define GL_MAX_INTEGER_SAMPLES 0x9110\n#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE\n#define GL_SRC1_COLOR 0x88F9\n#define GL_ONE_MINUS_SRC1_COLOR 0x88FA\n#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB\n#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC\n#define GL_ANY_SAMPLES_PASSED 0x8C2F\n#define GL_SAMPLER_BINDING 0x8919\n#define GL_RGB10_A2UI 0x906F\n#define GL_TEXTURE_SWIZZLE_R 0x8E42\n#define GL_TEXTURE_SWIZZLE_G 0x8E43\n#define GL_TEXTURE_SWIZZLE_B 0x8E44\n#define GL_TEXTURE_SWIZZLE_A 0x8E45\n#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46\n#define GL_TIME_ELAPSED 0x88BF\n#define GL_TIMESTAMP 0x8E28\n#define GL_INT_2_10_10_10_REV 0x8D9F\n#define GL_SAMPLE_SHADING 0x8C36\n#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F\n#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B\n#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C\n#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D\n#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F\n#define GL_DRAW_INDIRECT_BUFFER 0x8F3F\n#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43\n#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F\n#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C\n#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D\n#define GL_MAX_VERTEX_STREAMS 0x8E71\n#define GL_DOUBLE_VEC2 0x8FFC\n#define GL_DOUBLE_VEC3 0x8FFD\n#define GL_DOUBLE_VEC4 0x8FFE\n#define GL_DOUBLE_MAT2 0x8F46\n#define GL_DOUBLE_MAT3 0x8F47\n#define GL_DOUBLE_MAT4 0x8F48\n#define GL_DOUBLE_MAT2x3 0x8F49\n#define GL_DOUBLE_MAT2x4 0x8F4A\n#define GL_DOUBLE_MAT3x2 0x8F4B\n#define GL_DOUBLE_MAT3x4 0x8F4C\n#define GL_DOUBLE_MAT4x2 0x8F4D\n#define GL_DOUBLE_MAT4x3 0x8F4E\n#define GL_ACTIVE_SUBROUTINES 0x8DE5\n#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47\n#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49\n#define GL_MAX_SUBROUTINES 0x8DE7\n#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8\n#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A\n#define GL_COMPATIBLE_SUBROUTINES 0x8E4B\n#define GL_PATCHES 0x000E\n#define GL_PATCH_VERTICES 0x8E72\n#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73\n#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74\n#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75\n#define GL_TESS_GEN_MODE 0x8E76\n#define GL_TESS_GEN_SPACING 0x8E77\n#define GL_TESS_GEN_VERTEX_ORDER 0x8E78\n#define GL_TESS_GEN_POINT_MODE 0x8E79\n#define GL_ISOLINES 0x8E7A\n#define GL_FRACTIONAL_ODD 0x8E7B\n#define GL_FRACTIONAL_EVEN 0x8E7C\n#define GL_MAX_PATCH_VERTICES 0x8E7D\n#define GL_MAX_TESS_GEN_LEVEL 0x8E7E\n#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F\n#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80\n#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81\n#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82\n#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83\n#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84\n#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85\n#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86\n#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89\n#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A\n#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C\n#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D\n#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E\n#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1\n#define GL_TESS_EVALUATION_SHADER 0x8E87\n#define GL_TESS_CONTROL_SHADER 0x8E88\n#define GL_TRANSFORM_FEEDBACK 0x8E22\n#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23\n#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24\n#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25\n#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70\n#define GL_FIXED 0x140C\n#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A\n#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B\n#define GL_LOW_FLOAT 0x8DF0\n#define GL_MEDIUM_FLOAT 0x8DF1\n#define GL_HIGH_FLOAT 0x8DF2\n#define GL_LOW_INT 0x8DF3\n#define GL_MEDIUM_INT 0x8DF4\n#define GL_HIGH_INT 0x8DF5\n#define GL_SHADER_COMPILER 0x8DFA\n#define GL_SHADER_BINARY_FORMATS 0x8DF8\n#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9\n#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB\n#define GL_MAX_VARYING_VECTORS 0x8DFC\n#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD\n#define GL_RGB565 0x8D62\n#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257\n#define GL_PROGRAM_BINARY_LENGTH 0x8741\n#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE\n#define GL_PROGRAM_BINARY_FORMATS 0x87FF\n#define GL_VERTEX_SHADER_BIT 0x00000001\n#define GL_FRAGMENT_SHADER_BIT 0x00000002\n#define GL_GEOMETRY_SHADER_BIT 0x00000004\n#define GL_TESS_CONTROL_SHADER_BIT 0x00000008\n#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010\n#define GL_ALL_SHADER_BITS 0xFFFFFFFF\n#define GL_PROGRAM_SEPARABLE 0x8258\n#define GL_ACTIVE_PROGRAM 0x8259\n#define GL_PROGRAM_PIPELINE_BINDING 0x825A\n#define GL_MAX_VIEWPORTS 0x825B\n#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C\n#define GL_VIEWPORT_BOUNDS_RANGE 0x825D\n#define GL_LAYER_PROVOKING_VERTEX 0x825E\n#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F\n#define GL_UNDEFINED_VERTEX 0x8260\n#define GL_COPY_READ_BUFFER_BINDING 0x8F36\n#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37\n#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24\n#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23\n#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127\n#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128\n#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129\n#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A\n#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B\n#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C\n#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D\n#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E\n#define GL_NUM_SAMPLE_COUNTS 0x9380\n#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC\n#define GL_ATOMIC_COUNTER_BUFFER 0x92C0\n#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1\n#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2\n#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3\n#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB\n#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0\n#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1\n#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6\n#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC\n#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9\n#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA\n#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB\n#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001\n#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002\n#define GL_UNIFORM_BARRIER_BIT 0x00000004\n#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008\n#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020\n#define GL_COMMAND_BARRIER_BIT 0x00000040\n#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080\n#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100\n#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200\n#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400\n#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800\n#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000\n#define GL_ALL_BARRIER_BITS 0xFFFFFFFF\n#define GL_MAX_IMAGE_UNITS 0x8F38\n#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39\n#define GL_IMAGE_BINDING_NAME 0x8F3A\n#define GL_IMAGE_BINDING_LEVEL 0x8F3B\n#define GL_IMAGE_BINDING_LAYERED 0x8F3C\n#define GL_IMAGE_BINDING_LAYER 0x8F3D\n#define GL_IMAGE_BINDING_ACCESS 0x8F3E\n#define GL_IMAGE_1D 0x904C\n#define GL_IMAGE_2D 0x904D\n#define GL_IMAGE_3D 0x904E\n#define GL_IMAGE_2D_RECT 0x904F\n#define GL_IMAGE_CUBE 0x9050\n#define GL_IMAGE_BUFFER 0x9051\n#define GL_IMAGE_1D_ARRAY 0x9052\n#define GL_IMAGE_2D_ARRAY 0x9053\n#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054\n#define GL_IMAGE_2D_MULTISAMPLE 0x9055\n#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056\n#define GL_INT_IMAGE_1D 0x9057\n#define GL_INT_IMAGE_2D 0x9058\n#define GL_INT_IMAGE_3D 0x9059\n#define GL_INT_IMAGE_2D_RECT 0x905A\n#define GL_INT_IMAGE_CUBE 0x905B\n#define GL_INT_IMAGE_BUFFER 0x905C\n#define GL_INT_IMAGE_1D_ARRAY 0x905D\n#define GL_INT_IMAGE_2D_ARRAY 0x905E\n#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F\n#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060\n#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061\n#define GL_UNSIGNED_INT_IMAGE_1D 0x9062\n#define GL_UNSIGNED_INT_IMAGE_2D 0x9063\n#define GL_UNSIGNED_INT_IMAGE_3D 0x9064\n#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065\n#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066\n#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067\n#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068\n#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069\n#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C\n#define GL_MAX_IMAGE_SAMPLES 0x906D\n#define GL_IMAGE_BINDING_FORMAT 0x906E\n#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9\n#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA\n#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB\n#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC\n#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD\n#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE\n#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF\n#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C\n#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D\n#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E\n#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F\n#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F\n#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9\n#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E\n#define GL_COMPRESSED_RGB8_ETC2 0x9274\n#define GL_COMPRESSED_SRGB8_ETC2 0x9275\n#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276\n#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277\n#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278\n#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279\n#define GL_COMPRESSED_R11_EAC 0x9270\n#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271\n#define GL_COMPRESSED_RG11_EAC 0x9272\n#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273\n#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69\n#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A\n#define GL_MAX_ELEMENT_INDEX 0x8D6B\n#define GL_COMPUTE_SHADER 0x91B9\n#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB\n#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC\n#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD\n#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262\n#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263\n#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264\n#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265\n#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266\n#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB\n#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE\n#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF\n#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED\n#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE\n#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF\n#define GL_COMPUTE_SHADER_BIT 0x00000020\n#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242\n#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243\n#define GL_DEBUG_CALLBACK_FUNCTION 0x8244\n#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245\n#define GL_DEBUG_SOURCE_API 0x8246\n#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247\n#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248\n#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249\n#define GL_DEBUG_SOURCE_APPLICATION 0x824A\n#define GL_DEBUG_SOURCE_OTHER 0x824B\n#define GL_DEBUG_TYPE_ERROR 0x824C\n#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D\n#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E\n#define GL_DEBUG_TYPE_PORTABILITY 0x824F\n#define GL_DEBUG_TYPE_PERFORMANCE 0x8250\n#define GL_DEBUG_TYPE_OTHER 0x8251\n#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143\n#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144\n#define GL_DEBUG_LOGGED_MESSAGES 0x9145\n#define GL_DEBUG_SEVERITY_HIGH 0x9146\n#define GL_DEBUG_SEVERITY_MEDIUM 0x9147\n#define GL_DEBUG_SEVERITY_LOW 0x9148\n#define GL_DEBUG_TYPE_MARKER 0x8268\n#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269\n#define GL_DEBUG_TYPE_POP_GROUP 0x826A\n#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B\n#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C\n#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D\n#define GL_BUFFER 0x82E0\n#define GL_SHADER 0x82E1\n#define GL_PROGRAM 0x82E2\n#define GL_QUERY 0x82E3\n#define GL_PROGRAM_PIPELINE 0x82E4\n#define GL_SAMPLER 0x82E6\n#define GL_MAX_LABEL_LENGTH 0x82E8\n#define GL_DEBUG_OUTPUT 0x92E0\n#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002\n#define GL_MAX_UNIFORM_LOCATIONS 0x826E\n#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310\n#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311\n#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312\n#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313\n#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314\n#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315\n#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316\n#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317\n#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318\n#define GL_INTERNALFORMAT_SUPPORTED 0x826F\n#define GL_INTERNALFORMAT_PREFERRED 0x8270\n#define GL_INTERNALFORMAT_RED_SIZE 0x8271\n#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272\n#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273\n#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274\n#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275\n#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276\n#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277\n#define GL_INTERNALFORMAT_RED_TYPE 0x8278\n#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279\n#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A\n#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B\n#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C\n#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D\n#define GL_MAX_WIDTH 0x827E\n#define GL_MAX_HEIGHT 0x827F\n#define GL_MAX_DEPTH 0x8280\n#define GL_MAX_LAYERS 0x8281\n#define GL_MAX_COMBINED_DIMENSIONS 0x8282\n#define GL_COLOR_COMPONENTS 0x8283\n#define GL_DEPTH_COMPONENTS 0x8284\n#define GL_STENCIL_COMPONENTS 0x8285\n#define GL_COLOR_RENDERABLE 0x8286\n#define GL_DEPTH_RENDERABLE 0x8287\n#define GL_STENCIL_RENDERABLE 0x8288\n#define GL_FRAMEBUFFER_RENDERABLE 0x8289\n#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A\n#define GL_FRAMEBUFFER_BLEND 0x828B\n#define GL_READ_PIXELS 0x828C\n#define GL_READ_PIXELS_FORMAT 0x828D\n#define GL_READ_PIXELS_TYPE 0x828E\n#define GL_TEXTURE_IMAGE_FORMAT 0x828F\n#define GL_TEXTURE_IMAGE_TYPE 0x8290\n#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291\n#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292\n#define GL_MIPMAP 0x8293\n#define GL_MANUAL_GENERATE_MIPMAP 0x8294\n#define GL_AUTO_GENERATE_MIPMAP 0x8295\n#define GL_COLOR_ENCODING 0x8296\n#define GL_SRGB_READ 0x8297\n#define GL_SRGB_WRITE 0x8298\n#define GL_FILTER 0x829A\n#define GL_VERTEX_TEXTURE 0x829B\n#define GL_TESS_CONTROL_TEXTURE 0x829C\n#define GL_TESS_EVALUATION_TEXTURE 0x829D\n#define GL_GEOMETRY_TEXTURE 0x829E\n#define GL_FRAGMENT_TEXTURE 0x829F\n#define GL_COMPUTE_TEXTURE 0x82A0\n#define GL_TEXTURE_SHADOW 0x82A1\n#define GL_TEXTURE_GATHER 0x82A2\n#define GL_TEXTURE_GATHER_SHADOW 0x82A3\n#define GL_SHADER_IMAGE_LOAD 0x82A4\n#define GL_SHADER_IMAGE_STORE 0x82A5\n#define GL_SHADER_IMAGE_ATOMIC 0x82A6\n#define GL_IMAGE_TEXEL_SIZE 0x82A7\n#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8\n#define GL_IMAGE_PIXEL_FORMAT 0x82A9\n#define GL_IMAGE_PIXEL_TYPE 0x82AA\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF\n#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1\n#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2\n#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3\n#define GL_CLEAR_BUFFER 0x82B4\n#define GL_TEXTURE_VIEW 0x82B5\n#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6\n#define GL_FULL_SUPPORT 0x82B7\n#define GL_CAVEAT_SUPPORT 0x82B8\n#define GL_IMAGE_CLASS_4_X_32 0x82B9\n#define GL_IMAGE_CLASS_2_X_32 0x82BA\n#define GL_IMAGE_CLASS_1_X_32 0x82BB\n#define GL_IMAGE_CLASS_4_X_16 0x82BC\n#define GL_IMAGE_CLASS_2_X_16 0x82BD\n#define GL_IMAGE_CLASS_1_X_16 0x82BE\n#define GL_IMAGE_CLASS_4_X_8 0x82BF\n#define GL_IMAGE_CLASS_2_X_8 0x82C0\n#define GL_IMAGE_CLASS_1_X_8 0x82C1\n#define GL_IMAGE_CLASS_11_11_10 0x82C2\n#define GL_IMAGE_CLASS_10_10_10_2 0x82C3\n#define GL_VIEW_CLASS_128_BITS 0x82C4\n#define GL_VIEW_CLASS_96_BITS 0x82C5\n#define GL_VIEW_CLASS_64_BITS 0x82C6\n#define GL_VIEW_CLASS_48_BITS 0x82C7\n#define GL_VIEW_CLASS_32_BITS 0x82C8\n#define GL_VIEW_CLASS_24_BITS 0x82C9\n#define GL_VIEW_CLASS_16_BITS 0x82CA\n#define GL_VIEW_CLASS_8_BITS 0x82CB\n#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC\n#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD\n#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE\n#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF\n#define GL_VIEW_CLASS_RGTC1_RED 0x82D0\n#define GL_VIEW_CLASS_RGTC2_RG 0x82D1\n#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2\n#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3\n#define GL_UNIFORM 0x92E1\n#define GL_UNIFORM_BLOCK 0x92E2\n#define GL_PROGRAM_INPUT 0x92E3\n#define GL_PROGRAM_OUTPUT 0x92E4\n#define GL_BUFFER_VARIABLE 0x92E5\n#define GL_SHADER_STORAGE_BLOCK 0x92E6\n#define GL_VERTEX_SUBROUTINE 0x92E8\n#define GL_TESS_CONTROL_SUBROUTINE 0x92E9\n#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA\n#define GL_GEOMETRY_SUBROUTINE 0x92EB\n#define GL_FRAGMENT_SUBROUTINE 0x92EC\n#define GL_COMPUTE_SUBROUTINE 0x92ED\n#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE\n#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF\n#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0\n#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1\n#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2\n#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3\n#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4\n#define GL_ACTIVE_RESOURCES 0x92F5\n#define GL_MAX_NAME_LENGTH 0x92F6\n#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7\n#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8\n#define GL_NAME_LENGTH 0x92F9\n#define GL_TYPE 0x92FA\n#define GL_ARRAY_SIZE 0x92FB\n#define GL_OFFSET 0x92FC\n#define GL_BLOCK_INDEX 0x92FD\n#define GL_ARRAY_STRIDE 0x92FE\n#define GL_MATRIX_STRIDE 0x92FF\n#define GL_IS_ROW_MAJOR 0x9300\n#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301\n#define GL_BUFFER_BINDING 0x9302\n#define GL_BUFFER_DATA_SIZE 0x9303\n#define GL_NUM_ACTIVE_VARIABLES 0x9304\n#define GL_ACTIVE_VARIABLES 0x9305\n#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306\n#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307\n#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308\n#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309\n#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A\n#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B\n#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C\n#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D\n#define GL_LOCATION 0x930E\n#define GL_LOCATION_INDEX 0x930F\n#define GL_IS_PER_PATCH 0x92E7\n#define GL_SHADER_STORAGE_BUFFER 0x90D2\n#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3\n#define GL_SHADER_STORAGE_BUFFER_START 0x90D4\n#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5\n#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6\n#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7\n#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8\n#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9\n#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA\n#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB\n#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC\n#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD\n#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE\n#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF\n#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000\n#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39\n#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA\n#define GL_TEXTURE_BUFFER_OFFSET 0x919D\n#define GL_TEXTURE_BUFFER_SIZE 0x919E\n#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F\n#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB\n#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC\n#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD\n#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE\n#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF\n#define GL_VERTEX_ATTRIB_BINDING 0x82D4\n#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5\n#define GL_VERTEX_BINDING_DIVISOR 0x82D6\n#define GL_VERTEX_BINDING_OFFSET 0x82D7\n#define GL_VERTEX_BINDING_STRIDE 0x82D8\n#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9\n#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA\n#define GL_VERTEX_BINDING_BUFFER 0x8F4F\n#define GL_DISPLAY_LIST 0x82E7\n#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5\n#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221\n#define GL_TEXTURE_BUFFER_BINDING 0x8C2A\n#define GL_MAP_PERSISTENT_BIT 0x0040\n#define GL_MAP_COHERENT_BIT 0x0080\n#define GL_DYNAMIC_STORAGE_BIT 0x0100\n#define GL_CLIENT_STORAGE_BIT 0x0200\n#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000\n#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F\n#define GL_BUFFER_STORAGE_FLAGS 0x8220\n#define GL_CLEAR_TEXTURE 0x9365\n#define GL_LOCATION_COMPONENT 0x934A\n#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B\n#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C\n#define GL_QUERY_BUFFER 0x9192\n#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000\n#define GL_QUERY_BUFFER_BINDING 0x9193\n#define GL_QUERY_RESULT_NO_WAIT 0x9194\n#define GL_MIRROR_CLAMP_TO_EDGE 0x8743\n#define GL_CONTEXT_LOST 0x0507\n#define GL_NEGATIVE_ONE_TO_ONE 0x935E\n#define GL_ZERO_TO_ONE 0x935F\n#define GL_CLIP_ORIGIN 0x935C\n#define GL_CLIP_DEPTH_MODE 0x935D\n#define GL_QUERY_WAIT_INVERTED 0x8E17\n#define GL_QUERY_NO_WAIT_INVERTED 0x8E18\n#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19\n#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A\n#define GL_MAX_CULL_DISTANCES 0x82F9\n#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA\n#define GL_TEXTURE_TARGET 0x1006\n#define GL_QUERY_TARGET 0x82EA\n#define GL_GUILTY_CONTEXT_RESET 0x8253\n#define GL_INNOCENT_CONTEXT_RESET 0x8254\n#define GL_UNKNOWN_CONTEXT_RESET 0x8255\n#define GL_RESET_NOTIFICATION_STRATEGY 0x8256\n#define GL_LOSE_CONTEXT_ON_RESET 0x8252\n#define GL_NO_RESET_NOTIFICATION 0x8261\n#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004\n#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB\n#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC\n#ifndef GL_VERSION_1_0\n#define GL_VERSION_1_0 1\nGLAPI int GLAD_GL_VERSION_1_0;\ntypedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode);\nGLAPI PFNGLCULLFACEPROC glad_glCullFace;\n#define glCullFace glad_glCullFace\ntypedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode);\nGLAPI PFNGLFRONTFACEPROC glad_glFrontFace;\n#define glFrontFace glad_glFrontFace\ntypedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode);\nGLAPI PFNGLHINTPROC glad_glHint;\n#define glHint glad_glHint\ntypedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width);\nGLAPI PFNGLLINEWIDTHPROC glad_glLineWidth;\n#define glLineWidth glad_glLineWidth\ntypedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size);\nGLAPI PFNGLPOINTSIZEPROC glad_glPointSize;\n#define glPointSize glad_glPointSize\ntypedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode);\nGLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode;\n#define glPolygonMode glad_glPolygonMode\ntypedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI PFNGLSCISSORPROC glad_glScissor;\n#define glScissor glad_glScissor\ntypedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param);\nGLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf;\n#define glTexParameterf glad_glTexParameterf\ntypedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params);\nGLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;\n#define glTexParameterfv glad_glTexParameterfv\ntypedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param);\nGLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri;\n#define glTexParameteri glad_glTexParameteri\ntypedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params);\nGLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;\n#define glTexParameteriv glad_glTexParameteriv\ntypedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);\nGLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D;\n#define glTexImage1D glad_glTexImage1D\ntypedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);\nGLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D;\n#define glTexImage2D glad_glTexImage2D\ntypedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf);\nGLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer;\n#define glDrawBuffer glad_glDrawBuffer\ntypedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask);\nGLAPI PFNGLCLEARPROC glad_glClear;\n#define glClear glad_glClear\ntypedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI PFNGLCLEARCOLORPROC glad_glClearColor;\n#define glClearColor glad_glClearColor\ntypedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s);\nGLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil;\n#define glClearStencil glad_glClearStencil\ntypedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth);\nGLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth;\n#define glClearDepth glad_glClearDepth\ntypedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask);\nGLAPI PFNGLSTENCILMASKPROC glad_glStencilMask;\n#define glStencilMask glad_glStencilMask\ntypedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\nGLAPI PFNGLCOLORMASKPROC glad_glColorMask;\n#define glColorMask glad_glColorMask\ntypedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag);\nGLAPI PFNGLDEPTHMASKPROC glad_glDepthMask;\n#define glDepthMask glad_glDepthMask\ntypedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap);\nGLAPI PFNGLDISABLEPROC glad_glDisable;\n#define glDisable glad_glDisable\ntypedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap);\nGLAPI PFNGLENABLEPROC glad_glEnable;\n#define glEnable glad_glEnable\ntypedef void (APIENTRYP PFNGLFINISHPROC)();\nGLAPI PFNGLFINISHPROC glad_glFinish;\n#define glFinish glad_glFinish\ntypedef void (APIENTRYP PFNGLFLUSHPROC)();\nGLAPI PFNGLFLUSHPROC glad_glFlush;\n#define glFlush glad_glFlush\ntypedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor);\nGLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc;\n#define glBlendFunc glad_glBlendFunc\ntypedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode);\nGLAPI PFNGLLOGICOPPROC glad_glLogicOp;\n#define glLogicOp glad_glLogicOp\ntypedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask);\nGLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc;\n#define glStencilFunc glad_glStencilFunc\ntypedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass);\nGLAPI PFNGLSTENCILOPPROC glad_glStencilOp;\n#define glStencilOp glad_glStencilOp\ntypedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func);\nGLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc;\n#define glDepthFunc glad_glDepthFunc\ntypedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param);\nGLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref;\n#define glPixelStoref glad_glPixelStoref\ntypedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param);\nGLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei;\n#define glPixelStorei glad_glPixelStorei\ntypedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src);\nGLAPI PFNGLREADBUFFERPROC glad_glReadBuffer;\n#define glReadBuffer glad_glReadBuffer\ntypedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);\nGLAPI PFNGLREADPIXELSPROC glad_glReadPixels;\n#define glReadPixels glad_glReadPixels\ntypedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data);\nGLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv;\n#define glGetBooleanv glad_glGetBooleanv\ntypedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data);\nGLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev;\n#define glGetDoublev glad_glGetDoublev\ntypedef GLenum (APIENTRYP PFNGLGETERRORPROC)();\nGLAPI PFNGLGETERRORPROC glad_glGetError;\n#define glGetError glad_glGetError\ntypedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data);\nGLAPI PFNGLGETFLOATVPROC glad_glGetFloatv;\n#define glGetFloatv glad_glGetFloatv\ntypedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data);\nGLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv;\n#define glGetIntegerv glad_glGetIntegerv\ntypedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name);\nGLAPI PFNGLGETSTRINGPROC glad_glGetString;\n#define glGetString glad_glGetString\ntypedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels);\nGLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage;\n#define glGetTexImage glad_glGetTexImage\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params);\nGLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;\n#define glGetTexParameterfv glad_glGetTexParameterfv\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params);\nGLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;\n#define glGetTexParameteriv glad_glGetTexParameteriv\ntypedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params);\nGLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv;\n#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv\ntypedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params);\nGLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;\n#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv\ntypedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap);\nGLAPI PFNGLISENABLEDPROC glad_glIsEnabled;\n#define glIsEnabled glad_glIsEnabled\ntypedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble near, GLdouble far);\nGLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange;\n#define glDepthRange glad_glDepthRange\ntypedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI PFNGLVIEWPORTPROC glad_glViewport;\n#define glViewport glad_glViewport\ntypedef void (APIENTRYP PFNGLNEWLISTPROC)(GLuint list, GLenum mode);\nGLAPI PFNGLNEWLISTPROC glad_glNewList;\n#define glNewList glad_glNewList\ntypedef void (APIENTRYP PFNGLENDLISTPROC)();\nGLAPI PFNGLENDLISTPROC glad_glEndList;\n#define glEndList glad_glEndList\ntypedef void (APIENTRYP PFNGLCALLLISTPROC)(GLuint list);\nGLAPI PFNGLCALLLISTPROC glad_glCallList;\n#define glCallList glad_glCallList\ntypedef void (APIENTRYP PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void *lists);\nGLAPI PFNGLCALLLISTSPROC glad_glCallLists;\n#define glCallLists glad_glCallLists\ntypedef void (APIENTRYP PFNGLDELETELISTSPROC)(GLuint list, GLsizei range);\nGLAPI PFNGLDELETELISTSPROC glad_glDeleteLists;\n#define glDeleteLists glad_glDeleteLists\ntypedef GLuint (APIENTRYP PFNGLGENLISTSPROC)(GLsizei range);\nGLAPI PFNGLGENLISTSPROC glad_glGenLists;\n#define glGenLists glad_glGenLists\ntypedef void (APIENTRYP PFNGLLISTBASEPROC)(GLuint base);\nGLAPI PFNGLLISTBASEPROC glad_glListBase;\n#define glListBase glad_glListBase\ntypedef void (APIENTRYP PFNGLBEGINPROC)(GLenum mode);\nGLAPI PFNGLBEGINPROC glad_glBegin;\n#define glBegin glad_glBegin\ntypedef void (APIENTRYP PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);\nGLAPI PFNGLBITMAPPROC glad_glBitmap;\n#define glBitmap glad_glBitmap\ntypedef void (APIENTRYP PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue);\nGLAPI PFNGLCOLOR3BPROC glad_glColor3b;\n#define glColor3b glad_glColor3b\ntypedef void (APIENTRYP PFNGLCOLOR3BVPROC)(const GLbyte *v);\nGLAPI PFNGLCOLOR3BVPROC glad_glColor3bv;\n#define glColor3bv glad_glColor3bv\ntypedef void (APIENTRYP PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue);\nGLAPI PFNGLCOLOR3DPROC glad_glColor3d;\n#define glColor3d glad_glColor3d\ntypedef void (APIENTRYP PFNGLCOLOR3DVPROC)(const GLdouble *v);\nGLAPI PFNGLCOLOR3DVPROC glad_glColor3dv;\n#define glColor3dv glad_glColor3dv\ntypedef void (APIENTRYP PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue);\nGLAPI PFNGLCOLOR3FPROC glad_glColor3f;\n#define glColor3f glad_glColor3f\ntypedef void (APIENTRYP PFNGLCOLOR3FVPROC)(const GLfloat *v);\nGLAPI PFNGLCOLOR3FVPROC glad_glColor3fv;\n#define glColor3fv glad_glColor3fv\ntypedef void (APIENTRYP PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue);\nGLAPI PFNGLCOLOR3IPROC glad_glColor3i;\n#define glColor3i glad_glColor3i\ntypedef void (APIENTRYP PFNGLCOLOR3IVPROC)(const GLint *v);\nGLAPI PFNGLCOLOR3IVPROC glad_glColor3iv;\n#define glColor3iv glad_glColor3iv\ntypedef void (APIENTRYP PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue);\nGLAPI PFNGLCOLOR3SPROC glad_glColor3s;\n#define glColor3s glad_glColor3s\ntypedef void (APIENTRYP PFNGLCOLOR3SVPROC)(const GLshort *v);\nGLAPI PFNGLCOLOR3SVPROC glad_glColor3sv;\n#define glColor3sv glad_glColor3sv\ntypedef void (APIENTRYP PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue);\nGLAPI PFNGLCOLOR3UBPROC glad_glColor3ub;\n#define glColor3ub glad_glColor3ub\ntypedef void (APIENTRYP PFNGLCOLOR3UBVPROC)(const GLubyte *v);\nGLAPI PFNGLCOLOR3UBVPROC glad_glColor3ubv;\n#define glColor3ubv glad_glColor3ubv\ntypedef void (APIENTRYP PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue);\nGLAPI PFNGLCOLOR3UIPROC glad_glColor3ui;\n#define glColor3ui glad_glColor3ui\ntypedef void (APIENTRYP PFNGLCOLOR3UIVPROC)(const GLuint *v);\nGLAPI PFNGLCOLOR3UIVPROC glad_glColor3uiv;\n#define glColor3uiv glad_glColor3uiv\ntypedef void (APIENTRYP PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue);\nGLAPI PFNGLCOLOR3USPROC glad_glColor3us;\n#define glColor3us glad_glColor3us\ntypedef void (APIENTRYP PFNGLCOLOR3USVPROC)(const GLushort *v);\nGLAPI PFNGLCOLOR3USVPROC glad_glColor3usv;\n#define glColor3usv glad_glColor3usv\ntypedef void (APIENTRYP PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);\nGLAPI PFNGLCOLOR4BPROC glad_glColor4b;\n#define glColor4b glad_glColor4b\ntypedef void (APIENTRYP PFNGLCOLOR4BVPROC)(const GLbyte *v);\nGLAPI PFNGLCOLOR4BVPROC glad_glColor4bv;\n#define glColor4bv glad_glColor4bv\ntypedef void (APIENTRYP PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);\nGLAPI PFNGLCOLOR4DPROC glad_glColor4d;\n#define glColor4d glad_glColor4d\ntypedef void (APIENTRYP PFNGLCOLOR4DVPROC)(const GLdouble *v);\nGLAPI PFNGLCOLOR4DVPROC glad_glColor4dv;\n#define glColor4dv glad_glColor4dv\ntypedef void (APIENTRYP PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI PFNGLCOLOR4FPROC glad_glColor4f;\n#define glColor4f glad_glColor4f\ntypedef void (APIENTRYP PFNGLCOLOR4FVPROC)(const GLfloat *v);\nGLAPI PFNGLCOLOR4FVPROC glad_glColor4fv;\n#define glColor4fv glad_glColor4fv\ntypedef void (APIENTRYP PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha);\nGLAPI PFNGLCOLOR4IPROC glad_glColor4i;\n#define glColor4i glad_glColor4i\ntypedef void (APIENTRYP PFNGLCOLOR4IVPROC)(const GLint *v);\nGLAPI PFNGLCOLOR4IVPROC glad_glColor4iv;\n#define glColor4iv glad_glColor4iv\ntypedef void (APIENTRYP PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha);\nGLAPI PFNGLCOLOR4SPROC glad_glColor4s;\n#define glColor4s glad_glColor4s\ntypedef void (APIENTRYP PFNGLCOLOR4SVPROC)(const GLshort *v);\nGLAPI PFNGLCOLOR4SVPROC glad_glColor4sv;\n#define glColor4sv glad_glColor4sv\ntypedef void (APIENTRYP PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);\nGLAPI PFNGLCOLOR4UBPROC glad_glColor4ub;\n#define glColor4ub glad_glColor4ub\ntypedef void (APIENTRYP PFNGLCOLOR4UBVPROC)(const GLubyte *v);\nGLAPI PFNGLCOLOR4UBVPROC glad_glColor4ubv;\n#define glColor4ubv glad_glColor4ubv\ntypedef void (APIENTRYP PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha);\nGLAPI PFNGLCOLOR4UIPROC glad_glColor4ui;\n#define glColor4ui glad_glColor4ui\ntypedef void (APIENTRYP PFNGLCOLOR4UIVPROC)(const GLuint *v);\nGLAPI PFNGLCOLOR4UIVPROC glad_glColor4uiv;\n#define glColor4uiv glad_glColor4uiv\ntypedef void (APIENTRYP PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha);\nGLAPI PFNGLCOLOR4USPROC glad_glColor4us;\n#define glColor4us glad_glColor4us\ntypedef void (APIENTRYP PFNGLCOLOR4USVPROC)(const GLushort *v);\nGLAPI PFNGLCOLOR4USVPROC glad_glColor4usv;\n#define glColor4usv glad_glColor4usv\ntypedef void (APIENTRYP PFNGLEDGEFLAGPROC)(GLboolean flag);\nGLAPI PFNGLEDGEFLAGPROC glad_glEdgeFlag;\n#define glEdgeFlag glad_glEdgeFlag\ntypedef void (APIENTRYP PFNGLEDGEFLAGVPROC)(const GLboolean *flag);\nGLAPI PFNGLEDGEFLAGVPROC glad_glEdgeFlagv;\n#define glEdgeFlagv glad_glEdgeFlagv\ntypedef void (APIENTRYP PFNGLENDPROC)();\nGLAPI PFNGLENDPROC glad_glEnd;\n#define glEnd glad_glEnd\ntypedef void (APIENTRYP PFNGLINDEXDPROC)(GLdouble c);\nGLAPI PFNGLINDEXDPROC glad_glIndexd;\n#define glIndexd glad_glIndexd\ntypedef void (APIENTRYP PFNGLINDEXDVPROC)(const GLdouble *c);\nGLAPI PFNGLINDEXDVPROC glad_glIndexdv;\n#define glIndexdv glad_glIndexdv\ntypedef void (APIENTRYP PFNGLINDEXFPROC)(GLfloat c);\nGLAPI PFNGLINDEXFPROC glad_glIndexf;\n#define glIndexf glad_glIndexf\ntypedef void (APIENTRYP PFNGLINDEXFVPROC)(const GLfloat *c);\nGLAPI PFNGLINDEXFVPROC glad_glIndexfv;\n#define glIndexfv glad_glIndexfv\ntypedef void (APIENTRYP PFNGLINDEXIPROC)(GLint c);\nGLAPI PFNGLINDEXIPROC glad_glIndexi;\n#define glIndexi glad_glIndexi\ntypedef void (APIENTRYP PFNGLINDEXIVPROC)(const GLint *c);\nGLAPI PFNGLINDEXIVPROC glad_glIndexiv;\n#define glIndexiv glad_glIndexiv\ntypedef void (APIENTRYP PFNGLINDEXSPROC)(GLshort c);\nGLAPI PFNGLINDEXSPROC glad_glIndexs;\n#define glIndexs glad_glIndexs\ntypedef void (APIENTRYP PFNGLINDEXSVPROC)(const GLshort *c);\nGLAPI PFNGLINDEXSVPROC glad_glIndexsv;\n#define glIndexsv glad_glIndexsv\ntypedef void (APIENTRYP PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz);\nGLAPI PFNGLNORMAL3BPROC glad_glNormal3b;\n#define glNormal3b glad_glNormal3b\ntypedef void (APIENTRYP PFNGLNORMAL3BVPROC)(const GLbyte *v);\nGLAPI PFNGLNORMAL3BVPROC glad_glNormal3bv;\n#define glNormal3bv glad_glNormal3bv\ntypedef void (APIENTRYP PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz);\nGLAPI PFNGLNORMAL3DPROC glad_glNormal3d;\n#define glNormal3d glad_glNormal3d\ntypedef void (APIENTRYP PFNGLNORMAL3DVPROC)(const GLdouble *v);\nGLAPI PFNGLNORMAL3DVPROC glad_glNormal3dv;\n#define glNormal3dv glad_glNormal3dv\ntypedef void (APIENTRYP PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz);\nGLAPI PFNGLNORMAL3FPROC glad_glNormal3f;\n#define glNormal3f glad_glNormal3f\ntypedef void (APIENTRYP PFNGLNORMAL3FVPROC)(const GLfloat *v);\nGLAPI PFNGLNORMAL3FVPROC glad_glNormal3fv;\n#define glNormal3fv glad_glNormal3fv\ntypedef void (APIENTRYP PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz);\nGLAPI PFNGLNORMAL3IPROC glad_glNormal3i;\n#define glNormal3i glad_glNormal3i\ntypedef void (APIENTRYP PFNGLNORMAL3IVPROC)(const GLint *v);\nGLAPI PFNGLNORMAL3IVPROC glad_glNormal3iv;\n#define glNormal3iv glad_glNormal3iv\ntypedef void (APIENTRYP PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz);\nGLAPI PFNGLNORMAL3SPROC glad_glNormal3s;\n#define glNormal3s glad_glNormal3s\ntypedef void (APIENTRYP PFNGLNORMAL3SVPROC)(const GLshort *v);\nGLAPI PFNGLNORMAL3SVPROC glad_glNormal3sv;\n#define glNormal3sv glad_glNormal3sv\ntypedef void (APIENTRYP PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y);\nGLAPI PFNGLRASTERPOS2DPROC glad_glRasterPos2d;\n#define glRasterPos2d glad_glRasterPos2d\ntypedef void (APIENTRYP PFNGLRASTERPOS2DVPROC)(const GLdouble *v);\nGLAPI PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv;\n#define glRasterPos2dv glad_glRasterPos2dv\ntypedef void (APIENTRYP PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y);\nGLAPI PFNGLRASTERPOS2FPROC glad_glRasterPos2f;\n#define glRasterPos2f glad_glRasterPos2f\ntypedef void (APIENTRYP PFNGLRASTERPOS2FVPROC)(const GLfloat *v);\nGLAPI PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv;\n#define glRasterPos2fv glad_glRasterPos2fv\ntypedef void (APIENTRYP PFNGLRASTERPOS2IPROC)(GLint x, GLint y);\nGLAPI PFNGLRASTERPOS2IPROC glad_glRasterPos2i;\n#define glRasterPos2i glad_glRasterPos2i\ntypedef void (APIENTRYP PFNGLRASTERPOS2IVPROC)(const GLint *v);\nGLAPI PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv;\n#define glRasterPos2iv glad_glRasterPos2iv\ntypedef void (APIENTRYP PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y);\nGLAPI PFNGLRASTERPOS2SPROC glad_glRasterPos2s;\n#define glRasterPos2s glad_glRasterPos2s\ntypedef void (APIENTRYP PFNGLRASTERPOS2SVPROC)(const GLshort *v);\nGLAPI PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv;\n#define glRasterPos2sv glad_glRasterPos2sv\ntypedef void (APIENTRYP PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z);\nGLAPI PFNGLRASTERPOS3DPROC glad_glRasterPos3d;\n#define glRasterPos3d glad_glRasterPos3d\ntypedef void (APIENTRYP PFNGLRASTERPOS3DVPROC)(const GLdouble *v);\nGLAPI PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv;\n#define glRasterPos3dv glad_glRasterPos3dv\ntypedef void (APIENTRYP PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z);\nGLAPI PFNGLRASTERPOS3FPROC glad_glRasterPos3f;\n#define glRasterPos3f glad_glRasterPos3f\ntypedef void (APIENTRYP PFNGLRASTERPOS3FVPROC)(const GLfloat *v);\nGLAPI PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv;\n#define glRasterPos3fv glad_glRasterPos3fv\ntypedef void (APIENTRYP PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z);\nGLAPI PFNGLRASTERPOS3IPROC glad_glRasterPos3i;\n#define glRasterPos3i glad_glRasterPos3i\ntypedef void (APIENTRYP PFNGLRASTERPOS3IVPROC)(const GLint *v);\nGLAPI PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv;\n#define glRasterPos3iv glad_glRasterPos3iv\ntypedef void (APIENTRYP PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z);\nGLAPI PFNGLRASTERPOS3SPROC glad_glRasterPos3s;\n#define glRasterPos3s glad_glRasterPos3s\ntypedef void (APIENTRYP PFNGLRASTERPOS3SVPROC)(const GLshort *v);\nGLAPI PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv;\n#define glRasterPos3sv glad_glRasterPos3sv\ntypedef void (APIENTRYP PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nGLAPI PFNGLRASTERPOS4DPROC glad_glRasterPos4d;\n#define glRasterPos4d glad_glRasterPos4d\ntypedef void (APIENTRYP PFNGLRASTERPOS4DVPROC)(const GLdouble *v);\nGLAPI PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv;\n#define glRasterPos4dv glad_glRasterPos4dv\ntypedef void (APIENTRYP PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nGLAPI PFNGLRASTERPOS4FPROC glad_glRasterPos4f;\n#define glRasterPos4f glad_glRasterPos4f\ntypedef void (APIENTRYP PFNGLRASTERPOS4FVPROC)(const GLfloat *v);\nGLAPI PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv;\n#define glRasterPos4fv glad_glRasterPos4fv\ntypedef void (APIENTRYP PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w);\nGLAPI PFNGLRASTERPOS4IPROC glad_glRasterPos4i;\n#define glRasterPos4i glad_glRasterPos4i\ntypedef void (APIENTRYP PFNGLRASTERPOS4IVPROC)(const GLint *v);\nGLAPI PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv;\n#define glRasterPos4iv glad_glRasterPos4iv\ntypedef void (APIENTRYP PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w);\nGLAPI PFNGLRASTERPOS4SPROC glad_glRasterPos4s;\n#define glRasterPos4s glad_glRasterPos4s\ntypedef void (APIENTRYP PFNGLRASTERPOS4SVPROC)(const GLshort *v);\nGLAPI PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv;\n#define glRasterPos4sv glad_glRasterPos4sv\ntypedef void (APIENTRYP PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);\nGLAPI PFNGLRECTDPROC glad_glRectd;\n#define glRectd glad_glRectd\ntypedef void (APIENTRYP PFNGLRECTDVPROC)(const GLdouble *v1, const GLdouble *v2);\nGLAPI PFNGLRECTDVPROC glad_glRectdv;\n#define glRectdv glad_glRectdv\ntypedef void (APIENTRYP PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);\nGLAPI PFNGLRECTFPROC glad_glRectf;\n#define glRectf glad_glRectf\ntypedef void (APIENTRYP PFNGLRECTFVPROC)(const GLfloat *v1, const GLfloat *v2);\nGLAPI PFNGLRECTFVPROC glad_glRectfv;\n#define glRectfv glad_glRectfv\ntypedef void (APIENTRYP PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2);\nGLAPI PFNGLRECTIPROC glad_glRecti;\n#define glRecti glad_glRecti\ntypedef void (APIENTRYP PFNGLRECTIVPROC)(const GLint *v1, const GLint *v2);\nGLAPI PFNGLRECTIVPROC glad_glRectiv;\n#define glRectiv glad_glRectiv\ntypedef void (APIENTRYP PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);\nGLAPI PFNGLRECTSPROC glad_glRects;\n#define glRects glad_glRects\ntypedef void (APIENTRYP PFNGLRECTSVPROC)(const GLshort *v1, const GLshort *v2);\nGLAPI PFNGLRECTSVPROC glad_glRectsv;\n#define glRectsv glad_glRectsv\ntypedef void (APIENTRYP PFNGLTEXCOORD1DPROC)(GLdouble s);\nGLAPI PFNGLTEXCOORD1DPROC glad_glTexCoord1d;\n#define glTexCoord1d glad_glTexCoord1d\ntypedef void (APIENTRYP PFNGLTEXCOORD1DVPROC)(const GLdouble *v);\nGLAPI PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv;\n#define glTexCoord1dv glad_glTexCoord1dv\ntypedef void (APIENTRYP PFNGLTEXCOORD1FPROC)(GLfloat s);\nGLAPI PFNGLTEXCOORD1FPROC glad_glTexCoord1f;\n#define glTexCoord1f glad_glTexCoord1f\ntypedef void (APIENTRYP PFNGLTEXCOORD1FVPROC)(const GLfloat *v);\nGLAPI PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv;\n#define glTexCoord1fv glad_glTexCoord1fv\ntypedef void (APIENTRYP PFNGLTEXCOORD1IPROC)(GLint s);\nGLAPI PFNGLTEXCOORD1IPROC glad_glTexCoord1i;\n#define glTexCoord1i glad_glTexCoord1i\ntypedef void (APIENTRYP PFNGLTEXCOORD1IVPROC)(const GLint *v);\nGLAPI PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv;\n#define glTexCoord1iv glad_glTexCoord1iv\ntypedef void (APIENTRYP PFNGLTEXCOORD1SPROC)(GLshort s);\nGLAPI PFNGLTEXCOORD1SPROC glad_glTexCoord1s;\n#define glTexCoord1s glad_glTexCoord1s\ntypedef void (APIENTRYP PFNGLTEXCOORD1SVPROC)(const GLshort *v);\nGLAPI PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv;\n#define glTexCoord1sv glad_glTexCoord1sv\ntypedef void (APIENTRYP PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t);\nGLAPI PFNGLTEXCOORD2DPROC glad_glTexCoord2d;\n#define glTexCoord2d glad_glTexCoord2d\ntypedef void (APIENTRYP PFNGLTEXCOORD2DVPROC)(const GLdouble *v);\nGLAPI PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv;\n#define glTexCoord2dv glad_glTexCoord2dv\ntypedef void (APIENTRYP PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t);\nGLAPI PFNGLTEXCOORD2FPROC glad_glTexCoord2f;\n#define glTexCoord2f glad_glTexCoord2f\ntypedef void (APIENTRYP PFNGLTEXCOORD2FVPROC)(const GLfloat *v);\nGLAPI PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv;\n#define glTexCoord2fv glad_glTexCoord2fv\ntypedef void (APIENTRYP PFNGLTEXCOORD2IPROC)(GLint s, GLint t);\nGLAPI PFNGLTEXCOORD2IPROC glad_glTexCoord2i;\n#define glTexCoord2i glad_glTexCoord2i\ntypedef void (APIENTRYP PFNGLTEXCOORD2IVPROC)(const GLint *v);\nGLAPI PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv;\n#define glTexCoord2iv glad_glTexCoord2iv\ntypedef void (APIENTRYP PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t);\nGLAPI PFNGLTEXCOORD2SPROC glad_glTexCoord2s;\n#define glTexCoord2s glad_glTexCoord2s\ntypedef void (APIENTRYP PFNGLTEXCOORD2SVPROC)(const GLshort *v);\nGLAPI PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv;\n#define glTexCoord2sv glad_glTexCoord2sv\ntypedef void (APIENTRYP PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r);\nGLAPI PFNGLTEXCOORD3DPROC glad_glTexCoord3d;\n#define glTexCoord3d glad_glTexCoord3d\ntypedef void (APIENTRYP PFNGLTEXCOORD3DVPROC)(const GLdouble *v);\nGLAPI PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv;\n#define glTexCoord3dv glad_glTexCoord3dv\ntypedef void (APIENTRYP PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r);\nGLAPI PFNGLTEXCOORD3FPROC gla"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.004, "dedup_hash": "a060d7059f16cc6e", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glfw", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Glfw", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/GLFW/glfw3.h", "language": "code", "loc": 2157, "comment_density": 0.817, "code": "/*************************************************************************\n * GLFW 3.0 - www.glfw.org\n * A library for OpenGL, window and input\n *------------------------------------------------------------------------\n * Copyright (c) 2002-2006 Marcus Geelnard\n * Copyright (c) 2006-2010 Camilla Berglund \n *\n * This software is provided 'as-is', without any express or implied\n * warranty. In no event will the authors be held liable for any damages\n * arising from the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, subject to the following restrictions:\n *\n * 1. The origin of this software must not be misrepresented; you must not\n * claim that you wrote the original software. If you use this software\n * in a product, an acknowledgment in the product documentation would\n * be appreciated but is not required.\n *\n * 2. Altered source versions must be plainly marked as such, and must not\n * be misrepresented as being the original software.\n *\n * 3. This notice may not be removed or altered from any source\n * distribution.\n *\n *************************************************************************/\n\n#ifndef _glfw3_h_\n#define _glfw3_h_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/*************************************************************************\n * Doxygen documentation\n *************************************************************************/\n\n/*! @defgroup clipboard Clipboard support\n */\n/*! @defgroup context Context handling\n */\n/*! @defgroup error Error handling\n */\n/*! @defgroup init Initialization and version information\n */\n/*! @defgroup input Input handling\n */\n/*! @defgroup monitor Monitor handling\n *\n * This is the reference documentation for monitor related functions and types.\n * For more information, see the @ref monitor.\n */\n/*! @defgroup time Time input\n */\n/*! @defgroup window Window handling\n *\n * This is the reference documentation for window related functions and types,\n * including creation, deletion and event polling. For more information, see\n * the @ref window.\n */\n\n\n/*************************************************************************\n * Global definitions\n *************************************************************************/\n\n/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */\n\n/* Please report any problems that you find with your compiler, which may\n * be solved in this section! There are several compilers that I have not\n * been able to test this file with yet.\n *\n * First: If we are we on Windows, we want a single define for it (_WIN32)\n * (Note: For Cygwin the compiler flag -mwin32 should be used, but to\n * make sure that things run smoothly for Cygwin users, we add __CYGWIN__\n * to the list of \"valid Win32 identifiers\", which removes the need for\n * -mwin32)\n */\n#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))\n #define _WIN32\n#endif /* _WIN32 */\n\n/* In order for extension support to be portable, we need to define an\n * OpenGL function call method. We use the keyword APIENTRY, which is\n * defined for Win32. (Note: Windows also needs this for )\n */\n#ifndef APIENTRY\n #ifdef _WIN32\n #define APIENTRY __stdcall\n #else\n #define APIENTRY\n #endif\n#endif /* APIENTRY */\n\n/* The following three defines are here solely to make some Windows-based\n * files happy. Theoretically we could include , but\n * it has the major drawback of severely polluting our namespace.\n */\n\n/* Under Windows, we need WINGDIAPI defined */\n#if !defined(WINGDIAPI) && defined(_WIN32)\n #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)\n /* Microsoft Visual C++, Borland C++ Builder and Pelles C */\n #define WINGDIAPI __declspec(dllimport)\n #elif defined(__LCC__)\n /* LCC-Win32 */\n #define WINGDIAPI __stdcall\n #else\n /* Others (e.g. MinGW, Cygwin) */\n #define WINGDIAPI extern\n #endif\n #define GLFW_WINGDIAPI_DEFINED\n#endif /* WINGDIAPI */\n\n/* Some files also need CALLBACK defined */\n#if !defined(CALLBACK) && defined(_WIN32)\n #if defined(_MSC_VER)\n /* Microsoft Visual C++ */\n #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)\n #define CALLBACK __stdcall\n #else\n #define CALLBACK\n #endif\n #else\n /* Other Windows compilers */\n #define CALLBACK __stdcall\n #endif\n #define GLFW_CALLBACK_DEFINED\n#endif /* CALLBACK */\n\n/* Most GL/glu.h variants on Windows need wchar_t\n * OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */\n#if !defined(GLFW_INCLUDE_NONE)\n #include \n#endif\n\n/* Include the chosen client API headers.\n */\n#if defined(__APPLE_CC__)\n #if defined(GLFW_INCLUDE_GLCOREARB)\n #include \n #elif !defined(GLFW_INCLUDE_NONE)\n #define GL_GLEXT_LEGACY\n #include \n #endif\n #if defined(GLFW_INCLUDE_GLU)\n #include \n #endif\n#else\n #if defined(GLFW_INCLUDE_GLCOREARB)\n #include \n #elif defined(GLFW_INCLUDE_ES1)\n #include \n #elif defined(GLFW_INCLUDE_ES2)\n #include \n #elif defined(GLFW_INCLUDE_ES3)\n #include \n #elif !defined(GLFW_INCLUDE_NONE)\n #include \n #endif\n #if defined(GLFW_INCLUDE_GLU)\n #include \n #endif\n#endif\n\n#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)\n /* GLFW_DLL is defined by users of GLFW when compiling programs that will link\n * to the DLL version of the GLFW library. _GLFW_BUILD_DLL is defined by the\n * GLFW configuration header when compiling the DLL version of the library.\n */\n #error \"You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined\"\n#endif\n\n#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)\n\n /* We are building a Win32 DLL */\n #define GLFWAPI __declspec(dllexport)\n\n#elif defined(_WIN32) && defined(GLFW_DLL)\n\n /* We are calling a Win32 DLL */\n #if defined(__LCC__)\n #define GLFWAPI extern\n #else\n #define GLFWAPI __declspec(dllimport)\n #endif\n\n#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)\n\n #define GLFWAPI __attribute__((visibility(\"default\")))\n\n#else\n\n /* We are either building/calling a static lib or we are non-win32 */\n #define GLFWAPI\n\n#endif\n\n/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */\n\n\n/*************************************************************************\n * GLFW API tokens\n *************************************************************************/\n\n/*! @name GLFW version macros\n * @{ */\n/*! @brief The major version number of the GLFW library.\n *\n * This is incremented when the API is changed in non-compatible ways.\n * @ingroup init\n */\n#define GLFW_VERSION_MAJOR 3\n/*! @brief The minor version number of the GLFW library.\n *\n * This is incremented when features are added to the API but it remains\n * backward-compatible.\n * @ingroup init\n */\n#define GLFW_VERSION_MINOR 0\n/*! @brief The revision number of the GLFW library.\n *\n * This is incremented when a bug fix release is made that does not contain any\n * API changes.\n * @ingroup init\n */\n#define GLFW_VERSION_REVISION 4\n/*! @} */\n\n/*! @name Key and button actions\n * @{ */\n/*! @brief The key or button was released.\n * @ingroup input\n */\n#define GLFW_RELEASE 0\n/*! @brief The key or button was pressed.\n * @ingroup input\n */\n#define GLFW_PRESS 1\n/*! @brief The key was held down until it repeated.\n * @ingroup input\n */\n#define GLFW_REPEAT 2\n/*! @} */\n\n/*! @defgroup keys Keyboard keys\n *\n * These key codes are inspired by the *USB HID Usage Tables v1.12* (p. 53-60),\n * but re-arranged to map to 7-bit ASCII for printable keys (function keys are\n * put in the 256+ range).\n *\n * The naming of the key codes follow these rules:\n * - The US keyboard layout is used\n * - Names of printable alpha-numeric characters are used (e.g. \"A\", \"R\",\n * \"3\", etc.)\n * - For non-alphanumeric characters, Unicode:ish names are used (e.g.\n * \"COMMA\", \"LEFT_SQUARE_BRACKET\", etc.). Note that some names do not\n * correspond to the Unicode standard (usually for brevity)\n * - Keys that lack a clear US mapping are named \"WORLD_x\"\n * - For non-printable keys, custom names are used (e.g. \"F4\",\n * \"BACKSPACE\", etc.)\n *\n * @ingroup input\n * @{\n */\n\n/* The unknown key */\n#define GLFW_KEY_UNKNOWN -1\n\n/* Printable keys */\n#define GLFW_KEY_SPACE 32\n#define GLFW_KEY_APOSTROPHE 39 /* ' */\n#define GLFW_KEY_COMMA 44 /* , */\n#define GLFW_KEY_MINUS 45 /* - */\n#define GLFW_KEY_PERIOD 46 /* . */\n#define GLFW_KEY_SLASH 47 /* / */\n#define GLFW_KEY_0 48\n#define GLFW_KEY_1 49\n#define GLFW_KEY_2 50\n#define GLFW_KEY_3 51\n#define GLFW_KEY_4 52\n#define GLFW_KEY_5 53\n#define GLFW_KEY_6 54\n#define GLFW_KEY_7 55\n#define GLFW_KEY_8 56\n#define GLFW_KEY_9 57\n#define GLFW_KEY_SEMICOLON 59 /* ; */\n#define GLFW_KEY_EQUAL 61 /* = */\n#define GLFW_KEY_A 65\n#define GLFW_KEY_B 66\n#define GLFW_KEY_C 67\n#define GLFW_KEY_D 68\n#define GLFW_KEY_E 69\n#define GLFW_KEY_F 70\n#define GLFW_KEY_G 71\n#define GLFW_KEY_H 72\n#define GLFW_KEY_I 73\n#define GLFW_KEY_J 74\n#define GLFW_KEY_K 75\n#define GLFW_KEY_L 76\n#define GLFW_KEY_M 77\n#define GLFW_KEY_N 78\n#define GLFW_KEY_O 79\n#define GLFW_KEY_P 80\n#define GLFW_KEY_Q 81\n#define GLFW_KEY_R 82\n#define GLFW_KEY_S 83\n#define GLFW_KEY_T 84\n#define GLFW_KEY_U 85\n#define GLFW_KEY_V 86\n#define GLFW_KEY_W 87\n#define GLFW_KEY_X 88\n#define GLFW_KEY_Y 89\n#define GLFW_KEY_Z 90\n#define GLFW_KEY_LEFT_BRACKET 91 /* [ */\n#define GLFW_KEY_BACKSLASH 92 /* \\ */\n#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */\n#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */\n#define GLFW_KEY_WORLD_1 161 /* non-US #1 */\n#define GLFW_KEY_WORLD_2 162 /* non-US #2 */\n\n/* Function keys */\n#define GLFW_KEY_ESCAPE 256\n#define GLFW_KEY_ENTER 257\n#define GLFW_KEY_TAB 258\n#define GLFW_KEY_BACKSPACE 259\n#define GLFW_KEY_INSERT 260\n#define GLFW_KEY_DELETE 261\n#define GLFW_KEY_RIGHT 262\n#define GLFW_KEY_LEFT 263\n#define GLFW_KEY_DOWN 264\n#define GLFW_KEY_UP 265\n#define GLFW_KEY_PAGE_UP 266\n#define GLFW_KEY_PAGE_DOWN 267\n#define GLFW_KEY_HOME 268\n#define GLFW_KEY_END 269\n#define GLFW_KEY_CAPS_LOCK 280\n#define GLFW_KEY_SCROLL_LOCK 281\n#define GLFW_KEY_NUM_LOCK 282\n#define GLFW_KEY_PRINT_SCREEN 283\n#define GLFW_KEY_PAUSE 284\n#define GLFW_KEY_F1 290\n#define GLFW_KEY_F2 291\n#define GLFW_KEY_F3 292\n#define GLFW_KEY_F4 293\n#define GLFW_KEY_F5 294\n#define GLFW_KEY_F6 295\n#define GLFW_KEY_F7 296\n#define GLFW_KEY_F8 297\n#define GLFW_KEY_F9 298\n#define GLFW_KEY_F10 299\n#define GLFW_KEY_F11 300\n#define GLFW_KEY_F12 301\n#define GLFW_KEY_F13 302\n#define GLFW_KEY_F14 303\n#define GLFW_KEY_F15 304\n#define GLFW_KEY_F16 305\n#define GLFW_KEY_F17 306\n#define GLFW_KEY_F18 307\n#define GLFW_KEY_F19 308\n#define GLFW_KEY_F20 309\n#define GLFW_KEY_F21 310\n#define GLFW_KEY_F22 311\n#define GLFW_KEY_F23 312\n#define GLFW_KEY_F24 313\n#define GLFW_KEY_F25 314\n#define GLFW_KEY_KP_0 320\n#define GLFW_KEY_KP_1 321\n#define GLFW_KEY_KP_2 322\n#define GLFW_KEY_KP_3 323\n#define GLFW_KEY_KP_4 324\n#define GLFW_KEY_KP_5 325\n#define GLFW_KEY_KP_6 326\n#define GLFW_KEY_KP_7 327\n#define GLFW_KEY_KP_8 328\n#define GLFW_KEY_KP_9 329\n#define GLFW_KEY_KP_DECIMAL 330\n#define GLFW_KEY_KP_DIVIDE 331\n#define GLFW_KEY_KP_MULTIPLY 332\n#define GLFW_KEY_KP_SUBTRACT 333\n#define GLFW_KEY_KP_ADD 334\n#define GLFW_KEY_KP_ENTER 335\n#define GLFW_KEY_KP_EQUAL 336\n#define GLFW_KEY_LEFT_SHIFT 340\n#define GLFW_KEY_LEFT_CONTROL 341\n#define GLFW_KEY_LEFT_ALT 342\n#define GLFW_KEY_LEFT_SUPER 343\n#define GLFW_KEY_RIGHT_SHIFT 344\n#define GLFW_KEY_RIGHT_CONTROL 345\n#define GLFW_KEY_RIGHT_ALT 346\n#define GLFW_KEY_RIGHT_SUPER 347\n#define GLFW_KEY_MENU 348\n#define GLFW_KEY_LAST GLFW_KEY_MENU\n\n/*! @} */\n\n/*! @defgroup mods Modifier key flags\n * @ingroup input\n * @{ */\n\n/*! @brief If this bit is set one or more Shift keys were held down.\n */\n#define GLFW_MOD_SHIFT 0x0001\n/*! @brief If this bit is set one or more Control keys were held down.\n */\n#define GLFW_MOD_CONTROL 0x0002\n/*! @brief If this bit is set one or more Alt keys were held down.\n */\n#define GLFW_MOD_ALT 0x0004\n/*! @brief If this bit is set one or more Super keys were held down.\n */\n#define GLFW_MOD_SUPER 0x0008\n\n/*! @} */\n\n/*! @defgroup buttons Mouse buttons\n * @ingroup input\n * @{ */\n#define GLFW_MOUSE_BUTTON_1 0\n#define GLFW_MOUSE_BUTTON_2 1\n#define GLFW_MOUSE_BUTTON_3 2\n#define GLFW_MOUSE_BUTTON_4 3\n#define GLFW_MOUSE_BUTTON_5 4\n#define GLFW_MOUSE_BUTTON_6 5\n#define GLFW_MOUSE_BUTTON_7 6\n#define GLFW_MOUSE_BUTTON_8 7\n#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8\n#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1\n#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2\n#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3\n/*! @} */\n\n/*! @defgroup joysticks Joysticks\n * @ingroup input\n * @{ */\n#define GLFW_JOYSTICK_1 0\n#define GLFW_JOYSTICK_2 1\n#define GLFW_JOYSTICK_3 2\n#define GLFW_JOYSTICK_4 3\n#define GLFW_JOYSTICK_5 4\n#define GLFW_JOYSTICK_6 5\n#define GLFW_JOYSTICK_7 6\n#define GLFW_JOYSTICK_8 7\n#define GLFW_JOYSTICK_9 8\n#define GLFW_JOYSTICK_10 9\n#define GLFW_JOYSTICK_11 10\n#define GLFW_JOYSTICK_12 11\n#define GLFW_JOYSTICK_13 12\n#define GLFW_JOYSTICK_14 13\n#define GLFW_JOYSTICK_15 14\n#define GLFW_JOYSTICK_16 15\n#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16\n/*! @} */\n\n/*! @defgroup errors Error codes\n * @ingroup error\n * @{ */\n/*! @brief GLFW has not been initialized.\n */\n#define GLFW_NOT_INITIALIZED 0x00010001\n/*! @brief No context is current for this thread.\n */\n#define GLFW_NO_CURRENT_CONTEXT 0x00010002\n/*! @brief One of the enum parameters for the function was given an invalid\n * enum.\n */\n#define GLFW_INVALID_ENUM 0x00010003\n/*! @brief One of the parameters for the function was given an invalid value.\n */\n#define GLFW_INVALID_VALUE 0x00010004\n/*! @brief A memory allocation failed.\n */\n#define GLFW_OUT_OF_MEMORY 0x00010005\n/*! @brief GLFW could not find support for the requested client API on the\n * system.\n */\n#define GLFW_API_UNAVAILABLE 0x00010006\n/*! @brief The requested client API version is not available.\n */\n#define GLFW_VERSION_UNAVAILABLE 0x00010007\n/*! @brief A platform-specific error occurred that does not match any of the\n * more specific categories.\n */\n#define GLFW_PLATFORM_ERROR 0x00010008\n/*! @brief The clipboard did not contain data in the requested format.\n */\n#define GLFW_FORMAT_UNAVAILABLE 0x00010009\n/*! @} */\n\n#define GLFW_FOCUSED 0x00020001\n#define GLFW_ICONIFIED 0x00020002\n#define GLFW_RESIZABLE 0x00020003\n#define GLFW_VISIBLE 0x00020004\n#define GLFW_DECORATED 0x00020005\n\n#define GLFW_RED_BITS 0x00021001\n#define GLFW_GREEN_BITS 0x00021002\n#define GLFW_BLUE_BITS 0x00021003\n#define GLFW_ALPHA_BITS 0x00021004\n#define GLFW_DEPTH_BITS 0x00021005\n#define GLFW_STENCIL_BITS 0x00021006\n#define GLFW_ACCUM_RED_BITS 0x00021007\n#define GLFW_ACCUM_GREEN_BITS 0x00021008\n#define GLFW_ACCUM_BLUE_BITS 0x00021009\n#define GLFW_ACCUM_ALPHA_BITS 0x0002100A\n#define GLFW_AUX_BUFFERS 0x0002100B\n#define GLFW_STEREO 0x0002100C\n#define GLFW_SAMPLES 0x0002100D\n#define GLFW_SRGB_CAPABLE 0x0002100E\n#define GLFW_REFRESH_RATE 0x0002100F\n\n#define GLFW_CLIENT_API 0x00022001\n#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002\n#define GLFW_CONTEXT_VERSION_MINOR 0x00022003\n#define GLFW_CONTEXT_REVISION 0x00022004\n#define GLFW_CONTEXT_ROBUSTNESS 0x00022005\n#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006\n#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007\n#define GLFW_OPENGL_PROFILE 0x00022008\n\n#define GLFW_OPENGL_API 0x00030001\n#define GLFW_OPENGL_ES_API 0x00030002\n\n#define GLFW_NO_ROBUSTNESS 0\n#define GLFW_NO_RESET_NOTIFICATION 0x00031001\n#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002\n\n#define GLFW_OPENGL_ANY_PROFILE 0\n#define GLFW_OPENGL_CORE_PROFILE 0x00032001\n#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002\n\n#define GLFW_CURSOR 0x00033001\n#define GLFW_STICKY_KEYS 0x00033002\n#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003\n\n#define GLFW_CURSOR_NORMAL 0x00034001\n#define GLFW_CURSOR_HIDDEN 0x00034002\n#define GLFW_CURSOR_DISABLED 0x00034003\n\n#define GLFW_CONNECTED 0x00040001\n#define GLFW_DISCONNECTED 0x00040002\n\n\n/*************************************************************************\n * GLFW API types\n *************************************************************************/\n\n/*! @brief Client API function pointer type.\n *\n * Generic function pointer used for returning client API function pointers\n * without forcing a cast from a regular pointer.\n *\n * @ingroup context\n */\ntypedef void (*GLFWglproc)(void);\n\n/*! @brief Opaque monitor object.\n *\n * Opaque monitor object.\n *\n * @ingroup monitor\n */\ntypedef struct GLFWmonitor GLFWmonitor;\n\n/*! @brief Opaque window object.\n *\n * Opaque window object.\n *\n * @ingroup window\n */\ntypedef struct GLFWwindow GLFWwindow;\n\n/*! @brief The function signature for error callbacks.\n *\n * This is the function signature for error callback functions.\n *\n * @param[in] error An [error code](@ref errors).\n * @param[in] description A UTF-8 encoded string describing the error.\n *\n * @sa glfwSetErrorCallback\n *\n * @ingroup error\n */\ntypedef void (* GLFWerrorfun)(int,const char*);\n\n/*! @brief The function signature for window position callbacks.\n *\n * This is the function signature for window position callback functions.\n *\n * @param[in] window The window that the user moved.\n * @param[in] xpos The new x-coordinate, in screen coordinates, of the\n * upper-left corner of the client area of the window.\n * @param[in] ypos The new y-coordinate, in screen coordinates, of the\n * upper-left corner of the client area of the window.\n *\n * @sa glfwSetWindowPosCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);\n\n/*! @brief The function signature for window resize callbacks.\n *\n * This is the function signature for window size callback functions.\n *\n * @param[in] window The window that the user resized.\n * @param[in] width The new width, in screen coordinates, of the window.\n * @param[in] height The new height, in screen coordinates, of the window.\n *\n * @sa glfwSetWindowSizeCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);\n\n/*! @brief The function signature for window close callbacks.\n *\n * This is the function signature for window close callback functions.\n *\n * @param[in] window The window that the user attempted to close.\n *\n * @sa glfwSetWindowCloseCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowclosefun)(GLFWwindow*);\n\n/*! @brief The function signature for window content refresh callbacks.\n *\n * This is the function signature for window refresh callback functions.\n *\n * @param[in] window The window whose content needs to be refreshed.\n *\n * @sa glfwSetWindowRefreshCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowrefreshfun)(GLFWwindow*);\n\n/*! @brief The function signature for window focus/defocus callbacks.\n *\n * This is the function signature for window focus callback functions.\n *\n * @param[in] window The window that was focused or defocused.\n * @param[in] focused `GL_TRUE` if the window was focused, or `GL_FALSE` if\n * it was defocused.\n *\n * @sa glfwSetWindowFocusCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);\n\n/*! @brief The function signature for window iconify/restore callbacks.\n *\n * This is the function signature for window iconify/restore callback\n * functions.\n *\n * @param[in] window The window that was iconified or restored.\n * @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE`\n * if it was restored.\n *\n * @sa glfwSetWindowIconifyCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);\n\n/*! @brief The function signature for framebuffer resize callbacks.\n *\n * This is the function signature for framebuffer resize callback\n * functions.\n *\n * @param[in] window The window whose framebuffer was resized.\n * @param[in] width The new width, in pixels, of the framebuffer.\n * @param[in] height The new height, in pixels, of the framebuffer.\n *\n * @sa glfwSetFramebufferSizeCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);\n\n/*! @brief The function signature for mouse button callbacks.\n *\n * This is the function signature for mouse button callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] button The [mouse button](@ref buttons) that was pressed or\n * released.\n * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.\n * @param[in] mods Bit field describing which [modifier keys](@ref mods) were\n * held down.\n *\n * @sa glfwSetMouseButtonCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);\n\n/*! @brief The function signature for cursor position callbacks.\n *\n * This is the function signature for cursor position callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor.\n * @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor.\n *\n * @sa glfwSetCursorPosCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);\n\n/*! @brief The function signature for cursor enter/leave callbacks.\n *\n * This is the function signature for cursor enter/leave callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] entered `GL_TRUE` if the cursor entered the window's client\n * area, or `GL_FALSE` if it left it.\n *\n * @sa glfwSetCursorEnterCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWcursorenterfun)(GLFWwindow*,int);\n\n/*! @brief The function signature for scroll callbacks.\n *\n * This is the function signature for scroll callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] xoffset The scroll offset along the x-axis.\n * @param[in] yoffset The scroll offset along the y-axis.\n *\n * @sa glfwSetScrollCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWscrollfun)(GLFWwindow*,double,double);\n\n/*! @brief The function signature for keyboard key callbacks.\n *\n * This is the function signature for keyboard key callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] key The [keyboard key](@ref keys) that was pressed or released.\n * @param[in] scancode The system-specific scancode of the key.\n * @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT.\n * @param[in] mods Bit field describing which [modifier keys](@ref mods) were\n * held down.\n *\n * @sa glfwSetKeyCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);\n\n/*! @brief The function signature for Unicode character callbacks.\n *\n * This is the function signature for Unicode character callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] codepoint The Unicode code point of the character.\n *\n * @sa glfwSetCharCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);\n\n/*! @brief The function signature for monitor configuration callbacks.\n *\n * This is the function signature for monitor configuration callback functions.\n *\n * @param[in] monitor The monitor that was connected or disconnected.\n * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.\n *\n * @sa glfwSetMonitorCallback\n *\n * @ingroup monitor\n */\ntypedef void (* GLFWmonitorfun)(GLFWmonitor*,int);\n\n/*! @brief Video mode type.\n *\n * This describes a single video mode.\n *\n * @ingroup monitor\n */\ntypedef struct GLFWvidmode\n{\n /*! The width, in screen coordinates, of the video mode.\n */\n int width;\n /*! The height, in screen coordinates, of the video mode.\n */\n int height;\n /*! The bit depth of the red channel of the video mode.\n */\n int redBits;\n /*! The bit depth of the green channel of the video mode.\n */\n int greenBits;\n /*! The bit depth of the blue channel of the video mode.\n */\n int blueBits;\n /*! The refresh rate, in Hz, of the video mode.\n */\n int refreshRate;\n} GLFWvidmode;\n\n/*! @brief Gamma ramp.\n *\n * This describes the gamma ramp for a monitor.\n *\n * @sa glfwGetGammaRamp glfwSetGammaRamp\n *\n * @ingroup monitor\n */\ntypedef struct GLFWgammaramp\n{\n /*! An array of value describing the response of the red channel.\n */\n unsigned short* red;\n /*! An array of value describing the response of the green channel.\n */\n unsigned short* green;\n /*! An array of value describing the response of the blue channel.\n */\n unsigned short* blue;\n /*! The number of elements in each array.\n */\n unsigned int size;\n} GLFWgammaramp;\n\n\n/*************************************************************************\n * GLFW API functions\n *************************************************************************/\n\n/*! @brief Initializes the GLFW library.\n *\n * This function initializes the GLFW library. Before most GLFW functions can\n * be used, GLFW must be initialized, and before a program terminates GLFW\n * should be terminated in order to free any resources allocated during or\n * after initialization.\n *\n * If this function fails, it calls @ref glfwTerminate before returning. If it\n * succeeds, you should call @ref glfwTerminate before the program exits.\n *\n * Additional calls to this function after successful initialization but before\n * termination will succeed but will do nothing.\n *\n * @return `GL_TRUE` if successful, or `GL_FALSE` if an error occurred.\n *\n * @par New in GLFW 3\n * This function no longer registers @ref glfwTerminate with `atexit`.\n *\n * @note This function may only be called from the main thread.\n *\n * @note **OS X:** This function will change the current directory of the\n * application to the `Contents/Resources` subdirectory of the application's\n * bundle, if present.\n *\n * @sa glfwTerminate\n *\n * @ingroup init\n */\nGLFWAPI int glfwInit(void);\n\n/*! @brief Terminates the GLFW library.\n *\n * This function destroys all remaining windows, frees any allocated resources\n * and sets the library to an uninitialized state. Once this is called, you\n * must again call @ref glfwInit successfully before you will be able to use\n * most GLFW functions.\n *\n * If GLFW has been successfully initialized, this function should be called\n * before the program exits. If initialization fails, there is no need to call\n * this function, as it is called by @ref glfwInit before it returns failure.\n *\n * @remarks This function may be called before @ref glfwInit.\n *\n * @note This function may only be called from the main thread.\n *\n * @warning No window's context may be current on another thread when this\n * function is called.\n *\n * @sa glfwInit\n *\n * @ingroup init\n */\nGLFWAPI void glfwTerminate(void);\n\n/*! @brief Retrieves the version of the GLFW library.\n *\n * This function retrieves the major, minor and revision numbers of the GLFW\n * library. It is intended for when you are using GLFW as a shared library and\n * want to ensure that you are using the minimum required version.\n *\n * @param[out] major Where to store the major version number, or `NULL`.\n * @param[out] minor Where to store the minor version number, or `NULL`.\n * @param[out] rev Where to store the revision number, or `NULL`.\n *\n * @remarks This function may be called before @ref glfwInit.\n *\n * @remarks This function may be called from any thread.\n *\n * @sa glfwGetVersionString\n *\n * @ingroup init\n */\nGLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);\n\n/*! @brief Returns a string describing the compile-time configuration.\n *\n * This function returns a static string generated at compile-time according to\n * which configuration macros were defined. This is intended for use when\n * submitting bug reports, to allow developers to see which code paths are\n * enabled in a binary.\n *\n * The format of the string is as follows:\n * - The version of GLFW\n * - The name of the window system API\n * - The name of the context creation API\n * - Any additional options or APIs\n *\n * For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL\n * back ends, the version string may look something like this:\n *\n * 3.0.0 Win32 WGL MinGW\n *\n * @return The GLFW version string.\n *\n * @remarks This function may be called before @ref glfwInit.\n *\n * @remarks This function may be called from any thread.\n *\n * @sa glfwGetVersion\n *\n * @ingroup init\n */\nGLFWAPI const char* glfwGetVersionString(void);\n\n/*! @brief Sets the error callback.\n *\n * This function sets the error callback, which is called with an error code\n * and a human-readable description each time a GLFW error occurs.\n *\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @remarks This function may be called before @ref glfwInit.\n *\n * @note The error callback is called by the thread where the error was\n * generated. If you are using GLFW from multiple threads, your error callback\n * needs to be written accordingly.\n *\n * @note Because the description string provided to the callback may have been\n * generated specifically for that error, it is not guaranteed to be valid\n * after the callback has returned. If you wish to use it after that, you need\n * to make your own copy of it before returning.\n *\n * @ingroup error\n */\nGLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);\n\n/*! @brief Returns the currently connected monitors.\n *\n * This function returns an array of handles for all currently connected\n * monitors.\n *\n * @param[out] count Where to store the size of the returned array. This is\n * set to zero if an error occurred.\n * @return An array of monitor handles, or `NULL` if an error occurred.\n *\n * @note The returned array is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned array is valid only until the monitor configuration\n * changes. See @ref glfwSetMonitorCallback to receive notifications of\n * configuration changes.\n *\n * @sa glfwGetPrimaryMonitor\n *\n * @ingroup monitor\n */\nGLFWAPI GLFWmonitor** glfwGetMonitors(int* count);\n\n/*! @brief Returns the primary monitor.\n *\n * This function returns the primary monitor. This is usually the monitor\n * where elements like the Windows task bar or the OS X menu bar is located.\n *\n * @return The primary monitor, or `NULL` if an error occurred.\n *\n * @sa glfwGetMonitors\n *\n * @ingroup monitor\n */\nGLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);\n\n/*! @brief Returns the position of the monitor's viewport on the virtual screen.\n *\n * This function returns the position, in screen coordinates, of the upper-left\n * corner of the specified monitor.\n *\n * @param[in] monitor The monitor to query.\n * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.\n * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.\n *\n * @ingroup monitor\n */\nGLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);\n\n/*! @brief Returns the physical size of the monitor.\n *\n * This function returns the size, in millimetres, of the display area of the\n * specified monitor.\n *\n * @param[in] monitor The monitor to query.\n * @param[out] width Where to store the width, in mm, of the monitor's display\n * area, or `NULL`.\n * @param[out] height Where to store the height, in mm, of the monitor's\n * display area, or `NULL`.\n *\n * @note Some operating systems do not provide accurate information, either\n * because the monitor's EDID data is incorrect, or because the driver does not\n * report it accurately.\n *\n * @ingroup monitor\n */\nGLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height);\n\n/*! @brief Returns the name of the specified monitor.\n *\n * This function returns a human-readable name, encoded as UTF-8, of the\n * specified monitor.\n *\n * @param[in] monitor The monitor to query.\n * @return The UTF-8 encoded name of the monitor, or `NULL` if an error\n * occurred.\n *\n * @note The returned string is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @ingroup monitor\n */\nGLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);\n\n/*! @brief Sets the monitor configuration callback.\n *\n * This function sets the monitor configuration callback, or removes the\n * currently set callback. This is called when a monitor is connected to or\n * disconnected from the system.\n *\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @bug **X11:** This callback is not yet called on monitor configuration\n * changes.\n *\n * @ingroup monitor\n */\nGLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);\n\n/*! @brief Returns the available video modes for the specified monitor.\n *\n * This function returns an array of all video modes supported by the specified\n * monitor. The returned array is sorted in ascending order, first by color\n * bit depth (the sum of all channel depths) and then by resolution area (the\n * product of width and height).\n *\n * @param[in] monitor The monitor to query.\n * @param[out] count Where to store the number of video modes in the returned\n * array. This is set to zero if an error occurred.\n * @return An array of video modes, or `NULL` if an error occurred.\n *\n * @note The returned array is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned array is valid only until this function is called again\n * for the specified monitor.\n *\n * @sa glfwGetVideoMode\n *\n * @ingroup monitor\n */\nGLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);\n\n/*! @brief Returns the current mode of the specified monitor.\n *\n * This function returns the current video mode of the specified monitor. If\n * you are using a full screen window, the return value will therefore depend\n * on whether it is focused.\n *\n * @param[in] monitor The monitor to query.\n * @return The current mode of the monitor, or `NULL` if an error occurred.\n *\n * @note The returned struct is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @sa glfwGetVideoModes\n *\n * @ingroup monitor\n */\nGLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);\n\n/*! @brief Generates a gamma ramp and sets it for the specified monitor.\n *\n * This function generates a 256-element gamma ramp from the specified exponent\n * and then calls @ref glfwSetGammaRamp with it.\n *\n * @param[in] monitor The monitor whose gamma ramp to set.\n * @param[in] gamma The desired exponent.\n *\n * @ingroup monitor\n */\nGLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);\n\n/*! @brief Retrieves the current gamma ramp for the specified monitor.\n *\n * This function retrieves the current gamma ramp of the specified monitor.\n *\n * @param[in] monitor The monitor to query.\n * @return The current gamma ramp, or `NULL` if an error occurred.\n *\n * @note The value arrays of the returned ramp are allocated and freed by GLFW.\n * You should not free them yourself.\n *\n * @ingroup monitor\n */\nGLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);\n\n/*! @brief Sets the current gamma ramp for the specified monitor.\n *\n * This function sets the current gamma ramp for the specified monitor.\n *\n * @param[in] monitor The monitor whose gamma ramp to set.\n * @param[in] ramp The gamma ramp to use.\n *\n * @note Gamma ramp sizes other than 256 are not supported by all hardware.\n *\n * @ingroup monitor\n */\nGLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);\n\n/*! @brief Resets all window hints to their default values.\n *\n * This function resets all window hints to their\n * [default values](@ref window_hints_values).\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwWindowHint\n *\n * @ingroup window\n */\nGLFWAPI void glfwDefaultWindowHints(void);\n\n/*! @brief Sets the specified window hint to the desired value.\n *\n * This function sets hints for the next call to @ref glfwCreateWindow. The\n * hints, once set, retain their values until changed by a call to @ref\n * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is\n * terminated with @ref glfwTerminate.\n *\n * @param[in] target The [window hint](@ref window_hints) to set.\n * @param[in] hint The new value of the window hint.\n *\n * @par New in GLFW 3\n * Hints are no longer reset to their default values on window creation. To\n * set default hint values, use @ref glfwDefaultWindowHints.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwDefaultWindowHints\n *\n * @ingroup window\n */\nGLFWAPI void glfwWindowHint(int target, int hint);\n\n/*! @brief Creates a window and its associated context.\n *\n * This function creates a window and its associated context. Most of the\n * options controlling how the window and its context should be created are\n * specified through @ref glfwWindowHint.\n *\n * Successful creation does not change which context is current. Before you\n * can use the newly created context, you need to make it current using @ref\n * glfwMakeContextCurrent.\n *\n * Note that the created window and context may differ from what you requested,\n * as not all parameters and hints are\n * [hard constraints](@ref window_hints_hard). This includes the size of the\n * window, especially for full screen windows. To retrieve the actual\n * attributes of the created window and context, use queries like @ref\n * glfwGetWindowAttrib and @ref glfwGetWindowSize.\n *\n * To create a full screen window, you need to specify the monitor to use. If\n * no monitor is specified, windowed mode will be used. Unless you have a way\n * for the user to choose a specific monitor, it is recommended that you pick\n * the primary monitor. For more information on how to retrieve monitors, see\n * @ref monitor_monitors.\n *\n * To create the window at a specific position, make it initially invisible\n * using the `GLFW_VISIBLE` window hint, set its position and then show it.\n *\n * If a full screen window is active, the screensaver is prohibited from\n * starting.\n *\n * @param[in] width The desired width, in screen coordinates, of the window.\n * This must be greater than zero.\n * @param[in] height The desired height, in screen coordinates, of the window.\n * This must be greater than zero.\n * @param[in] title The initial, UTF-8 encoded window title.\n * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use\n * windowed mode.\n * @param[in] share The window whose context to share resources with, or `NULL`\n * to not share resources.\n * @return The handle of the created window, or `NULL` if an error occurred.\n *\n * @remarks **Windows:** Window creation will fail if the Microsoft GDI\n * software OpenGL implementation is the only one available.\n *\n * @remarks **Windows:** If the executable has an icon resource named\n * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is\n * present, the `IDI_WINLOGO` icon will be used instead.\n *\n * @remarks **OS X:** The GLFW window has no icon, as it is not a document\n * window, but the dock icon will be the same as the application bundle's icon.\n * Also, the first time a window is opened the menu bar is populated with\n * common commands like Hide, Quit and About. The (minimal) about dialog uses\n * information from the application's bundle. For more information on bundles,\n * see the Bundle Programming Guide provided by Apple.\n *\n * @remarks **X11:** There is no mechanism for setting the window icon yet.\n *\n * @remarks The swap interval is not set during window creation, but is left at\n * the default value for that platform. For more information, see @ref\n * glfwSwapInterval.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwDestroyWindow\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);\n\n/*! @brief Destroys the specified window and its context.\n *\n * This function destroys the specified window and its context. On calling\n * this function, no further callbacks will be called for that window.\n *\n * @param[in] window The window to destroy.\n *\n * @note This function may only be called from the main thread.\n *\n * @note This function may not be called from a callback.\n *\n * @note If the window's context is current on the main thread, it is\n * detached before being destroyed.\n *\n * @warning The window's context must not be current on any other thread.\n *\n * @sa glfwCreateWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwDestroyWindow(GLFWwindow* window);\n\n/*! @brief Checks the close flag of the specified window.\n *\n * This function returns the value of the close flag of the specified window.\n *\n * @param[in] window The window to query.\n * @return The value of the close flag.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @ingroup window\n */\nGLFWAPI int glfwWindowShouldClose(GLFWwindow* window);\n\n/*! @brief Sets the close flag of the specified window.\n *\n * This function sets the value of the close flag of the specified window.\n * This can be used to override the user's attempt to close the window, or\n * to signal that it should be closed.\n *\n * @param[in] window The window whose flag to change.\n * @param[in] value The new value.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);\n\n/*! @brief Sets the title of the specified window.\n *\n * This function sets the window title, encoded as UTF-8, of the specified\n * window.\n *\n * @param[in] window The window whose title to change.\n * @param[in] title The UTF-8 encoded window title.\n *\n * @note This function may only be called from the main thread.\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);\n\n/*! @brief Retrieves the position of the client area of the specified window.\n *\n * This function retrieves the position, in screen coordinates, of the\n * upper-left corner of the client area of the specified window.\n *\n * @param[in] window The window to query.\n * @param[out] xpos Where to store the x-coordinate of the upper-left corner of\n * the client area, or `NULL`.\n * @param[out] ypos Where to store the y-coordinate of the upper-left corner of\n * the client area, or `NULL`.\n *\n * @sa glfwSetWindowPos\n *\n * @ingroup window\n */\nGLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);\n\n/*! @brief Sets the position of the client area of the specified window.\n *\n * This function sets the position, in screen coordinates, of the upper-left\n * corner of the client area of the window.\n *\n * If the specified window is a full screen window, this function does nothing.\n *\n * If you wish to set an initial window position you should create a hidden\n * window (using @ref glfwWindowHint and `GLFW_VISIBLE`), set its position and\n * then show it.\n *\n * @param[in] window The window to query.\n * @param[in] xpos The x-coordinate of the upper-left corner of the client area.\n * @param[in] ypos The y-coordinate of the upper-left corner of the client area.\n *\n * @note It is very rarely a good idea to move an already visible window, as it\n * will confuse and annoy the user.\n *\n * @note This function may only be called from the main thread.\n *\n * @note The window manager may put limits on what positions are allowed.\n *\n * @sa glfwGetWindowPos\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);\n\n/*! @brief Retrieves the size of the client area of the specified window.\n *\n * This function retrieves the size, in screen coordinates, of the client area\n * of the specified window. If you wish to retrieve the size of the\n * framebuffer in pixels, see @ref glfwGetFramebufferSize.\n *\n * @param[in] window The window whose size to retrieve.\n * @param[out] width Where to store the width, in screen coordinates, of the\n * client area, or `NULL`.\n * @param[out] height Where to store the height, in screen coordinates, of the\n * client area, or `NULL`.\n *\n * @sa glfwSetWindowSize\n *\n * @ingroup window\n */\nGLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);\n\n/*! @brief Sets the size of the client area of the specified window.\n *\n * This function sets the size, in screen coordinates, of the client area of\n * the specified window.\n *\n * For full screen windows, this function selects and switches to the resolution\n * closest to the specified size, without affecting the window's context. As\n * the context is unaffected, the bit depths of the framebuffer remain\n * unchanged.\n *\n * @param[in] window The window to resize.\n * @param[in] width The desired width of the specified window.\n * @param[in] height The desired height of the specified window.\n *\n * @note This function may only be called from the main thread.\n *\n * @note The window manager may put limits on what window sizes are allowed.\n *\n * @sa glfwGetWindowSize\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);\n\n/*! @brief Retrieves the size of the framebuffer of the specified window.\n *\n * This function retrieves the size, in pixels, of the framebuffer of the\n * specified window. If you wish to retrieve the size of the window in screen\n * coordinates, see @ref glfwGetWindowSize.\n *\n * @param[in] window The window whose framebuffer to query.\n * @param[out] width Where to store the width, in pixels, of the framebuffer,\n * or `NULL`.\n * @param[out] height Where to store the height, in pixels, of the framebuffer,\n * or `NULL`.\n *\n * @sa glfwSetFramebufferSizeCallback\n *\n * @ingroup window\n */\nGLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);\n\n/*! @brief Iconifies the specified window.\n *\n * This function iconifies/minimizes the specified window, if it was previously\n * restored. If it is a full screen window, the original monitor resolution is\n * restored until the window is restored. If the window is already iconified,\n * this function does nothing.\n *\n * @param[in] window The window to iconify.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwRestoreWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwIconifyWindow(GLFWwindow* window);\n\n/*! @brief Restores the specified window.\n *\n * This function restores the specified window, if it was previously\n * iconified/minimized. If it is a full screen window, the resolution chosen\n * for the window is restored on the selected monitor. If the window is\n * already restored, this function does nothing.\n *\n * @param[in] window The window to restore.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwIconifyWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwRestoreWindow(GLFWwindow* window);\n\n/*! @brief Makes the specified window visible.\n *\n * This function makes the specified window visible, if it was previously\n * hidden. If the window is already visible or is in full screen mode, this\n * function does nothing.\n *\n * @param[in] window The window to make visible.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwHideWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwShowWindow(GLFWwindow* window);\n\n/*! @brief Hides the specified window.\n *\n * This function hides the specified window, if it was previously visible. If\n * the window is already hidden or is in full screen mode, this function does\n * nothing.\n *\n * @param[in] window The window to hide.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwShowWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwHideWindow(GLFWwindow* window);\n\n/*! @brief Returns the monitor that the window uses for full screen mode.\n *\n * This function returns the handle of the monitor that the specified window is\n * in full screen on.\n *\n * @param[in] window The window to query.\n * @return The monitor, or `NULL` if the window is in windowed mode.\n *\n * @ingroup window\n */\nGLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);\n\n/*! @brief Returns an attribute of the specified window.\n *\n * This function returns an attribute of the specified window. There are many\n * attributes, some related to the window and others to its context.\n *\n * @param[in] window The window to query.\n * @param[in] attrib The [window attribute](@ref window_attribs) whose value to\n * return.\n * @return The value of the attribute, or zero if an error occurred.\n *\n * @ingroup window\n */\nGLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);\n\n/*! @brief Sets the user pointer of the specified window.\n *\n * This function sets the user-defined pointer of the specified window. The\n * current value is retained until the window is destroyed. The initial value\n * is `NULL`.\n *\n * @param[in] window The window whose pointer to set.\n * @param[in] pointer The new value.\n *\n * @sa glfwGetWindowUserPointer\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);\n\n/*! @brief Returns the user pointer of the specified window.\n *\n * This function returns the current value of the user-defined pointer of the\n * specified window. The initial value is `NULL`.\n *\n * @param[in] window The window whose pointer to return.\n *\n * @sa glfwSetWindowUserPointer\n *\n * @ingroup window\n */\nGLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);\n\n/*! @brief Sets the position callback for the specified window.\n *\n * This function sets the position callback of the specified window, which is\n * called when the window is moved. The callback is provided with the screen\n * position of the upper-left corner of the client area of the window.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);\n\n/*! @brief Sets the size callback for the specified window.\n *\n * This function sets the size callback of the specified window, which is\n * called when the window is resized. The callback is provided with the size,\n * in screen coordinates, of the client area of the window.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);\n\n/*! @brief Sets the close callback for the specified window.\n *\n * This function sets the close callback of the specified window, which is\n * called when the user attempts to close the window, for example by clicking\n * the close widget in the title bar.\n *\n * The close flag is set before this callback is called, but you can modify it\n * at any time with @ref glfwSetWindowShouldClose.\n *\n * The close callback is not triggered by @ref glfwDestroyWindow.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @par New in GLFW 3\n * The close callback no longer returns a value.\n *\n * @remarks **OS X:** Selecting Quit from the application menu will\n * trigger the close callback for all windows.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);\n\n/*! @brief Sets the refresh callback for the specified window.\n *\n * This function sets the refresh callback of the specified window, which is\n * called when the client area of the window needs to be redrawn, for example\n * if the window has been exposed after having been covered by another window.\n *\n * On compositing window systems such as Aero, Compiz or Aqua, where the window\n * contents are saved off-screen, this callback may be called only very\n * infrequently or never at all.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @note On compositing window systems such as Aero, Compiz or Aqua, where the\n * window contents are saved off-screen, this callback may be called only very\n * infrequently or never at all.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);\n\n/*! @brief Sets the focus callback for the specified window.\n *\n * This function sets the focus callback of the specified window, which is\n * called when the window gains or loses focus.\n *\n * After the focus callback is called for a window that lost focus, synthetic\n * key and mouse button release events will be generated for all such that had\n * been pressed. For more information, see @ref glfwSetKeyCallback and @ref\n * glfwSetMouseButtonCallback.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);\n\n/*! @brief Sets the iconify callback for the specified window.\n *\n * This function sets the iconification callback of the specified window, which\n * is called when the window is iconified or restored.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);\n\n/*! @brief Sets the framebuffer resize callback for the specified window.\n *\n * This function sets the framebuffer resize callback of the specified window,\n * which is called when the framebuffer of the specified window is resized.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);\n\n/*! @brief Processes all pending events.\n *\n * This function processes only those events that have already been received\n * and then returns immediately. Processing events will cause the window and\n * input callbacks associated with those events to be called.\n *\n * This function is not required for joystick input to work.\n *\n * @par New in GLFW 3\n * This function is no longer called by @ref glfwSwapBuffers. You need to call\n * it or @ref glfwWaitEvents yourself.\n *\n * @remarks On some platforms, a window move, resize or menu operation will\n * cause event processing to block. This is due to how event processing is\n * designed on those platforms. You can use the\n * [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents\n * of your window when necessary during the operation.\n *\n * @note This function may only be called from the main thread.\n *\n * @note This function may not be called from a callback.\n *\n * @note On some platforms, certain callbacks may be called outside of a call\n * to one of the event processing functions.\n *\n * @sa glfwWaitEvents\n *\n * @ingroup window\n */\nGLFWAPI void glfwPollEvents(void);\n\n/*! @brief Waits until events are pending and processes them.\n *\n * This function puts the calling thread to sleep until at least one event has\n * been received. Once one or more events have been received, it behaves as if\n * @ref glfwPollEvents was called, i.e. the events are processed and the\n * function then returns immediately. Processing events will cause the window\n * and input callbacks associated with those events to be called.\n *\n * Since not all events are associated with callbacks, this function may return\n * without a callback having been called even if you are monitoring all\n * callbacks.\n *\n * This function is not required for joystick input to work.\n *\n * @remarks On some platforms, a window move, resize or menu operation will\n * cause event processing to block. This is due to how event processing is\n * designed on those platforms. You can use the\n * [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents\n * of your window when necessary during the operation.\n *\n * @note This function may only be called from the main thread.\n *\n * @note This function may not be called from a callback.\n *\n * @note On some platforms, certain callbacks may be called outside of a call\n * to one of the event processing functions.\n *\n * @sa glfwPollEvents\n *\n * @ingroup window\n */\nGLFWAPI void glfwWaitEvents(void);\n\n/*! @brief Returns the value of an input option for the specified window.\n *\n * @param[in] window The window to query.\n * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or\n * `GLFW_STICKY_MOUSE_BUTTONS`.\n *\n * @sa glfwSetInputMode\n *\n * @ingroup input\n */\nGLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);\n\n/*! @brief Sets an input option for the specified window.\n * @param[in] window The window whose input mode to set.\n * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or\n * `GLFW_STICKY_MOUSE_BUTTONS`.\n * @param[in] value The new value of the specified input mode.\n *\n * If `mode` is `GLFW_CURSOR`, the value must be one of the supported input\n * modes:\n * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.\n * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client\n * area of the window but does not restrict the cursor from leaving. This is\n * useful if you wish to render your own cursor or have no visible cursor at\n * all.\n * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual\n * and unlimited cursor movement. This is useful for implementing for\n * example 3D camera controls.\n *\n * If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to\n * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are\n * enabled, a key press will ensure that @ref glfwGetKey returns @ref\n * GLFW_PRESS the next time it is called even if the key had been released\n * before the call. This is useful when you are only interested in whether\n * keys have been pressed but not when or in which order.\n *\n * If `mode` is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either `GL_TRUE`\n * to enable sticky mouse buttons, or `GL_FALSE` to disable it. If sticky\n * mouse buttons are enabled, a mouse button press will ensure that @ref\n * glfwGetMouseButton returns @ref GLFW_PRESS the next time it is called even\n * if the mouse button had been released before the call. This is useful when\n * you are only interested in whether mouse buttons have been pressed but not\n * when or in which order.\n *\n * @sa glfwGetInputMode\n *\n * @ingroup input\n */\nGLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);\n\n/*! @brief Returns the last reported state of a keyboard key for the specified\n * window.\n *\n * This function returns the last state reported for the specified key to the\n * specified window. The returned state is one of `GLFW_PRESS` or\n * `GLFW_RELEASE`. The higher-level state `GLFW_REPEAT` is only reported to\n * the key callback.\n *\n * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns\n * `GLFW_PRESS` the first time you call this function after a key has been\n * pressed, even if the key has already been released.\n *\n * The key functions deal with physical keys, with [key tokens](@ref keys)\n * named after their use on the standard US keyboard layout. If you want to\n * input text, use the Unicode character callback instead.\n *\n * @param[in] window The desired window.\n * @param[in] key The desired [keyboard key](@ref keys).\n * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.\n *\n * @note `GLFW_KEY_UNKNOWN` is not a valid key for this function.\n *\n * @ingroup input\n */\nGLFWAPI int glfwGetKey(GLFWwindow* window, int key);\n\n/*! @brief Returns the last reported state of a mouse button for the specified\n * window.\n *\n * This function returns the last state reported for the specified mouse button\n * to the specified window.\n *\n * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function\n * returns `GLFW_PRESS` the first time you call this function after a mouse\n * button has been pressed, even if the mouse button has already been released.\n *\n * @param[in] window The desired window.\n * @param[in] button The desired [mouse button](@ref buttons).\n * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.\n *\n * @ingroup input\n */\nGLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);\n\n/*! @brief Retrieves the last reported cursor position, relative to the client\n * area of the window.\n *\n * This function returns the last reported position of the cursor, in screen\n * coordinates, relative to the upper-left corner of the client area of the\n * specified window.\n *\n * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor\n * position is unbounded and limited only by the minimum and maximum values of\n * a `double`.\n *\n * The coordinate can be converted to their integer equivalents with the\n * `floor` function. Casting directly to an integer type works for positive\n * coordinates, but fails for negative ones.\n *\n * @param[in] window The desired window.\n * @param[out] xpos Where to store the cursor x-coordinate, relative to the\n * left edge of the client area, or `NULL`.\n * @param[out] ypos Where to store the cursor y-coordinate, relative to the to\n * top edge of the client area, or `NULL`.\n *\n * @sa glfwSetCursorPos\n *\n * @ingroup input\n */\nGLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);\n\n/*! @brief Sets the position of the cursor, relative to the client area of the\n * window.\n *\n * This function sets the position, in screen coordinates, of the cursor\n * relative to the upper-left corner of the client area of the specified\n * window. The window must be focused. If the window does not have focus when\n * this function is called, it fails silently.\n *\n * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor\n * position is unbounded and limited only by the minimum and maximum values of\n * a `double`.\n *\n * @param[in] window The desired window.\n * @param[in] xpos The desired x-coordinate, relative to the left edge of the\n * client area.\n * @param[in] ypos The desired y-coordinate, relative to the top edge of the\n * client area.\n *\n * @sa glfwGetCursorPos\n *\n * @ingroup input\n */\nGLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);\n\n/*! @brief Sets the key callback.\n *\n * This function sets the key callback of the specific window, which is called\n * when a key is pressed, repeated or released.\n *\n * The key functions deal with physical keys, with layout independent\n * [key tokens](@ref keys) named after their values in the standard US keyboard\n * layout. If you want to input text, use the\n * [character callback](@ref glfwSetCharCallback) instead.\n *\n * When a window loses focus, it will generate synthetic key release events\n * for all pressed keys. You can tell these events from user-generated events\n * by the fact that the synthetic ones are generated after the window has lost\n * focus, i.e. `GLFW_FOCUSED` will be false and the focus callback will have\n * already been called.\n *\n * The scancode of a key is specific to that platform or sometimes even to that\n * machine. Scancodes are intended to allow users to bind keys that don't have\n * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their\n * state is not saved and so it cannot be retrieved with @ref glfwGetKey.\n *\n * Sometimes GLFW needs to generate synthetic key events, in which case the\n * scancode may be zero.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new key callback, or `NULL` to remove the currently\n * set callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);\n\n/*! @brief Sets the Unicode character callback.\n *\n * This function sets the character callback of the specific window, which is\n * called when a Unicode character is input.\n *\n * The character callback is intended for text input. If you want to know\n * whether a specific key was pressed or released, use the\n * [key callback](@ref glfwSetKeyCallback) instead.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);\n\n/*! @brief Sets the mouse button callback.\n *\n * This function sets the mouse button callback of the specified window, which\n * is called when a mouse button is pressed or released.\n *\n * When a window loses focus, it will generate synthetic mouse button release\n * events for all pressed mouse buttons. You can tell these events from\n * user-generated events by the fact that the synthetic ones are generated\n * after the window has lost focus, i.e. `GLFW_FOCUSED` will be false and the\n * focus callback will have already been called.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);\n\n/*! @brief Sets the cursor position callback.\n *\n * This function sets the cursor position callback of the specified window,\n * which is called when the cursor is moved. The callback is provided with the\n * position, in screen coordinates, relative to the upper-left corner of the\n * client area of the window.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);\n\n/*! @brief Sets the cursor enter/exit callback.\n *\n * This function sets the cursor boundary crossing callback of the specified\n * window, which is called when the cursor enters or leaves the client area of\n * the window.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);\n\n/*! @brief Sets the scroll callback.\n *\n * This function sets the scroll callback of the specified window, which is\n * called when a scrolling device is used, such as a mouse wheel or scrolling\n * area of a touchpad.\n *\n * The scroll callback receives all scrolling input, like that from a mouse\n * wheel or a touchpad scrolling area.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently\n * set callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);\n\n/*! @brief Returns whether the specified joystick is present.\n *\n * This function returns whether the specified joystick is present.\n *\n * @param[in] joy The joystick to query.\n * @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.\n *\n * @ingroup input\n */\nGLFWAPI int glfwJoystickPresent(int joy);\n\n/*! @brief Returns the values of all axes of the specified joystick.\n *\n * This function returns the values of all axes of the specified joystick.\n *\n * @param[in] joy The joystick to query.\n * @param[out] count Where to store the size of the returned array. This is\n * set to zero if an error occurred.\n * @return An array of axis values, or `NULL` if the joystick is not present.\n *\n * @note The returned array is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned array is valid only until the next call to @ref\n * glfwGetJoystickAxes for that joystick.\n *\n * @ingroup input\n */\nGLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);\n\n/*! @brief Returns the state of all buttons of the specified joystick.\n *\n * This function returns the state of all buttons of the specified joystick.\n *\n * @param[in] joy The joystick to query.\n * @param[out] count Where to store the size of the returned array. This is\n * set to zero if an error occurred.\n * @return An array of button states, or `NULL` if the joystick is not present.\n *\n * @note The returned array is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned array is valid only until the next call to @ref\n * glfwGetJoystickButtons for that joystick.\n *\n * @ingroup input\n */\nGLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);\n\n/*! @brief Returns the name of the specified joystick.\n *\n * This function returns the name, encoded as UTF-8, of the specified joystick.\n *\n * @param[in] joy The joystick to query.\n * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick\n * is not present.\n *\n * @note The returned string is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned string is valid only until the next call to @ref\n * glfwGetJoystickName for that joystick.\n *\n * @ingroup input\n */\nGLFWAPI const char* glfwGetJoystickName(int joy);\n\n/*! @brief Sets the clipboard to the specified string.\n *\n * This function sets the system clipboard to the specified, UTF-8 encoded\n * string. The string is copied before returning, so you don't have to retain\n * it afterwards.\n *\n * @param[in] window The window that will own the clipboard contents.\n * @param[in] string A UTF-8 encoded string.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwGetClipboardString\n *\n * @ingroup clipboard\n */\nGLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);\n\n/*! @brief Retrieves the contents of the clipboard as a string.\n *\n * This function returns the contents of the system clipboard, if it contains\n * or is convertible to a UTF-8 encoded string.\n *\n * @param[in] window The window that will request the clipboard contents.\n * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`\n * if an error occurred.\n *\n * @note This function may only be called from the main thread.\n *\n * @note The returned string is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned string is valid only until the next call to @ref\n * glfwGetClipboardString or @ref glfwSetClipboardString.\n *\n * @sa glfwSetClipboardString\n *\n * @ingroup clipboard\n */\nGLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);\n\n/*! @brief Returns the value of the GLFW timer.\n *\n * This function returns the value of the GLFW timer. Unless the timer has\n * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW\n * was initialized.\n *\n * @return The current value, in seconds, or zero if an error occurred.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @note The resolution of the timer is system dependent, but is usually on the\n * order of a few micro- or nanoseconds. It uses the highest-resolution\n * monotonic time source on each supported platform.\n *\n * @ingroup time\n */\nGLFWAPI double glfwGetTime(void);\n\n/*! @brief Sets the GLFW timer.\n *\n * This function sets the value of the GLFW timer. It then continues to count\n * up from that value.\n *\n * @param[in] time The new value, in seconds.\n *\n * @note The resolution of the timer is system dependent, but is usually on the\n * order of a few micro- or nanoseconds. It uses the highest-resolution\n * monotonic time source on each supported platform.\n *\n * @ingroup time\n */\nGLFWAPI void glfwSetTime(double time);\n\n/*! @brief Makes the context of the specified window current for the calling\n * thread.\n *\n * This function makes the context of the specified window current on the\n * calling thread. A context can only be made current on a single thread at\n * a time and each thread can have only a single current context at a time.\n *\n * @param[in] window The window whose context to make current, or `NULL` to\n * detach the current context.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @sa glfwGetCurrentContext\n *\n * @ingroup context\n */\nGLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);\n\n/*! @brief Returns the window whose context is current on the calling thread.\n *\n * This function returns the window whose context is current on the calling\n * thread.\n *\n * @return The window whose context is current, or `NULL` if no window's\n * context is current.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @sa glfwMakeContextCurrent\n *\n * @ingroup context\n */\nGLFWAPI GLFWwindow* glfwGetCurrentContext(void);\n\n/*! @brief Swaps the front and back buffers of the specified window.\n *\n * This function swaps the front and back buffers of the specified window. If\n * the swap interval is greater than zero, the GPU driver waits the specified\n * number of screen updates before swapping the buffers.\n *\n * @param[in] window The window whose buffers to swap.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @par New in GLFW 3\n * This function no longer calls @ref glfwPollEvents. You need to call it or\n * @ref glfwWaitEvents yourself.\n *\n * @sa glfwSwapInterval\n *\n * @ingroup context\n */\nGLFWAPI void glfwSwapBuffers(GLFWwindow* window);\n\n/*! @brief Sets the swap interval for the current context.\n *\n * This function sets the swap interval for the current context, i.e. the\n * number of screen updates to wait before swapping the buffers of a window and\n * returning from @ref glfwSwapBuffers. This is sometimes called 'vertical\n * synchronization', 'vertical retrace synchronization' or 'vsync'.\n *\n * Contexts that support either of the `WGL_EXT_swap_control_tear` and\n * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,\n * which allow the driver to swap even if a frame arrives a little bit late.\n * You can check for the presence of these extensions using @ref\n * glfwExtensionSupported. For more information about swap tearing, see the\n * extension specifications.\n *\n * @param[in] interval The minimum number of screen updates to wait for\n * until the buffers are swapped by @ref glfwSwapBuffers.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @note This function is not called during window creation, leaving the swap\n * interval set to whatever is the default on that platform. This is done\n * because some swap interval extensions used by GLFW do not allow the swap\n * interval to be reset to zero once it has been set to a non-zero value.\n *\n * @note Some GPU drivers do not honor the requested swap interval, either\n * because of user settings that override the request or due to bugs in the\n * driver.\n *\n * @sa glfwSwapBuffers\n *\n * @ingroup context\n */\nGLFWAPI void glfwSwapInterval(int interval);\n\n/*! @brief Returns whether the specified extension is available.\n *\n * This function returns whether the specified\n * [OpenGL or context creation API extension](@ref context_glext) is supported\n * by the current context. For example, on Windows both the OpenGL and WGL\n * extension strings are checked.\n *\n * @param[in] extension The ASCII encoded name of the extension.\n * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @note As this functions searches one or more extension strings on each call,\n * it is recommended that you cache its results if it's going to be used\n * frequently. The extension strings will not change during the lifetime of\n * a context, so there is no danger in doing this.\n *\n * @ingroup context\n */\nGLFWAPI int glfwExtensionSupported(const char* extension);\n\n/*! @brief Returns the address of the specified function for the current\n * context.\n *\n * This function returns the address of the specified\n * [client API or extension function](@ref context_glext), if it is supported\n * by the current context.\n *\n * @param[in] procname The ASCII encoded name of the function.\n * @return The address of the function, or `NULL` if the function is\n * unavailable.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @note The addresses of these functions are not guaranteed to be the same for\n * all contexts, especially if they use different client APIs or even different\n * context creation hints.\n *\n * @ingroup context\n */\nGLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);\n\n\n/*************************************************************************\n * Global definition cleanup\n *************************************************************************/\n\n/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */\n\n#ifdef GLFW_WINGDIAPI_DEFINED\n #undef WINGDIAPI\n #undef GLFW_WINGDIAPI_DEFINED\n#endif\n\n#ifdef GLFW_CALLBACK_DEFINED\n #undef CALLBACK\n #undef GLFW_CALLBACK_DEFINED\n#endif\n\n/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _glfw3_h_ */\n\n"}, {"path": "includes/GLFW/glfw3native.h", "language": "code", "loc": 159, "comment_density": 0.66, "code": "/*************************************************************************\n * GLFW 3.0 - www.glfw.org\n * A library for OpenGL, window and input\n *------------------------------------------------------------------------\n * Copyright (c) 2002-2006 Marcus Geelnard\n * Copyright (c) 2006-2010 Camilla Berglund \n *\n * This software is provided 'as-is', without any express or implied\n * warranty. In no event will the authors be held liable for any damages\n * arising from the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, subject to the following restrictions:\n *\n * 1. The origin of this software must not be misrepresented; you must not\n * claim that you wrote the original software. If you use this software\n * in a product, an acknowledgment in the product documentation would\n * be appreciated but is not required.\n *\n * 2. Altered source versions must be plainly marked as such, and must not\n * be misrepresented as being the original software.\n *\n * 3. This notice may not be removed or altered from any source\n * distribution.\n *\n *************************************************************************/\n\n#ifndef _glfw3_native_h_\n#define _glfw3_native_h_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/*************************************************************************\n * Doxygen documentation\n *************************************************************************/\n\n/*! @defgroup native Native access\n *\n * **By using the native API, you assert that you know what you're doing and\n * how to fix problems caused by using it. If you don't, you shouldn't be\n * using it.**\n *\n * Before the inclusion of @ref glfw3native.h, you must define exactly one\n * window API macro and exactly one context API macro. Failure to do this\n * will cause a compile-time error.\n *\n * The available window API macros are:\n * * `GLFW_EXPOSE_NATIVE_WIN32`\n * * `GLFW_EXPOSE_NATIVE_COCOA`\n * * `GLFW_EXPOSE_NATIVE_X11`\n *\n * The available context API macros are:\n * * `GLFW_EXPOSE_NATIVE_WGL`\n * * `GLFW_EXPOSE_NATIVE_NSGL`\n * * `GLFW_EXPOSE_NATIVE_GLX`\n * * `GLFW_EXPOSE_NATIVE_EGL`\n *\n * These macros select which of the native access functions that are declared\n * and which platform-specific headers to include. It is then up your (by\n * definition platform-specific) code to handle which of these should be\n * defined.\n */\n\n\n/*************************************************************************\n * System headers and types\n *************************************************************************/\n\n#if defined(GLFW_EXPOSE_NATIVE_WIN32)\n #include \n#elif defined(GLFW_EXPOSE_NATIVE_COCOA)\n #if defined(__OBJC__)\n #import \n #else\n typedef void* id;\n #endif\n#elif defined(GLFW_EXPOSE_NATIVE_X11)\n #include \n#else\n #error \"No window API specified\"\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_WGL)\n /* WGL is declared by windows.h */\n#elif defined(GLFW_EXPOSE_NATIVE_NSGL)\n /* NSGL is declared by Cocoa.h */\n#elif defined(GLFW_EXPOSE_NATIVE_GLX)\n #include \n#elif defined(GLFW_EXPOSE_NATIVE_EGL)\n #include \n#else\n #error \"No context API specified\"\n#endif\n\n\n/*************************************************************************\n * Functions\n *************************************************************************/\n\n#if defined(GLFW_EXPOSE_NATIVE_WIN32)\n/*! @brief Returns the `HWND` of the specified window.\n * @return The `HWND` of the specified window.\n * @ingroup native\n */\nGLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_WGL)\n/*! @brief Returns the `HGLRC` of the specified window.\n * @return The `HGLRC` of the specified window.\n * @ingroup native\n */\nGLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_COCOA)\n/*! @brief Returns the `NSWindow` of the specified window.\n * @return The `NSWindow` of the specified window.\n * @ingroup native\n */\nGLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_NSGL)\n/*! @brief Returns the `NSOpenGLContext` of the specified window.\n * @return The `NSOpenGLContext` of the specified window.\n * @ingroup native\n */\nGLFWAPI id glfwGetNSGLContext(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_X11)\n/*! @brief Returns the `Display` used by GLFW.\n * @return The `Display` used by GLFW.\n * @ingroup native\n */\nGLFWAPI Display* glfwGetX11Display(void);\n/*! @brief Returns the `Window` of the specified window.\n * @return The `Window` of the specified window.\n * @ingroup native\n */\nGLFWAPI Window glfwGetX11Window(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_GLX)\n/*! @brief Returns the `GLXContext` of the specified window.\n * @return The `GLXContext` of the specified window.\n * @ingroup native\n */\nGLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_EGL)\n/*! @brief Returns the `EGLDisplay` used by GLFW.\n * @return The `EGLDisplay` used by GLFW.\n * @ingroup native\n */\nGLFWAPI EGLDisplay glfwGetEGLDisplay(void);\n/*! @brief Returns the `EGLContext` of the specified window.\n * @return The `EGLContext` of the specified window.\n * @ingroup native\n */\nGLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);\n/*! @brief Returns the `EGLSurface` of the specified window.\n * @return The `EGLSurface` of the specified window.\n * @ingroup native\n */\nGLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _glfw3_native_h_ */\n\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.738, "dedup_hash": "4e18b0b99bb1b3ed", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Glm", "api": "OpenGL Core", "glsl_version": null, "topic": "bumpmapping/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/common.hpp", "language": "code", "loc": 482, "comment_density": 0.809, "code": "/// @ref core\n/// @file glm/common.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n///\n/// @defgroup core_func_common Common functions\n/// @ingroup core\n///\n/// Provides GLSL common functions\n///\n/// These all operate component-wise. The description is per component.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"detail/qualifier.hpp\"\n#include \"detail/_fixes.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_common\n\t/// @{\n\n\t/// Returns x if x >= 0; otherwise, it returns -x.\n\t///\n\t/// @tparam genType floating-point or signed integer; scalar or vector types.\n\t///\n\t/// @see GLSL abs man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType abs(genType x);\n\n\t/// Returns x if x >= 0; otherwise, it returns -x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL abs man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec abs(vec const& x);\n\n\t/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL sign man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec sign(vec const& x);\n\n\t/// Returns a value equal to the nearest integer that is less than or equal to x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL floor man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec floor(vec const& x);\n\n\t/// Returns a value equal to the nearest integer to x\n\t/// whose absolute value is not larger than the absolute value of x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL trunc man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec trunc(vec const& x);\n\n\t/// Returns a value equal to the nearest integer to x.\n\t/// The fraction 0.5 will round in a direction chosen by the\n\t/// implementation, presumably the direction that is fastest.\n\t/// This includes the possibility that round(x) returns the\n\t/// same value as roundEven(x) for all values of x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL round man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec round(vec const& x);\n\n\t/// Returns a value equal to the nearest integer to x.\n\t/// A fractional part of 0.5 will round toward the nearest even\n\t/// integer. (Both 3.5 and 4.5 for x will return 4.0.)\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL roundEven man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\t/// @see New round to even technique\n\ttemplate\n\tGLM_FUNC_DECL vec roundEven(vec const& x);\n\n\t/// Returns a value equal to the nearest integer\n\t/// that is greater than or equal to x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL ceil man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec ceil(vec const& x);\n\n\t/// Return x - floor(x).\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL fract man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType fract(genType x);\n\n\t/// Return x - floor(x).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL fract man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec fract(vec const& x);\n\n\ttemplate\n\tGLM_FUNC_DECL genType mod(genType x, genType y);\n\n\ttemplate\n\tGLM_FUNC_DECL vec mod(vec const& x, T y);\n\n\t/// Modulus. Returns x - y * floor(x / y)\n\t/// for each component in x using the floating point value y.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types, include glm/gtc/integer for integer scalar types support\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL mod man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec mod(vec const& x, vec const& y);\n\n\t/// Returns the fractional part of x and sets i to the integer\n\t/// part (as a whole number floating point value). Both the\n\t/// return value and the output parameter will have the same\n\t/// sign as x.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL modf man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType modf(genType x, genType& i);\n\n\t/// Returns y if y < x; otherwise, it returns x.\n\t///\n\t/// @tparam genType Floating-point or integer; scalar or vector types.\n\t///\n\t/// @see GLSL min man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType min(genType x, genType y);\n\n\t/// Returns y if y < x; otherwise, it returns x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL min man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& x, T y);\n\n\t/// Returns y if y < x; otherwise, it returns x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL min man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& x, vec const& y);\n\n\t/// Returns y if x < y; otherwise, it returns x.\n\t///\n\t/// @tparam genType Floating-point or integer; scalar or vector types.\n\t///\n\t/// @see GLSL max man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType max(genType x, genType y);\n\n\t/// Returns y if x < y; otherwise, it returns x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL max man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec max(vec const& x, T y);\n\n\t/// Returns y if x < y; otherwise, it returns x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL max man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec max(vec const& x, vec const& y);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x\n\t/// using the floating-point values minVal and maxVal.\n\t///\n\t/// @tparam genType Floating-point or integer; scalar or vector types.\n\t///\n\t/// @see GLSL clamp man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType clamp(genType x, genType minVal, genType maxVal);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x\n\t/// using the floating-point values minVal and maxVal.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL clamp man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec clamp(vec const& x, T minVal, T maxVal);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x\n\t/// using the floating-point values minVal and maxVal.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL clamp man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec clamp(vec const& x, vec const& minVal, vec const& maxVal);\n\n\t/// If genTypeU is a floating scalar or vector:\n\t/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of\n\t/// x and y using the floating-point value a.\n\t/// The value for a is not restricted to the range [0, 1].\n\t///\n\t/// If genTypeU is a boolean scalar or vector:\n\t/// Selects which vector each returned component comes\n\t/// from. For a component of 'a' that is false, the\n\t/// corresponding component of 'x' is returned. For a\n\t/// component of 'a' that is true, the corresponding\n\t/// component of 'y' is returned. Components of 'x' and 'y' that\n\t/// are not selected are allowed to be invalid floating point\n\t/// values and will have no effect on the results. Thus, this\n\t/// provides different functionality than\n\t/// genType mix(genType x, genType y, genType(a))\n\t/// where a is a Boolean vector.\n\t///\n\t/// @see GLSL mix man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\t///\n\t/// @param[in] x Value to interpolate.\n\t/// @param[in] y Value to interpolate.\n\t/// @param[in] a Interpolant.\n\t///\n\t/// @tparam\tgenTypeT Floating point scalar or vector.\n\t/// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT.\n\t///\n\t/// @code\n\t/// #include \n\t/// ...\n\t/// float a;\n\t/// bool b;\n\t/// glm::dvec3 e;\n\t/// glm::dvec3 f;\n\t/// glm::vec4 g;\n\t/// glm::vec4 h;\n\t/// ...\n\t/// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors.\n\t/// glm::vec4 s = glm::mix(g, h, b); // Returns g or h;\n\t/// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second.\n\t/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.\n\t/// @endcode\n\ttemplate\n\tGLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);\n\n\ttemplate\n\tGLM_FUNC_DECL vec mix(vec const& x, vec const& y, vec const& a);\n\n\ttemplate\n\tGLM_FUNC_DECL vec mix(vec const& x, vec const& y, U a);\n\n\t/// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.\n\t///\n\t/// @see GLSL step man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType step(genType edge, genType x);\n\n\t/// Returns 0.0 if x < edge, otherwise it returns 1.0.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL step man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec step(T edge, vec const& x);\n\n\t/// Returns 0.0 if x < edge, otherwise it returns 1.0.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL step man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec step(vec const& edge, vec const& x);\n\n\t/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and\n\t/// performs smooth Hermite interpolation between 0 and 1\n\t/// when edge0 < x < edge1. This is useful in cases where\n\t/// you would want a threshold function with a smooth\n\t/// transition. This is equivalent to:\n\t/// genType t;\n\t/// t = clamp ((x - edge0) / (edge1 - edge0), 0, 1);\n\t/// return t * t * (3 - 2 * t);\n\t/// Results are undefined if edge0 >= edge1.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL smoothstep man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);\n\n\ttemplate\n\tGLM_FUNC_DECL vec smoothstep(T edge0, T edge1, vec const& x);\n\n\ttemplate\n\tGLM_FUNC_DECL vec smoothstep(vec const& edge0, vec const& edge1, vec const& x);\n\n\t/// Returns true if x holds a NaN (not a number)\n\t/// representation in the underlying implementation's set of\n\t/// floating point representations. Returns false otherwise,\n\t/// including for implementations with no NaN\n\t/// representations.\n\t///\n\t/// /!\\ When using compiler fast math, this function may fail.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL isnan man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec isnan(vec const& x);\n\n\t/// Returns true if x holds a positive infinity or negative\n\t/// infinity representation in the underlying implementation's\n\t/// set of floating point representations. Returns false\n\t/// otherwise, including for implementations with no infinity\n\t/// representations.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL isinf man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec isinf(vec const& x);\n\n\t/// Returns a signed integer value representing\n\t/// the encoding of a floating-point value. The floating-point\n\t/// value's bit-level representation is preserved.\n\t///\n\t/// @see GLSL floatBitsToInt man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\tGLM_FUNC_DECL int floatBitsToInt(float const& v);\n\n\t/// Returns a signed integer value representing\n\t/// the encoding of a floating-point value. The floatingpoint\n\t/// value's bit-level representation is preserved.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL floatBitsToInt man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec floatBitsToInt(vec const& v);\n\n\t/// Returns a unsigned integer value representing\n\t/// the encoding of a floating-point value. The floatingpoint\n\t/// value's bit-level representation is preserved.\n\t///\n\t/// @see GLSL floatBitsToUint man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\tGLM_FUNC_DECL uint floatBitsToUint(float const& v);\n\n\t/// Returns a unsigned integer value representing\n\t/// the encoding of a floating-point value. The floatingpoint\n\t/// value's bit-level representation is preserved.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL floatBitsToUint man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec floatBitsToUint(vec const& v);\n\n\t/// Returns a floating-point value corresponding to a signed\n\t/// integer encoding of a floating-point value.\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\t/// resulting floating point value is unspecified. Otherwise,\n\t/// the bit-level representation is preserved.\n\t///\n\t/// @see GLSL intBitsToFloat man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\tGLM_FUNC_DECL float intBitsToFloat(int const& v);\n\n\t/// Returns a floating-point value corresponding to a signed\n\t/// integer encoding of a floating-point value.\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\t/// resulting floating point value is unspecified. Otherwise,\n\t/// the bit-level representation is preserved.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL intBitsToFloat man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec intBitsToFloat(vec const& v);\n\n\t/// Returns a floating-point value corresponding to a\n\t/// unsigned integer encoding of a floating-point value.\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\t/// resulting floating point value is unspecified. Otherwise,\n\t/// the bit-level representation is preserved.\n\t///\n\t/// @see GLSL uintBitsToFloat man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\tGLM_FUNC_DECL float uintBitsToFloat(uint const& v);\n\n\t/// Returns a floating-point value corresponding to a\n\t/// unsigned integer encoding of a floating-point value.\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\t/// resulting floating point value is unspecified. Otherwise,\n\t/// the bit-level representation is preserved.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL uintBitsToFloat man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec uintBitsToFloat(vec const& v);\n\n\t/// Computes and returns a * b + c.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL fma man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType fma(genType const& a, genType const& b, genType const& c);\n\n\t/// Splits x into a floating-point significand in the range\n\t/// [0.5, 1.0) and an integral exponent of two, such that:\n\t/// x = significand * exp(2, exponent)\n\t///\n\t/// The significand is returned by the function and the\n\t/// exponent is returned in the parameter exp. For a\n\t/// floating-point value of zero, the significant and exponent\n\t/// are both zero. For a floating-point value that is an\n\t/// infinity or is not a number, the results are undefined.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL frexp man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType frexp(genType const& x, genIType& exp);\n\n\t/// Builds a floating-point number from x and the\n\t/// corresponding integral exponent of two in exp, returning:\n\t/// significand * exp(2, exponent)\n\t///\n\t/// If this product is too large to be represented in the\n\t/// floating-point type, the result is undefined.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL ldexp man page;\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType ldexp(genType const& x, genIType const& exp);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_common.inl\"\n\n"}, {"path": "includes/glm/exponential.hpp", "language": "code", "loc": 98, "comment_density": 0.765, "code": "/// @ref core\n/// @file glm/exponential.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n///\n/// @defgroup core_func_exponential Exponential functions\n/// @ingroup core\n///\n/// Provides GLSL exponential functions\n///\n/// These all operate component-wise. The description is per component.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"detail/type_vec1.hpp\"\n#include \"detail/type_vec2.hpp\"\n#include \"detail/type_vec3.hpp\"\n#include \"detail/type_vec4.hpp\"\n#include \n\nnamespace glm\n{\n\t/// @addtogroup core_func_exponential\n\t/// @{\n\n\t/// Returns 'base' raised to the power 'exponent'.\n\t///\n\t/// @param base Floating point value. pow function is defined for input values of 'base' defined in the range (inf-, inf+) in the limit of the type qualifier.\n\t/// @param exponent Floating point value representing the 'exponent'.\n\t///\n\t/// @see GLSL pow man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec pow(vec const& base, vec const& exponent);\n\n\t/// Returns the natural exponentiation of x, i.e., e^x.\n\t///\n\t/// @param v exp function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL exp man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec exp(vec const& v);\n\n\t/// Returns the natural logarithm of v, i.e.,\n\t/// returns the value y which satisfies the equation x = e^y.\n\t/// Results are undefined if v <= 0.\n\t///\n\t/// @param v log function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL log man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec log(vec const& v);\n\n\t/// Returns 2 raised to the v power.\n\t///\n\t/// @param v exp2 function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL exp2 man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec exp2(vec const& v);\n\n\t/// Returns the base 2 log of x, i.e., returns the value y,\n\t/// which satisfies the equation x = 2 ^ y.\n\t///\n\t/// @param v log2 function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL log2 man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec log2(vec const& v);\n\n\t/// Returns the positive square root of v.\n\t///\n\t/// @param v sqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL sqrt man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec sqrt(vec const& v);\n\n\t/// Returns the reciprocal of the positive square root of v.\n\t///\n\t/// @param v inversesqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL inversesqrt man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec inversesqrt(vec const& v);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_exponential.inl\"\n"}, {"path": "includes/glm/ext.hpp", "language": "code", "loc": 177, "comment_density": 0.028, "code": "/// @file glm/ext.hpp\n///\n/// @ref core (Dependence)\n\n#include \"detail/setup.hpp\"\n\n#pragma once\n\n#include \"glm.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED)\n#\tdefine GLM_MESSAGE_EXT_INCLUDED_DISPLAYED\n#\tpragma message(\"GLM: All extensions included (not recommended)\")\n#endif//GLM_MESSAGES\n\n#include \"./ext/matrix_double2x2.hpp\"\n#include \"./ext/matrix_double2x2_precision.hpp\"\n#include \"./ext/matrix_double2x3.hpp\"\n#include \"./ext/matrix_double2x3_precision.hpp\"\n#include \"./ext/matrix_double2x4.hpp\"\n#include \"./ext/matrix_double2x4_precision.hpp\"\n#include \"./ext/matrix_double3x2.hpp\"\n#include \"./ext/matrix_double3x2_precision.hpp\"\n#include \"./ext/matrix_double3x3.hpp\"\n#include \"./ext/matrix_double3x3_precision.hpp\"\n#include \"./ext/matrix_double3x4.hpp\"\n#include \"./ext/matrix_double3x4_precision.hpp\"\n#include \"./ext/matrix_double4x2.hpp\"\n#include \"./ext/matrix_double4x2_precision.hpp\"\n#include \"./ext/matrix_double4x3.hpp\"\n#include \"./ext/matrix_double4x3_precision.hpp\"\n#include \"./ext/matrix_double4x4.hpp\"\n#include \"./ext/matrix_double4x4_precision.hpp\"\n\n#include \"./ext/matrix_float2x2.hpp\"\n#include \"./ext/matrix_float2x2_precision.hpp\"\n#include \"./ext/matrix_float2x3.hpp\"\n#include \"./ext/matrix_float2x3_precision.hpp\"\n#include \"./ext/matrix_float2x4.hpp\"\n#include \"./ext/matrix_float2x4_precision.hpp\"\n#include \"./ext/matrix_float3x2.hpp\"\n#include \"./ext/matrix_float3x2_precision.hpp\"\n#include \"./ext/matrix_float3x3.hpp\"\n#include \"./ext/matrix_float3x3_precision.hpp\"\n#include \"./ext/matrix_float3x4.hpp\"\n#include \"./ext/matrix_float3x4_precision.hpp\"\n#include \"./ext/matrix_float4x2.hpp\"\n#include \"./ext/matrix_float4x2_precision.hpp\"\n#include \"./ext/matrix_float4x3.hpp\"\n#include \"./ext/matrix_float4x3_precision.hpp\"\n#include \"./ext/matrix_float4x4.hpp\"\n#include \"./ext/matrix_float4x4_precision.hpp\"\n\n#include \"./ext/matrix_relational.hpp\"\n\n#include \"./ext/quaternion_double.hpp\"\n#include \"./ext/quaternion_double_precision.hpp\"\n#include \"./ext/quaternion_float.hpp\"\n#include \"./ext/quaternion_float_precision.hpp\"\n#include \"./ext/quaternion_geometric.hpp\"\n#include \"./ext/quaternion_relational.hpp\"\n\n#include \"./ext/scalar_constants.hpp\"\n#include \"./ext/scalar_int_sized.hpp\"\n#include \"./ext/scalar_relational.hpp\"\n\n#include \"./ext/vector_bool1.hpp\"\n#include \"./ext/vector_bool1_precision.hpp\"\n#include \"./ext/vector_bool2.hpp\"\n#include \"./ext/vector_bool2_precision.hpp\"\n#include \"./ext/vector_bool3.hpp\"\n#include \"./ext/vector_bool3_precision.hpp\"\n#include \"./ext/vector_bool4.hpp\"\n#include \"./ext/vector_bool4_precision.hpp\"\n\n#include \"./ext/vector_double1.hpp\"\n#include \"./ext/vector_double1_precision.hpp\"\n#include \"./ext/vector_double2.hpp\"\n#include \"./ext/vector_double2_precision.hpp\"\n#include \"./ext/vector_double3.hpp\"\n#include \"./ext/vector_double3_precision.hpp\"\n#include \"./ext/vector_double4.hpp\"\n#include \"./ext/vector_double4_precision.hpp\"\n\n#include \"./ext/vector_float1.hpp\"\n#include \"./ext/vector_float1_precision.hpp\"\n#include \"./ext/vector_float2.hpp\"\n#include \"./ext/vector_float2_precision.hpp\"\n#include \"./ext/vector_float3.hpp\"\n#include \"./ext/vector_float3_precision.hpp\"\n#include \"./ext/vector_float4.hpp\"\n#include \"./ext/vector_float4_precision.hpp\"\n\n#include \"./ext/vector_int1.hpp\"\n#include \"./ext/vector_int1_precision.hpp\"\n#include \"./ext/vector_int2.hpp\"\n#include \"./ext/vector_int2_precision.hpp\"\n#include \"./ext/vector_int3.hpp\"\n#include \"./ext/vector_int3_precision.hpp\"\n#include \"./ext/vector_int4.hpp\"\n#include \"./ext/vector_int4_precision.hpp\"\n\n#include \"./ext/vector_relational.hpp\"\n\n#include \"./ext/vector_uint1.hpp\"\n#include \"./ext/vector_uint1_precision.hpp\"\n#include \"./ext/vector_uint2.hpp\"\n#include \"./ext/vector_uint2_precision.hpp\"\n#include \"./ext/vector_uint3.hpp\"\n#include \"./ext/vector_uint3_precision.hpp\"\n#include \"./ext/vector_uint4.hpp\"\n#include \"./ext/vector_uint4_precision.hpp\"\n\n#include \"./gtc/bitfield.hpp\"\n#include \"./gtc/color_space.hpp\"\n#include \"./gtc/constants.hpp\"\n#include \"./gtc/epsilon.hpp\"\n#include \"./gtc/integer.hpp\"\n#include \"./gtc/matrix_access.hpp\"\n#include \"./gtc/matrix_integer.hpp\"\n#include \"./gtc/matrix_inverse.hpp\"\n#include \"./gtc/matrix_transform.hpp\"\n#include \"./gtc/noise.hpp\"\n#include \"./gtc/packing.hpp\"\n#include \"./gtc/quaternion.hpp\"\n#include \"./gtc/random.hpp\"\n#include \"./gtc/reciprocal.hpp\"\n#include \"./gtc/round.hpp\"\n#include \"./gtc/type_precision.hpp\"\n#include \"./gtc/type_ptr.hpp\"\n#include \"./gtc/ulp.hpp\"\n#include \"./gtc/vec1.hpp\"\n#if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n#\tinclude \"./gtc/type_aligned.hpp\"\n#endif\n\n#ifdef GLM_ENABLE_EXPERIMENTAL\n#include \"./gtx/associated_min_max.hpp\"\n#include \"./gtx/bit.hpp\"\n#include \"./gtx/closest_point.hpp\"\n#include \"./gtx/color_encoding.hpp\"\n#include \"./gtx/color_space.hpp\"\n#include \"./gtx/color_space_YCoCg.hpp\"\n#include \"./gtx/compatibility.hpp\"\n#include \"./gtx/component_wise.hpp\"\n#include \"./gtx/dual_quaternion.hpp\"\n#include \"./gtx/euler_angles.hpp\"\n#include \"./gtx/extend.hpp\"\n#include \"./gtx/extended_min_max.hpp\"\n#include \"./gtx/fast_exponential.hpp\"\n#include \"./gtx/fast_square_root.hpp\"\n#include \"./gtx/fast_trigonometry.hpp\"\n#include \"./gtx/functions.hpp\"\n#include \"./gtx/gradient_paint.hpp\"\n#include \"./gtx/handed_coordinate_space.hpp\"\n#include \"./gtx/integer.hpp\"\n#include \"./gtx/intersect.hpp\"\n#include \"./gtx/log_base.hpp\"\n#include \"./gtx/matrix_cross_product.hpp\"\n#include \"./gtx/matrix_interpolation.hpp\"\n#include \"./gtx/matrix_major_storage.hpp\"\n#include \"./gtx/matrix_operation.hpp\"\n#include \"./gtx/matrix_query.hpp\"\n#include \"./gtx/mixed_product.hpp\"\n#include \"./gtx/norm.hpp\"\n#include \"./gtx/normal.hpp\"\n#include \"./gtx/normalize_dot.hpp\"\n#include \"./gtx/number_precision.hpp\"\n#include \"./gtx/optimum_pow.hpp\"\n#include \"./gtx/orthonormalize.hpp\"\n#include \"./gtx/perpendicular.hpp\"\n#include \"./gtx/polar_coordinates.hpp\"\n#include \"./gtx/projection.hpp\"\n#include \"./gtx/quaternion.hpp\"\n#include \"./gtx/raw_data.hpp\"\n#include \"./gtx/rotate_vector.hpp\"\n#include \"./gtx/spline.hpp\"\n#include \"./gtx/std_based_type.hpp\"\n#if !(GLM_COMPILER & GLM_COMPILER_CUDA)\n#\tinclude \"./gtx/string_cast.hpp\"\n#endif\n#include \"./gtx/transform.hpp\"\n#include \"./gtx/transform2.hpp\"\n#include \"./gtx/vec_swizzle.hpp\"\n#include \"./gtx/vector_angle.hpp\"\n#include \"./gtx/vector_query.hpp\"\n#include \"./gtx/wrap.hpp\"\n\n#if GLM_HAS_TEMPLATE_ALIASES\n#\tinclude \"./gtx/scalar_multiplication.hpp\"\n#endif\n\n#if GLM_HAS_RANGE_FOR\n#\tinclude \"./gtx/range.hpp\"\n#endif\n#endif//GLM_ENABLE_EXPERIMENTAL\n"}, {"path": "includes/glm/fwd.hpp", "language": "code", "loc": 662, "comment_density": 0.017, "code": "#pragma once\n\n#include \"detail/qualifier.hpp\"\n\nnamespace glm\n{\n#if GLM_HAS_EXTENDED_INTEGER_TYPE\n\ttypedef std::int8_t\t\t\t\tint8;\n\ttypedef std::int16_t\t\t\tint16;\n\ttypedef std::int32_t\t\t\tint32;\n\ttypedef std::int64_t\t\t\tint64;\n\n\ttypedef std::uint8_t\t\t\tuint8;\n\ttypedef std::uint16_t\t\t\tuint16;\n\ttypedef std::uint32_t\t\t\tuint32;\n\ttypedef std::uint64_t\t\t\tuint64;\n#else\n\ttypedef char\t\t\t\t\tint8;\n\ttypedef short\t\t\t\t\tint16;\n\ttypedef int\t\t\t\t\t\tint32;\n\ttypedef detail::int64\t\t\tint64;\n\n\ttypedef unsigned char\t\t\tuint8;\n\ttypedef unsigned short\t\t\tuint16;\n\ttypedef unsigned int\t\t\tuint32;\n\ttypedef detail::uint64\t\t\tuint64;\n#endif\n\n\t// Scalar int\n\n\ttypedef int8\t\t\t\t\tlowp_i8;\n\ttypedef int8\t\t\t\t\tmediump_i8;\n\ttypedef int8\t\t\t\t\thighp_i8;\n\ttypedef int8\t\t\t\t\ti8;\n\n\ttypedef int8\t\t\t\t\tlowp_int8;\n\ttypedef int8\t\t\t\t\tmediump_int8;\n\ttypedef int8\t\t\t\t\thighp_int8;\n\n\ttypedef int8\t\t\t\t\tlowp_int8_t;\n\ttypedef int8\t\t\t\t\tmediump_int8_t;\n\ttypedef int8\t\t\t\t\thighp_int8_t;\n\ttypedef int8\t\t\t\t\tint8_t;\n\n\ttypedef int16\t\t\t\t\tlowp_i16;\n\ttypedef int16\t\t\t\t\tmediump_i16;\n\ttypedef int16\t\t\t\t\thighp_i16;\n\ttypedef int16\t\t\t\t\ti16;\n\n\ttypedef int16\t\t\t\t\tlowp_int16;\n\ttypedef int16\t\t\t\t\tmediump_int16;\n\ttypedef int16\t\t\t\t\thighp_int16;\n\n\ttypedef int16\t\t\t\t\tlowp_int16_t;\n\ttypedef int16\t\t\t\t\tmediump_int16_t;\n\ttypedef int16\t\t\t\t\thighp_int16_t;\n\ttypedef int16\t\t\t\t\tint16_t;\n\n\ttypedef int32\t\t\t\t\tlowp_i32;\n\ttypedef int32\t\t\t\t\tmediump_i32;\n\ttypedef int32\t\t\t\t\thighp_i32;\n\ttypedef int32\t\t\t\t\ti32;\n\n\ttypedef int32\t\t\t\t\tlowp_int32;\n\ttypedef int32\t\t\t\t\tmediump_int32;\n\ttypedef int32\t\t\t\t\thighp_int32;\n\n\ttypedef int32\t\t\t\t\tlowp_int32_t;\n\ttypedef int32\t\t\t\t\tmediump_int32_t;\n\ttypedef int32\t\t\t\t\thighp_int32_t;\n\ttypedef int32\t\t\t\t\tint32_t;\n\n\ttypedef int64\t\t\t\t\tlowp_i64;\n\ttypedef int64\t\t\t\t\tmediump_i64;\n\ttypedef int64\t\t\t\t\thighp_i64;\n\ttypedef int64\t\t\t\t\ti64;\n\n\ttypedef int64\t\t\t\t\tlowp_int64;\n\ttypedef int64\t\t\t\t\tmediump_int64;\n\ttypedef int64\t\t\t\t\thighp_int64;\n\n\ttypedef int64\t\t\t\t\tlowp_int64_t;\n\ttypedef int64\t\t\t\t\tmediump_int64_t;\n\ttypedef int64\t\t\t\t\thighp_int64_t;\n\ttypedef int64\t\t\t\t\tint64_t;\n\n\t// Scalar uint\n\n\ttypedef uint8\t\t\t\t\tlowp_u8;\n\ttypedef uint8\t\t\t\t\tmediump_u8;\n\ttypedef uint8\t\t\t\t\thighp_u8;\n\ttypedef uint8\t\t\t\t\tu8;\n\n\ttypedef uint8\t\t\t\t\tlowp_uint8;\n\ttypedef uint8\t\t\t\t\tmediump_uint8;\n\ttypedef uint8\t\t\t\t\thighp_uint8;\n\n\ttypedef uint8\t\t\t\t\tlowp_uint8_t;\n\ttypedef uint8\t\t\t\t\tmediump_uint8_t;\n\ttypedef uint8\t\t\t\t\thighp_uint8_t;\n\ttypedef uint8\t\t\t\t\tuint8_t;\n\n\ttypedef uint16\t\t\t\t\tlowp_u16;\n\ttypedef uint16\t\t\t\t\tmediump_u16;\n\ttypedef uint16\t\t\t\t\thighp_u16;\n\ttypedef uint16\t\t\t\t\tu16;\n\n\ttypedef uint16\t\t\t\t\tlowp_uint16;\n\ttypedef uint16\t\t\t\t\tmediump_uint16;\n\ttypedef uint16\t\t\t\t\thighp_uint16;\n\n\ttypedef uint16\t\t\t\t\tlowp_uint16_t;\n\ttypedef uint16\t\t\t\t\tmediump_uint16_t;\n\ttypedef uint16\t\t\t\t\thighp_uint16_t;\n\ttypedef uint16\t\t\t\t\tuint16_t;\n\n\ttypedef uint32\t\t\t\t\tlowp_u32;\n\ttypedef uint32\t\t\t\t\tmediump_u32;\n\ttypedef uint32\t\t\t\t\thighp_u32;\n\ttypedef uint32\t\t\t\t\tu32;\n\n\ttypedef uint32\t\t\t\t\tlowp_uint32;\n\ttypedef uint32\t\t\t\t\tmediump_uint32;\n\ttypedef uint32\t\t\t\t\thighp_uint32;\n\n\ttypedef uint32\t\t\t\t\tlowp_uint32_t;\n\ttypedef uint32\t\t\t\t\tmediump_uint32_t;\n\ttypedef uint32\t\t\t\t\thighp_uint32_t;\n\ttypedef uint32\t\t\t\t\tuint32_t;\n\n\ttypedef uint64\t\t\t\t\tlowp_u64;\n\ttypedef uint64\t\t\t\t\tmediump_u64;\n\ttypedef uint64\t\t\t\t\thighp_u64;\n\ttypedef uint64\t\t\t\t\tu64;\n\n\ttypedef uint64\t\t\t\t\tlowp_uint64;\n\ttypedef uint64\t\t\t\t\tmediump_uint64;\n\ttypedef uint64\t\t\t\t\thighp_uint64;\n\n\ttypedef uint64\t\t\t\t\tlowp_uint64_t;\n\ttypedef uint64\t\t\t\t\tmediump_uint64_t;\n\ttypedef uint64\t\t\t\t\thighp_uint64_t;\n\ttypedef uint64\t\t\t\t\tuint64_t;\n\n\t// Scalar float\n\n\ttypedef float\t\t\t\t\tlowp_f32;\n\ttypedef float\t\t\t\t\tmediump_f32;\n\ttypedef float\t\t\t\t\thighp_f32;\n\ttypedef float\t\t\t\t\tf32;\n\n\ttypedef float\t\t\t\t\tlowp_float32;\n\ttypedef float\t\t\t\t\tmediump_float32;\n\ttypedef float\t\t\t\t\thighp_float32;\n\ttypedef float\t\t\t\t\tfloat32;\n\n\ttypedef float\t\t\t\t\tlowp_float32_t;\n\ttypedef float\t\t\t\t\tmediump_float32_t;\n\ttypedef float\t\t\t\t\thighp_float32_t;\n\ttypedef float\t\t\t\t\tfloat32_t;\n\n\n\ttypedef double\t\t\t\t\tlowp_f64;\n\ttypedef double\t\t\t\t\tmediump_f64;\n\ttypedef double\t\t\t\t\thighp_f64;\n\ttypedef double\t\t\t\t\tf64;\n\n\ttypedef double\t\t\t\t\tlowp_float64;\n\ttypedef double\t\t\t\t\tmediump_float64;\n\ttypedef double\t\t\t\t\thighp_float64;\n\ttypedef double\t\t\t\t\tfloat64;\n\n\ttypedef double\t\t\t\t\tlowp_float64_t;\n\ttypedef double\t\t\t\t\tmediump_float64_t;\n\ttypedef double\t\t\t\t\thighp_float64_t;\n\ttypedef double\t\t\t\t\tfloat64_t;\n\n\t// Vector bool\n\n\ttypedef vec<1, bool, lowp>\t\tlowp_bvec1;\n\ttypedef vec<2, bool, lowp>\t\tlowp_bvec2;\n\ttypedef vec<3, bool, lowp>\t\tlowp_bvec3;\n\ttypedef vec<4, bool, lowp>\t\tlowp_bvec4;\n\n\ttypedef vec<1, bool, mediump>\tmediump_bvec1;\n\ttypedef vec<2, bool, mediump>\tmediump_bvec2;\n\ttypedef vec<3, bool, mediump>\tmediump_bvec3;\n\ttypedef vec<4, bool, mediump>\tmediump_bvec4;\n\n\ttypedef vec<1, bool, highp>\t\thighp_bvec1;\n\ttypedef vec<2, bool, highp>\t\thighp_bvec2;\n\ttypedef vec<3, bool, highp>\t\thighp_bvec3;\n\ttypedef vec<4, bool, highp>\t\thighp_bvec4;\n\n\ttypedef vec<1, bool, defaultp>\tbvec1;\n\ttypedef vec<2, bool, defaultp>\tbvec2;\n\ttypedef vec<3, bool, defaultp>\tbvec3;\n\ttypedef vec<4, bool, defaultp>\tbvec4;\n\n\t// Vector int\n\n\ttypedef vec<1, i32, lowp>\t\tlowp_ivec1;\n\ttypedef vec<2, i32, lowp>\t\tlowp_ivec2;\n\ttypedef vec<3, i32, lowp>\t\tlowp_ivec3;\n\ttypedef vec<4, i32, lowp>\t\tlowp_ivec4;\n\n\ttypedef vec<1, i32, mediump>\tmediump_ivec1;\n\ttypedef vec<2, i32, mediump>\tmediump_ivec2;\n\ttypedef vec<3, i32, mediump>\tmediump_ivec3;\n\ttypedef vec<4, i32, mediump>\tmediump_ivec4;\n\n\ttypedef vec<1, i32, highp>\t\thighp_ivec1;\n\ttypedef vec<2, i32, highp>\t\thighp_ivec2;\n\ttypedef vec<3, i32, highp>\t\thighp_ivec3;\n\ttypedef vec<4, i32, highp>\t\thighp_ivec4;\n\n\ttypedef vec<1, i32, defaultp>\tivec1;\n\ttypedef vec<2, i32, defaultp>\tivec2;\n\ttypedef vec<3, i32, defaultp>\tivec3;\n\ttypedef vec<4, i32, defaultp>\tivec4;\n\n\ttypedef vec<1, i8, lowp>\t\tlowp_i8vec1;\n\ttypedef vec<2, i8, lowp>\t\tlowp_i8vec2;\n\ttypedef vec<3, i8, lowp>\t\tlowp_i8vec3;\n\ttypedef vec<4, i8, lowp>\t\tlowp_i8vec4;\n\n\ttypedef vec<1, i8, mediump>\t\tmediump_i8vec1;\n\ttypedef vec<2, i8, mediump>\t\tmediump_i8vec2;\n\ttypedef vec<3, i8, mediump>\t\tmediump_i8vec3;\n\ttypedef vec<4, i8, mediump>\t\tmediump_i8vec4;\n\n\ttypedef vec<1, i8, highp>\t\thighp_i8vec1;\n\ttypedef vec<2, i8, highp>\t\thighp_i8vec2;\n\ttypedef vec<3, i8, highp>\t\thighp_i8vec3;\n\ttypedef vec<4, i8, highp>\t\thighp_i8vec4;\n\n\ttypedef vec<1, i8, defaultp>\ti8vec1;\n\ttypedef vec<2, i8, defaultp>\ti8vec2;\n\ttypedef vec<3, i8, defaultp>\ti8vec3;\n\ttypedef vec<4, i8, defaultp>\ti8vec4;\n\n\ttypedef vec<1, i16, lowp>\t\tlowp_i16vec1;\n\ttypedef vec<2, i16, lowp>\t\tlowp_i16vec2;\n\ttypedef vec<3, i16, lowp>\t\tlowp_i16vec3;\n\ttypedef vec<4, i16, lowp>\t\tlowp_i16vec4;\n\n\ttypedef vec<1, i16, mediump>\tmediump_i16vec1;\n\ttypedef vec<2, i16, mediump>\tmediump_i16vec2;\n\ttypedef vec<3, i16, mediump>\tmediump_i16vec3;\n\ttypedef vec<4, i16, mediump>\tmediump_i16vec4;\n\n\ttypedef vec<1, i16, highp>\t\thighp_i16vec1;\n\ttypedef vec<2, i16, highp>\t\thighp_i16vec2;\n\ttypedef vec<3, i16, highp>\t\thighp_i16vec3;\n\ttypedef vec<4, i16, highp>\t\thighp_i16vec4;\n\n\ttypedef vec<1, i16, defaultp>\ti16vec1;\n\ttypedef vec<2, i16, defaultp>\ti16vec2;\n\ttypedef vec<3, i16, defaultp>\ti16vec3;\n\ttypedef vec<4, i16, defaultp>\ti16vec4;\n\n\ttypedef vec<1, i32, lowp>\t\tlowp_i32vec1;\n\ttypedef vec<2, i32, lowp>\t\tlowp_i32vec2;\n\ttypedef vec<3, i32, lowp>\t\tlowp_i32vec3;\n\ttypedef vec<4, i32, lowp>\t\tlowp_i32vec4;\n\n\ttypedef vec<1, i32, mediump>\tmediump_i32vec1;\n\ttypedef vec<2, i32, mediump>\tmediump_i32vec2;\n\ttypedef vec<3, i32, mediump>\tmediump_i32vec3;\n\ttypedef vec<4, i32, mediump>\tmediump_i32vec4;\n\n\ttypedef vec<1, i32, highp>\t\thighp_i32vec1;\n\ttypedef vec<2, i32, highp>\t\thighp_i32vec2;\n\ttypedef vec<3, i32, highp>\t\thighp_i32vec3;\n\ttypedef vec<4, i32, highp>\t\thighp_i32vec4;\n\n\ttypedef vec<1, i32, defaultp>\ti32vec1;\n\ttypedef vec<2, i32, defaultp>\ti32vec2;\n\ttypedef vec<3, i32, defaultp>\ti32vec3;\n\ttypedef vec<4, i32, defaultp>\ti32vec4;\n\n\ttypedef vec<1, i64, lowp>\t\tlowp_i64vec1;\n\ttypedef vec<2, i64, lowp>\t\tlowp_i64vec2;\n\ttypedef vec<3, i64, lowp>\t\tlowp_i64vec3;\n\ttypedef vec<4, i64, lowp>\t\tlowp_i64vec4;\n\n\ttypedef vec<1, i64, mediump>\tmediump_i64vec1;\n\ttypedef vec<2, i64, mediump>\tmediump_i64vec2;\n\ttypedef vec<3, i64, mediump>\tmediump_i64vec3;\n\ttypedef vec<4, i64, mediump>\tmediump_i64vec4;\n\n\ttypedef vec<1, i64, highp>\t\thighp_i64vec1;\n\ttypedef vec<2, i64, highp>\t\thighp_i64vec2;\n\ttypedef vec<3, i64, highp>\t\thighp_i64vec3;\n\ttypedef vec<4, i64, highp>\t\thighp_i64vec4;\n\n\ttypedef vec<1, i64, defaultp>\ti64vec1;\n\ttypedef vec<2, i64, defaultp>\ti64vec2;\n\ttypedef vec<3, i64, defaultp>\ti64vec3;\n\ttypedef vec<4, i64, defaultp>\ti64vec4;\n\n\t// Vector uint\n\n\ttypedef vec<1, u32, lowp>\t\tlowp_uvec1;\n\ttypedef vec<2, u32, lowp>\t\tlowp_uvec2;\n\ttypedef vec<3, u32, lowp>\t\tlowp_uvec3;\n\ttypedef vec<4, u32, lowp>\t\tlowp_uvec4;\n\n\ttypedef vec<1, u32, mediump>\tmediump_uvec1;\n\ttypedef vec<2, u32, mediump>\tmediump_uvec2;\n\ttypedef vec<3, u32, mediump>\tmediump_uvec3;\n\ttypedef vec<4, u32, mediump>\tmediump_uvec4;\n\n\ttypedef vec<1, u32, highp>\t\thighp_uvec1;\n\ttypedef vec<2, u32, highp>\t\thighp_uvec2;\n\ttypedef vec<3, u32, highp>\t\thighp_uvec3;\n\ttypedef vec<4, u32, highp>\t\thighp_uvec4;\n\n\ttypedef vec<1, u32, defaultp>\tuvec1;\n\ttypedef vec<2, u32, defaultp>\tuvec2;\n\ttypedef vec<3, u32, defaultp>\tuvec3;\n\ttypedef vec<4, u32, defaultp>\tuvec4;\n\n\ttypedef vec<1, u8, lowp>\t\tlowp_u8vec1;\n\ttypedef vec<2, u8, lowp>\t\tlowp_u8vec2;\n\ttypedef vec<3, u8, lowp>\t\tlowp_u8vec3;\n\ttypedef vec<4, u8, lowp>\t\tlowp_u8vec4;\n\n\ttypedef vec<1, u8, mediump>\t\tmediump_u8vec1;\n\ttypedef vec<2, u8, mediump>\t\tmediump_u8vec2;\n\ttypedef vec<3, u8, mediump>\t\tmediump_u8vec3;\n\ttypedef vec<4, u8, mediump>\t\tmediump_u8vec4;\n\n\ttypedef vec<1, u8, highp>\t\thighp_u8vec1;\n\ttypedef vec<2, u8, highp>\t\thighp_u8vec2;\n\ttypedef vec<3, u8, highp>\t\thighp_u8vec3;\n\ttypedef vec<4, u8, highp>\t\thighp_u8vec4;\n\n\ttypedef vec<1, u8, defaultp>\tu8vec1;\n\ttypedef vec<2, u8, defaultp>\tu8vec2;\n\ttypedef vec<3, u8, defaultp>\tu8vec3;\n\ttypedef vec<4, u8, defaultp>\tu8vec4;\n\n\ttypedef vec<1, u16, lowp>\t\tlowp_u16vec1;\n\ttypedef vec<2, u16, lowp>\t\tlowp_u16vec2;\n\ttypedef vec<3, u16, lowp>\t\tlowp_u16vec3;\n\ttypedef vec<4, u16, lowp>\t\tlowp_u16vec4;\n\n\ttypedef vec<1, u16, mediump>\tmediump_u16vec1;\n\ttypedef vec<2, u16, mediump>\tmediump_u16vec2;\n\ttypedef vec<3, u16, mediump>\tmediump_u16vec3;\n\ttypedef vec<4, u16, mediump>\tmediump_u16vec4;\n\n\ttypedef vec<1, u16, highp>\t\thighp_u16vec1;\n\ttypedef vec<2, u16, highp>\t\thighp_u16vec2;\n\ttypedef vec<3, u16, highp>\t\thighp_u16vec3;\n\ttypedef vec<4, u16, highp>\t\thighp_u16vec4;\n\n\ttypedef vec<1, u16, defaultp>\tu16vec1;\n\ttypedef vec<2, u16, defaultp>\tu16vec2;\n\ttypedef vec<3, u16, defaultp>\tu16vec3;\n\ttypedef vec<4, u16, defaultp>\tu16vec4;\n\n\ttypedef vec<1, u32, lowp>\t\tlowp_u32vec1;\n\ttypedef vec<2, u32, lowp>\t\tlowp_u32vec2;\n\ttypedef vec<3, u32, lowp>\t\tlowp_u32vec3;\n\ttypedef vec<4, u32, lowp>\t\tlowp_u32vec4;\n\n\ttypedef vec<1, u32, mediump>\tmediump_u32vec1;\n\ttypedef vec<2, u32, mediump>\tmediump_u32vec2;\n\ttypedef vec<3, u32, mediump>\tmediump_u32vec3;\n\ttypedef vec<4, u32, mediump>\tmediump_u32vec4;\n\n\ttypedef vec<1, u32, highp>\t\thighp_u32vec1;\n\ttypedef vec<2, u32, highp>\t\thighp_u32vec2;\n\ttypedef vec<3, u32, highp>\t\thighp_u32vec3;\n\ttypedef vec<4, u32, highp>\t\thighp_u32vec4;\n\n\ttypedef vec<1, u32, defaultp>\tu32vec1;\n\ttypedef vec<2, u32, defaultp>\tu32vec2;\n\ttypedef vec<3, u32, defaultp>\tu32vec3;\n\ttypedef vec<4, u32, defaultp>\tu32vec4;\n\n\ttypedef vec<1, u64, lowp>\t\tlowp_u64vec1;\n\ttypedef vec<2, u64, lowp>\t\tlowp_u64vec2;\n\ttypedef vec<3, u64, lowp>\t\tlowp_u64vec3;\n\ttypedef vec<4, u64, lowp>\t\tlowp_u64vec4;\n\n\ttypedef vec<1, u64, mediump>\tmediump_u64vec1;\n\ttypedef vec<2, u64, mediump>\tmediump_u64vec2;\n\ttypedef vec<3, u64, mediump>\tmediump_u64vec3;\n\ttypedef vec<4, u64, mediump>\tmediump_u64vec4;\n\n\ttypedef vec<1, u64, highp>\t\thighp_u64vec1;\n\ttypedef vec<2, u64, highp>\t\thighp_u64vec2;\n\ttypedef vec<3, u64, highp>\t\thighp_u64vec3;\n\ttypedef vec<4, u64, highp>\t\thighp_u64vec4;\n\n\ttypedef vec<1, u64, defaultp>\tu64vec1;\n\ttypedef vec<2, u64, defaultp>\tu64vec2;\n\ttypedef vec<3, u64, defaultp>\tu64vec3;\n\ttypedef vec<4, u64, defaultp>\tu64vec4;\n\n\t// Vector float\n\n\ttypedef vec<1, float, lowp>\t\t\tlowp_vec1;\n\ttypedef vec<2, float, lowp>\t\t\tlowp_vec2;\n\ttypedef vec<3, float, lowp>\t\t\tlowp_vec3;\n\ttypedef vec<4, float, lowp>\t\t\tlowp_vec4;\n\n\ttypedef vec<1, float, mediump>\t\tmediump_vec1;\n\ttypedef vec<2, float, mediump>\t\tmediump_vec2;\n\ttypedef vec<3, float, mediump>\t\tmediump_vec3;\n\ttypedef vec<4, float, mediump>\t\tmediump_vec4;\n\n\ttypedef vec<1, float, highp>\t\thighp_vec1;\n\ttypedef vec<2, float, highp>\t\thighp_vec2;\n\ttypedef vec<3, float, highp>\t\thighp_vec3;\n\ttypedef vec<4, float, highp>\t\thighp_vec4;\n\n\ttypedef vec<1, float, defaultp>\t\tvec1;\n\ttypedef vec<2, float, defaultp>\t\tvec2;\n\ttypedef vec<3, float, defaultp>\t\tvec3;\n\ttypedef vec<4, float, defaultp>\t\tvec4;\n\n\ttypedef vec<1, float, lowp>\t\t\tlowp_fvec1;\n\ttypedef vec<2, float, lowp>\t\t\tlowp_fvec2;\n\ttypedef vec<3, float, lowp>\t\t\tlowp_fvec3;\n\ttypedef vec<4, float, lowp>\t\t\tlowp_fvec4;\n\n\ttypedef vec<1, float, mediump>\t\tmediump_fvec1;\n\ttypedef vec<2, float, mediump>\t\tmediump_fvec2;\n\ttypedef vec<3, float, mediump>\t\tmediump_fvec3;\n\ttypedef vec<4, float, mediump>\t\tmediump_fvec4;\n\n\ttypedef vec<1, float, highp>\t\thighp_fvec1;\n\ttypedef vec<2, float, highp>\t\thighp_fvec2;\n\ttypedef vec<3, float, highp>\t\thighp_fvec3;\n\ttypedef vec<4, float, highp>\t\thighp_fvec4;\n\n\ttypedef vec<1, f32, defaultp>\t\tfvec1;\n\ttypedef vec<2, f32, defaultp>\t\tfvec2;\n\ttypedef vec<3, f32, defaultp>\t\tfvec3;\n\ttypedef vec<4, f32, defaultp>\t\tfvec4;\n\n\ttypedef vec<1, f32, lowp>\t\t\tlowp_f32vec1;\n\ttypedef vec<2, f32, lowp>\t\t\tlowp_f32vec2;\n\ttypedef vec<3, f32, lowp>\t\t\tlowp_f32vec3;\n\ttypedef vec<4, f32, lowp>\t\t\tlowp_f32vec4;\n\n\ttypedef vec<1, f32, mediump>\t\tmediump_f32vec1;\n\ttypedef vec<2, f32, mediump>\t\tmediump_f32vec2;\n\ttypedef vec<3, f32, mediump>\t\tmediump_f32vec3;\n\ttypedef vec<4, f32, mediump>\t\tmediump_f32vec4;\n\n\ttypedef vec<1, f32, highp>\t\t\thighp_f32vec1;\n\ttypedef vec<2, f32, highp>\t\t\thighp_f32vec2;\n\ttypedef vec<3, f32, highp>\t\t\thighp_f32vec3;\n\ttypedef vec<4, f32, highp>\t\t\thighp_f32vec4;\n\n\ttypedef vec<1, f32, defaultp>\t\tf32vec1;\n\ttypedef vec<2, f32, defaultp>\t\tf32vec2;\n\ttypedef vec<3, f32, defaultp>\t\tf32vec3;\n\ttypedef vec<4, f32, defaultp>\t\tf32vec4;\n\n\ttypedef vec<1, f64, lowp>\t\t\tlowp_dvec1;\n\ttypedef vec<2, f64, lowp>\t\t\tlowp_dvec2;\n\ttypedef vec<3, f64, lowp>\t\t\tlowp_dvec3;\n\ttypedef vec<4, f64, lowp>\t\t\tlowp_dvec4;\n\n\ttypedef vec<1, f64, mediump>\t\tmediump_dvec1;\n\ttypedef vec<2, f64, mediump>\t\tmediump_dvec2;\n\ttypedef vec<3, f64, mediump>\t\tmediump_dvec3;\n\ttypedef vec<4, f64, mediump>\t\tmediump_dvec4;\n\n\ttypedef vec<1, f64, highp>\t\t\thighp_dvec1;\n\ttypedef vec<2, f64, highp>\t\t\thighp_dvec2;\n\ttypedef vec<3, f64, highp>\t\t\thighp_dvec3;\n\ttypedef vec<4, f64, highp>\t\t\thighp_dvec4;\n\n\ttypedef vec<1, f64, defaultp>\t\tdvec1;\n\ttypedef vec<2, f64, defaultp>\t\tdvec2;\n\ttypedef vec<3, f64, defaultp>\t\tdvec3;\n\ttypedef vec<4, f64, defaultp>\t\tdvec4;\n\n\ttypedef vec<1, f64, lowp>\t\t\tlowp_f64vec1;\n\ttypedef vec<2, f64, lowp>\t\t\tlowp_f64vec2;\n\ttypedef vec<3, f64, lowp>\t\t\tlowp_f64vec3;\n\ttypedef vec<4, f64, lowp>\t\t\tlowp_f64vec4;\n\n\ttypedef vec<1, f64, mediump>\t\tmediump_f64vec1;\n\ttypedef vec<2, f64, mediump>\t\tmediump_f64vec2;\n\ttypedef vec<3, f64, mediump>\t\tmediump_f64vec3;\n\ttypedef vec<4, f64, mediump>\t\tmediump_f64vec4;\n\n\ttypedef vec<1, f64, highp>\t\t\thighp_f64vec1;\n\ttypedef vec<2, f64, highp>\t\t\thighp_f64vec2;\n\ttypedef vec<3, f64, highp>\t\t\thighp_f64vec3;\n\ttypedef vec<4, f64, highp>\t\t\thighp_f64vec4;\n\n\ttypedef vec<1, f64, defaultp>\t\tf64vec1;\n\ttypedef vec<2, f64, defaultp>\t\tf64vec2;\n\ttypedef vec<3, f64, defaultp>\t\tf64vec3;\n\ttypedef vec<4, f64, defaultp>\t\tf64vec4;\n\n\t// Matrix NxN\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_mat2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_mat3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_mat4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_mat2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_mat3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_mat4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_mat2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_mat3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_mat4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tmat2;\n\ttypedef mat<3, 3, f32, defaultp>\tmat3;\n\ttypedef mat<4, 4, f32, defaultp>\tmat4;\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_fmat2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_fmat3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_fmat4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_fmat2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_fmat3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_fmat4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_fmat2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_fmat3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_fmat4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tfmat2;\n\ttypedef mat<3, 3, f32, defaultp>\tfmat3;\n\ttypedef mat<4, 4, f32, defaultp>\tfmat4;\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_f32mat2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_f32mat3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_f32mat4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_f32mat2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_f32mat3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_f32mat4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_f32mat2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_f32mat3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_f32mat4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tf32mat2;\n\ttypedef mat<3, 3, f32, defaultp>\tf32mat3;\n\ttypedef mat<4, 4, f32, defaultp>\tf32mat4;\n\n\ttypedef mat<2, 2, f64, lowp>\t\tlowp_dmat2;\n\ttypedef mat<3, 3, f64, lowp>\t\tlowp_dmat3;\n\ttypedef mat<4, 4, f64, lowp>\t\tlowp_dmat4;\n\n\ttypedef mat<2, 2, f64, mediump>\t\tmediump_dmat2;\n\ttypedef mat<3, 3, f64, mediump>\t\tmediump_dmat3;\n\ttypedef mat<4, 4, f64, mediump>\t\tmediump_dmat4;\n\n\ttypedef mat<2, 2, f64, highp>\t\thighp_dmat2;\n\ttypedef mat<3, 3, f64, highp>\t\thighp_dmat3;\n\ttypedef mat<4, 4, f64, highp>\t\thighp_dmat4;\n\n\ttypedef mat<2, 2, f64, defaultp>\tdmat2;\n\ttypedef mat<3, 3, f64, defaultp>\tdmat3;\n\ttypedef mat<4, 4, f64, defaultp>\tdmat4;\n\n\ttypedef mat<2, 2, f64, lowp>\t\tlowp_f64mat2;\n\ttypedef mat<3, 3, f64, lowp>\t\tlowp_f64mat3;\n\ttypedef mat<4, 4, f64, lowp>\t\tlowp_f64mat4;\n\n\ttypedef mat<2, 2, f64, mediump>\t\tmediump_f64mat2;\n\ttypedef mat<3, 3, f64, mediump>\t\tmediump_f64mat3;\n\ttypedef mat<4, 4, f64, mediump>\t\tmediump_f64mat4;\n\n\ttypedef mat<2, 2, f64, highp>\t\thighp_f64mat2;\n\ttypedef mat<3, 3, f64, highp>\t\thighp_f64mat3;\n\ttypedef mat<4, 4, f64, highp>\t\thighp_f64mat4;\n\n\ttypedef mat<2, 2, f64, defaultp>\tf64mat2;\n\ttypedef mat<3, 3, f64, defaultp>\tf64mat3;\n\ttypedef mat<4, 4, f64, defaultp>\tf64mat4;\n\n\t// Matrix MxN\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_mat2x2;\n\ttypedef mat<2, 3, f32, lowp>\t\tlowp_mat2x3;\n\ttypedef mat<2, 4, f32, lowp>\t\tlowp_mat2x4;\n\ttypedef mat<3, 2, f32, lowp>\t\tlowp_mat3x2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_mat3x3;\n\ttypedef mat<3, 4, f32, lowp>\t\tlowp_mat3x4;\n\ttypedef mat<4, 2, f32, lowp>\t\tlowp_mat4x2;\n\ttypedef mat<4, 3, f32, lowp>\t\tlowp_mat4x3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_mat4x4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_mat2x2;\n\ttypedef mat<2, 3, f32, mediump>\t\tmediump_mat2x3;\n\ttypedef mat<2, 4, f32, mediump>\t\tmediump_mat2x4;\n\ttypedef mat<3, 2, f32, mediump>\t\tmediump_mat3x2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_mat3x3;\n\ttypedef mat<3, 4, f32, mediump>\t\tmediump_mat3x4;\n\ttypedef mat<4, 2, f32, mediump>\t\tmediump_mat4x2;\n\ttypedef mat<4, 3, f32, mediump>\t\tmediump_mat4x3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_mat4x4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_mat2x2;\n\ttypedef mat<2, 3, f32, highp>\t\thighp_mat2x3;\n\ttypedef mat<2, 4, f32, highp>\t\thighp_mat2x4;\n\ttypedef mat<3, 2, f32, highp>\t\thighp_mat3x2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_mat3x3;\n\ttypedef mat<3, 4, f32, highp>\t\thighp_mat3x4;\n\ttypedef mat<4, 2, f32, highp>\t\thighp_mat4x2;\n\ttypedef mat<4, 3, f32, highp>\t\thighp_mat4x3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_mat4x4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tmat2x2;\n\ttypedef mat<3, 2, f32, defaultp>\tmat3x2;\n\ttypedef mat<4, 2, f32, defaultp>\tmat4x2;\n\ttypedef mat<2, 3, f32, defaultp>\tmat2x3;\n\ttypedef mat<3, 3, f32, defaultp>\tmat3x3;\n\ttypedef mat<4, 3, f32, defaultp>\tmat4x3;\n\ttypedef mat<2, 4, f32, defaultp>\tmat2x4;\n\ttypedef mat<3, 4, f32, defaultp>\tmat3x4;\n\ttypedef mat<4, 4, f32, defaultp>\tmat4x4;\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_fmat2x2;\n\ttypedef mat<2, 3, f32, lowp>\t\tlowp_fmat2x3;\n\ttypedef mat<2, 4, f32, lowp>\t\tlowp_fmat2x4;\n\ttypedef mat<3, 2, f32, lowp>\t\tlowp_fmat3x2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_fmat3x3;\n\ttypedef mat<3, 4, f32, lowp>\t\tlowp_fmat3x4;\n\ttypedef mat<4, 2, f32, lowp>\t\tlowp_fmat4x2;\n\ttypedef mat<4, 3, f32, lowp>\t\tlowp_fmat4x3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_fmat4x4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_fmat2x2;\n\ttypedef mat<2, 3, f32, mediump>\t\tmediump_fmat2x3;\n\ttypedef mat<2, 4, f32, mediump>\t\tmediump_fmat2x4;\n\ttypedef mat<3, 2, f32, mediump>\t\tmediump_fmat3x2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_fmat3x3;\n\ttypedef mat<3, 4, f32, mediump>\t\tmediump_fmat3x4;\n\ttypedef mat<4, 2, f32, mediump>\t\tmediump_fmat4x2;\n\ttypedef mat<4, 3, f32, mediump>\t\tmediump_fmat4x3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_fmat4x4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_fmat2x2;\n\ttypedef mat<2, 3, f32, highp>\t\thighp_fmat2x3;\n\ttypedef mat<2, 4, f32, highp>\t\thighp_fmat2x4;\n\ttypedef mat<3, 2, f32, highp>\t\thighp_fmat3x2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_fmat3x3;\n\ttypedef mat<3, 4, f32, highp>\t\thighp_fmat3x4;\n\ttypedef mat<4, 2, f32, highp>\t\thighp_fmat4x2;\n\ttypedef mat<4, 3, f32, highp>\t\thighp_fmat4x3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_fmat4x4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tfmat2x2;\n\ttypedef mat<3, 2, f32, defaultp>\tfmat3x2;\n\ttypedef mat<4, 2, f32, defaultp>\tfmat4x2;\n\ttypedef mat<2, 3, f32, defaultp>\tfmat2x3;\n\ttypedef mat<3, 3, f32, defaultp>\tfmat3x3;\n\ttypedef mat<4, 3, f32, defaultp>\tfmat4x3;\n\ttypedef mat<2, 4, f32, defaultp>\tfmat2x4;\n\ttypedef mat<3, 4, f32, defaultp>\tfmat3x4;\n\ttypedef mat<4, 4, f32, defaultp>\tfmat4x4;\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_f32mat2x2;\n\ttypedef mat<2, 3, f32, lowp>\t\tlowp_f32mat2x3;\n\ttypedef mat<2, 4, f32, lowp>\t\tlowp_f32mat2x4;\n\ttypedef mat<3, 2, f32, lowp>\t\tlowp_f32mat3x2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_f32mat3x3;\n\ttypedef mat<3, 4, f32, lowp>\t\tlowp_f32mat3x4;\n\ttypedef mat<4, 2, f32, lowp>\t\tlowp_f32mat4x2;\n\ttypedef mat<4, 3, f32, lowp>\t\tlowp_f32mat4x3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_f32mat4x4;\n\t\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_f32mat2x2;\n\ttypedef mat<2, 3, f32, mediump>\t\tmediump_f32mat2x3;\n\ttypedef mat<2, 4, f32, mediump>\t\tmediump_f32mat2x4;\n\ttypedef mat<3, 2, f32, mediump>\t\tmediump_f32mat3x2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_f32mat3x3;\n\ttypedef mat<3, 4, f32, mediump>\t\tmediump_f32mat3x4;\n\ttypedef mat<4, 2, f32, mediump>\t\tmediump_f32mat4x2;\n\ttypedef mat<4, 3, f32, mediump>\t\tmediump_f32mat4x3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_f32mat4x4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_f32mat2x2;\n\ttypedef mat<2, 3, f32, highp>\t\thighp_f32mat2x3;\n\ttypedef mat<2, 4, f32, highp>\t\thighp_f32mat2x4;\n\ttypedef mat<3, 2, f32, highp>\t\thighp_f32mat3x2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_f32mat3x3;\n\ttypedef mat<3, 4, f32, highp>\t\thighp_f32mat3x4;\n\ttypedef mat<4, 2, f32, highp>\t\thighp_f32mat4x2;\n\ttypedef mat<4, 3, f32, highp>\t\thighp_f32mat4x3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_f32mat4x4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tf32mat2x2;\n\ttypedef mat<3, 2, f32, defaultp>\tf32mat3x2;\n\ttypedef mat<4, 2, f32, defaultp>\tf32mat4x2;\n\ttypedef mat<2, 3, f32, defaultp>\tf32mat2x3;\n\ttypedef mat<3, 3, f32, defaultp>\tf32mat3x3;\n\ttypedef mat<4, 3, f32, defaultp>\tf32mat4x3;\n\ttypedef mat<2, 4, f32, defaultp>\tf32mat2x4;\n\ttypedef mat<3, 4, f32, defaultp>\tf32mat3x4;\n\ttypedef mat<4, 4, f32, defaultp>\tf32mat4x4;\n\n\ttypedef mat<2, 2, double, lowp>\t\tlowp_dmat2x2;\n\ttypedef mat<2, 3, double, lowp>\t\tlowp_dmat2x3;\n\ttypedef mat<2, 4, double, lowp>\t\tlowp_dmat2x4;\n\ttypedef mat<3, 2, double, lowp>\t\tlowp_dmat3x2;\n\ttypedef mat<3, 3, double, lowp>\t\tlowp_dmat3x3;\n\ttypedef mat<3, 4, double, lowp>\t\tlowp_dmat3x4;\n\ttypedef mat<4, 2, double, lowp>\t\tlowp_dmat4x2;\n\ttypedef mat<4, 3, double, lowp>\t\tlowp_dmat4x3;\n\ttypedef mat<4, 4, double, lowp>\t\tlowp_dmat4x4;\n\n\ttypedef mat<2, 2, double, mediump>\tmediump_dmat2x2;\n\ttypedef mat<2, 3, double, mediump>\tmediump_dmat2x3;\n\ttypedef mat<2, 4, double, mediump>\tmediump_dmat2x4;\n\ttypedef mat<3, 2, double, mediump>\tmediump_dmat3x2;\n\ttypedef mat<3, 3, double, mediump>\tmediump_dmat3x3;\n\ttypedef mat<3, 4, double, mediump>\tmediump_dmat3x4;\n\ttypedef mat<4, 2, double, mediump>\tmediump_dmat4x2;\n\ttypedef mat<4, 3, double, mediump>\tmediump_dmat4x3;\n\ttypedef mat<4, 4, double, mediump>\tmediump_dmat4x4;\n\n\ttypedef mat<2, 2, double, highp>\thighp_dmat2x2;\n\ttypedef mat<2, 3, double, highp>\thighp_dmat2x3;\n\ttypedef mat<2, 4, double, highp>\thighp_dmat2x4;\n\ttypedef mat<3, 2, double, highp>\thighp_dmat3x2;\n\ttypedef mat<3, 3, double, highp>\thighp_dmat3x3;\n\ttypedef mat<3, 4, double, highp>\thighp_dmat3x4;\n\ttypedef mat<4, 2, double, highp>\thighp_dmat4x2;\n\ttypedef mat<4, 3, double, highp>\thighp_dmat4x3;\n\ttypedef mat<4, 4, double, highp>\thighp_dmat4x4;\n\n\ttypedef mat<2, 2, double, defaultp>\tdmat2x2;\n\ttypedef mat<3, 2, double, defaultp>\tdmat3x2;\n\ttypedef mat<4, 2, double, defaultp>\tdmat4x2;\n\ttypedef mat<2, 3, double, defaultp>\tdmat2x3;\n\ttypedef mat<3, 3, double, defaultp>\tdmat3x3;\n\ttypedef mat<4, 3, double, defaultp>\tdmat4x3;\n\ttypedef mat<2, 4, double, defaultp>\tdmat2x4;\n\ttypedef mat<3, 4, double, defaultp>\tdmat3x4;\n\ttypedef mat<4, 4, double, defaultp>\tdmat4x4;\n\n\ttypedef mat<2, 2, f64, lowp>\t\tlowp_f64mat2x2;\n\ttypedef mat<2, 3, f64, lowp>\t\tlowp_f64mat2x3;\n\ttypedef mat<2, 4, f64, lowp>\t\tlowp_f64mat2x4;\n\ttypedef mat<3, 2, f64, lowp>\t\tlowp_f64mat3x2;\n\ttypedef mat<3, 3, f64, lowp>\t\tlowp_f64mat3x3;\n\ttypedef mat<3, 4, f64, lowp>\t\tlowp_f64mat3x4;\n\ttypedef mat<4, 2, f64, lowp>\t\tlowp_f64mat4x2;\n\ttypedef mat<4, 3, f64, lowp>\t\tlowp_f64mat4x3;\n\ttypedef mat<4, 4, f64, lowp>\t\tlowp_f64mat4x4;\n\n\ttypedef mat<2, 2, f64, mediump>\t\tmediump_f64mat2x2;\n\ttypedef mat<2, 3, f64, mediump>\t\tmediump_f64mat2x3;\n\ttypedef mat<2, 4, f64, mediump>\t\tmediump_f64mat2x4;\n\ttypedef mat<3, 2, f64, mediump>\t\tmediump_f64mat3x2;\n\ttypedef mat<3, 3, f64, mediump>\t\tmediump_f64mat3x3;\n\ttypedef mat<3, 4, f64, mediump>\t\tmediump_f64mat3x4;\n\ttypedef mat<4, 2, f64, mediump>\t\tmediump_f64mat4x2;\n\ttypedef mat<4, 3, f64, mediump>\t\tmediump_f64mat4x3;\n\ttypedef mat<4, 4, f64, mediump>\t\tmediump_f64mat4x4;\n\n\ttypedef mat<2, 2, f64, highp>\t\thighp_f64mat2x2;\n\ttypedef mat<2, 3, f64, highp>\t\thighp_f64mat2x3;\n\ttypedef mat<2, 4, f64, highp>\t\thighp_f64mat2x4;\n\ttypedef mat<3, 2, f64, highp>\t\thighp_f64mat3x2;\n\ttypedef mat<3, 3, f64, highp>\t\thighp_f64mat3x3;\n\ttypedef mat<3, 4, f64, highp>\t\thighp_f64mat3x4;\n\ttypedef mat<4, 2, f64, highp>\t\thighp_f64mat4x2;\n\ttypedef mat<4, 3, f64, highp>\t\thighp_f64mat4x3;\n\ttypedef mat<4, 4, f64, highp>\t\thighp_f64mat4x4;\n\n\ttypedef mat<2, 2, f64, defaultp>\tf64mat2x2;\n\ttypedef mat<3, 2, f64, defaultp>\tf64mat3x2;\n\ttypedef mat<4, 2, f64, defaultp>\tf64mat4x2;\n\ttypedef mat<2, 3, f64, defaultp>\tf64mat2x3;\n\ttypedef mat<3, 3, f64, defaultp>\tf64mat3x3;\n\ttypedef mat<4, 3, f64, defaultp>\tf64mat4x3;\n\ttypedef mat<2, 4, f64, defaultp>\tf64mat2x4;\n\ttypedef mat<3, 4, f64, defaultp>\tf64mat3x4;\n\ttypedef mat<4, 4, f64, defaultp>\tf64mat4x4;\n\n\t// Quaternion\n\n\ttypedef qua\t\t\tlowp_quat;\n\ttypedef qua\t\t\tmediump_quat;\n\ttypedef qua\t\t\thighp_quat;\n\ttypedef qua\t\tquat;\n\n\ttypedef qua\t\t\tlowp_fquat;\n\ttypedef qua\t\t\tmediump_fquat;\n\ttypedef qua\t\t\thighp_fquat;\n\ttypedef qua\t\tfquat;\n\n\ttypedef qua\t\t\t\tlowp_f32quat;\n\ttypedef qua\t\t\tmediump_f32quat;\n\ttypedef qua\t\t\t\thighp_f32quat;\n\ttypedef qua\t\t\tf32quat;\n\n\ttypedef qua\t\t\tlowp_dquat;\n\ttypedef qua\t\tmediump_dquat;\n\ttypedef qua\t\t\thighp_dquat;\n\ttypedef qua\t\tdquat;\n\n\ttypedef qua\t\t\t\tlowp_f64quat;\n\ttypedef qua\t\t\tmediump_f64quat;\n\ttypedef qua\t\t\t\thighp_f64quat;\n\ttypedef qua\t\t\tf64quat;\n}//namespace glm\n\n\n"}, {"path": "includes/glm/geometric.hpp", "language": "code", "loc": 103, "comment_density": 0.718, "code": "/// @ref core\n/// @file glm/geometric.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n///\n/// @defgroup core_func_geometric Geometric functions\n/// @ingroup core\n///\n/// These operate on vectors as vectors, not component-wise.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_geometric\n\t/// @{\n\n\t/// Returns the length of x, i.e., sqrt(x * x).\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL length man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL T length(vec const& x);\n\n\t/// Returns the distance between p0 and p1, i.e., length(p0 - p1).\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL distance man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL T distance(vec const& p0, vec const& p1);\n\n\t/// Returns the dot product of x and y, i.e., result = x * y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL dot man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL T dot(vec const& x, vec const& y);\n\n\t/// Returns the cross product of x and y.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL cross man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> cross(vec<3, T, Q> const& x, vec<3, T, Q> const& y);\n\n\t/// Returns a vector in the same direction as x but with length of 1.\n\t/// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefined and generate an error.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL normalize man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec normalize(vec const& x);\n\n\t/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL faceforward man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec faceforward(\n\t\tvec const& N,\n\t\tvec const& I,\n\t\tvec const& Nref);\n\n\t/// For the incident vector I and surface orientation N,\n\t/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL reflect man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec reflect(\n\t\tvec const& I,\n\t\tvec const& N);\n\n\t/// For the incident vector I and surface normal N,\n\t/// and the ratio of indices of refraction eta,\n\t/// return the refraction vector.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL refract man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec refract(\n\t\tvec const& I,\n\t\tvec const& N,\n\t\tT eta);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_geometric.inl\"\n"}, {"path": "includes/glm/glm.hpp", "language": "code", "loc": 130, "comment_density": 0.777, "code": "/// @ref core\n/// @file glm/glm.hpp\n///\n/// @defgroup core Core features\n///\n/// @brief Features that implement in C++ the GLSL specification as closely as possible.\n///\n/// The GLM core consists of C++ types that mirror GLSL types and\n/// C++ functions that mirror the GLSL functions.\n///\n/// The best documentation for GLM Core is the current GLSL specification,\n/// version 4.2\n/// (pdf file).\n///\n/// GLM core functionalities require to be included to be used.\n///\n///\n/// @defgroup core_vector Vector types\n///\n/// Vector types of two to four components with an exhaustive set of operators.\n///\n/// @ingroup core\n///\n///\n/// @defgroup core_vector_precision Vector types with precision qualifiers\n///\n/// @brief Vector types with precision qualifiers which may result in various precision in term of ULPs\n///\n/// GLSL allows defining qualifiers for particular variables.\n/// With OpenGL's GLSL, these qualifiers have no effect; they are there for compatibility,\n/// with OpenGL ES's GLSL, these qualifiers do have an effect.\n///\n/// C++ has no language equivalent to qualifier qualifiers. So GLM provides the next-best thing:\n/// a number of typedefs that use a particular qualifier.\n///\n/// None of these types make any guarantees about the actual qualifier used.\n///\n/// @ingroup core\n///\n///\n/// @defgroup core_matrix Matrix types\n///\n/// Matrix types of with C columns and R rows where C and R are values between 2 to 4 included.\n/// These types have exhaustive sets of operators.\n///\n/// @ingroup core\n///\n///\n/// @defgroup core_matrix_precision Matrix types with precision qualifiers\n///\n/// @brief Matrix types with precision qualifiers which may result in various precision in term of ULPs\n///\n/// GLSL allows defining qualifiers for particular variables.\n/// With OpenGL's GLSL, these qualifiers have no effect; they are there for compatibility,\n/// with OpenGL ES's GLSL, these qualifiers do have an effect.\n///\n/// C++ has no language equivalent to qualifier qualifiers. So GLM provides the next-best thing:\n/// a number of typedefs that use a particular qualifier.\n///\n/// None of these types make any guarantees about the actual qualifier used.\n///\n/// @ingroup core\n///\n///\n/// @defgroup ext Stable extensions\n///\n/// @brief Additional features not specified by GLSL specification.\n///\n/// EXT extensions are fully tested and documented.\n///\n/// Even if it's highly unrecommended, it's possible to include all the extensions at once by\n/// including . Otherwise, each extension needs to be included a specific file.\n///\n///\n/// @defgroup gtc Recommended extensions\n///\n/// @brief Additional features not specified by GLSL specification.\n///\n/// GTC extensions aim to be stable with tests and documentation.\n///\n/// Even if it's highly unrecommended, it's possible to include all the extensions at once by\n/// including . Otherwise, each extension needs to be included a specific file.\n///\n///\n/// @defgroup gtx Experimental extensions\n///\n/// @brief Experimental features not specified by GLSL specification.\n///\n/// Experimental extensions are useful functions and types, but the development of\n/// their API and functionality is not necessarily stable. They can change\n/// substantially between versions. Backwards compatibility is not much of an issue\n/// for them.\n///\n/// Even if it's highly unrecommended, it's possible to include all the extensions\n/// at once by including . Otherwise, each extension needs to be\n/// included a specific file.\n///\n/// @mainpage OpenGL Mathematics (GLM)\n/// - Website: glm.g-truc.net\n/// - GLM API documentation\n/// - GLM Manual\n\n#include \"detail/_fixes.hpp\"\n\n#include \"detail/setup.hpp\"\n\n#pragma once\n\n#include \n#include \n#include \n#include \n#include \n#include \"fwd.hpp\"\n\n#include \"vec2.hpp\"\n#include \"vec3.hpp\"\n#include \"vec4.hpp\"\n#include \"mat2x2.hpp\"\n#include \"mat2x3.hpp\"\n#include \"mat2x4.hpp\"\n#include \"mat3x2.hpp\"\n#include \"mat3x3.hpp\"\n#include \"mat3x4.hpp\"\n#include \"mat4x2.hpp\"\n#include \"mat4x3.hpp\"\n#include \"mat4x4.hpp\"\n\n#include \"trigonometric.hpp\"\n#include \"exponential.hpp\"\n#include \"common.hpp\"\n#include \"packing.hpp\"\n#include \"geometric.hpp\"\n#include \"matrix.hpp\"\n#include \"vector_relational.hpp\"\n#include \"integer.hpp\"\n"}, {"path": "includes/glm/integer.hpp", "language": "code", "loc": 194, "comment_density": 0.722, "code": "/// @ref core\n/// @file glm/integer.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n///\n/// @defgroup core_func_integer Integer functions\n/// @ingroup core\n///\n/// Provides GLSL functions on integer types\n///\n/// These all operate component-wise. The description is per component.\n/// The notation [a, b] means the set of bits from bit-number a through bit-number\n/// b, inclusive. The lowest-order bit is bit 0.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"detail/qualifier.hpp\"\n#include \"common.hpp\"\n#include \"vector_relational.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_integer\n\t/// @{\n\n\t/// Adds 32-bit unsigned integer x and y, returning the sum\n\t/// modulo pow(2, 32). The value carry is set to 0 if the sum was\n\t/// less than pow(2, 32), or to 1 otherwise.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL uaddCarry man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec uaddCarry(\n\t\tvec const& x,\n\t\tvec const& y,\n\t\tvec & carry);\n\n\t/// Subtracts the 32-bit unsigned integer y from x, returning\n\t/// the difference if non-negative, or pow(2, 32) plus the difference\n\t/// otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL usubBorrow man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec usubBorrow(\n\t\tvec const& x,\n\t\tvec const& y,\n\t\tvec & borrow);\n\n\t/// Multiplies 32-bit integers x and y, producing a 64-bit\n\t/// result. The 32 least-significant bits are returned in lsb.\n\t/// The 32 most-significant bits are returned in msb.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL umulExtended man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL void umulExtended(\n\t\tvec const& x,\n\t\tvec const& y,\n\t\tvec & msb,\n\t\tvec & lsb);\n\n\t/// Multiplies 32-bit integers x and y, producing a 64-bit\n\t/// result. The 32 least-significant bits are returned in lsb.\n\t/// The 32 most-significant bits are returned in msb.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL imulExtended man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL void imulExtended(\n\t\tvec const& x,\n\t\tvec const& y,\n\t\tvec & msb,\n\t\tvec & lsb);\n\n\t/// Extracts bits [offset, offset + bits - 1] from value,\n\t/// returning them in the least significant bits of the result.\n\t/// For unsigned data types, the most significant bits of the\n\t/// result will be set to zero. For signed data types, the\n\t/// most significant bits will be set to the value of bit offset + base - 1.\n\t///\n\t/// If bits is zero, the result will be zero. The result will be\n\t/// undefined if offset or bits is negative, or if the sum of\n\t/// offset and bits is greater than the number of bits used\n\t/// to store the operand.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL bitfieldExtract man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldExtract(\n\t\tvec const& Value,\n\t\tint Offset,\n\t\tint Bits);\n\n\t/// Returns the insertion the bits least-significant bits of insert into base.\n\t///\n\t/// The result will have bits [offset, offset + bits - 1] taken\n\t/// from bits [0, bits - 1] of insert, and all other bits taken\n\t/// directly from the corresponding bits of base. If bits is\n\t/// zero, the result will simply be base. The result will be\n\t/// undefined if offset or bits is negative, or if the sum of\n\t/// offset and bits is greater than the number of bits used to\n\t/// store the operand.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar or vector types.\n\t///\n\t/// @see GLSL bitfieldInsert man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldInsert(\n\t\tvec const& Base,\n\t\tvec const& Insert,\n\t\tint Offset,\n\t\tint Bits);\n\n\t/// Returns the reversal of the bits of value.\n\t/// The bit numbered n of the result will be taken from bit (bits - 1) - n of value,\n\t/// where bits is the total number of bits used to represent value.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar or vector types.\n\t///\n\t/// @see GLSL bitfieldReverse man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldReverse(vec const& v);\n\n\t/// Returns the number of bits set to 1 in the binary representation of value.\n\t///\n\t/// @tparam genType Signed or unsigned integer scalar or vector types.\n\t///\n\t/// @see GLSL bitCount man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL int bitCount(genType v);\n\n\t/// Returns the number of bits set to 1 in the binary representation of value.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar or vector types.\n\t///\n\t/// @see GLSL bitCount man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec bitCount(vec const& v);\n\n\t/// Returns the bit number of the least significant bit set to\n\t/// 1 in the binary representation of value.\n\t/// If value is zero, -1 will be returned.\n\t///\n\t/// @tparam genIUType Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL findLSB man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL int findLSB(genIUType x);\n\n\t/// Returns the bit number of the least significant bit set to\n\t/// 1 in the binary representation of value.\n\t/// If value is zero, -1 will be returned.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL findLSB man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec findLSB(vec const& v);\n\n\t/// Returns the bit number of the most significant bit in the binary representation of value.\n\t/// For positive integers, the result will be the bit number of the most significant bit set to 1.\n\t/// For negative integers, the result will be the bit number of the most significant\n\t/// bit set to 0. For a value of zero or negative one, -1 will be returned.\n\t///\n\t/// @tparam genIUType Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL findMSB man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL int findMSB(genIUType x);\n\n\t/// Returns the bit number of the most significant bit in the binary representation of value.\n\t/// For positive integers, the result will be the bit number of the most significant bit set to 1.\n\t/// For negative integers, the result will be the bit number of the most significant\n\t/// bit set to 0. For a value of zero or negative one, -1 will be returned.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL findMSB man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec findMSB(vec const& v);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_integer.inl\"\n"}, {"path": "includes/glm/mat2x2.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat2x2.hpp\n\n#pragma once\n#include \"./ext/matrix_double2x2.hpp\"\n#include \"./ext/matrix_double2x2_precision.hpp\"\n#include \"./ext/matrix_float2x2.hpp\"\n#include \"./ext/matrix_float2x2_precision.hpp\"\n\n"}, {"path": "includes/glm/mat2x3.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat2x3.hpp\n\n#pragma once\n#include \"./ext/matrix_double2x3.hpp\"\n#include \"./ext/matrix_double2x3_precision.hpp\"\n#include \"./ext/matrix_float2x3.hpp\"\n#include \"./ext/matrix_float2x3_precision.hpp\"\n\n"}, {"path": "includes/glm/mat2x4.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat2x4.hpp\n\n#pragma once\n#include \"./ext/matrix_double2x4.hpp\"\n#include \"./ext/matrix_double2x4_precision.hpp\"\n#include \"./ext/matrix_float2x4.hpp\"\n#include \"./ext/matrix_float2x4_precision.hpp\"\n\n"}, {"path": "includes/glm/mat3x2.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat3x2.hpp\n\n#pragma once\n#include \"./ext/matrix_double3x2.hpp\"\n#include \"./ext/matrix_double3x2_precision.hpp\"\n#include \"./ext/matrix_float3x2.hpp\"\n#include \"./ext/matrix_float3x2_precision.hpp\"\n\n"}, {"path": "includes/glm/mat3x3.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat3x3.hpp\n\n#pragma once\n#include \"./ext/matrix_double3x3.hpp\"\n#include \"./ext/matrix_double3x3_precision.hpp\"\n#include \"./ext/matrix_float3x3.hpp\"\n#include \"./ext/matrix_float3x3_precision.hpp\"\n"}, {"path": "includes/glm/mat3x4.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat3x4.hpp\n\n#pragma once\n#include \"./ext/matrix_double3x4.hpp\"\n#include \"./ext/matrix_double3x4_precision.hpp\"\n#include \"./ext/matrix_float3x4.hpp\"\n#include \"./ext/matrix_float3x4_precision.hpp\"\n"}, {"path": "includes/glm/mat4x2.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat4x2.hpp\n\n#pragma once\n#include \"./ext/matrix_double4x2.hpp\"\n#include \"./ext/matrix_double4x2_precision.hpp\"\n#include \"./ext/matrix_float4x2.hpp\"\n#include \"./ext/matrix_float4x2_precision.hpp\"\n\n"}, {"path": "includes/glm/mat4x3.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat4x3.hpp\n\n#pragma once\n#include \"./ext/matrix_double4x3.hpp\"\n#include \"./ext/matrix_double4x3_precision.hpp\"\n#include \"./ext/matrix_float4x3.hpp\"\n#include \"./ext/matrix_float4x3_precision.hpp\"\n"}, {"path": "includes/glm/mat4x4.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat4x4.hpp\n\n#pragma once\n#include \"./ext/matrix_double4x4.hpp\"\n#include \"./ext/matrix_double4x4_precision.hpp\"\n#include \"./ext/matrix_float4x4.hpp\"\n#include \"./ext/matrix_float4x4_precision.hpp\"\n\n"}, {"path": "includes/glm/matrix.hpp", "language": "code", "loc": 141, "comment_density": 0.461, "code": "/// @ref core\n/// @file glm/matrix.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n///\n/// @defgroup core_func_matrix Matrix functions\n/// @ingroup core\n///\n/// Provides GLSL matrix functions.\n///\n/// Include to use these core features.\n\n#pragma once\n\n// Dependencies\n#include \"detail/qualifier.hpp\"\n#include \"detail/setup.hpp\"\n#include \"vec2.hpp\"\n#include \"vec3.hpp\"\n#include \"vec4.hpp\"\n#include \"mat2x2.hpp\"\n#include \"mat2x3.hpp\"\n#include \"mat2x4.hpp\"\n#include \"mat3x2.hpp\"\n#include \"mat3x3.hpp\"\n#include \"mat3x4.hpp\"\n#include \"mat4x2.hpp\"\n#include \"mat4x3.hpp\"\n#include \"mat4x4.hpp\"\n\nnamespace glm {\nnamespace detail\n{\n\ttemplate\n\tstruct outerProduct_trait{};\n\n\ttemplate\n\tstruct outerProduct_trait<2, 2, T, Q>\n\t{\n\t\ttypedef mat<2, 2, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<2, 3, T, Q>\n\t{\n\t\ttypedef mat<3, 2, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<2, 4, T, Q>\n\t{\n\t\ttypedef mat<4, 2, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<3, 2, T, Q>\n\t{\n\t\ttypedef mat<2, 3, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<3, 3, T, Q>\n\t{\n\t\ttypedef mat<3, 3, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<3, 4, T, Q>\n\t{\n\t\ttypedef mat<4, 3, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<4, 2, T, Q>\n\t{\n\t\ttypedef mat<2, 4, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<4, 3, T, Q>\n\t{\n\t\ttypedef mat<3, 4, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<4, 4, T, Q>\n\t{\n\t\ttypedef mat<4, 4, T, Q> type;\n\t};\n}//namespace detail\n\n\t /// @addtogroup core_func_matrix\n\t /// @{\n\n\t /// Multiply matrix x by matrix y component-wise, i.e.,\n\t /// result[i][j] is the scalar product of x[i][j] and y[i][j].\n\t ///\n\t /// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t /// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t /// @tparam T Floating-point or signed integer scalar types\n\t /// @tparam Q Value from qualifier enum\n\t ///\n\t /// @see GLSL matrixCompMult man page\n\t /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL mat matrixCompMult(mat const& x, mat const& y);\n\n\t/// Treats the first parameter c as a column vector\n\t/// and the second parameter r as a row vector\n\t/// and does a linear algebraic matrix multiply c * r.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t/// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL outerProduct man page\n\t/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL typename detail::outerProduct_trait::type outerProduct(vec const& c, vec const& r);\n\n\t/// Returns the transposed matrix of x\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t/// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL transpose man page\n\t/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL typename mat::transpose_type transpose(mat const& x);\n\n\t/// Return the determinant of a squared matrix.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t/// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL determinant man page\n\t/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL T determinant(mat const& m);\n\n\t/// Return the inverse of a squared matrix.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t/// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL inverse man page\n\t/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL mat inverse(mat const& m);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_matrix.inl\"\n"}, {"path": "includes/glm/packing.hpp", "language": "code", "loc": 156, "comment_density": 0.878, "code": "/// @ref core\n/// @file glm/packing.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n/// @see gtc_packing\n///\n/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions\n/// @ingroup core\n///\n/// Provides GLSL functions to pack and unpack half, single and double-precision floating point values into more compact integer types.\n///\n/// These functions do not operate component-wise, rather as described in each case.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"./ext/vector_uint2.hpp\"\n#include \"./ext/vector_float2.hpp\"\n#include \"./ext/vector_float4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_packing\n\t/// @{\n\n\t/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm2x16: round(clamp(c, 0, +1) * 65535.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see GLSL packUnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packUnorm2x16(vec2 const& v);\n\n\t/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm2x16: round(clamp(v, -1, +1) * 32767.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see GLSL packSnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packSnorm2x16(vec2 const& v);\n\n\t/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm4x8:\tround(clamp(c, 0, +1) * 255.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packUnorm4x8(vec4 const& v);\n\n\t/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm4x8:\tround(clamp(c, -1, +1) * 127.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packSnorm4x8(vec4 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm2x16: f / 65535.0\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see GLSL unpackUnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackUnorm2x16(uint p);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm2x16: clamp(f / 32767.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see GLSL unpackSnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackSnorm2x16(uint p);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm4x8: f / 255.0\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see GLSL unpackUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackUnorm4x8(uint p);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm4x8: clamp(f / 127.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackSnorm4x8(uint p);\n\n\t/// Returns a double-qualifier value obtained by packing the components of v into a 64-bit value.\n\t/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.\n\t/// Otherwise, the bit- level representation of v is preserved.\n\t/// The first vector component specifies the 32 least significant bits;\n\t/// the second component specifies the 32 most significant bits.\n\t///\n\t/// @see GLSL packDouble2x32 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL double packDouble2x32(uvec2 const& v);\n\n\t/// Returns a two-component unsigned integer vector representation of v.\n\t/// The bit-level representation of v is preserved.\n\t/// The first component of the vector contains the 32 least significant bits of the double;\n\t/// the second component consists the 32 most significant bits.\n\t///\n\t/// @see GLSL unpackDouble2x32 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uvec2 unpackDouble2x32(double v);\n\n\t/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification,\n\t/// and then packing these two 16- bit integers into a 32-bit unsigned integer.\n\t/// The first vector component specifies the 16 least-significant bits of the result;\n\t/// the second component specifies the 16 most-significant bits.\n\t///\n\t/// @see GLSL packHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packHalf2x16(vec2 const& v);\n\n\t/// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values,\n\t/// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,\n\t/// and converting them to 32-bit floating-point values.\n\t/// The first component of the vector is obtained from the 16 least-significant bits of v;\n\t/// the second component is obtained from the 16 most-significant bits of v.\n\t///\n\t/// @see GLSL unpackHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackHalf2x16(uint v);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_packing.inl\"\n"}, {"path": "includes/glm/trigonometric.hpp", "language": "code", "loc": 190, "comment_density": 0.811, "code": "/// @ref core\n/// @file glm/trigonometric.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n///\n/// @defgroup core_func_trigonometric Angle and Trigonometry Functions\n/// @ingroup core\n///\n/// Function parameters specified as angle are assumed to be in units of radians.\n/// In no case will any of these functions result in a divide by zero error. If\n/// the divisor of a ratio is 0, then results will be undefined.\n///\n/// These all operate component-wise. The description is per component.\n///\n/// Include to use these core features.\n///\n/// @see ext_vector_trigonometric\n\n#pragma once\n\n#include \"detail/setup.hpp\"\n#include \"detail/qualifier.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_trigonometric\n\t/// @{\n\n\t/// Converts degrees to radians and returns the result.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL radians man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec radians(vec const& degrees);\n\n\t/// Converts radians to degrees and returns the result.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL degrees man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec degrees(vec const& radians);\n\n\t/// The standard trigonometric sine function.\n\t/// The values returned by this function will range from [-1, 1].\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL sin man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec sin(vec const& angle);\n\n\t/// The standard trigonometric cosine function.\n\t/// The values returned by this function will range from [-1, 1].\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL cos man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec cos(vec const& angle);\n\n\t/// The standard trigonometric tangent function.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL tan man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec tan(vec const& angle);\n\n\t/// Arc sine. Returns an angle whose sine is x.\n\t/// The range of values returned by this function is [-PI/2, PI/2].\n\t/// Results are undefined if |x| > 1.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL asin man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec asin(vec const& x);\n\n\t/// Arc cosine. Returns an angle whose sine is x.\n\t/// The range of values returned by this function is [0, PI].\n\t/// Results are undefined if |x| > 1.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL acos man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec acos(vec const& x);\n\n\t/// Arc tangent. Returns an angle whose tangent is y/x.\n\t/// The signs of x and y are used to determine what\n\t/// quadrant the angle is in. The range of values returned\n\t/// by this function is [-PI, PI]. Results are undefined\n\t/// if x and y are both 0.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL atan man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec atan(vec const& y, vec const& x);\n\n\t/// Arc tangent. Returns an angle whose tangent is y_over_x.\n\t/// The range of values returned by this function is [-PI/2, PI/2].\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL atan man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec atan(vec const& y_over_x);\n\n\t/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL sinh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec sinh(vec const& angle);\n\n\t/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL cosh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec cosh(vec const& angle);\n\n\t/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL tanh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec tanh(vec const& angle);\n\n\t/// Arc hyperbolic sine; returns the inverse of sinh.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL asinh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec asinh(vec const& x);\n\n\t/// Arc hyperbolic cosine; returns the non-negative inverse\n\t/// of cosh. Results are undefined if x < 1.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL acosh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec acosh(vec const& x);\n\n\t/// Arc hyperbolic tangent; returns the inverse of tanh.\n\t/// Results are undefined if abs(x) >= 1.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL atanh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec atanh(vec const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_trigonometric.inl\"\n"}, {"path": "includes/glm/vec2.hpp", "language": "code", "loc": 13, "comment_density": 0.154, "code": "/// @ref core\n/// @file glm/vec2.hpp\n\n#pragma once\n#include \"./ext/vector_bool2.hpp\"\n#include \"./ext/vector_bool2_precision.hpp\"\n#include \"./ext/vector_float2.hpp\"\n#include \"./ext/vector_float2_precision.hpp\"\n#include \"./ext/vector_double2.hpp\"\n#include \"./ext/vector_double2_precision.hpp\"\n#include \"./ext/vector_int2.hpp\"\n#include \"./ext/vector_int2_precision.hpp\"\n#include \"./ext/vector_uint2.hpp\"\n#include \"./ext/vector_uint2_precision.hpp\"\n"}, {"path": "includes/glm/vec3.hpp", "language": "code", "loc": 13, "comment_density": 0.154, "code": "/// @ref core\n/// @file glm/vec3.hpp\n\n#pragma once\n#include \"./ext/vector_bool3.hpp\"\n#include \"./ext/vector_bool3_precision.hpp\"\n#include \"./ext/vector_float3.hpp\"\n#include \"./ext/vector_float3_precision.hpp\"\n#include \"./ext/vector_double3.hpp\"\n#include \"./ext/vector_double3_precision.hpp\"\n#include \"./ext/vector_int3.hpp\"\n#include \"./ext/vector_int3_precision.hpp\"\n#include \"./ext/vector_uint3.hpp\"\n#include \"./ext/vector_uint3_precision.hpp\"\n"}, {"path": "includes/glm/vec4.hpp", "language": "code", "loc": 13, "comment_density": 0.154, "code": "/// @ref core\n/// @file glm/vec4.hpp\n\n#pragma once\n#include \"./ext/vector_bool4.hpp\"\n#include \"./ext/vector_bool4_precision.hpp\"\n#include \"./ext/vector_float4.hpp\"\n#include \"./ext/vector_float4_precision.hpp\"\n#include \"./ext/vector_double4.hpp\"\n#include \"./ext/vector_double4_precision.hpp\"\n#include \"./ext/vector_int4.hpp\"\n#include \"./ext/vector_int4_precision.hpp\"\n#include \"./ext/vector_uint4.hpp\"\n#include \"./ext/vector_uint4_precision.hpp\"\n\n"}, {"path": "includes/glm/vector_relational.hpp", "language": "code", "loc": 107, "comment_density": 0.776, "code": "/// @ref core\n/// @file glm/vector_relational.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n///\n/// @defgroup core_func_vector_relational Vector Relational Functions\n/// @ingroup core\n///\n/// Relational and equality operators (<, <=, >, >=, ==, !=) are defined to\n/// operate on scalars and produce scalar Boolean results. For vector results,\n/// use the following built-in functions.\n///\n/// In all cases, the sizes of all the input and return vectors for any particular\n/// call must match.\n///\n/// Include to use these core features.\n///\n/// @see ext_vector_relational\n\n#pragma once\n\n#include \"detail/qualifier.hpp\"\n#include \"detail/setup.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_vector_relational\n\t/// @{\n\n\t/// Returns the component-wise comparison result of x < y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point or integer scalar type.\n\t///\n\t/// @see GLSL lessThan man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec lessThan(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x <= y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point or integer scalar type.\n\t///\n\t/// @see GLSL lessThanEqual man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec lessThanEqual(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x > y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point or integer scalar type.\n\t///\n\t/// @see GLSL greaterThan man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec greaterThan(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x >= y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point or integer scalar type.\n\t///\n\t/// @see GLSL greaterThanEqual man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec greaterThanEqual(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x == y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point, integer or bool scalar type.\n\t///\n\t/// @see GLSL equal man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x != y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point, integer or bool scalar type.\n\t///\n\t/// @see GLSL notEqual man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y);\n\n\t/// Returns true if any component of x is true.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL any man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool any(vec const& v);\n\n\t/// Returns true if all components of x are true.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL all man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool all(vec const& v);\n\n\t/// Returns the component-wise logical complement of x.\n\t/// /!\\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL not man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec not_(vec const& v);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_vector_relational.inl\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.426, "dedup_hash": "0f3aebc699d157f0", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_detail", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Detail", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/detail/_features.hpp", "language": "code", "loc": 295, "comment_density": 0.631, "code": "#pragma once\n\n// #define GLM_CXX98_EXCEPTIONS\n// #define GLM_CXX98_RTTI\n\n// #define GLM_CXX11_RVALUE_REFERENCES\n// Rvalue references - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html\n\n// GLM_CXX11_TRAILING_RETURN\n// Rvalue references for *this - GCC not supported\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm\n\n// GLM_CXX11_NONSTATIC_MEMBER_INIT\n// Initialization of class objects by rvalues - GCC any\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1610.html\n\n// GLM_CXX11_NONSTATIC_MEMBER_INIT\n// Non-static data member initializers - GCC 4.7\n// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2756.htm\n\n// #define GLM_CXX11_VARIADIC_TEMPLATE\n// Variadic templates - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf\n\n//\n// Extending variadic template template parameters - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf\n\n// #define GLM_CXX11_GENERALIZED_INITIALIZERS\n// Initializer lists - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm\n\n// #define GLM_CXX11_STATIC_ASSERT\n// Static assertions - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html\n\n// #define GLM_CXX11_AUTO_TYPE\n// auto-typed variables - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf\n\n// #define GLM_CXX11_AUTO_TYPE\n// Multi-declarator auto - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1737.pdf\n\n// #define GLM_CXX11_AUTO_TYPE\n// Removal of auto as a storage-class specifier - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2546.htm\n\n// #define GLM_CXX11_AUTO_TYPE\n// New function declarator syntax - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm\n\n// #define GLM_CXX11_LAMBDAS\n// New wording for C++0x lambdas - GCC 4.5\n// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf\n\n// #define GLM_CXX11_DECLTYPE\n// Declared type of an expression - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf\n\n//\n// Right angle brackets - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html\n\n//\n// Default template arguments for function templates\tDR226\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226\n\n//\n// Solving the SFINAE problem for expressions\tDR339\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html\n\n// #define GLM_CXX11_ALIAS_TEMPLATE\n// Template aliases\tN2258\tGCC 4.7\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf\n\n//\n// Extern templates\tN1987\tYes\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm\n\n// #define GLM_CXX11_NULLPTR\n// Null pointer constant\tN2431\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf\n\n// #define GLM_CXX11_STRONG_ENUMS\n// Strongly-typed enums\tN2347\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf\n\n//\n// Forward declarations for enums\tN2764\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf\n\n//\n// Generalized attributes\tN2761\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf\n\n//\n// Generalized constant expressions\tN2235\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf\n\n//\n// Alignment support\tN2341\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf\n\n// #define GLM_CXX11_DELEGATING_CONSTRUCTORS\n// Delegating constructors\tN1986\tGCC 4.7\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf\n\n//\n// Inheriting constructors\tN2540\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm\n\n// #define GLM_CXX11_EXPLICIT_CONVERSIONS\n// Explicit conversion operators\tN2437\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf\n\n//\n// New character types\tN2249\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html\n\n//\n// Unicode string literals\tN2442\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm\n\n//\n// Raw string literals\tN2442\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm\n\n//\n// Universal character name literals\tN2170\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html\n\n// #define GLM_CXX11_USER_LITERALS\n// User-defined literals\t\tN2765\tGCC 4.7\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf\n\n//\n// Standard Layout Types\tN2342\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm\n\n// #define GLM_CXX11_DEFAULTED_FUNCTIONS\n// #define GLM_CXX11_DELETED_FUNCTIONS\n// Defaulted and deleted functions\tN2346\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm\n\n//\n// Extended friend declarations\tN1791\tGCC 4.7\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf\n\n//\n// Extending sizeof\tN2253\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html\n\n// #define GLM_CXX11_INLINE_NAMESPACES\n// Inline namespaces\tN2535\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm\n\n// #define GLM_CXX11_UNRESTRICTED_UNIONS\n// Unrestricted unions\tN2544\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf\n\n// #define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS\n// Local and unnamed types as template arguments\tN2657\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm\n\n// #define GLM_CXX11_RANGE_FOR\n// Range-based for\tN2930\tGCC 4.6\n// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html\n\n// #define GLM_CXX11_OVERRIDE_CONTROL\n// Explicit virtual overrides\tN2928 N3206 N3272\tGCC 4.7\n// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm\n\n//\n// Minimal support for garbage collection and reachability-based leak detection\tN2670\tNo\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm\n\n// #define GLM_CXX11_NOEXCEPT\n// Allowing move constructors to throw [noexcept]\tN3050\tGCC 4.6 (core language only)\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html\n\n//\n// Defining move special member functions\tN3053\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html\n\n//\n// Sequence points\tN2239\tYes\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html\n\n//\n// Atomic operations\tN2427\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html\n\n//\n// Strong Compare and Exchange\tN2748\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html\n\n//\n// Bidirectional Fences\tN2752\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm\n\n//\n// Memory model\tN2429\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2429.htm\n\n//\n// Data-dependency ordering: atomics and memory model\tN2664\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2664.htm\n\n//\n// Propagating exceptions\tN2179\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html\n\n//\n// Abandoning a process and at_quick_exit\tN2440\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2440.htm\n\n//\n// Allow atomics use in signal handlers\tN2547\tYes\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm\n\n//\n// Thread-local storage\tN2659\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm\n\n//\n// Dynamic initialization and destruction with concurrency\tN2660\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm\n\n//\n// __func__ predefined identifier\tN2340\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm\n\n//\n// C99 preprocessor\tN1653\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm\n\n//\n// long long\tN1811\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf\n\n//\n// Extended integral types\tN1988\tYes\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1988.pdf\n\n#if(GLM_COMPILER & GLM_COMPILER_GCC)\n\n#\tdefine GLM_CXX11_STATIC_ASSERT\n\n#elif(GLM_COMPILER & GLM_COMPILER_CLANG)\n#\tif(__has_feature(cxx_exceptions))\n#\t\tdefine GLM_CXX98_EXCEPTIONS\n#\tendif\n\n#\tif(__has_feature(cxx_rtti))\n#\t\tdefine GLM_CXX98_RTTI\n#\tendif\n\n#\tif(__has_feature(cxx_access_control_sfinae))\n#\t\tdefine GLM_CXX11_ACCESS_CONTROL_SFINAE\n#\tendif\n\n#\tif(__has_feature(cxx_alias_templates))\n#\t\tdefine GLM_CXX11_ALIAS_TEMPLATE\n#\tendif\n\n#\tif(__has_feature(cxx_alignas))\n#\t\tdefine GLM_CXX11_ALIGNAS\n#\tendif\n\n#\tif(__has_feature(cxx_attributes))\n#\t\tdefine GLM_CXX11_ATTRIBUTES\n#\tendif\n\n#\tif(__has_feature(cxx_constexpr))\n#\t\tdefine GLM_CXX11_CONSTEXPR\n#\tendif\n\n#\tif(__has_feature(cxx_decltype))\n#\t\tdefine GLM_CXX11_DECLTYPE\n#\tendif\n\n#\tif(__has_feature(cxx_default_function_template_args))\n#\t\tdefine GLM_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS\n#\tendif\n\n#\tif(__has_feature(cxx_defaulted_functions))\n#\t\tdefine GLM_CXX11_DEFAULTED_FUNCTIONS\n#\tendif\n\n#\tif(__has_feature(cxx_delegating_constructors))\n#\t\tdefine GLM_CXX11_DELEGATING_CONSTRUCTORS\n#\tendif\n\n#\tif(__has_feature(cxx_deleted_functions))\n#\t\tdefine GLM_CXX11_DELETED_FUNCTIONS\n#\tendif\n\n#\tif(__has_feature(cxx_explicit_conversions))\n#\t\tdefine GLM_CXX11_EXPLICIT_CONVERSIONS\n#\tendif\n\n#\tif(__has_feature(cxx_generalized_initializers))\n#\t\tdefine GLM_CXX11_GENERALIZED_INITIALIZERS\n#\tendif\n\n#\tif(__has_feature(cxx_implicit_moves))\n#\t\tdefine GLM_CXX11_IMPLICIT_MOVES\n#\tendif\n\n#\tif(__has_feature(cxx_inheriting_constructors))\n#\t\tdefine GLM_CXX11_INHERITING_CONSTRUCTORS\n#\tendif\n\n#\tif(__has_feature(cxx_inline_namespaces))\n#\t\tdefine GLM_CXX11_INLINE_NAMESPACES\n#\tendif\n\n#\tif(__has_feature(cxx_lambdas))\n#\t\tdefine GLM_CXX11_LAMBDAS\n#\tendif\n\n#\tif(__has_feature(cxx_local_type_template_args))\n#\t\tdefine GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS\n#\tendif\n\n#\tif(__has_feature(cxx_noexcept))\n#\t\tdefine GLM_CXX11_NOEXCEPT\n#\tendif\n\n#\tif(__has_feature(cxx_nonstatic_member_init))\n#\t\tdefine GLM_CXX11_NONSTATIC_MEMBER_INIT\n#\tendif\n\n#\tif(__has_feature(cxx_nullptr))\n#\t\tdefine GLM_CXX11_NULLPTR\n#\tendif\n\n#\tif(__has_feature(cxx_override_control))\n#\t\tdefine GLM_CXX11_OVERRIDE_CONTROL\n#\tendif\n\n#\tif(__has_feature(cxx_reference_qualified_functions))\n#\t\tdefine GLM_CXX11_REFERENCE_QUALIFIED_FUNCTIONS\n#\tendif\n\n#\tif(__has_feature(cxx_range_for))\n#\t\tdefine GLM_CXX11_RANGE_FOR\n#\tendif\n\n#\tif(__has_feature(cxx_raw_string_literals))\n#\t\tdefine GLM_CXX11_RAW_STRING_LITERALS\n#\tendif\n\n#\tif(__has_feature(cxx_rvalue_references))\n#\t\tdefine GLM_CXX11_RVALUE_REFERENCES\n#\tendif\n\n#\tif(__has_feature(cxx_static_assert))\n#\t\tdefine GLM_CXX11_STATIC_ASSERT\n#\tendif\n\n#\tif(__has_feature(cxx_auto_type))\n#\t\tdefine GLM_CXX11_AUTO_TYPE\n#\tendif\n\n#\tif(__has_feature(cxx_strong_enums))\n#\t\tdefine GLM_CXX11_STRONG_ENUMS\n#\tendif\n\n#\tif(__has_feature(cxx_trailing_return))\n#\t\tdefine GLM_CXX11_TRAILING_RETURN\n#\tendif\n\n#\tif(__has_feature(cxx_unicode_literals))\n#\t\tdefine GLM_CXX11_UNICODE_LITERALS\n#\tendif\n\n#\tif(__has_feature(cxx_unrestricted_unions))\n#\t\tdefine GLM_CXX11_UNRESTRICTED_UNIONS\n#\tendif\n\n#\tif(__has_feature(cxx_user_literals))\n#\t\tdefine GLM_CXX11_USER_LITERALS\n#\tendif\n\n#\tif(__has_feature(cxx_variadic_templates))\n#\t\tdefine GLM_CXX11_VARIADIC_TEMPLATES\n#\tendif\n\n#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)\n"}, {"path": "includes/glm/detail/_fixes.hpp", "language": "code", "loc": 21, "comment_density": 0.238, "code": "#include \n\n//! Workaround for compatibility with other libraries\n#ifdef max\n#undef max\n#endif\n\n//! Workaround for compatibility with other libraries\n#ifdef min\n#undef min\n#endif\n\n//! Workaround for Android\n#ifdef isnan\n#undef isnan\n#endif\n\n//! Workaround for Android\n#ifdef isinf\n#undef isinf\n#endif\n\n//! Workaround for Chrome Native Client\n#ifdef log2\n#undef log2\n#endif\n\n"}, {"path": "includes/glm/detail/_noise.hpp", "language": "code", "loc": 67, "comment_density": 0.03, "code": "#pragma once\n\n#include \"../common.hpp\"\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate\n\tGLM_FUNC_QUALIFIER T mod289(T const& x)\n\t{\n\t\treturn x - floor(x * (static_cast(1.0) / static_cast(289.0))) * static_cast(289.0);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER T permute(T const& x)\n\t{\n\t\treturn mod289(((x * static_cast(34)) + static_cast(1)) * x);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<2, T, Q> permute(vec<2, T, Q> const& x)\n\t{\n\t\treturn mod289(((x * static_cast(34)) + static_cast(1)) * x);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<3, T, Q> permute(vec<3, T, Q> const& x)\n\t{\n\t\treturn mod289(((x * static_cast(34)) + static_cast(1)) * x);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<4, T, Q> permute(vec<4, T, Q> const& x)\n\t{\n\t\treturn mod289(((x * static_cast(34)) + static_cast(1)) * x);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r)\n\t{\n\t\treturn static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r)\n\t{\n\t\treturn static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r)\n\t{\n\t\treturn static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r)\n\t{\n\t\treturn static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t)\n\t{\n\t\treturn (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t)\n\t{\n\t\treturn (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t)\n\t{\n\t\treturn (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));\n\t}\n}//namespace detail\n}//namespace glm\n\n"}, {"path": "includes/glm/detail/_swizzle.hpp", "language": "code", "loc": 757, "comment_density": 0.073, "code": "#pragma once\n\nnamespace glm{\nnamespace detail\n{\n\t// Internal class for implementing swizzle operators\n\ttemplate\n\tstruct _swizzle_base0\n\t{\n\tprotected:\n\t\tGLM_FUNC_QUALIFIER T& elem(size_t i){ return (reinterpret_cast(_buffer))[i]; }\n\t\tGLM_FUNC_QUALIFIER T const& elem(size_t i) const{ return (reinterpret_cast(_buffer))[i]; }\n\n\t\t// Use an opaque buffer to *ensure* the compiler doesn't call a constructor.\n\t\t// The size 1 buffer is assumed to aligned to the actual members so that the\n\t\t// elem()\n\t\tchar _buffer[1];\n\t};\n\n\ttemplate\n\tstruct _swizzle_base1 : public _swizzle_base0\n\t{\n\t};\n\n\ttemplate\n\tstruct _swizzle_base1<2, T, Q, E0,E1,-1,-2, Aligned> : public _swizzle_base0\n\t{\n\t\tGLM_FUNC_QUALIFIER vec<2, T, Q> operator ()() const { return vec<2, T, Q>(this->elem(E0), this->elem(E1)); }\n\t};\n\n\ttemplate\n\tstruct _swizzle_base1<3, T, Q, E0,E1,E2,-1, Aligned> : public _swizzle_base0\n\t{\n\t\tGLM_FUNC_QUALIFIER vec<3, T, Q> operator ()() const { return vec<3, T, Q>(this->elem(E0), this->elem(E1), this->elem(E2)); }\n\t};\n\n\ttemplate\n\tstruct _swizzle_base1<4, T, Q, E0,E1,E2,E3, Aligned> : public _swizzle_base0\n\t{\n\t\tGLM_FUNC_QUALIFIER vec<4, T, Q> operator ()() const { return vec<4, T, Q>(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); }\n\t};\n\n\t// Internal class for implementing swizzle operators\n\t/*\n\t\tTemplate parameters:\n\n\t\tT\t\t\t= type of scalar values (e.g. float, double)\n\t\tN\t\t\t= number of components in the vector (e.g. 3)\n\t\tE0...3\t\t= what index the n-th element of this swizzle refers to in the unswizzled vec\n\n\t\tDUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles\n\t\t\tcontaining duplicate elements so that they cannot be used as r-values).\n\t*/\n\ttemplate\n\tstruct _swizzle_base2 : public _swizzle_base1::value>\n\t{\n\t\tstruct op_equal\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e = t; }\n\t\t};\n\n\t\tstruct op_minus\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e -= t; }\n\t\t};\n\n\t\tstruct op_plus\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e += t; }\n\t\t};\n\n\t\tstruct op_mul\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e *= t; }\n\t\t};\n\n\t\tstruct op_div\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e /= t; }\n\t\t};\n\n\tpublic:\n\t\tGLM_FUNC_QUALIFIER _swizzle_base2& operator= (const T& t)\n\t\t{\n\t\t\tfor (int i = 0; i < N; ++i)\n\t\t\t\t(*this)[i] = t;\n\t\t\treturn *this;\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER _swizzle_base2& operator= (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_equal());\n\t\t\treturn *this;\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER void operator -= (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_minus());\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER void operator += (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_plus());\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER void operator *= (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_mul());\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER void operator /= (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_div());\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER T& operator[](size_t i)\n\t\t{\n\t\t\tconst int offset_dst[4] = { E0, E1, E2, E3 };\n\t\t\treturn this->elem(offset_dst[i]);\n\t\t}\n\t\tGLM_FUNC_QUALIFIER T operator[](size_t i) const\n\t\t{\n\t\t\tconst int offset_dst[4] = { E0, E1, E2, E3 };\n\t\t\treturn this->elem(offset_dst[i]);\n\t\t}\n\n\tprotected:\n\t\ttemplate\n\t\tGLM_FUNC_QUALIFIER void _apply_op(vec const& that, const U& op)\n\t\t{\n\t\t\t// Make a copy of the data in this == &that.\n\t\t\t// The copier should optimize out the copy in cases where the function is\n\t\t\t// properly inlined and the copy is not necessary.\n\t\t\tT t[N];\n\t\t\tfor (int i = 0; i < N; ++i)\n\t\t\t\tt[i] = that[i];\n\t\t\tfor (int i = 0; i < N; ++i)\n\t\t\t\top( (*this)[i], t[i] );\n\t\t}\n\t};\n\n\t// Specialization for swizzles containing duplicate elements. These cannot be modified.\n\ttemplate\n\tstruct _swizzle_base2 : public _swizzle_base1::value>\n\t{\n\t\tstruct Stub {};\n\n\t\tGLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const&) { return *this; }\n\n\t\tGLM_FUNC_QUALIFIER T operator[] (size_t i) const\n\t\t{\n\t\t\tconst int offset_dst[4] = { E0, E1, E2, E3 };\n\t\t\treturn this->elem(offset_dst[i]);\n\t\t}\n\t};\n\n\ttemplate\n\tstruct _swizzle : public _swizzle_base2\n\t{\n\t\ttypedef _swizzle_base2 base_type;\n\n\t\tusing base_type::operator=;\n\n\t\tGLM_FUNC_QUALIFIER operator vec () const { return (*this)(); }\n\t};\n\n//\n// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros\n//\n#define GLM_SWIZZLE_TEMPLATE1 template\n#define GLM_SWIZZLE_TEMPLATE2 template\n#define GLM_SWIZZLE_TYPE1 _swizzle\n#define GLM_SWIZZLE_TYPE2 _swizzle\n\n//\n// Wrapper for a binary operator (e.g. u.yy + v.zy)\n//\n#define GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \\\n\tGLM_SWIZZLE_TEMPLATE2 \\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE2& b) \\\n\t{ \\\n\t\treturn a() OPERAND b(); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const GLM_SWIZZLE_TYPE1& a, const vec& b) \\\n\t{ \\\n\t\treturn a() OPERAND b; \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const vec& a, const GLM_SWIZZLE_TYPE1& b) \\\n\t{ \\\n\t\treturn a OPERAND b(); \\\n\t}\n\n//\n// Wrapper for a operand between a swizzle and a binary (e.g. 1.0f - u.xyz)\n//\n#define GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND)\t\t\t\t\t\t\t\t\\\n\tGLM_SWIZZLE_TEMPLATE1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const GLM_SWIZZLE_TYPE1& a, const T& b)\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn a() OPERAND b;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_SWIZZLE_TEMPLATE1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const T& a, const GLM_SWIZZLE_TYPE1& b)\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn a OPERAND b();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t}\n\n//\n// Macro for wrapping a function taking one argument (e.g. abs())\n//\n#define GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION)\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_SWIZZLE_TEMPLATE1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a)\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn FUNCTION(a());\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t}\n\n//\n// Macro for wrapping a function taking two vector arguments (e.g. dot()).\n//\n#define GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \\\n\tGLM_SWIZZLE_TEMPLATE2 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE2& b) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b()); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE1& b) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b()); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const typename V& b) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const GLM_SWIZZLE_TYPE1& b) \\\n\t{ \\\n\t\treturn FUNCTION(a, b()); \\\n\t}\n\n//\n// Macro for wrapping a function take 2 vec arguments followed by a scalar (e.g. mix()).\n//\n#define GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \\\n\tGLM_SWIZZLE_TEMPLATE2 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE2& b, const T& c) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b(), c); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE1& b, const T& c) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b(), c); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\\\n\t{ \\\n\t\treturn FUNCTION(a(), b, c); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const GLM_SWIZZLE_TYPE1& b, const T& c) \\\n\t{ \\\n\t\treturn FUNCTION(a, b(), c); \\\n\t}\n\n}//namespace detail\n}//namespace glm\n\nnamespace glm\n{\n\tnamespace detail\n\t{\n\t\tGLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-)\n\t\tGLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*)\n\t\tGLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+)\n\t\tGLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-)\n\t\tGLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*)\n\t\tGLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/)\n\t}\n\n\t//\n\t// Swizzles are distinct types from the unswizzled type. The below macros will\n\t// provide template specializations for the swizzle types for the given functions\n\t// so that the compiler does not have any ambiguity to choosing how to handle\n\t// the function.\n\t//\n\t// The alternative is to use the operator()() when calling the function in order\n\t// to explicitly convert the swizzled type to the unswizzled type.\n\t//\n\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs);\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos);\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh);\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all);\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any);\n\n\t//GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot);\n\t//GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross);\n\t//GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step);\n\t//GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix);\n}\n\n#define GLM_SWIZZLE2_2_MEMBERS(T, Q, E0,E1) \\\n\tstruct { detail::_swizzle<2, T, Q, 0,0,-1,-2> E0 ## E0; }; \\\n\tstruct { detail::_swizzle<2, T, Q, 0,1,-1,-2> E0 ## E1; }; \\\n\tstruct { detail::_swizzle<2, T, Q, 1,0,-1,-2> E1 ## E0; }; \\\n\tstruct { detail::_swizzle<2, T, Q, 1,1,-1,-2> E1 ## E1; };\n\n#define GLM_SWIZZLE2_3_MEMBERS(T, Q, E0,E1) \\\n\tstruct { detail::_swizzle<3,T, Q, 0,0,0,-1> E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 0,0,1,-1> E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 0,1,0,-1> E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 0,1,1,-1> E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 1,0,0,-1> E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 1,0,1,-1> E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 1,1,0,-1> E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 1,1,1,-1> E1 ## E1 ## E1; };\n\n#define GLM_SWIZZLE2_4_MEMBERS(T, Q, E0,E1) \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,1> E1 ## E1 ## E1 ## E1; };\n\n#define GLM_SWIZZLE3_2_MEMBERS(T, Q, E0,E1,E2) \\\n\tstruct { detail::_swizzle<2,T, Q, 0,0,-1,-2> E0 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,1,-1,-2> E0 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,2,-1,-2> E0 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,0,-1,-2> E1 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,1,-1,-2> E1 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,2,-1,-2> E1 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,0,-1,-2> E2 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,1,-1,-2> E2 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,2,-1,-2> E2 ## E2; };\n\n#define GLM_SWIZZLE3_3_MEMBERS(T, Q ,E0,E1,E2) \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,0,-1> E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,1,-1> E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,2,-1> E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,0,-1> E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,1,-1> E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,2,-1> E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,0,-1> E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,1,-1> E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,2,-1> E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,0,-1> E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,1,-1> E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,2,-1> E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,0,-1> E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,1,-1> E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,2,-1> E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,0,-1> E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,1,-1> E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,2,-1> E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,0,-1> E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,1,-1> E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,2,-1> E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,0,-1> E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,1,-1> E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,2,-1> E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,0,-1> E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,1,-1> E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,2,-1> E2 ## E2 ## E2; };\n\n#define GLM_SWIZZLE3_4_MEMBERS(T, Q, E0,E1,E2) \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,2,2> E2 ## E2 ## E2 ## E2; };\n\n#define GLM_SWIZZLE4_2_MEMBERS(T, Q, E0,E1,E2,E3) \\\n\tstruct { detail::_swizzle<2,T, Q, 0,0,-1,-2> E0 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,1,-1,-2> E0 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,2,-1,-2> E0 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,3,-1,-2> E0 ## E3; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,0,-1,-2> E1 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,1,-1,-2> E1 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,2,-1,-2> E1 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,3,-1,-2> E1 ## E3; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,0,-1,-2> E2 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,1,-1,-2> E2 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,2,-1,-2> E2 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,3,-1,-2> E2 ## E3; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 3,0,-1,-2> E3 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 3,1,-1,-2> E3 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 3,2,-1,-2> E3 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 3,3,-1,-2> E3 ## E3; };\n\n#define GLM_SWIZZLE4_3_MEMBERS(T, Q, E0,E1,E2,E3) \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,0,-1> E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,1,-1> E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,2,-1> E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,3,-1> E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,0,-1> E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,1,-1> E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,2,-1> E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,3,-1> E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,0,-1> E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,1,-1> E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,2,-1> E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,3,-1> E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,3,0,-1> E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,3,1,-1> E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,3,2,-1> E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,3,3,-1> E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,0,-1> E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,1,-1> E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,2,-1> E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,3,-1> E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,0,-1> E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,1,-1> E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,2,-1> E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,3,-1> E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,0,-1> E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,1,-1> E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,2,-1> E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,3,-1> E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,3,0,-1> E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,3,1,-1> E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,3,2,-1> E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,3,3,-1> E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,0,-1> E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,1,-1> E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,2,-1> E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,3,-1> E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,0,-1> E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,1,-1> E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,2,-1> E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,3,-1> E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,0,-1> E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,1,-1> E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,2,-1> E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,3,-1> E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,3,0,-1> E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,3,1,-1> E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,3,2,-1> E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,3,3,-1> E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,0,0,-1> E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,0,1,-1> E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,0,2,-1> E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,0,3,-1> E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,1,0,-1> E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,1,1,-1> E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,1,2,-1> E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,1,3,-1> E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,2,0,-1> E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,2,1,-1> E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,2,2,-1> E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,2,3,-1> E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,3,0,-1> E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,3,1,-1> E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,3,2,-1> E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,3,3,-1> E3 ## E3 ## E3; };\n\n#define GLM_SWIZZLE4_4_MEMBERS(T, Q, E0,E1,E2,E3) \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,0,3> E0 ## E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,1,3> E0 ## E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,2,3> E0 ## E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,3,0> E0 ## E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,3,1> E0 ## E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,3,2> E0 ## E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,3,3> E0 ## E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,0,3> E0 ## E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,1,3> E0 ## E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,2,3> E0 ## E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,3,0> E0 ## E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,3,1> E0 ## E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,3,2> E0 ## E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,3,3> E0 ## E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,0,3> E0 ## E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,1,3> E0 ## E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,2,3> E0 ## E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,3,0> E0 ## E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,0,3> E1 ## E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,1,3> E1 ## E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,2,3> E1 ## E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,3,0> E1 ## E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,3,1> E1 ## E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,3,2> E1 ## E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,3,3> E1 ## E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,0,3> E1 ## E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,1,3> E1 ## E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,2,3> E1 ## E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,3,0> E1 ## E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,3,1> E1 ## E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,3,2> E1 ## E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,3,3> E1 ## E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,0,3> E1 ## E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,1,3> E1 ## E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,2,3> E1 ## E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,3,0> E1 ## E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,3,1> E1 ## E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,3,2> E1 ## E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,3,3> E1 ## E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,0,0> E1 ## E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,0,1> E1 ## E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,0,2> E1 ## E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,0,3> E1 ## E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,1,0> E1 ## E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,1,1> E1 ## E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,1,2> E1 ## E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,1,3> E1 ## E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,2,0> E1 ## E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,2,1> E1 ## E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,2,2> E1 ## E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,2,3> E1 ## E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,3,0> E1 ## E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,3,1> E1 ## E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,3,2> E1 ## E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,3,3> E1 ## E3 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,0,3> E2 ## E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,1,3> E2 ## E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,2,3> E2 ## E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,3,0> E2 ## E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,3,1> E2 ## E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,3,2> E2 ## E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,3,3> E2 ## E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,0,3> E2 ## E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,1,3> E2 ## E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,2,3> E2 ## E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,3,0> E2 ## E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,3,1> E2 ## E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,3,2> E2 ## E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,3,3> E2 ## E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,0,3> E2 ## E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,1,3> E2 ## E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,2,3> E2 ## E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,3,0> E2 ## E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,3,1> E2 ## E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,3,2> E2 ## E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,3,3> E2 ## E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,0,0> E2 ## E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,0,1> E2 ## E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,0,2> E2 ## E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,0,3> E2 ## E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,1,0> E2 ## E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,1,1> E2 ## E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,1,2> E2 ## E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,1,3> E2 ## E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,2,0> E2 ## E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,2,1> E2 ## E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,2,2> E2 ## E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,2,3> E2 ## E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,3,0> E2 ## E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,3,1> E2 ## E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,3,2> E2 ## E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,3,3> E2 ## E3 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,0,0> E3 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,0,1> E3 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,0,2> E3 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,0,3> E3 ## E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,1,0> E3 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,1,1> E3 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,1,2> E3 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,1,3> E3 ## E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,2,0> E3 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,2,1> E3 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,2,2> E3 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,2,3> E3 ## E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,3,0> E3 ## E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,3,1> E3 ## E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,3,2> E3 ## E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,3,3> E3 ## E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,0,0> E3 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,0,1> E3 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,0,2> E3 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,0,3> E3 ## E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,1,0> E3 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,1,1> E3 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,1,2> E3 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,1,3> E3 ## E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,2,0> E3 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,2,1> E3 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,2,2> E3 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,2,3> E3 ## E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,3,0> E3 ## E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,3,1> E3 ## E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,3,2> E3 ## E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,3,3> E3 ## E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,0,0> E3 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,0,1> E3 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,0,2> E3 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,0,3> E3 ## E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,1,0> E3 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,1,1> E3 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,1,2> E3 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,1,3> E3 ## E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,2,0> E3 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,2,1> E3 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,2,2> E3 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,2,3> E3 ## E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,3,0> E3 ## E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,3,1> E3 ## E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,3,2> E3 ## E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,3,3> E3 ## E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,0,0> E3 ## E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,0,1> E3 ## E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,0,2> E3 ## E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,0,3> E3 ## E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,1,0> E3 ## E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,1,1> E3 ## E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,1,2> E3 ## E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,1,3> E3 ## E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,2,0> E3 ## E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,2,1> E3 ## E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,2,2> E3 ## E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,2,3> E3 ## E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,3,3> E3 ## E3 ## E3 ## E3; };\n"}, {"path": "includes/glm/detail/_swizzle_func.hpp", "language": "code", "loc": 648, "comment_density": 0.0, "code": "#pragma once\n\n#define GLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, CONST, A, B)\t\\\n\tvec<2, T, Q> A ## B() CONST\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<2, T, Q>(this->A, this->B);\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, CONST, A, B, C)\t\t\\\n\tvec<3, T, Q> A ## B ## C() CONST\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<3, T, Q>(this->A, this->B, this->C);\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, CONST, A, B, C, D)\t\t\t\t\t\\\n\tvec<4, T, Q> A ## B ## C ## D() CONST\t\t\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<4, T, Q>(this->A, this->B, this->C, this->D);\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(T, P, L, CONST, A, B)\t\\\n\ttemplate\t\t\t\t\t\t\t\t\t\t\\\n\tvec vec::A ## B() CONST\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<2, T, Q>(this->A, this->B);\t\t\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC3_ENTRY_DEF(T, P, L, CONST, A, B, C)\t\t\\\n\ttemplate\t\t\t\t\t\t\t\t\t\t\t\\\n\tvec<3, T, Q> vec::A ## B ## C() CONST\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<3, T, Q>(this->A, this->B, this->C);\t\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC4_ENTRY_DEF(T, P, L, CONST, A, B, C, D)\t\t\\\n\ttemplate\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tvec<4, T, Q> vec::A ## B ## C ## D() CONST\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<4, T, Q>(this->A, this->B, this->C, this->D);\t\t\\\n\t}\n\n#define GLM_MUTABLE\n\n#define GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, 2, GLM_MUTABLE, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, 2, GLM_MUTABLE, B, A)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC2(T, P) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(T, P, x, y) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(T, P, r, g) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(T, P, s, t)\n\n#define GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, B)\n\n#define GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, C, B, A)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(T, P, A, B, C)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, P) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, x, y, z) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, r, g, b) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, s, t, p)\n\n#define GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, D, C)\n\n#define GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, C, B)\n\n#define GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, B, C, A)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(T, P, A, B, C, D)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, P) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, x, y, z, w) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, r, g, b, a) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, s, t, p, q)\n\n#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, B)\n\n#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, B)\n\n#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, B)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(T, P, A, B)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P)\t\t\t\\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, P, x, y)\t\\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, P, r, g)\t\\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, P, s, t)\n\n#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, C)\n\n#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, C)\n\n#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, C)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(T, P, A, B, C)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, x, y, z) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, r, g, b) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, s, t, p)\n\n#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, D, D)\n\n#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, D, D)\n\n#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, D, D)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(T, P, A, B, C, D)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, x, y, z, w) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, r, g, b, a) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, s, t, p, q)\n\n"}, {"path": "includes/glm/detail/_vectorize.hpp", "language": "code", "loc": 108, "comment_density": 0.019, "code": "#pragma once\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate class vec, length_t L, typename R, typename T, qualifier Q>\n\tstruct functor1{};\n\n\ttemplate class vec, typename R, typename T, qualifier Q>\n\tstruct functor1\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<1, R, Q> call(R (*Func) (T x), vec<1, T, Q> const& v)\n\t\t{\n\t\t\treturn vec<1, R, Q>(Func(v.x));\n\t\t}\n\t};\n\n\ttemplate class vec, typename R, typename T, qualifier Q>\n\tstruct functor1\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<2, R, Q> call(R (*Func) (T x), vec<2, T, Q> const& v)\n\t\t{\n\t\t\treturn vec<2, R, Q>(Func(v.x), Func(v.y));\n\t\t}\n\t};\n\n\ttemplate class vec, typename R, typename T, qualifier Q>\n\tstruct functor1\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<3, R, Q> call(R (*Func) (T x), vec<3, T, Q> const& v)\n\t\t{\n\t\t\treturn vec<3, R, Q>(Func(v.x), Func(v.y), Func(v.z));\n\t\t}\n\t};\n\n\ttemplate class vec, typename R, typename T, qualifier Q>\n\tstruct functor1\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<4, R, Q> call(R (*Func) (T x), vec<4, T, Q> const& v)\n\t\t{\n\t\t\treturn vec<4, R, Q>(Func(v.x), Func(v.y), Func(v.z), Func(v.w));\n\t\t}\n\t};\n\n\ttemplate class vec, length_t L, typename T, qualifier Q>\n\tstruct functor2{};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<1, T, Q> call(T (*Func) (T x, T y), vec<1, T, Q> const& a, vec<1, T, Q> const& b)\n\t\t{\n\t\t\treturn vec<1, T, Q>(Func(a.x, b.x));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<2, T, Q> call(T (*Func) (T x, T y), vec<2, T, Q> const& a, vec<2, T, Q> const& b)\n\t\t{\n\t\t\treturn vec<2, T, Q>(Func(a.x, b.x), Func(a.y, b.y));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<3, T, Q> call(T (*Func) (T x, T y), vec<3, T, Q> const& a, vec<3, T, Q> const& b)\n\t\t{\n\t\t\treturn vec<3, T, Q>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<4, T, Q> call(T (*Func) (T x, T y), vec<4, T, Q> const& a, vec<4, T, Q> const& b)\n\t\t{\n\t\t\treturn vec<4, T, Q>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w));\n\t\t}\n\t};\n\n\ttemplate class vec, length_t L, typename T, qualifier Q>\n\tstruct functor2_vec_sca{};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2_vec_sca\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<1, T, Q> call(T (*Func) (T x, T y), vec<1, T, Q> const& a, T b)\n\t\t{\n\t\t\treturn vec<1, T, Q>(Func(a.x, b));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2_vec_sca\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<2, T, Q> call(T (*Func) (T x, T y), vec<2, T, Q> const& a, T b)\n\t\t{\n\t\t\treturn vec<2, T, Q>(Func(a.x, b), Func(a.y, b));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2_vec_sca\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<3, T, Q> call(T (*Func) (T x, T y), vec<3, T, Q> const& a, T b)\n\t\t{\n\t\t\treturn vec<3, T, Q>(Func(a.x, b), Func(a.y, b), Func(a.z, b));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2_vec_sca\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<4, T, Q> call(T (*Func) (T x, T y), vec<4, T, Q> const& a, T b)\n\t\t{\n\t\t\treturn vec<4, T, Q>(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b));\n\t\t}\n\t};\n}//namespace detail\n}//namespace glm\n"}, {"path": "includes/glm/detail/compute_common.hpp", "language": "code", "loc": 44, "comment_density": 0.091, "code": "#pragma once\n\n#include \"setup.hpp\"\n#include \n\nnamespace glm{\nnamespace detail\n{\n\ttemplate\n\tstruct compute_abs\n\t{};\n\n\ttemplate\n\tstruct compute_abs\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x)\n\t\t{\n\t\t\tGLM_STATIC_ASSERT(\n\t\t\t\tstd::numeric_limits::is_iec559 || std::numeric_limits::is_signed,\n\t\t\t\t\"'abs' only accept floating-point and integer scalar or vector inputs\");\n\n\t\t\treturn x >= genFIType(0) ? x : -x;\n\t\t\t// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;\n\t\t}\n\t};\n\n#if GLM_COMPILER & GLM_COMPILER_CUDA\n\ttemplate<>\n\tstruct compute_abs\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static float call(float x)\n\t\t{\n\t\t\treturn fabsf(x);\n\t\t}\n\t};\n#endif\n\n\ttemplate\n\tstruct compute_abs\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x)\n\t\t{\n\t\t\tGLM_STATIC_ASSERT(\n\t\t\t\t(!std::numeric_limits::is_signed && std::numeric_limits::is_integer),\n\t\t\t\t\"'abs' only accept floating-point and integer scalar or vector inputs\");\n\t\t\treturn x;\n\t\t}\n\t};\n}//namespace detail\n}//namespace glm\n"}, {"path": "includes/glm/detail/compute_vector_relational.hpp", "language": "code", "loc": 28, "comment_density": 0.5, "code": "#pragma once\n\n//#include \"compute_common.hpp\"\n#include \"setup.hpp\"\n#include \n\nnamespace glm{\nnamespace detail\n{\n\ttemplate \n\tstruct compute_equal\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b)\n\t\t{\n\t\t\treturn a == b;\n\t\t}\n\t};\n/*\n\ttemplate \n\tstruct compute_equal\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b)\n\t\t{\n\t\t\treturn detail::compute_abs::is_signed>::call(b - a) <= static_cast(0);\n\t\t\t//return std::memcmp(&a, &b, sizeof(T)) == 0;\n\t\t}\n\t};\n*/\n}//namespace detail\n}//namespace glm\n"}, {"path": "includes/glm/detail/glm.cpp", "language": "code", "loc": 213, "comment_density": 0.085, "code": "/// @ref core\n/// @file glm/glm.cpp\n\n#define GLM_ENABLE_EXPERIMENTAL\n#include \n#include \n#include \n#include \n#include \n#include \n\nnamespace glm\n{\n// tvec1 type explicit instantiation\ntemplate struct vec<1, uint8, lowp>;\ntemplate struct vec<1, uint16, lowp>;\ntemplate struct vec<1, uint32, lowp>;\ntemplate struct vec<1, uint64, lowp>;\ntemplate struct vec<1, int8, lowp>;\ntemplate struct vec<1, int16, lowp>;\ntemplate struct vec<1, int32, lowp>;\ntemplate struct vec<1, int64, lowp>;\ntemplate struct vec<1, float32, lowp>;\ntemplate struct vec<1, float64, lowp>;\n\ntemplate struct vec<1, uint8, mediump>;\ntemplate struct vec<1, uint16, mediump>;\ntemplate struct vec<1, uint32, mediump>;\ntemplate struct vec<1, uint64, mediump>;\ntemplate struct vec<1, int8, mediump>;\ntemplate struct vec<1, int16, mediump>;\ntemplate struct vec<1, int32, mediump>;\ntemplate struct vec<1, int64, mediump>;\ntemplate struct vec<1, float32, mediump>;\ntemplate struct vec<1, float64, mediump>;\n\ntemplate struct vec<1, uint8, highp>;\ntemplate struct vec<1, uint16, highp>;\ntemplate struct vec<1, uint32, highp>;\ntemplate struct vec<1, uint64, highp>;\ntemplate struct vec<1, int8, highp>;\ntemplate struct vec<1, int16, highp>;\ntemplate struct vec<1, int32, highp>;\ntemplate struct vec<1, int64, highp>;\ntemplate struct vec<1, float32, highp>;\ntemplate struct vec<1, float64, highp>;\n\n// tvec2 type explicit instantiation\ntemplate struct vec<2, uint8, lowp>;\ntemplate struct vec<2, uint16, lowp>;\ntemplate struct vec<2, uint32, lowp>;\ntemplate struct vec<2, uint64, lowp>;\ntemplate struct vec<2, int8, lowp>;\ntemplate struct vec<2, int16, lowp>;\ntemplate struct vec<2, int32, lowp>;\ntemplate struct vec<2, int64, lowp>;\ntemplate struct vec<2, float32, lowp>;\ntemplate struct vec<2, float64, lowp>;\n\ntemplate struct vec<2, uint8, mediump>;\ntemplate struct vec<2, uint16, mediump>;\ntemplate struct vec<2, uint32, mediump>;\ntemplate struct vec<2, uint64, mediump>;\ntemplate struct vec<2, int8, mediump>;\ntemplate struct vec<2, int16, mediump>;\ntemplate struct vec<2, int32, mediump>;\ntemplate struct vec<2, int64, mediump>;\ntemplate struct vec<2, float32, mediump>;\ntemplate struct vec<2, float64, mediump>;\n\ntemplate struct vec<2, uint8, highp>;\ntemplate struct vec<2, uint16, highp>;\ntemplate struct vec<2, uint32, highp>;\ntemplate struct vec<2, uint64, highp>;\ntemplate struct vec<2, int8, highp>;\ntemplate struct vec<2, int16, highp>;\ntemplate struct vec<2, int32, highp>;\ntemplate struct vec<2, int64, highp>;\ntemplate struct vec<2, float32, highp>;\ntemplate struct vec<2, float64, highp>;\n\n// tvec3 type explicit instantiation\ntemplate struct vec<3, uint8, lowp>;\ntemplate struct vec<3, uint16, lowp>;\ntemplate struct vec<3, uint32, lowp>;\ntemplate struct vec<3, uint64, lowp>;\ntemplate struct vec<3, int8, lowp>;\ntemplate struct vec<3, int16, lowp>;\ntemplate struct vec<3, int32, lowp>;\ntemplate struct vec<3, int64, lowp>;\ntemplate struct vec<3, float32, lowp>;\ntemplate struct vec<3, float64, lowp>;\n\ntemplate struct vec<3, uint8, mediump>;\ntemplate struct vec<3, uint16, mediump>;\ntemplate struct vec<3, uint32, mediump>;\ntemplate struct vec<3, uint64, mediump>;\ntemplate struct vec<3, int8, mediump>;\ntemplate struct vec<3, int16, mediump>;\ntemplate struct vec<3, int32, mediump>;\ntemplate struct vec<3, int64, mediump>;\ntemplate struct vec<3, float32, mediump>;\ntemplate struct vec<3, float64, mediump>;\n\ntemplate struct vec<3, uint8, highp>;\ntemplate struct vec<3, uint16, highp>;\ntemplate struct vec<3, uint32, highp>;\ntemplate struct vec<3, uint64, highp>;\ntemplate struct vec<3, int8, highp>;\ntemplate struct vec<3, int16, highp>;\ntemplate struct vec<3, int32, highp>;\ntemplate struct vec<3, int64, highp>;\ntemplate struct vec<3, float32, highp>;\ntemplate struct vec<3, float64, highp>;\n\n// tvec4 type explicit instantiation\ntemplate struct vec<4, uint8, lowp>;\ntemplate struct vec<4, uint16, lowp>;\ntemplate struct vec<4, uint32, lowp>;\ntemplate struct vec<4, uint64, lowp>;\ntemplate struct vec<4, int8, lowp>;\ntemplate struct vec<4, int16, lowp>;\ntemplate struct vec<4, int32, lowp>;\ntemplate struct vec<4, int64, lowp>;\ntemplate struct vec<4, float32, lowp>;\ntemplate struct vec<4, float64, lowp>;\n\ntemplate struct vec<4, uint8, mediump>;\ntemplate struct vec<4, uint16, mediump>;\ntemplate struct vec<4, uint32, mediump>;\ntemplate struct vec<4, uint64, mediump>;\ntemplate struct vec<4, int8, mediump>;\ntemplate struct vec<4, int16, mediump>;\ntemplate struct vec<4, int32, mediump>;\ntemplate struct vec<4, int64, mediump>;\ntemplate struct vec<4, float32, mediump>;\ntemplate struct vec<4, float64, mediump>;\n\ntemplate struct vec<4, uint8, highp>;\ntemplate struct vec<4, uint16, highp>;\ntemplate struct vec<4, uint32, highp>;\ntemplate struct vec<4, uint64, highp>;\ntemplate struct vec<4, int8, highp>;\ntemplate struct vec<4, int16, highp>;\ntemplate struct vec<4, int32, highp>;\ntemplate struct vec<4, int64, highp>;\ntemplate struct vec<4, float32, highp>;\ntemplate struct vec<4, float64, highp>;\n\n// tmat2x2 type explicit instantiation\ntemplate struct mat<2, 2, float32, lowp>;\ntemplate struct mat<2, 2, float64, lowp>;\n\ntemplate struct mat<2, 2, float32, mediump>;\ntemplate struct mat<2, 2, float64, mediump>;\n\ntemplate struct mat<2, 2, float32, highp>;\ntemplate struct mat<2, 2, float64, highp>;\n\n// tmat2x3 type explicit instantiation\ntemplate struct mat<2, 3, float32, lowp>;\ntemplate struct mat<2, 3, float64, lowp>;\n\ntemplate struct mat<2, 3, float32, mediump>;\ntemplate struct mat<2, 3, float64, mediump>;\n\ntemplate struct mat<2, 3, float32, highp>;\ntemplate struct mat<2, 3, float64, highp>;\n\n// tmat2x4 type explicit instantiation\ntemplate struct mat<2, 4, float32, lowp>;\ntemplate struct mat<2, 4, float64, lowp>;\n\ntemplate struct mat<2, 4, float32, mediump>;\ntemplate struct mat<2, 4, float64, mediump>;\n\ntemplate struct mat<2, 4, float32, highp>;\ntemplate struct mat<2, 4, float64, highp>;\n\n// tmat3x2 type explicit instantiation\ntemplate struct mat<3, 2, float32, lowp>;\ntemplate struct mat<3, 2, float64, lowp>;\n\ntemplate struct mat<3, 2, float32, mediump>;\ntemplate struct mat<3, 2, float64, mediump>;\n\ntemplate struct mat<3, 2, float32, highp>;\ntemplate struct mat<3, 2, float64, highp>;\n\n// tmat3x3 type explicit instantiation\ntemplate struct mat<3, 3, float32, lowp>;\ntemplate struct mat<3, 3, float64, lowp>;\n\ntemplate struct mat<3, 3, float32, mediump>;\ntemplate struct mat<3, 3, float64, mediump>;\n\ntemplate struct mat<3, 3, float32, highp>;\ntemplate struct mat<3, 3, float64, highp>;\n\n// tmat3x4 type explicit instantiation\ntemplate struct mat<3, 4, float32, lowp>;\ntemplate struct mat<3, 4, float64, lowp>;\n\ntemplate struct mat<3, 4, float32, mediump>;\ntemplate struct mat<3, 4, float64, mediump>;\n\ntemplate struct mat<3, 4, float32, highp>;\ntemplate struct mat<3, 4, float64, highp>;\n\n// tmat4x2 type explicit instantiation\ntemplate struct mat<4, 2, float32, lowp>;\ntemplate struct mat<4, 2, float64, lowp>;\n\ntemplate struct mat<4, 2, float32, mediump>;\ntemplate struct mat<4, 2, float64, mediump>;\n\ntemplate struct mat<4, 2, float32, highp>;\ntemplate struct mat<4, 2, float64, highp>;\n\n// tmat4x3 type explicit instantiation\ntemplate struct mat<4, 3, float32, lowp>;\ntemplate struct mat<4, 3, float64, lowp>;\n\ntemplate struct mat<4, 3, float32, mediump>;\ntemplate struct mat<4, 3, float64, mediump>;\n\ntemplate struct mat<4, 3, float32, highp>;\ntemplate struct mat<4, 3, float64, highp>;\n\n// tmat4x4 type explicit instantiation\ntemplate struct mat<4, 4, float32, lowp>;\ntemplate struct mat<4, 4, float64, lowp>;\n\ntemplate struct mat<4, 4, float32, mediump>;\ntemplate struct mat<4, 4, float64, mediump>;\n\ntemplate struct mat<4, 4, float32, highp>;\ntemplate struct mat<4, 4, float64, highp>;\n\n// tquat type explicit instantiation\ntemplate struct qua;\ntemplate struct qua;\n\ntemplate struct qua;\ntemplate struct qua;\n\ntemplate struct qua;\ntemplate struct qua;\n\n//tdualquat type explicit instantiation\ntemplate struct tdualquat;\ntemplate struct tdualquat;\n\ntemplate struct tdualquat;\ntemplate struct tdualquat;\n\ntemplate struct tdualquat;\ntemplate struct tdualquat;\n\n}//namespace glm\n\n"}, {"path": "includes/glm/detail/qualifier.hpp", "language": "code", "loc": 180, "comment_density": 0.078, "code": "#pragma once\n\n#include \"setup.hpp\"\n\nnamespace glm\n{\n\t/// Qualify GLM types in term of alignment (packed, aligned) and precision in term of ULPs (lowp, mediump, highp)\n\tenum qualifier\n\t{\n\t\tpacked_highp, ///< Typed data is tightly packed in memory and operations are executed with high precision in term of ULPs\n\t\tpacked_mediump, ///< Typed data is tightly packed in memory and operations are executed with medium precision in term of ULPs for higher performance\n\t\tpacked_lowp, ///< Typed data is tightly packed in memory and operations are executed with low precision in term of ULPs to maximize performance\n\n#\t\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n\t\t\taligned_highp, ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs\n\t\t\taligned_mediump, ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs for higher performance\n\t\t\taligned_lowp, // ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs to maximize performance\n\t\t\taligned = aligned_highp, ///< By default aligned qualifier is also high precision\n#\t\tendif\n\n\t\thighp = packed_highp, ///< By default highp qualifier is also packed\n\t\tmediump = packed_mediump, ///< By default mediump qualifier is also packed\n\t\tlowp = packed_lowp, ///< By default lowp qualifier is also packed\n\t\tpacked = packed_highp, ///< By default packed qualifier is also high precision\n\n#\t\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE && defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES)\n\t\t\tdefaultp = aligned_highp\n#\t\telse\n\t\t\tdefaultp = highp\n#\t\tendif\n\t};\n\n\ttypedef qualifier precision;\n\n\ttemplate struct vec;\n\ttemplate struct mat;\n\ttemplate struct qua;\n\n#\tif GLM_HAS_TEMPLATE_ALIASES\n\t\ttemplate using tvec1 = vec<1, T, Q>;\n\t\ttemplate using tvec2 = vec<2, T, Q>;\n\t\ttemplate using tvec3 = vec<3, T, Q>;\n\t\ttemplate using tvec4 = vec<4, T, Q>;\n\t\ttemplate using tmat2x2 = mat<2, 2, T, Q>;\n\t\ttemplate using tmat2x3 = mat<2, 3, T, Q>;\n\t\ttemplate using tmat2x4 = mat<2, 4, T, Q>;\n\t\ttemplate using tmat3x2 = mat<3, 2, T, Q>;\n\t\ttemplate using tmat3x3 = mat<3, 3, T, Q>;\n\t\ttemplate using tmat3x4 = mat<3, 4, T, Q>;\n\t\ttemplate using tmat4x2 = mat<4, 2, T, Q>;\n\t\ttemplate using tmat4x3 = mat<4, 3, T, Q>;\n\t\ttemplate using tmat4x4 = mat<4, 4, T, Q>;\n\t\ttemplate using tquat = qua;\n#\tendif\n\nnamespace detail\n{\n\ttemplate\n\tstruct is_aligned\n\t{\n\t\tstatic const bool value = false;\n\t};\n\n#\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n\t\ttemplate<>\n\t\tstruct is_aligned\n\t\t{\n\t\t\tstatic const bool value = true;\n\t\t};\n\n\t\ttemplate<>\n\t\tstruct is_aligned\n\t\t{\n\t\t\tstatic const bool value = true;\n\t\t};\n\n\t\ttemplate<>\n\t\tstruct is_aligned\n\t\t{\n\t\t\tstatic const bool value = true;\n\t\t};\n#\tendif\n\n\ttemplate\n\tstruct storage\n\t{\n\t\ttypedef struct type {\n\t\t\tT data[L];\n\t\t} type;\n\t};\n\n#\tif GLM_HAS_ALIGNOF\n\t\ttemplate\n\t\tstruct storage\n\t\t{\n\t\t\ttypedef struct alignas(L * sizeof(T)) type {\n\t\t\t\tT data[L];\n\t\t\t} type;\n\t\t};\n\n\t\ttemplate\n\t\tstruct storage<3, T, true>\n\t\t{\n\t\t\ttypedef struct alignas(4 * sizeof(T)) type {\n\t\t\t\tT data[4];\n\t\t\t} type;\n\t\t};\n#\tendif\n\n#\tif GLM_ARCH & GLM_ARCH_SSE2_BIT\n\ttemplate<>\n\tstruct storage<4, float, true>\n\t{\n\t\ttypedef glm_f32vec4 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<4, int, true>\n\t{\n\t\ttypedef glm_i32vec4 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<4, unsigned int, true>\n\t{\n\t\ttypedef glm_u32vec4 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<2, double, true>\n\t{\n\t\ttypedef glm_f64vec2 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<2, detail::int64, true>\n\t{\n\t\ttypedef glm_i64vec2 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<2, detail::uint64, true>\n\t{\n\t\ttypedef glm_u64vec2 type;\n\t};\n#\tendif\n\n#\tif (GLM_ARCH & GLM_ARCH_AVX_BIT)\n\ttemplate<>\n\tstruct storage<4, double, true>\n\t{\n\t\ttypedef glm_f64vec4 type;\n\t};\n#\tendif\n\n#\tif (GLM_ARCH & GLM_ARCH_AVX2_BIT)\n\ttemplate<>\n\tstruct storage<4, detail::int64, true>\n\t{\n\t\ttypedef glm_i64vec4 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<4, detail::uint64, true>\n\t{\n\t\ttypedef glm_u64vec4 type;\n\t};\n#\tendif\n\n\tenum genTypeEnum\n\t{\n\t\tGENTYPE_VEC,\n\t\tGENTYPE_MAT,\n\t\tGENTYPE_QUAT\n\t};\n\n\ttemplate \n\tstruct genTypeTrait\n\t{};\n\n\ttemplate \n\tstruct genTypeTrait >\n\t{\n\t\tstatic const genTypeEnum GENTYPE = GENTYPE_MAT;\n\t};\n\n\ttemplate\n\tstruct init_gentype\n\t{\n\t};\n\n\ttemplate\n\tstruct init_gentype\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static genType identity()\n\t\t{\n\t\t\treturn genType(1, 0, 0, 0);\n\t\t}\n\t};\n\n\ttemplate\n\tstruct init_gentype\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static genType identity()\n\t\t{\n\t\t\treturn genType(1);\n\t\t}\n\t};\n}//namespace detail\n}//namespace glm\n"}, {"path": "includes/glm/detail/setup.hpp", "language": "code", "loc": 913, "comment_density": 0.136, "code": "#ifndef GLM_SETUP_INCLUDED\n\n#include \n#include \n\n#define GLM_VERSION_MAJOR\t\t\t0\n#define GLM_VERSION_MINOR\t\t\t9\n#define GLM_VERSION_PATCH\t\t\t9\n#define GLM_VERSION_REVISION\t\t3\n#define GLM_VERSION\t\t\t\t\t993\n#define GLM_VERSION_MESSAGE\t\t\t\"GLM: version 0.9.9.3\"\n\n#define GLM_SETUP_INCLUDED\t\t\tGLM_VERSION\n\n///////////////////////////////////////////////////////////////////////////////////\n// Active states\n\n#define GLM_DISABLE\t\t0\n#define GLM_ENABLE\t\t1\n\n///////////////////////////////////////////////////////////////////////////////////\n// Messages\n\n#if defined(GLM_FORCE_MESSAGES)\n#\tdefine GLM_MESSAGES GLM_ENABLE\n#else\n#\tdefine GLM_MESSAGES GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Detect the platform\n\n#include \"../simd/platform.h\"\n\n///////////////////////////////////////////////////////////////////////////////////\n// Build model\n\n#if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)\n#\tdefine GLM_MODEL\tGLM_MODEL_64\n#elif defined(__i386__) || defined(__ppc__)\n#\tdefine GLM_MODEL\tGLM_MODEL_32\n#else\n#\tdefine GLM_MODEL\tGLM_MODEL_32\n#endif//\n\n#if !defined(GLM_MODEL) && GLM_COMPILER != 0\n#\terror \"GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message.\"\n#endif//GLM_MODEL\n\n///////////////////////////////////////////////////////////////////////////////////\n// C++ Version\n\n// User defines: GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_FORCE_CXX11, GLM_FORCE_CXX14, GLM_FORCE_CXX17, GLM_FORCE_CXX2A\n\n#define GLM_LANG_CXX98_FLAG\t\t\t(1 << 1)\n#define GLM_LANG_CXX03_FLAG\t\t\t(1 << 2)\n#define GLM_LANG_CXX0X_FLAG\t\t\t(1 << 3)\n#define GLM_LANG_CXX11_FLAG\t\t\t(1 << 4)\n#define GLM_LANG_CXX14_FLAG\t\t\t(1 << 5)\n#define GLM_LANG_CXX17_FLAG\t\t\t(1 << 6)\n#define GLM_LANG_CXX2A_FLAG\t\t\t(1 << 7)\n#define GLM_LANG_CXXMS_FLAG\t\t\t(1 << 8)\n#define GLM_LANG_CXXGNU_FLAG\t\t(1 << 9)\n\n#define GLM_LANG_CXX98\t\t\tGLM_LANG_CXX98_FLAG\n#define GLM_LANG_CXX03\t\t\t(GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)\n#define GLM_LANG_CXX0X\t\t\t(GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)\n#define GLM_LANG_CXX11\t\t\t(GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)\n#define GLM_LANG_CXX14\t\t\t(GLM_LANG_CXX11 | GLM_LANG_CXX14_FLAG)\n#define GLM_LANG_CXX17\t\t\t(GLM_LANG_CXX14 | GLM_LANG_CXX17_FLAG)\n#define GLM_LANG_CXX2A\t\t\t(GLM_LANG_CXX17 | GLM_LANG_CXX2A_FLAG)\n#define GLM_LANG_CXXMS\t\t\tGLM_LANG_CXXMS_FLAG\n#define GLM_LANG_CXXGNU\t\t\tGLM_LANG_CXXGNU_FLAG\n\n#if (defined(_MSC_EXTENSIONS))\n#\tdefine GLM_LANG_EXT GLM_LANG_CXXMS_FLAG\n#elif ((GLM_COMPILER & (GLM_COMPILER_CLANG | GLM_COMPILER_GCC)) && (GLM_ARCH & GLM_ARCH_SIMD_BIT))\n#\tdefine GLM_LANG_EXT GLM_LANG_CXXMS_FLAG\n#else\n#\tdefine GLM_LANG_EXT 0\n#endif\n\n#if (defined(GLM_FORCE_CXX_UNKNOWN))\n#\tdefine GLM_LANG 0\n#elif defined(GLM_FORCE_CXX2A)\n#\tdefine GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT)\n#\tdefine GLM_LANG_STL11_FORCED\n#elif defined(GLM_FORCE_CXX17)\n#\tdefine GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT)\n#\tdefine GLM_LANG_STL11_FORCED\n#elif defined(GLM_FORCE_CXX14)\n#\tdefine GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT)\n#\tdefine GLM_LANG_STL11_FORCED\n#elif defined(GLM_FORCE_CXX11)\n#\tdefine GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT)\n#\tdefine GLM_LANG_STL11_FORCED\n#elif defined(GLM_FORCE_CXX03)\n#\tdefine GLM_LANG (GLM_LANG_CXX03 | GLM_LANG_EXT)\n#elif defined(GLM_FORCE_CXX98)\n#\tdefine GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_EXT)\n#else\n#\tif GLM_COMPILER & GLM_COMPILER_VC && defined(_MSVC_LANG)\n#\t\tif GLM_COMPILER >= GLM_COMPILER_VC15_7\n#\t\t\tdefine GLM_LANG_PLATFORM _MSVC_LANG\n#\t\telif GLM_COMPILER >= GLM_COMPILER_VC15\n#\t\t\tif _MSVC_LANG > 201402L\n#\t\t\t\tdefine GLM_LANG_PLATFORM 201402L\n#\t\t\telse\n#\t\t\t\tdefine GLM_LANG_PLATFORM _MSVC_LANG\n#\t\t\tendif\n#\t\telse\n#\t\t\tdefine GLM_LANG_PLATFORM 0\n#\t\tendif\n#\telse\n#\t\tdefine GLM_LANG_PLATFORM 0\n#\tendif\n\n#\tif __cplusplus > 201703L || GLM_LANG_PLATFORM > 201703L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT)\n#\telif __cplusplus == 201703L || GLM_LANG_PLATFORM == 201703L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT)\n#\telif __cplusplus == 201402L || GLM_LANG_PLATFORM == 201402L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT)\n#\telif __cplusplus == 201103L || GLM_LANG_PLATFORM == 201103L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT)\n#\telif defined(__INTEL_CXX11_MODE__) || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)\n#\t\tdefine GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_EXT)\n#\telif __cplusplus == 199711L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_EXT)\n#\telse\n#\t\tdefine GLM_LANG (0 | GLM_LANG_EXT)\n#\tendif\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Has of C++ features\n\n// http://clang.llvm.org/cxx_status.html\n// http://gcc.gnu.org/projects/cxx0x.html\n// http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx\n\n// Android has multiple STLs but C++11 STL detection doesn't always work #284 #564\n#if GLM_PLATFORM == GLM_PLATFORM_ANDROID && !defined(GLM_LANG_STL11_FORCED)\n#\tdefine GLM_HAS_CXX11_STL 0\n#elif GLM_COMPILER & GLM_COMPILER_CLANG\n#\tif (defined(_LIBCPP_VERSION) && GLM_LANG & GLM_LANG_CXX11_FLAG) || defined(GLM_LANG_STL11_FORCED)\n#\t\tdefine GLM_HAS_CXX11_STL 1\n#\telse\n#\t\tdefine GLM_HAS_CXX11_STL 0\n#\tendif\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_CXX11_STL 1\n#else\n#\tdefine GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))))\n#endif\n\n// N1720\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_STATIC_ASSERT 1\n#else\n#\tdefine GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC))))\n#endif\n\n// N1988\n#if GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_EXTENDED_INTEGER_TYPE 1\n#else\n#\tdefine GLM_HAS_EXTENDED_INTEGER_TYPE (\\\n\t\t((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC)) || \\\n\t\t((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \\\n\t\t((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG)))\n#endif\n\n// N2672 Initializer lists http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_INITIALIZER_LISTS 1\n#else\n#\tdefine GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75))))\n#endif\n\n// N2544 Unrestricted unions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_UNRESTRICTED_UNIONS 1\n#else\n#\tdefine GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t(GLM_COMPILER & GLM_COMPILER_VC) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75)))\n#endif\n\n// N2346\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_DEFAULTED_FUNCTIONS 1\n#else\n#\tdefine GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL)) || \\\n\t\t(GLM_COMPILER & GLM_COMPILER_CUDA)))\n#endif\n\n// N2118\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_RVALUE_REFERENCES 1\n#else\n#\tdefine GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n// N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1\n#else\n#\tdefine GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n// N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_TEMPLATE_ALIASES 1\n#else\n#\tdefine GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n// N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_RANGE_FOR 1\n#else\n#\tdefine GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n// N2341 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_ALIGNOF __has_feature(cxx_alignas)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_ALIGNOF 1\n#else\n#\tdefine GLM_HAS_ALIGNOF ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA70))))\n#endif\n\n// N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf\n// N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html\n#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) // Compiler SIMD intrinsics don't support constexpr...\n#\tdefine GLM_HAS_CONSTEXPR 0\n#elif (GLM_COMPILER & GLM_COMPILER_CLANG)\n#\tdefine GLM_HAS_CONSTEXPR __has_feature(cxx_relaxed_constexpr)\n#elif (GLM_LANG & GLM_LANG_CXX14_FLAG)\n#\tdefine GLM_HAS_CONSTEXPR 1\n#else\n#\tdefine GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && GLM_HAS_INITIALIZER_LISTS && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL17)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC6)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15))))\n#endif\n\n#if GLM_HAS_CONSTEXPR\n#\tdefine GLM_CONSTEXPR constexpr\n#else\n#\tdefine GLM_CONSTEXPR\n#endif\n\n//\n#if GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_ASSIGNABLE 1\n#else\n#\tdefine GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))))\n#endif\n\n//\n#define GLM_HAS_TRIVIAL_QUERIES 0\n\n//\n#if GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_MAKE_SIGNED 1\n#else\n#\tdefine GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n//\n#if defined(GLM_FORCE_PURE)\n#\tdefine GLM_HAS_BITSCAN_WINDOWS 0\n#else\n#\tdefine GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT))))\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// OpenMP\n#ifdef _OPENMP\n#\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\tif GLM_COMPILER >= GLM_COMPILER_GCC61\n#\t\t\tdefine GLM_HAS_OPENMP 45\n#\t\telif GLM_COMPILER >= GLM_COMPILER_GCC49\n#\t\t\tdefine GLM_HAS_OPENMP 40\n#\t\telif GLM_COMPILER >= GLM_COMPILER_GCC47\n#\t\t\tdefine GLM_HAS_OPENMP 31\n#\t\telse\n#\t\t\tdefine GLM_HAS_OPENMP 0\n#\t\tendif\n#\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\tif GLM_COMPILER >= GLM_COMPILER_CLANG38\n#\t\t\tdefine GLM_HAS_OPENMP 31\n#\t\telse\n#\t\t\tdefine GLM_HAS_OPENMP 0\n#\t\tendif\n#\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tdefine GLM_HAS_OPENMP 20\n#\telif GLM_COMPILER & GLM_COMPILER_INTEL\n#\t\tif GLM_COMPILER >= GLM_COMPILER_INTEL16\n#\t\t\tdefine GLM_HAS_OPENMP 40\n#\t\telse\n#\t\t\tdefine GLM_HAS_OPENMP 0\n#\t\tendif\n#\telse\n#\t\tdefine GLM_HAS_OPENMP 0\n#\tendif\n#else\n#\tdefine GLM_HAS_OPENMP 0\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// nullptr\n\n#if GLM_LANG & GLM_LANG_CXX0X_FLAG\n#\tdefine GLM_CONFIG_NULLPTR GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_NULLPTR GLM_DISABLE\n#endif\n\n#if GLM_CONFIG_NULLPTR == GLM_ENABLE\n#\tdefine GLM_NULLPTR nullptr\n#else\n#\tdefine GLM_NULLPTR 0\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Static assert\n\n#if GLM_HAS_STATIC_ASSERT\n#\tdefine GLM_STATIC_ASSERT(x, message) static_assert(x, message)\n#elif GLM_COMPILER & GLM_COMPILER_VC\n#\tdefine GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]\n#else\n#\tdefine GLM_STATIC_ASSERT(x, message) assert(x)\n#endif//GLM_LANG\n\n///////////////////////////////////////////////////////////////////////////////////\n// Qualifiers\n\n#if GLM_COMPILER & GLM_COMPILER_CUDA\n#\tdefine GLM_CUDA_FUNC_DEF __device__ __host__\n#\tdefine GLM_CUDA_FUNC_DECL __device__ __host__\n#else\n#\tdefine GLM_CUDA_FUNC_DEF\n#\tdefine GLM_CUDA_FUNC_DECL\n#endif\n\n#if defined(GLM_FORCE_INLINE)\n#\tif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tdefine GLM_INLINE __forceinline\n#\t\tdefine GLM_NEVER_INLINE __declspec((noinline))\n#\telif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)\n#\t\tdefine GLM_INLINE inline __attribute__((__always_inline__))\n#\t\tdefine GLM_NEVER_INLINE __attribute__((__noinline__))\n#\telif GLM_COMPILER & GLM_COMPILER_CUDA\n#\t\tdefine GLM_INLINE __forceinline__\n#\t\tdefine GLM_NEVER_INLINE __noinline__\n#\telse\n#\t\tdefine GLM_INLINE inline\n#\t\tdefine GLM_NEVER_INLINE\n#\tendif//GLM_COMPILER\n#else\n#\tdefine GLM_INLINE inline\n#\tdefine GLM_NEVER_INLINE\n#endif//defined(GLM_FORCE_INLINE)\n\n#define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL\n#define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE\n\n///////////////////////////////////////////////////////////////////////////////////\n// Swizzle operators\n\n// User defines: GLM_FORCE_SWIZZLE\n\n#define GLM_SWIZZLE_DISABLED\t\t0\n#define GLM_SWIZZLE_OPERATOR\t\t1\n#define GLM_SWIZZLE_FUNCTION\t\t2\n\n#if defined(GLM_FORCE_XYZW_ONLY)\n#\tundef GLM_FORCE_SWIZZLE\n#endif\n\n#if defined(GLM_SWIZZLE)\n#\tpragma message(\"GLM: GLM_SWIZZLE is deprecated, use GLM_FORCE_SWIZZLE instead.\")\n#\tdefine GLM_FORCE_SWIZZLE\n#endif\n\n#if defined(GLM_FORCE_SWIZZLE) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)\n#\tdefine GLM_CONFIG_SWIZZLE GLM_SWIZZLE_OPERATOR\n#elif defined(GLM_FORCE_SWIZZLE)\n#\tdefine GLM_CONFIG_SWIZZLE GLM_SWIZZLE_FUNCTION\n#else\n#\tdefine GLM_CONFIG_SWIZZLE GLM_SWIZZLE_DISABLED\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Allows using not basic types as genType\n\n// #define GLM_FORCE_UNRESTRICTED_GENTYPE\n\n#ifdef GLM_FORCE_UNRESTRICTED_GENTYPE\n#\tdefine GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Clip control, define GLM_FORCE_DEPTH_ZERO_TO_ONE before including GLM\n// to use a clip space between 0 to 1.\n// Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM\n// to use left handed coordinate system by default.\n\n#define GLM_CLIP_CONTROL_ZO_BIT\t\t(1 << 0) // ZERO_TO_ONE\n#define GLM_CLIP_CONTROL_NO_BIT\t\t(1 << 1) // NEGATIVE_ONE_TO_ONE\n#define GLM_CLIP_CONTROL_LH_BIT\t\t(1 << 2) // LEFT_HANDED, For DirectX, Metal, Vulkan\n#define GLM_CLIP_CONTROL_RH_BIT\t\t(1 << 3) // RIGHT_HANDED, For OpenGL, default in GLM\n\n#define GLM_CLIP_CONTROL_LH_ZO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_ZO_BIT)\n#define GLM_CLIP_CONTROL_LH_NO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_NO_BIT)\n#define GLM_CLIP_CONTROL_RH_ZO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_ZO_BIT)\n#define GLM_CLIP_CONTROL_RH_NO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_NO_BIT)\n\n#ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE\n#\tifdef GLM_FORCE_LEFT_HANDED\n#\t\tdefine GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_ZO\n#\telse\n#\t\tdefine GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_ZO\n#\tendif\n#else\n#\tifdef GLM_FORCE_LEFT_HANDED\n#\t\tdefine GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_NO\n#\telse\n#\t\tdefine GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_NO\n#\tendif\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Qualifiers\n\n#if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))\n#\tdefine GLM_DEPRECATED __declspec(deprecated)\n#\tdefine GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name\n#elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL)\n#\tdefine GLM_DEPRECATED __attribute__((__deprecated__))\n#\tdefine GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))\n#elif GLM_COMPILER & GLM_COMPILER_CUDA\n#\tdefine GLM_DEPRECATED\n#\tdefine GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x)\n#else\n#\tdefine GLM_DEPRECATED\n#\tdefine GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n\n#ifdef GLM_FORCE_EXPLICIT_CTOR\n#\tdefine GLM_EXPLICIT explicit\n#else\n#\tdefine GLM_EXPLICIT\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Length type: all length functions returns a length_t type.\n// When GLM_FORCE_SIZE_T_LENGTH is defined, length_t is a typedef of size_t otherwise\n// length_t is a typedef of int like GLSL defines it.\n\n#define GLM_LENGTH_INT\t\t1\n#define GLM_LENGTH_SIZE_T\t2\n\n#ifdef GLM_FORCE_SIZE_T_LENGTH\n#\tdefine GLM_CONFIG_LENGTH_TYPE\t\tGLM_LENGTH_SIZE_T\n#else\n#\tdefine GLM_CONFIG_LENGTH_TYPE\t\tGLM_LENGTH_INT\n#endif\n\nnamespace glm\n{\n\tusing std::size_t;\n#\tif GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T\n\t\ttypedef size_t length_t;\n#\telse\n\t\ttypedef int length_t;\n#\tendif\n}//namespace glm\n\n///////////////////////////////////////////////////////////////////////////////////\n// constexpr\n\n#if GLM_HAS_CONSTEXPR\n#\tdefine GLM_CONFIG_CONSTEXP GLM_ENABLE\n\n\tnamespace glm\n\t{\n\t\ttemplate\n\t\tconstexpr std::size_t countof(T const (&)[N])\n\t\t{\n\t\t\treturn N;\n\t\t}\n\t}//namespace glm\n#\tdefine GLM_COUNTOF(arr) glm::countof(arr)\n#elif defined(_MSC_VER)\n#\tdefine GLM_CONFIG_CONSTEXP GLM_DISABLE\n\n#\tdefine GLM_COUNTOF(arr) _countof(arr)\n#else\n#\tdefine GLM_CONFIG_CONSTEXP GLM_DISABLE\n\n#\tdefine GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// uint\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate\n\tstruct is_int\n\t{\n\t\tenum test {value = 0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n}//namespace detail\n\n\ttypedef unsigned int\tuint;\n}//namespace glm\n\n///////////////////////////////////////////////////////////////////////////////////\n// 64-bit int\n\n#if GLM_HAS_EXTENDED_INTEGER_TYPE\n#\tinclude \n#endif\n\nnamespace glm{\nnamespace detail\n{\n#\tif GLM_HAS_EXTENDED_INTEGER_TYPE\n\t\ttypedef std::uint64_t\t\t\t\t\t\tuint64;\n\t\ttypedef std::int64_t\t\t\t\t\t\tint64;\n#\telif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available\n\t\ttypedef uint64_t\t\t\t\t\t\t\tuint64;\n\t\ttypedef int64_t\t\t\t\t\t\t\t\tint64;\n#\telif GLM_COMPILER & GLM_COMPILER_VC\n\t\ttypedef unsigned __int64\t\t\t\t\tuint64;\n\t\ttypedef signed __int64\t\t\t\t\t\tint64;\n#\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\tpragma GCC diagnostic ignored \"-Wlong-long\"\n\t\t__extension__ typedef unsigned long long\tuint64;\n\t\t__extension__ typedef signed long long\t\tint64;\n#\telif (GLM_COMPILER & GLM_COMPILER_CLANG)\n#\t\tpragma clang diagnostic ignored \"-Wc++11-long-long\"\n\t\ttypedef unsigned long long\t\t\t\t\tuint64;\n\t\ttypedef signed long long\t\t\t\t\tint64;\n#\telse//unknown compiler\n\t\ttypedef unsigned long long\t\t\t\t\tuint64;\n\t\ttypedef signed long long\t\t\t\t\tint64;\n#\tendif\n}//namespace detail\n}//namespace glm\n\n///////////////////////////////////////////////////////////////////////////////////\n// make_unsigned\n\n#if GLM_HAS_MAKE_SIGNED\n#\tinclude \n\nnamespace glm{\nnamespace detail\n{\n\tusing std::make_unsigned;\n}//namespace detail\n}//namespace glm\n\n#else\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate\n\tstruct make_unsigned\n\t{};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned char type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned short type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned int type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned long type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef uint64 type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned char type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned short type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned int type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned long type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef uint64 type;\n\t};\n}//namespace detail\n}//namespace glm\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Only use x, y, z, w as vector type components\n\n#ifdef GLM_FORCE_XYZW_ONLY\n#\tdefine GLM_CONFIG_XYZW_ONLY GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_XYZW_ONLY GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Configure the use of defaulted initialized types\n\n#define GLM_CTOR_INIT_DISABLE\t\t0\n#define GLM_CTOR_INITIALIZER_LIST\t1\n#define GLM_CTOR_INITIALISATION\t\t2\n\n#if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS\n#\tdefine GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALIZER_LIST\n#elif defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS\n#\tdefine GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALISATION\n#else\n#\tdefine GLM_CONFIG_CTOR_INIT GLM_CTOR_INIT_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Use SIMD instruction sets\n\n#if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)\n#\tdefine GLM_CONFIG_SIMD GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_SIMD GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Configure the use of defaulted function\n\n#if GLM_HAS_DEFAULTED_FUNCTIONS && GLM_CONFIG_CTOR_INIT == GLM_CTOR_INIT_DISABLE\n#\tdefine GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_ENABLE\n#\tdefine GLM_DEFAULT = default\n#else\n#\tdefine GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_DISABLE\n#\tdefine GLM_DEFAULT\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Configure the use of aligned gentypes\n\n#ifdef GLM_FORCE_ALIGNED // Legacy define\n#\tdefine GLM_FORCE_DEFAULT_ALIGNED_GENTYPES\n#endif\n\n#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES\n#\tdefine GLM_FORCE_ALIGNED_GENTYPES\n#endif\n\n#if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (defined(GLM_FORCE_ALIGNED_GENTYPES) || (GLM_CONFIG_SIMD == GLM_ENABLE))\n#\tdefine GLM_CONFIG_ALIGNED_GENTYPES GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_ALIGNED_GENTYPES GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Configure the use of anonymous structure as implementation detail\n\n#if ((GLM_CONFIG_SIMD == GLM_ENABLE) || (GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR) || (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE))\n#\tdefine GLM_CONFIG_ANONYMOUS_STRUCT GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_ANONYMOUS_STRUCT GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Silent warnings\n\n#ifdef GLM_FORCE_SILENT_WARNINGS\n#\tdefine GLM_SILENT_WARNINGS GLM_ENABLE\n#else\n#\tdefine GLM_SILENT_WARNINGS GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Precision\n\n#define GLM_HIGHP\t\t1\n#define GLM_MEDIUMP\t\t2\n#define GLM_LOWP\t\t3\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_BOOL) || defined(GLM_PRECISION_HIGHP_BOOL)\n#\tdefine GLM_CONFIG_PRECISION_BOOL\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_BOOL) || defined(GLM_PRECISION_MEDIUMP_BOOL)\n#\tdefine GLM_CONFIG_PRECISION_BOOL\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_BOOL) || defined(GLM_PRECISION_LOWP_BOOL)\n#\tdefine GLM_CONFIG_PRECISION_BOOL\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_BOOL\t\tGLM_HIGHP\n#endif\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_INT) || defined(GLM_PRECISION_HIGHP_INT)\n#\tdefine GLM_CONFIG_PRECISION_INT\t\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_INT) || defined(GLM_PRECISION_MEDIUMP_INT)\n#\tdefine GLM_CONFIG_PRECISION_INT\t\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_INT) || defined(GLM_PRECISION_LOWP_INT)\n#\tdefine GLM_CONFIG_PRECISION_INT\t\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_INT\t\t\tGLM_HIGHP\n#endif\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_UINT) || defined(GLM_PRECISION_HIGHP_UINT)\n#\tdefine GLM_CONFIG_PRECISION_UINT\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_UINT) || defined(GLM_PRECISION_MEDIUMP_UINT)\n#\tdefine GLM_CONFIG_PRECISION_UINT\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_UINT) || defined(GLM_PRECISION_LOWP_UINT)\n#\tdefine GLM_CONFIG_PRECISION_UINT\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_UINT\t\tGLM_HIGHP\n#endif\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_FLOAT) || defined(GLM_PRECISION_HIGHP_FLOAT)\n#\tdefine GLM_CONFIG_PRECISION_FLOAT\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_FLOAT) || defined(GLM_PRECISION_MEDIUMP_FLOAT)\n#\tdefine GLM_CONFIG_PRECISION_FLOAT\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_FLOAT) || defined(GLM_PRECISION_LOWP_FLOAT)\n#\tdefine GLM_CONFIG_PRECISION_FLOAT\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_FLOAT\t\tGLM_HIGHP\n#endif\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_DOUBLE) || defined(GLM_PRECISION_HIGHP_DOUBLE)\n#\tdefine GLM_CONFIG_PRECISION_DOUBLE\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_DOUBLE) || defined(GLM_PRECISION_MEDIUMP_DOUBLE)\n#\tdefine GLM_CONFIG_PRECISION_DOUBLE\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_DOUBLE) || defined(GLM_PRECISION_LOWP_DOUBLE)\n#\tdefine GLM_CONFIG_PRECISION_DOUBLE\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_DOUBLE\t\tGLM_HIGHP\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Check inclusions of different versions of GLM\n\n#elif ((GLM_SETUP_INCLUDED != GLM_VERSION) && !defined(GLM_FORCE_IGNORE_VERSION))\n#\terror \"GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error.\"\n#elif GLM_SETUP_INCLUDED == GLM_VERSION\n\n///////////////////////////////////////////////////////////////////////////////////\n// Messages\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_DISPLAYED)\n#\tdefine GLM_MESSAGE_DISPLAYED\n#\t\tdefine GLM_STR_HELPER(x) #x\n#\t\tdefine GLM_STR(x) GLM_STR_HELPER(x)\n\n\t// Report GLM version\n#\t\tpragma message (GLM_STR(GLM_VERSION_MESSAGE))\n\n\t// Report C++ language\n#\tif (GLM_LANG & GLM_LANG_CXX2A_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 2A with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX2A_FLAG)\n#\t\tpragma message(\"GLM: C++ 2A\")\n#\telif (GLM_LANG & GLM_LANG_CXX17_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 17 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX17_FLAG)\n#\t\tpragma message(\"GLM: C++ 17\")\n#\telif (GLM_LANG & GLM_LANG_CXX14_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 14 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX14_FLAG)\n#\t\tpragma message(\"GLM: C++ 14\")\n#\telif (GLM_LANG & GLM_LANG_CXX11_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 11 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX11_FLAG)\n#\t\tpragma message(\"GLM: C++ 11\")\n#\telif (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 0x with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX0X_FLAG)\n#\t\tpragma message(\"GLM: C++ 0x\")\n#\telif (GLM_LANG & GLM_LANG_CXX03_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 03 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX03_FLAG)\n#\t\tpragma message(\"GLM: C++ 03\")\n#\telif (GLM_LANG & GLM_LANG_CXX98_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 98 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX98_FLAG)\n#\t\tpragma message(\"GLM: C++ 98\")\n#\telse\n#\t\tpragma message(\"GLM: C++ language undetected\")\n#\tendif//GLM_LANG\n\n\t// Report compiler detection\n#\tif GLM_COMPILER & GLM_COMPILER_CUDA\n#\t\tpragma message(\"GLM: CUDA compiler detected\")\n#\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tpragma message(\"GLM: Visual C++ compiler detected\")\n#\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\tpragma message(\"GLM: Clang compiler detected\")\n#\telif GLM_COMPILER & GLM_COMPILER_INTEL\n#\t\tpragma message(\"GLM: Intel Compiler detected\")\n#\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\tpragma message(\"GLM: GCC compiler detected\")\n#\telse\n#\t\tpragma message(\"GLM: Compiler not detected\")\n#\tendif\n\n\t// Report build target\n#\tif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with AVX2 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with AVX2 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with AVX instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with AVX instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSE4.2 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSE4.2 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSE4.1 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSE4.1 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSSE3 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSSE3 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSE3 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSE3 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSE2 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSE2 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits build target\")\n#\telif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: ARM 64 bits with Neon instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: ARM 32 bits with Neon instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: ARM 64 bits build target\")\n#\telif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: ARM 32 bits build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: MIPS 64 bits build target\")\n#\telif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: MIPS 32 bits build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: PowerPC 64 bits build target\")\n#\telif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: PowerPC 32 bits build target\")\n#\telse\n#\t\tpragma message(\"GLM: Unknown build target\")\n#\tendif//GLM_ARCH\n\n\t// Report platform name\n#\tif(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)\n#\t\tpragma message(\"GLM: QNX platform detected\")\n//#\telif(GLM_PLATFORM & GLM_PLATFORM_IOS)\n//#\t\tpragma message(\"GLM: iOS platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_APPLE)\n#\t\tpragma message(\"GLM: Apple platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_WINCE)\n#\t\tpragma message(\"GLM: WinCE platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)\n#\t\tpragma message(\"GLM: Windows platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)\n#\t\tpragma message(\"GLM: Native Client detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)\n#\t\tpragma message(\"GLM: Android platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_LINUX)\n#\t\tpragma message(\"GLM: Linux platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_UNIX)\n#\t\tpragma message(\"GLM: UNIX platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)\n#\t\tpragma message(\"GLM: platform unknown\")\n#\telse\n#\t\tpragma message(\"GLM: platform not detected\")\n#\tendif\n\n\t// Report whether only xyzw component are used\n#\tif defined GLM_FORCE_XYZW_ONLY\n#\t\tpragma message(\"GLM: GLM_FORCE_XYZW_ONLY is defined. Only x, y, z and w component are available in vector type. This define disables swizzle operators and SIMD instruction sets.\")\n#\tendif\n\n\t// Report swizzle operator support\n#\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\t\tpragma message(\"GLM: GLM_FORCE_SWIZZLE is defined, swizzling operators enabled.\")\n#\telif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\t\tpragma message(\"GLM: GLM_FORCE_SWIZZLE is defined, swizzling functions enabled. Enable compiler C++ language extensions to enable swizzle operators.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_SWIZZLE is undefined. swizzling functions or operators are disabled.\")\n#\tendif\n\n\t// Report .length() type\n#\tif GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T\n#\t\tpragma message(\"GLM: GLM_FORCE_SIZE_T_LENGTH is defined. .length() returns a glm::length_t, a typedef of std::size_t.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_SIZE_T_LENGTH is undefined. .length() returns a glm::length_t, a typedef of int following GLSL.\")\n#\tendif\n\n#\tif GLM_CONFIG_UNRESTRICTED_GENTYPE == GLM_ENABLE\n#\t\tpragma message(\"GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is defined. Removes GLSL restrictions on valid function genTypes.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is undefined. Follows strictly GLSL on valid function genTypes.\")\n#\tendif\n\n#\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\tpragma message(\"GLM: GLM_FORCE_SILENT_WARNINGS is defined. Ignores C++ warnings from using C++ language extensions.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_SILENT_WARNINGS is undefined. Shows C++ warnings from using C++ language extensions.\")\n#\tendif\n\n#\tifdef GLM_FORCE_SINGLE_ONLY\n#\t\tpragma message(\"GLM: GLM_FORCE_SINGLE_ONLY is defined. Using only single precision floating-point types.\")\n#\tendif\n\n#\tif defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE)\n#\t\tundef GLM_FORCE_ALIGNED_GENTYPES\n#\t\tpragma message(\"GLM: GLM_FORCE_ALIGNED_GENTYPES is defined, allowing aligned types. This prevents the use of C++ constexpr.\")\n#\telif defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE)\n#\t\tundef GLM_FORCE_ALIGNED_GENTYPES\n#\t\tpragma message(\"GLM: GLM_FORCE_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.\")\n#\tendif\n\n#\tif defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES)\n#\t\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE\n#\t\t\tundef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES\n#\t\t\tpragma message(\"GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.\")\n#\t\telif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n#\t\t\tpragma message(\"GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined. All gentypes (e.g. vec3) will be aligned and padded by default.\")\n#\t\tendif\n#\tendif\n\n#\tif GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT\n#\t\tpragma message(\"GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is defined. Using zero to one depth clip space.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is undefined. Using negative one to one depth clip space.\")\n#\tendif\n\n#\tif GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT\n#\t\tpragma message(\"GLM: GLM_FORCE_LEFT_HANDED is defined. Using left handed coordinate system.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_LEFT_HANDED is undefined. Using right handed coordinate system.\")\n#\tendif\n#endif//GLM_MESSAGES\n\n#endif//GLM_SETUP_INCLUDED\n"}, {"path": "includes/glm/detail/type_float.hpp", "language": "code", "loc": 54, "comment_density": 0.111, "code": "#pragma once\n\n#include \"setup.hpp\"\n\n#if GLM_COMPILER == GLM_COMPILER_VC12\n#\tpragma warning(push)\n#\tpragma warning(disable: 4512) // assignment operator could not be generated\n#endif\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate \n\tunion float_t\n\t{};\n\n\t// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/\n\ttemplate <>\n\tunion float_t\n\t{\n\t\ttypedef int int_type;\n\t\ttypedef float float_type;\n\n\t\tGLM_CONSTEXPR float_t(float_type Num = 0.0f) : f(Num) {}\n\n\t\tGLM_CONSTEXPR float_t& operator=(float_t const& x)\n\t\t{\n\t\t\tf = x.f;\n\t\t\treturn *this;\n\t\t}\n\n\t\t// Portable extraction of components.\n\t\tGLM_CONSTEXPR bool negative() const { return i < 0; }\n\t\tGLM_CONSTEXPR int_type mantissa() const { return i & ((1 << 23) - 1); }\n\t\tGLM_CONSTEXPR int_type exponent() const { return (i >> 23) & ((1 << 8) - 1); }\n\n\t\tint_type i;\n\t\tfloat_type f;\n\t};\n\n\ttemplate <>\n\tunion float_t\n\t{\n\t\ttypedef detail::int64 int_type;\n\t\ttypedef double float_type;\n\n\t\tGLM_CONSTEXPR float_t(float_type Num = static_cast(0)) : f(Num) {}\n\n\t\tGLM_CONSTEXPR float_t& operator=(float_t const& x)\n\t\t{\n\t\t\tf = x.f;\n\t\t\treturn *this;\n\t\t}\n\n\t\t// Portable extraction of components.\n\t\tGLM_CONSTEXPR bool negative() const { return i < 0; }\n\t\tGLM_CONSTEXPR int_type mantissa() const { return i & ((int_type(1) << 52) - 1); }\n\t\tGLM_CONSTEXPR int_type exponent() const { return (i >> 52) & ((int_type(1) << 11) - 1); }\n\n\t\tint_type i;\n\t\tfloat_type f;\n\t};\n}//namespace detail\n}//namespace glm\n\n#if GLM_COMPILER == GLM_COMPILER_VC12\n#\tpragma warning(pop)\n#endif\n"}, {"path": "includes/glm/detail/type_half.hpp", "language": "code", "loc": 11, "comment_density": 0.182, "code": "#pragma once\n\n#include \"setup.hpp\"\n\nnamespace glm{\nnamespace detail\n{\n\ttypedef short hdata;\n\n\tGLM_FUNC_DECL float toFloat32(hdata value);\n\tGLM_FUNC_DECL hdata toFloat16(float const& value);\n\n}//namespace detail\n}//namespace glm\n\n#include \"type_half.inl\"\n"}, {"path": "includes/glm/detail/type_mat2x2.hpp", "language": "code", "loc": 131, "comment_density": 0.092, "code": "/// @ref core\n/// @file glm/detail/type_mat2x2.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<2, 2, T, Q>\n\t{\n\t\ttypedef vec<2, T, Q> col_type;\n\t\ttypedef vec<2, T, Q> row_type;\n\t\ttypedef mat<2, 2, T, Q> type;\n\t\ttypedef mat<2, 2, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[2];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 2, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT const& x1, T const& y1,\n\t\t\tT const& x2, T const& y2);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2);\n\n\t\t// -- Conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tU const& x1, V const& y1,\n\t\t\tM const& x2, N const& y2);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<2, U, Q> const& v1,\n\t\t\tvec<2, V, Q> const& v2);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator=(mat<2, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator+=(mat<2, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator-=(mat<2, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator*=(mat<2, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator/=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator/=(mat<2, 2, U, Q> const& m);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator+(T scalar, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator-(T scalar, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(T scalar, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 2, T, Q>::col_type operator*(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 2, T, Q>::row_type operator*(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator/(T scalar, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 2, T, Q>::col_type operator/(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 2, T, Q>::row_type operator/(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n} //namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat2x2.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat2x3.hpp", "language": "code", "loc": 118, "comment_density": 0.102, "code": "/// @ref core\n/// @file glm/detail/type_mat2x3.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \"type_vec3.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<2, 3, T, Q>\n\t{\n\t\ttypedef vec<3, T, Q> col_type;\n\t\ttypedef vec<2, T, Q> row_type;\n\t\ttypedef mat<2, 3, T, Q> type;\n\t\ttypedef mat<3, 2, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[2];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 3, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0, T z0,\n\t\t\tT x1, T y1, T z1);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1);\n\n\t\t// -- Conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1, Z1 z1,\n\t\t\tX2 x2, Y2 y2, Z2 z2);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<3, U, Q> const& v1,\n\t\t\tvec<3, V, Q> const& v2);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator=(mat<2, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator+=(mat<2, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator-=(mat<2, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(mat<2, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(T scalar, mat<2, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 3, T, Q>::col_type operator*(mat<2, 3, T, Q> const& m, typename mat<2, 3, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 3, T, Q>::row_type operator*(typename mat<2, 3, T, Q>::col_type const& v, mat<2, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(mat<2, 3, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(mat<2, 3, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<2, 3, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator/(mat<2, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator/(T scalar, mat<2, 3, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat2x3.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat2x4.hpp", "language": "code", "loc": 120, "comment_density": 0.1, "code": "/// @ref core\n/// @file glm/detail/type_mat2x4.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<2, 4, T, Q>\n\t{\n\t\ttypedef vec<4, T, Q> col_type;\n\t\ttypedef vec<2, T, Q> row_type;\n\t\ttypedef mat<2, 4, T, Q> type;\n\t\ttypedef mat<4, 2, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[2];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 4, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0, T z0, T w0,\n\t\t\tT x1, T y1, T z1, T w1);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1, typename W1,\n\t\t\ttypename X2, typename Y2, typename Z2, typename W2>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1, Z1 z1, W1 w1,\n\t\t\tX2 x2, Y2 y2, Z2 z2, W2 w2);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<4, U, Q> const& v1,\n\t\t\tvec<4, V, Q> const& v2);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator=(mat<2, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator+=(mat<2, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator-=(mat<2, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(mat<2, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(T scalar, mat<2, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 4, T, Q>::col_type operator*(mat<2, 4, T, Q> const& m, typename mat<2, 4, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 4, T, Q>::row_type operator*(typename mat<2, 4, T, Q>::col_type const& v, mat<2, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<2, 4, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(mat<2, 4, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(mat<2, 4, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator/(mat<2, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator/(T scalar, mat<2, 4, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat2x4.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat3x2.hpp", "language": "code", "loc": 125, "comment_density": 0.096, "code": "/// @ref core\n/// @file glm/detail/type_mat3x2.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \"type_vec3.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<3, 2, T, Q>\n\t{\n\t\ttypedef vec<2, T, Q> col_type;\n\t\ttypedef vec<3, T, Q> row_type;\n\t\ttypedef mat<3, 2, T, Q> type;\n\t\ttypedef mat<2, 3, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[3];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 2, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0,\n\t\t\tT x1, T y1,\n\t\t\tT x2, T y2);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1,\n\t\t\ttypename X2, typename Y2,\n\t\t\ttypename X3, typename Y3>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1,\n\t\t\tX2 x2, Y2 y2,\n\t\t\tX3 x3, Y3 y3);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<2, V1, Q> const& v1,\n\t\t\tvec<2, V2, Q> const& v2,\n\t\t\tvec<2, V3, Q> const& v3);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator=(mat<3, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator+=(mat<3, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator-=(mat<3, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(T scalar, mat<3, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 2, T, Q>::col_type operator*(mat<3, 2, T, Q> const& m, typename mat<3, 2, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 2, T, Q>::row_type operator*(typename mat<3, 2, T, Q>::col_type const& v, mat<3, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator/(mat<3, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator/(T scalar, mat<3, 2, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat3x2.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat3x3.hpp", "language": "code", "loc": 138, "comment_density": 0.087, "code": "/// @ref core\n/// @file glm/detail/type_mat3x3.hpp\n\n#pragma once\n\n#include \"type_vec3.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<3, 3, T, Q>\n\t{\n\t\ttypedef vec<3, T, Q> col_type;\n\t\ttypedef vec<3, T, Q> row_type;\n\t\ttypedef mat<3, 3, T, Q> type;\n\t\ttypedef mat<3, 3, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[3];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 3, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0, T z0,\n\t\t\tT x1, T y1, T z1,\n\t\t\tT x2, T y2, T z2);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1,\n\t\t\ttypename X2, typename Y2, typename Z2,\n\t\t\ttypename X3, typename Y3, typename Z3>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1, Z1 z1,\n\t\t\tX2 x2, Y2 y2, Z2 z2,\n\t\t\tX3 x3, Y3 y3, Z3 z3);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<3, V1, Q> const& v1,\n\t\t\tvec<3, V2, Q> const& v2,\n\t\t\tvec<3, V3, Q> const& v3);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator=(mat<3, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator+=(mat<3, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator-=(mat<3, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator*=(mat<3, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator/=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator/=(mat<3, 3, U, Q> const& m);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator++();\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator--();\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator+(T scalar, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator-(T scalar, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(mat<3, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(T scalar, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 3, T, Q>::col_type operator*(mat<3, 3, T, Q> const& m, typename mat<3, 3, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 3, T, Q>::row_type operator*(typename mat<3, 3, T, Q>::col_type const& v, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(mat<3, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<3, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator/(mat<3, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator/(T scalar, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 3, T, Q>::col_type operator/(mat<3, 3, T, Q> const& m, typename mat<3, 3, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 3, T, Q>::row_type operator/(typename mat<3, 3, T, Q>::col_type const& v, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator/(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat3x3.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat3x4.hpp", "language": "code", "loc": 125, "comment_density": 0.096, "code": "/// @ref core\n/// @file glm/detail/type_mat3x4.hpp\n\n#pragma once\n\n#include \"type_vec3.hpp\"\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<3, 4, T, Q>\n\t{\n\t\ttypedef vec<4, T, Q> col_type;\n\t\ttypedef vec<3, T, Q> row_type;\n\t\ttypedef mat<3, 4, T, Q> type;\n\t\ttypedef mat<4, 3, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[3];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 4, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0, T z0, T w0,\n\t\t\tT x1, T y1, T z1, T w1,\n\t\t\tT x2, T y2, T z2, T w2);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1, typename W1,\n\t\t\ttypename X2, typename Y2, typename Z2, typename W2,\n\t\t\ttypename X3, typename Y3, typename Z3, typename W3>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1, Z1 z1, W1 w1,\n\t\t\tX2 x2, Y2 y2, Z2 z2, W2 w2,\n\t\t\tX3 x3, Y3 y3, Z3 z3, W3 w3);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<4, V1, Q> const& v1,\n\t\t\tvec<4, V2, Q> const& v2,\n\t\t\tvec<4, V3, Q> const& v3);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator=(mat<3, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator+=(mat<3, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator-=(mat<3, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator++();\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator--();\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(mat<3, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(T scalar, mat<3, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 4, T, Q>::col_type operator*(mat<3, 4, T, Q> const& m, typename mat<3, 4, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 4, T, Q>::row_type operator*(typename mat<3, 4, T, Q>::col_type const& v, mat<3, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1,\tmat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1,\tmat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator/(mat<3, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator/(T scalar, mat<3, 4, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat3x4.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat4x2.hpp", "language": "code", "loc": 130, "comment_density": 0.092, "code": "/// @ref core\n/// @file glm/detail/type_mat4x2.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<4, 2, T, Q>\n\t{\n\t\ttypedef vec<2, T, Q> col_type;\n\t\ttypedef vec<4, T, Q> row_type;\n\t\ttypedef mat<4, 2, T, Q> type;\n\t\ttypedef mat<2, 4, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[4];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 2, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0,\n\t\t\tT x1, T y1,\n\t\t\tT x2, T y2,\n\t\t\tT x3, T y3);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2,\n\t\t\tcol_type const& v3);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X0, typename Y0,\n\t\t\ttypename X1, typename Y1,\n\t\t\ttypename X2, typename Y2,\n\t\t\ttypename X3, typename Y3>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX0 x0, Y0 y0,\n\t\t\tX1 x1, Y1 y1,\n\t\t\tX2 x2, Y2 y2,\n\t\t\tX3 x3, Y3 y3);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<2, V1, Q> const& v1,\n\t\t\tvec<2, V2, Q> const& v2,\n\t\t\tvec<2, V3, Q> const& v3,\n\t\t\tvec<2, V4, Q> const& v4);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator=(mat<4, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator+=(mat<4, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator-=(mat<4, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m1,\tmat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<4, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(T scalar, mat<4, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 2, T, Q>::col_type operator*(mat<4, 2, T, Q> const& m, typename mat<4, 2, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 2, T, Q>::row_type operator*(typename mat<4, 2, T, Q>::col_type const& v, mat<4, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<4, 2, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<4, 2, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<4, 2, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator/(mat<4, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator/(T scalar, mat<4, 2, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat4x2.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat4x3.hpp", "language": "code", "loc": 130, "comment_density": 0.1, "code": "/// @ref core\n/// @file glm/detail/type_mat4x3.hpp\n\n#pragma once\n\n#include \"type_vec3.hpp\"\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<4, 3, T, Q>\n\t{\n\t\ttypedef vec<3, T, Q> col_type;\n\t\ttypedef vec<4, T, Q> row_type;\n\t\ttypedef mat<4, 3, T, Q> type;\n\t\ttypedef mat<3, 4, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[4];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 3, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T const& x);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT const& x0, T const& y0, T const& z0,\n\t\t\tT const& x1, T const& y1, T const& z1,\n\t\t\tT const& x2, T const& y2, T const& z2,\n\t\t\tT const& x3, T const& y3, T const& z3);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2,\n\t\t\tcol_type const& v3);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1,\n\t\t\ttypename X2, typename Y2, typename Z2,\n\t\t\ttypename X3, typename Y3, typename Z3,\n\t\t\ttypename X4, typename Y4, typename Z4>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 const& x1, Y1 const& y1, Z1 const& z1,\n\t\t\tX2 const& x2, Y2 const& y2, Z2 const& z2,\n\t\t\tX3 const& x3, Y3 const& y3, Z3 const& z3,\n\t\t\tX4 const& x4, Y4 const& y4, Z4 const& z4);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<3, V1, Q> const& v1,\n\t\t\tvec<3, V2, Q> const& v2,\n\t\t\tvec<3, V3, Q> const& v3,\n\t\t\tvec<3, V4, Q> const& v4);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator=(mat<4, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator+=(mat<4, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator-=(mat<4, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q>& operator++();\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q>& operator--();\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(T const& s, mat<4, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 3, T, Q>::col_type operator*(mat<4, 3, T, Q> const& m, typename mat<4, 3, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 3, T, Q>::row_type operator*(typename mat<4, 3, T, Q>::col_type const& v, mat<4, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1,\tmat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator/(mat<4, 3, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator/(T const& s, mat<4, 3, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat4x3.inl\"\n#endif //GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_mat4x4.hpp", "language": "code", "loc": 143, "comment_density": 0.091, "code": "/// @ref core\n/// @file glm/detail/type_mat4x4.hpp\n\n#pragma once\n\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<4, 4, T, Q>\n\t{\n\t\ttypedef vec<4, T, Q> col_type;\n\t\ttypedef vec<4, T, Q> row_type;\n\t\ttypedef mat<4, 4, T, Q> type;\n\t\ttypedef mat<4, 4, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[4];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 4, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T const& x);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT const& x0, T const& y0, T const& z0, T const& w0,\n\t\t\tT const& x1, T const& y1, T const& z1, T const& w1,\n\t\t\tT const& x2, T const& y2, T const& z2, T const& w2,\n\t\t\tT const& x3, T const& y3, T const& z3, T const& w3);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2,\n\t\t\tcol_type const& v3);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1, typename W1,\n\t\t\ttypename X2, typename Y2, typename Z2, typename W2,\n\t\t\ttypename X3, typename Y3, typename Z3, typename W3,\n\t\t\ttypename X4, typename Y4, typename Z4, typename W4>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 const& x1, Y1 const& y1, Z1 const& z1, W1 const& w1,\n\t\t\tX2 const& x2, Y2 const& y2, Z2 const& z2, W2 const& w2,\n\t\t\tX3 const& x3, Y3 const& y3, Z3 const& z3, W3 const& w3,\n\t\t\tX4 const& x4, Y4 const& y4, Z4 const& z4, W4 const& w4);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<4, V1, Q> const& v1,\n\t\t\tvec<4, V2, Q> const& v2,\n\t\t\tvec<4, V3, Q> const& v3,\n\t\t\tvec<4, V4, Q> const& v4);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator=(mat<4, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator+=(mat<4, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator-=(mat<4, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator*=(mat<4, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator/=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator/=(mat<4, 4, U, Q> const& m);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator++();\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator--();\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator+(T const& s, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator-(T const& s, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m1,\tmat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(T const& s, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 4, T, Q>::col_type operator*(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 4, T, Q>::row_type operator*(typename mat<4, 4, T, Q>::col_type const& v, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator/(T const& s, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 4, T, Q>::col_type operator/(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 4, T, Q>::row_type operator/(typename mat<4, 4, T, Q>::col_type const& v, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m1,\tmat<4, 4, T, Q> const& m2);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat4x4.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_quat.hpp", "language": "code", "loc": 146, "comment_density": 0.253, "code": "/// @ref gtc_quaternion\n/// @file glm/gtc/quaternion.hpp\n///\n/// @see core (dependence)\n/// @see gtc_constants (dependence)\n///\n/// @defgroup gtc_quaternion GLM_GTC_quaternion\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines a templated quaternion type and several quaternion operations.\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_mat3x3.hpp\"\n#include \"../detail/type_mat4x4.hpp\"\n#include \"../detail/type_vec3.hpp\"\n#include \"../detail/type_vec4.hpp\"\n#include \"../ext/vector_relational.hpp\"\n#include \"../ext/quaternion_relational.hpp\"\n#include \"../gtc/constants.hpp\"\n#include \"../gtc/matrix_transform.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup gtc_quaternion\n\t/// @{\n\n\ttemplate\n\tstruct qua\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef qua type;\n\t\ttypedef T value_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_LANG & GLM_LANG_CXXMS_FLAG\n\t\t\tunion\n\t\t\t{\n\t\t\t\tstruct { T x, y, z, w;};\n\n\t\t\t\ttypename detail::storage<4, T, detail::is_aligned::value>::type data;\n\t\t\t};\n#\t\telse\n\t\t\tT x, y, z, w;\n#\t\tendif\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\ttypedef length_t length_type;\n\t\t/// Return the count of components of a quaternion\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua(qua const& q) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua(qua const& q);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua(T s, vec<3, T, Q> const& v);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua(T w, T x, T y, T z);\n\n\t\t// -- Conversion constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT qua(qua const& q);\n\n\t\t/// Explicit conversion operators\n#\t\tif GLM_HAS_EXPLICIT_CONVERSION_OPERATORS\n\t\t\tGLM_FUNC_DECL explicit operator mat<3, 3, T, Q>();\n\t\t\tGLM_FUNC_DECL explicit operator mat<4, 4, T, Q>();\n#\t\tendif\n\n\t\t/// Create a quaternion from two normalized axis\n\t\t///\n\t\t/// @param u A first normalized axis\n\t\t/// @param v A second normalized axis\n\t\t/// @see gtc_quaternion\n\t\t/// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors\n\t\tGLM_FUNC_DECL qua(vec<3, T, Q> const& u, vec<3, T, Q> const& v);\n\n\t\t/// Build a quaternion from euler angles (pitch, yaw, roll), in radians.\n\t\tGLM_FUNC_DECL GLM_EXPLICIT qua(vec<3, T, Q> const& eulerAngles);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT qua(mat<3, 3, T, Q> const& q);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT qua(mat<4, 4, T, Q> const& q);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL qua& operator=(qua const& q) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator=(qua const& q);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator+=(qua const& q);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator-=(qua const& q);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator*=(qua const& q);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator/=(U s);\n\t};\n\n\t// -- Unary bit operators --\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator+(qua const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator-(qua const& q);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator+(qua const& q, qua const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator-(qua const& q, qua const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator*(qua const& q, qua const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> operator*(qua const& q, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, qua const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> operator*(qua const& q, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, qua const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator*(qua const& q, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator*(T const& s, qua const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator/(qua const& q, T const& s);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(qua const& q1, qua const& q2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(qua const& q1, qua const& q2);\n\n\t/// @}\n} //namespace glm\n\n#include \"type_quat.inl\"\n"}, {"path": "includes/glm/detail/type_vec1.hpp", "language": "code", "loc": 241, "comment_density": 0.207, "code": "/// @ref core\n/// @file glm/detail/type_vec1.hpp\n\n#pragma once\n\n#include \"qualifier.hpp\"\n#if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\tinclude \"_swizzle.hpp\"\n#elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\tinclude \"_swizzle_func.hpp\"\n#endif\n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct vec<1, T, Q>\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef vec<1, T, Q> type;\n\t\ttypedef vec<1, bool, Q> bool_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_CONFIG_XYZW_ONLY\n\t\t\tT x;\n#\t\telif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE\n\t\t\tunion\n\t\t\t{\n\t\t\t\tT x;\n\t\t\t\tT r;\n\t\t\t\tT s;\n\n\t\t\t\ttypename detail::storage<1, T, detail::is_aligned::value>::type data;\n/*\n#\t\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\t\t\t_GLM_SWIZZLE1_2_MEMBERS(T, Q, x)\n\t\t\t\t\t_GLM_SWIZZLE1_2_MEMBERS(T, Q, r)\n\t\t\t\t\t_GLM_SWIZZLE1_2_MEMBERS(T, Q, s)\n\t\t\t\t\t_GLM_SWIZZLE1_3_MEMBERS(T, Q, x)\n\t\t\t\t\t_GLM_SWIZZLE1_3_MEMBERS(T, Q, r)\n\t\t\t\t\t_GLM_SWIZZLE1_3_MEMBERS(T, Q, s)\n\t\t\t\t\t_GLM_SWIZZLE1_4_MEMBERS(T, Q, x)\n\t\t\t\t\t_GLM_SWIZZLE1_4_MEMBERS(T, Q, r)\n\t\t\t\t\t_GLM_SWIZZLE1_4_MEMBERS(T, Q, s)\n#\t\t\t\tendif\n*/\n\t\t\t};\n#\t\telse\n\t\t\tunion {T x, r, s;};\n/*\n#\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n\t\t\t\tGLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, Q)\n#\t\t\tendif\n*/\n#\t\tendif\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\t/// Return the count of components of the vector\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 1;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, T, P> const& v);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);\n\n\t\t// -- Conversion vector constructors --\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<2, U, P> const& v);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<1, U, P> const& v);\n\n\t\t// -- Swizzle constructors --\n/*\n#\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<1, T, Q, E0, -1,-2,-3> const& that)\n\t\t\t{\n\t\t\t\t*this = that();\n\t\t\t}\n#\t\tendif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n*/\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator=(vec const& v) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator+=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator+=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator-=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator-=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator*=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator*=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator/=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator/=(vec<1, U, Q> const& v);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator++();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator--();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator--(int);\n\n\t\t// -- Unary bit operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator%=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator%=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator&=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator&=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator|=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator|=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator^=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator^=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator<<=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator<<=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator>>=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator>>=(vec<1, U, Q> const& v);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(vec<1, T, Q> const& v);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator*(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator*(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator*(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator/(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator/(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator/(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator%(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator%(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator%(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator&(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator&(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator&(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator|(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator|(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator|(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator^(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator^(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator^(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator<<(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator<<(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator<<(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator>>(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator>>(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator>>(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator~(vec<1, T, Q> const& v);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, bool, Q> operator&&(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, bool, Q> operator||(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_vec1.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_vec2.hpp", "language": "code", "loc": 306, "comment_density": 0.085, "code": "/// @ref core\n/// @file glm/detail/type_vec2.hpp\n\n#pragma once\n\n#include \"qualifier.hpp\"\n#if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\tinclude \"_swizzle.hpp\"\n#elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\tinclude \"_swizzle_func.hpp\"\n#endif\n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct vec<2, T, Q>\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef vec<2, T, Q> type;\n\t\ttypedef vec<2, bool, Q> bool_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_CONFIG_XYZW_ONLY\n\t\t\tT x, y;\n#\t\telif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE\n\t\t\tunion\n\t\t\t{\n\t\t\t\tstruct{ T x, y; };\n\t\t\t\tstruct{ T r, g; };\n\t\t\t\tstruct{ T s, t; };\n\n\t\t\t\ttypename detail::storage<2, T, detail::is_aligned::value>::type data;\n\n#\t\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\t\t\tGLM_SWIZZLE2_2_MEMBERS(T, Q, x, y)\n\t\t\t\t\tGLM_SWIZZLE2_2_MEMBERS(T, Q, r, g)\n\t\t\t\t\tGLM_SWIZZLE2_2_MEMBERS(T, Q, s, t)\n\t\t\t\t\tGLM_SWIZZLE2_3_MEMBERS(T, Q, x, y)\n\t\t\t\t\tGLM_SWIZZLE2_3_MEMBERS(T, Q, r, g)\n\t\t\t\t\tGLM_SWIZZLE2_3_MEMBERS(T, Q, s, t)\n\t\t\t\t\tGLM_SWIZZLE2_4_MEMBERS(T, Q, x, y)\n\t\t\t\t\tGLM_SWIZZLE2_4_MEMBERS(T, Q, r, g)\n\t\t\t\t\tGLM_SWIZZLE2_4_MEMBERS(T, Q, s, t)\n#\t\t\t\tendif\n\t\t\t};\n#\t\telse\n\t\t\tunion {T x, r, s;};\n\t\t\tunion {T y, g, t;};\n\n#\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n\t\t\t\tGLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q)\n#\t\t\tendif//GLM_CONFIG_SWIZZLE\n#\t\tendif\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\t/// Return the count of components of the vector\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T& operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, T, P> const& v);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T x, T y);\n\n\t\t// -- Conversion constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A x, B y);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, B y);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A x, vec<1, B, Q> const& y);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, vec<1, B, Q> const& y);\n\n\t\t// -- Conversion vector constructors --\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<2, U, P> const& v);\n\n\t\t// -- Swizzle constructors --\n#\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1,-1,-2> const& that)\n\t\t\t{\n\t\t\t\t*this = that();\n\t\t\t}\n#\t\tendif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec const& v) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<2, U, Q> const& v);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator++();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator--();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator--(int);\n\n\t\t// -- Unary bit operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(vec<2, U, Q> const& v);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator~(vec<2, T, Q> const& v);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator&&(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator||(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_vec2.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_vec3.hpp", "language": "code", "loc": 337, "comment_density": 0.092, "code": "/// @ref core\n/// @file glm/detail/type_vec3.hpp\n\n#pragma once\n\n#include \"qualifier.hpp\"\n#if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\tinclude \"_swizzle.hpp\"\n#elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\tinclude \"_swizzle_func.hpp\"\n#endif\n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct vec<3, T, Q>\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef vec<3, T, Q> type;\n\t\ttypedef vec<3, bool, Q> bool_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\t\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n#\t\t\t\t\tpragma warning(disable: 4324) // structure was padded due to alignment specifier\n#\t\t\t\tendif\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_CONFIG_XYZW_ONLY\n\t\t\tT x, y, z;\n#\t\telif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE\n\t\t\tunion\n\t\t\t{\n\t\t\t\tstruct{ T x, y, z; };\n\t\t\t\tstruct{ T r, g, b; };\n\t\t\t\tstruct{ T s, t, p; };\n\n\t\t\t\ttypename detail::storage<3, T, detail::is_aligned::value>::type data;\n\n#\t\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\t\t\tGLM_SWIZZLE3_2_MEMBERS(T, Q, x, y, z)\n\t\t\t\t\tGLM_SWIZZLE3_2_MEMBERS(T, Q, r, g, b)\n\t\t\t\t\tGLM_SWIZZLE3_2_MEMBERS(T, Q, s, t, p)\n\t\t\t\t\tGLM_SWIZZLE3_3_MEMBERS(T, Q, x, y, z)\n\t\t\t\t\tGLM_SWIZZLE3_3_MEMBERS(T, Q, r, g, b)\n\t\t\t\t\tGLM_SWIZZLE3_3_MEMBERS(T, Q, s, t, p)\n\t\t\t\t\tGLM_SWIZZLE3_4_MEMBERS(T, Q, x, y, z)\n\t\t\t\t\tGLM_SWIZZLE3_4_MEMBERS(T, Q, r, g, b)\n\t\t\t\t\tGLM_SWIZZLE3_4_MEMBERS(T, Q, s, t, p)\n#\t\t\t\tendif\n\t\t\t};\n#\t\telse\n\t\t\tunion { T x, r, s; };\n\t\t\tunion { T y, g, t; };\n\t\t\tunion { T z, b, p; };\n\n#\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n\t\t\t\tGLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, Q)\n#\t\t\tendif//GLM_CONFIG_SWIZZLE\n#\t\tendif//GLM_LANG\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\t/// Return the count of components of the vector\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 3;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, T, P> const& v);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T a, T b, T c);\n\n\t\t// -- Conversion scalar constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X x, Y y, Z z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, Z _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, Z _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, Z _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, vec<1, Z, Q> const& _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, vec<1, Z, Q> const& _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);\n\n\t\t// -- Conversion vector constructors --\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, B _z);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<2, B, P> const& _yz);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);\n\n\t\t// -- Swizzle constructors --\n#\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1> const& that)\n\t\t\t{\n\t\t\t\t*this = that();\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v, T const& scalar)\n\t\t\t{\n\t\t\t\t*this = vec(v(), scalar);\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T const& scalar, detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v)\n\t\t\t{\n\t\t\t\t*this = vec(scalar, v());\n\t\t\t}\n#\t\tendif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q>& operator=(vec<3, T, Q> const& v) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(vec<3, U, Q> const& v);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator++();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator--();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator--(int);\n\n\t\t// -- Unary bit operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(vec<3, U, Q> const& v);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q> const& v);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q> const& v1, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator~(vec<3, T, Q> const& v);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, bool, Q> operator&&(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, bool, Q> operator||(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_vec3.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_vec4.hpp", "language": "code", "loc": 405, "comment_density": 0.099, "code": "/// @ref core\n/// @file glm/detail/type_vec4.hpp\n\n#pragma once\n\n#include \"qualifier.hpp\"\n#if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\tinclude \"_swizzle.hpp\"\n#elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\tinclude \"_swizzle_func.hpp\"\n#endif\n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct vec<4, T, Q>\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef vec<4, T, Q> type;\n\t\ttypedef vec<4, bool, Q> bool_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_CONFIG_XYZW_ONLY\n\t\t\tT x, y, z, w;\n#\t\telif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE\n\t\t\tunion\n\t\t\t{\n\t\t\t\tstruct { T x, y, z, w; };\n\t\t\t\tstruct { T r, g, b, a; };\n\t\t\t\tstruct { T s, t, p, q; };\n\n\t\t\t\ttypename detail::storage<4, T, detail::is_aligned::value>::type data;\n\n#\t\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\t\t\tGLM_SWIZZLE4_2_MEMBERS(T, Q, x, y, z, w)\n\t\t\t\t\tGLM_SWIZZLE4_2_MEMBERS(T, Q, r, g, b, a)\n\t\t\t\t\tGLM_SWIZZLE4_2_MEMBERS(T, Q, s, t, p, q)\n\t\t\t\t\tGLM_SWIZZLE4_3_MEMBERS(T, Q, x, y, z, w)\n\t\t\t\t\tGLM_SWIZZLE4_3_MEMBERS(T, Q, r, g, b, a)\n\t\t\t\t\tGLM_SWIZZLE4_3_MEMBERS(T, Q, s, t, p, q)\n\t\t\t\t\tGLM_SWIZZLE4_4_MEMBERS(T, Q, x, y, z, w)\n\t\t\t\t\tGLM_SWIZZLE4_4_MEMBERS(T, Q, r, g, b, a)\n\t\t\t\t\tGLM_SWIZZLE4_4_MEMBERS(T, Q, s, t, p, q)\n#\t\t\t\tendif\n\t\t\t};\n#\t\telse\n\t\t\tunion { T x, r, s; };\n\t\t\tunion { T y, g, t; };\n\t\t\tunion { T z, b, p; };\n\t\t\tunion { T w, a, q; };\n\n#\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n\t\t\t\tGLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, Q)\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\t/// Return the count of components of the vector\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<4, T, Q> const& v) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<4, T, P> const& v);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T x, T y, T z, T w);\n\n\t\t// -- Conversion scalar constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, Z _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, Z _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, Z _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, Z _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, vec<1, Z, Q> const& _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, vec<1, Z, Q> const& _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, Z _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, Z _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, Z _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, vec<1, Z, Q> const& _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, vec<1, Z, Q> const& _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _Y, vec<1, Z, Q> const& _z, vec<1, W, Q> const& _w);\n\n\t\t// -- Conversion vector constructors --\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, B _z, C _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, C _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, B _z, vec<1, C, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, vec<1, C, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<2, B, P> const& _yz, C _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, C _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, B _y, vec<2, C, P> const& _zw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, B _y, vec<2, C, P> const& _zw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, A, P> const& _xyz, B _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, A, P> const& _xyz, vec<1, B, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<3, B, P> const& _yzw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<3, B, P> const& _yzw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<2, B, P> const& _zw);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);\n\n\t\t// -- Swizzle constructors --\n#\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<4, T, Q, E0, E1, E2, E3> const& that)\n\t\t\t{\n\t\t\t\t*this = that();\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v, detail::_swizzle<2, T, Q, F0, F1, -1, -2> const& u)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(v(), u());\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T const& x, T const& y, detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(x, y, v());\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T const& x, detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v, T const& w)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(x, v(), w);\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v, T const& z, T const& w)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(v(), z, w);\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1> const& v, T const& w)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(v(), w);\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T const& x, detail::_swizzle<3, T, Q, E0, E1, E2, -1> const& v)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(x, v());\n\t\t\t}\n#\t\tendif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator=(vec<4, T, Q> const& v) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator+=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator+=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator+=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator-=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator-=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator-=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator*=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator*=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator*=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator/=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator/=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator/=(vec<4, U, Q> const& v);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator++();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator--();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator--(int);\n\n\t\t// -- Unary bit operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator%=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator%=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator%=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator&=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator&=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator&=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator|=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator|=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator|=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator^=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator^=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator^=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator<<=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator<<=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator<<=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator>>=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator>>=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator>>=(vec<4, U, Q> const& v);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v, T const & scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<1, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v, T const & scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<1, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, T const & scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<1, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v, T const & scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<1, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator~(vec<4, T, Q> const& v);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, bool, Q> operator&&(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, bool, Q> operator||(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_vec4.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.139, "dedup_hash": "18bfbc78ddf44843", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_ext", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Ext", "api": "OpenGL Core", "glsl_version": null, "topic": "camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/ext/matrix_clip_space.hpp", "language": "code", "loc": 473, "comment_density": 0.712, "code": "/// @ref ext_matrix_clip_space\n/// @file glm/ext/matrix_clip_space.hpp\n///\n/// @defgroup ext_matrix_clip_space GLM_EXT_matrix_clip_space\n/// @ingroup ext\n///\n/// Defines functions that generate clip space transformation matrices.\n///\n/// The matrices generated by this extension use standard OpenGL fixed-function\n/// conventions. For example, the lookAt function generates a transform from world\n/// space into the specific eye space that the projective matrix functions\n/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility\n/// specifications defines the particular layout of this eye space.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_matrix_transform\n/// @see ext_matrix_projection\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_constants.hpp\"\n#include \"../geometric.hpp\"\n#include \"../trigonometric.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_matrix_clip_space extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_matrix_clip_space\n\t/// @{\n\n\t/// Creates a matrix for projecting two-dimensional coordinates onto the screen.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top, T const& zNear, T const& zFar)\n\t/// @see gluOrtho2D man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(\n\t\tT left, T right, T bottom, T top);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_ZO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume using right-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_NO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_ZO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_NO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoZO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoNO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using the default handedness and default near and far clip planes definition.\n\t/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\t/// @see glOrtho man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a left handed frustum matrix.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_ZO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a left handed frustum matrix.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_NO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a right handed frustum matrix.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_ZO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a right handed frustum matrix.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_NO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumZO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumNO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a left handed frustum matrix.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a right handed frustum matrix.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a frustum matrix with default handedness, using the default handedness and default near and far clip planes definition.\n\t/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @see glFrustum man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustum(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\n\t/// Creates a matrix for a right handed, symmetric perspective-view frustum.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_ZO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a right handed, symmetric perspective-view frustum.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_NO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a left handed, symmetric perspective-view frustum.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_ZO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a left handed, symmetric perspective-view frustum.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_NO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveZO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveNO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a right handed, symmetric perspective-view frustum.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a left handed, symmetric perspective-view frustum.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum based on the default handedness and default near and far clip planes definition.\n\t/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @param fovy Specifies the field of view angle in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @see gluPerspective man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspective(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using right-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_ZO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using right-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_NO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_ZO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_NO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovZO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovNO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a right handed perspective projection matrix based on a field of view.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a left handed perspective projection matrix based on a field of view.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view and the default handedness and default near and far clip planes definition.\n\t/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFov(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Creates a matrix for a left handed, symmetric perspective-view frustum with far plane at infinite.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH(\n\t\tT fovy, T aspect, T near);\n\n\t/// Creates a matrix for a right handed, symmetric perspective-view frustum with far plane at infinite.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH(\n\t\tT fovy, T aspect, T near);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite with default handedness.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspective(\n\t\tT fovy, T aspect, T near);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(\n\t\tT fovy, T aspect, T near);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param ep Epsilon\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(\n\t\tT fovy, T aspect, T near, T ep);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_clip_space.inl\"\n"}, {"path": "includes/glm/ext/matrix_double2x2.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x2.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 2, double, defaultp>\t\tdmat2x2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 2, double, defaultp>\t\tdmat2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x2_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, lowp>\t\tlowp_dmat2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, mediump>\tmediump_dmat2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, highp>\thighp_dmat2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, lowp>\t\tlowp_dmat2x2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, mediump>\tmediump_dmat2x2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, highp>\thighp_dmat2x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x3.hpp\n\n#pragma once\n#include \"../detail/type_mat2x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 3 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 3, double, defaultp>\t\tdmat2x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, double, lowp>\t\tlowp_dmat2x3;\n\n\t/// 2 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, double, mediump>\tmediump_dmat2x3;\n\n\t/// 2 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, double, highp>\thighp_dmat2x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x4.hpp\n\n#pragma once\n#include \"../detail/type_mat2x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 4 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 4, double, defaultp>\t\tdmat2x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, double, lowp>\t\tlowp_dmat2x4;\n\n\t/// 2 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, double, mediump>\tmediump_dmat2x4;\n\n\t/// 2 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, double, highp>\thighp_dmat2x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x2.hpp\n\n#pragma once\n#include \"../detail/type_mat3x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 2 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 2, double, defaultp>\t\tdmat3x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, double, lowp>\t\tlowp_dmat3x2;\n\n\t/// 3 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, double, mediump>\tmediump_dmat3x2;\n\n\t/// 3 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, double, highp>\thighp_dmat3x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x3.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x3.hpp\n\n#pragma once\n#include \"../detail/type_mat3x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 3, double, defaultp>\t\tdmat3x3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 3, double, defaultp>\t\tdmat3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x3_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, lowp>\t\tlowp_dmat3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, mediump>\tmediump_dmat3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, highp>\thighp_dmat3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, lowp>\t\tlowp_dmat3x3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, mediump>\tmediump_dmat3x3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, highp>\thighp_dmat3x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x4.hpp\n\n#pragma once\n#include \"../detail/type_mat3x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 4 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 4, double, defaultp>\t\tdmat3x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, double, lowp>\t\tlowp_dmat3x4;\n\n\t/// 3 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, double, mediump>\tmediump_dmat3x4;\n\n\t/// 3 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, double, highp>\thighp_dmat3x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x2.hpp\n\n#pragma once\n#include \"../detail/type_mat4x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 2 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 2, double, defaultp>\t\tdmat4x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, double, lowp>\t\tlowp_dmat4x2;\n\n\t/// 4 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, double, mediump>\tmediump_dmat4x2;\n\n\t/// 4 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, double, highp>\thighp_dmat4x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x3.hpp\n\n#pragma once\n#include \"../detail/type_mat4x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 3 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 3, double, defaultp>\t\tdmat4x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, double, lowp>\t\tlowp_dmat4x3;\n\n\t/// 4 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, double, mediump>\tmediump_dmat4x3;\n\n\t/// 4 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, double, highp>\thighp_dmat4x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x4.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x4.hpp\n\n#pragma once\n#include \"../detail/type_mat4x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 4, double, defaultp>\t\tdmat4x4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 4, double, defaultp>\t\tdmat4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x4_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, lowp>\t\tlowp_dmat4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, mediump>\tmediump_dmat4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, highp>\thighp_dmat4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, lowp>\t\tlowp_dmat4x4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, mediump>\tmediump_dmat4x4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, highp>\thighp_dmat4x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x2.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x2.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 2, float, defaultp>\t\tmat2x2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 2, float, defaultp>\t\tmat2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x2_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, lowp>\t\tlowp_mat2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, mediump>\tmediump_mat2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, highp>\t\thighp_mat2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, lowp>\t\tlowp_mat2x2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, mediump>\tmediump_mat2x2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, highp>\t\thighp_mat2x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x3.hpp\n\n#pragma once\n#include \"../detail/type_mat2x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 3 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 3, float, defaultp>\t\tmat2x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, float, lowp>\t\tlowp_mat2x3;\n\n\t/// 2 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, float, mediump>\tmediump_mat2x3;\n\n\t/// 2 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, float, highp>\t\thighp_mat2x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x4.hpp\n\n#pragma once\n#include \"../detail/type_mat2x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 4 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 4, float, defaultp>\t\tmat2x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, float, lowp>\t\tlowp_mat2x4;\n\n\t/// 2 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, float, mediump>\tmediump_mat2x4;\n\n\t/// 2 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, float, highp>\t\thighp_mat2x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x2.hpp\n\n#pragma once\n#include \"../detail/type_mat3x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core\n\t/// @{\n\n\t/// 3 columns of 2 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 2, float, defaultp>\t\t\tmat3x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, float, lowp>\t\tlowp_mat3x2;\n\n\t/// 3 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, float, mediump>\tmediump_mat3x2;\n\n\t/// 3 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, float, highp>\t\thighp_mat3x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x3.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x3.hpp\n\n#pragma once\n#include \"../detail/type_mat3x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 3, float, defaultp>\t\t\tmat3x3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 3, float, defaultp>\t\t\tmat3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x3_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, lowp>\t\tlowp_mat3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, mediump>\tmediump_mat3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, highp>\t\thighp_mat3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, lowp>\t\tlowp_mat3x3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, mediump>\tmediump_mat3x3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, highp>\t\thighp_mat3x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x4.hpp\n\n#pragma once\n#include \"../detail/type_mat3x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 4 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 4, float, defaultp>\t\t\tmat3x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, float, lowp>\t\tlowp_mat3x4;\n\n\t/// 3 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, float, mediump>\tmediump_mat3x4;\n\n\t/// 3 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, float, highp>\t\thighp_mat3x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x2.hpp\n\n#pragma once\n#include \"../detail/type_mat4x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 2 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 2, float, defaultp>\t\t\tmat4x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, float, lowp>\t\tlowp_mat4x2;\n\n\t/// 4 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, float, mediump>\tmediump_mat4x2;\n\n\t/// 4 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, float, highp>\t\thighp_mat4x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x3.hpp\n\n#pragma once\n#include \"../detail/type_mat4x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 3 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 3, float, defaultp>\t\t\tmat4x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, float, lowp>\t\tlowp_mat4x3;\n\n\t/// 4 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, float, mediump>\tmediump_mat4x3;\n\n\t/// 4 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, float, highp>\t\thighp_mat4x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x4.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x4.hpp\n\n#pragma once\n#include \"../detail/type_mat4x4.hpp\"\n\nnamespace glm\n{\n\t/// @ingroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 4, float, defaultp>\t\t\tmat4x4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 4, float, defaultp>\t\t\tmat4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x4_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, lowp>\t\tlowp_mat4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, mediump>\tmediump_mat4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, highp>\t\thighp_mat4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, lowp>\t\tlowp_mat4x4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, mediump>\tmediump_mat4x4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, highp>\t\thighp_mat4x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_projection.hpp", "language": "code", "loc": 136, "comment_density": 0.765, "code": "/// @ref ext_matrix_projection\n/// @file glm/ext/matrix_projection.hpp\n///\n/// @defgroup ext_matrix_projection GLM_EXT_matrix_projection\n/// @ingroup ext\n///\n/// Functions that generate common projection transformation matrices.\n///\n/// The matrices generated by this extension use standard OpenGL fixed-function\n/// conventions. For example, the lookAt function generates a transform from world\n/// space into the specific eye space that the projective matrix functions\n/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility\n/// specifications defines the particular layout of this eye space.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_matrix_transform\n/// @see ext_matrix_clip_space\n\n#pragma once\n\n// Dependencies\n#include \"../gtc/constants.hpp\"\n#include \"../geometric.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../matrix.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_matrix_projection extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_matrix_projection\n\t/// @{\n\n\t/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param obj Specify the object coordinates.\n\t/// @param model Specifies the current modelview matrix\n\t/// @param proj Specifies the current projection matrix\n\t/// @param viewport Specifies the current viewport\n\t/// @return Return the computed window coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> projectZO(\n\t\tvec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param obj Specify the object coordinates.\n\t/// @param model Specifies the current modelview matrix\n\t/// @param proj Specifies the current projection matrix\n\t/// @param viewport Specifies the current viewport\n\t/// @return Return the computed window coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> projectNO(\n\t\tvec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates using default near and far clip planes definition.\n\t/// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @param obj Specify the object coordinates.\n\t/// @param model Specifies the current modelview matrix\n\t/// @param proj Specifies the current projection matrix\n\t/// @param viewport Specifies the current viewport\n\t/// @return Return the computed window coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> project(\n\t\tvec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param win Specify the window coordinates to be mapped.\n\t/// @param model Specifies the modelview matrix\n\t/// @param proj Specifies the projection matrix\n\t/// @param viewport Specifies the viewport\n\t/// @return Returns the computed object coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluUnProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> unProjectZO(\n\t\tvec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param win Specify the window coordinates to be mapped.\n\t/// @param model Specifies the modelview matrix\n\t/// @param proj Specifies the projection matrix\n\t/// @param viewport Specifies the viewport\n\t/// @return Returns the computed object coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluUnProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> unProjectNO(\n\t\tvec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using default near and far clip planes definition.\n\t/// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @param win Specify the window coordinates to be mapped.\n\t/// @param model Specifies the modelview matrix\n\t/// @param proj Specifies the projection matrix\n\t/// @param viewport Specifies the viewport\n\t/// @return Returns the computed object coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluUnProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> unProject(\n\t\tvec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Define a picking region\n\t///\n\t/// @param center Specify the center of a picking region in window coordinates.\n\t/// @param delta Specify the width and height, respectively, of the picking region in window coordinates.\n\t/// @param viewport Rendering viewport\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluPickMatrix man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> pickMatrix(\n\t\tvec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_projection.inl\"\n"}, {"path": "includes/glm/ext/matrix_relational.hpp", "language": "code", "loc": 116, "comment_density": 0.759, "code": "/// @ref ext_matrix_relational\n/// @file glm/ext/matrix_relational.hpp\n///\n/// @defgroup ext_matrix_relational GLM_EXT_matrix_relational\n/// @ingroup ext\n///\n/// Exposes comparison functions for matrix types that take a user defined epsilon values.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_relational\n/// @see ext_scalar_relational\n/// @see ext_quaternion_relational\n\n#pragma once\n\n// Dependencies\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_matrix_relational extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_matrix_relational\n\t/// @{\n\n\t/// Perform a component-wise equal-to comparison of two matrices.\n\t/// Return a boolean vector which components value is True if this expression is satisfied per column of the matrices.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y);\n\n\t/// Perform a component-wise not-equal-to comparison of two matrices.\n\t/// Return a boolean vector which components value is True if this expression is satisfied per column of the matrices.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y, vec const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y, vec const& epsilon);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y, vec const& ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y, vec const& ULPs);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_relational.inl\"\n"}, {"path": "includes/glm/ext/matrix_transform.hpp", "language": "code", "loc": 131, "comment_density": 0.763, "code": "/// @ref ext_matrix_transform\n/// @file glm/ext/matrix_transform.hpp\n///\n/// @defgroup ext_matrix_transform GLM_EXT_matrix_transform\n/// @ingroup ext\n///\n/// Defines functions that generate common transformation matrices.\n///\n/// The matrices generated by this extension use standard OpenGL fixed-function\n/// conventions. For example, the lookAt function generates a transform from world\n/// space into the specific eye space that the projective matrix functions\n/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility\n/// specifications defines the particular layout of this eye space.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_matrix_projection\n/// @see ext_matrix_clip_space\n\n#pragma once\n\n// Dependencies\n#include \"../gtc/constants.hpp\"\n#include \"../geometric.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../matrix.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_matrix_transform extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_matrix_transform\n\t/// @{\n\n\t/// Builds an identity matrix.\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType identity();\n\n\t/// Builds a translation 4 * 4 matrix created from a vector of 3 components.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param v Coordinates of a translation vector.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @code\n\t/// #include \n\t/// #include \n\t/// ...\n\t/// glm::mat4 m = glm::translate(glm::mat4(1.0f), glm::vec3(1.0f));\n\t/// // m[0][0] == 1.0f, m[0][1] == 0.0f, m[0][2] == 0.0f, m[0][3] == 0.0f\n\t/// // m[1][0] == 0.0f, m[1][1] == 1.0f, m[1][2] == 0.0f, m[1][3] == 0.0f\n\t/// // m[2][0] == 0.0f, m[2][1] == 0.0f, m[2][2] == 1.0f, m[2][3] == 0.0f\n\t/// // m[3][0] == 1.0f, m[3][1] == 1.0f, m[3][2] == 1.0f, m[3][3] == 1.0f\n\t/// @endcode\n\t///\n\t/// @see - translate(mat<4, 4, T, Q> const& m, T x, T y, T z)\n\t/// @see - translate(vec<3, T, Q> const& v)\n\t/// @see glTranslate man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> translate(\n\t\tmat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);\n\n\t/// Builds a rotation 4 * 4 matrix created from an axis vector and an angle.\n\t///\n\t/// @param m Input matrix multiplied by this rotation matrix.\n\t/// @param angle Rotation angle expressed in radians.\n\t/// @param axis Rotation axis, recommended to be normalized.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)\n\t/// @see - rotate(T angle, vec<3, T, Q> const& v)\n\t/// @see glRotate man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rotate(\n\t\tmat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& axis);\n\n\t/// Builds a scale 4 * 4 matrix created from 3 scalars.\n\t///\n\t/// @param m Input matrix multiplied by this scale matrix.\n\t/// @param v Ratio of scaling for each axis.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - scale(mat<4, 4, T, Q> const& m, T x, T y, T z)\n\t/// @see - scale(vec<3, T, Q> const& v)\n\t/// @see glScale man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> scale(\n\t\tmat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);\n\n\t/// Build a right handed look at view matrix.\n\t///\n\t/// @param eye Position of the camera\n\t/// @param center Position where the camera is looking at\n\t/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> lookAtRH(\n\t\tvec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);\n\n\t/// Build a left handed look at view matrix.\n\t///\n\t/// @param eye Position of the camera\n\t/// @param center Position where the camera is looking at\n\t/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> lookAtLH(\n\t\tvec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);\n\n\t/// Build a look at view matrix based on the default handedness.\n\t///\n\t/// @param eye Position of the camera\n\t/// @param center Position where the camera is looking at\n\t/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)\n\t/// @see gluLookAt man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> lookAt(\n\t\tvec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_transform.inl\"\n"}, {"path": "includes/glm/ext/quaternion_common.hpp", "language": "code", "loc": 107, "comment_density": 0.748, "code": "/// @ref ext_quaternion_common\n/// @file glm/ext/quaternion_common.hpp\n///\n/// @defgroup ext_quaternion_common GLM_EXT_quaternion_common\n/// @ingroup ext\n///\n/// Provides common functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_scalar_common\n/// @see ext_vector_common\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_trigonometric\n/// @see ext_quaternion_transform\n\n#pragma once\n\n// Dependency:\n#include \"../ext/scalar_constants.hpp\"\n#include \"../ext/quaternion_geometric.hpp\"\n#include \"../common.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../exponential.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_common extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_common\n\t/// @{\n\n\t/// Spherical linear interpolation of two quaternions.\n\t/// The interpolation is oriented and the rotation is performed at constant speed.\n\t/// For short path spherical linear interpolation, use the slerp function.\n\t///\n\t/// @param x A quaternion\n\t/// @param y A quaternion\n\t/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - slerp(qua const& x, qua const& y, T const& a)\n\ttemplate\n\tGLM_FUNC_DECL qua mix(qua const& x, qua const& y, T a);\n\n\t/// Linear interpolation of two quaternions.\n\t/// The interpolation is oriented.\n\t///\n\t/// @param x A quaternion\n\t/// @param y A quaternion\n\t/// @param a Interpolation factor. The interpolation is defined in the range [0, 1].\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua lerp(qua const& x, qua const& y, T a);\n\n\t/// Spherical linear interpolation of two quaternions.\n\t/// The interpolation always take the short path and the rotation is performed at constant speed.\n\t///\n\t/// @param x A quaternion\n\t/// @param y A quaternion\n\t/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua slerp(qua const& x, qua const& y, T a);\n\n\t/// Returns the q conjugate.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua conjugate(qua const& q);\n\n\t/// Returns the q inverse.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua inverse(qua const& q);\n\n\t/// Returns true if x holds a NaN (not a number)\n\t/// representation in the underlying implementation's set of\n\t/// floating point representations. Returns false otherwise,\n\t/// including for implementations with no NaN\n\t/// representations.\n\t///\n\t/// /!\\ When using compiler fast math, this function may fail.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> isnan(qua const& x);\n\n\t/// Returns true if x holds a positive infinity or negative\n\t/// infinity representation in the underlying implementation's\n\t/// set of floating point representations. Returns false\n\t/// otherwise, including for implementations with no infinity\n\t/// representations.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> isinf(qua const& x);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_common.inl\"\n"}, {"path": "includes/glm/ext/quaternion_double.hpp", "language": "code", "loc": 32, "comment_density": 0.75, "code": "/// @ref ext_quaternion_double\n/// @file glm/ext/quaternion_double.hpp\n///\n/// @defgroup ext_quaternion_double GLM_EXT_quaternion_double\n/// @ingroup ext\n///\n/// Exposes double-precision floating point quaternion type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double_precision\n/// @see ext_quaternion_common\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_transform\n/// @see ext_quaternion_trigonometric\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_quat.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_double extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_double\n\t/// @{\n\n\t/// Quaternion of double-precision floating-point numbers.\n\ttypedef qua\t\tdquat;\n\n\t/// @}\n} //namespace glm\n\n"}, {"path": "includes/glm/ext/quaternion_double_precision.hpp", "language": "code", "loc": 33, "comment_density": 0.697, "code": "/// @ref ext_quaternion_double_precision\n/// @file glm/ext/quaternion_double_precision.hpp\n///\n/// @defgroup ext_quaternion_double_precision GLM_EXT_quaternion_double_precision\n/// @ingroup ext\n///\n/// Exposes double-precision floating point quaternion type with various precision in term of ULPs.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_quat.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_double_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_double_precision\n\t/// @{\n\n\t/// Quaternion of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see ext_quaternion_double_precision\n\ttypedef qua\t\tlowp_dquat;\n\n\t/// Quaternion of medium double-qualifier floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see ext_quaternion_double_precision\n\ttypedef qua\tmediump_dquat;\n\n\t/// Quaternion of high double-qualifier floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see ext_quaternion_double_precision\n\ttypedef qua\t\thighp_dquat;\n\n\t/// @}\n} //namespace glm\n\n"}, {"path": "includes/glm/ext/quaternion_exponential.hpp", "language": "code", "loc": 53, "comment_density": 0.642, "code": "/// @ref ext_quaternion_exponential\n/// @file glm/ext/quaternion_exponential.hpp\n///\n/// @defgroup ext_quaternion_exponential GLM_EXT_quaternion_exponential\n/// @ingroup ext\n///\n/// Provides exponential functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see core_exponential\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n\n#pragma once\n\n// Dependency:\n#include \"../common.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../geometric.hpp\"\n#include \"../ext/scalar_constants.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_exponential extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_transform\n\t/// @{\n\n\t/// Returns a exponential of a quaternion.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua exp(qua const& q);\n\n\t/// Returns a logarithm of a quaternion\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua log(qua const& q);\n\n\t/// Returns a quaternion raised to a power.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua pow(qua const& q, T y);\n\n\t/// Returns the square root of a quaternion\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua sqrt(qua const& q);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_exponential.inl\"\n"}, {"path": "includes/glm/ext/quaternion_float.hpp", "language": "code", "loc": 32, "comment_density": 0.75, "code": "/// @ref ext_quaternion_float\n/// @file glm/ext/quaternion_float.hpp\n///\n/// @defgroup ext_quaternion_float GLM_EXT_quaternion_float\n/// @ingroup ext\n///\n/// Exposes single-precision floating point quaternion type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_quaternion_double\n/// @see ext_quaternion_float_precision\n/// @see ext_quaternion_common\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_transform\n/// @see ext_quaternion_trigonometric\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_quat.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_float extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_float\n\t/// @{\n\n\t/// Quaternion of single-precision floating-point numbers.\n\ttypedef qua\t\tquat;\n\n\t/// @}\n} //namespace glm\n\n"}, {"path": "includes/glm/ext/quaternion_float_precision.hpp", "language": "code", "loc": 27, "comment_density": 0.63, "code": "/// @ref ext_quaternion_float_precision\n/// @file glm/ext/quaternion_float_precision.hpp\n///\n/// @defgroup ext_quaternion_float_precision GLM_EXT_quaternion_float_precision\n/// @ingroup ext\n///\n/// Exposes single-precision floating point quaternion type with various precision in term of ULPs.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_quat.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_float_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_float_precision\n\t/// @{\n\n\t/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef qua\t\tlowp_quat;\n\n\t/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef qua\t\tmediump_quat;\n\n\t/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef qua\t\thighp_quat;\n\n\t/// @}\n} //namespace glm\n\n"}, {"path": "includes/glm/ext/quaternion_geometric.hpp", "language": "code", "loc": 60, "comment_density": 0.7, "code": "/// @ref ext_quaternion_geometric\n/// @file glm/ext/quaternion_geometric.hpp\n///\n/// @defgroup ext_quaternion_geometric GLM_EXT_quaternion_geometric\n/// @ingroup ext\n///\n/// Provides geometric functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see core_geometric\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n\n#pragma once\n\n// Dependency:\n#include \"../geometric.hpp\"\n#include \"../exponential.hpp\"\n#include \"../ext/vector_relational.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_geometric extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_geometric\n\t/// @{\n\n\t/// Returns the norm of a quaternions\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_geometric\n\ttemplate\n\tGLM_FUNC_DECL T length(qua const& q);\n\n\t/// Returns the normalized quaternion.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_geometric\n\ttemplate\n\tGLM_FUNC_DECL qua normalize(qua const& q);\n\n\t/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_geometric\n\ttemplate\n\tGLM_FUNC_DECL T dot(qua const& x, qua const& y);\n\n\t/// Compute a cross product.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_geometric\n\ttemplate\n\tGLM_FUNC_QUALIFIER qua cross(qua const& q1, qua const& q2);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_geometric.inl\"\n"}, {"path": "includes/glm/ext/quaternion_relational.hpp", "language": "code", "loc": 52, "comment_density": 0.692, "code": "/// @ref ext_quaternion_relational\n/// @file glm/ext/quaternion_relational.hpp\n///\n/// @defgroup ext_quaternion_relational GLM_EXT_quaternion_relational\n/// @ingroup ext\n///\n/// Exposes comparison functions for quaternion types that take a user defined epsilon values.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_vector_relational\n/// @see ext_vector_relational\n/// @see ext_matrix_relational\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n\n#pragma once\n\n// Dependency:\n#include \"../vector_relational.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_relational extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_relational\n\t/// @{\n\n\t/// Returns the component-wise comparison of result x == y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> equal(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> equal(qua const& x, qua const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of result x != y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> notEqual(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> notEqual(qua const& x, qua const& y, T epsilon);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_relational.inl\"\n"}, {"path": "includes/glm/ext/quaternion_transform.hpp", "language": "code", "loc": 41, "comment_density": 0.707, "code": "/// @ref ext_quaternion_transform\n/// @file glm/ext/quaternion_transform.hpp\n///\n/// @defgroup ext_quaternion_transform GLM_EXT_quaternion_transform\n/// @ingroup ext\n///\n/// Provides transformation functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_trigonometric\n\n#pragma once\n\n// Dependency:\n#include \"../common.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../geometric.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_transform extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_transform\n\t/// @{\n\n\t/// Rotates a quaternion from a vector of 3 components axis and an angle.\n\t///\n\t/// @param q Source orientation\n\t/// @param angle Angle expressed in radians.\n\t/// @param axis Axis of the rotation\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua rotate(qua const& q, T const& angle, vec<3, T, Q> const& axis);\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_transform.inl\"\n"}, {"path": "includes/glm/ext/quaternion_trigonometric.hpp", "language": "code", "loc": 54, "comment_density": 0.667, "code": "/// @ref ext_quaternion_trigonometric\n/// @file glm/ext/quaternion_trigonometric.hpp\n///\n/// @defgroup ext_quaternion_trigonometric GLM_EXT_quaternion_trigonometric\n/// @ingroup ext\n///\n/// Provides trigonometric functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_transform\n\n#pragma once\n\n// Dependency:\n#include \"../trigonometric.hpp\"\n#include \"../exponential.hpp\"\n#include \"scalar_constants.hpp\"\n#include \"vector_relational.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_trigonometric extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_trigonometric\n\t/// @{\n\n\t/// Returns the quaternion rotation angle.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL T angle(qua const& x);\n\n\t/// Returns the q rotation axis.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> axis(qua const& x);\n\n\t/// Build a quaternion from an angle and a normalized axis.\n\t///\n\t/// @param angle Angle expressed in radians.\n\t/// @param axis Axis of the quaternion, must be normalized.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua angleAxis(T const& angle, vec<3, T, Q> const& axis);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_trigonometric.inl\"\n"}, {"path": "includes/glm/ext/scalar_common.hpp", "language": "code", "loc": 87, "comment_density": 0.678, "code": "/// @ref ext_scalar_common\n/// @file glm/ext/scalar_common.hpp\n///\n/// @defgroup ext_scalar_common GLM_EXT_scalar_common\n/// @ingroup ext\n///\n/// Exposes min and max functions for 3 to 4 scalar parameters.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_func_common\n/// @see ext_vector_common\n\n#pragma once\n\n// Dependency:\n#include \"../common.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_common extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_scalar_common\n\t/// @{\n\n\t/// Returns the minimum component-wise values of 3 inputs\n\t///\n\t/// @tparam T A floating-point scalar type.\n\ttemplate\n\tGLM_FUNC_DECL T min(T a, T b, T c);\n\n\t/// Returns the minimum component-wise values of 4 inputs\n\t///\n\t/// @tparam T A floating-point scalar type.\n\ttemplate\n\tGLM_FUNC_DECL T min(T a, T b, T c, T d);\n\n\t/// Returns the maximum component-wise values of 3 inputs\n\t///\n\t/// @tparam T A floating-point scalar type.\n\ttemplate\n\tGLM_FUNC_DECL T max(T a, T b, T c);\n\n\t/// Returns the maximum component-wise values of 4 inputs\n\t///\n\t/// @tparam T A floating-point scalar type.\n\ttemplate\n\tGLM_FUNC_DECL T max(T a, T b, T c, T d);\n\n\t/// Returns the minimum component-wise values of 2 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmin(T a, T b);\n\n\t/// Returns the minimum component-wise values of 3 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmin(T a, T b, T c);\n\n\t/// Returns the minimum component-wise values of 4 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmin(T a, T b, T c, T d);\n\n\t/// Returns the maximum component-wise values of 2 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmax(T a, T b);\n\n\t/// Returns the maximum component-wise values of 3 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmax(T a, T b, T C);\n\n\t/// Returns the maximum component-wise values of 4 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmax(T a, T b, T C, T D);\n\n\t/// @}\n}//namespace glm\n\n#include \"scalar_common.inl\"\n"}, {"path": "includes/glm/ext/scalar_constants.hpp", "language": "code", "loc": 28, "comment_density": 0.571, "code": "/// @ref ext_scalar_constants\n/// @file glm/ext/scalar_constants.hpp\n///\n/// @defgroup ext_scalar_constants GLM_EXT_scalar_constants\n/// @ingroup ext\n///\n/// Provides a list of constants and precomputed useful values.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_constants extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_scalar_constants\n\t/// @{\n\n\t/// Return the epsilon constant for floating point types.\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType epsilon();\n\n\t/// Return the pi constant for floating point types.\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType pi();\n\n\t/// @}\n} //namespace glm\n\n#include \"scalar_constants.inl\"\n"}, {"path": "includes/glm/ext/scalar_int_sized.hpp", "language": "code", "loc": 56, "comment_density": 0.375, "code": "/// @ref ext_scalar_int_sized\n/// @file glm/ext/scalar_int_sized.hpp\n///\n/// @defgroup ext_scalar_int_sized GLM_EXT_scalar_int_sized\n/// @ingroup ext\n///\n/// Exposes sized signed integer scalar types.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_scalar_uint_sized\n\n#pragma once\n\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_int_sized extension included\")\n#endif\n\nnamespace glm{\nnamespace detail\n{\n#\tif GLM_HAS_EXTENDED_INTEGER_TYPE\n\t\ttypedef std::int8_t\t\t\tint8;\n\t\ttypedef std::int16_t\t\tint16;\n\t\ttypedef std::int32_t\t\tint32;\n#\telse\n\t\ttypedef char\t\t\t\tint8;\n\t\ttypedef short\t\t\t\tint16;\n\t\ttypedef int\t\t\t\t\tint32;\n#endif//\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n}//namespace detail\n\n\n\t/// @addtogroup ext_scalar_int_sized\n\t/// @{\n\n\t/// 8 bit signed integer type.\n\ttypedef detail::int8\t\tint8;\n\n\t/// 16 bit signed integer type.\n\ttypedef detail::int16\t\tint16;\n\n\t/// 32 bit signed integer type.\n\ttypedef detail::int32\t\tint32;\n\n\t/// 64 bit signed integer type.\n\ttypedef detail::int64\t\tint64;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/scalar_relational.hpp", "language": "code", "loc": 56, "comment_density": 0.714, "code": "/// @ref ext_scalar_relational\n/// @file glm/ext/scalar_relational.hpp\n///\n/// @defgroup ext_scalar_relational GLM_EXT_scalar_relational\n/// @ingroup ext\n///\n/// Exposes comparison functions for scalar types that take a user defined epsilon values.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_vector_relational\n/// @see ext_vector_relational\n/// @see ext_matrix_relational\n\n#pragma once\n\n// Dependencies\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_relational extension included\")\n#endif\n\nnamespace glm\n{\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam genType Floating-point or integer scalar types\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool equal(genType const& x, genType const& y, genType const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam genType Floating-point or integer scalar types\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, genType const& epsilon);\n\n\t/// Returns the component-wise comparison between two scalars in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @param x First operand.\n\t/// @param y Second operand.\n\t/// @param ULPs Maximum difference in ULPs between the two operators to consider them equal.\n\t///\n\t/// @tparam genType Floating-point or integer scalar types\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool equal(genType const& x, genType const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two scalars in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @param x First operand.\n\t/// @param y Second operand.\n\t/// @param ULPs Maximum difference in ULPs between the two operators to consider them not equal.\n\t///\n\t/// @tparam genType Floating-point or integer scalar types\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, int ULPs);\n\n\t/// @}\n}//namespace glm\n\n#include \"scalar_relational.inl\"\n"}, {"path": "includes/glm/ext/scalar_uint_sized.hpp", "language": "code", "loc": 56, "comment_density": 0.357, "code": "/// @ref ext_scalar_uint_sized\n/// @file glm/ext/scalar_uint_sized.hpp\n///\n/// @defgroup ext_scalar_uint_sized GLM_EXT_scalar_uint_sized\n/// @ingroup ext\n///\n/// Exposes sized unsigned integer scalar types.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_scalar_int_sized\n\n#pragma once\n\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_uint_sized extension included\")\n#endif\n\nnamespace glm{\nnamespace detail\n{\n#\tif GLM_HAS_EXTENDED_INTEGER_TYPE\n\t\ttypedef std::uint8_t\t\tuint8;\n\t\ttypedef std::uint16_t\t\tuint16;\n\t\ttypedef std::uint32_t\t\tuint32;\n#\telse\n\t\ttypedef unsigned char\t\tuint8;\n\t\ttypedef unsigned short\t\tuint16;\n\t\ttypedef unsigned int\t\tuint32;\n#endif\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n}//namespace detail\n\n\n\t/// @addtogroup ext_scalar_uint_sized\n\t/// @{\n\n\t/// 8 bit unsigned integer type.\n\ttypedef detail::uint8\t\tuint8;\n\n\t/// 16 bit unsigned integer type.\n\ttypedef detail::uint16\t\tuint16;\n\n\t/// 32 bit unsigned integer type.\n\ttypedef detail::uint32\t\tuint32;\n\n\t/// 64 bit unsigned integer type.\n\ttypedef detail::uint64\t\tuint64;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/scalar_ulp.hpp", "language": "code", "loc": 63, "comment_density": 0.683, "code": "/// @ref ext_scalar_ulp\n/// @file glm/ext/scalar_ulp.hpp\n///\n/// @defgroup ext_scalar_ulp GLM_EXT_scalar_ulp\n/// @ingroup ext\n///\n/// Allow the measurement of the accuracy of a function against a reference\n/// implementation. This extension works on floating-point data and provide results\n/// in ULP.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_ulp\n/// @see ext_scalar_relational\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_int_sized.hpp\"\n#include \"../common.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_ulp extension included\")\n#endif\n\nnamespace glm\n{\n\t/// Return the next ULP value(s) after the input value(s).\n\t///\n\t/// @tparam genType A floating-point scalar type.\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL genType next_float(genType x);\n\n\t/// Return the previous ULP value(s) before the input value(s).\n\t///\n\t/// @tparam genType A floating-point scalar type.\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL genType prev_float(genType x);\n\n\t/// Return the value(s) ULP distance after the input value(s).\n\t///\n\t/// @tparam genType A floating-point scalar type.\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL genType next_float(genType x, int ULPs);\n\n\t/// Return the value(s) ULP distance before the input value(s).\n\t///\n\t/// @tparam genType A floating-point scalar type.\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL genType prev_float(genType x, int ULPs);\n\n\t/// Return the distance in the number of ULP between 2 single-precision floating-point scalars.\n\t///\n\t/// @see ext_scalar_ulp\n\tGLM_FUNC_DECL int float_distance(float x, float y);\n\n\t/// Return the distance in the number of ULP between 2 double-precision floating-point scalars.\n\t///\n\t/// @see ext_scalar_ulp\n\tGLM_FUNC_DECL int64 float_distance(double x, double y);\n\n\t/// @}\n}//namespace glm\n\n#include \"scalar_ulp.inl\"\n"}, {"path": "includes/glm/ext/vector_bool1.hpp", "language": "code", "loc": 24, "comment_density": 0.667, "code": "/// @ref ext_vector_bool1\n/// @file glm/ext/vector_bool1.hpp\n///\n/// @defgroup ext_vector_bool1 GLM_EXT_vector_bool1\n/// @ingroup ext\n///\n/// Exposes bvec1 vector type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_bool1_precision extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_bool1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_bool1\n\t/// @{\n\n\t/// 1 components vector of boolean.\n\ttypedef vec<1, bool, defaultp>\t\tbvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool1_precision.hpp", "language": "code", "loc": 26, "comment_density": 0.615, "code": "/// @ref ext_vector_bool1_precision\n/// @file glm/ext/vector_bool1_precision.hpp\n///\n/// @defgroup ext_vector_bool1_precision GLM_EXT_vector_bool1_precision\n/// @ingroup ext\n///\n/// Exposes highp_bvec1, mediump_bvec1 and lowp_bvec1 types.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_bool1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_bool1_precision\n\t/// @{\n\n\t/// 1 component vector of bool values.\n\ttypedef vec<1, bool, highp>\t\t\thighp_bvec1;\n\n\t/// 1 component vector of bool values.\n\ttypedef vec<1, bool, mediump>\t\tmediump_bvec1;\n\n\t/// 1 component vector of bool values.\n\ttypedef vec<1, bool, lowp>\t\t\tlowp_bvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_bool2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of boolean.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, bool, defaultp>\t\tbvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_bool2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, bool, highp>\t\thighp_bvec2;\n\n\t/// 2 components vector of medium qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, bool, mediump>\tmediump_bvec2;\n\n\t/// 2 components vector of low qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, bool, lowp>\t\tlowp_bvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_bool3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of boolean.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, bool, defaultp>\t\tbvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_bool3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, bool, highp>\t\thighp_bvec3;\n\n\t/// 3 components vector of medium qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, bool, mediump>\tmediump_bvec3;\n\n\t/// 3 components vector of low qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, bool, lowp>\t\tlowp_bvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_bool4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of boolean.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, bool, defaultp>\t\tbvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_bool4_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, bool, highp>\t\thighp_bvec4;\n\n\t/// 4 components vector of medium qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, bool, mediump>\tmediump_bvec4;\n\n\t/// 4 components vector of low qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, bool, lowp>\t\tlowp_bvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_common.hpp", "language": "code", "loc": 126, "comment_density": 0.738, "code": "/// @ref ext_vector_common\n/// @file glm/ext/vector_common.hpp\n///\n/// @defgroup ext_vector_common GLM_EXT_vector_common\n/// @ingroup ext\n///\n/// Exposes min and max functions for 3 to 4 vector parameters.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_common\n/// @see ext_scalar_common\n\n#pragma once\n\n// Dependency:\n#include \"../ext/scalar_common.hpp\"\n#include \"../common.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_common extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_common\n\t/// @{\n\n\t/// Return the minimum component-wise values of 3 inputs\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& a, vec const& b, vec const& c);\n\n\t/// Return the minimum component-wise values of 4 inputs\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& a, vec const& b, vec const& c, vec const& d);\n\n\t/// Return the maximum component-wise values of 3 inputs\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec max(vec const& x, vec const& y, vec const& z);\n\n\t/// Return the maximum component-wise values of 4 inputs\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec max( vec const& x, vec const& y, vec const& z, vec const& w);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmin(vec const& x, T y);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmin(vec const& x, vec const& y);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmin(vec const& a, vec const& b, vec const& c);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmin(vec const& a, vec const& b, vec const& c, vec const& d);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmax(vec const& a, T b);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmax(vec const& a, vec const& b);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmax(vec const& a, vec const& b, vec const& c);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmax(vec const& a, vec const& b, vec const& c, vec const& d);\n\n\t/// @}\n}//namespace glm\n\n#include \"vector_common.inl\"\n"}, {"path": "includes/glm/ext/vector_double1.hpp", "language": "code", "loc": 25, "comment_density": 0.68, "code": "/// @ref ext_vector_double1\n/// @file glm/ext/vector_double1.hpp\n///\n/// @defgroup ext_vector_double1 GLM_EXT_vector_double1\n/// @ingroup ext\n///\n/// Exposes double-precision floating point vector type with one component.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_double1_precision extension.\n/// @see ext_vector_float1 extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_dvec1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_double1\n\t/// @{\n\n\t/// 1 components vector of double-precision floating-point numbers.\n\ttypedef vec<1, double, defaultp>\t\tdvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double1_precision.hpp", "language": "code", "loc": 28, "comment_density": 0.643, "code": "/// @ref ext_vector_double1_precision\n/// @file glm/ext/vector_double1_precision.hpp\n///\n/// @defgroup ext_vector_double1_precision GLM_EXT_vector_double1_precision\n/// @ingroup ext\n///\n/// Exposes highp_dvec1, mediump_dvec1 and lowp_dvec1 types.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_double1\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_double1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_double1_precision\n\t/// @{\n\n\t/// 1 component vector of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, highp>\t\thighp_dvec1;\n\n\t/// 1 component vector of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, mediump>\t\tmediump_dvec1;\n\n\t/// 1 component vector of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, lowp>\t\tlowp_dvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_double2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, double, defaultp>\t\tdvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_double2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high double-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, double, highp>\t\thighp_dvec2;\n\n\t/// 2 components vector of medium double-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, double, mediump>\t\tmediump_dvec2;\n\n\t/// 2 components vector of low double-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, double, lowp>\t\tlowp_dvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_double3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, double, defaultp>\t\tdvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double3_precision.hpp", "language": "code", "loc": 28, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/vector_double3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, double, highp>\t\thighp_dvec3;\n\n\t/// 3 components vector of medium double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, double, mediump>\t\tmediump_dvec3;\n\n\t/// 3 components vector of low double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, double, lowp>\t\tlowp_dvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_double4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, double, defaultp>\t\tdvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double4_precision.hpp", "language": "code", "loc": 29, "comment_density": 0.724, "code": "/// @ref core\n/// @file glm/ext/vector_double4_precision.hpp\n\n#pragma once\n#include \"../detail/setup.hpp\"\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, double, highp>\t\thighp_dvec4;\n\n\t/// 4 components vector of medium double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, double, mediump>\t\tmediump_dvec4;\n\n\t/// 4 components vector of low double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, double, lowp>\t\tlowp_dvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float1.hpp", "language": "code", "loc": 25, "comment_density": 0.68, "code": "/// @ref ext_vector_float1\n/// @file glm/ext/vector_float1.hpp\n///\n/// @defgroup ext_vector_float1 GLM_EXT_vector_float1\n/// @ingroup ext\n///\n/// Exposes single-precision floating point vector type with one component.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_float1_precision extension.\n/// @see ext_vector_double1 extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_float1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_float1\n\t/// @{\n\n\t/// 1 components vector of single-precision floating-point numbers.\n\ttypedef vec<1, float, defaultp>\t\tvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float1_precision.hpp", "language": "code", "loc": 28, "comment_density": 0.643, "code": "/// @ref ext_vector_float1_precision\n/// @file glm/ext/vector_float1_precision.hpp\n///\n/// @defgroup ext_vector_float1_precision GLM_EXT_vector_float1_precision\n/// @ingroup ext\n///\n/// Exposes highp_vec1, mediump_vec1 and lowp_vec1 types.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_float1 extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_float1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_float1_precision\n\t/// @{\n\n\t/// 1 component vector of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, highp>\t\thighp_vec1;\n\n\t/// 1 component vector of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, mediump>\t\tmediump_vec1;\n\n\t/// 1 component vector of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, lowp>\t\t\tlowp_vec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_float2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, float, defaultp>\tvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_float2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, float, highp>\t\thighp_vec2;\n\n\t/// 2 components vector of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, float, mediump>\t\tmediump_vec2;\n\n\t/// 2 components vector of low single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, float, lowp>\t\t\tlowp_vec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_float3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, float, defaultp>\t\tvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_float3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, float, highp>\t\thighp_vec3;\n\n\t/// 3 components vector of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, float, mediump>\t\tmediump_vec3;\n\n\t/// 3 components vector of low single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, float, lowp>\t\t\tlowp_vec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_float4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, float, defaultp>\t\tvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_float4_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, float, highp>\t\thighp_vec4;\n\n\t/// 4 components vector of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, float, mediump>\t\tmediump_vec4;\n\n\t/// 4 components vector of low single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, float, lowp>\t\t\tlowp_vec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int1.hpp", "language": "code", "loc": 25, "comment_density": 0.68, "code": "/// @ref ext_vector_int1\n/// @file glm/ext/vector_int1.hpp\n///\n/// @defgroup ext_vector_int1 GLM_EXT_vector_int1\n/// @ingroup ext\n///\n/// Exposes ivec1 vector type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_uint1 extension.\n/// @see ext_vector_int1_precision extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_int1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_int1\n\t/// @{\n\n\t/// 1 component vector of signed integer numbers.\n\ttypedef vec<1, int, defaultp>\t\t\tivec1;\n\n\t/// @}\n}//namespace glm\n\n"}, {"path": "includes/glm/ext/vector_int1_precision.hpp", "language": "code", "loc": 26, "comment_density": 0.615, "code": "/// @ref ext_vector_int1_precision\n/// @file glm/ext/vector_int1_precision.hpp\n///\n/// @defgroup ext_vector_int1_precision GLM_EXT_vector_int1_precision\n/// @ingroup ext\n///\n/// Exposes highp_ivec1, mediump_ivec1 and lowp_ivec1 types.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_int1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_int1_precision\n\t/// @{\n\n\t/// 1 component vector of signed integer values.\n\ttypedef vec<1, int, highp>\t\t\thighp_ivec1;\n\n\t/// 1 component vector of signed integer values.\n\ttypedef vec<1, int, mediump>\t\tmediump_ivec1;\n\n\t/// 1 component vector of signed integer values.\n\ttypedef vec<1, int, lowp>\t\t\tlowp_ivec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_int2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, int, defaultp>\t\tivec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_int2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, int, highp>\t\thighp_ivec2;\n\n\t/// 2 components vector of medium qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, int, mediump>\tmediump_ivec2;\n\n\t/// 2 components vector of low qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, int, lowp>\t\tlowp_ivec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_int3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, int, defaultp>\t\tivec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_int3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, int, highp>\t\thighp_ivec3;\n\n\t/// 3 components vector of medium qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, int, mediump>\tmediump_ivec3;\n\n\t/// 3 components vector of low qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, int, lowp>\t\tlowp_ivec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_int4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, int, defaultp>\t\tivec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_int4_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, int, highp>\t\thighp_ivec4;\n\n\t/// 4 components vector of medium qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, int, mediump>\tmediump_ivec4;\n\n\t/// 4 components vector of low qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, int, lowp>\t\tlowp_ivec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_relational.hpp", "language": "code", "loc": 90, "comment_density": 0.733, "code": "/// @ref ext_vector_relational\n/// @file glm/ext/vector_relational.hpp\n///\n/// @defgroup ext_vector_relational GLM_EXT_vector_relational\n/// @ingroup ext\n///\n/// Exposes comparison functions for vector types that take a user defined epsilon values.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_vector_relational\n/// @see ext_scalar_relational\n/// @see ext_matrix_relational\n\n#pragma once\n\n// Dependencies\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_relational extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_relational\n\t/// @{\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y, vec const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, vec const& epsilon);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y, vec const& ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, vec const& ULPs);\n\n\t/// @}\n}//namespace glm\n\n#include \"vector_relational.inl\"\n"}, {"path": "includes/glm/ext/vector_uint1.hpp", "language": "code", "loc": 25, "comment_density": 0.68, "code": "/// @ref ext_vector_uint1\n/// @file glm/ext/vector_uint1.hpp\n///\n/// @defgroup ext_vector_uint1 GLM_EXT_vector_uint1\n/// @ingroup ext\n///\n/// Exposes uvec1 vector type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_int1 extension.\n/// @see ext_vector_uint1_precision extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_uint1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_uint1\n\t/// @{\n\n\t/// 1 component vector of unsigned integer numbers.\n\ttypedef vec<1, unsigned int, defaultp>\t\t\tuvec1;\n\n\t/// @}\n}//namespace glm\n\n"}, {"path": "includes/glm/ext/vector_uint1_precision.hpp", "language": "code", "loc": 32, "comment_density": 0.688, "code": "/// @ref ext_vector_uint1_precision\n/// @file glm/ext/vector_uint1_precision.hpp\n///\n/// @defgroup ext_vector_uint1_precision GLM_EXT_vector_uint1_precision\n/// @ingroup ext\n///\n/// Exposes highp_uvec1, mediump_uvec1 and lowp_uvec1 types.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_uint1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_uint1_precision\n\t/// @{\n\n\t/// 1 component vector of unsigned integer values.\n\t///\n\t/// @see ext_vector_uint1_precision\n\ttypedef vec<1, unsigned int, highp>\t\t\thighp_uvec1;\n\n\t/// 1 component vector of unsigned integer values.\n\t///\n\t/// @see ext_vector_uint1_precision\n\ttypedef vec<1, unsigned int, mediump>\t\tmediump_uvec1;\n\n\t/// 1 component vector of unsigned integer values.\n\t///\n\t/// @see ext_vector_uint1_precision\n\ttypedef vec<1, unsigned int, lowp>\t\t\tlowp_uvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_uint2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, unsigned int, defaultp>\t\tuvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_uint2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, unsigned int, highp>\t\thighp_uvec2;\n\n\t/// 2 components vector of medium qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, unsigned int, mediump>\tmediump_uvec2;\n\n\t/// 2 components vector of low qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, unsigned int, lowp>\t\tlowp_uvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_uint3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, unsigned int, defaultp>\t\tuvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_uint3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, unsigned int, highp>\t\thighp_uvec3;\n\n\t/// 3 components vector of medium qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, unsigned int, mediump>\tmediump_uvec3;\n\n\t/// 3 components vector of low qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, unsigned int, lowp>\t\tlowp_uvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_uint4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, unsigned int, defaultp>\t\tuvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_uint4_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, unsigned int, highp>\t\thighp_uvec4;\n\n\t/// 4 components vector of medium qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, unsigned int, mediump>\tmediump_uvec4;\n\n\t/// 4 components vector of low qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, unsigned int, lowp>\t\tlowp_uvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_ulp.hpp", "language": "code", "loc": 96, "comment_density": 0.75, "code": "/// @ref ext_vector_ulp\n/// @file glm/ext/vector_ulp.hpp\n///\n/// @defgroup ext_vector_ulp GLM_EXT_vector_ulp\n/// @ingroup ext\n///\n/// Allow the measurement of the accuracy of a function against a reference\n/// implementation. This extension works on floating-point data and provide results\n/// in ULP.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_scalar_ulp\n/// @see ext_scalar_relational\n/// @see ext_vector_relational\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_ulp.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_ulp extension included\")\n#endif\n\nnamespace glm\n{\n\t/// Return the next ULP value(s) after the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec next_float(vec const& x);\n\n\t/// Return the value(s) ULP distance after the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec next_float(vec const& x, int ULPs);\n\n\t/// Return the value(s) ULP distance after the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec next_float(vec const& x, vec const& ULPs);\n\n\t/// Return the previous ULP value(s) before the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec prev_float(vec const& x);\n\n\t/// Return the value(s) ULP distance before the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec prev_float(vec const& x, int ULPs);\n\n\t/// Return the value(s) ULP distance before the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec prev_float(vec const& x, vec const& ULPs);\n\n\t/// Return the distance in the number of ULP between 2 single-precision floating-point scalars.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec float_distance(vec const& x, vec const& y);\n\n\t/// Return the distance in the number of ULP between 2 double-precision floating-point scalars.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec float_distance(vec const& x, vec const& y);\n\n\t/// @}\n}//namespace glm\n\n#include \"vector_ulp.inl\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.682, "dedup_hash": "e26180dfeedd64ff", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_gtc", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Gtc", "api": "OpenGL Core", "glsl_version": null, "topic": "postprocessing/texturing/bumpmapping/vegetation/procedural", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/gtc/bitfield.hpp", "language": "code", "loc": 227, "comment_density": 0.753, "code": "/// @ref gtc_bitfield\n/// @file glm/gtc/bitfield.hpp\n///\n/// @see core (dependence)\n/// @see gtc_bitfield (dependence)\n///\n/// @defgroup gtc_bitfield GLM_GTC_bitfield\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Allow to perform bit operations on integer values\n\n#include \"../detail/setup.hpp\"\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_int_sized.hpp\"\n#include \"../ext/scalar_uint_sized.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../detail/_vectorize.hpp\"\n#include \"type_precision.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_bitfield extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_bitfield\n\t/// @{\n\n\t/// Build a mask of 'count' bits\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType mask(genIUType Bits);\n\n\t/// Build a mask of 'count' bits\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec mask(vec const& v);\n\n\t/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType bitfieldRotateRight(genIUType In, int Shift);\n\n\t/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldRotateRight(vec const& In, int Shift);\n\n\t/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType bitfieldRotateLeft(genIUType In, int Shift);\n\n\t/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldRotateLeft(vec const& In, int Shift);\n\n\t/// Set to 1 a range of bits.\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount);\n\n\t/// Set to 1 a range of bits.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldFillOne(vec const& Value, int FirstBit, int BitCount);\n\n\t/// Set to 0 a range of bits.\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount);\n\n\t/// Set to 0 a range of bits.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldFillZero(vec const& Value, int FirstBit, int BitCount);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int16 bitfieldInterleave(int8 x, int8 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint16 bitfieldInterleave(uint8 x, uint8 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of v.x followed by the first bit of v.y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint16 bitfieldInterleave(u8vec2 const& v);\n\n\t/// Deinterleaves the bits of x.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL glm::u8vec2 bitfieldDeinterleave(glm::uint16 x);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int32 bitfieldInterleave(int16 x, int16 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint32 bitfieldInterleave(uint16 x, uint16 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of v.x followed by the first bit of v.y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint32 bitfieldInterleave(u16vec2 const& v);\n\n\t/// Deinterleaves the bits of x.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL glm::u16vec2 bitfieldDeinterleave(glm::uint32 x);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of v.x followed by the first bit of v.y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(u32vec2 const& v);\n\n\t/// Deinterleaves the bits of x.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL glm::u32vec2 bitfieldDeinterleave(glm::uint64 x);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y, int32 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z);\n\n\t/// Interleaves the bits of x, y, z and w.\n\t/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w);\n\n\t/// Interleaves the bits of x, y, z and w.\n\t/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w);\n\n\t/// Interleaves the bits of x, y, z and w.\n\t/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w);\n\n\t/// Interleaves the bits of x, y, z and w.\n\t/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w);\n\n\t/// @}\n} //namespace glm\n\n#include \"bitfield.inl\"\n"}, {"path": "includes/glm/gtc/color_space.hpp", "language": "code", "loc": 46, "comment_density": 0.543, "code": "/// @ref gtc_color_space\n/// @file glm/gtc/color_space.hpp\n///\n/// @see core (dependence)\n/// @see gtc_color_space (dependence)\n///\n/// @defgroup gtc_color_space GLM_GTC_color_space\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../exponential.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_color_space extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_color_space\n\t/// @{\n\n\t/// Convert a linear color to sRGB color using a standard gamma correction.\n\t/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb\n\ttemplate\n\tGLM_FUNC_DECL vec convertLinearToSRGB(vec const& ColorLinear);\n\n\t/// Convert a linear color to sRGB color using a custom gamma correction.\n\t/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb\n\ttemplate\n\tGLM_FUNC_DECL vec convertLinearToSRGB(vec const& ColorLinear, T Gamma);\n\n\t/// Convert a sRGB color to linear color using a standard gamma correction.\n\t/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb\n\ttemplate\n\tGLM_FUNC_DECL vec convertSRGBToLinear(vec const& ColorSRGB);\n\n\t/// Convert a sRGB color to linear color using a custom gamma correction.\n\t// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb\n\ttemplate\n\tGLM_FUNC_DECL vec convertSRGBToLinear(vec const& ColorSRGB, T Gamma);\n\n\t/// @}\n} //namespace glm\n\n#include \"color_space.inl\"\n"}, {"path": "includes/glm/gtc/constants.hpp", "language": "code", "loc": 132, "comment_density": 0.53, "code": "/// @ref gtc_constants\n/// @file glm/gtc/constants.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_constants GLM_GTC_constants\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Provide a list of constants and precomputed useful values.\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_constants.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_constants extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_constants\n\t/// @{\n\n\t/// Return 0.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType zero();\n\n\t/// Return 1.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType one();\n\n\t/// Return pi * 2.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType two_pi();\n\n\t/// Return square root of pi.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_pi();\n\n\t/// Return pi / 2.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType half_pi();\n\n\t/// Return pi / 2 * 3.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType three_over_two_pi();\n\n\t/// Return pi / 4.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType quarter_pi();\n\n\t/// Return 1 / pi.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType one_over_pi();\n\n\t/// Return 1 / (pi * 2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType one_over_two_pi();\n\n\t/// Return 2 / pi.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType two_over_pi();\n\n\t/// Return 4 / pi.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType four_over_pi();\n\n\t/// Return 2 / sqrt(pi).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType two_over_root_pi();\n\n\t/// Return 1 / sqrt(2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType one_over_root_two();\n\n\t/// Return sqrt(pi / 2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_half_pi();\n\n\t/// Return sqrt(2 * pi).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_two_pi();\n\n\t/// Return sqrt(ln(4)).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_ln_four();\n\n\t/// Return e constant.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType e();\n\n\t/// Return Euler's constant.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType euler();\n\n\t/// Return sqrt(2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_two();\n\n\t/// Return sqrt(3).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_three();\n\n\t/// Return sqrt(5).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_five();\n\n\t/// Return ln(2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType ln_two();\n\n\t/// Return ln(10).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType ln_ten();\n\n\t/// Return ln(ln(2)).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType ln_ln_two();\n\n\t/// Return 1 / 3.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType third();\n\n\t/// Return 2 / 3.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType two_thirds();\n\n\t/// Return the golden ratio constant.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType golden_ratio();\n\n\t/// @}\n} //namespace glm\n\n#include \"constants.inl\"\n"}, {"path": "includes/glm/gtc/epsilon.hpp", "language": "code", "loc": 50, "comment_density": 0.66, "code": "/// @ref gtc_epsilon\n/// @file glm/gtc/epsilon.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtc_epsilon GLM_GTC_epsilon\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Comparison functions for a user defined epsilon values.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_epsilon extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_epsilon\n\t/// @{\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL vec epsilonEqual(vec const& x, vec const& y, T const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL bool epsilonEqual(genType const& x, genType const& y, genType const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL vec epsilonNotEqual(vec const& x, vec const& y, T const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL bool epsilonNotEqual(genType const& x, genType const& y, genType const& epsilon);\n\n\t/// @}\n}//namespace glm\n\n#include \"epsilon.inl\"\n"}, {"path": "includes/glm/gtc/integer.hpp", "language": "code", "loc": 56, "comment_density": 0.661, "code": "/// @ref gtc_integer\n/// @file glm/gtc/integer.hpp\n///\n/// @see core (dependence)\n/// @see gtc_integer (dependence)\n///\n/// @defgroup gtc_integer GLM_GTC_integer\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// @brief Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../common.hpp\"\n#include \"../integer.hpp\"\n#include \"../exponential.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_integer extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_integer\n\t/// @{\n\n\t/// Returns the log2 of x for integer values. Can be reliably using to compute mipmap count from the texture size.\n\t/// @see gtc_integer\n\ttemplate\n\tGLM_FUNC_DECL genIUType log2(genIUType x);\n\n\t/// Returns a value equal to the nearest integer to x.\n\t/// The fraction 0.5 will round in a direction chosen by the\n\t/// implementation, presumably the direction that is fastest.\n\t///\n\t/// @param x The values of the argument must be greater or equal to zero.\n\t/// @tparam T floating point scalar types.\n\t///\n\t/// @see GLSL round man page\n\t/// @see gtc_integer\n\ttemplate\n\tGLM_FUNC_DECL vec iround(vec const& x);\n\n\t/// Returns a value equal to the nearest integer to x.\n\t/// The fraction 0.5 will round in a direction chosen by the\n\t/// implementation, presumably the direction that is fastest.\n\t///\n\t/// @param x The values of the argument must be greater or equal to zero.\n\t/// @tparam T floating point scalar types.\n\t///\n\t/// @see GLSL round man page\n\t/// @see gtc_integer\n\ttemplate\n\tGLM_FUNC_DECL vec uround(vec const& x);\n\n\t/// @}\n} //namespace glm\n\n#include \"integer.inl\"\n"}, {"path": "includes/glm/gtc/matrix_access.hpp", "language": "code", "loc": 50, "comment_density": 0.48, "code": "/// @ref gtc_matrix_access\n/// @file glm/gtc/matrix_access.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_matrix_access GLM_GTC_matrix_access\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines functions to access rows or columns of a matrix easily.\n\n#pragma once\n\n// Dependency:\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_matrix_access extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_matrix_access\n\t/// @{\n\n\t/// Get a specific row of a matrix.\n\t/// @see gtc_matrix_access\n\ttemplate\n\tGLM_FUNC_DECL typename genType::row_type row(\n\t\tgenType const& m,\n\t\tlength_t index);\n\n\t/// Set a specific row to a matrix.\n\t/// @see gtc_matrix_access\n\ttemplate\n\tGLM_FUNC_DECL genType row(\n\t\tgenType const& m,\n\t\tlength_t index,\n\t\ttypename genType::row_type const& x);\n\n\t/// Get a specific column of a matrix.\n\t/// @see gtc_matrix_access\n\ttemplate\n\tGLM_FUNC_DECL typename genType::col_type column(\n\t\tgenType const& m,\n\t\tlength_t index);\n\n\t/// Set a specific column to a matrix.\n\t/// @see gtc_matrix_access\n\ttemplate\n\tGLM_FUNC_DECL genType column(\n\t\tgenType const& m,\n\t\tlength_t index,\n\t\ttypename genType::col_type const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_access.inl\"\n"}, {"path": "includes/glm/gtc/matrix_integer.hpp", "language": "code", "loc": 375, "comment_density": 0.565, "code": "/// @ref gtc_matrix_integer\n/// @file glm/gtc/matrix_integer.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_matrix_integer GLM_GTC_matrix_integer\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines a number of matrices with integer types.\n\n#pragma once\n\n// Dependency:\n#include \"../mat2x2.hpp\"\n#include \"../mat2x3.hpp\"\n#include \"../mat2x4.hpp\"\n#include \"../mat3x2.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat3x4.hpp\"\n#include \"../mat4x2.hpp\"\n#include \"../mat4x3.hpp\"\n#include \"../mat4x4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_matrix_integer extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_matrix_integer\n\t/// @{\n\n\t/// High-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, highp>\t\t\t\thighp_imat2;\n\n\t/// High-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, highp>\t\t\t\thighp_imat3;\n\n\t/// High-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, highp>\t\t\t\thighp_imat4;\n\n\t/// High-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, highp>\t\t\t\thighp_imat2x2;\n\n\t/// High-qualifier signed integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, int, highp>\t\t\t\thighp_imat2x3;\n\n\t/// High-qualifier signed integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, int, highp>\t\t\t\thighp_imat2x4;\n\n\t/// High-qualifier signed integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, int, highp>\t\t\t\thighp_imat3x2;\n\n\t/// High-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, highp>\t\t\t\thighp_imat3x3;\n\n\t/// High-qualifier signed integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, int, highp>\t\t\t\thighp_imat3x4;\n\n\t/// High-qualifier signed integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, int, highp>\t\t\t\thighp_imat4x2;\n\n\t/// High-qualifier signed integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, int, highp>\t\t\t\thighp_imat4x3;\n\n\t/// High-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, highp>\t\t\t\thighp_imat4x4;\n\n\n\t/// Medium-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, mediump>\t\t\tmediump_imat2;\n\n\t/// Medium-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, mediump>\t\t\tmediump_imat3;\n\n\t/// Medium-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, mediump>\t\t\tmediump_imat4;\n\n\n\t/// Medium-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, mediump>\t\t\tmediump_imat2x2;\n\n\t/// Medium-qualifier signed integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, int, mediump>\t\t\tmediump_imat2x3;\n\n\t/// Medium-qualifier signed integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, int, mediump>\t\t\tmediump_imat2x4;\n\n\t/// Medium-qualifier signed integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, int, mediump>\t\t\tmediump_imat3x2;\n\n\t/// Medium-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, mediump>\t\t\tmediump_imat3x3;\n\n\t/// Medium-qualifier signed integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, int, mediump>\t\t\tmediump_imat3x4;\n\n\t/// Medium-qualifier signed integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, int, mediump>\t\t\tmediump_imat4x2;\n\n\t/// Medium-qualifier signed integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, int, mediump>\t\t\tmediump_imat4x3;\n\n\t/// Medium-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, mediump>\t\t\tmediump_imat4x4;\n\n\n\t/// Low-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, lowp>\t\t\t\tlowp_imat2;\n\n\t/// Low-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, lowp>\t\t\t\tlowp_imat3;\n\n\t/// Low-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, lowp>\t\t\t\tlowp_imat4;\n\n\n\t/// Low-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, lowp>\t\t\t\tlowp_imat2x2;\n\n\t/// Low-qualifier signed integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, int, lowp>\t\t\t\tlowp_imat2x3;\n\n\t/// Low-qualifier signed integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, int, lowp>\t\t\t\tlowp_imat2x4;\n\n\t/// Low-qualifier signed integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, int, lowp>\t\t\t\tlowp_imat3x2;\n\n\t/// Low-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, lowp>\t\t\t\tlowp_imat3x3;\n\n\t/// Low-qualifier signed integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, int, lowp>\t\t\t\tlowp_imat3x4;\n\n\t/// Low-qualifier signed integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, int, lowp>\t\t\t\tlowp_imat4x2;\n\n\t/// Low-qualifier signed integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, int, lowp>\t\t\t\tlowp_imat4x3;\n\n\t/// Low-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, lowp>\t\t\t\tlowp_imat4x4;\n\n\n\t/// High-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, highp>\t\t\t\thighp_umat2;\n\n\t/// High-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, highp>\t\t\t\thighp_umat3;\n\n\t/// High-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, highp>\t\t\t\thighp_umat4;\n\n\t/// High-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, highp>\t\t\t\thighp_umat2x2;\n\n\t/// High-qualifier unsigned integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, uint, highp>\t\t\t\thighp_umat2x3;\n\n\t/// High-qualifier unsigned integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, uint, highp>\t\t\t\thighp_umat2x4;\n\n\t/// High-qualifier unsigned integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, uint, highp>\t\t\t\thighp_umat3x2;\n\n\t/// High-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, highp>\t\t\t\thighp_umat3x3;\n\n\t/// High-qualifier unsigned integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, uint, highp>\t\t\t\thighp_umat3x4;\n\n\t/// High-qualifier unsigned integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, uint, highp>\t\t\t\thighp_umat4x2;\n\n\t/// High-qualifier unsigned integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, uint, highp>\t\t\t\thighp_umat4x3;\n\n\t/// High-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, highp>\t\t\t\thighp_umat4x4;\n\n\n\t/// Medium-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, mediump>\t\t\tmediump_umat2;\n\n\t/// Medium-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, mediump>\t\t\tmediump_umat3;\n\n\t/// Medium-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, mediump>\t\t\tmediump_umat4;\n\n\n\t/// Medium-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, mediump>\t\t\tmediump_umat2x2;\n\n\t/// Medium-qualifier unsigned integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, uint, mediump>\t\t\tmediump_umat2x3;\n\n\t/// Medium-qualifier unsigned integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, uint, mediump>\t\t\tmediump_umat2x4;\n\n\t/// Medium-qualifier unsigned integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, uint, mediump>\t\t\tmediump_umat3x2;\n\n\t/// Medium-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, mediump>\t\t\tmediump_umat3x3;\n\n\t/// Medium-qualifier unsigned integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, uint, mediump>\t\t\tmediump_umat3x4;\n\n\t/// Medium-qualifier unsigned integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, uint, mediump>\t\t\tmediump_umat4x2;\n\n\t/// Medium-qualifier unsigned integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, uint, mediump>\t\t\tmediump_umat4x3;\n\n\t/// Medium-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, mediump>\t\t\tmediump_umat4x4;\n\n\n\t/// Low-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, lowp>\t\t\t\tlowp_umat2;\n\n\t/// Low-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, lowp>\t\t\t\tlowp_umat3;\n\n\t/// Low-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, lowp>\t\t\t\tlowp_umat4;\n\n\n\t/// Low-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, lowp>\t\t\t\tlowp_umat2x2;\n\n\t/// Low-qualifier unsigned integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, uint, lowp>\t\t\t\tlowp_umat2x3;\n\n\t/// Low-qualifier unsigned integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, uint, lowp>\t\t\t\tlowp_umat2x4;\n\n\t/// Low-qualifier unsigned integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, uint, lowp>\t\t\t\tlowp_umat3x2;\n\n\t/// Low-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, lowp>\t\t\t\tlowp_umat3x3;\n\n\t/// Low-qualifier unsigned integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, uint, lowp>\t\t\t\tlowp_umat3x4;\n\n\t/// Low-qualifier unsigned integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, uint, lowp>\t\t\t\tlowp_umat4x2;\n\n\t/// Low-qualifier unsigned integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, uint, lowp>\t\t\t\tlowp_umat4x3;\n\n\t/// Low-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, lowp>\t\t\t\tlowp_umat4x4;\n\n#if(defined(GLM_PRECISION_HIGHP_INT))\n\ttypedef highp_imat2\t\t\t\t\t\t\t\timat2;\n\ttypedef highp_imat3\t\t\t\t\t\t\t\timat3;\n\ttypedef highp_imat4\t\t\t\t\t\t\t\timat4;\n\ttypedef highp_imat2x2\t\t\t\t\t\t\timat2x2;\n\ttypedef highp_imat2x3\t\t\t\t\t\t\timat2x3;\n\ttypedef highp_imat2x4\t\t\t\t\t\t\timat2x4;\n\ttypedef highp_imat3x2\t\t\t\t\t\t\timat3x2;\n\ttypedef highp_imat3x3\t\t\t\t\t\t\timat3x3;\n\ttypedef highp_imat3x4\t\t\t\t\t\t\timat3x4;\n\ttypedef highp_imat4x2\t\t\t\t\t\t\timat4x2;\n\ttypedef highp_imat4x3\t\t\t\t\t\t\timat4x3;\n\ttypedef highp_imat4x4\t\t\t\t\t\t\timat4x4;\n#elif(defined(GLM_PRECISION_LOWP_INT))\n\ttypedef lowp_imat2\t\t\t\t\t\t\t\timat2;\n\ttypedef lowp_imat3\t\t\t\t\t\t\t\timat3;\n\ttypedef lowp_imat4\t\t\t\t\t\t\t\timat4;\n\ttypedef lowp_imat2x2\t\t\t\t\t\t\timat2x2;\n\ttypedef lowp_imat2x3\t\t\t\t\t\t\timat2x3;\n\ttypedef lowp_imat2x4\t\t\t\t\t\t\timat2x4;\n\ttypedef lowp_imat3x2\t\t\t\t\t\t\timat3x2;\n\ttypedef lowp_imat3x3\t\t\t\t\t\t\timat3x3;\n\ttypedef lowp_imat3x4\t\t\t\t\t\t\timat3x4;\n\ttypedef lowp_imat4x2\t\t\t\t\t\t\timat4x2;\n\ttypedef lowp_imat4x3\t\t\t\t\t\t\timat4x3;\n\ttypedef lowp_imat4x4\t\t\t\t\t\t\timat4x4;\n#else //if(defined(GLM_PRECISION_MEDIUMP_INT))\n\n\t/// Signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat2\t\t\t\t\t\t\timat2;\n\n\t/// Signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat3\t\t\t\t\t\t\timat3;\n\n\t/// Signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat4\t\t\t\t\t\t\timat4;\n\n\t/// Signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat2x2\t\t\t\t\t\t\timat2x2;\n\n\t/// Signed integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat2x3\t\t\t\t\t\t\timat2x3;\n\n\t/// Signed integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat2x4\t\t\t\t\t\t\timat2x4;\n\n\t/// Signed integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat3x2\t\t\t\t\t\t\timat3x2;\n\n\t/// Signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat3x3\t\t\t\t\t\t\timat3x3;\n\n\t/// Signed integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat3x4\t\t\t\t\t\t\timat3x4;\n\n\t/// Signed integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat4x2\t\t\t\t\t\t\timat4x2;\n\n\t/// Signed integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat4x3\t\t\t\t\t\t\timat4x3;\n\n\t/// Signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat4x4\t\t\t\t\t\t\timat4x4;\n#endif//GLM_PRECISION\n\n#if(defined(GLM_PRECISION_HIGHP_UINT))\n\ttypedef highp_umat2\t\t\t\t\t\t\t\tumat2;\n\ttypedef highp_umat3\t\t\t\t\t\t\t\tumat3;\n\ttypedef highp_umat4\t\t\t\t\t\t\t\tumat4;\n\ttypedef highp_umat2x2\t\t\t\t\t\t\tumat2x2;\n\ttypedef highp_umat2x3\t\t\t\t\t\t\tumat2x3;\n\ttypedef highp_umat2x4\t\t\t\t\t\t\tumat2x4;\n\ttypedef highp_umat3x2\t\t\t\t\t\t\tumat3x2;\n\ttypedef highp_umat3x3\t\t\t\t\t\t\tumat3x3;\n\ttypedef highp_umat3x4\t\t\t\t\t\t\tumat3x4;\n\ttypedef highp_umat4x2\t\t\t\t\t\t\tumat4x2;\n\ttypedef highp_umat4x3\t\t\t\t\t\t\tumat4x3;\n\ttypedef highp_umat4x4\t\t\t\t\t\t\tumat4x4;\n#elif(defined(GLM_PRECISION_LOWP_UINT))\n\ttypedef lowp_umat2\t\t\t\t\t\t\t\tumat2;\n\ttypedef lowp_umat3\t\t\t\t\t\t\t\tumat3;\n\ttypedef lowp_umat4\t\t\t\t\t\t\t\tumat4;\n\ttypedef lowp_umat2x2\t\t\t\t\t\t\tumat2x2;\n\ttypedef lowp_umat2x3\t\t\t\t\t\t\tumat2x3;\n\ttypedef lowp_umat2x4\t\t\t\t\t\t\tumat2x4;\n\ttypedef lowp_umat3x2\t\t\t\t\t\t\tumat3x2;\n\ttypedef lowp_umat3x3\t\t\t\t\t\t\tumat3x3;\n\ttypedef lowp_umat3x4\t\t\t\t\t\t\tumat3x4;\n\ttypedef lowp_umat4x2\t\t\t\t\t\t\tumat4x2;\n\ttypedef lowp_umat4x3\t\t\t\t\t\t\tumat4x3;\n\ttypedef lowp_umat4x4\t\t\t\t\t\t\tumat4x4;\n#else //if(defined(GLM_PRECISION_MEDIUMP_UINT))\n\n\t/// Unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat2\t\t\t\t\t\t\tumat2;\n\n\t/// Unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat3\t\t\t\t\t\t\tumat3;\n\n\t/// Unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat4\t\t\t\t\t\t\tumat4;\n\n\t/// Unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat2x2\t\t\t\t\t\t\tumat2x2;\n\n\t/// Unsigned integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat2x3\t\t\t\t\t\t\tumat2x3;\n\n\t/// Unsigned integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat2x4\t\t\t\t\t\t\tumat2x4;\n\n\t/// Unsigned integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat3x2\t\t\t\t\t\t\tumat3x2;\n\n\t/// Unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat3x3\t\t\t\t\t\t\tumat3x3;\n\n\t/// Unsigned integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat3x4\t\t\t\t\t\t\tumat3x4;\n\n\t/// Unsigned integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat4x2\t\t\t\t\t\t\tumat4x2;\n\n\t/// Unsigned integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat4x3\t\t\t\t\t\t\tumat4x3;\n\n\t/// Unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat4x4\t\t\t\t\t\t\tumat4x4;\n#endif//GLM_PRECISION\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/gtc/matrix_inverse.hpp", "language": "code", "loc": 42, "comment_density": 0.619, "code": "/// @ref gtc_matrix_inverse\n/// @file glm/gtc/matrix_inverse.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines additional matrix inverting functions.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../matrix.hpp\"\n#include \"../mat2x2.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat4x4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_matrix_inverse extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_matrix_inverse\n\t/// @{\n\n\t/// Fast matrix inverse for affine matrix.\n\t///\n\t/// @param m Input matrix to invert.\n\t/// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly inaccurate.\n\t/// @see gtc_matrix_inverse\n\ttemplate\n\tGLM_FUNC_DECL genType affineInverse(genType const& m);\n\n\t/// Compute the inverse transpose of a matrix.\n\t///\n\t/// @param m Input matrix to invert transpose.\n\t/// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly inaccurate.\n\t/// @see gtc_matrix_inverse\n\ttemplate\n\tGLM_FUNC_DECL genType inverseTranspose(genType const& m);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_inverse.inl\"\n"}, {"path": "includes/glm/gtc/matrix_transform.hpp", "language": "code", "loc": 32, "comment_density": 0.625, "code": "/// @ref gtc_matrix_transform\n/// @file glm/gtc/matrix_transform.hpp\n///\n/// @see core (dependence)\n/// @see gtx_transform\n/// @see gtx_transform2\n///\n/// @defgroup gtc_matrix_transform GLM_GTC_matrix_transform\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines functions that generate common transformation matrices.\n///\n/// The matrices generated by this extension use standard OpenGL fixed-function\n/// conventions. For example, the lookAt function generates a transform from world\n/// space into the specific eye space that the projective matrix functions\n/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility\n/// specifications defines the particular layout of this eye space.\n\n#pragma once\n\n// Dependencies\n#include \"../mat4x4.hpp\"\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../ext/matrix_projection.hpp\"\n#include \"../ext/matrix_clip_space.hpp\"\n#include \"../ext/matrix_transform.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_matrix_transform extension included\")\n#endif\n\n#include \"matrix_transform.inl\"\n"}, {"path": "includes/glm/gtc/noise.hpp", "language": "code", "loc": 52, "comment_density": 0.5, "code": "/// @ref gtc_noise\n/// @file glm/gtc/noise.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_noise GLM_GTC_noise\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines 2D, 3D and 4D procedural noise functions\n/// Based on the work of Stefan Gustavson and Ashima Arts on \"webgl-noise\":\n/// https://github.com/ashima/webgl-noise\n/// Following Stefan Gustavson's paper \"Simplex noise demystified\":\n/// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../detail/_noise.hpp\"\n#include \"../geometric.hpp\"\n#include \"../common.hpp\"\n#include \"../vector_relational.hpp\"\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_noise extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_noise\n\t/// @{\n\n\t/// Classic perlin noise.\n\t/// @see gtc_noise\n\ttemplate\n\tGLM_FUNC_DECL T perlin(\n\t\tvec const& p);\n\n\t/// Periodic perlin noise.\n\t/// @see gtc_noise\n\ttemplate\n\tGLM_FUNC_DECL T perlin(\n\t\tvec const& p,\n\t\tvec const& rep);\n\n\t/// Simplex noise.\n\t/// @see gtc_noise\n\ttemplate\n\tGLM_FUNC_DECL T simplex(\n\t\tvec const& p);\n\n\t/// @}\n}//namespace glm\n\n#include \"noise.inl\"\n"}, {"path": "includes/glm/gtc/packing.hpp", "language": "code", "loc": 648, "comment_density": 0.867, "code": "/// @ref gtc_packing\n/// @file glm/gtc/packing.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_packing GLM_GTC_packing\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// This extension provides a set of function to convert vertors to packed\n/// formats.\n\n#pragma once\n\n// Dependency:\n#include \"type_precision.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_packing extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_packing\n\t/// @{\n\n\t/// First, converts the normalized floating-point value v into a 8-bit integer value.\n\t/// Then, the results are packed into the returned 8-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm1x8:\tround(clamp(c, 0, +1) * 255.0)\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm2x8(vec2 const& v)\n\t/// @see uint32 packUnorm4x8(vec4 const& v)\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint8 packUnorm1x8(float v);\n\n\t/// Convert a single 8-bit integer to a normalized floating-point value.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm4x8: f / 255.0\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackUnorm2x8(uint16 p)\n\t/// @see vec4 unpackUnorm4x8(uint32 p)\n\t/// @see GLSL unpackUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackUnorm1x8(uint8 p);\n\n\t/// First, converts each component of the normalized floating-point value v into 8-bit integer values.\n\t/// Then, the results are packed into the returned 16-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm2x8:\tround(clamp(c, 0, +1) * 255.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint8 packUnorm1x8(float const& v)\n\t/// @see uint32 packUnorm4x8(vec4 const& v)\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packUnorm2x8(vec2 const& v);\n\n\t/// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit unsigned integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm4x8: f / 255.0\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackUnorm1x8(uint8 v)\n\t/// @see vec4 unpackUnorm4x8(uint32 p)\n\t/// @see GLSL unpackUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p);\n\n\t/// First, converts the normalized floating-point value v into 8-bit integer value.\n\t/// Then, the results are packed into the returned 8-bit unsigned integer.\n\t///\n\t/// The conversion to fixed point is done as follows:\n\t/// packSnorm1x8:\tround(clamp(s, -1, +1) * 127.0)\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packSnorm2x8(vec2 const& v)\n\t/// @see uint32 packSnorm4x8(vec4 const& v)\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint8 packSnorm1x8(float s);\n\n\t/// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers.\n\t/// Then, the value is converted to a normalized floating-point value to generate the returned scalar.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm1x8: clamp(f / 127.0, -1, +1)\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackSnorm2x8(uint16 p)\n\t/// @see vec4 unpackSnorm4x8(uint32 p)\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackSnorm1x8(uint8 p);\n\n\t/// First, converts each component of the normalized floating-point value v into 8-bit integer values.\n\t/// Then, the results are packed into the returned 16-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm2x8:\tround(clamp(c, -1, +1) * 127.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint8 packSnorm1x8(float const& v)\n\t/// @see uint32 packSnorm4x8(vec4 const& v)\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packSnorm2x8(vec2 const& v);\n\n\t/// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm2x8: clamp(f / 127.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackSnorm1x8(uint8 p)\n\t/// @see vec4 unpackSnorm4x8(uint32 p)\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p);\n\n\t/// First, converts the normalized floating-point value v into a 16-bit integer value.\n\t/// Then, the results are packed into the returned 16-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm1x16:\tround(clamp(c, 0, +1) * 65535.0)\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packSnorm1x16(float const& v)\n\t/// @see uint64 packSnorm4x16(vec4 const& v)\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packUnorm1x16(float v);\n\n\t/// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers.\n\t/// Then, the value is converted to a normalized floating-point value to generate the returned scalar.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm1x16: f / 65535.0\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackUnorm2x16(uint32 p)\n\t/// @see vec4 unpackUnorm4x16(uint64 p)\n\t/// @see GLSL unpackUnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackUnorm1x16(uint16 p);\n\n\t/// First, converts each component of the normalized floating-point value v into 16-bit integer values.\n\t/// Then, the results are packed into the returned 64-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm4x16:\tround(clamp(c, 0, +1) * 65535.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm1x16(float const& v)\n\t/// @see uint32 packUnorm2x16(vec2 const& v)\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint64 packUnorm4x16(vec4 const& v);\n\n\t/// First, unpacks a single 64-bit unsigned integer p into four 16-bit unsigned integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnormx4x16: f / 65535.0\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackUnorm1x16(uint16 p)\n\t/// @see vec2 unpackUnorm2x16(uint32 p)\n\t/// @see GLSL unpackUnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 p);\n\n\t/// First, converts the normalized floating-point value v into 16-bit integer value.\n\t/// Then, the results are packed into the returned 16-bit unsigned integer.\n\t///\n\t/// The conversion to fixed point is done as follows:\n\t/// packSnorm1x8:\tround(clamp(s, -1, +1) * 32767.0)\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packSnorm2x16(vec2 const& v)\n\t/// @see uint64 packSnorm4x16(vec4 const& v)\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packSnorm1x16(float v);\n\n\t/// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned scalar.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm1x16: clamp(f / 32767.0, -1, +1)\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackSnorm2x16(uint32 p)\n\t/// @see vec4 unpackSnorm4x16(uint64 p)\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackSnorm1x16(uint16 p);\n\n\t/// First, converts each component of the normalized floating-point value v into 16-bit integer values.\n\t/// Then, the results are packed into the returned 64-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm2x8:\tround(clamp(c, -1, +1) * 32767.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packSnorm1x16(float const& v)\n\t/// @see uint32 packSnorm2x16(vec2 const& v)\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint64 packSnorm4x16(vec4 const& v);\n\n\t/// First, unpacks a single 64-bit unsigned integer p into four 16-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm4x16: clamp(f / 32767.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackSnorm1x16(uint16 p)\n\t/// @see vec2 unpackSnorm2x16(uint32 p)\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackSnorm4x16(uint64 p);\n\n\t/// Returns an unsigned integer obtained by converting the components of a floating-point scalar\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification,\n\t/// and then packing this 16-bit value into a 16-bit unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packHalf2x16(vec2 const& v)\n\t/// @see uint64 packHalf4x16(vec4 const& v)\n\t/// @see GLSL packHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packHalf1x16(float v);\n\n\t/// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value,\n\t/// interpreted as a 16-bit floating-point number according to the OpenGL Specification,\n\t/// and converting it to 32-bit floating-point values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackHalf2x16(uint32 const& v)\n\t/// @see vec4 unpackHalf4x16(uint64 const& v)\n\t/// @see GLSL unpackHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackHalf1x16(uint16 v);\n\n\t/// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification,\n\t/// and then packing these four 16-bit values into a 64-bit unsigned integer.\n\t/// The first vector component specifies the 16 least-significant bits of the result;\n\t/// the forth component specifies the 16 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packHalf1x16(float const& v)\n\t/// @see uint32 packHalf2x16(vec2 const& v)\n\t/// @see GLSL packHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint64 packHalf4x16(vec4 const& v);\n\n\t/// Returns a four-component floating-point vector with components obtained by unpacking a 64-bit unsigned integer into four 16-bit values,\n\t/// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,\n\t/// and converting them to 32-bit floating-point values.\n\t/// The first component of the vector is obtained from the 16 least-significant bits of v;\n\t/// the forth component is obtained from the 16 most-significant bits of v.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackHalf1x16(uint16 const& v)\n\t/// @see vec2 unpackHalf2x16(uint32 const& v)\n\t/// @see GLSL unpackHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackHalf4x16(uint64 p);\n\n\t/// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector\n\t/// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification,\n\t/// and then packing these four values into a 32-bit unsigned integer.\n\t/// The first vector component specifies the 10 least-significant bits of the result;\n\t/// the forth component specifies the 2 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packI3x10_1x2(uvec4 const& v)\n\t/// @see uint32 packSnorm3x10_1x2(vec4 const& v)\n\t/// @see uint32 packUnorm3x10_1x2(vec4 const& v)\n\t/// @see ivec4 unpackI3x10_1x2(uint32 const& p)\n\tGLM_FUNC_DECL uint32 packI3x10_1x2(ivec4 const& v);\n\n\t/// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit signed integers.\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packU3x10_1x2(uvec4 const& v)\n\t/// @see vec4 unpackSnorm3x10_1x2(uint32 const& p);\n\t/// @see uvec4 unpackI3x10_1x2(uint32 const& p);\n\tGLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 p);\n\n\t/// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector\n\t/// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification,\n\t/// and then packing these four values into a 32-bit unsigned integer.\n\t/// The first vector component specifies the 10 least-significant bits of the result;\n\t/// the forth component specifies the 2 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packI3x10_1x2(ivec4 const& v)\n\t/// @see uint32 packSnorm3x10_1x2(vec4 const& v)\n\t/// @see uint32 packUnorm3x10_1x2(vec4 const& v)\n\t/// @see ivec4 unpackU3x10_1x2(uint32 const& p)\n\tGLM_FUNC_DECL uint32 packU3x10_1x2(uvec4 const& v);\n\n\t/// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit unsigned integers.\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packU3x10_1x2(uvec4 const& v)\n\t/// @see vec4 unpackSnorm3x10_1x2(uint32 const& p);\n\t/// @see uvec4 unpackI3x10_1x2(uint32 const& p);\n\tGLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 p);\n\n\t/// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values.\n\t/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm3x10_1x2(xyz):\tround(clamp(c, -1, +1) * 511.0)\n\t/// packSnorm3x10_1x2(w):\tround(clamp(c, -1, +1) * 1.0)\n\t///\n\t/// The first vector component specifies the 10 least-significant bits of the result;\n\t/// the forth component specifies the 2 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec4 unpackSnorm3x10_1x2(uint32 const& p)\n\t/// @see uint32 packUnorm3x10_1x2(vec4 const& v)\n\t/// @see uint32 packU3x10_1x2(uvec4 const& v)\n\t/// @see uint32 packI3x10_1x2(ivec4 const& v)\n\tGLM_FUNC_DECL uint32 packSnorm3x10_1x2(vec4 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm3x10_1x2(xyz): clamp(f / 511.0, -1, +1)\n\t/// unpackSnorm3x10_1x2(w): clamp(f / 511.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packSnorm3x10_1x2(vec4 const& v)\n\t/// @see vec4 unpackUnorm3x10_1x2(uint32 const& p))\n\t/// @see uvec4 unpackI3x10_1x2(uint32 const& p)\n\t/// @see uvec4 unpackU3x10_1x2(uint32 const& p)\n\tGLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 p);\n\n\t/// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values.\n\t/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm3x10_1x2(xyz):\tround(clamp(c, 0, +1) * 1023.0)\n\t/// packUnorm3x10_1x2(w):\tround(clamp(c, 0, +1) * 3.0)\n\t///\n\t/// The first vector component specifies the 10 least-significant bits of the result;\n\t/// the forth component specifies the 2 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec4 unpackUnorm3x10_1x2(uint32 const& p)\n\t/// @see uint32 packUnorm3x10_1x2(vec4 const& v)\n\t/// @see uint32 packU3x10_1x2(uvec4 const& v)\n\t/// @see uint32 packI3x10_1x2(ivec4 const& v)\n\tGLM_FUNC_DECL uint32 packUnorm3x10_1x2(vec4 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm3x10_1x2(xyz): clamp(f / 1023.0, 0, +1)\n\t/// unpackSnorm3x10_1x2(w): clamp(f / 3.0, 0, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packSnorm3x10_1x2(vec4 const& v)\n\t/// @see vec4 unpackInorm3x10_1x2(uint32 const& p))\n\t/// @see uvec4 unpackI3x10_1x2(uint32 const& p)\n\t/// @see uvec4 unpackU3x10_1x2(uint32 const& p)\n\tGLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 p);\n\n\t/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.\n\t/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The first vector component specifies the 11 least-significant bits of the result;\n\t/// the last component specifies the 10 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec3 unpackF2x11_1x10(uint32 const& p)\n\tGLM_FUNC_DECL uint32 packF2x11_1x10(vec3 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packF2x11_1x10(vec3 const& v)\n\tGLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p);\n\n\n\t/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.\n\t/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The first vector component specifies the 11 least-significant bits of the result;\n\t/// the last component specifies the 10 most-significant bits.\n\t///\n\t/// packF3x9_E1x5 allows encoding into RGBE / RGB9E5 format\n\t///\n\t/// @see gtc_packing\n\t/// @see vec3 unpackF3x9_E1x5(uint32 const& p)\n\tGLM_FUNC_DECL uint32 packF3x9_E1x5(vec3 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// unpackF3x9_E1x5 allows decoding RGBE / RGB9E5 data\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packF3x9_E1x5(vec3 const& v)\n\tGLM_FUNC_DECL vec3 unpackF3x9_E1x5(uint32 p);\n\n\t/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification.\n\t/// The first vector component specifies the 16 least-significant bits of the result;\n\t/// the forth component specifies the 16 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& p)\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> packRGBM(vec<3, T, Q> const& rgb);\n\n\t/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.\n\t/// The first component of the vector is obtained from the 16 least-significant bits of v;\n\t/// the forth component is obtained from the 16 most-significant bits of v.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec<4, T, Q> packRGBM(vec<3, float, Q> const& v)\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm);\n\n\t/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification.\n\t/// The first vector component specifies the 16 least-significant bits of the result;\n\t/// the forth component specifies the 16 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec unpackHalf(vec const& p)\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\ttemplate\n\tGLM_FUNC_DECL vec packHalf(vec const& v);\n\n\t/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.\n\t/// The first component of the vector is obtained from the 16 least-significant bits of v;\n\t/// the forth component is obtained from the 16 most-significant bits of v.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec packHalf(vec const& v)\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\ttemplate\n\tGLM_FUNC_DECL vec unpackHalf(vec const& p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec unpackUnorm(vec const& p);\n\ttemplate\n\tGLM_FUNC_DECL vec packUnorm(vec const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec packUnorm(vec const& v)\n\ttemplate\n\tGLM_FUNC_DECL vec unpackUnorm(vec const& v);\n\n\t/// Convert each component of the normalized floating-point vector into signed integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec unpackSnorm(vec const& p);\n\ttemplate\n\tGLM_FUNC_DECL vec packSnorm(vec const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec packSnorm(vec const& v)\n\ttemplate\n\tGLM_FUNC_DECL vec unpackSnorm(vec const& v);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackUnorm2x4(uint8 p)\n\tGLM_FUNC_DECL uint8 packUnorm2x4(vec2 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint8 packUnorm2x4(vec2 const& v)\n\tGLM_FUNC_DECL vec2 unpackUnorm2x4(uint8 p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec4 unpackUnorm4x4(uint16 p)\n\tGLM_FUNC_DECL uint16 packUnorm4x4(vec4 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm4x4(vec4 const& v)\n\tGLM_FUNC_DECL vec4 unpackUnorm4x4(uint16 p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec3 unpackUnorm1x5_1x6_1x5(uint16 p)\n\tGLM_FUNC_DECL uint16 packUnorm1x5_1x6_1x5(vec3 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm1x5_1x6_1x5(vec3 const& v)\n\tGLM_FUNC_DECL vec3 unpackUnorm1x5_1x6_1x5(uint16 p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec4 unpackUnorm3x5_1x1(uint16 p)\n\tGLM_FUNC_DECL uint16 packUnorm3x5_1x1(vec4 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm3x5_1x1(vec4 const& v)\n\tGLM_FUNC_DECL vec4 unpackUnorm3x5_1x1(uint16 p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec3 unpackUnorm2x3_1x2(uint8 p)\n\tGLM_FUNC_DECL uint8 packUnorm2x3_1x2(vec3 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint8 packUnorm2x3_1x2(vec3 const& v)\n\tGLM_FUNC_DECL vec3 unpackUnorm2x3_1x2(uint8 p);\n\n\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i8vec2 unpackInt2x8(int16 p)\n\tGLM_FUNC_DECL int16 packInt2x8(i8vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int16 packInt2x8(i8vec2 const& v)\n\tGLM_FUNC_DECL i8vec2 unpackInt2x8(int16 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u8vec2 unpackInt2x8(uint16 p)\n\tGLM_FUNC_DECL uint16 packUint2x8(u8vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packInt2x8(u8vec2 const& v)\n\tGLM_FUNC_DECL u8vec2 unpackUint2x8(uint16 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i8vec4 unpackInt4x8(int32 p)\n\tGLM_FUNC_DECL int32 packInt4x8(i8vec4 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int32 packInt2x8(i8vec4 const& v)\n\tGLM_FUNC_DECL i8vec4 unpackInt4x8(int32 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u8vec4 unpackUint4x8(uint32 p)\n\tGLM_FUNC_DECL uint32 packUint4x8(u8vec4 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packUint4x8(u8vec2 const& v)\n\tGLM_FUNC_DECL u8vec4 unpackUint4x8(uint32 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i16vec2 unpackInt2x16(int p)\n\tGLM_FUNC_DECL int packInt2x16(i16vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int packInt2x16(i16vec2 const& v)\n\tGLM_FUNC_DECL i16vec2 unpackInt2x16(int p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i16vec4 unpackInt4x16(int64 p)\n\tGLM_FUNC_DECL int64 packInt4x16(i16vec4 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int64 packInt4x16(i16vec4 const& v)\n\tGLM_FUNC_DECL i16vec4 unpackInt4x16(int64 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u16vec2 unpackUint2x16(uint p)\n\tGLM_FUNC_DECL uint packUint2x16(u16vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint packUint2x16(u16vec2 const& v)\n\tGLM_FUNC_DECL u16vec2 unpackUint2x16(uint p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u16vec4 unpackUint4x16(uint64 p)\n\tGLM_FUNC_DECL uint64 packUint4x16(u16vec4 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint64 packUint4x16(u16vec4 const& v)\n\tGLM_FUNC_DECL u16vec4 unpackUint4x16(uint64 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i32vec2 unpackInt2x32(int p)\n\tGLM_FUNC_DECL int64 packInt2x32(i32vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int packInt2x16(i32vec2 const& v)\n\tGLM_FUNC_DECL i32vec2 unpackInt2x32(int64 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u32vec2 unpackUint2x32(int p)\n\tGLM_FUNC_DECL uint64 packUint2x32(u32vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int packUint2x16(u32vec2 const& v)\n\tGLM_FUNC_DECL u32vec2 unpackUint2x32(uint64 p);\n\n\n\t/// @}\n}// namespace glm\n\n#include \"packing.inl\"\n"}, {"path": "includes/glm/gtc/quaternion.hpp", "language": "code", "loc": 153, "comment_density": 0.614, "code": "/// @ref gtc_quaternion\n/// @file glm/gtc/quaternion.hpp\n///\n/// @see core (dependence)\n/// @see gtc_constants (dependence)\n///\n/// @defgroup gtc_quaternion GLM_GTC_quaternion\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines a templated quaternion type and several quaternion operations.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/constants.hpp\"\n#include \"../gtc/matrix_transform.hpp\"\n#include \"../ext/vector_relational.hpp\"\n#include \"../ext/quaternion_common.hpp\"\n#include \"../ext/quaternion_float.hpp\"\n#include \"../ext/quaternion_float_precision.hpp\"\n#include \"../ext/quaternion_double.hpp\"\n#include \"../ext/quaternion_double_precision.hpp\"\n#include \"../ext/quaternion_relational.hpp\"\n#include \"../ext/quaternion_geometric.hpp\"\n#include \"../ext/quaternion_trigonometric.hpp\"\n#include \"../ext/quaternion_transform.hpp\"\n#include \"../detail/type_mat3x3.hpp\"\n#include \"../detail/type_mat4x4.hpp\"\n#include \"../detail/type_vec3.hpp\"\n#include \"../detail/type_vec4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_quaternion extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_quaternion\n\t/// @{\n\n\t/// Returns euler angles, pitch as x, yaw as y, roll as z.\n\t/// The result is expressed in radians.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> eulerAngles(qua const& x);\n\n\t/// Returns roll value of euler angles expressed in radians.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T roll(qua const& x);\n\n\t/// Returns pitch value of euler angles expressed in radians.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T pitch(qua const& x);\n\n\t/// Returns yaw value of euler angles expressed in radians.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T yaw(qua const& x);\n\n\t/// Converts a quaternion to a 3 * 3 matrix.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> mat3_cast(qua const& x);\n\n\t/// Converts a quaternion to a 4 * 4 matrix.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> mat4_cast(qua const& x);\n\n\t/// Converts a pure rotation 3 * 3 matrix to a quaternion.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua quat_cast(mat<3, 3, T, Q> const& x);\n\n\t/// Converts a pure rotation 4 * 4 matrix to a quaternion.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua quat_cast(mat<4, 4, T, Q> const& x);\n\n\t/// Returns the component-wise comparison result of x < y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_relational\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> lessThan(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of result x <= y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_relational\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> lessThanEqual(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of result x > y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_relational\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> greaterThan(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of result x >= y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_relational\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(qua const& x, qua const& y);\n\n\t/// Build a look at quaternion based on the default handedness.\n\t///\n\t/// @param direction Desired forward direction. Needs to be normalized.\n\t/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).\n\ttemplate\n\tGLM_FUNC_DECL qua quatLookAt(\n\t\tvec<3, T, Q> const& direction,\n\t\tvec<3, T, Q> const& up);\n\n\t/// Build a right-handed look at quaternion.\n\t///\n\t/// @param direction Desired forward direction onto which the -z-axis gets mapped. Needs to be normalized.\n\t/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).\n\ttemplate\n\tGLM_FUNC_DECL qua quatLookAtRH(\n\t\tvec<3, T, Q> const& direction,\n\t\tvec<3, T, Q> const& up);\n\n\t/// Build a left-handed look at quaternion.\n\t///\n\t/// @param direction Desired forward direction onto which the +z-axis gets mapped. Needs to be normalized.\n\t/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).\n\ttemplate\n\tGLM_FUNC_DECL qua quatLookAtLH(\n\t\tvec<3, T, Q> const& direction,\n\t\tvec<3, T, Q> const& up);\n\t/// @}\n} //namespace glm\n\n#include \"quaternion.inl\"\n"}, {"path": "includes/glm/gtc/random.hpp", "language": "code", "loc": 69, "comment_density": 0.652, "code": "/// @ref gtc_random\n/// @file glm/gtc/random.hpp\n///\n/// @see core (dependence)\n/// @see gtx_random (extended)\n///\n/// @defgroup gtc_random GLM_GTC_random\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Generate random number from various distribution methods.\n\n#pragma once\n\n// Dependency:\n#include \"../ext/scalar_int_sized.hpp\"\n#include \"../ext/scalar_uint_sized.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_random extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_random\n\t/// @{\n\n\t/// Generate random numbers in the interval [Min, Max], according a linear distribution\n\t///\n\t/// @param Min Minimum value included in the sampling\n\t/// @param Max Maximum value included in the sampling\n\t/// @tparam genType Value type. Currently supported: float or double scalars.\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL genType linearRand(genType Min, genType Max);\n\n\t/// Generate random numbers in the interval [Min, Max], according a linear distribution\n\t///\n\t/// @param Min Minimum value included in the sampling\n\t/// @param Max Maximum value included in the sampling\n\t/// @tparam T Value type. Currently supported: float or double.\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec linearRand(vec const& Min, vec const& Max);\n\n\t/// Generate random numbers in the interval [Min, Max], according a gaussian distribution\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL genType gaussRand(genType Mean, genType Deviation);\n\n\t/// Generate a random 2D vector which coordinates are regularly distributed on a circle of a given radius\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, defaultp> circularRand(T Radius);\n\n\t/// Generate a random 3D vector which coordinates are regularly distributed on a sphere of a given radius\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, defaultp> sphericalRand(T Radius);\n\n\t/// Generate a random 2D vector which coordinates are regularly distributed within the area of a disk of a given radius\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, defaultp> diskRand(T Radius);\n\n\t/// Generate a random 3D vector which coordinates are regularly distributed within the volume of a ball of a given radius\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, defaultp> ballRand(T Radius);\n\n\t/// @}\n}//namespace glm\n\n#include \"random.inl\"\n"}, {"path": "includes/glm/gtc/reciprocal.hpp", "language": "code", "loc": 117, "comment_density": 0.726, "code": "/// @ref gtc_reciprocal\n/// @file glm/gtc/reciprocal.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_reciprocal GLM_GTC_reciprocal\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Define secant, cosecant and cotangent functions.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_reciprocal extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_reciprocal\n\t/// @{\n\n\t/// Secant function.\n\t/// hypotenuse / adjacent or 1 / cos(x)\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType sec(genType angle);\n\n\t/// Cosecant function.\n\t/// hypotenuse / opposite or 1 / sin(x)\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType csc(genType angle);\n\n\t/// Cotangent function.\n\t/// adjacent / opposite or 1 / tan(x)\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType cot(genType angle);\n\n\t/// Inverse secant function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType asec(genType x);\n\n\t/// Inverse cosecant function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType acsc(genType x);\n\n\t/// Inverse cotangent function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType acot(genType x);\n\n\t/// Secant hyperbolic function.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType sech(genType angle);\n\n\t/// Cosecant hyperbolic function.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType csch(genType angle);\n\n\t/// Cotangent hyperbolic function.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType coth(genType angle);\n\n\t/// Inverse secant hyperbolic function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType asech(genType x);\n\n\t/// Inverse cosecant hyperbolic function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType acsch(genType x);\n\n\t/// Inverse cotangent hyperbolic function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType acoth(genType x);\n\n\t/// @}\n}//namespace glm\n\n#include \"reciprocal.inl\"\n"}, {"path": "includes/glm/gtc/round.hpp", "language": "code", "loc": 179, "comment_density": 0.737, "code": "/// @ref gtc_round\n/// @file glm/gtc/round.hpp\n///\n/// @see core (dependence)\n/// @see gtc_round (dependence)\n///\n/// @defgroup gtc_round GLM_GTC_round\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Rounding value to specific boundings\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../detail/_vectorize.hpp\"\n#include \"../vector_relational.hpp\"\n#include \"../common.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_integer extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_round\n\t/// @{\n\n\t/// Return true if the value is a power of two number.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL bool isPowerOfTwo(genIUType v);\n\n\t/// Return true if the value is a power of two number.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec isPowerOfTwo(vec const& v);\n\n\t/// Return the power of two number which value is just higher the input value,\n\t/// round up to a power of two.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genIUType ceilPowerOfTwo(genIUType v);\n\n\t/// Return the power of two number which value is just higher the input value,\n\t/// round up to a power of two.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec ceilPowerOfTwo(vec const& v);\n\n\t/// Return the power of two number which value is just lower the input value,\n\t/// round down to a power of two.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genIUType floorPowerOfTwo(genIUType v);\n\n\t/// Return the power of two number which value is just lower the input value,\n\t/// round down to a power of two.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec floorPowerOfTwo(vec const& v);\n\n\t/// Return the power of two number which value is the closet to the input value.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genIUType roundPowerOfTwo(genIUType v);\n\n\t/// Return the power of two number which value is the closet to the input value.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec roundPowerOfTwo(vec const& v);\n\n\t/// Return true if the 'Value' is a multiple of 'Multiple'.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL bool isMultiple(genIUType v, genIUType Multiple);\n\n\t/// Return true if the 'Value' is a multiple of 'Multiple'.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec isMultiple(vec const& v, T Multiple);\n\n\t/// Return true if the 'Value' is a multiple of 'Multiple'.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec isMultiple(vec const& v, vec const& Multiple);\n\n\t/// Higher multiple number of Source.\n\t///\n\t/// @tparam genType Floating-point or integer scalar or vector types.\n\t///\n\t/// @param v Source value to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genType ceilMultiple(genType v, genType Multiple);\n\n\t/// Higher multiple number of Source.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @param v Source values to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec ceilMultiple(vec const& v, vec const& Multiple);\n\n\t/// Lower multiple number of Source.\n\t///\n\t/// @tparam genType Floating-point or integer scalar or vector types.\n\t///\n\t/// @param v Source value to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genType floorMultiple(genType v, genType Multiple);\n\n\t/// Lower multiple number of Source.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @param v Source values to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec floorMultiple(vec const& v, vec const& Multiple);\n\n\t/// Lower multiple number of Source.\n\t///\n\t/// @tparam genType Floating-point or integer scalar or vector types.\n\t///\n\t/// @param v Source value to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genType roundMultiple(genType v, genType Multiple);\n\n\t/// Lower multiple number of Source.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @param v Source values to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec roundMultiple(vec const& v, vec const& Multiple);\n\n\t/// @}\n} //namespace glm\n\n#include \"round.inl\"\n"}, {"path": "includes/glm/gtc/type_aligned.hpp", "language": "code", "loc": 931, "comment_density": 0.424, "code": "/// @ref gtc_type_aligned\n/// @file glm/gtc/type_aligned.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_type_aligned GLM_GTC_type_aligned\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Aligned types allowing SIMD optimizations of vectors and matrices types\n\n#pragma once\n\n#if (GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE)\n#\terror \"GLM: Aligned gentypes require to enable C++ language extensions. Define GLM_FORCE_ALIGNED_GENTYPES before including GLM headers to use aligned types.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n# pragma message(\"GLM: GLM_GTC_type_aligned extension included\")\n#endif\n\n#include \"../mat4x4.hpp\"\n#include \"../mat4x3.hpp\"\n#include \"../mat4x2.hpp\"\n#include \"../mat3x4.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat3x2.hpp\"\n#include \"../mat2x4.hpp\"\n#include \"../mat2x3.hpp\"\n#include \"../mat2x2.hpp\"\n#include \"../gtc/vec1.hpp\"\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup gtc_type_aligned\n\t/// @{\n\n\t// -- *vec1 --\n\n\t/// 1 component vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, aligned_highp>\taligned_highp_vec1;\n\n\t/// 1 component vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, aligned_mediump>\taligned_mediump_vec1;\n\n\t/// 1 component vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, aligned_lowp>\t\taligned_lowp_vec1;\n\n\t/// 1 component vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, aligned_highp>\taligned_highp_dvec1;\n\n\t/// 1 component vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, aligned_mediump>\taligned_mediump_dvec1;\n\n\t/// 1 component vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, aligned_lowp>\taligned_lowp_dvec1;\n\n\t/// 1 component vector aligned in memory of signed integer numbers.\n\ttypedef vec<1, int, aligned_highp>\t\taligned_highp_ivec1;\n\n\t/// 1 component vector aligned in memory of signed integer numbers.\n\ttypedef vec<1, int, aligned_mediump>\taligned_mediump_ivec1;\n\n\t/// 1 component vector aligned in memory of signed integer numbers.\n\ttypedef vec<1, int, aligned_lowp>\t\taligned_lowp_ivec1;\n\n\t/// 1 component vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, aligned_highp>\t\taligned_highp_uvec1;\n\n\t/// 1 component vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, aligned_mediump>\taligned_mediump_uvec1;\n\n\t/// 1 component vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, aligned_lowp>\t\taligned_lowp_uvec1;\n\n\t/// 1 component vector aligned in memory of bool values.\n\ttypedef vec<1, bool, aligned_highp>\t\taligned_highp_bvec1;\n\n\t/// 1 component vector aligned in memory of bool values.\n\ttypedef vec<1, bool, aligned_mediump>\taligned_mediump_bvec1;\n\n\t/// 1 component vector aligned in memory of bool values.\n\ttypedef vec<1, bool, aligned_lowp>\t\taligned_lowp_bvec1;\n\n\t/// 1 component vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, packed_highp>\t\tpacked_highp_vec1;\n\n\t/// 1 component vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, packed_mediump>\tpacked_mediump_vec1;\n\n\t/// 1 component vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, packed_lowp>\t\tpacked_lowp_vec1;\n\n\t/// 1 component vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, packed_highp>\tpacked_highp_dvec1;\n\n\t/// 1 component vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, packed_mediump>\tpacked_mediump_dvec1;\n\n\t/// 1 component vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, packed_lowp>\t\tpacked_lowp_dvec1;\n\n\t/// 1 component vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<1, int, packed_highp>\t\tpacked_highp_ivec1;\n\n\t/// 1 component vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<1, int, packed_mediump>\t\tpacked_mediump_ivec1;\n\n\t/// 1 component vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<1, int, packed_lowp>\t\tpacked_lowp_ivec1;\n\n\t/// 1 component vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, packed_highp>\t\tpacked_highp_uvec1;\n\n\t/// 1 component vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, packed_mediump>\tpacked_mediump_uvec1;\n\n\t/// 1 component vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, packed_lowp>\t\tpacked_lowp_uvec1;\n\n\t/// 1 component vector tightly packed in memory of bool values.\n\ttypedef vec<1, bool, packed_highp>\t\tpacked_highp_bvec1;\n\n\t/// 1 component vector tightly packed in memory of bool values.\n\ttypedef vec<1, bool, packed_mediump>\tpacked_mediump_bvec1;\n\n\t/// 1 component vector tightly packed in memory of bool values.\n\ttypedef vec<1, bool, packed_lowp>\t\tpacked_lowp_bvec1;\n\n\t// -- *vec2 --\n\n\t/// 2 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, aligned_highp>\taligned_highp_vec2;\n\n\t/// 2 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, aligned_mediump>\taligned_mediump_vec2;\n\n\t/// 2 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, aligned_lowp>\t\taligned_lowp_vec2;\n\n\t/// 2 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, aligned_highp>\taligned_highp_dvec2;\n\n\t/// 2 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, aligned_mediump>\taligned_mediump_dvec2;\n\n\t/// 2 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, aligned_lowp>\taligned_lowp_dvec2;\n\n\t/// 2 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<2, int, aligned_highp>\t\taligned_highp_ivec2;\n\n\t/// 2 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<2, int, aligned_mediump>\taligned_mediump_ivec2;\n\n\t/// 2 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<2, int, aligned_lowp>\t\taligned_lowp_ivec2;\n\n\t/// 2 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, aligned_highp>\t\taligned_highp_uvec2;\n\n\t/// 2 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, aligned_mediump>\taligned_mediump_uvec2;\n\n\t/// 2 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, aligned_lowp>\t\taligned_lowp_uvec2;\n\n\t/// 2 components vector aligned in memory of bool values.\n\ttypedef vec<2, bool, aligned_highp>\t\taligned_highp_bvec2;\n\n\t/// 2 components vector aligned in memory of bool values.\n\ttypedef vec<2, bool, aligned_mediump>\taligned_mediump_bvec2;\n\n\t/// 2 components vector aligned in memory of bool values.\n\ttypedef vec<2, bool, aligned_lowp>\t\taligned_lowp_bvec2;\n\n\t/// 2 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, packed_highp>\t\tpacked_highp_vec2;\n\n\t/// 2 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, packed_mediump>\tpacked_mediump_vec2;\n\n\t/// 2 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, packed_lowp>\t\tpacked_lowp_vec2;\n\n\t/// 2 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, packed_highp>\tpacked_highp_dvec2;\n\n\t/// 2 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, packed_mediump>\tpacked_mediump_dvec2;\n\n\t/// 2 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, packed_lowp>\t\tpacked_lowp_dvec2;\n\n\t/// 2 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<2, int, packed_highp>\t\tpacked_highp_ivec2;\n\n\t/// 2 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<2, int, packed_mediump>\t\tpacked_mediump_ivec2;\n\n\t/// 2 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<2, int, packed_lowp>\t\tpacked_lowp_ivec2;\n\n\t/// 2 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, packed_highp>\t\tpacked_highp_uvec2;\n\n\t/// 2 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, packed_mediump>\tpacked_mediump_uvec2;\n\n\t/// 2 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, packed_lowp>\t\tpacked_lowp_uvec2;\n\n\t/// 2 components vector tightly packed in memory of bool values.\n\ttypedef vec<2, bool, packed_highp>\t\tpacked_highp_bvec2;\n\n\t/// 2 components vector tightly packed in memory of bool values.\n\ttypedef vec<2, bool, packed_mediump>\tpacked_mediump_bvec2;\n\n\t/// 2 components vector tightly packed in memory of bool values.\n\ttypedef vec<2, bool, packed_lowp>\t\tpacked_lowp_bvec2;\n\n\t// -- *vec3 --\n\n\t/// 3 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, aligned_highp>\taligned_highp_vec3;\n\n\t/// 3 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, aligned_mediump>\taligned_mediump_vec3;\n\n\t/// 3 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, aligned_lowp>\t\taligned_lowp_vec3;\n\n\t/// 3 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, aligned_highp>\taligned_highp_dvec3;\n\n\t/// 3 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, aligned_mediump>\taligned_mediump_dvec3;\n\n\t/// 3 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, aligned_lowp>\taligned_lowp_dvec3;\n\n\t/// 3 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<3, int, aligned_highp>\t\taligned_highp_ivec3;\n\n\t/// 3 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<3, int, aligned_mediump>\taligned_mediump_ivec3;\n\n\t/// 3 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<3, int, aligned_lowp>\t\taligned_lowp_ivec3;\n\n\t/// 3 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, aligned_highp>\t\taligned_highp_uvec3;\n\n\t/// 3 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, aligned_mediump>\taligned_mediump_uvec3;\n\n\t/// 3 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, aligned_lowp>\t\taligned_lowp_uvec3;\n\n\t/// 3 components vector aligned in memory of bool values.\n\ttypedef vec<3, bool, aligned_highp>\t\taligned_highp_bvec3;\n\n\t/// 3 components vector aligned in memory of bool values.\n\ttypedef vec<3, bool, aligned_mediump>\taligned_mediump_bvec3;\n\n\t/// 3 components vector aligned in memory of bool values.\n\ttypedef vec<3, bool, aligned_lowp>\t\taligned_lowp_bvec3;\n\n\t/// 3 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, packed_highp>\t\tpacked_highp_vec3;\n\n\t/// 3 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, packed_mediump>\tpacked_mediump_vec3;\n\n\t/// 3 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, packed_lowp>\t\tpacked_lowp_vec3;\n\n\t/// 3 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, packed_highp>\tpacked_highp_dvec3;\n\n\t/// 3 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, packed_mediump>\tpacked_mediump_dvec3;\n\n\t/// 3 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, packed_lowp>\t\tpacked_lowp_dvec3;\n\n\t/// 3 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<3, int, packed_highp>\t\tpacked_highp_ivec3;\n\n\t/// 3 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<3, int, packed_mediump>\t\tpacked_mediump_ivec3;\n\n\t/// 3 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<3, int, packed_lowp>\t\tpacked_lowp_ivec3;\n\n\t/// 3 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, packed_highp>\t\tpacked_highp_uvec3;\n\n\t/// 3 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, packed_mediump>\tpacked_mediump_uvec3;\n\n\t/// 3 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, packed_lowp>\t\tpacked_lowp_uvec3;\n\n\t/// 3 components vector tightly packed in memory of bool values.\n\ttypedef vec<3, bool, packed_highp>\t\tpacked_highp_bvec3;\n\n\t/// 3 components vector tightly packed in memory of bool values.\n\ttypedef vec<3, bool, packed_mediump>\tpacked_mediump_bvec3;\n\n\t/// 3 components vector tightly packed in memory of bool values.\n\ttypedef vec<3, bool, packed_lowp>\t\tpacked_lowp_bvec3;\n\n\t// -- *vec4 --\n\n\t/// 4 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, aligned_highp>\taligned_highp_vec4;\n\n\t/// 4 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, aligned_mediump>\taligned_mediump_vec4;\n\n\t/// 4 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, aligned_lowp>\t\taligned_lowp_vec4;\n\n\t/// 4 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, aligned_highp>\taligned_highp_dvec4;\n\n\t/// 4 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, aligned_mediump>\taligned_mediump_dvec4;\n\n\t/// 4 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, aligned_lowp>\taligned_lowp_dvec4;\n\n\t/// 4 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<4, int, aligned_highp>\t\taligned_highp_ivec4;\n\n\t/// 4 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<4, int, aligned_mediump>\taligned_mediump_ivec4;\n\n\t/// 4 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<4, int, aligned_lowp>\t\taligned_lowp_ivec4;\n\n\t/// 4 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, aligned_highp>\t\taligned_highp_uvec4;\n\n\t/// 4 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, aligned_mediump>\taligned_mediump_uvec4;\n\n\t/// 4 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, aligned_lowp>\t\taligned_lowp_uvec4;\n\n\t/// 4 components vector aligned in memory of bool values.\n\ttypedef vec<4, bool, aligned_highp>\t\taligned_highp_bvec4;\n\n\t/// 4 components vector aligned in memory of bool values.\n\ttypedef vec<4, bool, aligned_mediump>\taligned_mediump_bvec4;\n\n\t/// 4 components vector aligned in memory of bool values.\n\ttypedef vec<4, bool, aligned_lowp>\t\taligned_lowp_bvec4;\n\n\t/// 4 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, packed_highp>\t\tpacked_highp_vec4;\n\n\t/// 4 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, packed_mediump>\tpacked_mediump_vec4;\n\n\t/// 4 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, packed_lowp>\t\tpacked_lowp_vec4;\n\n\t/// 4 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, packed_highp>\tpacked_highp_dvec4;\n\n\t/// 4 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, packed_mediump>\tpacked_mediump_dvec4;\n\n\t/// 4 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, packed_lowp>\t\tpacked_lowp_dvec4;\n\n\t/// 4 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<4, int, packed_highp>\t\tpacked_highp_ivec4;\n\n\t/// 4 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<4, int, packed_mediump>\t\tpacked_mediump_ivec4;\n\n\t/// 4 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<4, int, packed_lowp>\t\tpacked_lowp_ivec4;\n\n\t/// 4 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, packed_highp>\t\tpacked_highp_uvec4;\n\n\t/// 4 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, packed_mediump>\tpacked_mediump_uvec4;\n\n\t/// 4 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, packed_lowp>\t\tpacked_lowp_uvec4;\n\n\t/// 4 components vector tightly packed in memory of bool values.\n\ttypedef vec<4, bool, packed_highp>\t\tpacked_highp_bvec4;\n\n\t/// 4 components vector tightly packed in memory of bool values.\n\ttypedef vec<4, bool, packed_mediump>\tpacked_mediump_bvec4;\n\n\t/// 4 components vector tightly packed in memory of bool values.\n\ttypedef vec<4, bool, packed_lowp>\t\tpacked_lowp_bvec4;\n\n\t// -- *mat2 --\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_highp>\t\taligned_highp_mat2;\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_mediump>\taligned_mediump_mat2;\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_lowp>\t\taligned_lowp_mat2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_highp>\taligned_highp_dmat2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_mediump>\taligned_mediump_dmat2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_lowp>\t\taligned_lowp_dmat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_highp>\t\tpacked_highp_mat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_mediump>\tpacked_mediump_mat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_lowp>\t\tpacked_lowp_mat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_highp>\t\tpacked_highp_dmat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_mediump>\tpacked_mediump_dmat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_lowp>\t\tpacked_lowp_dmat2;\n\n\t// -- *mat3 --\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_highp>\t\taligned_highp_mat3;\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_mediump>\taligned_mediump_mat3;\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_lowp>\t\taligned_lowp_mat3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_highp>\taligned_highp_dmat3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_mediump>\taligned_mediump_dmat3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_lowp>\t\taligned_lowp_dmat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_highp>\t\tpacked_highp_mat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_mediump>\tpacked_mediump_mat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_lowp>\t\tpacked_lowp_mat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_highp>\t\tpacked_highp_dmat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_mediump>\tpacked_mediump_dmat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_lowp>\t\tpacked_lowp_dmat3;\n\n\t// -- *mat4 --\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_highp>\t\taligned_highp_mat4;\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_mediump>\taligned_mediump_mat4;\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_lowp>\t\taligned_lowp_mat4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_highp>\taligned_highp_dmat4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_mediump>\taligned_mediump_dmat4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_lowp>\t\taligned_lowp_dmat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_highp>\t\tpacked_highp_mat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_mediump>\tpacked_mediump_mat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_lowp>\t\tpacked_lowp_mat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_highp>\t\tpacked_highp_dmat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_mediump>\tpacked_mediump_dmat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_lowp>\t\tpacked_lowp_dmat4;\n\n\t// -- *mat2x2 --\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_highp>\t\taligned_highp_mat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_mediump>\taligned_mediump_mat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_lowp>\t\taligned_lowp_mat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_highp>\taligned_highp_dmat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_mediump>\taligned_mediump_dmat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_lowp>\t\taligned_lowp_dmat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_highp>\t\tpacked_highp_mat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_mediump>\tpacked_mediump_mat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_lowp>\t\tpacked_lowp_mat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_highp>\t\tpacked_highp_dmat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_mediump>\tpacked_mediump_dmat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_lowp>\t\tpacked_lowp_dmat2x2;\n\n\t// -- *mat2x3 --\n\n\t/// 2 by 3 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, aligned_highp>\t\taligned_highp_mat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, aligned_mediump>\taligned_mediump_mat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, aligned_lowp>\t\taligned_lowp_mat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, aligned_highp>\taligned_highp_dmat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, aligned_mediump>\taligned_mediump_dmat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, aligned_lowp>\t\taligned_lowp_dmat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, packed_highp>\t\tpacked_highp_mat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, packed_mediump>\tpacked_mediump_mat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, packed_lowp>\t\tpacked_lowp_mat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, packed_highp>\t\tpacked_highp_dmat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, packed_mediump>\tpacked_mediump_dmat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, packed_lowp>\t\tpacked_lowp_dmat2x3;\n\n\t// -- *mat2x4 --\n\n\t/// 2 by 4 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, aligned_highp>\t\taligned_highp_mat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, aligned_mediump>\taligned_mediump_mat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, aligned_lowp>\t\taligned_lowp_mat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, aligned_highp>\taligned_highp_dmat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, aligned_mediump>\taligned_mediump_dmat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, aligned_lowp>\t\taligned_lowp_dmat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, packed_highp>\t\tpacked_highp_mat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, packed_mediump>\tpacked_mediump_mat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, packed_lowp>\t\tpacked_lowp_mat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, packed_highp>\t\tpacked_highp_dmat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, packed_mediump>\tpacked_mediump_dmat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, packed_lowp>\t\tpacked_lowp_dmat2x4;\n\n\t// -- *mat3x2 --\n\n\t/// 3 by 2 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, aligned_highp>\t\taligned_highp_mat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, aligned_mediump>\taligned_mediump_mat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, aligned_lowp>\t\taligned_lowp_mat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, aligned_highp>\taligned_highp_dmat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, aligned_mediump>\taligned_mediump_dmat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, aligned_lowp>\t\taligned_lowp_dmat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, packed_highp>\t\tpacked_highp_mat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, packed_mediump>\tpacked_mediump_mat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, packed_lowp>\t\tpacked_lowp_mat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, packed_highp>\t\tpacked_highp_dmat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, packed_mediump>\tpacked_mediump_dmat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, packed_lowp>\t\tpacked_lowp_dmat3x2;\n\n\t// -- *mat3x3 --\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_highp>\t\taligned_highp_mat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_mediump>\taligned_mediump_mat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_lowp>\t\taligned_lowp_mat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_highp>\taligned_highp_dmat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_mediump>\taligned_mediump_dmat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_lowp>\t\taligned_lowp_dmat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_highp>\t\tpacked_highp_mat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_mediump>\tpacked_mediump_mat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_lowp>\t\tpacked_lowp_mat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_highp>\t\tpacked_highp_dmat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_mediump>\tpacked_mediump_dmat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_lowp>\t\tpacked_lowp_dmat3x3;\n\n\t// -- *mat3x4 --\n\n\t/// 3 by 4 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, aligned_highp>\t\taligned_highp_mat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, aligned_mediump>\taligned_mediump_mat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, aligned_lowp>\t\taligned_lowp_mat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, aligned_highp>\taligned_highp_dmat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, aligned_mediump>\taligned_mediump_dmat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, aligned_lowp>\t\taligned_lowp_dmat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, packed_highp>\t\tpacked_highp_mat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, packed_mediump>\tpacked_mediump_mat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, packed_lowp>\t\tpacked_lowp_mat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, packed_highp>\t\tpacked_highp_dmat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, packed_mediump>\tpacked_mediump_dmat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, packed_lowp>\t\tpacked_lowp_dmat3x4;\n\n\t// -- *mat4x2 --\n\n\t/// 4 by 2 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, aligned_highp>\t\taligned_highp_mat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, aligned_mediump>\taligned_mediump_mat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, aligned_lowp>\t\taligned_lowp_mat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, aligned_highp>\taligned_highp_dmat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, aligned_mediump>\taligned_mediump_dmat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, aligned_lowp>\t\taligned_lowp_dmat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, packed_highp>\t\tpacked_highp_mat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, packed_mediump>\tpacked_mediump_mat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, packed_lowp>\t\tpacked_lowp_mat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, packed_highp>\t\tpacked_highp_dmat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, packed_mediump>\tpacked_mediump_dmat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, packed_lowp>\t\tpacked_lowp_dmat4x2;\n\n\t// -- *mat4x3 --\n\n\t/// 4 by 3 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, aligned_highp>\t\taligned_highp_mat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, aligned_mediump>\taligned_mediump_mat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, aligned_lowp>\t\taligned_lowp_mat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, aligned_highp>\taligned_highp_dmat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, aligned_mediump>\taligned_mediump_dmat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, aligned_lowp>\t\taligned_lowp_dmat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, packed_highp>\t\tpacked_highp_mat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, packed_mediump>\tpacked_mediump_mat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, packed_lowp>\t\tpacked_lowp_mat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, packed_highp>\t\tpacked_highp_dmat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, packed_mediump>\tpacked_mediump_dmat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, packed_lowp>\t\tpacked_lowp_dmat4x3;\n\n\t// -- *mat4x4 --\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_highp>\t\taligned_highp_mat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_mediump>\taligned_mediump_mat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_lowp>\t\taligned_lowp_mat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_highp>\taligned_highp_dmat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_mediump>\taligned_mediump_dmat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_lowp>\t\taligned_lowp_dmat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_highp>\t\tpacked_highp_mat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_mediump>\tpacked_mediump_mat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_lowp>\t\tpacked_lowp_mat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_highp>\t\tpacked_highp_dmat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_mediump>\tpacked_mediump_dmat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_lowp>\t\tpacked_lowp_dmat4x4;\n\n\t// -- default --\n\n#if(defined(GLM_PRECISION_LOWP_FLOAT))\n\ttypedef aligned_lowp_vec1\t\t\taligned_vec1;\n\ttypedef aligned_lowp_vec2\t\t\taligned_vec2;\n\ttypedef aligned_lowp_vec3\t\t\taligned_vec3;\n\ttypedef aligned_lowp_vec4\t\t\taligned_vec4;\n\ttypedef packed_lowp_vec1\t\t\tpacked_vec1;\n\ttypedef packed_lowp_vec2\t\t\tpacked_vec2;\n\ttypedef packed_lowp_vec3\t\t\tpacked_vec3;\n\ttypedef packed_lowp_vec4\t\t\tpacked_vec4;\n\n\ttypedef aligned_lowp_mat2\t\t\taligned_mat2;\n\ttypedef aligned_lowp_mat3\t\t\taligned_mat3;\n\ttypedef aligned_lowp_mat4\t\t\taligned_mat4;\n\ttypedef packed_lowp_mat2\t\t\tpacked_mat2;\n\ttypedef packed_lowp_mat3\t\t\tpacked_mat3;\n\ttypedef packed_lowp_mat4\t\t\tpacked_mat4;\n\n\ttypedef aligned_lowp_mat2x2\t\t\taligned_mat2x2;\n\ttypedef aligned_lowp_mat2x3\t\t\taligned_mat2x3;\n\ttypedef aligned_lowp_mat2x4\t\t\taligned_mat2x4;\n\ttypedef aligned_lowp_mat3x2\t\t\taligned_mat3x2;\n\ttypedef aligned_lowp_mat3x3\t\t\taligned_mat3x3;\n\ttypedef aligned_lowp_mat3x4\t\t\taligned_mat3x4;\n\ttypedef aligned_lowp_mat4x2\t\t\taligned_mat4x2;\n\ttypedef aligned_lowp_mat4x3\t\t\taligned_mat4x3;\n\ttypedef aligned_lowp_mat4x4\t\t\taligned_mat4x4;\n\ttypedef packed_lowp_mat2x2\t\t\tpacked_mat2x2;\n\ttypedef packed_lowp_mat2x3\t\t\tpacked_mat2x3;\n\ttypedef packed_lowp_mat2x4\t\t\tpacked_mat2x4;\n\ttypedef packed_lowp_mat3x2\t\t\tpacked_mat3x2;\n\ttypedef packed_lowp_mat3x3\t\t\tpacked_mat3x3;\n\ttypedef packed_lowp_mat3x4\t\t\tpacked_mat3x4;\n\ttypedef packed_lowp_mat4x2\t\t\tpacked_mat4x2;\n\ttypedef packed_lowp_mat4x3\t\t\tpacked_mat4x3;\n\ttypedef packed_lowp_mat4x4\t\t\tpacked_mat4x4;\n#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))\n\ttypedef aligned_mediump_vec1\t\taligned_vec1;\n\ttypedef aligned_mediump_vec2\t\taligned_vec2;\n\ttypedef aligned_mediump_vec3\t\taligned_vec3;\n\ttypedef aligned_mediump_vec4\t\taligned_vec4;\n\ttypedef packed_mediump_vec1\t\t\tpacked_vec1;\n\ttypedef packed_mediump_vec2\t\t\tpacked_vec2;\n\ttypedef packed_mediump_vec3\t\t\tpacked_vec3;\n\ttypedef packed_mediump_vec4\t\t\tpacked_vec4;\n\n\ttypedef aligned_mediump_mat2\t\taligned_mat2;\n\ttypedef aligned_mediump_mat3\t\taligned_mat3;\n\ttypedef aligned_mediump_mat4\t\taligned_mat4;\n\ttypedef packed_mediump_mat2\t\t\tpacked_mat2;\n\ttypedef packed_mediump_mat3\t\t\tpacked_mat3;\n\ttypedef packed_mediump_mat4\t\t\tpacked_mat4;\n\n\ttypedef aligned_mediump_mat2x2\t\taligned_mat2x2;\n\ttypedef aligned_mediump_mat2x3\t\taligned_mat2x3;\n\ttypedef aligned_mediump_mat2x4\t\taligned_mat2x4;\n\ttypedef aligned_mediump_mat3x2\t\taligned_mat3x2;\n\ttypedef aligned_mediump_mat3x3\t\taligned_mat3x3;\n\ttypedef aligned_mediump_mat3x4\t\taligned_mat3x4;\n\ttypedef aligned_mediump_mat4x2\t\taligned_mat4x2;\n\ttypedef aligned_mediump_mat4x3\t\taligned_mat4x3;\n\ttypedef aligned_mediump_mat4x4\t\taligned_mat4x4;\n\ttypedef packed_mediump_mat2x2\t\tpacked_mat2x2;\n\ttypedef packed_mediump_mat2x3\t\tpacked_mat2x3;\n\ttypedef packed_mediump_mat2x4\t\tpacked_mat2x4;\n\ttypedef packed_mediump_mat3x2\t\tpacked_mat3x2;\n\ttypedef packed_mediump_mat3x3\t\tpacked_mat3x3;\n\ttypedef packed_mediump_mat3x4\t\tpacked_mat3x4;\n\ttypedef packed_mediump_mat4x2\t\tpacked_mat4x2;\n\ttypedef packed_mediump_mat4x3\t\tpacked_mat4x3;\n\ttypedef packed_mediump_mat4x4\t\tpacked_mat4x4;\n#else //defined(GLM_PRECISION_HIGHP_FLOAT)\n\t/// 1 component vector aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_vec1\t\t\taligned_vec1;\n\n\t/// 2 components vector aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_vec2\t\t\taligned_vec2;\n\n\t/// 3 components vector aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_vec3\t\t\taligned_vec3;\n\n\t/// 4 components vector aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_vec4 \t\t\taligned_vec4;\n\n\t/// 1 component vector tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_vec1\t\t\tpacked_vec1;\n\n\t/// 2 components vector tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_vec2\t\t\tpacked_vec2;\n\n\t/// 3 components vector tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_vec3\t\t\tpacked_vec3;\n\n\t/// 4 components vector tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_vec4\t\t\tpacked_vec4;\n\n\t/// 2 by 2 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat2\t\t\taligned_mat2;\n\n\t/// 3 by 3 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat3\t\t\taligned_mat3;\n\n\t/// 4 by 4 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat4\t\t\taligned_mat4;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat2\t\t\tpacked_mat2;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat3\t\t\tpacked_mat3;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat4\t\t\tpacked_mat4;\n\n\t/// 2 by 2 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat2x2\t\taligned_mat2x2;\n\n\t/// 2 by 3 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat2x3\t\taligned_mat2x3;\n\n\t/// 2 by 4 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat2x4\t\taligned_mat2x4;\n\n\t/// 3 by 2 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat3x2\t\taligned_mat3x2;\n\n\t/// 3 by 3 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat3x3\t\taligned_mat3x3;\n\n\t/// 3 by 4 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat3x4\t\taligned_mat3x4;\n\n\t/// 4 by 2 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat4x2\t\taligned_mat4x2;\n\n\t/// 4 by 3 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat4x3\t\taligned_mat4x3;\n\n\t/// 4 by 4 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat4x4\t\taligned_mat4x4;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat2x2\t\t\tpacked_mat2x2;\n\n\t/// 2 by 3 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat2x3\t\t\tpacked_mat2x3;\n\n\t/// 2 by 4 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat2x4\t\t\tpacked_mat2x4;\n\n\t/// 3 by 2 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat3x2\t\t\tpacked_mat3x2;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat3x3\t\t\tpacked_mat3x3;\n\n\t/// 3 by 4 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat3x4\t\t\tpacked_mat3x4;\n\n\t/// 4 by 2 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat4x2\t\t\tpacked_mat4x2;\n\n\t/// 4 by 3 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat4x3\t\t\tpacked_mat4x3;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat4x4\t\t\tpacked_mat4x4;\n#endif//GLM_PRECISION\n\n#if(defined(GLM_PRECISION_LOWP_DOUBLE))\n\ttypedef aligned_lowp_dvec1\t\t\taligned_dvec1;\n\ttypedef aligned_lowp_dvec2\t\t\taligned_dvec2;\n\ttypedef aligned_lowp_dvec3\t\t\taligned_dvec3;\n\ttypedef aligned_lowp_dvec4\t\t\taligned_dvec4;\n\ttypedef packed_lowp_dvec1\t\t\tpacked_dvec1;\n\ttypedef packed_lowp_dvec2\t\t\tpacked_dvec2;\n\ttypedef packed_lowp_dvec3\t\t\tpacked_dvec3;\n\ttypedef packed_lowp_dvec4\t\t\tpacked_dvec4;\n\n\ttypedef aligned_lowp_dmat2\t\t\taligned_dmat2;\n\ttypedef aligned_lowp_dmat3\t\t\taligned_dmat3;\n\ttypedef aligned_lowp_dmat4\t\t\taligned_dmat4;\n\ttypedef packed_lowp_dmat2\t\t\tpacked_dmat2;\n\ttypedef packed_lowp_dmat3\t\t\tpacked_dmat3;\n\ttypedef packed_lowp_dmat4\t\t\tpacked_dmat4;\n\n\ttypedef aligned_lowp_dmat2x2\t\taligned_dmat2x2;\n\ttypedef aligned_lowp_dmat2x3\t\taligned_dmat2x3;\n\ttypedef aligned_lowp_dmat2x4\t\taligned_dmat2x4;\n\ttypedef aligned_lowp_dmat3x2\t\taligned_dmat3x2;\n\ttypedef aligned_lowp_dmat3x3\t\taligned_dmat3x3;\n\ttypedef aligned_lowp_dmat3x4\t\taligned_dmat3x4;\n\ttypedef aligned_lowp_dmat4x2\t\taligned_dmat4x2;\n\ttypedef aligned_lowp_dmat4x3\t\taligned_dmat4x3;\n\ttypedef aligned_lowp_dmat4x4\t\taligned_dmat4x4;\n\ttypedef packed_lowp_dmat2x2\t\t\tpacked_dmat2x2;\n\ttypedef packed_lowp_dmat2x3\t\t\tpacked_dmat2x3;\n\ttypedef packed_lowp_dmat2x4\t\t\tpacked_dmat2x4;\n\ttypedef packed_lowp_dmat3x2\t\t\tpacked_dmat3x2;\n\ttypedef packed_lowp_dmat3x3\t\t\tpacked_dmat3x3;\n\ttypedef packed_lowp_dmat3x4\t\t\tpacked_dmat3x4;\n\ttypedef packed_lowp_dmat4x2\t\t\tpacked_dmat4x2;\n\ttypedef packed_lowp_dmat4x3\t\t\tpacked_dmat4x3;\n\ttypedef packed_lowp_dmat4x4\t\t\tpacked_dmat4x4;\n#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))\n\ttypedef aligned_mediump_dvec1\t\taligned_dvec1;\n\ttypedef aligned_mediump_dvec2\t\taligned_dvec2;\n\ttypedef aligned_mediump_dvec3\t\taligned_dvec3;\n\ttypedef aligned_mediump_dvec4\t\taligned_dvec4;\n\ttypedef packed_mediump_dvec1\t\tpacked_dvec1;\n\ttypedef packed_mediump_dvec2\t\tpacked_dvec2;\n\ttypedef packed_mediump_dvec3\t\tpacked_dvec3;\n\ttypedef packed_mediump_dvec4\t\tpacked_dvec4;\n\n\ttypedef aligned_mediump_dmat2\t\taligned_dmat2;\n\ttypedef aligned_mediump_dmat3\t\taligned_dmat3;\n\ttypedef aligned_mediump_dmat4\t\taligned_dmat4;\n\ttypedef packed_mediump_dmat2\t\tpacked_dmat2;\n\ttypedef packed_mediump_dmat3\t\tpacked_dmat3;\n\ttypedef packed_mediump_dmat4\t\tpacked_dmat4;\n\n\ttypedef aligned_mediump_dmat2x2\t\taligned_dmat2x2;\n\ttypedef aligned_mediump_dmat2x3\t\taligned_dmat2x3;\n\ttypedef aligned_mediump_dmat2x4\t\taligned_dmat2x4;\n\ttypedef aligned_mediump_dmat3x2\t\taligned_dmat3x2;\n\ttypedef aligned_mediump_dmat3x3\t\taligned_dmat3x3;\n\ttypedef aligned_mediump_dmat3x4\t\taligned_dmat3x4;\n\ttypedef aligned_mediump_dmat4x2\t\taligned_dmat4x2;\n\ttypedef aligned_mediump_dmat4x3\t\taligned_dmat4x3;\n\ttypedef aligned_mediump_dmat4x4\t\taligned_dmat4x4;\n\ttypedef packed_mediump_dmat2x2\t\tpacked_dmat2x2;\n\ttypedef packed_mediump_dmat2x3\t\tpacked_dmat2x3;\n\ttypedef packed_mediump_dmat2x4\t\tpacked_dmat2x4;\n\ttypedef packed_mediump_dmat3x2\t\tpacked_dmat3x2;\n\ttypedef packed_mediump_dmat3x3\t\tpacked_dmat3x3;\n\ttypedef packed_mediump_dmat3x4\t\tpacked_dmat3x4;\n\ttypedef packed_mediump_dmat4x2\t\tpacked_dmat4x2;\n\ttypedef packed_mediump_dmat4x3\t\tpacked_dmat4x3;\n\ttypedef packed_mediump_dmat4x4\t\tpacked_dmat4x4;\n#else //defined(GLM_PRECISION_HIGHP_DOUBLE)\n\t/// 1 component vector aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dvec1\t\t\taligned_dvec1;\n\n\t/// 2 components vector aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dvec2\t\t\taligned_dvec2;\n\n\t/// 3 components vector aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dvec3\t\t\taligned_dvec3;\n\n\t/// 4 components vector aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dvec4\t\t\taligned_dvec4;\n\n\t/// 1 component vector tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dvec1\t\t\tpacked_dvec1;\n\n\t/// 2 components vector tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dvec2\t\t\tpacked_dvec2;\n\n\t/// 3 components vector tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dvec3\t\t\tpacked_dvec3;\n\n\t/// 4 components vector tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dvec4\t\t\tpacked_dvec4;\n\n\t/// 2 by 2 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat2\t\t\taligned_dmat2;\n\n\t/// 3 by 3 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat3\t\t\taligned_dmat3;\n\n\t/// 4 by 4 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat4\t\t\taligned_dmat4;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat2\t\t\tpacked_dmat2;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat3\t\t\tpacked_dmat3;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat4\t\t\tpacked_dmat4;\n\n\t/// 2 by 2 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat2x2\t\taligned_dmat2x2;\n\n\t/// 2 by 3 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat2x3\t\taligned_dmat2x3;\n\n\t/// 2 by 4 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat2x4\t\taligned_dmat2x4;\n\n\t/// 3 by 2 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat3x2\t\taligned_dmat3x2;\n\n\t/// 3 by 3 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat3x3\t\taligned_dmat3x3;\n\n\t/// 3 by 4 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat3x4\t\taligned_dmat3x4;\n\n\t/// 4 by 2 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat4x2\t\taligned_dmat4x2;\n\n\t/// 4 by 3 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat4x3\t\taligned_dmat4x3;\n\n\t/// 4 by 4 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat4x4\t\taligned_dmat4x4;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat2x2\t\tpacked_dmat2x2;\n\n\t/// 2 by 3 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat2x3\t\tpacked_dmat2x3;\n\n\t/// 2 by 4 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat2x4\t\tpacked_dmat2x4;\n\n\t/// 3 by 2 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat3x2\t\tpacked_dmat3x2;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat3x3\t\tpacked_dmat3x3;\n\n\t/// 3 by 4 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat3x4\t\tpacked_dmat3x4;\n\n\t/// 4 by 2 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat4x2\t\tpacked_dmat4x2;\n\n\t/// 4 by 3 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat4x3\t\tpacked_dmat4x3;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat4x4\t\tpacked_dmat4x4;\n#endif//GLM_PRECISION\n\n#if(defined(GLM_PRECISION_LOWP_INT))\n\ttypedef aligned_lowp_ivec1\t\t\taligned_ivec1;\n\ttypedef aligned_lowp_ivec2\t\t\taligned_ivec2;\n\ttypedef aligned_lowp_ivec3\t\t\taligned_ivec3;\n\ttypedef aligned_lowp_ivec4\t\t\taligned_ivec4;\n#elif(defined(GLM_PRECISION_MEDIUMP_INT))\n\ttypedef aligned_mediump_ivec1\t\taligned_ivec1;\n\ttypedef aligned_mediump_ivec2\t\taligned_ivec2;\n\ttypedef aligned_mediump_ivec3\t\taligned_ivec3;\n\ttypedef aligned_mediump_ivec4\t\taligned_ivec4;\n#else //defined(GLM_PRECISION_HIGHP_INT)\n\t/// 1 component vector aligned in memory of signed integer numbers.\n\ttypedef aligned_highp_ivec1\t\t\taligned_ivec1;\n\n\t/// 2 components vector aligned in memory of signed integer numbers.\n\ttypedef aligned_highp_ivec2\t\t\taligned_ivec2;\n\n\t/// 3 components vector aligned in memory of signed integer numbers.\n\ttypedef aligned_highp_ivec3\t\t\taligned_ivec3;\n\n\t/// 4 components vector aligned in memory of signed integer numbers.\n\ttypedef aligned_highp_ivec4\t\t\taligned_ivec4;\n\n\t/// 1 component vector tightly packed in memory of signed integer numbers.\n\ttypedef packed_highp_ivec1\t\t\tpacked_ivec1;\n\n\t/// 2 components vector tightly packed in memory of signed integer numbers.\n\ttypedef packed_highp_ivec2\t\t\tpacked_ivec2;\n\n\t/// 3 components vector tightly packed in memory of signed integer numbers.\n\ttypedef packed_highp_ivec3\t\t\tpacked_ivec3;\n\n\t/// 4 components vector tightly packed in memory of signed integer numbers.\n\ttypedef packed_highp_ivec4\t\t\tpacked_ivec4;\n#endif//GLM_PRECISION\n\n\t// -- Unsigned integer definition --\n\n#if(defined(GLM_PRECISION_LOWP_UINT))\n\ttypedef aligned_lowp_uvec1\t\t\taligned_uvec1;\n\ttypedef aligned_lowp_uvec2\t\t\taligned_uvec2;\n\ttypedef aligned_lowp_uvec3\t\t\taligned_uvec3;\n\ttypedef aligned_lowp_uvec4\t\t\taligned_uvec4;\n#elif(defined(GLM_PRECISION_MEDIUMP_UINT))\n\ttypedef aligned_mediump_uvec1\t\taligned_uvec1;\n\ttypedef aligned_mediump_uvec2\t\taligned_uvec2;\n\ttypedef aligned_mediump_uvec3\t\taligned_uvec3;\n\ttypedef aligned_mediump_uvec4\t\taligned_uvec4;\n#else //defined(GLM_PRECISION_HIGHP_UINT)\n\t/// 1 component vector aligned in memory of unsigned integer numbers.\n\ttypedef aligned_highp_uvec1\t\t\taligned_uvec1;\n\n\t/// 2 components vector aligned in memory of unsigned integer numbers.\n\ttypedef aligned_highp_uvec2\t\t\taligned_uvec2;\n\n\t/// 3 components vector aligned in memory of unsigned integer numbers.\n\ttypedef aligned_highp_uvec3\t\t\taligned_uvec3;\n\n\t/// 4 components vector aligned in memory of unsigned integer numbers.\n\ttypedef aligned_highp_uvec4\t\t\taligned_uvec4;\n\n\t/// 1 component vector tightly packed in memory of unsigned integer numbers.\n\ttypedef packed_highp_uvec1\t\t\tpacked_uvec1;\n\n\t/// 2 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef packed_highp_uvec2\t\t\tpacked_uvec2;\n\n\t/// 3 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef packed_highp_uvec3\t\t\tpacked_uvec3;\n\n\t/// 4 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef packed_highp_uvec4\t\t\tpacked_uvec4;\n#endif//GLM_PRECISION\n\n#if(defined(GLM_PRECISION_LOWP_BOOL))\n\ttypedef aligned_lowp_bvec1\t\t\taligned_bvec1;\n\ttypedef aligned_lowp_bvec2\t\t\taligned_bvec2;\n\ttypedef aligned_lowp_bvec3\t\t\taligned_bvec3;\n\ttypedef aligned_lowp_bvec4\t\t\taligned_bvec4;\n#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))\n\ttypedef aligned_mediump_bvec1\t\taligned_bvec1;\n\ttypedef aligned_mediump_bvec2\t\taligned_bvec2;\n\ttypedef aligned_mediump_bvec3\t\taligned_bvec3;\n\ttypedef aligned_mediump_bvec4\t\taligned_bvec4;\n#else //defined(GLM_PRECISION_HIGHP_BOOL)\n\t/// 1 component vector aligned in memory of bool values.\n\ttypedef aligned_highp_bvec1\t\t\taligned_bvec1;\n\n\t/// 2 components vector aligned in memory of bool values.\n\ttypedef aligned_highp_bvec2\t\t\taligned_bvec2;\n\n\t/// 3 components vector aligned in memory of bool values.\n\ttypedef aligned_highp_bvec3\t\t\taligned_bvec3;\n\n\t/// 4 components vector aligned in memory of bool values.\n\ttypedef aligned_highp_bvec4\t\t\taligned_bvec4;\n\n\t/// 1 components vector tightly packed in memory of bool values.\n\ttypedef packed_highp_bvec1\t\t\tpacked_bvec1;\n\n\t/// 2 components vector tightly packed in memory of bool values.\n\ttypedef packed_highp_bvec2\t\t\tpacked_bvec2;\n\n\t/// 3 components vector tightly packed in memory of bool values.\n\ttypedef packed_highp_bvec3\t\t\tpacked_bvec3;\n\n\t/// 4 components vector tightly packed in memory of bool values.\n\ttypedef packed_highp_bvec4\t\t\tpacked_bvec4;\n#endif//GLM_PRECISION\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/gtc/type_precision.hpp", "language": "code", "loc": 1544, "comment_density": 0.671, "code": "/// @ref gtc_type_precision\n/// @file glm/gtc/type_precision.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtc_type_precision GLM_GTC_type_precision\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines specific C++-based qualifier types.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtc/vec1.hpp\"\n#include \"../ext/scalar_int_sized.hpp\"\n#include \"../ext/scalar_uint_sized.hpp\"\n#include \"../detail/type_vec2.hpp\"\n#include \"../detail/type_vec3.hpp\"\n#include \"../detail/type_vec4.hpp\"\n#include \"../detail/type_mat2x2.hpp\"\n#include \"../detail/type_mat2x3.hpp\"\n#include \"../detail/type_mat2x4.hpp\"\n#include \"../detail/type_mat3x2.hpp\"\n#include \"../detail/type_mat3x3.hpp\"\n#include \"../detail/type_mat3x4.hpp\"\n#include \"../detail/type_mat4x2.hpp\"\n#include \"../detail/type_mat4x3.hpp\"\n#include \"../detail/type_mat4x4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_type_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t///////////////////////////\n\t// Signed int vector types\n\n\t/// @addtogroup gtc_type_precision\n\t/// @{\n\n\t/// Low qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 lowp_int8;\n\n\t/// Low qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 lowp_int16;\n\n\t/// Low qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 lowp_int32;\n\n\t/// Low qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 lowp_int64;\n\n\t/// Low qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 lowp_int8_t;\n\n\t/// Low qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 lowp_int16_t;\n\n\t/// Low qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 lowp_int32_t;\n\n\t/// Low qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 lowp_int64_t;\n\n\t/// Low qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 lowp_i8;\n\n\t/// Low qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 lowp_i16;\n\n\t/// Low qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 lowp_i32;\n\n\t/// Low qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 lowp_i64;\n\n\t/// Medium qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 mediump_int8;\n\n\t/// Medium qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 mediump_int16;\n\n\t/// Medium qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 mediump_int32;\n\n\t/// Medium qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 mediump_int64;\n\n\t/// Medium qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 mediump_int8_t;\n\n\t/// Medium qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 mediump_int16_t;\n\n\t/// Medium qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 mediump_int32_t;\n\n\t/// Medium qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 mediump_int64_t;\n\n\t/// Medium qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 mediump_i8;\n\n\t/// Medium qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 mediump_i16;\n\n\t/// Medium qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 mediump_i32;\n\n\t/// Medium qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 mediump_i64;\n\n\t/// High qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 highp_int8;\n\n\t/// High qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 highp_int16;\n\n\t/// High qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 highp_int32;\n\n\t/// High qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 highp_int64;\n\n\t/// High qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 highp_int8_t;\n\n\t/// High qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 highp_int16_t;\n\n\t/// 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 highp_int32_t;\n\n\t/// High qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 highp_int64_t;\n\n\t/// High qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 highp_i8;\n\n\t/// High qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 highp_i16;\n\n\t/// High qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 highp_i32;\n\n\t/// High qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 highp_i64;\n\n\n#if GLM_HAS_EXTENDED_INTEGER_TYPE\n\tusing std::int8_t;\n\tusing std::int16_t;\n\tusing std::int32_t;\n\tusing std::int64_t;\n#else\n\t/// 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 int8_t;\n\n\t/// 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 int16_t;\n\n\t/// 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 int32_t;\n\n\t/// 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 int64_t;\n#endif\n\n\t/// 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 i8;\n\n\t/// 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 i16;\n\n\t/// 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 i32;\n\n\t/// 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 i64;\n\n\n\n\t/// Low qualifier 8 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i8, lowp> lowp_i8vec1;\n\n\t/// Low qualifier 8 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i8, lowp> lowp_i8vec2;\n\n\t/// Low qualifier 8 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i8, lowp> lowp_i8vec3;\n\n\t/// Low qualifier 8 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i8, lowp> lowp_i8vec4;\n\n\n\t/// Medium qualifier 8 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i8, mediump> mediump_i8vec1;\n\n\t/// Medium qualifier 8 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i8, mediump> mediump_i8vec2;\n\n\t/// Medium qualifier 8 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i8, mediump> mediump_i8vec3;\n\n\t/// Medium qualifier 8 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i8, mediump> mediump_i8vec4;\n\n\n\t/// High qualifier 8 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i8, highp> highp_i8vec1;\n\n\t/// High qualifier 8 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i8, highp> highp_i8vec2;\n\n\t/// High qualifier 8 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i8, highp> highp_i8vec3;\n\n\t/// High qualifier 8 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i8, highp> highp_i8vec4;\n\n\n\n\t/// 8 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i8, defaultp> i8vec1;\n\n\t/// 8 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i8, defaultp> i8vec2;\n\n\t/// 8 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i8, defaultp> i8vec3;\n\n\t/// 8 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i8, defaultp> i8vec4;\n\n\n\n\n\n\t/// Low qualifier 16 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i16, lowp>\t\tlowp_i16vec1;\n\n\t/// Low qualifier 16 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i16, lowp>\t\tlowp_i16vec2;\n\n\t/// Low qualifier 16 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i16, lowp>\t\tlowp_i16vec3;\n\n\t/// Low qualifier 16 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i16, lowp>\t\tlowp_i16vec4;\n\n\n\t/// Medium qualifier 16 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i16, mediump>\t\tmediump_i16vec1;\n\n\t/// Medium qualifier 16 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i16, mediump>\t\tmediump_i16vec2;\n\n\t/// Medium qualifier 16 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i16, mediump>\t\tmediump_i16vec3;\n\n\t/// Medium qualifier 16 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i16, mediump>\t\tmediump_i16vec4;\n\n\n\t/// High qualifier 16 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i16, highp>\t\thighp_i16vec1;\n\n\t/// High qualifier 16 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i16, highp>\t\thighp_i16vec2;\n\n\t/// High qualifier 16 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i16, highp>\t\thighp_i16vec3;\n\n\t/// High qualifier 16 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i16, highp>\t\thighp_i16vec4;\n\n\n\n\n\t/// 16 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i16, defaultp> i16vec1;\n\n\t/// 16 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i16, defaultp> i16vec2;\n\n\t/// 16 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i16, defaultp> i16vec3;\n\n\t/// 16 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i16, defaultp> i16vec4;\n\n\n\n\t/// Low qualifier 32 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i32, lowp>\t\tlowp_i32vec1;\n\n\t/// Low qualifier 32 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i32, lowp>\t\tlowp_i32vec2;\n\n\t/// Low qualifier 32 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i32, lowp>\t\tlowp_i32vec3;\n\n\t/// Low qualifier 32 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i32, lowp>\t\tlowp_i32vec4;\n\n\n\t/// Medium qualifier 32 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i32, mediump>\t\tmediump_i32vec1;\n\n\t/// Medium qualifier 32 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i32, mediump>\t\tmediump_i32vec2;\n\n\t/// Medium qualifier 32 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i32, mediump>\t\tmediump_i32vec3;\n\n\t/// Medium qualifier 32 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i32, mediump>\t\tmediump_i32vec4;\n\n\n\t/// High qualifier 32 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i32, highp>\t\thighp_i32vec1;\n\n\t/// High qualifier 32 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i32, highp>\t\thighp_i32vec2;\n\n\t/// High qualifier 32 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i32, highp>\t\thighp_i32vec3;\n\n\t/// High qualifier 32 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i32, highp>\t\thighp_i32vec4;\n\n\n\t/// 32 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i32, defaultp> i32vec1;\n\n\t/// 32 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i32, defaultp> i32vec2;\n\n\t/// 32 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i32, defaultp> i32vec3;\n\n\t/// 32 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i32, defaultp> i32vec4;\n\n\n\n\n\t/// Low qualifier 64 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i64, lowp>\t\tlowp_i64vec1;\n\n\t/// Low qualifier 64 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i64, lowp>\t\tlowp_i64vec2;\n\n\t/// Low qualifier 64 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i64, lowp>\t\tlowp_i64vec3;\n\n\t/// Low qualifier 64 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i64, lowp>\t\tlowp_i64vec4;\n\n\n\t/// Medium qualifier 64 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i64, mediump>\t\tmediump_i64vec1;\n\n\t/// Medium qualifier 64 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i64, mediump>\t\tmediump_i64vec2;\n\n\t/// Medium qualifier 64 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i64, mediump>\t\tmediump_i64vec3;\n\n\t/// Medium qualifier 64 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i64, mediump>\t\tmediump_i64vec4;\n\n\n\t/// High qualifier 64 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i64, highp>\t\thighp_i64vec1;\n\n\t/// High qualifier 64 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i64, highp>\t\thighp_i64vec2;\n\n\t/// High qualifier 64 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i64, highp>\t\thighp_i64vec3;\n\n\t/// High qualifier 64 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i64, highp>\t\thighp_i64vec4;\n\n\n\t/// 64 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i64, defaultp> i64vec1;\n\n\t/// 64 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i64, defaultp> i64vec2;\n\n\t/// 64 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i64, defaultp> i64vec3;\n\n\t/// 64 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i64, defaultp> i64vec4;\n\n\n\t/////////////////////////////\n\t// Unsigned int vector types\n\n\t/// Low qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 lowp_uint8;\n\n\t/// Low qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 lowp_uint16;\n\n\t/// Low qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 lowp_uint32;\n\n\t/// Low qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 lowp_uint64;\n\n\t/// Low qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 lowp_uint8_t;\n\n\t/// Low qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 lowp_uint16_t;\n\n\t/// Low qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 lowp_uint32_t;\n\n\t/// Low qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 lowp_uint64_t;\n\n\t/// Low qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 lowp_u8;\n\n\t/// Low qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 lowp_u16;\n\n\t/// Low qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 lowp_u32;\n\n\t/// Low qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 lowp_u64;\n\n\t/// Medium qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 mediump_uint8;\n\n\t/// Medium qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 mediump_uint16;\n\n\t/// Medium qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 mediump_uint32;\n\n\t/// Medium qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 mediump_uint64;\n\n\t/// Medium qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 mediump_uint8_t;\n\n\t/// Medium qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 mediump_uint16_t;\n\n\t/// Medium qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 mediump_uint32_t;\n\n\t/// Medium qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 mediump_uint64_t;\n\n\t/// Medium qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 mediump_u8;\n\n\t/// Medium qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 mediump_u16;\n\n\t/// Medium qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 mediump_u32;\n\n\t/// Medium qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 mediump_u64;\n\n\t/// High qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 highp_uint8;\n\n\t/// High qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 highp_uint16;\n\n\t/// High qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 highp_uint32;\n\n\t/// High qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 highp_uint64;\n\n\t/// High qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 highp_uint8_t;\n\n\t/// High qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 highp_uint16_t;\n\n\t/// High qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 highp_uint32_t;\n\n\t/// High qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 highp_uint64_t;\n\n\t/// High qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 highp_u8;\n\n\t/// High qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 highp_u16;\n\n\t/// High qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 highp_u32;\n\n\t/// High qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 highp_u64;\n\n#if GLM_HAS_EXTENDED_INTEGER_TYPE\n\tusing std::uint8_t;\n\tusing std::uint16_t;\n\tusing std::uint32_t;\n\tusing std::uint64_t;\n#else\n\t/// Default qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 uint8_t;\n\n\t/// Default qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 uint16_t;\n\n\t/// Default qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 uint32_t;\n\n\t/// Default qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 uint64_t;\n#endif\n\n\t/// Default qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 u8;\n\n\t/// Default qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 u16;\n\n\t/// Default qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 u32;\n\n\t/// Default qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 u64;\n\n\n\n\n\n\t//////////////////////\n\t// Float vector types\n\n\t/// Single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float float32;\n\n\t/// Double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef double float64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32_t;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64_t;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_f32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_f64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32_t;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64_t;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_f32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_f64;\n\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32_t;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64_t;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_f32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_f64;\n\n\n\t/// Medium 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 mediump_float32;\n\n\t/// Medium 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 mediump_float64;\n\n\t/// Medium 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 mediump_float32_t;\n\n\t/// Medium 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 mediump_float64_t;\n\n\t/// Medium 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 mediump_f32;\n\n\t/// Medium 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 mediump_f64;\n\n\n\t/// High 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 highp_float32;\n\n\t/// High 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 highp_float64;\n\n\t/// High 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 highp_float32_t;\n\n\t/// High 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 highp_float64_t;\n\n\t/// High 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 highp_f32;\n\n\t/// High 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 highp_f64;\n\n\n#if(defined(GLM_PRECISION_LOWP_FLOAT))\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef lowp_float32_t float32_t;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef lowp_float64_t float64_t;\n\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f32 f32;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f64 f64;\n\n#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef mediump_float32 float32_t;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef mediump_float64 float64_t;\n\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef mediump_float32 f32;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef mediump_float64 f64;\n\n#else//(defined(GLM_PRECISION_HIGHP_FLOAT))\n\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef highp_float32_t float32_t;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef highp_float64_t float64_t;\n\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef highp_float32_t f32;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef highp_float64_t f64;\n#endif\n\n\n\t/// Low single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, float, lowp> lowp_fvec1;\n\n\t/// Low single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, float, lowp> lowp_fvec2;\n\n\t/// Low single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, float, lowp> lowp_fvec3;\n\n\t/// Low single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, float, lowp> lowp_fvec4;\n\n\n\t/// Medium single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, float, mediump> mediump_fvec1;\n\n\t/// Medium Single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, float, mediump> mediump_fvec2;\n\n\t/// Medium Single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, float, mediump> mediump_fvec3;\n\n\t/// Medium Single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, float, mediump> mediump_fvec4;\n\n\n\t/// High single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, float, highp> highp_fvec1;\n\n\t/// High Single-qualifier floating-point vector of 2 components.\n\t/// @see core_precision\n\ttypedef vec<2, float, highp> highp_fvec2;\n\n\t/// High Single-qualifier floating-point vector of 3 components.\n\t/// @see core_precision\n\ttypedef vec<3, float, highp> highp_fvec3;\n\n\t/// High Single-qualifier floating-point vector of 4 components.\n\t/// @see core_precision\n\ttypedef vec<4, float, highp> highp_fvec4;\n\n\n\t/// Low single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f32, lowp> lowp_f32vec1;\n\n\t/// Low single-qualifier floating-point vector of 2 components.\n\t/// @see core_precision\n\ttypedef vec<2, f32, lowp> lowp_f32vec2;\n\n\t/// Low single-qualifier floating-point vector of 3 components.\n\t/// @see core_precision\n\ttypedef vec<3, f32, lowp> lowp_f32vec3;\n\n\t/// Low single-qualifier floating-point vector of 4 components.\n\t/// @see core_precision\n\ttypedef vec<4, f32, lowp> lowp_f32vec4;\n\n\t/// Medium single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f32, mediump> mediump_f32vec1;\n\n\t/// Medium single-qualifier floating-point vector of 2 components.\n\t/// @see core_precision\n\ttypedef vec<2, f32, mediump> mediump_f32vec2;\n\n\t/// Medium single-qualifier floating-point vector of 3 components.\n\t/// @see core_precision\n\ttypedef vec<3, f32, mediump> mediump_f32vec3;\n\n\t/// Medium single-qualifier floating-point vector of 4 components.\n\t/// @see core_precision\n\ttypedef vec<4, f32, mediump> mediump_f32vec4;\n\n\t/// High single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f32, highp> highp_f32vec1;\n\n\t/// High single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f32, highp> highp_f32vec2;\n\n\t/// High single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f32, highp> highp_f32vec3;\n\n\t/// High single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f32, highp> highp_f32vec4;\n\n\n\t/// Low double-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f64, lowp> lowp_f64vec1;\n\n\t/// Low double-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f64, lowp> lowp_f64vec2;\n\n\t/// Low double-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f64, lowp> lowp_f64vec3;\n\n\t/// Low double-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f64, lowp> lowp_f64vec4;\n\n\t/// Medium double-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f64, mediump> mediump_f64vec1;\n\n\t/// Medium double-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f64, mediump> mediump_f64vec2;\n\n\t/// Medium double-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f64, mediump> mediump_f64vec3;\n\n\t/// Medium double-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f64, mediump> mediump_f64vec4;\n\n\t/// High double-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f64, highp> highp_f64vec1;\n\n\t/// High double-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f64, highp> highp_f64vec2;\n\n\t/// High double-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f64, highp> highp_f64vec3;\n\n\t/// High double-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f64, highp> highp_f64vec4;\n\n\n\n\t//////////////////////\n\t// Float matrix types\n\n\t/// Low single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef lowp_f32 lowp_fmat1x1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, lowp> lowp_fmat2x2;\n\n\t/// Low single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, lowp> lowp_fmat2x3;\n\n\t/// Low single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, lowp> lowp_fmat2x4;\n\n\t/// Low single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, lowp> lowp_fmat3x2;\n\n\t/// Low single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, lowp> lowp_fmat3x3;\n\n\t/// Low single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, lowp> lowp_fmat3x4;\n\n\t/// Low single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, lowp> lowp_fmat4x2;\n\n\t/// Low single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, lowp> lowp_fmat4x3;\n\n\t/// Low single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, lowp> lowp_fmat4x4;\n\n\t/// Low single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef lowp_fmat1x1 lowp_fmat1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_fmat2x2 lowp_fmat2;\n\n\t/// Low single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_fmat3x3 lowp_fmat3;\n\n\t/// Low single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_fmat4x4 lowp_fmat4;\n\n\n\t/// Medium single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef mediump_f32 mediump_fmat1x1;\n\n\t/// Medium single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, mediump> mediump_fmat2x2;\n\n\t/// Medium single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, mediump> mediump_fmat2x3;\n\n\t/// Medium single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, mediump> mediump_fmat2x4;\n\n\t/// Medium single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, mediump> mediump_fmat3x2;\n\n\t/// Medium single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, mediump> mediump_fmat3x3;\n\n\t/// Medium single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, mediump> mediump_fmat3x4;\n\n\t/// Medium single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, mediump> mediump_fmat4x2;\n\n\t/// Medium single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, mediump> mediump_fmat4x3;\n\n\t/// Medium single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, mediump> mediump_fmat4x4;\n\n\t/// Medium single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef mediump_fmat1x1 mediump_fmat1;\n\n\t/// Medium single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_fmat2x2 mediump_fmat2;\n\n\t/// Medium single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_fmat3x3 mediump_fmat3;\n\n\t/// Medium single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_fmat4x4 mediump_fmat4;\n\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef highp_f32 highp_fmat1x1;\n\n\t/// High single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, highp> highp_fmat2x2;\n\n\t/// High single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, highp> highp_fmat2x3;\n\n\t/// High single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, highp> highp_fmat2x4;\n\n\t/// High single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, highp> highp_fmat3x2;\n\n\t/// High single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, highp> highp_fmat3x3;\n\n\t/// High single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, highp> highp_fmat3x4;\n\n\t/// High single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, highp> highp_fmat4x2;\n\n\t/// High single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, highp> highp_fmat4x3;\n\n\t/// High single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, highp> highp_fmat4x4;\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef highp_fmat1x1 highp_fmat1;\n\n\t/// High single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_fmat2x2 highp_fmat2;\n\n\t/// High single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_fmat3x3 highp_fmat3;\n\n\t/// High single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_fmat4x4 highp_fmat4;\n\n\n\t/// Low single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 lowp_f32mat1x1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, lowp> lowp_f32mat2x2;\n\n\t/// Low single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, lowp> lowp_f32mat2x3;\n\n\t/// Low single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, lowp> lowp_f32mat2x4;\n\n\t/// Low single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, lowp> lowp_f32mat3x2;\n\n\t/// Low single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, lowp> lowp_f32mat3x3;\n\n\t/// Low single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, lowp> lowp_f32mat3x4;\n\n\t/// Low single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, lowp> lowp_f32mat4x2;\n\n\t/// Low single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, lowp> lowp_f32mat4x3;\n\n\t/// Low single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, lowp> lowp_f32mat4x4;\n\n\t/// Low single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 lowp_f32mat1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f32mat2x2 lowp_f32mat2;\n\n\t/// Low single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f32mat3x3 lowp_f32mat3;\n\n\t/// Low single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f32mat4x4 lowp_f32mat4;\n\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 mediump_f32mat1x1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, mediump> mediump_f32mat2x2;\n\n\t/// Medium single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, mediump> mediump_f32mat2x3;\n\n\t/// Medium single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, mediump> mediump_f32mat2x4;\n\n\t/// Medium single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, mediump> mediump_f32mat3x2;\n\n\t/// Medium single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, mediump> mediump_f32mat3x3;\n\n\t/// Medium single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, mediump> mediump_f32mat3x4;\n\n\t/// Medium single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, mediump> mediump_f32mat4x2;\n\n\t/// Medium single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, mediump> mediump_f32mat4x3;\n\n\t/// Medium single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, mediump> mediump_f32mat4x4;\n\n\t/// Medium single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 f32mat1;\n\n\t/// Medium single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f32mat2x2 mediump_f32mat2;\n\n\t/// Medium single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f32mat3x3 mediump_f32mat3;\n\n\t/// Medium single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f32mat4x4 mediump_f32mat4;\n\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 highp_f32mat1x1;\n\n\t/// High single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, highp> highp_f32mat2x2;\n\n\t/// High single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, highp> highp_f32mat2x3;\n\n\t/// High single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, highp> highp_f32mat2x4;\n\n\t/// High single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, highp> highp_f32mat3x2;\n\n\t/// High single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, highp> highp_f32mat3x3;\n\n\t/// High single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, highp> highp_f32mat3x4;\n\n\t/// High single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, highp> highp_f32mat4x2;\n\n\t/// High single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, highp> highp_f32mat4x3;\n\n\t/// High single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, highp> highp_f32mat4x4;\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 f32mat1;\n\n\t/// High single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f32mat2x2 highp_f32mat2;\n\n\t/// High single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f32mat3x3 highp_f32mat3;\n\n\t/// High single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f32mat4x4 highp_f32mat4;\n\n\n\t/// Low double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f64 lowp_f64mat1x1;\n\n\t/// Low double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, lowp> lowp_f64mat2x2;\n\n\t/// Low double-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f64, lowp> lowp_f64mat2x3;\n\n\t/// Low double-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f64, lowp> lowp_f64mat2x4;\n\n\t/// Low double-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f64, lowp> lowp_f64mat3x2;\n\n\t/// Low double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, lowp> lowp_f64mat3x3;\n\n\t/// Low double-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f64, lowp> lowp_f64mat3x4;\n\n\t/// Low double-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f64, lowp> lowp_f64mat4x2;\n\n\t/// Low double-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f64, lowp> lowp_f64mat4x3;\n\n\t/// Low double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, lowp> lowp_f64mat4x4;\n\n\t/// Low double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef lowp_f64mat1x1 lowp_f64mat1;\n\n\t/// Low double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f64mat2x2 lowp_f64mat2;\n\n\t/// Low double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f64mat3x3 lowp_f64mat3;\n\n\t/// Low double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f64mat4x4 lowp_f64mat4;\n\n\n\t/// Medium double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f64 Highp_f64mat1x1;\n\n\t/// Medium double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, mediump> mediump_f64mat2x2;\n\n\t/// Medium double-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f64, mediump> mediump_f64mat2x3;\n\n\t/// Medium double-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f64, mediump> mediump_f64mat2x4;\n\n\t/// Medium double-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f64, mediump> mediump_f64mat3x2;\n\n\t/// Medium double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, mediump> mediump_f64mat3x3;\n\n\t/// Medium double-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f64, mediump> mediump_f64mat3x4;\n\n\t/// Medium double-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f64, mediump> mediump_f64mat4x2;\n\n\t/// Medium double-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f64, mediump> mediump_f64mat4x3;\n\n\t/// Medium double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, mediump> mediump_f64mat4x4;\n\n\t/// Medium double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef mediump_f64mat1x1 mediump_f64mat1;\n\n\t/// Medium double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f64mat2x2 mediump_f64mat2;\n\n\t/// Medium double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f64mat3x3 mediump_f64mat3;\n\n\t/// Medium double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f64mat4x4 mediump_f64mat4;\n\n\t/// High double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f64 highp_f64mat1x1;\n\n\t/// High double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, highp> highp_f64mat2x2;\n\n\t/// High double-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f64, highp> highp_f64mat2x3;\n\n\t/// High double-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f64, highp> highp_f64mat2x4;\n\n\t/// High double-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f64, highp> highp_f64mat3x2;\n\n\t/// High double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, highp> highp_f64mat3x3;\n\n\t/// High double-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f64, highp> highp_f64mat3x4;\n\n\t/// High double-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f64, highp> highp_f64mat4x2;\n\n\t/// High double-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f64, highp> highp_f64mat4x3;\n\n\t/// High double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, highp> highp_f64mat4x4;\n\n\t/// High double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef highp_f64mat1x1 highp_f64mat1;\n\n\t/// High double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f64mat2x2 highp_f64mat2;\n\n\t/// High double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f64mat3x3 highp_f64mat3;\n\n\t/// High double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f64mat4x4 highp_f64mat4;\n\n\n\n\n\t/// Low qualifier 8 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u8, lowp> lowp_u8vec1;\n\n\t/// Low qualifier 8 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u8, lowp> lowp_u8vec2;\n\n\t/// Low qualifier 8 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u8, lowp> lowp_u8vec3;\n\n\t/// Low qualifier 8 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u8, lowp> lowp_u8vec4;\n\n\n\t/// Medium qualifier 8 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u8, mediump> mediump_u8vec1;\n\n\t/// Medium qualifier 8 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u8, mediump> mediump_u8vec2;\n\n\t/// Medium qualifier 8 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u8, mediump> mediump_u8vec3;\n\n\t/// Medium qualifier 8 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u8, mediump> mediump_u8vec4;\n\n\n\t/// High qualifier 8 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u8, highp> highp_u8vec1;\n\n\t/// High qualifier 8 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u8, highp> highp_u8vec2;\n\n\t/// High qualifier 8 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u8, highp> highp_u8vec3;\n\n\t/// High qualifier 8 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u8, highp> highp_u8vec4;\n\n\n\n\t/// Default qualifier 8 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u8, defaultp> u8vec1;\n\n\t/// Default qualifier 8 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u8, defaultp> u8vec2;\n\n\t/// Default qualifier 8 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u8, defaultp> u8vec3;\n\n\t/// Default qualifier 8 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u8, defaultp> u8vec4;\n\n\n\n\n\t/// Low qualifier 16 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u16, lowp>\t\tlowp_u16vec1;\n\n\t/// Low qualifier 16 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u16, lowp>\t\tlowp_u16vec2;\n\n\t/// Low qualifier 16 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u16, lowp>\t\tlowp_u16vec3;\n\n\t/// Low qualifier 16 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u16, lowp>\t\tlowp_u16vec4;\n\n\n\t/// Medium qualifier 16 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u16, mediump>\t\tmediump_u16vec1;\n\n\t/// Medium qualifier 16 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u16, mediump>\t\tmediump_u16vec2;\n\n\t/// Medium qualifier 16 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u16, mediump>\t\tmediump_u16vec3;\n\n\t/// Medium qualifier 16 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u16, mediump>\t\tmediump_u16vec4;\n\n\n\t/// High qualifier 16 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u16, highp>\t\thighp_u16vec1;\n\n\t/// High qualifier 16 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u16, highp>\t\thighp_u16vec2;\n\n\t/// High qualifier 16 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u16, highp>\t\thighp_u16vec3;\n\n\t/// High qualifier 16 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u16, highp>\t\thighp_u16vec4;\n\n\n\n\n\t/// Default qualifier 16 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u16, defaultp> u16vec1;\n\n\t/// Default qualifier 16 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u16, defaultp> u16vec2;\n\n\t/// Default qualifier 16 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u16, defaultp> u16vec3;\n\n\t/// Default qualifier 16 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u16, defaultp> u16vec4;\n\n\n\n\t/// Low qualifier 32 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u32, lowp>\t\tlowp_u32vec1;\n\n\t/// Low qualifier 32 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u32, lowp>\t\tlowp_u32vec2;\n\n\t/// Low qualifier 32 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u32, lowp>\t\tlowp_u32vec3;\n\n\t/// Low qualifier 32 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u32, lowp>\t\tlowp_u32vec4;\n\n\n\t/// Medium qualifier 32 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u32, mediump>\t\tmediump_u32vec1;\n\n\t/// Medium qualifier 32 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u32, mediump>\t\tmediump_u32vec2;\n\n\t/// Medium qualifier 32 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u32, mediump>\t\tmediump_u32vec3;\n\n\t/// Medium qualifier 32 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u32, mediump>\t\tmediump_u32vec4;\n\n\n\t/// High qualifier 32 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u32, highp>\t\thighp_u32vec1;\n\n\t/// High qualifier 32 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u32, highp>\t\thighp_u32vec2;\n\n\t/// High qualifier 32 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u32, highp>\t\thighp_u32vec3;\n\n\t/// High qualifier 32 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u32, highp>\t\thighp_u32vec4;\n\n\n\n\t/// Default qualifier 32 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u32, defaultp> u32vec1;\n\n\t/// Default qualifier 32 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u32, defaultp> u32vec2;\n\n\t/// Default qualifier 32 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u32, defaultp> u32vec3;\n\n\t/// Default qualifier 32 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u32, defaultp> u32vec4;\n\n\n\n\n\t/// Low qualifier 64 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u64, lowp>\t\tlowp_u64vec1;\n\n\t/// Low qualifier 64 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u64, lowp>\t\tlowp_u64vec2;\n\n\t/// Low qualifier 64 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u64, lowp>\t\tlowp_u64vec3;\n\n\t/// Low qualifier 64 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u64, lowp>\t\tlowp_u64vec4;\n\n\n\t/// Medium qualifier 64 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u64, mediump>\t\tmediump_u64vec1;\n\n\t/// Medium qualifier 64 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u64, mediump>\t\tmediump_u64vec2;\n\n\t/// Medium qualifier 64 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u64, mediump>\t\tmediump_u64vec3;\n\n\t/// Medium qualifier 64 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u64, mediump>\t\tmediump_u64vec4;\n\n\n\t/// High qualifier 64 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u64, highp>\t\thighp_u64vec1;\n\n\t/// High qualifier 64 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u64, highp>\t\thighp_u64vec2;\n\n\t/// High qualifier 64 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u64, highp>\t\thighp_u64vec3;\n\n\t/// High qualifier 64 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u64, highp>\t\thighp_u64vec4;\n\n\n\n\n\t/// Default qualifier 64 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u64, defaultp> u64vec1;\n\n\t/// Default qualifier 64 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u64, defaultp> u64vec2;\n\n\t/// Default qualifier 64 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u64, defaultp> u64vec3;\n\n\t/// Default qualifier 64 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u64, defaultp> u64vec4;\n\n\n\t//////////////////////\n\t// Float vector types\n\n\t/// 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 float32_t;\n\n\t/// 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 f32;\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t\t/// 64 bit double-qualifier floating-point scalar.\n\t\t/// @see gtc_type_precision\n\t\ttypedef float64 float64_t;\n\n\t\t/// 64 bit double-qualifier floating-point scalar.\n\t\t/// @see gtc_type_precision\n\t\ttypedef float64 f64;\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t/// Single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, float, defaultp> fvec1;\n\n\t/// Single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, float, defaultp> fvec2;\n\n\t/// Single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, float, defaultp> fvec3;\n\n\t/// Single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, float, defaultp> fvec4;\n\n\n\t/// Single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f32, defaultp> f32vec1;\n\n\t/// Single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f32, defaultp> f32vec2;\n\n\t/// Single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f32, defaultp> f32vec3;\n\n\t/// Single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f32, defaultp> f32vec4;\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\t\t/// Double-qualifier floating-point vector of 1 component.\n\t\t/// @see gtc_type_precision\n\t\ttypedef vec<1, f64, defaultp> f64vec1;\n\n\t\t/// Double-qualifier floating-point vector of 2 components.\n\t\t/// @see gtc_type_precision\n\t\ttypedef vec<2, f64, defaultp> f64vec2;\n\n\t\t/// Double-qualifier floating-point vector of 3 components.\n\t\t/// @see gtc_type_precision\n\t\ttypedef vec<3, f64, defaultp> f64vec3;\n\n\t\t/// Double-qualifier floating-point vector of 4 components.\n\t\t/// @see gtc_type_precision\n\t\ttypedef vec<4, f64, defaultp> f64vec4;\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\n\t//////////////////////\n\t// Float matrix types\n\n\t/// Single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 fmat1;\n\n\t/// Single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, defaultp> fmat2;\n\n\t/// Single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, defaultp> fmat3;\n\n\t/// Single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, defaultp> fmat4;\n\n\n\t/// Single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 fmat1x1;\n\n\t/// Single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, defaultp> fmat2x2;\n\n\t/// Single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, defaultp> fmat2x3;\n\n\t/// Single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, defaultp> fmat2x4;\n\n\t/// Single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, defaultp> fmat3x2;\n\n\t/// Single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, defaultp> fmat3x3;\n\n\t/// Single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, defaultp> fmat3x4;\n\n\t/// Single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, defaultp> fmat4x2;\n\n\t/// Single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, defaultp> fmat4x3;\n\n\t/// Single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, defaultp> fmat4x4;\n\n\n\t/// Single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 f32mat1;\n\n\t/// Single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, defaultp> f32mat2;\n\n\t/// Single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, defaultp> f32mat3;\n\n\t/// Single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, defaultp> f32mat4;\n\n\n\t/// Single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 f32mat1x1;\n\n\t/// Single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, defaultp> f32mat2x2;\n\n\t/// Single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, defaultp> f32mat2x3;\n\n\t/// Single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, defaultp> f32mat2x4;\n\n\t/// Single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, defaultp> f32mat3x2;\n\n\t/// Single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, defaultp> f32mat3x3;\n\n\t/// Single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, defaultp> f32mat3x4;\n\n\t/// Single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, defaultp> f32mat4x2;\n\n\t/// Single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, defaultp> f32mat4x3;\n\n\t/// Single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, defaultp> f32mat4x4;\n\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 f64mat1;\n\n\t/// Double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, defaultp> f64mat2;\n\n\t/// Double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, defaultp> f64mat3;\n\n\t/// Double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, defaultp> f64mat4;\n\n\n\t/// Double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f64 f64mat1x1;\n\n\t/// Double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, defaultp> f64mat2x2;\n\n\t/// Double-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f64, defaultp> f64mat2x3;\n\n\t/// Double-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f64, defaultp> f64mat2x4;\n\n\t/// Double-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f64, defaultp> f64mat3x2;\n\n\t/// Double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, defaultp> f64mat3x3;\n\n\t/// Double-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f64, defaultp> f64mat3x4;\n\n\t/// Double-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f64, defaultp> f64mat4x2;\n\n\t/// Double-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f64, defaultp> f64mat4x3;\n\n\t/// Double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, defaultp> f64mat4x4;\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t//////////////////////////\n\t// Quaternion types\n\n\t/// Single-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua f32quat;\n\n\t/// Low single-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua lowp_f32quat;\n\n\t/// Low double-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua lowp_f64quat;\n\n\t/// Medium single-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua mediump_f32quat;\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Medium double-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua mediump_f64quat;\n\n\t/// High single-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua highp_f32quat;\n\n\t/// High double-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua highp_f64quat;\n\n\t/// Double-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua f64quat;\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t/// @}\n}//namespace glm\n\n#include \"type_precision.inl\"\n"}, {"path": "includes/glm/gtc/type_ptr.hpp", "language": "code", "loc": 191, "comment_density": 0.539, "code": "/// @ref gtc_type_ptr\n/// @file glm/gtc/type_ptr.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtc_type_ptr GLM_GTC_type_ptr\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Handles the interaction between pointers and vector, matrix types.\n///\n/// This extension defines an overloaded function, glm::value_ptr. It returns\n/// a pointer to the memory layout of the object. Matrix types store their values\n/// in column-major order.\n///\n/// This is useful for uploading data to matrices or copying data to buffer objects.\n///\n/// Example:\n/// @code\n/// #include \n/// #include \n///\n/// glm::vec3 aVector(3);\n/// glm::mat4 someMatrix(1.0);\n///\n/// glUniform3fv(uniformLoc, 1, glm::value_ptr(aVector));\n/// glUniformMatrix4fv(uniformMatrixLoc, 1, GL_FALSE, glm::value_ptr(someMatrix));\n/// @endcode\n///\n/// need to be included to use the features of this extension.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtc/vec1.hpp\"\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../mat2x2.hpp\"\n#include \"../mat2x3.hpp\"\n#include \"../mat2x4.hpp\"\n#include \"../mat3x2.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat3x4.hpp\"\n#include \"../mat4x2.hpp\"\n#include \"../mat4x3.hpp\"\n#include \"../mat4x4.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_type_ptr extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_type_ptr\n\t/// @{\n\n\t/// Return the constant address to the data of the input parameter.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type const * value_ptr(genType const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<1, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<2, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<3, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<4, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<1, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<2, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<3, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<4, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<1, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<2, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<3, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<4, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<1, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<2, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<3, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<4, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, defaultp> make_vec2(T const * const ptr);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, defaultp> make_vec3(T const * const ptr);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, defaultp> make_vec4(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, defaultp> make_mat2x2(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, defaultp> make_mat2x3(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, defaultp> make_mat2x4(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, defaultp> make_mat3x2(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, defaultp> make_mat3x3(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, defaultp> make_mat3x4(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, defaultp> make_mat4x2(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, defaultp> make_mat4x3(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> make_mat4x4(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, defaultp> make_mat2(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, defaultp> make_mat3(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> make_mat4(T const * const ptr);\n\n\t/// Build a quaternion from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL qua make_quat(T const * const ptr);\n\n\t/// @}\n}//namespace glm\n\n#include \"type_ptr.inl\"\n"}, {"path": "includes/glm/gtc/ulp.hpp", "language": "code", "loc": 20, "comment_density": 0.7, "code": "/// @ref gtc_ulp\n/// @file glm/gtc/ulp.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_ulp GLM_GTC_ulp\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Allow the measurement of the accuracy of a function against a reference\n/// implementation. This extension works on floating-point data and provide results\n/// in ULP.\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_ulp.hpp\"\n#include \"../ext/vector_ulp.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_ulp extension included\")\n#endif\n\n"}, {"path": "includes/glm/gtc/vec1.hpp", "language": "code", "loc": 26, "comment_density": 0.462, "code": "/// @ref gtc_vec1\n/// @file glm/gtc/vec1.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_vec1 GLM_GTC_vec1\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Add vec1, ivec1, uvec1 and bvec1 types.\n\n#pragma once\n\n// Dependency:\n#include \"../ext/vector_bool1.hpp\"\n#include \"../ext/vector_bool1_precision.hpp\"\n#include \"../ext/vector_float1.hpp\"\n#include \"../ext/vector_float1_precision.hpp\"\n#include \"../ext/vector_double1.hpp\"\n#include \"../ext/vector_double1_precision.hpp\"\n#include \"../ext/vector_int1.hpp\"\n#include \"../ext/vector_int1_precision.hpp\"\n#include \"../ext/vector_uint1.hpp\"\n#include \"../ext/vector_uint1_precision.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_vec1 extension included\")\n#endif\n\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.616, "dedup_hash": "383a1470a5b44c54", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_gtx", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Gtx", "api": "OpenGL Core", "glsl_version": null, "topic": "postprocessing/texturing/bumpmapping/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/gtx/associated_min_max.hpp", "language": "code", "loc": 178, "comment_density": 0.343, "code": "/// @ref gtx_associated_min_max\n/// @file glm/gtx/associated_min_max.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_associated_min_max GLM_GTX_associated_min_max\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// @brief Min and max functions that return associated values not the compared onces.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GTX_associated_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_associated_min_max extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_associated_min_max\n\t/// @{\n\n\t/// Minimum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMin(T x, U a, T y, U b);\n\n\t/// Minimum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec<2, U, Q> associatedMin(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b);\n\n\t/// Minimum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tT x, const vec& a,\n\t\tT y, const vec& b);\n\n\t/// Minimum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b);\n\n\t/// Minimum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMin(\n\t\tT x, U a,\n\t\tT y, U b,\n\t\tT z, U c);\n\n\t/// Minimum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b,\n\t\tvec const& z, vec const& c);\n\n\t/// Minimum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMin(\n\t\tT x, U a,\n\t\tT y, U b,\n\t\tT z, U c,\n\t\tT w, U d);\n\n\t/// Minimum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b,\n\t\tvec const& z, vec const& c,\n\t\tvec const& w, vec const& d);\n\n\t/// Minimum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tT x, vec const& a,\n\t\tT y, vec const& b,\n\t\tT z, vec const& c,\n\t\tT w, vec const& d);\n\n\t/// Minimum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b,\n\t\tvec const& z, U c,\n\t\tvec const& w, U d);\n\n\t/// Maximum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMax(T x, U a, T y, U b);\n\n\t/// Maximum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec<2, U, Q> associatedMax(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b);\n\n\t/// Maximum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tT x, vec const& a,\n\t\tT y, vec const& b);\n\n\t/// Maximum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b);\n\n\t/// Maximum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMax(\n\t\tT x, U a,\n\t\tT y, U b,\n\t\tT z, U c);\n\n\t/// Maximum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b,\n\t\tvec const& z, vec const& c);\n\n\t/// Maximum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tT x, vec const& a,\n\t\tT y, vec const& b,\n\t\tT z, vec const& c);\n\n\t/// Maximum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b,\n\t\tvec const& z, U c);\n\n\t/// Maximum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMax(\n\t\tT x, U a,\n\t\tT y, U b,\n\t\tT z, U c,\n\t\tT w, U d);\n\n\t/// Maximum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b,\n\t\tvec const& z, vec const& c,\n\t\tvec const& w, vec const& d);\n\n\t/// Maximum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tT x, vec const& a,\n\t\tT y, vec const& b,\n\t\tT z, vec const& c,\n\t\tT w, vec const& d);\n\n\t/// Maximum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b,\n\t\tvec const& z, U c,\n\t\tvec const& w, U d);\n\n\t/// @}\n} //namespace glm\n\n#include \"associated_min_max.inl\"\n"}, {"path": "includes/glm/gtx/bit.hpp", "language": "code", "loc": 80, "comment_density": 0.637, "code": "/// @ref gtx_bit\n/// @file glm/gtx/bit.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_bit GLM_GTX_bit\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../gtc/bitfield.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_bit is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_bit extension is deprecated, include GLM_GTC_bitfield and GLM_GTC_integer instead\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_bit\n\t/// @{\n\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_FUNC_DECL genIUType highestBitValue(genIUType Value);\n\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_FUNC_DECL genIUType lowestBitValue(genIUType Value);\n\n\t/// Find the highest bit set to 1 in a integer variable and return its value.\n\t///\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_FUNC_DECL vec highestBitValue(vec const& value);\n\n\t/// Return the power of two number which value is just higher the input value.\n\t/// Deprecated, use ceilPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoAbove(genIUType Value);\n\n\t/// Return the power of two number which value is just higher the input value.\n\t/// Deprecated, use ceilPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoAbove(vec const& value);\n\n\t/// Return the power of two number which value is just lower the input value.\n\t/// Deprecated, use floorPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoBelow(genIUType Value);\n\n\t/// Return the power of two number which value is just lower the input value.\n\t/// Deprecated, use floorPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoBelow(vec const& value);\n\n\t/// Return the power of two number which value is the closet to the input value.\n\t/// Deprecated, use roundPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoNearest(genIUType Value);\n\n\t/// Return the power of two number which value is the closet to the input value.\n\t/// Deprecated, use roundPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoNearest(vec const& value);\n\n\t/// @}\n} //namespace glm\n\n\n#include \"bit.inl\"\n\n"}, {"path": "includes/glm/gtx/closest_point.hpp", "language": "code", "loc": 40, "comment_density": 0.475, "code": "/// @ref gtx_closest_point\n/// @file glm/gtx/closest_point.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_closest_point GLM_GTX_closest_point\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Find the point on a straight line which is the closet of a point.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_closest_point extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_closest_point\n\t/// @{\n\n\t/// Find the point on a straight line which is the closet of a point.\n\t/// @see gtx_closest_point\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> closestPointOnLine(\n\t\tvec<3, T, Q> const& point,\n\t\tvec<3, T, Q> const& a,\n\t\tvec<3, T, Q> const& b);\n\n\t/// 2d lines work as well\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, Q> closestPointOnLine(\n\t\tvec<2, T, Q> const& point,\n\t\tvec<2, T, Q> const& a,\n\t\tvec<2, T, Q> const& b);\n\n\t/// @}\n}// namespace glm\n\n#include \"closest_point.inl\"\n"}, {"path": "includes/glm/gtx/color_encoding.hpp", "language": "code", "loc": 40, "comment_density": 0.525, "code": "/// @ref gtx_color_encoding\n/// @file glm/gtx/color_encoding.hpp\n///\n/// @see core (dependence)\n/// @see gtx_color_encoding (dependence)\n///\n/// @defgroup gtx_color_encoding GLM_GTX_color_encoding\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// @brief Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../vec3.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_color_encoding extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_color_encoding\n\t/// @{\n\n\t/// Convert a linear sRGB color to D65 YUV.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD65XYZ(vec<3, T, Q> const& ColorLinearSRGB);\n\n\t/// Convert a linear sRGB color to D50 YUV.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD50XYZ(vec<3, T, Q> const& ColorLinearSRGB);\n\n\t/// Convert a D65 YUV color to linear sRGB.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> convertD65XYZToLinearSRGB(vec<3, T, Q> const& ColorD65XYZ);\n\n\t/// Convert a D65 YUV color to D50 YUV.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> convertD65XYZToD50XYZ(vec<3, T, Q> const& ColorD65XYZ);\n\n\t/// @}\n} //namespace glm\n\n#include \"color_encoding.inl\"\n"}, {"path": "includes/glm/gtx/color_space.hpp", "language": "code", "loc": 59, "comment_density": 0.475, "code": "/// @ref gtx_color_space\n/// @file glm/gtx/color_space.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_color_space GLM_GTX_color_space\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Related to RGB to HSV conversions and operations.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_color_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_color_space extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_color_space\n\t/// @{\n\n\t/// Converts a color from HSV color space to its color in RGB color space.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rgbColor(\n\t\tvec<3, T, Q> const& hsvValue);\n\n\t/// Converts a color from RGB color space to its color in HSV color space.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> hsvColor(\n\t\tvec<3, T, Q> const& rgbValue);\n\n\t/// Build a saturation matrix.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> saturation(\n\t\tT const s);\n\n\t/// Modify the saturation of a color.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> saturation(\n\t\tT const s,\n\t\tvec<3, T, Q> const& color);\n\n\t/// Modify the saturation of a color.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> saturation(\n\t\tT const s,\n\t\tvec<4, T, Q> const& color);\n\n\t/// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL T luminosity(\n\t\tvec<3, T, Q> const& color);\n\n\t/// @}\n}//namespace glm\n\n#include \"color_space.inl\"\n"}, {"path": "includes/glm/gtx/color_space_YCoCg.hpp", "language": "code", "loc": 49, "comment_density": 0.531, "code": "/// @ref gtx_color_space_YCoCg\n/// @file glm/gtx/color_space_YCoCg.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_color_space_YCoCg GLM_GTX_color_space_YCoCg\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// RGB to YCoCg conversions and operations\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_color_space_YCoCg is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_color_space_YCoCg extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_color_space_YCoCg\n\t/// @{\n\n\t/// Convert a color from RGB color space to YCoCg color space.\n\t/// @see gtx_color_space_YCoCg\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rgb2YCoCg(\n\t\tvec<3, T, Q> const& rgbColor);\n\n\t/// Convert a color from YCoCg color space to RGB color space.\n\t/// @see gtx_color_space_YCoCg\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> YCoCg2rgb(\n\t\tvec<3, T, Q> const& YCoCgColor);\n\n\t/// Convert a color from RGB color space to YCoCgR color space.\n\t/// @see \"YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range\"\n\t/// @see gtx_color_space_YCoCg\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rgb2YCoCgR(\n\t\tvec<3, T, Q> const& rgbColor);\n\n\t/// Convert a color from YCoCgR color space to RGB color space.\n\t/// @see \"YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range\"\n\t/// @see gtx_color_space_YCoCg\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> YCoCgR2rgb(\n\t\tvec<3, T, Q> const& YCoCgColor);\n\n\t/// @}\n}//namespace glm\n\n#include \"color_space_YCoCg.inl\"\n"}, {"path": "includes/glm/gtx/common.hpp", "language": "code", "loc": 65, "comment_density": 0.662, "code": "/// @ref gtx_common\n/// @file glm/gtx/common.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_common GLM_GTX_common\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// @brief Provide functions to increase the compatibility with Cg and HLSL languages\n\n#pragma once\n\n// Dependencies:\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../gtc/vec1.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_common is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_common extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_common\n\t/// @{\n\n\t/// Returns true if x is a denormalized number\n\t/// Numbers whose absolute value is too small to be represented in the normal format are represented in an alternate, denormalized format.\n\t/// This format is less precise but can represent values closer to zero.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL isnan man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL typename genType::bool_type isdenormal(genType const& x);\n\n\t/// Similar to 'mod' but with a different rounding and integer support.\n\t/// Returns 'x - y * trunc(x/y)' instead of 'x - y * floor(x/y)'\n\t///\n\t/// @see GLSL mod vs HLSL fmod\n\t/// @see GLSL mod man page\n\ttemplate\n\tGLM_FUNC_DECL vec fmod(vec const& v);\n\n\t/// Returns whether vector components values are within an interval. A open interval excludes its endpoints, and is denoted with square brackets.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_vector_relational\n\ttemplate \n\tGLM_FUNC_DECL vec openBounded(vec const& Value, vec const& Min, vec const& Max);\n\n\t/// Returns whether vector components values are within an interval. A closed interval includes its endpoints, and is denoted with square brackets.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_vector_relational\n\ttemplate \n\tGLM_FUNC_DECL vec closeBounded(vec const& Value, vec const& Min, vec const& Max);\n\n\t/// @}\n}//namespace glm\n\n#include \"common.inl\"\n"}, {"path": "includes/glm/gtx/compatibility.hpp", "language": "code", "loc": 112, "comment_density": 0.83, "code": "/// @ref gtx_compatibility\n/// @file glm/gtx/compatibility.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_compatibility GLM_GTX_compatibility\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Provide functions to increase the compatibility with Cg and HLSL languages\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_compatibility is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_compatibility extension included\")\n#endif\n\n#if GLM_COMPILER & GLM_COMPILER_VC\n#\tinclude \n#elif GLM_COMPILER & GLM_COMPILER_GCC\n#\tinclude \n#\tif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)\n#\t\tundef isfinite\n#\tendif\n#endif//GLM_COMPILER\n\nnamespace glm\n{\n\t/// @addtogroup gtx_compatibility\n\t/// @{\n\n\ttemplate GLM_FUNC_QUALIFIER T lerp(T x, T y, T a){return mix(x, y, a);}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//!< \\brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<2, T, Q> lerp(const vec<2, T, Q>& x, const vec<2, T, Q>& y, T a){return mix(x, y, a);}\t\t\t\t\t\t\t//!< \\brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\n\ttemplate GLM_FUNC_QUALIFIER vec<3, T, Q> lerp(const vec<3, T, Q>& x, const vec<3, T, Q>& y, T a){return mix(x, y, a);}\t\t\t\t\t\t\t//!< \\brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<4, T, Q> lerp(const vec<4, T, Q>& x, const vec<4, T, Q>& y, T a){return mix(x, y, a);}\t\t\t\t\t\t\t//!< \\brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<2, T, Q> lerp(const vec<2, T, Q>& x, const vec<2, T, Q>& y, const vec<2, T, Q>& a){return mix(x, y, a);}\t//!< \\brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<3, T, Q> lerp(const vec<3, T, Q>& x, const vec<3, T, Q>& y, const vec<3, T, Q>& a){return mix(x, y, a);}\t//!< \\brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<4, T, Q> lerp(const vec<4, T, Q>& x, const vec<4, T, Q>& y, const vec<4, T, Q>& a){return mix(x, y, a);}\t//!< \\brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\n\ttemplate GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));}\t\t\t\t\t\t\t\t\t\t\t\t\t\t//!< \\brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<2, T, Q> saturate(const vec<2, T, Q>& x){return clamp(x, T(0), T(1));}\t\t\t\t\t//!< \\brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<3, T, Q> saturate(const vec<3, T, Q>& x){return clamp(x, T(0), T(1));}\t\t\t\t\t//!< \\brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<4, T, Q> saturate(const vec<4, T, Q>& x){return clamp(x, T(0), T(1));}\t\t\t\t\t//!< \\brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)\n\n\ttemplate GLM_FUNC_QUALIFIER T atan2(T x, T y){return atan(x, y);}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//!< \\brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<2, T, Q> atan2(const vec<2, T, Q>& x, const vec<2, T, Q>& y){return atan(x, y);}\t//!< \\brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<3, T, Q> atan2(const vec<3, T, Q>& x, const vec<3, T, Q>& y){return atan(x, y);}\t//!< \\brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<4, T, Q> atan2(const vec<4, T, Q>& x, const vec<4, T, Q>& y){return atan(x, y);}\t//!< \\brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)\n\n\ttemplate GLM_FUNC_DECL bool isfinite(genType const& x);\t\t\t\t\t\t\t\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_DECL vec<1, bool, Q> isfinite(const vec<1, T, Q>& x);\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_DECL vec<2, bool, Q> isfinite(const vec<2, T, Q>& x);\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_DECL vec<3, bool, Q> isfinite(const vec<3, T, Q>& x);\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_DECL vec<4, bool, Q> isfinite(const vec<4, T, Q>& x);\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\n\ttypedef bool\t\t\t\t\t\tbool1;\t\t\t//!< \\brief boolean type with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef vec<2, bool, highp>\t\t\tbool2;\t\t\t//!< \\brief boolean type with 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<3, bool, highp>\t\t\tbool3;\t\t\t//!< \\brief boolean type with 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<4, bool, highp>\t\t\tbool4;\t\t\t//!< \\brief boolean type with 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef bool\t\t\t\t\t\tbool1x1;\t\t//!< \\brief boolean matrix with 1 x 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 2, bool, highp>\t\tbool2x2;\t\t//!< \\brief boolean matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 3, bool, highp>\t\tbool2x3;\t\t//!< \\brief boolean matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 4, bool, highp>\t\tbool2x4;\t\t//!< \\brief boolean matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 2, bool, highp>\t\tbool3x2;\t\t//!< \\brief boolean matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 3, bool, highp>\t\tbool3x3;\t\t//!< \\brief boolean matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 4, bool, highp>\t\tbool3x4;\t\t//!< \\brief boolean matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 2, bool, highp>\t\tbool4x2;\t\t//!< \\brief boolean matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 3, bool, highp>\t\tbool4x3;\t\t//!< \\brief boolean matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 4, bool, highp>\t\tbool4x4;\t\t//!< \\brief boolean matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef int\t\t\t\t\t\t\tint1;\t\t\t//!< \\brief integer vector with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef vec<2, int, highp>\t\t\tint2;\t\t\t//!< \\brief integer vector with 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<3, int, highp>\t\t\tint3;\t\t\t//!< \\brief integer vector with 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<4, int, highp>\t\t\tint4;\t\t\t//!< \\brief integer vector with 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef int\t\t\t\t\t\t\tint1x1;\t\t\t//!< \\brief integer matrix with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 2, int, highp>\t\tint2x2;\t\t\t//!< \\brief integer matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 3, int, highp>\t\tint2x3;\t\t\t//!< \\brief integer matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 4, int, highp>\t\tint2x4;\t\t\t//!< \\brief integer matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 2, int, highp>\t\tint3x2;\t\t\t//!< \\brief integer matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 3, int, highp>\t\tint3x3;\t\t\t//!< \\brief integer matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 4, int, highp>\t\tint3x4;\t\t\t//!< \\brief integer matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 2, int, highp>\t\tint4x2;\t\t\t//!< \\brief integer matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 3, int, highp>\t\tint4x3;\t\t\t//!< \\brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 4, int, highp>\t\tint4x4;\t\t\t//!< \\brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef float\t\t\t\t\t\tfloat1;\t\t\t//!< \\brief single-qualifier floating-point vector with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef vec<2, float, highp>\t\tfloat2;\t\t\t//!< \\brief single-qualifier floating-point vector with 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<3, float, highp>\t\tfloat3;\t\t\t//!< \\brief single-qualifier floating-point vector with 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<4, float, highp>\t\tfloat4;\t\t\t//!< \\brief single-qualifier floating-point vector with 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef float\t\t\t\t\t\tfloat1x1;\t\t//!< \\brief single-qualifier floating-point matrix with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 2, float, highp>\t\tfloat2x2;\t\t//!< \\brief single-qualifier floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 3, float, highp>\t\tfloat2x3;\t\t//!< \\brief single-qualifier floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 4, float, highp>\t\tfloat2x4;\t\t//!< \\brief single-qualifier floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 2, float, highp>\t\tfloat3x2;\t\t//!< \\brief single-qualifier floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 3, float, highp>\t\tfloat3x3;\t\t//!< \\brief single-qualifier floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 4, float, highp>\t\tfloat3x4;\t\t//!< \\brief single-qualifier floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 2, float, highp>\t\tfloat4x2;\t\t//!< \\brief single-qualifier floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 3, float, highp>\t\tfloat4x3;\t\t//!< \\brief single-qualifier floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 4, float, highp>\t\tfloat4x4;\t\t//!< \\brief single-qualifier floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef double\t\t\t\t\t\tdouble1;\t\t//!< \\brief double-qualifier floating-point vector with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef vec<2, double, highp>\t\tdouble2;\t\t//!< \\brief double-qualifier floating-point vector with 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<3, double, highp>\t\tdouble3;\t\t//!< \\brief double-qualifier floating-point vector with 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<4, double, highp>\t\tdouble4;\t\t//!< \\brief double-qualifier floating-point vector with 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef double\t\t\t\t\t\tdouble1x1;\t\t//!< \\brief double-qualifier floating-point matrix with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 2, double, highp>\t\tdouble2x2;\t\t//!< \\brief double-qualifier floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 3, double, highp>\t\tdouble2x3;\t\t//!< \\brief double-qualifier floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 4, double, highp>\t\tdouble2x4;\t\t//!< \\brief double-qualifier floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 2, double, highp>\t\tdouble3x2;\t\t//!< \\brief double-qualifier floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 3, double, highp>\t\tdouble3x3;\t\t//!< \\brief double-qualifier floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 4, double, highp>\t\tdouble3x4;\t\t//!< \\brief double-qualifier floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 2, double, highp>\t\tdouble4x2;\t\t//!< \\brief double-qualifier floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 3, double, highp>\t\tdouble4x3;\t\t//!< \\brief double-qualifier floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 4, double, highp>\t\tdouble4x4;\t\t//!< \\brief double-qualifier floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)\n\n\t/// @}\n}//namespace glm\n\n#include \"compatibility.inl\"\n"}, {"path": "includes/glm/gtx/component_wise.hpp", "language": "code", "loc": 56, "comment_density": 0.571, "code": "/// @ref gtx_component_wise\n/// @file glm/gtx/component_wise.hpp\n/// @date 2007-05-21 / 2011-06-07\n/// @author Christophe Riccio\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_component_wise GLM_GTX_component_wise\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Operations between components of a type\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_component_wise is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_component_wise extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_component_wise\n\t/// @{\n\n\t/// Convert an integer vector to a normalized float vector.\n\t/// If the parameter value type is already a floating qualifier type, the value is passed through.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL vec compNormalize(vec const& v);\n\n\t/// Convert a normalized float vector to an integer vector.\n\t/// If the parameter value type is already a floating qualifier type, the value is passed through.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL vec compScale(vec const& v);\n\n\t/// Add all vector components together.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type compAdd(genType const& v);\n\n\t/// Multiply all vector components together.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type compMul(genType const& v);\n\n\t/// Find the minimum value between single vector components.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type compMin(genType const& v);\n\n\t/// Find the maximum value between single vector components.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type compMax(genType const& v);\n\n\t/// @}\n}//namespace glm\n\n#include \"component_wise.inl\"\n"}, {"path": "includes/glm/gtx/dual_quaternion.hpp", "language": "code", "loc": 209, "comment_density": 0.431, "code": "/// @ref gtx_dual_quaternion\n/// @file glm/gtx/dual_quaternion.hpp\n/// @author Maksim Vorobiev (msomeone@gmail.com)\n///\n/// @see core (dependence)\n/// @see gtc_constants (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_dual_quaternion GLM_GTX_dual_quaternion\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines a templated dual-quaternion type and several dual-quaternion operations.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/constants.hpp\"\n#include \"../gtc/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_dual_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_dual_quaternion extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_dual_quaternion\n\t/// @{\n\n\ttemplate\n\tstruct tdualquat\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef qua part_type;\n\n\t\t// -- Data --\n\n\t\tqua real, dual;\n\n\t\t// -- Component accesses --\n\n\t\ttypedef length_t length_type;\n\t\t/// Return the count of components of a dual quaternion\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;}\n\n\t\tGLM_FUNC_DECL part_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL part_type const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const& d) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const& d);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(qua const& real);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(qua const& orientation, vec<3, T, Q> const& translation);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(qua const& real, qua const& dual);\n\n\t\t// -- Conversion constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat const& q);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR tdualquat(mat<2, 4, T, Q> const& holder_mat);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR tdualquat(mat<3, 4, T, Q> const& aug_mat);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL tdualquat & operator=(tdualquat const& m) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL tdualquat & operator=(tdualquat const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL tdualquat & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL tdualquat & operator/=(U s);\n\t};\n\n\t// -- Unary bit operators --\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator+(tdualquat const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator-(tdualquat const& q);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator+(tdualquat const& q, tdualquat const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator*(tdualquat const& q, tdualquat const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> operator*(tdualquat const& q, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, tdualquat const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> operator*(tdualquat const& q, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, tdualquat const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator*(tdualquat const& q, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator*(T const& s, tdualquat const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator/(tdualquat const& q, T const& s);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(tdualquat const& q1, tdualquat const& q2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(tdualquat const& q1, tdualquat const& q2);\n\n\t/// Creates an identity dual quaternion.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate \n\tGLM_FUNC_DECL tdualquat dual_quat_identity();\n\n\t/// Returns the normalized quaternion.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat normalize(tdualquat const& q);\n\n\t/// Returns the linear interpolation of two dual quaternion.\n\t///\n\t/// @see gtc_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat lerp(tdualquat const& x, tdualquat const& y, T const& a);\n\n\t/// Returns the q inverse.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat inverse(tdualquat const& q);\n\n\t/// Converts a quaternion to a 2 * 4 matrix.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> mat2x4_cast(tdualquat const& x);\n\n\t/// Converts a quaternion to a 3 * 4 matrix.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> mat3x4_cast(tdualquat const& x);\n\n\t/// Converts a 2 * 4 matrix (matrix which holds real and dual parts) to a quaternion.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat dualquat_cast(mat<2, 4, T, Q> const& x);\n\n\t/// Converts a 3 * 4 matrix (augmented matrix rotation + translation) to a quaternion.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat dualquat_cast(mat<3, 4, T, Q> const& x);\n\n\n\t/// Dual-quaternion of low single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\tlowp_dualquat;\n\n\t/// Dual-quaternion of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\tmediump_dualquat;\n\n\t/// Dual-quaternion of high single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\thighp_dualquat;\n\n\n\t/// Dual-quaternion of low single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\tlowp_fdualquat;\n\n\t/// Dual-quaternion of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\tmediump_fdualquat;\n\n\t/// Dual-quaternion of high single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\thighp_fdualquat;\n\n\n\t/// Dual-quaternion of low double-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\tlowp_ddualquat;\n\n\t/// Dual-quaternion of medium double-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\tmediump_ddualquat;\n\n\t/// Dual-quaternion of high double-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\thighp_ddualquat;\n\n\n#if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))\n\t/// Dual-quaternion of floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef highp_fdualquat\t\t\tdualquat;\n\n\t/// Dual-quaternion of single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef highp_fdualquat\t\t\tfdualquat;\n#elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))\n\ttypedef highp_fdualquat\t\t\tdualquat;\n\ttypedef highp_fdualquat\t\t\tfdualquat;\n#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))\n\ttypedef mediump_fdualquat\t\tdualquat;\n\ttypedef mediump_fdualquat\t\tfdualquat;\n#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))\n\ttypedef lowp_fdualquat\t\t\tdualquat;\n\ttypedef lowp_fdualquat\t\t\tfdualquat;\n#else\n#\terror \"GLM error: multiple default precision requested for single-precision floating-point types\"\n#endif\n\n\n#if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))\n\t/// Dual-quaternion of default double-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef highp_ddualquat\t\t\tddualquat;\n#elif(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))\n\ttypedef highp_ddualquat\t\t\tddualquat;\n#elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))\n\ttypedef mediump_ddualquat\t\tddualquat;\n#elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && defined(GLM_PRECISION_LOWP_DOUBLE))\n\ttypedef lowp_ddualquat\t\t\tddualquat;\n#else\n#\terror \"GLM error: Multiple default precision requested for double-precision floating-point types\"\n#endif\n\n\t/// @}\n} //namespace glm\n\n#include \"dual_quaternion.inl\"\n"}, {"path": "includes/glm/gtx/easing.hpp", "language": "code", "loc": 178, "comment_density": 0.551, "code": "/// @ref gtx_easing\n/// @file glm/gtx/easing.hpp\n/// @author Robert Chisholm\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_easing GLM_GTX_easing\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Easing functions for animations and transitions\n/// All functions take a parameter x in the range [0.0,1.0]\n///\n/// Based on the AHEasing project of Warren Moore (https://github.com/warrenm/AHEasing)\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/constants.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_easing is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_easing extension included\")\n#endif\n\nnamespace glm{\n\t/// @addtogroup gtx_easing\n\t/// @{\n\n\t/// Modelled after the line y = x\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType linearInterpolation(genType const & a);\n\n\t/// Modelled after the parabola y = x^2\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quadraticEaseIn(genType const & a);\n\n\t/// Modelled after the parabola y = -x^2 + 2x\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quadraticEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise quadratic\n\t/// y = (1/2)((2x)^2)\t\t\t\t; [0, 0.5)\n\t/// y = -(1/2)((2x-1)*(2x-3) - 1)\t; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quadraticEaseInOut(genType const & a);\n\n\t/// Modelled after the cubic y = x^3\n\ttemplate \n\tGLM_FUNC_DECL genType cubicEaseIn(genType const & a);\n\n\t/// Modelled after the cubic y = (x - 1)^3 + 1\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType cubicEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise cubic\n\t/// y = (1/2)((2x)^3)\t\t; [0, 0.5)\n\t/// y = (1/2)((2x-2)^3 + 2)\t; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType cubicEaseInOut(genType const & a);\n\n\t/// Modelled after the quartic x^4\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quarticEaseIn(genType const & a);\n\n\t/// Modelled after the quartic y = 1 - (x - 1)^4\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quarticEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise quartic\n\t/// y = (1/2)((2x)^4)\t\t\t; [0, 0.5)\n\t/// y = -(1/2)((2x-2)^4 - 2)\t; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quarticEaseInOut(genType const & a);\n\n\t/// Modelled after the quintic y = x^5\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quinticEaseIn(genType const & a);\n\n\t/// Modelled after the quintic y = (x - 1)^5 + 1\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quinticEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise quintic\n\t/// y = (1/2)((2x)^5)\t\t; [0, 0.5)\n\t/// y = (1/2)((2x-2)^5 + 2) ; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quinticEaseInOut(genType const & a);\n\n\t/// Modelled after quarter-cycle of sine wave\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType sineEaseIn(genType const & a);\n\n\t/// Modelled after quarter-cycle of sine wave (different phase)\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType sineEaseOut(genType const & a);\n\n\t/// Modelled after half sine wave\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType sineEaseInOut(genType const & a);\n\n\t/// Modelled after shifted quadrant IV of unit circle\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType circularEaseIn(genType const & a);\n\n\t/// Modelled after shifted quadrant II of unit circle\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType circularEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise circular function\n\t/// y = (1/2)(1 - sqrt(1 - 4x^2))\t\t\t; [0, 0.5)\n\t/// y = (1/2)(sqrt(-(2x - 3)*(2x - 1)) + 1) ; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType circularEaseInOut(genType const & a);\n\n\t/// Modelled after the exponential function y = 2^(10(x - 1))\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType exponentialEaseIn(genType const & a);\n\n\t/// Modelled after the exponential function y = -2^(-10x) + 1\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType exponentialEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise exponential\n\t/// y = (1/2)2^(10(2x - 1))\t\t\t; [0,0.5)\n\t/// y = -(1/2)*2^(-10(2x - 1))) + 1 ; [0.5,1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType exponentialEaseInOut(genType const & a);\n\n\t/// Modelled after the damped sine wave y = sin(13pi/2*x)*pow(2, 10 * (x - 1))\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType elasticEaseIn(genType const & a);\n\n\t/// Modelled after the damped sine wave y = sin(-13pi/2*(x + 1))*pow(2, -10x) + 1\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType elasticEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise exponentially-damped sine wave:\n\t/// y = (1/2)*sin(13pi/2*(2*x))*pow(2, 10 * ((2*x) - 1))\t\t; [0,0.5)\n\t/// y = (1/2)*(sin(-13pi/2*((2x-1)+1))*pow(2,-10(2*x-1)) + 2)\t; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType elasticEaseInOut(genType const & a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseIn(genType const& a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseOut(genType const& a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseInOut(genType const& a);\n\n\t/// @param a parameter\n\t/// @param o Optional overshoot modifier\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseIn(genType const& a, genType const& o);\n\n\t/// @param a parameter\n\t/// @param o Optional overshoot modifier\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseOut(genType const& a, genType const& o);\n\n\t/// @param a parameter\n\t/// @param o Optional overshoot modifier\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseInOut(genType const& a, genType const& o);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType bounceEaseIn(genType const& a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType bounceEaseOut(genType const& a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType bounceEaseInOut(genType const& a);\n\n\t/// @}\n}//namespace glm\n\n#include \"easing.inl\"\n"}, {"path": "includes/glm/gtx/euler_angles.hpp", "language": "code", "loc": 287, "comment_density": 0.352, "code": "/// @ref gtx_euler_angles\n/// @file glm/gtx/euler_angles.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_euler_angles GLM_GTX_euler_angles\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Build matrices from Euler angles.\n///\n/// Extraction of Euler angles from rotation matrix.\n/// Based on the original paper 2014 Mike Day - Extracting Euler Angles from a Rotation Matrix.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_euler_angles is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_euler_angles extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_euler_angles\n\t/// @{\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle X.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleX(\n\t\tT const& angleX);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Y.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleY(\n\t\tT const& angleY);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Z.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZ(\n\t\tT const& angleZ);\n\n\t/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about X-axis.\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleX(\n\t\tT const & angleX, T const & angularVelocityX);\n\n\t/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about Y-axis.\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleY(\n\t\tT const & angleY, T const & angularVelocityY);\n\n\t/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about Z-axis.\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleZ(\n\t\tT const & angleZ, T const & angularVelocityZ);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXY(\n\t\tT const& angleX,\n\t\tT const& angleY);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYX(\n\t\tT const& angleY,\n\t\tT const& angleX);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZ(\n\t\tT const& angleX,\n\t\tT const& angleZ);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZX(\n\t\tT const& angle,\n\t\tT const& angleX);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZ(\n\t\tT const& angleY,\n\t\tT const& angleZ);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZY(\n\t\tT const& angleZ,\n\t\tT const& angleY);\n\n /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y * Z).\n /// @see gtx_euler_angles\n template\n GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXYZ(\n T const& t1,\n T const& t2,\n T const& t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYXZ(\n\t\tT const& yaw,\n\t\tT const& pitch,\n\t\tT const& roll);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z * X).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZX(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y * X).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXYX(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Y).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYXY(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z * Y).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZY(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y * Z).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZYZ(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZXZ(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z * Y).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZY(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z * X).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZX(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y * X).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZYX(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X * Y).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZXY(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> yawPitchRoll(\n\t\tT const& yaw,\n\t\tT const& pitch,\n\t\tT const& roll);\n\n\t/// Creates a 2D 2 * 2 rotation matrix from an euler angle.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, defaultp> orientate2(T const& angle);\n\n\t/// Creates a 2D 4 * 4 homogeneous rotation matrix from an euler angle.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, defaultp> orientate3(T const& angle);\n\n\t/// Creates a 3D 3 * 3 rotation matrix from euler angles (Y * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> orientate3(vec<3, T, Q> const& angles);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> orientate4(vec<3, T, Q> const& angles);\n\n /// Extracts the (X * Y * Z) Euler angles from the rotation matrix M\n /// @see gtx_euler_angles\n template\n GLM_FUNC_DECL void extractEulerAngleXYZ(mat<4, 4, T, defaultp> const& M,\n T & t1,\n T & t2,\n T & t3);\n\n\t/// Extracts the (Y * X * Z) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleYXZ(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (X * Z * X) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleXZX(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (X * Y * X) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleXYX(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Y * X * Y) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleYXY(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Y * Z * Y) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleYZY(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Z * Y * Z) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleZYZ(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Z * X * Z) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleZXZ(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (X * Z * Y) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleXZY(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Y * Z * X) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleYZX(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Z * Y * X) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleZYX(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Z * X * Y) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleZXY(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// @}\n}//namespace glm\n\n#include \"euler_angles.inl\"\n"}, {"path": "includes/glm/gtx/extend.hpp", "language": "code", "loc": 34, "comment_density": 0.529, "code": "/// @ref gtx_extend\n/// @file glm/gtx/extend.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_extend GLM_GTX_extend\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Extend a position from a source to a position at a defined length.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_extend extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_extend\n\t/// @{\n\n\t/// Extends of Length the Origin position using the (Source - Origin) direction.\n\t/// @see gtx_extend\n\ttemplate\n\tGLM_FUNC_DECL genType extend(\n\t\tgenType const& Origin,\n\t\tgenType const& Source,\n\t\ttypename genType::value_type const Length);\n\n\t/// @}\n}//namespace glm\n\n#include \"extend.inl\"\n"}, {"path": "includes/glm/gtx/extended_min_max.hpp", "language": "code", "loc": 157, "comment_density": 0.446, "code": "/// @ref gtx_extended_min_max\n/// @file glm/gtx/extended_min_max.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_extended_min_max GLM_GTX_extended_min_max\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Min and max functions for 3 to 4 parameters.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_extended_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_extended_min_max extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_extended_min_max\n\t/// @{\n\n\t/// Return the minimum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL T min(\n\t\tT const& x,\n\t\tT const& y,\n\t\tT const& z);\n\n\t/// Return the minimum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C min(\n\t\tC const& x,\n\t\ttypename C::T const& y,\n\t\ttypename C::T const& z);\n\n\t/// Return the minimum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C min(\n\t\tC const& x,\n\t\tC const& y,\n\t\tC const& z);\n\n\t/// Return the minimum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL T min(\n\t\tT const& x,\n\t\tT const& y,\n\t\tT const& z,\n\t\tT const& w);\n\n\t/// Return the minimum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C min(\n\t\tC const& x,\n\t\ttypename C::T const& y,\n\t\ttypename C::T const& z,\n\t\ttypename C::T const& w);\n\n\t/// Return the minimum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C min(\n\t\tC const& x,\n\t\tC const& y,\n\t\tC const& z,\n\t\tC const& w);\n\n\t/// Return the maximum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL T max(\n\t\tT const& x,\n\t\tT const& y,\n\t\tT const& z);\n\n\t/// Return the maximum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C max(\n\t\tC const& x,\n\t\ttypename C::T const& y,\n\t\ttypename C::T const& z);\n\n\t/// Return the maximum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C max(\n\t\tC const& x,\n\t\tC const& y,\n\t\tC const& z);\n\n\t/// Return the maximum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL T max(\n\t\tT const& x,\n\t\tT const& y,\n\t\tT const& z,\n\t\tT const& w);\n\n\t/// Return the maximum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C max(\n\t\tC const& x,\n\t\ttypename C::T const& y,\n\t\ttypename C::T const& z,\n\t\ttypename C::T const& w);\n\n\t/// Return the maximum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C max(\n\t\tC const& x,\n\t\tC const& y,\n\t\tC const& z,\n\t\tC const& w);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam genType Floating-point or integer; scalar or vector types.\n\t///\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL genType fmin(genType x, genType y);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam genType Floating-point; scalar or vector types.\n\t///\n\t/// @see gtx_extended_min_max\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL genType fmax(genType x, genType y);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL genType fclamp(genType x, genType minVal, genType maxVal);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec fclamp(vec const& x, T minVal, T maxVal);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec fclamp(vec const& x, vec const& minVal, vec const& maxVal);\n\n\n\t/// @}\n}//namespace glm\n\n#include \"extended_min_max.inl\"\n"}, {"path": "includes/glm/gtx/exterior_product.hpp", "language": "code", "loc": 34, "comment_density": 0.676, "code": "/// @ref gtx_exterior_product\n/// @file glm/gtx/exterior_product.hpp\n///\n/// @see core (dependence)\n/// @see gtx_exterior_product (dependence)\n///\n/// @defgroup gtx_exterior_product GLM_GTX_exterior_product\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// @brief Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_exterior_product extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_exterior_product\n\t/// @{\n\n\t/// Returns the cross product of x and y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see Exterior product\n\ttemplate\n\tGLM_FUNC_DECL T cross(vec<2, T, Q> const& v, vec<2, T, Q> const& u);\n\n\t/// @}\n} //namespace glm\n\n#include \"exterior_product.inl\"\n"}, {"path": "includes/glm/gtx/fast_exponential.hpp", "language": "code", "loc": 76, "comment_density": 0.539, "code": "/// @ref gtx_fast_exponential\n/// @file glm/gtx/fast_exponential.hpp\n///\n/// @see core (dependence)\n/// @see gtx_half_float (dependence)\n///\n/// @defgroup gtx_fast_exponential GLM_GTX_fast_exponential\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Fast but less accurate implementations of exponential based functions.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_fast_exponential is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_fast_exponential extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_fast_exponential\n\t/// @{\n\n\t/// Faster than the common pow function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL genType fastPow(genType x, genType y);\n\n\t/// Faster than the common pow function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastPow(vec const& x, vec const& y);\n\n\t/// Faster than the common pow function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL genTypeT fastPow(genTypeT x, genTypeU y);\n\n\t/// Faster than the common pow function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastPow(vec const& x);\n\n\t/// Faster than the common exp function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL T fastExp(T x);\n\n\t/// Faster than the common exp function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastExp(vec const& x);\n\n\t/// Faster than the common log function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL T fastLog(T x);\n\n\t/// Faster than the common exp2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastLog(vec const& x);\n\n\t/// Faster than the common exp2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL T fastExp2(T x);\n\n\t/// Faster than the common exp2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastExp2(vec const& x);\n\n\t/// Faster than the common log2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL T fastLog2(T x);\n\n\t/// Faster than the common log2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastLog2(vec const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"fast_exponential.inl\"\n"}, {"path": "includes/glm/gtx/fast_square_root.hpp", "language": "code", "loc": 76, "comment_density": 0.592, "code": "/// @ref gtx_fast_square_root\n/// @file glm/gtx/fast_square_root.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_fast_square_root GLM_GTX_fast_square_root\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Fast but less accurate implementations of square root based functions.\n/// - Sqrt optimisation based on Newton's method,\n/// www.gamedev.net/community/forums/topic.asp?topic id=139956\n\n#pragma once\n\n// Dependency:\n#include \"../common.hpp\"\n#include \"../exponential.hpp\"\n#include \"../geometric.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_fast_square_root is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_fast_square_root extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_fast_square_root\n\t/// @{\n\n\t/// Faster than the common sqrt function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastSqrt(genType x);\n\n\t/// Faster than the common sqrt function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL vec fastSqrt(vec const& x);\n\n\t/// Faster than the common inversesqrt function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastInverseSqrt(genType x);\n\n\t/// Faster than the common inversesqrt function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL vec fastInverseSqrt(vec const& x);\n\n\t/// Faster than the common length function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastLength(genType x);\n\n\t/// Faster than the common length function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastLength(vec const& x);\n\n\t/// Faster than the common distance function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastDistance(genType x, genType y);\n\n\t/// Faster than the common distance function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastDistance(vec const& x, vec const& y);\n\n\t/// Faster than the common normalize function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastNormalize(genType const& x);\n\n\t/// @}\n}// namespace glm\n\n#include \"fast_square_root.inl\"\n"}, {"path": "includes/glm/gtx/fast_trigonometry.hpp", "language": "code", "loc": 64, "comment_density": 0.578, "code": "/// @ref gtx_fast_trigonometry\n/// @file glm/gtx/fast_trigonometry.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_fast_trigonometry GLM_GTX_fast_trigonometry\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Fast but less accurate implementations of trigonometric functions.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/constants.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_fast_trigonometry is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_fast_trigonometry extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_fast_trigonometry\n\t/// @{\n\n\t/// Wrap an angle to [0 2pi[\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T wrapAngle(T angle);\n\n\t/// Faster than the common sin function but less accurate.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastSin(T angle);\n\n\t/// Faster than the common cos function but less accurate.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastCos(T angle);\n\n\t/// Faster than the common tan function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastTan(T angle);\n\n\t/// Faster than the common asin function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastAsin(T angle);\n\n\t/// Faster than the common acos function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastAcos(T angle);\n\n\t/// Faster than the common atan function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastAtan(T y, T x);\n\n\t/// Faster than the common atan function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastAtan(T angle);\n\n\t/// @}\n}//namespace glm\n\n#include \"fast_trigonometry.inl\"\n"}, {"path": "includes/glm/gtx/functions.hpp", "language": "code", "loc": 43, "comment_density": 0.535, "code": "/// @ref gtx_functions\n/// @file glm/gtx/functions.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_functions GLM_GTX_functions\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// List of useful common functions.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../detail/type_vec2.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_functions extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_functions\n\t/// @{\n\n\t/// 1D gauss function\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL T gauss(\n\t\tT x,\n\t\tT ExpectedValue,\n\t\tT StandardDeviation);\n\n\t/// 2D gauss function\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL T gauss(\n\t\tvec<2, T, Q> const& Coord,\n\t\tvec<2, T, Q> const& ExpectedValue,\n\t\tvec<2, T, Q> const& StandardDeviation);\n\n\t/// @}\n}//namespace glm\n\n#include \"functions.inl\"\n\n"}, {"path": "includes/glm/gtx/gradient_paint.hpp", "language": "code", "loc": 44, "comment_density": 0.477, "code": "/// @ref gtx_gradient_paint\n/// @file glm/gtx/gradient_paint.hpp\n///\n/// @see core (dependence)\n/// @see gtx_optimum_pow (dependence)\n///\n/// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Functions that return the color of procedural gradient for specific coordinates.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/optimum_pow.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_gradient_paint is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_gradient_paint extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_gradient_paint\n\t/// @{\n\n\t/// Return a color from a radial gradient.\n\t/// @see - gtx_gradient_paint\n\ttemplate\n\tGLM_FUNC_DECL T radialGradient(\n\t\tvec<2, T, Q> const& Center,\n\t\tT const& Radius,\n\t\tvec<2, T, Q> const& Focal,\n\t\tvec<2, T, Q> const& Position);\n\n\t/// Return a color from a linear gradient.\n\t/// @see - gtx_gradient_paint\n\ttemplate\n\tGLM_FUNC_DECL T linearGradient(\n\t\tvec<2, T, Q> const& Point0,\n\t\tvec<2, T, Q> const& Point1,\n\t\tvec<2, T, Q> const& Position);\n\n\t/// @}\n}// namespace glm\n\n#include \"gradient_paint.inl\"\n"}, {"path": "includes/glm/gtx/handed_coordinate_space.hpp", "language": "code", "loc": 41, "comment_density": 0.488, "code": "/// @ref gtx_handed_coordinate_space\n/// @file glm/gtx/handed_coordinate_space.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// To know if a set of three basis vectors defines a right or left-handed coordinate system.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_handed_coordinate_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_handed_coordinate_space extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_handed_coordinate_space\n\t/// @{\n\n\t//! Return if a trihedron right handed or not.\n\t//! From GLM_GTX_handed_coordinate_space extension.\n\ttemplate\n\tGLM_FUNC_DECL bool rightHanded(\n\t\tvec<3, T, Q> const& tangent,\n\t\tvec<3, T, Q> const& binormal,\n\t\tvec<3, T, Q> const& normal);\n\n\t//! Return if a trihedron left handed or not.\n\t//! From GLM_GTX_handed_coordinate_space extension.\n\ttemplate\n\tGLM_FUNC_DECL bool leftHanded(\n\t\tvec<3, T, Q> const& tangent,\n\t\tvec<3, T, Q> const& binormal,\n\t\tvec<3, T, Q> const& normal);\n\n\t/// @}\n}// namespace glm\n\n#include \"handed_coordinate_space.inl\"\n"}, {"path": "includes/glm/gtx/hash.hpp", "language": "code", "loc": 113, "comment_density": 0.106, "code": "/// @ref gtx_hash\n/// @file glm/gtx/hash.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_hash GLM_GTX_hash\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add std::hash support for glm types\n\n#pragma once\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_hash is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#include \n\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../gtc/vec1.hpp\"\n\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtx/dual_quaternion.hpp\"\n\n#include \"../mat2x2.hpp\"\n#include \"../mat2x3.hpp\"\n#include \"../mat2x4.hpp\"\n\n#include \"../mat3x2.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat3x4.hpp\"\n\n#include \"../mat4x2.hpp\"\n#include \"../mat4x3.hpp\"\n#include \"../mat4x4.hpp\"\n\n#if !GLM_HAS_CXX11_STL\n#\terror \"GLM_GTX_hash requires C++11 standard library support\"\n#endif\n\nnamespace std\n{\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const;\n\t};\n\n\ttemplate\n\tstruct hash>\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::tquat const& q) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::tdualquat const& q) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const;\n\t};\n} // namespace std\n\n#include \"hash.inl\"\n"}, {"path": "includes/glm/gtx/integer.hpp", "language": "code", "loc": 59, "comment_density": 0.61, "code": "/// @ref gtx_integer\n/// @file glm/gtx/integer.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_integer GLM_GTX_integer\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add support for integer for core functions\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/integer.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_integer is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_integer extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_integer\n\t/// @{\n\n\t//! Returns x raised to the y power.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL int pow(int x, uint y);\n\n\t//! Returns the positive square root of x.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL int sqrt(int x);\n\n\t//! Returns the floor log2 of x.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL unsigned int floor_log2(unsigned int x);\n\n\t//! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL int mod(int x, int y);\n\n\t//! Return the factorial value of a number (!12 max, integer only)\n\t//! From GLM_GTX_integer extension.\n\ttemplate\n\tGLM_FUNC_DECL genType factorial(genType const& x);\n\n\t//! 32bit signed integer.\n\t//! From GLM_GTX_integer extension.\n\ttypedef signed int\t\t\t\t\tsint;\n\n\t//! Returns x raised to the y power.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL uint pow(uint x, uint y);\n\n\t//! Returns the positive square root of x.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL uint sqrt(uint x);\n\n\t//! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL uint mod(uint x, uint y);\n\n\t//! Returns the number of leading zeros.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL uint nlz(uint x);\n\n\t/// @}\n}//namespace glm\n\n#include \"integer.inl\"\n"}, {"path": "includes/glm/gtx/intersect.hpp", "language": "code", "loc": 79, "comment_density": 0.405, "code": "/// @ref gtx_intersect\n/// @file glm/gtx/intersect.hpp\n///\n/// @see core (dependence)\n/// @see gtx_closest_point (dependence)\n///\n/// @defgroup gtx_intersect GLM_GTX_intersect\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add intersection functions\n\n#pragma once\n\n// Dependency:\n#include \n#include \n#include \"../glm.hpp\"\n#include \"../geometric.hpp\"\n#include \"../gtx/closest_point.hpp\"\n#include \"../gtx/vector_query.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_closest_point extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_intersect\n\t/// @{\n\n\t//! Compute the intersection of a ray and a plane.\n\t//! Ray direction and plane normal must be unit length.\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectRayPlane(\n\t\tgenType const& orig, genType const& dir,\n\t\tgenType const& planeOrig, genType const& planeNormal,\n\t\ttypename genType::value_type & intersectionDistance);\n\n\t//! Compute the intersection of a ray and a triangle.\n\t/// Based om Tomas Möller implementation http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/raytri/\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectRayTriangle(\n\t\tvec<3, T, Q> const& orig, vec<3, T, Q> const& dir,\n\t\tvec<3, T, Q> const& v0, vec<3, T, Q> const& v1, vec<3, T, Q> const& v2,\n\t\tvec<2, T, Q>& baryPosition, T& distance);\n\n\t//! Compute the intersection of a line and a triangle.\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectLineTriangle(\n\t\tgenType const& orig, genType const& dir,\n\t\tgenType const& vert0, genType const& vert1, genType const& vert2,\n\t\tgenType & position);\n\n\t//! Compute the intersection distance of a ray and a sphere.\n\t//! The ray direction vector is unit length.\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectRaySphere(\n\t\tgenType const& rayStarting, genType const& rayNormalizedDirection,\n\t\tgenType const& sphereCenter, typename genType::value_type const sphereRadiusSquared,\n\t\ttypename genType::value_type & intersectionDistance);\n\n\t//! Compute the intersection of a ray and a sphere.\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectRaySphere(\n\t\tgenType const& rayStarting, genType const& rayNormalizedDirection,\n\t\tgenType const& sphereCenter, const typename genType::value_type sphereRadius,\n\t\tgenType & intersectionPosition, genType & intersectionNormal);\n\n\t//! Compute the intersection of a line and a sphere.\n\t//! From GLM_GTX_intersect extension\n\ttemplate\n\tGLM_FUNC_DECL bool intersectLineSphere(\n\t\tgenType const& point0, genType const& point1,\n\t\tgenType const& sphereCenter, typename genType::value_type sphereRadius,\n\t\tgenType & intersectionPosition1, genType & intersectionNormal1,\n\t\tgenType & intersectionPosition2 = genType(), genType & intersectionNormal2 = genType());\n\n\t/// @}\n}//namespace glm\n\n#include \"intersect.inl\"\n"}, {"path": "includes/glm/gtx/io.hpp", "language": "code", "loc": 160, "comment_density": 0.181, "code": "/// @ref gtx_io\n/// @file glm/gtx/io.hpp\n/// @author Jan P Springer (regnirpsj@gmail.com)\n///\n/// @see core (dependence)\n/// @see gtc_matrix_access (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_io GLM_GTX_io\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// std::[w]ostream support for glm types\n///\n/// std::[w]ostream support for glm types + qualifier/width/etc. manipulators\n/// based on howard hinnant's std::chrono io proposal\n/// [http://home.roadrunner.com/~hinnant/bloomington/chrono_io.html]\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_io is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n# pragma message(\"GLM: GLM_GTX_io extension included\")\n#endif\n\n#include // std::basic_ostream<> (fwd)\n#include // std::locale, std::locale::facet, std::locale::id\n#include // std::pair<>\n\nnamespace glm\n{\n\t/// @addtogroup gtx_io\n\t/// @{\n\n\tnamespace io\n\t{\n\t\tenum order_type { column_major, row_major};\n\n\t\ttemplate\n\t\tclass format_punct : public std::locale::facet\n\t\t{\n\t\t\ttypedef CTy char_type;\n\n\t\tpublic:\n\n\t\t\tstatic std::locale::id id;\n\n\t\t\tbool formatted;\n\t\t\tunsigned precision;\n\t\t\tunsigned width;\n\t\t\tchar_type separator;\n\t\t\tchar_type delim_left;\n\t\t\tchar_type delim_right;\n\t\t\tchar_type space;\n\t\t\tchar_type newline;\n\t\t\torder_type order;\n\n\t\t\tGLM_FUNC_DECL explicit format_punct(size_t a = 0);\n\t\t\tGLM_FUNC_DECL explicit format_punct(format_punct const&);\n\t\t};\n\n\t\ttemplate >\n\t\tclass basic_state_saver {\n\n\t\tpublic:\n\n\t\t\tGLM_FUNC_DECL explicit basic_state_saver(std::basic_ios&);\n\t\t\tGLM_FUNC_DECL ~basic_state_saver();\n\n\t\tprivate:\n\n\t\t\ttypedef ::std::basic_ios state_type;\n\t\t\ttypedef typename state_type::char_type char_type;\n\t\t\ttypedef ::std::ios_base::fmtflags flags_type;\n\t\t\ttypedef ::std::streamsize streamsize_type;\n\t\t\ttypedef ::std::locale const locale_type;\n\n\t\t\tstate_type& state_;\n\t\t\tflags_type flags_;\n\t\t\tstreamsize_type precision_;\n\t\t\tstreamsize_type width_;\n\t\t\tchar_type fill_;\n\t\t\tlocale_type locale_;\n\n\t\t\tGLM_FUNC_DECL basic_state_saver& operator=(basic_state_saver const&);\n\t\t};\n\n\t\ttypedef basic_state_saver state_saver;\n\t\ttypedef basic_state_saver wstate_saver;\n\n\t\ttemplate >\n\t\tclass basic_format_saver\n\t\t{\n\t\tpublic:\n\n\t\t\tGLM_FUNC_DECL explicit basic_format_saver(std::basic_ios&);\n\t\t\tGLM_FUNC_DECL ~basic_format_saver();\n\n\t\tprivate:\n\n\t\t\tbasic_state_saver const bss_;\n\n\t\t\tGLM_FUNC_DECL basic_format_saver& operator=(basic_format_saver const&);\n\t\t};\n\n\t\ttypedef basic_format_saver format_saver;\n\t\ttypedef basic_format_saver wformat_saver;\n\n\t\tstruct precision\n\t\t{\n\t\t\tunsigned value;\n\n\t\t\tGLM_FUNC_DECL explicit precision(unsigned);\n\t\t};\n\n\t\tstruct width\n\t\t{\n\t\t\tunsigned value;\n\n\t\t\tGLM_FUNC_DECL explicit width(unsigned);\n\t\t};\n\n\t\ttemplate\n\t\tstruct delimiter\n\t\t{\n\t\t\tCTy value[3];\n\n\t\t\tGLM_FUNC_DECL explicit delimiter(CTy /* left */, CTy /* right */, CTy /* separator */ = ',');\n\t\t};\n\n\t\tstruct order\n\t\t{\n\t\t\torder_type value;\n\n\t\t\tGLM_FUNC_DECL explicit order(order_type);\n\t\t};\n\n\t\t// functions, inlined (inline)\n\n\t\ttemplate\n\t\tFTy const& get_facet(std::basic_ios&);\n\t\ttemplate\n\t\tstd::basic_ios& formatted(std::basic_ios&);\n\t\ttemplate\n\t\tstd::basic_ios& unformatted(std::basic_ios&);\n\n\t\ttemplate\n\t\tstd::basic_ostream& operator<<(std::basic_ostream&, precision const&);\n\t\ttemplate\n\t\tstd::basic_ostream& operator<<(std::basic_ostream&, width const&);\n\t\ttemplate\n\t\tstd::basic_ostream& operator<<(std::basic_ostream&, delimiter const&);\n\t\ttemplate\n\t\tstd::basic_ostream& operator<<(std::basic_ostream&, order const&);\n\t}//namespace io\n\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, qua const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<1, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<2, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<3, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<4, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 2, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 3, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 4, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 2, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 3, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 4, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 2, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 3, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 4, T, Q> const&);\n\n template\n\tGLM_FUNC_DECL std::basic_ostream & operator<<(std::basic_ostream &,\n std::pair const, mat<4, 4, T, Q> const> const&);\n\n\t/// @}\n}//namespace glm\n\n#include \"io.inl\"\n"}, {"path": "includes/glm/gtx/log_base.hpp", "language": "code", "loc": 39, "comment_density": 0.513, "code": "/// @ref gtx_log_base\n/// @file glm/gtx/log_base.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_log_base GLM_GTX_log_base\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Logarithm for any base. base can be a vector or a scalar.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_log_base extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_log_base\n\t/// @{\n\n\t/// Logarithm for any base.\n\t/// From GLM_GTX_log_base.\n\ttemplate\n\tGLM_FUNC_DECL genType log(\n\t\tgenType const& x,\n\t\tgenType const& base);\n\n\t/// Logarithm for any base.\n\t/// From GLM_GTX_log_base.\n\ttemplate\n\tGLM_FUNC_DECL vec sign(\n\t\tvec const& x,\n\t\tvec const& base);\n\n\t/// @}\n}//namespace glm\n\n#include \"log_base.inl\"\n"}, {"path": "includes/glm/gtx/matrix_cross_product.hpp", "language": "code", "loc": 38, "comment_density": 0.553, "code": "/// @ref gtx_matrix_cross_product\n/// @file glm/gtx/matrix_cross_product.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Build cross product matrices\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_cross_product extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_cross_product\n\t/// @{\n\n\t//! Build a cross product matrix.\n\t//! From GLM_GTX_matrix_cross_product extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> matrixCross3(\n\t\tvec<3, T, Q> const& x);\n\n\t//! Build a cross product matrix.\n\t//! From GLM_GTX_matrix_cross_product extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> matrixCross4(\n\t\tvec<3, T, Q> const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_cross_product.inl\"\n"}, {"path": "includes/glm/gtx/matrix_decompose.hpp", "language": "code", "loc": 38, "comment_density": 0.474, "code": "/// @ref gtx_matrix_decompose\n/// @file glm/gtx/matrix_decompose.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_decompose GLM_GTX_matrix_decompose\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Decomposes a model matrix to translations, rotation and scale components\n\n#pragma once\n\n// Dependencies\n#include \"../mat4x4.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../geometric.hpp\"\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtc/matrix_transform.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_decompose is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_decompose extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_decompose\n\t/// @{\n\n\t/// Decomposes a model matrix to translations, rotation and scale components\n\t/// @see gtx_matrix_decompose\n\ttemplate\n\tGLM_FUNC_DECL bool decompose(\n\t\tmat<4, 4, T, Q> const& modelMatrix,\n\t\tvec<3, T, Q> & scale, qua & orientation, vec<3, T, Q> & translation, vec<3, T, Q> & skew, vec<4, T, Q> & perspective);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_decompose.inl\"\n"}, {"path": "includes/glm/gtx/matrix_factorisation.hpp", "language": "code", "loc": 57, "comment_density": 0.649, "code": "/// @ref gtx_matrix_factorisation\n/// @file glm/gtx/matrix_factorisation.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_factorisation GLM_GTX_matrix_factorisation\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Functions to factor matrices in various forms\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_factorisation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_factorisation extension included\")\n#endif\n\n/*\nSuggestions:\n - Move helper functions flipud and fliplr to another file: They may be helpful in more general circumstances.\n - Implement other types of matrix factorisation, such as: QL and LQ, L(D)U, eigendecompositions, etc...\n*/\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_factorisation\n\t/// @{\n\n\t/// Flips the matrix rows up and down.\n\t///\n\t/// From GLM_GTX_matrix_factorisation extension.\n\ttemplate \n\tGLM_FUNC_DECL mat flipud(mat const& in);\n\n\t/// Flips the matrix columns right and left.\n\t///\n\t/// From GLM_GTX_matrix_factorisation extension.\n\ttemplate \n\tGLM_FUNC_DECL mat fliplr(mat const& in);\n\n\t/// Performs QR factorisation of a matrix.\n\t/// Returns 2 matrices, q and r, such that the columns of q are orthonormal and span the same subspace than those of the input matrix, r is an upper triangular matrix, and q*r=in.\n\t/// Given an n-by-m input matrix, q has dimensions min(n,m)-by-m, and r has dimensions n-by-min(n,m).\n\t///\n\t/// From GLM_GTX_matrix_factorisation extension.\n\ttemplate \n\tGLM_FUNC_DECL void qr_decompose(mat const& in, mat<(C < R ? C : R), R, T, Q>& q, mat& r);\n\n\t/// Performs RQ factorisation of a matrix.\n\t/// Returns 2 matrices, r and q, such that r is an upper triangular matrix, the rows of q are orthonormal and span the same subspace than those of the input matrix, and r*q=in.\n\t/// Note that in the context of RQ factorisation, the diagonal is seen as starting in the lower-right corner of the matrix, instead of the usual upper-left.\n\t/// Given an n-by-m input matrix, r has dimensions min(n,m)-by-m, and q has dimensions n-by-min(n,m).\n\t///\n\t/// From GLM_GTX_matrix_factorisation extension.\n\ttemplate \n\tGLM_FUNC_DECL void rq_decompose(mat const& in, mat<(C < R ? C : R), R, T, Q>& r, mat& q);\n\n\t/// @}\n}\n\n#include \"matrix_factorisation.inl\"\n"}, {"path": "includes/glm/gtx/matrix_interpolation.hpp", "language": "code", "loc": 49, "comment_density": 0.531, "code": "/// @ref gtx_matrix_interpolation\n/// @file glm/gtx/matrix_interpolation.hpp\n/// @author Ghenadii Ursachi (the.asteroth@gmail.com)\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_interpolation GLM_GTX_matrix_interpolation\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Allows to directly interpolate two matrices.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_interpolation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_interpolation extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_interpolation\n\t/// @{\n\n\t/// Get the axis and angle of the rotation from a matrix.\n\t/// From GLM_GTX_matrix_interpolation extension.\n\ttemplate\n\tGLM_FUNC_DECL void axisAngle(\n\t\tmat<4, 4, T, Q> const& Mat, vec<3, T, Q> & Axis, T & Angle);\n\n\t/// Build a matrix from axis and angle.\n\t/// From GLM_GTX_matrix_interpolation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> axisAngleMatrix(\n\t\tvec<3, T, Q> const& Axis, T const Angle);\n\n\t/// Extracts the rotation part of a matrix.\n\t/// From GLM_GTX_matrix_interpolation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> extractMatrixRotation(\n\t\tmat<4, 4, T, Q> const& Mat);\n\n\t/// Build a interpolation of 4 * 4 matrixes.\n\t/// From GLM_GTX_matrix_interpolation extension.\n\t/// Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> interpolate(\n\t\tmat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2, T const Delta);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_interpolation.inl\"\n"}, {"path": "includes/glm/gtx/matrix_major_storage.hpp", "language": "code", "loc": 100, "comment_density": 0.41, "code": "/// @ref gtx_matrix_major_storage\n/// @file glm/gtx/matrix_major_storage.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_matrix_major_storage GLM_GTX_matrix_major_storage\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Build matrices with specific matrix order, row or column\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_major_storage is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_major_storage extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_major_storage\n\t/// @{\n\n\t//! Build a row major matrix from row vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> rowMajor2(\n\t\tvec<2, T, Q> const& v1,\n\t\tvec<2, T, Q> const& v2);\n\n\t//! Build a row major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> rowMajor2(\n\t\tmat<2, 2, T, Q> const& m);\n\n\t//! Build a row major matrix from row vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> rowMajor3(\n\t\tvec<3, T, Q> const& v1,\n\t\tvec<3, T, Q> const& v2,\n\t\tvec<3, T, Q> const& v3);\n\n\t//! Build a row major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> rowMajor3(\n\t\tmat<3, 3, T, Q> const& m);\n\n\t//! Build a row major matrix from row vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rowMajor4(\n\t\tvec<4, T, Q> const& v1,\n\t\tvec<4, T, Q> const& v2,\n\t\tvec<4, T, Q> const& v3,\n\t\tvec<4, T, Q> const& v4);\n\n\t//! Build a row major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rowMajor4(\n\t\tmat<4, 4, T, Q> const& m);\n\n\t//! Build a column major matrix from column vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> colMajor2(\n\t\tvec<2, T, Q> const& v1,\n\t\tvec<2, T, Q> const& v2);\n\n\t//! Build a column major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> colMajor2(\n\t\tmat<2, 2, T, Q> const& m);\n\n\t//! Build a column major matrix from column vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> colMajor3(\n\t\tvec<3, T, Q> const& v1,\n\t\tvec<3, T, Q> const& v2,\n\t\tvec<3, T, Q> const& v3);\n\n\t//! Build a column major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> colMajor3(\n\t\tmat<3, 3, T, Q> const& m);\n\n\t//! Build a column major matrix from column vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> colMajor4(\n\t\tvec<4, T, Q> const& v1,\n\t\tvec<4, T, Q> const& v2,\n\t\tvec<4, T, Q> const& v3,\n\t\tvec<4, T, Q> const& v4);\n\n\t//! Build a column major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> colMajor4(\n\t\tmat<4, 4, T, Q> const& m);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_major_storage.inl\"\n"}, {"path": "includes/glm/gtx/matrix_operation.hpp", "language": "code", "loc": 84, "comment_density": 0.476, "code": "/// @ref gtx_matrix_operation\n/// @file glm/gtx/matrix_operation.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_operation GLM_GTX_matrix_operation\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Build diagonal matrices from vectors.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_operation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_operation extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_operation\n\t/// @{\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> diagonal2x2(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> diagonal2x3(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> diagonal2x4(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> diagonal3x2(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> diagonal3x3(\n\t\tvec<3, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> diagonal3x4(\n\t\tvec<3, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> diagonal4x2(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> diagonal4x3(\n\t\tvec<3, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> diagonal4x4(\n\t\tvec<4, T, Q> const& v);\n\n\t/// Build an adjugate matrix.\n\t/// From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> adjugate(mat<2, 2, T, Q> const& m);\n\n\t/// Build an adjugate matrix.\n\t/// From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> adjugate(mat<3, 3, T, Q> const& m);\n\n\t/// Build an adjugate matrix.\n\t/// From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> adjugate(mat<4, 4, T, Q> const& m);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_operation.inl\"\n"}, {"path": "includes/glm/gtx/matrix_query.hpp", "language": "code", "loc": 62, "comment_density": 0.532, "code": "/// @ref gtx_matrix_query\n/// @file glm/gtx/matrix_query.hpp\n///\n/// @see core (dependence)\n/// @see gtx_vector_query (dependence)\n///\n/// @defgroup gtx_matrix_query GLM_GTX_matrix_query\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Query to evaluate matrix properties\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/vector_query.hpp\"\n#include \n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_query extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_query\n\t/// @{\n\n\t/// Return whether a matrix a null matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNull(mat<2, 2, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix a null matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNull(mat<3, 3, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is a null matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNull(mat<4, 4, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is an identity matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate class matType>\n\tGLM_FUNC_DECL bool isIdentity(matType const& m, T const& epsilon);\n\n\t/// Return whether a matrix is a normalized matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNormalized(mat<2, 2, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is a normalized matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNormalized(mat<3, 3, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is a normalized matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNormalized(mat<4, 4, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is an orthonormalized matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate class matType>\n\tGLM_FUNC_DECL bool isOrthogonal(matType const& m, T const& epsilon);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_query.inl\"\n"}, {"path": "includes/glm/gtx/matrix_transform_2d.hpp", "language": "code", "loc": 69, "comment_density": 0.536, "code": "/// @ref gtx_matrix_transform_2d\n/// @file glm/gtx/matrix_transform_2d.hpp\n/// @author Miguel Ángel Pérez Martínez\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines functions that generate common 2d transformation matrices.\n\n#pragma once\n\n// Dependency:\n#include \"../mat3x3.hpp\"\n#include \"../vec2.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_transform_2d is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_transform_2d extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_transform_2d\n\t/// @{\n\n\t/// Builds a translation 3 * 3 matrix created from a vector of 2 components.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param v Coordinates of a translation vector.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tvec<2, T, Q> const& v);\n\n\t/// Builds a rotation 3 * 3 matrix created from an angle.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param angle Rotation angle expressed in radians.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tT angle);\n\n\t/// Builds a scale 3 * 3 matrix created from a vector of 2 components.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param v Coordinates of a scale vector.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tvec<2, T, Q> const& v);\n\n\t/// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param y Shear factor.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tT y);\n\n\t/// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param x Shear factor.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tT x);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_transform_2d.inl\"\n"}, {"path": "includes/glm/gtx/mixed_product.hpp", "language": "code", "loc": 33, "comment_density": 0.515, "code": "/// @ref gtx_mixed_product\n/// @file glm/gtx/mixed_product.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_mixed_product GLM_GTX_mixed_product\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Mixed product of 3 vectors.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_mixed_product extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_mixed_product\n\t/// @{\n\n\t/// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension)\n\ttemplate\n\tGLM_FUNC_DECL T mixedProduct(\n\t\tvec<3, T, Q> const& v1,\n\t\tvec<3, T, Q> const& v2,\n\t\tvec<3, T, Q> const& v3);\n\n\t/// @}\n}// namespace glm\n\n#include \"mixed_product.inl\"\n"}, {"path": "includes/glm/gtx/norm.hpp", "language": "code", "loc": 61, "comment_density": 0.541, "code": "/// @ref gtx_norm\n/// @file glm/gtx/norm.hpp\n///\n/// @see core (dependence)\n/// @see gtx_quaternion (dependence)\n///\n/// @defgroup gtx_norm GLM_GTX_norm\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Various ways to compute vector norms.\n\n#pragma once\n\n// Dependency:\n#include \"../geometric.hpp\"\n#include \"../gtx/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_norm is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_norm extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_norm\n\t/// @{\n\n\t/// Returns the squared length of x.\n\t/// From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T length2(vec const& x);\n\n\t/// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).\n\t/// From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T distance2(vec const& p0, vec const& p1);\n\n\t//! Returns the L1 norm between x and y.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);\n\n\t//! Returns the L1 norm of v.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& v);\n\n\t//! Returns the L2 norm between x and y.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);\n\n\t//! Returns the L2 norm of v.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x);\n\n\t//! Returns the L norm between x and y.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y, unsigned int Depth);\n\n\t//! Returns the L norm of v.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, unsigned int Depth);\n\n\t/// @}\n}//namespace glm\n\n#include \"norm.inl\"\n"}, {"path": "includes/glm/gtx/normal.hpp", "language": "code", "loc": 33, "comment_density": 0.606, "code": "/// @ref gtx_normal\n/// @file glm/gtx/normal.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_normal GLM_GTX_normal\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Compute the normal of a triangle.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_normal extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_normal\n\t/// @{\n\n\t/// Computes triangle normal from triangle points.\n\t///\n\t/// @see gtx_normal\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> triangleNormal(vec<3, T, Q> const& p1, vec<3, T, Q> const& p2, vec<3, T, Q> const& p3);\n\n\t/// @}\n}//namespace glm\n\n#include \"normal.inl\"\n"}, {"path": "includes/glm/gtx/normalize_dot.hpp", "language": "code", "loc": 40, "comment_density": 0.625, "code": "/// @ref gtx_normalize_dot\n/// @file glm/gtx/normalize_dot.hpp\n///\n/// @see core (dependence)\n/// @see gtx_fast_square_root (dependence)\n///\n/// @defgroup gtx_normalize_dot GLM_GTX_normalize_dot\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Dot product of vectors that need to be normalize with a single square root.\n\n#pragma once\n\n// Dependency:\n#include \"../gtx/fast_square_root.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_normalize_dot is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_normalize_dot extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_normalize_dot\n\t/// @{\n\n\t/// Normalize parameters and returns the dot product of x and y.\n\t/// It's faster that dot(normalize(x), normalize(y)).\n\t///\n\t/// @see gtx_normalize_dot extension.\n\ttemplate\n\tGLM_FUNC_DECL T normalizeDot(vec const& x, vec const& y);\n\n\t/// Normalize parameters and returns the dot product of x and y.\n\t/// Faster that dot(fastNormalize(x), fastNormalize(y)).\n\t///\n\t/// @see gtx_normalize_dot extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastNormalizeDot(vec const& x, vec const& y);\n\n\t/// @}\n}//namespace glm\n\n#include \"normalize_dot.inl\"\n"}, {"path": "includes/glm/gtx/number_precision.hpp", "language": "code", "loc": 48, "comment_density": 0.729, "code": "/// @ref gtx_number_precision\n/// @file glm/gtx/number_precision.hpp\n///\n/// @see core (dependence)\n/// @see gtc_type_precision (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_number_precision GLM_GTX_number_precision\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defined size types.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/type_precision.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_number_precision is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_number_precision extension included\")\n#endif\n\nnamespace glm{\nnamespace gtx\n{\n\t/////////////////////////////\n\t// Unsigned int vector types\n\n\t/// @addtogroup gtx_number_precision\n\t/// @{\n\n\ttypedef u8\t\t\tu8vec1;\t\t//!< \\brief 8bit unsigned integer scalar. (from GLM_GTX_number_precision extension)\n\ttypedef u16\t\t\tu16vec1; //!< \\brief 16bit unsigned integer scalar. (from GLM_GTX_number_precision extension)\n\ttypedef u32\t\t\tu32vec1; //!< \\brief 32bit unsigned integer scalar. (from GLM_GTX_number_precision extension)\n\ttypedef u64\t\t\tu64vec1; //!< \\brief 64bit unsigned integer scalar. (from GLM_GTX_number_precision extension)\n\n\t//////////////////////\n\t// Float vector types\n\n\ttypedef f32\t\t\tf32vec1; //!< \\brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\ttypedef f64\t\t\tf64vec1; //!< \\brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\n\t//////////////////////\n\t// Float matrix types\n\n\ttypedef f32\t\t\tf32mat1;\t//!< \\brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\ttypedef f32\t\t\tf32mat1x1;\t//!< \\brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\ttypedef f64\t\t\tf64mat1;\t//!< \\brief Double-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\ttypedef f64\t\t\tf64mat1x1;\t//!< \\brief Double-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\n\t/// @}\n}//namespace gtx\n}//namespace glm\n\n#include \"number_precision.inl\"\n"}, {"path": "includes/glm/gtx/optimum_pow.hpp", "language": "code", "loc": 44, "comment_density": 0.591, "code": "/// @ref gtx_optimum_pow\n/// @file glm/gtx/optimum_pow.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_optimum_pow GLM_GTX_optimum_pow\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Integer exponentiation of power functions.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_optimum_pow is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_optimum_pow extension included\")\n#endif\n\nnamespace glm{\nnamespace gtx\n{\n\t/// @addtogroup gtx_optimum_pow\n\t/// @{\n\n\t/// Returns x raised to the power of 2.\n\t///\n\t/// @see gtx_optimum_pow\n\ttemplate\n\tGLM_FUNC_DECL genType pow2(genType const& x);\n\n\t/// Returns x raised to the power of 3.\n\t///\n\t/// @see gtx_optimum_pow\n\ttemplate\n\tGLM_FUNC_DECL genType pow3(genType const& x);\n\n\t/// Returns x raised to the power of 4.\n\t///\n\t/// @see gtx_optimum_pow\n\ttemplate\n\tGLM_FUNC_DECL genType pow4(genType const& x);\n\n\t/// @}\n}//namespace gtx\n}//namespace glm\n\n#include \"optimum_pow.inl\"\n"}, {"path": "includes/glm/gtx/orthonormalize.hpp", "language": "code", "loc": 40, "comment_density": 0.575, "code": "/// @ref gtx_orthonormalize\n/// @file glm/gtx/orthonormalize.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Orthonormalize matrices.\n\n#pragma once\n\n// Dependency:\n#include \"../vec3.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../geometric.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_orthonormalize is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_orthonormalize extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_orthonormalize\n\t/// @{\n\n\t/// Returns the orthonormalized matrix of m.\n\t///\n\t/// @see gtx_orthonormalize\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m);\n\n\t/// Orthonormalizes x according y.\n\t///\n\t/// @see gtx_orthonormalize\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y);\n\n\t/// @}\n}//namespace glm\n\n#include \"orthonormalize.inl\"\n"}, {"path": "includes/glm/gtx/perpendicular.hpp", "language": "code", "loc": 33, "comment_density": 0.576, "code": "/// @ref gtx_perpendicular\n/// @file glm/gtx/perpendicular.hpp\n///\n/// @see core (dependence)\n/// @see gtx_projection (dependence)\n///\n/// @defgroup gtx_perpendicular GLM_GTX_perpendicular\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Perpendicular of a vector from other one\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/projection.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_perpendicular extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_perpendicular\n\t/// @{\n\n\t//! Projects x a perpendicular axis of Normal.\n\t//! From GLM_GTX_perpendicular extension.\n\ttemplate\n\tGLM_FUNC_DECL genType perp(genType const& x, genType const& Normal);\n\n\t/// @}\n}//namespace glm\n\n#include \"perpendicular.inl\"\n"}, {"path": "includes/glm/gtx/polar_coordinates.hpp", "language": "code", "loc": 39, "comment_density": 0.564, "code": "/// @ref gtx_polar_coordinates\n/// @file glm/gtx/polar_coordinates.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Conversion from Euclidean space to polar space and revert.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_polar_coordinates is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_polar_coordinates extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_polar_coordinates\n\t/// @{\n\n\t/// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude.\n\t///\n\t/// @see gtx_polar_coordinates\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> polar(\n\t\tvec<3, T, Q> const& euclidean);\n\n\t/// Convert Polar to Euclidean coordinates.\n\t///\n\t/// @see gtx_polar_coordinates\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> euclidean(\n\t\tvec<2, T, Q> const& polar);\n\n\t/// @}\n}//namespace glm\n\n#include \"polar_coordinates.inl\"\n"}, {"path": "includes/glm/gtx/projection.hpp", "language": "code", "loc": 32, "comment_density": 0.594, "code": "/// @ref gtx_projection\n/// @file glm/gtx/projection.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_projection GLM_GTX_projection\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Projection of a vector to other one\n\n#pragma once\n\n// Dependency:\n#include \"../geometric.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_projection extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_projection\n\t/// @{\n\n\t/// Projects x on Normal.\n\t///\n\t/// @see gtx_projection\n\ttemplate\n\tGLM_FUNC_DECL genType proj(genType const& x, genType const& Normal);\n\n\t/// @}\n}//namespace glm\n\n#include \"projection.inl\"\n"}, {"path": "includes/glm/gtx/quaternion.hpp", "language": "code", "loc": 150, "comment_density": 0.493, "code": "/// @ref gtx_quaternion\n/// @file glm/gtx/quaternion.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_quaternion GLM_GTX_quaternion\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Extended quaternion types and functions\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/constants.hpp\"\n#include \"../gtc/quaternion.hpp\"\n#include \"../ext/quaternion_exponential.hpp\"\n#include \"../gtx/norm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_quaternion extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_quaternion\n\t/// @{\n\n\t/// Create an identity quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua quat_identity();\n\n\t/// Compute a cross product between a quaternion and a vector.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> cross(\n\t\tqua const& q,\n\t\tvec<3, T, Q> const& v);\n\n\t//! Compute a cross product between a vector and a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> cross(\n\t\tvec<3, T, Q> const& v,\n\t\tqua const& q);\n\n\t//! Compute a point on a path according squad equation.\n\t//! q1 and q2 are control points; s1 and s2 are intermediate control points.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua squad(\n\t\tqua const& q1,\n\t\tqua const& q2,\n\t\tqua const& s1,\n\t\tqua const& s2,\n\t\tT const& h);\n\n\t//! Returns an intermediate control point for squad interpolation.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua intermediate(\n\t\tqua const& prev,\n\t\tqua const& curr,\n\t\tqua const& next);\n\n\t//! Returns quarternion square root.\n\t///\n\t/// @see gtx_quaternion\n\t//template\n\t//qua sqrt(\n\t//\tqua const& q);\n\n\t//! Rotates a 3 components vector by a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotate(\n\t\tqua const& q,\n\t\tvec<3, T, Q> const& v);\n\n\t/// Rotates a 4 components vector by a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotate(\n\t\tqua const& q,\n\t\tvec<4, T, Q> const& v);\n\n\t/// Extract the real component of a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T extractRealComponent(\n\t\tqua const& q);\n\n\t/// Converts a quaternion to a 3 * 3 matrix.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> toMat3(\n\t\tqua const& x){return mat3_cast(x);}\n\n\t/// Converts a quaternion to a 4 * 4 matrix.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> toMat4(\n\t\tqua const& x){return mat4_cast(x);}\n\n\t/// Converts a 3 * 3 matrix to a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua toQuat(\n\t\tmat<3, 3, T, Q> const& x){return quat_cast(x);}\n\n\t/// Converts a 4 * 4 matrix to a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua toQuat(\n\t\tmat<4, 4, T, Q> const& x){return quat_cast(x);}\n\n\t/// Quaternion interpolation using the rotation short path.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua shortMix(\n\t\tqua const& x,\n\t\tqua const& y,\n\t\tT const& a);\n\n\t/// Quaternion normalized linear interpolation.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua fastMix(\n\t\tqua const& x,\n\t\tqua const& y,\n\t\tT const& a);\n\n\t/// Compute the rotation between two vectors.\n\t/// param orig vector, needs to be normalized\n\t/// param dest vector, needs to be normalized\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua rotation(\n\t\tvec<3, T, Q> const& orig,\n\t\tvec<3, T, Q> const& dest);\n\n\t/// Returns the squared length of x.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T length2(qua const& q);\n\n\t/// @}\n}//namespace glm\n\n#include \"quaternion.inl\"\n"}, {"path": "includes/glm/gtx/range.hpp", "language": "code", "loc": 80, "comment_density": 0.212, "code": "/// @ref gtx_range\n/// @file glm/gtx/range.hpp\n/// @author Joshua Moerman\n///\n/// @defgroup gtx_range GLM_GTX_range\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines begin and end for vectors and matrices. Useful for range-based for loop.\n/// The range is defined over the elements, not over columns or rows (e.g. mat4 has 16 elements).\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_range is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if !GLM_HAS_RANGE_FOR\n#\terror \"GLM_GTX_range requires C++11 support or 'range for'\"\n#endif\n\n#include \"../gtc/type_ptr.hpp\"\n#include \"../gtc/vec1.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup gtx_range\n\t/// @{\n\n#\tif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tpragma warning(push)\n#\t\tpragma warning(disable : 4100) // unreferenced formal parameter\n#\tendif\n\n\ttemplate\n\tinline length_t components(vec<1, T, Q> const& v)\n\t{\n\t\treturn v.length();\n\t}\n\n\ttemplate\n\tinline length_t components(vec<2, T, Q> const& v)\n\t{\n\t\treturn v.length();\n\t}\n\n\ttemplate\n\tinline length_t components(vec<3, T, Q> const& v)\n\t{\n\t\treturn v.length();\n\t}\n\n\ttemplate\n\tinline length_t components(vec<4, T, Q> const& v)\n\t{\n\t\treturn v.length();\n\t}\n\n\ttemplate\n\tinline length_t components(genType const& m)\n\t{\n\t\treturn m.length() * m[0].length();\n\t}\n\n\ttemplate\n\tinline typename genType::value_type const * begin(genType const& v)\n\t{\n\t\treturn value_ptr(v);\n\t}\n\n\ttemplate\n\tinline typename genType::value_type const * end(genType const& v)\n\t{\n\t\treturn begin(v) + components(v);\n\t}\n\n\ttemplate\n\tinline typename genType::value_type * begin(genType& v)\n\t{\n\t\treturn value_ptr(v);\n\t}\n\n\ttemplate\n\tinline typename genType::value_type * end(genType& v)\n\t{\n\t\treturn begin(v) + components(v);\n\t}\n\n#\tif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tpragma warning(pop)\n#\tendif\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/gtx/raw_data.hpp", "language": "code", "loc": 40, "comment_density": 0.6, "code": "/// @ref gtx_raw_data\n/// @file glm/gtx/raw_data.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_raw_data GLM_GTX_raw_data\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Projection of a vector to other one\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_uint_sized.hpp\"\n#include \"../detail/setup.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_raw_data extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_raw_data\n\t/// @{\n\n\t//! Type for byte numbers.\n\t//! From GLM_GTX_raw_data extension.\n\ttypedef detail::uint8\t\tbyte;\n\n\t//! Type for word numbers.\n\t//! From GLM_GTX_raw_data extension.\n\ttypedef detail::uint16\t\tword;\n\n\t//! Type for dword numbers.\n\t//! From GLM_GTX_raw_data extension.\n\ttypedef detail::uint32\t\tdword;\n\n\t//! Type for qword numbers.\n\t//! From GLM_GTX_raw_data extension.\n\ttypedef detail::uint64\t\tqword;\n\n\t/// @}\n}// namespace glm\n\n#include \"raw_data.inl\"\n"}, {"path": "includes/glm/gtx/rotate_normalized_axis.hpp", "language": "code", "loc": 59, "comment_density": 0.61, "code": "/// @ref gtx_rotate_normalized_axis\n/// @file glm/gtx/rotate_normalized_axis.hpp\n///\n/// @see core (dependence)\n/// @see gtc_matrix_transform\n/// @see gtc_quaternion\n///\n/// @defgroup gtx_rotate_normalized_axis GLM_GTX_rotate_normalized_axis\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Quaternions and matrices rotations around normalized axis.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/epsilon.hpp\"\n#include \"../gtc/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_rotate_normalized_axis is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_rotate_normalized_axis extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_rotate_normalized_axis\n\t/// @{\n\n\t/// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle.\n\t///\n\t/// @param m Input matrix multiplied by this rotation matrix.\n\t/// @param angle Rotation angle expressed in radians.\n\t/// @param axis Rotation axis, must be normalized.\n\t/// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.\n\t///\n\t/// @see gtx_rotate_normalized_axis\n\t/// @see - rotate(T angle, T x, T y, T z)\n\t/// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)\n\t/// @see - rotate(T angle, vec<3, T, Q> const& v)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rotateNormalizedAxis(\n\t\tmat<4, 4, T, Q> const& m,\n\t\tT const& angle,\n\t\tvec<3, T, Q> const& axis);\n\n\t/// Rotates a quaternion from a vector of 3 components normalized axis and an angle.\n\t///\n\t/// @param q Source orientation\n\t/// @param angle Angle expressed in radians.\n\t/// @param axis Normalized axis of the rotation, must be normalized.\n\t///\n\t/// @see gtx_rotate_normalized_axis\n\ttemplate\n\tGLM_FUNC_DECL qua rotateNormalizedAxis(\n\t\tqua const& q,\n\t\tT const& angle,\n\t\tvec<3, T, Q> const& axis);\n\n\t/// @}\n}//namespace glm\n\n#include \"rotate_normalized_axis.inl\"\n"}, {"path": "includes/glm/gtx/rotate_vector.hpp", "language": "code", "loc": 105, "comment_density": 0.419, "code": "/// @ref gtx_rotate_vector\n/// @file glm/gtx/rotate_vector.hpp\n///\n/// @see core (dependence)\n/// @see gtx_transform (dependence)\n///\n/// @defgroup gtx_rotate_vector GLM_GTX_rotate_vector\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Function to directly rotate a vector\n\n#pragma once\n\n// Dependency:\n#include \"../gtx/transform.hpp\"\n#include \"../gtc/epsilon.hpp\"\n#include \"../ext/vector_relational.hpp\"\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_rotate_vector is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_rotate_vector extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_rotate_vector\n\t/// @{\n\n\t/// Returns Spherical interpolation between two vectors\n\t///\n\t/// @param x A first vector\n\t/// @param y A second vector\n\t/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].\n\t///\n\t/// @see gtx_rotate_vector\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> slerp(\n\t\tvec<3, T, Q> const& x,\n\t\tvec<3, T, Q> const& y,\n\t\tT const& a);\n\n\t//! Rotate a two dimensional vector.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, Q> rotate(\n\t\tvec<2, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a three dimensional vector around an axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotate(\n\t\tvec<3, T, Q> const& v,\n\t\tT const& angle,\n\t\tvec<3, T, Q> const& normal);\n\n\t//! Rotate a four dimensional vector around an axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotate(\n\t\tvec<4, T, Q> const& v,\n\t\tT const& angle,\n\t\tvec<3, T, Q> const& normal);\n\n\t//! Rotate a three dimensional vector around the X axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotateX(\n\t\tvec<3, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a three dimensional vector around the Y axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotateY(\n\t\tvec<3, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a three dimensional vector around the Z axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotateZ(\n\t\tvec<3, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a four dimensional vector around the X axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotateX(\n\t\tvec<4, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a four dimensional vector around the Y axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotateY(\n\t\tvec<4, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a four dimensional vector around the Z axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotateZ(\n\t\tvec<4, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Build a rotation matrix from a normal and a up vector.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> orientation(\n\t\tvec<3, T, Q> const& Normal,\n\t\tvec<3, T, Q> const& Up);\n\n\t/// @}\n}//namespace glm\n\n#include \"rotate_vector.inl\"\n"}, {"path": "includes/glm/gtx/scalar_multiplication.hpp", "language": "code", "loc": 65, "comment_density": 0.246, "code": "/// @ref gtx\n/// @file glm/gtx/scalar_multiplication.hpp\n/// @author Joshua Moerman\n///\n/// Include to use the features of this extension.\n///\n/// Enables scalar multiplication for all types\n///\n/// Since GLSL is very strict about types, the following (often used) combinations do not work:\n/// double * vec4\n/// int * vec4\n/// vec4 / int\n/// So we'll fix that! Of course \"float * vec4\" should remain the same (hence the enable_if magic)\n\n#pragma once\n\n#include \"../detail/setup.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_scalar_multiplication is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if !GLM_HAS_TEMPLATE_ALIASES && !(GLM_COMPILER & GLM_COMPILER_GCC)\n#\terror \"GLM_GTX_scalar_multiplication requires C++11 support or alias templates and if not support for GCC\"\n#endif\n\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../mat2x2.hpp\"\n#include \n\nnamespace glm\n{\n\ttemplate\n\tusing return_type_scalar_multiplication = typename std::enable_if<\n\t\t!std::is_same::value // T may not be a float\n\t\t&& std::is_arithmetic::value, Vec // But it may be an int or double (no vec3 or mat3, ...)\n\t>::type;\n\n#define GLM_IMPLEMENT_SCAL_MULT(Vec) \\\n\ttemplate \\\n\treturn_type_scalar_multiplication \\\n\toperator*(T const& s, Vec rh){ \\\n\t\treturn rh *= static_cast(s); \\\n\t} \\\n\t \\\n\ttemplate \\\n\treturn_type_scalar_multiplication \\\n\toperator*(Vec lh, T const& s){ \\\n\t\treturn lh *= static_cast(s); \\\n\t} \\\n\t \\\n\ttemplate \\\n\treturn_type_scalar_multiplication \\\n\toperator/(Vec lh, T const& s){ \\\n\t\treturn lh *= 1.0f / s; \\\n\t}\n\nGLM_IMPLEMENT_SCAL_MULT(vec2)\nGLM_IMPLEMENT_SCAL_MULT(vec3)\nGLM_IMPLEMENT_SCAL_MULT(vec4)\n\nGLM_IMPLEMENT_SCAL_MULT(mat2)\nGLM_IMPLEMENT_SCAL_MULT(mat2x3)\nGLM_IMPLEMENT_SCAL_MULT(mat2x4)\nGLM_IMPLEMENT_SCAL_MULT(mat3x2)\nGLM_IMPLEMENT_SCAL_MULT(mat3)\nGLM_IMPLEMENT_SCAL_MULT(mat3x4)\nGLM_IMPLEMENT_SCAL_MULT(mat4x2)\nGLM_IMPLEMENT_SCAL_MULT(mat4x3)\nGLM_IMPLEMENT_SCAL_MULT(mat4)\n\n#undef GLM_IMPLEMENT_SCAL_MULT\n} // namespace glm\n"}, {"path": "includes/glm/gtx/scalar_relational.hpp", "language": "code", "loc": 27, "comment_density": 0.593, "code": "/// @ref gtx_scalar_relational\n/// @file glm/gtx/scalar_relational.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Extend a position from a source to a position at a defined length.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_extend extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_scalar_relational\n\t/// @{\n\n\n\n\t/// @}\n}//namespace glm\n\n#include \"scalar_relational.inl\"\n"}, {"path": "includes/glm/gtx/spline.hpp", "language": "code", "loc": 55, "comment_density": 0.4, "code": "/// @ref gtx_spline\n/// @file glm/gtx/spline.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_spline GLM_GTX_spline\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Spline functions\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/optimum_pow.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_spline is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_spline extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_spline\n\t/// @{\n\n\t/// Return a point from a catmull rom curve.\n\t/// @see gtx_spline extension.\n\ttemplate\n\tGLM_FUNC_DECL genType catmullRom(\n\t\tgenType const& v1,\n\t\tgenType const& v2,\n\t\tgenType const& v3,\n\t\tgenType const& v4,\n\t\ttypename genType::value_type const& s);\n\n\t/// Return a point from a hermite curve.\n\t/// @see gtx_spline extension.\n\ttemplate\n\tGLM_FUNC_DECL genType hermite(\n\t\tgenType const& v1,\n\t\tgenType const& t1,\n\t\tgenType const& v2,\n\t\tgenType const& t2,\n\t\ttypename genType::value_type const& s);\n\n\t/// Return a point from a cubic curve.\n\t/// @see gtx_spline extension.\n\ttemplate\n\tGLM_FUNC_DECL genType cubic(\n\t\tgenType const& v1,\n\t\tgenType const& v2,\n\t\tgenType const& v3,\n\t\tgenType const& v4,\n\t\ttypename genType::value_type const& s);\n\n\t/// @}\n}//namespace glm\n\n#include \"spline.inl\"\n"}, {"path": "includes/glm/gtx/std_based_type.hpp", "language": "code", "loc": 53, "comment_density": 0.623, "code": "/// @ref gtx_std_based_type\n/// @file glm/gtx/std_based_type.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_std_based_type GLM_GTX_std_based_type\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Adds vector types based on STL value types.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_std_based_type is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_std_based_type extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_std_based_type\n\t/// @{\n\n\t/// Vector type based of one std::size_t component.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<1, std::size_t, defaultp>\t\tsize1;\n\n\t/// Vector type based of two std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<2, std::size_t, defaultp>\t\tsize2;\n\n\t/// Vector type based of three std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<3, std::size_t, defaultp>\t\tsize3;\n\n\t/// Vector type based of four std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<4, std::size_t, defaultp>\t\tsize4;\n\n\t/// Vector type based of one std::size_t component.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<1, std::size_t, defaultp>\t\tsize1_t;\n\n\t/// Vector type based of two std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<2, std::size_t, defaultp>\t\tsize2_t;\n\n\t/// Vector type based of three std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<3, std::size_t, defaultp>\t\tsize3_t;\n\n\t/// Vector type based of four std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<4, std::size_t, defaultp>\t\tsize4_t;\n\n\t/// @}\n}//namespace glm\n\n#include \"std_based_type.inl\"\n"}, {"path": "includes/glm/gtx/string_cast.hpp", "language": "code", "loc": 43, "comment_density": 0.512, "code": "/// @ref gtx_string_cast\n/// @file glm/gtx/string_cast.hpp\n///\n/// @see core (dependence)\n/// @see gtx_integer (dependence)\n/// @see gtx_quaternion (dependence)\n///\n/// @defgroup gtx_string_cast GLM_GTX_string_cast\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Setup strings for GLM type values\n///\n/// This extension is not supported with CUDA\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/type_precision.hpp\"\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtx/dual_quaternion.hpp\"\n#include \n#include \n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_string_cast is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if(GLM_COMPILER & GLM_COMPILER_CUDA)\n#\terror \"GLM_GTX_string_cast is not supported on CUDA compiler\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_string_cast extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_string_cast\n\t/// @{\n\n\t/// Create a string from a GLM vector or matrix typed variable.\n\t/// @see gtx_string_cast extension.\n\ttemplate\n\tGLM_FUNC_DECL std::string to_string(genType const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"string_cast.inl\"\n"}, {"path": "includes/glm/gtx/texture.hpp", "language": "code", "loc": 37, "comment_density": 0.595, "code": "/// @ref gtx_texture\n/// @file glm/gtx/texture.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_texture GLM_GTX_texture\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Wrapping mode of texture coordinates.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/integer.hpp\"\n#include \"../gtx/component_wise.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_texture is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_texture extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_texture\n\t/// @{\n\n\t/// Compute the number of mipmaps levels necessary to create a mipmap complete texture\n\t///\n\t/// @param Extent Extent of the texture base level mipmap\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate \n\tT levels(vec const& Extent);\n\n\t/// @}\n}// namespace glm\n\n#include \"texture.inl\"\n\n"}, {"path": "includes/glm/gtx/transform.hpp", "language": "code", "loc": 50, "comment_density": 0.56, "code": "/// @ref gtx_transform\n/// @file glm/gtx/transform.hpp\n///\n/// @see core (dependence)\n/// @see gtc_matrix_transform (dependence)\n/// @see gtx_transform\n/// @see gtx_transform2\n///\n/// @defgroup gtx_transform GLM_GTX_transform\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add transformation matrices\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/matrix_transform.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_transform extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_transform\n\t/// @{\n\n\t/// Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars.\n\t/// @see gtc_matrix_transform\n\t/// @see gtx_transform\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> translate(\n\t\tvec<3, T, Q> const& v);\n\n\t/// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians.\n\t/// @see gtc_matrix_transform\n\t/// @see gtx_transform\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rotate(\n\t\tT angle,\n\t\tvec<3, T, Q> const& v);\n\n\t/// Transforms a matrix with a scale 4 * 4 matrix created from a vector of 3 components.\n\t/// @see gtc_matrix_transform\n\t/// @see gtx_transform\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> scale(\n\t\tvec<3, T, Q> const& v);\n\n\t/// @}\n}// namespace glm\n\n#include \"transform.inl\"\n"}, {"path": "includes/glm/gtx/transform2.hpp", "language": "code", "loc": 71, "comment_density": 0.577, "code": "/// @ref gtx_transform2\n/// @file glm/gtx/transform2.hpp\n///\n/// @see core (dependence)\n/// @see gtx_transform (dependence)\n///\n/// @defgroup gtx_transform2 GLM_GTX_transform2\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add extra transformation matrices\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/transform.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_transform2 is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_transform2 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_transform2\n\t/// @{\n\n\t//! Transforms a matrix with a shearing on X axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> shearX2D(mat<3, 3, T, Q> const& m, T y);\n\n\t//! Transforms a matrix with a shearing on Y axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> shearY2D(mat<3, 3, T, Q> const& m, T x);\n\n\t//! Transforms a matrix with a shearing on X axis\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> shearX3D(mat<4, 4, T, Q> const& m, T y, T z);\n\n\t//! Transforms a matrix with a shearing on Y axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> shearY3D(mat<4, 4, T, Q> const& m, T x, T z);\n\n\t//! Transforms a matrix with a shearing on Z axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> shearZ3D(mat<4, 4, T, Q> const& m, T x, T y);\n\n\t//template GLM_FUNC_QUALIFIER mat<4, 4, T, Q> shear(const mat<4, 4, T, Q> & m, shearPlane, planePoint, angle)\n\t// Identity + tan(angle) * cross(Normal, OnPlaneVector) 0\n\t// - dot(PointOnPlane, normal) * OnPlaneVector 1\n\n\t// Reflect functions seem to don't work\n\t//template mat<3, 3, T, Q> reflect2D(const mat<3, 3, T, Q> & m, const vec<3, T, Q>& normal){return reflect2DGTX(m, normal);}\t\t\t\t\t\t\t\t\t//!< \\brief Build a reflection matrix (from GLM_GTX_transform2 extension)\n\t//template mat<4, 4, T, Q> reflect3D(const mat<4, 4, T, Q> & m, const vec<3, T, Q>& normal){return reflect3DGTX(m, normal);}\t\t\t\t\t\t\t\t\t//!< \\brief Build a reflection matrix (from GLM_GTX_transform2 extension)\n\n\t//! Build planar projection matrix along normal axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> proj2D(mat<3, 3, T, Q> const& m, vec<3, T, Q> const& normal);\n\n\t//! Build planar projection matrix along normal axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> proj3D(mat<4, 4, T, Q> const & m, vec<3, T, Q> const& normal);\n\n\t//! Build a scale bias matrix.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> scaleBias(T scale, T bias);\n\n\t//! Build a scale bias matrix.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> scaleBias(mat<4, 4, T, Q> const& m, T scale, T bias);\n\n\t/// @}\n}// namespace glm\n\n#include \"transform2.inl\"\n"}, {"path": "includes/glm/gtx/type_aligned.hpp", "language": "code", "loc": 698, "comment_density": 0.678, "code": "/// @ref gtx_type_aligned\n/// @file glm/gtx/type_aligned.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_type_aligned GLM_GTX_type_aligned\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines aligned types.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/type_precision.hpp\"\n#include \"../gtc/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_type_aligned is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_type_aligned extension included\")\n#endif\n\nnamespace glm\n{\n\t///////////////////////////\n\t// Signed int vector types\n\n\t/// @addtogroup gtx_type_aligned\n\t/// @{\n\n\t/// Low qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int8, aligned_lowp_int8, 1);\n\n\t/// Low qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int16, aligned_lowp_int16, 2);\n\n\t/// Low qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int32, aligned_lowp_int32, 4);\n\n\t/// Low qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int64, aligned_lowp_int64, 8);\n\n\n\t/// Low qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int8_t, aligned_lowp_int8_t, 1);\n\n\t/// Low qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int16_t, aligned_lowp_int16_t, 2);\n\n\t/// Low qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int32_t, aligned_lowp_int32_t, 4);\n\n\t/// Low qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int64_t, aligned_lowp_int64_t, 8);\n\n\n\t/// Low qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_i8, aligned_lowp_i8, 1);\n\n\t/// Low qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_i16, aligned_lowp_i16, 2);\n\n\t/// Low qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_i32, aligned_lowp_i32, 4);\n\n\t/// Low qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_i64, aligned_lowp_i64, 8);\n\n\n\t/// Medium qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int8, aligned_mediump_int8, 1);\n\n\t/// Medium qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int16, aligned_mediump_int16, 2);\n\n\t/// Medium qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int32, aligned_mediump_int32, 4);\n\n\t/// Medium qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int64, aligned_mediump_int64, 8);\n\n\n\t/// Medium qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int8_t, aligned_mediump_int8_t, 1);\n\n\t/// Medium qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int16_t, aligned_mediump_int16_t, 2);\n\n\t/// Medium qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int32_t, aligned_mediump_int32_t, 4);\n\n\t/// Medium qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int64_t, aligned_mediump_int64_t, 8);\n\n\n\t/// Medium qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_i8, aligned_mediump_i8, 1);\n\n\t/// Medium qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_i16, aligned_mediump_i16, 2);\n\n\t/// Medium qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_i32, aligned_mediump_i32, 4);\n\n\t/// Medium qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_i64, aligned_mediump_i64, 8);\n\n\n\t/// High qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int8, aligned_highp_int8, 1);\n\n\t/// High qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int16, aligned_highp_int16, 2);\n\n\t/// High qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int32, aligned_highp_int32, 4);\n\n\t/// High qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int64, aligned_highp_int64, 8);\n\n\n\t/// High qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int8_t, aligned_highp_int8_t, 1);\n\n\t/// High qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int16_t, aligned_highp_int16_t, 2);\n\n\t/// High qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int32_t, aligned_highp_int32_t, 4);\n\n\t/// High qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int64_t, aligned_highp_int64_t, 8);\n\n\n\t/// High qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_i8, aligned_highp_i8, 1);\n\n\t/// High qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_i16, aligned_highp_i16, 2);\n\n\t/// High qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_i32, aligned_highp_i32, 4);\n\n\t/// High qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_i64, aligned_highp_i64, 8);\n\n\n\t/// Default qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int8, aligned_int8, 1);\n\n\t/// Default qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int16, aligned_int16, 2);\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int32, aligned_int32, 4);\n\n\t/// Default qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int64, aligned_int64, 8);\n\n\n\t/// Default qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int8_t, aligned_int8_t, 1);\n\n\t/// Default qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int16_t, aligned_int16_t, 2);\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int32_t, aligned_int32_t, 4);\n\n\t/// Default qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int64_t, aligned_int64_t, 8);\n\n\n\t/// Default qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8, aligned_i8, 1);\n\n\t/// Default qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16, aligned_i16, 2);\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32, aligned_i32, 4);\n\n\t/// Default qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64, aligned_i64, 8);\n\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(ivec1, aligned_ivec1, 4);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(ivec2, aligned_ivec2, 8);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(ivec3, aligned_ivec3, 16);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(ivec4, aligned_ivec4, 16);\n\n\n\t/// Default qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8vec1, aligned_i8vec1, 1);\n\n\t/// Default qualifier 8 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8vec2, aligned_i8vec2, 2);\n\n\t/// Default qualifier 8 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8vec3, aligned_i8vec3, 4);\n\n\t/// Default qualifier 8 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8vec4, aligned_i8vec4, 4);\n\n\n\t/// Default qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16vec1, aligned_i16vec1, 2);\n\n\t/// Default qualifier 16 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16vec2, aligned_i16vec2, 4);\n\n\t/// Default qualifier 16 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16vec3, aligned_i16vec3, 8);\n\n\t/// Default qualifier 16 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16vec4, aligned_i16vec4, 8);\n\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32vec1, aligned_i32vec1, 4);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32vec2, aligned_i32vec2, 8);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32vec3, aligned_i32vec3, 16);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32vec4, aligned_i32vec4, 16);\n\n\n\t/// Default qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64vec1, aligned_i64vec1, 8);\n\n\t/// Default qualifier 64 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64vec2, aligned_i64vec2, 16);\n\n\t/// Default qualifier 64 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64vec3, aligned_i64vec3, 32);\n\n\t/// Default qualifier 64 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64vec4, aligned_i64vec4, 32);\n\n\n\t/////////////////////////////\n\t// Unsigned int vector types\n\n\t/// Low qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint8, aligned_lowp_uint8, 1);\n\n\t/// Low qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint16, aligned_lowp_uint16, 2);\n\n\t/// Low qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint32, aligned_lowp_uint32, 4);\n\n\t/// Low qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint64, aligned_lowp_uint64, 8);\n\n\n\t/// Low qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint8_t, aligned_lowp_uint8_t, 1);\n\n\t/// Low qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint16_t, aligned_lowp_uint16_t, 2);\n\n\t/// Low qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint32_t, aligned_lowp_uint32_t, 4);\n\n\t/// Low qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint64_t, aligned_lowp_uint64_t, 8);\n\n\n\t/// Low qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_u8, aligned_lowp_u8, 1);\n\n\t/// Low qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_u16, aligned_lowp_u16, 2);\n\n\t/// Low qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_u32, aligned_lowp_u32, 4);\n\n\t/// Low qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_u64, aligned_lowp_u64, 8);\n\n\n\t/// Medium qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint8, aligned_mediump_uint8, 1);\n\n\t/// Medium qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint16, aligned_mediump_uint16, 2);\n\n\t/// Medium qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint32, aligned_mediump_uint32, 4);\n\n\t/// Medium qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint64, aligned_mediump_uint64, 8);\n\n\n\t/// Medium qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint8_t, aligned_mediump_uint8_t, 1);\n\n\t/// Medium qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint16_t, aligned_mediump_uint16_t, 2);\n\n\t/// Medium qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint32_t, aligned_mediump_uint32_t, 4);\n\n\t/// Medium qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint64_t, aligned_mediump_uint64_t, 8);\n\n\n\t/// Medium qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_u8, aligned_mediump_u8, 1);\n\n\t/// Medium qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_u16, aligned_mediump_u16, 2);\n\n\t/// Medium qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_u32, aligned_mediump_u32, 4);\n\n\t/// Medium qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_u64, aligned_mediump_u64, 8);\n\n\n\t/// High qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint8, aligned_highp_uint8, 1);\n\n\t/// High qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint16, aligned_highp_uint16, 2);\n\n\t/// High qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint32, aligned_highp_uint32, 4);\n\n\t/// High qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint64, aligned_highp_uint64, 8);\n\n\n\t/// High qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint8_t, aligned_highp_uint8_t, 1);\n\n\t/// High qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint16_t, aligned_highp_uint16_t, 2);\n\n\t/// High qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint32_t, aligned_highp_uint32_t, 4);\n\n\t/// High qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint64_t, aligned_highp_uint64_t, 8);\n\n\n\t/// High qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_u8, aligned_highp_u8, 1);\n\n\t/// High qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_u16, aligned_highp_u16, 2);\n\n\t/// High qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_u32, aligned_highp_u32, 4);\n\n\t/// High qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_u64, aligned_highp_u64, 8);\n\n\n\t/// Default qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint8, aligned_uint8, 1);\n\n\t/// Default qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint16, aligned_uint16, 2);\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint32, aligned_uint32, 4);\n\n\t/// Default qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint64, aligned_uint64, 8);\n\n\n\t/// Default qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint8_t, aligned_uint8_t, 1);\n\n\t/// Default qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint16_t, aligned_uint16_t, 2);\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint32_t, aligned_uint32_t, 4);\n\n\t/// Default qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint64_t, aligned_uint64_t, 8);\n\n\n\t/// Default qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8, aligned_u8, 1);\n\n\t/// Default qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16, aligned_u16, 2);\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32, aligned_u32, 4);\n\n\t/// Default qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64, aligned_u64, 8);\n\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uvec1, aligned_uvec1, 4);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uvec2, aligned_uvec2, 8);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uvec3, aligned_uvec3, 16);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uvec4, aligned_uvec4, 16);\n\n\n\t/// Default qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8vec1, aligned_u8vec1, 1);\n\n\t/// Default qualifier 8 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8vec2, aligned_u8vec2, 2);\n\n\t/// Default qualifier 8 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8vec3, aligned_u8vec3, 4);\n\n\t/// Default qualifier 8 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8vec4, aligned_u8vec4, 4);\n\n\n\t/// Default qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16vec1, aligned_u16vec1, 2);\n\n\t/// Default qualifier 16 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16vec2, aligned_u16vec2, 4);\n\n\t/// Default qualifier 16 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16vec3, aligned_u16vec3, 8);\n\n\t/// Default qualifier 16 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16vec4, aligned_u16vec4, 8);\n\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32vec1, aligned_u32vec1, 4);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32vec2, aligned_u32vec2, 8);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32vec3, aligned_u32vec3, 16);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32vec4, aligned_u32vec4, 16);\n\n\n\t/// Default qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64vec1, aligned_u64vec1, 8);\n\n\t/// Default qualifier 64 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64vec2, aligned_u64vec2, 16);\n\n\t/// Default qualifier 64 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64vec3, aligned_u64vec3, 32);\n\n\t/// Default qualifier 64 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64vec4, aligned_u64vec4, 32);\n\n\n\t//////////////////////\n\t// Float vector types\n\n\t/// 32 bit single-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float32, aligned_float32, 4);\n\n\t/// 32 bit single-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float32_t, aligned_float32_t, 4);\n\n\t/// 32 bit single-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float32, aligned_f32, 4);\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// 64 bit double-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float64, aligned_float64, 8);\n\n\t/// 64 bit double-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float64_t, aligned_float64_t, 8);\n\n\t/// 64 bit double-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float64, aligned_f64, 8);\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\n\t/// Single-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(vec1, aligned_vec1, 4);\n\n\t/// Single-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(vec2, aligned_vec2, 8);\n\n\t/// Single-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(vec3, aligned_vec3, 16);\n\n\t/// Single-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(vec4, aligned_vec4, 16);\n\n\n\t/// Single-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fvec1, aligned_fvec1, 4);\n\n\t/// Single-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fvec2, aligned_fvec2, 8);\n\n\t/// Single-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fvec3, aligned_fvec3, 16);\n\n\t/// Single-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fvec4, aligned_fvec4, 16);\n\n\n\t/// Single-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32vec1, aligned_f32vec1, 4);\n\n\t/// Single-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32vec2, aligned_f32vec2, 8);\n\n\t/// Single-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32vec3, aligned_f32vec3, 16);\n\n\t/// Single-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32vec4, aligned_f32vec4, 16);\n\n\n\t/// Double-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dvec1, aligned_dvec1, 8);\n\n\t/// Double-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dvec2, aligned_dvec2, 16);\n\n\t/// Double-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dvec3, aligned_dvec3, 32);\n\n\t/// Double-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dvec4, aligned_dvec4, 32);\n\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Double-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64vec1, aligned_f64vec1, 8);\n\n\t/// Double-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64vec2, aligned_f64vec2, 16);\n\n\t/// Double-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64vec3, aligned_f64vec3, 32);\n\n\t/// Double-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64vec4, aligned_f64vec4, 32);\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t//////////////////////\n\t// Float matrix types\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1 mat1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat2, aligned_mat2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat3, aligned_mat3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat4, aligned_mat4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1x1 mat1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat2x2, aligned_mat2x2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat3x3, aligned_mat3x3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat4x4, aligned_mat4x4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1x1 fmat1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat2x2, aligned_fmat2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat3x3, aligned_fmat3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat4x4, aligned_fmat4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef f32 fmat1x1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat2x2, aligned_fmat2x2, 16);\n\n\t/// Single-qualifier floating-point aligned 2x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat2x3, aligned_fmat2x3, 16);\n\n\t/// Single-qualifier floating-point aligned 2x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat2x4, aligned_fmat2x4, 16);\n\n\t/// Single-qualifier floating-point aligned 3x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat3x2, aligned_fmat3x2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat3x3, aligned_fmat3x3, 16);\n\n\t/// Single-qualifier floating-point aligned 3x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat3x4, aligned_fmat3x4, 16);\n\n\t/// Single-qualifier floating-point aligned 4x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat4x2, aligned_fmat4x2, 16);\n\n\t/// Single-qualifier floating-point aligned 4x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat4x3, aligned_fmat4x3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat4x4, aligned_fmat4x4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1x1 f32mat1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat2x2, aligned_f32mat2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat3x3, aligned_f32mat3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat4x4, aligned_f32mat4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef f32 f32mat1x1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat2x2, aligned_f32mat2x2, 16);\n\n\t/// Single-qualifier floating-point aligned 2x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat2x3, aligned_f32mat2x3, 16);\n\n\t/// Single-qualifier floating-point aligned 2x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat2x4, aligned_f32mat2x4, 16);\n\n\t/// Single-qualifier floating-point aligned 3x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat3x2, aligned_f32mat3x2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat3x3, aligned_f32mat3x3, 16);\n\n\t/// Single-qualifier floating-point aligned 3x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat3x4, aligned_f32mat3x4, 16);\n\n\t/// Single-qualifier floating-point aligned 4x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat4x2, aligned_f32mat4x2, 16);\n\n\t/// Single-qualifier floating-point aligned 4x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat4x3, aligned_f32mat4x3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat4x4, aligned_f32mat4x4, 16);\n\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Double-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1x1 f64mat1;\n\n\t/// Double-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat2x2, aligned_f64mat2, 32);\n\n\t/// Double-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat3x3, aligned_f64mat3, 32);\n\n\t/// Double-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat4x4, aligned_f64mat4, 32);\n\n\n\t/// Double-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef f64 f64mat1x1;\n\n\t/// Double-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat2x2, aligned_f64mat2x2, 32);\n\n\t/// Double-qualifier floating-point aligned 2x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat2x3, aligned_f64mat2x3, 32);\n\n\t/// Double-qualifier floating-point aligned 2x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat2x4, aligned_f64mat2x4, 32);\n\n\t/// Double-qualifier floating-point aligned 3x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat3x2, aligned_f64mat3x2, 32);\n\n\t/// Double-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat3x3, aligned_f64mat3x3, 32);\n\n\t/// Double-qualifier floating-point aligned 3x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat3x4, aligned_f64mat3x4, 32);\n\n\t/// Double-qualifier floating-point aligned 4x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat4x2, aligned_f64mat4x2, 32);\n\n\t/// Double-qualifier floating-point aligned 4x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat4x3, aligned_f64mat4x3, 32);\n\n\t/// Double-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat4x4, aligned_f64mat4x4, 32);\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\n\t//////////////////////////\n\t// Quaternion types\n\n\t/// Single-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(quat, aligned_quat, 16);\n\n\t/// Single-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(quat, aligned_fquat, 16);\n\n\t/// Double-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dquat, aligned_dquat, 32);\n\n\t/// Single-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32quat, aligned_f32quat, 16);\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Double-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64quat, aligned_f64quat, 32);\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t/// @}\n}//namespace glm\n\n#include \"type_aligned.inl\"\n"}, {"path": "includes/glm/gtx/type_trait.hpp", "language": "code", "loc": 73, "comment_density": 0.219, "code": "/// @ref gtx_type_trait\n/// @file glm/gtx/type_trait.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_type_trait GLM_GTX_type_trait\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines traits for each type.\n\n#pragma once\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_type_trait is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n// Dependency:\n#include \"../detail/qualifier.hpp\"\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtx/dual_quaternion.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_type_trait extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_type_trait\n\t/// @{\n\n\ttemplate\n\tstruct type\n\t{\n\t\tstatic bool const is_vec = false;\n\t\tstatic bool const is_mat = false;\n\t\tstatic bool const is_quat = false;\n\t\tstatic length_t const components = 0;\n\t\tstatic length_t const cols = 0;\n\t\tstatic length_t const rows = 0;\n\t};\n\n\ttemplate\n\tstruct type >\n\t{\n\t\tstatic bool const is_vec = true;\n\t\tstatic bool const is_mat = false;\n\t\tstatic bool const is_quat = false;\n\t\tstatic length_t const components = L;\n\t};\n\n\ttemplate\n\tstruct type >\n\t{\n\t\tstatic bool const is_vec = false;\n\t\tstatic bool const is_mat = true;\n\t\tstatic bool const is_quat = false;\n\t\tstatic length_t const components = C;\n\t\tstatic length_t const cols = C;\n\t\tstatic length_t const rows = R;\n\t};\n\n\ttemplate\n\tstruct type >\n\t{\n\t\tstatic bool const is_vec = false;\n\t\tstatic bool const is_mat = false;\n\t\tstatic bool const is_quat = true;\n\t\tstatic length_t const components = 4;\n\t};\n\n\ttemplate\n\tstruct type >\n\t{\n\t\tstatic bool const is_vec = false;\n\t\tstatic bool const is_mat = false;\n\t\tstatic bool const is_quat = true;\n\t\tstatic length_t const components = 8;\n\t};\n\n\t/// @}\n}//namespace glm\n\n#include \"type_trait.inl\"\n"}, {"path": "includes/glm/gtx/vec_swizzle.hpp", "language": "code", "loc": 2290, "comment_density": 0.152, "code": "/// @ref gtx_vec_swizzle\n/// @file glm/gtx/vec_swizzle.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_vec_swizzle GLM_GTX_vec_swizzle\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Functions to perform swizzle operation.\n\n#pragma once\n\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_vec_swizzle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\nnamespace glm {\n\t// xx\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xx(const glm::vec<1, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.x);\n\t}\n\n\t// xy\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.y);\n\t}\n\n\t// xz\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.z);\n\t}\n\n\t// xw\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.w);\n\t}\n\n\t// yx\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.x);\n\t}\n\n\t// yy\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.y);\n\t}\n\n\t// yz\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.z);\n\t}\n\n\t// yw\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.w);\n\t}\n\n\t// zx\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.x);\n\t}\n\n\t// zy\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.y);\n\t}\n\n\t// zz\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.z);\n\t}\n\n\t// zw\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.w);\n\t}\n\n\t// wx\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> wx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.w, v.x);\n\t}\n\n\t// wy\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> wy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.w, v.y);\n\t}\n\n\t// wz\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> wz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.w, v.z);\n\t}\n\n\t// ww\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> ww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.w, v.w);\n\t}\n\n\t// xxx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxx(const glm::vec<1, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.x);\n\t}\n\n\t// xxy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.y);\n\t}\n\n\t// xxz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.z);\n\t}\n\n\t// xxw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.w);\n\t}\n\n\t// xyx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.x);\n\t}\n\n\t// xyy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.y);\n\t}\n\n\t// xyz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.z);\n\t}\n\n\t// xyw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.w);\n\t}\n\n\t// xzx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.x);\n\t}\n\n\t// xzy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.y);\n\t}\n\n\t// xzz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.z);\n\t}\n\n\t// xzw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.w);\n\t}\n\n\t// xwx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.w, v.x);\n\t}\n\n\t// xwy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.w, v.y);\n\t}\n\n\t// xwz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.w, v.z);\n\t}\n\n\t// xww\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.w, v.w);\n\t}\n\n\t// yxx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.x);\n\t}\n\n\t// yxy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.y);\n\t}\n\n\t// yxz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.z);\n\t}\n\n\t// yxw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.w);\n\t}\n\n\t// yyx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.x);\n\t}\n\n\t// yyy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.y);\n\t}\n\n\t// yyz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.z);\n\t}\n\n\t// yyw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.w);\n\t}\n\n\t// yzx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.x);\n\t}\n\n\t// yzy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.y);\n\t}\n\n\t// yzz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.z);\n\t}\n\n\t// yzw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.w);\n\t}\n\n\t// ywx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> ywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.w, v.x);\n\t}\n\n\t// ywy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> ywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.w, v.y);\n\t}\n\n\t// ywz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> ywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.w, v.z);\n\t}\n\n\t// yww\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.w, v.w);\n\t}\n\n\t// zxx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.x);\n\t}\n\n\t// zxy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.y);\n\t}\n\n\t// zxz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.z);\n\t}\n\n\t// zxw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.w);\n\t}\n\n\t// zyx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.x);\n\t}\n\n\t// zyy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.y);\n\t}\n\n\t// zyz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.z);\n\t}\n\n\t// zyw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.w);\n\t}\n\n\t// zzx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.x);\n\t}\n\n\t// zzy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.y);\n\t}\n\n\t// zzz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.z);\n\t}\n\n\t// zzw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.w);\n\t}\n\n\t// zwx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.w, v.x);\n\t}\n\n\t// zwy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.w, v.y);\n\t}\n\n\t// zwz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.w, v.z);\n\t}\n\n\t// zww\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.w, v.w);\n\t}\n\n\t// wxx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.x, v.x);\n\t}\n\n\t// wxy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.x, v.y);\n\t}\n\n\t// wxz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.x, v.z);\n\t}\n\n\t// wxw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.x, v.w);\n\t}\n\n\t// wyx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.y, v.x);\n\t}\n\n\t// wyy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.y, v.y);\n\t}\n\n\t// wyz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.y, v.z);\n\t}\n\n\t// wyw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.y, v.w);\n\t}\n\n\t// wzx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.z, v.x);\n\t}\n\n\t// wzy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.z, v.y);\n\t}\n\n\t// wzz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.z, v.z);\n\t}\n\n\t// wzw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.z, v.w);\n\t}\n\n\t// wwx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.w, v.x);\n\t}\n\n\t// wwy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.w, v.y);\n\t}\n\n\t// wwz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.w, v.z);\n\t}\n\n\t// www\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> www(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.w, v.w);\n\t}\n\n\t// xxxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxx(const glm::vec<1, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.x);\n\t}\n\n\t// xxxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.y);\n\t}\n\n\t// xxxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.z);\n\t}\n\n\t// xxxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.w);\n\t}\n\n\t// xxyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.x);\n\t}\n\n\t// xxyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.y);\n\t}\n\n\t// xxyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.z);\n\t}\n\n\t// xxyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.w);\n\t}\n\n\t// xxzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.x);\n\t}\n\n\t// xxzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.y);\n\t}\n\n\t// xxzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.z);\n\t}\n\n\t// xxzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.w);\n\t}\n\n\t// xxwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.w, v.x);\n\t}\n\n\t// xxwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.w, v.y);\n\t}\n\n\t// xxwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.w, v.z);\n\t}\n\n\t// xxww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.w, v.w);\n\t}\n\n\t// xyxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.x);\n\t}\n\n\t// xyxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.y);\n\t}\n\n\t// xyxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.z);\n\t}\n\n\t// xyxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.w);\n\t}\n\n\t// xyyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.x);\n\t}\n\n\t// xyyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.y);\n\t}\n\n\t// xyyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.z);\n\t}\n\n\t// xyyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.w);\n\t}\n\n\t// xyzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.x);\n\t}\n\n\t// xyzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.y);\n\t}\n\n\t// xyzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.z);\n\t}\n\n\t// xyzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.w);\n\t}\n\n\t// xywx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.w, v.x);\n\t}\n\n\t// xywy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.w, v.y);\n\t}\n\n\t// xywz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.w, v.z);\n\t}\n\n\t// xyww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.w, v.w);\n\t}\n\n\t// xzxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.x);\n\t}\n\n\t// xzxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.y);\n\t}\n\n\t// xzxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.z);\n\t}\n\n\t// xzxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.w);\n\t}\n\n\t// xzyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.x);\n\t}\n\n\t// xzyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.y);\n\t}\n\n\t// xzyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.z);\n\t}\n\n\t// xzyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.w);\n\t}\n\n\t// xzzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.x);\n\t}\n\n\t// xzzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.y);\n\t}\n\n\t// xzzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.z);\n\t}\n\n\t// xzzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.w);\n\t}\n\n\t// xzwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.w, v.x);\n\t}\n\n\t// xzwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.w, v.y);\n\t}\n\n\t// xzwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.w, v.z);\n\t}\n\n\t// xzww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.w, v.w);\n\t}\n\n\t// xwxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.x, v.x);\n\t}\n\n\t// xwxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.x, v.y);\n\t}\n\n\t// xwxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.x, v.z);\n\t}\n\n\t// xwxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.x, v.w);\n\t}\n\n\t// xwyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.y, v.x);\n\t}\n\n\t// xwyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.y, v.y);\n\t}\n\n\t// xwyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.y, v.z);\n\t}\n\n\t// xwyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.y, v.w);\n\t}\n\n\t// xwzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.z, v.x);\n\t}\n\n\t// xwzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.z, v.y);\n\t}\n\n\t// xwzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.z, v.z);\n\t}\n\n\t// xwzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.z, v.w);\n\t}\n\n\t// xwwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.w, v.x);\n\t}\n\n\t// xwwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.w, v.y);\n\t}\n\n\t// xwwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.w, v.z);\n\t}\n\n\t// xwww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.w, v.w);\n\t}\n\n\t// yxxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.x);\n\t}\n\n\t// yxxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.y);\n\t}\n\n\t// yxxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.z);\n\t}\n\n\t// yxxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.w);\n\t}\n\n\t// yxyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.x);\n\t}\n\n\t// yxyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.y);\n\t}\n\n\t// yxyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.z);\n\t}\n\n\t// yxyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.w);\n\t}\n\n\t// yxzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.x);\n\t}\n\n\t// yxzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.y);\n\t}\n\n\t// yxzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.z);\n\t}\n\n\t// yxzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.w);\n\t}\n\n\t// yxwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.w, v.x);\n\t}\n\n\t// yxwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.w, v.y);\n\t}\n\n\t// yxwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.w, v.z);\n\t}\n\n\t// yxww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.w, v.w);\n\t}\n\n\t// yyxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.x);\n\t}\n\n\t// yyxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.y);\n\t}\n\n\t// yyxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.z);\n\t}\n\n\t// yyxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.w);\n\t}\n\n\t// yyyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.x);\n\t}\n\n\t// yyyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.y);\n\t}\n\n\t// yyyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.z);\n\t}\n\n\t// yyyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.w);\n\t}\n\n\t// yyzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.x);\n\t}\n\n\t// yyzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.y);\n\t}\n\n\t// yyzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.z);\n\t}\n\n\t// yyzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.w);\n\t}\n\n\t// yywx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.w, v.x);\n\t}\n\n\t// yywy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.w, v.y);\n\t}\n\n\t// yywz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.w, v.z);\n\t}\n\n\t// yyww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.w, v.w);\n\t}\n\n\t// yzxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.x);\n\t}\n\n\t// yzxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.y);\n\t}\n\n\t// yzxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.z);\n\t}\n\n\t// yzxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.w);\n\t}\n\n\t// yzyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.x);\n\t}\n\n\t// yzyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.y);\n\t}\n\n\t// yzyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.z);\n\t}\n\n\t// yzyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.w);\n\t}\n\n\t// yzzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.x);\n\t}\n\n\t// yzzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.y);\n\t}\n\n\t// yzzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.z);\n\t}\n\n\t// yzzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.w);\n\t}\n\n\t// yzwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.w, v.x);\n\t}\n\n\t// yzwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.w, v.y);\n\t}\n\n\t// yzwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.w, v.z);\n\t}\n\n\t// yzww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.w, v.w);\n\t}\n\n\t// ywxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.x, v.x);\n\t}\n\n\t// ywxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.x, v.y);\n\t}\n\n\t// ywxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.x, v.z);\n\t}\n\n\t// ywxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.x, v.w);\n\t}\n\n\t// ywyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.y, v.x);\n\t}\n\n\t// ywyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.y, v.y);\n\t}\n\n\t// ywyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.y, v.z);\n\t}\n\n\t// ywyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.y, v.w);\n\t}\n\n\t// ywzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.z, v.x);\n\t}\n\n\t// ywzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.z, v.y);\n\t}\n\n\t// ywzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.z, v.z);\n\t}\n\n\t// ywzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.z, v.w);\n\t}\n\n\t// ywwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.w, v.x);\n\t}\n\n\t// ywwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.w, v.y);\n\t}\n\n\t// ywwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.w, v.z);\n\t}\n\n\t// ywww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.w, v.w);\n\t}\n\n\t// zxxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.x);\n\t}\n\n\t// zxxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.y);\n\t}\n\n\t// zxxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.z);\n\t}\n\n\t// zxxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.w);\n\t}\n\n\t// zxyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.x);\n\t}\n\n\t// zxyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.y);\n\t}\n\n\t// zxyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.z);\n\t}\n\n\t// zxyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.w);\n\t}\n\n\t// zxzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.x);\n\t}\n\n\t// zxzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.y);\n\t}\n\n\t// zxzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.z);\n\t}\n\n\t// zxzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.w);\n\t}\n\n\t// zxwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.w, v.x);\n\t}\n\n\t// zxwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.w, v.y);\n\t}\n\n\t// zxwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.w, v.z);\n\t}\n\n\t// zxww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.w, v.w);\n\t}\n\n\t// zyxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.x);\n\t}\n\n\t// zyxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.y);\n\t}\n\n\t// zyxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.z);\n\t}\n\n\t// zyxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.w);\n\t}\n\n\t// zyyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.x);\n\t}\n\n\t// zyyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.y);\n\t}\n\n\t// zyyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.z);\n\t}\n\n\t// zyyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.w);\n\t}\n\n\t// zyzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.x);\n\t}\n\n\t// zyzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.y);\n\t}\n\n\t// zyzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.z);\n\t}\n\n\t// zyzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.w);\n\t}\n\n\t// zywx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.w, v.x);\n\t}\n\n\t// zywy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.w, v.y);\n\t}\n\n\t// zywz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.w, v.z);\n\t}\n\n\t// zyww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.w, v.w);\n\t}\n\n\t// zzxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.x);\n\t}\n\n\t// zzxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.y);\n\t}\n\n\t// zzxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.z);\n\t}\n\n\t// zzxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.w);\n\t}\n\n\t// zzyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.x);\n\t}\n\n\t// zzyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.y);\n\t}\n\n\t// zzyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.z);\n\t}\n\n\t// zzyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.w);\n\t}\n\n\t// zzzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.x);\n\t}\n\n\t// zzzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.y);\n\t}\n\n\t// zzzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.z);\n\t}\n\n\t// zzzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.w);\n\t}\n\n\t// zzwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.w, v.x);\n\t}\n\n\t// zzwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.w, v.y);\n\t}\n\n\t// zzwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.w, v.z);\n\t}\n\n\t// zzww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.w, v.w);\n\t}\n\n\t// zwxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.x, v.x);\n\t}\n\n\t// zwxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.x, v.y);\n\t}\n\n\t// zwxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.x, v.z);\n\t}\n\n\t// zwxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.x, v.w);\n\t}\n\n\t// zwyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.y, v.x);\n\t}\n\n\t// zwyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.y, v.y);\n\t}\n\n\t// zwyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.y, v.z);\n\t}\n\n\t// zwyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.y, v.w);\n\t}\n\n\t// zwzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.z, v.x);\n\t}\n\n\t// zwzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.z, v.y);\n\t}\n\n\t// zwzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.z, v.z);\n\t}\n\n\t// zwzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.z, v.w);\n\t}\n\n\t// zwwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.w, v.x);\n\t}\n\n\t// zwwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.w, v.y);\n\t}\n\n\t// zwwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.w, v.z);\n\t}\n\n\t// zwww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.w, v.w);\n\t}\n\n\t// wxxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.x, v.x);\n\t}\n\n\t// wxxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.x, v.y);\n\t}\n\n\t// wxxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.x, v.z);\n\t}\n\n\t// wxxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.x, v.w);\n\t}\n\n\t// wxyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.y, v.x);\n\t}\n\n\t// wxyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.y, v.y);\n\t}\n\n\t// wxyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.y, v.z);\n\t}\n\n\t// wxyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.y, v.w);\n\t}\n\n\t// wxzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.z, v.x);\n\t}\n\n\t// wxzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.z, v.y);\n\t}\n\n\t// wxzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.z, v.z);\n\t}\n\n\t// wxzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.z, v.w);\n\t}\n\n\t// wxwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.w, v.x);\n\t}\n\n\t// wxwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.w, v.y);\n\t}\n\n\t// wxwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.w, v.z);\n\t}\n\n\t// wxww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.w, v.w);\n\t}\n\n\t// wyxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.x, v.x);\n\t}\n\n\t// wyxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.x, v.y);\n\t}\n\n\t// wyxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.x, v.z);\n\t}\n\n\t// wyxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.x, v.w);\n\t}\n\n\t// wyyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.y, v.x);\n\t}\n\n\t// wyyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.y, v.y);\n\t}\n\n\t// wyyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.y, v.z);\n\t}\n\n\t// wyyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.y, v.w);\n\t}\n\n\t// wyzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.z, v.x);\n\t}\n\n\t// wyzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.z, v.y);\n\t}\n\n\t// wyzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.z, v.z);\n\t}\n\n\t// wyzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.z, v.w);\n\t}\n\n\t// wywx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.w, v.x);\n\t}\n\n\t// wywy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.w, v.y);\n\t}\n\n\t// wywz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.w, v.z);\n\t}\n\n\t// wyww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.w, v.w);\n\t}\n\n\t// wzxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.x, v.x);\n\t}\n\n\t// wzxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.x, v.y);\n\t}\n\n\t// wzxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.x, v.z);\n\t}\n\n\t// wzxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.x, v.w);\n\t}\n\n\t// wzyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.y, v.x);\n\t}\n\n\t// wzyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.y, v.y);\n\t}\n\n\t// wzyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.y, v.z);\n\t}\n\n\t// wzyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.y, v.w);\n\t}\n\n\t// wzzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.z, v.x);\n\t}\n\n\t// wzzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.z, v.y);\n\t}\n\n\t// wzzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.z, v.z);\n\t}\n\n\t// wzzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.z, v.w);\n\t}\n\n\t// wzwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.w, v.x);\n\t}\n\n\t// wzwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.w, v.y);\n\t}\n\n\t// wzwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.w, v.z);\n\t}\n\n\t// wzww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.w, v.w);\n\t}\n\n\t// wwxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.x, v.x);\n\t}\n\n\t// wwxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.x, v.y);\n\t}\n\n\t// wwxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.x, v.z);\n\t}\n\n\t// wwxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.x, v.w);\n\t}\n\n\t// wwyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.y, v.x);\n\t}\n\n\t// wwyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.y, v.y);\n\t}\n\n\t// wwyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.y, v.z);\n\t}\n\n\t// wwyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.y, v.w);\n\t}\n\n\t// wwzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.z, v.x);\n\t}\n\n\t// wwzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.z, v.y);\n\t}\n\n\t// wwzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.z, v.z);\n\t}\n\n\t// wwzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.z, v.w);\n\t}\n\n\t// wwwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.w, v.x);\n\t}\n\n\t// wwwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.w, v.y);\n\t}\n\n\t// wwwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.w, v.z);\n\t}\n\n\t// wwww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.w, v.w);\n\t}\n\n}\n"}, {"path": "includes/glm/gtx/vector_angle.hpp", "language": "code", "loc": 47, "comment_density": 0.574, "code": "/// @ref gtx_vector_angle\n/// @file glm/gtx/vector_angle.hpp\n///\n/// @see core (dependence)\n/// @see gtx_quaternion (dependence)\n/// @see gtx_epsilon (dependence)\n///\n/// @defgroup gtx_vector_angle GLM_GTX_vector_angle\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Compute angle between vectors\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/epsilon.hpp\"\n#include \"../gtx/quaternion.hpp\"\n#include \"../gtx/rotate_vector.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_vector_angle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_vector_angle extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_vector_angle\n\t/// @{\n\n\t//! Returns the absolute angle between two vectors.\n\t//! Parameters need to be normalized.\n\t/// @see gtx_vector_angle extension.\n\ttemplate\n\tGLM_FUNC_DECL T angle(vec const& x, vec const& y);\n\n\t//! Returns the oriented angle between two 2d vectors.\n\t//! Parameters need to be normalized.\n\t/// @see gtx_vector_angle extension.\n\ttemplate\n\tGLM_FUNC_DECL T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y);\n\n\t//! Returns the oriented angle between two 3d vectors based from a reference axis.\n\t//! Parameters need to be normalized.\n\t/// @see gtx_vector_angle extension.\n\ttemplate\n\tGLM_FUNC_DECL T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref);\n\n\t/// @}\n}// namespace glm\n\n#include \"vector_angle.inl\"\n"}, {"path": "includes/glm/gtx/vector_query.hpp", "language": "code", "loc": 53, "comment_density": 0.528, "code": "/// @ref gtx_vector_query\n/// @file glm/gtx/vector_query.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_vector_query GLM_GTX_vector_query\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Query informations of vector types\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \n#include \n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_vector_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_vector_query extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_vector_query\n\t/// @{\n\n\t//! Check whether two vectors are collinears.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool areCollinear(vec const& v0, vec const& v1, T const& epsilon);\n\n\t//! Check whether two vectors are orthogonals.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool areOrthogonal(vec const& v0, vec const& v1, T const& epsilon);\n\n\t//! Check whether a vector is normalized.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool isNormalized(vec const& v, T const& epsilon);\n\n\t//! Check whether a vector is null.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool isNull(vec const& v, T const& epsilon);\n\n\t//! Check whether a each component of a vector is null.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL vec isCompNull(vec const& v, T const& epsilon);\n\n\t//! Check whether two vectors are orthonormal.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool areOrthonormal(vec const& v0, vec const& v1, T const& epsilon);\n\n\t/// @}\n}// namespace glm\n\n#include \"vector_query.inl\"\n"}, {"path": "includes/glm/gtx/wrap.hpp", "language": "code", "loc": 44, "comment_density": 0.545, "code": "/// @ref gtx_wrap\n/// @file glm/gtx/wrap.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_wrap GLM_GTX_wrap\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Wrapping mode of texture coordinates.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/vec1.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_wrap is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_wrap extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_wrap\n\t/// @{\n\n\t/// Simulate GL_CLAMP OpenGL wrap mode\n\t/// @see gtx_wrap extension.\n\ttemplate\n\tGLM_FUNC_DECL genType clamp(genType const& Texcoord);\n\n\t/// Simulate GL_REPEAT OpenGL wrap mode\n\t/// @see gtx_wrap extension.\n\ttemplate\n\tGLM_FUNC_DECL genType repeat(genType const& Texcoord);\n\n\t/// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode\n\t/// @see gtx_wrap extension.\n\ttemplate\n\tGLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord);\n\n\t/// Simulate GL_MIRROR_REPEAT OpenGL wrap mode\n\t/// @see gtx_wrap extension.\n\ttemplate\n\tGLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord);\n\n\t/// @}\n}// namespace glm\n\n#include \"wrap.inl\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.512, "dedup_hash": "e6358ecf44f07564", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_simd", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Simd", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/simd/common.h", "language": "code", "loc": 208, "comment_density": 0.101, "code": "/// @ref simd\n/// @file glm/simd/common.h\n\n#pragma once\n\n#include \"platform.h\"\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_add(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_add_ps(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_add(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_add_ss(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sub(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_sub_ps(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sub(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_sub_ss(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_mul(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_mul_ps(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_mul(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_mul_ss(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_div(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_div_ps(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_div(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_div_ss(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_div_lowp(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn glm_vec4_mul(a, _mm_rcp_ps(b));\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_swizzle_xyzw(glm_f32vec4 a)\n{\n#\tif GLM_ARCH & GLM_ARCH_AVX2_BIT\n\t\treturn _mm_permute_ps(a, _MM_SHUFFLE(3, 2, 1, 0));\n#\telse\n\t\treturn _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 1, 0));\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_fma(glm_f32vec4 a, glm_f32vec4 b, glm_f32vec4 c)\n{\n#\tif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && !(GLM_COMPILER & GLM_COMPILER_CLANG)\n\t\treturn _mm_fmadd_ss(a, b, c);\n#\telse\n\t\treturn _mm_add_ss(_mm_mul_ss(a, b), c);\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_fma(glm_f32vec4 a, glm_f32vec4 b, glm_f32vec4 c)\n{\n#\tif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && !(GLM_COMPILER & GLM_COMPILER_CLANG)\n\t\treturn _mm_fmadd_ps(a, b, c);\n#\telse\n\t\treturn glm_vec4_add(glm_vec4_mul(a, b), c);\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_abs(glm_f32vec4 x)\n{\n\treturn _mm_and_ps(x, _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF)));\n}\n\nGLM_FUNC_QUALIFIER glm_ivec4 glm_ivec4_abs(glm_ivec4 x)\n{\n#\tif GLM_ARCH & GLM_ARCH_SSSE3_BIT\n\t\treturn _mm_sign_epi32(x, x);\n#\telse\n\t\tglm_ivec4 const sgn0 = _mm_srai_epi32(x, 31);\n\t\tglm_ivec4 const inv0 = _mm_xor_si128(x, sgn0);\n\t\tglm_ivec4 const sub0 = _mm_sub_epi32(inv0, sgn0);\n\t\treturn sub0;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_sign(glm_vec4 x)\n{\n\tglm_vec4 const zro0 = _mm_setzero_ps();\n\tglm_vec4 const cmp0 = _mm_cmplt_ps(x, zro0);\n\tglm_vec4 const cmp1 = _mm_cmpgt_ps(x, zro0);\n\tglm_vec4 const and0 = _mm_and_ps(cmp0, _mm_set1_ps(-1.0f));\n\tglm_vec4 const and1 = _mm_and_ps(cmp1, _mm_set1_ps(1.0f));\n\tglm_vec4 const or0 = _mm_or_ps(and0, and1);;\n\treturn or0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_round(glm_vec4 x)\n{\n#\tif GLM_ARCH & GLM_ARCH_SSE41_BIT\n\t\treturn _mm_round_ps(x, _MM_FROUND_TO_NEAREST_INT);\n#\telse\n\t\tglm_vec4 const sgn0 = _mm_castsi128_ps(_mm_set1_epi32(int(0x80000000)));\n\t\tglm_vec4 const and0 = _mm_and_ps(sgn0, x);\n\t\tglm_vec4 const or0 = _mm_or_ps(and0, _mm_set_ps1(8388608.0f));\n\t\tglm_vec4 const add0 = glm_vec4_add(x, or0);\n\t\tglm_vec4 const sub0 = glm_vec4_sub(add0, or0);\n\t\treturn sub0;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_floor(glm_vec4 x)\n{\n#\tif GLM_ARCH & GLM_ARCH_SSE41_BIT\n\t\treturn _mm_floor_ps(x);\n#\telse\n\t\tglm_vec4 const rnd0 = glm_vec4_round(x);\n\t\tglm_vec4 const cmp0 = _mm_cmplt_ps(x, rnd0);\n\t\tglm_vec4 const and0 = _mm_and_ps(cmp0, _mm_set1_ps(1.0f));\n\t\tglm_vec4 const sub0 = glm_vec4_sub(rnd0, and0);\n\t\treturn sub0;\n#\tendif\n}\n\n/* trunc TODO\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_trunc(glm_vec4 x)\n{\n\treturn glm_vec4();\n}\n*/\n\n//roundEven\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_roundEven(glm_vec4 x)\n{\n\tglm_vec4 const sgn0 = _mm_castsi128_ps(_mm_set1_epi32(int(0x80000000)));\n\tglm_vec4 const and0 = _mm_and_ps(sgn0, x);\n\tglm_vec4 const or0 = _mm_or_ps(and0, _mm_set_ps1(8388608.0f));\n\tglm_vec4 const add0 = glm_vec4_add(x, or0);\n\tglm_vec4 const sub0 = glm_vec4_sub(add0, or0);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_ceil(glm_vec4 x)\n{\n#\tif GLM_ARCH & GLM_ARCH_SSE41_BIT\n\t\treturn _mm_ceil_ps(x);\n#\telse\n\t\tglm_vec4 const rnd0 = glm_vec4_round(x);\n\t\tglm_vec4 const cmp0 = _mm_cmpgt_ps(x, rnd0);\n\t\tglm_vec4 const and0 = _mm_and_ps(cmp0, _mm_set1_ps(1.0f));\n\t\tglm_vec4 const add0 = glm_vec4_add(rnd0, and0);\n\t\treturn add0;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_fract(glm_vec4 x)\n{\n\tglm_vec4 const flr0 = glm_vec4_floor(x);\n\tglm_vec4 const sub0 = glm_vec4_sub(x, flr0);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_mod(glm_vec4 x, glm_vec4 y)\n{\n\tglm_vec4 const div0 = glm_vec4_div(x, y);\n\tglm_vec4 const flr0 = glm_vec4_floor(div0);\n\tglm_vec4 const mul0 = glm_vec4_mul(y, flr0);\n\tglm_vec4 const sub0 = glm_vec4_sub(x, mul0);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_clamp(glm_vec4 v, glm_vec4 minVal, glm_vec4 maxVal)\n{\n\tglm_vec4 const min0 = _mm_min_ps(v, maxVal);\n\tglm_vec4 const max0 = _mm_max_ps(min0, minVal);\n\treturn max0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_mix(glm_vec4 v1, glm_vec4 v2, glm_vec4 a)\n{\n\tglm_vec4 const sub0 = glm_vec4_sub(_mm_set1_ps(1.0f), a);\n\tglm_vec4 const mul0 = glm_vec4_mul(v1, sub0);\n\tglm_vec4 const mad0 = glm_vec4_fma(v2, a, mul0);\n\treturn mad0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_step(glm_vec4 edge, glm_vec4 x)\n{\n\tglm_vec4 const cmp = _mm_cmple_ps(x, edge);\n\treturn _mm_movemask_ps(cmp) == 0 ? _mm_set1_ps(1.0f) : _mm_setzero_ps();\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_smoothstep(glm_vec4 edge0, glm_vec4 edge1, glm_vec4 x)\n{\n\tglm_vec4 const sub0 = glm_vec4_sub(x, edge0);\n\tglm_vec4 const sub1 = glm_vec4_sub(edge1, edge0);\n\tglm_vec4 const div0 = glm_vec4_sub(sub0, sub1);\n\tglm_vec4 const clp0 = glm_vec4_clamp(div0, _mm_setzero_ps(), _mm_set1_ps(1.0f));\n\tglm_vec4 const mul0 = glm_vec4_mul(_mm_set1_ps(2.0f), clp0);\n\tglm_vec4 const sub2 = glm_vec4_sub(_mm_set1_ps(3.0f), mul0);\n\tglm_vec4 const mul1 = glm_vec4_mul(clp0, clp0);\n\tglm_vec4 const mul2 = glm_vec4_mul(mul1, sub2);\n\treturn mul2;\n}\n\n// Agner Fog method\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_nan(glm_vec4 x)\n{\n\tglm_ivec4 const t1 = _mm_castps_si128(x);\t\t\t\t\t\t// reinterpret as 32-bit integer\n\tglm_ivec4 const t2 = _mm_sll_epi32(t1, _mm_cvtsi32_si128(1));\t// shift out sign bit\n\tglm_ivec4 const t3 = _mm_set1_epi32(int(0xFF000000));\t\t\t\t// exponent mask\n\tglm_ivec4 const t4 = _mm_and_si128(t2, t3);\t\t\t\t\t\t// exponent\n\tglm_ivec4 const t5 = _mm_andnot_si128(t3, t2);\t\t\t\t\t// fraction\n\tglm_ivec4 const Equal = _mm_cmpeq_epi32(t3, t4);\n\tglm_ivec4 const Nequal = _mm_cmpeq_epi32(t5, _mm_setzero_si128());\n\tglm_ivec4 const And = _mm_and_si128(Equal, Nequal);\n\treturn _mm_castsi128_ps(And);\t\t\t\t\t\t\t\t\t// exponent = all 1s and fraction != 0\n}\n\n// Agner Fog method\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_inf(glm_vec4 x)\n{\n\tglm_ivec4 const t1 = _mm_castps_si128(x);\t\t\t\t\t\t\t\t\t\t// reinterpret as 32-bit integer\n\tglm_ivec4 const t2 = _mm_sll_epi32(t1, _mm_cvtsi32_si128(1));\t\t\t\t\t// shift out sign bit\n\treturn _mm_castsi128_ps(_mm_cmpeq_epi32(t2, _mm_set1_epi32(int(0xFF000000))));\t\t// exponent is all 1s, fraction is 0\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/exponential.h", "language": "code", "loc": 14, "comment_density": 0.214, "code": "/// @ref simd\n/// @file glm/simd/experimental.h\n\n#pragma once\n\n#include \"platform.h\"\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sqrt_lowp(glm_f32vec4 x)\n{\n\treturn _mm_mul_ss(_mm_rsqrt_ss(x), x);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sqrt_lowp(glm_f32vec4 x)\n{\n\treturn _mm_mul_ps(_mm_rsqrt_ps(x), x);\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/geometric.h", "language": "code", "loc": 107, "comment_density": 0.028, "code": "/// @ref simd\n/// @file glm/simd/geometric.h\n\n#pragma once\n\n#include \"common.h\"\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_DECL glm_vec4 glm_vec4_dot(glm_vec4 v1, glm_vec4 v2);\nGLM_FUNC_DECL glm_vec4 glm_vec1_dot(glm_vec4 v1, glm_vec4 v2);\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_length(glm_vec4 x)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(x, x);\n\tglm_vec4 const sqt0 = _mm_sqrt_ps(dot0);\n\treturn sqt0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_distance(glm_vec4 p0, glm_vec4 p1)\n{\n\tglm_vec4 const sub0 = _mm_sub_ps(p0, p1);\n\tglm_vec4 const len0 = glm_vec4_length(sub0);\n\treturn len0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_dot(glm_vec4 v1, glm_vec4 v2)\n{\n#\tif GLM_ARCH & GLM_ARCH_AVX_BIT\n\t\treturn _mm_dp_ps(v1, v2, 0xff);\n#\telif GLM_ARCH & GLM_ARCH_SSE3_BIT\n\t\tglm_vec4 const mul0 = _mm_mul_ps(v1, v2);\n\t\tglm_vec4 const hadd0 = _mm_hadd_ps(mul0, mul0);\n\t\tglm_vec4 const hadd1 = _mm_hadd_ps(hadd0, hadd0);\n\t\treturn hadd1;\n#\telse\n\t\tglm_vec4 const mul0 = _mm_mul_ps(v1, v2);\n\t\tglm_vec4 const swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1));\n\t\tglm_vec4 const add0 = _mm_add_ps(mul0, swp0);\n\t\tglm_vec4 const swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3));\n\t\tglm_vec4 const add1 = _mm_add_ps(add0, swp1);\n\t\treturn add1;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec1_dot(glm_vec4 v1, glm_vec4 v2)\n{\n#\tif GLM_ARCH & GLM_ARCH_AVX_BIT\n\t\treturn _mm_dp_ps(v1, v2, 0xff);\n#\telif GLM_ARCH & GLM_ARCH_SSE3_BIT\n\t\tglm_vec4 const mul0 = _mm_mul_ps(v1, v2);\n\t\tglm_vec4 const had0 = _mm_hadd_ps(mul0, mul0);\n\t\tglm_vec4 const had1 = _mm_hadd_ps(had0, had0);\n\t\treturn had1;\n#\telse\n\t\tglm_vec4 const mul0 = _mm_mul_ps(v1, v2);\n\t\tglm_vec4 const mov0 = _mm_movehl_ps(mul0, mul0);\n\t\tglm_vec4 const add0 = _mm_add_ps(mov0, mul0);\n\t\tglm_vec4 const swp1 = _mm_shuffle_ps(add0, add0, 1);\n\t\tglm_vec4 const add1 = _mm_add_ss(add0, swp1);\n\t\treturn add1;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_cross(glm_vec4 v1, glm_vec4 v2)\n{\n\tglm_vec4 const swp0 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 0, 2, 1));\n\tglm_vec4 const swp1 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 1, 0, 2));\n\tglm_vec4 const swp2 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 0, 2, 1));\n\tglm_vec4 const swp3 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 1, 0, 2));\n\tglm_vec4 const mul0 = _mm_mul_ps(swp0, swp3);\n\tglm_vec4 const mul1 = _mm_mul_ps(swp1, swp2);\n\tglm_vec4 const sub0 = _mm_sub_ps(mul0, mul1);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_normalize(glm_vec4 v)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(v, v);\n\tglm_vec4 const isr0 = _mm_rsqrt_ps(dot0);\n\tglm_vec4 const mul0 = _mm_mul_ps(v, isr0);\n\treturn mul0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_faceforward(glm_vec4 N, glm_vec4 I, glm_vec4 Nref)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(Nref, I);\n\tglm_vec4 const sgn0 = glm_vec4_sign(dot0);\n\tglm_vec4 const mul0 = _mm_mul_ps(sgn0, _mm_set1_ps(-1.0f));\n\tglm_vec4 const mul1 = _mm_mul_ps(N, mul0);\n\treturn mul1;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_reflect(glm_vec4 I, glm_vec4 N)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(N, I);\n\tglm_vec4 const mul0 = _mm_mul_ps(N, dot0);\n\tglm_vec4 const mul1 = _mm_mul_ps(mul0, _mm_set1_ps(2.0f));\n\tglm_vec4 const sub0 = _mm_sub_ps(I, mul1);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER __m128 glm_vec4_refract(glm_vec4 I, glm_vec4 N, glm_vec4 eta)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(N, I);\n\tglm_vec4 const mul0 = _mm_mul_ps(eta, eta);\n\tglm_vec4 const mul1 = _mm_mul_ps(dot0, dot0);\n\tglm_vec4 const sub0 = _mm_sub_ps(_mm_set1_ps(1.0f), mul0);\n\tglm_vec4 const sub1 = _mm_sub_ps(_mm_set1_ps(1.0f), mul1);\n\tglm_vec4 const mul2 = _mm_mul_ps(sub0, sub1);\n\n\tif(_mm_movemask_ps(_mm_cmplt_ss(mul2, _mm_set1_ps(0.0f))) == 0)\n\t\treturn _mm_set1_ps(0.0f);\n\n\tglm_vec4 const sqt0 = _mm_sqrt_ps(mul2);\n\tglm_vec4 const mad0 = glm_vec4_fma(eta, dot0, sqt0);\n\tglm_vec4 const mul4 = _mm_mul_ps(mad0, N);\n\tglm_vec4 const mul5 = _mm_mul_ps(eta, I);\n\tglm_vec4 const sub2 = _mm_sub_ps(mul5, mul4);\n\n\treturn sub2;\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/integer.h", "language": "code", "loc": 92, "comment_density": 0.326, "code": "/// @ref simd\n/// @file glm/simd/integer.h\n\n#pragma once\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_QUALIFIER glm_uvec4 glm_i128_interleave(glm_uvec4 x)\n{\n\tglm_uvec4 const Mask4 = _mm_set1_epi32(0x0000FFFF);\n\tglm_uvec4 const Mask3 = _mm_set1_epi32(0x00FF00FF);\n\tglm_uvec4 const Mask2 = _mm_set1_epi32(0x0F0F0F0F);\n\tglm_uvec4 const Mask1 = _mm_set1_epi32(0x33333333);\n\tglm_uvec4 const Mask0 = _mm_set1_epi32(0x55555555);\n\n\tglm_uvec4 Reg1;\n\tglm_uvec4 Reg2;\n\n\t// REG1 = x;\n\t// REG2 = y;\n\t//Reg1 = _mm_unpacklo_epi64(x, y);\n\tReg1 = x;\n\n\t//REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF);\n\t//REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF);\n\tReg2 = _mm_slli_si128(Reg1, 2);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask4);\n\n\t//REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF);\n\t//REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF);\n\tReg2 = _mm_slli_si128(Reg1, 1);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask3);\n\n\t//REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F);\n\t//REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F);\n\tReg2 = _mm_slli_epi32(Reg1, 4);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask2);\n\n\t//REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333);\n\t//REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333);\n\tReg2 = _mm_slli_epi32(Reg1, 2);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask1);\n\n\t//REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555);\n\t//REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555);\n\tReg2 = _mm_slli_epi32(Reg1, 1);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask0);\n\n\t//return REG1 | (REG2 << 1);\n\tReg2 = _mm_slli_epi32(Reg1, 1);\n\tReg2 = _mm_srli_si128(Reg2, 8);\n\tReg1 = _mm_or_si128(Reg1, Reg2);\n\n\treturn Reg1;\n}\n\nGLM_FUNC_QUALIFIER glm_uvec4 glm_i128_interleave2(glm_uvec4 x, glm_uvec4 y)\n{\n\tglm_uvec4 const Mask4 = _mm_set1_epi32(0x0000FFFF);\n\tglm_uvec4 const Mask3 = _mm_set1_epi32(0x00FF00FF);\n\tglm_uvec4 const Mask2 = _mm_set1_epi32(0x0F0F0F0F);\n\tglm_uvec4 const Mask1 = _mm_set1_epi32(0x33333333);\n\tglm_uvec4 const Mask0 = _mm_set1_epi32(0x55555555);\n\n\tglm_uvec4 Reg1;\n\tglm_uvec4 Reg2;\n\n\t// REG1 = x;\n\t// REG2 = y;\n\tReg1 = _mm_unpacklo_epi64(x, y);\n\n\t//REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF);\n\t//REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF);\n\tReg2 = _mm_slli_si128(Reg1, 2);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask4);\n\n\t//REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF);\n\t//REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF);\n\tReg2 = _mm_slli_si128(Reg1, 1);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask3);\n\n\t//REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F);\n\t//REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F);\n\tReg2 = _mm_slli_epi32(Reg1, 4);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask2);\n\n\t//REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333);\n\t//REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333);\n\tReg2 = _mm_slli_epi32(Reg1, 2);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask1);\n\n\t//REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555);\n\t//REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555);\n\tReg2 = _mm_slli_epi32(Reg1, 1);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask0);\n\n\t//return REG1 | (REG2 << 1);\n\tReg2 = _mm_slli_epi32(Reg1, 1);\n\tReg2 = _mm_srli_si128(Reg2, 8);\n\tReg1 = _mm_or_si128(Reg1, Reg2);\n\n\treturn Reg1;\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/matrix.h", "language": "code", "loc": 848, "comment_density": 0.36, "code": "/// @ref simd\n/// @file glm/simd/matrix.h\n\n#pragma once\n\n#include \"geometric.h\"\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_QUALIFIER void glm_mat4_matrixCompMult(glm_vec4 const in1[4], glm_vec4 const in2[4], glm_vec4 out[4])\n{\n\tout[0] = _mm_mul_ps(in1[0], in2[0]);\n\tout[1] = _mm_mul_ps(in1[1], in2[1]);\n\tout[2] = _mm_mul_ps(in1[2], in2[2]);\n\tout[3] = _mm_mul_ps(in1[3], in2[3]);\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_add(glm_vec4 const in1[4], glm_vec4 const in2[4], glm_vec4 out[4])\n{\n\tout[0] = _mm_add_ps(in1[0], in2[0]);\n\tout[1] = _mm_add_ps(in1[1], in2[1]);\n\tout[2] = _mm_add_ps(in1[2], in2[2]);\n\tout[3] = _mm_add_ps(in1[3], in2[3]);\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_sub(glm_vec4 const in1[4], glm_vec4 const in2[4], glm_vec4 out[4])\n{\n\tout[0] = _mm_sub_ps(in1[0], in2[0]);\n\tout[1] = _mm_sub_ps(in1[1], in2[1]);\n\tout[2] = _mm_sub_ps(in1[2], in2[2]);\n\tout[3] = _mm_sub_ps(in1[3], in2[3]);\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_mat4_mul_vec4(glm_vec4 const m[4], glm_vec4 v)\n{\n\t__m128 v0 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 v1 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 v2 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 v3 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(3, 3, 3, 3));\n\n\t__m128 m0 = _mm_mul_ps(m[0], v0);\n\t__m128 m1 = _mm_mul_ps(m[1], v1);\n\t__m128 m2 = _mm_mul_ps(m[2], v2);\n\t__m128 m3 = _mm_mul_ps(m[3], v3);\n\n\t__m128 a0 = _mm_add_ps(m0, m1);\n\t__m128 a1 = _mm_add_ps(m2, m3);\n\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\treturn a2;\n}\n\nGLM_FUNC_QUALIFIER __m128 glm_vec4_mul_mat4(glm_vec4 v, glm_vec4 const m[4])\n{\n\t__m128 i0 = m[0];\n\t__m128 i1 = m[1];\n\t__m128 i2 = m[2];\n\t__m128 i3 = m[3];\n\n\t__m128 m0 = _mm_mul_ps(v, i0);\n\t__m128 m1 = _mm_mul_ps(v, i1);\n\t__m128 m2 = _mm_mul_ps(v, i2);\n\t__m128 m3 = _mm_mul_ps(v, i3);\n\n\t__m128 u0 = _mm_unpacklo_ps(m0, m1);\n\t__m128 u1 = _mm_unpackhi_ps(m0, m1);\n\t__m128 a0 = _mm_add_ps(u0, u1);\n\n\t__m128 u2 = _mm_unpacklo_ps(m2, m3);\n\t__m128 u3 = _mm_unpackhi_ps(m2, m3);\n\t__m128 a1 = _mm_add_ps(u2, u3);\n\n\t__m128 f0 = _mm_movelh_ps(a0, a1);\n\t__m128 f1 = _mm_movehl_ps(a1, a0);\n\t__m128 f2 = _mm_add_ps(f0, f1);\n\n\treturn f2;\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_mul(glm_vec4 const in1[4], glm_vec4 const in2[4], glm_vec4 out[4])\n{\n\t{\n\t\t__m128 e0 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 e1 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 e2 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 e3 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 m0 = _mm_mul_ps(in1[0], e0);\n\t\t__m128 m1 = _mm_mul_ps(in1[1], e1);\n\t\t__m128 m2 = _mm_mul_ps(in1[2], e2);\n\t\t__m128 m3 = _mm_mul_ps(in1[3], e3);\n\n\t\t__m128 a0 = _mm_add_ps(m0, m1);\n\t\t__m128 a1 = _mm_add_ps(m2, m3);\n\t\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\t\tout[0] = a2;\n\t}\n\n\t{\n\t\t__m128 e0 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 e1 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 e2 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 e3 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 m0 = _mm_mul_ps(in1[0], e0);\n\t\t__m128 m1 = _mm_mul_ps(in1[1], e1);\n\t\t__m128 m2 = _mm_mul_ps(in1[2], e2);\n\t\t__m128 m3 = _mm_mul_ps(in1[3], e3);\n\n\t\t__m128 a0 = _mm_add_ps(m0, m1);\n\t\t__m128 a1 = _mm_add_ps(m2, m3);\n\t\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\t\tout[1] = a2;\n\t}\n\n\t{\n\t\t__m128 e0 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 e1 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 e2 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 e3 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 m0 = _mm_mul_ps(in1[0], e0);\n\t\t__m128 m1 = _mm_mul_ps(in1[1], e1);\n\t\t__m128 m2 = _mm_mul_ps(in1[2], e2);\n\t\t__m128 m3 = _mm_mul_ps(in1[3], e3);\n\n\t\t__m128 a0 = _mm_add_ps(m0, m1);\n\t\t__m128 a1 = _mm_add_ps(m2, m3);\n\t\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\t\tout[2] = a2;\n\t}\n\n\t{\n\t\t//(__m128&)_mm_shuffle_epi32(__m128i&)in2[0], _MM_SHUFFLE(3, 3, 3, 3))\n\t\t__m128 e0 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 e1 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 e2 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 e3 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 m0 = _mm_mul_ps(in1[0], e0);\n\t\t__m128 m1 = _mm_mul_ps(in1[1], e1);\n\t\t__m128 m2 = _mm_mul_ps(in1[2], e2);\n\t\t__m128 m3 = _mm_mul_ps(in1[3], e3);\n\n\t\t__m128 a0 = _mm_add_ps(m0, m1);\n\t\t__m128 a1 = _mm_add_ps(m2, m3);\n\t\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\t\tout[3] = a2;\n\t}\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_transpose(glm_vec4 const in[4], glm_vec4 out[4])\n{\n\t__m128 tmp0 = _mm_shuffle_ps(in[0], in[1], 0x44);\n\t__m128 tmp2 = _mm_shuffle_ps(in[0], in[1], 0xEE);\n\t__m128 tmp1 = _mm_shuffle_ps(in[2], in[3], 0x44);\n\t__m128 tmp3 = _mm_shuffle_ps(in[2], in[3], 0xEE);\n\n\tout[0] = _mm_shuffle_ps(tmp0, tmp1, 0x88);\n\tout[1] = _mm_shuffle_ps(tmp0, tmp1, 0xDD);\n\tout[2] = _mm_shuffle_ps(tmp2, tmp3, 0x88);\n\tout[3] = _mm_shuffle_ps(tmp2, tmp3, 0xDD);\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_mat4_determinant_highp(glm_vec4 const in[4])\n{\n\t__m128 Fac0;\n\t{\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];\n\t\t//\tvalType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac0 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac1;\n\t{\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];\n\t\t//\tvalType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac1 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\n\t__m128 Fac2;\n\t{\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];\n\t\t//\tvalType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac2 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac3;\n\t{\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];\n\t\t//\tvalType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac3 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac4;\n\t{\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];\n\t\t//\tvalType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac4 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac5;\n\t{\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];\n\t\t//\tvalType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac5 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);\n\t__m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);\n\n\t// m[1][0]\n\t// m[0][0]\n\t// m[0][0]\n\t// m[0][0]\n\t__m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][1]\n\t// m[0][1]\n\t// m[0][1]\n\t// m[0][1]\n\t__m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][2]\n\t// m[0][2]\n\t// m[0][2]\n\t// m[0][2]\n\t__m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][3]\n\t// m[0][3]\n\t// m[0][3]\n\t// m[0][3]\n\t__m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));\n\t__m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// col0\n\t// + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),\n\t// - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),\n\t// + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),\n\t// - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),\n\t__m128 Mul00 = _mm_mul_ps(Vec1, Fac0);\n\t__m128 Mul01 = _mm_mul_ps(Vec2, Fac1);\n\t__m128 Mul02 = _mm_mul_ps(Vec3, Fac2);\n\t__m128 Sub00 = _mm_sub_ps(Mul00, Mul01);\n\t__m128 Add00 = _mm_add_ps(Sub00, Mul02);\n\t__m128 Inv0 = _mm_mul_ps(SignB, Add00);\n\n\t// col1\n\t// - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),\n\t// + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),\n\t// - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),\n\t// + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),\n\t__m128 Mul03 = _mm_mul_ps(Vec0, Fac0);\n\t__m128 Mul04 = _mm_mul_ps(Vec2, Fac3);\n\t__m128 Mul05 = _mm_mul_ps(Vec3, Fac4);\n\t__m128 Sub01 = _mm_sub_ps(Mul03, Mul04);\n\t__m128 Add01 = _mm_add_ps(Sub01, Mul05);\n\t__m128 Inv1 = _mm_mul_ps(SignA, Add01);\n\n\t// col2\n\t// + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),\n\t// - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),\n\t// + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),\n\t// - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),\n\t__m128 Mul06 = _mm_mul_ps(Vec0, Fac1);\n\t__m128 Mul07 = _mm_mul_ps(Vec1, Fac3);\n\t__m128 Mul08 = _mm_mul_ps(Vec3, Fac5);\n\t__m128 Sub02 = _mm_sub_ps(Mul06, Mul07);\n\t__m128 Add02 = _mm_add_ps(Sub02, Mul08);\n\t__m128 Inv2 = _mm_mul_ps(SignB, Add02);\n\n\t// col3\n\t// - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),\n\t// + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),\n\t// - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),\n\t// + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));\n\t__m128 Mul09 = _mm_mul_ps(Vec0, Fac2);\n\t__m128 Mul10 = _mm_mul_ps(Vec1, Fac4);\n\t__m128 Mul11 = _mm_mul_ps(Vec2, Fac5);\n\t__m128 Sub03 = _mm_sub_ps(Mul09, Mul10);\n\t__m128 Add03 = _mm_add_ps(Sub03, Mul11);\n\t__m128 Inv3 = _mm_mul_ps(SignA, Add03);\n\n\t__m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));\n\n\t//\tvalType Determinant = m[0][0] * Inverse[0][0]\n\t//\t\t\t\t\t\t+ m[0][1] * Inverse[1][0]\n\t//\t\t\t\t\t\t+ m[0][2] * Inverse[2][0]\n\t//\t\t\t\t\t\t+ m[0][3] * Inverse[3][0];\n\t__m128 Det0 = glm_vec4_dot(in[0], Row2);\n\treturn Det0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_mat4_determinant_lowp(glm_vec4 const m[4])\n{\n\t// _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(\n\n\t//T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t//T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t//T SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t//T SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t//T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t//T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\n\t// First 2 columns\n \t__m128 Swp2A = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(0, 1, 1, 2)));\n \t__m128 Swp3A = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(3, 2, 3, 3)));\n\t__m128 MulA = _mm_mul_ps(Swp2A, Swp3A);\n\n\t// Second 2 columns\n\t__m128 Swp2B = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(3, 2, 3, 3)));\n\t__m128 Swp3B = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(0, 1, 1, 2)));\n\t__m128 MulB = _mm_mul_ps(Swp2B, Swp3B);\n\n\t// Columns subtraction\n\t__m128 SubE = _mm_sub_ps(MulA, MulB);\n\n\t// Last 2 rows\n\t__m128 Swp2C = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(0, 0, 1, 2)));\n\t__m128 Swp3C = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(1, 2, 0, 0)));\n\t__m128 MulC = _mm_mul_ps(Swp2C, Swp3C);\n\t__m128 SubF = _mm_sub_ps(_mm_movehl_ps(MulC, MulC), MulC);\n\n\t//vec<4, T, Q> DetCof(\n\t//\t+ (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02),\n\t//\t- (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04),\n\t//\t+ (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05),\n\t//\t- (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05));\n\n\t__m128 SubFacA = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubE), _MM_SHUFFLE(2, 1, 0, 0)));\n\t__m128 SwpFacA = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(0, 0, 0, 1)));\n\t__m128 MulFacA = _mm_mul_ps(SwpFacA, SubFacA);\n\n\t__m128 SubTmpB = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(0, 0, 3, 1));\n\t__m128 SubFacB = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubTmpB), _MM_SHUFFLE(3, 1, 1, 0)));//SubF[0], SubE[3], SubE[3], SubE[1];\n\t__m128 SwpFacB = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(1, 1, 2, 2)));\n\t__m128 MulFacB = _mm_mul_ps(SwpFacB, SubFacB);\n\n\t__m128 SubRes = _mm_sub_ps(MulFacA, MulFacB);\n\n\t__m128 SubTmpC = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(1, 0, 2, 2));\n\t__m128 SubFacC = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubTmpC), _MM_SHUFFLE(3, 3, 2, 0)));\n\t__m128 SwpFacC = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(2, 3, 3, 3)));\n\t__m128 MulFacC = _mm_mul_ps(SwpFacC, SubFacC);\n\n\t__m128 AddRes = _mm_add_ps(SubRes, MulFacC);\n\t__m128 DetCof = _mm_mul_ps(AddRes, _mm_setr_ps( 1.0f,-1.0f, 1.0f,-1.0f));\n\n\t//return m[0][0] * DetCof[0]\n\t//\t + m[0][1] * DetCof[1]\n\t//\t + m[0][2] * DetCof[2]\n\t//\t + m[0][3] * DetCof[3];\n\n\treturn glm_vec4_dot(m[0], DetCof);\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_mat4_determinant(glm_vec4 const m[4])\n{\n\t// _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(add)\n\n\t//T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t//T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t//T SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t//T SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t//T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t//T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\n\t// First 2 columns\n \t__m128 Swp2A = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(0, 1, 1, 2));\n \t__m128 Swp3A = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(3, 2, 3, 3));\n\t__m128 MulA = _mm_mul_ps(Swp2A, Swp3A);\n\n\t// Second 2 columns\n\t__m128 Swp2B = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(3, 2, 3, 3));\n\t__m128 Swp3B = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(0, 1, 1, 2));\n\t__m128 MulB = _mm_mul_ps(Swp2B, Swp3B);\n\n\t// Columns subtraction\n\t__m128 SubE = _mm_sub_ps(MulA, MulB);\n\n\t// Last 2 rows\n\t__m128 Swp2C = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(0, 0, 1, 2));\n\t__m128 Swp3C = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(1, 2, 0, 0));\n\t__m128 MulC = _mm_mul_ps(Swp2C, Swp3C);\n\t__m128 SubF = _mm_sub_ps(_mm_movehl_ps(MulC, MulC), MulC);\n\n\t//vec<4, T, Q> DetCof(\n\t//\t+ (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02),\n\t//\t- (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04),\n\t//\t+ (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05),\n\t//\t- (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05));\n\n\t__m128 SubFacA = _mm_shuffle_ps(SubE, SubE, _MM_SHUFFLE(2, 1, 0, 0));\n\t__m128 SwpFacA = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(0, 0, 0, 1));\n\t__m128 MulFacA = _mm_mul_ps(SwpFacA, SubFacA);\n\n\t__m128 SubTmpB = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(0, 0, 3, 1));\n\t__m128 SubFacB = _mm_shuffle_ps(SubTmpB, SubTmpB, _MM_SHUFFLE(3, 1, 1, 0));//SubF[0], SubE[3], SubE[3], SubE[1];\n\t__m128 SwpFacB = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(1, 1, 2, 2));\n\t__m128 MulFacB = _mm_mul_ps(SwpFacB, SubFacB);\n\n\t__m128 SubRes = _mm_sub_ps(MulFacA, MulFacB);\n\n\t__m128 SubTmpC = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(1, 0, 2, 2));\n\t__m128 SubFacC = _mm_shuffle_ps(SubTmpC, SubTmpC, _MM_SHUFFLE(3, 3, 2, 0));\n\t__m128 SwpFacC = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(2, 3, 3, 3));\n\t__m128 MulFacC = _mm_mul_ps(SwpFacC, SubFacC);\n\n\t__m128 AddRes = _mm_add_ps(SubRes, MulFacC);\n\t__m128 DetCof = _mm_mul_ps(AddRes, _mm_setr_ps( 1.0f,-1.0f, 1.0f,-1.0f));\n\n\t//return m[0][0] * DetCof[0]\n\t//\t + m[0][1] * DetCof[1]\n\t//\t + m[0][2] * DetCof[2]\n\t//\t + m[0][3] * DetCof[3];\n\n\treturn glm_vec4_dot(m[0], DetCof);\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_inverse(glm_vec4 const in[4], glm_vec4 out[4])\n{\n\t__m128 Fac0;\n\t{\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];\n\t\t//\tvalType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac0 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac1;\n\t{\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];\n\t\t//\tvalType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac1 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\n\t__m128 Fac2;\n\t{\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];\n\t\t//\tvalType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac2 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac3;\n\t{\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];\n\t\t//\tvalType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac3 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac4;\n\t{\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];\n\t\t//\tvalType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac4 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac5;\n\t{\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];\n\t\t//\tvalType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac5 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);\n\t__m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);\n\n\t// m[1][0]\n\t// m[0][0]\n\t// m[0][0]\n\t// m[0][0]\n\t__m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][1]\n\t// m[0][1]\n\t// m[0][1]\n\t// m[0][1]\n\t__m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][2]\n\t// m[0][2]\n\t// m[0][2]\n\t// m[0][2]\n\t__m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][3]\n\t// m[0][3]\n\t// m[0][3]\n\t// m[0][3]\n\t__m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));\n\t__m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// col0\n\t// + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),\n\t// - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),\n\t// + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),\n\t// - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),\n\t__m128 Mul00 = _mm_mul_ps(Vec1, Fac0);\n\t__m128 Mul01 = _mm_mul_ps(Vec2, Fac1);\n\t__m128 Mul02 = _mm_mul_ps(Vec3, Fac2);\n\t__m128 Sub00 = _mm_sub_ps(Mul00, Mul01);\n\t__m128 Add00 = _mm_add_ps(Sub00, Mul02);\n\t__m128 Inv0 = _mm_mul_ps(SignB, Add00);\n\n\t// col1\n\t// - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),\n\t// + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),\n\t// - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),\n\t// + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),\n\t__m128 Mul03 = _mm_mul_ps(Vec0, Fac0);\n\t__m128 Mul04 = _mm_mul_ps(Vec2, Fac3);\n\t__m128 Mul05 = _mm_mul_ps(Vec3, Fac4);\n\t__m128 Sub01 = _mm_sub_ps(Mul03, Mul04);\n\t__m128 Add01 = _mm_add_ps(Sub01, Mul05);\n\t__m128 Inv1 = _mm_mul_ps(SignA, Add01);\n\n\t// col2\n\t// + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),\n\t// - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),\n\t// + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),\n\t// - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),\n\t__m128 Mul06 = _mm_mul_ps(Vec0, Fac1);\n\t__m128 Mul07 = _mm_mul_ps(Vec1, Fac3);\n\t__m128 Mul08 = _mm_mul_ps(Vec3, Fac5);\n\t__m128 Sub02 = _mm_sub_ps(Mul06, Mul07);\n\t__m128 Add02 = _mm_add_ps(Sub02, Mul08);\n\t__m128 Inv2 = _mm_mul_ps(SignB, Add02);\n\n\t// col3\n\t// - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),\n\t// + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),\n\t// - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),\n\t// + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));\n\t__m128 Mul09 = _mm_mul_ps(Vec0, Fac2);\n\t__m128 Mul10 = _mm_mul_ps(Vec1, Fac4);\n\t__m128 Mul11 = _mm_mul_ps(Vec2, Fac5);\n\t__m128 Sub03 = _mm_sub_ps(Mul09, Mul10);\n\t__m128 Add03 = _mm_add_ps(Sub03, Mul11);\n\t__m128 Inv3 = _mm_mul_ps(SignA, Add03);\n\n\t__m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));\n\n\t//\tvalType Determinant = m[0][0] * Inverse[0][0]\n\t//\t\t\t\t\t\t+ m[0][1] * Inverse[1][0]\n\t//\t\t\t\t\t\t+ m[0][2] * Inverse[2][0]\n\t//\t\t\t\t\t\t+ m[0][3] * Inverse[3][0];\n\t__m128 Det0 = glm_vec4_dot(in[0], Row2);\n\t__m128 Rcp0 = _mm_div_ps(_mm_set1_ps(1.0f), Det0);\n\t//__m128 Rcp0 = _mm_rcp_ps(Det0);\n\n\t//\tInverse /= Determinant;\n\tout[0] = _mm_mul_ps(Inv0, Rcp0);\n\tout[1] = _mm_mul_ps(Inv1, Rcp0);\n\tout[2] = _mm_mul_ps(Inv2, Rcp0);\n\tout[3] = _mm_mul_ps(Inv3, Rcp0);\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_inverse_lowp(glm_vec4 const in[4], glm_vec4 out[4])\n{\n\t__m128 Fac0;\n\t{\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];\n\t\t//\tvalType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac0 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac1;\n\t{\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];\n\t\t//\tvalType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac1 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\n\t__m128 Fac2;\n\t{\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];\n\t\t//\tvalType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac2 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac3;\n\t{\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];\n\t\t//\tvalType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac3 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac4;\n\t{\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];\n\t\t//\tvalType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac4 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac5;\n\t{\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];\n\t\t//\tvalType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac5 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);\n\t__m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);\n\n\t// m[1][0]\n\t// m[0][0]\n\t// m[0][0]\n\t// m[0][0]\n\t__m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][1]\n\t// m[0][1]\n\t// m[0][1]\n\t// m[0][1]\n\t__m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][2]\n\t// m[0][2]\n\t// m[0][2]\n\t// m[0][2]\n\t__m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][3]\n\t// m[0][3]\n\t// m[0][3]\n\t// m[0][3]\n\t__m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));\n\t__m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// col0\n\t// + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),\n\t// - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),\n\t// + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),\n\t// - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),\n\t__m128 Mul00 = _mm_mul_ps(Vec1, Fac0);\n\t__m128 Mul01 = _mm_mul_ps(Vec2, Fac1);\n\t__m128 Mul02 = _mm_mul_ps(Vec3, Fac2);\n\t__m128 Sub00 = _mm_sub_ps(Mul00, Mul01);\n\t__m128 Add00 = _mm_add_ps(Sub00, Mul02);\n\t__m128 Inv0 = _mm_mul_ps(SignB, Add00);\n\n\t// col1\n\t// - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),\n\t// + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),\n\t// - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),\n\t// + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),\n\t__m128 Mul03 = _mm_mul_ps(Vec0, Fac0);\n\t__m128 Mul04 = _mm_mul_ps(Vec2, Fac3);\n\t__m128 Mul05 = _mm_mul_ps(Vec3, Fac4);\n\t__m128 Sub01 = _mm_sub_ps(Mul03, Mul04);\n\t__m128 Add01 = _mm_add_ps(Sub01, Mul05);\n\t__m128 Inv1 = _mm_mul_ps(SignA, Add01);\n\n\t// col2\n\t// + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),\n\t// - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),\n\t// + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),\n\t// - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),\n\t__m128 Mul06 = _mm_mul_ps(Vec0, Fac1);\n\t__m128 Mul07 = _mm_mul_ps(Vec1, Fac3);\n\t__m128 Mul08 = _mm_mul_ps(Vec3, Fac5);\n\t__m128 Sub02 = _mm_sub_ps(Mul06, Mul07);\n\t__m128 Add02 = _mm_add_ps(Sub02, Mul08);\n\t__m128 Inv2 = _mm_mul_ps(SignB, Add02);\n\n\t// col3\n\t// - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),\n\t// + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),\n\t// - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),\n\t// + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));\n\t__m128 Mul09 = _mm_mul_ps(Vec0, Fac2);\n\t__m128 Mul10 = _mm_mul_ps(Vec1, Fac4);\n\t__m128 Mul11 = _mm_mul_ps(Vec2, Fac5);\n\t__m128 Sub03 = _mm_sub_ps(Mul09, Mul10);\n\t__m128 Add03 = _mm_add_ps(Sub03, Mul11);\n\t__m128 Inv3 = _mm_mul_ps(SignA, Add03);\n\n\t__m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));\n\n\t//\tvalType Determinant = m[0][0] * Inverse[0][0]\n\t//\t\t\t\t\t\t+ m[0][1] * Inverse[1][0]\n\t//\t\t\t\t\t\t+ m[0][2] * Inverse[2][0]\n\t//\t\t\t\t\t\t+ m[0][3] * Inverse[3][0];\n\t__m128 Det0 = glm_vec4_dot(in[0], Row2);\n\t__m128 Rcp0 = _mm_rcp_ps(Det0);\n\t//__m128 Rcp0 = _mm_div_ps(one, Det0);\n\t//\tInverse /= Determinant;\n\tout[0] = _mm_mul_ps(Inv0, Rcp0);\n\tout[1] = _mm_mul_ps(Inv1, Rcp0);\n\tout[2] = _mm_mul_ps(Inv2, Rcp0);\n\tout[3] = _mm_mul_ps(Inv3, Rcp0);\n}\n/*\nGLM_FUNC_QUALIFIER void glm_mat4_rotate(__m128 const in[4], float Angle, float const v[3], __m128 out[4])\n{\n\tfloat a = glm::radians(Angle);\n\tfloat c = cos(a);\n\tfloat s = sin(a);\n\n\tglm::vec4 AxisA(v[0], v[1], v[2], float(0));\n\t__m128 AxisB = _mm_set_ps(AxisA.w, AxisA.z, AxisA.y, AxisA.x);\n\t__m128 AxisC = detail::sse_nrm_ps(AxisB);\n\n\t__m128 Cos0 = _mm_set_ss(c);\n\t__m128 CosA = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Sin0 = _mm_set_ss(s);\n\t__m128 SinA = _mm_shuffle_ps(Sin0, Sin0, _MM_SHUFFLE(0, 0, 0, 0));\n\n\t// vec<3, T, Q> temp = (valType(1) - c) * axis;\n\t__m128 Temp0 = _mm_sub_ps(one, CosA);\n\t__m128 Temp1 = _mm_mul_ps(Temp0, AxisC);\n\n\t//Rotate[0][0] = c + temp[0] * axis[0];\n\t//Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2];\n\t//Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1];\n\t__m128 Axis0 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 TmpA0 = _mm_mul_ps(Axis0, AxisC);\n\t__m128 CosA0 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 1, 1, 0));\n\t__m128 TmpA1 = _mm_add_ps(CosA0, TmpA0);\n\t__m128 SinA0 = SinA;//_mm_set_ps(0.0f, s, -s, 0.0f);\n\t__m128 TmpA2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 1, 2, 3));\n\t__m128 TmpA3 = _mm_mul_ps(SinA0, TmpA2);\n\t__m128 TmpA4 = _mm_add_ps(TmpA1, TmpA3);\n\n\t//Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2];\n\t//Rotate[1][1] = c + temp[1] * axis[1];\n\t//Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0];\n\t__m128 Axis1 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 TmpB0 = _mm_mul_ps(Axis1, AxisC);\n\t__m128 CosA1 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 1, 0, 1));\n\t__m128 TmpB1 = _mm_add_ps(CosA1, TmpB0);\n\t__m128 SinB0 = SinA;//_mm_set_ps(-s, 0.0f, s, 0.0f);\n\t__m128 TmpB2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 0, 3, 2));\n\t__m128 TmpB3 = _mm_mul_ps(SinA0, TmpB2);\n\t__m128 TmpB4 = _mm_add_ps(TmpB1, TmpB3);\n\n\t//Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1];\n\t//Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0];\n\t//Rotate[2][2] = c + temp[2] * axis[2];\n\t__m128 Axis2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 TmpC0 = _mm_mul_ps(Axis2, AxisC);\n\t__m128 CosA2 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 0, 1, 1));\n\t__m128 TmpC1 = _mm_add_ps(CosA2, TmpC0);\n\t__m128 SinC0 = SinA;//_mm_set_ps(s, -s, 0.0f, 0.0f);\n\t__m128 TmpC2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 3, 0, 1));\n\t__m128 TmpC3 = _mm_mul_ps(SinA0, TmpC2);\n\t__m128 TmpC4 = _mm_add_ps(TmpC1, TmpC3);\n\n\t__m128 Result[4];\n\tResult[0] = TmpA4;\n\tResult[1] = TmpB4;\n\tResult[2] = TmpC4;\n\tResult[3] = _mm_set_ps(1, 0, 0, 0);\n\n\t//mat<4, 4, valType> Result;\n\t//Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];\n\t//Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];\n\t//Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];\n\t//Result[3] = m[3];\n\t//return Result;\n\tsse_mul_ps(in, Result, out);\n}\n*/\nGLM_FUNC_QUALIFIER void glm_mat4_outerProduct(__m128 const& c, __m128 const& r, __m128 out[4])\n{\n\tout[0] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(0, 0, 0, 0)));\n\tout[1] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(1, 1, 1, 1)));\n\tout[2] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(2, 2, 2, 2)));\n\tout[3] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(3, 3, 3, 3)));\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/packing.h", "language": "code", "loc": 5, "comment_density": 0.6, "code": "/// @ref simd\n/// @file glm/simd/packing.h\n\n#pragma once\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/platform.h", "language": "code", "loc": 326, "comment_density": 0.074, "code": "#pragma once\n\n///////////////////////////////////////////////////////////////////////////////////\n// Platform\n\n#define GLM_PLATFORM_UNKNOWN\t\t0x00000000\n#define GLM_PLATFORM_WINDOWS\t\t0x00010000\n#define GLM_PLATFORM_LINUX\t\t\t0x00020000\n#define GLM_PLATFORM_APPLE\t\t\t0x00040000\n//#define GLM_PLATFORM_IOS\t\t\t0x00080000\n#define GLM_PLATFORM_ANDROID\t\t0x00100000\n#define GLM_PLATFORM_CHROME_NACL\t0x00200000\n#define GLM_PLATFORM_UNIX\t\t\t0x00400000\n#define GLM_PLATFORM_QNXNTO\t\t\t0x00800000\n#define GLM_PLATFORM_WINCE\t\t\t0x01000000\n#define GLM_PLATFORM_CYGWIN\t\t\t0x02000000\n\n#ifdef GLM_FORCE_PLATFORM_UNKNOWN\n#\tdefine GLM_PLATFORM GLM_PLATFORM_UNKNOWN\n#elif defined(__CYGWIN__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_CYGWIN\n#elif defined(__QNXNTO__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_QNXNTO\n#elif defined(__APPLE__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_APPLE\n#elif defined(WINCE)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_WINCE\n#elif defined(_WIN32)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_WINDOWS\n#elif defined(__native_client__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_CHROME_NACL\n#elif defined(__ANDROID__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_ANDROID\n#elif defined(__linux)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_LINUX\n#elif defined(__unix)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_UNIX\n#else\n#\tdefine GLM_PLATFORM GLM_PLATFORM_UNKNOWN\n#endif//\n\n///////////////////////////////////////////////////////////////////////////////////\n// Compiler\n\n#define GLM_COMPILER_UNKNOWN\t\t0x00000000\n\n// Intel\n#define GLM_COMPILER_INTEL\t\t\t0x00100000\n#define GLM_COMPILER_INTEL14\t\t0x00100040\n#define GLM_COMPILER_INTEL15\t\t0x00100050\n#define GLM_COMPILER_INTEL16\t\t0x00100060\n#define GLM_COMPILER_INTEL17\t\t0x00100070\n\n// Visual C++ defines\n#define GLM_COMPILER_VC\t\t\t\t0x01000000\n#define GLM_COMPILER_VC12\t\t\t0x01000001\n#define GLM_COMPILER_VC14\t\t\t0x01000002\n#define GLM_COMPILER_VC15\t\t\t0x01000003\n#define GLM_COMPILER_VC15_3\t\t\t0x01000004\n#define GLM_COMPILER_VC15_5\t\t\t0x01000005\n#define GLM_COMPILER_VC15_6\t\t\t0x01000006\n#define GLM_COMPILER_VC15_7\t\t\t0x01000007\n\n// GCC defines\n#define GLM_COMPILER_GCC\t\t\t0x02000000\n#define GLM_COMPILER_GCC46\t\t\t0x020000D0\n#define GLM_COMPILER_GCC47\t\t\t0x020000E0\n#define GLM_COMPILER_GCC48\t\t\t0x020000F0\n#define GLM_COMPILER_GCC49\t\t\t0x02000100\n#define GLM_COMPILER_GCC5\t\t\t0x02000200\n#define GLM_COMPILER_GCC6\t\t\t0x02000300\n#define GLM_COMPILER_GCC7\t\t\t0x02000400\n#define GLM_COMPILER_GCC8\t\t\t0x02000500\n\n// CUDA\n#define GLM_COMPILER_CUDA\t\t\t0x10000000\n#define GLM_COMPILER_CUDA70\t\t\t0x100000A0\n#define GLM_COMPILER_CUDA75\t\t\t0x100000B0\n#define GLM_COMPILER_CUDA80\t\t\t0x100000C0\n\n// Clang\n#define GLM_COMPILER_CLANG\t\t\t0x20000000\n#define GLM_COMPILER_CLANG34\t\t0x20000050\n#define GLM_COMPILER_CLANG35\t\t0x20000060\n#define GLM_COMPILER_CLANG36\t\t0x20000070\n#define GLM_COMPILER_CLANG37\t\t0x20000080\n#define GLM_COMPILER_CLANG38\t\t0x20000090\n#define GLM_COMPILER_CLANG39\t\t0x200000A0\n#define GLM_COMPILER_CLANG40\t\t0x200000B0\n#define GLM_COMPILER_CLANG41\t\t0x200000C0\n#define GLM_COMPILER_CLANG42\t\t0x200000D0\n\n// Build model\n#define GLM_MODEL_32\t\t\t\t0x00000010\n#define GLM_MODEL_64\t\t\t\t0x00000020\n\n// Force generic C++ compiler\n#ifdef GLM_FORCE_COMPILER_UNKNOWN\n#\tdefine GLM_COMPILER GLM_COMPILER_UNKNOWN\n\n#elif defined(__INTEL_COMPILER)\n#\tif (__INTEL_COMPILER < 1400)\n#\t\terror \"GLM requires ICC 2013 SP1 or newer\"\n#\telif __INTEL_COMPILER == 1400\n#\t\tdefine GLM_COMPILER GLM_COMPILER_INTEL14\n#\telif __INTEL_COMPILER == 1500\n#\t\tdefine GLM_COMPILER GLM_COMPILER_INTEL15\n#\telif __INTEL_COMPILER == 1600\n#\t\tdefine GLM_COMPILER GLM_COMPILER_INTEL16\n#\telif __INTEL_COMPILER >= 1700\n#\t\tdefine GLM_COMPILER GLM_COMPILER_INTEL17\n#\tendif\n\n// CUDA\n#elif defined(__CUDACC__)\n#\tif !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)\n#\t\tinclude // make sure version is defined since nvcc does not define it itself!\n#\tendif\n#\tif CUDA_VERSION < 7000\n#\t\terror \"GLM requires CUDA 7.0 or higher\"\n#\telif (CUDA_VERSION >= 7000 && CUDA_VERSION < 7500)\n#\t\tdefine GLM_COMPILER GLM_COMPILER_CUDA70\n#\telif (CUDA_VERSION >= 7500 && CUDA_VERSION < 8000)\n#\t\tdefine GLM_COMPILER GLM_COMPILER_CUDA75\n#\telif (CUDA_VERSION >= 8000)\n#\t\tdefine GLM_COMPILER GLM_COMPILER_CUDA80\n#\tendif\n\n// Clang\n#elif defined(__clang__)\n#\tif defined(__apple_build_version__)\n#\t\tif (__clang_major__ < 6)\n#\t\t\terror \"GLM requires Clang 3.4 / Apple Clang 6.0 or higher\"\n#\t\telif __clang_major__ == 6 && __clang_minor__ == 0\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG35\n#\t\telif __clang_major__ == 6 && __clang_minor__ >= 1\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG36\n#\t\telif __clang_major__ >= 7\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG37\n#\t\tendif\n#\telse\n#\t\tif ((__clang_major__ == 3) && (__clang_minor__ < 4)) || (__clang_major__ < 3)\n#\t\t\terror \"GLM requires Clang 3.4 or higher\"\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 4\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG34\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 5\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG35\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 6\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG36\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 7\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG37\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 8\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG38\n#\t\telif __clang_major__ == 3 && __clang_minor__ >= 9\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG39\n#\t\telif __clang_major__ == 4 && __clang_minor__ == 0\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG40\n#\t\telif __clang_major__ == 4 && __clang_minor__ == 1\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG41\n#\t\telif __clang_major__ == 4 && __clang_minor__ >= 2\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG42\n#\t\telif __clang_major__ >= 4\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG42\n#\t\tendif\n#\tendif\n\n// Visual C++\n#elif defined(_MSC_VER)\n#\tif _MSC_VER < 1800\n#\t\terror \"GLM requires Visual C++ 12 - 2013 or higher\"\n#\telif _MSC_VER == 1800\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC12\n#\telif _MSC_VER == 1900\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC14\n#\telif _MSC_VER == 1910\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15\n#\telif _MSC_VER == 1911\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15_3\n#\telif _MSC_VER == 1912\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15_5\n#\telif _MSC_VER == 1913\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15_6\n#\telif _MSC_VER >= 1914\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15_7\n#\tendif//_MSC_VER\n\n// G++\n#elif defined(__GNUC__) || defined(__MINGW32__)\n#\tif ((__GNUC__ == 4) && (__GNUC_MINOR__ < 6)) || (__GNUC__ < 4)\n#\t\terror \"GLM requires GCC 4.7 or higher\"\n#\telif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC46)\n#\telif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC47)\n#\telif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC48)\n#\telif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC49)\n#\telif (__GNUC__ == 5)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC5)\n#\telif (__GNUC__ == 6)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC6)\n#\telif (__GNUC__ == 7)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC7)\n#\telif (__GNUC__ >= 8)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC8)\n#\tendif\n\n#else\n#\tdefine GLM_COMPILER GLM_COMPILER_UNKNOWN\n#endif\n\n#ifndef GLM_COMPILER\n#\terror \"GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message.\"\n#endif//GLM_COMPILER\n\n///////////////////////////////////////////////////////////////////////////////////\n// Instruction sets\n\n// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2 GLM_FORCE_AVX2\n\n#define GLM_ARCH_MIPS_BIT\t(0x10000000)\n#define GLM_ARCH_PPC_BIT\t(0x20000000)\n#define GLM_ARCH_ARM_BIT\t(0x40000000)\n#define GLM_ARCH_X86_BIT\t(0x80000000)\n\n#define GLM_ARCH_SIMD_BIT\t(0x00001000)\n\n#define GLM_ARCH_NEON_BIT\t(0x00000001)\n#define GLM_ARCH_SSE_BIT\t(0x00000002)\n#define GLM_ARCH_SSE2_BIT\t(0x00000004)\n#define GLM_ARCH_SSE3_BIT\t(0x00000008)\n#define GLM_ARCH_SSSE3_BIT\t(0x00000010)\n#define GLM_ARCH_SSE41_BIT\t(0x00000020)\n#define GLM_ARCH_SSE42_BIT\t(0x00000040)\n#define GLM_ARCH_AVX_BIT\t(0x00000080)\n#define GLM_ARCH_AVX2_BIT\t(0x00000100)\n\n#define GLM_ARCH_UNKNOWN\t(0)\n#define GLM_ARCH_X86\t\t(GLM_ARCH_X86_BIT)\n#define GLM_ARCH_SSE\t\t(GLM_ARCH_SSE_BIT | GLM_ARCH_SIMD_BIT | GLM_ARCH_X86)\n#define GLM_ARCH_SSE2\t\t(GLM_ARCH_SSE2_BIT | GLM_ARCH_SSE)\n#define GLM_ARCH_SSE3\t\t(GLM_ARCH_SSE3_BIT | GLM_ARCH_SSE2)\n#define GLM_ARCH_SSSE3\t\t(GLM_ARCH_SSSE3_BIT | GLM_ARCH_SSE3)\n#define GLM_ARCH_SSE41\t\t(GLM_ARCH_SSE41_BIT | GLM_ARCH_SSSE3)\n#define GLM_ARCH_SSE42\t\t(GLM_ARCH_SSE42_BIT | GLM_ARCH_SSE41)\n#define GLM_ARCH_AVX\t\t(GLM_ARCH_AVX_BIT | GLM_ARCH_SSE42)\n#define GLM_ARCH_AVX2\t\t(GLM_ARCH_AVX2_BIT | GLM_ARCH_AVX)\n#define GLM_ARCH_ARM\t\t(GLM_ARCH_ARM_BIT)\n#define GLM_ARCH_NEON\t\t(GLM_ARCH_NEON_BIT | GLM_ARCH_SIMD_BIT | GLM_ARCH_ARM)\n#define GLM_ARCH_MIPS\t\t(GLM_ARCH_MIPS_BIT)\n#define GLM_ARCH_PPC\t\t(GLM_ARCH_PPC_BIT)\n\n#ifdef GLM_FORCE_ARCH_UNKNOWN\n#\tdefine GLM_ARCH GLM_ARCH_UNKNOWN\n#elif defined(GLM_FORCE_PURE) || defined(GLM_FORCE_XYZW_ONLY)\n#\tif defined(__x86_64__) || defined(_M_X64) || defined(_M_IX86) || defined(__i386__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_X86)\n#\telif defined(__arm__ ) || defined(_M_ARM)\n#\t\tdefine GLM_ARCH (GLM_ARCH_ARM)\n#\telif defined(__powerpc__ ) || defined(_M_PPC)\n#\t\tdefine GLM_ARCH (GLM_ARCH_PPC)\n#\telif defined(__mips__ )\n#\t\tdefine GLM_ARCH (GLM_ARCH_MIPS)\n#\telse\n#\t\tdefine GLM_ARCH (GLM_ARCH_UNKNOWN)\n#\tendif\n#elif defined(GLM_FORCE_NEON)\n#\tdefine GLM_ARCH (GLM_ARCH_NEON)\n#elif defined(GLM_FORCE_AVX2)\n#\tdefine GLM_ARCH (GLM_ARCH_AVX2)\n#elif defined(GLM_FORCE_AVX)\n#\tdefine GLM_ARCH (GLM_ARCH_AVX)\n#elif defined(GLM_FORCE_SSE42)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE42)\n#elif defined(GLM_FORCE_SSE41)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE41)\n#elif defined(GLM_FORCE_SSSE3)\n#\tdefine GLM_ARCH (GLM_ARCH_SSSE3)\n#elif defined(GLM_FORCE_SSE3)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE3)\n#elif defined(GLM_FORCE_SSE2)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE2)\n#elif defined(GLM_FORCE_SSE)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE)\n#else\n#\tif defined(__AVX2__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_AVX2)\n#\telif defined(__AVX__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_AVX)\n#\telif defined(__SSE4_2__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSE42)\n#\telif defined(__SSE4_1__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSE41)\n#\telif defined(__SSSE3__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSSE3)\n#\telif defined(__SSE3__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSE3)\n#\telif defined(__SSE2__) || defined(__x86_64__) || defined(_M_X64) || defined(_M_IX86_FP)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSE2)\n#\telif defined(__i386__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_X86)\n#\telif defined(__ARM_NEON)\n#\t\tdefine GLM_ARCH (GLM_ARCH_ARM | GLM_ARCH_NEON)\n#\telif defined(__arm__ ) || defined(_M_ARM)\n#\t\tdefine GLM_ARCH (GLM_ARCH_ARM)\n#\telif defined(__mips__ )\n#\t\tdefine GLM_ARCH (GLM_ARCH_MIPS)\n#\telif defined(__powerpc__ ) || defined(_M_PPC)\n#\t\tdefine GLM_ARCH (GLM_ARCH_PPC)\n#\telse\n#\t\tdefine GLM_ARCH (GLM_ARCH_UNKNOWN)\n#\tendif\n#endif\n\n#if GLM_ARCH & GLM_ARCH_AVX2_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_AVX_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSE42_BIT\n#\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\tinclude \n#\tendif\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSE41_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSSE3_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSE3_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSE2_BIT\n#\tinclude \n#endif//GLM_ARCH\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\ttypedef __m128\t\t\tglm_f32vec4;\n\ttypedef __m128i\t\t\tglm_i32vec4;\n\ttypedef __m128i\t\t\tglm_u32vec4;\n\ttypedef __m128d\t\t\tglm_f64vec2;\n\ttypedef __m128i\t\t\tglm_i64vec2;\n\ttypedef __m128i\t\t\tglm_u64vec2;\n\n\ttypedef glm_f32vec4\t\tglm_vec4;\n\ttypedef glm_i32vec4\t\tglm_ivec4;\n\ttypedef glm_u32vec4\t\tglm_uvec4;\n\ttypedef glm_f64vec2\t\tglm_dvec2;\n#endif\n\n#if GLM_ARCH & GLM_ARCH_AVX_BIT\n\ttypedef __m256d\t\t\tglm_f64vec4;\n\ttypedef glm_f64vec4\t\tglm_dvec4;\n#endif\n\n#if GLM_ARCH & GLM_ARCH_AVX2_BIT\n\ttypedef __m256i\t\t\tglm_i64vec4;\n\ttypedef __m256i\t\t\tglm_u64vec4;\n#endif\n"}, {"path": "includes/glm/simd/trigonometric.h", "language": "code", "loc": 5, "comment_density": 0.6, "code": "/// @ref simd\n/// @file glm/simd/trigonometric.h\n\n#pragma once\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n\n"}, {"path": "includes/glm/simd/vector_relational.h", "language": "code", "loc": 5, "comment_density": 0.6, "code": "/// @ref simd\n/// @file glm/simd/vector_relational.h\n\n#pragma once\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.323, "dedup_hash": "fcb1c8ff8437988a", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_irrklang", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Irrklang", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/irrKlang/ik_ESoundEngineOptions.h", "language": "code", "loc": 64, "comment_density": 0.734, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __E_IRRKLANG_SOUND_ENGINE_OPTIONS_H_INCLUDED__\n#define __E_IRRKLANG_SOUND_ENGINE_OPTIONS_H_INCLUDED__\n\nnamespace irrklang \n{\n\t//! An enumeration for all options for starting up the sound engine\n\t/** When using createIrrKlangDevice, use a combination of this these\n\tas 'options' parameter to start up the engine. By default, irrKlang\n\tuses ESEO_DEFAULT_OPTIONS, which is set to the combination \n\tESEO_MULTI_THREADED | ESEO_LOAD_PLUGINS | ESEO_USE_3D_BUFFERS | ESEO_PRINT_DEBUG_INFO_TO_DEBUGGER | ESEO_PRINT_DEBUG_INFO_TO_STDOUT. */\n\tenum E_SOUND_ENGINE_OPTIONS\n\t{\n\t\t//! If specified (default), it will make irrKlang run in a separate thread.\n\t\t/** Using this flag, irrKlang will update\n\t\tall streams, sounds, 3d positions and whatever automatically. You also don't need to call ISoundEngine::update()\n\t\tif irrKlang is running multithreaded. However, if you want to run irrKlang in the same thread\n\t\tas your application (for easier debugging for example), don't set this. But you need to call ISoundEngine::update()\n\t\tas often as you can (at least about 2-3 times per second) to make irrKlang update everything correctly then. */\n\t\tESEO_MULTI_THREADED = 0x01,\n\n\t\t//! If the window of the application doesn't have the focus, irrKlang will be silent if this has been set. \n\t\t/** This will only work when irrKlang is using the DirectSound output driver. */\n\t\tESEO_MUTE_IF_NOT_FOCUSED = 0x02,\n\n\t\t//! Automatically loads external plugins when starting up.\n\t\t/** Plugins usually are .dll, .so or .dylib\n\t\tfiles named for example ikpMP3.dll (= short for irrKlangPluginMP3) which are executed\n\t\tafter the startup of the sound engine and modify it for example to make it possible\n\t\tto play back mp3 files. Plugins are being loaded from the current working directory \n\t\tas well as from the position where the .exe using the irrKlang library resides. \n\t\tIt is also possible to load the plugins after the engine has started up using \n\t\tISoundEngine::loadPlugins(). */\n\t\tESEO_LOAD_PLUGINS = 0x04,\n\n\t\t//! Uses 3D sound buffers instead of emulating them when playing 3d sounds (default).\n\t\t/** If this flag is not specified, all buffers will by created\n\t\tin 2D only and 3D positioning will be emulated in software, making the engine run\n\t\tfaster if hardware 3d audio is slow on the system. */\n\t\tESEO_USE_3D_BUFFERS = 0x08,\n\n\t\t//! Prints debug messages to the debugger window.\n\t\t/** irrKlang will print debug info and status messages to any windows debugger supporting \n\t\tOutputDebugString() (like VisualStudio).\n\t\tThis is useful if your application does not capture any console output (see ESEO_PRINT_DEBUG_INFO_TO_STDOUT). */\n\t\tESEO_PRINT_DEBUG_INFO_TO_DEBUGGER = 0x10,\n\n\t\t//! Prints debug messages to stdout (the ConsoleWindow).\n\t\t/** irrKlang will print debug info and status messages stdout, the console window in Windows. */\n\t\tESEO_PRINT_DEBUG_INFO_TO_STDOUT = 0x20,\n\n\t\t//! Uses linear rolloff for 3D sound.\n\t\t/** If specified, instead of the default logarithmic one, irrKlang will \n\t\t use a linear rolloff model which influences the attenuation \n\t\t of the sounds over distance. The volume is interpolated linearly between the MinDistance\n\t\t and MaxDistance, making it possible to adjust sounds more easily although this is not\n\t\t physically correct.\n\t\t Note that this option may not work when used together with the ESEO_USE_3D_BUFFERS\n\t\t option when using Direct3D for example, irrKlang will then turn off ESEO_USE_3D_BUFFERS\n\t\t automatically to be able to use this option and write out a warning. */\n\t\tESEO_LINEAR_ROLLOFF = 0x40,\n\n\t\t//! Default parameters when starting up the engine.\n\t\tESEO_DEFAULT_OPTIONS = ESEO_MULTI_THREADED | ESEO_LOAD_PLUGINS | ESEO_USE_3D_BUFFERS | ESEO_PRINT_DEBUG_INFO_TO_DEBUGGER | ESEO_PRINT_DEBUG_INFO_TO_STDOUT,\n\n\t\t//! Never used, it only forces the compiler to compile these enumeration values to 32 bit.\n\t\t/** Don't use this. */\n\t\tESEO_FORCE_32_BIT = 0x7fffffff\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_ESoundOutputDrivers.h", "language": "code", "loc": 46, "comment_density": 0.63, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __E_IRRKLANG_SOUND_OUTPUT_DRIVERS_H_INCLUDED__\n#define __E_IRRKLANG_SOUND_OUTPUT_DRIVERS_H_INCLUDED__\n\nnamespace irrklang\n{\n\t//! An enumeration for all types of supported sound drivers\n\t/** Values of this enumeration can be used as parameter when calling createIrrKlangDevice(). */\n\tenum E_SOUND_OUTPUT_DRIVER\n\t{\n\t\t//! Autodetects the best sound driver for the system\n\t\tESOD_AUTO_DETECT = 0,\n\n\t\t//! DirectSound8 sound output driver, windows only. \n\t\t/** In contrast to ESOD_DIRECT_SOUND, this supports sophisticated sound effects\n\t\tbut may not be available on old windows versions. It behaves very similar \n\t\tto ESOD_DIRECT_SOUND but also supports DX8 sound effects.*/\n\t\tESOD_DIRECT_SOUND_8,\n\n\t\t//! DirectSound sound output driver, windows only.\n\t\t/** This uses DirectSound 3 or above, if available. If DX8 sound effects\n\t\tare needed, use ESOD_DIRECT_SOUND_8 instead. The \n\t\tESOD_DIRECT_SOUND driver may be available on more and older windows \n\t\tversions than ESOD_DIRECT_SOUND_8.*/\n\t\tESOD_DIRECT_SOUND,\n\n\t\t//! WinMM sound output driver, windows only.\n\t\t/** Supports the ISoundMixedOutputReceiver interface using setMixedDataOutputReceiver. */\n\t\tESOD_WIN_MM,\n\n\t\t//! ALSA sound output driver, linux only.\n\t\t/** When using ESOD_ALSA in createIrrKlangDevice(), it is possible to set the third parameter,\n\t\t'deviceID' to the name of specific ALSA pcm device, to the irrKlang force to use this one.\n\t\tSet it to 'default', or 'plug:hw' or whatever you need it to be. \n\t\tSupports the ISoundMixedOutputReceiver interface using setMixedDataOutputReceiver. */\n\t\tESOD_ALSA,\n\t\t\n\t\t//! Core Audio sound output driver, mac os only.\n\t\t/** Supports the ISoundMixedOutputReceiver interface using setMixedDataOutputReceiver. */\n\t\tESOD_CORE_AUDIO,\n\n\t\t//! Null driver, creating no sound output\n\t\tESOD_NULL,\n\n\t\t//! Amount of built-in sound output drivers\n\t\tESOD_COUNT,\n\n\t\t//! This enumeration literal is never used, it only forces the compiler to\n\t\t//! compile these enumeration values to 32 bit.\n\t\tESOD_FORCE_32_BIT = 0x7fffffff\n\t};\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_EStreamModes.h", "language": "code", "loc": 22, "comment_density": 0.455, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __E_IRRKLANG_STREAM_MODES_H_INCLUDED__\n#define __E_IRRKLANG_STREAM_MODES_H_INCLUDED__\n\nnamespace irrklang \n{\n\t//! An enumeration for all types of supported stream modes\n\tenum E_STREAM_MODE\n\t{\n\t\t//! Autodetects the best stream mode for a specified audio data.\n\t\tESM_AUTO_DETECT = 0,\n\n\t\t//! Streams the audio data when needed.\n\t\tESM_STREAMING,\n\n\t\t//! Loads the whole audio data into the memory.\n\t\tESM_NO_STREAMING,\n\n\t\t//! This enumeration literal is never used, it only forces the compiler to \n\t\t//! compile these enumeration values to 32 bit.\n\t\tESM_FORCE_32_BIT = 0x7fffffff\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IAudioRecorder.h", "language": "code", "loc": 89, "comment_density": 0.652, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_AUDIO_RECORDER_H_INCLUDED__\n#define __I_IRRKLANG_AUDIO_RECORDER_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_ISoundSource.h\"\n\n\nnamespace irrklang\n{\n\tclass ICapturedAudioDataReceiver;\n\n\t//! Interface to an audio recorder. Create it using the createIrrKlangAudioRecorder() function.\n\t/** It creates sound sources into an ISoundEngine which then can be played there. \n\tSee @ref recordingAudio for an example on how to use this. */\n\tclass IAudioRecorder : public virtual IRefCounted\n\t{\n\tpublic:\n\n\t\t//! Starts recording audio. \n\t\t/** Clears all possibly previously recorded buffered audio data and starts to record. \n\t\tWhen finished recording audio data, call stopRecordingAudio(). \n\t\tAll recorded audio data gets stored into an internal audio buffer, which\n\t\tcan then be accessed for example using addSoundSourceFromRecordedAudio() or\n\t\tgetRecordedAudioData(). For recording audio data not into an internal audio\n\t\tbuffer, use startRecordingCustomHandledAudio().\n\t\t\\param sampleRate: Sample rate of the recorded audio.\n\t\t\\param sampleFormat: Sample format of the recorded audio.\n\t\t\\param channelCount: Amount of audio channels.\n\t\t\\return Returns true if successfully started recording and false if not.*/\n\t\tvirtual bool startRecordingBufferedAudio(ik_s32 sampleRate=22000, \n\t\t ESampleFormat sampleFormat=ESF_S16,\n\t\t\t\t\t\t\t\t\t\t\t\t ik_s32 channelCount=1) = 0;\n\n\t\t//! Starts recording audio. \n\t\t/** Clears all possibly previously recorded buffered audio data and starts to record \n\t\taudio data, which is delivered to a custom user callback interface. \n\t\tWhen finished recording audio data, call stopRecordingAudio(). If instead of \n\t\trecording the data to the receiver interface recording into a managed buffer\n\t\tis wished, use startRecordingBufferedAudio() instead.\n\t\t\\param receiver: Interface to be implemented by the user, gets called once for each\n\t\tcaptured audio data chunk. \n\t\t\\param sampleRate: Sample rate of the recorded audio.\n\t\t\\param sampleFormat: Sample format of the recorded audio.\n\t\t\\param channelCount: Amount of audio channels.\n\t\t\\return Returns true if successfully started recording and false if not. */\n\t\tvirtual bool startRecordingCustomHandledAudio(ICapturedAudioDataReceiver* receiver,\n\t\t\t ik_s32 sampleRate=22000,\n\t\t\t\t\t\t\t\t\t\t\t\t\t ESampleFormat sampleFormat=ESF_S16,\n\t\t\t\t\t\t\t\t\t\t\t\t\t ik_s32 channelCount=1) = 0;\n\n\t\t//! Stops recording audio.\n\t\tvirtual void stopRecordingAudio() = 0;\n\n\t\t//! Creates a sound source for the recorded audio data.\n\t\t/** The returned sound source pointer then can be used to play back the recorded audio data\n\t\tusing ISoundEngine::play2D(). This method only will succeed if the audio was recorded using\n\t\tstartRecordingBufferedAudio() and audio recording is currently stopped.\n\t\t\\param soundName Name of the virtual sound file (e.g. \"someRecordedAudio\"). You can also use this\n\t\tname when calling play3D() or play2D(). */\n\t\tvirtual ISoundSource* addSoundSourceFromRecordedAudio(const char* soundName) = 0;\n\n\t\t//! Clears recorded audio data buffer, freeing memory.\n\t\t/** This method will only succeed if audio recording is currently stopped. */\n\t\tvirtual void clearRecordedAudioDataBuffer() = 0;\n\n\t\t//! Returns if the recorder is currently recording audio.\n\t\tvirtual bool isRecording() = 0;\n\n\t\t//! Returns the audio format of the recorded audio data. \n\t\t/** Also contains informations about the length of the recorded audio stream. */\n\t\tvirtual SAudioStreamFormat getAudioFormat() = 0;\n\n\t\t//! Returns a pointer to the recorded audio data.\n\t\t/** This method will only succeed if audio recording is currently stopped and\n\t\tsomething was recorded previously using startRecordingBufferedAudio(). \n\t\tThe length of the buffer can be retrieved using \n\t\tgetAudioFormat().getSampleDataSize(). Note that the pointer is only valid\n\t\tas long as not clearRecordedAudioDataBuffer() is called or another sample is\n\t\trecorded.*/\n\t\tvirtual void* getRecordedAudioData() = 0;\n\n\t\t//! returns the name of the sound driver, like 'ALSA' for the alsa device.\n\t\t/** Possible returned strings are \"NULL\", \"ALSA\", \"CoreAudio\", \"winMM\", \n\t\t\"DirectSound\" and \"DirectSound8\". */\n\t\tvirtual const char* getDriverName() = 0;\n\t};\n\n\n\t//! Interface to be implemented by the user if access to the recorded audio data is needed.\n\t/** Is used as parameter in IAudioRecorder::startRecordingCustomHandledAudio. */\n\tclass ICapturedAudioDataReceiver : public IRefCounted\n\t{\n\tpublic:\n\n\t\t//! Gets called once for each captured audio data chunk.\n\t\t/** See IAudioRecorder::startRecordingCustomHandledAudio for details.\n\t\t\\param audioData: Pointer to a part of the recorded audio data\n\t\t\\param lengthInBytes: Amount of bytes in the audioData buffer.*/\n\t\tvirtual void OnReceiveAudioDataStreamChunk(unsigned char* audioData, unsigned long lengthInBytes) = 0;\n\t};\n\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_IAudioStream.h", "language": "code", "loc": 35, "comment_density": 0.543, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_AUDIO_STREAM_H_INCLUDED__\n#define __I_IRRKLANG_AUDIO_STREAM_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_SAudioStreamFormat.h\"\n\nnamespace irrklang\n{\n\n\n//!\tReads and decodes audio data into an usable audio stream for the ISoundEngine\nclass IAudioStream : public IRefCounted\n{\npublic:\n\n\t//! destructor\n\tvirtual ~IAudioStream() {};\n\n\t//! returns format of the audio stream\n\tvirtual SAudioStreamFormat getFormat() = 0;\n\n\t//! sets the position of the audio stream.\n\t/** For example to let the stream be read from the beginning of the file again, \n\tsetPosition(0) would be called. This is usually done be the sound engine to\n\tloop a stream after if has reached the end. Return true if successful and 0 if not. \n\t\\param pos: Position in frames.*/\n\tvirtual bool setPosition(ik_s32 pos) = 0;\n\n\t//! returns true if the audio stream is seekable\n\t/* Some file formats like (MODs) don't support seeking */\n\tvirtual bool getIsSeekingSupported() { return true; }\n\n //! tells the audio stream to read frameCountToRead audio frames into the specified buffer\n\t/** \\param target: Target data buffer to the method will write the read frames into. The\n\tspecified buffer will be at least getFormat().getFrameSize()*frameCountToRead bytes big.\n\t\\param frameCountToRead: amount of frames to be read.\n\t\\returns Returns amount of frames really read. Should be frameCountToRead in most cases. */\n\tvirtual ik_s32 readFrames(void* target, ik_s32 frameCountToRead) = 0;\n};\n\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IAudioStreamLoader.h", "language": "code", "loc": 28, "comment_density": 0.464, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_AUDIO_STREAM_LOADER_H_INCLUDED__\n#define __I_IRRKLANG_AUDIO_STREAM_LOADER_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_IFileReader.h\"\n\nnamespace irrklang\n{\n\nclass IAudioStream;\n\n//!\tClass which is able to create an audio file stream from a file.\nclass IAudioStreamLoader : public IRefCounted\n{\npublic:\n\n\t//! destructor\n\tvirtual ~IAudioStreamLoader() {};\n\n\t//! Returns true if the file maybe is able to be loaded by this class.\n\t/** This decision should be based only on the file extension (e.g. \".wav\"). The given\n\tfilename string is guaranteed to be lower case. */\n\tvirtual bool isALoadableFileExtension(const ik_c8* fileName) = 0;\n\n\t//! Creates an audio file input stream from a file\n\t/** \\return Pointer to the created audio stream. Returns 0 if loading failed.\n\tIf you no longer need the stream, you should call IAudioFileStream::drop().\n\tSee IRefCounted::drop() for more information. */\n\tvirtual IAudioStream* createAudioStream(IFileReader* file) = 0;\n};\n\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IFileFactory.h", "language": "code", "loc": 32, "comment_density": 0.594, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_FILE_FACTORY_H_INCLUDED__\n#define __I_IRRKLANG_FILE_FACTORY_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n\nnamespace irrklang\n{\n\tclass IFileReader;\n\n\t//! Interface to overwrite file access in irrKlang.\n\t/** Derive your own class from IFileFactory, overwrite the createFileReader()\n\t\tmethod and return your own implemented IFileReader to overwrite file access of irrKlang.\n\t\tUse ISoundEngine::addFileFactory() to let irrKlang know about your class.\n\t\tExample code can be found in the tutorial 04.OverrideFileAccess.\n\t */\n\tclass IFileFactory : public virtual IRefCounted\n\t{\n\tpublic:\n\n\t\tvirtual ~IFileFactory() {};\n\n\t\t//! Opens a file for read access.\n\t\t/** Derive your own class from IFileFactory, overwrite this\n\t\tmethod and return your own implemented IFileReader to overwrite file access of irrKlang.\n\t\tUse ISoundEngine::addFileFactory() to let irrKlang know about your class.\n\t\tExample code can be found in the tutorial 04.OverrideFileAccess.\n\t\t\\param filename Name of file to open.\n\t\t\\return Returns a pointer to the created file interface.\n\t\tThe returned pointer should be dropped when no longer needed.\n\t\tSee IRefCounted::drop() for more information. Returns 0 if file cannot be opened. */\n\t\tvirtual IFileReader* createFileReader(const ik_c8* filename) = 0;\t\t\n\t};\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IFileReader.h", "language": "code", "loc": 37, "comment_density": 0.568, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_READ_FILE_H_INCLUDED__\n#define __I_IRRKLANG_READ_FILE_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n\nnamespace irrklang\n{\n\n\t//! Interface providing read access to a file.\n\tclass IFileReader : public virtual IRefCounted\n\t{\n\tpublic:\n\n\t\tvirtual ~IFileReader() {};\n\n\t\t//! Reads an amount of bytes from the file.\n\t\t//! \\param buffer: Pointer to buffer where to read bytes will be written to.\n\t\t//! \\param sizeToRead: Amount of bytes to read from the file.\n\t\t//! \\return Returns how much bytes were read.\n\t\tvirtual ik_s32 read(void* buffer, ik_u32 sizeToRead) = 0;\n\n\t\t//! Changes position in file, returns true if successful.\n\t\t//! \\param finalPos: Destination position in the file.\n\t\t//! \\param relativeMovement: If set to true, the position in the file is\n\t\t//! changed relative to current position. Otherwise the position is changed \n\t\t//! from beginning of file.\n\t\t//! \\return Returns true if successful, otherwise false.\n\t\tvirtual bool seek(ik_s32 finalPos, bool relativeMovement = false) = 0;\n\n\t\t//! Returns size of file.\n\t\t//! \\return Returns the size of the file in bytes.\n\t\tvirtual ik_s32 getSize() = 0;\n\n\t\t//! Returns the current position in the file.\n\t\t//! \\return Returns the current position in the file in bytes.\n\t\tvirtual ik_s32 getPos() = 0;\n\n\t\t//! Returns name of file.\n\t\t//! \\return Returns the file name as zero terminated character string.\n\t\tvirtual const ik_c8* getFileName() = 0;\n\t};\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IRefCounted.h", "language": "code", "loc": 101, "comment_density": 0.703, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_IREFERENCE_COUNTED_H_INCLUDED__\n#define __I_IRRKLANG_IREFERENCE_COUNTED_H_INCLUDED__\n\n#include \"ik_irrKlangTypes.h\"\n\nnamespace irrklang\n{\n\t//! Base class of most objects of the irrKlang.\n\t/** This class provides reference counting through the methods grab() and drop().\n\tIt also is able to store a debug string for every instance of an object.\n\tMost objects of irrKlang are derived from IRefCounted, and so they are reference counted.\n\n\tWhen you receive an object in irrKlang (for example an ISound using play2D() or\n\tplay3D()), and you no longer need the object, you have \n\tto call drop(). This will destroy the object, if grab() was not called\n\tin another part of you program, because this part still needs the object.\n\tNote, that you only don't need to call drop() for all objects you receive, it\n\twill be explicitly noted in the documentation.\n\n\tA simple example:\n\n\tIf you want to play a sound, you may want to call the method\n\tISoundEngine::play2D. You call\n\tISound* mysound = engine->play2D(\"foobar.mp3\", false, false true);\n\tIf you no longer need the sound interface, call mysound->drop(). The \n\tsound may still play on after this because the engine still has a reference\n\tto that sound, but you can be sure that it's memory will be released as soon\n\tthe sound is no longer used.\n\n\tIf you want to add a sound source, you may want to call a method\n\tISoundEngine::addSoundSourceFromFile. You do this like\n\tISoundSource* mysource = engine->addSoundSourceFromFile(\"example.jpg\");\n\tYou will not have to drop the pointer to the source, because\n\tsound sources are managed by the engine (it will live as long as the sound engine) and\n\tthe documentation says so. \n\t*/\n\tclass IRefCounted\n\t{\n\tpublic:\n\n\t\t//! Constructor.\n\t\tIRefCounted()\n\t\t\t: ReferenceCounter(1)\n\t\t{\n\t\t}\n\n\t\t//! Destructor.\n\t\tvirtual ~IRefCounted()\n\t\t{\n\t\t}\n\n\t\t//! Grabs the object. Increments the reference counter by one.\n\t\t//! Someone who calls grab() to an object, should later also call\n\t\t//! drop() to it. If an object never gets as much drop() as grab()\n\t\t//! calls, it will never be destroyed.\n\t\t//! The IRefCounted class provides a basic reference counting mechanism\n\t\t//! with its methods grab() and drop(). Most objects of irrklang\n\t\t//! are derived from IRefCounted, and so they are reference counted.\n\t\t//!\n\t\t//! When you receive an object in irrKlang (for example an ISound using play2D() or\n\t\t//! play3D()), and you no longer need the object, you have \n\t\t//! to call drop(). This will destroy the object, if grab() was not called\n\t\t//! in another part of you program, because this part still needs the object.\n\t\t//! Note, that you only don't need to call drop() for all objects you receive, it\n\t\t//! will be explicitly noted in the documentation.\n\t\t//! \n\t\t//! A simple example:\n\t\t//! \n\t\t//! If you want to play a sound, you may want to call the method\n\t\t//! ISoundEngine::play2D. You call\n\t\t//! ISound* mysound = engine->play2D(\"foobar.mp3\", false, false true);\n\t\t//! If you no longer need the sound interface, call mysound->drop(). The \n\t\t//! sound may still play on after this because the engine still has a reference\n\t\t//! to that sound, but you can be sure that it's memory will be released as soon\n\t\t//! the sound is no longer used.\n\t\tvoid grab() { ++ReferenceCounter; }\n\n\t\t//! When you receive an object in irrKlang (for example an ISound using play2D() or\n\t\t//! play3D()), and you no longer need the object, you have \n\t\t//! to call drop(). This will destroy the object, if grab() was not called\n\t\t//! in another part of you program, because this part still needs the object.\n\t\t//! Note, that you only don't need to call drop() for all objects you receive, it\n\t\t//! will be explicitly noted in the documentation.\n\t\t//! \n\t\t//! A simple example:\n\t\t//! \n\t\t//! If you want to play a sound, you may want to call the method\n\t\t//! ISoundEngine::play2D. You call\n\t\t//! ISound* mysound = engine->play2D(\"foobar.mp3\", false, false true);\n\t\t//! If you no longer need the sound interface, call mysound->drop(). The \n\t\t//! sound may still play on after this because the engine still has a reference\n\t\t//! to that sound, but you can be sure that it's memory will be released as soon\n\t\t//! the sound is no longer used.\n\t\tbool drop()\n\t\t{\n\t\t\t--ReferenceCounter;\n\n\t\t\tif (!ReferenceCounter)\n\t\t\t{\n\t\t\t\tdelete this;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\tprivate:\n\n\t\tik_s32\tReferenceCounter;\n\t};\n\n} // end namespace irr\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_ISound.h", "language": "code", "loc": 160, "comment_density": 0.75, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_H_INCLUDED__\n\n#include \"ik_IVirtualRefCounted.h\"\n#include \"ik_ISoundEffectControl.h\"\n#include \"ik_vec3d.h\"\n\n\nnamespace irrklang\n{\n\tclass ISoundSource;\n\tclass ISoundStopEventReceiver;\n\n\t//! Represents a sound which is currently played.\n\t/** The sound can be stopped, its volume or pan changed, effects added/removed\n\tand similar using this interface.\n\tCreating sounds is done using ISoundEngine::play2D() or ISoundEngine::play3D(). \n\tMore informations about the source of a sound can be obtained from the ISoundSource\n\tinterface. */\n\tclass ISound : public IVirtualRefCounted\n\t{\n\tpublic:\n\n\t\t//! returns source of the sound which stores the filename and other informations about that sound\n\t\t/** \\return Returns the sound source pointer of this sound. May return 0 if the sound source\n\t\thas been removed.*/\n\t\tvirtual ISoundSource* getSoundSource() = 0;\n\n\t\t//! returns if the sound is paused\n\t\tvirtual void setIsPaused( bool paused = true) = 0;\n\n\t\t//! returns if the sound is paused\n\t\tvirtual bool getIsPaused() = 0;\n\n\t\t//! Will stop the sound and free its resources.\n\t\t/** If you just want to pause the sound, use setIsPaused().\n\t\tAfter calling stop(), isFinished() will usually return true. \n\t\tBe sure to also call ->drop() once you are done.*/\n\t\tvirtual void stop() = 0;\n\n\t\t//! returns volume of the sound, a value between 0 (mute) and 1 (full volume).\n\t\t/** (this volume gets multiplied with the master volume of the sound engine\n\t\tand other parameters like distance to listener when played as 3d sound) */\n\t\tvirtual ik_f32 getVolume() = 0;\n\n\t\t//! sets the volume of the sound, a value between 0 (mute) and 1 (full volume).\n\t\t/** This volume gets multiplied with the master volume of the sound engine\n\t\tand other parameters like distance to listener when played as 3d sound. */\n\t\tvirtual void setVolume(ik_f32 volume) = 0;\n\n\t\t//! sets the pan of the sound. Takes a value between -1 and 1, 0 is center.\n\t\tvirtual void setPan(ik_f32 pan) = 0;\n\n\t\t//! returns the pan of the sound. Takes a value between -1 and 1, 0 is center.\n\t\tvirtual ik_f32 getPan() = 0;\n\n\t\t//! returns if the sound has been started to play looped\n\t\tvirtual bool isLooped() = 0;\n\n\t\t//! changes the loop mode of the sound. \n\t\t/** If the sound is playing looped and it is changed to not-looped, then it \n\t\twill stop playing after the loop has finished. \n\t\tIf it is not looped and changed to looped, the sound will start repeating to be \n\t\tplayed when it reaches its end. \n\t\tInvoking this method will not have an effect when the sound already has stopped. */\n\t\tvirtual void setIsLooped(bool looped) = 0;\n\n\t\t//! returns if the sound has finished playing.\n\t\t/** Don't mix this up with isPaused(). isFinished() returns if the sound has been\n\t\tfinished playing. If it has, is maybe already have been removed from the playing list of the\n\t\tsound engine and calls to any other of the methods of ISound will not have any result.\n\t\tIf you call stop() to a playing sound will result that this function will return true\n\t\twhen invoked. */\n\t\tvirtual bool isFinished() = 0;\n\n\t\t//! Sets the minimal distance if this is a 3D sound.\n\t\t/** Changes the distance at which the 3D sound stops getting louder. This works\n\t\tlike this: As a listener approaches a 3D sound source, the sound gets louder.\n\t\tPast a certain point, it is not reasonable for the volume to continue to increase.\n\t\tEither the maximum (zero) has been reached, or the nature of the sound source\n\t\timposes a logical limit. This is the minimum distance for the sound source.\n\t\tSimilarly, the maximum distance for a sound source is the distance beyond\n\t\twhich the sound does not get any quieter.\n\t\tThe default minimum distance is 1, the default max distance is a huge number like 1000000000.0f. */\n\t\tvirtual void setMinDistance(ik_f32 min) = 0;\n\n\t\t//! Returns the minimal distance if this is a 3D sound.\n\t\t/** See setMinDistance() for details. */\n\t\tvirtual ik_f32 getMinDistance() = 0;\n\n\t\t//! Sets the maximal distance if this is a 3D sound.\n\t\t/** Changing this value is usually not necessary. Use setMinDistance() instead.\n\t\tDon't change this value if you don't know what you are doing: This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setMinDistance()) to influence this.\n\t\tThe maximum distance for a sound source is the distance beyond which the sound does not get any quieter.\n\t\tThe default minimum distance is 1, the default max distance is a huge number like 1000000000.0f. */\n\t\tvirtual void setMaxDistance(ik_f32 max) = 0;\n\n\t\t//! Returns the maximal distance if this is a 3D sound.\n\t\t/** See setMaxDistance() for details. */\n\t\tvirtual ik_f32 getMaxDistance() = 0;\n\n\t\t//! sets the position of the sound in 3d space\n\t\tvirtual void setPosition(vec3df position) = 0;\n\n\t\t//! returns the position of the sound in 3d space\n\t\tvirtual vec3df getPosition() = 0;\n\n\t\t//! sets the position of the sound in 3d space, needed for Doppler effects.\n\t\t/** To use doppler effects use ISound::setVelocity to set a sounds velocity, \n\t\tISoundEngine::setListenerPosition() to set the listeners velocity and \n\t\tISoundEngine::setDopplerEffectParameters() to adjust two parameters influencing \n\t\tthe doppler effects intensity. */\n\t\tvirtual void setVelocity(vec3df vel) = 0;\n\n\t\t//! returns the velocity of the sound in 3d space, needed for Doppler effects.\n\t\t/** To use doppler effects use ISound::setVelocity to set a sounds velocity, \n\t\tISoundEngine::setListenerPosition() to set the listeners velocity and \n\t\tISoundEngine::setDopplerEffectParameters() to adjust two parameters influencing \n\t\tthe doppler effects intensity. */\n\t\tvirtual vec3df getVelocity() = 0;\n\n\t\t//! returns the current play position of the sound in milliseconds.\n\t\t/** \\return Returns -1 if not implemented or possible for this sound for example\n\t\tbecause it already has been stopped and freed internally or similar. */\n\t\tvirtual ik_u32 getPlayPosition() = 0;\n\n\t\t//! sets the current play position of the sound in milliseconds.\n /** \\param pos Position in milliseconds. Must be between 0 and the value returned\n\t\tby getPlayPosition().\n\t\t\\return Returns true successful. False is returned for example if the sound already finished\n\t\tplaying and is stopped or the audio source is not seekable, for example if it \n\t\tis an internet stream or a a file format not supporting seeking (a .MOD file for example).\n\t\tA file can be tested if it can bee seeking using ISoundSource::getIsSeekingSupported(). */\n\t\tvirtual bool setPlayPosition(ik_u32 pos) = 0;\n\n\t\t//! Sets the playback speed (frequency) of the sound.\n\t\t/** Plays the sound at a higher or lower speed, increasing or decreasing its\n\t\tfrequency which makes it sound lower or higher.\n\t\tNote that this feature is not available on all sound output drivers (it is on the\n\t\tDirectSound drivers at least), and it does not work together with the \n\t\t'enableSoundEffects' parameter of ISoundEngine::play2D and ISoundEngine::play3D when\n\t\tusing DirectSound.\n\t\t\\param speed Factor of the speed increase or decrease. 2 is twice as fast, \n\t\t0.5 is only half as fast. The default is 1.0.\n\t\t\\return Returns true if successful, false if not. The current sound driver might not\n\t\tsupport changing the playBack speed, or the sound was started with the \n\t\t'enableSoundEffects' parameter. */\n\t\tvirtual bool setPlaybackSpeed(ik_f32 speed = 1.0f) = 0;\n\n\t\t//! Returns the playback speed set by setPlaybackSpeed(). Default: 1.0f.\n\t\t/** See setPlaybackSpeed() for details */\n\t\tvirtual ik_f32 getPlaybackSpeed() = 0;\n\n\t\t//! returns the play length of the sound in milliseconds.\n\t\t/** Returns -1 if not known for this sound for example because its decoder\n\t\tdoes not support length reporting or it is a file stream of unknown size.\n\t\tNote: You can also use ISoundSource::getPlayLength() to get the length of \n\t\ta sound without actually needing to play it. */\n\t\tvirtual ik_u32 getPlayLength() = 0;\n\n\t\t//! Returns the sound effect control interface for this sound.\n\t\t/** Sound effects such as Chorus, Distortions, Echo, Reverb and similar can\n\t\tbe controlled using this. The interface pointer is only valid as long as the ISound pointer is valid.\n\t\tIf the ISound pointer gets dropped (IVirtualRefCounted::drop()), the ISoundEffects\n\t\tmay not be used any more. \n\t\t\\return Returns a pointer to the sound effects interface if available. The sound\n\t\thas to be started via ISoundEngine::play2D() or ISoundEngine::play3D(),\n\t\twith the flag enableSoundEffects=true, otherwise 0 will be returned. Note that\n\t\tif the output driver does not support sound effects, 0 will be returned as well.*/\n\t\tvirtual ISoundEffectControl* getSoundEffectControl() = 0;\n\n\t\t//! Sets the sound stop event receiver, an interface which gets called if a sound has finished playing.\n\t\t/** This event is guaranteed to be called when the sound or sound stream is finished,\n\t\teither because the sound reached its playback end, its sound source was removed,\n\t\tISoundEngine::stopAllSounds() has been called or the whole engine was deleted.\n\t\tThere is an example on how to use events in irrklang at @ref events .\n\t\t\\param receiver Interface to a user implementation of the sound receiver. This interface\n\t\tshould be as long valid as the sound exists or another stop event receiver is set.\n\t\tSet this to null to set no sound stop event receiver.\n\t\t\\param userData: A iser data pointer, can be null. */\n\t\tvirtual void setSoundStopEventReceiver(ISoundStopEventReceiver* receiver, void* userData=0) = 0;\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_ISoundDeviceList.h", "language": "code", "loc": 30, "comment_density": 0.567, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_DEVICE_LIST_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_DEVICE_LIST_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n\nnamespace irrklang\n{\n\n//!\tA list of sound devices for a sound driver. Use irrklang::createSoundDeviceList() to create this list.\n/** The function createIrrKlangDevice() has a parameter 'deviceID' which takes the value returned by\nISoundDeviceList::getDeviceID() and uses that device then. \nThe list of devices in ISoundDeviceList usually also includes the default device which is the first\nentry and has an empty deviceID string (\"\") and the description \"default device\". \nThere is some example code on how to use the ISoundDeviceList in @ref enumeratingDevices.*/\nclass ISoundDeviceList : public IRefCounted\n{\npublic:\n\n\t//! Returns amount of enumerated devices in the list.\n\tvirtual ik_s32 getDeviceCount() = 0;\n\n\t//! Returns the ID of the device. Use this string to identify this device in createIrrKlangDevice().\n\t/** \\param index Index of the device, a value between 0 and ISoundDeviceList::getDeviceCount()-1. \n\t\\return Returns a pointer to a string identifying the device. The string will only as long valid \n\tas long as the ISoundDeviceList exists. */\n\tvirtual const char* getDeviceID(ik_s32 index) = 0;\n\n\t//! Returns description of the device.\n\t/** \\param index Index of the device, a value between 0 and ISoundDeviceList::getDeviceCount()-1. */\n\tvirtual const char* getDeviceDescription(ik_s32 index) = 0;\n};\n\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_ISoundEffectControl.h", "language": "code", "loc": 208, "comment_density": 0.615, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_EFFECT_CONTROL_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_EFFECT_CONTROL_H_INCLUDED__\n\n#include \"ik_IVirtualRefCounted.h\"\n#include \"ik_vec3d.h\"\n\n\nnamespace irrklang\n{\n\t//! Interface to control the active sound effects (echo, reverb,...) of an ISound object, a playing sound.\n\t/** Sound effects such as chorus, distortions, echo, reverb and similar can\n\tbe controlled using this. An instance of this interface can be obtained via\n\tISound::getSoundEffectControl(). The sound containing this interface has to be started via \n\tISoundEngine::play2D() or ISoundEngine::play3D() with the flag enableSoundEffects=true, \n\totherwise no access to this interface will be available.\n\tFor the DirectSound driver, these are effects available since DirectSound8. For most \n\teffects, sounds should have a sample rate of 44 khz and should be at least\n\t150 milli seconds long for optimal quality when using the DirectSound driver.\n\tNote that the interface pointer is only valid as long as\n\tthe ISound pointer is valid. If the ISound pointer gets dropped (IVirtualRefCounted::drop()),\n\tthe ISoundEffects may not be used any more. */\n\tclass ISoundEffectControl\n\t{\n\tpublic:\n\n\t\t//! Disables all active sound effects\n\t\tvirtual void disableAllEffects() = 0;\n\n\t\t//! Enables the chorus sound effect or adjusts its values.\n\t\t/** Chorus is a voice-doubling effect created by echoing the\n\t\toriginal sound with a slight delay and slightly modulating the delay of the echo. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fWetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fDepth Percentage by which the delay time is modulated by the low-frequency oscillator, in hundredths of a percentage point. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fFeedback Percentage of output signal to feed back into the effect's input. Minimal Value:-99, Maximal Value:99.0f;\n\t\t\\param fFrequency Frequency of the LFO. Minimal Value:0, Maximal Value:10.0f;\n\t\t\\param sinusWaveForm True for sinus wave form, false for triangle.\n\t\t\\param fDelay Number of milliseconds the input is delayed before it is played back. Minimal Value:0, Maximal Value:20.0f;\n\t\t\\param lPhase Phase differential between left and right LFOs. Possible values:\n\t\t\t-180, -90, 0, 90, 180\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableChorusSoundEffect(ik_f32 fWetDryMix = 50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fDepth = 10,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFeedback = 25,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFrequency = 1.1,\n\t\t\t\t\t\t\t\t\t\t\tbool sinusWaveForm = true,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fDelay = 16,\n\t\t\t\t\t\t\t\t\t\t\tik_s32 lPhase = 90) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableChorusSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isChorusSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Compressor sound effect or adjusts its values.\n\t\t/** Compressor is a reduction in the fluctuation of a signal above a certain amplitude. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fGain Output gain of signal after Compressor. Minimal Value:-60, Maximal Value:60.0f;\n\t\t\\param fAttack Time before Compressor reaches its full value. Minimal Value:0.01, Maximal Value:500.0f;\n\t\t\\param fRelease Speed at which Compressor is stopped after input drops below fThreshold. Minimal Value:50, Maximal Value:3000.0f;\n\t\t\\param fThreshold Point at which Compressor begins, in decibels. Minimal Value:-60, Maximal Value:0.0f;\n\t\t\\param fRatio Compressor ratio. Minimal Value:1, Maximal Value:100.0f;\n\t\t\\param fPredelay Time after lThreshold is reached before attack phase is started, in milliseconds. Minimal Value:0, Maximal Value:4.0f;\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableCompressorSoundEffect( ik_f32 fGain = 0,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fAttack = 10,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fRelease = 200,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fThreshold = -20,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fRatio = 3,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fPredelay = 4) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableCompressorSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isCompressorSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Distortion sound effect or adjusts its values.\n\t\t/** Distortion is achieved by adding harmonics to the signal in such a way that,\n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\tas the level increases, the top of the waveform becomes squared off or clipped.\n\t\t\\param fGain Amount of signal change after distortion. Minimal Value:-60, Maximal Value:0;\n\t\t\\param fEdge Percentage of distortion intensity. Minimal Value:0, Maximal Value:100;\n\t\t\\param fPostEQCenterFrequency Center frequency of harmonic content addition. Minimal Value:100, Maximal Value:8000;\n\t\t\\param fPostEQBandwidth Width of frequency band that determines range of harmonic content addition. Minimal Value:100, Maximal Value:8000;\n\t\t\\param fPreLowpassCutoff Filter cutoff for high-frequency harmonics attenuation. Minimal Value:100, Maximal Value:8000;\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableDistortionSoundEffect(ik_f32 fGain = -18,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fEdge = 15,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fPostEQCenterFrequency = 2400,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fPostEQBandwidth = 2400,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fPreLowpassCutoff = 8000) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableDistortionSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isDistortionSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Echo sound effect or adjusts its values.\n\t\t/** An echo effect causes an entire sound to be repeated after a fixed delay.\n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fWetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fFeedback Percentage of output fed back into input. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fLeftDelay Delay for left channel, in milliseconds. Minimal Value:1, Maximal Value:2000.0f;\n\t\t\\param fRightDelay Delay for right channel, in milliseconds. Minimal Value:1, Maximal Value:2000.0f;\n\t\t\\param lPanDelay Value that specifies whether to swap left and right delays with each successive echo. Minimal Value:0, Maximal Value:1;\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableEchoSoundEffect(ik_f32 fWetDryMix = 50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFeedback = 50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fLeftDelay = 500,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fRightDelay = 500,\n\t\t\t\t\t\t\t\t\t\t\tik_s32 lPanDelay = 0) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableEchoSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isEchoSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Flanger sound effect or adjusts its values.\n\t\t/** Flange is an echo effect in which the delay between the original \n\t\tsignal and its echo is very short and varies over time. The result is \n\t\tsometimes referred to as a sweeping sound. The term flange originated\n\t\twith the practice of grabbing the flanges of a tape reel to change the speed. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fWetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fDepth Percentage by which the delay time is modulated by the low-frequency oscillator, in hundredths of a percentage point. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fFeedback Percentage of output signal to feed back into the effect's input. Minimal Value:-99, Maximal Value:99.0f;\n\t\t\\param fFrequency Frequency of the LFO. Minimal Value:0, Maximal Value:10.0f;\n\t\t\\param triangleWaveForm True for triangle wave form, false for square.\n\t\t\\param fDelay Number of milliseconds the input is delayed before it is played back. Minimal Value:0, Maximal Value:20.0f;\n\t\t\\param lPhase Phase differential between left and right LFOs. Possible values:\n\t\t\t-180, -90, 0, 90, 180\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableFlangerSoundEffect(ik_f32 fWetDryMix = 50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fDepth = 100,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFeedback = -50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFrequency = 0.25f,\n\t\t\t\t\t\t\t\t\t\t\tbool triangleWaveForm = true,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fDelay = 2,\n\t\t\t\t\t\t\t\t\t\t\tik_s32 lPhase = 0) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableFlangerSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isFlangerSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Gargle sound effect or adjusts its values.\n\t\t/** The gargle effect modulates the amplitude of the signal. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param rateHz Rate of modulation, in Hertz. Minimal Value:1, Maximal Value:1000\n\t\t\\param sinusWaveForm True for sinus wave form, false for triangle.\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableGargleSoundEffect(ik_s32 rateHz = 20, bool sinusWaveForm = true) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableGargleSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isGargleSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Interactive 3D Level 2 reverb sound effect or adjusts its values.\n\t\t/** An implementation of the listener properties in the I3DL2 specification. Source properties are not supported.\n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param lRoom Attenuation of the room effect, in millibels (mB). Interval: [-10000, 0] Default: -1000 mB\n\t\t\\param lRoomHF Attenuation of the room high-frequency effect. Interval: [-10000, 0] default: 0 mB\n\t\t\\param flRoomRolloffFactor Rolloff factor for the reflected signals. Interval: [0.0, 10.0] default: 0.0\n\t\t\\param flDecayTime Decay time, in seconds. Interval: [0.1, 20.0] default: 1.49s\n\t\t\\param flDecayHFRatio Ratio of the decay time at high frequencies to the decay time at low frequencies. Interval: [0.1, 2.0] default: 0.83\n\t\t\\param lReflections Attenuation of early reflections relative to lRoom. Interval: [-10000, 1000] default: -2602 mB\n\t\t\\param flReflectionsDelay Delay time of the first reflection relative to the direct path in seconds. Interval: [0.0, 0.3] default: 0.007 s\n\t\t\\param lReverb Attenuation of late reverberation relative to lRoom, in mB. Interval: [-10000, 2000] default: 200 mB\n\t\t\\param flReverbDelay Time limit between the early reflections and the late reverberation relative to the time of the first reflection. Interval: [0.0, 0.1] default: 0.011 s\n\t\t\\param flDiffusion Echo density in the late reverberation decay in percent. Interval: [0.0, 100.0] default: 100.0 %\n\t\t\\param flDensity Modal density in the late reverberation decay, in percent. Interval: [0.0, 100.0] default: 100.0 %\n\t\t\\param flHFReference Reference high frequency, in hertz. Interval: [20.0, 20000.0] default: 5000.0 Hz \n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableI3DL2ReverbSoundEffect(ik_s32 lRoom = -1000,\n\t\t\t\t\t\t\t\t\t\t\t\tik_s32 lRoomHF = -100,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flRoomRolloffFactor = 0,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flDecayTime = 1.49f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flDecayHFRatio = 0.83f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_s32 lReflections = -2602,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flReflectionsDelay = 0.007f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_s32 lReverb = 200,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flReverbDelay = 0.011f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flDiffusion = 100.0f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flDensity = 100.0f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flHFReference = 5000.0f ) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableI3DL2ReverbSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isI3DL2ReverbSoundEffectEnabled() = 0;\n\n\t\t//! Enables the ParamEq sound effect or adjusts its values.\n\t\t/** Parametric equalizer amplifies or attenuates signals of a given frequency. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fCenter Center frequency, in hertz, The default value is 8000. Minimal Value:80, Maximal Value:16000.0f\n\t\t\\param fBandwidth Bandwidth, in semitones, The default value is 12. Minimal Value:1.0f, Maximal Value:36.0f\n\t\t\\param fGain Gain, default value is 0. Minimal Value:-15.0f, Maximal Value:15.0f\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableParamEqSoundEffect(ik_f32 fCenter = 8000,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fBandwidth = 12,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fGain = 0) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableParamEqSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isParamEqSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Waves Reverb sound effect or adjusts its values.\n\t\t/** \\param fInGain Input gain of signal, in decibels (dB). Min/Max: [-96.0,0.0] Default: 0.0 dB.\n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fReverbMix Reverb mix, in dB. Min/Max: [-96.0,0.0] Default: 0.0 dB\n\t\t\\param fReverbTime Reverb time, in milliseconds. Min/Max: [0.001,3000.0] Default: 1000.0 ms\n\t\t\\param fHighFreqRTRatio High-frequency reverb time ratio. Min/Max: [0.001,0.999] Default: 0.001 \n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableWavesReverbSoundEffect(ik_f32 fInGain = 0,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fReverbMix = 0,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fReverbTime = 1000,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fHighFreqRTRatio = 0.001f) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableWavesReverbSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isWavesReverbSoundEffectEnabled() = 0;\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_ISoundEngine.h", "language": "code", "loc": 383, "comment_density": 0.773, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_ENGINE_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_ENGINE_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_vec3d.h\"\n#include \"ik_ISoundSource.h\"\n#include \"ik_ISound.h\"\n#include \"ik_EStreamModes.h\"\n#include \"ik_IFileFactory.h\"\n#include \"ik_ISoundMixedOutputReceiver.h\"\n\n\nnamespace irrklang\n{\n\tclass IAudioStreamLoader;\n\tstruct SInternalAudioInterface;\n\n\t//! Interface to the sound engine, for playing 3d and 2d sound and music.\n\t/** This is the main interface of irrKlang. You usually would create this using\n\tthe createIrrKlangDevice() function. \n\t*/\n\tclass ISoundEngine : public virtual irrklang::IRefCounted\n\t{\n\tpublic:\n\n\t\t//! returns the name of the sound driver, like 'ALSA' for the alsa device\n\t\t/** Possible returned strings are \"NULL\", \"ALSA\", \"CoreAudio\", \"winMM\", \n\t\t\"DirectSound\" and \"DirectSound8\". */\n\t\tvirtual const char* getDriverName() = 0;\n\n\t\t//! loads a sound source (if not loaded already) from a file and plays it.\n\t\t/** \\param sourceFileName Filename of sound, like \"sounds/test.wav\" or \"foobar.ogg\".\n\t\t \\param playLooped plays the sound in loop mode. If set to 'false', the sound is played once, then stopped and deleted from the internal playing list. Calls to\n\t\t ISound have no effect after such a non looped sound has been stopped automatically.\n\t\t \\param startPaused starts the sound paused. This implies that track=true. Use this if you want to modify some of the playing\n\t\t parameters before the sound actually plays. Usually you would set this parameter to true, then use the ISound interface to\n\t\t modify some of the sound parameters and then call ISound::setPaused(false);\n\t\t Note: You need to call ISound::drop() when setting this parameter to true and you don't need the ISound\n\t\t object anymore. See 'return' for details.\n\t\t \\param track Makes it possible to track the sound. Causes the method to return an ISound interface. See 'return' for details.\n\t\t \\param streamMode Specifies if the file should be streamed or loaded completely into memory for playing.\n\t\t ESM_AUTO_DETECT sets this to autodetection. Note: if the sound has been loaded or played before into the\n\t\t engine, this parameter has no effect.\n\t\t \\param enableSoundEffects Makes it possible to use sound effects such as chorus, distortions, echo, \n\t\t reverb and similar for this sound. Sound effects can then be controlled via ISound::getSoundEffectControl().\n\t\t Only enable if necessary. \n\t\t \\return Only returns a pointer to an ISound if the parameters 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been\t set to true. Note: if this method returns an ISound as result, \n\t\t you HAVE to call ISound::drop() after you don't need the ISound interface anymore. Otherwise this \n\t\t will cause memory waste. This method also may return 0 although 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been set to true, if the sound could not be played.*/\n\t\tvirtual ISound* play2D(const char* soundFileName, \n\t\t\t\t\t\t\t bool playLooped = false,\n\t\t\t\t\t\t\t bool startPaused = false, \n\t\t\t\t\t\t\t bool track = false,\n\t\t\t\t\t\t\t E_STREAM_MODE streamMode = ESM_AUTO_DETECT,\n\t\t\t\t\t\t\t bool enableSoundEffects = false) = 0;\n\n\t\t//! Plays a sound source as 2D sound with its default settings stored in ISoundSource.\n\t\t/** An ISoundSource object will be created internally when playing a sound the first time,\n\t\tor can be added with getSoundSource().\n\t\t\\param source The sound source, specifying sound file source and default settings for this file.\n\t\tUse the other ISoundEngine::play2D() overloads if you want to specify a filename string instead of this.\n\t\t\\param playLooped plays the sound in loop mode. If set to 'false', the sound is played once, then stopped and deleted from the internal playing list. Calls to\n\t\t ISound have no effect after such a non looped sound has been stopped automatically.\n\t\t\\param startPaused starts the sound paused. This implies that track=true. Use this if you want to modify some of the playing\n\t\t parameters before the sound actually plays. Usually you would set this parameter to true, then use the ISound interface to\n\t\t modify some of the sound parameters and then call ISound::setPaused(false);\n\t\t Note: You need to call ISound::drop() when setting this parameter to true and you don't need the ISound\n\t\t object anymore. See 'return' for details.\n\t\t \\param track Makes it possible to track the sound. Causes the method to return an ISound interface. See 'return' for details.\n\t\t \\param enableSoundEffects Makes it possible to use sound effects such as chorus, distortions, echo, \n\t\t reverb and similar for this sound. Sound effects can then be controlled via ISound::getSoundEffectControl().\n\t\t Only enable if necessary. \n\t\t \\return Only returns a pointer to an ISound if the parameters 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been\t set to true. Note: if this method returns an ISound as result, \n\t\t you HAVE to call ISound::drop() after you don't need the ISound interface anymore. Otherwise this \n\t\t will cause memory waste. This method also may return 0 although 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been set to true, if the sound could not be played.*/\n\t\tvirtual ISound* play2D(ISoundSource* source, \n\t\t\t\t\t\t\t bool playLooped = false,\n\t\t\t\t\t\t\t bool startPaused = false, \n\t\t\t\t\t\t\t bool track = false,\n\t\t\t\t\t\t\t bool enableSoundEffects = false) = 0;\n\n\t\t//! Loads a sound source (if not loaded already) from a file and plays it as 3D sound.\n\t\t/** There is some example code on how to work with 3D sound at @ref sound3d.\n\t\t\\param sourceFileName Filename of sound, like \"sounds/test.wav\" or \"foobar.ogg\".\n\t\t \\param pos Position of the 3D sound.\n\t\t \\param playLooped plays the sound in loop mode. If set to 'false', the sound is played once, then stopped and deleted from the internal playing list. Calls to\n\t\t ISound have no effect after such a non looped sound has been stopped automatically.\n\t\t \\param startPaused starts the sound paused. This implies that track=true. Use this if you want to modify some of the playing\n\t\t parameters before the sound actually plays. Usually you would set this parameter to true, then use the ISound interface to\n\t\t modify some of the sound parameters and then call ISound::setPaused(false);\n\t\t Note: You need to call ISound::drop() when setting this parameter to true and you don't need the ISound\n\t\t object anymore. See 'return' for details.\n\t\t \\param track Makes it possible to track the sound. Causes the method to return an ISound interface. See 'return' for details.\n \t\t \\param streamMode Specifies if the file should be streamed or loaded completely into memory for playing.\n\t\t ESM_AUTO_DETECT sets this to autodetection. Note: if the sound has been loaded or played before into the\n\t\t engine, this parameter has no effect.\n\t\t \\param enableSoundEffects Makes it possible to use sound effects such as chorus, distortions, echo, \n\t\t reverb and similar for this sound. Sound effects can then be controlled via ISound::getSoundEffectControl().\n\t\t Only enable if necessary. \n\t\t \\return Only returns a pointer to an ISound if the parameters 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been\t set to true. Note: if this method returns an ISound as result, \n\t\t you HAVE to call ISound::drop() after you don't need the ISound interface anymore. Otherwise this \n\t\t will cause memory waste. This method also may return 0 although 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been set to true, if the sound could not be played.*/\n\t\tvirtual ISound* play3D(const char* soundFileName, vec3df pos,\n\t\t\t\t\t\t\t bool playLooped = false, \n\t\t\t\t\t\t\t bool startPaused = false,\n\t\t\t\t\t\t\t bool track = false, \n\t\t\t\t\t\t\t E_STREAM_MODE streamMode = ESM_AUTO_DETECT,\n\t\t\t\t\t\t\t bool enableSoundEffects = false) = 0;\n\n\t\t//! Plays a sound source as 3D sound with its default settings stored in ISoundSource.\n\t\t/** An ISoundSource object will be created internally when playing a sound the first time,\n\t\tor can be added with getSoundSource(). There is some example code on how to work with 3D sound @ref sound3d.\n\t\t\\param source The sound source, specifying sound file source and default settings for this file.\n\t\tUse the other ISoundEngine::play2D() overloads if you want to specify a filename string instead of this.\n\t\t\\param pos Position of the 3D sound.\n\t\t\\param playLooped plays the sound in loop mode. If set to 'false', the sound is played once, then stopped and deleted from the internal playing list. Calls to\n\t\t ISound have no effect after such a non looped sound has been stopped automatically.\n\t\t\\param startPaused starts the sound paused. This implies that track=true. Use this if you want to modify some of the playing\n\t\t parameters before the sound actually plays. Usually you would set this parameter to true, then use the ISound interface to\n\t\t modify some of the sound parameters and then call ISound::setPaused(false);\n\t\t Note: You need to call ISound::drop() when setting this parameter to true and you don't need the ISound\n\t\t object anymore. See 'return' for details.\n\t\t \\param track Makes it possible to track the sound. Causes the method to return an ISound interface. See 'return' for details.\n\t\t \\param enableSoundEffects Makes it possible to use sound effects such as chorus, distortions, echo, \n\t\t reverb and similar for this sound. Sound effects can then be controlled via ISound::getSoundEffectControl().\n\t\t Only enable if necessary. \n\t\t \\return Only returns a pointer to an ISound if the parameters 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been\t set to true. Note: if this method returns an ISound as result, \n\t\t you HAVE to call ISound::drop() after you don't need the ISound interface anymore. Otherwise this \n\t\t will cause memory waste. This method also may return 0 although 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been set to true, if the sound could not be played.*/\n\t\tvirtual ISound* play3D(ISoundSource* source, vec3df pos,\n\t\t\t\t\t\t\t bool playLooped = false, \n\t\t\t\t\t\t\t bool startPaused = false, \n\t\t\t\t\t\t\t bool track = false,\n\t\t\t\t\t\t\t bool enableSoundEffects = false) = 0;\n\n\t\t//! Stops all currently playing sounds.\n\t\tvirtual void stopAllSounds() = 0;\n\n //! Pauses or unpauses all currently playing sounds.\n\t\tvirtual void setAllSoundsPaused( bool bPaused = true ) = 0;\n\n\t\t//! Gets a sound source by sound name. Adds the sound source as file into the sound engine if not loaded already.\n\t\t/** Please note: For performance reasons most ISoundEngine implementations will\n\t\tnot try to load the sound when calling this method, but only when play() is called\n\t\twith this sound source as parameter. \n\t\t\\param addIfNotFound if 'true' adds the sound source to the list and returns the interface to it\n\t\tif it cannot be found in the sound source list. If 'false', returns 0 if the sound\n\t\tsource is not in the list and does not modify the list. Default value: true.\n\t\t\\return Returns the sound source or 0 if not available.\n\t\tNote: Don't call drop() to this pointer, it will be managed by irrKlang and\n\t\texist as long as you don't delete irrKlang or call removeSoundSource(). However,\n\t\tyou are free to call grab() if you want and drop() it then later of course. */\n\t\tvirtual ISoundSource* getSoundSource(const ik_c8* soundName, bool addIfNotFound=true) = 0;\n\n\t\t//! Returns a sound source by index.\n\t\t/** \\param idx: Index of the loaded sound source, must by smaller than getSoundSourceCount().\n\t\t\\return Returns the sound source or 0 if not available.\n\t\tNote: Don't call drop() to this pointer, it will be managed by irrKlang and\n\t\texist as long as you don't delete irrKlang or call removeSoundSource(). However,\n\t\tyou are free to call grab() if you want and drop() it then later of course. */\t\n\t\tvirtual ISoundSource* getSoundSource(ik_s32 index) = 0;\n\n\t\t//! Returns amount of loaded sound sources.\n\t\tvirtual ik_s32 getSoundSourceCount() = 0;\n\n\t\t//! Adds sound source into the sound engine as file.\n\t\t/** \\param fileName Name of the sound file (e.g. \"sounds/something.mp3\"). You can also use this\n\t\tname when calling play3D() or play2D().\n\t\t\\param mode Streaming mode for this sound source\n\t\t\\param preload If this flag is set to false (which is default) the sound engine will\n\t\tnot try to load the sound file when calling this method, but only when play() is called\n\t\twith this sound source as parameter. Otherwise the sound will be preloaded.\n\t\t\\return Returns the pointer to the added sound source or 0 if not successful because for\n\t\texample a sound already existed with that name. If not successful, the reason will be printed\n\t\tinto the log. Note: Don't call drop() to this pointer, it will be managed by irrKlang and\n\t\texist as long as you don't delete irrKlang or call removeSoundSource(). However,\n\t\tyou are free to call grab() if you want and drop() it then later of course. */\t\n\t\tvirtual ISoundSource* addSoundSourceFromFile(const ik_c8* fileName, E_STREAM_MODE mode=ESM_AUTO_DETECT,\n\t\t\t bool preload=false) = 0;\n\n\t\t//! Adds a sound source into the sound engine as memory source.\n\t\t/** Note: This method only accepts a file (.wav, .ogg, etc) which is totally loaded into memory.\n\t\tIf you want to add a sound source from decoded plain PCM data in memory, use addSoundSourceFromPCMData() instead.\n\t\t\\param memory Pointer to the memory to be treated as loaded sound file.\n\t\t\\param sizeInBytes Size of the memory chunk, in bytes.\n\t\t\\param soundName Name of the virtual sound file (e.g. \"sounds/something.mp3\"). You can also use this\n\t\tname when calling play3D() or play2D(). Hint: If you include the extension of the original file\n\t\tlike .ogg, .mp3 or .wav at the end of the filename, irrKlang will be able to decide better what\n\t\tfile format it is and might be able to start playback faster.\n\t\t\\param copyMemory If set to true which is default, the memory block is copied \n\t\tand stored in the engine, after\tcalling addSoundSourceFromMemory() the memory pointer can be deleted\n\t\tsavely. If set to false, the memory is not copied and the user takes the responsibility that \n\t\tthe memory block pointed to remains there as long as the sound engine or at least this sound\n\t\tsource exists.\n\t\t\\return Returns the pointer to the added sound source or 0 if not successful because for example a sound already\n\t\texisted with that name. If not successful, the reason will be printed into the log. \n\t\tNote: Don't call drop() to this pointer, it will be managed by irrKlang and exist as long as you don't \n\t\tdelete irrKlang or call removeSoundSource(). However, you are free to call grab() if you\n\t\twant and drop() it then later of course. */\n\t\tvirtual ISoundSource* addSoundSourceFromMemory(void* memory, ik_s32 sizeInBytes, const ik_c8* soundName,\n\t\t\t\t\t\t\t\t\t\t\t bool copyMemory=true) = 0;\n\n\n\t\t//! Adds a sound source into the sound engine from plain PCM data in memory.\n\t\t/** \\param memory Pointer to the memory to be treated as loaded sound file.\n\t\t\\param sizeInBytes Size of the memory chunk, in bytes. \n\t\t\\param soundName Name of the virtual sound file (e.g. \"sounds/something.mp3\"). You can also use this\n\t\tname when calling play3D() or play2D(). \n\t\t\\param copyMemory If set to true which is default, the memory block is copied \n\t\tand stored in the engine, after\tcalling addSoundSourceFromPCMData() the memory pointer can be deleted\n\t\tsavely. If set to true, the memory is not copied and the user takes the responsibility that \n\t\tthe memory block pointed to remains there as long as the sound engine or at least this sound\n\t\tsource exists. \n\t\t\\return Returns the pointer to the added sound source or 0 if not successful because for\n\t\texample a sound already existed with that name. If not successful, the reason will be printed\n\t\tinto the log. */\n\t\tvirtual ISoundSource* addSoundSourceFromPCMData(void* memory, ik_s32 sizeInBytes, \n\t\t\t const ik_c8* soundName, SAudioStreamFormat format,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbool copyMemory=true) = 0;\n\n\t\t//! Adds a sound source as alias for an existing sound source, but with a different name or optional different default settings.\n\t\t/** This is useful if you want to play multiple sounds but each sound isn't necessarily one single file.\n\t\tAlso useful if you want to or play the same sound using different names, volumes or min and max 3D distances.\n\t\t\\param baseSource The sound source where this sound source should be based on. This sound\n\t\tsource will use the baseSource as base to access the file and similar, but it will have its\n\t\town name and its own default settings.\n\t\t\\param soundName Name of the new sound source to be added.\n\t\t\\return Returns the pointer to the added sound source or 0 if not successful because for\n\t\texample a sound already existed with that name. If not successful, the reason will be printed\n\t\tinto the log.*/\n\t\tvirtual ISoundSource* addSoundSourceAlias(ISoundSource* baseSource, const ik_c8* soundName) = 0;\n\n\t\t//! Removes a sound source from the engine, freeing the memory it occupies.\n\t\t/** This will also cause all currently playing sounds of this source to be stopped. \n\t\tAlso note that if the source has been removed successfully, the value returned \n\t\tby getSoundSourceCount() will have been decreased by one. \n\t\tRemoving sound sources is only necessary if you know you won't use a lot of non-streamed\n\t\tsounds again. Sound sources of streamed sounds do not cost a lot of memory.*/\n\t\tvirtual void removeSoundSource(ISoundSource* source) = 0;\n\n\t\t//! Removes a sound source from the engine, freeing the memory it occupies.\n\t\t/** This will also cause all currently playing sounds of this source to be stopped. \n\t\tAlso note that if the source has been removed successfully, the value returned \n\t\tby getSoundSourceCount() will have been decreased by one. \n\t\tRemoving sound sources is only necessary if you know you won't use a lot of non-streamed\n\t\tsounds again. Sound sources of streamed sounds do not cost a lot of memory. */\n\t\tvirtual void removeSoundSource(const ik_c8* name) = 0;\n\n\t\t//! Removes all sound sources from the engine\n\t\t/** This will also cause all sounds to be stopped. \n\t\tRemoving sound sources is only necessary if you know you won't use a lot of non-streamed\n\t\tsounds again. Sound sources of streamed sounds do not cost a lot of memory. */\n\t\tvirtual void removeAllSoundSources() = 0;\n\n\t\t//! Sets master sound volume. This value is multiplied with all sounds played.\n\t\t/** \\param volume 0 (silent) to 1.0f (full volume) */\n\t\tvirtual void setSoundVolume(ik_f32 volume) = 0;\n\n\t\t//! Returns master sound volume.\n\t\t/* A value between 0.0 and 1.0. Default is 1.0. Can be changed using setSoundVolume(). */\n\t\tvirtual ik_f32 getSoundVolume() = 0;\n\n\t\t//! Sets the current listener 3d position.\n\t\t/** When playing sounds in 3D, updating the position of the listener every frame should be\n\t\tdone using this function.\n\t\t\\param pos Position of the camera or listener.\n\t\t\\param lookdir Direction vector where the camera or listener is looking into. If you have a \n\t\tcamera position and a target 3d point where it is looking at, this would be cam->getTarget() - cam->getAbsolutePosition().\n\t\t\\param velPerSecond The velocity per second describes the speed of the listener and \n\t\tis only needed for doppler effects.\n\t\t\\param upvector Vector pointing 'up', so the engine can decide where is left and right. \n\t\tThis vector is usually (0,1,0).*/\n\t\tvirtual void setListenerPosition(const vec3df& pos,\n\t\t\tconst vec3df& lookdir,\n\t\t\tconst vec3df& velPerSecond = vec3df(0,0,0),\n\t\t\tconst vec3df& upVector = vec3df(0,1,0)) = 0;\n\n\t\t//! Updates the audio engine. This should be called several times per frame if irrKlang was started in single thread mode.\n\t\t/** This updates the 3d positions of the sounds as well as their volumes, effects,\n\t\tstreams and other stuff. Call this several times per frame (the more the better) if you\n\t\tspecified irrKlang to run single threaded. Otherwise it is not necessary to use this method.\n\t\tThis method is being called by the scene manager automatically if you are using one, so\n\t\tyou might want to ignore this. */\n\t\tvirtual void update() = 0;\n\n\t\t//! Returns if a sound with the specified name is currently playing.\n\t\tvirtual bool isCurrentlyPlaying(const char* soundName) = 0;\n\n\t\t//! Returns if a sound with the specified source is currently playing.\n\t\tvirtual bool isCurrentlyPlaying(ISoundSource* source) = 0;\n\n\t\t//! Stops all sounds of a specific sound source\n\t\tvirtual void stopAllSoundsOfSoundSource(ISoundSource* source) = 0;\n\n\t\t//! Registers a new audio stream loader in the sound engine.\n\t\t/** Use this to enhance the audio engine to support other or new file formats.\n\t\tTo do this, implement your own IAudioStreamLoader interface and register it\n\t\twith this method */\n\t\tvirtual void registerAudioStreamLoader(IAudioStreamLoader* loader) = 0;\n\n\t\t//! Returns if irrKlang is running in the same thread as the application or is using multithreading.\n\t\t/** This basically returns the flag set by the user when creating the sound engine.*/\n\t\tvirtual bool isMultiThreaded() const = 0;\n\n\t\t//! Adds a file factory to the sound engine, making it possible to override file access of the sound engine.\n\t\t/** Derive your own class from IFileFactory, overwrite the createFileReader()\n\t\tmethod and return your own implemented IFileReader to overwrite file access of irrKlang. */\n\t\tvirtual void addFileFactory(IFileFactory* fileFactory) = 0;\n\n\t\t//! Sets the default minimal distance for 3D sounds.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tSee ISound::setMinDistance() for details about what the min distance is.\n\t\tIt is also possible to influence this default value for every sound file \n\t\tusing ISoundSource::setDefaultMinDistance().\n\t\tThis method only influences the initial distance value of sounds. For changing the\n\t\tdistance after the sound has been started to play, use ISound::setMinDistance() and ISound::setMaxDistance().\n\t\t\\param minDistance Default minimal distance for 3d sounds. The default value is 1.0f.*/\n\t\tvirtual void setDefault3DSoundMinDistance(ik_f32 minDistance) = 0;\n\n\t\t//! Returns the default minimal distance for 3D sounds.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tYou can change it using setDefault3DSoundMinDistance().\n\t\tSee ISound::setMinDistance() for details about what the min distance is.\n\t\tIt is also possible to influence this default value for every sound file \n\t\tusing ISoundSource::setDefaultMinDistance().\n\t\t\\return Default minimal distance for 3d sounds. The default value is 1.0f. */\n\t\tvirtual ik_f32 getDefault3DSoundMinDistance() = 0;\n\n\t\t//! Sets the default maximal distance for 3D sounds.\n\t\t/** Changing this value is usually not necessary. Use setDefault3DSoundMinDistance() instead.\n\t\tDon't change this value if you don't know what you are doing: This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setDefault3DSoundMinDistance()) to influence this.\n\t\tSee ISound::setMaxDistance() for details about what the max distance is.\n\t\tIt is also possible to influence this default value for every sound file \n\t\tusing ISoundSource::setDefaultMaxDistance().\n\t\tThis method only influences the initial distance value of sounds. For changing the\n\t\tdistance after the sound has been started to play, use ISound::setMinDistance() and ISound::setMaxDistance().\n\t\t\\param maxDistance Default maximal distance for 3d sounds. The default value is 1000000000.0f. */\n\t\tvirtual void setDefault3DSoundMaxDistance(ik_f32 maxDistance) = 0;\n\n\t\t//! Returns the default maximal distance for 3D sounds.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tYou can change it using setDefault3DSoundmaxDistance(), but \n\t\tchanging this value is usually not necessary. This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setDefault3DSoundMinDistance()) to influence this.\n\t\tSee ISound::setMaxDistance() for details about what the max distance is.\n\t\tIt is also possible to influence this default value for every sound file \n\t\tusing ISoundSource::setDefaultMaxDistance().\n\t\t\\return Default maximal distance for 3d sounds. The default value is 1000000000.0f. */\n\t\tvirtual ik_f32 getDefault3DSoundMaxDistance() = 0;\n\n\t\t//! Sets a rolloff factor which influences the amount of attenuation that is applied to 3D sounds.\n\t\t/** The rolloff factor can range from 0.0 to 10.0, where 0 is no rolloff. 1.0 is the default \n\t\trolloff factor set, the value which we also experience in the real world. A value of 2 would mean\n\t\ttwice the real-world rolloff. */\n\t\tvirtual void setRolloffFactor(ik_f32 rolloff) = 0;\n\n\t\t//! Sets parameters affecting the doppler effect.\n\t\t/** \\param dopplerFactor is a value between 0 and 10 which multiplies the doppler \n\t\teffect. Default value is 1.0, which is the real world doppler effect, and 10.0f \n\t\twould be ten times the real world doppler effect.\n\t\t\\param distanceFactor is the number of meters in a vector unit. The default value\n\t\tis 1.0. Doppler effects are calculated in meters per second, with this parameter,\n\t\tthis can be changed, all velocities and positions are influenced by this. If\n\t\tthe measurement should be in foot instead of meters, set this value to 0.3048f\n\t\tfor example.*/\n\t\tvirtual void setDopplerEffectParameters(ik_f32 dopplerFactor=1.0f, ik_f32 distanceFactor=1.0f) = 0;\n\n\t\t//! Loads irrKlang plugins from a custom path.\n\t\t/** Plugins usually are .dll, .so or .dylib\n\t\tfiles named for example ikpMP3.dll (= short for irrKlangPluginMP3) which\n\t\tmake it possible to play back mp3 files. Plugins are being \n\t\tloaded from the current working directory at startup of the sound engine\n\t\tif the parameter ESEO_LOAD_PLUGINS is set (which it is by default), but\n\t\tusing this method, it is possible to load plugins from a custom path in addition. \n\t\t\\param path Path to the plugin directory, like \"C:\\games\\somegamegame\\irrklangplugins\".\n\t\t\\return returns true if successful or false if not, for example because the path could \n\t\tnot be found. */\n\t\tvirtual bool loadPlugins(const ik_c8* path) = 0;\n\n\t\t//! Returns a pointer to internal sound engine pointers, like the DirectSound interface.\n\t\t/** Use this with caution. This is only exposed to make it possible for other libraries\n\t\tsuch as Video playback packages to extend or use the sound driver irrklang uses. */\n\t\tvirtual const SInternalAudioInterface& getInternalAudioInterface() = 0;\t\t\n\n\t\t//! Sets the OutputMixedDataReceiver, so you can receive the pure mixed output audio data while it is being played.\n\t\t/** This can be used to store the sound output as .wav file or for creating a Oscillograph or similar.\n\t\tThis works only with software based audio drivers, that is ESOD_WIN_MM, ESOD_ALSA, and ESOD_CORE_AUDIO. \n\t\tReturns true if successful and false if the current audio driver doesn't support this feature. Set this to null\n\t\tagain once you don't need it anymore. */\n\t\tvirtual bool setMixedDataOutputReceiver(ISoundMixedOutputReceiver* receiver) = 0;\n\t};\n\n\n\t//! structure for returning pointers to the internal audio interface. \n\t/** Use ISoundEngine::getInternalAudioInterface() to get this. */\n\tstruct SInternalAudioInterface\n\t{\n\t\t//! IDirectSound interface, this is not null when using the ESOD_DIRECT_SOUND audio driver\n\t\tvoid* pIDirectSound;\n\n\t\t//! IDirectSound8 interface, this is not null when using the ESOD_DIRECT_SOUND8 audio driver\n\t\tvoid* pIDirectSound8;\n\n\t\t//! HWaveout interface, this is not null when using the ESOD_WIN_MM audio driver\n\t\tvoid* pWinMM_HWaveOut;\n\n\t\t//! ALSA PCM Handle interface, this is not null when using the ESOD_ALSA audio driver\n\t\tvoid* pALSA_SND_PCM;\n\n\t\t//! AudioDeviceID handle, this is not null when using the ESOD_CORE_AUDIO audio driver\n\t\tik_u32 pCoreAudioDeviceID;\n\t};\n\n\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_ISoundMixedOutputReceiver.h", "language": "code", "loc": 32, "comment_density": 0.594, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_MIXED_OUTPUT_RECEIVER_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_MIXED_OUTPUT_RECEIVER_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_SAudioStreamFormat.h\"\n\n\nnamespace irrklang\n{\n\n\n//! Interface to be implemented by the user, which receives the mixed output when it it played by the sound engine.\n/** This can be used to store the sound output as .wav file or for creating a Oscillograph or similar. \n Simply implement your own class derived from ISoundMixedOutputReceiver and use ISoundEngine::setMixedDataOutputReceiver\n to let the audio driver know about it. */\nclass ISoundMixedOutputReceiver\n{\npublic:\n \n\t//! destructor\n\tvirtual ~ISoundMixedOutputReceiver() {};\n\n\t//! Called when a chunk of sound has been mixed and is about to be played. \n\t/** Note: This is called from the playing thread of the sound library, so you need to \n\tmake everything you are doing in this method thread safe. Additionally, it would\n\tbe a good idea to do nothing complicated in your implementation and return as fast as possible,\n\totherwise sound output may be stuttering.\n\t\\param data representing the sound frames which just have been mixed. Sound data always\n\tconsists of two interleaved sound channels at 16bit per frame. \n\t \\param byteCount Amount of bytes of the data \n\t \\param playbackrate The playback rate at samples per second (usually something like 44000). \n\t This value will not change and always be the same for an instance of an ISoundEngine. */\n\tvirtual void OnAudioDataReady(const void* data, int byteCount, int playbackrate) = 0;\n\n};\n\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_ISoundSource.h", "language": "code", "loc": 143, "comment_density": 0.797, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_IRR_SOUND_SOURCE_H_INCLUDED__\n#define __I_IRRKLANG_IRR_SOUND_SOURCE_H_INCLUDED__\n\n#include \"ik_IVirtualRefCounted.h\"\n#include \"ik_vec3d.h\"\n#include \"ik_EStreamModes.h\"\n#include \"ik_SAudioStreamFormat.h\"\n\n\nnamespace irrklang\n{\n\n\t//! A sound source describes an input file (.ogg, .mp3, .wav or similar) and its default settings.\n\t/** It provides some informations about the sound source like the play length and\n\tcan have default settings for volume, distances for 3d etc. There is some example code on how\n\tto use Sound sources at @ref soundSources.*/\n\tclass ISoundSource : public IVirtualRefCounted\n\t{\n\tpublic:\n\n\t\t//! Returns the name of the sound source (usually, this is the file name)\n\t\tvirtual const ik_c8* getName() = 0;\n\n\t\t//! Sets the stream mode which should be used for a sound played from this source.\n\t\t/** Note that if this is set to ESM_NO_STREAMING, the engine still might decide\n\t\tto stream the sound if it is too big. The threshold for this can be \n\t\tadjusted using ISoundSource::setForcedStreamingThreshold(). */\n\t\tvirtual void setStreamMode(E_STREAM_MODE mode) = 0;\n\n\t\t//! Returns the detected or set type of the sound with wich the sound will be played.\n\t\t/** Note: If the returned type is ESM_AUTO_DETECT, this mode will change after the\n\t\tsound has been played the first time. */\n\t\tvirtual E_STREAM_MODE getStreamMode() = 0;\n\n\t\t//! Returns the play length of the sound in milliseconds.\n\t\t/** Returns -1 if not known for this sound for example because its decoder\n\t\tdoes not support length reporting or it is a file stream of unknown size.\n\t\tNote: If the sound never has been played before, the sound engine will have to open\n\t\tthe file and try to get the play length from there, so this call could take a bit depending\n\t\ton the type of file. */\n\t\tvirtual ik_u32 getPlayLength() = 0;\n\n\t\t//! Returns informations about the sound source: channel count (mono/stereo), frame count, sample rate, etc.\n\t\t/** \\return Returns the structure filled with 0 or negative values if not known for this sound for example because \n\t\tbecause the file could not be opened or similar.\n\t\tNote: If the sound never has been played before, the sound engine will have to open\n\t\tthe file and try to get the play length from there, so this call could take a bit depending\n\t\ton the type of file. */\n\t\tvirtual SAudioStreamFormat getAudioFormat() = 0;\n\n\t\t//! Returns if sounds played from this source will support seeking via ISound::setPlayPosition().\n\t\t/* If a sound is seekable depends on the file type and the audio format. For example MOD files\n\t\tcannot be seeked currently.\n\t\t\\return Returns true of the sound source supports setPlayPosition() and false if not. \n\t\tNote: If the sound never has been played before, the sound engine will have to open\n\t\tthe file and try to get the information from there, so this call could take a bit depending\n\t\ton the type of file. */\n\t\tvirtual bool getIsSeekingSupported() = 0;\n\n\t\t//! Sets the default volume for a sound played from this source.\n\t\t/** The default value of this is 1.0f. \n\t\tNote that the default volume is being multiplied with the master volume\n\t\tof ISoundEngine, change this via ISoundEngine::setSoundVolume(). \n\t\t//! \\param volume 0 (silent) to 1.0f (full volume). Default value is 1.0f. */\n\t\tvirtual void setDefaultVolume(ik_f32 volume=1.0f) = 0;\n\n\t\t//! Returns the default volume for a sound played from this source.\n\t\t/** You can influence this default volume value using setDefaultVolume().\n\t\tNote that the default volume is being multiplied with the master volume\n\t\tof ISoundEngine, change this via ISoundEngine::setSoundVolume(). \n\t\t//! \\return 0 (silent) to 1.0f (full volume). Default value is 1.0f. */\n\t\tvirtual ik_f32 getDefaultVolume() = 0;\n\n\t\t//! sets the default minimal distance for 3D sounds played from this source.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tSee ISound::setMinDistance() for details about what the min distance is.\n\t\tThis method only influences the initial distance value of sounds. For changing the\n\t\tdistance while the sound is playing, use ISound::setMinDistance() and ISound::setMaxDistance().\n\t\t\\param minDistance: Default minimal distance for 3D sounds from this source. Set it to a negative\n\t\tvalue to let sounds of this source use the engine level default min distance, which\n\t\tcan be set via ISoundEngine::setDefault3DSoundMinDistance(). Default value is -1, causing\n\t\tthe default min distance of the sound engine to take effect. */\n\t\tvirtual void setDefaultMinDistance(ik_f32 minDistance) = 0;\n\n\t\t//! Returns the default minimal distance for 3D sounds played from this source.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tSee ISound::setMinDistance() for details about what the minimal distance is.\n\t\t\\return Default minimal distance for 3d sounds from this source. If setDefaultMinDistance()\n\t\twas set to a negative value, it will return the default value set in the engine,\n\t\tusing ISoundEngine::setDefault3DSoundMinDistance(). Default value is -1, causing\n\t\tthe default min distance of the sound engine to take effect. */\n\t\tvirtual ik_f32 getDefaultMinDistance() = 0;\n\n\t\t//! Sets the default maximal distance for 3D sounds played from this source.\n\t\t/** Changing this value is usually not necessary. Use setDefaultMinDistance() instead.\n\t\tDon't change this value if you don't know what you are doing: This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setDefaultMinDistance()) to influence this.\n\t\tSee ISound::setMaxDistance() for details about what the max distance is.\n\t\tThis method only influences the initial distance value of sounds. For changing the\n\t\tdistance while the sound is played, use ISound::setMinDistance() \n\t\tand ISound::setMaxDistance().\n\t\t\\param maxDistance Default maximal distance for 3D sounds from this source. Set it to a negative\n\t\tvalue to let sounds of this source use the engine level default max distance, which\n\t\tcan be set via ISoundEngine::setDefault3DSoundMaxDistance(). Default value is -1, causing\n\t\tthe default max distance of the sound engine to take effect. */\n\t\tvirtual void setDefaultMaxDistance(ik_f32 maxDistance) = 0;\n\n\t\t//! returns the default maximal distance for 3D sounds played from this source.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tChanging this value is usually not necessary. Use setDefaultMinDistance() instead.\n\t\tDon't change this value if you don't know what you are doing: This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setDefaultMinDistance()) to influence this.\n\t\tSee ISound::setMaxDistance() for details about what the max distance is.\n\t\t\\return Default maximal distance for 3D sounds from this source. If setDefaultMaxDistance()\n\t\twas set to a negative value, it will return the default value set in the engine,\n\t\tusing ISoundEngine::setDefault3DSoundMaxDistance(). Default value is -1, causing\n\t\tthe default max distance of the sound engine to take effect. */\n\t\tvirtual ik_f32 getDefaultMaxDistance() = 0;\n\n\t\t//! Forces the sound to be reloaded at next replay.\n\t\t/** Sounds which are not played as streams are buffered to make it possible to\n\t\treplay them without much overhead. If the sound file is altered after the sound\n\t\thas been played the first time, the engine won't play the changed file then.\n\t\tCalling this method makes the engine reload the file before the file is played\n\t\tthe next time.*/\n\t\tvirtual void forceReloadAtNextUse() = 0;\n\n\t\t//! Sets the threshold size where irrKlang decides to force streaming a file independent of the user specified setting.\n\t\t/** When specifying ESM_NO_STREAMING for playing back a sound file, irrKlang will\n\t\tignore this setting if the file is bigger than this threshold and stream the file\n\t\tanyway. Please note that if an audio format loader is not able to return the \n\t\tsize of a sound source and returns -1 as length, this will be ignored as well \n\t\tand streaming has to be forced.\n\t\t\\param threshold: New threshold. The value is specified in uncompressed bytes and its default value is \n\t\tabout one Megabyte. Set to 0 or a negative value to disable stream forcing. */\n\t\tvirtual void setForcedStreamingThreshold(ik_s32 thresholdBytes) = 0;\n\n\t\t//! Returns the threshold size where irrKlang decides to force streaming a file independent of the user specified setting.\n\t\t/** The value is specified in uncompressed bytes and its default value is \n\t\tabout one Megabyte. See setForcedStreamingThreshold() for details. */\n\t\tvirtual ik_s32 getForcedStreamingThreshold() = 0;\n\n\t\t//! Returns a pointer to the loaded and decoded sample data.\n\t\t/** \\return Returns a pointer to the sample data. The data is provided in decoded PCM data. The\n\t\texact format can be retrieved using getAudioFormat(). Use getAudioFormat().getSampleDataSize()\n\t\tfor getting the amount of bytes. The returned pointer will only be valid as long as the sound\n\t\tsource exists.\n\t\tThis function will only return a pointer to the data if the \n\t\taudio file is not streamed, namely ESM_NO_STREAMING. Otherwise this function will return 0.\n\t\tNote: If the sound never has been played before, the sound engine will have to open\n\t\tthe file and decode audio data from there, so this call could take a bit depending\n\t\ton the type of the file.*/\n\t\tvirtual void* getSampleData() = 0;\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_ISoundStopEventReceiver.h", "language": "code", "loc": 53, "comment_density": 0.623, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_STOP_EVENT_RECEIVER_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_STOP_EVENT_RECEIVER_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_SAudioStreamFormat.h\"\n\n\nnamespace irrklang\n{\n\n\n//! An enumeration listing all reasons for a fired sound stop event\nenum E_STOP_EVENT_CAUSE\n{\n\t//! The sound stop event was fired because the sound finished playing\n\tESEC_SOUND_FINISHED_PLAYING = 0,\n\n\t//! The sound stop event was fired because the sound was stopped by the user, calling ISound::stop().\n\tESEC_SOUND_STOPPED_BY_USER,\n\n\t//! The sound stop event was fired because the source of the sound was removed, for example\n\t//! because irrKlang was shut down or the user called ISoundEngine::removeSoundSource().\n\tESEC_SOUND_STOPPED_BY_SOURCE_REMOVAL,\n\n\t//! This enumeration literal is never used, it only forces the compiler to \n\t//! compile these enumeration values to 32 bit.\n\tESEC_FORCE_32_BIT = 0x7fffffff\n};\n\n\n//! Interface to be implemented by the user, which receives sound stop events.\n/** The interface has only one method to be implemented by the user: OnSoundStopped().\nImplement this interface and set it via ISound::setSoundStopEventReceiver().\nThe sound stop event is guaranteed to be called when a sound or sound stream is finished,\neither because the sound reached its playback end, its sound source was removed,\nISoundEngine::stopAllSounds() has been called or the whole engine was deleted. */\nclass ISoundStopEventReceiver\n{\npublic:\n \n\t//! destructor\n\tvirtual ~ISoundStopEventReceiver() {};\n\n\t//! Called when a sound has stopped playing. \n\t/** This is the only method to be implemented by the user.\n\tThe sound stop event is guaranteed to be called when a sound or sound stream is finished,\n\teither because the sound reached its playback end, its sound source was removed,\n\tISoundEngine::stopAllSounds() has been called or the whole engine was deleted.\n\tPlease note: Sound events will occur in a different thread when the engine runs in\n\tmulti threaded mode (default). In single threaded mode, the event will happen while\n\tthe user thread is calling ISoundEngine::update().\n\t\\param sound: Sound which has been stopped. \n\t\\param reason: The reason why the sound stop event was fired. Usually, this will be ESEC_SOUND_FINISHED_PLAYING.\n\tWhen the sound was aborted by calling ISound::stop() or ISoundEngine::stopAllSounds();, this would be \n\tESEC_SOUND_STOPPED_BY_USER. If irrKlang was deleted or the sound source was removed, the value is \n\tESEC_SOUND_STOPPED_BY_SOURCE_REMOVAL.\n\t\\param userData: userData pointer set by the user when registering the interface\n\tvia ISound::setSoundStopEventReceiver(). */\n\tvirtual void OnSoundStopped(ISound* sound, E_STOP_EVENT_CAUSE reason, void* userData) = 0;\n\n};\n\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IVirtualRefCounted.h", "language": "code", "loc": 33, "comment_density": 0.545, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_VIRTUAL_UNKNOWN_H_INCLUDED__\n#define __I_IRRKLANG_VIRTUAL_UNKNOWN_H_INCLUDED__\n\n#include \"ik_irrKlangTypes.h\"\n\n\nnamespace irrklang\n{\n\n\t//! Reference counting base class for objects in the Irrlicht Engine similar to IRefCounted.\n\t/** See IRefCounted for the basics of this class.\n\tThe difference to IRefCounted is that the class has to implement reference counting\n\tfor itself. \n\t*/\n\tclass IVirtualRefCounted\n\t{\n\tpublic:\n\n\t\t//! Destructor.\n\t\tvirtual ~IVirtualRefCounted()\n\t\t{\n\t\t}\n\n\t\t//! Grabs the object. Increments the reference counter by one.\n\t\t/** To be implemented by the derived class. If you don't want to\n\t\timplement this, use the class IRefCounted instead. See IRefCounted::grab() for details\n\t\tof this method. */\n\t\tvirtual void grab() = 0;\n\n\t\t//! Drops the object. Decrements the reference counter by one.\n\t\t/** To be implemented by the derived class. If you don't want to\n\t\timplement this, use the class IRefCounted instead. See IRefCounted::grab() for details\n\t\tof this method. */\n\t\tvirtual bool drop() = 0;\n\t};\n\n\n\n} // end namespace irrklang\n\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_SAudioStreamFormat.h", "language": "code", "loc": 52, "comment_density": 0.346, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __S_IRRKLANG_AUDIO_STREAM_FORMAT_H_INCLUDED__\n#define __S_IRRKLANG_AUDIO_STREAM_FORMAT_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n\n\nnamespace irrklang\n{\n\n\t//! audio sample data format enumeration for supported formats\n\tenum ESampleFormat\n\t{\n\t\t//! one unsigned byte (0;255)\n\t\tESF_U8, \n\n\t\t//! 16 bit, signed (-32k;32k)\n\t\tESF_S16 \n\t};\n\n\n\t//! structure describing an audio stream format with helper functions\n\tstruct SAudioStreamFormat\n\t{\n\t\t//! channels, 1 for mono, 2 for stereo\n\t\tik_s32 ChannelCount; \n\n\t\t//! amount of frames in the sample data or stream. \n\t\t/** If the stream has an unknown length, this is -1 */\n\t\tik_s32 FrameCount;\t\t\n\n\t\t//! samples per second\n\t\tik_s32 SampleRate;\n\t\t\n\t\t//! format of the sample data\n\t\tESampleFormat SampleFormat;\n\n\t\t//! returns the size of a sample of the data described by the stream data in bytes\n\t\tinline ik_s32 getSampleSize() const\n\t\t{\n\t\t\treturn (SampleFormat == ESF_U8) ? 1 : 2;\n\t\t}\n\n\t\t//! returns the frame size of the stream data in bytes\n\t\tinline ik_s32 getFrameSize() const\n\t\t{\n\t\t\treturn ChannelCount * getSampleSize();\n\t\t}\n\n\t\t//! returns the size of the sample data in bytes\n\t\t/* Returns an invalid negative value when the stream has an unknown length */\n\t\tinline ik_s32 getSampleDataSize() const\n\t\t{\n\t\t\treturn getFrameSize() * FrameCount;\n\t\t}\n\n\t\t//! returns amount of bytes per second\n\t\tinline ik_s32 getBytesPerSecond() const\n\t\t{\n\t\t\treturn getFrameSize() * SampleRate;\n\t\t}\n\t};\n\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_irrKlangTypes.h", "language": "code", "loc": 67, "comment_density": 0.582, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __IRRKLANG_TYPES_H_INCLUDED__\n#define __IRRKLANG_TYPES_H_INCLUDED__\n\n\nnamespace irrklang\n{\n\n\t//! 8 bit unsigned variable.\n\t/** This is a typedef for unsigned char, it ensures portability of the engine. */\n\ttypedef unsigned char ik_u8;\n\n\t//! 8 bit signed variable.\n\t/** This is a typedef for signed char, it ensures portability of the engine. */\n\ttypedef signed char\tik_s8;\n\n\t//! 8 bit character variable.\n\t/** This is a typedef for char, it ensures portability of the engine. */\n\ttypedef char ik_c8;\n\n\n\n\t//! 16 bit unsigned variable.\n\t/** This is a typedef for unsigned short, it ensures portability of the engine. */\n\ttypedef unsigned short ik_u16;\n\n\t//! 16 bit signed variable.\n\t/** This is a typedef for signed short, it ensures portability of the engine. */\n\ttypedef signed short ik_s16;\n\n\n\n\t//! 32 bit unsigned variable.\n\t/** This is a typedef for unsigned int, it ensures portability of the engine. */\n\ttypedef unsigned int ik_u32;\n\n\t//! 32 bit signed variable.\n\t/** This is a typedef for signed int, it ensures portability of the engine. */\n\ttypedef signed int ik_s32;\n\n\n\n\t//! 32 bit floating point variable.\n\t/** This is a typedef for float, it ensures portability of the engine. */\n\ttypedef float ik_f32;\n\n\t//! 64 bit floating point variable.\n\t/** This is a typedef for double, it ensures portability of the engine. */\n\ttypedef double ik_f64;\n\n\n\n // some constants\n\n\tconst ik_f32 IK_ROUNDING_ERROR_32\t= 0.000001f;\n\tconst ik_f64 IK_PI64\t\t\t = 3.1415926535897932384626433832795028841971693993751;\n\tconst ik_f32 IK_PI32\t\t\t = 3.14159265359f;\n\tconst ik_f32 IK_RADTODEG = 180.0f / IK_PI32;\n\tconst ik_f32 IK_DEGTORAD = IK_PI32 / 180.0f;\n\tconst ik_f64 IK_RADTODEG64 = 180.0 / IK_PI64;\n\tconst ik_f64 IK_DEGTORAD64 = IK_PI64 / 180.0;\n\n\t//! returns if a float equals the other one, taking floating\n\t//! point rounding errors into account\n\tinline bool equalsfloat(const ik_f32 a, const ik_f32 b, const ik_f32 tolerance = IK_ROUNDING_ERROR_32)\n\t{\n\t\treturn (a + tolerance > b) && (a - tolerance < b);\n\t}\n\n} // end irrklang namespace\n\n// ensure wchar_t type is existing for unicode support\n#include \n\n// define the wchar_t type if not already built in.\n#ifdef _MSC_VER // microsoft compiler\n\t#ifndef _WCHAR_T_DEFINED\n\t\t//! A 16 bit wide character type.\n\t\t/**\n\t\t\tDefines the wchar_t-type.\n\t\t\tIn VS6, its not possible to tell\n\t\t\tthe standard compiler to treat wchar_t as a built-in type, and\n\t\t\tsometimes we just don't want to include the huge stdlib.h or wchar.h,\n\t\t\tso we'll use this.\n\t\t*/\n\t\ttypedef unsigned short wchar_t;\n\t\t#define _WCHAR_T_DEFINED\n\t#endif // wchar is not defined\n#endif // microsoft compiler\n\n\n#endif // __IRR_TYPES_H_INCLUDED__\n\n"}, {"path": "includes/irrKlang/ik_vec3d.h", "language": "code", "loc": 208, "comment_density": 0.24, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __IRR_IRRKLANG_VEC_3D_H_INCLUDED__\n#define __IRR_IRRKLANG_VEC_3D_H_INCLUDED__\n\n#include \n#include \"ik_irrKlangTypes.h\"\n\n\nnamespace irrklang\n{\n\n\t//! a 3d vector template class for representing vectors and points in 3d\n\ttemplate \n\tclass vec3d\n\t{\n\tpublic:\n\n\t\tvec3d(): X(0), Y(0), Z(0) {};\n\t\tvec3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {};\n\t\tvec3d(const vec3d& other)\t:X(other.X), Y(other.Y), Z(other.Z) {};\n\n\t\t//! constructor creating an irrklang vec3d from an irrlicht vector.\n\t\t#ifdef __IRR_POINT_3D_H_INCLUDED__\n\t\ttemplate\n\t\tvec3d(const B& other)\t:X(other.X), Y(other.Y), Z(other.Z) {};\n\t\t#endif // __IRR_POINT_3D_H_INCLUDED__\n\n\t\t// operators\n\n\t\tvec3d operator-() const { return vec3d(-X, -Y, -Z); }\n\n\t\tvec3d& operator=(const vec3d& other)\t{ X = other.X; Y = other.Y; Z = other.Z; return *this; }\n\n\t\tvec3d operator+(const vec3d& other) const { return vec3d(X + other.X, Y + other.Y, Z + other.Z);\t}\n\t\tvec3d& operator+=(const vec3d& other)\t{ X+=other.X; Y+=other.Y; Z+=other.Z; return *this; }\n\n\t\tvec3d operator-(const vec3d& other) const { return vec3d(X - other.X, Y - other.Y, Z - other.Z);\t}\n\t\tvec3d& operator-=(const vec3d& other)\t{ X-=other.X; Y-=other.Y; Z-=other.Z; return *this; }\n\n\t\tvec3d operator*(const vec3d& other) const { return vec3d(X * other.X, Y * other.Y, Z * other.Z);\t}\n\t\tvec3d& operator*=(const vec3d& other)\t{ X*=other.X; Y*=other.Y; Z*=other.Z; return *this; }\n\t\tvec3d operator*(const T v) const { return vec3d(X * v, Y * v, Z * v);\t}\n\t\tvec3d& operator*=(const T v) { X*=v; Y*=v; Z*=v; return *this; }\n\n\t\tvec3d operator/(const vec3d& other) const { return vec3d(X / other.X, Y / other.Y, Z / other.Z);\t}\n\t\tvec3d& operator/=(const vec3d& other)\t{ X/=other.X; Y/=other.Y; Z/=other.Z; return *this; }\n\t\tvec3d operator/(const T v) const { T i=(T)1.0/v; return vec3d(X * i, Y * i, Z * i);\t}\n\t\tvec3d& operator/=(const T v) { T i=(T)1.0/v; X*=i; Y*=i; Z*=i; return *this; }\n\n\t\tbool operator<=(const vec3d&other) const { return X<=other.X && Y<=other.Y && Z<=other.Z;};\n\t\tbool operator>=(const vec3d&other) const { return X>=other.X && Y>=other.Y && Z>=other.Z;};\n\n\t\tbool operator==(const vec3d& other) const { return other.X==X && other.Y==Y && other.Z==Z; }\n\t\tbool operator!=(const vec3d& other) const { return other.X!=X || other.Y!=Y || other.Z!=Z; }\n\n\t\t// functions\n\n\t\t//! returns if this vector equalsfloat the other one, taking floating point rounding errors into account\n\t\tbool equals(const vec3d& other)\n\t\t{\n\t\t\treturn equalsfloat(X, other.X) &&\n\t\t\t\t equalsfloat(Y, other.Y) &&\n\t\t\t\t equalsfloat(Z, other.Z);\n\t\t}\n\n\t\tvoid set(const T nx, const T ny, const T nz) {X=nx; Y=ny; Z=nz; }\n\t\tvoid set(const vec3d& p) { X=p.X; Y=p.Y; Z=p.Z;}\n\n\t\t//! Returns length of the vector.\n\t\tik_f64 getLength() const { return sqrt(X*X + Y*Y + Z*Z); }\n\n\t\t//! Returns squared length of the vector.\n\t\t/** This is useful because it is much faster then\n\t\tgetLength(). */\n\t\tik_f64 getLengthSQ() const { return X*X + Y*Y + Z*Z; }\n\n\t\t//! Returns the dot product with another vector.\n\t\tT dotProduct(const vec3d& other) const\n\t\t{\n\t\t\treturn X*other.X + Y*other.Y + Z*other.Z;\n\t\t}\n\n\t\t//! Returns distance from another point.\n\t\t/** Here, the vector is interpreted as point in 3 dimensional space. */\n\t\tik_f64 getDistanceFrom(const vec3d& other) const\n\t\t{\n\t\t\tik_f64 vx = X - other.X; ik_f64 vy = Y - other.Y; ik_f64 vz = Z - other.Z;\n\t\t\treturn sqrt(vx*vx + vy*vy + vz*vz);\n\t\t}\n\n\t\t//! Returns squared distance from another point.\n\t\t/** Here, the vector is interpreted as point in 3 dimensional space. */\n\t\tik_f32 getDistanceFromSQ(const vec3d& other) const\n\t\t{\n\t\t\tik_f32 vx = X - other.X; ik_f32 vy = Y - other.Y; ik_f32 vz = Z - other.Z;\n\t\t\treturn (vx*vx + vy*vy + vz*vz);\n\t\t}\n\n\t\t//! Calculates the cross product with another vector\n\t\tvec3d crossProduct(const vec3d& p) const\n\t\t{\n\t\t\treturn vec3d(Y * p.Z - Z * p.Y, Z * p.X - X * p.Z, X * p.Y - Y * p.X);\n\t\t}\n\n\t\t//! Returns if this vector interpreted as a point is on a line between two other points.\n\t\t/** It is assumed that the point is on the line. */\n\t\tbool isBetweenPoints(const vec3d& begin, const vec3d& end) const\n\t\t{\n\t\t\tik_f32 f = (ik_f32)(end - begin).getLengthSQ();\n\t\t\treturn (ik_f32)getDistanceFromSQ(begin) < f &&\n\t\t\t\t(ik_f32)getDistanceFromSQ(end) < f;\n\t\t}\n\n\t\t//! Normalizes the vector.\n\t\tvec3d& normalize()\n\t\t{\n\t\t\tT l = (T)getLength();\n\t\t\tif (l == 0)\n\t\t\t\treturn *this;\n\n\t\t\tl = (T)1.0 / l;\n\t\t\tX *= l;\n\t\t\tY *= l;\n\t\t\tZ *= l;\n\t\t\treturn *this;\n\t\t}\n\n\t\t//! Sets the length of the vector to a new value\n\t\tvoid setLength(T newlength)\n\t\t{\n\t\t\tnormalize();\n\t\t\t*this *= newlength;\n\t\t}\n\n\t\t//! Inverts the vector.\n\t\tvoid invert()\n\t\t{\n\t\t\tX *= -1.0f;\n\t\t\tY *= -1.0f;\n\t\t\tZ *= -1.0f;\n\t\t}\n\n\t\t//! Rotates the vector by a specified number of degrees around the Y\n\t\t//! axis and the specified center.\n\t\t//! \\param degrees: Number of degrees to rotate around the Y axis.\n\t\t//! \\param center: The center of the rotation.\n\t\tvoid rotateXZBy(ik_f64 degrees, const vec3d& center)\n\t\t{\n\t\t\tdegrees *= IK_DEGTORAD64;\n\t\t\tT cs = (T)cos(degrees);\n\t\t\tT sn = (T)sin(degrees);\n\t\t\tX -= center.X;\n\t\t\tZ -= center.Z;\n\t\t\tset(X*cs - Z*sn, Y, X*sn + Z*cs);\n\t\t\tX += center.X;\n\t\t\tZ += center.Z;\n\t\t}\n\n\t\t//! Rotates the vector by a specified number of degrees around the Z\n\t\t//! axis and the specified center.\n\t\t//! \\param degrees: Number of degrees to rotate around the Z axis.\n\t\t//! \\param center: The center of the rotation.\n\t\tvoid rotateXYBy(ik_f64 degrees, const vec3d& center)\n\t\t{\n\t\t\tdegrees *= IK_DEGTORAD64;\n\t\t\tT cs = (T)cos(degrees);\n\t\t\tT sn = (T)sin(degrees);\n\t\t\tX -= center.X;\n\t\t\tY -= center.Y;\n\t\t\tset(X*cs - Y*sn, X*sn + Y*cs, Z);\n\t\t\tX += center.X;\n\t\t\tY += center.Y;\n\t\t}\n\n\t\t//! Rotates the vector by a specified number of degrees around the X\n\t\t//! axis and the specified center.\n\t\t//! \\param degrees: Number of degrees to rotate around the X axis.\n\t\t//! \\param center: The center of the rotation.\n\t\tvoid rotateYZBy(ik_f64 degrees, const vec3d& center)\n\t\t{\n\t\t\tdegrees *= IK_DEGTORAD64;\n\t\t\tT cs = (T)cos(degrees);\n\t\t\tT sn = (T)sin(degrees);\n\t\t\tZ -= center.Z;\n\t\t\tY -= center.Y;\n\t\t\tset(X, Y*cs - Z*sn, Y*sn + Z*cs);\n\t\t\tZ += center.Z;\n\t\t\tY += center.Y;\n\t\t}\n\n\t\t//! Returns interpolated vector.\n\t\t/** \\param other: other vector to interpolate between\n\t\t\\param d: value between 0.0f and 1.0f. */\n\t\tvec3d getInterpolated(const vec3d& other, ik_f32 d) const\n\t\t{\n\t\t\tik_f32 inv = 1.0f - d;\n\t\t\treturn vec3d(other.X*inv + X*d,\n\t\t\t\t\t\t\t\tother.Y*inv + Y*d,\n\t\t\t\t\t\t\t\tother.Z*inv + Z*d);\n\t\t}\n\n\t\t//! Gets the Y and Z rotations of a vector.\n\t\t/** Thanks to Arras on the Irrlicht forums to add this method.\n\t\t \\return A vector representing the rotation in degrees of\n\t\tthis vector. The Z component of the vector will always be 0. */\n\t\tvec3d getHorizontalAngle()\n\t\t{\n\t\t\tvec3d angle;\n\n\t\t\tangle.Y = (T)atan2(X, Z);\n\t\t\tangle.Y *= (ik_f32)IK_RADTODEG;\n\n\t\t\tif (angle.Y < 0.0f) angle.Y += 360.0f;\n\t\t\tif (angle.Y >= 360.0f) angle.Y -= 360.0f;\n\n\t\t\tik_f32 z1 = (T)sqrt(X*X + Z*Z);\n\n\t\t\tangle.X = (T)atan2(z1, Y);\n\t\t\tangle.X *= (ik_f32)IK_RADTODEG;\n\t\t\tangle.X -= 90.0f;\n\n\t\t\tif (angle.X < 0.0f) angle.X += 360.0f;\n\t\t\tif (angle.X >= 360) angle.X -= 360.0f;\n\n\t\t\treturn angle;\n\t\t}\n\n\t\t//! Fills an array of 4 values with the vector data (usually floats).\n\t\t/** Useful for setting in shader constants for example. The fourth value\n\t\t will always be 0. */\n\t\tvoid getAs4Values(T* array)\n\t\t{\n\t\t\tarray[0] = X;\n\t\t\tarray[1] = Y;\n\t\t\tarray[2] = Z;\n\t\t\tarray[3] = 0;\n\t\t}\n\n\n\t\t// member variables\n\n\t\tT X, Y, Z;\n\t};\n\n\n\t//! Typedef for a ik_f32 3d vector, a vector using floats for X, Y and Z\n\ttypedef vec3d vec3df;\n\n\t//! Typedef for an integer 3d vector, a vector using ints for X, Y and Z\n\ttypedef vec3d vec3di;\n\n\ttemplate vec3d operator*(const S scalar, const vec3d& vector) { return vector*scalar; }\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/irrKlang.h", "language": "code", "loc": 1015, "comment_density": 0.944, "code": "/* irrKlang.h -- interface of the 'irrKlang' library\n\n Copyright (C) 2002-2018 Nikolaus Gebhardt\n\n This software is provided 'as-is', without any express or implied\n warranty. In no event will the authors be held liable for any damages\n arising from the use of this software.\n*/\n\n#ifndef __IRR_KLANG_H_INCLUDED__\n#define __IRR_KLANG_H_INCLUDED__\n\n#include \"ik_irrKlangTypes.h\"\n#include \"ik_vec3d.h\"\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_IVirtualRefCounted.h\"\n\n#include \"ik_ESoundOutputDrivers.h\"\n#include \"ik_ESoundEngineOptions.h\"\n#include \"ik_EStreamModes.h\"\n#include \"ik_SAudioStreamFormat.h\"\n#include \"ik_ISoundEngine.h\"\n#include \"ik_ISoundSource.h\"\n#include \"ik_ISound.h\"\n#include \"ik_IAudioStream.h\"\n#include \"ik_IAudioStreamLoader.h\"\n#include \"ik_ISoundEffectControl.h\"\n#include \"ik_ISoundStopEventReceiver.h\"\n#include \"ik_IFileFactory.h\"\n#include \"ik_IFileReader.h\"\n#include \"ik_ISoundDeviceList.h\"\n#include \"ik_IAudioRecorder.h\"\n#include \"ik_ISoundMixedOutputReceiver.h\"\n\n//! irrKlang Version\n#define IRR_KLANG_VERSION \"1.6.0\"\n\n/*! \\mainpage irrKlang 1.6.0 API documentation\n *\n *
\n\n * \\section contents Contents\n * General:
\n * @ref intro
\n * @ref features
\n * @ref links
\n * @ref tipsandtricks
\n *
\n * Programming irrKlang:
\n * @ref concept
\n * @ref playingSounds
\n * @ref changingSounds
\n * @ref soundSources
\n * @ref sound3d
\n * @ref removingSounds
\n * @ref events
\n * @ref memoryPlayback
\n * @ref effects
\n * @ref fileOverriding
\n * @ref audioDecoders
\n * @ref plugins
\n * @ref staticLib
\n * @ref enumeratingDevices
\n * @ref recordingAudio
\n * @ref unicode
\n *
\n * Short full examples:
\n * @ref quickstartexample
\n * @ref quickstartexample2
\n *
\n *
\n *\n * \\section intro Introduction\n *\n * Welcome to the irrKlang API documentation. This page should give you a short overview \n * over irrKlang, the high level audio library. \n * In this documentation files you'll find any information you'll need to develop applications with\n * irrKlang using C++. If you are looking for a tutorial on how to start, you'll\n * find some on the homepage of irrKlang at\n * http://www.ambiera.com/irrklang\n * or inside the SDK in the directory \\examples.\n *\n * The irrKlang library is intended to be an easy-to-use 3d and 2d sound engine, so\n * this documentation is an important part of it. If you have any questions or\n * suggestions, please take a look into the ambiera.com forum or just send a mail.\n *\n *
\n *
\n *\n *\n * \\section features Features of irrKlang\n *\n * irrKlang is a high level 2D and 3D \n * cross platform sound engine and audio library.\n * It has a very simply object orientated interface and was designed to be used\n * in games, scientific simulations, architectural visualizations and similar.\n * irrKlang plays several file formats such as\n *
    \n *
  • RIFF WAVE (*.wav)
  • \n *
  • Ogg Vorbis (*.ogg)
  • \n *
  • MPEG-1 Audio Layer 3 (*.mp3)
  • \n *
  • Free Lossless Audio Codec (*.flac)
  • \n *
  • Amiga Modules (*.mod)
  • \n *
  • Impulse Tracker (*.it)
  • \n *
  • Scream Tracker 3 (*.s3d)
  • \n *
  • Fast Tracker 2 (*.xm)
  • \n *
\n * It is also able to run on different operating systems and use several output drivers:\n *
    \n *
  • Windows 98, ME, NT 4, 2000, XP, Vista, Windows 7, Windows 8
  • \n *\t
      \n *
    • DirectSound
    • \n *
    • DirectSound8
    • \n *
    • WinMM
    • \n *\t
    \n *
  • Linux / *nix
  • \t\n *\t
      \n *
    • ALSA
    • \n *\t
    \n *
  • Mac OS X (x86 and PPC)
  • \n *\t
      \n *
    • CoreAudio
    • \n *\t
    \n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section links Links into the API documentation\n *\n * irrklang::ISoundEngine: The main class of irrKlang.
\n * Class list: List of all classes with descriptions.
\n * Class members: Good place to find forgotten features.
\n *
\n *
\n *
\n *\n *\n *\n * \\section tipsandtricks Tips and Tricks\n *\n * This section lists a few tips you might consider when implementing the sound part of your application\n * using irrKlang:\n *\n *
    \n *
  • If you can choose which audio file format is the primary one for your application,\n *\t\t\t\t\t use .OGG files, instead of for example .MP3 files. irrKlang uses a lot less memory\n * and CPU power when playing .OGGs.
  • \n *
  • To keep your application simple, each time you play a sound, you can use for example\n * play2D(\"filename.mp3\") and let irrKlang handle the rest. There is no need to implement\n * a preloading/caching/file management system for the audio playback. irrKlang will handle\n * all this by itself and will never load a file twice.
  • \n *
  • irrKlang is crashing in your application? This should not happen, irrKlang is pretty stable,\n * and in most cases, this is a problem in your code: In a lot of cases the reason is simply\n * a wrong call to irrklang::IRefCounted::drop(). Be sure you are doing it correctly. (If you are unsure,\n * temporarily remove all calls to irrklang::IRefCounted::drop() and see if this helps.)
  • \n *
\n *\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section concept Starting up the Engine\n *\n * irrKlang is designed so that it is very easy to achieve everything, its interface should\n * be very simple to use. The @ref quickstartexample shows how to play and mp3 file, and there\n * is another example, @ref quickstartexample2, showing some few more details.
\n * To start up the sound engine, you simply need to call createIrrKlangDevice(). To shut it down,\n * call IRefCounted::drop():\n *\n * \\code\n * #include \n *\n * // ...\n *\n * // start up the engine\n * irrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();\n *\t\n * // ...\n * \n * // after finished,\n * // close the engine again, similar as calling 'delete'\n * engine->drop(); \n * \\endcode\n *\n * The createIrrKlangDevice() function also accepts several parameters, so that you can \n * specify which sound driver should be used, if plugins should be used, if irrKlang\n * should run in multithreaded mode, and similar.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section playingSounds Playing Sounds\n *\n * Once you have irrKlang running (like in @ref concept), you can start playing sounds:\n *\n * \\code\n * engine->play2D(\"someSoundFile.wav\"); \n * \\endcode\n *\n * This works with all supported file types. You can replace \"someSoundFile.wav\" with\n * \"someSoundFile.mp3\", or \"someSoundFile.ogg\", for example.
\n * To play a sound looped, set the second parameter to 'true':\n *\n * \\code\n * engine->play2D(\"myMusic.mp3\", true); \n * \\endcode \n *\n * To stop this looping sound again, use engine->\\link irrklang::ISoundEngine::stopAllSounds stopAllSounds()\\endlink to stop all sounds, or\n * irrklang::ISound::stop() if you only want to stop that single sound. @ref changingSounds\n * shows how to get to that ISound interface.\n *
\n *
\n *
\n *
\n *\n *\n * \\section changingSounds Influencing Sounds during Playback\n * To influence parameters of the sound such as pan, volume or playback speed during runtime, \n * to get the play position or stop playback of single playing sounds,\n * you can use the irrklang::ISound interface. \n * irrklang::ISoundEngine::play2D (but also play3D) returns\n * a pointer to this interface when its third ('startPaused') or fourth ('track') parameter\n * was set to true:\n *\n * \\code\n * irrklang::ISound* snd = engine->play2D(\"myMusic.mp3\", true, false, true); \n *\n * // ...\n *\n * if (snd)\n * snd->setVolume(someNewValue);\n * \n * // ...\n * \n * if (snd)\n * {\n * snd->drop(); // don't forget to release the pointer once it is no longer needed by you\n * snd = 0;\n * }\n * \\endcode\n *\n * The irrklang::ISound interface can also be used to test if the sound has been finished, \n * set event receivers, pause and unpause sounds and similar. \n *
\n *
\n *
\n *
\n *\n *\n * \\section soundSources Using Sound Sources\n *\n * To be more flexible playing back sounds, irrKlang uses the concept of sound sources. \n * A sound source can be simply the name of a sound file, such as \"sound.wav\". It is possible\n * to add \"sound.wav\" as sound source to irrKlang, and play it using the sound source pointer:\n *\n * \\code\n * irrklang::ISoundSource* shootSound = engine->addSoundSourceFromFile(\"shoot.wav\"); \n *\n * engine->play2D(shootSound);\n *\n * // note: you don't need to drop() the shootSound if you don't use it anymore\n * \\endcode\n *\n * The advantage of using irrklang::ISoundSource is that it is possible to set \n * default values for this source, such\n * as volume or distances if it should be used as 3D sound:\n *\n * \\code\n * irrklang::ISoundSource* shootSound = engine->addSoundSourceFromFile(\"shoot.wav\"); \n *\n * shootSound->setDefaultVolume(0.5f);\n *\n * // shootSound will now be played with half its sound volume by default:\n * engine->play2D(shootSound);\n * \\endcode\n *\n * It is also possible to have multiple settings for the same sound file:\n *\n * \\code\n * irrklang::ISoundSource* shootSound = engine->addSoundSourceFromFile(\"shoot.wav\"); \n * irrklang::ISoundSource* shootSound2 = engine->addSoundSourceAlias(shootSound, \"silentShoot\"); \n *\n * shootSound2->setDefaultVolume(0.1f);\n *\n * // shootSound will now be played with 100% of its sound volume by default,\n * // shootSound2 will now be played 10% of its sound volume by default. It is \n * // also possible to play it using engine->play(\"silentShoot\"), now.\n * \\endcode\n *\n * Using addSoundSourceFromMemory(), it is also possible to play sounds back directly from memory,\n * without files.\n * Of course, it is not necessary to use sound sources. Using irrklang::ISound, it is\n * possible to change the settings of all sounds, too. But using sound sources, it is\n * not necessary to do this every time a sound is played.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section sound3d 3D Sound\n *\n * There is nothing difficult in playing sounds in 3D using irrKlang: Instead of using \n * irrklang::ISoundEngine::play2D(), just use irrklang::ISoundEngine::play3D(), which\n * takes a 3D position as additional parameter:\n *\n * \\code\n * irrklang::vec3df position(23,70,90);\n * engine->play3D(\"yourSound.wav\", position);\n * \\endcode\n *\n * But to make it sound realistic, you need to set a minimal sound\n * distance: If your sound is caused by a bee, it will usually have a smaller\n * sound radius than for example a jet engine. You can set default values using sound sources\n * (see @ref soundSources) or set these values after you have started the sound paused:\n *\n * \\code\n * irrklang::vec3df position(23,70,90);\n *\n * // start the sound paused:\n * irrklang::ISound* snd = engine->play3D(\"yourSound.wav\", position, false, true);\n *\n * if (snd)\n * {\n * snd->setMinDistance(30.0f); // a loud sound\n * snd->setIsPaused(false); // unpause the sound\n * }\n * \\endcode\n * \n * There is also the possibility to change the maxDistance, but it is only necessary to change this\n * in very rare circumstances.\n * If the sound moves, it is also a good idea to update its position from time to time:\n * \n * \\code\n * if (snd)\n * snd->setPosition(newPosition);\n * \\endcode\n *\n * And don't forget to drop() the sound after you don't need it anymore. If you do, it's \n * nothing severe because irrKlang will still clean up the sounds resources after it has\n * finished, but you still would waste some few bytes of memory:\n * \n * \\code\n * if (snd)\n * {\n * snd->drop();\n * snd = 0;\n * }\n * \\endcode\n *\n * To update the position of yourself, the listener of the 3D sounds, use this from\n * time to time:\n *\n * \\code\n * irrklang::vec3df position(0,0,0); // position of the listener\n * irrklang::vec3df lookDirection(10,0,10); // the direction the listener looks into\n * irrklang::vec3df velPerSecond(0,0,0); // only relevant for doppler effects\n * irrklang::vec3df upVector(0,1,0); // where 'up' is in your 3D scene\n *\n * engine->setListenerPosition(position, lookDirection, velPerSecond, upVector);\n * \\endcode\n *\n *
\n *
\n *
\n *
\n *\n *\n * \\section removingSounds Removing Sounds\n *\n * irrKlang manages the memory usage of sounds by itself, so usually, you don't have\n * to care about memory management. But if you know you need to reduce the\n * amount of used memory at a certain point in your program, you can do this:\n *\n * \\code\n * engine->removeAllSoundSources(); \n * \\endcode\n *\n * This will remove all sounds and also cause all sounds to be stopped. To remove single\n * sounds from the engine, use:\n *\n * \\code\n * engine->removeSoundSource(pointerToSomeSoundSource); \n * // or:\n * engine->removeSoundSource(\"nameOfASoundFile.wav\"); \n * \\endcode\n *\n * Note: Only removing buffered sounds will reduce the amount of memory used by irrKlang, streamed\n * sounds don't occupy a lot of memory when they are not played.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section events Using Sound Events\n *\n * In order to wait for a sound to be finished, it is simply possible to \n * poll irrklang::ISound::isFinished(). Another way would be to constantly use \n * irrklang::ISoundEngine::isCurrentlyPlaying to test wether a sound with that name or source\n * is currently playing. But of course, an event based approach is a lot nicer. That's why irrKlang\n * supports sound events.
\n * The key to sound events is the method \n * \\link irrklang::ISound::setSoundStopEventReceiver setSoundStopEventReceiver \\endlink\n * of the irrklang::ISound interface\n * (See @ref changingSounds on how to get the ISound interface):\n *\n * \\code\n * irrklang::ISound* snd = engine->play2D(\"speech.mp3\", false, false, true); \n * if (snd)\n * snd->setSoundStopEventReceiver(yourEventReceiver, 0);\n * \\endcode\n * \n * The optional second parameter of setSoundStopEventReceiver is a user pointer, set it to whatever you like.\n * 'yourEventReceiver' must be an implementation of the irrklang::ISoundStopEventReceiver interface.
\n * A whole implementation could look like this:\n *\n * \\code\n * class MySoundEndReceiver : public irrklang::ISoundStopEventReceiver\n * {\n * public:\n * virtual void OnSoundStopped (irrklang::ISound* sound, irrklang::E_STOP_EVENT_CAUSE reason, void* userData)\n * {\n * // called when the sound has ended playing\n * printf(\"sound has ended\");\n * }\n * }\n *\n * // ...\n *\n * MySoundEndReceiver* myReceiver = new MySoundEndReceiver();\n * irrklang::ISound* snd = engine->play2D(\"speech.mp3\", false, false, true); \n * if (snd)\n * snd->setSoundStopEventReceiver(myReceiver);\n *\n * myReceiver->drop(); // similar to delete\n * \\endcode\n * \n * The irrklang::ISoundStopEventReceiver::OnSoundStopped() method is guaranteed to be called when a sound or sound stream has stopped,\n * either because the sound reached its playback end, its sound source was removed,\n * ISoundEngine::stopAllSounds() has been called or the whole engine was deleted.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section memoryPlayback Memory Playback\n *\n * Using irrKlang, it is easily possible to play sounds directly from memory instead out of \n * files. There is an example project showing this: In the SDK, in /examples/03.MemoryPlayback.\n * But in short, it simply works by adding the memory as sound source (See @ref soundSources for \n * details about sound sources):\n *\n * \\code\n * engine->addSoundSourceFromMemory(pointerToMemory, memorySize, \"nameforthesound.wav\");\n * \n * // play sound now\n * engine->play2D(\"nameforthesound.wav\");\n * \\endcode\n *\n * Or using a sound source pointer:\n *\n * \\code\n * irrklang::ISoundSource* snd = \n * engine->addSoundSourceFromMemory(pointerToMemory, memorySize, \"nameforthesound.wav\");\n * \n * // play sound now\n * engine->play2D(snd);\n * \\endcode\n *\n * Note: It is also possible to overwrite the file access directly, don't use this Memory Playback\n * feature for this. See @ref fileOverriding for details.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section effects Sound Effects\n *\n * irrKlang supports the effects Chorus, Compressor, Distortion, Echo, Flanger\n * Gargle, 3DL2Reverb, ParamEq and WavesReverb, when using the sound driver \n * irrklang::ESOD_DIRECT_SOUND_8, which selected by default when using Windows.
\n *\n * Using the irrklang::ISound interface, you can obtain the irrklang::ISoundEffectControl\n * interface if the sound device supports sound effects and the last parameter ('enableSoundEffects')\n * was set to true when calling play2D():\n *\n * \\code\n * irrklang::ISound* snd = engine->play2D(\"sound.wav\", true, false, true, ESM_AUTO_DETECT, true);\n *\n * if (snd)\n * {\n * irrklang::ISoundEffectControl* fx = snd->getSoundEffectControl();\n * if (fx)\n * {\n * // enable the echo sound effect for this sound\n * fx->enableEchoSoundEffect();\n * }\n * }\n * \n * snd->drop();\n * \\endcode\n *\n * This enabled the echo sound effect for this sound. The method also supports a lot of \n * parameters, and can be called multiple times to change those parameters over time if wished.\n * There are a lot of other sound effects, see irrklang::ISoundEffectControl for details.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section fileOverriding Overriding File Access\n *\n * It is possible to let irrKlang use your own file access functions.\n * This is useful if you want to read sounds from other sources than\n * just files, for example from custom internet streams or \n * an own encrypted archive format. There is an example in the SDK in \n * examples/04.OverrideFileAccess which shows this as well.
\n *\n * The only thing to do for this is to implement your own irrklang::IFileFactory,\n * and set it in irrKlang using irrklang::ISoundEngine::addFileFactory():\n *\n * \\code\n * // a class implementing the IFileFactory interface to override irrklang file access\n * class CMyFileFactory : public irrklang::IFileFactory\n * {\n * public:\n *\n * // Opens a file for read access. Simply return 0 if file not found.\n * virtual irrklang::IFileReader* createFileReader(const ik_c8* filename)\n * {\n * // return your own irrklang::IFileReader implementation here, for example like that:\n * return new CMyReadFile(filename);\n * }\n * };\n * \n * // ...\n *\n * CMyFileFactory* myFactory = new CMyFileFactory();\n * engine->addFileFactory(myFactory);\n * myFactory->drop();\n * \\endcode\n *\n * For a full example implementation, just take a look into the SDK in examples/04.OverrideFileAccess.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section audioDecoders Adding Audio Decoders\n *\n * To add support for new file formats, it is possible to add new audio decoders\n * to irrKlang. \n * The only thing to do for this is to implement your own irrklang::IAudioStreamLoader,\n * and irrklang::IAudioStream, and set it in irrKlang using \n * irrklang::ISoundEngine::registerAudioStreamLoader():\n *\n * \\code\n * class NewAudioStreamLoader : public irrklang::IAudioStreamLoader\n * {\n * // ... returns NewAudioDecoder and the used file name suffices.\n * };\n *\n * class NewAudioDecoder : public irrklang::IAudioStream\n * {\n * public:\n * // ... decodes the new file format\n * };\n *\n * // ...\n *\n * NewAudioDecoder* loader = new NewAudioDecoder();\n * engine->registerAudioStreamLoader(loader);\n * loader->drop();\n * \\endcode\n * \n * There is an example audio decoder and loader with full source in plugins/ikpMP3, which\n * adds MP3 audio decoding capabilities to irrKlang.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section plugins Creating irrKlang Plugins\n *\n * irrKlang plugins are ikp*.dll (Windows), ikp*.so (Unix) or ikp*.dylib (MacOS) \n * files which are loaded by irrKlang at startup when the \n * irrklang::ESEO_LOAD_PLUGINS was set (which is default) or\n * irrklang::ISoundEngine::loadPlugins() was called.
\n *\n * The plugin only needs to contain the following function which will be called by irrKlang:\n *\n * \\code\n * #ifdef WIN32\n * // Windows version\n * __declspec(dllexport) void __stdcall irrKlangPluginInit(ISoundEngine* engine, const char* version)\n * #else\n * // Linux and Mac OS version\n * void irrKlangPluginInit(ISoundEngine* engine, const char* version)\n * #endif\n * {\n * // your implementation here\n * }\n * \\endcode\n *\n * In there, it is for example possible to extend irrKlang with new audio decoders,\n * see @ref audioDecoders for details.
\n * \n * There is an example plugin with full source in plugins/ikpMP3, which\n * adds MP3 audio decoding capabilities to irrKlang.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section staticLib Using irrKlang as static Lib\n *\n * If you don't want to use the irrKlang.DLL file and link irrKlang statically, you can do this\n * by simply linking to the irrKlang.lib in the bin/win32-visualstudio_lib folder. This folder\n * will only available in the pro versions of irrKlang, which you get when purchasing an irrKlang\n * license.\n *\n * To use irrKlang in this way, just define IRRKLANG_STATIC before including irrklang.h, like this:\n *\n * \\code\n * #define IRRKLANG_STATIC\n * #include \n * \\endcode\n *\n * Of course, IRRKLANG_STATIC can also simply be defined in the project/compiler settings instead of\n * in the source file.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section enumeratingDevices Enumerating sound devices\n *\n * irrKlang uses the default sound device when playing sound when started without parameters. But if you want\n * irrKlang to playback sound on one specific sound device, you may want to enumerate the available\n * sound devices on your system and select one of them. Use irrklang::createSoundDeviceList() for this. \n * This example code shows how to print a list of all available sound devices on the current system and lets\n * the user choose one of them: \n *\n * \\code\n * int main(int argc, const char** argv)\n * {\n *\t// enumerate devices\n * \n * \tirrklang::ISoundDeviceList* deviceList = createSoundDeviceList();\n * \n * \t// ask user for a sound device\n * \n * \tprintf(\"Devices available:\\n\\n\");\n * \n * \tfor (int i=0; igetDeviceCount(); ++i)\n * \t\tprintf(\"%d: %s\\n\", i, deviceList->getDeviceDescription(i));\n * \n * \tprintf(\"\\nselect a device using the number (or press any key to use default):\\n\\n\");\n * \tint deviceNumber = getch() - '0';\n * \n * \t// create device with the selected driver\n * \n * \tconst char* deviceID = deviceList->getDeviceID(deviceNumber);\n * \t\t\n * \tISoundEngine* engine = createIrrKlangDevice(irrklang::ESOD_AUTO_DETECT, \n * \t irrklang::ESEO_DEFAULT_OPTIONS,\n * \t deviceID);\n * \n * \tdeviceList->drop(); // delete device list\n *\n * // ... use engine now\n * } \n * \\endcode\n *\n * In this way, it is also possible to play back sound using two devices at the same time: Simply \n * create two irrKlang devices with each a different deviceID.
\n * Note: createSoundDeviceList() takes a driver type parameter (such as irrklang::ESOD_DIRECT_SOUND8), which you\n * have to set to the same value as the first parameter you want to use with createIrrKlangDevice(), if it is \n * other than irrklang::ESOD_AUTO_DETECT.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section recordingAudio Recording Audio\n *\n * irrKlang is able to record audio from sound capturing devices such as microphones (currently only \n * supported in windows). Use the irrklang::IAudioRecorder interface to do this. The following example shows how\n * to record some audio and play it back again using the engine: \n *\n * \\code\n * int main(int argc, const char** argv)\n * {\n *\tirrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();\n *\tirrklang::IAudioRecorder* recorder = irrklang::createIrrKlangAudioRecorder(engine);\n *\n *\tif (!engine || !recorder)\n *\t{\n *\t\tprintf(\"Could not create audio engine or audio recorder\\n\");\n *\t\treturn 1;\n *\t}\n *\n *\tprintf(\"\\nPress any key to start recording audio...\\n\");\n *\tgetch();\n *\n *\t// record some audio\n *\n *\trecorder->startRecordingBufferedAudio();\n *\n *\tprintf(\"\\nRECORDING. Press any key to stop...\\n\");\n *\tgetch();\n *\n *\trecorder->stopRecordingAudio();\n *\n *\tprintf(\"\\nRecording done, recorded %dms of audio.\\n\", \n *\t\trecorder->getAudioFormat().FrameCount * 1000 / recorder->getAudioFormat().SampleRate );\n *\tprintf(\"Press any key to play back recorded audio...\\n\");\n *\tgetch();\n *\n *\t// play the recorded audio\n *\trecorder->addSoundSourceFromRecordedAudio(\"myRecordedVoice\");\n *\tengine->play2D(\"myRecordedVoice\", true);\n *\n *\t// wait until user presses a key\n *\tprintf(\"\\nPress any key to quit...\");\n *\tgetch();\n *\n *\trecorder->drop();\n *\tengine->drop(); // delete engine\n *\n *\treturn 0;\n * } \n * \\endcode\n *\n * In order to select a specific audio capturing device for recording, it is necessary to enumerate\n * the available devices. Simply replace the first to lines of code of the example above with code\n * like this to list all devices and select one:\n *\n * \\code\n * // enumerate recording devices and ask user to select one\n * \n * irrklang::ISoundDeviceList* deviceList = irrklang::createAudioRecorderDeviceList();\n *\n * printf(\"Devices available:\\n\\n\");\n *\n * for (int i=0; igetDeviceCount(); ++i)\n * printf(\"%d: %s\\n\", i, deviceList->getDeviceDescription(i));\n *\n * printf(\"\\nselect a device using the number (or press any key to use default):\\n\\n\");\n * int deviceNumber = getch() - '0';\n *\n * // create recording device with the selected driver\n *\n * const char* deviceID = deviceList->getDeviceID(deviceNumber);\n * irrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();\n * irrklang::IAudioRecorder* recorder = \n * irrklang::createIrrKlangAudioRecorder(engine, irrklang::ESOD_AUTO_DETECT, deviceID);\n *\n * \\endcode\n *\n *
\n *
\n *
\n *
\n *\n *\n * \\section unicode Unicode support\n *\n * irrKlang supports unicode on all operating systems. Internally, it uses UTF8, and all functions accepting strings\n * and file names take UTF8 strings. If you are running irrKlang on Windows, and are using the UNICODE define or using\n * wchar_t* strings directly, you can do this as well. Use the irrKlang provided function makeUTF8fromUTF16string() to \n * convert your wchar_t* string to a char* string.\n *\n * This example shows how:\n *\n * \\code\n * const wchar_t* yourFilename = L\"SomeUnicodeFilename.wav\"; // assuming this is the file name you get from some of your functions\n *\n * const int nBufferSize = 2048; // large enough, but best would be wcslen(yourFilename)*3.\n * char strBuffer[nBufferSize]; \n * irrklang::makeUTF8fromUTF16string(yourFilename, strBuffer, nBufferSize);\n *\n * // now the converted file name is in strBuffer. We can play it for example now:\n * engine->play2D(strBuffer);\n * \\endcode\n *\n * Of course, you can use any other unicode conversion function for this. makeUTF8fromUTF16string() is only provided\n * for convenience.\n *
\n *
\n *
\n *
\n *\n *\n *\n *\n *\n * \\section quickstartexample Quick Start Example\n *\n * To simply start the engine and play a mp3 file, use code like this:\n *\n * \\code\n * #include \n * #include \n * #pragma comment(lib, \"irrKlang.lib\") // link with irrKlang.dll\n *\n * int main(int argc, const char** argv)\n * {\n *\tirrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();\n *\tif (!engine) return 1; // could not start engine\n *\n *\tengine->play2D(\"someMusic.mp3\", true); // play some mp3 file, looped\n * \n *\tstd::cin.get(); // wait until user presses a key\n * \n *\tengine->drop(); // delete engine\n *\treturn 0;\n * } \n * \\endcode\n *\n * A mp3 file is being played until the user presses enter in this example. \n * As you can see, irrKlang uses namespaces, all of\n * the classes are located in the namespace irrklang. If you don't want to write \n * this in front of every class and function you are using, simply write \n *\n * \\code\n * using namespace irrklang;\n * \\endcode\n * in front of your code, as also shown in the next example.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section quickstartexample2 Quick Start Example 2\n *\n * The following is a simple interactive application, starting up the sound engine and \n * playing some streaming .ogg music file and a .wav sound effect every time the user\n * presses a key.\n *\n * \\code\n * #include \n * #include \n * using namespace irrklang;\n *\n * #pragma comment(lib, \"irrKlang.lib\") // link with irrKlang.dll\n *\n *\n * int main(int argc, const char** argv)\n * {\n * \t// start the sound engine with default parameters\n * \tISoundEngine* engine = createIrrKlangDevice();\n *\n * \tif (!engine)\n * \t\treturn 0; // error starting up the engine\n *\n * \t// play some sound stream, looped\n * \tengine->play2D(\"../../media/helltroopers.ogg\", true);\n *\n * \tstd::cout << \"\\nHello World!\\n\";\n *\n * \tchar i = 0;\n *\n * \twhile(i != 'q')\n * \t{\n * \t\tstd::cout << \"Press any key to play some sound, press 'q' to quit.\\n\";\n *\n * \t\t// play a single sound\n * \t\tengine->play2D(\"../../media/bell.wav\");\n *\n * \t\tstd::cin >> i; // wait for user to press some key\n * \t}\n *\n * \tengine->drop(); // delete engine\n * \treturn 0;\n * }\n *\n * \\endcode\n */\n\n#if defined(IRRKLANG_STATIC)\n #define IRRKLANG_API\n#else\n #if (defined(WIN32) || defined(WIN64) || defined(_MSC_VER))\n #ifdef IRRKLANG_EXPORTS\n #define IRRKLANG_API __declspec(dllexport)\n #else\n #define IRRKLANG_API __declspec(dllimport)\n #endif // IRRKLANG_EXPORT\n #else\n #define IRRKLANG_API __attribute__((visibility(\"default\")))\n #endif // defined(WIN32) || defined(WIN64)\n#endif // IRRKLANG_STATIC\n\n#if defined(_STDCALL_SUPPORTED)\n#define IRRKLANGCALLCONV __stdcall // Declare the calling convention.\n#else\n#define IRRKLANGCALLCONV\n#endif // STDCALL_SUPPORTED\n\n//! Everything in the irrKlang Sound Engine can be found in this namespace.\nnamespace irrklang\n{\n\t//! Creates an irrKlang device. The irrKlang device is the root object for using the sound engine.\n\t/** \\param driver The sound output driver to be used for sound output. Use irrklang::ESOD_AUTO_DETECT\n\tto let irrKlang decide which driver will be best.\n\t\\param options A combination of irrklang::E_SOUND_ENGINE_OPTIONS literals. Default value is \n\tirrklang::ESEO_DEFAULT_OPTIONS.\n\t\\param deviceID Some additional optional deviceID for the audio driver. If not needed, simple\n\tset this to 0. \n\tThis can be used for example to set a specific ALSA output pcm device for output\n\t(\"default\" or \"hw\", for example). For most driver types, available deviceIDs can be \n\tenumerated using createSoundDeviceList().\n\tSee @ref enumeratingDevices for an example or ISoundDeviceList or details.\n\t\\param sdk_version_do_not_use Don't use or change this parameter. Always set it to\n\tIRRKLANG_SDK_VERSION, which is done by default. This is needed for sdk version checks.\n\t\\return Returns pointer to the created irrKlang device or null if the\n\tdevice could not be created. If you don't need the device, use ISoundEngine::drop() to\n\tdelete it. See IRefCounted::drop() for details.\n\t*/\n\tIRRKLANG_API ISoundEngine* IRRKLANGCALLCONV createIrrKlangDevice(\n\t\tE_SOUND_OUTPUT_DRIVER driver = ESOD_AUTO_DETECT,\n\t\tint options = ESEO_DEFAULT_OPTIONS,\n\t\tconst char* deviceID = 0,\n\t\tconst char* sdk_version_do_not_use = IRR_KLANG_VERSION);\n\n\n\t//! Creates a list of available sound devices for the driver type. \n\t/** The device IDs in this list can be used as parameter to createIrrKlangDevice() to\n\tmake irrKlang use a special sound device. See @ref enumeratingDevices for an example on how\n\tto use this.\n\t\\param driver The sound output driver of which the list is generated. Set it irrklang::ESOD_AUTO_DETECT\n\tto let this function use the same device as createIrrKlangDevice() would choose.\n\t\\param sdk_version_do_not_use Don't use or change this parameter. Always set it to\n\tIRRKLANG_SDK_VERSION, which is done by default. This is needed for sdk version checks.\n\t\\return Returns a pointer to the list of enumerated sound devices for the selected sound driver.\n\tThe device IDs in this list can be used as parameter to createIrrKlangDevice() to\n\tmake irrKlang use a special sound device. \n\tAfter you don't need the list anymore, call ISoundDeviceList::drop() in order to free its memory. */\n\tIRRKLANG_API ISoundDeviceList* IRRKLANGCALLCONV createSoundDeviceList(\n\t\tE_SOUND_OUTPUT_DRIVER driver = ESOD_AUTO_DETECT,\n\t\tconst char* sdk_version_do_not_use = IRR_KLANG_VERSION);\n\n\n\t//! Creates an irrKlang audio recording device. The IAudioRecorder is the root object for recording audio.\n\t/** If you want to play back recorded audio as well, create the ISoundEngine first using\n\tcreateIrrKlangDevice() and then the IAudioRecorder using createIrrKlangAudioRecorder(), where\n\tyou set the ISoundEngine as first parameter. See @ref recordingAudio for an example on how to use this.\n\tNote: audio recording is a very new feature a still beta in irrKlang. It currently only works in Windows\n\tand with DirectSound (subject to change).\n\t\\param irrKlangDeviceForPlayback A pointer to the already existing sound device used for playback\n\tof audio. Sound sources recorded with the IAudioRecorder will be added into that device so that\n\tthey can be played back there.\n\t\\param driver The sound output driver to be used for recording audio. Use irrklang::ESOD_AUTO_DETECT\n\tto let irrKlang decide which driver will be best.\n\t\\param deviceID Some additional optional deviceID for the audio driver. If not needed, simple\n\tset this to 0. Use createAudioRecorderDeviceList() to get a list of all deviceIDs.\n\t\\param sdk_version_do_not_use Don't use or change this parameter. Always set it to\n\tIRRKLANG_SDK_VERSION, which is done by default. This is needed for sdk version checks.\n\t\\return Returns pointer to the created irrKlang device or null if the\n\tdevice could not be created. If you don't need the device, use ISoundEngine::drop() to\n\tdelete it. See IRefCounted::drop() for details.\n\t*/\n\tIRRKLANG_API IAudioRecorder* IRRKLANGCALLCONV createIrrKlangAudioRecorder(\n\t\tISoundEngine* irrKlangDeviceForPlayback,\n\t\tE_SOUND_OUTPUT_DRIVER driver = ESOD_AUTO_DETECT,\n\t\tconst char* deviceID = 0,\n\t\tconst char* sdk_version_do_not_use = IRR_KLANG_VERSION);\n\n\t//! Creates a list of available recording devices for the driver type. \n\t/** The device IDs in this list can be used as parameter to createIrrKlangAudioRecorder() to\n\tmake irrKlang use a special recording device. \n\t\\param driver The sound output driver of which the list is generated. Set it irrklang::ESOD_AUTO_DETECT\n\tto let this function use the same device as createIrrKlangDevice() would choose.\n\t\\param sdk_version_do_not_use Don't use or change this parameter. Always set it to\n\tIRRKLANG_SDK_VERSION, which is done by default. This is needed for sdk version checks.\n\t\\return Returns a pointer to the list of enumerated recording devices for the selected sound driver.\n\tThe device IDs in this list can be used as parameter to createIrrKlangAudioRecorder() to\n\tmake irrKlang use a special sound device. \n\tAfter you don't need the list anymore, call ISoundDeviceList::drop() in order to free its memory. */\n\tIRRKLANG_API ISoundDeviceList* IRRKLANGCALLCONV createAudioRecorderDeviceList(\n\t\tE_SOUND_OUTPUT_DRIVER driver = ESOD_AUTO_DETECT,\n\t\tconst char* sdk_version_do_not_use = IRR_KLANG_VERSION);\n\n\n\t//! Converts a wchar_t string to an utf8 string, useful when using Windows in unicode mode. \n\t/** irrKlang works with unicode file names, and accepts char* strings as parameters for names and filenames.\n\tIf you are running irrKlang in Windows, and working with wchar_t* pointers instead of char* ones, \n\tyou can use this function to create a char* (UTF8) representation of your wchar_t* (UTF16) string.\n\tWorks for filenames and other strings.\n\t\\param pInputString zero terminated input string.\n\t\\param pOutputBuffer the buffer where the converted string is written to. Be sure that this buffer\n\thas a big enough size. A good size would be three times the string length of your input buffer, like\n\twcslen(yourInputBuffer)*3. Because each wchar_t can be represented by up to 3 chars.\n\t\\param outputBufferSize size of your output buffer.\n\t\\return Returns true if successful, and false if not. If 'false' is returned, maybe your buffer was too small. */\n\tIRRKLANG_API bool IRRKLANGCALLCONV makeUTF8fromUTF16string(\n\t\tconst wchar_t* pInputString, char* pOutputBuffer, int outputBufferSize);\n\n\n} // end namespace irrklang\n\n\n/*! \\file irrKlang.h\n \\brief Main header file of the irrKlang sound library, the only file needed to include.\n*/\n\n#endif\n\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.606, "dedup_hash": "b723a5c315ca32ba", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_khr", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Khr", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/KHR/khrplatform.h", "language": "code", "loc": 258, "comment_density": 0.612, "code": "#ifndef __khrplatform_h_\n#define __khrplatform_h_\n\n/*\n** Copyright (c) 2008-2009 The Khronos Group Inc.\n**\n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n**\n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n**\n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n/* Khronos platform-specific types and definitions.\n *\n * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $\n *\n * Adopters may modify this file to suit their platform. Adopters are\n * encouraged to submit platform specific modifications to the Khronos\n * group so that they can be included in future versions of this file.\n * Please submit changes by sending them to the public Khronos Bugzilla\n * (http://khronos.org/bugzilla) by filing a bug against product\n * \"Khronos (general)\" component \"Registry\".\n *\n * A predefined template which fills in some of the bug fields can be\n * reached using http://tinyurl.com/khrplatform-h-bugreport, but you\n * must create a Bugzilla login first.\n *\n *\n * See the Implementer's Guidelines for information about where this file\n * should be located on your system and for more details of its use:\n * http://www.khronos.org/registry/implementers_guide.pdf\n *\n * This file should be included as\n * #include \n * by Khronos client API header files that use its types and defines.\n *\n * The types in khrplatform.h should only be used to define API-specific types.\n *\n * Types defined in khrplatform.h:\n * khronos_int8_t signed 8 bit\n * khronos_uint8_t unsigned 8 bit\n * khronos_int16_t signed 16 bit\n * khronos_uint16_t unsigned 16 bit\n * khronos_int32_t signed 32 bit\n * khronos_uint32_t unsigned 32 bit\n * khronos_int64_t signed 64 bit\n * khronos_uint64_t unsigned 64 bit\n * khronos_intptr_t signed same number of bits as a pointer\n * khronos_uintptr_t unsigned same number of bits as a pointer\n * khronos_ssize_t signed size\n * khronos_usize_t unsigned size\n * khronos_float_t signed 32 bit floating point\n * khronos_time_ns_t unsigned 64 bit time in nanoseconds\n * khronos_utime_nanoseconds_t unsigned time interval or absolute time in\n * nanoseconds\n * khronos_stime_nanoseconds_t signed time interval in nanoseconds\n * khronos_boolean_enum_t enumerated boolean type. This should\n * only be used as a base type when a client API's boolean type is\n * an enum. Client APIs which use an integer or other type for\n * booleans cannot use this as the base type for their boolean.\n *\n * Tokens defined in khrplatform.h:\n *\n * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.\n *\n * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.\n * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.\n *\n * Calling convention macros defined in this file:\n * KHRONOS_APICALL\n * KHRONOS_APIENTRY\n * KHRONOS_APIATTRIBUTES\n *\n * These may be used in function prototypes as:\n *\n * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(\n * int arg1,\n * int arg2) KHRONOS_APIATTRIBUTES;\n */\n\n/*-------------------------------------------------------------------------\n * Definition of KHRONOS_APICALL\n *-------------------------------------------------------------------------\n * This precedes the return type of the function in the function prototype.\n */\n#if defined(_WIN32) && !defined(__SCITECH_SNAP__)\n# define KHRONOS_APICALL __declspec(dllimport)\n#elif defined (__SYMBIAN32__)\n# define KHRONOS_APICALL IMPORT_C\n#elif defined(__ANDROID__)\n# include \n# define KHRONOS_APICALL __attribute__((visibility(\"default\"))) __NDK_FPABI__\n#else\n# define KHRONOS_APICALL\n#endif\n\n/*-------------------------------------------------------------------------\n * Definition of KHRONOS_APIENTRY\n *-------------------------------------------------------------------------\n * This follows the return type of the function and precedes the function\n * name in the function prototype.\n */\n#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)\n /* Win32 but not WinCE */\n# define KHRONOS_APIENTRY __stdcall\n#else\n# define KHRONOS_APIENTRY\n#endif\n\n/*-------------------------------------------------------------------------\n * Definition of KHRONOS_APIATTRIBUTES\n *-------------------------------------------------------------------------\n * This follows the closing parenthesis of the function prototype arguments.\n */\n#if defined (__ARMCC_2__)\n#define KHRONOS_APIATTRIBUTES __softfp\n#else\n#define KHRONOS_APIATTRIBUTES\n#endif\n\n/*-------------------------------------------------------------------------\n * basic type definitions\n *-----------------------------------------------------------------------*/\n#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)\n\n\n/*\n * Using \n */\n#include \ntypedef int32_t khronos_int32_t;\ntypedef uint32_t khronos_uint32_t;\ntypedef int64_t khronos_int64_t;\ntypedef uint64_t khronos_uint64_t;\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#elif defined(__VMS ) || defined(__sgi)\n\n/*\n * Using \n */\n#include \ntypedef int32_t khronos_int32_t;\ntypedef uint32_t khronos_uint32_t;\ntypedef int64_t khronos_int64_t;\ntypedef uint64_t khronos_uint64_t;\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)\n\n/*\n * Win32\n */\ntypedef __int32 khronos_int32_t;\ntypedef unsigned __int32 khronos_uint32_t;\ntypedef __int64 khronos_int64_t;\ntypedef unsigned __int64 khronos_uint64_t;\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#elif defined(__sun__) || defined(__digital__)\n\n/*\n * Sun or Digital\n */\ntypedef int khronos_int32_t;\ntypedef unsigned int khronos_uint32_t;\n#if defined(__arch64__) || defined(_LP64)\ntypedef long int khronos_int64_t;\ntypedef unsigned long int khronos_uint64_t;\n#else\ntypedef long long int khronos_int64_t;\ntypedef unsigned long long int khronos_uint64_t;\n#endif /* __arch64__ */\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#elif 0\n\n/*\n * Hypothetical platform with no float or int64 support\n */\ntypedef int khronos_int32_t;\ntypedef unsigned int khronos_uint32_t;\n#define KHRONOS_SUPPORT_INT64 0\n#define KHRONOS_SUPPORT_FLOAT 0\n\n#else\n\n/*\n * Generic fallback\n */\n#include \ntypedef int32_t khronos_int32_t;\ntypedef uint32_t khronos_uint32_t;\ntypedef int64_t khronos_int64_t;\ntypedef uint64_t khronos_uint64_t;\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#endif\n\n\n/*\n * Types that are (so far) the same on all platforms\n */\ntypedef signed char khronos_int8_t;\ntypedef unsigned char khronos_uint8_t;\ntypedef signed short int khronos_int16_t;\ntypedef unsigned short int khronos_uint16_t;\n\n/*\n * Types that differ between LLP64 and LP64 architectures - in LLP64,\n * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears\n * to be the only LLP64 architecture in current use.\n */\n#ifdef _WIN64\ntypedef signed long long int khronos_intptr_t;\ntypedef unsigned long long int khronos_uintptr_t;\ntypedef signed long long int khronos_ssize_t;\ntypedef unsigned long long int khronos_usize_t;\n#else\ntypedef signed long int khronos_intptr_t;\ntypedef unsigned long int khronos_uintptr_t;\ntypedef signed long int khronos_ssize_t;\ntypedef unsigned long int khronos_usize_t;\n#endif\n\n#if KHRONOS_SUPPORT_FLOAT\n/*\n * Float type\n */\ntypedef float khronos_float_t;\n#endif\n\n#if KHRONOS_SUPPORT_INT64\n/* Time types\n *\n * These types can be used to represent a time interval in nanoseconds or\n * an absolute Unadjusted System Time. Unadjusted System Time is the number\n * of nanoseconds since some arbitrary system event (e.g. since the last\n * time the system booted). The Unadjusted System Time is an unsigned\n * 64 bit value that wraps back to 0 every 584 years. Time intervals\n * may be either signed or unsigned.\n */\ntypedef khronos_uint64_t khronos_utime_nanoseconds_t;\ntypedef khronos_int64_t khronos_stime_nanoseconds_t;\n#endif\n\n/*\n * Dummy value used to pad enum types to 32 bits.\n */\n#ifndef KHRONOS_MAX_ENUM\n#define KHRONOS_MAX_ENUM 0x7FFFFFFF\n#endif\n\n/*\n * Enumerated boolean type\n *\n * Values other than zero should be considered to be true. Therefore\n * comparisons should not be made against KHRONOS_TRUE.\n */\ntypedef enum {\n KHRONOS_FALSE = 0,\n KHRONOS_TRUE = 1,\n KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM\n} khronos_boolean_enum_t;\n\n#endif /* __khrplatform_h_ */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.612, "dedup_hash": "63c07c7f994e5a33", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_learnopengl", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Learnopengl", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/compute/geometry_shader/tessellation/postprocessing", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "includes/learnopengl/animation.h", "language": "code", "loc": 94, "comment_density": 0.032, "code": "#pragma once\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct AssimpNodeData\n{\n\tglm::mat4 transformation;\n\tstd::string name;\n\tint childrenCount;\n\tstd::vector children;\n};\n\nclass Animation\n{\npublic:\n\tAnimation() = default;\n\n\tAnimation(const std::string& animationPath, Model* model)\n\t{\n\t\tAssimp::Importer importer;\n\t\tconst aiScene* scene = importer.ReadFile(animationPath, aiProcess_Triangulate);\n\t\tassert(scene && scene->mRootNode);\n\t\tauto animation = scene->mAnimations[0];\n\t\tm_Duration = animation->mDuration;\n\t\tm_TicksPerSecond = animation->mTicksPerSecond;\n\t\taiMatrix4x4 globalTransformation = scene->mRootNode->mTransformation;\n\t\tglobalTransformation = globalTransformation.Inverse();\n\t\tReadHierarchyData(m_RootNode, scene->mRootNode);\n\t\tReadMissingBones(animation, *model);\n\t}\n\n\t~Animation()\n\t{\n\t}\n\n\tBone* FindBone(const std::string& name)\n\t{\n\t\tauto iter = std::find_if(m_Bones.begin(), m_Bones.end(),\n\t\t\t[&](const Bone& Bone)\n\t\t\t{\n\t\t\t\treturn Bone.GetBoneName() == name;\n\t\t\t}\n\t\t);\n\t\tif (iter == m_Bones.end()) return nullptr;\n\t\telse return &(*iter);\n\t}\n\n\t\n\tinline float GetTicksPerSecond() { return m_TicksPerSecond; }\n\tinline float GetDuration() { return m_Duration;}\n\tinline const AssimpNodeData& GetRootNode() { return m_RootNode; }\n\tinline const std::map& GetBoneIDMap() \n\t{ \n\t\treturn m_BoneInfoMap;\n\t}\n\nprivate:\n\tvoid ReadMissingBones(const aiAnimation* animation, Model& model)\n\t{\n\t\tint size = animation->mNumChannels;\n\n\t\tauto& boneInfoMap = model.GetBoneInfoMap();//getting m_BoneInfoMap from Model class\n\t\tint& boneCount = model.GetBoneCount(); //getting the m_BoneCounter from Model class\n\n\t\t//reading channels(bones engaged in an animation and their keyframes)\n\t\tfor (int i = 0; i < size; i++)\n\t\t{\n\t\t\tauto channel = animation->mChannels[i];\n\t\t\tstd::string boneName = channel->mNodeName.data;\n\n\t\t\tif (boneInfoMap.find(boneName) == boneInfoMap.end())\n\t\t\t{\n\t\t\t\tboneInfoMap[boneName].id = boneCount;\n\t\t\t\tboneCount++;\n\t\t\t}\n\t\t\tm_Bones.push_back(Bone(channel->mNodeName.data,\n\t\t\t\tboneInfoMap[channel->mNodeName.data].id, channel));\n\t\t}\n\n\t\tm_BoneInfoMap = boneInfoMap;\n\t}\n\n\tvoid ReadHierarchyData(AssimpNodeData& dest, const aiNode* src)\n\t{\n\t\tassert(src);\n\n\t\tdest.name = src->mName.data;\n\t\tdest.transformation = AssimpGLMHelpers::ConvertMatrixToGLMFormat(src->mTransformation);\n\t\tdest.childrenCount = src->mNumChildren;\n\n\t\tfor (int i = 0; i < src->mNumChildren; i++)\n\t\t{\n\t\t\tAssimpNodeData newData;\n\t\t\tReadHierarchyData(newData, src->mChildren[i]);\n\t\t\tdest.children.push_back(newData);\n\t\t}\n\t}\n\tfloat m_Duration;\n\tint m_TicksPerSecond;\n\tstd::vector m_Bones;\n\tAssimpNodeData m_RootNode;\n\tstd::map m_BoneInfoMap;\n};\n\n"}, {"path": "includes/learnopengl/animator.h", "language": "code", "loc": 65, "comment_density": 0.0, "code": "#pragma once\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nclass Animator\n{\npublic:\n\tAnimator(Animation* animation)\n\t{\n\t\tm_CurrentTime = 0.0;\n\t\tm_CurrentAnimation = animation;\n\n\t\tm_FinalBoneMatrices.reserve(100);\n\n\t\tfor (int i = 0; i < 100; i++)\n\t\t\tm_FinalBoneMatrices.push_back(glm::mat4(1.0f));\n\t}\n\n\tvoid UpdateAnimation(float dt)\n\t{\n\t\tm_DeltaTime = dt;\n\t\tif (m_CurrentAnimation)\n\t\t{\n\t\t\tm_CurrentTime += m_CurrentAnimation->GetTicksPerSecond() * dt;\n\t\t\tm_CurrentTime = fmod(m_CurrentTime, m_CurrentAnimation->GetDuration());\n\t\t\tCalculateBoneTransform(&m_CurrentAnimation->GetRootNode(), glm::mat4(1.0f));\n\t\t}\n\t}\n\n\tvoid PlayAnimation(Animation* pAnimation)\n\t{\n\t\tm_CurrentAnimation = pAnimation;\n\t\tm_CurrentTime = 0.0f;\n\t}\n\n\tvoid CalculateBoneTransform(const AssimpNodeData* node, glm::mat4 parentTransform)\n\t{\n\t\tstd::string nodeName = node->name;\n\t\tglm::mat4 nodeTransform = node->transformation;\n\n\t\tBone* Bone = m_CurrentAnimation->FindBone(nodeName);\n\n\t\tif (Bone)\n\t\t{\n\t\t\tBone->Update(m_CurrentTime);\n\t\t\tnodeTransform = Bone->GetLocalTransform();\n\t\t}\n\n\t\tglm::mat4 globalTransformation = parentTransform * nodeTransform;\n\n\t\tauto boneInfoMap = m_CurrentAnimation->GetBoneIDMap();\n\t\tif (boneInfoMap.find(nodeName) != boneInfoMap.end())\n\t\t{\n\t\t\tint index = boneInfoMap[nodeName].id;\n\t\t\tglm::mat4 offset = boneInfoMap[nodeName].offset;\n\t\t\tm_FinalBoneMatrices[index] = globalTransformation * offset;\n\t\t}\n\n\t\tfor (int i = 0; i < node->childrenCount; i++)\n\t\t\tCalculateBoneTransform(&node->children[i], globalTransformation);\n\t}\n\n\tstd::vector GetFinalBoneMatrices()\n\t{\n\t\treturn m_FinalBoneMatrices;\n\t}\n\nprivate:\n\tstd::vector m_FinalBoneMatrices;\n\tAnimation* m_CurrentAnimation;\n\tfloat m_CurrentTime;\n\tfloat m_DeltaTime;\n\n};\n"}, {"path": "includes/learnopengl/animdata.h", "language": "code", "loc": 10, "comment_density": 0.2, "code": "#pragma once\n\n#include\n\nstruct BoneInfo\n{\n\t/*id is index in finalBoneMatrices*/\n\tint id;\n\n\t/*offset matrix transforms vertex from model space to bone space*/\n\tglm::mat4 offset;\n\n};\n#pragma once\n"}, {"path": "includes/learnopengl/assimp_glm_helpers.h", "language": "code", "loc": 28, "comment_density": 0.036, "code": "#pragma once\n\n#include\n#include\n#include\n#include\n#include\n\n\nclass AssimpGLMHelpers\n{\npublic:\n\n\tstatic inline glm::mat4 ConvertMatrixToGLMFormat(const aiMatrix4x4& from)\n\t{\n\t\tglm::mat4 to;\n\t\t//the a,b,c,d in assimp is the row ; the 1,2,3,4 is the column\n\t\tto[0][0] = from.a1; to[1][0] = from.a2; to[2][0] = from.a3; to[3][0] = from.a4;\n\t\tto[0][1] = from.b1; to[1][1] = from.b2; to[2][1] = from.b3; to[3][1] = from.b4;\n\t\tto[0][2] = from.c1; to[1][2] = from.c2; to[2][2] = from.c3; to[3][2] = from.c4;\n\t\tto[0][3] = from.d1; to[1][3] = from.d2; to[2][3] = from.d3; to[3][3] = from.d4;\n\t\treturn to;\n\t}\n\n\tstatic inline glm::vec3 GetGLMVec(const aiVector3D& vec) \n\t{ \n\t\treturn glm::vec3(vec.x, vec.y, vec.z); \n\t}\n\n\tstatic inline glm::quat GetGLMQuat(const aiQuaternion& pOrientation)\n\t{\n\t\treturn glm::quat(pOrientation.w, pOrientation.x, pOrientation.y, pOrientation.z);\n\t}\n};"}, {"path": "includes/learnopengl/bone.h", "language": "code", "loc": 160, "comment_density": 0.006, "code": "#pragma once\n\n/* Container for bone data */\n\n#include \n#include \n#include \n#include \n#define GLM_ENABLE_EXPERIMENTAL\n#include \n#include \n\nstruct KeyPosition\n{\n\tglm::vec3 position;\n\tfloat timeStamp;\n};\n\nstruct KeyRotation\n{\n\tglm::quat orientation;\n\tfloat timeStamp;\n};\n\nstruct KeyScale\n{\n\tglm::vec3 scale;\n\tfloat timeStamp;\n};\n\nclass Bone\n{\npublic:\n\tBone(const std::string& name, int ID, const aiNodeAnim* channel)\n\t\t:\n\t\tm_Name(name),\n\t\tm_ID(ID),\n\t\tm_LocalTransform(1.0f)\n\t{\n\t\tm_NumPositions = channel->mNumPositionKeys;\n\n\t\tfor (int positionIndex = 0; positionIndex < m_NumPositions; ++positionIndex)\n\t\t{\n\t\t\taiVector3D aiPosition = channel->mPositionKeys[positionIndex].mValue;\n\t\t\tfloat timeStamp = channel->mPositionKeys[positionIndex].mTime;\n\t\t\tKeyPosition data;\n\t\t\tdata.position = AssimpGLMHelpers::GetGLMVec(aiPosition);\n\t\t\tdata.timeStamp = timeStamp;\n\t\t\tm_Positions.push_back(data);\n\t\t}\n\n\t\tm_NumRotations = channel->mNumRotationKeys;\n\t\tfor (int rotationIndex = 0; rotationIndex < m_NumRotations; ++rotationIndex)\n\t\t{\n\t\t\taiQuaternion aiOrientation = channel->mRotationKeys[rotationIndex].mValue;\n\t\t\tfloat timeStamp = channel->mRotationKeys[rotationIndex].mTime;\n\t\t\tKeyRotation data;\n\t\t\tdata.orientation = AssimpGLMHelpers::GetGLMQuat(aiOrientation);\n\t\t\tdata.timeStamp = timeStamp;\n\t\t\tm_Rotations.push_back(data);\n\t\t}\n\n\t\tm_NumScalings = channel->mNumScalingKeys;\n\t\tfor (int keyIndex = 0; keyIndex < m_NumScalings; ++keyIndex)\n\t\t{\n\t\t\taiVector3D scale = channel->mScalingKeys[keyIndex].mValue;\n\t\t\tfloat timeStamp = channel->mScalingKeys[keyIndex].mTime;\n\t\t\tKeyScale data;\n\t\t\tdata.scale = AssimpGLMHelpers::GetGLMVec(scale);\n\t\t\tdata.timeStamp = timeStamp;\n\t\t\tm_Scales.push_back(data);\n\t\t}\n\t}\n\t\n\tvoid Update(float animationTime)\n\t{\n\t\tglm::mat4 translation = InterpolatePosition(animationTime);\n\t\tglm::mat4 rotation = InterpolateRotation(animationTime);\n\t\tglm::mat4 scale = InterpolateScaling(animationTime);\n\t\tm_LocalTransform = translation * rotation * scale;\n\t}\n\tglm::mat4 GetLocalTransform() { return m_LocalTransform; }\n\tstd::string GetBoneName() const { return m_Name; }\n\tint GetBoneID() { return m_ID; }\n\t\n\n\n\tint GetPositionIndex(float animationTime)\n\t{\n\t\tfor (int index = 0; index < m_NumPositions - 1; ++index)\n\t\t{\n\t\t\tif (animationTime < m_Positions[index + 1].timeStamp)\n\t\t\t\treturn index;\n\t\t}\n\t\tassert(0);\n\t}\n\n\tint GetRotationIndex(float animationTime)\n\t{\n\t\tfor (int index = 0; index < m_NumRotations - 1; ++index)\n\t\t{\n\t\t\tif (animationTime < m_Rotations[index + 1].timeStamp)\n\t\t\t\treturn index;\n\t\t}\n\t\tassert(0);\n\t}\n\n\tint GetScaleIndex(float animationTime)\n\t{\n\t\tfor (int index = 0; index < m_NumScalings - 1; ++index)\n\t\t{\n\t\t\tif (animationTime < m_Scales[index + 1].timeStamp)\n\t\t\t\treturn index;\n\t\t}\n\t\tassert(0);\n\t}\n\n\nprivate:\n\n\tfloat GetScaleFactor(float lastTimeStamp, float nextTimeStamp, float animationTime)\n\t{\n\t\tfloat scaleFactor = 0.0f;\n\t\tfloat midWayLength = animationTime - lastTimeStamp;\n\t\tfloat framesDiff = nextTimeStamp - lastTimeStamp;\n\t\tscaleFactor = midWayLength / framesDiff;\n\t\treturn scaleFactor;\n\t}\n\n\tglm::mat4 InterpolatePosition(float animationTime)\n\t{\n\t\tif (1 == m_NumPositions)\n\t\t\treturn glm::translate(glm::mat4(1.0f), m_Positions[0].position);\n\n\t\tint p0Index = GetPositionIndex(animationTime);\n\t\tint p1Index = p0Index + 1;\n\t\tfloat scaleFactor = GetScaleFactor(m_Positions[p0Index].timeStamp,\n\t\t\tm_Positions[p1Index].timeStamp, animationTime);\n\t\tglm::vec3 finalPosition = glm::mix(m_Positions[p0Index].position, m_Positions[p1Index].position\n\t\t\t, scaleFactor);\n\t\treturn glm::translate(glm::mat4(1.0f), finalPosition);\n\t}\n\n\tglm::mat4 InterpolateRotation(float animationTime)\n\t{\n\t\tif (1 == m_NumRotations)\n\t\t{\n\t\t\tauto rotation = glm::normalize(m_Rotations[0].orientation);\n\t\t\treturn glm::toMat4(rotation);\n\t\t}\n\n\t\tint p0Index = GetRotationIndex(animationTime);\n\t\tint p1Index = p0Index + 1;\n\t\tfloat scaleFactor = GetScaleFactor(m_Rotations[p0Index].timeStamp,\n\t\t\tm_Rotations[p1Index].timeStamp, animationTime);\n\t\tglm::quat finalRotation = glm::slerp(m_Rotations[p0Index].orientation, m_Rotations[p1Index].orientation\n\t\t\t, scaleFactor);\n\t\tfinalRotation = glm::normalize(finalRotation);\n\t\treturn glm::toMat4(finalRotation);\n\n\t}\n\n\tglm::mat4 InterpolateScaling(float animationTime)\n\t{\n\t\tif (1 == m_NumScalings)\n\t\t\treturn glm::scale(glm::mat4(1.0f), m_Scales[0].scale);\n\n\t\tint p0Index = GetScaleIndex(animationTime);\n\t\tint p1Index = p0Index + 1;\n\t\tfloat scaleFactor = GetScaleFactor(m_Scales[p0Index].timeStamp,\n\t\t\tm_Scales[p1Index].timeStamp, animationTime);\n\t\tglm::vec3 finalScale = glm::mix(m_Scales[p0Index].scale, m_Scales[p1Index].scale\n\t\t\t, scaleFactor);\n\t\treturn glm::scale(glm::mat4(1.0f), finalScale);\n\t}\n\n\tstd::vector m_Positions;\n\tstd::vector m_Rotations;\n\tstd::vector m_Scales;\n\tint m_NumPositions;\n\tint m_NumRotations;\n\tint m_NumScalings;\n\n\tglm::mat4 m_LocalTransform;\n\tstd::string m_Name;\n\tint m_ID;\n};\n\n"}, {"path": "includes/learnopengl/camera.h", "language": "code", "loc": 114, "comment_density": 0.158, "code": "#ifndef CAMERA_H\n#define CAMERA_H\n\n#include \n#include \n#include \n\n// Defines several possible options for camera movement. Used as abstraction to stay away from window-system specific input methods\nenum Camera_Movement {\n FORWARD,\n BACKWARD,\n LEFT,\n RIGHT\n};\n\n// Default camera values\nconst float YAW = -90.0f;\nconst float PITCH = 0.0f;\nconst float SPEED = 2.5f;\nconst float SENSITIVITY = 0.1f;\nconst float ZOOM = 45.0f;\n\n\n// An abstract camera class that processes input and calculates the corresponding Euler Angles, Vectors and Matrices for use in OpenGL\nclass Camera\n{\npublic:\n // camera Attributes\n glm::vec3 Position;\n glm::vec3 Front;\n glm::vec3 Up;\n glm::vec3 Right;\n glm::vec3 WorldUp;\n // euler Angles\n float Yaw;\n float Pitch;\n // camera options\n float MovementSpeed;\n float MouseSensitivity;\n float Zoom;\n\n // constructor with vectors\n Camera(glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), float yaw = YAW, float pitch = PITCH) : Front(glm::vec3(0.0f, 0.0f, -1.0f)), MovementSpeed(SPEED), MouseSensitivity(SENSITIVITY), Zoom(ZOOM)\n {\n Position = position;\n WorldUp = up;\n Yaw = yaw;\n Pitch = pitch;\n updateCameraVectors();\n }\n // constructor with scalar values\n Camera(float posX, float posY, float posZ, float upX, float upY, float upZ, float yaw, float pitch) : Front(glm::vec3(0.0f, 0.0f, -1.0f)), MovementSpeed(SPEED), MouseSensitivity(SENSITIVITY), Zoom(ZOOM)\n {\n Position = glm::vec3(posX, posY, posZ);\n WorldUp = glm::vec3(upX, upY, upZ);\n Yaw = yaw;\n Pitch = pitch;\n updateCameraVectors();\n }\n\n // returns the view matrix calculated using Euler Angles and the LookAt Matrix\n glm::mat4 GetViewMatrix()\n {\n return glm::lookAt(Position, Position + Front, Up);\n }\n\n // processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)\n void ProcessKeyboard(Camera_Movement direction, float deltaTime)\n {\n float velocity = MovementSpeed * deltaTime;\n if (direction == FORWARD)\n Position += Front * velocity;\n if (direction == BACKWARD)\n Position -= Front * velocity;\n if (direction == LEFT)\n Position -= Right * velocity;\n if (direction == RIGHT)\n Position += Right * velocity;\n }\n\n // processes input received from a mouse input system. Expects the offset value in both the x and y direction.\n void ProcessMouseMovement(float xoffset, float yoffset, GLboolean constrainPitch = true)\n {\n xoffset *= MouseSensitivity;\n yoffset *= MouseSensitivity;\n\n Yaw += xoffset;\n Pitch += yoffset;\n\n // make sure that when pitch is out of bounds, screen doesn't get flipped\n if (constrainPitch)\n {\n if (Pitch > 89.0f)\n Pitch = 89.0f;\n if (Pitch < -89.0f)\n Pitch = -89.0f;\n }\n\n // update Front, Right and Up Vectors using the updated Euler angles\n updateCameraVectors();\n }\n\n // processes input received from a mouse scroll-wheel event. Only requires input on the vertical wheel-axis\n void ProcessMouseScroll(float yoffset)\n {\n Zoom -= (float)yoffset;\n if (Zoom < 1.0f)\n Zoom = 1.0f;\n if (Zoom > 45.0f)\n Zoom = 45.0f;\n }\n\nprivate:\n // calculates the front vector from the Camera's (updated) Euler Angles\n void updateCameraVectors()\n {\n // calculate the new Front vector\n glm::vec3 front;\n front.x = cos(glm::radians(Yaw)) * cos(glm::radians(Pitch));\n front.y = sin(glm::radians(Pitch));\n front.z = sin(glm::radians(Yaw)) * cos(glm::radians(Pitch));\n Front = glm::normalize(front);\n // also re-calculate the Right and Up vector\n Right = glm::normalize(glm::cross(Front, WorldUp)); // normalize the vectors, because their length gets closer to 0 the more you look up or down which results in slower movement.\n Up = glm::normalize(glm::cross(Right, Front));\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/entity.h", "language": "code", "loc": 394, "comment_density": 0.084, "code": "#ifndef ENTITY_H\n#define ENTITY_H\n\n#include //glm::mat4\n#include //std::list\n#include //std::array\n#include //std::unique_ptr\n\nclass Transform\n{\nprotected:\n\t//Local space information\n\tglm::vec3 m_pos = { 0.0f, 0.0f, 0.0f };\n\tglm::vec3 m_eulerRot = { 0.0f, 0.0f, 0.0f }; //In degrees\n\tglm::vec3 m_scale = { 1.0f, 1.0f, 1.0f };\n\n\t//Global space information concatenate in matrix\n\tglm::mat4 m_modelMatrix = glm::mat4(1.0f);\n\n\t//Dirty flag\n\tbool m_isDirty = true;\n\nprotected:\n\tglm::mat4 getLocalModelMatrix()\n\t{\n\t\tconst glm::mat4 transformX = glm::rotate(glm::mat4(1.0f), glm::radians(m_eulerRot.x), glm::vec3(1.0f, 0.0f, 0.0f));\n\t\tconst glm::mat4 transformY = glm::rotate(glm::mat4(1.0f), glm::radians(m_eulerRot.y), glm::vec3(0.0f, 1.0f, 0.0f));\n\t\tconst glm::mat4 transformZ = glm::rotate(glm::mat4(1.0f), glm::radians(m_eulerRot.z), glm::vec3(0.0f, 0.0f, 1.0f));\n\n\t\t// Y * X * Z\n\t\tconst glm::mat4 rotationMatrix = transformY * transformX * transformZ;\n\n\t\t// translation * rotation * scale (also know as TRS matrix)\n\t\treturn glm::translate(glm::mat4(1.0f), m_pos) * rotationMatrix * glm::scale(glm::mat4(1.0f), m_scale);\n\t}\npublic:\n\n\tvoid computeModelMatrix()\n\t{\n\t\tm_modelMatrix = getLocalModelMatrix();\n\t\tm_isDirty = false;\n\t}\n\n\tvoid computeModelMatrix(const glm::mat4& parentGlobalModelMatrix)\n\t{\n\t\tm_modelMatrix = parentGlobalModelMatrix * getLocalModelMatrix();\n\t\tm_isDirty = false;\n\t}\n\n\tvoid setLocalPosition(const glm::vec3& newPosition)\n\t{\n\t\tm_pos = newPosition;\n\t\tm_isDirty = true;\n\t}\n\n\tvoid setLocalRotation(const glm::vec3& newRotation)\n\t{\n\t\tm_eulerRot = newRotation;\n\t\tm_isDirty = true;\n\t}\n\n\tvoid setLocalScale(const glm::vec3& newScale)\n\t{\n\t\tm_scale = newScale;\n\t\tm_isDirty = true;\n\t}\n\n\tconst glm::vec3& getGlobalPosition() const\n\t{\n\t\treturn m_modelMatrix[3];\n\t}\n\n\tconst glm::vec3& getLocalPosition() const\n\t{\n\t\treturn m_pos;\n\t}\n\n\tconst glm::vec3& getLocalRotation() const\n\t{\n\t\treturn m_eulerRot;\n\t}\n\n\tconst glm::vec3& getLocalScale() const\n\t{\n\t\treturn m_scale;\n\t}\n\n\tconst glm::mat4& getModelMatrix() const\n\t{\n\t\treturn m_modelMatrix;\n\t}\n\n\tglm::vec3 getRight() const\n\t{\n\t\treturn m_modelMatrix[0];\n\t}\n\n\n\tglm::vec3 getUp() const\n\t{\n\t\treturn m_modelMatrix[1];\n\t}\n\n\tglm::vec3 getBackward() const\n\t{\n\t\treturn m_modelMatrix[2];\n\t}\n\n\tglm::vec3 getForward() const\n\t{\n\t\treturn -m_modelMatrix[2];\n\t}\n\n\tglm::vec3 getGlobalScale() const\n\t{\n\t\treturn { glm::length(getRight()), glm::length(getUp()), glm::length(getBackward()) };\n\t}\n\n\tbool isDirty() const\n\t{\n\t\treturn m_isDirty;\n\t}\n};\n\nstruct Plane\n{\n\tglm::vec3 normal = { 0.f, 1.f, 0.f }; // unit vector\n\tfloat distance = 0.f; // Distance with origin\n\n\tPlane() = default;\n\n\tPlane(const glm::vec3& p1, const glm::vec3& norm)\n\t\t: normal(glm::normalize(norm)),\n\t\tdistance(glm::dot(normal, p1))\n\t{}\n\n\tfloat getSignedDistanceToPlane(const glm::vec3& point) const\n\t{\n\t\treturn glm::dot(normal, point) - distance;\n\t}\n};\n\nstruct Frustum\n{\n\tPlane topFace;\n\tPlane bottomFace;\n\n\tPlane rightFace;\n\tPlane leftFace;\n\n\tPlane farFace;\n\tPlane nearFace;\n};\n\nstruct BoundingVolume\n{\n\tvirtual bool isOnFrustum(const Frustum& camFrustum, const Transform& transform) const = 0;\n\n\tvirtual bool isOnOrForwardPlane(const Plane& plane) const = 0;\n\n\tbool isOnFrustum(const Frustum& camFrustum) const\n\t{\n\t\treturn (isOnOrForwardPlane(camFrustum.leftFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.rightFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.topFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.bottomFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.nearFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.farFace));\n\t};\n};\n\nstruct Sphere : public BoundingVolume\n{\n\tglm::vec3 center{ 0.f, 0.f, 0.f };\n\tfloat radius{ 0.f };\n\n\tSphere(const glm::vec3& inCenter, float inRadius)\n\t\t: BoundingVolume{}, center{ inCenter }, radius{ inRadius }\n\t{}\n\n\tbool isOnOrForwardPlane(const Plane& plane) const final\n\t{\n\t\treturn plane.getSignedDistanceToPlane(center) > -radius;\n\t}\n\n\tbool isOnFrustum(const Frustum& camFrustum, const Transform& transform) const final\n\t{\n\t\t//Get global scale thanks to our transform\n\t\tconst glm::vec3 globalScale = transform.getGlobalScale();\n\n\t\t//Get our global center with process it with the global model matrix of our transform\n\t\tconst glm::vec3 globalCenter{ transform.getModelMatrix() * glm::vec4(center, 1.f) };\n\n\t\t//To wrap correctly our shape, we need the maximum scale scalar.\n\t\tconst float maxScale = std::max(std::max(globalScale.x, globalScale.y), globalScale.z);\n\n\t\t//Max scale is assuming for the diameter. So, we need the half to apply it to our radius\n\t\tSphere globalSphere(globalCenter, radius * (maxScale * 0.5f));\n\n\t\t//Check Firstly the result that have the most chance to failure to avoid to call all functions.\n\t\treturn (globalSphere.isOnOrForwardPlane(camFrustum.leftFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.rightFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.farFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.nearFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.topFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.bottomFace));\n\t};\n};\n\nstruct SquareAABB : public BoundingVolume\n{\n\tglm::vec3 center{ 0.f, 0.f, 0.f };\n\tfloat extent{ 0.f };\n\n\tSquareAABB(const glm::vec3& inCenter, float inExtent)\n\t\t: BoundingVolume{}, center{ inCenter }, extent{ inExtent }\n\t{}\n\n\tbool isOnOrForwardPlane(const Plane& plane) const final\n\t{\n\t\t// Compute the projection interval radius of b onto L(t) = b.c + t * p.n\n\t\tconst float r = extent * (std::abs(plane.normal.x) + std::abs(plane.normal.y) + std::abs(plane.normal.z));\n\t\treturn -r <= plane.getSignedDistanceToPlane(center);\n\t}\n\n\tbool isOnFrustum(const Frustum& camFrustum, const Transform& transform) const final\n\t{\n\t\t//Get global scale thanks to our transform\n\t\tconst glm::vec3 globalCenter{ transform.getModelMatrix() * glm::vec4(center, 1.f) };\n\n\t\t// Scaled orientation\n\t\tconst glm::vec3 right = transform.getRight() * extent;\n\t\tconst glm::vec3 up = transform.getUp() * extent;\n\t\tconst glm::vec3 forward = transform.getForward() * extent;\n\n\t\tconst float newIi = std::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, forward));\n\n\t\tconst float newIj = std::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, forward));\n\n\t\tconst float newIk = std::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, forward));\n\n\t\tconst SquareAABB globalAABB(globalCenter, std::max(std::max(newIi, newIj), newIk));\n\n\t\treturn (globalAABB.isOnOrForwardPlane(camFrustum.leftFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.rightFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.topFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.bottomFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.nearFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.farFace));\n\t};\n};\n\nstruct AABB : public BoundingVolume\n{\n\tglm::vec3 center{ 0.f, 0.f, 0.f };\n\tglm::vec3 extents{ 0.f, 0.f, 0.f };\n\n\tAABB(const glm::vec3& min, const glm::vec3& max)\n\t\t: BoundingVolume{}, center{ (max + min) * 0.5f }, extents{ max.x - center.x, max.y - center.y, max.z - center.z }\n\t{}\n\n\tAABB(const glm::vec3& inCenter, float iI, float iJ, float iK)\n\t\t: BoundingVolume{}, center{ inCenter }, extents{ iI, iJ, iK }\n\t{}\n\n\tstd::array getVertice() const\n\t{\n\t\tstd::array vertice;\n\t\tvertice[0] = { center.x - extents.x, center.y - extents.y, center.z - extents.z };\n\t\tvertice[1] = { center.x + extents.x, center.y - extents.y, center.z - extents.z };\n\t\tvertice[2] = { center.x - extents.x, center.y + extents.y, center.z - extents.z };\n\t\tvertice[3] = { center.x + extents.x, center.y + extents.y, center.z - extents.z };\n\t\tvertice[4] = { center.x - extents.x, center.y - extents.y, center.z + extents.z };\n\t\tvertice[5] = { center.x + extents.x, center.y - extents.y, center.z + extents.z };\n\t\tvertice[6] = { center.x - extents.x, center.y + extents.y, center.z + extents.z };\n\t\tvertice[7] = { center.x + extents.x, center.y + extents.y, center.z + extents.z };\n\t\treturn vertice;\n\t}\n\n\t//see https://gdbooks.gitbooks.io/3dcollisions/content/Chapter2/static_aabb_plane.html\n\tbool isOnOrForwardPlane(const Plane& plane) const final\n\t{\n\t\t// Compute the projection interval radius of b onto L(t) = b.c + t * p.n\n\t\tconst float r = extents.x * std::abs(plane.normal.x) + extents.y * std::abs(plane.normal.y) +\n\t\t\textents.z * std::abs(plane.normal.z);\n\n\t\treturn -r <= plane.getSignedDistanceToPlane(center);\n\t}\n\n\tbool isOnFrustum(const Frustum& camFrustum, const Transform& transform) const final\n\t{\n\t\t//Get global scale thanks to our transform\n\t\tconst glm::vec3 globalCenter{ transform.getModelMatrix() * glm::vec4(center, 1.f) };\n\n\t\t// Scaled orientation\n\t\tconst glm::vec3 right = transform.getRight() * extents.x;\n\t\tconst glm::vec3 up = transform.getUp() * extents.y;\n\t\tconst glm::vec3 forward = transform.getForward() * extents.z;\n\n\t\tconst float newIi = std::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, forward));\n\n\t\tconst float newIj = std::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, forward));\n\n\t\tconst float newIk = std::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, forward));\n\n\t\tconst AABB globalAABB(globalCenter, newIi, newIj, newIk);\n\n\t\treturn (globalAABB.isOnOrForwardPlane(camFrustum.leftFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.rightFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.topFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.bottomFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.nearFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.farFace));\n\t};\n};\n\nFrustum createFrustumFromCamera(const Camera& cam, float aspect, float fovY, float zNear, float zFar)\n{\n\tFrustum frustum;\n\tconst float halfVSide = zFar * tanf(fovY * .5f);\n\tconst float halfHSide = halfVSide * aspect;\n\tconst glm::vec3 frontMultFar = zFar * cam.Front;\n\n\tfrustum.nearFace = { cam.Position + zNear * cam.Front, cam.Front };\n\tfrustum.farFace = { cam.Position + frontMultFar, -cam.Front };\n\tfrustum.rightFace = { cam.Position, glm::cross(frontMultFar - cam.Right * halfHSide, cam.Up) };\n\tfrustum.leftFace = { cam.Position, glm::cross(cam.Up, frontMultFar + cam.Right * halfHSide) };\n\tfrustum.topFace = { cam.Position, glm::cross(cam.Right, frontMultFar - cam.Up * halfVSide) };\n\tfrustum.bottomFace = { cam.Position, glm::cross(frontMultFar + cam.Up * halfVSide, cam.Right) };\n\treturn frustum;\n}\n\nAABB generateAABB(const Model& model)\n{\n\tglm::vec3 minAABB = glm::vec3(std::numeric_limits::max());\n\tglm::vec3 maxAABB = glm::vec3(std::numeric_limits::min());\n\tfor (auto&& mesh : model.meshes)\n\t{\n\t\tfor (auto&& vertex : mesh.vertices)\n\t\t{\n\t\t\tminAABB.x = std::min(minAABB.x, vertex.Position.x);\n\t\t\tminAABB.y = std::min(minAABB.y, vertex.Position.y);\n\t\t\tminAABB.z = std::min(minAABB.z, vertex.Position.z);\n\n\t\t\tmaxAABB.x = std::max(maxAABB.x, vertex.Position.x);\n\t\t\tmaxAABB.y = std::max(maxAABB.y, vertex.Position.y);\n\t\t\tmaxAABB.z = std::max(maxAABB.z, vertex.Position.z);\n\t\t}\n\t}\n\treturn AABB(minAABB, maxAABB);\n}\n\nSphere generateSphereBV(const Model& model)\n{\n\tglm::vec3 minAABB = glm::vec3(std::numeric_limits::max());\n\tglm::vec3 maxAABB = glm::vec3(std::numeric_limits::min());\n\tfor (auto&& mesh : model.meshes)\n\t{\n\t\tfor (auto&& vertex : mesh.vertices)\n\t\t{\n\t\t\tminAABB.x = std::min(minAABB.x, vertex.Position.x);\n\t\t\tminAABB.y = std::min(minAABB.y, vertex.Position.y);\n\t\t\tminAABB.z = std::min(minAABB.z, vertex.Position.z);\n\n\t\t\tmaxAABB.x = std::max(maxAABB.x, vertex.Position.x);\n\t\t\tmaxAABB.y = std::max(maxAABB.y, vertex.Position.y);\n\t\t\tmaxAABB.z = std::max(maxAABB.z, vertex.Position.z);\n\t\t}\n\t}\n\n\treturn Sphere((maxAABB + minAABB) * 0.5f, glm::length(minAABB - maxAABB));\n}\n\nclass Entity\n{\npublic:\n\t//Scene graph\n\tstd::list> children;\n\tEntity* parent = nullptr;\n\n\t//Space information\n\tTransform transform;\n\n\tModel* pModel = nullptr;\n\tstd::unique_ptr boundingVolume;\n\n\n\t// constructor, expects a filepath to a 3D model.\n\tEntity(Model& model) : pModel{ &model }\n\t{\n\t\tboundingVolume = std::make_unique(generateAABB(model));\n\t\t//boundingVolume = std::make_unique(generateSphereBV(model));\n\t}\n\n\tAABB getGlobalAABB()\n\t{\n\t\t//Get global scale thanks to our transform\n\t\tconst glm::vec3 globalCenter{ transform.getModelMatrix() * glm::vec4(boundingVolume->center, 1.f) };\n\n\t\t// Scaled orientation\n\t\tconst glm::vec3 right = transform.getRight() * boundingVolume->extents.x;\n\t\tconst glm::vec3 up = transform.getUp() * boundingVolume->extents.y;\n\t\tconst glm::vec3 forward = transform.getForward() * boundingVolume->extents.z;\n\n\t\tconst float newIi = std::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, forward));\n\n\t\tconst float newIj = std::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, forward));\n\n\t\tconst float newIk = std::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, forward));\n\n\t\treturn AABB(globalCenter, newIi, newIj, newIk);\n\t}\n\n\t//Add child. Argument input is argument of any constructor that you create. By default you can use the default constructor and don't put argument input.\n\ttemplate\n\tvoid addChild(TArgs&... args)\n\t{\n\t\tchildren.emplace_back(std::make_unique(args...));\n\t\tchildren.back()->parent = this;\n\t}\n\n\t//Update transform if it was changed\n\tvoid updateSelfAndChild()\n\t{\n\t\tif (transform.isDirty()) {\n\t\t\tforceUpdateSelfAndChild();\n\t\t\treturn;\n\t\t}\n\t\t\t\n\t\tfor (auto&& child : children)\n\t\t{\n\t\t\tchild->updateSelfAndChild();\n\t\t}\n\t}\n\n\t//Force update of transform even if local space don't change\n\tvoid forceUpdateSelfAndChild()\n\t{\n\t\tif (parent)\n\t\t\ttransform.computeModelMatrix(parent->transform.getModelMatrix());\n\t\telse\n\t\t\ttransform.computeModelMatrix();\n\n\t\tfor (auto&& child : children)\n\t\t{\n\t\t\tchild->forceUpdateSelfAndChild();\n\t\t}\n\t}\n\n\n\tvoid drawSelfAndChild(const Frustum& frustum, Shader& ourShader, unsigned int& display, unsigned int& total)\n\t{\n\t\tif (boundingVolume->isOnFrustum(frustum, transform))\n\t\t{\n\t\t\tourShader.setMat4(\"model\", transform.getModelMatrix());\n\t\t\tpModel->Draw(ourShader);\n\t\t\tdisplay++;\n\t\t}\n\t\ttotal++;\n\n\t\tfor (auto&& child : children)\n\t\t{\n\t\t\tchild->drawSelfAndChild(frustum, ourShader, display, total);\n\t\t}\n\t}\n};\n#endif\n"}, {"path": "includes/learnopengl/filesystem.h", "language": "code", "loc": 42, "comment_density": 0.071, "code": "#ifndef FILESYSTEM_H\n#define FILESYSTEM_H\n\n#include \n#include \n#include \"root_directory.h\" // This is a configuration file generated by CMake.\n\nclass FileSystem\n{\nprivate:\n typedef std::string (*Builder) (const std::string& path);\n\npublic:\n static std::string getPath(const std::string& path)\n {\n static std::string(*pathBuilder)(std::string const &) = getPathBuilder();\n return (*pathBuilder)(path);\n }\n\nprivate:\n static std::string const & getRoot()\n {\n static char const * envRoot = getenv(\"LOGL_ROOT_PATH\");\n static char const * givenRoot = (envRoot != nullptr ? envRoot : logl_root);\n static std::string root = (givenRoot != nullptr ? givenRoot : \"\");\n return root;\n }\n\n //static std::string(*foo (std::string const &)) getPathBuilder()\n static Builder getPathBuilder()\n {\n if (getRoot() != \"\")\n return &FileSystem::getPathRelativeRoot;\n else\n return &FileSystem::getPathRelativeBinary;\n }\n\n static std::string getPathRelativeRoot(const std::string& path)\n {\n return getRoot() + std::string(\"/\") + path;\n }\n\n static std::string getPathRelativeBinary(const std::string& path)\n {\n return \"../../../\" + path;\n }\n\n\n};\n\n// FILESYSTEM_H\n#endif\n"}, {"path": "includes/learnopengl/mesh.h", "language": "code", "loc": 126, "comment_density": 0.294, "code": "#ifndef MESH_H\n#define MESH_H\n\n#include // holds all OpenGL type declarations\n\n#include \n#include \n\n#include \n\n#include \n#include \nusing namespace std;\n\n#define MAX_BONE_INFLUENCE 4\n\nstruct Vertex {\n // position\n glm::vec3 Position;\n // normal\n glm::vec3 Normal;\n // texCoords\n glm::vec2 TexCoords;\n // tangent\n glm::vec3 Tangent;\n // bitangent\n glm::vec3 Bitangent;\n\t//bone indexes which will influence this vertex\n\tint m_BoneIDs[MAX_BONE_INFLUENCE];\n\t//weights from each bone\n\tfloat m_Weights[MAX_BONE_INFLUENCE];\n};\n\nstruct Texture {\n unsigned int id;\n string type;\n string path;\n};\n\nclass Mesh {\npublic:\n // mesh Data\n vector vertices;\n vector indices;\n vector textures;\n unsigned int VAO;\n\n // constructor\n Mesh(vector vertices, vector indices, vector textures)\n {\n this->vertices = vertices;\n this->indices = indices;\n this->textures = textures;\n\n // now that we have all the required data, set the vertex buffers and its attribute pointers.\n setupMesh();\n }\n\n // render the mesh\n void Draw(Shader &shader) \n {\n // bind appropriate textures\n unsigned int diffuseNr = 1;\n unsigned int specularNr = 1;\n unsigned int normalNr = 1;\n unsigned int heightNr = 1;\n for(unsigned int i = 0; i < textures.size(); i++)\n {\n glActiveTexture(GL_TEXTURE0 + i); // active proper texture unit before binding\n // retrieve texture number (the N in diffuse_textureN)\n string number;\n string name = textures[i].type;\n if(name == \"texture_diffuse\")\n number = std::to_string(diffuseNr++);\n else if(name == \"texture_specular\")\n number = std::to_string(specularNr++); // transfer unsigned int to string\n else if(name == \"texture_normal\")\n number = std::to_string(normalNr++); // transfer unsigned int to string\n else if(name == \"texture_height\")\n number = std::to_string(heightNr++); // transfer unsigned int to string\n\n // now set the sampler to the correct texture unit\n glUniform1i(glGetUniformLocation(shader.ID, (name + number).c_str()), i);\n // and finally bind the texture\n glBindTexture(GL_TEXTURE_2D, textures[i].id);\n }\n \n // draw mesh\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, static_cast(indices.size()), GL_UNSIGNED_INT, 0);\n glBindVertexArray(0);\n\n // always good practice to set everything back to defaults once configured.\n glActiveTexture(GL_TEXTURE0);\n }\n\nprivate:\n // render data \n unsigned int VBO, EBO;\n\n // initializes all the buffer objects/arrays\n void setupMesh()\n {\n // create buffers/arrays\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n // load data into vertex buffers\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // A great thing about structs is that their memory layout is sequential for all its items.\n // The effect is that we can simply pass a pointer to the struct and it translates perfectly to a glm::vec3/2 array which\n // again translates to 3/2 floats which translates to a byte array.\n glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), &vertices[0], GL_STATIC_DRAW); \n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);\n\n // set the vertex attribute pointers\n // vertex Positions\n glEnableVertexAttribArray(0);\t\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)0);\n // vertex normals\n glEnableVertexAttribArray(1);\t\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Normal));\n // vertex texture coords\n glEnableVertexAttribArray(2);\t\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, TexCoords));\n // vertex tangent\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Tangent));\n // vertex bitangent\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Bitangent));\n\t\t// ids\n\t\tglEnableVertexAttribArray(5);\n\t\tglVertexAttribIPointer(5, 4, GL_INT, sizeof(Vertex), (void*)offsetof(Vertex, m_BoneIDs));\n\n\t\t// weights\n\t\tglEnableVertexAttribArray(6);\n\t\tglVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, m_Weights));\n glBindVertexArray(0);\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/model.h", "language": "code", "loc": 219, "comment_density": 0.21, "code": "#ifndef MODEL_H\n#define MODEL_H\n\n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nunsigned int TextureFromFile(const char *path, const string &directory, bool gamma = false);\n\nclass Model \n{\npublic:\n // model data \n vector textures_loaded;\t// stores all the textures loaded so far, optimization to make sure textures aren't loaded more than once.\n vector meshes;\n string directory;\n bool gammaCorrection;\n\n // constructor, expects a filepath to a 3D model.\n Model(string const &path, bool gamma = false) : gammaCorrection(gamma)\n {\n loadModel(path);\n }\n\n // draws the model, and thus all its meshes\n void Draw(Shader &shader)\n {\n for(unsigned int i = 0; i < meshes.size(); i++)\n meshes[i].Draw(shader);\n }\n \nprivate:\n // loads a model with supported ASSIMP extensions from file and stores the resulting meshes in the meshes vector.\n void loadModel(string const &path)\n {\n // read file via ASSIMP\n Assimp::Importer importer;\n const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_FlipUVs | aiProcess_CalcTangentSpace);\n // check for errors\n if(!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) // if is Not Zero\n {\n cout << \"ERROR::ASSIMP:: \" << importer.GetErrorString() << endl;\n return;\n }\n // retrieve the directory path of the filepath\n directory = path.substr(0, path.find_last_of('/'));\n\n // process ASSIMP's root node recursively\n processNode(scene->mRootNode, scene);\n }\n\n // processes a node in a recursive fashion. Processes each individual mesh located at the node and repeats this process on its children nodes (if any).\n void processNode(aiNode *node, const aiScene *scene)\n {\n // process each mesh located at the current node\n for(unsigned int i = 0; i < node->mNumMeshes; i++)\n {\n // the node object only contains indices to index the actual objects in the scene. \n // the scene contains all the data, node is just to keep stuff organized (like relations between nodes).\n aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];\n meshes.push_back(processMesh(mesh, scene));\n }\n // after we've processed all of the meshes (if any) we then recursively process each of the children nodes\n for(unsigned int i = 0; i < node->mNumChildren; i++)\n {\n processNode(node->mChildren[i], scene);\n }\n\n }\n\n Mesh processMesh(aiMesh *mesh, const aiScene *scene)\n {\n // data to fill\n vector vertices;\n vector indices;\n vector textures;\n\n // walk through each of the mesh's vertices\n for(unsigned int i = 0; i < mesh->mNumVertices; i++)\n {\n Vertex vertex;\n glm::vec3 vector; // we declare a placeholder vector since assimp uses its own vector class that doesn't directly convert to glm's vec3 class so we transfer the data to this placeholder glm::vec3 first.\n // positions\n vector.x = mesh->mVertices[i].x;\n vector.y = mesh->mVertices[i].y;\n vector.z = mesh->mVertices[i].z;\n vertex.Position = vector;\n // normals\n if (mesh->HasNormals())\n {\n vector.x = mesh->mNormals[i].x;\n vector.y = mesh->mNormals[i].y;\n vector.z = mesh->mNormals[i].z;\n vertex.Normal = vector;\n }\n // texture coordinates\n if(mesh->mTextureCoords[0]) // does the mesh contain texture coordinates?\n {\n glm::vec2 vec;\n // a vertex can contain up to 8 different texture coordinates. We thus make the assumption that we won't \n // use models where a vertex can have multiple texture coordinates so we always take the first set (0).\n vec.x = mesh->mTextureCoords[0][i].x; \n vec.y = mesh->mTextureCoords[0][i].y;\n vertex.TexCoords = vec;\n // tangent\n vector.x = mesh->mTangents[i].x;\n vector.y = mesh->mTangents[i].y;\n vector.z = mesh->mTangents[i].z;\n vertex.Tangent = vector;\n // bitangent\n vector.x = mesh->mBitangents[i].x;\n vector.y = mesh->mBitangents[i].y;\n vector.z = mesh->mBitangents[i].z;\n vertex.Bitangent = vector;\n }\n else\n vertex.TexCoords = glm::vec2(0.0f, 0.0f);\n\n vertices.push_back(vertex);\n }\n // now wak through each of the mesh's faces (a face is a mesh its triangle) and retrieve the corresponding vertex indices.\n for(unsigned int i = 0; i < mesh->mNumFaces; i++)\n {\n aiFace face = mesh->mFaces[i];\n // retrieve all indices of the face and store them in the indices vector\n for(unsigned int j = 0; j < face.mNumIndices; j++)\n indices.push_back(face.mIndices[j]); \n }\n // process materials\n aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex]; \n // we assume a convention for sampler names in the shaders. Each diffuse texture should be named\n // as 'texture_diffuseN' where N is a sequential number ranging from 1 to MAX_SAMPLER_NUMBER. \n // Same applies to other texture as the following list summarizes:\n // diffuse: texture_diffuseN\n // specular: texture_specularN\n // normal: texture_normalN\n\n // 1. diffuse maps\n vector diffuseMaps = loadMaterialTextures(material, aiTextureType_DIFFUSE, \"texture_diffuse\");\n textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());\n // 2. specular maps\n vector specularMaps = loadMaterialTextures(material, aiTextureType_SPECULAR, \"texture_specular\");\n textures.insert(textures.end(), specularMaps.begin(), specularMaps.end());\n // 3. normal maps\n std::vector normalMaps = loadMaterialTextures(material, aiTextureType_HEIGHT, \"texture_normal\");\n textures.insert(textures.end(), normalMaps.begin(), normalMaps.end());\n // 4. height maps\n std::vector heightMaps = loadMaterialTextures(material, aiTextureType_AMBIENT, \"texture_height\");\n textures.insert(textures.end(), heightMaps.begin(), heightMaps.end());\n \n // return a mesh object created from the extracted mesh data\n return Mesh(vertices, indices, textures);\n }\n\n // checks all material textures of a given type and loads the textures if they're not loaded yet.\n // the required info is returned as a Texture struct.\n vector loadMaterialTextures(aiMaterial *mat, aiTextureType type, string typeName)\n {\n vector textures;\n for(unsigned int i = 0; i < mat->GetTextureCount(type); i++)\n {\n aiString str;\n mat->GetTexture(type, i, &str);\n // check if texture was loaded before and if so, continue to next iteration: skip loading a new texture\n bool skip = false;\n for(unsigned int j = 0; j < textures_loaded.size(); j++)\n {\n if(std::strcmp(textures_loaded[j].path.data(), str.C_Str()) == 0)\n {\n textures.push_back(textures_loaded[j]);\n skip = true; // a texture with the same filepath has already been loaded, continue to next one. (optimization)\n break;\n }\n }\n if(!skip)\n { // if texture hasn't been loaded already, load it\n Texture texture;\n texture.id = TextureFromFile(str.C_Str(), this->directory);\n texture.type = typeName;\n texture.path = str.C_Str();\n textures.push_back(texture);\n textures_loaded.push_back(texture); // store it as texture loaded for entire model, to ensure we won't unnecessary load duplicate textures.\n }\n }\n return textures;\n }\n};\n\n\nunsigned int TextureFromFile(const char *path, const string &directory, bool gamma)\n{\n string filename = string(path);\n filename = directory + '/' + filename;\n\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(filename.c_str(), &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n#endif\n"}, {"path": "includes/learnopengl/model_animation.h", "language": "code", "loc": 238, "comment_density": 0.088, "code": "#ifndef MODEL_H\n#define MODEL_H\n\n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nclass Model \n{\npublic:\n // model data \n vector textures_loaded;\t// stores all the textures loaded so far, optimization to make sure textures aren't loaded more than once.\n vector meshes;\n string directory;\n bool gammaCorrection;\n\t\n\t\n\n // constructor, expects a filepath to a 3D model.\n Model(string const &path, bool gamma = false) : gammaCorrection(gamma)\n {\n loadModel(path);\n }\n\n // draws the model, and thus all its meshes\n void Draw(Shader &shader)\n {\n for(unsigned int i = 0; i < meshes.size(); i++)\n meshes[i].Draw(shader);\n }\n \n\tauto& GetBoneInfoMap() { return m_BoneInfoMap; }\n\tint& GetBoneCount() { return m_BoneCounter; }\n\t\n\nprivate:\n\n\tstd::map m_BoneInfoMap;\n\tint m_BoneCounter = 0;\n\n // loads a model with supported ASSIMP extensions from file and stores the resulting meshes in the meshes vector.\n void loadModel(string const &path)\n {\n // read file via ASSIMP\n Assimp::Importer importer;\n const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_CalcTangentSpace);\n // check for errors\n if(!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) // if is Not Zero\n {\n cout << \"ERROR::ASSIMP:: \" << importer.GetErrorString() << endl;\n return;\n }\n // retrieve the directory path of the filepath\n directory = path.substr(0, path.find_last_of('/'));\n\n // process ASSIMP's root node recursively\n processNode(scene->mRootNode, scene);\n }\n\n // processes a node in a recursive fashion. Processes each individual mesh located at the node and repeats this process on its children nodes (if any).\n void processNode(aiNode *node, const aiScene *scene)\n {\n // process each mesh located at the current node\n for(unsigned int i = 0; i < node->mNumMeshes; i++)\n {\n // the node object only contains indices to index the actual objects in the scene. \n // the scene contains all the data, node is just to keep stuff organized (like relations between nodes).\n aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];\n meshes.push_back(processMesh(mesh, scene));\n }\n // after we've processed all of the meshes (if any) we then recursively process each of the children nodes\n for(unsigned int i = 0; i < node->mNumChildren; i++)\n {\n processNode(node->mChildren[i], scene);\n }\n\n }\n\n\tvoid SetVertexBoneDataToDefault(Vertex& vertex)\n\t{\n\t\tfor (int i = 0; i < MAX_BONE_INFLUENCE; i++)\n\t\t{\n\t\t\tvertex.m_BoneIDs[i] = -1;\n\t\t\tvertex.m_Weights[i] = 0.0f;\n\t\t}\n\t}\n\n\n\tMesh processMesh(aiMesh* mesh, const aiScene* scene)\n\t{\n\t\tvector vertices;\n\t\tvector indices;\n\t\tvector textures;\n\n\t\tfor (unsigned int i = 0; i < mesh->mNumVertices; i++)\n\t\t{\n\t\t\tVertex vertex;\n\t\t\tSetVertexBoneDataToDefault(vertex);\n\t\t\tvertex.Position = AssimpGLMHelpers::GetGLMVec(mesh->mVertices[i]);\n\t\t\tvertex.Normal = AssimpGLMHelpers::GetGLMVec(mesh->mNormals[i]);\n\t\t\t\n\t\t\tif (mesh->mTextureCoords[0])\n\t\t\t{\n\t\t\t\tglm::vec2 vec;\n\t\t\t\tvec.x = mesh->mTextureCoords[0][i].x;\n\t\t\t\tvec.y = mesh->mTextureCoords[0][i].y;\n\t\t\t\tvertex.TexCoords = vec;\n\t\t\t}\n\t\t\telse\n\t\t\t\tvertex.TexCoords = glm::vec2(0.0f, 0.0f);\n\n\t\t\tvertices.push_back(vertex);\n\t\t}\n\t\tfor (unsigned int i = 0; i < mesh->mNumFaces; i++)\n\t\t{\n\t\t\taiFace face = mesh->mFaces[i];\n\t\t\tfor (unsigned int j = 0; j < face.mNumIndices; j++)\n\t\t\t\tindices.push_back(face.mIndices[j]);\n\t\t}\n\t\taiMaterial* material = scene->mMaterials[mesh->mMaterialIndex];\n\n\t\tvector diffuseMaps = loadMaterialTextures(material, aiTextureType_DIFFUSE, \"texture_diffuse\");\n\t\ttextures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());\n\t\tvector specularMaps = loadMaterialTextures(material, aiTextureType_SPECULAR, \"texture_specular\");\n\t\ttextures.insert(textures.end(), specularMaps.begin(), specularMaps.end());\n\t\tstd::vector normalMaps = loadMaterialTextures(material, aiTextureType_HEIGHT, \"texture_normal\");\n\t\ttextures.insert(textures.end(), normalMaps.begin(), normalMaps.end());\n\t\tstd::vector heightMaps = loadMaterialTextures(material, aiTextureType_AMBIENT, \"texture_height\");\n\t\ttextures.insert(textures.end(), heightMaps.begin(), heightMaps.end());\n\n\t\tExtractBoneWeightForVertices(vertices,mesh,scene);\n\n\t\treturn Mesh(vertices, indices, textures);\n\t}\n\n\tvoid SetVertexBoneData(Vertex& vertex, int boneID, float weight)\n\t{\n\t\tfor (int i = 0; i < MAX_BONE_INFLUENCE; ++i)\n\t\t{\n\t\t\tif (vertex.m_BoneIDs[i] < 0)\n\t\t\t{\n\t\t\t\tvertex.m_Weights[i] = weight;\n\t\t\t\tvertex.m_BoneIDs[i] = boneID;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tvoid ExtractBoneWeightForVertices(std::vector& vertices, aiMesh* mesh, const aiScene* scene)\n\t{\n\t\tauto& boneInfoMap = m_BoneInfoMap;\n\t\tint& boneCount = m_BoneCounter;\n\n\t\tfor (int boneIndex = 0; boneIndex < mesh->mNumBones; ++boneIndex)\n\t\t{\n\t\t\tint boneID = -1;\n\t\t\tstd::string boneName = mesh->mBones[boneIndex]->mName.C_Str();\n\t\t\tif (boneInfoMap.find(boneName) == boneInfoMap.end())\n\t\t\t{\n\t\t\t\tBoneInfo newBoneInfo;\n\t\t\t\tnewBoneInfo.id = boneCount;\n\t\t\t\tnewBoneInfo.offset = AssimpGLMHelpers::ConvertMatrixToGLMFormat(mesh->mBones[boneIndex]->mOffsetMatrix);\n\t\t\t\tboneInfoMap[boneName] = newBoneInfo;\n\t\t\t\tboneID = boneCount;\n\t\t\t\tboneCount++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tboneID = boneInfoMap[boneName].id;\n\t\t\t}\n\t\t\tassert(boneID != -1);\n\t\t\tauto weights = mesh->mBones[boneIndex]->mWeights;\n\t\t\tint numWeights = mesh->mBones[boneIndex]->mNumWeights;\n\n\t\t\tfor (int weightIndex = 0; weightIndex < numWeights; ++weightIndex)\n\t\t\t{\n\t\t\t\tint vertexId = weights[weightIndex].mVertexId;\n\t\t\t\tfloat weight = weights[weightIndex].mWeight;\n\t\t\t\tassert(vertexId <= vertices.size());\n\t\t\t\tSetVertexBoneData(vertices[vertexId], boneID, weight);\n\t\t\t}\n\t\t}\n\t}\n\n\n\tunsigned int TextureFromFile(const char* path, const string& directory, bool gamma = false)\n\t{\n\t\tstring filename = string(path);\n\t\tfilename = directory + '/' + filename;\n\n\t\tunsigned int textureID;\n\t\tglGenTextures(1, &textureID);\n\n\t\tint width, height, nrComponents;\n\t\tunsigned char* data = stbi_load(filename.c_str(), &width, &height, &nrComponents, 0);\n\t\tif (data)\n\t\t{\n\t\t\tGLenum format;\n\t\t\tif (nrComponents == 1)\n\t\t\t\tformat = GL_RED;\n\t\t\telse if (nrComponents == 3)\n\t\t\t\tformat = GL_RGB;\n\t\t\telse if (nrComponents == 4)\n\t\t\t\tformat = GL_RGBA;\n\n\t\t\tglBindTexture(GL_TEXTURE_2D, textureID);\n\t\t\tglTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n\t\t\tglGenerateMipmap(GL_TEXTURE_2D);\n\n\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\t\t\tstbi_image_free(data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstd::cout << \"Texture failed to load at path: \" << path << std::endl;\n\t\t\tstbi_image_free(data);\n\t\t}\n\n\t\treturn textureID;\n\t}\n \n // checks all material textures of a given type and loads the textures if they're not loaded yet.\n // the required info is returned as a Texture struct.\n vector loadMaterialTextures(aiMaterial *mat, aiTextureType type, string typeName)\n {\n vector textures;\n for(unsigned int i = 0; i < mat->GetTextureCount(type); i++)\n {\n aiString str;\n mat->GetTexture(type, i, &str);\n // check if texture was loaded before and if so, continue to next iteration: skip loading a new texture\n bool skip = false;\n for(unsigned int j = 0; j < textures_loaded.size(); j++)\n {\n if(std::strcmp(textures_loaded[j].path.data(), str.C_Str()) == 0)\n {\n textures.push_back(textures_loaded[j]);\n skip = true; // a texture with the same filepath has already been loaded, continue to next one. (optimization)\n break;\n }\n }\n if(!skip)\n { // if texture hasn't been loaded already, load it\n Texture texture;\n texture.id = TextureFromFile(str.C_Str(), this->directory);\n texture.type = typeName;\n texture.path = str.C_Str();\n textures.push_back(texture);\n textures_loaded.push_back(texture); // store it as texture loaded for entire model, to ensure we won't unnecessary load duplicate textures.\n }\n }\n return textures;\n }\n};\n\n\n\n#endif\n"}, {"path": "includes/learnopengl/shader.h", "language": "code", "loc": 186, "comment_density": 0.156, "code": "#ifndef SHADER_H\n#define SHADER_H\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nclass Shader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n Shader(const char* vertexPath, const char* fragmentPath, const char* geometryPath = nullptr)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::string geometryCode;\n std::ifstream vShaderFile;\n std::ifstream fShaderFile;\n std::ifstream gShaderFile;\n // ensure ifstream objects can throw exceptions:\n vShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n fShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n gShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n try \n {\n // open files\n vShaderFile.open(vertexPath);\n fShaderFile.open(fragmentPath);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vShaderFile.rdbuf();\n fShaderStream << fShaderFile.rdbuf();\t\t\n // close file handlers\n vShaderFile.close();\n fShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\t\t\t\n // if geometry shader path is present, also load a geometry shader\n if(geometryPath != nullptr)\n {\n gShaderFile.open(geometryPath);\n std::stringstream gShaderStream;\n gShaderStream << gShaderFile.rdbuf();\n gShaderFile.close();\n geometryCode = gShaderStream.str();\n }\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" << e.what() << std::endl;\n }\n const char* vShaderCode = vertexCode.c_str();\n const char * fShaderCode = fragmentCode.c_str();\n // 2. compile shaders\n unsigned int vertex, fragment;\n // vertex shader\n vertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertex, 1, &vShaderCode, NULL);\n glCompileShader(vertex);\n checkCompileErrors(vertex, \"VERTEX\");\n // fragment Shader\n fragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragment, 1, &fShaderCode, NULL);\n glCompileShader(fragment);\n checkCompileErrors(fragment, \"FRAGMENT\");\n // if geometry shader is given, compile geometry shader\n unsigned int geometry;\n if(geometryPath != nullptr)\n {\n const char * gShaderCode = geometryCode.c_str();\n geometry = glCreateShader(GL_GEOMETRY_SHADER);\n glShaderSource(geometry, 1, &gShaderCode, NULL);\n glCompileShader(geometry);\n checkCompileErrors(geometry, \"GEOMETRY\");\n }\n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, vertex);\n glAttachShader(ID, fragment);\n if(geometryPath != nullptr)\n glAttachShader(ID, geometry);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(vertex);\n glDeleteShader(fragment);\n if(geometryPath != nullptr)\n glDeleteShader(geometry);\n\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use() \n { \n glUseProgram(ID); \n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); \n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n { \n glUniform1f(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setVec2(const std::string &name, const glm::vec2 &value) const\n { \n glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec2(const std::string &name, float x, float y) const\n { \n glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y); \n }\n // ------------------------------------------------------------------------\n void setVec3(const std::string &name, const glm::vec3 &value) const\n { \n glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec3(const std::string &name, float x, float y, float z) const\n { \n glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z); \n }\n // ------------------------------------------------------------------------\n void setVec4(const std::string &name, const glm::vec4 &value) const\n { \n glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec4(const std::string &name, float x, float y, float z, float w) \n { \n glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w); \n }\n // ------------------------------------------------------------------------\n void setMat2(const std::string &name, const glm::mat2 &mat) const\n {\n glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat3(const std::string &name, const glm::mat3 &mat) const\n {\n glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat4(const std::string &name, const glm::mat4 &mat) const\n {\n glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(GLuint shader, std::string type)\n {\n GLint success;\n GLchar infoLog[1024];\n if(type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if(!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if(!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/shader_c.h", "language": "code", "loc": 145, "comment_density": 0.179, "code": "#ifndef COMPUTE_SHADER_H\n#define COMPUTE_SHADER_H\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nclass ComputeShader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n ComputeShader(const char* computePath)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string computeCode;\n std::ifstream cShaderFile;\n // ensure ifstream objects can throw exceptions:\n cShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);\n try\n {\n // open files\n cShaderFile.open(computePath);\n\n std::stringstream cShaderStream;\n // read file's buffer contents into streams\n cShaderStream << cShaderFile.rdbuf();\n // close file handlers\n cShaderFile.close();\n // convert stream into string\n computeCode = cShaderStream.str();\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" << e.what() << std::endl;\n }\n const char* cShaderCode = computeCode.c_str();\n // 2. compile shaders\n unsigned int compute;\n // compute shader\n compute = glCreateShader(GL_COMPUTE_SHADER);\n glShaderSource(compute, 1, &cShaderCode, NULL);\n glCompileShader(compute);\n checkCompileErrors(compute, \"COMPUTE\");\n \n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, compute);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(compute);\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use() \n { \n glUseProgram(ID); \n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); \n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n { \n glUniform1f(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setVec2(const std::string &name, const glm::vec2 &value) const\n { \n glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec2(const std::string &name, float x, float y) const\n { \n glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y); \n }\n // ------------------------------------------------------------------------\n void setVec3(const std::string &name, const glm::vec3 &value) const\n { \n glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec3(const std::string &name, float x, float y, float z) const\n { \n glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z); \n }\n // ------------------------------------------------------------------------\n void setVec4(const std::string &name, const glm::vec4 &value) const\n { \n glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec4(const std::string &name, float x, float y, float z, float w) \n { \n glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w); \n }\n // ------------------------------------------------------------------------\n void setMat2(const std::string &name, const glm::mat2 &mat) const\n {\n glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat3(const std::string &name, const glm::mat3 &mat) const\n {\n glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat4(const std::string &name, const glm::mat4 &mat) const\n {\n glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(GLuint shader, std::string type)\n {\n GLint success;\n GLchar infoLog[1024];\n if(type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if(!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if(!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif"}, {"path": "includes/learnopengl/shader_m.h", "language": "code", "loc": 160, "comment_density": 0.169, "code": "#ifndef SHADER_H\n#define SHADER_H\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nclass Shader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n Shader(const char* vertexPath, const char* fragmentPath)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::ifstream vShaderFile;\n std::ifstream fShaderFile;\n // ensure ifstream objects can throw exceptions:\n vShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n fShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n try \n {\n // open files\n vShaderFile.open(vertexPath);\n fShaderFile.open(fragmentPath);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vShaderFile.rdbuf();\n fShaderStream << fShaderFile.rdbuf();\t\t\n // close file handlers\n vShaderFile.close();\n fShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\t\t\t\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" << e.what() << std::endl;\n }\n const char* vShaderCode = vertexCode.c_str();\n const char * fShaderCode = fragmentCode.c_str();\n // 2. compile shaders\n unsigned int vertex, fragment;\n // vertex shader\n vertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertex, 1, &vShaderCode, NULL);\n glCompileShader(vertex);\n checkCompileErrors(vertex, \"VERTEX\");\n // fragment Shader\n fragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragment, 1, &fShaderCode, NULL);\n glCompileShader(fragment);\n checkCompileErrors(fragment, \"FRAGMENT\");\n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, vertex);\n glAttachShader(ID, fragment);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(vertex);\n glDeleteShader(fragment);\n\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use() const\n { \n glUseProgram(ID); \n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); \n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n { \n glUniform1f(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setVec2(const std::string &name, const glm::vec2 &value) const\n { \n glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec2(const std::string &name, float x, float y) const\n { \n glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y); \n }\n // ------------------------------------------------------------------------\n void setVec3(const std::string &name, const glm::vec3 &value) const\n { \n glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec3(const std::string &name, float x, float y, float z) const\n { \n glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z); \n }\n // ------------------------------------------------------------------------\n void setVec4(const std::string &name, const glm::vec4 &value) const\n { \n glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec4(const std::string &name, float x, float y, float z, float w) const\n { \n glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w); \n }\n // ------------------------------------------------------------------------\n void setMat2(const std::string &name, const glm::mat2 &mat) const\n {\n glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat3(const std::string &name, const glm::mat3 &mat) const\n {\n glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat4(const std::string &name, const glm::mat4 &mat) const\n {\n glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(GLuint shader, std::string type)\n {\n GLint success;\n GLchar infoLog[1024];\n if (type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if (!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/shader_s.h", "language": "code", "loc": 117, "comment_density": 0.179, "code": "#ifndef SHADER_H\n#define SHADER_H\n\n#include \n\n#include \n#include \n#include \n#include \n\nclass Shader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n Shader(const char* vertexPath, const char* fragmentPath)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::ifstream vShaderFile;\n std::ifstream fShaderFile;\n // ensure ifstream objects can throw exceptions:\n vShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n fShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n try \n {\n // open files\n vShaderFile.open(vertexPath);\n fShaderFile.open(fragmentPath);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vShaderFile.rdbuf();\n fShaderStream << fShaderFile.rdbuf();\n // close file handlers\n vShaderFile.close();\n fShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" << e.what() << std::endl;\n }\n const char* vShaderCode = vertexCode.c_str();\n const char * fShaderCode = fragmentCode.c_str();\n // 2. compile shaders\n unsigned int vertex, fragment;\n // vertex shader\n vertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertex, 1, &vShaderCode, NULL);\n glCompileShader(vertex);\n checkCompileErrors(vertex, \"VERTEX\");\n // fragment Shader\n fragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragment, 1, &fShaderCode, NULL);\n glCompileShader(fragment);\n checkCompileErrors(fragment, \"FRAGMENT\");\n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, vertex);\n glAttachShader(ID, fragment);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(vertex);\n glDeleteShader(fragment);\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use() \n { \n glUseProgram(ID); \n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); \n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n { \n glUniform1f(glGetUniformLocation(ID, name.c_str()), value); \n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(unsigned int shader, std::string type)\n {\n int success;\n char infoLog[1024];\n if (type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if (!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/shader_t.h", "language": "code", "loc": 231, "comment_density": 0.13, "code": "#ifndef SHADER_H\n#define SHADER_H\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nclass Shader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n Shader(const char* vertexPath, const char* fragmentPath, const char* geometryPath = nullptr,\n const char* tessControlPath = nullptr, const char* tessEvalPath = nullptr)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::string geometryCode;\n std::string tessControlCode;\n std::string tessEvalCode;\n std::ifstream vShaderFile;\n std::ifstream fShaderFile;\n std::ifstream gShaderFile;\n std::ifstream tcShaderFile;\n std::ifstream teShaderFile;\n // ensure ifstream objects can throw exceptions:\n vShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n fShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n gShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n tcShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n teShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n try\n {\n // open files\n vShaderFile.open(vertexPath);\n fShaderFile.open(fragmentPath);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vShaderFile.rdbuf();\n fShaderStream << fShaderFile.rdbuf();\n // close file handlers\n vShaderFile.close();\n fShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\n // if geometry shader path is present, also load a geometry shader\n if(geometryPath != nullptr)\n {\n gShaderFile.open(geometryPath);\n std::stringstream gShaderStream;\n gShaderStream << gShaderFile.rdbuf();\n gShaderFile.close();\n geometryCode = gShaderStream.str();\n }\n if(tessControlPath != nullptr) {\n tcShaderFile.open(tessControlPath);\n std::stringstream tcShaderStream;\n tcShaderStream << tcShaderFile.rdbuf();\n tcShaderFile.close();\n tessControlCode = tcShaderStream.str();\n }\n if(tessEvalPath != nullptr) {\n teShaderFile.open(tessEvalPath);\n std::stringstream teShaderStream;\n teShaderStream << teShaderFile.rdbuf();\n teShaderFile.close();\n tessEvalCode = teShaderStream.str();\n }\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" \n << e.what() << std::endl;\n }\n const char* vShaderCode = vertexCode.c_str();\n const char * fShaderCode = fragmentCode.c_str();\n // 2. compile shaders\n unsigned int vertex, fragment;\n // vertex shader\n vertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertex, 1, &vShaderCode, NULL);\n glCompileShader(vertex);\n checkCompileErrors(vertex, \"VERTEX\");\n // fragment Shader\n fragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragment, 1, &fShaderCode, NULL);\n glCompileShader(fragment);\n checkCompileErrors(fragment, \"FRAGMENT\");\n // if geometry shader is given, compile geometry shader\n unsigned int geometry;\n if(geometryPath != nullptr)\n {\n const char * gShaderCode = geometryCode.c_str();\n geometry = glCreateShader(GL_GEOMETRY_SHADER);\n glShaderSource(geometry, 1, &gShaderCode, NULL);\n glCompileShader(geometry);\n checkCompileErrors(geometry, \"GEOMETRY\");\n }\n // if tessellation shader is given, compile tessellation shader\n unsigned int tessControl;\n if(tessControlPath != nullptr)\n {\n const char * tcShaderCode = tessControlCode.c_str();\n tessControl = glCreateShader(GL_TESS_CONTROL_SHADER);\n glShaderSource(tessControl, 1, &tcShaderCode, NULL);\n glCompileShader(tessControl);\n checkCompileErrors(tessControl, \"TESS_CONTROL\");\n }\n unsigned int tessEval;\n if(tessEvalPath != nullptr)\n {\n const char * teShaderCode = tessEvalCode.c_str();\n tessEval = glCreateShader(GL_TESS_EVALUATION_SHADER);\n glShaderSource(tessEval, 1, &teShaderCode, NULL);\n glCompileShader(tessEval);\n checkCompileErrors(tessEval, \"TESS_EVALUATION\");\n }\n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, vertex);\n glAttachShader(ID, fragment);\n if(geometryPath != nullptr)\n glAttachShader(ID, geometry);\n if(tessControlPath != nullptr)\n glAttachShader(ID, tessControl);\n if(tessEvalPath != nullptr)\n glAttachShader(ID, tessEval);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(vertex);\n glDeleteShader(fragment);\n if(geometryPath != nullptr)\n glDeleteShader(geometry);\n\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use()\n {\n glUseProgram(ID);\n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n {\n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value);\n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n {\n glUniform1i(glGetUniformLocation(ID, name.c_str()), value);\n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n {\n glUniform1f(glGetUniformLocation(ID, name.c_str()), value);\n }\n // ------------------------------------------------------------------------\n void setVec2(const std::string &name, const glm::vec2 &value) const\n {\n glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]);\n }\n void setVec2(const std::string &name, float x, float y) const\n {\n glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y);\n }\n // ------------------------------------------------------------------------\n void setVec3(const std::string &name, const glm::vec3 &value) const\n {\n glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]);\n }\n void setVec3(const std::string &name, float x, float y, float z) const\n {\n glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z);\n }\n // ------------------------------------------------------------------------\n void setVec4(const std::string &name, const glm::vec4 &value) const\n {\n glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]);\n }\n void setVec4(const std::string &name, float x, float y, float z, float w)\n {\n glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w);\n }\n // ------------------------------------------------------------------------\n void setMat2(const std::string &name, const glm::mat2 &mat) const\n {\n glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat3(const std::string &name, const glm::mat3 &mat) const\n {\n glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat4(const std::string &name, const glm::mat4 &mat) const\n {\n glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(GLuint shader, std::string type)\n {\n GLint success;\n GLchar infoLog[1024];\n if(type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if(!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if(!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.124, "dedup_hash": "9174da8610873c2a", "has_readme": true} +{"id": "joeydevries_learnopengl_src", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Src", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/glad.c", "language": "code", "loc": 2474, "comment_density": 0.008, "code": "/*\n\n OpenGL loader generated by glad 0.1.13a0 on Sun Apr 2 14:54:18 2017.\n\n Language/Generator: C/C++\n Specification: gl\n APIs: gl=4.5\n Profile: compatibility\n Extensions:\n GL_KHR_debug\n Loader: True\n Local files: False\n Omit khrplatform: False\n\n Commandline:\n --profile=\"compatibility\" --api=\"gl=4.5\" --generator=\"c\" --spec=\"gl\" --extensions=\"GL_KHR_debug\"\n Online:\n http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.5&extensions=GL_KHR_debug\n*/\n\n#include \n#include \n#include \n#include \n\nstatic void* get_proc(const char *namez);\n\n#ifdef _WIN32\n#include \nstatic HMODULE libGL;\n\ntypedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);\nPFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;\n\nstatic\nint open_gl(void) {\n libGL = LoadLibraryW(L\"opengl32.dll\");\n if(libGL != NULL) {\n gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress(\n libGL, \"wglGetProcAddress\");\n return gladGetProcAddressPtr != NULL;\n }\n\n return 0;\n}\n\nstatic\nvoid close_gl(void) {\n if(libGL != NULL) {\n FreeLibrary(libGL);\n libGL = NULL;\n }\n}\n#else\n#include \nstatic void* libGL;\n\n#ifndef __APPLE__\ntypedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);\nPFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;\n#endif\n\nstatic\nint open_gl(void) {\n#ifdef __APPLE__\n static const char *NAMES[] = {\n \"../Frameworks/OpenGL.framework/OpenGL\",\n \"/Library/Frameworks/OpenGL.framework/OpenGL\",\n \"/System/Library/Frameworks/OpenGL.framework/OpenGL\",\n \"/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL\"\n };\n#else\n static const char *NAMES[] = {\"libGL.so.1\", \"libGL.so\"};\n#endif\n\n unsigned int index = 0;\n for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) {\n libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);\n\n if(libGL != NULL) {\n#ifdef __APPLE__\n return 1;\n#else\n gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,\n \"glXGetProcAddressARB\");\n return gladGetProcAddressPtr != NULL;\n#endif\n }\n }\n\n return 0;\n}\n\nstatic\nvoid close_gl() {\n if(libGL != NULL) {\n dlclose(libGL);\n libGL = NULL;\n }\n}\n#endif\n\nstatic\nvoid* get_proc(const char *namez) {\n void* result = NULL;\n if(libGL == NULL) return NULL;\n\n#ifndef __APPLE__\n if(gladGetProcAddressPtr != NULL) {\n result = gladGetProcAddressPtr(namez);\n }\n#endif\n if(result == NULL) {\n#ifdef _WIN32\n result = (void*)GetProcAddress(libGL, namez);\n#else\n result = dlsym(libGL, namez);\n#endif\n }\n\n return result;\n}\n\nint gladLoadGL(void) {\n int status = 0;\n\n if(open_gl()) {\n status = gladLoadGLLoader(&get_proc);\n close_gl();\n }\n\n return status;\n}\n\nstruct gladGLversionStruct GLVersion;\n\n#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)\n#define _GLAD_IS_SOME_NEW_VERSION 1\n#endif\n\nstatic int max_loaded_major;\nstatic int max_loaded_minor;\n\nstatic const char *exts = NULL;\nstatic int num_exts_i = 0;\nstatic const char **exts_i = NULL;\n\nstatic int get_exts(void) {\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n if(max_loaded_major < 3) {\n#endif\n exts = (const char *)glGetString(GL_EXTENSIONS);\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n } else {\n int index;\n\n num_exts_i = 0;\n glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);\n if (num_exts_i > 0) {\n exts_i = (const char **)realloc((void *)exts_i, num_exts_i * sizeof *exts_i);\n }\n\n if (exts_i == NULL) {\n return 0;\n }\n\n for(index = 0; index < num_exts_i; index++) {\n exts_i[index] = (const char*)glGetStringi(GL_EXTENSIONS, index);\n }\n }\n#endif\n return 1;\n}\n\nstatic void free_exts(void) {\n if (exts_i != NULL) {\n free((char **)exts_i);\n exts_i = NULL;\n }\n}\n\nstatic int has_ext(const char *ext) {\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n if(max_loaded_major < 3) {\n#endif\n const char *extensions;\n const char *loc;\n const char *terminator;\n extensions = exts;\n if(extensions == NULL || ext == NULL) {\n return 0;\n }\n\n while(1) {\n loc = strstr(extensions, ext);\n if(loc == NULL) {\n return 0;\n }\n\n terminator = loc + strlen(ext);\n if((loc == extensions || *(loc - 1) == ' ') &&\n (*terminator == ' ' || *terminator == '\\0')) {\n return 1;\n }\n extensions = terminator;\n }\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n } else {\n int index;\n\n for(index = 0; index < num_exts_i; index++) {\n const char *e = exts_i[index];\n\n if(strcmp(e, ext) == 0) {\n return 1;\n }\n }\n }\n#endif\n\n return 0;\n}\nint GLAD_GL_VERSION_1_0;\nint GLAD_GL_VERSION_1_1;\nint GLAD_GL_VERSION_1_2;\nint GLAD_GL_VERSION_1_3;\nint GLAD_GL_VERSION_1_4;\nint GLAD_GL_VERSION_1_5;\nint GLAD_GL_VERSION_2_0;\nint GLAD_GL_VERSION_2_1;\nint GLAD_GL_VERSION_3_0;\nint GLAD_GL_VERSION_3_1;\nint GLAD_GL_VERSION_3_2;\nint GLAD_GL_VERSION_3_3;\nint GLAD_GL_VERSION_4_0;\nint GLAD_GL_VERSION_4_1;\nint GLAD_GL_VERSION_4_2;\nint GLAD_GL_VERSION_4_3;\nint GLAD_GL_VERSION_4_4;\nint GLAD_GL_VERSION_4_5;\nPFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D;\nPFNGLTEXTUREPARAMETERFPROC glad_glTextureParameterf;\nPFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui;\nPFNGLVERTEXARRAYELEMENTBUFFERPROC glad_glVertexArrayElementBuffer;\nPFNGLWINDOWPOS2SPROC glad_glWindowPos2s;\nPFNGLTEXTURESTORAGE3DMULTISAMPLEPROC glad_glTextureStorage3DMultisample;\nPFNGLTEXTUREPARAMETERFVPROC glad_glTextureParameterfv;\nPFNGLWINDOWPOS2IPROC glad_glWindowPos2i;\nPFNGLWINDOWPOS2FPROC glad_glWindowPos2f;\nPFNGLWINDOWPOS2DPROC glad_glWindowPos2d;\nPFNGLVERTEX2FVPROC glad_glVertex2fv;\nPFNGLINDEXIPROC glad_glIndexi;\nPFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer;\nPFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv;\nPFNGLRECTDVPROC glad_glRectdv;\nPFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D;\nPFNGLEVALCOORD2DPROC glad_glEvalCoord2d;\nPFNGLEVALCOORD2FPROC glad_glEvalCoord2f;\nPFNGLGETDOUBLEI_VPROC glad_glGetDoublei_v;\nPFNGLINDEXDPROC glad_glIndexd;\nPFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv;\nPFNGLINDEXFPROC glad_glIndexf;\nPFNGLBINDSAMPLERPROC glad_glBindSampler;\nPFNGLLINEWIDTHPROC glad_glLineWidth;\nPFNGLCOLORP3UIVPROC glad_glColorP3uiv;\nPFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v;\nPFNGLGETMAPFVPROC glad_glGetMapfv;\nPFNGLINDEXSPROC glad_glIndexs;\nPFNGLCOMPILESHADERPROC glad_glCompileShader;\nPFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying;\nPFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv;\nPFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC glad_glDrawTransformFeedbackStreamInstanced;\nPFNGLINDEXFVPROC glad_glIndexfv;\nPFNGLGETCOMPRESSEDTEXTUREIMAGEPROC glad_glGetCompressedTextureImage;\nPFNGLGETNMAPFVPROC glad_glGetnMapfv;\nPFNGLFOGIVPROC glad_glFogiv;\nPFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate;\nPFNGLRASTERPOS2FVPROC glad_glRasterPos2fv;\nPFNGLLIGHTMODELIVPROC glad_glLightModeliv;\nPFNGLDEPTHRANGEFPROC glad_glDepthRangef;\nPFNGLCOLOR4UIPROC glad_glColor4ui;\nPFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv;\nPFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui;\nPFNGLMEMORYBARRIERBYREGIONPROC glad_glMemoryBarrierByRegion;\nPFNGLGETNAMEDBUFFERPARAMETERIVPROC glad_glGetNamedBufferParameteriv;\nPFNGLFOGFVPROC glad_glFogfv;\nPFNGLVERTEXP4UIPROC glad_glVertexP4ui;\nPFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC glad_glDrawElementsInstancedBaseInstance;\nPFNGLENABLEIPROC glad_glEnablei;\nPFNGLPROGRAMUNIFORM3DVPROC glad_glProgramUniform3dv;\nPFNGLVERTEX4IVPROC glad_glVertex4iv;\nPFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv;\nPFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv;\nPFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui;\nPFNGLCREATESHADERPROC glad_glCreateShader;\nPFNGLISBUFFERPROC glad_glIsBuffer;\nPFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv;\nPFNGLPROGRAMUNIFORMMATRIX2DVPROC glad_glProgramUniformMatrix2dv;\nPFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers;\nPFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D;\nPFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D;\nPFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f;\nPFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate;\nPFNGLVERTEX4FVPROC glad_glVertex4fv;\nPFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading;\nPFNGLCLEARNAMEDFRAMEBUFFERFIPROC glad_glClearNamedFramebufferfi;\nPFNGLGETQUERYBUFFEROBJECTUIVPROC glad_glGetQueryBufferObjectuiv;\nPFNGLBINDTEXTUREPROC glad_glBindTexture;\nPFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s;\nPFNGLTEXCOORD2FVPROC glad_glTexCoord2fv;\nPFNGLSAMPLEMASKIPROC glad_glSampleMaski;\nPFNGLVERTEXP2UIPROC glad_glVertexP2ui;\nPFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex;\nPFNGLTEXCOORD4FVPROC glad_glTexCoord4fv;\nPFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv;\nPFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl;\nPFNGLPOINTSIZEPROC glad_glPointSize;\nPFNGLBINDTEXTUREUNITPROC glad_glBindTextureUnit;\nPFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv;\nPFNGLDELETEPROGRAMPROC glad_glDeleteProgram;\nPFNGLCOLOR4BVPROC glad_glColor4bv;\nPFNGLRASTERPOS2FPROC glad_glRasterPos2f;\nPFNGLRASTERPOS2DPROC glad_glRasterPos2d;\nPFNGLLOADIDENTITYPROC glad_glLoadIdentity;\nPFNGLRASTERPOS2IPROC glad_glRasterPos2i;\nPFNGLMULTIDRAWARRAYSINDIRECTPROC glad_glMultiDrawArraysIndirect;\nPFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage;\nPFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv;\nPFNGLCOLOR3BPROC glad_glColor3b;\nPFNGLCLEARBUFFERFVPROC glad_glClearBufferfv;\nPFNGLEDGEFLAGPROC glad_glEdgeFlag;\nPFNGLDELETESAMPLERSPROC glad_glDeleteSamplers;\nPFNGLVERTEX3DPROC glad_glVertex3d;\nPFNGLVERTEX3FPROC glad_glVertex3f;\nPFNGLGETNMAPIVPROC glad_glGetnMapiv;\nPFNGLVERTEX3IPROC glad_glVertex3i;\nPFNGLCOLOR3IPROC glad_glColor3i;\nPFNGLUNIFORM3DPROC glad_glUniform3d;\nPFNGLUNIFORM3FPROC glad_glUniform3f;\nPFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv;\nPFNGLCOLOR3SPROC glad_glColor3s;\nPFNGLVERTEX3SPROC glad_glVertex3s;\nPFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui;\nPFNGLCOLORMASKIPROC glad_glColorMaski;\nPFNGLCLEARBUFFERFIPROC glad_glClearBufferfi;\nPFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect;\nPFNGLTEXCOORD1IVPROC glad_glTexCoord1iv;\nPFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer;\nPFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback;\nPFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui;\nPFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glad_glProgramUniformMatrix3x2dv;\nPFNGLCOPYNAMEDBUFFERSUBDATAPROC glad_glCopyNamedBufferSubData;\nPFNGLNAMEDFRAMEBUFFERTEXTUREPROC glad_glNamedFramebufferTexture;\nPFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glad_glProgramUniformMatrix3x2fv;\nPFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv;\nPFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex;\nPFNGLVERTEXATTRIBL4DPROC glad_glVertexAttribL4d;\nPFNGLBINDIMAGETEXTUREPROC glad_glBindImageTexture;\nPFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f;\nPFNGLPROGRAMUNIFORMMATRIX4FVPROC glad_glProgramUniformMatrix4fv;\nPFNGLVERTEX2IVPROC glad_glVertex2iv;\nPFNGLGETQUERYBUFFEROBJECTI64VPROC glad_glGetQueryBufferObjecti64v;\nPFNGLCOLOR3SVPROC glad_glColor3sv;\nPFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv;\nPFNGLACTIVESHADERPROGRAMPROC glad_glActiveShaderProgram;\nPFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv;\nPFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv;\nPFNGLNORMALPOINTERPROC glad_glNormalPointer;\nPFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv;\nPFNGLVERTEX4SVPROC glad_glVertex4sv;\nPFNGLVERTEXARRAYATTRIBLFORMATPROC glad_glVertexArrayAttribLFormat;\nPFNGLINVALIDATEBUFFERSUBDATAPROC glad_glInvalidateBufferSubData;\nPFNGLPASSTHROUGHPROC glad_glPassThrough;\nPFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui;\nPFNGLFOGIPROC glad_glFogi;\nPFNGLBEGINPROC glad_glBegin;\nPFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv;\nPFNGLCOLOR3UBVPROC glad_glColor3ubv;\nPFNGLVERTEXPOINTERPROC glad_glVertexPointer;\nPFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv;\nPFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers;\nPFNGLDRAWARRAYSPROC glad_glDrawArrays;\nPFNGLUNIFORM1UIPROC glad_glUniform1ui;\nPFNGLGETTRANSFORMFEEDBACKIVPROC glad_glGetTransformFeedbackiv;\nPFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d;\nPFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f;\nPFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri;\nPFNGLLIGHTFVPROC glad_glLightfv;\nPFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui;\nPFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d;\nPFNGLCLEARPROC glad_glClear;\nPFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i;\nPFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName;\nPFNGLMEMORYBARRIERPROC glad_glMemoryBarrier;\nPFNGLGETGRAPHICSRESETSTATUSPROC glad_glGetGraphicsResetStatus;\nPFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s;\nPFNGLISENABLEDPROC glad_glIsEnabled;\nPFNGLSTENCILOPPROC glad_glStencilOp;\nPFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv;\nPFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D;\nPFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv;\nPFNGLTRANSLATEFPROC glad_glTranslatef;\nPFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub;\nPFNGLTRANSLATEDPROC glad_glTranslated;\nPFNGLTEXCOORD3SVPROC glad_glTexCoord3sv;\nPFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation;\nPFNGLGETTEXTUREPARAMETERIIVPROC glad_glGetTextureParameterIiv;\nPFNGLTEXIMAGE1DPROC glad_glTexImage1D;\nPFNGLCOPYTEXTURESUBIMAGE3DPROC glad_glCopyTextureSubImage3D;\nPFNGLVERTEXP3UIVPROC glad_glVertexP3uiv;\nPFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;\nPFNGLVERTEXARRAYATTRIBIFORMATPROC glad_glVertexArrayAttribIFormat;\nPFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv;\nPFNGLGETMATERIALFVPROC glad_glGetMaterialfv;\nPFNGLGETTEXIMAGEPROC glad_glGetTexImage;\nPFNGLFOGCOORDFVPROC glad_glFogCoordfv;\nPFNGLPIXELMAPUIVPROC glad_glPixelMapuiv;\nPFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog;\nPFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v;\nPFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers;\nPFNGLCREATETEXTURESPROC glad_glCreateTextures;\nPFNGLTRANSFORMFEEDBACKBUFFERBASEPROC glad_glTransformFeedbackBufferBase;\nPFNGLINDEXSVPROC glad_glIndexsv;\nPFNGLCLEARTEXSUBIMAGEPROC glad_glClearTexSubImage;\nPFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glad_glProgramUniformMatrix3x4dv;\nPFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders;\nPFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer;\nPFNGLVERTEX3IVPROC glad_glVertex3iv;\nPFNGLBITMAPPROC glad_glBitmap;\nPFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog;\nPFNGLPROGRAMUNIFORM1UIVPROC glad_glProgramUniform1uiv;\nPFNGLMATERIALIPROC glad_glMateriali;\nPFNGLISVERTEXARRAYPROC glad_glIsVertexArray;\nPFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray;\nPFNGLPROGRAMUNIFORM2IVPROC glad_glProgramUniform2iv;\nPFNGLGETQUERYIVPROC glad_glGetQueryiv;\nPFNGLTEXCOORD4FPROC glad_glTexCoord4f;\nPFNGLBLITNAMEDFRAMEBUFFERPROC glad_glBlitNamedFramebuffer;\nPFNGLTEXCOORD4DPROC glad_glTexCoord4d;\nPFNGLCREATEQUERIESPROC glad_glCreateQueries;\nPFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv;\nPFNGLTEXCOORD4IPROC glad_glTexCoord4i;\nPFNGLSHADERSTORAGEBLOCKBINDINGPROC glad_glShaderStorageBlockBinding;\nPFNGLMATERIALFPROC glad_glMaterialf;\nPFNGLTEXCOORD4SPROC glad_glTexCoord4s;\nPFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glad_glProgramUniformMatrix4x2dv;\nPFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices;\nPFNGLISSHADERPROC glad_glIsShader;\nPFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s;\nPFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv;\nPFNGLVERTEX3DVPROC glad_glVertex3dv;\nPFNGLGETINTEGER64VPROC glad_glGetInteger64v;\nPFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv;\nPFNGLGETNMINMAXPROC glad_glGetnMinmax;\nPFNGLENABLEPROC glad_glEnable;\nPFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv;\nPFNGLCOLOR4FVPROC glad_glColor4fv;\nPFNGLTEXCOORD1FVPROC glad_glTexCoord1fv;\nPFNGLVERTEXARRAYATTRIBBINDINGPROC glad_glVertexArrayAttribBinding;\nPFNGLTEXTURESTORAGE1DPROC glad_glTextureStorage1D;\nPFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup;\nPFNGLBLENDEQUATIONIPROC glad_glBlendEquationi;\nPFNGLTEXCOORD2SVPROC glad_glTexCoord2sv;\nPFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv;\nPFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv;\nPFNGLGETPROGRAMINTERFACEIVPROC glad_glGetProgramInterfaceiv;\nPFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i;\nPFNGLTEXCOORD3FVPROC glad_glTexCoord3fv;\nPFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv;\nPFNGLTEXGENFPROC glad_glTexGenf;\nPFNGLMAPNAMEDBUFFERPROC glad_glMapNamedBuffer;\nPFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv;\nPFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui;\nPFNGLVERTEXATTRIBL1DVPROC glad_glVertexAttribL1dv;\nPFNGLTEXTUREBUFFERRANGEPROC glad_glTextureBufferRange;\nPFNGLGETNUNIFORMDVPROC glad_glGetnUniformdv;\nPFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui;\nPFNGLPROGRAMUNIFORM3UIPROC glad_glProgramUniform3ui;\nPFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC glad_glTransformFeedbackBufferRange;\nPFNGLGETPOINTERVPROC glad_glGetPointerv;\nPFNGLVERTEXBINDINGDIVISORPROC glad_glVertexBindingDivisor;\nPFNGLPOLYGONOFFSETPROC glad_glPolygonOffset;\nPFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv;\nPFNGLNORMAL3FVPROC glad_glNormal3fv;\nPFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s;\nPFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC glad_glNamedFramebufferDrawBuffers;\nPFNGLDEPTHRANGEPROC glad_glDepthRange;\nPFNGLFRUSTUMPROC glad_glFrustum;\nPFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv;\nPFNGLVERTEXARRAYBINDINGDIVISORPROC glad_glVertexArrayBindingDivisor;\nPFNGLDRAWBUFFERPROC glad_glDrawBuffer;\nPFNGLPUSHMATRIXPROC glad_glPushMatrix;\nPFNGLGETNPIXELMAPUSVPROC glad_glGetnPixelMapusv;\nPFNGLRASTERPOS3FVPROC glad_glRasterPos3fv;\nPFNGLORTHOPROC glad_glOrtho;\nPFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced;\nPFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv;\nPFNGLVERTEXATTRIBL4DVPROC glad_glVertexAttribL4dv;\nPFNGLPROGRAMUNIFORM1IPROC glad_glProgramUniform1i;\nPFNGLUNIFORM2DVPROC glad_glUniform2dv;\nPFNGLPROGRAMUNIFORM1DPROC glad_glProgramUniform1d;\nPFNGLPROGRAMUNIFORM1FPROC glad_glProgramUniform1f;\nPFNGLCLEARINDEXPROC glad_glClearIndex;\nPFNGLMAP1DPROC glad_glMap1d;\nPFNGLMAP1FPROC glad_glMap1f;\nPFNGLFLUSHPROC glad_glFlush;\nPFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv;\nPFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed;\nPFNGLPROGRAMUNIFORM3IVPROC glad_glProgramUniform3iv;\nPFNGLINDEXIVPROC glad_glIndexiv;\nPFNGLNAMEDRENDERBUFFERSTORAGEPROC glad_glNamedRenderbufferStorage;\nPFNGLRASTERPOS3SVPROC glad_glRasterPos3sv;\nPFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv;\nPFNGLPIXELZOOMPROC glad_glPixelZoom;\nPFNGLFENCESYNCPROC glad_glFenceSync;\nPFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays;\nPFNGLCOLORP3UIPROC glad_glColorP3ui;\nPFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glad_glDrawElementsInstancedBaseVertexBaseInstance;\nPFNGLTEXTURESTORAGE2DMULTISAMPLEPROC glad_glTextureStorage2DMultisample;\nPFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv;\nPFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender;\nPFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup;\nPFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat;\nPFNGLVALIDATEPROGRAMPIPELINEPROC glad_glValidateProgramPipeline;\nPFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex;\nPFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;\nPFNGLLIGHTIPROC glad_glLighti;\nPFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv;\nPFNGLVERTEXARRAYVERTEXBUFFERPROC glad_glVertexArrayVertexBuffer;\nPFNGLLIGHTFPROC glad_glLightf;\nPFNGLBINDVERTEXBUFFERSPROC glad_glBindVertexBuffers;\nPFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation;\nPFNGLTEXSTORAGE3DMULTISAMPLEPROC glad_glTexStorage3DMultisample;\nPFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate;\nPFNGLDISABLEVERTEXARRAYATTRIBPROC glad_glDisableVertexArrayAttrib;\nPFNGLGENSAMPLERSPROC glad_glGenSamplers;\nPFNGLCLAMPCOLORPROC glad_glClampColor;\nPFNGLUNIFORM4IVPROC glad_glUniform4iv;\nPFNGLCLEARSTENCILPROC glad_glClearStencil;\nPFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv;\nPFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC glad_glGetNamedRenderbufferParameteriv;\nPFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC glad_glDrawTransformFeedbackInstanced;\nPFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv;\nPFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv;\nPFNGLGENTEXTURESPROC glad_glGenTextures;\nPFNGLTEXCOORD4IVPROC glad_glTexCoord4iv;\nPFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback;\nPFNGLUNIFORM1DVPROC glad_glUniform1dv;\nPFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv;\nPFNGLGETTRANSFORMFEEDBACKI_VPROC glad_glGetTransformFeedbacki_v;\nPFNGLINDEXPOINTERPROC glad_glIndexPointer;\nPFNGLGETNPOLYGONSTIPPLEPROC glad_glGetnPolygonStipple;\nPFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv;\nPFNGLCLEARNAMEDFRAMEBUFFERUIVPROC glad_glClearNamedFramebufferuiv;\nPFNGLGETVERTEXARRAYINDEXEDIVPROC glad_glGetVertexArrayIndexediv;\nPFNGLISSYNCPROC glad_glIsSync;\nPFNGLVERTEX2FPROC glad_glVertex2f;\nPFNGLVERTEX2DPROC glad_glVertex2d;\nPFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers;\nPFNGLUNIFORM2IPROC glad_glUniform2i;\nPFNGLMAPGRID2DPROC glad_glMapGrid2d;\nPFNGLMAPGRID2FPROC glad_glMapGrid2f;\nPFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui;\nPFNGLVERTEX2IPROC glad_glVertex2i;\nPFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer;\nPFNGLPROGRAMUNIFORM1UIPROC glad_glProgramUniform1ui;\nPFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer;\nPFNGLVERTEX2SPROC glad_glVertex2s;\nPFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel;\nPFNGLTEXTUREPARAMETERIPROC glad_glTextureParameteri;\nPFNGLNORMAL3BVPROC glad_glNormal3bv;\nPFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv;\nPFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange;\nPFNGLPROGRAMUNIFORM2FVPROC glad_glProgramUniform2fv;\nPFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv;\nPFNGLPROGRAMUNIFORMMATRIX4DVPROC glad_glProgramUniformMatrix4dv;\nPFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv;\nPFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glad_glProgramUniformMatrix2x4dv;\nPFNGLDISPATCHCOMPUTEPROC glad_glDispatchCompute;\nPFNGLVERTEX3SVPROC glad_glVertex3sv;\nPFNGLGENQUERIESPROC glad_glGenQueries;\nPFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv;\nPFNGLTEXENVFPROC glad_glTexEnvf;\nPFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui;\nPFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D;\nPFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v;\nPFNGLFOGCOORDDPROC glad_glFogCoordd;\nPFNGLFOGCOORDFPROC glad_glFogCoordf;\nPFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D;\nPFNGLTEXENVIPROC glad_glTexEnvi;\nPFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv;\nPFNGLISENABLEDIPROC glad_glIsEnabledi;\nPFNGLBINDBUFFERSRANGEPROC glad_glBindBuffersRange;\nPFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui;\nPFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i;\nPFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed;\nPFNGLCOPYIMAGESUBDATAPROC glad_glCopyImageSubData;\nPFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv;\nPFNGLUNIFORM2IVPROC glad_glUniform2iv;\nPFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv;\nPFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ;\nPFNGLUNIFORM4UIVPROC glad_glUniform4uiv;\nPFNGLMATRIXMODEPROC glad_glMatrixMode;\nPFNGLGETTEXTUREIMAGEPROC glad_glGetTextureImage;\nPFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer;\nPFNGLPROGRAMUNIFORM2DVPROC glad_glProgramUniform2dv;\nPFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed;\nPFNGLGETMAPIVPROC glad_glGetMapiv;\nPFNGLTEXTURESUBIMAGE3DPROC glad_glTextureSubImage3D;\nPFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D;\nPFNGLUNIFORM4DPROC glad_glUniform4d;\nPFNGLGETSHADERIVPROC glad_glGetShaderiv;\nPFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d;\nPFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f;\nPFNGLPROGRAMUNIFORMMATRIX3FVPROC glad_glProgramUniformMatrix3fv;\nPFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel;\nPFNGLINVALIDATEFRAMEBUFFERPROC glad_glInvalidateFramebuffer;\nPFNGLBINDTEXTURESPROC glad_glBindTextures;\nPFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation;\nPFNGLNAMEDBUFFERSTORAGEPROC glad_glNamedBufferStorage;\nPFNGLSCISSORARRAYVPROC glad_glScissorArrayv;\nPFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures;\nPFNGLCALLLISTPROC glad_glCallList;\nPFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv;\nPFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv;\nPFNGLGETDOUBLEVPROC glad_glGetDoublev;\nPFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv;\nPFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d;\nPFNGLUNIFORM4DVPROC glad_glUniform4dv;\nPFNGLLIGHTMODELFPROC glad_glLightModelf;\nPFNGLGETUNIFORMIVPROC glad_glGetUniformiv;\nPFNGLINVALIDATEBUFFERDATAPROC glad_glInvalidateBufferData;\nPFNGLVERTEX2SVPROC glad_glVertex2sv;\nPFNGLVERTEXARRAYVERTEXBUFFERSPROC glad_glVertexArrayVertexBuffers;\nPFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC glad_glCompressedTextureSubImage1D;\nPFNGLLIGHTMODELIPROC glad_glLightModeli;\nPFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv;\nPFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv;\nPFNGLUNIFORM3FVPROC glad_glUniform3fv;\nPFNGLPIXELSTOREIPROC glad_glPixelStorei;\nPFNGLGETPROGRAMPIPELINEINFOLOGPROC glad_glGetProgramPipelineInfoLog;\nPFNGLCALLLISTSPROC glad_glCallLists;\nPFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glad_glProgramUniformMatrix3x4fv;\nPFNGLINVALIDATESUBFRAMEBUFFERPROC glad_glInvalidateSubFramebuffer;\nPFNGLMAPBUFFERPROC glad_glMapBuffer;\nPFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d;\nPFNGLTEXCOORD3IPROC glad_glTexCoord3i;\nPFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv;\nPFNGLRASTERPOS3IPROC glad_glRasterPos3i;\nPFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b;\nPFNGLRASTERPOS3DPROC glad_glRasterPos3d;\nPFNGLRASTERPOS3FPROC glad_glRasterPos3f;\nPFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D;\nPFNGLTEXCOORD3FPROC glad_glTexCoord3f;\nPFNGLDELETESYNCPROC glad_glDeleteSync;\nPFNGLTEXCOORD3DPROC glad_glTexCoord3d;\nPFNGLGETTRANSFORMFEEDBACKI64_VPROC glad_glGetTransformFeedbacki64_v;\nPFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv;\nPFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample;\nPFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv;\nPFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv;\nPFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements;\nPFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv;\nPFNGLTEXCOORD3SPROC glad_glTexCoord3s;\nPFNGLUNIFORM3IVPROC glad_glUniform3iv;\nPFNGLRASTERPOS3SPROC glad_glRasterPos3s;\nPFNGLPOLYGONMODEPROC glad_glPolygonMode;\nPFNGLDRAWBUFFERSPROC glad_glDrawBuffers;\nPFNGLGETNHISTOGRAMPROC glad_glGetnHistogram;\nPFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv;\nPFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident;\nPFNGLPROGRAMUNIFORM2DPROC glad_glProgramUniform2d;\nPFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glad_glProgramUniformMatrix4x3dv;\nPFNGLISLISTPROC glad_glIsList;\nPFNGLPROGRAMUNIFORM4IVPROC glad_glProgramUniform4iv;\nPFNGLRASTERPOS2SVPROC glad_glRasterPos2sv;\nPFNGLRASTERPOS4SVPROC glad_glRasterPos4sv;\nPFNGLCOLOR4SPROC glad_glColor4s;\nPFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary;\nPFNGLUSEPROGRAMPROC glad_glUseProgram;\nPFNGLLINESTIPPLEPROC glad_glLineStipple;\nPFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv;\nPFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog;\nPFNGLCLEARTEXIMAGEPROC glad_glClearTexImage;\nPFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv;\nPFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv;\nPFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv;\nPFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray;\nPFNGLCOLOR4BPROC glad_glColor4b;\nPFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f;\nPFNGLCOLOR4FPROC glad_glColor4f;\nPFNGLCOLOR4DPROC glad_glColor4d;\nPFNGLCOLOR4IPROC glad_glColor4i;\nPFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv;\nPFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex;\nPFNGLVERTEXATTRIBLFORMATPROC glad_glVertexAttribLFormat;\nPFNGLRASTERPOS3IVPROC glad_glRasterPos3iv;\nPFNGLTEXTURESTORAGE2DPROC glad_glTextureStorage2D;\nPFNGLGENERATETEXTUREMIPMAPPROC glad_glGenerateTextureMipmap;\nPFNGLVERTEX2DVPROC glad_glVertex2dv;\nPFNGLTEXCOORD4SVPROC glad_glTexCoord4sv;\nPFNGLUNIFORM2UIVPROC glad_glUniform2uiv;\nPFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D;\nPFNGLFINISHPROC glad_glFinish;\nPFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed;\nPFNGLGETBOOLEANVPROC glad_glGetBooleanv;\nPFNGLDELETESHADERPROC glad_glDeleteShader;\nPFNGLDRAWELEMENTSPROC glad_glDrawElements;\nPFNGLGETINTERNALFORMATI64VPROC glad_glGetInternalformati64v;\nPFNGLRASTERPOS2SPROC glad_glRasterPos2s;\nPFNGLCOPYTEXTURESUBIMAGE1DPROC glad_glCopyTextureSubImage1D;\nPFNGLGETMAPDVPROC glad_glGetMapdv;\nPFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv;\nPFNGLMATERIALFVPROC glad_glMaterialfv;\nPFNGLTEXTUREPARAMETERIUIVPROC glad_glTextureParameterIuiv;\nPFNGLVIEWPORTPROC glad_glViewport;\nPFNGLUNIFORM1UIVPROC glad_glUniform1uiv;\nPFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings;\nPFNGLINDEXDVPROC glad_glIndexdv;\nPFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D;\nPFNGLTEXCOORD3IVPROC glad_glTexCoord3iv;\nPFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback;\nPFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i;\nPFNGLINVALIDATETEXIMAGEPROC glad_glInvalidateTexImage;\nPFNGLVERTEXATTRIBFORMATPROC glad_glVertexAttribFormat;\nPFNGLCLEARDEPTHPROC glad_glClearDepth;\nPFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv;\nPFNGLTEXPARAMETERFPROC glad_glTexParameterf;\nPFNGLVERTEXATTRIBBINDINGPROC glad_glVertexAttribBinding;\nPFNGLTEXPARAMETERIPROC glad_glTexParameteri;\nPFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv;\nPFNGLGETSHADERSOURCEPROC glad_glGetShaderSource;\nPFNGLCREATETRANSFORMFEEDBACKSPROC glad_glCreateTransformFeedbacks;\nPFNGLGETNTEXIMAGEPROC glad_glGetnTexImage;\nPFNGLTEXBUFFERPROC glad_glTexBuffer;\nPFNGLPOPNAMEPROC glad_glPopName;\nPFNGLVALIDATEPROGRAMPROC glad_glValidateProgram;\nPFNGLPIXELSTOREFPROC glad_glPixelStoref;\nPFNGLUNIFORM3UIVPROC glad_glUniform3uiv;\nPFNGLVIEWPORTINDEXEDFPROC glad_glViewportIndexedf;\nPFNGLRASTERPOS4FVPROC glad_glRasterPos4fv;\nPFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv;\nPFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv;\nPFNGLGENPROGRAMPIPELINESPROC glad_glGenProgramPipelines;\nPFNGLRECTIPROC glad_glRecti;\nPFNGLCOLOR4UBPROC glad_glColor4ub;\nPFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf;\nPFNGLRECTFPROC glad_glRectf;\nPFNGLRECTDPROC glad_glRectd;\nPFNGLNORMAL3SVPROC glad_glNormal3sv;\nPFNGLNEWLISTPROC glad_glNewList;\nPFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glad_glProgramUniformMatrix2x3dv;\nPFNGLCOLOR4USPROC glad_glColor4us;\nPFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv;\nPFNGLLINKPROGRAMPROC glad_glLinkProgram;\nPFNGLHINTPROC glad_glHint;\nPFNGLRECTSPROC glad_glRects;\nPFNGLTEXCOORD2DVPROC glad_glTexCoord2dv;\nPFNGLRASTERPOS4IVPROC glad_glRasterPos4iv;\nPFNGLGETOBJECTLABELPROC glad_glGetObjectLabel;\nPFNGLPROGRAMUNIFORM2FPROC glad_glProgramUniform2f;\nPFNGLGETSTRINGPROC glad_glGetString;\nPFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv;\nPFNGLEDGEFLAGVPROC glad_glEdgeFlagv;\nPFNGLDETACHSHADERPROC glad_glDetachShader;\nPFNGLPROGRAMUNIFORM3IPROC glad_glProgramUniform3i;\nPFNGLSCALEFPROC glad_glScalef;\nPFNGLENDQUERYPROC glad_glEndQuery;\nPFNGLSCALEDPROC glad_glScaled;\nPFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer;\nPFNGLFRAMEBUFFERPARAMETERIPROC glad_glFramebufferParameteri;\nPFNGLGETPROGRAMRESOURCENAMEPROC glad_glGetProgramResourceName;\nPFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv;\nPFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv;\nPFNGLCOPYPIXELSPROC glad_glCopyPixels;\nPFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui;\nPFNGLGETPROGRAMRESOURCELOCATIONPROC glad_glGetProgramResourceLocation;\nPFNGLPOPATTRIBPROC glad_glPopAttrib;\nPFNGLDELETETEXTURESPROC glad_glDeleteTextures;\nPFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC glad_glGetActiveAtomicCounterBufferiv;\nPFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate;\nPFNGLGETTEXTUREPARAMETERIVPROC glad_glGetTextureParameteriv;\nPFNGLDELETEQUERIESPROC glad_glDeleteQueries;\nPFNGLNORMALP3UIVPROC glad_glNormalP3uiv;\nPFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f;\nPFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d;\nPFNGLVIEWPORTINDEXEDFVPROC glad_glViewportIndexedfv;\nPFNGLINITNAMESPROC glad_glInitNames;\nPFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v;\nPFNGLCOLOR3DVPROC glad_glColor3dv;\nPFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i;\nPFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;\nPFNGLWAITSYNCPROC glad_glWaitSync;\nPFNGLCREATEVERTEXARRAYSPROC glad_glCreateVertexArrays;\nPFNGLPROGRAMUNIFORM1DVPROC glad_glProgramUniform1dv;\nPFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s;\nPFNGLCOLORMATERIALPROC glad_glColorMaterial;\nPFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage;\nPFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri;\nPFNGLCLEARBUFFERSUBDATAPROC glad_glClearBufferSubData;\nPFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf;\nPFNGLTEXSTORAGE1DPROC glad_glTexStorage1D;\nPFNGLUNIFORM1FPROC glad_glUniform1f;\nPFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv;\nPFNGLUNIFORM1DPROC glad_glUniform1d;\nPFNGLRENDERMODEPROC glad_glRenderMode;\nPFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage;\nPFNGLGETNCOMPRESSEDTEXIMAGEPROC glad_glGetnCompressedTexImage;\nPFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv;\nPFNGLUNIFORM1IPROC glad_glUniform1i;\nPFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib;\nPFNGLUNIFORM3IPROC glad_glUniform3i;\nPFNGLPIXELTRANSFERIPROC glad_glPixelTransferi;\nPFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D;\nPFNGLDISABLEPROC glad_glDisable;\nPFNGLLOGICOPPROC glad_glLogicOp;\nPFNGLEVALPOINT2PROC glad_glEvalPoint2;\nPFNGLPIXELTRANSFERFPROC glad_glPixelTransferf;\nPFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i;\nPFNGLPROGRAMUNIFORM4UIVPROC glad_glProgramUniform4uiv;\nPFNGLUNIFORM4UIPROC glad_glUniform4ui;\nPFNGLCOLOR3FPROC glad_glColor3f;\nPFNGLNAMEDFRAMEBUFFERREADBUFFERPROC glad_glNamedFramebufferReadBuffer;\nPFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer;\nPFNGLGETTEXENVFVPROC glad_glGetTexEnvfv;\nPFNGLRECTFVPROC glad_glRectfv;\nPFNGLCULLFACEPROC glad_glCullFace;\nPFNGLGETLIGHTFVPROC glad_glGetLightfv;\nPFNGLGETNUNIFORMIVPROC glad_glGetnUniformiv;\nPFNGLCOLOR3DPROC glad_glColor3d;\nPFNGLPROGRAMUNIFORM4IPROC glad_glProgramUniform4i;\nPFNGLTEXGENDPROC glad_glTexGend;\nPFNGLPROGRAMUNIFORM4FPROC glad_glProgramUniform4f;\nPFNGLTEXGENIPROC glad_glTexGeni;\nPFNGLPROGRAMUNIFORM4DPROC glad_glProgramUniform4d;\nPFNGLTEXTUREPARAMETERIIVPROC glad_glTextureParameterIiv;\nPFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s;\nPFNGLGETSTRINGIPROC glad_glGetStringi;\nPFNGLGETTEXTUREPARAMETERFVPROC glad_glGetTextureParameterfv;\nPFNGLTEXTURESUBIMAGE2DPROC glad_glTextureSubImage2D;\nPFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i;\nPFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f;\nPFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream;\nPFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d;\nPFNGLATTACHSHADERPROC glad_glAttachShader;\nPFNGLFOGCOORDDVPROC glad_glFogCoorddv;\nPFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv;\nPFNGLGETTEXGENFVPROC glad_glGetTexGenfv;\nPFNGLQUERYCOUNTERPROC glad_glQueryCounter;\nPFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer;\nPFNGLPROGRAMUNIFORMMATRIX3DVPROC glad_glProgramUniformMatrix3dv;\nPFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex;\nPFNGLSHADERBINARYPROC glad_glShaderBinary;\nPFNGLUNMAPNAMEDBUFFERPROC glad_glUnmapNamedBuffer;\nPFNGLGETNCOLORTABLEPROC glad_glGetnColorTable;\nPFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D;\nPFNGLTEXGENIVPROC glad_glTexGeniv;\nPFNGLRASTERPOS2DVPROC glad_glRasterPos2dv;\nPFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv;\nPFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture;\nPFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glNamedRenderbufferStorageMultisample;\nPFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv;\nPFNGLCLEARNAMEDBUFFERDATAPROC glad_glClearNamedBufferData;\nPFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us;\nPFNGLNORMALP3UIPROC glad_glNormalP3ui;\nPFNGLTEXENVFVPROC glad_glTexEnvfv;\nPFNGLREADBUFFERPROC glad_glReadBuffer;\nPFNGLVIEWPORTARRAYVPROC glad_glViewportArrayv;\nPFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv;\nPFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced;\nPFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap;\nPFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC glad_glCompressedTextureSubImage2D;\nPFNGLPROGRAMUNIFORMMATRIX2FVPROC glad_glProgramUniformMatrix2fv;\nPFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv;\nPFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv;\nPFNGLLIGHTMODELFVPROC glad_glLightModelfv;\nPFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv;\nPFNGLDELETELISTSPROC glad_glDeleteLists;\nPFNGLGETCLIPPLANEPROC glad_glGetClipPlane;\nPFNGLVERTEX4DVPROC glad_glVertex4dv;\nPFNGLTEXCOORD2DPROC glad_glTexCoord2d;\nPFNGLPOPMATRIXPROC glad_glPopMatrix;\nPFNGLTEXCOORD2FPROC glad_glTexCoord2f;\nPFNGLCOLOR4IVPROC glad_glColor4iv;\nPFNGLINDEXUBVPROC glad_glIndexubv;\nPFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC glad_glCheckNamedFramebufferStatus;\nPFNGLUNMAPBUFFERPROC glad_glUnmapBuffer;\nPFNGLTEXCOORD2IPROC glad_glTexCoord2i;\nPFNGLRASTERPOS4DPROC glad_glRasterPos4d;\nPFNGLRASTERPOS4FPROC glad_glRasterPos4f;\nPFNGLPROGRAMUNIFORM1IVPROC glad_glProgramUniform1iv;\nPFNGLGETVERTEXARRAYIVPROC glad_glGetVertexArrayiv;\nPFNGLCOPYTEXTURESUBIMAGE2DPROC glad_glCopyTextureSubImage2D;\nPFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s;\nPFNGLTEXCOORD2SPROC glad_glTexCoord2s;\nPFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer;\nPFNGLVERTEX3FVPROC glad_glVertex3fv;\nPFNGLTEXCOORD4DVPROC glad_glTexCoord4dv;\nPFNGLMATERIALIVPROC glad_glMaterialiv;\nPFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv;\nPFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv;\nPFNGLISPROGRAMPROC glad_glIsProgram;\nPFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv;\nPFNGLVERTEX4SPROC glad_glVertex4s;\nPFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv;\nPFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv;\nPFNGLNORMAL3DVPROC glad_glNormal3dv;\nPFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback;\nPFNGLUNIFORM4IPROC glad_glUniform4i;\nPFNGLACTIVETEXTUREPROC glad_glActiveTexture;\nPFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray;\nPFNGLROTATEDPROC glad_glRotated;\nPFNGLISPROGRAMPIPELINEPROC glad_glIsProgramPipeline;\nPFNGLROTATEFPROC glad_glRotatef;\nPFNGLVERTEX4IPROC glad_glVertex4i;\nPFNGLREADPIXELSPROC glad_glReadPixels;\nPFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv;\nPFNGLLOADNAMEPROC glad_glLoadName;\nPFNGLUNIFORM4FPROC glad_glUniform4f;\nPFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample;\nPFNGLCREATEPROGRAMPIPELINESPROC glad_glCreateProgramPipelines;\nPFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays;\nPFNGLSHADEMODELPROC glad_glShadeModel;\nPFNGLMAPGRID1DPROC glad_glMapGrid1d;\nPFNGLGETUNIFORMFVPROC glad_glGetUniformfv;\nPFNGLMAPGRID1FPROC glad_glMapGrid1f;\nPFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv;\nPFNGLVERTEXATTRIBLPOINTERPROC glad_glVertexAttribLPointer;\nPFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState;\nPFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv;\nPFNGLGETNUNIFORMFVPROC glad_glGetnUniformfv;\nPFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex;\nPFNGLVERTEXATTRIBL2DVPROC glad_glVertexAttribL2dv;\nPFNGLMULTIDRAWELEMENTSINDIRECTPROC glad_glMultiDrawElementsIndirect;\nPFNGLENABLEVERTEXARRAYATTRIBPROC glad_glEnableVertexArrayAttrib;\nPFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer;\nPFNGLALPHAFUNCPROC glad_glAlphaFunc;\nPFNGLUNIFORM1IVPROC glad_glUniform1iv;\nPFNGLCREATESHADERPROGRAMVPROC glad_glCreateShaderProgramv;\nPFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName;\nPFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv;\nPFNGLVERTEXATTRIBL2DPROC glad_glVertexAttribL2d;\nPFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv;\nPFNGLSTENCILFUNCPROC glad_glStencilFunc;\nPFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC glad_glInvalidateNamedFramebufferData;\nPFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv;\nPFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding;\nPFNGLCOLOR4UIVPROC glad_glColor4uiv;\nPFNGLRECTIVPROC glad_glRectiv;\nPFNGLCOLORP4UIPROC glad_glColorP4ui;\nPFNGLUSEPROGRAMSTAGESPROC glad_glUseProgramStages;\nPFNGLRASTERPOS3DVPROC glad_glRasterPos3dv;\nPFNGLEVALMESH2PROC glad_glEvalMesh2;\nPFNGLEVALMESH1PROC glad_glEvalMesh1;\nPFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer;\nPFNGLPROGRAMUNIFORM3FPROC glad_glProgramUniform3f;\nPFNGLPROGRAMUNIFORM3DPROC glad_glProgramUniform3d;\nPFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv;\nPFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv;\nPFNGLGETPROGRAMPIPELINEIVPROC glad_glGetProgramPipelineiv;\nPFNGLTEXSTORAGE3DPROC glad_glTexStorage3D;\nPFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv;\nPFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC glad_glNamedFramebufferDrawBuffer;\nPFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv;\nPFNGLCOLOR4UBVPROC glad_glColor4ubv;\nPFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd;\nPFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf;\nPFNGLTEXTUREPARAMETERIVPROC glad_glTextureParameteriv;\nPFNGLOBJECTLABELPROC glad_glObjectLabel;\nPFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i;\nPFNGLRASTERPOS2IVPROC glad_glRasterPos2iv;\nPFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData;\nPFNGLGETVERTEXATTRIBLDVPROC glad_glGetVertexAttribLdv;\nPFNGLGETNUNIFORMUIVPROC glad_glGetnUniformuiv;\nPFNGLGETQUERYBUFFEROBJECTIVPROC glad_glGetQueryBufferObjectiv;\nPFNGLTEXENVIVPROC glad_glTexEnviv;\nPFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate;\nPFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui;\nPFNGLGENBUFFERSPROC glad_glGenBuffers;\nPFNGLSELECTBUFFERPROC glad_glSelectBuffer;\nPFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex;\nPFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv;\nPFNGLSCISSORINDEXEDVPROC glad_glScissorIndexedv;\nPFNGLPUSHATTRIBPROC glad_glPushAttrib;\nPFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer;\nPFNGLBLENDFUNCPROC glad_glBlendFunc;\nPFNGLCREATEPROGRAMPROC glad_glCreateProgram;\nPFNGLNAMEDBUFFERSUBDATAPROC glad_glNamedBufferSubData;\nPFNGLTEXIMAGE3DPROC glad_glTexImage3D;\nPFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer;\nPFNGLCLEARNAMEDFRAMEBUFFERFVPROC glad_glClearNamedFramebufferfv;\nPFNGLLIGHTIVPROC glad_glLightiv;\nPFNGLGETNAMEDBUFFERSUBDATAPROC glad_glGetNamedBufferSubData;\nPFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC glad_glCompressedTextureSubImage3D;\nPFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex;\nPFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC glad_glFlushMappedNamedBufferRange;\nPFNGLINVALIDATETEXSUBIMAGEPROC glad_glInvalidateTexSubImage;\nPFNGLTEXGENFVPROC glad_glTexGenfv;\nPFNGLGETTEXTUREPARAMETERIUIVPROC glad_glGetTextureParameterIuiv;\nPFNGLGETNCONVOLUTIONFILTERPROC glad_glGetnConvolutionFilter;\nPFNGLBINDIMAGETEXTURESPROC glad_glBindImageTextures;\nPFNGLENDPROC glad_glEnd;\nPFNGLDELETEBUFFERSPROC glad_glDeleteBuffers;\nPFNGLBINDPROGRAMPIPELINEPROC glad_glBindProgramPipeline;\nPFNGLSCISSORPROC glad_glScissor;\nPFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv;\nPFNGLCLIPPLANEPROC glad_glClipPlane;\nPFNGLPUSHNAMEPROC glad_glPushName;\nPFNGLTEXGENDVPROC glad_glTexGendv;\nPFNGLINDEXUBPROC glad_glIndexub;\nPFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetNamedFramebufferAttachmentParameteriv;\nPFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC glad_glNamedFramebufferRenderbuffer;\nPFNGLVERTEXP2UIVPROC glad_glVertexP2uiv;\nPFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv;\nPFNGLRASTERPOS4IPROC glad_glRasterPos4i;\nPFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd;\nPFNGLCLEARCOLORPROC glad_glClearColor;\nPFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv;\nPFNGLNORMAL3SPROC glad_glNormal3s;\nPFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv;\nPFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glad_glProgramUniformMatrix2x3fv;\nPFNGLCLEARBUFFERIVPROC glad_glClearBufferiv;\nPFNGLPOINTPARAMETERIPROC glad_glPointParameteri;\nPFNGLPROGRAMUNIFORM4DVPROC glad_glProgramUniform4dv;\nPFNGLCOLORP4UIVPROC glad_glColorP4uiv;\nPFNGLBLENDCOLORPROC glad_glBlendColor;\nPFNGLGETNPIXELMAPUIVPROC glad_glGetnPixelMapuiv;\nPFNGLGETTEXTURELEVELPARAMETERIVPROC glad_glGetTextureLevelParameteriv;\nPFNGLWINDOWPOS3DPROC glad_glWindowPos3d;\nPFNGLPROGRAMUNIFORM3FVPROC glad_glProgramUniform3fv;\nPFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv;\nPFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC glad_glGetNamedFramebufferParameteriv;\nPFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv;\nPFNGLUNIFORM3UIPROC glad_glUniform3ui;\nPFNGLPROGRAMUNIFORM3UIVPROC glad_glProgramUniform3uiv;\nPFNGLCOLOR4DVPROC glad_glColor4dv;\nPFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv;\nPFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv;\nPFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback;\nPFNGLUNIFORM2FVPROC glad_glUniform2fv;\nPFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName;\nPFNGLGETPROGRAMRESOURCEINDEXPROC glad_glGetProgramResourceIndex;\nPFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub;\nPFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect;\nPFNGLGETTEXTURELEVELPARAMETERFVPROC glad_glGetTextureLevelParameterfv;\nPFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui;\nPFNGLTEXCOORD3DVPROC glad_glTexCoord3dv;\nPFNGLGETNAMEDBUFFERPOINTERVPROC glad_glGetNamedBufferPointerv;\nPFNGLDISPATCHCOMPUTEINDIRECTPROC glad_glDispatchComputeIndirect;\nPFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC glad_glInvalidateNamedFramebufferSubData;\nPFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv;\nPFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange;\nPFNGLNORMAL3IVPROC glad_glNormal3iv;\nPFNGLTEXTURESUBIMAGE1DPROC glad_glTextureSubImage1D;\nPFNGLVERTEXATTRIBL3DVPROC glad_glVertexAttribL3dv;\nPFNGLGETUNIFORMDVPROC glad_glGetUniformdv;\nPFNGLWINDOWPOS3SPROC glad_glWindowPos3s;\nPFNGLPOINTPARAMETERFPROC glad_glPointParameterf;\nPFNGLCLEARDEPTHFPROC glad_glClearDepthf;\nPFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv;\nPFNGLWINDOWPOS3IPROC glad_glWindowPos3i;\nPFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s;\nPFNGLGETTEXTURESUBIMAGEPROC glad_glGetTextureSubImage;\nPFNGLWINDOWPOS3FPROC glad_glWindowPos3f;\nPFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks;\nPFNGLCOLOR3USPROC glad_glColor3us;\nPFNGLCOLOR3UIVPROC glad_glColor3uiv;\nPFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv;\nPFNGLGETLIGHTIVPROC glad_glGetLightiv;\nPFNGLDEPTHFUNCPROC glad_glDepthFunc;\nPFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D;\nPFNGLLISTBASEPROC glad_glListBase;\nPFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f;\nPFNGLCOLOR3UBPROC glad_glColor3ub;\nPFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d;\nPFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv;\nPFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei;\nPFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;\nPFNGLCOLOR3UIPROC glad_glColor3ui;\nPFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC glad_glGetProgramResourceLocationIndex;\nPFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i;\nPFNGLBUFFERSTORAGEPROC glad_glBufferStorage;\nPFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple;\nPFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync;\nPFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui;\nPFNGLGETFLOATI_VPROC glad_glGetFloati_v;\nPFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv;\nPFNGLCOLORMASKPROC glad_glColorMask;\nPFNGLTEXTUREBUFFERPROC glad_glTextureBuffer;\nPFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv;\nPFNGLBLENDEQUATIONPROC glad_glBlendEquation;\nPFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation;\nPFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv;\nPFNGLVERTEXARRAYATTRIBFORMATPROC glad_glVertexArrayAttribFormat;\nPFNGLREADNPIXELSPROC glad_glReadnPixels;\nPFNGLRASTERPOS4SPROC glad_glRasterPos4s;\nPFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback;\nPFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv;\nPFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv;\nPFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv;\nPFNGLBINDVERTEXBUFFERPROC glad_glBindVertexBuffer;\nPFNGLCOLOR4SVPROC glad_glColor4sv;\nPFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert;\nPFNGLCREATESAMPLERSPROC glad_glCreateSamplers;\nPFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib;\nPFNGLCLEARBUFFERDATAPROC glad_glClearBufferData;\nPFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback;\nPFNGLFOGFPROC glad_glFogf;\nPFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv;\nPFNGLPROGRAMBINARYPROC glad_glProgramBinary;\nPFNGLISSAMPLERPROC glad_glIsSampler;\nPFNGLVERTEXP3UIPROC glad_glVertexP3ui;\nPFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor;\nPFNGLBINDSAMPLERSPROC glad_glBindSamplers;\nPFNGLCOLOR3IVPROC glad_glColor3iv;\nPFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D;\nPFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks;\nPFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D;\nPFNGLTEXCOORD1IPROC glad_glTexCoord1i;\nPFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus;\nPFNGLTEXCOORD1DPROC glad_glTexCoord1d;\nPFNGLTEXCOORD1FPROC glad_glTexCoord1f;\nPFNGLTEXTURESTORAGE3DPROC glad_glTextureStorage3D;\nPFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender;\nPFNGLENABLECLIENTSTATEPROC glad_glEnableClientState;\nPFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation;\nPFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv;\nPFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv;\nPFNGLBLENDFUNCIPROC glad_glBlendFunci;\nPFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv;\nPFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv;\nPFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements;\nPFNGLTEXCOORD1SPROC glad_glTexCoord1s;\nPFNGLBINDBUFFERBASEPROC glad_glBindBufferBase;\nPFNGLBUFFERSUBDATAPROC glad_glBufferSubData;\nPFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv;\nPFNGLGENLISTSPROC glad_glGenLists;\nPFNGLCOLOR3BVPROC glad_glColor3bv;\nPFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange;\nPFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture;\nPFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei;\nPFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glad_glProgramUniformMatrix4x2fv;\nPFNGLVERTEXATTRIBL1DPROC glad_glVertexAttribL1d;\nPFNGLGETTEXGENDVPROC glad_glGetTexGendv;\nPFNGLCLEARNAMEDFRAMEBUFFERIVPROC glad_glClearNamedFramebufferiv;\nPFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays;\nPFNGLENDLISTPROC glad_glEndList;\nPFNGLSCISSORINDEXEDPROC glad_glScissorIndexed;\nPFNGLVERTEXP4UIVPROC glad_glVertexP4uiv;\nPFNGLUNIFORM2UIPROC glad_glUniform2ui;\nPFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv;\nPFNGLGETNMAPDVPROC glad_glGetnMapdv;\nPFNGLCOLOR3USVPROC glad_glColor3usv;\nPFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv;\nPFNGLTEXTUREVIEWPROC glad_glTextureView;\nPFNGLDISABLEIPROC glad_glDisablei;\nPFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glad_glProgramUniformMatrix2x4fv;\nPFNGLCREATERENDERBUFFERSPROC glad_glCreateRenderbuffers;\nPFNGLINDEXMASKPROC glad_glIndexMask;\nPFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib;\nPFNGLSHADERSOURCEPROC glad_glShaderSource;\nPFNGLGETNSEPARABLEFILTERPROC glad_glGetnSeparableFilter;\nPFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName;\nPFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv;\nPFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler;\nPFNGLVERTEXATTRIBIFORMATPROC glad_glVertexAttribIFormat;\nPFNGLCREATEFRAMEBUFFERSPROC glad_glCreateFramebuffers;\nPFNGLCLEARACCUMPROC glad_glClearAccum;\nPFNGLGETSYNCIVPROC glad_glGetSynciv;\nPFNGLPROGRAMUNIFORM2UIVPROC glad_glProgramUniform2uiv;\nPFNGLGETNPIXELMAPFVPROC glad_glGetnPixelMapfv;\nPFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv;\nPFNGLPATCHPARAMETERIPROC glad_glPatchParameteri;\nPFNGLPROGRAMUNIFORM2IPROC glad_glProgramUniform2i;\nPFNGLUNIFORM2FPROC glad_glUniform2f;\nPFNGLGETNAMEDBUFFERPARAMETERI64VPROC glad_glGetNamedBufferParameteri64v;\nPFNGLBEGINQUERYPROC glad_glBeginQuery;\nPFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex;\nPFNGLBINDBUFFERPROC glad_glBindBuffer;\nPFNGLMAP2DPROC glad_glMap2d;\nPFNGLMAP2FPROC glad_glMap2f;\nPFNGLTEXSTORAGE2DMULTISAMPLEPROC glad_glTexStorage2DMultisample;\nPFNGLUNIFORM2DPROC glad_glUniform2d;\nPFNGLVERTEX4DPROC glad_glVertex4d;\nPFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv;\nPFNGLTEXCOORD1SVPROC glad_glTexCoord1sv;\nPFNGLBUFFERDATAPROC glad_glBufferData;\nPFNGLEVALPOINT1PROC glad_glEvalPoint1;\nPFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv;\nPFNGLGETQUERYBUFFEROBJECTUI64VPROC glad_glGetQueryBufferObjectui64v;\nPFNGLTEXCOORD1DVPROC glad_glTexCoord1dv;\nPFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui;\nPFNGLGETERRORPROC glad_glGetError;\nPFNGLGETTEXENVIVPROC glad_glGetTexEnviv;\nPFNGLGETPROGRAMIVPROC glad_glGetProgramiv;\nPFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui;\nPFNGLGETFLOATVPROC glad_glGetFloatv;\nPFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D;\nPFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv;\nPFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv;\nPFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv;\nPFNGLEVALCOORD1DPROC glad_glEvalCoord1d;\nPFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv;\nPFNGLEVALCOORD1FPROC glad_glEvalCoord1f;\nPFNGLPIXELMAPFVPROC glad_glPixelMapfv;\nPFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv;\nPFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv;\nPFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv;\nPFNGLGETINTEGERVPROC glad_glGetIntegerv;\nPFNGLACCUMPROC glad_glAccum;\nPFNGLGETVERTEXARRAYINDEXED64IVPROC glad_glGetVertexArrayIndexed64iv;\nPFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv;\nPFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv;\nPFNGLRASTERPOS4DVPROC glad_glRasterPos4dv;\nPFNGLPROGRAMUNIFORM4FVPROC glad_glProgramUniform4fv;\nPFNGLTEXCOORD2IVPROC glad_glTexCoord2iv;\nPFNGLTEXTUREBARRIERPROC glad_glTextureBarrier;\nPFNGLISQUERYPROC glad_glIsQuery;\nPFNGLPROGRAMUNIFORM2UIPROC glad_glProgramUniform2ui;\nPFNGLPROGRAMUNIFORM4UIPROC glad_glProgramUniform4ui;\nPFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv;\nPFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv;\nPFNGLTEXIMAGE2DPROC glad_glTexImage2D;\nPFNGLSTENCILMASKPROC glad_glStencilMask;\nPFNGLDRAWPIXELSPROC glad_glDrawPixels;\nPFNGLMULTMATRIXDPROC glad_glMultMatrixd;\nPFNGLMULTMATRIXFPROC glad_glMultMatrixf;\nPFNGLISTEXTUREPROC glad_glIsTexture;\nPFNGLGETMATERIALIVPROC glad_glGetMaterialiv;\nPFNGLNAMEDBUFFERDATAPROC glad_glNamedBufferData;\nPFNGLUNIFORM1FVPROC glad_glUniform1fv;\nPFNGLLOADMATRIXFPROC glad_glLoadMatrixf;\nPFNGLTEXSTORAGE2DPROC glad_glTexStorage2D;\nPFNGLLOADMATRIXDPROC glad_glLoadMatrixd;\nPFNGLCLEARNAMEDBUFFERSUBDATAPROC glad_glClearNamedBufferSubData;\nPFNGLMAPNAMEDBUFFERRANGEPROC glad_glMapNamedBufferRange;\nPFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC glad_glNamedFramebufferTextureLayer;\nPFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;\nPFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv;\nPFNGLVERTEX4FPROC glad_glVertex4f;\nPFNGLRECTSVPROC glad_glRectsv;\nPFNGLCOLOR4USVPROC glad_glColor4usv;\nPFNGLUNIFORM3DVPROC glad_glUniform3dv;\nPFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glad_glProgramUniformMatrix4x3fv;\nPFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple;\nPFNGLBINDBUFFERSBASEPROC glad_glBindBuffersBase;\nPFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays;\nPFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation;\nPFNGLNORMAL3IPROC glad_glNormal3i;\nPFNGLNORMAL3FPROC glad_glNormal3f;\nPFNGLNORMAL3DPROC glad_glNormal3d;\nPFNGLNORMAL3BPROC glad_glNormal3b;\nPFNGLGETFRAMEBUFFERPARAMETERIVPROC glad_glGetFramebufferParameteriv;\nPFNGLPIXELMAPUSVPROC glad_glPixelMapusv;\nPFNGLGETTEXGENIVPROC glad_glGetTexGeniv;\nPFNGLARRAYELEMENTPROC glad_glArrayElement;\nPFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC glad_glGetCompressedTextureSubImage;\nPFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData;\nPFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv;\nPFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d;\nPFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback;\nPFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f;\nPFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv;\nPFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v;\nPFNGLDEPTHMASKPROC glad_glDepthMask;\nPFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s;\nPFNGLCOLOR3FVPROC glad_glColor3fv;\nPFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample;\nPFNGLPROGRAMUNIFORM1FVPROC glad_glProgramUniform1fv;\nPFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv;\nPFNGLUNIFORM4FVPROC glad_glUniform4fv;\nPFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform;\nPFNGLCOLORPOINTERPROC glad_glColorPointer;\nPFNGLFRONTFACEPROC glad_glFrontFace;\nPFNGLTEXBUFFERRANGEPROC glad_glTexBufferRange;\nPFNGLCREATEBUFFERSPROC glad_glCreateBuffers;\nPFNGLNAMEDFRAMEBUFFERPARAMETERIPROC glad_glNamedFramebufferParameteri;\nPFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC glad_glDrawArraysInstancedBaseInstance;\nPFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v;\nPFNGLVERTEXATTRIBL3DPROC glad_glVertexAttribL3d;\nPFNGLDELETEPROGRAMPIPELINESPROC glad_glDeleteProgramPipelines;\nPFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv;\nPFNGLCLIPCONTROLPROC glad_glClipControl;\nPFNGLGETPROGRAMRESOURCEIVPROC glad_glGetProgramResourceiv;\nint GLAD_GL_KHR_debug;\nPFNGLDEBUGMESSAGECONTROLKHRPROC glad_glDebugMessageControlKHR;\nPFNGLDEBUGMESSAGEINSERTKHRPROC glad_glDebugMessageInsertKHR;\nPFNGLDEBUGMESSAGECALLBACKKHRPROC glad_glDebugMessageCallbackKHR;\nPFNGLGETDEBUGMESSAGELOGKHRPROC glad_glGetDebugMessageLogKHR;\nPFNGLPUSHDEBUGGROUPKHRPROC glad_glPushDebugGroupKHR;\nPFNGLPOPDEBUGGROUPKHRPROC glad_glPopDebugGroupKHR;\nPFNGLOBJECTLABELKHRPROC glad_glObjectLabelKHR;\nPFNGLGETOBJECTLABELKHRPROC glad_glGetObjectLabelKHR;\nPFNGLOBJECTPTRLABELKHRPROC glad_glObjectPtrLabelKHR;\nPFNGLGETOBJECTPTRLABELKHRPROC glad_glGetObjectPtrLabelKHR;\nPFNGLGETPOINTERVKHRPROC glad_glGetPointervKHR;\nstatic void load_GL_VERSION_1_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_0) return;\n\tglad_glCullFace = (PFNGLCULLFACEPROC)load(\"glCullFace\");\n\tglad_glFrontFace = (PFNGLFRONTFACEPROC)load(\"glFrontFace\");\n\tglad_glHint = (PFNGLHINTPROC)load(\"glHint\");\n\tglad_glLineWidth = (PFNGLLINEWIDTHPROC)load(\"glLineWidth\");\n\tglad_glPointSize = (PFNGLPOINTSIZEPROC)load(\"glPointSize\");\n\tglad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load(\"glPolygonMode\");\n\tglad_glScissor = (PFNGLSCISSORPROC)load(\"glScissor\");\n\tglad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load(\"glTexParameterf\");\n\tglad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load(\"glTexParameterfv\");\n\tglad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load(\"glTexParameteri\");\n\tglad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load(\"glTexParameteriv\");\n\tglad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load(\"glTexImage1D\");\n\tglad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load(\"glTexImage2D\");\n\tglad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load(\"glDrawBuffer\");\n\tglad_glClear = (PFNGLCLEARPROC)load(\"glClear\");\n\tglad_glClearColor = (PFNGLCLEARCOLORPROC)load(\"glClearColor\");\n\tglad_glClearStencil = (PFNGLCLEARSTENCILPROC)load(\"glClearStencil\");\n\tglad_glClearDepth = (PFNGLCLEARDEPTHPROC)load(\"glClearDepth\");\n\tglad_glStencilMask = (PFNGLSTENCILMASKPROC)load(\"glStencilMask\");\n\tglad_glColorMask = (PFNGLCOLORMASKPROC)load(\"glColorMask\");\n\tglad_glDepthMask = (PFNGLDEPTHMASKPROC)load(\"glDepthMask\");\n\tglad_glDisable = (PFNGLDISABLEPROC)load(\"glDisable\");\n\tglad_glEnable = (PFNGLENABLEPROC)load(\"glEnable\");\n\tglad_glFinish = (PFNGLFINISHPROC)load(\"glFinish\");\n\tglad_glFlush = (PFNGLFLUSHPROC)load(\"glFlush\");\n\tglad_glBlendFunc = (PFNGLBLENDFUNCPROC)load(\"glBlendFunc\");\n\tglad_glLogicOp = (PFNGLLOGICOPPROC)load(\"glLogicOp\");\n\tglad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load(\"glStencilFunc\");\n\tglad_glStencilOp = (PFNGLSTENCILOPPROC)load(\"glStencilOp\");\n\tglad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load(\"glDepthFunc\");\n\tglad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load(\"glPixelStoref\");\n\tglad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load(\"glPixelStorei\");\n\tglad_glReadBuffer = (PFNGLREADBUFFERPROC)load(\"glReadBuffer\");\n\tglad_glReadPixels = (PFNGLREADPIXELSPROC)load(\"glReadPixels\");\n\tglad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load(\"glGetBooleanv\");\n\tglad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load(\"glGetDoublev\");\n\tglad_glGetError = (PFNGLGETERRORPROC)load(\"glGetError\");\n\tglad_glGetFloatv = (PFNGLGETFLOATVPROC)load(\"glGetFloatv\");\n\tglad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load(\"glGetIntegerv\");\n\tglad_glGetString = (PFNGLGETSTRINGPROC)load(\"glGetString\");\n\tglad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load(\"glGetTexImage\");\n\tglad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load(\"glGetTexParameterfv\");\n\tglad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load(\"glGetTexParameteriv\");\n\tglad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load(\"glGetTexLevelParameterfv\");\n\tglad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load(\"glGetTexLevelParameteriv\");\n\tglad_glIsEnabled = (PFNGLISENABLEDPROC)load(\"glIsEnabled\");\n\tglad_glDepthRange = (PFNGLDEPTHRANGEPROC)load(\"glDepthRange\");\n\tglad_glViewport = (PFNGLVIEWPORTPROC)load(\"glViewport\");\n\tglad_glNewList = (PFNGLNEWLISTPROC)load(\"glNewList\");\n\tglad_glEndList = (PFNGLENDLISTPROC)load(\"glEndList\");\n\tglad_glCallList = (PFNGLCALLLISTPROC)load(\"glCallList\");\n\tglad_glCallLists = (PFNGLCALLLISTSPROC)load(\"glCallLists\");\n\tglad_glDeleteLists = (PFNGLDELETELISTSPROC)load(\"glDeleteLists\");\n\tglad_glGenLists = (PFNGLGENLISTSPROC)load(\"glGenLists\");\n\tglad_glListBase = (PFNGLLISTBASEPROC)load(\"glListBase\");\n\tglad_glBegin = (PFNGLBEGINPROC)load(\"glBegin\");\n\tglad_glBitmap = (PFNGLBITMAPPROC)load(\"glBitmap\");\n\tglad_glColor3b = (PFNGLCOLOR3BPROC)load(\"glColor3b\");\n\tglad_glColor3bv = (PFNGLCOLOR3BVPROC)load(\"glColor3bv\");\n\tglad_glColor3d = (PFNGLCOLOR3DPROC)load(\"glColor3d\");\n\tglad_glColor3dv = (PFNGLCOLOR3DVPROC)load(\"glColor3dv\");\n\tglad_glColor3f = (PFNGLCOLOR3FPROC)load(\"glColor3f\");\n\tglad_glColor3fv = (PFNGLCOLOR3FVPROC)load(\"glColor3fv\");\n\tglad_glColor3i = (PFNGLCOLOR3IPROC)load(\"glColor3i\");\n\tglad_glColor3iv = (PFNGLCOLOR3IVPROC)load(\"glColor3iv\");\n\tglad_glColor3s = (PFNGLCOLOR3SPROC)load(\"glColor3s\");\n\tglad_glColor3sv = (PFNGLCOLOR3SVPROC)load(\"glColor3sv\");\n\tglad_glColor3ub = (PFNGLCOLOR3UBPROC)load(\"glColor3ub\");\n\tglad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load(\"glColor3ubv\");\n\tglad_glColor3ui = (PFNGLCOLOR3UIPROC)load(\"glColor3ui\");\n\tglad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load(\"glColor3uiv\");\n\tglad_glColor3us = (PFNGLCOLOR3USPROC)load(\"glColor3us\");\n\tglad_glColor3usv = (PFNGLCOLOR3USVPROC)load(\"glColor3usv\");\n\tglad_glColor4b = (PFNGLCOLOR4BPROC)load(\"glColor4b\");\n\tglad_glColor4bv = (PFNGLCOLOR4BVPROC)load(\"glColor4bv\");\n\tglad_glColor4d = (PFNGLCOLOR4DPROC)load(\"glColor4d\");\n\tglad_glColor4dv = (PFNGLCOLOR4DVPROC)load(\"glColor4dv\");\n\tglad_glColor4f = (PFNGLCOLOR4FPROC)load(\"glColor4f\");\n\tglad_glColor4fv = (PFNGLCOLOR4FVPROC)load(\"glColor4fv\");\n\tglad_glColor4i = (PFNGLCOLOR4IPROC)load(\"glColor4i\");\n\tglad_glColor4iv = (PFNGLCOLOR4IVPROC)load(\"glColor4iv\");\n\tglad_glColor4s = (PFNGLCOLOR4SPROC)load(\"glColor4s\");\n\tglad_glColor4sv = (PFNGLCOLOR4SVPROC)load(\"glColor4sv\");\n\tglad_glColor4ub = (PFNGLCOLOR4UBPROC)load(\"glColor4ub\");\n\tglad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load(\"glColor4ubv\");\n\tglad_glColor4ui = (PFNGLCOLOR4UIPROC)load(\"glColor4ui\");\n\tglad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load(\"glColor4uiv\");\n\tglad_glColor4us = (PFNGLCOLOR4USPROC)load(\"glColor4us\");\n\tglad_glColor4usv = (PFNGLCOLOR4USVPROC)load(\"glColor4usv\");\n\tglad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load(\"glEdgeFlag\");\n\tglad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load(\"glEdgeFlagv\");\n\tglad_glEnd = (PFNGLENDPROC)load(\"glEnd\");\n\tglad_glIndexd = (PFNGLINDEXDPROC)load(\"glIndexd\");\n\tglad_glIndexdv = (PFNGLINDEXDVPROC)load(\"glIndexdv\");\n\tglad_glIndexf = (PFNGLINDEXFPROC)load(\"glIndexf\");\n\tglad_glIndexfv = (PFNGLINDEXFVPROC)load(\"glIndexfv\");\n\tglad_glIndexi = (PFNGLINDEXIPROC)load(\"glIndexi\");\n\tglad_glIndexiv = (PFNGLINDEXIVPROC)load(\"glIndexiv\");\n\tglad_glIndexs = (PFNGLINDEXSPROC)load(\"glIndexs\");\n\tglad_glIndexsv = (PFNGLINDEXSVPROC)load(\"glIndexsv\");\n\tglad_glNormal3b = (PFNGLNORMAL3BPROC)load(\"glNormal3b\");\n\tglad_glNormal3bv = (PFNGLNORMAL3BVPROC)load(\"glNormal3bv\");\n\tglad_glNormal3d = (PFNGLNORMAL3DPROC)load(\"glNormal3d\");\n\tglad_glNormal3dv = (PFNGLNORMAL3DVPROC)load(\"glNormal3dv\");\n\tglad_glNormal3f = (PFNGLNORMAL3FPROC)load(\"glNormal3f\");\n\tglad_glNormal3fv = (PFNGLNORMAL3FVPROC)load(\"glNormal3fv\");\n\tglad_glNormal3i = (PFNGLNORMAL3IPROC)load(\"glNormal3i\");\n\tglad_glNormal3iv = (PFNGLNORMAL3IVPROC)load(\"glNormal3iv\");\n\tglad_glNormal3s = (PFNGLNORMAL3SPROC)load(\"glNormal3s\");\n\tglad_glNormal3sv = (PFNGLNORMAL3SVPROC)load(\"glNormal3sv\");\n\tglad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load(\"glRasterPos2d\");\n\tglad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load(\"glRasterPos2dv\");\n\tglad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load(\"glRasterPos2f\");\n\tglad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load(\"glRasterPos2fv\");\n\tglad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load(\"glRasterPos2i\");\n\tglad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load(\"glRasterPos2iv\");\n\tglad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load(\"glRasterPos2s\");\n\tglad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load(\"glRasterPos2sv\");\n\tglad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load(\"glRasterPos3d\");\n\tglad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load(\"glRasterPos3dv\");\n\tglad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load(\"glRasterPos3f\");\n\tglad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load(\"glRasterPos3fv\");\n\tglad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load(\"glRasterPos3i\");\n\tglad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load(\"glRasterPos3iv\");\n\tglad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load(\"glRasterPos3s\");\n\tglad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load(\"glRasterPos3sv\");\n\tglad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load(\"glRasterPos4d\");\n\tglad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load(\"glRasterPos4dv\");\n\tglad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load(\"glRasterPos4f\");\n\tglad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load(\"glRasterPos4fv\");\n\tglad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load(\"glRasterPos4i\");\n\tglad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load(\"glRasterPos4iv\");\n\tglad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load(\"glRasterPos4s\");\n\tglad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load(\"glRasterPos4sv\");\n\tglad_glRectd = (PFNGLRECTDPROC)load(\"glRectd\");\n\tglad_glRectdv = (PFNGLRECTDVPROC)load(\"glRectdv\");\n\tglad_glRectf = (PFNGLRECTFPROC)load(\"glRectf\");\n\tglad_glRectfv = (PFNGLRECTFVPROC)load(\"glRectfv\");\n\tglad_glRecti = (PFNGLRECTIPROC)load(\"glRecti\");\n\tglad_glRectiv = (PFNGLRECTIVPROC)load(\"glRectiv\");\n\tglad_glRects = (PFNGLRECTSPROC)load(\"glRects\");\n\tglad_glRectsv = (PFNGLRECTSVPROC)load(\"glRectsv\");\n\tglad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load(\"glTexCoord1d\");\n\tglad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load(\"glTexCoord1dv\");\n\tglad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load(\"glTexCoord1f\");\n\tglad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load(\"glTexCoord1fv\");\n\tglad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load(\"glTexCoord1i\");\n\tglad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load(\"glTexCoord1iv\");\n\tglad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load(\"glTexCoord1s\");\n\tglad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load(\"glTexCoord1sv\");\n\tglad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load(\"glTexCoord2d\");\n\tglad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load(\"glTexCoord2dv\");\n\tglad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load(\"glTexCoord2f\");\n\tglad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load(\"glTexCoord2fv\");\n\tglad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load(\"glTexCoord2i\");\n\tglad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load(\"glTexCoord2iv\");\n\tglad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load(\"glTexCoord2s\");\n\tglad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load(\"glTexCoord2sv\");\n\tglad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load(\"glTexCoord3d\");\n\tglad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load(\"glTexCoord3dv\");\n\tglad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load(\"glTexCoord3f\");\n\tglad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load(\"glTexCoord3fv\");\n\tglad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load(\"glTexCoord3i\");\n\tglad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load(\"glTexCoord3iv\");\n\tglad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load(\"glTexCoord3s\");\n\tglad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load(\"glTexCoord3sv\");\n\tglad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load(\"glTexCoord4d\");\n\tglad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load(\"glTexCoord4dv\");\n\tglad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load(\"glTexCoord4f\");\n\tglad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load(\"glTexCoord4fv\");\n\tglad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load(\"glTexCoord4i\");\n\tglad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load(\"glTexCoord4iv\");\n\tglad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load(\"glTexCoord4s\");\n\tglad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load(\"glTexCoord4sv\");\n\tglad_glVertex2d = (PFNGLVERTEX2DPROC)load(\"glVertex2d\");\n\tglad_glVertex2dv = (PFNGLVERTEX2DVPROC)load(\"glVertex2dv\");\n\tglad_glVertex2f = (PFNGLVERTEX2FPROC)load(\"glVertex2f\");\n\tglad_glVertex2fv = (PFNGLVERTEX2FVPROC)load(\"glVertex2fv\");\n\tglad_glVertex2i = (PFNGLVERTEX2IPROC)load(\"glVertex2i\");\n\tglad_glVertex2iv = (PFNGLVERTEX2IVPROC)load(\"glVertex2iv\");\n\tglad_glVertex2s = (PFNGLVERTEX2SPROC)load(\"glVertex2s\");\n\tglad_glVertex2sv = (PFNGLVERTEX2SVPROC)load(\"glVertex2sv\");\n\tglad_glVertex3d = (PFNGLVERTEX3DPROC)load(\"glVertex3d\");\n\tglad_glVertex3dv = (PFNGLVERTEX3DVPROC)load(\"glVertex3dv\");\n\tglad_glVertex3f = (PFNGLVERTEX3FPROC)load(\"glVertex3f\");\n\tglad_glVertex3fv = (PFNGLVERTEX3FVPROC)load(\"glVertex3fv\");\n\tglad_glVertex3i = (PFNGLVERTEX3IPROC)load(\"glVertex3i\");\n\tglad_glVertex3iv = (PFNGLVERTEX3IVPROC)load(\"glVertex3iv\");\n\tglad_glVertex3s = (PFNGLVERTEX3SPROC)load(\"glVertex3s\");\n\tglad_glVertex3sv = (PFNGLVERTEX3SVPROC)load(\"glVertex3sv\");\n\tglad_glVertex4d = (PFNGLVERTEX4DPROC)load(\"glVertex4d\");\n\tglad_glVertex4dv = (PFNGLVERTEX4DVPROC)load(\"glVertex4dv\");\n\tglad_glVertex4f = (PFNGLVERTEX4FPROC)load(\"glVertex4f\");\n\tglad_glVertex4fv = (PFNGLVERTEX4FVPROC)load(\"glVertex4fv\");\n\tglad_glVertex4i = (PFNGLVERTEX4IPROC)load(\"glVertex4i\");\n\tglad_glVertex4iv = (PFNGLVERTEX4IVPROC)load(\"glVertex4iv\");\n\tglad_glVertex4s = (PFNGLVERTEX4SPROC)load(\"glVertex4s\");\n\tglad_glVertex4sv = (PFNGLVERTEX4SVPROC)load(\"glVertex4sv\");\n\tglad_glClipPlane = (PFNGLCLIPPLANEPROC)load(\"glClipPlane\");\n\tglad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load(\"glColorMaterial\");\n\tglad_glFogf = (PFNGLFOGFPROC)load(\"glFogf\");\n\tglad_glFogfv = (PFNGLFOGFVPROC)load(\"glFogfv\");\n\tglad_glFogi = (PFNGLFOGIPROC)load(\"glFogi\");\n\tglad_glFogiv = (PFNGLFOGIVPROC)load(\"glFogiv\");\n\tglad_glLightf = (PFNGLLIGHTFPROC)load(\"glLightf\");\n\tglad_glLightfv = (PFNGLLIGHTFVPROC)load(\"glLightfv\");\n\tglad_glLighti = (PFNGLLIGHTIPROC)load(\"glLighti\");\n\tglad_glLightiv = (PFNGLLIGHTIVPROC)load(\"glLightiv\");\n\tglad_glLightModelf = (PFNGLLIGHTMODELFPROC)load(\"glLightModelf\");\n\tglad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load(\"glLightModelfv\");\n\tglad_glLightModeli = (PFNGLLIGHTMODELIPROC)load(\"glLightModeli\");\n\tglad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load(\"glLightModeliv\");\n\tglad_glLineStipple = (PFNGLLINESTIPPLEPROC)load(\"glLineStipple\");\n\tglad_glMaterialf = (PFNGLMATERIALFPROC)load(\"glMaterialf\");\n\tglad_glMaterialfv = (PFNGLMATERIALFVPROC)load(\"glMaterialfv\");\n\tglad_glMateriali = (PFNGLMATERIALIPROC)load(\"glMateriali\");\n\tglad_glMaterialiv = (PFNGLMATERIALIVPROC)load(\"glMaterialiv\");\n\tglad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load(\"glPolygonStipple\");\n\tglad_glShadeModel = (PFNGLSHADEMODELPROC)load(\"glShadeModel\");\n\tglad_glTexEnvf = (PFNGLTEXENVFPROC)load(\"glTexEnvf\");\n\tglad_glTexEnvfv = (PFNGLTEXENVFVPROC)load(\"glTexEnvfv\");\n\tglad_glTexEnvi = (PFNGLTEXENVIPROC)load(\"glTexEnvi\");\n\tglad_glTexEnviv = (PFNGLTEXENVIVPROC)load(\"glTexEnviv\");\n\tglad_glTexGend = (PFNGLTEXGENDPROC)load(\"glTexGend\");\n\tglad_glTexGendv = (PFNGLTEXGENDVPROC)load(\"glTexGendv\");\n\tglad_glTexGenf = (PFNGLTEXGENFPROC)load(\"glTexGenf\");\n\tglad_glTexGenfv = (PFNGLTEXGENFVPROC)load(\"glTexGenfv\");\n\tglad_glTexGeni = (PFNGLTEXGENIPROC)load(\"glTexGeni\");\n\tglad_glTexGeniv = (PFNGLTEXGENIVPROC)load(\"glTexGeniv\");\n\tglad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load(\"glFeedbackBuffer\");\n\tglad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load(\"glSelectBuffer\");\n\tglad_glRenderMode = (PFNGLRENDERMODEPROC)load(\"glRenderMode\");\n\tglad_glInitNames = (PFNGLINITNAMESPROC)load(\"glInitNames\");\n\tglad_glLoadName = (PFNGLLOADNAMEPROC)load(\"glLoadName\");\n\tglad_glPassThrough = (PFNGLPASSTHROUGHPROC)load(\"glPassThrough\");\n\tglad_glPopName = (PFNGLPOPNAMEPROC)load(\"glPopName\");\n\tglad_glPushName = (PFNGLPUSHNAMEPROC)load(\"glPushName\");\n\tglad_glClearAccum = (PFNGLCLEARACCUMPROC)load(\"glClearAccum\");\n\tglad_glClearIndex = (PFNGLCLEARINDEXPROC)load(\"glClearIndex\");\n\tglad_glIndexMask = (PFNGLINDEXMASKPROC)load(\"glIndexMask\");\n\tglad_glAccum = (PFNGLACCUMPROC)load(\"glAccum\");\n\tglad_glPopAttrib = (PFNGLPOPATTRIBPROC)load(\"glPopAttrib\");\n\tglad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load(\"glPushAttrib\");\n\tglad_glMap1d = (PFNGLMAP1DPROC)load(\"glMap1d\");\n\tglad_glMap1f = (PFNGLMAP1FPROC)load(\"glMap1f\");\n\tglad_glMap2d = (PFNGLMAP2DPROC)load(\"glMap2d\");\n\tglad_glMap2f = (PFNGLMAP2FPROC)load(\"glMap2f\");\n\tglad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load(\"glMapGrid1d\");\n\tglad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load(\"glMapGrid1f\");\n\tglad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load(\"glMapGrid2d\");\n\tglad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load(\"glMapGrid2f\");\n\tglad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load(\"glEvalCoord1d\");\n\tglad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load(\"glEvalCoord1dv\");\n\tglad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load(\"glEvalCoord1f\");\n\tglad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load(\"glEvalCoord1fv\");\n\tglad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load(\"glEvalCoord2d\");\n\tglad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load(\"glEvalCoord2dv\");\n\tglad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load(\"glEvalCoord2f\");\n\tglad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load(\"glEvalCoord2fv\");\n\tglad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load(\"glEvalMesh1\");\n\tglad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load(\"glEvalPoint1\");\n\tglad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load(\"glEvalMesh2\");\n\tglad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load(\"glEvalPoint2\");\n\tglad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load(\"glAlphaFunc\");\n\tglad_glPixelZoom = (PFNGLPIXELZOOMPROC)load(\"glPixelZoom\");\n\tglad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load(\"glPixelTransferf\");\n\tglad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load(\"glPixelTransferi\");\n\tglad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load(\"glPixelMapfv\");\n\tglad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load(\"glPixelMapuiv\");\n\tglad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load(\"glPixelMapusv\");\n\tglad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load(\"glCopyPixels\");\n\tglad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load(\"glDrawPixels\");\n\tglad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load(\"glGetClipPlane\");\n\tglad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load(\"glGetLightfv\");\n\tglad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load(\"glGetLightiv\");\n\tglad_glGetMapdv = (PFNGLGETMAPDVPROC)load(\"glGetMapdv\");\n\tglad_glGetMapfv = (PFNGLGETMAPFVPROC)load(\"glGetMapfv\");\n\tglad_glGetMapiv = (PFNGLGETMAPIVPROC)load(\"glGetMapiv\");\n\tglad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load(\"glGetMaterialfv\");\n\tglad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load(\"glGetMaterialiv\");\n\tglad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load(\"glGetPixelMapfv\");\n\tglad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load(\"glGetPixelMapuiv\");\n\tglad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load(\"glGetPixelMapusv\");\n\tglad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load(\"glGetPolygonStipple\");\n\tglad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load(\"glGetTexEnvfv\");\n\tglad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load(\"glGetTexEnviv\");\n\tglad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load(\"glGetTexGendv\");\n\tglad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load(\"glGetTexGenfv\");\n\tglad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load(\"glGetTexGeniv\");\n\tglad_glIsList = (PFNGLISLISTPROC)load(\"glIsList\");\n\tglad_glFrustum = (PFNGLFRUSTUMPROC)load(\"glFrustum\");\n\tglad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load(\"glLoadIdentity\");\n\tglad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load(\"glLoadMatrixf\");\n\tglad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load(\"glLoadMatrixd\");\n\tglad_glMatrixMode = (PFNGLMATRIXMODEPROC)load(\"glMatrixMode\");\n\tglad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load(\"glMultMatrixf\");\n\tglad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load(\"glMultMatrixd\");\n\tglad_glOrtho = (PFNGLORTHOPROC)load(\"glOrtho\");\n\tglad_glPopMatrix = (PFNGLPOPMATRIXPROC)load(\"glPopMatrix\");\n\tglad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load(\"glPushMatrix\");\n\tglad_glRotated = (PFNGLROTATEDPROC)load(\"glRotated\");\n\tglad_glRotatef = (PFNGLROTATEFPROC)load(\"glRotatef\");\n\tglad_glScaled = (PFNGLSCALEDPROC)load(\"glScaled\");\n\tglad_glScalef = (PFNGLSCALEFPROC)load(\"glScalef\");\n\tglad_glTranslated = (PFNGLTRANSLATEDPROC)load(\"glTranslated\");\n\tglad_glTranslatef = (PFNGLTRANSLATEFPROC)load(\"glTranslatef\");\n}\nstatic void load_GL_VERSION_1_1(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_1) return;\n\tglad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load(\"glDrawArrays\");\n\tglad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load(\"glDrawElements\");\n\tglad_glGetPointerv = (PFNGLGETPOINTERVPROC)load(\"glGetPointerv\");\n\tglad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load(\"glPolygonOffset\");\n\tglad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load(\"glCopyTexImage1D\");\n\tglad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load(\"glCopyTexImage2D\");\n\tglad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load(\"glCopyTexSubImage1D\");\n\tglad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load(\"glCopyTexSubImage2D\");\n\tglad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load(\"glTexSubImage1D\");\n\tglad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load(\"glTexSubImage2D\");\n\tglad_glBindTexture = (PFNGLBINDTEXTUREPROC)load(\"glBindTexture\");\n\tglad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load(\"glDeleteTextures\");\n\tglad_glGenTextures = (PFNGLGENTEXTURESPROC)load(\"glGenTextures\");\n\tglad_glIsTexture = (PFNGLISTEXTUREPROC)load(\"glIsTexture\");\n\tglad_glArrayElement = (PFNGLARRAYELEMENTPROC)load(\"glArrayElement\");\n\tglad_glColorPointer = (PFNGLCOLORPOINTERPROC)load(\"glColorPointer\");\n\tglad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load(\"glDisableClientState\");\n\tglad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load(\"glEdgeFlagPointer\");\n\tglad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load(\"glEnableClientState\");\n\tglad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load(\"glIndexPointer\");\n\tglad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load(\"glInterleavedArrays\");\n\tglad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load(\"glNormalPointer\");\n\tglad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load(\"glTexCoordPointer\");\n\tglad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load(\"glVertexPointer\");\n\tglad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load(\"glAreTexturesResident\");\n\tglad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load(\"glPrioritizeTextures\");\n\tglad_glIndexub = (PFNGLINDEXUBPROC)load(\"glIndexub\");\n\tglad_glIndexubv = (PFNGLINDEXUBVPROC)load(\"glIndexubv\");\n\tglad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load(\"glPopClientAttrib\");\n\tglad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load(\"glPushClientAttrib\");\n}\nstatic void load_GL_VERSION_1_2(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_2) return;\n\tglad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load(\"glDrawRangeElements\");\n\tglad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load(\"glTexImage3D\");\n\tglad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load(\"glTexSubImage3D\");\n\tglad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load(\"glCopyTexSubImage3D\");\n}\nstatic void load_GL_VERSION_1_3(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_3) return;\n\tglad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load(\"glActiveTexture\");\n\tglad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load(\"glSampleCoverage\");\n\tglad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load(\"glCompressedTexImage3D\");\n\tglad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load(\"glCompressedTexImage2D\");\n\tglad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load(\"glCompressedTexImage1D\");\n\tglad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load(\"glCompressedTexSubImage3D\");\n\tglad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load(\"glCompressedTexSubImage2D\");\n\tglad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load(\"glCompressedTexSubImage1D\");\n\tglad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load(\"glGetCompressedTexImage\");\n\tglad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load(\"glClientActiveTexture\");\n\tglad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load(\"glMultiTexCoord1d\");\n\tglad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load(\"glMultiTexCoord1dv\");\n\tglad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load(\"glMultiTexCoord1f\");\n\tglad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load(\"glMultiTexCoord1fv\");\n\tglad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load(\"glMultiTexCoord1i\");\n\tglad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load(\"glMultiTexCoord1iv\");\n\tglad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load(\"glMultiTexCoord1s\");\n\tglad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load(\"glMultiTexCoord1sv\");\n\tglad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load(\"glMultiTexCoord2d\");\n\tglad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load(\"glMultiTexCoord2dv\");\n\tglad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load(\"glMultiTexCoord2f\");\n\tglad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load(\"glMultiTexCoord2fv\");\n\tglad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load(\"glMultiTexCoord2i\");\n\tglad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load(\"glMultiTexCoord2iv\");\n\tglad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load(\"glMultiTexCoord2s\");\n\tglad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load(\"glMultiTexCoord2sv\");\n\tglad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load(\"glMultiTexCoord3d\");\n\tglad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load(\"glMultiTexCoord3dv\");\n\tglad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load(\"glMultiTexCoord3f\");\n\tglad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load(\"glMultiTexCoord3fv\");\n\tglad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load(\"glMultiTexCoord3i\");\n\tglad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load(\"glMultiTexCoord3iv\");\n\tglad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load(\"glMultiTexCoord3s\");\n\tglad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load(\"glMultiTexCoord3sv\");\n\tglad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load(\"glMultiTexCoord4d\");\n\tglad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load(\"glMultiTexCoord4dv\");\n\tglad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load(\"glMultiTexCoord4f\");\n\tglad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load(\"glMultiTexCoord4fv\");\n\tglad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load(\"glMultiTexCoord4i\");\n\tglad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load(\"glMultiTexCoord4iv\");\n\tglad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load(\"glMultiTexCoord4s\");\n\tglad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load(\"glMultiTexCoord4sv\");\n\tglad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load(\"glLoadTransposeMatrixf\");\n\tglad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load(\"glLoadTransposeMatrixd\");\n\tglad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load(\"glMultTransposeMatrixf\");\n\tglad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load(\"glMultTransposeMatrixd\");\n}\nstatic void load_GL_VERSION_1_4(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_4) return;\n\tglad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load(\"glBlendFuncSeparate\");\n\tglad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load(\"glMultiDrawArrays\");\n\tglad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load(\"glMultiDrawElements\");\n\tglad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load(\"glPointParameterf\");\n\tglad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load(\"glPointParameterfv\");\n\tglad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load(\"glPointParameteri\");\n\tglad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load(\"glPointParameteriv\");\n\tglad_glFogCoordf = (PFNGLFOGCOORDFPROC)load(\"glFogCoordf\");\n\tglad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load(\"glFogCoordfv\");\n\tglad_glFogCoordd = (PFNGLFOGCOORDDPROC)load(\"glFogCoordd\");\n\tglad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load(\"glFogCoorddv\");\n\tglad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load(\"glFogCoordPointer\");\n\tglad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load(\"glSecondaryColor3b\");\n\tglad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load(\"glSecondaryColor3bv\");\n\tglad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load(\"glSecondaryColor3d\");\n\tglad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load(\"glSecondaryColor3dv\");\n\tglad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load(\"glSecondaryColor3f\");\n\tglad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load(\"glSecondaryColor3fv\");\n\tglad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load(\"glSecondaryColor3i\");\n\tglad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load(\"glSecondaryColor3iv\");\n\tglad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load(\"glSecondaryColor3s\");\n\tglad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load(\"glSecondaryColor3sv\");\n\tglad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load(\"glSecondaryColor3ub\");\n\tglad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load(\"glSecondaryColor3ubv\");\n\tglad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load(\"glSecondaryColor3ui\");\n\tglad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load(\"glSecondaryColor3uiv\");\n\tglad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load(\"glSecondaryColor3us\");\n\tglad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load(\"glSecondaryColor3usv\");\n\tglad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load(\"glSecondaryColorPointer\");\n\tglad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load(\"glWindowPos2d\");\n\tglad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load(\"glWindowPos2dv\");\n\tglad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load(\"glWindowPos2f\");\n\tglad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load(\"glWindowPos2fv\");\n\tglad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load(\"glWindowPos2i\");\n\tglad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load(\"glWindowPos2iv\");\n\tglad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load(\"glWindowPos2s\");\n\tglad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load(\"glWindowPos2sv\");\n\tglad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load(\"glWindowPos3d\");\n\tglad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load(\"glWindowPos3dv\");\n\tglad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load(\"glWindowPos3f\");\n\tglad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load(\"glWindowPos3fv\");\n\tglad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load(\"glWindowPos3i\");\n\tglad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load(\"glWindowPos3iv\");\n\tglad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load(\"glWindowPos3s\");\n\tglad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load(\"glWindowPos3sv\");\n\tglad_glBlendColor = (PFNGLBLENDCOLORPROC)load(\"glBlendColor\");\n\tglad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load(\"glBlendEquation\");\n}\nstatic void load_GL_VERSION_1_5(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_5) return;\n\tglad_glGenQueries = (PFNGLGENQUERIESPROC)load(\"glGenQueries\");\n\tglad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load(\"glDeleteQueries\");\n\tglad_glIsQuery = (PFNGLISQUERYPROC)load(\"glIsQuery\");\n\tglad_glBeginQuery = (PFNGLBEGINQUERYPROC)load(\"glBeginQuery\");\n\tglad_glEndQuery = (PFNGLENDQUERYPROC)load(\"glEndQuery\");\n\tglad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load(\"glGetQueryiv\");\n\tglad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load(\"glGetQueryObjectiv\");\n\tglad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load(\"glGetQueryObjectuiv\");\n\tglad_glBindBuffer = (PFNGLBINDBUFFERPROC)load(\"glBindBuffer\");\n\tglad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load(\"glDeleteBuffers\");\n\tglad_glGenBuffers = (PFNGLGENBUFFERSPROC)load(\"glGenBuffers\");\n\tglad_glIsBuffer = (PFNGLISBUFFERPROC)load(\"glIsBuffer\");\n\tglad_glBufferData = (PFNGLBUFFERDATAPROC)load(\"glBufferData\");\n\tglad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load(\"glBufferSubData\");\n\tglad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load(\"glGetBufferSubData\");\n\tglad_glMapBuffer = (PFNGLMAPBUFFERPROC)load(\"glMapBuffer\");\n\tglad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load(\"glUnmapBuffer\");\n\tglad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load(\"glGetBufferParameteriv\");\n\tglad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load(\"glGetBufferPointerv\");\n}\nstatic void load_GL_VERSION_2_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_2_0) return;\n\tglad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load(\"glBlendEquationSeparate\");\n\tglad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load(\"glDrawBuffers\");\n\tglad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load(\"glStencilOpSeparate\");\n\tglad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load(\"glStencilFuncSeparate\");\n\tglad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load(\"glStencilMaskSeparate\");\n\tglad_glAttachShader = (PFNGLATTACHSHADERPROC)load(\"glAttachShader\");\n\tglad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load(\"glBindAttribLocation\");\n\tglad_glCompileShader = (PFNGLCOMPILESHADERPROC)load(\"glCompileShader\");\n\tglad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load(\"glCreateProgram\");\n\tglad_glCreateShader = (PFNGLCREATESHADERPROC)load(\"glCreateShader\");\n\tglad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load(\"glDeleteProgram\");\n\tglad_glDeleteShader = (PFNGLDELETESHADERPROC)load(\"glDeleteShader\");\n\tglad_glDetachShader = (PFNGLDETACHSHADERPROC)load(\"glDetachShader\");\n\tglad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load(\"glDisableVertexAttribArray\");\n\tglad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load(\"glEnableVertexAttribArray\");\n\tglad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load(\"glGetActiveAttrib\");\n\tglad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load(\"glGetActiveUniform\");\n\tglad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load(\"glGetAttachedShaders\");\n\tglad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load(\"glGetAttribLocation\");\n\tglad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load(\"glGetProgramiv\");\n\tglad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load(\"glGetProgramInfoLog\");\n\tglad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load(\"glGetShaderiv\");\n\tglad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load(\"glGetShaderInfoLog\");\n\tglad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load(\"glGetShaderSource\");\n\tglad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load(\"glGetUniformLocation\");\n\tglad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load(\"glGetUniformfv\");\n\tglad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load(\"glGetUniformiv\");\n\tglad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load(\"glGetVertexAttribdv\");\n\tglad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load(\"glGetVertexAttribfv\");\n\tglad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load(\"glGetVertexAttribiv\");\n\tglad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load(\"glGetVertexAttribPointerv\");\n\tglad_glIsProgram = (PFNGLISPROGRAMPROC)load(\"glIsProgram\");\n\tglad_glIsShader = (PFNGLISSHADERPROC)load(\"glIsShader\");\n\tglad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load(\"glLinkProgram\");\n\tglad_glShaderSource = (PFNGLSHADERSOURCEPROC)load(\"glShaderSource\");\n\tglad_glUseProgram = (PFNGLUSEPROGRAMPROC)load(\"glUseProgram\");\n\tglad_glUniform1f = (PFNGLUNIFORM1FPROC)load(\"glUniform1f\");\n\tglad_glUniform2f = (PFNGLUNIFORM2FPROC)load(\"glUniform2f\");\n\tglad_glUniform3f = (PFNGLUNIFORM3FPROC)load(\"glUniform3f\");\n\tglad_glUniform4f = (PFNGLUNIFORM4FPROC)load(\"glUniform4f\");\n\tglad_glUniform1i = (PFNGLUNIFORM1IPROC)load(\"glUniform1i\");\n\tglad_glUniform2i = (PFNGLUNIFORM2IPROC)load(\"glUniform2i\");\n\tglad_glUniform3i = (PFNGLUNIFORM3IPROC)load(\"glUniform3i\");\n\tglad_glUniform4i = (PFNGLUNIFORM4IPROC)load(\"glUniform4i\");\n\tglad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load(\"glUniform1fv\");\n\tglad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load(\"glUniform2fv\");\n\tglad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load(\"glUniform3fv\");\n\tglad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load(\"glUniform4fv\");\n\tglad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load(\"glUniform1iv\");\n\tglad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load(\"glUniform2iv\");\n\tglad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load(\"glUniform3iv\");\n\tglad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load(\"glUniform4iv\");\n\tglad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load(\"glUniformMatrix2fv\");\n\tglad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load(\"glUniformMatrix3fv\");\n\tglad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load(\"glUniformMatrix4fv\");\n\tglad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load(\"glValidateProgram\");\n\tglad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load(\"glVertexAttrib1d\");\n\tglad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load(\"glVertexAttrib1dv\");\n\tglad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load(\"glVertexAttrib1f\");\n\tglad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load(\"glVertexAttrib1fv\");\n\tglad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load(\"glVertexAttrib1s\");\n\tglad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load(\"glVertexAttrib1sv\");\n\tglad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load(\"glVertexAttrib2d\");\n\tglad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load(\"glVertexAttrib2dv\");\n\tglad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load(\"glVertexAttrib2f\");\n\tglad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load(\"glVertexAttrib2fv\");\n\tglad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load(\"glVertexAttrib2s\");\n\tglad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load(\"glVertexAttrib2sv\");\n\tglad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load(\"glVertexAttrib3d\");\n\tglad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load(\"glVertexAttrib3dv\");\n\tglad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load(\"glVertexAttrib3f\");\n\tglad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load(\"glVertexAttrib3fv\");\n\tglad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load(\"glVertexAttrib3s\");\n\tglad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load(\"glVertexAttrib3sv\");\n\tglad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load(\"glVertexAttrib4Nbv\");\n\tglad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load(\"glVertexAttrib4Niv\");\n\tglad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load(\"glVertexAttrib4Nsv\");\n\tglad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load(\"glVertexAttrib4Nub\");\n\tglad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load(\"glVertexAttrib4Nubv\");\n\tglad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load(\"glVertexAttrib4Nuiv\");\n\tglad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load(\"glVertexAttrib4Nusv\");\n\tglad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load(\"glVertexAttrib4bv\");\n\tglad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load(\"glVertexAttrib4d\");\n\tglad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load(\"glVertexAttrib4dv\");\n\tglad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load(\"glVertexAttrib4f\");\n\tglad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load(\"glVertexAttrib4fv\");\n\tglad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load(\"glVertexAttrib4iv\");\n\tglad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load(\"glVertexAttrib4s\");\n\tglad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load(\"glVertexAttrib4sv\");\n\tglad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load(\"glVertexAttrib4ubv\");\n\tglad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load(\"glVertexAttrib4uiv\");\n\tglad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load(\"glVertexAttrib4usv\");\n\tglad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load(\"glVertexAttribPointer\");\n}\nstatic void load_GL_VERSION_2_1(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_2_1) return;\n\tglad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load(\"glUniformMatrix2x3fv\");\n\tglad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load(\"glUniformMatrix3x2fv\");\n\tglad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load(\"glUniformMatrix2x4fv\");\n\tglad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load(\"glUniformMatrix4x2fv\");\n\tglad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load(\"glUniformMatrix3x4fv\");\n\tglad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load(\"glUniformMatrix4x3fv\");\n}\nstatic void load_GL_VERSION_3_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_3_0) return;\n\tglad_glColorMaski = (PFNGLCOLORMASKIPROC)load(\"glColorMaski\");\n\tglad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load(\"glGetBooleani_v\");\n\tglad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load(\"glGetIntegeri_v\");\n\tglad_glEnablei = (PFNGLENABLEIPROC)load(\"glEnablei\");\n\tglad_glDisablei = (PFNGLDISABLEIPROC)load(\"glDisablei\");\n\tglad_glIsEnabledi = (PFNGLISENABLEDIPROC)load(\"glIsEnabledi\");\n\tglad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load(\"glBeginTransformFeedback\");\n"}, {"path": "src/stb_image.cpp", "language": "code", "loc": 2, "comment_density": 0.0, "code": "#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\""}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": "images/joeydevries_learnopengl_src.png", "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.004, "dedup_hash": "44df987f88843120", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_1_1_hello_window", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "1.1.Hello Window", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/1.1.hello_window/hello_window.cpp", "language": "code", "loc": 69, "comment_density": 0.304, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n } \n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.304, "dedup_hash": "d8ce816b10983838", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_1_2_hello_window_clear", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "1.2.Hello Window Clear", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/1.2.hello_window_clear/hello_window_clear.cpp", "language": "code", "loc": 73, "comment_density": 0.315, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n } \n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.315, "dedup_hash": "cf3c9ca0ab9e3228", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_1_hello_triangle", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.1.Hello Triangle", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp", "language": "code", "loc": 157, "comment_density": 0.299, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, 0.0f, // left \n 0.5f, -0.5f, 0.0f, // right \n 0.0f, 0.5f, 0.0f // top \n }; \n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind\n glBindBuffer(GL_ARRAY_BUFFER, 0); \n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n glBindVertexArray(0); \n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // draw our first triangle\n glUseProgram(shaderProgram);\n glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized\n glDrawArrays(GL_TRIANGLES, 0, 3);\n // glBindVertexArray(0); // no need to unbind it every time \n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.299, "dedup_hash": "5dfc017d52cbb431", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_2_hello_triangle_indexed", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.2.Hello Triangle Indexed", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.2.hello_triangle_indexed/hello_triangle_indexed.cpp", "language": "code", "loc": 169, "comment_density": 0.32, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n 0.5f, 0.5f, 0.0f, // top right\n 0.5f, -0.5f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f // top left \n };\n unsigned int indices[] = { // note that we start from 0!\n 0, 1, 3, // first Triangle\n 1, 2, 3 // second Triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind\n glBindBuffer(GL_ARRAY_BUFFER, 0); \n\n // remember: do NOT unbind the EBO while a VAO is active as the bound element buffer object IS stored in the VAO; keep the EBO bound.\n //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);\n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n glBindVertexArray(0); \n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // draw our first triangle\n glUseProgram(shaderProgram);\n glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized\n //glDrawArrays(GL_TRIANGLES, 0, 6);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n // glBindVertexArray(0); // no need to unbind it every time \n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.32, "dedup_hash": "d7ffa31f226241fe", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_3_hello_triangle_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.3.Hello Triangle Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.3.hello_triangle_exercise1/hello_triangle_exercise1.cpp", "language": "code", "loc": 163, "comment_density": 0.331, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n // add a new set of vertices to form a second triangle (a total of 6 vertices); the vertex attribute configuration remains the same (still one 3-float position vector per vertex)\n float vertices[] = {\n // first triangle\n -0.9f, -0.5f, 0.0f, // left \n -0.0f, -0.5f, 0.0f, // right\n -0.45f, 0.5f, 0.0f, // top \n // second triangle\n 0.0f, -0.5f, 0.0f, // left\n 0.9f, -0.5f, 0.0f, // right\n 0.45f, 0.5f, 0.0f // top \n }; \n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind\n glBindBuffer(GL_ARRAY_BUFFER, 0); \n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n glBindVertexArray(0); \n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // draw our first triangle\n glUseProgram(shaderProgram);\n glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized\n glDrawArrays(GL_TRIANGLES, 0, 6); // set the count to 6 since we're drawing 6 vertices now (2 triangles); not 3!\n // glBindVertexArray(0); // no need to unbind it every time \n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.331, "dedup_hash": "31be20b3b3d6a00a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_4_hello_triangle_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.4.Hello Triangle Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.4.hello_triangle_exercise2/hello_triangle_exercise2.cpp", "language": "code", "loc": 169, "comment_density": 0.331, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float firstTriangle[] = {\n -0.9f, -0.5f, 0.0f, // left \n -0.0f, -0.5f, 0.0f, // right\n -0.45f, 0.5f, 0.0f, // top \n };\n float secondTriangle[] = {\n 0.0f, -0.5f, 0.0f, // left\n 0.9f, -0.5f, 0.0f, // right\n 0.45f, 0.5f, 0.0f // top \n };\n unsigned int VBOs[2], VAOs[2];\n glGenVertexArrays(2, VAOs); // we can also generate multiple VAOs or buffers at the same time\n glGenBuffers(2, VBOs);\n // first triangle setup\n // --------------------\n glBindVertexArray(VAOs[0]);\n glBindBuffer(GL_ARRAY_BUFFER, VBOs[0]);\n glBufferData(GL_ARRAY_BUFFER, sizeof(firstTriangle), firstTriangle, GL_STATIC_DRAW);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\t// Vertex attributes stay the same\n glEnableVertexAttribArray(0);\n // glBindVertexArray(0); // no need to unbind at all as we directly bind a different VAO the next few lines\n // second triangle setup\n // ---------------------\n glBindVertexArray(VAOs[1]);\t// note that we bind to a different VAO now\n glBindBuffer(GL_ARRAY_BUFFER, VBOs[1]);\t// and a different VBO\n glBufferData(GL_ARRAY_BUFFER, sizeof(secondTriangle), secondTriangle, GL_STATIC_DRAW);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0); // because the vertex data is tightly packed we can also specify 0 as the vertex attribute's stride to let OpenGL figure it out\n glEnableVertexAttribArray(0);\n // glBindVertexArray(0); // not really necessary as well, but beware of calls that could affect VAOs while this one is bound (like binding element buffer objects, or enabling/disabling vertex attributes)\n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n glUseProgram(shaderProgram);\n // draw first triangle using the data from the first VAO\n glBindVertexArray(VAOs[0]);\n glDrawArrays(GL_TRIANGLES, 0, 3);\n // then we draw the second triangle using the data from the second VAO\n glBindVertexArray(VAOs[1]);\n glDrawArrays(GL_TRIANGLES, 0, 3);\n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(2, VAOs);\n glDeleteBuffers(2, VBOs);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.331, "dedup_hash": "68035e5b3314a206", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_5_hello_triangle_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.5.Hello Triangle Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.5.hello_triangle_exercise3/hello_triangle_exercise3.cpp", "language": "code", "loc": 163, "comment_density": 0.374, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShader1Source = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\nconst char *fragmentShader2Source = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 1.0f, 0.0f, 1.0f);\\n\"\n \"}\\n\\0\";\n\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // we skipped compile log checks this time for readability (if you do encounter issues, add the compile-checks! see previous code samples)\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n unsigned int fragmentShaderOrange = glCreateShader(GL_FRAGMENT_SHADER); // the first fragment shader that outputs the color orange\n unsigned int fragmentShaderYellow = glCreateShader(GL_FRAGMENT_SHADER); // the second fragment shader that outputs the color yellow\n unsigned int shaderProgramOrange = glCreateProgram();\n unsigned int shaderProgramYellow = glCreateProgram(); // the second shader program\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n glShaderSource(fragmentShaderOrange, 1, &fragmentShader1Source, NULL);\n glCompileShader(fragmentShaderOrange);\n glShaderSource(fragmentShaderYellow, 1, &fragmentShader2Source, NULL);\n glCompileShader(fragmentShaderYellow);\n // link the first program object\n glAttachShader(shaderProgramOrange, vertexShader);\n glAttachShader(shaderProgramOrange, fragmentShaderOrange);\n glLinkProgram(shaderProgramOrange);\n // then link the second program object using a different fragment shader (but same vertex shader)\n // this is perfectly allowed since the inputs and outputs of both the vertex and fragment shaders are equally matched.\n glAttachShader(shaderProgramYellow, vertexShader);\n glAttachShader(shaderProgramYellow, fragmentShaderYellow);\n glLinkProgram(shaderProgramYellow);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float firstTriangle[] = {\n -0.9f, -0.5f, 0.0f, // left \n -0.0f, -0.5f, 0.0f, // right\n -0.45f, 0.5f, 0.0f, // top \n };\n float secondTriangle[] = {\n 0.0f, -0.5f, 0.0f, // left\n 0.9f, -0.5f, 0.0f, // right\n 0.45f, 0.5f, 0.0f // top \n };\n unsigned int VBOs[2], VAOs[2];\n glGenVertexArrays(2, VAOs); // we can also generate multiple VAOs or buffers at the same time\n glGenBuffers(2, VBOs);\n // first triangle setup\n // --------------------\n glBindVertexArray(VAOs[0]);\n glBindBuffer(GL_ARRAY_BUFFER, VBOs[0]);\n glBufferData(GL_ARRAY_BUFFER, sizeof(firstTriangle), firstTriangle, GL_STATIC_DRAW);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\t// Vertex attributes stay the same\n glEnableVertexAttribArray(0);\n // glBindVertexArray(0); // no need to unbind at all as we directly bind a different VAO the next few lines\n // second triangle setup\n // ---------------------\n glBindVertexArray(VAOs[1]);\t// note that we bind to a different VAO now\n glBindBuffer(GL_ARRAY_BUFFER, VBOs[1]);\t// and a different VBO\n glBufferData(GL_ARRAY_BUFFER, sizeof(secondTriangle), secondTriangle, GL_STATIC_DRAW);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0); // because the vertex data is tightly packed we can also specify 0 as the vertex attribute's stride to let OpenGL figure it out\n glEnableVertexAttribArray(0);\n // glBindVertexArray(0); // not really necessary as well, but beware of calls that could affect VAOs while this one is bound (like binding element buffer objects, or enabling/disabling vertex attributes)\n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // now when we draw the triangle we first use the vertex and orange fragment shader from the first program\n glUseProgram(shaderProgramOrange);\n // draw the first triangle using the data from our first VAO\n glBindVertexArray(VAOs[0]);\n glDrawArrays(GL_TRIANGLES, 0, 3);\t// this call should output an orange triangle\n // then we draw the second triangle using the data from the second VAO\n // when we draw the second triangle we want to use a different shader program so we switch to the shader program with our yellow fragment shader.\n glUseProgram(shaderProgramYellow);\n glBindVertexArray(VAOs[1]);\n glDrawArrays(GL_TRIANGLES, 0, 3);\t// this call should output a yellow triangle\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(2, VAOs);\n glDeleteBuffers(2, VBOs);\n glDeleteProgram(shaderProgramOrange);\n glDeleteProgram(shaderProgramYellow);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.374, "dedup_hash": "fe42700f8b6b9b09", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_1_shaders_uniform", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.1.Shaders Uniform", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.1.shaders_uniform/shaders_uniform.cpp", "language": "code", "loc": 162, "comment_density": 0.29, "code": "#include \n#include \n\n#include \n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource =\"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos, 1.0);\\n\"\n \"}\\0\";\n\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"uniform vec4 ourColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = ourColor;\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n 0.5f, -0.5f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, // bottom left\n 0.0f, 0.5f, 0.0f // top \n };\n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n // glBindVertexArray(0);\n\n\n // bind the VAO (it was already bound, but just to demonstrate): seeing as we only have a single VAO we can \n // just bind it beforehand before rendering the respective triangle; this is another approach.\n glBindVertexArray(VAO);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // be sure to activate the shader before any calls to glUniform\n glUseProgram(shaderProgram);\n\n // update shader uniform\n double timeValue = glfwGetTime();\n float greenValue = static_cast(sin(timeValue) / 2.0 + 0.5);\n int vertexColorLocation = glGetUniformLocation(shaderProgram, \"ourColor\");\n glUniform4f(vertexColorLocation, 0.0f, greenValue, 0.0f, 1.0f);\n\n // render the triangle\n glDrawArrays(GL_TRIANGLES, 0, 3);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.29, "dedup_hash": "c8652da810fd943b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_2_shaders_interpolation", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.2.Shaders Interpolation", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.2.shaders_interpolation/shaders_interpolation.cpp", "language": "code", "loc": 162, "comment_density": 0.29, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource =\"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"layout (location = 1) in vec3 aColor;\\n\"\n \"out vec3 ourColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos, 1.0);\\n\"\n \" ourColor = aColor;\\n\"\n \"}\\0\";\n\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"in vec3 ourColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(ourColor, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom left\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f // top \n\n };\n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n // glBindVertexArray(0);\n\n // as we only have a single shader, we could also just activate our shader once beforehand if we want to \n glUseProgram(shaderProgram);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // render the triangle\n glBindVertexArray(VAO);\n glDrawArrays(GL_TRIANGLES, 0, 3);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.29, "dedup_hash": "47a52e3d47f46d1e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_3_shaders_class", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.3.Shaders Class", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.3.shaders_class/3.3.shader.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\n\nvoid main()\n{\n FragColor = vec4(ourColor, 1.0f);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/3.3.shaders_class/3.3.shader.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\n\nout vec3 ourColor;\n\nvoid main()\n{\n gl_Position = vec4(aPos, 1.0);\n ourColor = aColor;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/3.3.shaders_class/shaders_class.cpp", "language": "code", "loc": 109, "comment_density": 0.376, "code": "#include \n#include \n\n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader program\n // ------------------------------------\n Shader ourShader(\"3.3.shader.vs\", \"3.3.shader.fs\"); // you can name your shader files however you like\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom left\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f // top \n };\n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n // glBindVertexArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // render the triangle\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawArrays(GL_TRIANGLES, 0, 3);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.125, "dedup_hash": "20b81b1f4bf91c2a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_4_shaders_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.4.Shaders Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.4.shaders_exercise1/shaders_exercise1.cpp", "language": "code", "loc": 9, "comment_density": 0.111, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\n\nout vec3 ourColor;\n\nvoid main()\n{\n gl_Position = vec4(aPos.x, -aPos.y, aPos.z, 1.0); // just add a - to the y position\n ourColor = aColor;\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.111, "dedup_hash": "f74258d65cc0cb40", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_5_shaders_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.5.Shaders Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.5.shaders_exercise2/shaders_exercise2.cpp", "language": "code", "loc": 16, "comment_density": 0.312, "code": "// In your CPP file:\n// ======================\nfloat offset = 0.5f;\nourShader.setFloat(\"xOffset\", offset);\n\n// In your vertex shader:\n// ======================\n#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\n\nout vec3 ourColor;\n\nuniform float xOffset;\n\nvoid main()\n{\n gl_Position = vec4(aPos.x + xOffset, aPos.y, aPos.z, 1.0); // add the xOffset to the x position of the vertex position\n ourColor = aColor;\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.312, "dedup_hash": "7bf9b0e8ebcb220a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_6_shaders_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.6.Shaders Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.6.shaders_exercise3/shaders_exercise3.cpp", "language": "code", "loc": 32, "comment_density": 0.531, "code": "// Vertex shader:\n// ==============\n#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\n\n// out vec3 ourColor;\nout vec3 ourPosition;\n\nvoid main()\n{\n gl_Position = vec4(aPos, 1.0); \n // ourColor = aColor;\n ourPosition = aPos;\n}\n\n// Fragment shader:\n// ================\n#version 330 core\nout vec4 FragColor;\n// in vec3 ourColor;\nin vec3 ourPosition;\n\nvoid main()\n{\n FragColor = vec4(ourPosition, 1.0); // note how the position value is linearly interpolated to get all the different colors\n}\n\n/* \nAnswer to the question: Do you know why the bottom-left side is black?\n-- --------------------------------------------------------------------\nThink about this for a second: the output of our fragment's color is equal to the (interpolated) coordinate of \nthe triangle. What is the coordinate of the bottom-left point of our triangle? This is (-0.5f, -0.5f, 0.0f). Since the\nxy values are negative they are clamped to a value of 0.0f. This happens all the way to the center sides of the \ntriangle since from that point on the values will be interpolated positively again. Values of 0.0f are of course black\nand that explains the black side of the triangle.\n*/"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.531, "dedup_hash": "a210b57732cf1e8b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_1_textures", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "4.1.Textures", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.1.textures/4.1.texture.fs", "language": "glsl", "loc": 10, "comment_density": 0.1, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\n// texture sampler\nuniform sampler2D texture1;\n\nvoid main()\n{\n\tFragColor = texture(texture1, TexCoord);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.1.textures/4.1.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.1.textures/textures.cpp", "language": "code", "loc": 146, "comment_density": 0.336, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.1.texture.vs\", \"4.1.texture.fs\"); \n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = { \n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture;\n glGenTextures(1, &texture);\n glBindTexture(GL_TEXTURE_2D, texture); // all upcoming GL_TEXTURE_2D operations now have effect on this texture object\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind Texture\n glBindTexture(GL_TEXTURE_2D, texture);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.145, "dedup_hash": "5569850cb433b081", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_2_textures_combined", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "4.2.Textures Combined", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.2.textures_combined/4.2.texture.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.2.textures_combined/4.2.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.2.textures_combined/textures_combined.cpp", "language": "code", "loc": 182, "comment_density": 0.346, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.2.texture.vs\", \"4.2.texture.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1); \n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); // don't forget to activate/use the shader before setting uniforms!\n // either set it manually like so:\n glUniform1i(glGetUniformLocation(ourShader.ID, \"texture1\"), 0);\n // or set it via the texture class\n ourShader.setInt(\"texture2\", 1);\n\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.171, "dedup_hash": "97bf778a7fe22501", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_3_textures_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "4.3.Textures Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.3.textures_exercise1/textures_exercise1.cpp", "language": "code", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\nuniform sampler2D ourTexture1;\nuniform sampler2D ourTexture2;\n\nvoid main()\n{\n FragColor = mix(texture(ourTexture1, TexCoord), texture(ourTexture2, vec2(1.0 - TexCoord.x, TexCoord.y)), 0.2);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.0, "dedup_hash": "01ff7514417ce6be", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_4_textures_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "4.4.Textures Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.4.textures_exercise2/4.3.texture.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.4.textures_exercise2/4.3.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.4.textures_exercise2/textures_exercise2.cpp", "language": "code", "loc": 182, "comment_density": 0.346, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.3.texture.vs\", \"4.3.texture.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords (note that we changed them to 2.0f!)\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 2.0f, 2.0f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 2.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 2.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // note that we set the container wrapping method to GL_CLAMP_TO_EDGE\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// we want to repeat the awesomeface pattern so we kept it at GL_REPEAT\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); // don't forget to activate/use the shader before setting uniforms!\n // either set it manually like so:\n glUniform1i(glGetUniformLocation(ourShader.ID, \"texture1\"), 0);\n // or set it via the texture class\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.171, "dedup_hash": "8302d82d63c444ea", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_5_textures_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "4.5.Textures Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.5.textures_exercise3/4.4.texture.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.5.textures_exercise3/4.4.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.5.textures_exercise3/textures_exercise3.cpp", "language": "code", "loc": 182, "comment_density": 0.352, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.4.texture.vs\", \"4.4.texture.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords (note that we changed them to 'zoom in' on our texture image)\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.55f, 0.55f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.55f, 0.45f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.45f, 0.45f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.45f, 0.55f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // note that we set the container wrapping method to GL_CLAMP_TO_EDGE\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // set texture filtering to nearest neighbor to clearly see the texels/pixels\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // set texture filtering to nearest neighbor to clearly see the texels/pixels\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); // don't forget to activate/use the shader before setting uniforms!\n // either set it manually like so:\n glUniform1i(glGetUniformLocation(ourShader.ID, \"texture1\"), 0);\n // or set it via the texture class\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.173, "dedup_hash": "e32cb5f4e0296e91", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_6_textures_exercise4", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "4.6.Textures Exercise4", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.6.textures_exercise4/4.5.texture.fs", "language": "glsl", "loc": 13, "comment_density": 0.154, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\nuniform float mixValue;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), mixValue);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.6.textures_exercise4/4.5.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.6.textures_exercise4/textures_exercise4.cpp", "language": "code", "loc": 198, "comment_density": 0.338, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// stores how much we're seeing of either texture\nfloat mixValue = 0.2f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.5.texture.vs\", \"4.5.texture.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); // don't forget to activate/use the shader before setting uniforms!\n // either set it manually like so:\n glUniform1i(glGetUniformLocation(ourShader.ID, \"texture1\"), 0);\n // or set it via the texture class\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // set the texture mix value in the shader\n ourShader.setFloat(\"mixValue\", mixValue);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_UP) == GLFW_PRESS)\n {\n mixValue += 0.001f; // change this value accordingly (might be too slow or too fast based on system hardware)\n if(mixValue >= 1.0f)\n mixValue = 1.0f;\n }\n if (glfwGetKey(window, GLFW_KEY_DOWN) == GLFW_PRESS)\n {\n mixValue -= 0.001f; // change this value accordingly (might be too slow or too fast based on system hardware)\n if (mixValue <= 0.0f)\n mixValue = 0.0f;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.164, "dedup_hash": "2545a9fa1e3b41d9", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_5_1_transformations", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "5.1.Transformations", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/5.1.transformations/5.1.transform.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/5.1.transformations/5.1.transform.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 transform;\n\nvoid main()\n{\n\tgl_Position = transform * vec4(aPos, 1.0);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/5.1.transformations/transformations.cpp", "language": "code", "loc": 186, "comment_density": 0.317, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"5.1.transform.vs\", \"5.1.transform.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); \n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // create transformations\n glm::mat4 transform = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n transform = glm::translate(transform, glm::vec3(0.5f, -0.5f, 0.0f));\n transform = glm::rotate(transform, (float)glfwGetTime(), glm::vec3(0.0f, 0.0f, 1.0f));\n\n // get matrix's uniform location and set matrix\n ourShader.use();\n unsigned int transformLoc = glGetUniformLocation(ourShader.ID, \"transform\");\n glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transform));\n\n // render container\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.166, "dedup_hash": "253919d01bb096f2", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_5_2_transformations_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "5.2.Transformations Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/5.2.transformations_exercise1/transformations_exercise1.cpp", "language": "code", "loc": 30, "comment_density": 0.667, "code": "int main()\n{\n [...]\n while(!glfwWindowShouldClose(window))\n {\n [...] \n // create transformations\n glm::mat4 transform = glm::mat4(1.0f);\n transform = glm::rotate(transform, (float)glfwGetTime(), glm::vec3(0.0f, 0.0f, 1.0f)); // switched the order\n transform = glm::translate(transform, glm::vec3(0.5f, -0.5f, 0.0f)); // switched the order \n [...]\n }\n}\n\n/* Why does our container now spin around our screen?:\n== ===================================================\nRemember that matrix multiplication is applied in reverse. This time a translation is thus\napplied first to the container positioning it in the bottom-right corner of the screen.\nAfter the translation the rotation is applied to the translated container.\n\nA rotation transformation is also known as a change-of-basis transformation\nfor when we dig a bit deeper into linear algebra. Since we're changing the\nbasis of the container, the next resulting translations will translate the container\nbased on the new basis vectors. Once the vector is slightly rotated, the vertical\ntranslations would also be slightly translated for example.\n\nIf we would first apply rotations then they'd resolve around the rotation origin (0,0,0), but \nsince the container is first translated, its rotation origin is no longer (0,0,0) making it\nlooks as if its circling around the origin of the scene.\n\nIf you had trouble visualizing this or figuring it out, don't worry. If you\nexperiment with transformations you'll soon get the grasp of it; all it takes\nis practice and experience.\n*/"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.667, "dedup_hash": "95aa73d5d67784e0", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_5_2_transformations_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "5.2.Transformations Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/5.2.transformations_exercise2/5.2.transform.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/5.2.transformations_exercise2/5.2.transform.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 transform;\n\nvoid main()\n{\n\tgl_Position = transform * vec4(aPos, 1.0);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp", "language": "code", "loc": 195, "comment_density": 0.333, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"5.2.transform.vs\", \"5.2.transform.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n\n glm::mat4 transform = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n // first container\n // ---------------\n transform = glm::translate(transform, glm::vec3(0.5f, -0.5f, 0.0f));\n transform = glm::rotate(transform, (float)glfwGetTime(), glm::vec3(0.0f, 0.0f, 1.0f));\n // get their uniform location and set matrix (using glm::value_ptr)\n unsigned int transformLoc = glGetUniformLocation(ourShader.ID, \"transform\");\n glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transform));\n\n // with the uniform matrix set, draw the first container\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // second transformation\n // ---------------------\n transform = glm::mat4(1.0f); // reset it to identity matrix\n transform = glm::translate(transform, glm::vec3(-0.5f, 0.5f, 0.0f));\n float scaleAmount = static_cast(sin(glfwGetTime()));\n transform = glm::scale(transform, glm::vec3(scaleAmount, scaleAmount, scaleAmount));\n glUniformMatrix4fv(transformLoc, 1, GL_FALSE, &transform[0][0]); // this time take the matrix value array's first element as its memory pointer value\n\n // now with the uniform matrix being replaced with new transformations, draw it again.\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.172, "dedup_hash": "8caee19431fb9817", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_6_1_coordinate_systems", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "6.1.Coordinate Systems", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/6.1.coordinate_systems/6.1.coordinate_systems.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/6.1.coordinate_systems/6.1.coordinate_systems.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/6.1.coordinate_systems/coordinate_systems.cpp", "language": "code", "loc": 195, "comment_density": 0.318, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"6.1.coordinate_systems.vs\", \"6.1.coordinate_systems.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n \n // activate shader\n ourShader.use();\n \n // create transformations\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n glm::mat4 view = glm::mat4(1.0f);\n glm::mat4 projection = glm::mat4(1.0f);\n model = glm::rotate(model, glm::radians(-55.0f), glm::vec3(1.0f, 0.0f, 0.0f));\n view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));\n projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n // retrieve the matrix uniform locations\n unsigned int modelLoc = glGetUniformLocation(ourShader.ID, \"model\");\n unsigned int viewLoc = glGetUniformLocation(ourShader.ID, \"view\");\n // pass them to the shaders (3 different ways)\n glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));\n glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view[0][0]);\n // note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once.\n ourShader.setMat4(\"projection\", projection);\n\n // render container\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.167, "dedup_hash": "8b055c9cb73255ff", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_6_2_coordinate_systems_depth", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "6.2.Coordinate Systems Depth", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/6.2.coordinate_systems_depth/6.2.coordinate_systems.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/6.2.coordinate_systems_depth/6.2.coordinate_systems.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/6.2.coordinate_systems_depth/coordinate_systems_depth.cpp", "language": "code", "loc": 221, "comment_density": 0.262, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"6.2.coordinate_systems.vs\", \"6.2.coordinate_systems.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // also clear the depth buffer now!\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // create transformations\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n glm::mat4 view = glm::mat4(1.0f);\n glm::mat4 projection = glm::mat4(1.0f);\n model = glm::rotate(model, (float)glfwGetTime(), glm::vec3(0.5f, 1.0f, 0.0f));\n view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));\n projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n // retrieve the matrix uniform locations\n unsigned int modelLoc = glGetUniformLocation(ourShader.ID, \"model\");\n unsigned int viewLoc = glGetUniformLocation(ourShader.ID, \"view\");\n // pass them to the shaders (3 different ways)\n glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));\n glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view[0][0]);\n // note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once.\n ourShader.setMat4(\"projection\", projection);\n\n // render box\n glBindVertexArray(VAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.148, "dedup_hash": "2244972ae86f6a65", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_6_3_coordinate_systems_multiple", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "6.3.Coordinate Systems Multiple", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/6.3.coordinate_systems_multiple/6.3.coordinate_systems.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n FragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/6.3.coordinate_systems_multiple/6.3.coordinate_systems.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0f);\n TexCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/6.3.coordinate_systems_multiple/coordinate_systems_multiple.cpp", "language": "code", "loc": 236, "comment_density": 0.25, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"6.3.coordinate_systems.vs\", \"6.3.coordinate_systems.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // also clear the depth buffer now!\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // create transformations\n glm::mat4 view = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n glm::mat4 projection = glm::mat4(1.0f);\n projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));\n // pass transformation matrices to the shader\n ourShader.setMat4(\"projection\", projection); // note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once.\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.083, "dedup_hash": "adda10648fd45e9b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_6_4_coordinate_systems_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "6.4.Coordinate Systems Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/6.4.coordinate_systems_exercise3/coordinate_systems_exercise3.cpp", "language": "code", "loc": 15, "comment_density": 0.133, "code": "...\n\n\nglBindVertexArray(VAO);\nfor(unsigned int i = 0; i < 10; i++)\n{\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i; \n if(i % 3 == 0) // every 3rd iteration (including the first) we set the angle using GLFW's time function.\n angle = glfwGetTime() * 25.0f;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n \n glDrawArrays(GL_TRIANGLES, 0, 36); \n}\n\n..."}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.133, "dedup_hash": "3ec7620dd0da3064", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_1_camera_circle", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.1.Camera Circle", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.1.camera_circle/7.1.camera.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/7.1.camera_circle/7.1.camera.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/7.1.camera_circle/camera_circle.cpp", "language": "code", "loc": 239, "comment_density": 0.243, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"7.1.camera.vs\", \"7.1.camera.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3 (2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n // pass projection matrix to shader (as projection matrix rarely changes there's no need to do this per frame)\n // -----------------------------------------------------------------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n ourShader.setMat4(\"projection\", projection); \n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // camera/view transformation\n glm::mat4 view = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n float radius = 10.0f;\n float camX = static_cast(sin(glfwGetTime()) * radius);\n float camZ = static_cast(cos(glfwGetTime()) * radius);\n view = glm::lookAt(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.142, "dedup_hash": "40c6f809c3f3ccb1", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_2_camera_keyboard_dt", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.2.Camera Keyboard Dt", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.2.camera_keyboard_dt/7.2.camera.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/7.2.camera_keyboard_dt/7.2.camera.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp", "language": "code", "loc": 256, "comment_density": 0.246, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nglm::vec3 cameraPos = glm::vec3(0.0f, 0.0f, 3.0f);\nglm::vec3 cameraFront = glm::vec3(0.0f, 0.0f, -1.0f);\nglm::vec3 cameraUp = glm::vec3(0.0f, 1.0f, 0.0f);\n\n// timing\nfloat deltaTime = 0.0f;\t// time between current frame and last frame\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"7.2.camera.vs\", \"7.2.camera.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n // pass projection matrix to shader (as projection matrix rarely changes there's no need to do this per frame)\n // -----------------------------------------------------------------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n ourShader.setMat4(\"projection\", projection);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // camera/view transformation\n glm::mat4 view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n float cameraSpeed = static_cast(2.5 * deltaTime);\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n cameraPos += cameraSpeed * cameraFront;\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n cameraPos -= cameraSpeed * cameraFront;\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n cameraPos -= glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n cameraPos += glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.143, "dedup_hash": "17d084bf46328952", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_3_camera_mouse_zoom", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.3.Camera Mouse Zoom", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.3.camera_mouse_zoom/7.3.camera.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/7.3.camera_mouse_zoom/7.3.camera.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp", "language": "code", "loc": 309, "comment_density": 0.23, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nglm::vec3 cameraPos = glm::vec3(0.0f, 0.0f, 3.0f);\nglm::vec3 cameraFront = glm::vec3(0.0f, 0.0f, -1.0f);\nglm::vec3 cameraUp = glm::vec3(0.0f, 1.0f, 0.0f);\n\nbool firstMouse = true;\nfloat yaw = -90.0f;\t// yaw is initialized to -90.0 degrees since a yaw of 0.0 results in a direction vector pointing to the right so we initially rotate a bit to the left.\nfloat pitch = 0.0f;\nfloat lastX = 800.0f / 2.0;\nfloat lastY = 600.0 / 2.0;\nfloat fov = 45.0f;\n\n// timing\nfloat deltaTime = 0.0f;\t// time between current frame and last frame\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"7.3.camera.vs\", \"7.3.camera.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // pass projection matrix to shader (note that in this case it could change every frame)\n glm::mat4 projection = glm::perspective(glm::radians(fov), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n ourShader.setMat4(\"projection\", projection);\n\n // camera/view transformation\n glm::mat4 view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n float cameraSpeed = static_cast(2.5 * deltaTime);\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n cameraPos += cameraSpeed * cameraFront;\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n cameraPos -= cameraSpeed * cameraFront;\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n cameraPos -= glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n cameraPos += glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n lastX = xpos;\n lastY = ypos;\n\n float sensitivity = 0.1f; // change this value to your liking\n xoffset *= sensitivity;\n yoffset *= sensitivity;\n\n yaw += xoffset;\n pitch += yoffset;\n\n // make sure that when pitch is out of bounds, screen doesn't get flipped\n if (pitch > 89.0f)\n pitch = 89.0f;\n if (pitch < -89.0f)\n pitch = -89.0f;\n\n glm::vec3 front;\n front.x = cos(glm::radians(yaw)) * cos(glm::radians(pitch));\n front.y = sin(glm::radians(pitch));\n front.z = sin(glm::radians(yaw)) * cos(glm::radians(pitch));\n cameraFront = glm::normalize(front);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n fov -= (float)yoffset;\n if (fov < 1.0f)\n fov = 1.0f;\n if (fov > 45.0f)\n fov = 45.0f;\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.137, "dedup_hash": "1bcdda46187f945b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_4_camera_class", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.4.Camera Class", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.4.camera_class/7.4.camera.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/7.4.camera_class/7.4.camera.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/7.4.camera_class/camera_class.cpp", "language": "code", "loc": 286, "comment_density": 0.238, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\t// time between current frame and last frame\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"7.4.camera.vs\", \"7.4.camera.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // pass projection matrix to shader (note that in this case it could change every frame)\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n ourShader.setMat4(\"projection\", projection);\n\n // camera/view transformation\n glm::mat4 view = camera.GetViewMatrix();\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.14, "dedup_hash": "d9e4ef2435e8e02e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_5_camera_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.5.Camera Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.5.camera_exercise1/camera_exercise1.cpp", "language": "code", "loc": 19, "comment_density": 0.263, "code": "// This function is found in the camera class. What we basically do is keep the y position value at 0.0f to force our\n// user to stick to the ground.\n\n[...]\n// processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)\nvoid ProcessKeyboard(Camera_Movement direction, float deltaTime)\n{\n float velocity = MovementSpeed * deltaTime;\n if (direction == FORWARD)\n Position += Front * velocity;\n if (direction == BACKWARD)\n Position -= Front * velocity;\n if (direction == LEFT)\n Position -= Right * velocity;\n if (direction == RIGHT)\n Position += Right * velocity;\n // make sure the user stays at the ground level\n Position.y = 0.0f; // <-- this one-liner keeps the user at the ground level (xz plane)\n}\n[...]"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.263, "dedup_hash": "24f861cef5dada66", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_6_camera_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.6.Camera Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.6.camera_exercise2/camera_exercise2.cpp", "language": "code", "loc": 32, "comment_density": 0.5, "code": "// Custom implementation of the LookAt function\nglm::mat4 calculate_lookAt_matrix(glm::vec3 position, glm::vec3 target, glm::vec3 worldUp)\n{\n // 1. Position = known\n // 2. Calculate cameraDirection\n glm::vec3 zaxis = glm::normalize(position - target);\n // 3. Get positive right axis vector\n glm::vec3 xaxis = glm::normalize(glm::cross(glm::normalize(worldUp), zaxis));\n // 4. Calculate camera up vector\n glm::vec3 yaxis = glm::cross(zaxis, xaxis);\n\n // Create translation and rotation matrix\n // In glm we access elements as mat[col][row] due to column-major layout\n glm::mat4 translation = glm::mat4(1.0f); // Identity matrix by default\n translation[3][0] = -position.x; // Fourth column, first row\n translation[3][1] = -position.y;\n translation[3][2] = -position.z;\n glm::mat4 rotation = glm::mat4(1.0f);\n rotation[0][0] = xaxis.x; // First column, first row\n rotation[1][0] = xaxis.y;\n rotation[2][0] = xaxis.z;\n rotation[0][1] = yaxis.x; // First column, second row\n rotation[1][1] = yaxis.y;\n rotation[2][1] = yaxis.z;\n rotation[0][2] = zaxis.x; // First column, third row\n rotation[1][2] = zaxis.y;\n rotation[2][2] = zaxis.z; \n\n // Return lookAt matrix as combination of translation and rotation matrix\n return rotation * translation; // Remember to read from right to left (first translation then rotation)\n}\n\n\n// Don't forget to replace glm::lookAt with your own version\n// view = glm::lookAt(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));\nview = calculate_lookAt_matrix(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.5, "dedup_hash": "e444c750582aaa96", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_1_colors", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "1.Colors", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/1.colors/1.colors.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n \nuniform vec3 objectColor;\nuniform vec3 lightColor;\n\nvoid main()\n{\n FragColor = vec4(lightColor * objectColor, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/1.colors/1.colors.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/1.colors/1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/1.colors/1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/1.colors/colors.cpp", "language": "code", "loc": 227, "comment_density": 0.229, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"1.colors.vs\", \"1.colors.fs\");\n Shader lightCubeShader(\"1.light_cube.vs\", \"1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n -0.5f, 0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n\n -0.5f, -0.5f, 0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n -0.5f, -0.5f, 0.5f, \n\n -0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n -0.5f, -0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n\n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n\n -0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, -0.5f, 0.5f, \n -0.5f, -0.5f, 0.5f, \n -0.5f, -0.5f, -0.5f, \n\n -0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, -0.5f, \n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n // we only need to bind to the VBO (to link it with glVertexAttribPointer), no need to fill it; the VBO's data already contains all we need (it's already bound, but we do it again for educational purposes)\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n \n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"objectColor\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"lightColor\", 1.0f, 1.0f, 1.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.079, "dedup_hash": "cb3e04481f608102", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_1_basic_lighting_diffuse", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.1.Basic Lighting Diffuse", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.1.basic_lighting_diffuse/2.1.basic_lighting.fs", "language": "glsl", "loc": 20, "comment_density": 0.1, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 Normal; \nin vec3 FragPos; \n \nuniform vec3 lightPos; \nuniform vec3 lightColor;\nuniform vec3 objectColor;\n\nvoid main()\n{\n // ambient\n float ambientStrength = 0.1;\n vec3 ambient = ambientStrength * lightColor;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(lightPos - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = diff * lightColor;\n \n vec3 result = (ambient + diffuse) * objectColor;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/2.1.basic_lighting_diffuse/2.1.basic_lighting.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = aNormal; \n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/2.1.basic_lighting_diffuse/2.1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/2.1.basic_lighting_diffuse/2.1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp", "language": "code", "loc": 231, "comment_density": 0.229, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\t\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"2.1.basic_lighting.vs\", \"2.1.basic_lighting.fs\");\n Shader lightCubeShader(\"2.1.light_cube.vs\", \"2.1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // normal attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"objectColor\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"lightColor\", 1.0f, 1.0f, 1.0f);\n lightingShader.setVec3(\"lightPos\", lightPos);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.099, "dedup_hash": "d9c7b9d0e8914f0a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_2_basic_lighting_specular", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.2.Basic Lighting Specular", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.2.basic_lighting_specular/2.2.basic_lighting.fs", "language": "glsl", "loc": 27, "comment_density": 0.111, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 Normal; \nin vec3 FragPos; \n \nuniform vec3 lightPos; \nuniform vec3 viewPos; \nuniform vec3 lightColor;\nuniform vec3 objectColor;\n\nvoid main()\n{\n // ambient\n float ambientStrength = 0.1;\n vec3 ambient = ambientStrength * lightColor;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(lightPos - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = diff * lightColor;\n \n // specular\n float specularStrength = 0.5;\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);\n vec3 specular = specularStrength * spec * lightColor; \n \n vec3 result = (ambient + diffuse + specular) * objectColor;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/2.2.basic_lighting_specular/2.2.basic_lighting.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/2.2.basic_lighting_specular/2.2.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/2.2.basic_lighting_specular/2.2.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp", "language": "code", "loc": 232, "comment_density": 0.228, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\t\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"2.2.basic_lighting.vs\", \"2.2.basic_lighting.fs\");\n Shader lightCubeShader(\"2.2.light_cube.vs\", \"2.2.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // normal attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"objectColor\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"lightColor\", 1.0f, 1.0f, 1.0f);\n lightingShader.setVec3(\"lightPos\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.101, "dedup_hash": "2c764e6e439d1e13", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_3_basic_lighting_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.3.Basic Lighting Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.3.basic_lighting_exercise1/basic_lighting_exercise1.cpp", "language": "code", "loc": 25, "comment_density": 0.28, "code": "int main()\n{\n [...]\n // render loop\n while(!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n float currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n processInput(window);\n\n // clear the colorbuffer\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // change the light's position values over time (can be done anywhere in the render loop actually, but try to do it at least before using the light source positions)\n lightPos.x = 1.0f + sin(glfwGetTime()) * 2.0f;\n lightPos.y = sin(glfwGetTime() / 2.0f) * 1.0f;\n \n // set uniforms, draw objects\n [...]\n \n // glfw: swap buffers and poll IO events\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.28, "dedup_hash": "6a00f18a90146f6b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_4_basic_lighting_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.4.Basic Lighting Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.4.basic_lighting_exercise2/basic_lighting_exercise2.cpp", "language": "code", "loc": 47, "comment_density": 0.234, "code": "// Vertex shader:\n// ================\n#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec3 LightPos;\n\nuniform vec3 lightPos; // we now define the uniform in the vertex shader and pass the 'view space' lightpos to the fragment shader. lightPos is currently in world space.\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n FragPos = vec3(view * model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(view * model))) * aNormal;\n LightPos = vec3(view * vec4(lightPos, 1.0)); // Transform world-space light position to view-space light position\n}\n\n\n// Fragment shader:\n// ================\n#version 330 core\nout vec4 FragColor;\n\nin vec3 FragPos;\nin vec3 Normal;\nin vec3 LightPos; // extra in variable, since we need the light position in view space we calculate this in the vertex shader\n\nuniform vec3 lightColor;\nuniform vec3 objectColor;\n\nvoid main()\n{\n // ambient\n float ambientStrength = 0.1;\n vec3 ambient = ambientStrength * lightColor; \n \n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(LightPos - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = diff * lightColor;\n \n // specular\n float specularStrength = 0.5;\n vec3 viewDir = normalize(-FragPos); // the viewer is always at (0,0,0) in view-space, so viewDir is (0,0,0) - Position => -Position\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);\n vec3 specular = specularStrength * spec * lightColor; \n \n vec3 result = (ambient + diffuse + specular) * objectColor;\n FragColor = vec4(result, 1.0);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.234, "dedup_hash": "970624504cbb6e4f", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_5_basic_lighting_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.5.Basic Lighting Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.5.basic_lighting_exercise3/basic_lighting_exercise3.cpp", "language": "code", "loc": 56, "comment_density": 0.393, "code": "// Vertex shader:\n// ================\n#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 LightingColor; // resulting color from lighting calculations\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\nuniform vec3 lightColor;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n \n // gouraud shading\n // ------------------------\n vec3 Position = vec3(model * vec4(aPos, 1.0));\n vec3 Normal = mat3(transpose(inverse(model))) * aNormal;\n \n // ambient\n float ambientStrength = 0.1;\n vec3 ambient = ambientStrength * lightColor;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(lightPos - Position);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = diff * lightColor;\n \n // specular\n float specularStrength = 1.0; // this is set higher to better show the effect of Gouraud shading \n vec3 viewDir = normalize(viewPos - Position);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);\n vec3 specular = specularStrength * spec * lightColor; \n\n LightingColor = ambient + diffuse + specular;\n}\n\n\n// Fragment shader:\n// ================\n#version 330 core\nout vec4 FragColor;\n\nin vec3 LightingColor; \n\nuniform vec3 objectColor;\n\nvoid main()\n{\n FragColor = vec4(LightingColor * objectColor, 1.0);\n}\n\n\n/*\nSo what do we see?\nYou can see (for yourself or in the provided image) the clear distinction of the two triangles at the front of the \ncube. This 'stripe' is visible because of fragment interpolation. From the example image we can see that the top-right \nvertex of the cube's front face is lit with specular highlights. Since the top-right vertex of the bottom-right triangle is \nlit and the other 2 vertices of the triangle are not, the bright values interpolates to the other 2 vertices. The same \nhappens for the upper-left triangle. Since the intermediate fragment colors are not directly from the light source \nbut are the result of interpolation, the lighting is incorrect at the intermediate fragments and the top-left and \nbottom-right triangle collide in their brightness resulting in a visible stripe between both triangles.\n\nThis effect will become more apparent when using more complicated shapes.\n*/"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.393, "dedup_hash": "99c8725902e90dcd", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_3_1_materials", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "3.1.Materials", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/3.1.materials/3.1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/3.1.materials/3.1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/3.1.materials/3.1.materials.fs", "language": "glsl", "loc": 36, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * material.ambient;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * (diff * material.diffuse);\n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * (spec * material.specular); \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/3.1.materials/3.1.materials.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/3.1.materials/materials.cpp", "language": "code", "loc": 245, "comment_density": 0.237, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f; \nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"3.1.materials.vs\", \"3.1.materials.fs\");\n Shader lightCubeShader(\"3.1.light_cube.vs\", \"3.1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // normal attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n glm::vec3 lightColor;\n lightColor.x = static_cast(sin(glfwGetTime() * 2.0));\n lightColor.y = static_cast(sin(glfwGetTime() * 0.7));\n lightColor.z = static_cast(sin(glfwGetTime() * 1.3));\n glm::vec3 diffuseColor = lightColor * glm::vec3(0.5f); // decrease the influence\n glm::vec3 ambientColor = diffuseColor * glm::vec3(0.2f); // low influence\n lightingShader.setVec3(\"light.ambient\", ambientColor);\n lightingShader.setVec3(\"light.diffuse\", diffuseColor);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setVec3(\"material.ambient\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"material.diffuse\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"material.specular\", 0.5f, 0.5f, 0.5f); // specular lighting doesn't have full effect on this object's material\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.097, "dedup_hash": "af2ef7aa3103fa79", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_3_2_materials_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "3.2.Materials Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/3.2.materials_exercise1/3.2.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/3.2.materials_exercise1/3.2.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/3.2.materials_exercise1/3.2.materials.fs", "language": "glsl", "loc": 36, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * material.ambient;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * (diff * material.diffuse);\n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * (spec * material.specular); \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/3.2.materials_exercise1/3.2.materials.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp", "language": "code", "loc": 239, "comment_density": 0.234, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"3.2.materials.vs\", \"3.2.materials.fs\");\n Shader lightCubeShader(\"3.2.light_cube.vs\", \"3.2.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // normal attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 1.0f, 1.0f, 1.0f); // note that all light colors are set at full intensity\n lightingShader.setVec3(\"light.diffuse\", 1.0f, 1.0f, 1.0f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setVec3(\"material.ambient\", 0.0f, 0.1f, 0.06f);\n lightingShader.setVec3(\"material.diffuse\", 0.0f, 0.50980392f, 0.50980392f);\n lightingShader.setVec3(\"material.specular\", 0.50196078f, 0.50196078f, 0.50196078f);\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.097, "dedup_hash": "dfe1f39833884b43", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_4_1_lighting_maps_diffuse_map", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "4.1.Lighting Maps Diffuse Map", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/4.1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/4.1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/4.1.lighting_maps.fs", "language": "glsl", "loc": 36, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n vec3 specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * (spec * material.specular); \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/4.1.lighting_maps.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/lighting_maps_diffuse.cpp", "language": "code", "loc": 283, "comment_density": 0.216, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"4.1.lighting_maps.vs\", \"4.1.lighting_maps.fs\");\n Shader lightCubeShader(\"4.1.light_cube.vs\", \"4.1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use(); \n lightingShader.setInt(\"material.diffuse\", 0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f); \n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setVec3(\"material.specular\", 0.5f, 0.5f, 0.5f);\n lightingShader.setFloat(\"material.shininess\", 64.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n \n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.093, "dedup_hash": "3b2e9da45f46222d", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_4_2_lighting_maps_specular_map", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "4.2.Lighting Maps Specular Map", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/4.2.lighting_maps_specular_map/4.2.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.2.lighting_maps_specular_map/4.2.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.2.lighting_maps_specular_map/4.2.lighting_maps.fs", "language": "glsl", "loc": 36, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.2.lighting_maps_specular_map/4.2.lighting_maps.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp", "language": "code", "loc": 287, "comment_density": 0.216, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"4.2.lighting_maps.vs\", \"4.2.lighting_maps.fs\");\n Shader lightCubeShader(\"4.2.light_cube.vs\", \"4.2.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f);\n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 64.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.093, "dedup_hash": "1af0caff55aba608", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_4_3_lighting_maps_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "4.3.Lighting Maps Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/4.3.lighting_maps_exercise2/lighting_maps_exercise2.cpp", "language": "code", "loc": 35, "comment_density": 0.114, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular;\n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords)); \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * (vec3(1.0) - vec3(texture(material.specular, TexCoords))); // here we inverse the sampled specular color. Black becomes white and white becomes black.\n \n FragColor = vec4(ambient + diffuse + specular, 1.0); \n} "}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.114, "dedup_hash": "f0dc6fe746aa9b5e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_4_4_lighting_maps_exercise4", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "4.4.Lighting Maps Exercise4", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/4.4.lighting_maps_exercise4/4.4.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.4.lighting_maps_exercise4/4.4.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.4.lighting_maps_exercise4/4.4.lighting_maps.fs", "language": "glsl", "loc": 39, "comment_density": 0.103, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n sampler2D emission;\n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n // emission\n vec3 emission = texture(material.emission, TexCoords).rgb;\n \n vec3 result = ambient + diffuse + specular + emission;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.4.lighting_maps_exercise4/4.4.lighting_maps.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp", "language": "code", "loc": 292, "comment_density": 0.216, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"4.4.lighting_maps.vs\", \"4.4.lighting_maps.fs\");\n Shader lightCubeShader(\"4.4.light_cube.vs\", \"4.4.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n unsigned int emissionMap = loadTexture(FileSystem::getPath(\"resources/textures/matrix.jpg\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n lightingShader.setInt(\"material.emission\", 2);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f);\n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 64.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n // bind emission map\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, emissionMap);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.097, "dedup_hash": "2f3b9be372d51167", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_5_1_light_casters_directional", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "5.1.Light Casters Directional", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/5.1.light_casters_directional/5.1.light_casters.fs", "language": "glsl", "loc": 38, "comment_density": 0.132, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n //vec3 position;\n vec3 direction;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n // vec3 lightDir = normalize(light.position - FragPos);\n vec3 lightDir = normalize(-light.direction); \n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.1.light_casters_directional/5.1.light_casters.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.1.light_casters_directional/5.1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.1.light_casters_directional/5.1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp", "language": "code", "loc": 310, "comment_density": 0.239, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader lightingShader(\"5.1.light_casters.vs\", \"5.1.light_casters.fs\");\n Shader lightCubeShader(\"5.1.light_cube.vs\", \"5.1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.direction\", -0.2f, -1.0f, -0.3f);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f);\n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render the cube\n // glBindVertexArray(cubeVAO);\n // glDrawArrays(GL_TRIANGLES, 0, 36);*/\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n\n // a lamp object is weird when we only have a directional light, don't render the light object\n // lightCubeShader.use();\n // lightCubeShader.setMat4(\"projection\", projection);\n // lightCubeShader.setMat4(\"view\", view);\n // model = glm::mat4(1.0f);\n // model = glm::translate(model, lightPos);\n // model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n // lightCubeShader.setMat4(\"model\", model);\n\n // glBindVertexArray(lightCubeVAO);\n // glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.108, "dedup_hash": "aabb176c807b3c28", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_5_2_light_casters_point", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "5.2.Light Casters Point", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/5.2.light_casters_point/5.2.light_casters.fs", "language": "glsl", "loc": 45, "comment_density": 0.089, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position; \n \n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n\t\n float constant;\n float linear;\n float quadratic;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n // attenuation\n float distance = length(light.position - FragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n\n ambient *= attenuation; \n diffuse *= attenuation;\n specular *= attenuation; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.2.light_casters_point/5.2.light_casters.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.2.light_casters_point/5.2.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.2.light_casters_point/5.2.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.2.light_casters_point/light_casters_point.cpp", "language": "code", "loc": 312, "comment_density": 0.205, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"5.2.light_casters.vs\", \"5.2.light_casters.fs\");\n Shader lightCubeShader(\"5.2.light_cube.vs\", \"5.2.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f);\n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"light.constant\", 1.0f);\n lightingShader.setFloat(\"light.linear\", 0.09f);\n lightingShader.setFloat(\"light.quadratic\", 0.032f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.092, "dedup_hash": "890bf9e04b8e5ff7", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_5_3_light_casters_spot", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "5.3.Light Casters Spot", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/5.3.light_casters_spot/5.3.light_casters.fs", "language": "glsl", "loc": 58, "comment_density": 0.138, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position; \n vec3 direction;\n float cutOff;\n float outerCutOff;\n \n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n\t\n float constant;\n float linear;\n float quadratic;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n vec3 lightDir = normalize(light.position - FragPos);\n \n // check if lighting is inside the spotlight cone\n float theta = dot(lightDir, normalize(-light.direction)); \n \n if(theta > light.cutOff) // remember that we're working with angles as cosines instead of degrees so a '>' is used.\n { \n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \n // diffuse \n vec3 norm = normalize(Normal);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n // attenuation\n float distance = length(light.position - FragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n\n // ambient *= attenuation; // remove attenuation from ambient, as otherwise at large distances the light would be darker inside than outside the spotlight due the ambient term in the else branch\n diffuse *= attenuation;\n specular *= attenuation; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n }\n else \n {\n // else, use ambient light so scene isn't completely dark outside the spotlight.\n FragColor = vec4(light.ambient * texture(material.diffuse, TexCoords).rgb, 1.0);\n }\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.3.light_casters_spot/5.3.light_casters.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.3.light_casters_spot/5.3.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.3.light_casters_spot/5.3.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp", "language": "code", "loc": 314, "comment_density": 0.232, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"5.3.light_casters.vs\", \"5.3.light_casters.fs\");\n Shader lightCubeShader(\"5.3.light_cube.vs\", \"5.3.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", camera.Position);\n lightingShader.setVec3(\"light.direction\", camera.Front);\n lightingShader.setFloat(\"light.cutOff\", glm::cos(glm::radians(12.5f)));\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.1f, 0.1f, 0.1f);\n // we configure the diffuse intensity slightly higher; the right lighting conditions differ with each lighting method and environment.\n // each environment and lighting type requires some tweaking to get the best out of your environment.\n lightingShader.setVec3(\"light.diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"light.constant\", 1.0f);\n lightingShader.setFloat(\"light.linear\", 0.09f);\n lightingShader.setFloat(\"light.quadratic\", 0.032f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n\n // again, a lamp object is weird when we only have a spot light, don't render the light object\n // lightCubeShader.use();\n // lightCubeShader.setMat4(\"projection\", projection);\n // lightCubeShader.setMat4(\"view\", view);\n // model = glm::mat4(1.0f);\n // model = glm::translate(model, lightPos);\n // model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n // lightCubeShader.setMat4(\"model\", model);\n\n // glBindVertexArray(lightCubeVAO);\n // glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.107, "dedup_hash": "57761de9fbb953b7", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_5_4_light_casters_spot_soft", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "5.4.Light Casters Spot Soft", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/5.4.light_casters_spot_soft/5.4.light_casters.fs", "language": "glsl", "loc": 54, "comment_density": 0.093, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position; \n vec3 direction;\n float cutOff;\n float outerCutOff;\n \n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n\t\n float constant;\n float linear;\n float quadratic;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n // spotlight (soft edges)\n float theta = dot(lightDir, normalize(-light.direction)); \n float epsilon = (light.cutOff - light.outerCutOff);\n float intensity = clamp((theta - light.outerCutOff) / epsilon, 0.0, 1.0);\n diffuse *= intensity;\n specular *= intensity;\n \n // attenuation\n float distance = length(light.position - FragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n ambient *= attenuation; \n diffuse *= attenuation;\n specular *= attenuation; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.4.light_casters_spot_soft/5.4.light_casters.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.4.light_casters_spot_soft/5.4.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.4.light_casters_spot_soft/5.4.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp", "language": "code", "loc": 315, "comment_density": 0.232, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"5.4.light_casters.vs\", \"5.4.light_casters.fs\");\n Shader lightCubeShader(\"5.4.light_cube.vs\", \"5.4.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", camera.Position);\n lightingShader.setVec3(\"light.direction\", camera.Front);\n lightingShader.setFloat(\"light.cutOff\", glm::cos(glm::radians(12.5f)));\n lightingShader.setFloat(\"light.outerCutOff\", glm::cos(glm::radians(17.5f)));\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.1f, 0.1f, 0.1f);\n // we configure the diffuse intensity slightly higher; the right lighting conditions differ with each lighting method and environment.\n // each environment and lighting type requires some tweaking to get the best out of your environment.\n lightingShader.setVec3(\"light.diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"light.constant\", 1.0f);\n lightingShader.setFloat(\"light.linear\", 0.09f);\n lightingShader.setFloat(\"light.quadratic\", 0.032f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // again, a lamp object is weird when we only have a spot light, don't render the light object\n // lightCubeShader.use();\n // lightCubeShader.setMat4(\"projection\", projection);\n // lightCubeShader.setMat4(\"view\", view);\n // model = glm::mat4(1.0f);\n // model = glm::translate(model, lightPos);\n // model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n // lightCubeShader.setMat4(\"model\", model);\n\n // glBindVertexArray(lightCubeVAO);\n // glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.098, "dedup_hash": "a2df867a17853659", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_6_multiple_lights", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "6.Multiple Lights", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/6.multiple_lights/6.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/6.multiple_lights/6.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/6.multiple_lights/6.multiple_lights.fs", "language": "glsl", "loc": 128, "comment_density": 0.203, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular;\n float shininess;\n}; \n\nstruct DirLight {\n vec3 direction;\n\t\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nstruct PointLight {\n vec3 position;\n \n float constant;\n float linear;\n float quadratic;\n\t\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nstruct SpotLight {\n vec3 position;\n vec3 direction;\n float cutOff;\n float outerCutOff;\n \n float constant;\n float linear;\n float quadratic;\n \n vec3 ambient;\n vec3 diffuse;\n vec3 specular; \n};\n\n#define NR_POINT_LIGHTS 4\n\nin vec3 FragPos;\nin vec3 Normal;\nin vec2 TexCoords;\n\nuniform vec3 viewPos;\nuniform DirLight dirLight;\nuniform PointLight pointLights[NR_POINT_LIGHTS];\nuniform SpotLight spotLight;\nuniform Material material;\n\n// function prototypes\nvec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir);\nvec3 CalcPointLight(PointLight light, vec3 normal, vec3 fragPos, vec3 viewDir);\nvec3 CalcSpotLight(SpotLight light, vec3 normal, vec3 fragPos, vec3 viewDir);\n\nvoid main()\n{ \n // properties\n vec3 norm = normalize(Normal);\n vec3 viewDir = normalize(viewPos - FragPos);\n \n // == =====================================================\n // Our lighting is set up in 3 phases: directional, point lights and an optional flashlight\n // For each phase, a calculate function is defined that calculates the corresponding color\n // per lamp. In the main() function we take all the calculated colors and sum them up for\n // this fragment's final color.\n // == =====================================================\n // phase 1: directional lighting\n vec3 result = CalcDirLight(dirLight, norm, viewDir);\n // phase 2: point lights\n for(int i = 0; i < NR_POINT_LIGHTS; i++)\n result += CalcPointLight(pointLights[i], norm, FragPos, viewDir); \n // phase 3: spot light\n result += CalcSpotLight(spotLight, norm, FragPos, viewDir); \n \n FragColor = vec4(result, 1.0);\n}\n\n// calculates the color when using a directional light.\nvec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir)\n{\n vec3 lightDir = normalize(-light.direction);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // specular shading\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n // combine results\n vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));\n vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords));\n vec3 specular = light.specular * spec * vec3(texture(material.specular, TexCoords));\n return (ambient + diffuse + specular);\n}\n\n// calculates the color when using a point light.\nvec3 CalcPointLight(PointLight light, vec3 normal, vec3 fragPos, vec3 viewDir)\n{\n vec3 lightDir = normalize(light.position - fragPos);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // specular shading\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n // attenuation\n float distance = length(light.position - fragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n // combine results\n vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));\n vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords));\n vec3 specular = light.specular * spec * vec3(texture(material.specular, TexCoords));\n ambient *= attenuation;\n diffuse *= attenuation;\n specular *= attenuation;\n return (ambient + diffuse + specular);\n}\n\n// calculates the color when using a spot light.\nvec3 CalcSpotLight(SpotLight light, vec3 normal, vec3 fragPos, vec3 viewDir)\n{\n vec3 lightDir = normalize(light.position - fragPos);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // specular shading\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n // attenuation\n float distance = length(light.position - fragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n // spotlight intensity\n float theta = dot(lightDir, normalize(-light.direction)); \n float epsilon = light.cutOff - light.outerCutOff;\n float intensity = clamp((theta - light.outerCutOff) / epsilon, 0.0, 1.0);\n // combine results\n vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));\n vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords));\n vec3 specular = light.specular * spec * vec3(texture(material.specular, TexCoords));\n ambient *= attenuation * intensity;\n diffuse *= attenuation * intensity;\n specular *= attenuation * intensity;\n return (ambient + diffuse + specular);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/6.multiple_lights/6.multiple_lights.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/6.multiple_lights/multiple_lights.cpp", "language": "code", "loc": 368, "comment_density": 0.207, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"6.multiple_lights.vs\", \"6.multiple_lights.fs\");\n Shader lightCubeShader(\"6.light_cube.vs\", \"6.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // positions of the point lights\n glm::vec3 pointLightPositions[] = {\n glm::vec3( 0.7f, 0.2f, 2.0f),\n glm::vec3( 2.3f, -3.3f, -4.0f),\n glm::vec3(-4.0f, 2.0f, -12.0f),\n glm::vec3( 0.0f, 0.0f, -3.0f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"viewPos\", camera.Position);\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n /*\n Here we set all the uniforms for the 5/6 types of lights we have. We have to set them manually and index \n the proper PointLight struct in the array to set each uniform variable. This can be done more code-friendly\n by defining light types as classes and set their values in there, or by using a more efficient uniform approach\n by using 'Uniform buffer objects', but that is something we'll discuss in the 'Advanced GLSL' tutorial.\n */\n // directional light\n lightingShader.setVec3(\"dirLight.direction\", -0.2f, -1.0f, -0.3f);\n lightingShader.setVec3(\"dirLight.ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"dirLight.diffuse\", 0.4f, 0.4f, 0.4f);\n lightingShader.setVec3(\"dirLight.specular\", 0.5f, 0.5f, 0.5f);\n // point light 1\n lightingShader.setVec3(\"pointLights[0].position\", pointLightPositions[0]);\n lightingShader.setVec3(\"pointLights[0].ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"pointLights[0].diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"pointLights[0].specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"pointLights[0].constant\", 1.0f);\n lightingShader.setFloat(\"pointLights[0].linear\", 0.09f);\n lightingShader.setFloat(\"pointLights[0].quadratic\", 0.032f);\n // point light 2\n lightingShader.setVec3(\"pointLights[1].position\", pointLightPositions[1]);\n lightingShader.setVec3(\"pointLights[1].ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"pointLights[1].diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"pointLights[1].specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"pointLights[1].constant\", 1.0f);\n lightingShader.setFloat(\"pointLights[1].linear\", 0.09f);\n lightingShader.setFloat(\"pointLights[1].quadratic\", 0.032f);\n // point light 3\n lightingShader.setVec3(\"pointLights[2].position\", pointLightPositions[2]);\n lightingShader.setVec3(\"pointLights[2].ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"pointLights[2].diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"pointLights[2].specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"pointLights[2].constant\", 1.0f);\n lightingShader.setFloat(\"pointLights[2].linear\", 0.09f);\n lightingShader.setFloat(\"pointLights[2].quadratic\", 0.032f);\n // point light 4\n lightingShader.setVec3(\"pointLights[3].position\", pointLightPositions[3]);\n lightingShader.setVec3(\"pointLights[3].ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"pointLights[3].diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"pointLights[3].specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"pointLights[3].constant\", 1.0f);\n lightingShader.setFloat(\"pointLights[3].linear\", 0.09f);\n lightingShader.setFloat(\"pointLights[3].quadratic\", 0.032f);\n // spotLight\n lightingShader.setVec3(\"spotLight.position\", camera.Position);\n lightingShader.setVec3(\"spotLight.direction\", camera.Front);\n lightingShader.setVec3(\"spotLight.ambient\", 0.0f, 0.0f, 0.0f);\n lightingShader.setVec3(\"spotLight.diffuse\", 1.0f, 1.0f, 1.0f);\n lightingShader.setVec3(\"spotLight.specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"spotLight.constant\", 1.0f);\n lightingShader.setFloat(\"spotLight.linear\", 0.09f);\n lightingShader.setFloat(\"spotLight.quadratic\", 0.032f);\n lightingShader.setFloat(\"spotLight.cutOff\", glm::cos(glm::radians(12.5f)));\n lightingShader.setFloat(\"spotLight.outerCutOff\", glm::cos(glm::radians(15.0f))); \n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // also draw the lamp object(s)\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n \n // we now draw as many light bulbs as we have point lights.\n glBindVertexArray(lightCubeVAO);\n for (unsigned int i = 0; i < 4; i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, pointLightPositions[i]);\n model = glm::scale(model, glm::vec3(0.2f)); // Make it a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.115, "dedup_hash": "db73b606ccb92632", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_6_multiple_lights_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "6.Multiple Lights Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/6.multiple_lights_exercise1/multiple_lights_exercise1.cpp", "language": "code", "loc": 240, "comment_density": 0.15, "code": "// == ==============================================================================================\n// DESERT\n// == ==============================================================================================\nglClearColor(0.75f, 0.52f, 0.3f, 1.0f);\n[...]\nglm::vec3 pointLightColors[] = {\n glm::vec3(1.0f, 0.6f, 0.0f),\n glm::vec3(1.0f, 0.0f, 0.0f),\n glm::vec3(1.0f, 1.0, 0.0),\n glm::vec3(0.2f, 0.2f, 1.0f)\n};\n[...]\n// Directional light\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.direction\"), -0.2f, -1.0f, -0.3f);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.ambient\"), 0.3f, 0.24f, 0.14f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.diffuse\"), 0.7f, 0.42f, 0.26f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.specular\"), 0.5f, 0.5f, 0.5f);\n// Point light 1\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].position\"), pointLightPositions[0].x, pointLightPositions[0].y, pointLightPositions[0].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].ambient\"), pointLightColors[0].x * 0.1, pointLightColors[0].y * 0.1, pointLightColors[0].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].diffuse\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].specular\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].quadratic\"), 0.032);\t\t\n// Point light 2\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].position\"), pointLightPositions[1].x, pointLightPositions[1].y, pointLightPositions[1].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].ambient\"), pointLightColors[1].x * 0.1, pointLightColors[1].y * 0.1, pointLightColors[1].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].diffuse\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].specular\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].quadratic\"), 0.032);\t\t\n// Point light 3\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].position\"), pointLightPositions[2].x, pointLightPositions[2].y, pointLightPositions[2].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].ambient\"), pointLightColors[2].x * 0.1, pointLightColors[2].y * 0.1, pointLightColors[2].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].diffuse\"), pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].specular\") ,pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].quadratic\"), 0.032);\t\t\n// Point light 4\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].position\"), pointLightPositions[3].x, pointLightPositions[3].y, pointLightPositions[3].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].ambient\"), pointLightColors[3].x * 0.1, pointLightColors[3].y * 0.1, pointLightColors[3].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].diffuse\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].specular\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].quadratic\"), 0.032);\t\t\n// SpotLight\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.position\"), camera.Position.x, camera.Position.y, camera.Position.z);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.direction\"), camera.Front.x, camera.Front.y, camera.Front.z);\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.diffuse\"), 0.8f, 0.8f, 0.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.specular\"), 0.8f, 0.8f, 0.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.quadratic\"), 0.032);\t\t\t\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.cutOff\"), glm::cos(glm::radians(12.5f)));\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.outerCutOff\"), glm::cos(glm::radians(13.0f)));\t\n// == ==============================================================================================\n// FACTORY\n// == ==============================================================================================\nglClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n[...]\nglm::vec3 pointLightColors[] = {\n glm::vec3(0.2f, 0.2f, 0.6f),\n glm::vec3(0.3f, 0.3f, 0.7f),\n glm::vec3(0.0f, 0.0f, 0.3f),\n glm::vec3(0.4f, 0.4f, 0.4f)\n};\n[...]\n// Directional light\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.direction\"), -0.2f, -1.0f, -0.3f);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.ambient\"), 0.05f, 0.05f, 0.1f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.diffuse\"), 0.2f, 0.2f, 0.7); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.specular\"), 0.7f, 0.7f, 0.7f);\n// Point light 1\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].position\"), pointLightPositions[0].x, pointLightPositions[0].y, pointLightPositions[0].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].ambient\"), pointLightColors[0].x * 0.1, pointLightColors[0].y * 0.1, pointLightColors[0].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].diffuse\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].specular\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].quadratic\"), 0.032);\t\t\n// Point light 2\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].position\"), pointLightPositions[1].x, pointLightPositions[1].y, pointLightPositions[1].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].ambient\"), pointLightColors[1].x * 0.1, pointLightColors[1].y * 0.1, pointLightColors[1].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].diffuse\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].specular\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].quadratic\"), 0.032);\t\t\n// Point light 3\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].position\"), pointLightPositions[2].x, pointLightPositions[2].y, pointLightPositions[2].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].ambient\"), pointLightColors[2].x * 0.1, pointLightColors[2].y * 0.1, pointLightColors[2].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].diffuse\"), pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].specular\") ,pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].quadratic\"), 0.032);\t\t\n// Point light 4\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].position\"), pointLightPositions[3].x, pointLightPositions[3].y, pointLightPositions[3].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].ambient\"), pointLightColors[3].x * 0.1, pointLightColors[3].y * 0.1, pointLightColors[3].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].diffuse\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].specular\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].quadratic\"), 0.032);\t\t\n// SpotLight\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.position\"), camera.Position.x, camera.Position.y, camera.Position.z);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.direction\"), camera.Front.x, camera.Front.y, camera.Front.z);\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.diffuse\"), 1.0f, 1.0f, 1.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.specular\"), 1.0f, 1.0f, 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.linear\"), 0.009);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.quadratic\"), 0.0032);\t\t\t\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.cutOff\"), glm::cos(glm::radians(10.0f)));\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.outerCutOff\"), glm::cos(glm::radians(12.5f)));\t\n// == ==============================================================================================\n// HORROR\n// == ==============================================================================================\nglClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n[...]\nglm::vec3 pointLightColors[] = {\n glm::vec3(0.1f, 0.1f, 0.1f),\n glm::vec3(0.1f, 0.1f, 0.1f),\n glm::vec3(0.1f, 0.1f, 0.1f),\n glm::vec3(0.3f, 0.1f, 0.1f)\n};\n[...]\n// Directional light\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.direction\"), -0.2f, -1.0f, -0.3f);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.diffuse\"), 0.05f, 0.05f, 0.05); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.specular\"), 0.2f, 0.2f, 0.2f);\n// Point light 1\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].position\"), pointLightPositions[0].x, pointLightPositions[0].y, pointLightPositions[0].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].ambient\"), pointLightColors[0].x * 0.1, pointLightColors[0].y * 0.1, pointLightColors[0].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].diffuse\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].specular\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].linear\"), 0.14);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].quadratic\"), 0.07);\t\t\n// Point light 2\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].position\"), pointLightPositions[1].x, pointLightPositions[1].y, pointLightPositions[1].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].ambient\"), pointLightColors[1].x * 0.1, pointLightColors[1].y * 0.1, pointLightColors[1].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].diffuse\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].specular\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].linear\"), 0.14);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].quadratic\"), 0.07);\t\t\n// Point light 3\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].position\"), pointLightPositions[2].x, pointLightPositions[2].y, pointLightPositions[2].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].ambient\"), pointLightColors[2].x * 0.1, pointLightColors[2].y * 0.1, pointLightColors[2].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].diffuse\"), pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].specular\") ,pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].linear\"), 0.22);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].quadratic\"), 0.20);\t\t\n// Point light 4\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].position\"), pointLightPositions[3].x, pointLightPositions[3].y, pointLightPositions[3].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].ambient\"), pointLightColors[3].x * 0.1, pointLightColors[3].y * 0.1, pointLightColors[3].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].diffuse\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].specular\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].linear\"), 0.14);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].quadratic\"), 0.07);\t\t\n// SpotLight\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.position\"), camera.Position.x, camera.Position.y, camera.Position.z);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.direction\"), camera.Front.x, camera.Front.y, camera.Front.z);\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.diffuse\"), 1.0f, 1.0f, 1.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.specular\"), 1.0f, 1.0f, 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.quadratic\"), 0.032);\t\t\t\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.cutOff\"), glm::cos(glm::radians(10.0f)));\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.outerCutOff\"), glm::cos(glm::radians(15.0f)));\n// == ==============================================================================================\n// BIOCHEMICAL LAB\n// == ==============================================================================================\nglClearColor(0.9f, 0.9f, 0.9f, 1.0f);\n[...]\nglm::vec3 pointLightColors[] = {\n glm::vec3(0.4f, 0.7f, 0.1f),\n glm::vec3(0.4f, 0.7f, 0.1f),\n glm::vec3(0.4f, 0.7f, 0.1f),\n glm::vec3(0.4f, 0.7f, 0.1f)\n};\n[...]\n// Directional light\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.direction\"), -0.2f, -1.0f, -0.3f);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.ambient\"), 0.5f, 0.5f, 0.5f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.diffuse\"), 1.0f, 1.0f, 1.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.specular\"), 1.0f, 1.0f, 1.0f);\n// Point light 1\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].position\"), pointLightPositions[0].x, pointLightPositions[0].y, pointLightPositions[0].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].ambient\"), pointLightColors[0].x * 0.1, pointLightColors[0].y * 0.1, pointLightColors[0].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].diffuse\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].specular\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].quadratic\"), 0.017);\t\t\n// Point light 2\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].position\"), pointLightPositions[1].x, pointLightPositions[1].y, pointLightPositions[1].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].ambient\"), pointLightColors[1].x * 0.1, pointLightColors[1].y * 0.1, pointLightColors[1].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].diffuse\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].specular\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].quadratic\"), 0.017);\t\t\n// Point light 3\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].position\"), pointLightPositions[2].x, pointLightPositions[2].y, pointLightPositions[2].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].ambient\"), pointLightColors[2].x * 0.1, pointLightColors[2].y * 0.1, pointLightColors[2].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].diffuse\"), pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].specular\") ,pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].quadratic\"), 0.017);\t\t\n// Point light 4\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].position\"), pointLightPositions[3].x, pointLightPositions[3].y, pointLightPositions[3].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].ambient\"), pointLightColors[3].x * 0.1, pointLightColors[3].y * 0.1, pointLightColors[3].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].diffuse\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].specular\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].quadratic\"), 0.017);\t\t\n// SpotLight\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.position\"), camera.Position.x, camera.Position.y, camera.Position.z);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.direction\"), camera.Front.x, camera.Front.y, camera.Front.z);\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.diffuse\"), 0.0f, 1.0f, 0.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.specular\"), 0.0f, 1.0f, 0.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.quadratic\"), 0.017);\t\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.cutOff\"), glm::cos(glm::radians(7.0f)));\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.outerCutOff\"), glm::cos(glm::radians(10.0f)));\t"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.15, "dedup_hash": "7e84b0f67b4f362f", "has_readme": true} +{"id": "joeydevries_learnopengl_src_3_model_loading_1_model_loading", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "1.Model Loading", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/3.model_loading/1.model_loading/1.model_loading.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{ \n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/3.model_loading/1.model_loading/1.model_loading.vs", "language": "glsl", "loc": 13, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/3.model_loading/1.model_loading/model_loading.cpp", "language": "code", "loc": 157, "comment_density": 0.299, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // tell stb_image.h to flip loaded texture's on the y-axis (before loading model).\n stbi_set_flip_vertically_on_load(true);\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader ourShader(\"1.model_loading.vs\", \"1.model_loading.fs\");\n\n // load models\n // -----------\n Model ourModel(FileSystem::getPath(\"resources/objects/backpack/backpack.obj\"));\n\n \n // draw in wireframe\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.05f, 0.05f, 0.05f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // don't forget to enable shader before setting uniforms\n ourShader.use();\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n ourShader.setMat4(\"projection\", projection);\n ourShader.setMat4(\"view\", view);\n\n // render the loaded model\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 0.0f, 0.0f)); // translate it down so it's at the center of the scene\n model = glm::scale(model, glm::vec3(1.0f, 1.0f, 1.0f));\t// it's a bit too big for our scene, so scale it down\n ourShader.setMat4(\"model\", model);\n ourModel.Draw(ourShader);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.1, "dedup_hash": "7d046dd8b8d0163a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_1_1_depth_testing", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "1.1.Depth Testing", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/1.1.depth_testing/1.1.depth_testing.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/1.1.depth_testing/1.1.depth_testing.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp", "language": "code", "loc": 282, "comment_density": 0.184, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glDepthFunc(GL_ALWAYS); // always pass the depth test (same effect as glDisable(GL_DEPTH_TEST))\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"1.1.depth_testing.vs\", \"1.1.depth_testing.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords (note we set these higher than 1 (together with GL_REPEAT as texture wrapping mode). this will cause the floor texture to repeat)\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\t\t\t\t\t\t\t\t\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while(!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture); \t\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const *path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.061, "dedup_hash": "7877e2d688e4f75c", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_1_2_depth_testing_view", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "1.2.Depth Testing View", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/1.2.depth_testing_view/1.2.depth_testing.fs", "language": "glsl", "loc": 14, "comment_density": 0.143, "code": "#version 330 core\nout vec4 FragColor;\n\nfloat near = 0.1; \nfloat far = 100.0; \nfloat LinearizeDepth(float depth) \n{\n float z = depth * 2.0 - 1.0; // back to NDC \n return (2.0 * near * far) / (far + near - z * (far - near));\t\n}\n\nvoid main()\n{ \n float depth = LinearizeDepth(gl_FragCoord.z) / far; // divide by far to get depth in range [0,1] for visualization purposes\n FragColor = vec4(vec3(depth), 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/1.2.depth_testing_view/1.2.depth_testing.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp", "language": "code", "loc": 282, "comment_density": 0.181, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glDepthFunc(GL_LESS);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"1.2.depth_testing.vs\", \"1.2.depth_testing.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords (note we set these higher than 1 (together with GL_REPEAT as texture wrapping mode). this will cause the floor texture to repeat)\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const *path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.108, "dedup_hash": "20ca2c55f12e3e6c", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_10_1_instancing_quads", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "10.1.Instancing Quads", "api": "OpenGL Core", "glsl_version": null, "topic": "instancing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/10.1.instancing_quads/10.1.instancing.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 fColor;\n\nvoid main()\n{\n FragColor = vec4(fColor, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.1.instancing_quads/10.1.instancing.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aOffset;\n\nout vec3 fColor;\n\nvoid main()\n{\n fColor = aColor;\n gl_Position = vec4(aPos + aOffset, 0.0, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.1.instancing_quads/instancing_quads.cpp", "language": "code", "loc": 125, "comment_density": 0.28, "code": "#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"10.1.instancing.vs\", \"10.1.instancing.fs\");\n\n // generate a list of 100 quad locations/translation-vectors\n // ---------------------------------------------------------\n glm::vec2 translations[100];\n int index = 0;\n float offset = 0.1f;\n for (int y = -10; y < 10; y += 2)\n {\n for (int x = -10; x < 10; x += 2)\n {\n glm::vec2 translation;\n translation.x = (float)x / 10.0f + offset;\n translation.y = (float)y / 10.0f + offset;\n translations[index++] = translation;\n }\n }\n\n // store instance data in an array buffer\n // --------------------------------------\n unsigned int instanceVBO;\n glGenBuffers(1, &instanceVBO);\n glBindBuffer(GL_ARRAY_BUFFER, instanceVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec2) * 100, &translations[0], GL_STATIC_DRAW);\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float quadVertices[] = {\n // positions // colors\n -0.05f, 0.05f, 1.0f, 0.0f, 0.0f,\n 0.05f, -0.05f, 0.0f, 1.0f, 0.0f,\n -0.05f, -0.05f, 0.0f, 0.0f, 1.0f,\n\n -0.05f, 0.05f, 1.0f, 0.0f, 0.0f,\n 0.05f, -0.05f, 0.0f, 1.0f, 0.0f,\n 0.05f, 0.05f, 0.0f, 1.0f, 1.0f\n };\n unsigned int quadVAO, quadVBO;\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(2 * sizeof(float)));\n // also set instance data\n glEnableVertexAttribArray(2);\n glBindBuffer(GL_ARRAY_BUFFER, instanceVBO); // this attribute comes from a different vertex buffer\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0);\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glVertexAttribDivisor(2, 1); // tell OpenGL this is an instanced vertex attribute.\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw 100 instanced quads\n shader.use();\n glBindVertexArray(quadVAO);\n glDrawArraysInstanced(GL_TRIANGLES, 0, 6, 100); // 100 triangles of 6 vertices each\n glBindVertexArray(0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &quadVAO);\n glDeleteBuffers(1, &quadVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.093, "dedup_hash": "ec7493de6623d3ef", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_10_2_asteroids", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "10.2.Asteroids", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/instancing/texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/10.2.asteroids/10.2.instancing.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.2.asteroids/10.2.instancing.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0f); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.2.asteroids/asteroids.cpp", "language": "code", "loc": 187, "comment_density": 0.257, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 55.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"10.2.instancing.vs\", \"10.2.instancing.fs\");\n\n // load models\n // -----------\n Model rock(FileSystem::getPath(\"resources/objects/rock/rock.obj\"));\n Model planet(FileSystem::getPath(\"resources/objects/planet/planet.obj\"));\n\n // generate a large list of semi-random model transformation matrices\n // ------------------------------------------------------------------\n unsigned int amount = 1000;\n glm::mat4* modelMatrices;\n modelMatrices = new glm::mat4[amount];\n srand(static_cast(glfwGetTime())); // initialize random seed\n float radius = 50.0;\n float offset = 2.5f;\n for (unsigned int i = 0; i < amount; i++)\n {\n glm::mat4 model = glm::mat4(1.0f);\n // 1. translation: displace along circle with 'radius' in range [-offset, offset]\n float angle = (float)i / (float)amount * 360.0f;\n float displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float x = sin(angle) * radius + displacement;\n displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float y = displacement * 0.4f; // keep height of asteroid field smaller compared to width of x and z\n displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float z = cos(angle) * radius + displacement;\n model = glm::translate(model, glm::vec3(x, y, z));\n\n // 2. scale: Scale between 0.05 and 0.25f\n float scale = static_cast((rand() % 20) / 100.0 + 0.05);\n model = glm::scale(model, glm::vec3(scale));\n\n // 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector\n float rotAngle = static_cast((rand() % 360));\n model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f));\n\n // 4. now add to list of matrices\n modelMatrices[i] = model;\n }\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure transformation matrices\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);\n glm::mat4 view = camera.GetViewMatrix();;\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n\n // draw planet\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, -3.0f, 0.0f));\n model = glm::scale(model, glm::vec3(4.0f, 4.0f, 4.0f));\n shader.setMat4(\"model\", model);\n planet.Draw(shader);\n\n // draw meteorites\n for (unsigned int i = 0; i < amount; i++)\n {\n shader.setMat4(\"model\", modelMatrices[i]);\n rock.Draw(shader);\n } \n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.086, "dedup_hash": "f180c1595c566626", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_10_3_asteroids_instanced", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "10.3.Asteroids Instanced", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/10.3.asteroids_instanced/10.3.asteroids.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.3.asteroids_instanced/10.3.asteroids.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\nlayout (location = 3) in mat4 aInstanceMatrix;\n\nout vec2 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * aInstanceMatrix * vec4(aPos, 1.0f); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.3.asteroids_instanced/10.3.planet.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.3.asteroids_instanced/10.3.planet.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0f); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp", "language": "code", "loc": 225, "comment_density": 0.249, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 155.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader asteroidShader(\"10.3.asteroids.vs\", \"10.3.asteroids.fs\");\n Shader planetShader(\"10.3.planet.vs\", \"10.3.planet.fs\");\n\n // load models\n // -----------\n Model rock(FileSystem::getPath(\"resources/objects/rock/rock.obj\"));\n Model planet(FileSystem::getPath(\"resources/objects/planet/planet.obj\"));\n\n // generate a large list of semi-random model transformation matrices\n // ------------------------------------------------------------------\n unsigned int amount = 100000;\n glm::mat4* modelMatrices;\n modelMatrices = new glm::mat4[amount];\n srand(static_cast(glfwGetTime())); // initialize random seed\n float radius = 150.0;\n float offset = 25.0f;\n for (unsigned int i = 0; i < amount; i++)\n {\n glm::mat4 model = glm::mat4(1.0f);\n // 1. translation: displace along circle with 'radius' in range [-offset, offset]\n float angle = (float)i / (float)amount * 360.0f;\n float displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float x = sin(angle) * radius + displacement;\n displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float y = displacement * 0.4f; // keep height of asteroid field smaller compared to width of x and z\n displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float z = cos(angle) * radius + displacement;\n model = glm::translate(model, glm::vec3(x, y, z));\n\n // 2. scale: Scale between 0.05 and 0.25f\n float scale = static_cast((rand() % 20) / 100.0 + 0.05);\n model = glm::scale(model, glm::vec3(scale));\n\n // 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector\n float rotAngle = static_cast((rand() % 360));\n model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f));\n\n // 4. now add to list of matrices\n modelMatrices[i] = model;\n }\n\n // configure instanced array\n // -------------------------\n unsigned int buffer;\n glGenBuffers(1, &buffer);\n glBindBuffer(GL_ARRAY_BUFFER, buffer);\n glBufferData(GL_ARRAY_BUFFER, amount * sizeof(glm::mat4), &modelMatrices[0], GL_STATIC_DRAW);\n\n // set transformation matrices as an instance vertex attribute (with divisor 1)\n // note: we're cheating a little by taking the, now publicly declared, VAO of the model's mesh(es) and adding new vertexAttribPointers\n // normally you'd want to do this in a more organized fashion, but for learning purposes this will do.\n // -----------------------------------------------------------------------------------------------------------------------------------\n for (unsigned int i = 0; i < rock.meshes.size(); i++)\n {\n unsigned int VAO = rock.meshes[i].VAO;\n glBindVertexArray(VAO);\n // set attribute pointers for matrix (4 times vec4)\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), (void*)0);\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), (void*)(sizeof(glm::vec4)));\n glEnableVertexAttribArray(5);\n glVertexAttribPointer(5, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), (void*)(2 * sizeof(glm::vec4)));\n glEnableVertexAttribArray(6);\n glVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), (void*)(3 * sizeof(glm::vec4)));\n\n glVertexAttribDivisor(3, 1);\n glVertexAttribDivisor(4, 1);\n glVertexAttribDivisor(5, 1);\n glVertexAttribDivisor(6, 1);\n\n glBindVertexArray(0);\n }\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure transformation matrices\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);\n glm::mat4 view = camera.GetViewMatrix();\n asteroidShader.use();\n asteroidShader.setMat4(\"projection\", projection);\n asteroidShader.setMat4(\"view\", view);\n planetShader.use();\n planetShader.setMat4(\"projection\", projection);\n planetShader.setMat4(\"view\", view);\n \n // draw planet\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, -3.0f, 0.0f));\n model = glm::scale(model, glm::vec3(4.0f, 4.0f, 4.0f));\n planetShader.setMat4(\"model\", model);\n planet.Draw(planetShader);\n\n // draw meteorites\n asteroidShader.use();\n asteroidShader.setInt(\"texture_diffuse1\", 0);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, rock.textures_loaded[0].id); // note: we also made the textures_loaded vector public (instead of private) from the model class.\n for (unsigned int i = 0; i < rock.meshes.size(); i++)\n {\n glBindVertexArray(rock.meshes[i].VAO);\n glDrawElementsInstanced(GL_TRIANGLES, static_cast(rock.meshes[i].indices.size()), GL_UNSIGNED_INT, 0, amount);\n glBindVertexArray(0);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.05, "dedup_hash": "09a41d17509d124b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_11_1_anti_aliasing_msaa", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "11.1.Anti Aliasing Msaa", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/11.1.anti_aliasing_msaa/11.1.anti_aliasing.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.1.anti_aliasing_msaa/11.1.anti_aliasing.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp", "language": "code", "loc": 195, "comment_density": 0.21, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_MULTISAMPLE); // enabled by default on some drivers, but not all so always enable to make sure\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"11.1.anti_aliasing.vs\", \"11.1.anti_aliasing.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions \n -0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n -0.5f, 0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n\n -0.5f, -0.5f, 0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n -0.5f, -0.5f, 0.5f,\n\n -0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n -0.5f, -0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n\n -0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, -0.5f, 0.5f,\n -0.5f, -0.5f, 0.5f,\n -0.5f, -0.5f, -0.5f,\n\n -0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, -0.5f\n };\n // setup cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // set transformation matrices\t\t\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", camera.GetViewMatrix());\n shader.setMat4(\"model\", glm::mat4(1.0f));\n\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36); \n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.07, "dedup_hash": "447d49abda4ae3d8", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_11_2_anti_aliasing_offscreen", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "11.2.Anti Aliasing Offscreen", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/11.2.aa_post.fs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D screenTexture;\n\nvoid main()\n{\n vec3 col = texture(screenTexture, TexCoords).rgb;\n float grayscale = 0.2126 * col.r + 0.7152 * col.g + 0.0722 * col.b;\n FragColor = vec4(vec3(grayscale), 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/11.2.aa_post.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); \n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/11.2.anti_aliasing.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/11.2.anti_aliasing.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp", "language": "code", "loc": 276, "comment_density": 0.207, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"11.2.anti_aliasing.vs\", \"11.2.anti_aliasing.fs\");\n Shader screenShader(\"11.2.aa_post.vs\", \"11.2.aa_post.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions \n -0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n -0.5f, 0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n\n -0.5f, -0.5f, 0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n -0.5f, -0.5f, 0.5f,\n\n -0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n -0.5f, -0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n\n -0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, -0.5f, 0.5f,\n -0.5f, -0.5f, 0.5f,\n -0.5f, -0.5f, -0.5f,\n\n -0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, -0.5f\n };\n float quadVertices[] = { // vertex attributes for a quad that fills the entire screen in Normalized Device Coordinates.\n // positions // texCoords\n -1.0f, 1.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n\n -1.0f, 1.0f, 0.0f, 1.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n 1.0f, 1.0f, 1.0f, 1.0f\n };\n // setup cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n // setup screen VAO\n unsigned int quadVAO, quadVBO;\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));\n\n\n // configure MSAA framebuffer\n // --------------------------\n unsigned int framebuffer;\n glGenFramebuffers(1, &framebuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n // create a multisampled color attachment texture\n unsigned int textureColorBufferMultiSampled;\n glGenTextures(1, &textureColorBufferMultiSampled);\n glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, textureColorBufferMultiSampled);\n glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGB, SCR_WIDTH, SCR_HEIGHT, GL_TRUE);\n glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, textureColorBufferMultiSampled, 0);\n // create a (also multisampled) renderbuffer object for depth and stencil attachments\n unsigned int rbo;\n glGenRenderbuffers(1, &rbo);\n glBindRenderbuffer(GL_RENDERBUFFER, rbo);\n glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH24_STENCIL8, SCR_WIDTH, SCR_HEIGHT);\n glBindRenderbuffer(GL_RENDERBUFFER, 0);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo);\n\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n cout << \"ERROR::FRAMEBUFFER:: Framebuffer is not complete!\" << endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // configure second post-processing framebuffer\n unsigned int intermediateFBO;\n glGenFramebuffers(1, &intermediateFBO);\n glBindFramebuffer(GL_FRAMEBUFFER, intermediateFBO);\n // create a color attachment texture\n unsigned int screenTexture;\n glGenTextures(1, &screenTexture);\n glBindTexture(GL_TEXTURE_2D, screenTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, screenTexture, 0);\t// we only need a color buffer\n\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n cout << \"ERROR::FRAMEBUFFER:: Intermediate framebuffer is not complete!\" << endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // shader configuration\n // --------------------\n screenShader.use();\n screenShader.setInt(\"screenTexture\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. draw scene as normal in multisampled buffers\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n glEnable(GL_DEPTH_TEST);\n\n // set transformation matrices\t\t\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", camera.GetViewMatrix());\n shader.setMat4(\"model\", glm::mat4(1.0f));\n\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n // 2. now blit multisampled buffer(s) to normal colorbuffer of intermediate FBO. Image is stored in screenTexture\n glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);\n glBindFramebuffer(GL_DRAW_FRAMEBUFFER, intermediateFBO);\n glBlitFramebuffer(0, 0, SCR_WIDTH, SCR_HEIGHT, 0, 0, SCR_WIDTH, SCR_HEIGHT, GL_COLOR_BUFFER_BIT, GL_NEAREST);\n\n // 3. now render quad with scene's visuals as its texture image\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n glClearColor(1.0f, 1.0f, 1.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n glDisable(GL_DEPTH_TEST);\n\n // draw Screen quad\n screenShader.use();\n glBindVertexArray(quadVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, screenTexture); // use the now resolved color attachment as the quad's texture\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.041, "dedup_hash": "c9712427cb7440e6", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_2_stencil_testing", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "2.Stencil Testing", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/2.stencil_testing/2.stencil_single_color.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.04, 0.28, 0.26, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/2.stencil_testing/2.stencil_testing.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/2.stencil_testing/2.stencil_testing.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0f);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp", "language": "code", "loc": 322, "comment_density": 0.189, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glDepthFunc(GL_LESS);\n glEnable(GL_STENCIL_TEST);\n glStencilFunc(GL_NOTEQUAL, 1, 0xFF);\n glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"2.stencil_testing.vs\", \"2.stencil_testing.fs\");\n Shader shaderSingleColor(\"2.stencil_testing.vs\", \"2.stencil_single_color.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords (note we set these higher than 1 (together with GL_REPEAT as texture wrapping mode). this will cause the floor texture to repeat)\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // don't forget to clear the stencil buffer!\n\n // set uniforms\n shaderSingleColor.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shaderSingleColor.setMat4(\"view\", view);\n shaderSingleColor.setMat4(\"projection\", projection);\n\n shader.use();\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n\n // draw floor as normal, but don't write the floor to the stencil buffer, we only care about the containers. We set its mask to 0x00 to not write to the stencil buffer.\n glStencilMask(0x00);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // 1st. render pass, draw objects as normal, writing to the stencil buffer\n // --------------------------------------------------------------------\n glStencilFunc(GL_ALWAYS, 1, 0xFF);\n glStencilMask(0xFF);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n // 2nd. render pass: now draw slightly scaled versions of the objects, this time disabling stencil writing.\n // Because the stencil buffer is now filled with several 1s. The parts of the buffer that are 1 are not drawn, thus only drawing \n // the objects' size differences, making it look like borders.\n // -----------------------------------------------------------------------------------------------------------------------------\n glStencilFunc(GL_NOTEQUAL, 1, 0xFF);\n glStencilMask(0x00);\n glDisable(GL_DEPTH_TEST);\n shaderSingleColor.use();\n float scale = 1.1f;\n // cubes\n glBindVertexArray(cubeVAO);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n model = glm::scale(model, glm::vec3(scale, scale, scale));\n shaderSingleColor.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n model = glm::scale(model, glm::vec3(scale, scale, scale));\n shaderSingleColor.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n glStencilMask(0xFF);\n glStencilFunc(GL_ALWAYS, 0, 0xFF);\n glEnable(GL_DEPTH_TEST);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 3, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.047, "dedup_hash": "0d0f06eda545ae4f", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_3_1_blending_discard", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "3.1.Blending Discard", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/3.1.blending_discard/3.1.blending.fs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n vec4 texColor = texture(texture1, TexCoords);\n if(texColor.a < 0.1)\n discard;\n FragColor = texColor;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/3.1.blending_discard/3.1.blending.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp", "language": "code", "loc": 322, "comment_density": 0.18, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.1.blending.vs\", \"3.1.blending.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords \n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n float transparentVertices[] = {\n // positions // texture Coords (swapped y coordinates because texture is flipped upside down)\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,\n 0.0f, -0.5f, 0.0f, 0.0f, 1.0f,\n 1.0f, -0.5f, 0.0f, 1.0f, 1.0f,\n\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,\n 1.0f, -0.5f, 0.0f, 1.0f, 1.0f,\n 1.0f, 0.5f, 0.0f, 1.0f, 0.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // transparent VAO\n unsigned int transparentVAO, transparentVBO;\n glGenVertexArrays(1, &transparentVAO);\n glGenBuffers(1, &transparentVBO);\n glBindVertexArray(transparentVAO);\n glBindBuffer(GL_ARRAY_BUFFER, transparentVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(transparentVertices), transparentVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n unsigned int transparentTexture = loadTexture(FileSystem::getPath(\"resources/textures/grass.png\").c_str());\n\n // transparent vegetation locations\n // --------------------------------\n vector vegetation \n {\n glm::vec3(-1.5f, 0.0f, -0.48f),\n glm::vec3( 1.5f, 0.0f, 0.51f),\n glm::vec3( 0.0f, 0.0f, 0.7f),\n glm::vec3(-0.3f, 0.0f, -2.3f),\n glm::vec3 (0.5f, 0.0f, -0.6f)\n };\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw objects\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // vegetation\n glBindVertexArray(transparentVAO);\n glBindTexture(GL_TEXTURE_2D, transparentTexture);\n for (unsigned int i = 0; i < vegetation.size(); i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, vegetation[i]);\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n }\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.06, "dedup_hash": "fd2126e341bf9bda", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_3_2_blending_sort", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "3.2.Blending Sort", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/3.2.blending_sort/3.2.blending.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/3.2.blending_sort/3.2.blending.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp", "language": "code", "loc": 332, "comment_density": 0.181, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.2.blending.vs\", \"3.2.blending.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords \n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n float transparentVertices[] = {\n // positions // texture Coords (swapped y coordinates because texture is flipped upside down)\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,\n 0.0f, -0.5f, 0.0f, 0.0f, 1.0f,\n 1.0f, -0.5f, 0.0f, 1.0f, 1.0f,\n\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,\n 1.0f, -0.5f, 0.0f, 1.0f, 1.0f,\n 1.0f, 0.5f, 0.0f, 1.0f, 0.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // transparent VAO\n unsigned int transparentVAO, transparentVBO;\n glGenVertexArrays(1, &transparentVAO);\n glGenBuffers(1, &transparentVBO);\n glBindVertexArray(transparentVAO);\n glBindBuffer(GL_ARRAY_BUFFER, transparentVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(transparentVertices), transparentVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n unsigned int transparentTexture = loadTexture(FileSystem::getPath(\"resources/textures/window.png\").c_str());\n\n // transparent window locations\n // --------------------------------\n vector windows\n {\n glm::vec3(-1.5f, 0.0f, -0.48f),\n glm::vec3( 1.5f, 0.0f, 0.51f),\n glm::vec3( 0.0f, 0.0f, 0.7f),\n glm::vec3(-0.3f, 0.0f, -2.3f),\n glm::vec3( 0.5f, 0.0f, -0.6f)\n };\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // sort the transparent windows before rendering\n // ---------------------------------------------\n std::map sorted;\n for (unsigned int i = 0; i < windows.size(); i++)\n {\n float distance = glm::length(camera.Position - windows[i]);\n sorted[distance] = windows[i];\n }\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw objects\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // windows (from furthest to nearest)\n glBindVertexArray(transparentVAO);\n glBindTexture(GL_TEXTURE_2D, transparentTexture);\n for (std::map::reverse_iterator it = sorted.rbegin(); it != sorted.rend(); ++it)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, it->second);\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n }\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.06, "dedup_hash": "ae086ca7dd94e3e3", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_4_face_culling_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "4.Face Culling Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/4.face_culling_exercise1/face_culling_exercise1.cpp", "language": "code", "loc": 48, "comment_density": 0.958, "code": "float vertices[] = {\n // back face\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, // bottom-left\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, // bottom-right \n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right \n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, // bottom-left \n // front face\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, // top-right\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-right \n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, // top-right\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, // top-left \n // left face\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-right\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-left\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-left \n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-left\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-right\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-right\n // right face\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-left\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right \n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-right \n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-right\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-left\n // bottom face \n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // top-right\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-left\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f, // top-left \n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-left\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // top-right\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-right\n // top face\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // bottom-right \n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // bottom-right\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, // bottom-left \n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f // top-left \n};\n\n/* Also make sure to add a call to OpenGL to specify that triangles defined by a clockwise ordering \n are now 'front-facing' triangles so the cube is rendered as normal:\n glFrontFace(GL_CW);\n*/"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.958, "dedup_hash": "e159f0583133b4b3", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_5_1_framebuffers", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "5.1.Framebuffers", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/5.1.framebuffers/5.1.framebuffers.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.1.framebuffers/5.1.framebuffers.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.1.framebuffers/5.1.framebuffers_screen.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D screenTexture;\n\nvoid main()\n{\n vec3 col = texture(screenTexture, TexCoords).rgb;\n FragColor = vec4(col, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.1.framebuffers/5.1.framebuffers_screen.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); \n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp", "language": "code", "loc": 345, "comment_density": 0.206, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"5.1.framebuffers.vs\", \"5.1.framebuffers.fs\");\n Shader screenShader(\"5.1.framebuffers_screen.vs\", \"5.1.framebuffers_screen.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords \n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n float quadVertices[] = { // vertex attributes for a quad that fills the entire screen in Normalized Device Coordinates.\n // positions // texCoords\n -1.0f, 1.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n\n -1.0f, 1.0f, 0.0f, 1.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n 1.0f, 1.0f, 1.0f, 1.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // screen quad VAO\n unsigned int quadVAO, quadVBO;\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/container.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n screenShader.use();\n screenShader.setInt(\"screenTexture\", 0);\n\n // framebuffer configuration\n // -------------------------\n unsigned int framebuffer;\n glGenFramebuffers(1, &framebuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n // create a color attachment texture\n unsigned int textureColorbuffer;\n glGenTextures(1, &textureColorbuffer);\n glBindTexture(GL_TEXTURE_2D, textureColorbuffer);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureColorbuffer, 0);\n // create a renderbuffer object for depth and stencil attachment (we won't be sampling these)\n unsigned int rbo;\n glGenRenderbuffers(1, &rbo);\n glBindRenderbuffer(GL_RENDERBUFFER, rbo);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, SCR_WIDTH, SCR_HEIGHT); // use a single renderbuffer object for both a depth AND stencil buffer.\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); // now actually attach it\n // now that we actually created the framebuffer and added all attachments we want to check if it is actually complete now\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n cout << \"ERROR::FRAMEBUFFER:: Framebuffer is not complete!\" << endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // draw as wireframe\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n\n // render\n // ------\n // bind to framebuffer and draw scene as we normally would to color texture \n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n glEnable(GL_DEPTH_TEST); // enable depth testing (is disabled for rendering screen-space quad)\n\n // make sure we clear the framebuffer's content\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // now bind back to default framebuffer and draw a quad plane with the attached framebuffer color texture\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n glDisable(GL_DEPTH_TEST); // disable depth test so screen-space quad isn't discarded due to depth test.\n // clear all relevant buffers\n glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // set clear color to white (not really necessary actually, since we won't be able to see behind the quad anyways)\n glClear(GL_COLOR_BUFFER_BIT);\n\n screenShader.use();\n glBindVertexArray(quadVAO);\n glBindTexture(GL_TEXTURE_2D, textureColorbuffer);\t// use the color attachment texture as the texture of the quad plane\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteVertexArrays(1, &quadVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n glDeleteBuffers(1, &quadVBO);\n glDeleteRenderbuffers(1, &rbo);\n glDeleteFramebuffers(1, &framebuffer);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.041, "dedup_hash": "65746d2e5892d71d", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_5_2_framebuffers_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:14+00:00", "source_type": "repo", "title": "5.2.Framebuffers Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/5.2.framebuffers.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/5.2.framebuffers.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/5.2.framebuffers_screen.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D screenTexture;\n\nvoid main()\n{\n vec3 col = texture(screenTexture, TexCoords).rgb;\n FragColor = vec4(col, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/5.2.framebuffers_screen.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); \n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp", "language": "code", "loc": 373, "comment_density": 0.212, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"5.2.framebuffers.vs\", \"5.2.framebuffers.fs\");\n Shader screenShader(\"5.2.framebuffers_screen.vs\", \"5.2.framebuffers_screen.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords \n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n float quadVertices[] = { // vertex attributes for a quad that fills the entire screen in Normalized Device Coordinates. NOTE that this plane is now much smaller and at the top of the screen\n // positions // texCoords\n -0.3f, 1.0f, 0.0f, 1.0f,\n -0.3f, 0.7f, 0.0f, 0.0f,\n 0.3f, 0.7f, 1.0f, 0.0f,\n\n -0.3f, 1.0f, 0.0f, 1.0f,\n 0.3f, 0.7f, 1.0f, 0.0f,\n 0.3f, 1.0f, 1.0f, 1.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // screen quad VAO\n unsigned int quadVAO, quadVBO;\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/container.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n screenShader.use();\n screenShader.setInt(\"screenTexture\", 0);\n\n // framebuffer configuration\n // -------------------------\n unsigned int framebuffer;\n glGenFramebuffers(1, &framebuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n // create a color attachment texture\n unsigned int textureColorbuffer;\n glGenTextures(1, &textureColorbuffer);\n glBindTexture(GL_TEXTURE_2D, textureColorbuffer);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureColorbuffer, 0);\n // create a renderbuffer object for depth and stencil attachment (we won't be sampling these)\n unsigned int rbo;\n glGenRenderbuffers(1, &rbo);\n glBindRenderbuffer(GL_RENDERBUFFER, rbo);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, SCR_WIDTH, SCR_HEIGHT); // use a single renderbuffer object for both a depth AND stencil buffer.\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); // now actually attach it\n // now that we actually created the framebuffer and added all attachments we want to check if it is actually complete now\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n cout << \"ERROR::FRAMEBUFFER:: Framebuffer is not complete!\" << endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // draw as wireframe\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n\n // first render pass: mirror texture.\n // bind to framebuffer and draw to color texture as we normally \n // would, but with the view camera reversed.\n // bind to framebuffer and draw scene as we normally would to color texture \n // ------------------------------------------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n glEnable(GL_DEPTH_TEST); // enable depth testing (is disabled for rendering screen-space quad)\n\n // make sure we clear the framebuffer's content\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n camera.Yaw += 180.0f; // rotate the camera's yaw 180 degrees around\n camera.ProcessMouseMovement(0, 0, false); // call this to make sure it updates its camera vectors, note that we disable pitch constrains for this specific case (otherwise we can't reverse camera's pitch values)\n glm::mat4 view = camera.GetViewMatrix();\n camera.Yaw -= 180.0f; // reset it back to its original orientation\n camera.ProcessMouseMovement(0, 0, true); \n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // second render pass: draw as normal\n // ----------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n model = glm::mat4(1.0f);\n view = camera.GetViewMatrix();\n shader.setMat4(\"view\", view);\n\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // now draw the mirror quad with screen texture\n // --------------------------------------------\n glDisable(GL_DEPTH_TEST); // disable depth test so screen-space quad isn't discarded due to depth test.\n\n screenShader.use();\n glBindVertexArray(quadVAO);\n glBindTexture(GL_TEXTURE_2D, textureColorbuffer);\t// use the color attachment texture as the texture of the quad plane\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteVertexArrays(1, &quadVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n glDeleteBuffers(1, &quadVBO);\n glDeleteRenderbuffers(1, &rbo);\n glDeleteFramebuffers(1, &framebuffer);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.042, "dedup_hash": "27361a61d79a2abd", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_6_1_cubemaps_skybox", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:14+00:00", "source_type": "repo", "title": "6.1.Cubemaps Skybox", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/6.1.cubemaps.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/6.1.cubemaps.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/6.1.skybox.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 TexCoords;\n\nuniform samplerCube skybox;\n\nvoid main()\n{ \n FragColor = texture(skybox, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/6.1.skybox.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout vec3 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n TexCoords = aPos;\n vec4 pos = projection * view * vec4(aPos, 1.0);\n gl_Position = pos.xyww;\n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp", "language": "code", "loc": 360, "comment_density": 0.181, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nunsigned int loadCubemap(vector faces);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"6.1.cubemaps.vs\", \"6.1.cubemaps.fs\");\n Shader skyboxShader(\"6.1.skybox.vs\", \"6.1.skybox.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float skyboxVertices[] = {\n // positions \n -1.0f, 1.0f, -1.0f,\n -1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n\n -1.0f, -1.0f, 1.0f,\n -1.0f, -1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, 1.0f,\n -1.0f, -1.0f, 1.0f,\n\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n\n -1.0f, -1.0f, 1.0f,\n -1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 1.0f,\n -1.0f, -1.0f, 1.0f,\n\n -1.0f, 1.0f, -1.0f,\n 1.0f, 1.0f, -1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, -1.0f,\n\n -1.0f, -1.0f, -1.0f,\n -1.0f, -1.0f, 1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n -1.0f, -1.0f, 1.0f,\n 1.0f, -1.0f, 1.0f\n };\n\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // skybox VAO\n unsigned int skyboxVAO, skyboxVBO;\n glGenVertexArrays(1, &skyboxVAO);\n glGenBuffers(1, &skyboxVBO);\n glBindVertexArray(skyboxVAO);\n glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/container.jpg\").c_str());\n\n vector faces\n {\n FileSystem::getPath(\"resources/textures/skybox/right.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/left.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/top.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/bottom.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/front.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/back.jpg\")\n };\n unsigned int cubemapTexture = loadCubemap(faces);\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n skyboxShader.use();\n skyboxShader.setInt(\"skybox\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw scene as normal\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"model\", model);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n\n // draw skybox as last\n glDepthFunc(GL_LEQUAL); // change depth function so depth test passes when values are equal to depth buffer's content\n skyboxShader.use();\n view = glm::mat4(glm::mat3(camera.GetViewMatrix())); // remove translation from the view matrix\n skyboxShader.setMat4(\"view\", view);\n skyboxShader.setMat4(\"projection\", projection);\n // skybox cube\n glBindVertexArray(skyboxVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n glDepthFunc(GL_LESS); // set depth function back to default\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &skyboxVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &skyboxVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n\n// loads a cubemap texture from 6 individual texture faces\n// order:\n// +X (right)\n// -X (left)\n// +Y (top)\n// -Y (bottom)\n// +Z (front) \n// -Z (back)\n// -------------------------------------------------------\nunsigned int loadCubemap(vector faces)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);\n\n int width, height, nrChannels;\n for (unsigned int i = 0; i < faces.size(); i++)\n {\n unsigned char *data = stbi_load(faces[i].c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Cubemap texture failed to load at path: \" << faces[i] << std::endl;\n stbi_image_free(data);\n }\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.036, "dedup_hash": "8d04c782bc3f1696", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_6_2_cubemaps_environment_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:14+00:00", "source_type": "repo", "title": "6.2.Cubemaps Environment Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/6.2.cubemaps.fs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 Normal;\nin vec3 Position;\n\nuniform vec3 cameraPos;\nuniform samplerCube skybox;\n\nvoid main()\n{ \n vec3 I = normalize(Position - cameraPos);\n vec3 R = reflect(I, normalize(Normal));\n FragColor = vec4(texture(skybox, R).rgb, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/6.2.cubemaps.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 Normal;\nout vec3 Position;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n Normal = mat3(transpose(inverse(model))) * aNormal;\n Position = vec3(model * vec4(aPos, 1.0));\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/6.2.skybox.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 TexCoords;\n\nuniform samplerCube skybox;\n\nvoid main()\n{ \n FragColor = texture(skybox, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/6.2.skybox.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout vec3 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n TexCoords = aPos;\n vec4 pos = projection * view * vec4(aPos, 1.0);\n gl_Position = pos.xyww;\n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp", "language": "code", "loc": 360, "comment_density": 0.181, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nunsigned int loadCubemap(vector faces);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"6.2.cubemaps.vs\", \"6.2.cubemaps.fs\");\n Shader skyboxShader(\"6.2.skybox.vs\", \"6.2.skybox.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // normals\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n float skyboxVertices[] = {\n // positions \n -1.0f, 1.0f, -1.0f,\n -1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n\n -1.0f, -1.0f, 1.0f,\n -1.0f, -1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, 1.0f,\n -1.0f, -1.0f, 1.0f,\n\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n\n -1.0f, -1.0f, 1.0f,\n -1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 1.0f,\n -1.0f, -1.0f, 1.0f,\n\n -1.0f, 1.0f, -1.0f,\n 1.0f, 1.0f, -1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, -1.0f,\n\n -1.0f, -1.0f, -1.0f,\n -1.0f, -1.0f, 1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n -1.0f, -1.0f, 1.0f,\n 1.0f, -1.0f, 1.0f\n };\n\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n // skybox VAO\n unsigned int skyboxVAO, skyboxVBO;\n glGenVertexArrays(1, &skyboxVAO);\n glGenBuffers(1, &skyboxVBO);\n glBindVertexArray(skyboxVAO);\n glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n\n // load textures\n // -------------\n vector faces\n {\n FileSystem::getPath(\"resources/textures/skybox/right.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/left.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/top.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/bottom.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/front.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/back.jpg\"),\n };\n unsigned int cubemapTexture = loadCubemap(faces);\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"skybox\", 0);\n\n skyboxShader.use();\n skyboxShader.setInt(\"skybox\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw scene as normal\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"model\", model);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n shader.setVec3(\"cameraPos\", camera.Position);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n\n // draw skybox as last\n glDepthFunc(GL_LEQUAL); // change depth function so depth test passes when values are equal to depth buffer's content\n skyboxShader.use();\n view = glm::mat4(glm::mat3(camera.GetViewMatrix())); // remove translation from the view matrix\n skyboxShader.setMat4(\"view\", view);\n skyboxShader.setMat4(\"projection\", projection);\n // skybox cube\n glBindVertexArray(skyboxVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n glDepthFunc(GL_LESS); // set depth function back to default\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &skyboxVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &skyboxVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n\n// loads a cubemap texture from 6 individual texture faces\n// order:\n// +X (right)\n// -X (left)\n// +Y (top)\n// -Y (bottom)\n// +Z (front) \n// -Z (back)\n// -------------------------------------------------------\nunsigned int loadCubemap(vector faces)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);\n\n int width, height, nrComponents;\n for (unsigned int i = 0; i < faces.size(); i++)\n {\n unsigned char *data = stbi_load(faces[i].c_str(), &width, &height, &nrComponents, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Cubemap texture failed to load at path: \" << faces[i] << std::endl;\n stbi_image_free(data);\n }\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.036, "dedup_hash": "27a9ec9ed5787c05", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_8_advanced_glsl_ubo", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "8.Advanced Glsl Ubo", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.advanced_glsl.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nlayout (std140) uniform Matrices\n{\n mat4 projection;\n mat4 view;\n};\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.blue.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.0, 0.0, 1.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.green.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.red.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.yellow.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp", "language": "code", "loc": 241, "comment_density": 0.232, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shaderRed(\"8.advanced_glsl.vs\", \"8.red.fs\");\n Shader shaderGreen(\"8.advanced_glsl.vs\", \"8.green.fs\");\n Shader shaderBlue(\"8.advanced_glsl.vs\", \"8.blue.fs\");\n Shader shaderYellow(\"8.advanced_glsl.vs\", \"8.yellow.fs\");\n \n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions \n -0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n -0.5f, 0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n\n -0.5f, -0.5f, 0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n -0.5f, -0.5f, 0.5f, \n\n -0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n -0.5f, -0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n\n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n\n -0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, -0.5f, 0.5f, \n -0.5f, -0.5f, 0.5f, \n -0.5f, -0.5f, -0.5f, \n\n -0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, -0.5f, \n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n\n // configure a uniform buffer object\n // ---------------------------------\n // first. We get the relevant block indices\n unsigned int uniformBlockIndexRed = glGetUniformBlockIndex(shaderRed.ID, \"Matrices\");\n unsigned int uniformBlockIndexGreen = glGetUniformBlockIndex(shaderGreen.ID, \"Matrices\");\n unsigned int uniformBlockIndexBlue = glGetUniformBlockIndex(shaderBlue.ID, \"Matrices\");\n unsigned int uniformBlockIndexYellow = glGetUniformBlockIndex(shaderYellow.ID, \"Matrices\");\n // then we link each shader's uniform block to this uniform binding point\n glUniformBlockBinding(shaderRed.ID, uniformBlockIndexRed, 0);\n glUniformBlockBinding(shaderGreen.ID, uniformBlockIndexGreen, 0);\n glUniformBlockBinding(shaderBlue.ID, uniformBlockIndexBlue, 0);\n glUniformBlockBinding(shaderYellow.ID, uniformBlockIndexYellow, 0);\n // Now actually create the buffer\n unsigned int uboMatrices;\n glGenBuffers(1, &uboMatrices);\n glBindBuffer(GL_UNIFORM_BUFFER, uboMatrices);\n glBufferData(GL_UNIFORM_BUFFER, 2 * sizeof(glm::mat4), NULL, GL_STATIC_DRAW);\n glBindBuffer(GL_UNIFORM_BUFFER, 0);\n // define the range of the buffer that links to a uniform binding point\n glBindBufferRange(GL_UNIFORM_BUFFER, 0, uboMatrices, 0, 2 * sizeof(glm::mat4));\n\n // store the projection matrix (we only do this once now) (note: we're not using zoom anymore by changing the FoV)\n glm::mat4 projection = glm::perspective(45.0f, (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glBindBuffer(GL_UNIFORM_BUFFER, uboMatrices);\n glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(glm::mat4), glm::value_ptr(projection));\n glBindBuffer(GL_UNIFORM_BUFFER, 0);\n \n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // set the view and projection matrix in the uniform block - we only have to do this once per loop iteration.\n glm::mat4 view = camera.GetViewMatrix();\n glBindBuffer(GL_UNIFORM_BUFFER, uboMatrices);\n glBufferSubData(GL_UNIFORM_BUFFER, sizeof(glm::mat4), sizeof(glm::mat4), glm::value_ptr(view));\n glBindBuffer(GL_UNIFORM_BUFFER, 0);\n\n // draw 4 cubes \n // RED\n glBindVertexArray(cubeVAO);\n shaderRed.use();\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-0.75f, 0.75f, 0.0f)); // move top-left\n shaderRed.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // GREEN\n shaderGreen.use();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.75f, 0.75f, 0.0f)); // move top-right\n shaderGreen.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // YELLOW\n shaderYellow.use();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-0.75f, -0.75f, 0.0f)); // move bottom-left\n shaderYellow.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // BLUE\n shaderBlue.use();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.75f, -0.75f, 0.0f)); // move bottom-right\n shaderBlue.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteBuffers(1, &cubeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n"}], "validation": {"glslang_valid": 5, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.039, "dedup_hash": "7d80b9d4bf85cf25", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_9_1_geometry_shader_houses", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "9.1.Geometry Shader Houses", "api": "OpenGL Core", "glsl_version": null, "topic": "geometry_shader/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/9.1.geometry_shader_houses/9.1.geometry_shader.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 fColor;\n\nvoid main()\n{\n FragColor = vec4(fColor, 1.0); \n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.1.geometry_shader_houses/9.1.geometry_shader.gs", "language": "glsl", "loc": 26, "comment_density": 0.231, "code": "#version 330 core\nlayout (points) in;\nlayout (triangle_strip, max_vertices = 5) out;\n\nin VS_OUT {\n vec3 color;\n} gs_in[];\n\nout vec3 fColor;\n\nvoid build_house(vec4 position)\n{ \n fColor = gs_in[0].color; // gs_in[0] since there's only one input vertex\n gl_Position = position + vec4(-0.2, -0.2, 0.0, 0.0); // 1:bottom-left \n EmitVertex(); \n gl_Position = position + vec4( 0.2, -0.2, 0.0, 0.0); // 2:bottom-right\n EmitVertex();\n gl_Position = position + vec4(-0.2, 0.2, 0.0, 0.0); // 3:top-left\n EmitVertex();\n gl_Position = position + vec4( 0.2, 0.2, 0.0, 0.0); // 4:top-right\n EmitVertex();\n gl_Position = position + vec4( 0.0, 0.4, 0.0, 0.0); // 5:top\n fColor = vec3(1.0, 1.0, 1.0);\n EmitVertex();\n EndPrimitive();\n}\n\nvoid main() { \n build_house(gl_in[0].gl_Position);\n}", "stage": "geometry", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.1.geometry_shader_houses/9.1.geometry_shader.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec3 aColor;\n\nout VS_OUT {\n vec3 color;\n} vs_out;\n\nvoid main()\n{\n vs_out.color = aColor;\n gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.1.geometry_shader_houses/geometry_shader_houses.cpp", "language": "code", "loc": 94, "comment_density": 0.319, "code": "#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"9.1.geometry_shader.vs\", \"9.1.geometry_shader.fs\", \"9.1.geometry_shader.gs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float points[] = {\n -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, // top-left\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, // top-right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, // bottom-right\n -0.5f, -0.5f, 1.0f, 1.0f, 0.0f // bottom-left\n };\n unsigned int VBO, VAO;\n glGenBuffers(1, &VBO);\n glGenVertexArrays(1, &VAO);\n glBindVertexArray(VAO);\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(points), &points, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), 0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(2 * sizeof(float)));\n glBindVertexArray(0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw points\n shader.use();\n glBindVertexArray(VAO);\n glDrawArrays(GL_POINTS, 0, 4);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n glfwTerminate();\n return 0;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 3, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.138, "dedup_hash": "0013566fe1a83da8", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_9_2_geometry_shader_exploding", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "9.2.Geometry Shader Exploding", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/geometry_shader/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/9.2.geometry_shader_exploding/9.2.geometry_shader.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}\n\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.2.geometry_shader_exploding/9.2.geometry_shader.gs", "language": "glsl", "loc": 33, "comment_density": 0.0, "code": "#version 330 core\nlayout (triangles) in;\nlayout (triangle_strip, max_vertices = 3) out;\n\nin VS_OUT {\n vec2 texCoords;\n} gs_in[];\n\nout vec2 TexCoords; \n\nuniform float time;\n\nvec4 explode(vec4 position, vec3 normal)\n{\n float magnitude = 2.0;\n vec3 direction = normal * ((sin(time) + 1.0) / 2.0) * magnitude; \n return position + vec4(direction, 0.0);\n}\n\nvec3 GetNormal()\n{\n vec3 a = vec3(gl_in[0].gl_Position) - vec3(gl_in[1].gl_Position);\n vec3 b = vec3(gl_in[2].gl_Position) - vec3(gl_in[1].gl_Position);\n return normalize(cross(a, b));\n}\n\nvoid main() { \n vec3 normal = GetNormal();\n\n gl_Position = explode(gl_in[0].gl_Position, normal);\n TexCoords = gs_in[0].texCoords;\n EmitVertex();\n gl_Position = explode(gl_in[1].gl_Position, normal);\n TexCoords = gs_in[1].texCoords;\n EmitVertex();\n gl_Position = explode(gl_in[2].gl_Position, normal);\n TexCoords = gs_in[2].texCoords;\n EmitVertex();\n EndPrimitive();\n}", "stage": "geometry", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.2.geometry_shader_exploding/9.2.geometry_shader.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\n\nout VS_OUT {\n vec2 texCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n vs_out.texCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp", "language": "code", "loc": 151, "comment_density": 0.265, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"9.2.geometry_shader.vs\", \"9.2.geometry_shader.fs\", \"9.2.geometry_shader.gs\");\n\n // load models\n // -----------\n Model nanosuit(FileSystem::getPath(\"resources/objects/nanosuit/nanosuit.obj\")); \n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure transformation matrices\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 1.0f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();;\n glm::mat4 model = glm::mat4(1.0f);\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"model\", model);\n\n // add time component to geometry shader in the form of a uniform\n shader.setFloat(\"time\", static_cast(glfwGetTime()));\n\n // draw model\n nanosuit.Draw(shader);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 3, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.066, "dedup_hash": "8056bca5065bc9e9", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_9_3_geometry_shader_normals", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "9.3.Geometry Shader Normals", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/geometry_shader/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.default.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}\n\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.default.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.normal_visualization.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\n\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.normal_visualization.gs", "language": "glsl", "loc": 22, "comment_density": 0.136, "code": "#version 330 core\nlayout (triangles) in;\nlayout (line_strip, max_vertices = 6) out;\n\nin VS_OUT {\n vec3 normal;\n} gs_in[];\n\nconst float MAGNITUDE = 0.2;\n\nuniform mat4 projection;\n\nvoid GenerateLine(int index)\n{\n gl_Position = projection * gl_in[index].gl_Position;\n EmitVertex();\n gl_Position = projection * (gl_in[index].gl_Position + vec4(gs_in[index].normal, 0.0) * MAGNITUDE);\n EmitVertex();\n EndPrimitive();\n}\n\nvoid main()\n{\n GenerateLine(0); // first vertex normal\n GenerateLine(1); // second vertex normal\n GenerateLine(2); // third vertex normal\n}", "stage": "geometry", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.normal_visualization.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout VS_OUT {\n vec3 normal;\n} vs_out;\n\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n mat3 normalMatrix = mat3(transpose(inverse(view * model)));\n vs_out.normal = vec3(vec4(normalMatrix * aNormal, 0.0));\n gl_Position = view * model * vec4(aPos, 1.0); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp", "language": "code", "loc": 157, "comment_density": 0.255, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"9.3.default.vs\", \"9.3.default.fs\");\n Shader normalShader(\"9.3.normal_visualization.vs\", \"9.3.normal_visualization.fs\", \"9.3.normal_visualization.gs\");\n\n // load models\n // -----------\n stbi_set_flip_vertically_on_load(true);\n Model backpack(FileSystem::getPath(\"resources/objects/backpack/backpack.obj\"));\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure transformation matrices\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 1.0f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();;\n glm::mat4 model = glm::mat4(1.0f);\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"model\", model);\n\n // draw model as usual\n backpack.Draw(shader);\n\n // then draw model with normal visualizing geometry shader\n normalShader.use();\n normalShader.setMat4(\"projection\", projection);\n normalShader.setMat4(\"view\", view);\n normalShader.setMat4(\"model\", model);\n\n backpack.Draw(normalShader);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 5, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.065, "dedup_hash": "02bfee350ad6a2bb", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_1_advanced_lighting", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "1.Advanced Lighting", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/1.advanced_lighting/1.advanced_lighting.fs", "language": "glsl", "loc": 38, "comment_density": 0.105, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D floorTexture;\nuniform vec3 lightPos;\nuniform vec3 viewPos;\nuniform bool blinn;\n\nvoid main()\n{ \n vec3 color = texture(floorTexture, fs_in.TexCoords).rgb;\n // ambient\n vec3 ambient = 0.05 * color;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n vec3 normal = normalize(fs_in.Normal);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * color;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n if(blinn)\n {\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);\n }\n else\n {\n vec3 reflectDir = reflect(-lightDir, normal);\n spec = pow(max(dot(viewDir, reflectDir), 0.0), 8.0);\n }\n vec3 specular = vec3(0.3) * spec; // assuming bright white light color\n FragColor = vec4(ambient + diffuse + specular, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/1.advanced_lighting/1.advanced_lighting.vs", "language": "glsl", "loc": 19, "comment_density": 0.053, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\n// declare an interface block; see 'Advanced GLSL' for what these are.\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n vs_out.FragPos = aPos;\n vs_out.Normal = aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp", "language": "code", "loc": 238, "comment_density": 0.223, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool blinn = false;\nbool blinnKeyPressed = false;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"1.advanced_lighting.vs\", \"1.advanced_lighting.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f,\n -10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f,\n\n 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f,\n -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f,\n 10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 10.0f\n };\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n \n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.0f, 0.0f, 0.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw objects\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setInt(\"blinn\", blinn);\n // floor\n glBindVertexArray(planeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n std::cout << (blinn ? \"Blinn-Phong\" : \"Phong\") << std::endl;\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_B) == GLFW_PRESS && !blinnKeyPressed) \n {\n blinn = !blinn;\n blinnKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_B) == GLFW_RELEASE) \n {\n blinnKeyPressed = false;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.127, "dedup_hash": "d38c3523fc41cdb3", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_2_gamma_correction", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "2.Gamma Correction", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/2.gamma_correction/2.gamma_correction.fs", "language": "glsl", "loc": 44, "comment_density": 0.068, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D floorTexture;\n\nuniform vec3 lightPositions[4];\nuniform vec3 lightColors[4];\nuniform vec3 viewPos;\nuniform bool gamma;\n\nvec3 BlinnPhong(vec3 normal, vec3 fragPos, vec3 lightPos, vec3 lightColor)\n{\n // diffuse\n vec3 lightDir = normalize(lightPos - fragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // simple attenuation\n float max_distance = 1.5;\n float distance = length(lightPos - fragPos);\n float attenuation = 1.0 / (gamma ? distance * distance : distance);\n \n diffuse *= attenuation;\n specular *= attenuation;\n \n return diffuse + specular;\n}\n\nvoid main()\n{ \n vec3 color = texture(floorTexture, fs_in.TexCoords).rgb;\n vec3 lighting = vec3(0.0);\n for(int i = 0; i < 4; ++i)\n lighting += BlinnPhong(normalize(fs_in.Normal), fs_in.FragPos, lightPositions[i], lightColors[i]);\n color *= lighting;\n if(gamma)\n color = pow(color, vec3(1.0/2.2));\n FragColor = vec4(color, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/2.gamma_correction/2.gamma_correction.vs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n vs_out.FragPos = aPos;\n vs_out.Normal = aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp", "language": "code", "loc": 260, "comment_density": 0.2, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool gammaEnabled = false;\nbool gammaKeyPressed = false;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"2.gamma_correction.vs\", \"2.gamma_correction.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f,\n -10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f,\n\n 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f,\n -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f,\n 10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 10.0f\n };\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str(), false);\n unsigned int floorTextureGammaCorrected = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str(), true);\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"floorTexture\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPositions[] = {\n glm::vec3(-3.0f, 0.0f, 0.0f),\n glm::vec3(-1.0f, 0.0f, 0.0f),\n glm::vec3 (1.0f, 0.0f, 0.0f),\n glm::vec3 (3.0f, 0.0f, 0.0f)\n };\n glm::vec3 lightColors[] = {\n glm::vec3(0.25),\n glm::vec3(0.50),\n glm::vec3(0.75),\n glm::vec3(1.00)\n };\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw objects\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n glUniform3fv(glGetUniformLocation(shader.ID, \"lightPositions\"), 4, &lightPositions[0][0]);\n glUniform3fv(glGetUniformLocation(shader.ID, \"lightColors\"), 4, &lightColors[0][0]);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setInt(\"gamma\", gammaEnabled);\n // floor\n glBindVertexArray(planeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, gammaEnabled ? floorTextureGammaCorrected : floorTexture);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n std::cout << (gammaEnabled ? \"Gamma enabled\" : \"Gamma disabled\") << std::endl;\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !gammaKeyPressed)\n {\n gammaEnabled = !gammaEnabled;\n gammaKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)\n {\n gammaKeyPressed = false;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path, bool gammaCorrection)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum internalFormat;\n GLenum dataFormat;\n if (nrComponents == 1)\n {\n internalFormat = dataFormat = GL_RED;\n }\n else if (nrComponents == 3)\n {\n internalFormat = gammaCorrection ? GL_SRGB : GL_RGB;\n dataFormat = GL_RGB;\n }\n else if (nrComponents == 4)\n {\n internalFormat = gammaCorrection ? GL_SRGB_ALPHA : GL_RGBA;\n dataFormat = GL_RGBA;\n }\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, dataFormat, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.089, "dedup_hash": "03692b7620da2b45", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_1_1_shadow_mapping_depth", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:16+00:00", "source_type": "repo", "title": "3.1.1.Shadow Mapping Depth", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/3.1.1.debug_quad.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/3.1.1.debug_quad_depth.fs", "language": "glsl", "loc": 18, "comment_density": 0.222, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D depthMap;\nuniform float near_plane;\nuniform float far_plane;\n\n// required when using a perspective projection matrix\nfloat LinearizeDepth(float depth)\n{\n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));\t\n}\n\nvoid main()\n{ \n float depthValue = texture(depthMap, TexCoords).r;\n // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective\n FragColor = vec4(vec3(depthValue), 1.0); // orthographic\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/3.1.1.shadow_mapping_depth.fs", "language": "glsl", "loc": 5, "comment_density": 0.2, "code": "#version 330 core\n\nvoid main()\n{ \n // gl_FragDepth = gl_FragCoord.z;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/3.1.1.shadow_mapping_depth.vs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 lightSpaceMatrix;\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = lightSpaceMatrix * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp", "language": "code", "loc": 395, "comment_density": 0.296, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// meshes\nunsigned int planeVAO;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader simpleDepthShader(\"3.1.1.shadow_mapping_depth.vs\", \"3.1.1.shadow_mapping_depth.fs\");\n Shader debugDepthQuad(\"3.1.1.debug_quad.vs\", \"3.1.1.debug_quad_depth.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n 25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 25.0f\n };\n // plane VAO\n unsigned int planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth texture\n unsigned int depthMap;\n glGenTextures(1, &depthMap);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n debugDepthQuad.use();\n debugDepthQuad.setInt(\"depthMap\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(-2.0f, 4.0f, -1.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render depth of scene to texture (from light's perspective)\n // --------------------------------------------------------------\n glm::mat4 lightProjection, lightView;\n glm::mat4 lightSpaceMatrix;\n float near_plane = 1.0f, far_plane = 7.5f;\n lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);\n lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));\n lightSpaceMatrix = lightProjection * lightView;\n // render scene from light's point of view\n simpleDepthShader.use();\n simpleDepthShader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // reset viewport\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // render Depth map to quad for visual debugging\n // ---------------------------------------------\n debugDepthQuad.use();\n debugDepthQuad.setFloat(\"near_plane\", near_plane);\n debugDepthQuad.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // floor\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glBindVertexArray(planeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 1.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, 2.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.25));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.144, "dedup_hash": "302a9ab1f17beeb9", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_1_2_shadow_mapping_base", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:16+00:00", "source_type": "repo", "title": "3.1.2.Shadow Mapping Base", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/shadows/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.debug_quad.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.debug_quad_depth.fs", "language": "glsl", "loc": 18, "comment_density": 0.222, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D depthMap;\nuniform float near_plane;\nuniform float far_plane;\n\n// required when using a perspective projection matrix\nfloat LinearizeDepth(float depth)\n{\n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));\t\n}\n\nvoid main()\n{ \n float depthValue = texture(depthMap, TexCoords).r;\n // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective\n FragColor = vec4(vec3(depthValue), 1.0); // orthographic\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.shadow_mapping.fs", "language": "glsl", "loc": 49, "comment_density": 0.184, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n vec4 FragPosLightSpace;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform sampler2D shadowMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nfloat ShadowCalculation(vec4 fragPosLightSpace)\n{\n // perform perspective divide\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n // transform to [0,1] range\n projCoords = projCoords * 0.5 + 0.5;\n // get closest depth value from light's perspective (using [0,1] range fragPosLight as coords)\n float closestDepth = texture(shadowMap, projCoords.xy).r; \n // get depth of current fragment from light's perspective\n float currentDepth = projCoords.z;\n // check whether current frag pos is in shadow\n float shadow = currentDepth > closestDepth ? 1.0 : 0.0;\n\n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * lightColor;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = ShadowCalculation(fs_in.FragPosLightSpace); \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.shadow_mapping.vs", "language": "glsl", "loc": 23, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n vec4 FragPosLightSpace;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat4 lightSpaceMatrix;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n vs_out.FragPosLightSpace = lightSpaceMatrix * vec4(vs_out.FragPos, 1.0);\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.shadow_mapping_depth.fs", "language": "glsl", "loc": 5, "comment_density": 0.2, "code": "#version 330 core\n\nvoid main()\n{ \n // gl_FragDepth = gl_FragCoord.z;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.shadow_mapping_depth.vs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 lightSpaceMatrix;\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = lightSpaceMatrix * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/shadow_mapping_base.cpp", "language": "code", "loc": 415, "comment_density": 0.292, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// meshes\nunsigned int planeVAO;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.1.2.shadow_mapping.vs\", \"3.1.2.shadow_mapping.fs\");\n Shader simpleDepthShader(\"3.1.2.shadow_mapping_depth.vs\", \"3.1.2.shadow_mapping_depth.fs\");\n Shader debugDepthQuad(\"3.1.2.debug_quad.vs\", \"3.1.2.debug_quad_depth.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n 25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 25.0f\n };\n // plane VAO\n unsigned int planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth texture\n unsigned int depthMap;\n glGenTextures(1, &depthMap);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"shadowMap\", 1);\n debugDepthQuad.use();\n debugDepthQuad.setInt(\"depthMap\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(-2.0f, 4.0f, -1.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render depth of scene to texture (from light's perspective)\n // --------------------------------------------------------------\n glm::mat4 lightProjection, lightView;\n glm::mat4 lightSpaceMatrix;\n float near_plane = 1.0f, far_plane = 7.5f;\n lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);\n lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));\n lightSpaceMatrix = lightProjection * lightView;\n // render scene from light's point of view\n simpleDepthShader.use();\n simpleDepthShader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // reset viewport\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 2. render scene as normal using the generated depth/shadow map \n // --------------------------------------------------------------\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n renderScene(shader);\n\n // render Depth map to quad for visual debugging\n // ---------------------------------------------\n debugDepthQuad.use();\n debugDepthQuad.setFloat(\"near_plane\", near_plane);\n debugDepthQuad.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n //renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // floor\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glBindVertexArray(planeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 1.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, 2.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.25));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.128, "dedup_hash": "658856556258338a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_1_3_shadow_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:17+00:00", "source_type": "repo", "title": "3.1.3.Shadow Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/shadows/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.debug_quad.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.debug_quad_depth.fs", "language": "glsl", "loc": 18, "comment_density": 0.222, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D depthMap;\nuniform float near_plane;\nuniform float far_plane;\n\n// required when using a perspective projection matrix\nfloat LinearizeDepth(float depth)\n{\n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));\t\n}\n\nvoid main()\n{ \n float depthValue = texture(depthMap, TexCoords).r;\n // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective\n FragColor = vec4(vec3(depthValue), 1.0); // orthographic\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.shadow_mapping.fs", "language": "glsl", "loc": 68, "comment_density": 0.191, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n vec4 FragPosLightSpace;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform sampler2D shadowMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nfloat ShadowCalculation(vec4 fragPosLightSpace)\n{\n // perform perspective divide\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n // transform to [0,1] range\n projCoords = projCoords * 0.5 + 0.5;\n // get closest depth value from light's perspective (using [0,1] range fragPosLight as coords)\n float closestDepth = texture(shadowMap, projCoords.xy).r; \n // get depth of current fragment from light's perspective\n float currentDepth = projCoords.z;\n // calculate bias (based on depth map resolution and slope)\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float bias = max(0.05 * (1.0 - dot(normal, lightDir)), 0.005);\n // check whether current frag pos is in shadow\n // float shadow = currentDepth - bias > closestDepth ? 1.0 : 0.0;\n // PCF\n float shadow = 0.0;\n vec2 texelSize = 1.0 / textureSize(shadowMap, 0);\n for(int x = -1; x <= 1; ++x)\n {\n for(int y = -1; y <= 1; ++y)\n {\n float pcfDepth = texture(shadowMap, projCoords.xy + vec2(x, y) * texelSize).r; \n shadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0; \n } \n }\n shadow /= 9.0;\n \n // keep the shadow at 0.0 when outside the far_plane region of the light's frustum.\n if(projCoords.z > 1.0)\n shadow = 0.0;\n \n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * lightColor;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = ShadowCalculation(fs_in.FragPosLightSpace); \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.shadow_mapping.vs", "language": "glsl", "loc": 23, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n vec4 FragPosLightSpace;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat4 lightSpaceMatrix;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n vs_out.FragPosLightSpace = lightSpaceMatrix * vec4(vs_out.FragPos, 1.0);\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.shadow_mapping_depth.fs", "language": "glsl", "loc": 5, "comment_density": 0.2, "code": "#version 330 core\n\nvoid main()\n{ \n // gl_FragDepth = gl_FragCoord.z;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.shadow_mapping_depth.vs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 lightSpaceMatrix;\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = lightSpaceMatrix * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp", "language": "code", "loc": 422, "comment_density": 0.299, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// meshes\nunsigned int planeVAO;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.1.3.shadow_mapping.vs\", \"3.1.3.shadow_mapping.fs\");\n Shader simpleDepthShader(\"3.1.3.shadow_mapping_depth.vs\", \"3.1.3.shadow_mapping_depth.fs\");\n Shader debugDepthQuad(\"3.1.3.debug_quad.vs\", \"3.1.3.debug_quad_depth.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n 25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 25.0f\n };\n // plane VAO\n unsigned int planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth texture\n unsigned int depthMap;\n glGenTextures(1, &depthMap);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);\n float borderColor[] = { 1.0, 1.0, 1.0, 1.0 };\n glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"shadowMap\", 1);\n debugDepthQuad.use();\n debugDepthQuad.setInt(\"depthMap\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(-2.0f, 4.0f, -1.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // change light position over time\n //lightPos.x = sin(glfwGetTime()) * 3.0f;\n //lightPos.z = cos(glfwGetTime()) * 2.0f;\n //lightPos.y = 5.0 + cos(glfwGetTime()) * 1.0f;\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render depth of scene to texture (from light's perspective)\n // --------------------------------------------------------------\n glm::mat4 lightProjection, lightView;\n glm::mat4 lightSpaceMatrix;\n float near_plane = 1.0f, far_plane = 7.5f;\n //lightProjection = glm::perspective(glm::radians(45.0f), (GLfloat)SHADOW_WIDTH / (GLfloat)SHADOW_HEIGHT, near_plane, far_plane); // note that if you use a perspective projection matrix you'll have to change the light position as the current light position isn't enough to reflect the whole scene\n lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);\n lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));\n lightSpaceMatrix = lightProjection * lightView;\n // render scene from light's point of view\n simpleDepthShader.use();\n simpleDepthShader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // reset viewport\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 2. render scene as normal using the generated depth/shadow map \n // --------------------------------------------------------------\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n renderScene(shader);\n\n // render Depth map to quad for visual debugging\n // ---------------------------------------------\n debugDepthQuad.use();\n debugDepthQuad.setFloat(\"near_plane\", near_plane);\n debugDepthQuad.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n //renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // floor\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glBindVertexArray(planeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 1.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, 2.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.25));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.13, "dedup_hash": "39e33187786c4c28", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_2_1_point_shadows", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:17+00:00", "source_type": "repo", "title": "3.2.1.Point Shadows", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/geometry_shader/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows.fs", "language": "glsl", "loc": 53, "comment_density": 0.226, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform samplerCube depthMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nuniform float far_plane;\nuniform bool shadows;\n\nfloat ShadowCalculation(vec3 fragPos)\n{\n // get vector between fragment position and light position\n vec3 fragToLight = fragPos - lightPos;\n // ise the fragment to light vector to sample from the depth map \n float closestDepth = texture(depthMap, fragToLight).r;\n // it is currently in linear range between [0,1], let's re-transform it back to original depth value\n closestDepth *= far_plane;\n // now get current linear depth as the length between the fragment and light position\n float currentDepth = length(fragToLight);\n // test for shadows\n float bias = 0.05; // we use a much larger bias since depth is now in [near_plane, far_plane] range\n float shadow = currentDepth - bias > closestDepth ? 1.0 : 0.0; \n // display closestDepth as debug (to visualize depth cubemap)\n // FragColor = vec4(vec3(closestDepth / far_plane), 1.0); \n \n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * lightColor;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = shadows ? ShadowCalculation(fs_in.FragPos) : 0.0; \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows.vs", "language": "glsl", "loc": 24, "comment_density": 0.042, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform bool reverse_normals;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n if(reverse_normals) // a slight hack to make sure the outer large cube displays lighting from the 'inside' instead of the default 'outside'.\n vs_out.Normal = transpose(inverse(mat3(model))) * (-1.0 * aNormal);\n else\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows_depth.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nin vec4 FragPos;\n\nuniform vec3 lightPos;\nuniform float far_plane;\n\nvoid main()\n{\n float lightDistance = length(FragPos.xyz - lightPos);\n \n // map to [0;1] range by dividing by far_plane\n lightDistance = lightDistance / far_plane;\n \n // write this as modified depth\n gl_FragDepth = lightDistance;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows_depth.gs", "language": "glsl", "loc": 19, "comment_density": 0.158, "code": "#version 330 core\nlayout (triangles) in;\nlayout (triangle_strip, max_vertices=18) out;\n\nuniform mat4 shadowMatrices[6];\n\nout vec4 FragPos; // FragPos from GS (output per emitvertex)\n\nvoid main()\n{\n for(int face = 0; face < 6; ++face)\n {\n gl_Layer = face; // built-in variable that specifies to which face we render.\n for(int i = 0; i < 3; ++i) // for each triangle's vertices\n {\n FragPos = gl_in[i].gl_Position;\n gl_Position = shadowMatrices[face] * FragPos;\n EmitVertex();\n } \n EndPrimitive();\n }\n} ", "stage": "geometry", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows_depth.vs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp", "language": "code", "loc": 378, "comment_density": 0.296, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool shadows = true;\nbool shadowsKeyPressed = false;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_CULL_FACE);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.2.1.point_shadows.vs\", \"3.2.1.point_shadows.fs\");\n Shader simpleDepthShader(\"3.2.1.point_shadows_depth.vs\", \"3.2.1.point_shadows_depth.fs\", \"3.2.1.point_shadows_depth.gs\"); \n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth cubemap texture\n unsigned int depthCubemap;\n glGenTextures(1, &depthCubemap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, depthCubemap);\n for (unsigned int i = 0; i < 6; ++i)\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthCubemap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"depthMap\", 1);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.0f, 0.0f, 0.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // move light position over time\n lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 0. create depth cubemap transformation matrices\n // -----------------------------------------------\n float near_plane = 1.0f;\n float far_plane = 25.0f;\n glm::mat4 shadowProj = glm::perspective(glm::radians(90.0f), (float)SHADOW_WIDTH / (float)SHADOW_HEIGHT, near_plane, far_plane);\n std::vector shadowTransforms;\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n\n // 1. render scene to depth cubemap\n // --------------------------------\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n simpleDepthShader.use();\n for (unsigned int i = 0; i < 6; ++i)\n simpleDepthShader.setMat4(\"shadowMatrices[\" + std::to_string(i) + \"]\", shadowTransforms[i]);\n simpleDepthShader.setFloat(\"far_plane\", far_plane);\n simpleDepthShader.setVec3(\"lightPos\", lightPos);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 2. render scene as normal \n // -------------------------\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set lighting uniforms\n shader.setVec3(\"lightPos\", lightPos);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setInt(\"shadows\", shadows); // enable/disable shadows by pressing 'SPACE'\n shader.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_CUBE_MAP, depthCubemap);\n renderScene(shader);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // room cube\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::scale(model, glm::vec3(5.0f));\n shader.setMat4(\"model\", model);\n glDisable(GL_CULL_FACE); // note that we disable culling here since we render 'inside' the cube instead of the usual 'outside' which throws off the normal culling methods.\n shader.setInt(\"reverse_normals\", 1); // A small little hack to invert normals when drawing cube from the inside so lighting still works.\n renderCube();\n shader.setInt(\"reverse_normals\", 0); // and of course disable it\n glEnable(GL_CULL_FACE);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(4.0f, -3.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 3.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.75f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-3.0f, -1.0f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.5f, 1.0f, 1.5));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.5f, 2.0f, -3.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.75f));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !shadowsKeyPressed)\n {\n shadows = !shadows;\n shadowsKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)\n {\n shadowsKeyPressed = false;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 5, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.148, "dedup_hash": "9a5a1b3890cccae0", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_2_2_point_shadows_soft", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:17+00:00", "source_type": "repo", "title": "3.2.2.Point Shadows Soft", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/shadows/geometry_shader/texturing/framebuffer", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows.fs", "language": "glsl", "loc": 94, "comment_density": 0.383, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform samplerCube depthMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nuniform float far_plane;\nuniform bool shadows;\n\n\n// array of offset direction for sampling\nvec3 gridSamplingDisk[20] = vec3[]\n(\n vec3(1, 1, 1), vec3( 1, -1, 1), vec3(-1, -1, 1), vec3(-1, 1, 1), \n vec3(1, 1, -1), vec3( 1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1),\n vec3(1, 1, 0), vec3( 1, -1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0),\n vec3(1, 0, 1), vec3(-1, 0, 1), vec3( 1, 0, -1), vec3(-1, 0, -1),\n vec3(0, 1, 1), vec3( 0, -1, 1), vec3( 0, -1, -1), vec3( 0, 1, -1)\n);\n\nfloat ShadowCalculation(vec3 fragPos)\n{\n // get vector between fragment position and light position\n vec3 fragToLight = fragPos - lightPos;\n // use the fragment to light vector to sample from the depth map \n // float closestDepth = texture(depthMap, fragToLight).r;\n // it is currently in linear range between [0,1], let's re-transform it back to original depth value\n // closestDepth *= far_plane;\n // now get current linear depth as the length between the fragment and light position\n float currentDepth = length(fragToLight);\n // test for shadows\n // float bias = 0.05; // we use a much larger bias since depth is now in [near_plane, far_plane] range\n // float shadow = currentDepth - bias > closestDepth ? 1.0 : 0.0;\n // PCF\n // float shadow = 0.0;\n // float bias = 0.05; \n // float samples = 4.0;\n // float offset = 0.1;\n // for(float x = -offset; x < offset; x += offset / (samples * 0.5))\n // {\n // for(float y = -offset; y < offset; y += offset / (samples * 0.5))\n // {\n // for(float z = -offset; z < offset; z += offset / (samples * 0.5))\n // {\n // float closestDepth = texture(depthMap, fragToLight + vec3(x, y, z)).r; // use lightdir to lookup cubemap\n // closestDepth *= far_plane; // Undo mapping [0;1]\n // if(currentDepth - bias > closestDepth)\n // shadow += 1.0;\n // }\n // }\n // }\n // shadow /= (samples * samples * samples);\n float shadow = 0.0;\n float bias = 0.15;\n int samples = 20;\n float viewDistance = length(viewPos - fragPos);\n float diskRadius = (1.0 + (viewDistance / far_plane)) / 25.0;\n for(int i = 0; i < samples; ++i)\n {\n float closestDepth = texture(depthMap, fragToLight + gridSamplingDisk[i] * diskRadius).r;\n closestDepth *= far_plane; // undo mapping [0;1]\n if(currentDepth - bias > closestDepth)\n shadow += 1.0;\n }\n shadow /= float(samples);\n \n // display closestDepth as debug (to visualize depth cubemap)\n // FragColor = vec4(vec3(closestDepth / far_plane), 1.0); \n \n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * lightColor;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = shadows ? ShadowCalculation(fs_in.FragPos) : 0.0; \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows.vs", "language": "glsl", "loc": 24, "comment_density": 0.042, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform bool reverse_normals;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n if(reverse_normals) // a slight hack to make sure the outer large cube displays lighting from the 'inside' instead of the default 'outside'.\n vs_out.Normal = transpose(inverse(mat3(model))) * (-1.0 * aNormal);\n else\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows_depth.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nin vec4 FragPos;\n\nuniform vec3 lightPos;\nuniform float far_plane;\n\nvoid main()\n{\n float lightDistance = length(FragPos.xyz - lightPos);\n \n // map to [0;1] range by dividing by far_plane\n lightDistance = lightDistance / far_plane;\n \n // write this as modified depth\n gl_FragDepth = lightDistance;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows_depth.gs", "language": "glsl", "loc": 19, "comment_density": 0.158, "code": "#version 330 core\nlayout (triangles) in;\nlayout (triangle_strip, max_vertices=18) out;\n\nuniform mat4 shadowMatrices[6];\n\nout vec4 FragPos; // FragPos from GS (output per emitvertex)\n\nvoid main()\n{\n for(int face = 0; face < 6; ++face)\n {\n gl_Layer = face; // built-in variable that specifies to which face we render.\n for(int i = 0; i < 3; ++i) // for each triangle's vertices\n {\n FragPos = gl_in[i].gl_Position;\n gl_Position = shadowMatrices[face] * FragPos;\n EmitVertex();\n } \n EndPrimitive();\n }\n} ", "stage": "geometry", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows_depth.vs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp", "language": "code", "loc": 378, "comment_density": 0.296, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool shadows = true;\nbool shadowsKeyPressed = false;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_CULL_FACE);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.2.2.point_shadows.vs\", \"3.2.2.point_shadows.fs\");\n Shader simpleDepthShader(\"3.2.2.point_shadows_depth.vs\", \"3.2.2.point_shadows_depth.fs\", \"3.2.2.point_shadows_depth.gs\");\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth cubemap texture\n unsigned int depthCubemap;\n glGenTextures(1, &depthCubemap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, depthCubemap);\n for (unsigned int i = 0; i < 6; ++i)\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthCubemap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"depthMap\", 1);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.0f, 0.0f, 0.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // move light position over time\n lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 0. create depth cubemap transformation matrices\n // -----------------------------------------------\n float near_plane = 1.0f;\n float far_plane = 25.0f;\n glm::mat4 shadowProj = glm::perspective(glm::radians(90.0f), (float)SHADOW_WIDTH / (float)SHADOW_HEIGHT, near_plane, far_plane);\n std::vector shadowTransforms;\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n\n // 1. render scene to depth cubemap\n // --------------------------------\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n simpleDepthShader.use();\n for (unsigned int i = 0; i < 6; ++i)\n simpleDepthShader.setMat4(\"shadowMatrices[\" + std::to_string(i) + \"]\", shadowTransforms[i]);\n simpleDepthShader.setFloat(\"far_plane\", far_plane);\n simpleDepthShader.setVec3(\"lightPos\", lightPos);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 2. render scene as normal \n // -------------------------\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set lighting uniforms\n shader.setVec3(\"lightPos\", lightPos);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setInt(\"shadows\", shadows); // enable/disable shadows by pressing 'SPACE'\n shader.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_CUBE_MAP, depthCubemap);\n renderScene(shader);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // room cube\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::scale(model, glm::vec3(5.0f));\n shader.setMat4(\"model\", model);\n glDisable(GL_CULL_FACE); // note that we disable culling here since we render 'inside' the cube instead of the usual 'outside' which throws off the normal culling methods.\n shader.setInt(\"reverse_normals\", 1); // A small little hack to invert normals when drawing cube from the inside so lighting still works.\n renderCube();\n shader.setInt(\"reverse_normals\", 0); // and of course disable it\n glEnable(GL_CULL_FACE);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(4.0f, -3.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 3.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.75f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-3.0f, -1.0f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.5f, 1.0f, 1.5));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.5f, 2.0f, -3.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.75f));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !shadowsKeyPressed)\n {\n shadows = !shadows;\n shadowsKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)\n {\n shadowsKeyPressed = false;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 5, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.174, "dedup_hash": "70c0e6825e1a1dba", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_3_csm", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:17+00:00", "source_type": "repo", "title": "3.3.Csm", "api": "OpenGL Core", "glsl_version": null, "topic": "shadows/texturing/basics/camera", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.3.csm/csm.cpp", "language": "code", "loc": 248, "comment_density": 0.177, "code": "// Std. Includes\n#include \n\n// GLEW\n#define GLEW_STATIC\n#include \n\n// GLFW\n#include \n\n// GL includes\n#include \n#include \n\n// GLM Mathematics\n#include \n#include \n#include \n\n// Other Libs\n#include \n\n// Properties\nGLuint screenWidth = 800, screenHeight = 600;\n\n// Function prototypes\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid Do_Movement();\nGLuint loadTexture(GLchar const * path);\n\n// Camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nbool keys[1024];\nGLfloat lastX = 400, lastY = 300;\nbool firstMouse = true;\n\nGLfloat deltaTime = 0.0f;\nGLfloat lastFrame = 0.0f;\n\n// The MAIN function, from here we start our application and run our Game loop\nint main()\n{\n // Init GLFW\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // uncomment this statement to fix compilation on OS X\n#endif\n\n GLFWwindow* window = glfwCreateWindow(screenWidth, screenHeight, \"LearnOpenGL\", nullptr, nullptr); // Windowed\n glfwMakeContextCurrent(window);\n\n // Set the required callback functions\n glfwSetKeyCallback(window, key_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // Options\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // Initialize GLEW to setup the OpenGL Function pointers\n glewExperimental = GL_TRUE;\n glewInit();\n\n // Define the viewport dimensions\n glViewport(0, 0, screenWidth, screenHeight);\n\n // Setup some OpenGL options\n glEnable(GL_DEPTH_TEST);\n // glDepthFunc(GL_ALWAYS); // Set to always pass the depth test (same effect as glDisable(GL_DEPTH_TEST))\n\n // Setup and compile our shaders\n Shader shader(\"depth_testing.vs\", \"depth_testing.frag\");\n\n #pragma region \"object_initialization\"\n // Set the object data (buffers, vertex attributes)\n GLfloat cubeVertices[] = {\n // Positions // Texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n GLfloat planeVertices[] = {\n // Positions // Texture Coords (note we set these higher than 1 that together with GL_REPEAT as texture wrapping mode will cause the floor texture to repeat)\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\t\t\t\t\t\t\t\t\n };\n // Setup cube VAO\n GLuint cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));\n glBindVertexArray(0);\n // Setup plane VAO\n GLuint planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));\n glBindVertexArray(0);\n\n // Load textures\n GLuint cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n GLuint floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n #pragma endregion\n\n // Game loop\n while(!glfwWindowShouldClose(window))\n {\n // Set frame time\n GLfloat currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // Check and call events\n glfwPollEvents();\n Do_Movement();\n\n // Clear the colorbuffer\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // Draw objects\n shader.Use(); \n glm::mat4 model;\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(camera.Zoom, (float)screenWidth/(float)screenHeight, 0.1f, 100.0f);\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"view\"), 1, GL_FALSE, glm::value_ptr(view));\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"projection\"), 1, GL_FALSE, glm::value_ptr(projection));\n // Cubes\n glBindVertexArray(cubeVAO);\n glBindTexture(GL_TEXTURE_2D, cubeTexture); // We omit the glActiveTexture part since TEXTURE0 is already the default active texture unit. (sampler used in fragment is set to 0 as well as default)\t\t\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"model\"), 1, GL_FALSE, glm::value_ptr(model));\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4();\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"model\"), 1, GL_FALSE, glm::value_ptr(model));\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // Floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n model = glm::mat4();\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"model\"), 1, GL_FALSE, glm::value_ptr(model));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\t\t\t\t\n\n\n // Swap the buffers\n glfwSwapBuffers(window);\n }\n\n glfwTerminate();\n return 0;\n}\n\n// This function loads a texture from file. Note: texture loading functions like these are usually \n// managed by a 'Resource Manager' that manages all resources (like textures, models, audio). \n// For learning purposes we'll just define it as a utility function.\nGLuint loadTexture(GLchar const * path)\n{\n //Generate texture ID and load texture data \n GLuint textureID;\n glGenTextures(1, &textureID);\n int width,height;\n unsigned char* image = SOIL_load_image(path, &width, &height, 0, SOIL_LOAD_RGB);\n // Assign texture to ID\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);\n glGenerateMipmap(GL_TEXTURE_2D);\t\n\n // Parameters\n glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );\n glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );\n glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );\n glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glBindTexture(GL_TEXTURE_2D, 0);\n SOIL_free_image_data(image);\n return textureID;\n\n}\n\n#pragma region \"User input\"\n\n// Moves/alters the camera positions based on user input\nvoid Do_Movement()\n{\n // Camera controls\n if(keys[GLFW_KEY_W])\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if(keys[GLFW_KEY_S])\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if(keys[GLFW_KEY_A])\n camera.ProcessKeyboard(LEFT, deltaTime);\n if(keys[GLFW_KEY_D])\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// Is called whenever a key is pressed/released via GLFW\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)\n{\n if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)\n glfwSetWindowShouldClose(window, GL_TRUE);\n\n if(action == GLFW_PRESS)\n keys[key] = true;\n else if(action == GLFW_RELEASE)\n keys[key] = false;\t\n}\n\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n if(firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n GLfloat xoffset = xpos - lastX;\n GLfloat yoffset = lastY - ypos; \n \n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\t\n\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(yoffset);\n}\n\n#pragma endregion\n"}, {"path": "src/5.advanced_lighting/3.3.csm/csm.fs", "language": "glsl", "loc": 14, "comment_density": 0.143, "code": "#version 330 core\nout vec4 color;\n\nfloat LinearizeDepth(float depth) // Note that this ranges from [0,1] instead of up to 'far plane distance' since we divide by 'far'\n{\n float near = 0.1; \n float far = 100.0; \n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near) / (far + near - z * (far - near));\t\n}\n\nvoid main()\n{ \n float depth = LinearizeDepth(gl_FragCoord.z);\n color = vec4(vec3(depth), 1.0f);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.3.csm/csm.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 position;\nlayout (location = 1) in vec2 texCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(position, 1.0f);\n TexCoords = texCoords;\n}", "stage": "vertex", "validation_status": "valid"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.107, "dedup_hash": "f327f57dc43d8642", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_4_normal_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:18+00:00", "source_type": "repo", "title": "4.Normal Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/4.normal_mapping/4.normal_mapping.fs", "language": "glsl", "loc": 35, "comment_density": 0.2, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} fs_in;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D normalMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nvoid main()\n{ \n // obtain normal from normal map in range [0,1]\n vec3 normal = texture(normalMap, fs_in.TexCoords).rgb;\n // transform normal vector to range [-1,1]\n normal = normalize(normal * 2.0 - 1.0); // this normal is in tangent space\n \n // get diffuse color\n vec3 color = texture(diffuseMap, fs_in.TexCoords).rgb;\n // ambient\n vec3 ambient = 0.1 * color;\n // diffuse\n vec3 lightDir = normalize(fs_in.TangentLightPos - fs_in.TangentFragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * color;\n // specular\n vec3 viewDir = normalize(fs_in.TangentViewPos - fs_in.TangentFragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n vec3 halfwayDir = normalize(lightDir + viewDir); \n float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);\n\n vec3 specular = vec3(0.2) * spec;\n FragColor = vec4(ambient + diffuse + specular, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/4.normal_mapping/4.normal_mapping.vs", "language": "glsl", "loc": 33, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\nlayout (location = 3) in vec3 aTangent;\nlayout (location = 4) in vec3 aBitangent;\n\nout VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); \n vs_out.TexCoords = aTexCoords;\n \n mat3 normalMatrix = transpose(inverse(mat3(model)));\n vec3 T = normalize(normalMatrix * aTangent);\n vec3 N = normalize(normalMatrix * aNormal);\n T = normalize(T - dot(T, N) * N);\n vec3 B = cross(N, T);\n \n mat3 TBN = transpose(mat3(T, B, N)); \n vs_out.TangentLightPos = TBN * lightPos;\n vs_out.TangentViewPos = TBN * viewPos;\n vs_out.TangentFragPos = TBN * vs_out.FragPos;\n \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp", "language": "code", "loc": 285, "comment_density": 0.211, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"4.normal_mapping.vs\", \"4.normal_mapping.fs\");\n\n // load textures\n // -------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/brickwall.jpg\").c_str());\n unsigned int normalMap = loadTexture(FileSystem::getPath(\"resources/textures/brickwall_normal.jpg\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseMap\", 0);\n shader.setInt(\"normalMap\", 1);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.5f, 1.0f, 0.3f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure view/projection matrices\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // render normal-mapped quad\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::rotate(model, glm::radians((float)glfwGetTime() * -10.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0))); // rotate the quad to show normal mapping from multiple directions\n shader.setMat4(\"model\", model);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, normalMap);\n renderQuad();\n\n // render light source (simply re-renders a smaller plane at the light's position for debugging/visualization)\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.1f));\n shader.setMat4(\"model\", model);\n renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders a 1x1 quad in NDC with manually calculated tangent vectors\n// ------------------------------------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n // positions\n glm::vec3 pos1(-1.0f, 1.0f, 0.0f);\n glm::vec3 pos2(-1.0f, -1.0f, 0.0f);\n glm::vec3 pos3( 1.0f, -1.0f, 0.0f);\n glm::vec3 pos4( 1.0f, 1.0f, 0.0f);\n // texture coordinates\n glm::vec2 uv1(0.0f, 1.0f);\n glm::vec2 uv2(0.0f, 0.0f);\n glm::vec2 uv3(1.0f, 0.0f); \n glm::vec2 uv4(1.0f, 1.0f);\n // normal vector\n glm::vec3 nm(0.0f, 0.0f, 1.0f);\n\n // calculate tangent/bitangent vectors of both triangles\n glm::vec3 tangent1, bitangent1;\n glm::vec3 tangent2, bitangent2;\n // triangle 1\n // ----------\n glm::vec3 edge1 = pos2 - pos1;\n glm::vec3 edge2 = pos3 - pos1;\n glm::vec2 deltaUV1 = uv2 - uv1;\n glm::vec2 deltaUV2 = uv3 - uv1;\n\n float f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent1.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent1.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent1.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n\n bitangent1.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent1.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent1.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n\n // triangle 2\n // ----------\n edge1 = pos3 - pos1;\n edge2 = pos4 - pos1;\n deltaUV1 = uv3 - uv1;\n deltaUV2 = uv4 - uv1;\n\n f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent2.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent2.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent2.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n\n\n bitangent2.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent2.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent2.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n\n\n float quadVertices[] = {\n // positions // normal // texcoords // tangent // bitangent\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos2.x, pos2.y, pos2.z, nm.x, nm.y, nm.z, uv2.x, uv2.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos4.x, pos4.y, pos4.z, nm.x, nm.y, nm.z, uv4.x, uv4.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z\n };\n // configure plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(8 * sizeof(float)));\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(11 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.137, "dedup_hash": "8e936dde2a68b7ff", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_5_1_parallax_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:18+00:00", "source_type": "repo", "title": "5.1.Parallax Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/framebuffer/terrain", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/5.1.parallax_mapping/5.1.parallax_mapping.fs", "language": "glsl", "loc": 44, "comment_density": 0.136, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} fs_in;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D normalMap;\nuniform sampler2D depthMap;\n\nuniform float heightScale;\n\nvec2 ParallaxMapping(vec2 texCoords, vec3 viewDir)\n{ \n float height = texture(depthMap, texCoords).r; \n return texCoords - viewDir.xy * (height * heightScale); \n}\n\nvoid main()\n{ \n // offset texture coordinates with Parallax Mapping\n vec3 viewDir = normalize(fs_in.TangentViewPos - fs_in.TangentFragPos);\n vec2 texCoords = fs_in.TexCoords;\n \n texCoords = ParallaxMapping(fs_in.TexCoords, viewDir); \n if(texCoords.x > 1.0 || texCoords.y > 1.0 || texCoords.x < 0.0 || texCoords.y < 0.0)\n discard;\n\n // obtain normal from normal map\n vec3 normal = texture(normalMap, texCoords).rgb;\n normal = normalize(normal * 2.0 - 1.0); \n \n // get diffuse color\n vec3 color = texture(diffuseMap, texCoords).rgb;\n // ambient\n vec3 ambient = 0.1 * color;\n // diffuse\n vec3 lightDir = normalize(fs_in.TangentLightPos - fs_in.TangentFragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * color;\n // specular \n vec3 reflectDir = reflect(-lightDir, normal);\n vec3 halfwayDir = normalize(lightDir + viewDir); \n float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);\n\n vec3 specular = vec3(0.2) * spec;\n FragColor = vec4(ambient + diffuse + specular, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/5.1.parallax_mapping/5.1.parallax_mapping.vs", "language": "glsl", "loc": 31, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\nlayout (location = 3) in vec3 aTangent;\nlayout (location = 4) in vec3 aBitangent;\n\nout VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); \n vs_out.TexCoords = aTexCoords; \n \n vec3 T = normalize(mat3(model) * aTangent);\n vec3 B = normalize(mat3(model) * aBitangent);\n vec3 N = normalize(mat3(model) * aNormal);\n mat3 TBN = transpose(mat3(T, B, N));\n\n vs_out.TangentLightPos = TBN * lightPos;\n vs_out.TangentViewPos = TBN * viewPos;\n vs_out.TangentFragPos = TBN * vs_out.FragPos;\n \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/5.1.parallax_mapping/parallax_mapping.cpp", "language": "code", "loc": 313, "comment_density": 0.201, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nfloat heightScale = 0.1f;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"5.1.parallax_mapping.vs\", \"5.1.parallax_mapping.fs\");\n\n // load textures\n // -------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2.jpg\").c_str());\n unsigned int normalMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2_normal.jpg\").c_str());\n unsigned int heightMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2_disp.jpg\").c_str());\n /* unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_diffuse.png\").c_str());\n unsigned int normalMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_normal.png\").c_str());\n unsigned int heightMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_disp.png\").c_str());*/\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseMap\", 0);\n shader.setInt(\"normalMap\", 1);\n shader.setInt(\"depthMap\", 2);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.5f, 1.0f, 0.3f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure view/projection matrices\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // render parallax-mapped quad\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::rotate(model, glm::radians((float)glfwGetTime() * -10.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0))); // rotate the quad to show parallax mapping from multiple directions\n shader.setMat4(\"model\", model);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setFloat(\"heightScale\", heightScale); // adjust with Q and E keys\n std::cout << heightScale << std::endl;\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, normalMap);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, heightMap);\n renderQuad();\n\n // render light source (simply re-renders a smaller plane at the light's position for debugging/visualization)\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.1f));\n shader.setMat4(\"model\", model);\n renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders a 1x1 quad in NDC with manually calculated tangent vectors\n// ------------------------------------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n // positions\n glm::vec3 pos1(-1.0f, 1.0f, 0.0f);\n glm::vec3 pos2(-1.0f, -1.0f, 0.0f);\n glm::vec3 pos3( 1.0f, -1.0f, 0.0f);\n glm::vec3 pos4( 1.0f, 1.0f, 0.0f);\n // texture coordinates\n glm::vec2 uv1(0.0f, 1.0f);\n glm::vec2 uv2(0.0f, 0.0f);\n glm::vec2 uv3(1.0f, 0.0f);\n glm::vec2 uv4(1.0f, 1.0f);\n // normal vector\n glm::vec3 nm(0.0f, 0.0f, 1.0f);\n\n // calculate tangent/bitangent vectors of both triangles\n glm::vec3 tangent1, bitangent1;\n glm::vec3 tangent2, bitangent2;\n // triangle 1\n // ----------\n glm::vec3 edge1 = pos2 - pos1;\n glm::vec3 edge2 = pos3 - pos1;\n glm::vec2 deltaUV1 = uv2 - uv1;\n glm::vec2 deltaUV2 = uv3 - uv1;\n\n float f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent1.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent1.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent1.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n tangent1 = glm::normalize(tangent1);\n\n bitangent1.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent1.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent1.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n bitangent1 = glm::normalize(bitangent1);\n\n // triangle 2\n // ----------\n edge1 = pos3 - pos1;\n edge2 = pos4 - pos1;\n deltaUV1 = uv3 - uv1;\n deltaUV2 = uv4 - uv1;\n\n f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent2.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent2.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent2.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n tangent2 = glm::normalize(tangent2);\n\n\n bitangent2.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent2.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent2.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n bitangent2 = glm::normalize(bitangent2);\n\n\n float quadVertices[] = {\n // positions // normal // texcoords // tangent // bitangent\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos2.x, pos2.y, pos2.z, nm.x, nm.y, nm.z, uv2.x, uv2.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos4.x, pos4.y, pos4.z, nm.x, nm.y, nm.z, uv4.x, uv4.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z\n };\n // configure plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(8 * sizeof(float)));\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(11 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS) \n {\n if (heightScale > 0.0f) \n heightScale -= 0.0005f;\n else \n heightScale = 0.0f;\n }\n else if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS) \n {\n if (heightScale < 1.0f) \n heightScale += 0.0005f;\n else \n heightScale = 1.0f;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.112, "dedup_hash": "f3eb83c68bfd7414", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_5_2_steep_parallax_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:18+00:00", "source_type": "repo", "title": "5.2.Steep Parallax Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/framebuffer/terrain", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/5.2.steep_parallax_mapping/5.2.parallax_mapping.fs", "language": "glsl", "loc": 66, "comment_density": 0.212, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} fs_in;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D normalMap;\nuniform sampler2D depthMap;\n\nuniform float heightScale;\n\nvec2 ParallaxMapping(vec2 texCoords, vec3 viewDir)\n{ \n // number of depth layers\n const float minLayers = 8;\n const float maxLayers = 32;\n float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0.0, 0.0, 1.0), viewDir))); \n // calculate the size of each layer\n float layerDepth = 1.0 / numLayers;\n // depth of current layer\n float currentLayerDepth = 0.0;\n // the amount to shift the texture coordinates per layer (from vector P)\n vec2 P = viewDir.xy / viewDir.z * heightScale; \n vec2 deltaTexCoords = P / numLayers;\n \n // get initial values\n vec2 currentTexCoords = texCoords;\n float currentDepthMapValue = texture(depthMap, currentTexCoords).r;\n \n while(currentLayerDepth < currentDepthMapValue)\n {\n // shift texture coordinates along direction of P\n currentTexCoords -= deltaTexCoords;\n // get depthmap value at current texture coordinates\n currentDepthMapValue = texture(depthMap, currentTexCoords).r; \n // get depth of next layer\n currentLayerDepth += layerDepth; \n }\n \n return currentTexCoords;\n}\n\nvoid main()\n{ \n // offset texture coordinates with Parallax Mapping\n vec3 viewDir = normalize(fs_in.TangentViewPos - fs_in.TangentFragPos);\n vec2 texCoords = fs_in.TexCoords;\n \n texCoords = ParallaxMapping(fs_in.TexCoords, viewDir); \n if(texCoords.x > 1.0 || texCoords.y > 1.0 || texCoords.x < 0.0 || texCoords.y < 0.0)\n discard;\n\n // obtain normal from normal map\n vec3 normal = texture(normalMap, texCoords).rgb;\n normal = normalize(normal * 2.0 - 1.0); \n \n // get diffuse color\n vec3 color = texture(diffuseMap, texCoords).rgb;\n // ambient\n vec3 ambient = 0.1 * color;\n // diffuse\n vec3 lightDir = normalize(fs_in.TangentLightPos - fs_in.TangentFragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * color;\n // specular \n vec3 reflectDir = reflect(-lightDir, normal);\n vec3 halfwayDir = normalize(lightDir + viewDir); \n float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);\n\n vec3 specular = vec3(0.2) * spec;\n FragColor = vec4(ambient + diffuse + specular, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/5.2.steep_parallax_mapping/5.2.parallax_mapping.vs", "language": "glsl", "loc": 31, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\nlayout (location = 3) in vec3 aTangent;\nlayout (location = 4) in vec3 aBitangent;\n\nout VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); \n vs_out.TexCoords = aTexCoords; \n \n vec3 T = normalize(mat3(model) * aTangent);\n vec3 B = normalize(mat3(model) * aBitangent);\n vec3 N = normalize(mat3(model) * aNormal);\n mat3 TBN = transpose(mat3(T, B, N));\n\n vs_out.TangentLightPos = TBN * lightPos;\n vs_out.TangentViewPos = TBN * viewPos;\n vs_out.TangentFragPos = TBN * vs_out.FragPos;\n \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/5.2.steep_parallax_mapping/steep_parallax_mapping.cpp", "language": "code", "loc": 313, "comment_density": 0.201, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nfloat heightScale = 0.1f;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"5.2.parallax_mapping.vs\", \"5.2.parallax_mapping.fs\");\n\n // load textures\n // -------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2.jpg\").c_str());\n unsigned int normalMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2_normal.jpg\").c_str());\n unsigned int heightMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2_disp.jpg\").c_str());\n /* unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_diffuse.png\").c_str());\n unsigned int normalMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_normal.png\").c_str());\n unsigned int heightMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_disp.png\").c_str());*/\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseMap\", 0);\n shader.setInt(\"normalMap\", 1);\n shader.setInt(\"depthMap\", 2);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.5f, 1.0f, 0.3f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure view/projection matrices\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // render parallax-mapped quad\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::rotate(model, glm::radians((float)glfwGetTime() * -10.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0))); // rotate the quad to show parallax mapping from multiple directions\n shader.setMat4(\"model\", model);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setFloat(\"heightScale\", heightScale); // adjust with Q and E keys\n std::cout << heightScale << std::endl;\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, normalMap);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, heightMap);\n renderQuad();\n\n // render light source (simply re-renders a smaller plane at the light's position for debugging/visualization)\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.1f));\n shader.setMat4(\"model\", model);\n renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders a 1x1 quad in NDC with manually calculated tangent vectors\n// ------------------------------------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n // positions\n glm::vec3 pos1(-1.0f, 1.0f, 0.0f);\n glm::vec3 pos2(-1.0f, -1.0f, 0.0f);\n glm::vec3 pos3( 1.0f, -1.0f, 0.0f);\n glm::vec3 pos4( 1.0f, 1.0f, 0.0f);\n // texture coordinates\n glm::vec2 uv1(0.0f, 1.0f);\n glm::vec2 uv2(0.0f, 0.0f);\n glm::vec2 uv3(1.0f, 0.0f);\n glm::vec2 uv4(1.0f, 1.0f);\n // normal vector\n glm::vec3 nm(0.0f, 0.0f, 1.0f);\n\n // calculate tangent/bitangent vectors of both triangles\n glm::vec3 tangent1, bitangent1;\n glm::vec3 tangent2, bitangent2;\n // triangle 1\n // ----------\n glm::vec3 edge1 = pos2 - pos1;\n glm::vec3 edge2 = pos3 - pos1;\n glm::vec2 deltaUV1 = uv2 - uv1;\n glm::vec2 deltaUV2 = uv3 - uv1;\n\n float f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent1.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent1.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent1.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n tangent1 = glm::normalize(tangent1);\n\n bitangent1.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent1.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent1.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n bitangent1 = glm::normalize(bitangent1);\n\n // triangle 2\n // ----------\n edge1 = pos3 - pos1;\n edge2 = pos4 - pos1;\n deltaUV1 = uv3 - uv1;\n deltaUV2 = uv4 - uv1;\n\n f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent2.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent2.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent2.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n tangent2 = glm::normalize(tangent2);\n\n\n bitangent2.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent2.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent2.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n bitangent2 = glm::normalize(bitangent2);\n\n\n float quadVertices[] = {\n // positions // normal // texcoords // tangent // bitangent\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos2.x, pos2.y, pos2.z, nm.x, nm.y, nm.z, uv2.x, uv2.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos4.x, pos4.y, pos4.z, nm.x, nm.y, nm.z, uv4.x, uv4.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z\n };\n // configure plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(8 * sizeof(float)));\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(11 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)\n {\n if (heightScale > 0.0f)\n heightScale -= 0.0005f;\n else\n heightScale = 0.0f;\n }\n else if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)\n {\n if (heightScale < 1.0f)\n heightScale += 0.0005f;\n else\n heightScale = 1.0f;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.138, "dedup_hash": "12d88076f7a3ff76", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_5_3_parallax_occlusion_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:18+00:00", "source_type": "repo", "title": "5.3.Parallax Occlusion Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/framebuffer/terrain", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/5.3.parallax_occlusion_mapping/5.3.parallax_mapping.fs", "language": "glsl", "loc": 74, "comment_density": 0.23, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} fs_in;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D normalMap;\nuniform sampler2D depthMap;\n\nuniform float heightScale;\n\nvec2 ParallaxMapping(vec2 texCoords, vec3 viewDir)\n{ \n // number of depth layers\n const float minLayers = 8;\n const float maxLayers = 32;\n float numLayers = mix(maxLayers, minLayers, abs(dot(vec3(0.0, 0.0, 1.0), viewDir))); \n // calculate the size of each layer\n float layerDepth = 1.0 / numLayers;\n // depth of current layer\n float currentLayerDepth = 0.0;\n // the amount to shift the texture coordinates per layer (from vector P)\n vec2 P = viewDir.xy / viewDir.z * heightScale; \n vec2 deltaTexCoords = P / numLayers;\n \n // get initial values\n vec2 currentTexCoords = texCoords;\n float currentDepthMapValue = texture(depthMap, currentTexCoords).r;\n \n while(currentLayerDepth < currentDepthMapValue)\n {\n // shift texture coordinates along direction of P\n currentTexCoords -= deltaTexCoords;\n // get depthmap value at current texture coordinates\n currentDepthMapValue = texture(depthMap, currentTexCoords).r; \n // get depth of next layer\n currentLayerDepth += layerDepth; \n }\n \n // get texture coordinates before collision (reverse operations)\n vec2 prevTexCoords = currentTexCoords + deltaTexCoords;\n\n // get depth after and before collision for linear interpolation\n float afterDepth = currentDepthMapValue - currentLayerDepth;\n float beforeDepth = texture(depthMap, prevTexCoords).r - currentLayerDepth + layerDepth;\n \n // interpolation of texture coordinates\n float weight = afterDepth / (afterDepth - beforeDepth);\n vec2 finalTexCoords = prevTexCoords * weight + currentTexCoords * (1.0 - weight);\n\n return finalTexCoords;\n}\n\nvoid main()\n{ \n // offset texture coordinates with Parallax Mapping\n vec3 viewDir = normalize(fs_in.TangentViewPos - fs_in.TangentFragPos);\n vec2 texCoords = fs_in.TexCoords;\n \n texCoords = ParallaxMapping(fs_in.TexCoords, viewDir); \n if(texCoords.x > 1.0 || texCoords.y > 1.0 || texCoords.x < 0.0 || texCoords.y < 0.0)\n discard;\n\n // obtain normal from normal map\n vec3 normal = texture(normalMap, texCoords).rgb;\n normal = normalize(normal * 2.0 - 1.0); \n \n // get diffuse color\n vec3 color = texture(diffuseMap, texCoords).rgb;\n // ambient\n vec3 ambient = 0.1 * color;\n // diffuse\n vec3 lightDir = normalize(fs_in.TangentLightPos - fs_in.TangentFragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * color;\n // specular \n vec3 reflectDir = reflect(-lightDir, normal);\n vec3 halfwayDir = normalize(lightDir + viewDir); \n float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);\n\n vec3 specular = vec3(0.2) * spec;\n FragColor = vec4(ambient + diffuse + specular, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/5.3.parallax_occlusion_mapping/5.3.parallax_mapping.vs", "language": "glsl", "loc": 31, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\nlayout (location = 3) in vec3 aTangent;\nlayout (location = 4) in vec3 aBitangent;\n\nout VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); \n vs_out.TexCoords = aTexCoords; \n \n vec3 T = normalize(mat3(model) * aTangent);\n vec3 B = normalize(mat3(model) * aBitangent);\n vec3 N = normalize(mat3(model) * aNormal);\n mat3 TBN = transpose(mat3(T, B, N));\n\n vs_out.TangentLightPos = TBN * lightPos;\n vs_out.TangentViewPos = TBN * viewPos;\n vs_out.TangentFragPos = TBN * vs_out.FragPos;\n \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/5.3.parallax_occlusion_mapping/parallax_occlusion_mapping.cpp", "language": "code", "loc": 313, "comment_density": 0.201, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nfloat heightScale = 0.1f;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"5.3.parallax_mapping.vs\", \"5.3.parallax_mapping.fs\");\n\n // load textures\n // -------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2.jpg\").c_str());\n unsigned int normalMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2_normal.jpg\").c_str());\n unsigned int heightMap = loadTexture(FileSystem::getPath(\"resources/textures/bricks2_disp.jpg\").c_str());\n /*unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_diffuse.png\").c_str());\n unsigned int normalMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_normal.png\").c_str());\n unsigned int heightMap = loadTexture(FileSystem::getPath(\"resources/textures/toy_box_disp.png\").c_str());*/\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseMap\", 0);\n shader.setInt(\"normalMap\", 1);\n shader.setInt(\"depthMap\", 2);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.5f, 1.0f, 0.3f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure view/projection matrices\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // render parallax-mapped quad\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::rotate(model, glm::radians((float)glfwGetTime() * -10.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0))); // rotate the quad to show parallax mapping from multiple directions\n shader.setMat4(\"model\", model);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setFloat(\"heightScale\", heightScale); // adjust with Q and E keys\n std::cout << heightScale << std::endl;\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, normalMap);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, heightMap);\n renderQuad();\n\n // render light source (simply re-renders a smaller plane at the light's position for debugging/visualization)\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.1f));\n shader.setMat4(\"model\", model);\n renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders a 1x1 quad in NDC with manually calculated tangent vectors\n// ------------------------------------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n // positions\n glm::vec3 pos1(-1.0f, 1.0f, 0.0f);\n glm::vec3 pos2(-1.0f, -1.0f, 0.0f);\n glm::vec3 pos3( 1.0f, -1.0f, 0.0f);\n glm::vec3 pos4( 1.0f, 1.0f, 0.0f);\n // texture coordinates\n glm::vec2 uv1(0.0f, 1.0f);\n glm::vec2 uv2(0.0f, 0.0f);\n glm::vec2 uv3(1.0f, 0.0f);\n glm::vec2 uv4(1.0f, 1.0f);\n // normal vector\n glm::vec3 nm(0.0f, 0.0f, 1.0f);\n\n // calculate tangent/bitangent vectors of both triangles\n glm::vec3 tangent1, bitangent1;\n glm::vec3 tangent2, bitangent2;\n // triangle 1\n // ----------\n glm::vec3 edge1 = pos2 - pos1;\n glm::vec3 edge2 = pos3 - pos1;\n glm::vec2 deltaUV1 = uv2 - uv1;\n glm::vec2 deltaUV2 = uv3 - uv1;\n\n float f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent1.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent1.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent1.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n tangent1 = glm::normalize(tangent1);\n\n bitangent1.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent1.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent1.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n bitangent1 = glm::normalize(bitangent1);\n\n // triangle 2\n // ----------\n edge1 = pos3 - pos1;\n edge2 = pos4 - pos1;\n deltaUV1 = uv3 - uv1;\n deltaUV2 = uv4 - uv1;\n\n f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent2.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent2.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent2.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n tangent2 = glm::normalize(tangent2);\n\n\n bitangent2.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent2.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent2.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n bitangent2 = glm::normalize(bitangent2);\n\n\n float quadVertices[] = {\n // positions // normal // texcoords // tangent // bitangent\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos2.x, pos2.y, pos2.z, nm.x, nm.y, nm.z, uv2.x, uv2.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos4.x, pos4.y, pos4.z, nm.x, nm.y, nm.z, uv4.x, uv4.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z\n };\n // configure plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(8 * sizeof(float)));\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(11 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)\n {\n if (heightScale > 0.0f)\n heightScale -= 0.0005f;\n else\n heightScale = 0.0f;\n }\n else if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)\n {\n if (heightScale < 1.0f)\n heightScale += 0.0005f;\n else\n heightScale = 1.0f;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.144, "dedup_hash": "9e25c6876f19fcdd", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_6_hdr", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:18+00:00", "source_type": "repo", "title": "6.Hdr", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/6.hdr/6.hdr.fs", "language": "glsl", "loc": 26, "comment_density": 0.154, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D hdrBuffer;\nuniform bool hdr;\nuniform float exposure;\n\nvoid main()\n{ \n const float gamma = 2.2;\n vec3 hdrColor = texture(hdrBuffer, TexCoords).rgb;\n if(hdr)\n {\n // reinhard\n // vec3 result = hdrColor / (hdrColor + vec3(1.0));\n // exposure\n vec3 result = vec3(1.0) - exp(-hdrColor * exposure);\n // also gamma correct while we're at it \n result = pow(result, vec3(1.0 / gamma));\n FragColor = vec4(result, 1.0);\n }\n else\n {\n vec3 result = pow(hdrColor, vec3(1.0 / gamma));\n FragColor = vec4(result, 1.0);\n }\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/6.hdr/6.hdr.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/6.hdr/6.lighting.fs", "language": "glsl", "loc": 36, "comment_density": 0.111, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nstruct Light {\n vec3 Position;\n vec3 Color;\n};\n\nuniform Light lights[16];\nuniform sampler2D diffuseTexture;\nuniform vec3 viewPos;\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n // ambient\n vec3 ambient = 0.0 * color;\n // lighting\n vec3 lighting = vec3(0.0);\n for(int i = 0; i < 16; i++)\n {\n // diffuse\n vec3 lightDir = normalize(lights[i].Position - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = lights[i].Color * diff * color; \n vec3 result = diffuse; \n // attenuation (use quadratic as we have gamma correction)\n float distance = length(fs_in.FragPos - lights[i].Position);\n result *= 1.0 / (distance * distance);\n lighting += result;\n \n }\n FragColor = vec4(ambient + lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/6.hdr/6.lighting.vs", "language": "glsl", "loc": 22, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform bool inverse_normals;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); \n vs_out.TexCoords = aTexCoords;\n \n vec3 n = inverse_normals ? -aNormal : aNormal;\n \n mat3 normalMatrix = transpose(inverse(mat3(model)));\n vs_out.Normal = normalize(normalMatrix * n);\n \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/6.hdr/hdr.cpp", "language": "code", "loc": 391, "comment_density": 0.281, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\nvoid renderQuad();\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool hdr = true;\nbool hdrKeyPressed = false;\nfloat exposure = 1.0f;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 5.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"6.lighting.vs\", \"6.lighting.fs\");\n Shader hdrShader(\"6.hdr.vs\", \"6.hdr.fs\");\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str(), true); // note that we're loading the texture as an SRGB texture\n\n // configure floating point framebuffer\n // ------------------------------------\n unsigned int hdrFBO;\n glGenFramebuffers(1, &hdrFBO);\n // create floating point color buffer\n unsigned int colorBuffer;\n glGenTextures(1, &colorBuffer);\n glBindTexture(GL_TEXTURE_2D, colorBuffer);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // create depth buffer (renderbuffer)\n unsigned int rboDepth;\n glGenRenderbuffers(1, &rboDepth);\n glBindRenderbuffer(GL_RENDERBUFFER, rboDepth);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, SCR_WIDTH, SCR_HEIGHT);\n // attach buffers\n glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorBuffer, 0);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepth);\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"Framebuffer not complete!\" << std::endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // lighting info\n // -------------\n // positions\n std::vector lightPositions;\n lightPositions.push_back(glm::vec3( 0.0f, 0.0f, 49.5f)); // back light\n lightPositions.push_back(glm::vec3(-1.4f, -1.9f, 9.0f));\n lightPositions.push_back(glm::vec3( 0.0f, -1.8f, 4.0f));\n lightPositions.push_back(glm::vec3( 0.8f, -1.7f, 6.0f));\n // colors\n std::vector lightColors;\n lightColors.push_back(glm::vec3(200.0f, 200.0f, 200.0f));\n lightColors.push_back(glm::vec3(0.1f, 0.0f, 0.0f));\n lightColors.push_back(glm::vec3(0.0f, 0.0f, 0.2f));\n lightColors.push_back(glm::vec3(0.0f, 0.1f, 0.0f));\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n hdrShader.use();\n hdrShader.setInt(\"hdrBuffer\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render scene into floating point framebuffer\n // -----------------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (GLfloat)SCR_WIDTH / (GLfloat)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n // set lighting uniforms\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n shader.setVec3(\"lights[\" + std::to_string(i) + \"].Position\", lightPositions[i]);\n shader.setVec3(\"lights[\" + std::to_string(i) + \"].Color\", lightColors[i]);\n }\n shader.setVec3(\"viewPos\", camera.Position);\n // render tunnel\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 0.0f, 25.0));\n model = glm::scale(model, glm::vec3(2.5f, 2.5f, 27.5f));\n shader.setMat4(\"model\", model);\n shader.setInt(\"inverse_normals\", true);\n renderCube();\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 2. now render floating point color buffer to 2D quad and tonemap HDR colors to default framebuffer's (clamped) color range\n // --------------------------------------------------------------------------------------------------------------------------\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n hdrShader.use();\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, colorBuffer);\n hdrShader.setInt(\"hdr\", hdr);\n hdrShader.setFloat(\"exposure\", exposure);\n renderQuad();\n\n std::cout << \"hdr: \" << (hdr ? \"on\" : \"off\") << \"| exposure: \" << exposure << std::endl;\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !hdrKeyPressed)\n {\n hdr = !hdr;\n hdrKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)\n {\n hdrKeyPressed = false;\n }\n\n if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)\n {\n if (exposure > 0.0f)\n exposure -= 0.001f;\n else\n exposure = 0.0f;\n }\n else if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)\n {\n exposure += 0.001f;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path, bool gammaCorrection)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum internalFormat;\n GLenum dataFormat;\n if (nrComponents == 1)\n {\n internalFormat = dataFormat = GL_RED;\n }\n else if (nrComponents == 3)\n {\n internalFormat = gammaCorrection ? GL_SRGB : GL_RGB;\n dataFormat = GL_RGB;\n }\n else if (nrComponents == 4)\n {\n internalFormat = gammaCorrection ? GL_SRGB_ALPHA : GL_RGBA;\n dataFormat = GL_RGBA;\n }\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, dataFormat, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.109, "dedup_hash": "c780f36225a329dd", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_7_bloom", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:19+00:00", "source_type": "repo", "title": "7.Bloom", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/postprocessing/texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/7.bloom/7.bloom.fs", "language": "glsl", "loc": 44, "comment_density": 0.114, "code": "#version 330 core\nlayout (location = 0) out vec4 FragColor;\nlayout (location = 1) out vec4 BrightColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nstruct Light {\n vec3 Position;\n vec3 Color;\n};\n\nuniform Light lights[4];\nuniform sampler2D diffuseTexture;\nuniform vec3 viewPos;\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n // ambient\n vec3 ambient = 0.0 * color;\n // lighting\n vec3 lighting = vec3(0.0);\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n for(int i = 0; i < 4; i++)\n {\n // diffuse\n vec3 lightDir = normalize(lights[i].Position - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 result = lights[i].Color * diff * color; \n // attenuation (use quadratic as we have gamma correction)\n float distance = length(fs_in.FragPos - lights[i].Position);\n result *= 1.0 / (distance * distance);\n lighting += result;\n \n }\n vec3 result = ambient + lighting;\n // check whether result is higher than some threshold, if so, output as bloom threshold color\n float brightness = dot(result, vec3(0.2126, 0.7152, 0.0722));\n if(brightness > 1.0)\n BrightColor = vec4(result, 1.0);\n else\n BrightColor = vec4(0.0, 0.0, 0.0, 1.0);\n FragColor = vec4(result, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/7.bloom/7.bloom.vs", "language": "glsl", "loc": 20, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); \n vs_out.TexCoords = aTexCoords;\n \n mat3 normalMatrix = transpose(inverse(mat3(model)));\n vs_out.Normal = normalize(normalMatrix * aNormal);\n \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/7.bloom/7.bloom_final.fs", "language": "glsl", "loc": 20, "comment_density": 0.15, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D scene;\nuniform sampler2D bloomBlur;\nuniform bool bloom;\nuniform float exposure;\n\nvoid main()\n{ \n const float gamma = 2.2;\n vec3 hdrColor = texture(scene, TexCoords).rgb; \n vec3 bloomColor = texture(bloomBlur, TexCoords).rgb;\n if(bloom)\n hdrColor += bloomColor; // additive blending\n // tone mapping\n vec3 result = vec3(1.0) - exp(-hdrColor * exposure);\n // also gamma correct while we're at it \n result = pow(result, vec3(1.0 / gamma));\n FragColor = vec4(result, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/7.bloom/7.bloom_final.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/7.bloom/7.blur.fs", "language": "glsl", "loc": 28, "comment_density": 0.036, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D image;\n\nuniform bool horizontal;\nuniform float weight[5] = float[] (0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162);\n\nvoid main()\n{ \n vec2 tex_offset = 1.0 / textureSize(image, 0); // gets size of single texel\n vec3 result = texture(image, TexCoords).rgb * weight[0];\n if(horizontal)\n {\n for(int i = 1; i < 5; ++i)\n {\n result += texture(image, TexCoords + vec2(tex_offset.x * i, 0.0)).rgb * weight[i];\n result += texture(image, TexCoords - vec2(tex_offset.x * i, 0.0)).rgb * weight[i];\n }\n }\n else\n {\n for(int i = 1; i < 5; ++i)\n {\n result += texture(image, TexCoords + vec2(0.0, tex_offset.y * i)).rgb * weight[i];\n result += texture(image, TexCoords - vec2(0.0, tex_offset.y * i)).rgb * weight[i];\n }\n }\n FragColor = vec4(result, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/7.bloom/7.blur.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/7.bloom/7.light_box.fs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) out vec4 FragColor;\nlayout (location = 1) out vec4 BrightColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform vec3 lightColor;\n\nvoid main()\n{ \n FragColor = vec4(lightColor, 1.0);\n float brightness = dot(FragColor.rgb, vec3(0.2126, 0.7152, 0.0722));\n if(brightness > 1.0)\n BrightColor = vec4(FragColor.rgb, 1.0);\n\telse\n\t\tBrightColor = vec4(0.0, 0.0, 0.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/7.bloom/bloom.cpp", "language": "code", "loc": 489, "comment_density": 0.247, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\nvoid renderQuad();\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool bloom = true;\nbool bloomKeyPressed = false;\nfloat exposure = 1.0f;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 5.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"7.bloom.vs\", \"7.bloom.fs\");\n Shader shaderLight(\"7.bloom.vs\", \"7.light_box.fs\");\n Shader shaderBlur(\"7.blur.vs\", \"7.blur.fs\");\n Shader shaderBloomFinal(\"7.bloom_final.vs\", \"7.bloom_final.fs\");\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str(), true); // note that we're loading the texture as an SRGB texture\n unsigned int containerTexture = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str(), true); // note that we're loading the texture as an SRGB texture\n\n // configure (floating point) framebuffers\n // ---------------------------------------\n unsigned int hdrFBO;\n glGenFramebuffers(1, &hdrFBO);\n glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);\n // create 2 floating point color buffers (1 for normal rendering, other for brightness threshold values)\n unsigned int colorBuffers[2];\n glGenTextures(2, colorBuffers);\n for (unsigned int i = 0; i < 2; i++)\n {\n glBindTexture(GL_TEXTURE_2D, colorBuffers[i]);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // we clamp to the edge as the blur filter would otherwise sample repeated texture values!\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n // attach texture to framebuffer\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, colorBuffers[i], 0);\n }\n // create and attach depth buffer (renderbuffer)\n unsigned int rboDepth;\n glGenRenderbuffers(1, &rboDepth);\n glBindRenderbuffer(GL_RENDERBUFFER, rboDepth);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, SCR_WIDTH, SCR_HEIGHT);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepth);\n // tell OpenGL which color attachments we'll use (of this framebuffer) for rendering \n unsigned int attachments[2] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };\n glDrawBuffers(2, attachments);\n // finally check if framebuffer is complete\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"Framebuffer not complete!\" << std::endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // ping-pong-framebuffer for blurring\n unsigned int pingpongFBO[2];\n unsigned int pingpongColorbuffers[2];\n glGenFramebuffers(2, pingpongFBO);\n glGenTextures(2, pingpongColorbuffers);\n for (unsigned int i = 0; i < 2; i++)\n {\n glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[i]);\n glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[i]);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // we clamp to the edge as the blur filter would otherwise sample repeated texture values!\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pingpongColorbuffers[i], 0);\n // also check if framebuffers are complete (no need for depth buffer)\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"Framebuffer not complete!\" << std::endl;\n }\n\n // lighting info\n // -------------\n // positions\n std::vector lightPositions;\n lightPositions.push_back(glm::vec3( 0.0f, 0.5f, 1.5f));\n lightPositions.push_back(glm::vec3(-4.0f, 0.5f, -3.0f));\n lightPositions.push_back(glm::vec3( 3.0f, 0.5f, 1.0f));\n lightPositions.push_back(glm::vec3(-.8f, 2.4f, -1.0f));\n // colors\n std::vector lightColors;\n lightColors.push_back(glm::vec3(5.0f, 5.0f, 5.0f));\n lightColors.push_back(glm::vec3(10.0f, 0.0f, 0.0f));\n lightColors.push_back(glm::vec3(0.0f, 0.0f, 15.0f));\n lightColors.push_back(glm::vec3(0.0f, 5.0f, 0.0f));\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shaderBlur.use();\n shaderBlur.setInt(\"image\", 0);\n shaderBloomFinal.use();\n shaderBloomFinal.setInt(\"scene\", 0);\n shaderBloomFinal.setInt(\"bloomBlur\", 1);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render scene into floating point framebuffer\n // -----------------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n // set lighting uniforms\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n shader.setVec3(\"lights[\" + std::to_string(i) + \"].Position\", lightPositions[i]);\n shader.setVec3(\"lights[\" + std::to_string(i) + \"].Color\", lightColors[i]);\n }\n shader.setVec3(\"viewPos\", camera.Position);\n // create one large cube that acts as the floor\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, -1.0f, 0.0));\n model = glm::scale(model, glm::vec3(12.5f, 0.5f, 12.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n // then create multiple cubes as the scenery\n glBindTexture(GL_TEXTURE_2D, containerTexture);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 1.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, -1.0f, 2.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 2.7f, 4.0));\n model = glm::rotate(model, glm::radians(23.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(1.25));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-2.0f, 1.0f, -3.0));\n model = glm::rotate(model, glm::radians(124.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-3.0f, 0.0f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n\n // finally show all the light sources as bright cubes\n shaderLight.use();\n shaderLight.setMat4(\"projection\", projection);\n shaderLight.setMat4(\"view\", view);\n\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(lightPositions[i]));\n model = glm::scale(model, glm::vec3(0.25f));\n shaderLight.setMat4(\"model\", model);\n shaderLight.setVec3(\"lightColor\", lightColors[i]);\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 2. blur bright fragments with two-pass Gaussian Blur \n // --------------------------------------------------\n bool horizontal = true, first_iteration = true;\n unsigned int amount = 10;\n shaderBlur.use();\n for (unsigned int i = 0; i < amount; i++)\n {\n glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[horizontal]);\n shaderBlur.setInt(\"horizontal\", horizontal);\n glBindTexture(GL_TEXTURE_2D, first_iteration ? colorBuffers[1] : pingpongColorbuffers[!horizontal]); // bind texture of other framebuffer (or scene if first iteration)\n renderQuad();\n horizontal = !horizontal;\n if (first_iteration)\n first_iteration = false;\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 3. now render floating point color buffer to 2D quad and tonemap HDR colors to default framebuffer's (clamped) color range\n // --------------------------------------------------------------------------------------------------------------------------\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shaderBloomFinal.use();\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, colorBuffers[0]);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[!horizontal]);\n shaderBloomFinal.setInt(\"bloom\", bloom);\n shaderBloomFinal.setFloat(\"exposure\", exposure);\n renderQuad();\n\n std::cout << \"bloom: \" << (bloom ? \"on\" : \"off\") << \"| exposure: \" << exposure << std::endl;\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !bloomKeyPressed)\n {\n bloom = !bloom;\n bloomKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)\n {\n bloomKeyPressed = false;\n }\n\n if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)\n {\n if (exposure > 0.0f)\n exposure -= 0.001f;\n else\n exposure = 0.0f;\n }\n else if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)\n {\n exposure += 0.001f;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path, bool gammaCorrection)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum internalFormat;\n GLenum dataFormat;\n if (nrComponents == 1)\n {\n internalFormat = dataFormat = GL_RED;\n }\n else if (nrComponents == 3)\n {\n internalFormat = gammaCorrection ? GL_SRGB : GL_RGB;\n dataFormat = GL_RGB;\n }\n else if (nrComponents == 4)\n {\n internalFormat = gammaCorrection ? GL_SRGB_ALPHA : GL_RGBA;\n dataFormat = GL_RGBA;\n }\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, dataFormat, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 7, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.068, "dedup_hash": "d244b629d2632e76", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_8_1_deferred_shading", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:19+00:00", "source_type": "repo", "title": "8.1.Deferred Shading", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/8.1.deferred_shading/8.1.deferred_light_box.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) out vec4 FragColor;\n\nuniform vec3 lightColor;\n\nvoid main()\n{ \n FragColor = vec4(lightColor, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.1.deferred_shading/8.1.deferred_light_box.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.1.deferred_shading/8.1.deferred_shading.fs", "language": "glsl", "loc": 43, "comment_density": 0.14, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D gPosition;\nuniform sampler2D gNormal;\nuniform sampler2D gAlbedoSpec;\n\nstruct Light {\n vec3 Position;\n vec3 Color;\n \n float Linear;\n float Quadratic;\n};\nconst int NR_LIGHTS = 32;\nuniform Light lights[NR_LIGHTS];\nuniform vec3 viewPos;\n\nvoid main()\n{ \n // retrieve data from gbuffer\n vec3 FragPos = texture(gPosition, TexCoords).rgb;\n vec3 Normal = texture(gNormal, TexCoords).rgb;\n vec3 Diffuse = texture(gAlbedoSpec, TexCoords).rgb;\n float Specular = texture(gAlbedoSpec, TexCoords).a;\n \n // then calculate lighting as usual\n vec3 lighting = Diffuse * 0.1; // hard-coded ambient component\n vec3 viewDir = normalize(viewPos - FragPos);\n for(int i = 0; i < NR_LIGHTS; ++i)\n {\n // diffuse\n vec3 lightDir = normalize(lights[i].Position - FragPos);\n vec3 diffuse = max(dot(Normal, lightDir), 0.0) * Diffuse * lights[i].Color;\n // specular\n vec3 halfwayDir = normalize(lightDir + viewDir); \n float spec = pow(max(dot(Normal, halfwayDir), 0.0), 16.0);\n vec3 specular = lights[i].Color * spec * Specular;\n // attenuation\n float distance = length(lights[i].Position - FragPos);\n float attenuation = 1.0 / (1.0 + lights[i].Linear * distance + lights[i].Quadratic * distance * distance);\n diffuse *= attenuation;\n specular *= attenuation;\n lighting += diffuse + specular; \n }\n FragColor = vec4(lighting, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.1.deferred_shading/8.1.deferred_shading.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.1.deferred_shading/8.1.fbo_debug.fs", "language": "glsl", "loc": 9, "comment_density": 0.111, "code": "// fragment shader\n#version 330 core\nout vec4 FragColor;\nin vec2 TexCoords;\n \nuniform sampler2D fboAttachment;\n \nvoid main()\n{\n FragColor = texture(fboAttachment, TexCoords);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.1.deferred_shading/8.1.fbo_debug.vs", "language": "glsl", "loc": 10, "comment_density": 0.1, "code": "// vertex shader\n#version 330 core\nlayout (location = 0) in vec2 position;\nlayout (location = 1) in vec2 texCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n gl_Position = vec4(position, 0.0f, 1.0f);\n TexCoords = texCoords;\n}\n ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.1.deferred_shading/8.1.g_buffer.fs", "language": "glsl", "loc": 20, "comment_density": 0.2, "code": "#version 330 core\nlayout (location = 0) out vec3 gPosition;\nlayout (location = 1) out vec3 gNormal;\nlayout (location = 2) out vec4 gAlbedoSpec;\n\nin vec2 TexCoords;\nin vec3 FragPos;\nin vec3 Normal;\n\nuniform sampler2D texture_diffuse1;\nuniform sampler2D texture_specular1;\n\nvoid main()\n{ \n // store the fragment position vector in the first gbuffer texture\n gPosition = FragPos;\n // also store the per-fragment normals into the gbuffer\n gNormal = normalize(Normal);\n // and the diffuse per-fragment color\n gAlbedoSpec.rgb = texture(texture_diffuse1, TexCoords).rgb;\n // store specular intensity in gAlbedoSpec's alpha component\n gAlbedoSpec.a = texture(texture_specular1, TexCoords).r;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.1.deferred_shading/8.1.g_buffer.vs", "language": "glsl", "loc": 19, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec2 TexCoords;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n vec4 worldPos = model * vec4(aPos, 1.0);\n FragPos = worldPos.xyz; \n TexCoords = aTexCoords;\n \n mat3 normalMatrix = transpose(inverse(mat3(model)));\n Normal = normalMatrix * aNormal;\n\n gl_Position = projection * view * worldPos;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.1.deferred_shading/deferred_shading.cpp", "language": "code", "loc": 390, "comment_density": 0.313, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\nvoid renderQuad();\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 5.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n \n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // tell stb_image.h to flip loaded texture's on the y-axis (before loading model).\n stbi_set_flip_vertically_on_load(true);\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shaderGeometryPass(\"8.1.g_buffer.vs\", \"8.1.g_buffer.fs\");\n Shader shaderLightingPass(\"8.1.deferred_shading.vs\", \"8.1.deferred_shading.fs\");\n Shader shaderLightBox(\"8.1.deferred_light_box.vs\", \"8.1.deferred_light_box.fs\");\n\n // load models\n // -----------\n Model backpack(FileSystem::getPath(\"resources/objects/backpack/backpack.obj\"));\n std::vector objectPositions;\n objectPositions.push_back(glm::vec3(-3.0, -0.5, -3.0));\n objectPositions.push_back(glm::vec3( 0.0, -0.5, -3.0));\n objectPositions.push_back(glm::vec3( 3.0, -0.5, -3.0));\n objectPositions.push_back(glm::vec3(-3.0, -0.5, 0.0));\n objectPositions.push_back(glm::vec3( 0.0, -0.5, 0.0));\n objectPositions.push_back(glm::vec3( 3.0, -0.5, 0.0));\n objectPositions.push_back(glm::vec3(-3.0, -0.5, 3.0));\n objectPositions.push_back(glm::vec3( 0.0, -0.5, 3.0));\n objectPositions.push_back(glm::vec3( 3.0, -0.5, 3.0));\n\n\n // configure g-buffer framebuffer\n // ------------------------------\n unsigned int gBuffer;\n glGenFramebuffers(1, &gBuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);\n unsigned int gPosition, gNormal, gAlbedoSpec;\n // position color buffer\n glGenTextures(1, &gPosition);\n glBindTexture(GL_TEXTURE_2D, gPosition);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gPosition, 0);\n // normal color buffer\n glGenTextures(1, &gNormal);\n glBindTexture(GL_TEXTURE_2D, gNormal);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, gNormal, 0);\n // color + specular color buffer\n glGenTextures(1, &gAlbedoSpec);\n glBindTexture(GL_TEXTURE_2D, gAlbedoSpec);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, gAlbedoSpec, 0);\n // tell OpenGL which color attachments we'll use (of this framebuffer) for rendering \n unsigned int attachments[3] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };\n glDrawBuffers(3, attachments);\n // create and attach depth buffer (renderbuffer)\n unsigned int rboDepth;\n glGenRenderbuffers(1, &rboDepth);\n glBindRenderbuffer(GL_RENDERBUFFER, rboDepth);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, SCR_WIDTH, SCR_HEIGHT);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepth);\n // finally check if framebuffer is complete\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"Framebuffer not complete!\" << std::endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // lighting info\n // -------------\n const unsigned int NR_LIGHTS = 32;\n std::vector lightPositions;\n std::vector lightColors;\n srand(13);\n for (unsigned int i = 0; i < NR_LIGHTS; i++)\n {\n // calculate slightly random offsets\n float xPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0);\n float yPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 4.0);\n float zPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0);\n lightPositions.push_back(glm::vec3(xPos, yPos, zPos));\n // also calculate random color\n float rColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0\n float gColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0\n float bColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0\n lightColors.push_back(glm::vec3(rColor, gColor, bColor));\n }\n\n // shader configuration\n // --------------------\n shaderLightingPass.use();\n shaderLightingPass.setInt(\"gPosition\", 0);\n shaderLightingPass.setInt(\"gNormal\", 1);\n shaderLightingPass.setInt(\"gAlbedoSpec\", 2);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n auto currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. geometry pass: render scene's geometry/color data into gbuffer\n // -----------------------------------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shaderGeometryPass.use();\n shaderGeometryPass.setMat4(\"projection\", projection);\n shaderGeometryPass.setMat4(\"view\", view);\n for (unsigned int i = 0; i < objectPositions.size(); i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, objectPositions[i]);\n model = glm::scale(model, glm::vec3(0.5f));\n shaderGeometryPass.setMat4(\"model\", model);\n backpack.Draw(shaderGeometryPass);\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 2. lighting pass: calculate lighting by iterating over a screen filled quad pixel-by-pixel using the gbuffer's content.\n // -----------------------------------------------------------------------------------------------------------------------\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shaderLightingPass.use();\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, gPosition);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, gNormal);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, gAlbedoSpec);\n // send light relevant uniforms\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n shaderLightingPass.setVec3(\"lights[\" + std::to_string(i) + \"].Position\", lightPositions[i]);\n shaderLightingPass.setVec3(\"lights[\" + std::to_string(i) + \"].Color\", lightColors[i]);\n // update attenuation parameters and calculate radius\n const float linear = 0.7f;\n const float quadratic = 1.8f;\n shaderLightingPass.setFloat(\"lights[\" + std::to_string(i) + \"].Linear\", linear);\n shaderLightingPass.setFloat(\"lights[\" + std::to_string(i) + \"].Quadratic\", quadratic);\n }\n shaderLightingPass.setVec3(\"viewPos\", camera.Position);\n // finally render quad\n renderQuad();\n\n // 2.5. copy content of geometry's depth buffer to default framebuffer's depth buffer\n // ----------------------------------------------------------------------------------\n glBindFramebuffer(GL_READ_FRAMEBUFFER, gBuffer);\n glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // write to default framebuffer\n // blit to default framebuffer. Note that this may or may not work as the internal formats of both the FBO and default framebuffer have to match.\n // the internal formats are implementation defined. This works on all of my systems, but if it doesn't on yours you'll likely have to write to the \t\t\n // depth buffer in another shader stage (or somehow see to match the default framebuffer's internal format with the FBO's internal format).\n glBlitFramebuffer(0, 0, SCR_WIDTH, SCR_HEIGHT, 0, 0, SCR_WIDTH, SCR_HEIGHT, GL_DEPTH_BUFFER_BIT, GL_NEAREST);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 3. render lights on top of scene\n // --------------------------------\n shaderLightBox.use();\n shaderLightBox.setMat4(\"projection\", projection);\n shaderLightBox.setMat4(\"view\", view);\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPositions[i]);\n model = glm::scale(model, glm::vec3(0.125f));\n shaderLightBox.setMat4(\"model\", model);\n shaderLightBox.setVec3(\"lightColor\", lightColors[i]);\n renderCube();\n }\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 8, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.096, "dedup_hash": "de1e4fd76187f6f7", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_8_2_deferred_shading_volumes", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:20+00:00", "source_type": "repo", "title": "8.2.Deferred Shading Volumes", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/8.2.deferred_shading_volumes/8.2.deferred_light_box.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) out vec4 FragColor;\n\nuniform vec3 lightColor;\n\nvoid main()\n{ \n FragColor = vec4(lightColor, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.2.deferred_shading_volumes/8.2.deferred_light_box.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.2.deferred_shading_volumes/8.2.deferred_shading.fs", "language": "glsl", "loc": 48, "comment_density": 0.146, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D gPosition;\nuniform sampler2D gNormal;\nuniform sampler2D gAlbedoSpec;\n\nstruct Light {\n vec3 Position;\n vec3 Color;\n \n float Linear;\n float Quadratic;\n float Radius;\n};\nconst int NR_LIGHTS = 32;\nuniform Light lights[NR_LIGHTS];\nuniform vec3 viewPos;\n\nvoid main()\n{ \n // retrieve data from gbuffer\n vec3 FragPos = texture(gPosition, TexCoords).rgb;\n vec3 Normal = texture(gNormal, TexCoords).rgb;\n vec3 Diffuse = texture(gAlbedoSpec, TexCoords).rgb;\n float Specular = texture(gAlbedoSpec, TexCoords).a;\n \n // then calculate lighting as usual\n vec3 lighting = Diffuse * 0.1; // hard-coded ambient component\n vec3 viewDir = normalize(viewPos - FragPos);\n for(int i = 0; i < NR_LIGHTS; ++i)\n {\n // calculate distance between light source and current fragment\n float distance = length(lights[i].Position - FragPos);\n if(distance < lights[i].Radius)\n {\n // diffuse\n vec3 lightDir = normalize(lights[i].Position - FragPos);\n vec3 diffuse = max(dot(Normal, lightDir), 0.0) * Diffuse * lights[i].Color;\n // specular\n vec3 halfwayDir = normalize(lightDir + viewDir); \n float spec = pow(max(dot(Normal, halfwayDir), 0.0), 16.0);\n vec3 specular = lights[i].Color * spec * Specular;\n // attenuation\n float attenuation = 1.0 / (1.0 + lights[i].Linear * distance + lights[i].Quadratic * distance * distance);\n diffuse *= attenuation;\n specular *= attenuation;\n lighting += diffuse + specular;\n }\n } \n FragColor = vec4(lighting, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.2.deferred_shading_volumes/8.2.deferred_shading.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.2.deferred_shading_volumes/8.2.g_buffer.fs", "language": "glsl", "loc": 20, "comment_density": 0.2, "code": "#version 330 core\nlayout (location = 0) out vec3 gPosition;\nlayout (location = 1) out vec3 gNormal;\nlayout (location = 2) out vec4 gAlbedoSpec;\n\nin vec2 TexCoords;\nin vec3 FragPos;\nin vec3 Normal;\n\nuniform sampler2D texture_diffuse1;\nuniform sampler2D texture_specular1;\n\nvoid main()\n{ \n // store the fragment position vector in the first gbuffer texture\n gPosition = FragPos;\n // also store the per-fragment normals into the gbuffer\n gNormal = normalize(Normal);\n // and the diffuse per-fragment color\n gAlbedoSpec.rgb = texture(texture_diffuse1, TexCoords).rgb;\n // store specular intensity in gAlbedoSpec's alpha component\n gAlbedoSpec.a = texture(texture_specular1, TexCoords).r;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.2.deferred_shading_volumes/8.2.g_buffer.vs", "language": "glsl", "loc": 19, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec2 TexCoords;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n vec4 worldPos = model * vec4(aPos, 1.0);\n FragPos = worldPos.xyz; \n TexCoords = aTexCoords;\n \n mat3 normalMatrix = transpose(inverse(mat3(model)));\n Normal = normalMatrix * aNormal;\n\n gl_Position = projection * view * worldPos;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp", "language": "code", "loc": 395, "comment_density": 0.314, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\nvoid renderQuad();\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 5.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // tell stb_image.h to flip loaded texture's on the y-axis (before loading model).\n stbi_set_flip_vertically_on_load(true);\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shaderGeometryPass(\"8.2.g_buffer.vs\", \"8.2.g_buffer.fs\");\n Shader shaderLightingPass(\"8.2.deferred_shading.vs\", \"8.2.deferred_shading.fs\");\n Shader shaderLightBox(\"8.2.deferred_light_box.vs\", \"8.2.deferred_light_box.fs\");\n\n // load models\n // -----------\n Model backpack(FileSystem::getPath(\"resources/objects/backpack/backpack.obj\"));\n std::vector objectPositions;\n objectPositions.push_back(glm::vec3(-3.0, -0.5, -3.0));\n objectPositions.push_back(glm::vec3( 0.0, -0.5, -3.0));\n objectPositions.push_back(glm::vec3( 3.0, -0.5, -3.0));\n objectPositions.push_back(glm::vec3(-3.0, -0.5, 0.0));\n objectPositions.push_back(glm::vec3( 0.0, -0.5, 0.0));\n objectPositions.push_back(glm::vec3( 3.0, -0.5, 0.0));\n objectPositions.push_back(glm::vec3(-3.0, -0.5, 3.0));\n objectPositions.push_back(glm::vec3( 0.0, -0.5, 3.0));\n objectPositions.push_back(glm::vec3( 3.0, -0.5, 3.0));\n\n\n // configure g-buffer framebuffer\n // ------------------------------\n unsigned int gBuffer;\n glGenFramebuffers(1, &gBuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);\n unsigned int gPosition, gNormal, gAlbedoSpec;\n // position color buffer\n glGenTextures(1, &gPosition);\n glBindTexture(GL_TEXTURE_2D, gPosition);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gPosition, 0);\n // normal color buffer\n glGenTextures(1, &gNormal);\n glBindTexture(GL_TEXTURE_2D, gNormal);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, gNormal, 0);\n // color + specular color buffer\n glGenTextures(1, &gAlbedoSpec);\n glBindTexture(GL_TEXTURE_2D, gAlbedoSpec);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, gAlbedoSpec, 0);\n // tell OpenGL which color attachments we'll use (of this framebuffer) for rendering \n unsigned int attachments[3] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };\n glDrawBuffers(3, attachments);\n // create and attach depth buffer (renderbuffer)\n unsigned int rboDepth;\n glGenRenderbuffers(1, &rboDepth);\n glBindRenderbuffer(GL_RENDERBUFFER, rboDepth);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, SCR_WIDTH, SCR_HEIGHT);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepth);\n // finally check if framebuffer is complete\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"Framebuffer not complete!\" << std::endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // lighting info\n // -------------\n const unsigned int NR_LIGHTS = 32;\n std::vector lightPositions;\n std::vector lightColors;\n srand(13);\n for (unsigned int i = 0; i < NR_LIGHTS; i++)\n {\n // calculate slightly random offsets\n float xPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0);\n float yPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 4.0);\n float zPos = static_cast(((rand() % 100) / 100.0) * 6.0 - 3.0);\n lightPositions.push_back(glm::vec3(xPos, yPos, zPos));\n // also calculate random color\n float rColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)\n float gColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)\n float bColor = static_cast(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)\n lightColors.push_back(glm::vec3(rColor, gColor, bColor));\n }\n\n // shader configuration\n // --------------------\n shaderLightingPass.use();\n shaderLightingPass.setInt(\"gPosition\", 0);\n shaderLightingPass.setInt(\"gNormal\", 1);\n shaderLightingPass.setInt(\"gAlbedoSpec\", 2);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n auto currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. geometry pass: render scene's geometry/color data into gbuffer\n // -----------------------------------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shaderGeometryPass.use();\n shaderGeometryPass.setMat4(\"projection\", projection);\n shaderGeometryPass.setMat4(\"view\", view);\n for (unsigned int i = 0; i < objectPositions.size(); i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, objectPositions[i]);\n model = glm::scale(model, glm::vec3(0.25f));\n shaderGeometryPass.setMat4(\"model\", model);\n backpack.Draw(shaderGeometryPass);\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 2. lighting pass: calculate lighting by iterating over a screen filled quad pixel-by-pixel using the gbuffer's content.\n // -----------------------------------------------------------------------------------------------------------------------\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shaderLightingPass.use();\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, gPosition);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, gNormal);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, gAlbedoSpec);\n // send light relevant uniforms\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n shaderLightingPass.setVec3(\"lights[\" + std::to_string(i) + \"].Position\", lightPositions[i]);\n shaderLightingPass.setVec3(\"lights[\" + std::to_string(i) + \"].Color\", lightColors[i]);\n // update attenuation parameters and calculate radius\n const float constant = 1.0f; // note that we don't send this to the shader, we assume it is always 1.0 (in our case)\n const float linear = 0.7f;\n const float quadratic = 1.8f;\n shaderLightingPass.setFloat(\"lights[\" + std::to_string(i) + \"].Linear\", linear);\n shaderLightingPass.setFloat(\"lights[\" + std::to_string(i) + \"].Quadratic\", quadratic);\n // then calculate radius of light volume/sphere\n const float maxBrightness = std::fmaxf(std::fmaxf(lightColors[i].r, lightColors[i].g), lightColors[i].b);\n float radius = (-linear + std::sqrt(linear * linear - 4 * quadratic * (constant - (256.0f / 5.0f) * maxBrightness))) / (2.0f * quadratic);\n shaderLightingPass.setFloat(\"lights[\" + std::to_string(i) + \"].Radius\", radius);\n }\n shaderLightingPass.setVec3(\"viewPos\", camera.Position);\n // finally render quad\n renderQuad();\n\n // 2.5. copy content of geometry's depth buffer to default framebuffer's depth buffer\n // ----------------------------------------------------------------------------------\n glBindFramebuffer(GL_READ_FRAMEBUFFER, gBuffer);\n glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); // write to default framebuffer\n // blit to default framebuffer. Note that this may or may not work as the internal formats of both the FBO and default framebuffer have to match.\n // the internal formats are implementation defined. This works on all of my systems, but if it doesn't on yours you'll likely have to write to the \t\t\n // depth buffer in another shader stage (or somehow see to match the default framebuffer's internal format with the FBO's internal format).\n glBlitFramebuffer(0, 0, SCR_WIDTH, SCR_HEIGHT, 0, 0, SCR_WIDTH, SCR_HEIGHT, GL_DEPTH_BUFFER_BIT, GL_NEAREST);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 3. render lights on top of scene\n // --------------------------------\n shaderLightBox.use();\n shaderLightBox.setMat4(\"projection\", projection);\n shaderLightBox.setMat4(\"view\", view);\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPositions[i]);\n model = glm::scale(model, glm::vec3(0.125f));\n shaderLightBox.setMat4(\"model\", model);\n shaderLightBox.setVec3(\"lightColor\", lightColors[i]);\n renderCube();\n }\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.094, "dedup_hash": "aff9f2165893f62e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_9_ssao", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:20+00:00", "source_type": "repo", "title": "9.Ssao", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/framebuffer/gi", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/9.ssao/9.ssao.fs", "language": "glsl", "loc": 45, "comment_density": 0.311, "code": "#version 330 core\nout float FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D gPosition;\nuniform sampler2D gNormal;\nuniform sampler2D texNoise;\n\nuniform vec3 samples[64];\n\n// parameters (you'd probably want to use them as uniforms to more easily tweak the effect)\nint kernelSize = 64;\nfloat radius = 0.5;\nfloat bias = 0.025;\n\n// tile noise texture over screen based on screen dimensions divided by noise size\nconst vec2 noiseScale = vec2(800.0/4.0, 600.0/4.0); \n\nuniform mat4 projection;\n\nvoid main()\n{\n // get input for SSAO algorithm\n vec3 fragPos = texture(gPosition, TexCoords).xyz;\n vec3 normal = normalize(texture(gNormal, TexCoords).rgb);\n vec3 randomVec = normalize(texture(texNoise, TexCoords * noiseScale).xyz);\n // create TBN change-of-basis matrix: from tangent-space to view-space\n vec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\n vec3 bitangent = cross(normal, tangent);\n mat3 TBN = mat3(tangent, bitangent, normal);\n // iterate over the sample kernel and calculate occlusion factor\n float occlusion = 0.0;\n for(int i = 0; i < kernelSize; ++i)\n {\n // get sample position\n vec3 samplePos = TBN * samples[i]; // from tangent to view-space\n samplePos = fragPos + samplePos * radius; \n \n // project sample position (to sample texture) (to get position on screen/texture)\n vec4 offset = vec4(samplePos, 1.0);\n offset = projection * offset; // from view to clip-space\n offset.xyz /= offset.w; // perspective divide\n offset.xyz = offset.xyz * 0.5 + 0.5; // transform to range 0.0 - 1.0\n \n // get sample depth\n float sampleDepth = texture(gPosition, offset.xy).z; // get depth value of kernel sample\n \n // range check & accumulate\n float rangeCheck = smoothstep(0.0, 1.0, radius / abs(fragPos.z - sampleDepth));\n occlusion += (sampleDepth >= samplePos.z + bias ? 1.0 : 0.0) * rangeCheck; \n }\n occlusion = 1.0 - (occlusion / kernelSize);\n \n FragColor = occlusion;\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/9.ssao/9.ssao.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/9.ssao/9.ssao_blur.fs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nout float FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D ssaoInput;\n\nvoid main() \n{\n vec2 texelSize = 1.0 / vec2(textureSize(ssaoInput, 0));\n float result = 0.0;\n for (int x = -2; x < 2; ++x) \n {\n for (int y = -2; y < 2; ++y) \n {\n vec2 offset = vec2(float(x), float(y)) * texelSize;\n result += texture(ssaoInput, TexCoords + offset).r;\n }\n }\n FragColor = result / (4.0 * 4.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/9.ssao/9.ssao_geometry.fs", "language": "glsl", "loc": 16, "comment_density": 0.188, "code": "#version 330 core\nlayout (location = 0) out vec3 gPosition;\nlayout (location = 1) out vec3 gNormal;\nlayout (location = 2) out vec3 gAlbedo;\n\nin vec2 TexCoords;\nin vec3 FragPos;\nin vec3 Normal;\n\nvoid main()\n{ \n // store the fragment position vector in the first gbuffer texture\n gPosition = FragPos;\n // also store the per-fragment normals into the gbuffer\n gNormal = normalize(Normal);\n // and the diffuse per-fragment color\n gAlbedo.rgb = vec3(0.95);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/9.ssao/9.ssao_geometry.vs", "language": "glsl", "loc": 20, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec2 TexCoords;\nout vec3 Normal;\n\nuniform bool invertedNormals;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n vec4 viewPos = view * model * vec4(aPos, 1.0);\n FragPos = viewPos.xyz; \n TexCoords = aTexCoords;\n \n mat3 normalMatrix = transpose(inverse(mat3(view * model)));\n Normal = normalMatrix * (invertedNormals ? -aNormal : aNormal);\n \n gl_Position = projection * viewPos;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/9.ssao/9.ssao_lighting.fs", "language": "glsl", "loc": 40, "comment_density": 0.15, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D gPosition;\nuniform sampler2D gNormal;\nuniform sampler2D gAlbedo;\nuniform sampler2D ssao;\n\nstruct Light {\n vec3 Position;\n vec3 Color;\n \n float Linear;\n float Quadratic;\n};\nuniform Light light;\n\nvoid main()\n{ \n // retrieve data from gbuffer\n vec3 FragPos = texture(gPosition, TexCoords).rgb;\n vec3 Normal = texture(gNormal, TexCoords).rgb;\n vec3 Diffuse = texture(gAlbedo, TexCoords).rgb;\n float AmbientOcclusion = texture(ssao, TexCoords).r;\n \n // then calculate lighting as usual\n vec3 ambient = vec3(0.3 * Diffuse * AmbientOcclusion);\n vec3 lighting = ambient; \n vec3 viewDir = normalize(-FragPos); // viewpos is (0.0.0)\n // diffuse\n vec3 lightDir = normalize(light.Position - FragPos);\n vec3 diffuse = max(dot(Normal, lightDir), 0.0) * Diffuse * light.Color;\n // specular\n vec3 halfwayDir = normalize(lightDir + viewDir); \n float spec = pow(max(dot(Normal, halfwayDir), 0.0), 8.0);\n vec3 specular = light.Color * spec;\n // attenuation\n float distance = length(light.Position - FragPos);\n float attenuation = 1.0 / (1.0 + light.Linear * distance + light.Quadratic * distance * distance);\n diffuse *= attenuation;\n specular *= attenuation;\n lighting += diffuse + specular;\n\n FragColor = vec4(lighting, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/9.ssao/ssao.cpp", "language": "code", "loc": 443, "comment_density": 0.287, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\nvoid renderQuad();\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 5.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nfloat ourLerp(float a, float b, float f)\n{\n return a + f * (b - a);\n}\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shaderGeometryPass(\"9.ssao_geometry.vs\", \"9.ssao_geometry.fs\");\n Shader shaderLightingPass(\"9.ssao.vs\", \"9.ssao_lighting.fs\");\n Shader shaderSSAO(\"9.ssao.vs\", \"9.ssao.fs\");\n Shader shaderSSAOBlur(\"9.ssao.vs\", \"9.ssao_blur.fs\");\n\n // load models\n // -----------\n Model backpack(FileSystem::getPath(\"resources/objects/backpack/backpack.obj\"));\n\n // configure g-buffer framebuffer\n // ------------------------------\n unsigned int gBuffer;\n glGenFramebuffers(1, &gBuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);\n unsigned int gPosition, gNormal, gAlbedo;\n // position color buffer\n glGenTextures(1, &gPosition);\n glBindTexture(GL_TEXTURE_2D, gPosition);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gPosition, 0);\n // normal color buffer\n glGenTextures(1, &gNormal);\n glBindTexture(GL_TEXTURE_2D, gNormal);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, gNormal, 0);\n // color + specular color buffer\n glGenTextures(1, &gAlbedo);\n glBindTexture(GL_TEXTURE_2D, gAlbedo);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, gAlbedo, 0);\n // tell OpenGL which color attachments we'll use (of this framebuffer) for rendering \n unsigned int attachments[3] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };\n glDrawBuffers(3, attachments);\n // create and attach depth buffer (renderbuffer)\n unsigned int rboDepth;\n glGenRenderbuffers(1, &rboDepth);\n glBindRenderbuffer(GL_RENDERBUFFER, rboDepth);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, SCR_WIDTH, SCR_HEIGHT);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepth);\n // finally check if framebuffer is complete\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"Framebuffer not complete!\" << std::endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // also create framebuffer to hold SSAO processing stage \n // -----------------------------------------------------\n unsigned int ssaoFBO, ssaoBlurFBO;\n glGenFramebuffers(1, &ssaoFBO); glGenFramebuffers(1, &ssaoBlurFBO);\n glBindFramebuffer(GL_FRAMEBUFFER, ssaoFBO);\n unsigned int ssaoColorBuffer, ssaoColorBufferBlur;\n // SSAO color buffer\n glGenTextures(1, &ssaoColorBuffer);\n glBindTexture(GL_TEXTURE_2D, ssaoColorBuffer);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, SCR_WIDTH, SCR_HEIGHT, 0, GL_RED, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ssaoColorBuffer, 0);\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"SSAO Framebuffer not complete!\" << std::endl;\n // and blur stage\n glBindFramebuffer(GL_FRAMEBUFFER, ssaoBlurFBO);\n glGenTextures(1, &ssaoColorBufferBlur);\n glBindTexture(GL_TEXTURE_2D, ssaoColorBufferBlur);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, SCR_WIDTH, SCR_HEIGHT, 0, GL_RED, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ssaoColorBufferBlur, 0);\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"SSAO Blur Framebuffer not complete!\" << std::endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // generate sample kernel\n // ----------------------\n std::uniform_real_distribution randomFloats(0.0, 1.0); // generates random floats between 0.0 and 1.0\n std::default_random_engine generator;\n std::vector ssaoKernel;\n for (unsigned int i = 0; i < 64; ++i)\n {\n glm::vec3 sample(randomFloats(generator) * 2.0 - 1.0, randomFloats(generator) * 2.0 - 1.0, randomFloats(generator));\n sample = glm::normalize(sample);\n sample *= randomFloats(generator);\n float scale = float(i) / 64.0f;\n\n // scale samples s.t. they're more aligned to center of kernel\n scale = ourLerp(0.1f, 1.0f, scale * scale);\n sample *= scale;\n ssaoKernel.push_back(sample);\n }\n\n // generate noise texture\n // ----------------------\n std::vector ssaoNoise;\n for (unsigned int i = 0; i < 16; i++)\n {\n glm::vec3 noise(randomFloats(generator) * 2.0 - 1.0, randomFloats(generator) * 2.0 - 1.0, 0.0f); // rotate around z-axis (in tangent space)\n ssaoNoise.push_back(noise);\n }\n unsigned int noiseTexture; glGenTextures(1, &noiseTexture);\n glBindTexture(GL_TEXTURE_2D, noiseTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 4, 4, 0, GL_RGB, GL_FLOAT, &ssaoNoise[0]);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n\n // lighting info\n // -------------\n glm::vec3 lightPos = glm::vec3(2.0, 4.0, -2.0);\n glm::vec3 lightColor = glm::vec3(0.2, 0.2, 0.7);\n\n // shader configuration\n // --------------------\n shaderLightingPass.use();\n shaderLightingPass.setInt(\"gPosition\", 0);\n shaderLightingPass.setInt(\"gNormal\", 1);\n shaderLightingPass.setInt(\"gAlbedo\", 2);\n shaderLightingPass.setInt(\"ssao\", 3);\n shaderSSAO.use();\n shaderSSAO.setInt(\"gPosition\", 0);\n shaderSSAO.setInt(\"gNormal\", 1);\n shaderSSAO.setInt(\"texNoise\", 2);\n shaderSSAOBlur.use();\n shaderSSAOBlur.setInt(\"ssaoInput\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. geometry pass: render scene's geometry/color data into gbuffer\n // -----------------------------------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, gBuffer);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 50.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shaderGeometryPass.use();\n shaderGeometryPass.setMat4(\"projection\", projection);\n shaderGeometryPass.setMat4(\"view\", view);\n // room cube\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0, 7.0f, 0.0f));\n model = glm::scale(model, glm::vec3(7.5f, 7.5f, 7.5f));\n shaderGeometryPass.setMat4(\"model\", model);\n shaderGeometryPass.setInt(\"invertedNormals\", 1); // invert normals as we're inside the cube\n renderCube();\n shaderGeometryPass.setInt(\"invertedNormals\", 0); \n // backpack model on the floor\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 0.5f, 0.0));\n model = glm::rotate(model, glm::radians(-90.0f), glm::vec3(1.0, 0.0, 0.0));\n model = glm::scale(model, glm::vec3(1.0f));\n shaderGeometryPass.setMat4(\"model\", model);\n backpack.Draw(shaderGeometryPass);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // 2. generate SSAO texture\n // ------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, ssaoFBO);\n glClear(GL_COLOR_BUFFER_BIT);\n shaderSSAO.use();\n // Send kernel + rotation \n for (unsigned int i = 0; i < 64; ++i)\n shaderSSAO.setVec3(\"samples[\" + std::to_string(i) + \"]\", ssaoKernel[i]);\n shaderSSAO.setMat4(\"projection\", projection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, gPosition);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, gNormal);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, noiseTexture);\n renderQuad();\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // 3. blur SSAO texture to remove noise\n // ------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, ssaoBlurFBO);\n glClear(GL_COLOR_BUFFER_BIT);\n shaderSSAOBlur.use();\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, ssaoColorBuffer);\n renderQuad();\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // 4. lighting pass: traditional deferred Blinn-Phong lighting with added screen-space ambient occlusion\n // -----------------------------------------------------------------------------------------------------\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shaderLightingPass.use();\n // send light relevant uniforms\n glm::vec3 lightPosView = glm::vec3(camera.GetViewMatrix() * glm::vec4(lightPos, 1.0));\n shaderLightingPass.setVec3(\"light.Position\", lightPosView);\n shaderLightingPass.setVec3(\"light.Color\", lightColor);\n // Update attenuation parameters\n const float linear = 0.09f;\n const float quadratic = 0.032f;\n shaderLightingPass.setFloat(\"light.Linear\", linear);\n shaderLightingPass.setFloat(\"light.Quadratic\", quadratic);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, gPosition);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, gNormal);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, gAlbedo);\n glActiveTexture(GL_TEXTURE3); // add extra SSAO texture to lighting pass\n glBindTexture(GL_TEXTURE_2D, ssaoColorBufferBlur);\n renderQuad();\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.134, "dedup_hash": "a6a95e6d7aa83491", "has_readme": true} +{"id": "joeydevries_learnopengl_src_6_pbr_1_1_lighting", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:20+00:00", "source_type": "repo", "title": "1.1.Lighting", "api": "OpenGL Core", "glsl_version": null, "topic": "pbr/lighting/postprocessing/texturing/framebuffer", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/6.pbr/1.1.lighting/1.1.pbr.fs", "language": "glsl", "loc": 101, "comment_density": 0.267, "code": "#version 330 core\nout vec4 FragColor;\nin vec2 TexCoords;\nin vec3 WorldPos;\nin vec3 Normal;\n\n// material parameters\nuniform vec3 albedo;\nuniform float metallic;\nuniform float roughness;\nuniform float ao;\n\n// lights\nuniform vec3 lightPositions[4];\nuniform vec3 lightColors[4];\n\nuniform vec3 camPos;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\nfloat DistributionGGX(vec3 N, vec3 H, float roughness)\n{\n float a = roughness*roughness;\n float a2 = a*a;\n float NdotH = max(dot(N, H), 0.0);\n float NdotH2 = NdotH*NdotH;\n\n float nom = a2;\n float denom = (NdotH2 * (a2 - 1.0) + 1.0);\n denom = PI * denom * denom;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySchlickGGX(float NdotV, float roughness)\n{\n float r = (roughness + 1.0);\n float k = (r*r) / 8.0;\n\n float nom = NdotV;\n float denom = NdotV * (1.0 - k) + k;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)\n{\n float NdotV = max(dot(N, V), 0.0);\n float NdotL = max(dot(N, L), 0.0);\n float ggx2 = GeometrySchlickGGX(NdotV, roughness);\n float ggx1 = GeometrySchlickGGX(NdotL, roughness);\n\n return ggx1 * ggx2;\n}\n// ----------------------------------------------------------------------------\nvec3 fresnelSchlick(float cosTheta, vec3 F0)\n{\n return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n}\n// ----------------------------------------------------------------------------\nvoid main()\n{\t\t\n vec3 N = normalize(Normal);\n vec3 V = normalize(camPos - WorldPos);\n\n // calculate reflectance at normal incidence; if dia-electric (like plastic) use F0 \n // of 0.04 and if it's a metal, use the albedo color as F0 (metallic workflow) \n vec3 F0 = vec3(0.04); \n F0 = mix(F0, albedo, metallic);\n\n // reflectance equation\n vec3 Lo = vec3(0.0);\n for(int i = 0; i < 4; ++i) \n {\n // calculate per-light radiance\n vec3 L = normalize(lightPositions[i] - WorldPos);\n vec3 H = normalize(V + L);\n float distance = length(lightPositions[i] - WorldPos);\n float attenuation = 1.0 / (distance * distance);\n vec3 radiance = lightColors[i] * attenuation;\n\n // Cook-Torrance BRDF\n float NDF = DistributionGGX(N, H, roughness); \n float G = GeometrySmith(N, V, L, roughness); \n vec3 F = fresnelSchlick(clamp(dot(H, V), 0.0, 1.0), F0);\n \n vec3 numerator = NDF * G * F; \n float denominator = 4.0 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero\n vec3 specular = numerator / denominator;\n \n // kS is equal to Fresnel\n vec3 kS = F;\n // for energy conservation, the diffuse and specular light can't\n // be above 1.0 (unless the surface emits light); to preserve this\n // relationship the diffuse component (kD) should equal 1.0 - kS.\n vec3 kD = vec3(1.0) - kS;\n // multiply kD by the inverse metalness such that only non-metals \n // have diffuse lighting, or a linear blend if partly metal (pure metals\n // have no diffuse light).\n kD *= 1.0 - metallic;\t \n\n // scale light by NdotL\n float NdotL = max(dot(N, L), 0.0); \n\n // add to outgoing radiance Lo\n Lo += (kD * albedo / PI + specular) * radiance * NdotL; // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again\n } \n \n // ambient lighting (note that the next IBL tutorial will replace \n // this ambient lighting with environment lighting).\n vec3 ambient = vec3(0.03) * albedo * ao;\n\n vec3 color = ambient + Lo;\n\n // HDR tonemapping\n color = color / (color + vec3(1.0));\n // gamma correct\n color = pow(color, vec3(1.0/2.2)); \n\n FragColor = vec4(color, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/1.1.lighting/1.1.pbr.vs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\nout vec3 WorldPos;\nout vec3 Normal;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat3 normalMatrix;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n WorldPos = vec3(model * vec4(aPos, 1.0));\n Normal = normalMatrix * aNormal; \n\n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/1.1.lighting/lighting.cpp", "language": "code", "loc": 329, "comment_density": 0.158, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderSphere();\n\n// settings\nconst unsigned int SCR_WIDTH = 1280;\nconst unsigned int SCR_HEIGHT = 720;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = 800.0f / 2.0;\nfloat lastY = 600.0 / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_SAMPLES, 4);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n glfwMakeContextCurrent(window);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"1.1.pbr.vs\", \"1.1.pbr.fs\");\n\n shader.use();\n shader.setVec3(\"albedo\", 0.5f, 0.0f, 0.0f);\n shader.setFloat(\"ao\", 1.0f);\n\n // lights\n // ------\n glm::vec3 lightPositions[] = {\n glm::vec3(-10.0f, 10.0f, 10.0f),\n glm::vec3( 10.0f, 10.0f, 10.0f),\n glm::vec3(-10.0f, -10.0f, 10.0f),\n glm::vec3( 10.0f, -10.0f, 10.0f),\n };\n glm::vec3 lightColors[] = {\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f)\n };\n int nrRows = 7;\n int nrColumns = 7;\n float spacing = 2.5;\n\n // initialize static shader uniforms before rendering\n // --------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.use();\n shader.setMat4(\"projection\", projection);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"view\", view);\n shader.setVec3(\"camPos\", camera.Position);\n\n // render rows*column number of spheres with varying metallic/roughness values scaled by rows and columns respectively\n glm::mat4 model = glm::mat4(1.0f);\n for (int row = 0; row < nrRows; ++row) \n {\n shader.setFloat(\"metallic\", (float)row / (float)nrRows);\n for (int col = 0; col < nrColumns; ++col) \n {\n // we clamp the roughness to 0.05 - 1.0 as perfectly smooth surfaces (roughness of 0.0) tend to look a bit off\n // on direct lighting.\n shader.setFloat(\"roughness\", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));\n \n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(\n (col - (nrColumns / 2)) * spacing, \n (row - (nrRows / 2)) * spacing, \n 0.0f\n ));\n shader.setMat4(\"model\", model);\n shader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n }\n\n // render light source (simply re-render sphere at light positions)\n // this looks a bit off as we use the same shader, but it'll make their positions obvious and \n // keeps the codeprint small.\n for (unsigned int i = 0; i < sizeof(lightPositions) / sizeof(lightPositions[0]); ++i)\n {\n glm::vec3 newPos = lightPositions[i] + glm::vec3(sin(glfwGetTime() * 5.0) * 5.0, 0.0, 0.0);\n newPos = lightPositions[i];\n shader.setVec3(\"lightPositions[\" + std::to_string(i) + \"]\", newPos);\n shader.setVec3(\"lightColors[\" + std::to_string(i) + \"]\", lightColors[i]);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, newPos);\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n shader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// renders (and builds at first invocation) a sphere\n// -------------------------------------------------\nunsigned int sphereVAO = 0;\nunsigned int indexCount;\nvoid renderSphere()\n{\n if (sphereVAO == 0)\n {\n glGenVertexArrays(1, &sphereVAO);\n\n unsigned int vbo, ebo;\n glGenBuffers(1, &vbo);\n glGenBuffers(1, &ebo);\n\n std::vector positions;\n std::vector uv;\n std::vector normals;\n std::vector indices;\n\n const unsigned int X_SEGMENTS = 64;\n const unsigned int Y_SEGMENTS = 64;\n const float PI = 3.14159265359f;\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n for (unsigned int y = 0; y <= Y_SEGMENTS; ++y)\n {\n float xSegment = (float)x / (float)X_SEGMENTS;\n float ySegment = (float)y / (float)Y_SEGMENTS;\n float xPos = std::cos(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n float yPos = std::cos(ySegment * PI);\n float zPos = std::sin(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n\n positions.push_back(glm::vec3(xPos, yPos, zPos));\n uv.push_back(glm::vec2(xSegment, ySegment));\n normals.push_back(glm::vec3(xPos, yPos, zPos));\n }\n }\n\n bool oddRow = false;\n for (unsigned int y = 0; y < Y_SEGMENTS; ++y)\n {\n if (!oddRow) // even rows: y == 0, y == 2; and so on\n {\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n }\n }\n else\n {\n for (int x = X_SEGMENTS; x >= 0; --x)\n {\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n }\n }\n oddRow = !oddRow;\n }\n indexCount = static_cast(indices.size());\n\n std::vector data;\n for (unsigned int i = 0; i < positions.size(); ++i)\n {\n data.push_back(positions[i].x);\n data.push_back(positions[i].y);\n data.push_back(positions[i].z); \n if (normals.size() > 0)\n {\n data.push_back(normals[i].x);\n data.push_back(normals[i].y);\n data.push_back(normals[i].z);\n }\n if (uv.size() > 0)\n {\n data.push_back(uv[i].x);\n data.push_back(uv[i].y);\n }\n }\n glBindVertexArray(sphereVAO);\n glBindBuffer(GL_ARRAY_BUFFER, vbo);\n glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(float), &data[0], GL_STATIC_DRAW);\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);\n unsigned int stride = (3 + 2 + 3) * sizeof(float);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (void*)0);\n glEnableVertexAttribArray(1); \n\t\tglVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\t\tglVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, stride, (void*)(6 * sizeof(float))); \n }\n\n glBindVertexArray(sphereVAO);\n glDrawElements(GL_TRIANGLE_STRIP, indexCount, GL_UNSIGNED_INT, 0);\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.142, "dedup_hash": "a1722593b20107e6", "has_readme": true} +{"id": "joeydevries_learnopengl_src_6_pbr_1_2_lighting_textured", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:20+00:00", "source_type": "repo", "title": "1.2.Lighting Textured", "api": "OpenGL Core", "glsl_version": null, "topic": "pbr/lighting/postprocessing/texturing/bumpmapping", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/6.pbr/1.2.lighting_textured/1.2.pbr.fs", "language": "glsl", "loc": 124, "comment_density": 0.258, "code": "#version 330 core\nout vec4 FragColor;\nin vec2 TexCoords;\nin vec3 WorldPos;\nin vec3 Normal;\n\n// material parameters\nuniform sampler2D albedoMap;\nuniform sampler2D normalMap;\nuniform sampler2D metallicMap;\nuniform sampler2D roughnessMap;\nuniform sampler2D aoMap;\n\n// lights\nuniform vec3 lightPositions[4];\nuniform vec3 lightColors[4];\n\nuniform vec3 camPos;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\n// Easy trick to get tangent-normals to world-space to keep PBR code simplified.\n// Don't worry if you don't get what's going on; you generally want to do normal \n// mapping the usual way for performance anyways; I do plan make a note of this \n// technique somewhere later in the normal mapping tutorial.\nvec3 getNormalFromMap()\n{\n vec3 tangentNormal = texture(normalMap, TexCoords).xyz * 2.0 - 1.0;\n\n vec3 Q1 = dFdx(WorldPos);\n vec3 Q2 = dFdy(WorldPos);\n vec2 st1 = dFdx(TexCoords);\n vec2 st2 = dFdy(TexCoords);\n\n vec3 N = normalize(Normal);\n vec3 T = normalize(Q1*st2.t - Q2*st1.t);\n vec3 B = -normalize(cross(N, T));\n mat3 TBN = mat3(T, B, N);\n\n return normalize(TBN * tangentNormal);\n}\n// ----------------------------------------------------------------------------\nfloat DistributionGGX(vec3 N, vec3 H, float roughness)\n{\n float a = roughness*roughness;\n float a2 = a*a;\n float NdotH = max(dot(N, H), 0.0);\n float NdotH2 = NdotH*NdotH;\n\n float nom = a2;\n float denom = (NdotH2 * (a2 - 1.0) + 1.0);\n denom = PI * denom * denom;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySchlickGGX(float NdotV, float roughness)\n{\n float r = (roughness + 1.0);\n float k = (r*r) / 8.0;\n\n float nom = NdotV;\n float denom = NdotV * (1.0 - k) + k;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)\n{\n float NdotV = max(dot(N, V), 0.0);\n float NdotL = max(dot(N, L), 0.0);\n float ggx2 = GeometrySchlickGGX(NdotV, roughness);\n float ggx1 = GeometrySchlickGGX(NdotL, roughness);\n\n return ggx1 * ggx2;\n}\n// ----------------------------------------------------------------------------\nvec3 fresnelSchlick(float cosTheta, vec3 F0)\n{\n return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n}\n// ----------------------------------------------------------------------------\nvoid main()\n{\t\t\n vec3 albedo = pow(texture(albedoMap, TexCoords).rgb, vec3(2.2));\n float metallic = texture(metallicMap, TexCoords).r;\n float roughness = texture(roughnessMap, TexCoords).r;\n float ao = texture(aoMap, TexCoords).r;\n\n vec3 N = getNormalFromMap();\n vec3 V = normalize(camPos - WorldPos);\n\n // calculate reflectance at normal incidence; if dia-electric (like plastic) use F0 \n // of 0.04 and if it's a metal, use the albedo color as F0 (metallic workflow) \n vec3 F0 = vec3(0.04); \n F0 = mix(F0, albedo, metallic);\n\n // reflectance equation\n vec3 Lo = vec3(0.0);\n for(int i = 0; i < 4; ++i) \n {\n // calculate per-light radiance\n vec3 L = normalize(lightPositions[i] - WorldPos);\n vec3 H = normalize(V + L);\n float distance = length(lightPositions[i] - WorldPos);\n float attenuation = 1.0 / (distance * distance);\n vec3 radiance = lightColors[i] * attenuation;\n\n // Cook-Torrance BRDF\n float NDF = DistributionGGX(N, H, roughness); \n float G = GeometrySmith(N, V, L, roughness); \n vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);\n \n vec3 numerator = NDF * G * F; \n float denominator = 4.0 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero\n vec3 specular = numerator / denominator;\n \n // kS is equal to Fresnel\n vec3 kS = F;\n // for energy conservation, the diffuse and specular light can't\n // be above 1.0 (unless the surface emits light); to preserve this\n // relationship the diffuse component (kD) should equal 1.0 - kS.\n vec3 kD = vec3(1.0) - kS;\n // multiply kD by the inverse metalness such that only non-metals \n // have diffuse lighting, or a linear blend if partly metal (pure metals\n // have no diffuse light).\n kD *= 1.0 - metallic;\t \n\n // scale light by NdotL\n float NdotL = max(dot(N, L), 0.0); \n\n // add to outgoing radiance Lo\n Lo += (kD * albedo / PI + specular) * radiance * NdotL; // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again\n } \n \n // ambient lighting (note that the next IBL tutorial will replace \n // this ambient lighting with environment lighting).\n vec3 ambient = vec3(0.03) * albedo * ao;\n \n vec3 color = ambient + Lo;\n\n // HDR tonemapping\n color = color / (color + vec3(1.0));\n // gamma correct\n color = pow(color, vec3(1.0/2.2)); \n\n FragColor = vec4(color, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/1.2.lighting_textured/1.2.pbr.vs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\nout vec3 WorldPos;\nout vec3 Normal;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat3 normalMatrix;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n WorldPos = vec3(model * vec4(aPos, 1.0));\n Normal = normalMatrix * aNormal; \n\n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/1.2.lighting_textured/lighting_textured.cpp", "language": "code", "loc": 339, "comment_density": 0.153, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderSphere();\n\n// settings\nconst unsigned int SCR_WIDTH = 1280;\nconst unsigned int SCR_HEIGHT = 720;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = 800.0f / 2.0;\nfloat lastY = 600.0 / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_SAMPLES, 4);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n glfwMakeContextCurrent(window);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"1.2.pbr.vs\", \"1.2.pbr.fs\");\n\n shader.use();\n shader.setInt(\"albedoMap\", 0);\n shader.setInt(\"normalMap\", 1);\n shader.setInt(\"metallicMap\", 2);\n shader.setInt(\"roughnessMap\", 3);\n shader.setInt(\"aoMap\", 4);\n\n // load PBR material textures\n // --------------------------\n unsigned int albedo = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/albedo.png\").c_str());\n unsigned int normal = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/normal.png\").c_str());\n unsigned int metallic = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/metallic.png\").c_str());\n unsigned int roughness = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/roughness.png\").c_str());\n unsigned int ao = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/ao.png\").c_str());\n\n // lights\n // ------\n glm::vec3 lightPositions[] = {\n glm::vec3(0.0f, 0.0f, 10.0f),\n };\n glm::vec3 lightColors[] = {\n glm::vec3(150.0f, 150.0f, 150.0f),\n };\n int nrRows = 7;\n int nrColumns = 7;\n float spacing = 2.5;\n\n // initialize static shader uniforms before rendering\n // --------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.use();\n shader.setMat4(\"projection\", projection);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"view\", view);\n shader.setVec3(\"camPos\", camera.Position);\n\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, albedo);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, normal);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, metallic);\n glActiveTexture(GL_TEXTURE3);\n glBindTexture(GL_TEXTURE_2D, roughness);\n glActiveTexture(GL_TEXTURE4);\n glBindTexture(GL_TEXTURE_2D, ao);\n\n // render rows*column number of spheres with material properties defined by textures (they all have the same material properties)\n glm::mat4 model = glm::mat4(1.0f);\n for (int row = 0; row < nrRows; ++row)\n {\n for (int col = 0; col < nrColumns; ++col)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(\n (float)(col - (nrColumns / 2)) * spacing,\n (float)(row - (nrRows / 2)) * spacing,\n 0.0f\n ));\n shader.setMat4(\"model\", model);\n shader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n }\n\n // render light source (simply re-render sphere at light positions)\n // this looks a bit off as we use the same shader, but it'll make their positions obvious and \n // keeps the codeprint small.\n for (unsigned int i = 0; i < sizeof(lightPositions) / sizeof(lightPositions[0]); ++i)\n {\n glm::vec3 newPos = lightPositions[i] + glm::vec3(sin(glfwGetTime() * 5.0) * 5.0, 0.0, 0.0);\n newPos = lightPositions[i];\n shader.setVec3(\"lightPositions[\" + std::to_string(i) + \"]\", newPos);\n shader.setVec3(\"lightColors[\" + std::to_string(i) + \"]\", lightColors[i]);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, newPos);\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n shader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// renders (and builds at first invocation) a sphere\n// -------------------------------------------------\nunsigned int sphereVAO = 0;\nunsigned int indexCount;\nvoid renderSphere()\n{\n if (sphereVAO == 0)\n {\n glGenVertexArrays(1, &sphereVAO);\n\n unsigned int vbo, ebo;\n glGenBuffers(1, &vbo);\n glGenBuffers(1, &ebo);\n\n std::vector positions;\n std::vector uv;\n std::vector normals;\n std::vector indices;\n\n const unsigned int X_SEGMENTS = 64;\n const unsigned int Y_SEGMENTS = 64;\n const float PI = 3.14159265359f;\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n for (unsigned int y = 0; y <= Y_SEGMENTS; ++y)\n {\n float xSegment = (float)x / (float)X_SEGMENTS;\n float ySegment = (float)y / (float)Y_SEGMENTS;\n float xPos = std::cos(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n float yPos = std::cos(ySegment * PI);\n float zPos = std::sin(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n\n positions.push_back(glm::vec3(xPos, yPos, zPos));\n uv.push_back(glm::vec2(xSegment, ySegment));\n normals.push_back(glm::vec3(xPos, yPos, zPos));\n }\n }\n\n bool oddRow = false;\n for (unsigned int y = 0; y < Y_SEGMENTS; ++y)\n {\n if (!oddRow) // even rows: y == 0, y == 2; and so on\n {\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n }\n }\n else\n {\n for (int x = X_SEGMENTS; x >= 0; --x)\n {\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n }\n }\n oddRow = !oddRow;\n }\n indexCount = static_cast(indices.size());\n\n std::vector data;\n for (unsigned int i = 0; i < positions.size(); ++i)\n {\n data.push_back(positions[i].x);\n data.push_back(positions[i].y);\n data.push_back(positions[i].z);\n if (normals.size() > 0)\n {\n data.push_back(normals[i].x);\n data.push_back(normals[i].y);\n data.push_back(normals[i].z);\n }\n if (uv.size() > 0)\n {\n data.push_back(uv[i].x);\n data.push_back(uv[i].y);\n }\n }\n glBindVertexArray(sphereVAO);\n glBindBuffer(GL_ARRAY_BUFFER, vbo);\n glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(float), &data[0], GL_STATIC_DRAW);\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);\n unsigned int stride = (3 + 2 + 3) * sizeof(float);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, stride, (void*)(6 * sizeof(float)));\n }\n\n glBindVertexArray(sphereVAO);\n glDrawElements(GL_TRIANGLE_STRIP, indexCount, GL_UNSIGNED_INT, 0);\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.137, "dedup_hash": "d80d8fa56be170cf", "has_readme": true} +{"id": "joeydevries_learnopengl_src_6_pbr_2_1_1_ibl_irradiance_conversion", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:21+00:00", "source_type": "repo", "title": "2.1.1.Ibl Irradiance Conversion", "api": "OpenGL Core", "glsl_version": null, "topic": "pbr/lighting/postprocessing/texturing/framebuffer", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.background.fs", "language": "glsl", "loc": 12, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\n\nvoid main()\n{\t\t\n vec3 envColor = texture(environmentMap, WorldPos).rgb;\n \n // HDR tonemap and gamma correct\n envColor = envColor / (envColor + vec3(1.0));\n envColor = pow(envColor, vec3(1.0/2.2)); \n \n FragColor = vec4(envColor, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.background.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nout vec3 WorldPos;\n\nvoid main()\n{\n WorldPos = aPos;\n\n\tmat4 rotView = mat4(mat3(view));\n\tvec4 clipPos = projection * rotView * vec4(WorldPos, 1.0);\n\n\tgl_Position = clipPos.xyww;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.cubemap.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout vec3 WorldPos;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n WorldPos = aPos;\n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.equirectangular_to_cubemap.fs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform sampler2D equirectangularMap;\n\nconst vec2 invAtan = vec2(0.1591, 0.3183);\nvec2 SampleSphericalMap(vec3 v)\n{\n vec2 uv = vec2(atan(v.z, v.x), asin(v.y));\n uv *= invAtan;\n uv += 0.5;\n return uv;\n}\n\nvoid main()\n{\t\t\n vec2 uv = SampleSphericalMap(normalize(WorldPos));\n vec3 color = texture(equirectangularMap, uv).rgb;\n \n FragColor = vec4(color, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.pbr.fs", "language": "glsl", "loc": 100, "comment_density": 0.25, "code": "#version 330 core\nout vec4 FragColor;\nin vec2 TexCoords;\nin vec3 WorldPos;\nin vec3 Normal;\n\n// material parameters\nuniform vec3 albedo;\nuniform float metallic;\nuniform float roughness;\nuniform float ao;\n\n// lights\nuniform vec3 lightPositions[4];\nuniform vec3 lightColors[4];\n\nuniform vec3 camPos;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\nfloat DistributionGGX(vec3 N, vec3 H, float roughness)\n{\n float a = roughness*roughness;\n float a2 = a*a;\n float NdotH = max(dot(N, H), 0.0);\n float NdotH2 = NdotH*NdotH;\n\n float nom = a2;\n float denom = (NdotH2 * (a2 - 1.0) + 1.0);\n denom = PI * denom * denom;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySchlickGGX(float NdotV, float roughness)\n{\n float r = (roughness + 1.0);\n float k = (r*r) / 8.0;\n\n float nom = NdotV;\n float denom = NdotV * (1.0 - k) + k;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)\n{\n float NdotV = max(dot(N, V), 0.0);\n float NdotL = max(dot(N, L), 0.0);\n float ggx2 = GeometrySchlickGGX(NdotV, roughness);\n float ggx1 = GeometrySchlickGGX(NdotL, roughness);\n\n return ggx1 * ggx2;\n}\n// ----------------------------------------------------------------------------\nvec3 fresnelSchlick(float cosTheta, vec3 F0)\n{\n return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n}\n// ----------------------------------------------------------------------------\nvoid main()\n{\t\t\n vec3 N = Normal;\n vec3 V = normalize(camPos - WorldPos);\n vec3 R = reflect(-V, N); \n\n // calculate reflectance at normal incidence; if dia-electric (like plastic) use F0 \n // of 0.04 and if it's a metal, use the albedo color as F0 (metallic workflow) \n vec3 F0 = vec3(0.04); \n F0 = mix(F0, albedo, metallic);\n\n // reflectance equation\n vec3 Lo = vec3(0.0);\n for(int i = 0; i < 4; ++i) \n {\n // calculate per-light radiance\n vec3 L = normalize(lightPositions[i] - WorldPos);\n vec3 H = normalize(V + L);\n float distance = length(lightPositions[i] - WorldPos);\n float attenuation = 1.0 / (distance * distance);\n vec3 radiance = lightColors[i] * attenuation;\n\n // Cook-Torrance BRDF\n float NDF = DistributionGGX(N, H, roughness); \n float G = GeometrySmith(N, V, L, roughness); \n vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0);\n \n vec3 numerator = NDF * G * F; \n float denominator = 4.0 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero\n vec3 specular = numerator / denominator;\n \n // kS is equal to Fresnel\n vec3 kS = F;\n // for energy conservation, the diffuse and specular light can't\n // be above 1.0 (unless the surface emits light); to preserve this\n // relationship the diffuse component (kD) should equal 1.0 - kS.\n vec3 kD = vec3(1.0) - kS;\n // multiply kD by the inverse metalness such that only non-metals \n // have diffuse lighting, or a linear blend if partly metal (pure metals\n // have no diffuse light).\n kD *= 1.0 - metallic;\t \n\n // scale light by NdotL\n float NdotL = max(dot(N, L), 0.0); \n\n // add to outgoing radiance Lo\n Lo += (kD * albedo / PI + specular) * radiance * NdotL; // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again\n } \n \n vec3 ambient = vec3(0.03) * albedo * ao;\n \n vec3 color = ambient + Lo;\n\n // HDR tonemapping\n color = color / (color + vec3(1.0));\n // gamma correct\n color = pow(color, vec3(1.0/2.2)); \n\n FragColor = vec4(color, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.pbr.vs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\nout vec3 WorldPos;\nout vec3 Normal;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat3 normalMatrix;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n WorldPos = vec3(model * vec4(aPos, 1.0));\n Normal = normalMatrix * aNormal; \n\n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.1.ibl_irradiance_conversion/ibl_irradiance_conversion.cpp", "language": "code", "loc": 468, "comment_density": 0.256, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nvoid renderSphere();\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 1280;\nconst unsigned int SCR_HEIGHT = 720;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = 800.0f / 2.0;\nfloat lastY = 600.0 / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_SAMPLES, 4);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n glfwMakeContextCurrent(window);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glDepthFunc(GL_LEQUAL); // set depth function to less than AND equal for skybox depth trick.\n\n // build and compile shaders\n // -------------------------\n Shader pbrShader(\"2.1.1.pbr.vs\", \"2.1.1.pbr.fs\");\n Shader equirectangularToCubemapShader(\"2.1.1.cubemap.vs\", \"2.1.1.equirectangular_to_cubemap.fs\");\n Shader backgroundShader(\"2.1.1.background.vs\", \"2.1.1.background.fs\");\n\n\n pbrShader.use();\n pbrShader.setVec3(\"albedo\", 0.5f, 0.0f, 0.0f);\n pbrShader.setFloat(\"ao\", 1.0f);\n\n backgroundShader.use();\n backgroundShader.setInt(\"environmentMap\", 0);\n\n\n // lights\n // ------\n glm::vec3 lightPositions[] = {\n glm::vec3(-10.0f, 10.0f, 10.0f),\n glm::vec3( 10.0f, 10.0f, 10.0f),\n glm::vec3(-10.0f, -10.0f, 10.0f),\n glm::vec3( 10.0f, -10.0f, 10.0f),\n };\n glm::vec3 lightColors[] = {\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f)\n };\n int nrRows = 7;\n int nrColumns = 7;\n float spacing = 2.5;\n\n // pbr: setup framebuffer\n // ----------------------\n unsigned int captureFBO;\n unsigned int captureRBO;\n glGenFramebuffers(1, &captureFBO);\n glGenRenderbuffers(1, &captureRBO);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 512, 512);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, captureRBO);\n\n // pbr: load the HDR environment map\n // ---------------------------------\n stbi_set_flip_vertically_on_load(true);\n int width, height, nrComponents;\n float *data = stbi_loadf(FileSystem::getPath(\"resources/textures/hdr/newport_loft.hdr\").c_str(), &width, &height, &nrComponents, 0);\n unsigned int hdrTexture;\n if (data)\n {\n glGenTextures(1, &hdrTexture);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, width, height, 0, GL_RGB, GL_FLOAT, data); // note how we specify the texture's data value to be float\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Failed to load HDR image.\" << std::endl;\n }\n\n // pbr: setup cubemap to render to and attach to framebuffer\n // ---------------------------------------------------------\n unsigned int envCubemap;\n glGenTextures(1, &envCubemap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 512, 512, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); \n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n // pbr: set up projection and view matrices for capturing data onto the 6 cubemap face directions\n // ----------------------------------------------------------------------------------------------\n glm::mat4 captureProjection = glm::perspective(glm::radians(90.0f), 1.0f, 0.1f, 10.0f);\n glm::mat4 captureViews[] =\n {\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f))\n };\n\n // pbr: convert HDR equirectangular environment map to cubemap equivalent\n // ----------------------------------------------------------------------\n equirectangularToCubemapShader.use();\n equirectangularToCubemapShader.setInt(\"equirectangularMap\", 0);\n equirectangularToCubemapShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n\n glViewport(0, 0, 512, 512); // don't forget to configure the viewport to the capture dimensions.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n for (unsigned int i = 0; i < 6; ++i)\n {\n equirectangularToCubemapShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, envCubemap, 0);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // initialize static shader uniforms before rendering\n // --------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n pbrShader.use();\n pbrShader.setMat4(\"projection\", projection);\n backgroundShader.use();\n backgroundShader.setMat4(\"projection\", projection);\n\n // then before rendering, configure the viewport to the original framebuffer's screen dimensions\n int scrWidth, scrHeight;\n glfwGetFramebufferSize(window, &scrWidth, &scrHeight);\n glViewport(0, 0, scrWidth, scrHeight);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // render scene, supplying the convoluted irradiance map to the final shader.\n // ------------------------------------------------------------------------------------------\n pbrShader.use();\n glm::mat4 view = camera.GetViewMatrix();\n pbrShader.setMat4(\"view\", view);\n pbrShader.setVec3(\"camPos\", camera.Position);\n\n // render rows*column number of spheres with varying metallic/roughness values scaled by rows and columns respectively\n glm::mat4 model = glm::mat4(1.0f);\n for (int row = 0; row < nrRows; ++row)\n {\n pbrShader.setFloat(\"metallic\", (float)row / (float)nrRows);\n for (int col = 0; col < nrColumns; ++col)\n {\n // we clamp the roughness to 0.025 - 1.0 as perfectly smooth surfaces (roughness of 0.0) tend to look a bit off\n // on direct lighting.\n pbrShader.setFloat(\"roughness\", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(\n (float)(col - (nrColumns / 2)) * spacing,\n (float)(row - (nrRows / 2)) * spacing,\n -2.0f\n ));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n }\n\n\n // render light source (simply re-render sphere at light positions)\n // this looks a bit off as we use the same shader, but it'll make their positions obvious and \n // keeps the codeprint small.\n for (unsigned int i = 0; i < sizeof(lightPositions) / sizeof(lightPositions[0]); ++i)\n {\n glm::vec3 newPos = lightPositions[i] + glm::vec3(sin(glfwGetTime() * 5.0) * 5.0, 0.0, 0.0);\n newPos = lightPositions[i];\n pbrShader.setVec3(\"lightPositions[\" + std::to_string(i) + \"]\", newPos);\n pbrShader.setVec3(\"lightColors[\" + std::to_string(i) + \"]\", lightColors[i]);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, newPos);\n model = glm::scale(model, glm::vec3(0.5f));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n\n // render skybox (render as last to prevent overdraw)\n backgroundShader.use();\n backgroundShader.setMat4(\"view\", view);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n renderCube();\n\n /* equirectangularToCubemapShader.Use();\n equirectangularToCubemapShader.setMat4(\"view\", view\");\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n renderCube();*/\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// renders (and builds at first invocation) a sphere\n// -------------------------------------------------\nunsigned int sphereVAO = 0;\nunsigned int indexCount;\nvoid renderSphere()\n{\n if (sphereVAO == 0)\n {\n glGenVertexArrays(1, &sphereVAO);\n\n unsigned int vbo, ebo;\n glGenBuffers(1, &vbo);\n glGenBuffers(1, &ebo);\n\n std::vector positions;\n std::vector uv;\n std::vector normals;\n std::vector indices;\n\n const unsigned int X_SEGMENTS = 64;\n const unsigned int Y_SEGMENTS = 64;\n const float PI = 3.14159265359f;\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n for (unsigned int y = 0; y <= Y_SEGMENTS; ++y)\n {\n float xSegment = (float)x / (float)X_SEGMENTS;\n float ySegment = (float)y / (float)Y_SEGMENTS;\n float xPos = std::cos(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n float yPos = std::cos(ySegment * PI);\n float zPos = std::sin(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n\n positions.push_back(glm::vec3(xPos, yPos, zPos));\n uv.push_back(glm::vec2(xSegment, ySegment));\n normals.push_back(glm::vec3(xPos, yPos, zPos));\n }\n }\n\n bool oddRow = false;\n for (unsigned int y = 0; y < Y_SEGMENTS; ++y)\n {\n if (!oddRow) // even rows: y == 0, y == 2; and so on\n {\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n }\n }\n else\n {\n for (int x = X_SEGMENTS; x >= 0; --x)\n {\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n }\n }\n oddRow = !oddRow;\n }\n indexCount = static_cast(indices.size());\n\n std::vector data;\n for (unsigned int i = 0; i < positions.size(); ++i)\n {\n data.push_back(positions[i].x);\n data.push_back(positions[i].y);\n data.push_back(positions[i].z);\n if (normals.size() > 0)\n {\n data.push_back(normals[i].x);\n data.push_back(normals[i].y);\n data.push_back(normals[i].z);\n }\n if (uv.size() > 0)\n {\n data.push_back(uv[i].x);\n data.push_back(uv[i].y);\n }\n }\n glBindVertexArray(sphereVAO);\n glBindBuffer(GL_ARRAY_BUFFER, vbo);\n glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(float), &data[0], GL_STATIC_DRAW);\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);\n unsigned int stride = (3 + 2 + 3) * sizeof(float);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, stride, (void*)(6 * sizeof(float)));\n }\n\n glBindVertexArray(sphereVAO);\n glDrawElements(GL_TRIANGLE_STRIP, indexCount, GL_UNSIGNED_INT, 0);\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.084, "dedup_hash": "1150399437520a4b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_6_pbr_2_1_2_ibl_irradiance", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:21+00:00", "source_type": "repo", "title": "2.1.2.Ibl Irradiance", "api": "OpenGL Core", "glsl_version": null, "topic": "pbr/lighting/postprocessing/texturing/bumpmapping", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/6.pbr/2.1.2.ibl_irradiance/2.1.2.background.fs", "language": "glsl", "loc": 12, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\n\nvoid main()\n{\t\t\n vec3 envColor = texture(environmentMap, WorldPos).rgb;\n \n // HDR tonemap and gamma correct\n envColor = envColor / (envColor + vec3(1.0));\n envColor = pow(envColor, vec3(1.0/2.2)); \n \n FragColor = vec4(envColor, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.2.ibl_irradiance/2.1.2.background.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nout vec3 WorldPos;\n\nvoid main()\n{\n WorldPos = aPos;\n\n\tmat4 rotView = mat4(mat3(view));\n\tvec4 clipPos = projection * rotView * vec4(WorldPos, 1.0);\n\n\tgl_Position = clipPos.xyww;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.2.ibl_irradiance/2.1.2.cubemap.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout vec3 WorldPos;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n WorldPos = aPos; \n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.2.ibl_irradiance/2.1.2.equirectangular_to_cubemap.fs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform sampler2D equirectangularMap;\n\nconst vec2 invAtan = vec2(0.1591, 0.3183);\nvec2 SampleSphericalMap(vec3 v)\n{\n vec2 uv = vec2(atan(v.z, v.x), asin(v.y));\n uv *= invAtan;\n uv += 0.5;\n return uv;\n}\n\nvoid main()\n{\t\t\n vec2 uv = SampleSphericalMap(normalize(WorldPos));\n vec3 color = texture(equirectangularMap, uv).rgb;\n \n FragColor = vec4(color, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.2.ibl_irradiance/2.1.2.irradiance_convolution.fs", "language": "glsl", "loc": 35, "comment_density": 0.229, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\n\nconst float PI = 3.14159265359;\n\nvoid main()\n{\t\t\n\t// The world vector acts as the normal of a tangent surface\n // from the origin, aligned to WorldPos. Given this normal, calculate all\n // incoming radiance of the environment. The result of this radiance\n // is the radiance of light coming from -Normal direction, which is what\n // we use in the PBR shader to sample irradiance.\n vec3 N = normalize(WorldPos);\n\n vec3 irradiance = vec3(0.0); \n \n // tangent space calculation from origin point\n vec3 up = vec3(0.0, 1.0, 0.0);\n vec3 right = normalize(cross(up, N));\n up = normalize(cross(N, right));\n \n float sampleDelta = 0.025;\n float nrSamples = 0.0;\n for(float phi = 0.0; phi < 2.0 * PI; phi += sampleDelta)\n {\n for(float theta = 0.0; theta < 0.5 * PI; theta += sampleDelta)\n {\n // spherical to cartesian (in tangent space)\n vec3 tangentSample = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));\n // tangent space to world\n vec3 sampleVec = tangentSample.x * right + tangentSample.y * up + tangentSample.z * N; \n\n irradiance += texture(environmentMap, sampleVec).rgb * cos(theta) * sin(theta);\n nrSamples++;\n }\n }\n irradiance = PI * irradiance * (1.0 / float(nrSamples));\n \n FragColor = vec4(irradiance, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.2.ibl_irradiance/2.1.2.pbr.fs", "language": "glsl", "loc": 109, "comment_density": 0.257, "code": "#version 330 core\nout vec4 FragColor;\nin vec2 TexCoords;\nin vec3 WorldPos;\nin vec3 Normal;\n\n// material parameters\nuniform vec3 albedo;\nuniform float metallic;\nuniform float roughness;\nuniform float ao;\n\n// IBL\nuniform samplerCube irradianceMap;\n\n// lights\nuniform vec3 lightPositions[4];\nuniform vec3 lightColors[4];\n\nuniform vec3 camPos;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\nfloat DistributionGGX(vec3 N, vec3 H, float roughness)\n{\n float a = roughness*roughness;\n float a2 = a*a;\n float NdotH = max(dot(N, H), 0.0);\n float NdotH2 = NdotH*NdotH;\n\n float nom = a2;\n float denom = (NdotH2 * (a2 - 1.0) + 1.0);\n denom = PI * denom * denom;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySchlickGGX(float NdotV, float roughness)\n{\n float r = (roughness + 1.0);\n float k = (r*r) / 8.0;\n\n float nom = NdotV;\n float denom = NdotV * (1.0 - k) + k;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)\n{\n float NdotV = max(dot(N, V), 0.0);\n float NdotL = max(dot(N, L), 0.0);\n float ggx2 = GeometrySchlickGGX(NdotV, roughness);\n float ggx1 = GeometrySchlickGGX(NdotL, roughness);\n\n return ggx1 * ggx2;\n}\n// ----------------------------------------------------------------------------\nvec3 fresnelSchlick(float cosTheta, vec3 F0)\n{\n return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n}\n// ----------------------------------------------------------------------------\nvoid main()\n{\t\t\n vec3 N = Normal;\n vec3 V = normalize(camPos - WorldPos);\n vec3 R = reflect(-V, N); \n\n // calculate reflectance at normal incidence; if dia-electric (like plastic) use F0 \n // of 0.04 and if it's a metal, use the albedo color as F0 (metallic workflow) \n vec3 F0 = vec3(0.04); \n F0 = mix(F0, albedo, metallic);\n\n // reflectance equation\n vec3 Lo = vec3(0.0);\n for(int i = 0; i < 4; ++i) \n {\n // calculate per-light radiance\n vec3 L = normalize(lightPositions[i] - WorldPos);\n vec3 H = normalize(V + L);\n float distance = length(lightPositions[i] - WorldPos);\n float attenuation = 1.0 / (distance * distance);\n vec3 radiance = lightColors[i] * attenuation;\n\n // Cook-Torrance BRDF\n float NDF = DistributionGGX(N, H, roughness); \n float G = GeometrySmith(N, V, L, roughness); \n vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0); \n \n vec3 numerator = NDF * G * F;\n float denominator = 4.0 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero\n vec3 specular = numerator / denominator;\n \n // kS is equal to Fresnel\n vec3 kS = F;\n // for energy conservation, the diffuse and specular light can't\n // be above 1.0 (unless the surface emits light); to preserve this\n // relationship the diffuse component (kD) should equal 1.0 - kS.\n vec3 kD = vec3(1.0) - kS;\n // multiply kD by the inverse metalness such that only non-metals \n // have diffuse lighting, or a linear blend if partly metal (pure metals\n // have no diffuse light).\n kD *= 1.0 - metallic;\t \n \n // scale light by NdotL\n float NdotL = max(dot(N, L), 0.0); \n\n // add to outgoing radiance Lo\n Lo += (kD * albedo / PI + specular) * radiance * NdotL; // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again\n } \n \n // ambient lighting (we now use IBL as the ambient term)\n vec3 kS = fresnelSchlick(max(dot(N, V), 0.0), F0);\n vec3 kD = 1.0 - kS;\n kD *= 1.0 - metallic;\t \n vec3 irradiance = texture(irradianceMap, N).rgb;\n vec3 diffuse = irradiance * albedo;\n vec3 ambient = (kD * diffuse) * ao;\n // vec3 ambient = vec3(0.002);\n \n vec3 color = ambient + Lo;\n\n // HDR tonemapping\n color = color / (color + vec3(1.0));\n // gamma correct\n color = pow(color, vec3(1.0/2.2)); \n\n FragColor = vec4(color , 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.2.ibl_irradiance/2.1.2.pbr.vs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\nout vec3 WorldPos;\nout vec3 Normal;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat3 normalMatrix;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n WorldPos = vec3(model * vec4(aPos, 1.0));\n Normal = normalMatrix * aNormal; \n\n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.1.2.ibl_irradiance/ibl_irradiance.cpp", "language": "code", "loc": 503, "comment_density": 0.243, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nvoid renderSphere();\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 1280;\nconst unsigned int SCR_HEIGHT = 720;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = 800.0f / 2.0;\nfloat lastY = 600.0 / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_SAMPLES, 4);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n glfwMakeContextCurrent(window);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glDepthFunc(GL_LEQUAL); // set depth function to less than AND equal for skybox depth trick.\n\n // build and compile shaders\n // -------------------------\n Shader pbrShader(\"2.1.2.pbr.vs\", \"2.1.2.pbr.fs\");\n Shader equirectangularToCubemapShader(\"2.1.2.cubemap.vs\", \"2.1.2.equirectangular_to_cubemap.fs\");\n Shader irradianceShader(\"2.1.2.cubemap.vs\", \"2.1.2.irradiance_convolution.fs\");\n Shader backgroundShader(\"2.1.2.background.vs\", \"2.1.2.background.fs\");\n\n\n pbrShader.use();\n pbrShader.setInt(\"irradianceMap\", 0);\n pbrShader.setVec3(\"albedo\", 0.5f, 0.0f, 0.0f);\n pbrShader.setFloat(\"ao\", 1.0f);\n\n backgroundShader.use();\n backgroundShader.setInt(\"environmentMap\", 0);\n\n\n // lights\n // ------\n glm::vec3 lightPositions[] = {\n glm::vec3(-10.0f, 10.0f, 10.0f),\n glm::vec3( 10.0f, 10.0f, 10.0f),\n glm::vec3(-10.0f, -10.0f, 10.0f),\n glm::vec3( 10.0f, -10.0f, 10.0f),\n };\n glm::vec3 lightColors[] = {\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f)\n };\n int nrRows = 7;\n int nrColumns = 7;\n float spacing = 2.5;\n\n // pbr: setup framebuffer\n // ----------------------\n unsigned int captureFBO;\n unsigned int captureRBO;\n glGenFramebuffers(1, &captureFBO);\n glGenRenderbuffers(1, &captureRBO);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 512, 512);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, captureRBO);\n\n // pbr: load the HDR environment map\n // ---------------------------------\n stbi_set_flip_vertically_on_load(true);\n int width, height, nrComponents;\n float *data = stbi_loadf(FileSystem::getPath(\"resources/textures/hdr/newport_loft.hdr\").c_str(), &width, &height, &nrComponents, 0);\n unsigned int hdrTexture;\n if (data)\n {\n glGenTextures(1, &hdrTexture);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, width, height, 0, GL_RGB, GL_FLOAT, data); // note how we specify the texture's data value to be float\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Failed to load HDR image.\" << std::endl;\n }\n\n // pbr: setup cubemap to render to and attach to framebuffer\n // ---------------------------------------------------------\n unsigned int envCubemap;\n glGenTextures(1, &envCubemap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 512, 512, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); \n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n // pbr: set up projection and view matrices for capturing data onto the 6 cubemap face directions\n // ----------------------------------------------------------------------------------------------\n glm::mat4 captureProjection = glm::perspective(glm::radians(90.0f), 1.0f, 0.1f, 10.0f);\n glm::mat4 captureViews[] =\n {\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f))\n };\n\n // pbr: convert HDR equirectangular environment map to cubemap equivalent\n // ----------------------------------------------------------------------\n equirectangularToCubemapShader.use();\n equirectangularToCubemapShader.setInt(\"equirectangularMap\", 0);\n equirectangularToCubemapShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n\n glViewport(0, 0, 512, 512); // don't forget to configure the viewport to the capture dimensions.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n for (unsigned int i = 0; i < 6; ++i)\n {\n equirectangularToCubemapShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, envCubemap, 0);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // pbr: create an irradiance cubemap, and re-scale capture FBO to irradiance scale.\n // --------------------------------------------------------------------------------\n unsigned int irradianceMap;\n glGenTextures(1, &irradianceMap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 32, 32, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 32, 32);\n\n // pbr: solve diffuse integral by convolution to create an irradiance (cube)map.\n // -----------------------------------------------------------------------------\n irradianceShader.use();\n irradianceShader.setInt(\"environmentMap\", 0);\n irradianceShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n\n glViewport(0, 0, 32, 32); // don't forget to configure the viewport to the capture dimensions.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n for (unsigned int i = 0; i < 6; ++i)\n {\n irradianceShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, irradianceMap, 0);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // initialize static shader uniforms before rendering\n // --------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n pbrShader.use();\n pbrShader.setMat4(\"projection\", projection);\n backgroundShader.use();\n backgroundShader.setMat4(\"projection\", projection);\n\n // then before rendering, configure the viewport to the original framebuffer's screen dimensions\n int scrWidth, scrHeight;\n glfwGetFramebufferSize(window, &scrWidth, &scrHeight);\n glViewport(0, 0, scrWidth, scrHeight);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // render scene, supplying the convoluted irradiance map to the final shader.\n // ------------------------------------------------------------------------------------------\n pbrShader.use();\n glm::mat4 view = camera.GetViewMatrix();\n pbrShader.setMat4(\"view\", view);\n pbrShader.setVec3(\"camPos\", camera.Position);\n\n // bind pre-computed IBL data\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap);\n\n // render rows*column number of spheres with varying metallic/roughness values scaled by rows and columns respectively\n glm::mat4 model = glm::mat4(1.0f);\n for (int row = 0; row < nrRows; ++row)\n {\n pbrShader.setFloat(\"metallic\", (float)row / (float)nrRows);\n for (int col = 0; col < nrColumns; ++col)\n {\n // we clamp the roughness to 0.025 - 1.0 as perfectly smooth surfaces (roughness of 0.0) tend to look a bit off\n // on direct lighting.\n pbrShader.setFloat(\"roughness\", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(\n (float)(col - (nrColumns / 2)) * spacing,\n (float)(row - (nrRows / 2)) * spacing,\n -2.0f\n ));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n }\n\n\n // render light source (simply re-render sphere at light positions)\n // this looks a bit off as we use the same shader, but it'll make their positions obvious and \n // keeps the codeprint small.\n for (unsigned int i = 0; i < sizeof(lightPositions) / sizeof(lightPositions[0]); ++i)\n {\n glm::vec3 newPos = lightPositions[i] + glm::vec3(sin(glfwGetTime() * 5.0) * 5.0, 0.0, 0.0);\n newPos = lightPositions[i];\n pbrShader.setVec3(\"lightPositions[\" + std::to_string(i) + \"]\", newPos);\n pbrShader.setVec3(\"lightColors[\" + std::to_string(i) + \"]\", lightColors[i]);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, newPos);\n model = glm::scale(model, glm::vec3(0.5f));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n\n // render skybox (render as last to prevent overdraw)\n backgroundShader.use();\n backgroundShader.setMat4(\"view\", view);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n //glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap); // display irradiance map\n renderCube();\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// renders (and builds at first invocation) a sphere\n// -------------------------------------------------\nunsigned int sphereVAO = 0;\nunsigned int indexCount;\nvoid renderSphere()\n{\n if (sphereVAO == 0)\n {\n glGenVertexArrays(1, &sphereVAO);\n\n unsigned int vbo, ebo;\n glGenBuffers(1, &vbo);\n glGenBuffers(1, &ebo);\n\n std::vector positions;\n std::vector uv;\n std::vector normals;\n std::vector indices;\n\n const unsigned int X_SEGMENTS = 64;\n const unsigned int Y_SEGMENTS = 64;\n const float PI = 3.14159265359f;\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n for (unsigned int y = 0; y <= Y_SEGMENTS; ++y)\n {\n float xSegment = (float)x / (float)X_SEGMENTS;\n float ySegment = (float)y / (float)Y_SEGMENTS;\n float xPos = std::cos(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n float yPos = std::cos(ySegment * PI);\n float zPos = std::sin(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n\n positions.push_back(glm::vec3(xPos, yPos, zPos));\n uv.push_back(glm::vec2(xSegment, ySegment));\n normals.push_back(glm::vec3(xPos, yPos, zPos));\n }\n }\n\n bool oddRow = false;\n for (unsigned int y = 0; y < Y_SEGMENTS; ++y)\n {\n if (!oddRow) // even rows: y == 0, y == 2; and so on\n {\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n }\n }\n else\n {\n for (int x = X_SEGMENTS; x >= 0; --x)\n {\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n }\n }\n oddRow = !oddRow;\n }\n indexCount = static_cast(indices.size());\n\n std::vector data;\n for (unsigned int i = 0; i < positions.size(); ++i)\n {\n data.push_back(positions[i].x);\n data.push_back(positions[i].y);\n data.push_back(positions[i].z);\n if (normals.size() > 0)\n {\n data.push_back(normals[i].x);\n data.push_back(normals[i].y);\n data.push_back(normals[i].z);\n }\n if (uv.size() > 0)\n {\n data.push_back(uv[i].x);\n data.push_back(uv[i].y);\n }\n }\n glBindVertexArray(sphereVAO);\n glBindBuffer(GL_ARRAY_BUFFER, vbo);\n glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(float), &data[0], GL_STATIC_DRAW);\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);\n unsigned int stride = (3 + 2 + 3) * sizeof(float);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, stride, (void*)(6 * sizeof(float)));\n }\n\n glBindVertexArray(sphereVAO);\n glDrawElements(GL_TRIANGLE_STRIP, indexCount, GL_UNSIGNED_INT, 0);\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n"}], "validation": {"glslang_valid": 7, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.102, "dedup_hash": "20d930838b4da3d8", "has_readme": true} +{"id": "joeydevries_learnopengl_src_6_pbr_2_2_1_ibl_specular", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:22+00:00", "source_type": "repo", "title": "2.2.1.Ibl Specular", "api": "OpenGL Core", "glsl_version": null, "topic": "pbr/lighting/postprocessing/texturing/bumpmapping", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.background.fs", "language": "glsl", "loc": 12, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\n\nvoid main()\n{\t\t\n vec3 envColor = textureLod(environmentMap, WorldPos, 0.0).rgb;\n \n // HDR tonemap and gamma correct\n envColor = envColor / (envColor + vec3(1.0));\n envColor = pow(envColor, vec3(1.0/2.2)); \n \n FragColor = vec4(envColor, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.background.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nout vec3 WorldPos;\n\nvoid main()\n{\n WorldPos = aPos;\n\n\tmat4 rotView = mat4(mat3(view));\n\tvec4 clipPos = projection * rotView * vec4(WorldPos, 1.0);\n\n\tgl_Position = clipPos.xyww;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.brdf.fs", "language": "glsl", "loc": 99, "comment_density": 0.152, "code": "#version 330 core\nout vec2 FragColor;\nin vec2 TexCoords;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\n// http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n// efficient VanDerCorpus calculation.\nfloat RadicalInverse_VdC(uint bits) \n{\n bits = (bits << 16u) | (bits >> 16u);\n bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n return float(bits) * 2.3283064365386963e-10; // / 0x100000000\n}\n// ----------------------------------------------------------------------------\nvec2 Hammersley(uint i, uint N)\n{\n\treturn vec2(float(i)/float(N), RadicalInverse_VdC(i));\n}\n// ----------------------------------------------------------------------------\nvec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)\n{\n\tfloat a = roughness*roughness;\n\t\n\tfloat phi = 2.0 * PI * Xi.x;\n\tfloat cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));\n\tfloat sinTheta = sqrt(1.0 - cosTheta*cosTheta);\n\t\n\t// from spherical coordinates to cartesian coordinates - halfway vector\n\tvec3 H;\n\tH.x = cos(phi) * sinTheta;\n\tH.y = sin(phi) * sinTheta;\n\tH.z = cosTheta;\n\t\n\t// from tangent-space H vector to world-space sample vector\n\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\tvec3 tangent = normalize(cross(up, N));\n\tvec3 bitangent = cross(N, tangent);\n\t\n\tvec3 sampleVec = tangent * H.x + bitangent * H.y + N * H.z;\n\treturn normalize(sampleVec);\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySchlickGGX(float NdotV, float roughness)\n{\n // note that we use a different k for IBL\n float a = roughness;\n float k = (a * a) / 2.0;\n\n float nom = NdotV;\n float denom = NdotV * (1.0 - k) + k;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)\n{\n float NdotV = max(dot(N, V), 0.0);\n float NdotL = max(dot(N, L), 0.0);\n float ggx2 = GeometrySchlickGGX(NdotV, roughness);\n float ggx1 = GeometrySchlickGGX(NdotL, roughness);\n\n return ggx1 * ggx2;\n}\n// ----------------------------------------------------------------------------\nvec2 IntegrateBRDF(float NdotV, float roughness)\n{\n vec3 V;\n V.x = sqrt(1.0 - NdotV*NdotV);\n V.y = 0.0;\n V.z = NdotV;\n\n float A = 0.0;\n float B = 0.0; \n\n vec3 N = vec3(0.0, 0.0, 1.0);\n \n const uint SAMPLE_COUNT = 1024u;\n for(uint i = 0u; i < SAMPLE_COUNT; ++i)\n {\n // generates a sample vector that's biased towards the\n // preferred alignment direction (importance sampling).\n vec2 Xi = Hammersley(i, SAMPLE_COUNT);\n vec3 H = ImportanceSampleGGX(Xi, N, roughness);\n vec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n float NdotL = max(L.z, 0.0);\n float NdotH = max(H.z, 0.0);\n float VdotH = max(dot(V, H), 0.0);\n\n if(NdotL > 0.0)\n {\n float G = GeometrySmith(N, V, L, roughness);\n float G_Vis = (G * VdotH) / (NdotH * NdotV);\n float Fc = pow(1.0 - VdotH, 5.0);\n\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n A /= float(SAMPLE_COUNT);\n B /= float(SAMPLE_COUNT);\n return vec2(A, B);\n}\n// ----------------------------------------------------------------------------\nvoid main() \n{\n vec2 integratedBRDF = IntegrateBRDF(TexCoords.x, TexCoords.y);\n FragColor = integratedBRDF;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.brdf.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n\tgl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.cubemap.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout vec3 WorldPos;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n WorldPos = aPos; \n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.equirectangular_to_cubemap.fs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform sampler2D equirectangularMap;\n\nconst vec2 invAtan = vec2(0.1591, 0.3183);\nvec2 SampleSphericalMap(vec3 v)\n{\n vec2 uv = vec2(atan(v.z, v.x), asin(v.y));\n uv *= invAtan;\n uv += 0.5;\n return uv;\n}\n\nvoid main()\n{\t\t\n vec2 uv = SampleSphericalMap(normalize(WorldPos));\n vec3 color = texture(equirectangularMap, uv).rgb;\n \n FragColor = vec4(color, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.irradiance_convolution.fs", "language": "glsl", "loc": 30, "comment_density": 0.1, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\n\nconst float PI = 3.14159265359;\n\nvoid main()\n{\t\t\n vec3 N = normalize(WorldPos);\n\n vec3 irradiance = vec3(0.0); \n \n // tangent space calculation from origin point\n vec3 up = vec3(0.0, 1.0, 0.0);\n vec3 right = normalize(cross(up, N));\n up = normalize(cross(N, right));\n \n float sampleDelta = 0.025;\n float nrSamples = 0.0f;\n for(float phi = 0.0; phi < 2.0 * PI; phi += sampleDelta)\n {\n for(float theta = 0.0; theta < 0.5 * PI; theta += sampleDelta)\n {\n // spherical to cartesian (in tangent space)\n vec3 tangentSample = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));\n // tangent space to world\n vec3 sampleVec = tangentSample.x * right + tangentSample.y * up + tangentSample.z * N; \n\n irradiance += texture(environmentMap, sampleVec).rgb * cos(theta) * sin(theta);\n nrSamples++;\n }\n }\n irradiance = PI * irradiance * (1.0 / float(nrSamples));\n \n FragColor = vec4(irradiance, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.pbr.fs", "language": "glsl", "loc": 121, "comment_density": 0.24, "code": "#version 330 core\nout vec4 FragColor;\nin vec2 TexCoords;\nin vec3 WorldPos;\nin vec3 Normal;\n\n// material parameters\nuniform vec3 albedo;\nuniform float metallic;\nuniform float roughness;\nuniform float ao;\n\n// IBL\nuniform samplerCube irradianceMap;\nuniform samplerCube prefilterMap;\nuniform sampler2D brdfLUT;\n\n// lights\nuniform vec3 lightPositions[4];\nuniform vec3 lightColors[4];\n\nuniform vec3 camPos;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\nfloat DistributionGGX(vec3 N, vec3 H, float roughness)\n{\n float a = roughness*roughness;\n float a2 = a*a;\n float NdotH = max(dot(N, H), 0.0);\n float NdotH2 = NdotH*NdotH;\n\n float nom = a2;\n float denom = (NdotH2 * (a2 - 1.0) + 1.0);\n denom = PI * denom * denom;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySchlickGGX(float NdotV, float roughness)\n{\n float r = (roughness + 1.0);\n float k = (r*r) / 8.0;\n\n float nom = NdotV;\n float denom = NdotV * (1.0 - k) + k;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)\n{\n float NdotV = max(dot(N, V), 0.0);\n float NdotL = max(dot(N, L), 0.0);\n float ggx2 = GeometrySchlickGGX(NdotV, roughness);\n float ggx1 = GeometrySchlickGGX(NdotL, roughness);\n\n return ggx1 * ggx2;\n}\n// ----------------------------------------------------------------------------\nvec3 fresnelSchlick(float cosTheta, vec3 F0)\n{\n return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n}\n// ----------------------------------------------------------------------------\nvec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness)\n{\n return F0 + (max(vec3(1.0 - roughness), F0) - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n} \n// ----------------------------------------------------------------------------\nvoid main()\n{\t\t\n vec3 N = Normal;\n vec3 V = normalize(camPos - WorldPos);\n vec3 R = reflect(-V, N); \n\n // calculate reflectance at normal incidence; if dia-electric (like plastic) use F0 \n // of 0.04 and if it's a metal, use the albedo color as F0 (metallic workflow) \n vec3 F0 = vec3(0.04); \n F0 = mix(F0, albedo, metallic);\n\n // reflectance equation\n vec3 Lo = vec3(0.0);\n for(int i = 0; i < 4; ++i) \n {\n // calculate per-light radiance\n vec3 L = normalize(lightPositions[i] - WorldPos);\n vec3 H = normalize(V + L);\n float distance = length(lightPositions[i] - WorldPos);\n float attenuation = 1.0 / (distance * distance);\n vec3 radiance = lightColors[i] * attenuation;\n\n // Cook-Torrance BRDF\n float NDF = DistributionGGX(N, H, roughness); \n float G = GeometrySmith(N, V, L, roughness); \n vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0); \n \n vec3 numerator = NDF * G * F;\n float denominator = 4.0 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero\n vec3 specular = numerator / denominator;\n \n // kS is equal to Fresnel\n vec3 kS = F;\n // for energy conservation, the diffuse and specular light can't\n // be above 1.0 (unless the surface emits light); to preserve this\n // relationship the diffuse component (kD) should equal 1.0 - kS.\n vec3 kD = vec3(1.0) - kS;\n // multiply kD by the inverse metalness such that only non-metals \n // have diffuse lighting, or a linear blend if partly metal (pure metals\n // have no diffuse light).\n kD *= 1.0 - metallic;\t \n \n // scale light by NdotL\n float NdotL = max(dot(N, L), 0.0); \n\n // add to outgoing radiance Lo\n Lo += (kD * albedo / PI + specular) * radiance * NdotL; // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again\n } \n \n // ambient lighting (we now use IBL as the ambient term)\n vec3 F = fresnelSchlickRoughness(max(dot(N, V), 0.0), F0, roughness);\n \n vec3 kS = F;\n vec3 kD = 1.0 - kS;\n kD *= 1.0 - metallic;\t \n \n vec3 irradiance = texture(irradianceMap, N).rgb;\n vec3 diffuse = irradiance * albedo;\n \n // sample both the pre-filter map and the BRDF lut and combine them together as per the Split-Sum approximation to get the IBL specular part.\n const float MAX_REFLECTION_LOD = 4.0;\n vec3 prefilteredColor = textureLod(prefilterMap, R, roughness * MAX_REFLECTION_LOD).rgb; \n vec2 brdf = texture(brdfLUT, vec2(max(dot(N, V), 0.0), roughness)).rg;\n vec3 specular = prefilteredColor * (F * brdf.x + brdf.y);\n\n vec3 ambient = (kD * diffuse + specular) * ao;\n \n vec3 color = ambient + Lo;\n\n // HDR tonemapping\n color = color / (color + vec3(1.0));\n // gamma correct\n color = pow(color, vec3(1.0/2.2)); \n\n FragColor = vec4(color , 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.pbr.vs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\nout vec3 WorldPos;\nout vec3 Normal;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat3 normalMatrix;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n WorldPos = vec3(model * vec4(aPos, 1.0));\n Normal = normalMatrix * aNormal; \n\n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/2.2.1.prefilter.fs", "language": "glsl", "loc": 89, "comment_density": 0.157, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\nuniform float roughness;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\nfloat DistributionGGX(vec3 N, vec3 H, float roughness)\n{\n float a = roughness*roughness;\n float a2 = a*a;\n float NdotH = max(dot(N, H), 0.0);\n float NdotH2 = NdotH*NdotH;\n\n float nom = a2;\n float denom = (NdotH2 * (a2 - 1.0) + 1.0);\n denom = PI * denom * denom;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\n// http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n// efficient VanDerCorpus calculation.\nfloat RadicalInverse_VdC(uint bits) \n{\n bits = (bits << 16u) | (bits >> 16u);\n bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n return float(bits) * 2.3283064365386963e-10; // / 0x100000000\n}\n// ----------------------------------------------------------------------------\nvec2 Hammersley(uint i, uint N)\n{\n\treturn vec2(float(i)/float(N), RadicalInverse_VdC(i));\n}\n// ----------------------------------------------------------------------------\nvec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)\n{\n\tfloat a = roughness*roughness;\n\t\n\tfloat phi = 2.0 * PI * Xi.x;\n\tfloat cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));\n\tfloat sinTheta = sqrt(1.0 - cosTheta*cosTheta);\n\t\n\t// from spherical coordinates to cartesian coordinates - halfway vector\n\tvec3 H;\n\tH.x = cos(phi) * sinTheta;\n\tH.y = sin(phi) * sinTheta;\n\tH.z = cosTheta;\n\t\n\t// from tangent-space H vector to world-space sample vector\n\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\tvec3 tangent = normalize(cross(up, N));\n\tvec3 bitangent = cross(N, tangent);\n\t\n\tvec3 sampleVec = tangent * H.x + bitangent * H.y + N * H.z;\n\treturn normalize(sampleVec);\n}\n// ----------------------------------------------------------------------------\nvoid main()\n{\t\t\n vec3 N = normalize(WorldPos);\n \n // make the simplifying assumption that V equals R equals the normal \n vec3 R = N;\n vec3 V = R;\n\n const uint SAMPLE_COUNT = 1024u;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n \n for(uint i = 0u; i < SAMPLE_COUNT; ++i)\n {\n // generates a sample vector that's biased towards the preferred alignment direction (importance sampling).\n vec2 Xi = Hammersley(i, SAMPLE_COUNT);\n vec3 H = ImportanceSampleGGX(Xi, N, roughness);\n vec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n float NdotL = max(dot(N, L), 0.0);\n if(NdotL > 0.0)\n {\n // sample from the environment's mip level based on roughness/pdf\n float D = DistributionGGX(N, H, roughness);\n float NdotH = max(dot(N, H), 0.0);\n float HdotV = max(dot(H, V), 0.0);\n float pdf = D * NdotH / (4.0 * HdotV) + 0.0001; \n\n float resolution = 512.0; // resolution of source cubemap (per face)\n float saTexel = 4.0 * PI / (6.0 * resolution * resolution);\n float saSample = 1.0 / (float(SAMPLE_COUNT) * pdf + 0.0001);\n\n float mipLevel = roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel); \n \n prefilteredColor += textureLod(environmentMap, L, mipLevel).rgb * NdotL;\n totalWeight += NdotL;\n }\n }\n\n prefilteredColor = prefilteredColor / totalWeight;\n\n FragColor = vec4(prefilteredColor, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.1.ibl_specular/ibl_specular.cpp", "language": "code", "loc": 618, "comment_density": 0.235, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nvoid renderSphere();\nvoid renderCube();\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 1280;\nconst unsigned int SCR_HEIGHT = 720;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = 800.0f / 2.0;\nfloat lastY = 600.0 / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_SAMPLES, 4);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n glfwMakeContextCurrent(window);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n // set depth function to less than AND equal for skybox depth trick.\n glDepthFunc(GL_LEQUAL);\n // enable seamless cubemap sampling for lower mip levels in the pre-filter map.\n glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);\n\n // build and compile shaders\n // -------------------------\n Shader pbrShader(\"2.2.1.pbr.vs\", \"2.2.1.pbr.fs\");\n Shader equirectangularToCubemapShader(\"2.2.1.cubemap.vs\", \"2.2.1.equirectangular_to_cubemap.fs\");\n Shader irradianceShader(\"2.2.1.cubemap.vs\", \"2.2.1.irradiance_convolution.fs\");\n Shader prefilterShader(\"2.2.1.cubemap.vs\", \"2.2.1.prefilter.fs\");\n Shader brdfShader(\"2.2.1.brdf.vs\", \"2.2.1.brdf.fs\");\n Shader backgroundShader(\"2.2.1.background.vs\", \"2.2.1.background.fs\");\n\n pbrShader.use();\n pbrShader.setInt(\"irradianceMap\", 0);\n pbrShader.setInt(\"prefilterMap\", 1);\n pbrShader.setInt(\"brdfLUT\", 2);\n pbrShader.setVec3(\"albedo\", 0.5f, 0.0f, 0.0f);\n pbrShader.setFloat(\"ao\", 1.0f);\n\n backgroundShader.use();\n backgroundShader.setInt(\"environmentMap\", 0);\n\n \n // lights\n // ------\n glm::vec3 lightPositions[] = {\n glm::vec3(-10.0f, 10.0f, 10.0f),\n glm::vec3( 10.0f, 10.0f, 10.0f),\n glm::vec3(-10.0f, -10.0f, 10.0f),\n glm::vec3( 10.0f, -10.0f, 10.0f),\n };\n glm::vec3 lightColors[] = {\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f)\n };\n int nrRows = 7;\n int nrColumns = 7;\n float spacing = 2.5;\n\n // pbr: setup framebuffer\n // ----------------------\n unsigned int captureFBO;\n unsigned int captureRBO;\n glGenFramebuffers(1, &captureFBO);\n glGenRenderbuffers(1, &captureRBO);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 512, 512);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, captureRBO);\n\n // pbr: load the HDR environment map\n // ---------------------------------\n stbi_set_flip_vertically_on_load(true);\n int width, height, nrComponents;\n float *data = stbi_loadf(FileSystem::getPath(\"resources/textures/hdr/newport_loft.hdr\").c_str(), &width, &height, &nrComponents, 0);\n unsigned int hdrTexture;\n if (data)\n {\n glGenTextures(1, &hdrTexture);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, width, height, 0, GL_RGB, GL_FLOAT, data); // note how we specify the texture's data value to be float\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Failed to load HDR image.\" << std::endl;\n }\n\n // pbr: setup cubemap to render to and attach to framebuffer\n // ---------------------------------------------------------\n unsigned int envCubemap;\n glGenTextures(1, &envCubemap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 512, 512, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // enable pre-filter mipmap sampling (combatting visible dots artifact)\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n // pbr: set up projection and view matrices for capturing data onto the 6 cubemap face directions\n // ----------------------------------------------------------------------------------------------\n glm::mat4 captureProjection = glm::perspective(glm::radians(90.0f), 1.0f, 0.1f, 10.0f);\n glm::mat4 captureViews[] =\n {\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f))\n };\n\n // pbr: convert HDR equirectangular environment map to cubemap equivalent\n // ----------------------------------------------------------------------\n equirectangularToCubemapShader.use();\n equirectangularToCubemapShader.setInt(\"equirectangularMap\", 0);\n equirectangularToCubemapShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n\n glViewport(0, 0, 512, 512); // don't forget to configure the viewport to the capture dimensions.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n for (unsigned int i = 0; i < 6; ++i)\n {\n equirectangularToCubemapShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, envCubemap, 0);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // then let OpenGL generate mipmaps from first mip face (combatting visible dots artifact)\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n glGenerateMipmap(GL_TEXTURE_CUBE_MAP);\n\n // pbr: create an irradiance cubemap, and re-scale capture FBO to irradiance scale.\n // --------------------------------------------------------------------------------\n unsigned int irradianceMap;\n glGenTextures(1, &irradianceMap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 32, 32, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 32, 32);\n\n // pbr: solve diffuse integral by convolution to create an irradiance (cube)map.\n // -----------------------------------------------------------------------------\n irradianceShader.use();\n irradianceShader.setInt(\"environmentMap\", 0);\n irradianceShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n\n glViewport(0, 0, 32, 32); // don't forget to configure the viewport to the capture dimensions.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n for (unsigned int i = 0; i < 6; ++i)\n {\n irradianceShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, irradianceMap, 0);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // pbr: create a pre-filter cubemap, and re-scale capture FBO to pre-filter scale.\n // --------------------------------------------------------------------------------\n unsigned int prefilterMap;\n glGenTextures(1, &prefilterMap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, prefilterMap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 128, 128, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // be sure to set minification filter to mip_linear \n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // generate mipmaps for the cubemap so OpenGL automatically allocates the required memory.\n glGenerateMipmap(GL_TEXTURE_CUBE_MAP);\n\n // pbr: run a quasi monte-carlo simulation on the environment lighting to create a prefilter (cube)map.\n // ----------------------------------------------------------------------------------------------------\n prefilterShader.use();\n prefilterShader.setInt(\"environmentMap\", 0);\n prefilterShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n unsigned int maxMipLevels = 5;\n for (unsigned int mip = 0; mip < maxMipLevels; ++mip)\n {\n // reisze framebuffer according to mip-level size.\n unsigned int mipWidth = static_cast(128 * std::pow(0.5, mip));\n unsigned int mipHeight = static_cast(128 * std::pow(0.5, mip));\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight);\n glViewport(0, 0, mipWidth, mipHeight);\n\n float roughness = (float)mip / (float)(maxMipLevels - 1);\n prefilterShader.setFloat(\"roughness\", roughness);\n for (unsigned int i = 0; i < 6; ++i)\n {\n prefilterShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, prefilterMap, mip);\n\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n renderCube();\n }\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // pbr: generate a 2D LUT from the BRDF equations used.\n // ----------------------------------------------------\n unsigned int brdfLUTTexture;\n glGenTextures(1, &brdfLUTTexture);\n\n // pre-allocate enough memory for the LUT texture.\n glBindTexture(GL_TEXTURE_2D, brdfLUTTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, 512, 512, 0, GL_RG, GL_FLOAT, 0);\n // be sure to set wrapping mode to GL_CLAMP_TO_EDGE\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n // then re-configure capture framebuffer object and render screen-space quad with BRDF shader.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 512, 512);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, brdfLUTTexture, 0);\n\n glViewport(0, 0, 512, 512);\n brdfShader.use();\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n renderQuad();\n\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // initialize static shader uniforms before rendering\n // --------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n pbrShader.use();\n pbrShader.setMat4(\"projection\", projection);\n backgroundShader.use();\n backgroundShader.setMat4(\"projection\", projection);\n\n // then before rendering, configure the viewport to the original framebuffer's screen dimensions\n int scrWidth, scrHeight;\n glfwGetFramebufferSize(window, &scrWidth, &scrHeight);\n glViewport(0, 0, scrWidth, scrHeight);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // render scene, supplying the convoluted irradiance map to the final shader.\n // ------------------------------------------------------------------------------------------\n pbrShader.use();\n glm::mat4 view = camera.GetViewMatrix();\n pbrShader.setMat4(\"view\", view);\n pbrShader.setVec3(\"camPos\", camera.Position);\n\n // bind pre-computed IBL data\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_CUBE_MAP, prefilterMap);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, brdfLUTTexture);\n\n // render rows*column number of spheres with varying metallic/roughness values scaled by rows and columns respectively\n glm::mat4 model = glm::mat4(1.0f);\n for (int row = 0; row < nrRows; ++row)\n {\n pbrShader.setFloat(\"metallic\", (float)row / (float)nrRows);\n for (int col = 0; col < nrColumns; ++col)\n {\n // we clamp the roughness to 0.025 - 1.0 as perfectly smooth surfaces (roughness of 0.0) tend to look a bit off\n // on direct lighting.\n pbrShader.setFloat(\"roughness\", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(\n (float)(col - (nrColumns / 2)) * spacing,\n (float)(row - (nrRows / 2)) * spacing,\n -2.0f\n ));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n }\n\n\n // render light source (simply re-render sphere at light positions)\n // this looks a bit off as we use the same shader, but it'll make their positions obvious and \n // keeps the codeprint small.\n for (unsigned int i = 0; i < sizeof(lightPositions) / sizeof(lightPositions[0]); ++i)\n {\n glm::vec3 newPos = lightPositions[i] + glm::vec3(sin(glfwGetTime() * 5.0) * 5.0, 0.0, 0.0);\n newPos = lightPositions[i];\n pbrShader.setVec3(\"lightPositions[\" + std::to_string(i) + \"]\", newPos);\n pbrShader.setVec3(\"lightColors[\" + std::to_string(i) + \"]\", lightColors[i]);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, newPos);\n model = glm::scale(model, glm::vec3(0.5f));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n\n // render skybox (render as last to prevent overdraw)\n backgroundShader.use();\n backgroundShader.setMat4(\"view\", view);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n //glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap); // display irradiance map\n //glBindTexture(GL_TEXTURE_CUBE_MAP, prefilterMap); // display prefilter map\n renderCube();\n\n\n // render BRDF map to screen\n //brdfShader.Use();\n //renderQuad();\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// renders (and builds at first invocation) a sphere\n// -------------------------------------------------\nunsigned int sphereVAO = 0;\nunsigned int indexCount;\nvoid renderSphere()\n{\n if (sphereVAO == 0)\n {\n glGenVertexArrays(1, &sphereVAO);\n\n unsigned int vbo, ebo;\n glGenBuffers(1, &vbo);\n glGenBuffers(1, &ebo);\n\n std::vector positions;\n std::vector uv;\n std::vector normals;\n std::vector indices;\n\n const unsigned int X_SEGMENTS = 64;\n const unsigned int Y_SEGMENTS = 64;\n const float PI = 3.14159265359f;\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n for (unsigned int y = 0; y <= Y_SEGMENTS; ++y)\n {\n float xSegment = (float)x / (float)X_SEGMENTS;\n float ySegment = (float)y / (float)Y_SEGMENTS;\n float xPos = std::cos(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n float yPos = std::cos(ySegment * PI);\n float zPos = std::sin(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n\n positions.push_back(glm::vec3(xPos, yPos, zPos));\n uv.push_back(glm::vec2(xSegment, ySegment));\n normals.push_back(glm::vec3(xPos, yPos, zPos));\n }\n }\n\n bool oddRow = false;\n for (unsigned int y = 0; y < Y_SEGMENTS; ++y)\n {\n if (!oddRow) // even rows: y == 0, y == 2; and so on\n {\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n }\n }\n else\n {\n for (int x = X_SEGMENTS; x >= 0; --x)\n {\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n }\n }\n oddRow = !oddRow;\n }\n indexCount = static_cast(indices.size());\n\n std::vector data;\n for (unsigned int i = 0; i < positions.size(); ++i)\n {\n data.push_back(positions[i].x);\n data.push_back(positions[i].y);\n data.push_back(positions[i].z);\n if (normals.size() > 0)\n {\n data.push_back(normals[i].x);\n data.push_back(normals[i].y);\n data.push_back(normals[i].z);\n }\n if (uv.size() > 0)\n {\n data.push_back(uv[i].x);\n data.push_back(uv[i].y);\n }\n }\n glBindVertexArray(sphereVAO);\n glBindBuffer(GL_ARRAY_BUFFER, vbo);\n glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(float), &data[0], GL_STATIC_DRAW);\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);\n unsigned int stride = (3 + 2 + 3) * sizeof(float);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, stride, (void*)(6 * sizeof(float)));\n }\n\n glBindVertexArray(sphereVAO);\n glDrawElements(GL_TRIANGLE_STRIP, indexCount, GL_UNSIGNED_INT, 0);\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n"}], "validation": {"glslang_valid": 10, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.088, "dedup_hash": "33f2de071455c26e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_6_pbr_2_2_2_ibl_specular_textured", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:23+00:00", "source_type": "repo", "title": "2.2.2.Ibl Specular Textured", "api": "OpenGL Core", "glsl_version": null, "topic": "pbr/lighting/postprocessing/texturing/bumpmapping", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.background.fs", "language": "glsl", "loc": 12, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\n\nvoid main()\n{\t\t\n vec3 envColor = textureLod(environmentMap, WorldPos, 0.0).rgb;\n \n // HDR tonemap and gamma correct\n envColor = envColor / (envColor + vec3(1.0));\n envColor = pow(envColor, vec3(1.0/2.2)); \n \n FragColor = vec4(envColor, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.background.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nout vec3 WorldPos;\n\nvoid main()\n{\n WorldPos = aPos;\n\n\tmat4 rotView = mat4(mat3(view));\n\tvec4 clipPos = projection * rotView * vec4(WorldPos, 1.0);\n\n\tgl_Position = clipPos.xyww;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.brdf.fs", "language": "glsl", "loc": 99, "comment_density": 0.152, "code": "#version 330 core\nout vec2 FragColor;\nin vec2 TexCoords;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\n// http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n// efficient VanDerCorpus calculation.\nfloat RadicalInverse_VdC(uint bits) \n{\n bits = (bits << 16u) | (bits >> 16u);\n bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n return float(bits) * 2.3283064365386963e-10; // / 0x100000000\n}\n// ----------------------------------------------------------------------------\nvec2 Hammersley(uint i, uint N)\n{\n\treturn vec2(float(i)/float(N), RadicalInverse_VdC(i));\n}\n// ----------------------------------------------------------------------------\nvec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)\n{\n\tfloat a = roughness*roughness;\n\t\n\tfloat phi = 2.0 * PI * Xi.x;\n\tfloat cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));\n\tfloat sinTheta = sqrt(1.0 - cosTheta*cosTheta);\n\t\n\t// from spherical coordinates to cartesian coordinates - halfway vector\n\tvec3 H;\n\tH.x = cos(phi) * sinTheta;\n\tH.y = sin(phi) * sinTheta;\n\tH.z = cosTheta;\n\t\n\t// from tangent-space H vector to world-space sample vector\n\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\tvec3 tangent = normalize(cross(up, N));\n\tvec3 bitangent = cross(N, tangent);\n\t\n\tvec3 sampleVec = tangent * H.x + bitangent * H.y + N * H.z;\n\treturn normalize(sampleVec);\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySchlickGGX(float NdotV, float roughness)\n{\n // note that we use a different k for IBL\n float a = roughness;\n float k = (a * a) / 2.0;\n\n float nom = NdotV;\n float denom = NdotV * (1.0 - k) + k;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)\n{\n float NdotV = max(dot(N, V), 0.0);\n float NdotL = max(dot(N, L), 0.0);\n float ggx2 = GeometrySchlickGGX(NdotV, roughness);\n float ggx1 = GeometrySchlickGGX(NdotL, roughness);\n\n return ggx1 * ggx2;\n}\n// ----------------------------------------------------------------------------\nvec2 IntegrateBRDF(float NdotV, float roughness)\n{\n vec3 V;\n V.x = sqrt(1.0 - NdotV*NdotV);\n V.y = 0.0;\n V.z = NdotV;\n\n float A = 0.0;\n float B = 0.0; \n\n vec3 N = vec3(0.0, 0.0, 1.0);\n \n const uint SAMPLE_COUNT = 1024u;\n for(uint i = 0u; i < SAMPLE_COUNT; ++i)\n {\n // generates a sample vector that's biased towards the\n // preferred alignment direction (importance sampling).\n vec2 Xi = Hammersley(i, SAMPLE_COUNT);\n vec3 H = ImportanceSampleGGX(Xi, N, roughness);\n vec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n float NdotL = max(L.z, 0.0);\n float NdotH = max(H.z, 0.0);\n float VdotH = max(dot(V, H), 0.0);\n\n if(NdotL > 0.0)\n {\n float G = GeometrySmith(N, V, L, roughness);\n float G_Vis = (G * VdotH) / (NdotH * NdotV);\n float Fc = pow(1.0 - VdotH, 5.0);\n\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n A /= float(SAMPLE_COUNT);\n B /= float(SAMPLE_COUNT);\n return vec2(A, B);\n}\n// ----------------------------------------------------------------------------\nvoid main() \n{\n vec2 integratedBRDF = IntegrateBRDF(TexCoords.x, TexCoords.y);\n FragColor = integratedBRDF;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.brdf.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n\tgl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.cubemap.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout vec3 WorldPos;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n WorldPos = aPos; \n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.equirectangular_to_cubemap.fs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform sampler2D equirectangularMap;\n\nconst vec2 invAtan = vec2(0.1591, 0.3183);\nvec2 SampleSphericalMap(vec3 v)\n{\n vec2 uv = vec2(atan(v.z, v.x), asin(v.y));\n uv *= invAtan;\n uv += 0.5;\n return uv;\n}\n\nvoid main()\n{\t\t\n vec2 uv = SampleSphericalMap(normalize(WorldPos));\n vec3 color = texture(equirectangularMap, uv).rgb;\n \n FragColor = vec4(color, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.irradiance_convolution.fs", "language": "glsl", "loc": 30, "comment_density": 0.1, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\n\nconst float PI = 3.14159265359;\n\nvoid main()\n{\t\t\n vec3 N = normalize(WorldPos);\n\n vec3 irradiance = vec3(0.0); \n \n // tangent space calculation from origin point\n vec3 up = vec3(0.0, 1.0, 0.0);\n vec3 right = normalize(cross(up, N));\n up = normalize(cross(N, right));\n \n float sampleDelta = 0.025;\n float nrSamples = 0.0f;\n for(float phi = 0.0; phi < 2.0 * PI; phi += sampleDelta)\n {\n for(float theta = 0.0; theta < 0.5 * PI; theta += sampleDelta)\n {\n // spherical to cartesian (in tangent space)\n vec3 tangentSample = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));\n // tangent space to world\n vec3 sampleVec = tangentSample.x * right + tangentSample.y * up + tangentSample.z * N; \n\n irradiance += texture(environmentMap, sampleVec).rgb * cos(theta) * sin(theta);\n nrSamples++;\n }\n }\n irradiance = PI * irradiance * (1.0 / float(nrSamples));\n \n FragColor = vec4(irradiance, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.fs", "language": "glsl", "loc": 146, "comment_density": 0.247, "code": "#version 330 core\nout vec4 FragColor;\nin vec2 TexCoords;\nin vec3 WorldPos;\nin vec3 Normal;\n\n// material parameters\nuniform sampler2D albedoMap;\nuniform sampler2D normalMap;\nuniform sampler2D metallicMap;\nuniform sampler2D roughnessMap;\nuniform sampler2D aoMap;\n\n// IBL\nuniform samplerCube irradianceMap;\nuniform samplerCube prefilterMap;\nuniform sampler2D brdfLUT;\n\n// lights\nuniform vec3 lightPositions[4];\nuniform vec3 lightColors[4];\n\nuniform vec3 camPos;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\n// Easy trick to get tangent-normals to world-space to keep PBR code simplified.\n// Don't worry if you don't get what's going on; you generally want to do normal \n// mapping the usual way for performance anyways; I do plan make a note of this \n// technique somewhere later in the normal mapping tutorial.\nvec3 getNormalFromMap()\n{\n vec3 tangentNormal = texture(normalMap, TexCoords).xyz * 2.0 - 1.0;\n\n vec3 Q1 = dFdx(WorldPos);\n vec3 Q2 = dFdy(WorldPos);\n vec2 st1 = dFdx(TexCoords);\n vec2 st2 = dFdy(TexCoords);\n\n vec3 N = normalize(Normal);\n vec3 T = normalize(Q1*st2.t - Q2*st1.t);\n vec3 B = -normalize(cross(N, T));\n mat3 TBN = mat3(T, B, N);\n\n return normalize(TBN * tangentNormal);\n}\n// ----------------------------------------------------------------------------\nfloat DistributionGGX(vec3 N, vec3 H, float roughness)\n{\n float a = roughness*roughness;\n float a2 = a*a;\n float NdotH = max(dot(N, H), 0.0);\n float NdotH2 = NdotH*NdotH;\n\n float nom = a2;\n float denom = (NdotH2 * (a2 - 1.0) + 1.0);\n denom = PI * denom * denom;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySchlickGGX(float NdotV, float roughness)\n{\n float r = (roughness + 1.0);\n float k = (r*r) / 8.0;\n\n float nom = NdotV;\n float denom = NdotV * (1.0 - k) + k;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\nfloat GeometrySmith(vec3 N, vec3 V, vec3 L, float roughness)\n{\n float NdotV = max(dot(N, V), 0.0);\n float NdotL = max(dot(N, L), 0.0);\n float ggx2 = GeometrySchlickGGX(NdotV, roughness);\n float ggx1 = GeometrySchlickGGX(NdotL, roughness);\n\n return ggx1 * ggx2;\n}\n// ----------------------------------------------------------------------------\nvec3 fresnelSchlick(float cosTheta, vec3 F0)\n{\n return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n}\n// ----------------------------------------------------------------------------\nvec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness)\n{\n return F0 + (max(vec3(1.0 - roughness), F0) - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n} \n// ----------------------------------------------------------------------------\nvoid main()\n{\t\t\n // material properties\n vec3 albedo = pow(texture(albedoMap, TexCoords).rgb, vec3(2.2));\n float metallic = texture(metallicMap, TexCoords).r;\n float roughness = texture(roughnessMap, TexCoords).r;\n float ao = texture(aoMap, TexCoords).r;\n \n // input lighting data\n vec3 N = getNormalFromMap();\n vec3 V = normalize(camPos - WorldPos);\n vec3 R = reflect(-V, N); \n\n // calculate reflectance at normal incidence; if dia-electric (like plastic) use F0 \n // of 0.04 and if it's a metal, use the albedo color as F0 (metallic workflow) \n vec3 F0 = vec3(0.04); \n F0 = mix(F0, albedo, metallic);\n\n // reflectance equation\n vec3 Lo = vec3(0.0);\n for(int i = 0; i < 4; ++i) \n {\n // calculate per-light radiance\n vec3 L = normalize(lightPositions[i] - WorldPos);\n vec3 H = normalize(V + L);\n float distance = length(lightPositions[i] - WorldPos);\n float attenuation = 1.0 / (distance * distance);\n vec3 radiance = lightColors[i] * attenuation;\n\n // Cook-Torrance BRDF\n float NDF = DistributionGGX(N, H, roughness); \n float G = GeometrySmith(N, V, L, roughness); \n vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0); \n \n vec3 numerator = NDF * G * F;\n float denominator = 4.0 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.0001; // + 0.0001 to prevent divide by zero\n vec3 specular = numerator / denominator;\n \n // kS is equal to Fresnel\n vec3 kS = F;\n // for energy conservation, the diffuse and specular light can't\n // be above 1.0 (unless the surface emits light); to preserve this\n // relationship the diffuse component (kD) should equal 1.0 - kS.\n vec3 kD = vec3(1.0) - kS;\n // multiply kD by the inverse metalness such that only non-metals \n // have diffuse lighting, or a linear blend if partly metal (pure metals\n // have no diffuse light).\n kD *= 1.0 - metallic;\t \n \n // scale light by NdotL\n float NdotL = max(dot(N, L), 0.0); \n\n // add to outgoing radiance Lo\n Lo += (kD * albedo / PI + specular) * radiance * NdotL; // note that we already multiplied the BRDF by the Fresnel (kS) so we won't multiply by kS again\n } \n \n // ambient lighting (we now use IBL as the ambient term)\n vec3 F = fresnelSchlickRoughness(max(dot(N, V), 0.0), F0, roughness);\n \n vec3 kS = F;\n vec3 kD = 1.0 - kS;\n kD *= 1.0 - metallic;\t \n \n vec3 irradiance = texture(irradianceMap, N).rgb;\n vec3 diffuse = irradiance * albedo;\n \n // sample both the pre-filter map and the BRDF lut and combine them together as per the Split-Sum approximation to get the IBL specular part.\n const float MAX_REFLECTION_LOD = 4.0;\n vec3 prefilteredColor = textureLod(prefilterMap, R, roughness * MAX_REFLECTION_LOD).rgb; \n vec2 brdf = texture(brdfLUT, vec2(max(dot(N, V), 0.0), roughness)).rg;\n vec3 specular = prefilteredColor * (F * brdf.x + brdf.y);\n\n vec3 ambient = (kD * diffuse + specular) * ao;\n \n vec3 color = ambient + Lo;\n\n // HDR tonemapping\n color = color / (color + vec3(1.0));\n // gamma correct\n color = pow(color, vec3(1.0/2.2)); \n\n FragColor = vec4(color , 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.vs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\nout vec3 WorldPos;\nout vec3 Normal;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat3 normalMatrix;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n WorldPos = vec3(model * vec4(aPos, 1.0));\n Normal = normalMatrix * aNormal; \n\n gl_Position = projection * view * vec4(WorldPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.prefilter.fs", "language": "glsl", "loc": 89, "comment_density": 0.157, "code": "#version 330 core\nout vec4 FragColor;\nin vec3 WorldPos;\n\nuniform samplerCube environmentMap;\nuniform float roughness;\n\nconst float PI = 3.14159265359;\n// ----------------------------------------------------------------------------\nfloat DistributionGGX(vec3 N, vec3 H, float roughness)\n{\n float a = roughness*roughness;\n float a2 = a*a;\n float NdotH = max(dot(N, H), 0.0);\n float NdotH2 = NdotH*NdotH;\n\n float nom = a2;\n float denom = (NdotH2 * (a2 - 1.0) + 1.0);\n denom = PI * denom * denom;\n\n return nom / denom;\n}\n// ----------------------------------------------------------------------------\n// http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n// efficient VanDerCorpus calculation.\nfloat RadicalInverse_VdC(uint bits) \n{\n bits = (bits << 16u) | (bits >> 16u);\n bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n return float(bits) * 2.3283064365386963e-10; // / 0x100000000\n}\n// ----------------------------------------------------------------------------\nvec2 Hammersley(uint i, uint N)\n{\n\treturn vec2(float(i)/float(N), RadicalInverse_VdC(i));\n}\n// ----------------------------------------------------------------------------\nvec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)\n{\n\tfloat a = roughness*roughness;\n\t\n\tfloat phi = 2.0 * PI * Xi.x;\n\tfloat cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));\n\tfloat sinTheta = sqrt(1.0 - cosTheta*cosTheta);\n\t\n\t// from spherical coordinates to cartesian coordinates - halfway vector\n\tvec3 H;\n\tH.x = cos(phi) * sinTheta;\n\tH.y = sin(phi) * sinTheta;\n\tH.z = cosTheta;\n\t\n\t// from tangent-space H vector to world-space sample vector\n\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\tvec3 tangent = normalize(cross(up, N));\n\tvec3 bitangent = cross(N, tangent);\n\t\n\tvec3 sampleVec = tangent * H.x + bitangent * H.y + N * H.z;\n\treturn normalize(sampleVec);\n}\n// ----------------------------------------------------------------------------\nvoid main()\n{\t\t\n vec3 N = normalize(WorldPos);\n \n // make the simplifying assumption that V equals R equals the normal \n vec3 R = N;\n vec3 V = R;\n\n const uint SAMPLE_COUNT = 1024u;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n \n for(uint i = 0u; i < SAMPLE_COUNT; ++i)\n {\n // generates a sample vector that's biased towards the preferred alignment direction (importance sampling).\n vec2 Xi = Hammersley(i, SAMPLE_COUNT);\n vec3 H = ImportanceSampleGGX(Xi, N, roughness);\n vec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n float NdotL = max(dot(N, L), 0.0);\n if(NdotL > 0.0)\n {\n // sample from the environment's mip level based on roughness/pdf\n float D = DistributionGGX(N, H, roughness);\n float NdotH = max(dot(N, H), 0.0);\n float HdotV = max(dot(H, V), 0.0);\n float pdf = D * NdotH / (4.0 * HdotV) + 0.0001; \n\n float resolution = 512.0; // resolution of source cubemap (per face)\n float saTexel = 4.0 * PI / (6.0 * resolution * resolution);\n float saSample = 1.0 / (float(SAMPLE_COUNT) * pdf + 0.0001);\n\n float mipLevel = roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel); \n \n prefilteredColor += textureLod(environmentMap, L, mipLevel).rgb * NdotL;\n totalWeight += NdotL;\n }\n }\n\n prefilteredColor = prefilteredColor / totalWeight;\n\n FragColor = vec4(prefilteredColor, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/6.pbr/2.2.2.ibl_specular_textured/ibl_specular_textured.cpp", "language": "code", "loc": 744, "comment_density": 0.21, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderSphere();\nvoid renderCube();\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 1280;\nconst unsigned int SCR_HEIGHT = 720;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = 800.0f / 2.0;\nfloat lastY = 600.0 / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\t\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_SAMPLES, 4);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n glfwMakeContextCurrent(window);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n // set depth function to less than AND equal for skybox depth trick.\n glDepthFunc(GL_LEQUAL);\n // enable seamless cubemap sampling for lower mip levels in the pre-filter map.\n glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);\n\n // build and compile shaders\n // -------------------------\n Shader pbrShader(\"2.2.2.pbr.vs\", \"2.2.2.pbr.fs\");\n Shader equirectangularToCubemapShader(\"2.2.2.cubemap.vs\", \"2.2.2.equirectangular_to_cubemap.fs\");\n Shader irradianceShader(\"2.2.2.cubemap.vs\", \"2.2.2.irradiance_convolution.fs\");\n Shader prefilterShader(\"2.2.2.cubemap.vs\", \"2.2.2.prefilter.fs\");\n Shader brdfShader(\"2.2.2.brdf.vs\", \"2.2.2.brdf.fs\");\n Shader backgroundShader(\"2.2.2.background.vs\", \"2.2.2.background.fs\");\n\n pbrShader.use();\n pbrShader.setInt(\"irradianceMap\", 0);\n pbrShader.setInt(\"prefilterMap\", 1);\n pbrShader.setInt(\"brdfLUT\", 2);\n pbrShader.setInt(\"albedoMap\", 3);\n pbrShader.setInt(\"normalMap\", 4);\n pbrShader.setInt(\"metallicMap\", 5);\n pbrShader.setInt(\"roughnessMap\", 6);\n pbrShader.setInt(\"aoMap\", 7);\n\n backgroundShader.use();\n backgroundShader.setInt(\"environmentMap\", 0);\n\n // load PBR material textures\n // --------------------------\n // rusted iron\n unsigned int ironAlbedoMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/albedo.png\").c_str());\n unsigned int ironNormalMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/normal.png\").c_str());\n unsigned int ironMetallicMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/metallic.png\").c_str());\n unsigned int ironRoughnessMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/roughness.png\").c_str());\n unsigned int ironAOMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/rusted_iron/ao.png\").c_str());\n\n // gold\n unsigned int goldAlbedoMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/gold/albedo.png\").c_str());\n unsigned int goldNormalMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/gold/normal.png\").c_str());\n unsigned int goldMetallicMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/gold/metallic.png\").c_str());\n unsigned int goldRoughnessMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/gold/roughness.png\").c_str());\n unsigned int goldAOMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/gold/ao.png\").c_str());\n\n // grass\n unsigned int grassAlbedoMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/grass/albedo.png\").c_str());\n unsigned int grassNormalMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/grass/normal.png\").c_str());\n unsigned int grassMetallicMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/grass/metallic.png\").c_str());\n unsigned int grassRoughnessMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/grass/roughness.png\").c_str());\n unsigned int grassAOMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/grass/ao.png\").c_str());\n\n // plastic\n unsigned int plasticAlbedoMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/plastic/albedo.png\").c_str());\n unsigned int plasticNormalMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/plastic/normal.png\").c_str());\n unsigned int plasticMetallicMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/plastic/metallic.png\").c_str());\n unsigned int plasticRoughnessMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/plastic/roughness.png\").c_str());\n unsigned int plasticAOMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/plastic/ao.png\").c_str());\n\n // wall\n unsigned int wallAlbedoMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/wall/albedo.png\").c_str());\n unsigned int wallNormalMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/wall/normal.png\").c_str());\n unsigned int wallMetallicMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/wall/metallic.png\").c_str());\n unsigned int wallRoughnessMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/wall/roughness.png\").c_str());\n unsigned int wallAOMap = loadTexture(FileSystem::getPath(\"resources/textures/pbr/wall/ao.png\").c_str());\n\n // lights\n // ------\n glm::vec3 lightPositions[] = {\n glm::vec3(-10.0f, 10.0f, 10.0f),\n glm::vec3( 10.0f, 10.0f, 10.0f),\n glm::vec3(-10.0f, -10.0f, 10.0f),\n glm::vec3( 10.0f, -10.0f, 10.0f),\n };\n glm::vec3 lightColors[] = {\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f),\n glm::vec3(300.0f, 300.0f, 300.0f)\n };\n\n // pbr: setup framebuffer\n // ----------------------\n unsigned int captureFBO;\n unsigned int captureRBO;\n glGenFramebuffers(1, &captureFBO);\n glGenRenderbuffers(1, &captureRBO);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 512, 512);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, captureRBO);\n\n // pbr: load the HDR environment map\n // ---------------------------------\n stbi_set_flip_vertically_on_load(true);\n int width, height, nrComponents;\n float *data = stbi_loadf(FileSystem::getPath(\"resources/textures/hdr/newport_loft.hdr\").c_str(), &width, &height, &nrComponents, 0);\n unsigned int hdrTexture;\n if (data)\n {\n glGenTextures(1, &hdrTexture);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, width, height, 0, GL_RGB, GL_FLOAT, data); // note how we specify the texture's data value to be float\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Failed to load HDR image.\" << std::endl;\n }\n\n // pbr: setup cubemap to render to and attach to framebuffer\n // ---------------------------------------------------------\n unsigned int envCubemap;\n glGenTextures(1, &envCubemap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 512, 512, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // enable pre-filter mipmap sampling (combatting visible dots artifact)\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n // pbr: set up projection and view matrices for capturing data onto the 6 cubemap face directions\n // ----------------------------------------------------------------------------------------------\n glm::mat4 captureProjection = glm::perspective(glm::radians(90.0f), 1.0f, 0.1f, 10.0f);\n glm::mat4 captureViews[] =\n {\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)),\n glm::lookAt(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3( 0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f))\n };\n\n // pbr: convert HDR equirectangular environment map to cubemap equivalent\n // ----------------------------------------------------------------------\n equirectangularToCubemapShader.use();\n equirectangularToCubemapShader.setInt(\"equirectangularMap\", 0);\n equirectangularToCubemapShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, hdrTexture);\n\n glViewport(0, 0, 512, 512); // don't forget to configure the viewport to the capture dimensions.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n for (unsigned int i = 0; i < 6; ++i)\n {\n equirectangularToCubemapShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, envCubemap, 0);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // then let OpenGL generate mipmaps from first mip face (combatting visible dots artifact)\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n glGenerateMipmap(GL_TEXTURE_CUBE_MAP);\n\n // pbr: create an irradiance cubemap, and re-scale capture FBO to irradiance scale.\n // --------------------------------------------------------------------------------\n unsigned int irradianceMap;\n glGenTextures(1, &irradianceMap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 32, 32, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 32, 32);\n\n // pbr: solve diffuse integral by convolution to create an irradiance (cube)map.\n // -----------------------------------------------------------------------------\n irradianceShader.use();\n irradianceShader.setInt(\"environmentMap\", 0);\n irradianceShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n\n glViewport(0, 0, 32, 32); // don't forget to configure the viewport to the capture dimensions.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n for (unsigned int i = 0; i < 6; ++i)\n {\n irradianceShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, irradianceMap, 0);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // pbr: create a pre-filter cubemap, and re-scale capture FBO to pre-filter scale.\n // --------------------------------------------------------------------------------\n unsigned int prefilterMap;\n glGenTextures(1, &prefilterMap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, prefilterMap);\n for (unsigned int i = 0; i < 6; ++i)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB16F, 128, 128, 0, GL_RGB, GL_FLOAT, nullptr);\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // be sure to set minification filter to mip_linear \n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // generate mipmaps for the cubemap so OpenGL automatically allocates the required memory.\n glGenerateMipmap(GL_TEXTURE_CUBE_MAP);\n\n // pbr: run a quasi monte-carlo simulation on the environment lighting to create a prefilter (cube)map.\n // ----------------------------------------------------------------------------------------------------\n prefilterShader.use();\n prefilterShader.setInt(\"environmentMap\", 0);\n prefilterShader.setMat4(\"projection\", captureProjection);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n unsigned int maxMipLevels = 5;\n for (unsigned int mip = 0; mip < maxMipLevels; ++mip)\n {\n // reisze framebuffer according to mip-level size.\n unsigned int mipWidth = static_cast(128 * std::pow(0.5, mip));\n unsigned int mipHeight = static_cast(128 * std::pow(0.5, mip));\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight);\n glViewport(0, 0, mipWidth, mipHeight);\n\n float roughness = (float)mip / (float)(maxMipLevels - 1);\n prefilterShader.setFloat(\"roughness\", roughness);\n for (unsigned int i = 0; i < 6; ++i)\n {\n prefilterShader.setMat4(\"view\", captureViews[i]);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, prefilterMap, mip);\n\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n renderCube();\n }\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // pbr: generate a 2D LUT from the BRDF equations used.\n // ----------------------------------------------------\n unsigned int brdfLUTTexture;\n glGenTextures(1, &brdfLUTTexture);\n\n // pre-allocate enough memory for the LUT texture.\n glBindTexture(GL_TEXTURE_2D, brdfLUTTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, 512, 512, 0, GL_RG, GL_FLOAT, 0);\n // be sure to set wrapping mode to GL_CLAMP_TO_EDGE\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n // then re-configure capture framebuffer object and render screen-space quad with BRDF shader.\n glBindFramebuffer(GL_FRAMEBUFFER, captureFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, captureRBO);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 512, 512);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, brdfLUTTexture, 0);\n\n glViewport(0, 0, 512, 512);\n brdfShader.use();\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n renderQuad();\n\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // initialize static shader uniforms before rendering\n // --------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n pbrShader.use();\n pbrShader.setMat4(\"projection\", projection);\n backgroundShader.use();\n backgroundShader.setMat4(\"projection\", projection);\n\n // then before rendering, configure the viewport to the original framebuffer's screen dimensions\n int scrWidth, scrHeight;\n glfwGetFramebufferSize(window, &scrWidth, &scrHeight);\n glViewport(0, 0, scrWidth, scrHeight);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // render scene, supplying the convoluted irradiance map to the final shader.\n // ------------------------------------------------------------------------------------------\n pbrShader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n pbrShader.setMat4(\"view\", view);\n pbrShader.setVec3(\"camPos\", camera.Position);\n\n // bind pre-computed IBL data\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_CUBE_MAP, prefilterMap);\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, brdfLUTTexture);\n\n // rusted iron\n glActiveTexture(GL_TEXTURE3);\n glBindTexture(GL_TEXTURE_2D, ironAlbedoMap);\n glActiveTexture(GL_TEXTURE4);\n glBindTexture(GL_TEXTURE_2D, ironNormalMap);\n glActiveTexture(GL_TEXTURE5);\n glBindTexture(GL_TEXTURE_2D, ironMetallicMap);\n glActiveTexture(GL_TEXTURE6);\n glBindTexture(GL_TEXTURE_2D, ironRoughnessMap);\n glActiveTexture(GL_TEXTURE7);\n glBindTexture(GL_TEXTURE_2D, ironAOMap);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-5.0, 0.0, 2.0));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n\n // gold\n glActiveTexture(GL_TEXTURE3);\n glBindTexture(GL_TEXTURE_2D, goldAlbedoMap);\n glActiveTexture(GL_TEXTURE4);\n glBindTexture(GL_TEXTURE_2D, goldNormalMap);\n glActiveTexture(GL_TEXTURE5);\n glBindTexture(GL_TEXTURE_2D, goldMetallicMap);\n glActiveTexture(GL_TEXTURE6);\n glBindTexture(GL_TEXTURE_2D, goldRoughnessMap);\n glActiveTexture(GL_TEXTURE7);\n glBindTexture(GL_TEXTURE_2D, goldAOMap);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-3.0, 0.0, 2.0));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n\n // grass\n glActiveTexture(GL_TEXTURE3);\n glBindTexture(GL_TEXTURE_2D, grassAlbedoMap);\n glActiveTexture(GL_TEXTURE4);\n glBindTexture(GL_TEXTURE_2D, grassNormalMap);\n glActiveTexture(GL_TEXTURE5);\n glBindTexture(GL_TEXTURE_2D, grassMetallicMap);\n glActiveTexture(GL_TEXTURE6);\n glBindTexture(GL_TEXTURE_2D, grassRoughnessMap);\n glActiveTexture(GL_TEXTURE7);\n glBindTexture(GL_TEXTURE_2D, grassAOMap);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0, 0.0, 2.0));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n\n // plastic\n glActiveTexture(GL_TEXTURE3);\n glBindTexture(GL_TEXTURE_2D, plasticAlbedoMap);\n glActiveTexture(GL_TEXTURE4);\n glBindTexture(GL_TEXTURE_2D, plasticNormalMap);\n glActiveTexture(GL_TEXTURE5);\n glBindTexture(GL_TEXTURE_2D, plasticMetallicMap);\n glActiveTexture(GL_TEXTURE6);\n glBindTexture(GL_TEXTURE_2D, plasticRoughnessMap);\n glActiveTexture(GL_TEXTURE7);\n glBindTexture(GL_TEXTURE_2D, plasticAOMap);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(1.0, 0.0, 2.0));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n\n // wall\n glActiveTexture(GL_TEXTURE3);\n glBindTexture(GL_TEXTURE_2D, wallAlbedoMap);\n glActiveTexture(GL_TEXTURE4);\n glBindTexture(GL_TEXTURE_2D, wallNormalMap);\n glActiveTexture(GL_TEXTURE5);\n glBindTexture(GL_TEXTURE_2D, wallMetallicMap);\n glActiveTexture(GL_TEXTURE6);\n glBindTexture(GL_TEXTURE_2D, wallRoughnessMap);\n glActiveTexture(GL_TEXTURE7);\n glBindTexture(GL_TEXTURE_2D, wallAOMap);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(3.0, 0.0, 2.0));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n\n // render light source (simply re-render sphere at light positions)\n // this looks a bit off as we use the same shader, but it'll make their positions obvious and \n // keeps the codeprint small.\n for (unsigned int i = 0; i < sizeof(lightPositions) / sizeof(lightPositions[0]); ++i)\n {\n glm::vec3 newPos = lightPositions[i] + glm::vec3(sin(glfwGetTime() * 5.0) * 5.0, 0.0, 0.0);\n newPos = lightPositions[i];\n pbrShader.setVec3(\"lightPositions[\" + std::to_string(i) + \"]\", newPos);\n pbrShader.setVec3(\"lightColors[\" + std::to_string(i) + \"]\", lightColors[i]);\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, newPos);\n model = glm::scale(model, glm::vec3(0.5f));\n pbrShader.setMat4(\"model\", model);\n pbrShader.setMat3(\"normalMatrix\", glm::transpose(glm::inverse(glm::mat3(model))));\n renderSphere();\n }\n\n // render skybox (render as last to prevent overdraw)\n backgroundShader.use();\n\n backgroundShader.setMat4(\"view\", view);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, envCubemap);\n //glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap); // display irradiance map\n //glBindTexture(GL_TEXTURE_CUBE_MAP, prefilterMap); // display prefilter map\n renderCube();\n\n // render BRDF map to screen\n //brdfShader.Use();\n //renderQuad();\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n \n// renders (and builds at first invocation) a sphere\n// -------------------------------------------------\nunsigned int sphereVAO = 0;\nGLsizei indexCount;\nvoid renderSphere()\n{\n if (sphereVAO == 0)\n {\n glGenVertexArrays(1, &sphereVAO);\n\n unsigned int vbo, ebo;\n glGenBuffers(1, &vbo);\n glGenBuffers(1, &ebo);\n\n std::vector positions;\n std::vector uv;\n std::vector normals;\n std::vector indices;\n\n const unsigned int X_SEGMENTS = 64;\n const unsigned int Y_SEGMENTS = 64;\n const float PI = 3.14159265359f;\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n for (unsigned int y = 0; y <= Y_SEGMENTS; ++y)\n {\n float xSegment = (float)x / (float)X_SEGMENTS;\n float ySegment = (float)y / (float)Y_SEGMENTS;\n float xPos = std::cos(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n float yPos = std::cos(ySegment * PI);\n float zPos = std::sin(xSegment * 2.0f * PI) * std::sin(ySegment * PI);\n\n positions.push_back(glm::vec3(xPos, yPos, zPos));\n uv.push_back(glm::vec2(xSegment, ySegment));\n normals.push_back(glm::vec3(xPos, yPos, zPos));\n }\n }\n\n bool oddRow = false;\n for (unsigned int y = 0; y < Y_SEGMENTS; ++y)\n {\n if (!oddRow) // even rows: y == 0, y == 2; and so on\n {\n for (unsigned int x = 0; x <= X_SEGMENTS; ++x)\n {\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n }\n }\n else\n {\n for (int x = X_SEGMENTS; x >= 0; --x)\n {\n indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);\n indices.push_back(y * (X_SEGMENTS + 1) + x);\n }\n }\n oddRow = !oddRow;\n }\n indexCount = static_cast(indices.size());\n\n std::vector data;\n for (unsigned int i = 0; i < positions.size(); ++i)\n {\n data.push_back(positions[i].x);\n data.push_back(positions[i].y);\n data.push_back(positions[i].z);\n if (normals.size() > 0)\n {\n data.push_back(normals[i].x);\n data.push_back(normals[i].y);\n data.push_back(normals[i].z);\n }\n if (uv.size() > 0)\n {\n data.push_back(uv[i].x);\n data.push_back(uv[i].y);\n }\n }\n glBindVertexArray(sphereVAO);\n glBindBuffer(GL_ARRAY_BUFFER, vbo);\n glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(float), &data[0], GL_STATIC_DRAW);\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);\n unsigned int stride = (3 + 2 + 3) * sizeof(float);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, stride, (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, stride, (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, stride, (void*)(6 * sizeof(float)));\n }\n\n glBindVertexArray(sphereVAO);\n glDrawElements(GL_TRIANGLE_STRIP, indexCount, GL_UNSIGNED_INT, 0);\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 10, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.086, "dedup_hash": "f81922bc7c7e60f8", "has_readme": true} +{"id": "joeydevries_learnopengl_src_7_in_practice_1_debugging", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:23+00:00", "source_type": "repo", "title": "1.Debugging", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/7.in_practice/1.debugging/debugging.cpp", "language": "code", "loc": 281, "comment_density": 0.285, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n\nGLenum glCheckError_(const char *file, int line)\n{\n GLenum errorCode;\n while ((errorCode = glGetError()) != GL_NO_ERROR)\n {\n std::string error;\n switch (errorCode)\n {\n case GL_INVALID_ENUM: error = \"INVALID_ENUM\"; break;\n case GL_INVALID_VALUE: error = \"INVALID_VALUE\"; break;\n case GL_INVALID_OPERATION: error = \"INVALID_OPERATION\"; break;\n case GL_STACK_OVERFLOW: error = \"STACK_OVERFLOW\"; break;\n case GL_STACK_UNDERFLOW: error = \"STACK_UNDERFLOW\"; break;\n case GL_OUT_OF_MEMORY: error = \"OUT_OF_MEMORY\"; break;\n case GL_INVALID_FRAMEBUFFER_OPERATION: error = \"INVALID_FRAMEBUFFER_OPERATION\"; break;\n }\n std::cout << error << \" | \" << file << \" (\" << line << \")\" << std::endl;\n }\n return errorCode;\n}\n#define glCheckError() glCheckError_(__FILE__, __LINE__)\n\nvoid APIENTRY glDebugOutput(GLenum source, \n GLenum type, \n unsigned int id, \n GLenum severity, \n GLsizei length, \n const char *message, \n const void *userParam)\n{\n if(id == 131169 || id == 131185 || id == 131218 || id == 131204) return; // ignore these non-significant error codes\n\n std::cout << \"---------------\" << std::endl;\n std::cout << \"Debug message (\" << id << \"): \" << message << std::endl;\n\n switch (source)\n {\n case GL_DEBUG_SOURCE_API: std::cout << \"Source: API\"; break;\n case GL_DEBUG_SOURCE_WINDOW_SYSTEM: std::cout << \"Source: Window System\"; break;\n case GL_DEBUG_SOURCE_SHADER_COMPILER: std::cout << \"Source: Shader Compiler\"; break;\n case GL_DEBUG_SOURCE_THIRD_PARTY: std::cout << \"Source: Third Party\"; break;\n case GL_DEBUG_SOURCE_APPLICATION: std::cout << \"Source: Application\"; break;\n case GL_DEBUG_SOURCE_OTHER: std::cout << \"Source: Other\"; break;\n } std::cout << std::endl;\n\n switch (type)\n {\n case GL_DEBUG_TYPE_ERROR: std::cout << \"Type: Error\"; break;\n case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: std::cout << \"Type: Deprecated Behaviour\"; break;\n case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: std::cout << \"Type: Undefined Behaviour\"; break; \n case GL_DEBUG_TYPE_PORTABILITY: std::cout << \"Type: Portability\"; break;\n case GL_DEBUG_TYPE_PERFORMANCE: std::cout << \"Type: Performance\"; break;\n case GL_DEBUG_TYPE_MARKER: std::cout << \"Type: Marker\"; break;\n case GL_DEBUG_TYPE_PUSH_GROUP: std::cout << \"Type: Push Group\"; break;\n case GL_DEBUG_TYPE_POP_GROUP: std::cout << \"Type: Pop Group\"; break;\n case GL_DEBUG_TYPE_OTHER: std::cout << \"Type: Other\"; break;\n } std::cout << std::endl;\n \n switch (severity)\n {\n case GL_DEBUG_SEVERITY_HIGH: std::cout << \"Severity: high\"; break;\n case GL_DEBUG_SEVERITY_MEDIUM: std::cout << \"Severity: medium\"; break;\n case GL_DEBUG_SEVERITY_LOW: std::cout << \"Severity: low\"; break;\n case GL_DEBUG_SEVERITY_NOTIFICATION: std::cout << \"Severity: notification\"; break;\n } std::cout << std::endl;\n std::cout << std::endl;\n}\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, true); // comment this line in a release build! \n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n glfwMakeContextCurrent(window);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // enable OpenGL debug context if context allows for debug context\n int flags; glGetIntegerv(GL_CONTEXT_FLAGS, &flags);\n if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)\n {\n glEnable(GL_DEBUG_OUTPUT);\n glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); // makes sure errors are displayed synchronously\n glDebugMessageCallback(glDebugOutput, nullptr);\n glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE);\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_CULL_FACE);\n \n // OpenGL initial state\n Shader shader(\"debugging.vs\", \"debugging.fs\");\n\n // configure 3D cube\n unsigned int cubeVAO, cubeVBO;\n float vertices[] = {\n // back face\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, // bottom-left\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, // bottom-right \n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, // bottom-left\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left\n // front face\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-right\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, // top-right\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, // top-right\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, // top-left\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left\n // left face\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, // top-right\n -0.5f, 0.5f, -0.5f, -1.0f, 1.0f, // top-left\n -0.5f, -0.5f, -0.5f, -0.0f, 1.0f, // bottom-left\n -0.5f, -0.5f, -0.5f, -0.0f, 1.0f, // bottom-left\n -0.5f, -0.5f, 0.5f, -0.0f, 0.0f, // bottom-right\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, // top-right\n // right face\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-left\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-right\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right \n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-right\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-left\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // top-right\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f, // top-left\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-left\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-left\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-right\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // top-right\n // top face\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // bottom-right\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right \n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // bottom-right\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n\n // load cube texture\n unsigned int texture;\n glGenTextures(1, &texture);\n glBindTexture(GL_TEXTURE_2D, texture);\n int width, height, nrComponents;\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/wood.png\").c_str(), &width, &height, &nrComponents, 0);\n if (data)\n {\n glTexImage2D(GL_FRAMEBUFFER, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // set up projection matrix\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 10.0f);\n glUniformMatrix4fv(glGetUniformLocation(shader.ID, \"projection\"), 1, GL_FALSE, glm::value_ptr(projection));\n glUniform1i(glGetUniformLocation(shader.ID, \"tex\"), 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n float rotationSpeed = 10.0f;\n float angle = (float)glfwGetTime() * rotationSpeed;\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0, 0.0f, -2.5));\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 1.0f, 1.0f));\n glUniformMatrix4fv(glGetUniformLocation(shader.ID, \"model\"), 1, GL_FALSE, glm::value_ptr(model));\n\n glBindTexture(GL_TEXTURE_2D, texture);\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}, {"path": "src/7.in_practice/1.debugging/debugging.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\nin vec2 TexCoords;\n\nuniform sampler2D tex;\n\nvoid main()\n{\n FragColor = texture(tex, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/7.in_practice/1.debugging/debugging.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 position;\nlayout (location = 1) in vec2 texCoords;\n\nuniform mat4 projection;\nuniform mat4 model;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n gl_Position = projection * model * vec4(position, 1.0f);\n TexCoords = texCoords;\n}", "stage": "vertex", "validation_status": "valid"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.095, "dedup_hash": "be853f27a71ddc90", "has_readme": true} +{"id": "joeydevries_learnopengl_src_7_in_practice_2_text_rendering", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:23+00:00", "source_type": "repo", "title": "2.Text Rendering", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/7.in_practice/2.text_rendering/text.fs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nin vec2 TexCoords;\nout vec4 color;\n\nuniform sampler2D text;\nuniform vec3 textColor;\n\nvoid main()\n{ \n vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r);\n color = vec4(textColor, 1.0) * sampled;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/7.in_practice/2.text_rendering/text.vs", "language": "glsl", "loc": 9, "comment_density": 0.111, "code": "#version 330 core\nlayout (location = 0) in vec4 vertex; // \nout vec2 TexCoords;\n\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\n TexCoords = vertex.zw;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/7.in_practice/2.text_rendering/text_rendering.cpp", "language": "code", "loc": 225, "comment_density": 0.249, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include FT_FREETYPE_H\n\n#include \n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\nvoid RenderText(Shader &shader, std::string text, float x, float y, float scale, glm::vec3 color);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n/// Holds all state information relevant to a character as loaded using FreeType\nstruct Character {\n unsigned int TextureID; // ID handle of the glyph texture\n glm::ivec2 Size; // Size of glyph\n glm::ivec2 Bearing; // Offset from baseline to left/top of glyph\n unsigned int Advance; // Horizontal offset to advance to next glyph\n};\n\nstd::map Characters;\nunsigned int VAO, VBO;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n \n // OpenGL state\n // ------------\n glEnable(GL_CULL_FACE);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n \n // compile and setup the shader\n // ----------------------------\n Shader shader(\"text.vs\", \"text.fs\");\n glm::mat4 projection = glm::ortho(0.0f, static_cast(SCR_WIDTH), 0.0f, static_cast(SCR_HEIGHT));\n shader.use();\n glUniformMatrix4fv(glGetUniformLocation(shader.ID, \"projection\"), 1, GL_FALSE, glm::value_ptr(projection));\n\n // FreeType\n // --------\n FT_Library ft;\n // All functions return a value different than 0 whenever an error occurred\n if (FT_Init_FreeType(&ft))\n {\n std::cout << \"ERROR::FREETYPE: Could not init FreeType Library\" << std::endl;\n return -1;\n }\n\n\t// find path to font\n std::string font_name = FileSystem::getPath(\"resources/fonts/Antonio-Bold.ttf\");\n if (font_name.empty())\n {\n std::cout << \"ERROR::FREETYPE: Failed to load font_name\" << std::endl;\n return -1;\n }\n\t\n\t// load font as face\n FT_Face face;\n if (FT_New_Face(ft, font_name.c_str(), 0, &face)) {\n std::cout << \"ERROR::FREETYPE: Failed to load font\" << std::endl;\n return -1;\n }\n else {\n // set size to load glyphs as\n FT_Set_Pixel_Sizes(face, 0, 48);\n\n // disable byte-alignment restriction\n glPixelStorei(GL_UNPACK_ALIGNMENT, 1);\n\n // load first 128 characters of ASCII set\n for (unsigned char c = 0; c < 128; c++)\n {\n // Load character glyph \n if (FT_Load_Char(face, c, FT_LOAD_RENDER))\n {\n std::cout << \"ERROR::FREETYTPE: Failed to load Glyph\" << std::endl;\n continue;\n }\n // generate texture\n unsigned int texture;\n glGenTextures(1, &texture);\n glBindTexture(GL_TEXTURE_2D, texture);\n glTexImage2D(\n GL_TEXTURE_2D,\n 0,\n GL_RED,\n face->glyph->bitmap.width,\n face->glyph->bitmap.rows,\n 0,\n GL_RED,\n GL_UNSIGNED_BYTE,\n face->glyph->bitmap.buffer\n );\n // set texture options\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // now store character for later use\n Character character = {\n texture,\n glm::ivec2(face->glyph->bitmap.width, face->glyph->bitmap.rows),\n glm::ivec2(face->glyph->bitmap_left, face->glyph->bitmap_top),\n static_cast(face->glyph->advance.x)\n };\n Characters.insert(std::pair(c, character));\n }\n glBindTexture(GL_TEXTURE_2D, 0);\n }\n // destroy FreeType once we're finished\n FT_Done_Face(face);\n FT_Done_FreeType(ft);\n\n \n // configure VAO/VBO for texture quads\n // -----------------------------------\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glBindVertexArray(VAO);\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 6 * 4, NULL, GL_DYNAMIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0);\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n RenderText(shader, \"This is sample text\", 25.0f, 25.0f, 1.0f, glm::vec3(0.5, 0.8f, 0.2f));\n RenderText(shader, \"(C) LearnOpenGL.com\", 540.0f, 570.0f, 0.5f, glm::vec3(0.3, 0.7f, 0.9f));\n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// render line of text\n// -------------------\nvoid RenderText(Shader &shader, std::string text, float x, float y, float scale, glm::vec3 color)\n{\n // activate corresponding render state\t\n shader.use();\n glUniform3f(glGetUniformLocation(shader.ID, \"textColor\"), color.x, color.y, color.z);\n glActiveTexture(GL_TEXTURE0);\n glBindVertexArray(VAO);\n\n // iterate through all characters\n std::string::const_iterator c;\n for (c = text.begin(); c != text.end(); c++) \n {\n Character ch = Characters[*c];\n\n float xpos = x + ch.Bearing.x * scale;\n float ypos = y - (ch.Size.y - ch.Bearing.y) * scale;\n\n float w = ch.Size.x * scale;\n float h = ch.Size.y * scale;\n // update VBO for each character\n float vertices[6][4] = {\n { xpos, ypos + h, 0.0f, 0.0f }, \n { xpos, ypos, 0.0f, 1.0f },\n { xpos + w, ypos, 1.0f, 1.0f },\n\n { xpos, ypos + h, 0.0f, 0.0f },\n { xpos + w, ypos, 1.0f, 1.0f },\n { xpos + w, ypos + h, 1.0f, 0.0f } \n };\n // render glyph texture over quad\n glBindTexture(GL_TEXTURE_2D, ch.TextureID);\n // update content of VBO memory\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); // be sure to use glBufferSubData and not glBufferData\n\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n // render quad\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // now advance cursors for next glyph (note that advance is number of 1/64 pixels)\n x += (ch.Advance >> 6) * scale; // bitshift by 6 to get value in pixels (2^6 = 64 (divide amount of 1/64th pixels by 64 to get amount of pixels))\n }\n glBindVertexArray(0);\n glBindTexture(GL_TEXTURE_2D, 0);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.12, "dedup_hash": "ba1fa3919abe3b7e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_7_in_practice_3_2d_game_0_full_source", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:23+00:00", "source_type": "repo", "title": "0.Full Source", "api": "OpenGL Core", "glsl_version": null, "topic": "geometry_shader/postprocessing/texturing/particles/framebuffer", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/7.in_practice/3.2d_game/0.full_source/ball_object.cpp", "language": "code", "loc": 48, "comment_density": 0.25, "code": "/******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"ball_object.h\"\n\n\nBallObject::BallObject() \n : GameObject(), Radius(12.5f), Stuck(true), Sticky(false), PassThrough(false) { }\n\nBallObject::BallObject(glm::vec2 pos, float radius, glm::vec2 velocity, Texture2D sprite)\n : GameObject(pos, glm::vec2(radius * 2.0f, radius * 2.0f), sprite, glm::vec3(1.0f), velocity), Radius(radius), Stuck(true), Sticky(false), PassThrough(false) { }\n\nglm::vec2 BallObject::Move(float dt, unsigned int window_width)\n{\n // if not stuck to player board\n if (!this->Stuck)\n {\n // move the ball\n this->Position += this->Velocity * dt;\n // then check if outside window bounds and if so, reverse velocity and restore at correct position\n if (this->Position.x <= 0.0f)\n {\n this->Velocity.x = -this->Velocity.x;\n this->Position.x = 0.0f;\n }\n else if (this->Position.x + this->Size.x >= window_width)\n {\n this->Velocity.x = -this->Velocity.x;\n this->Position.x = window_width - this->Size.x;\n }\n if (this->Position.y <= 0.0f)\n {\n this->Velocity.y = -this->Velocity.y;\n this->Position.y = 0.0f;\n }\n }\n return this->Position;\n}\n\n// resets the ball to initial Stuck Position (if ball is outside window bounds)\nvoid BallObject::Reset(glm::vec2 position, glm::vec2 velocity)\n{\n this->Position = position;\n this->Velocity = velocity;\n this->Stuck = true;\n this->Sticky = false;\n this->PassThrough = false;\n\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/ball_object.h", "language": "code", "loc": 34, "comment_density": 0.471, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef BALLOBJECT_H\n#define BALLOBJECT_H\n\n#include \n#include \n\n#include \"game_object.h\"\n#include \"texture.h\"\n\n\n// BallObject holds the state of the Ball object inheriting\n// relevant state data from GameObject. Contains some extra\n// functionality specific to Breakout's ball object that\n// were too specific for within GameObject alone.\nclass BallObject : public GameObject\n{\npublic:\n // ball state\t\n float Radius;\n bool Stuck;\n bool Sticky, PassThrough;\n // constructor(s)\n BallObject();\n BallObject(glm::vec2 pos, float radius, glm::vec2 velocity, Texture2D sprite);\n // moves the ball, keeping it constrained within the window bounds (except bottom edge); returns new position\n glm::vec2 Move(float dt, unsigned int window_width);\n // resets the ball to original state with given position and velocity\n void Reset(glm::vec2 position, glm::vec2 velocity);\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/game.cpp", "language": "code", "loc": 516, "comment_density": 0.184, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \n#include \n#include \n\n#include \n\n#include \nusing namespace irrklang;\n\n#include \"game.h\"\n#include \"resource_manager.h\"\n#include \"sprite_renderer.h\"\n#include \"game_object.h\"\n#include \"ball_object.h\"\n#include \"particle_generator.h\"\n#include \"post_processor.h\"\n#include \"text_renderer.h\"\n\n\n// Game-related State data\nSpriteRenderer *Renderer;\nGameObject *Player;\nBallObject *Ball;\nParticleGenerator *Particles;\nPostProcessor *Effects;\nISoundEngine *SoundEngine = createIrrKlangDevice();\nTextRenderer *Text;\n\nfloat ShakeTime = 0.0f;\n\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_MENU), Keys(), KeysProcessed(), Width(width), Height(height), Level(0), Lives(3)\n{ \n\n}\n\nGame::~Game()\n{\n delete Renderer;\n delete Player;\n delete Ball;\n delete Particles;\n delete Effects;\n delete Text;\n SoundEngine->drop();\n}\n\nvoid Game::Init()\n{\n // load shaders\n ResourceManager::LoadShader(\"sprite.vs\", \"sprite.fs\", nullptr, \"sprite\");\n ResourceManager::LoadShader(\"particle.vs\", \"particle.fs\", nullptr, \"particle\");\n ResourceManager::LoadShader(\"post_processing.vs\", \"post_processing.fs\", nullptr, \"postprocessing\");\n // configure shaders\n glm::mat4 projection = glm::ortho(0.0f, static_cast(this->Width), static_cast(this->Height), 0.0f, -1.0f, 1.0f);\n ResourceManager::GetShader(\"sprite\").Use().SetInteger(\"sprite\", 0);\n ResourceManager::GetShader(\"sprite\").SetMatrix4(\"projection\", projection);\n ResourceManager::GetShader(\"particle\").Use().SetInteger(\"sprite\", 0);\n ResourceManager::GetShader(\"particle\").SetMatrix4(\"projection\", projection);\n // load textures\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/background.jpg\").c_str(), false, \"background\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), true, \"face\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/block.png\").c_str(), false, \"block\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/block_solid.png\").c_str(), false, \"block_solid\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/paddle.png\").c_str(), true, \"paddle\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/particle.png\").c_str(), true, \"particle\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/powerup_speed.png\").c_str(), true, \"powerup_speed\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/powerup_sticky.png\").c_str(), true, \"powerup_sticky\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/powerup_increase.png\").c_str(), true, \"powerup_increase\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/powerup_confuse.png\").c_str(), true, \"powerup_confuse\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/powerup_chaos.png\").c_str(), true, \"powerup_chaos\");\n ResourceManager::LoadTexture(FileSystem::getPath(\"resources/textures/powerup_passthrough.png\").c_str(), true, \"powerup_passthrough\");\n // set render-specific controls\n Renderer = new SpriteRenderer(ResourceManager::GetShader(\"sprite\"));\n Particles = new ParticleGenerator(ResourceManager::GetShader(\"particle\"), ResourceManager::GetTexture(\"particle\"), 500);\n Effects = new PostProcessor(ResourceManager::GetShader(\"postprocessing\"), this->Width, this->Height);\n Text = new TextRenderer(this->Width, this->Height);\n Text->Load(FileSystem::getPath(\"resources/fonts/OCRAEXT.TTF\").c_str(), 24);\n // load levels\n GameLevel one; one.Load(FileSystem::getPath(\"resources/levels/one.lvl\").c_str(), this->Width, this->Height / 2);\n GameLevel two; two.Load(FileSystem::getPath(\"resources/levels/two.lvl\").c_str(), this->Width, this->Height /2 );\n GameLevel three; three.Load(FileSystem::getPath(\"resources/levels/three.lvl\").c_str(), this->Width, this->Height / 2);\n GameLevel four; four.Load(FileSystem::getPath(\"resources/levels/four.lvl\").c_str(), this->Width, this->Height / 2);\n this->Levels.push_back(one);\n this->Levels.push_back(two);\n this->Levels.push_back(three);\n this->Levels.push_back(four);\n this->Level = 0;\n // configure game objects\n glm::vec2 playerPos = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Player = new GameObject(playerPos, PLAYER_SIZE, ResourceManager::GetTexture(\"paddle\"));\n glm::vec2 ballPos = playerPos + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -BALL_RADIUS * 2.0f);\n Ball = new BallObject(ballPos, BALL_RADIUS, INITIAL_BALL_VELOCITY, ResourceManager::GetTexture(\"face\"));\n // audio\n SoundEngine->play2D(FileSystem::getPath(\"resources/audio/breakout.mp3\").c_str(), true);\n}\n\nvoid Game::Update(float dt)\n{\n // update objects\n Ball->Move(dt, this->Width);\n // check for collisions\n this->DoCollisions();\n // update particles\n Particles->Update(dt, *Ball, 2, glm::vec2(Ball->Radius / 2.0f));\n // update PowerUps\n this->UpdatePowerUps(dt);\n // reduce shake time\n if (ShakeTime > 0.0f)\n {\n ShakeTime -= dt;\n if (ShakeTime <= 0.0f)\n Effects->Shake = false;\n }\n // check loss condition\n if (Ball->Position.y >= this->Height) // did ball reach bottom edge?\n {\n --this->Lives;\n // did the player lose all his lives? : game over\n if (this->Lives == 0)\n {\n this->ResetLevel();\n this->State = GAME_MENU;\n }\n this->ResetPlayer();\n }\n // check win condition\n if (this->State == GAME_ACTIVE && this->Levels[this->Level].IsCompleted())\n {\n this->ResetLevel();\n this->ResetPlayer();\n Effects->Chaos = true;\n this->State = GAME_WIN;\n }\n}\n\n\nvoid Game::ProcessInput(float dt)\n{\n if (this->State == GAME_MENU)\n {\n if (this->Keys[GLFW_KEY_ENTER] && !this->KeysProcessed[GLFW_KEY_ENTER])\n {\n this->State = GAME_ACTIVE;\n this->KeysProcessed[GLFW_KEY_ENTER] = true;\n }\n if (this->Keys[GLFW_KEY_W] && !this->KeysProcessed[GLFW_KEY_W])\n {\n this->Level = (this->Level + 1) % 4;\n this->KeysProcessed[GLFW_KEY_W] = true;\n }\n if (this->Keys[GLFW_KEY_S] && !this->KeysProcessed[GLFW_KEY_S])\n {\n if (this->Level > 0)\n --this->Level;\n else\n this->Level = 3;\n //this->Level = (this->Level - 1) % 4;\n this->KeysProcessed[GLFW_KEY_S] = true;\n }\n }\n if (this->State == GAME_WIN)\n {\n if (this->Keys[GLFW_KEY_ENTER])\n {\n this->KeysProcessed[GLFW_KEY_ENTER] = true;\n Effects->Chaos = false;\n this->State = GAME_MENU;\n }\n }\n if (this->State == GAME_ACTIVE)\n {\n float velocity = PLAYER_VELOCITY * dt;\n // move playerboard\n if (this->Keys[GLFW_KEY_A])\n {\n if (Player->Position.x >= 0.0f)\n {\n Player->Position.x -= velocity;\n if (Ball->Stuck)\n Ball->Position.x -= velocity;\n }\n }\n if (this->Keys[GLFW_KEY_D])\n {\n if (Player->Position.x <= this->Width - Player->Size.x)\n {\n Player->Position.x += velocity;\n if (Ball->Stuck)\n Ball->Position.x += velocity;\n }\n }\n if (this->Keys[GLFW_KEY_SPACE])\n Ball->Stuck = false;\n }\n}\n\nvoid Game::Render()\n{\n if (this->State == GAME_ACTIVE || this->State == GAME_MENU || this->State == GAME_WIN)\n {\n // begin rendering to postprocessing framebuffer\n Effects->BeginRender();\n // draw background\n Renderer->DrawSprite(ResourceManager::GetTexture(\"background\"), glm::vec2(0.0f, 0.0f), glm::vec2(this->Width, this->Height), 0.0f);\n // draw level\n this->Levels[this->Level].Draw(*Renderer);\n // draw player\n Player->Draw(*Renderer);\n // draw PowerUps\n for (PowerUp &powerUp : this->PowerUps)\n if (!powerUp.Destroyed)\n powerUp.Draw(*Renderer);\n // draw particles\t\n Particles->Draw();\n // draw ball\n Ball->Draw(*Renderer); \n // end rendering to postprocessing framebuffer\n Effects->EndRender();\n // render postprocessing quad\n Effects->Render(glfwGetTime());\n // render text (don't include in postprocessing)\n std::stringstream ss; ss << this->Lives;\n Text->RenderText(\"Lives:\" + ss.str(), 5.0f, 5.0f, 1.0f);\n }\n if (this->State == GAME_MENU)\n {\n Text->RenderText(\"Press ENTER to start\", 250.0f, this->Height / 2.0f, 1.0f);\n Text->RenderText(\"Press W or S to select level\", 245.0f, this->Height / 2.0f + 20.0f, 0.75f);\n }\n if (this->State == GAME_WIN)\n {\n Text->RenderText(\"You WON!!!\", 320.0f, this->Height / 2.0f - 20.0f, 1.0f, glm::vec3(0.0f, 1.0f, 0.0f));\n Text->RenderText(\"Press ENTER to retry or ESC to quit\", 130.0f, this->Height / 2.0f, 1.0f, glm::vec3(1.0f, 1.0f, 0.0f));\n }\n}\n\n\nvoid Game::ResetLevel()\n{\n if (this->Level == 0)\n this->Levels[0].Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 1)\n this->Levels[1].Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 2)\n this->Levels[2].Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 3)\n this->Levels[3].Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n\n this->Lives = 3;\n}\n\nvoid Game::ResetPlayer()\n{\n // reset player/ball stats\n Player->Size = PLAYER_SIZE;\n Player->Position = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Ball->Reset(Player->Position + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -(BALL_RADIUS * 2.0f)), INITIAL_BALL_VELOCITY);\n // also disable all active powerups\n Effects->Chaos = Effects->Confuse = false;\n Ball->PassThrough = Ball->Sticky = false;\n Player->Color = glm::vec3(1.0f);\n Ball->Color = glm::vec3(1.0f);\n}\n\n\n// powerups\nbool IsOtherPowerUpActive(std::vector &powerUps, std::string type);\n\nvoid Game::UpdatePowerUps(float dt)\n{\n for (PowerUp &powerUp : this->PowerUps)\n {\n powerUp.Position += powerUp.Velocity * dt;\n if (powerUp.Activated)\n {\n powerUp.Duration -= dt;\n\n if (powerUp.Duration <= 0.0f)\n {\n // remove powerup from list (will later be removed)\n powerUp.Activated = false;\n // deactivate effects\n if (powerUp.Type == \"sticky\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"sticky\"))\n {\t// only reset if no other PowerUp of type sticky is active\n Ball->Sticky = false;\n Player->Color = glm::vec3(1.0f);\n }\n }\n else if (powerUp.Type == \"pass-through\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"pass-through\"))\n {\t// only reset if no other PowerUp of type pass-through is active\n Ball->PassThrough = false;\n Ball->Color = glm::vec3(1.0f);\n }\n }\n else if (powerUp.Type == \"confuse\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"confuse\"))\n {\t// only reset if no other PowerUp of type confuse is active\n Effects->Confuse = false;\n }\n }\n else if (powerUp.Type == \"chaos\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"chaos\"))\n {\t// only reset if no other PowerUp of type chaos is active\n Effects->Chaos = false;\n }\n }\n }\n }\n }\n // Remove all PowerUps from vector that are destroyed AND !activated (thus either off the map or finished)\n // Note we use a lambda expression to remove each PowerUp which is destroyed and not activated\n this->PowerUps.erase(std::remove_if(this->PowerUps.begin(), this->PowerUps.end(),\n [](const PowerUp &powerUp) { return powerUp.Destroyed && !powerUp.Activated; }\n ), this->PowerUps.end());\n}\n\nbool ShouldSpawn(unsigned int chance)\n{\n unsigned int random = rand() % chance;\n return random == 0;\n}\nvoid Game::SpawnPowerUps(GameObject &block)\n{\n if (ShouldSpawn(75)) // 1 in 75 chance\n this->PowerUps.push_back(PowerUp(\"speed\", glm::vec3(0.5f, 0.5f, 1.0f), 0.0f, block.Position, ResourceManager::GetTexture(\"powerup_speed\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"sticky\", glm::vec3(1.0f, 0.5f, 1.0f), 20.0f, block.Position, ResourceManager::GetTexture(\"powerup_sticky\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"pass-through\", glm::vec3(0.5f, 1.0f, 0.5f), 10.0f, block.Position, ResourceManager::GetTexture(\"powerup_passthrough\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"pad-size-increase\", glm::vec3(1.0f, 0.6f, 0.4), 0.0f, block.Position, ResourceManager::GetTexture(\"powerup_increase\")));\n if (ShouldSpawn(15)) // Negative powerups should spawn more often\n this->PowerUps.push_back(PowerUp(\"confuse\", glm::vec3(1.0f, 0.3f, 0.3f), 15.0f, block.Position, ResourceManager::GetTexture(\"powerup_confuse\")));\n if (ShouldSpawn(15))\n this->PowerUps.push_back(PowerUp(\"chaos\", glm::vec3(0.9f, 0.25f, 0.25f), 15.0f, block.Position, ResourceManager::GetTexture(\"powerup_chaos\")));\n}\n\nvoid ActivatePowerUp(PowerUp &powerUp)\n{\n if (powerUp.Type == \"speed\")\n {\n Ball->Velocity *= 1.2;\n }\n else if (powerUp.Type == \"sticky\")\n {\n Ball->Sticky = true;\n Player->Color = glm::vec3(1.0f, 0.5f, 1.0f);\n }\n else if (powerUp.Type == \"pass-through\")\n {\n Ball->PassThrough = true;\n Ball->Color = glm::vec3(1.0f, 0.5f, 0.5f);\n }\n else if (powerUp.Type == \"pad-size-increase\")\n {\n Player->Size.x += 50;\n }\n else if (powerUp.Type == \"confuse\")\n {\n if (!Effects->Chaos)\n Effects->Confuse = true; // only activate if chaos wasn't already active\n }\n else if (powerUp.Type == \"chaos\")\n {\n if (!Effects->Confuse)\n Effects->Chaos = true;\n }\n}\n\nbool IsOtherPowerUpActive(std::vector &powerUps, std::string type)\n{\n // Check if another PowerUp of the same type is still active\n // in which case we don't disable its effect (yet)\n for (const PowerUp &powerUp : powerUps)\n {\n if (powerUp.Activated)\n if (powerUp.Type == type)\n return true;\n }\n return false;\n}\n\n\n// collision detection\nbool CheckCollision(GameObject &one, GameObject &two);\nCollision CheckCollision(BallObject &one, GameObject &two);\nDirection VectorDirection(glm::vec2 closest);\n\nvoid Game::DoCollisions()\n{\n for (GameObject &box : this->Levels[this->Level].Bricks)\n {\n if (!box.Destroyed)\n {\n Collision collision = CheckCollision(*Ball, box);\n if (std::get<0>(collision)) // if collision is true\n {\n // destroy block if not solid\n if (!box.IsSolid)\n {\n box.Destroyed = true;\n this->SpawnPowerUps(box);\n SoundEngine->play2D(FileSystem::getPath(\"resources/audio/bleep.mp3\").c_str(), false);\n }\n else\n { // if block is solid, enable shake effect\n ShakeTime = 0.05f;\n Effects->Shake = true;\n SoundEngine->play2D(FileSystem::getPath(\"resources/audio/bleep.mp3\").c_str(), false);\n }\n // collision resolution\n Direction dir = std::get<1>(collision);\n glm::vec2 diff_vector = std::get<2>(collision);\n if (!(Ball->PassThrough && !box.IsSolid)) // don't do collision resolution on non-solid bricks if pass-through is activated\n {\n if (dir == LEFT || dir == RIGHT) // horizontal collision\n {\n Ball->Velocity.x = -Ball->Velocity.x; // reverse horizontal velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.x);\n if (dir == LEFT)\n Ball->Position.x += penetration; // move ball to right\n else\n Ball->Position.x -= penetration; // move ball to left;\n }\n else // vertical collision\n {\n Ball->Velocity.y = -Ball->Velocity.y; // reverse vertical velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.y);\n if (dir == UP)\n Ball->Position.y -= penetration; // move ball bback up\n else\n Ball->Position.y += penetration; // move ball back down\n }\n }\n }\n } \n }\n\n // also check collisions on PowerUps and if so, activate them\n for (PowerUp &powerUp : this->PowerUps)\n {\n if (!powerUp.Destroyed)\n {\n // first check if powerup passed bottom edge, if so: keep as inactive and destroy\n if (powerUp.Position.y >= this->Height)\n powerUp.Destroyed = true;\n\n if (CheckCollision(*Player, powerUp))\n {\t// collided with player, now activate powerup\n ActivatePowerUp(powerUp);\n powerUp.Destroyed = true;\n powerUp.Activated = true;\n SoundEngine->play2D(FileSystem::getPath(\"resources/audio/powerup.wav\").c_str(), false);\n }\n }\n }\n\n // and finally check collisions for player pad (unless stuck)\n Collision result = CheckCollision(*Ball, *Player);\n if (!Ball->Stuck && std::get<0>(result))\n {\n // check where it hit the board, and change velocity based on where it hit the board\n float centerBoard = Player->Position.x + Player->Size.x / 2.0f;\n float distance = (Ball->Position.x + Ball->Radius) - centerBoard;\n float percentage = distance / (Player->Size.x / 2.0f);\n // then move accordingly\n float strength = 2.0f;\n glm::vec2 oldVelocity = Ball->Velocity;\n Ball->Velocity.x = INITIAL_BALL_VELOCITY.x * percentage * strength; \n //Ball->Velocity.y = -Ball->Velocity.y;\n Ball->Velocity = glm::normalize(Ball->Velocity) * glm::length(oldVelocity); // keep speed consistent over both axes (multiply by length of old velocity, so total strength is not changed)\n // fix sticky paddle\n Ball->Velocity.y = -1.0f * abs(Ball->Velocity.y);\n\n // if Sticky powerup is activated, also stick ball to paddle once new velocity vectors were calculated\n Ball->Stuck = Ball->Sticky;\n\n SoundEngine->play2D(FileSystem::getPath(\"resources/audio/bleep.wav\").c_str(), false);\n }\n}\n\nbool CheckCollision(GameObject &one, GameObject &two) // AABB - AABB collision\n{\n // collision x-axis?\n bool collisionX = one.Position.x + one.Size.x >= two.Position.x &&\n two.Position.x + two.Size.x >= one.Position.x;\n // collision y-axis?\n bool collisionY = one.Position.y + one.Size.y >= two.Position.y &&\n two.Position.y + two.Size.y >= one.Position.y;\n // collision only if on both axes\n return collisionX && collisionY;\n}\n\nCollision CheckCollision(BallObject &one, GameObject &two) // AABB - Circle collision\n{\n // get center point circle first \n glm::vec2 center(one.Position + one.Radius);\n // calculate AABB info (center, half-extents)\n glm::vec2 aabb_half_extents(two.Size.x / 2.0f, two.Size.y / 2.0f);\n glm::vec2 aabb_center(two.Position.x + aabb_half_extents.x, two.Position.y + aabb_half_extents.y);\n // get difference vector between both centers\n glm::vec2 difference = center - aabb_center;\n glm::vec2 clamped = glm::clamp(difference, -aabb_half_extents, aabb_half_extents);\n // now that we know the clamped values, add this to AABB_center and we get the value of box closest to circle\n glm::vec2 closest = aabb_center + clamped;\n // now retrieve vector between center circle and closest point AABB and check if length < radius\n difference = closest - center;\n \n if (glm::length(difference) < one.Radius) // not <= since in that case a collision also occurs when object one exactly touches object two, which they are at the end of each collision resolution stage.\n return std::make_tuple(true, VectorDirection(difference), difference);\n else\n return std::make_tuple(false, UP, glm::vec2(0.0f, 0.0f));\n}\n\n// calculates which direction a vector is facing (N,E,S or W)\nDirection VectorDirection(glm::vec2 target)\n{\n glm::vec2 compass[] = {\n glm::vec2(0.0f, 1.0f),\t// up\n glm::vec2(1.0f, 0.0f),\t// right\n glm::vec2(0.0f, -1.0f),\t// down\n glm::vec2(-1.0f, 0.0f)\t// left\n };\n float max = 0.0f;\n unsigned int best_match = -1;\n for (unsigned int i = 0; i < 4; i++)\n {\n float dot_product = glm::dot(glm::normalize(target), compass[i]);\n if (dot_product > max)\n {\n max = dot_product;\n best_match = i;\n }\n }\n return (Direction)best_match;\n}\n"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/game.h", "language": "code", "loc": 72, "comment_density": 0.347, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef GAME_H\n#define GAME_H\n#include \n#include \n\n#include \n#include \n\n#include \"game_level.h\"\n#include \"power_up.h\"\n\n// Represents the current state of the game\nenum GameState {\n GAME_ACTIVE,\n GAME_MENU,\n GAME_WIN\n};\n\n// Represents the four possible (collision) directions\nenum Direction {\n UP,\n RIGHT,\n DOWN,\n LEFT\n};\n// Defines a Collision typedef that represents collision data\ntypedef std::tuple Collision; // \n\n// Initial size of the player paddle\nconst glm::vec2 PLAYER_SIZE(100.0f, 20.0f);\n// Initial velocity of the player paddle\nconst float PLAYER_VELOCITY(500.0f);\n// Initial velocity of the Ball\nconst glm::vec2 INITIAL_BALL_VELOCITY(100.0f, -350.0f);\n// Radius of the ball object\nconst float BALL_RADIUS = 12.5f;\n\n// Game holds all game-related state and functionality.\n// Combines all game-related data into a single class for\n// easy access to each of the components and manageability.\nclass Game\n{\npublic:\n // game state\n GameState State;\t\n bool Keys[1024];\n bool KeysProcessed[1024];\n unsigned int Width, Height;\n std::vector Levels;\n std::vector PowerUps;\n unsigned int Level;\n unsigned int Lives;\n // constructor/destructor\n Game(unsigned int width, unsigned int height);\n ~Game();\n // initialize game state (load all shaders/textures/levels)\n void Init();\n // game loop\n void ProcessInput(float dt);\n void Update(float dt);\n void Render();\n void DoCollisions();\n // reset\n void ResetLevel();\n void ResetPlayer();\n // powerups\n void SpawnPowerUps(GameObject &block);\n void UpdatePowerUps(float dt);\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/game_level.cpp", "language": "code", "loc": 86, "comment_density": 0.221, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"game_level.h\"\n\n#include \n#include \n\n\nvoid GameLevel::Load(const char *file, unsigned int levelWidth, unsigned int levelHeight)\n{\n // clear old data\n this->Bricks.clear();\n // load from file\n unsigned int tileCode;\n GameLevel level;\n std::string line;\n std::ifstream fstream(file);\n std::vector> tileData;\n if (fstream)\n {\n while (std::getline(fstream, line)) // read each line from level file\n {\n std::istringstream sstream(line);\n std::vector row;\n while (sstream >> tileCode) // read each word separated by spaces\n row.push_back(tileCode);\n tileData.push_back(row);\n }\n if (tileData.size() > 0)\n this->init(tileData, levelWidth, levelHeight);\n }\n}\n\nvoid GameLevel::Draw(SpriteRenderer &renderer)\n{\n for (GameObject &tile : this->Bricks)\n if (!tile.Destroyed)\n tile.Draw(renderer);\n}\n\nbool GameLevel::IsCompleted()\n{\n for (GameObject &tile : this->Bricks)\n if (!tile.IsSolid && !tile.Destroyed)\n return false;\n return true;\n}\n\nvoid GameLevel::init(std::vector> tileData, unsigned int levelWidth, unsigned int levelHeight)\n{\n // calculate dimensions\n unsigned int height = tileData.size();\n unsigned int width = tileData[0].size(); // note we can index vector at [0] since this function is only called if height > 0\n float unit_width = levelWidth / static_cast(width), unit_height = levelHeight / height; \n // initialize level tiles based on tileData\t\t\n for (unsigned int y = 0; y < height; ++y)\n {\n for (unsigned int x = 0; x < width; ++x)\n {\n // check block type from level data (2D level array)\n if (tileData[y][x] == 1) // solid\n {\n glm::vec2 pos(unit_width * x, unit_height * y);\n glm::vec2 size(unit_width, unit_height);\n GameObject obj(pos, size, ResourceManager::GetTexture(\"block_solid\"), glm::vec3(0.8f, 0.8f, 0.7f));\n obj.IsSolid = true;\n this->Bricks.push_back(obj);\n }\n else if (tileData[y][x] > 1)\t// non-solid; now determine its color based on level data\n {\n glm::vec3 color = glm::vec3(1.0f); // original: white\n if (tileData[y][x] == 2)\n color = glm::vec3(0.2f, 0.6f, 1.0f);\n else if (tileData[y][x] == 3)\n color = glm::vec3(0.0f, 0.7f, 0.0f);\n else if (tileData[y][x] == 4)\n color = glm::vec3(0.8f, 0.8f, 0.4f);\n else if (tileData[y][x] == 5)\n color = glm::vec3(1.0f, 0.5f, 0.0f);\n\n glm::vec2 pos(unit_width * x, unit_height * y);\n glm::vec2 size(unit_width, unit_height);\n this->Bricks.push_back(GameObject(pos, size, ResourceManager::GetTexture(\"block\"), color));\n }\n }\n }\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/game_level.h", "language": "code", "loc": 36, "comment_density": 0.444, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef GAMELEVEL_H\n#define GAMELEVEL_H\n#include \n\n#include \n#include \n\n#include \"game_object.h\"\n#include \"sprite_renderer.h\"\n#include \"resource_manager.h\"\n\n\n/// GameLevel holds all Tiles as part of a Breakout level and \n/// hosts functionality to Load/render levels from the harddisk.\nclass GameLevel\n{\npublic:\n // level state\n std::vector Bricks;\n // constructor\n GameLevel() { }\n // loads level from file\n void Load(const char *file, unsigned int levelWidth, unsigned int levelHeight);\n // render level\n void Draw(SpriteRenderer &renderer);\n // check if the level is completed (all non-solid tiles are destroyed)\n bool IsCompleted();\nprivate:\n // initialize level from tile data\n void init(std::vector> tileData, unsigned int levelWidth, unsigned int levelHeight);\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/game_object.cpp", "language": "code", "loc": 17, "comment_density": 0.471, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"game_object.h\"\n\n\nGameObject::GameObject() \n : Position(0.0f, 0.0f), Size(1.0f, 1.0f), Velocity(0.0f), Color(1.0f), Rotation(0.0f), Sprite(), IsSolid(false), Destroyed(false) { }\n\nGameObject::GameObject(glm::vec2 pos, glm::vec2 size, Texture2D sprite, glm::vec3 color, glm::vec2 velocity) \n : Position(pos), Size(size), Velocity(velocity), Color(color), Rotation(0.0f), Sprite(sprite), IsSolid(false), Destroyed(false) { }\n\nvoid GameObject::Draw(SpriteRenderer &renderer)\n{\n renderer.DrawSprite(this->Sprite, this->Position, this->Size, this->Rotation, this->Color);\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/game_object.h", "language": "code", "loc": 35, "comment_density": 0.429, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef GAMEOBJECT_H\n#define GAMEOBJECT_H\n\n#include \n#include \n\n#include \"texture.h\"\n#include \"sprite_renderer.h\"\n\n\n// Container object for holding all state relevant for a single\n// game object entity. Each object in the game likely needs the\n// minimal of state as described within GameObject.\nclass GameObject\n{\npublic:\n // object state\n glm::vec2 Position, Size, Velocity;\n glm::vec3 Color;\n float Rotation;\n bool IsSolid;\n bool Destroyed;\n // render state\n Texture2D Sprite;\t\n // constructor(s)\n GameObject();\n GameObject(glm::vec2 pos, glm::vec2 size, Texture2D sprite, glm::vec3 color = glm::vec3(1.0f), glm::vec2 velocity = glm::vec2(0.0f, 0.0f));\n // draw sprite\n virtual void Draw(SpriteRenderer &renderer);\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/glad.c", "language": "code", "loc": 1790, "comment_density": 0.012, "code": "/*\n\n OpenGL loader generated by glad 0.1.33 on Wed Apr 22 10:46:53 2020.\n\n Language/Generator: C/C++\n Specification: gl\n APIs: gl=3.3\n Profile: compatibility\n Extensions:\n \n Loader: True\n Local files: False\n Omit khrplatform: False\n Reproducible: False\n\n Commandline:\n --profile=\"compatibility\" --api=\"gl=3.3\" --generator=\"c\" --spec=\"gl\" --extensions=\"\"\n Online:\n https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.3\n*/\n\n#include \n#include \n#include \n#include \n\nstatic void* get_proc(const char *namez);\n\n#if defined(_WIN32) || defined(__CYGWIN__)\n#ifndef _WINDOWS_\n#undef APIENTRY\n#endif\n#include \nstatic HMODULE libGL;\n\ntypedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);\nstatic PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;\n\n#ifdef _MSC_VER\n#ifdef __has_include\n #if __has_include()\n #define HAVE_WINAPIFAMILY 1\n #endif\n#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_\n #define HAVE_WINAPIFAMILY 1\n#endif\n#endif\n\n#ifdef HAVE_WINAPIFAMILY\n #include \n #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)\n #define IS_UWP 1\n #endif\n#endif\n\nstatic\nint open_gl(void) {\n#ifndef IS_UWP\n libGL = LoadLibraryW(L\"opengl32.dll\");\n if(libGL != NULL) {\n void (* tmp)(void);\n tmp = (void(*)(void)) GetProcAddress(libGL, \"wglGetProcAddress\");\n gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE) tmp;\n return gladGetProcAddressPtr != NULL;\n }\n#endif\n\n return 0;\n}\n\nstatic\nvoid close_gl(void) {\n if(libGL != NULL) {\n FreeLibrary((HMODULE) libGL);\n libGL = NULL;\n }\n}\n#else\n#include \nstatic void* libGL;\n\n#if !defined(__APPLE__) && !defined(__HAIKU__)\ntypedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);\nstatic PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;\n#endif\n\nstatic\nint open_gl(void) {\n#ifdef __APPLE__\n static const char *NAMES[] = {\n \"../Frameworks/OpenGL.framework/OpenGL\",\n \"/Library/Frameworks/OpenGL.framework/OpenGL\",\n \"/System/Library/Frameworks/OpenGL.framework/OpenGL\",\n \"/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL\"\n };\n#else\n static const char *NAMES[] = {\"libGL.so.1\", \"libGL.so\"};\n#endif\n\n unsigned int index = 0;\n for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) {\n libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);\n\n if(libGL != NULL) {\n#if defined(__APPLE__) || defined(__HAIKU__)\n return 1;\n#else\n gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,\n \"glXGetProcAddressARB\");\n return gladGetProcAddressPtr != NULL;\n#endif\n }\n }\n\n return 0;\n}\n\nstatic\nvoid close_gl(void) {\n if(libGL != NULL) {\n dlclose(libGL);\n libGL = NULL;\n }\n}\n#endif\n\nstatic\nvoid* get_proc(const char *namez) {\n void* result = NULL;\n if(libGL == NULL) return NULL;\n\n#if !defined(__APPLE__) && !defined(__HAIKU__)\n if(gladGetProcAddressPtr != NULL) {\n result = gladGetProcAddressPtr(namez);\n }\n#endif\n if(result == NULL) {\n#if defined(_WIN32) || defined(__CYGWIN__)\n result = (void*)GetProcAddress((HMODULE) libGL, namez);\n#else\n result = dlsym(libGL, namez);\n#endif\n }\n\n return result;\n}\n\nint gladLoadGL(void) {\n int status = 0;\n\n if(open_gl()) {\n status = gladLoadGLLoader(&get_proc);\n close_gl();\n }\n\n return status;\n}\n\nstruct gladGLversionStruct GLVersion = { 0, 0 };\n\n#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)\n#define _GLAD_IS_SOME_NEW_VERSION 1\n#endif\n\nstatic int max_loaded_major;\nstatic int max_loaded_minor;\n\nstatic const char *exts = NULL;\nstatic int num_exts_i = 0;\nstatic char **exts_i = NULL;\n\nstatic int get_exts(void) {\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n if(max_loaded_major < 3) {\n#endif\n exts = (const char *)glGetString(GL_EXTENSIONS);\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n } else {\n unsigned int index;\n\n num_exts_i = 0;\n glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);\n if (num_exts_i > 0) {\n exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i));\n }\n\n if (exts_i == NULL) {\n return 0;\n }\n\n for(index = 0; index < (unsigned)num_exts_i; index++) {\n const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index);\n size_t len = strlen(gl_str_tmp);\n\n char *local_str = (char*)malloc((len+1) * sizeof(char));\n if(local_str != NULL) {\n memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char));\n }\n exts_i[index] = local_str;\n }\n }\n#endif\n return 1;\n}\n\nstatic void free_exts(void) {\n if (exts_i != NULL) {\n int index;\n for(index = 0; index < num_exts_i; index++) {\n free((char *)exts_i[index]);\n }\n free((void *)exts_i);\n exts_i = NULL;\n }\n}\n\nstatic int has_ext(const char *ext) {\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n if(max_loaded_major < 3) {\n#endif\n const char *extensions;\n const char *loc;\n const char *terminator;\n extensions = exts;\n if(extensions == NULL || ext == NULL) {\n return 0;\n }\n\n while(1) {\n loc = strstr(extensions, ext);\n if(loc == NULL) {\n return 0;\n }\n\n terminator = loc + strlen(ext);\n if((loc == extensions || *(loc - 1) == ' ') &&\n (*terminator == ' ' || *terminator == '\\0')) {\n return 1;\n }\n extensions = terminator;\n }\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n } else {\n int index;\n if(exts_i == NULL) return 0;\n for(index = 0; index < num_exts_i; index++) {\n const char *e = exts_i[index];\n\n if(exts_i[index] != NULL && strcmp(e, ext) == 0) {\n return 1;\n }\n }\n }\n#endif\n\n return 0;\n}\nint GLAD_GL_VERSION_1_0 = 0;\nint GLAD_GL_VERSION_1_1 = 0;\nint GLAD_GL_VERSION_1_2 = 0;\nint GLAD_GL_VERSION_1_3 = 0;\nint GLAD_GL_VERSION_1_4 = 0;\nint GLAD_GL_VERSION_1_5 = 0;\nint GLAD_GL_VERSION_2_0 = 0;\nint GLAD_GL_VERSION_2_1 = 0;\nint GLAD_GL_VERSION_3_0 = 0;\nint GLAD_GL_VERSION_3_1 = 0;\nint GLAD_GL_VERSION_3_2 = 0;\nint GLAD_GL_VERSION_3_3 = 0;\nPFNGLACCUMPROC glad_glAccum = NULL;\nPFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL;\nPFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL;\nPFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL;\nPFNGLARRAYELEMENTPROC glad_glArrayElement = NULL;\nPFNGLATTACHSHADERPROC glad_glAttachShader = NULL;\nPFNGLBEGINPROC glad_glBegin = NULL;\nPFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender = NULL;\nPFNGLBEGINQUERYPROC glad_glBeginQuery = NULL;\nPFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback = NULL;\nPFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL;\nPFNGLBINDBUFFERPROC glad_glBindBuffer = NULL;\nPFNGLBINDBUFFERBASEPROC glad_glBindBufferBase = NULL;\nPFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange = NULL;\nPFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation = NULL;\nPFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed = NULL;\nPFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL;\nPFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL;\nPFNGLBINDSAMPLERPROC glad_glBindSampler = NULL;\nPFNGLBINDTEXTUREPROC glad_glBindTexture = NULL;\nPFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL;\nPFNGLBITMAPPROC glad_glBitmap = NULL;\nPFNGLBLENDCOLORPROC glad_glBlendColor = NULL;\nPFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL;\nPFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL;\nPFNGLBLENDFUNCPROC glad_glBlendFunc = NULL;\nPFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL;\nPFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL;\nPFNGLBUFFERDATAPROC glad_glBufferData = NULL;\nPFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL;\nPFNGLCALLLISTPROC glad_glCallList = NULL;\nPFNGLCALLLISTSPROC glad_glCallLists = NULL;\nPFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL;\nPFNGLCLAMPCOLORPROC glad_glClampColor = NULL;\nPFNGLCLEARPROC glad_glClear = NULL;\nPFNGLCLEARACCUMPROC glad_glClearAccum = NULL;\nPFNGLCLEARBUFFERFIPROC glad_glClearBufferfi = NULL;\nPFNGLCLEARBUFFERFVPROC glad_glClearBufferfv = NULL;\nPFNGLCLEARBUFFERIVPROC glad_glClearBufferiv = NULL;\nPFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv = NULL;\nPFNGLCLEARCOLORPROC glad_glClearColor = NULL;\nPFNGLCLEARDEPTHPROC glad_glClearDepth = NULL;\nPFNGLCLEARINDEXPROC glad_glClearIndex = NULL;\nPFNGLCLEARSTENCILPROC glad_glClearStencil = NULL;\nPFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL;\nPFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync = NULL;\nPFNGLCLIPPLANEPROC glad_glClipPlane = NULL;\nPFNGLCOLOR3BPROC glad_glColor3b = NULL;\nPFNGLCOLOR3BVPROC glad_glColor3bv = NULL;\nPFNGLCOLOR3DPROC glad_glColor3d = NULL;\nPFNGLCOLOR3DVPROC glad_glColor3dv = NULL;\nPFNGLCOLOR3FPROC glad_glColor3f = NULL;\nPFNGLCOLOR3FVPROC glad_glColor3fv = NULL;\nPFNGLCOLOR3IPROC glad_glColor3i = NULL;\nPFNGLCOLOR3IVPROC glad_glColor3iv = NULL;\nPFNGLCOLOR3SPROC glad_glColor3s = NULL;\nPFNGLCOLOR3SVPROC glad_glColor3sv = NULL;\nPFNGLCOLOR3UBPROC glad_glColor3ub = NULL;\nPFNGLCOLOR3UBVPROC glad_glColor3ubv = NULL;\nPFNGLCOLOR3UIPROC glad_glColor3ui = NULL;\nPFNGLCOLOR3UIVPROC glad_glColor3uiv = NULL;\nPFNGLCOLOR3USPROC glad_glColor3us = NULL;\nPFNGLCOLOR3USVPROC glad_glColor3usv = NULL;\nPFNGLCOLOR4BPROC glad_glColor4b = NULL;\nPFNGLCOLOR4BVPROC glad_glColor4bv = NULL;\nPFNGLCOLOR4DPROC glad_glColor4d = NULL;\nPFNGLCOLOR4DVPROC glad_glColor4dv = NULL;\nPFNGLCOLOR4FPROC glad_glColor4f = NULL;\nPFNGLCOLOR4FVPROC glad_glColor4fv = NULL;\nPFNGLCOLOR4IPROC glad_glColor4i = NULL;\nPFNGLCOLOR4IVPROC glad_glColor4iv = NULL;\nPFNGLCOLOR4SPROC glad_glColor4s = NULL;\nPFNGLCOLOR4SVPROC glad_glColor4sv = NULL;\nPFNGLCOLOR4UBPROC glad_glColor4ub = NULL;\nPFNGLCOLOR4UBVPROC glad_glColor4ubv = NULL;\nPFNGLCOLOR4UIPROC glad_glColor4ui = NULL;\nPFNGLCOLOR4UIVPROC glad_glColor4uiv = NULL;\nPFNGLCOLOR4USPROC glad_glColor4us = NULL;\nPFNGLCOLOR4USVPROC glad_glColor4usv = NULL;\nPFNGLCOLORMASKPROC glad_glColorMask = NULL;\nPFNGLCOLORMASKIPROC glad_glColorMaski = NULL;\nPFNGLCOLORMATERIALPROC glad_glColorMaterial = NULL;\nPFNGLCOLORP3UIPROC glad_glColorP3ui = NULL;\nPFNGLCOLORP3UIVPROC glad_glColorP3uiv = NULL;\nPFNGLCOLORP4UIPROC glad_glColorP4ui = NULL;\nPFNGLCOLORP4UIVPROC glad_glColorP4uiv = NULL;\nPFNGLCOLORPOINTERPROC glad_glColorPointer = NULL;\nPFNGLCOMPILESHADERPROC glad_glCompileShader = NULL;\nPFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL;\nPFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL;\nPFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL;\nPFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL;\nPFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL;\nPFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL;\nPFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData = NULL;\nPFNGLCOPYPIXELSPROC glad_glCopyPixels = NULL;\nPFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL;\nPFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL;\nPFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL;\nPFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL;\nPFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL;\nPFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL;\nPFNGLCREATESHADERPROC glad_glCreateShader = NULL;\nPFNGLCULLFACEPROC glad_glCullFace = NULL;\nPFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL;\nPFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL;\nPFNGLDELETELISTSPROC glad_glDeleteLists = NULL;\nPFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL;\nPFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL;\nPFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL;\nPFNGLDELETESAMPLERSPROC glad_glDeleteSamplers = NULL;\nPFNGLDELETESHADERPROC glad_glDeleteShader = NULL;\nPFNGLDELETESYNCPROC glad_glDeleteSync = NULL;\nPFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL;\nPFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL;\nPFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL;\nPFNGLDEPTHMASKPROC glad_glDepthMask = NULL;\nPFNGLDEPTHRANGEPROC glad_glDepthRange = NULL;\nPFNGLDETACHSHADERPROC glad_glDetachShader = NULL;\nPFNGLDISABLEPROC glad_glDisable = NULL;\nPFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL;\nPFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL;\nPFNGLDISABLEIPROC glad_glDisablei = NULL;\nPFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL;\nPFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced = NULL;\nPFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL;\nPFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL;\nPFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL;\nPFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex = NULL;\nPFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced = NULL;\nPFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex = NULL;\nPFNGLDRAWPIXELSPROC glad_glDrawPixels = NULL;\nPFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL;\nPFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex = NULL;\nPFNGLEDGEFLAGPROC glad_glEdgeFlag = NULL;\nPFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer = NULL;\nPFNGLEDGEFLAGVPROC glad_glEdgeFlagv = NULL;\nPFNGLENABLEPROC glad_glEnable = NULL;\nPFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL;\nPFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL;\nPFNGLENABLEIPROC glad_glEnablei = NULL;\nPFNGLENDPROC glad_glEnd = NULL;\nPFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender = NULL;\nPFNGLENDLISTPROC glad_glEndList = NULL;\nPFNGLENDQUERYPROC glad_glEndQuery = NULL;\nPFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback = NULL;\nPFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL;\nPFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL;\nPFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL;\nPFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv = NULL;\nPFNGLEVALCOORD2DPROC glad_glEvalCoord2d = NULL;\nPFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv = NULL;\nPFNGLEVALCOORD2FPROC glad_glEvalCoord2f = NULL;\nPFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv = NULL;\nPFNGLEVALMESH1PROC glad_glEvalMesh1 = NULL;\nPFNGLEVALMESH2PROC glad_glEvalMesh2 = NULL;\nPFNGLEVALPOINT1PROC glad_glEvalPoint1 = NULL;\nPFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL;\nPFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL;\nPFNGLFENCESYNCPROC glad_glFenceSync = NULL;\nPFNGLFINISHPROC glad_glFinish = NULL;\nPFNGLFLUSHPROC glad_glFlush = NULL;\nPFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange = NULL;\nPFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer = NULL;\nPFNGLFOGCOORDDPROC glad_glFogCoordd = NULL;\nPFNGLFOGCOORDDVPROC glad_glFogCoorddv = NULL;\nPFNGLFOGCOORDFPROC glad_glFogCoordf = NULL;\nPFNGLFOGCOORDFVPROC glad_glFogCoordfv = NULL;\nPFNGLFOGFPROC glad_glFogf = NULL;\nPFNGLFOGFVPROC glad_glFogfv = NULL;\nPFNGLFOGIPROC glad_glFogi = NULL;\nPFNGLFOGIVPROC glad_glFogiv = NULL;\nPFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL;\nPFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture = NULL;\nPFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL;\nPFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL;\nPFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL;\nPFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL;\nPFNGLFRONTFACEPROC glad_glFrontFace = NULL;\nPFNGLFRUSTUMPROC glad_glFrustum = NULL;\nPFNGLGENBUFFERSPROC glad_glGenBuffers = NULL;\nPFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL;\nPFNGLGENLISTSPROC glad_glGenLists = NULL;\nPFNGLGENQUERIESPROC glad_glGenQueries = NULL;\nPFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL;\nPFNGLGENSAMPLERSPROC glad_glGenSamplers = NULL;\nPFNGLGENTEXTURESPROC glad_glGenTextures = NULL;\nPFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL;\nPFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL;\nPFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL;\nPFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL;\nPFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName = NULL;\nPFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv = NULL;\nPFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName = NULL;\nPFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv = NULL;\nPFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL;\nPFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL;\nPFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v = NULL;\nPFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL;\nPFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v = NULL;\nPFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL;\nPFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL;\nPFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL;\nPFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL;\nPFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL;\nPFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL;\nPFNGLGETERRORPROC glad_glGetError = NULL;\nPFNGLGETFLOATVPROC glad_glGetFloatv = NULL;\nPFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex = NULL;\nPFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation = NULL;\nPFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL;\nPFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v = NULL;\nPFNGLGETINTEGER64VPROC glad_glGetInteger64v = NULL;\nPFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v = NULL;\nPFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL;\nPFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL;\nPFNGLGETLIGHTIVPROC glad_glGetLightiv = NULL;\nPFNGLGETMAPDVPROC glad_glGetMapdv = NULL;\nPFNGLGETMAPFVPROC glad_glGetMapfv = NULL;\nPFNGLGETMAPIVPROC glad_glGetMapiv = NULL;\nPFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL;\nPFNGLGETMATERIALIVPROC glad_glGetMaterialiv = NULL;\nPFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv = NULL;\nPFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv = NULL;\nPFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL;\nPFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL;\nPFNGLGETPOINTERVPROC glad_glGetPointerv = NULL;\nPFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL;\nPFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL;\nPFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL;\nPFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v = NULL;\nPFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL;\nPFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v = NULL;\nPFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL;\nPFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL;\nPFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL;\nPFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv = NULL;\nPFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv = NULL;\nPFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv = NULL;\nPFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv = NULL;\nPFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL;\nPFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL;\nPFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL;\nPFNGLGETSTRINGPROC glad_glGetString = NULL;\nPFNGLGETSTRINGIPROC glad_glGetStringi = NULL;\nPFNGLGETSYNCIVPROC glad_glGetSynciv = NULL;\nPFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL;\nPFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL;\nPFNGLGETTEXGENDVPROC glad_glGetTexGendv = NULL;\nPFNGLGETTEXGENFVPROC glad_glGetTexGenfv = NULL;\nPFNGLGETTEXGENIVPROC glad_glGetTexGeniv = NULL;\nPFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL;\nPFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL;\nPFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL;\nPFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv = NULL;\nPFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv = NULL;\nPFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL;\nPFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL;\nPFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying = NULL;\nPFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex = NULL;\nPFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices = NULL;\nPFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL;\nPFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL;\nPFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL;\nPFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv = NULL;\nPFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv = NULL;\nPFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv = NULL;\nPFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL;\nPFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL;\nPFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL;\nPFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL;\nPFNGLHINTPROC glad_glHint = NULL;\nPFNGLINDEXMASKPROC glad_glIndexMask = NULL;\nPFNGLINDEXPOINTERPROC glad_glIndexPointer = NULL;\nPFNGLINDEXDPROC glad_glIndexd = NULL;\nPFNGLINDEXDVPROC glad_glIndexdv = NULL;\nPFNGLINDEXFPROC glad_glIndexf = NULL;\nPFNGLINDEXFVPROC glad_glIndexfv = NULL;\nPFNGLINDEXIPROC glad_glIndexi = NULL;\nPFNGLINDEXIVPROC glad_glIndexiv = NULL;\nPFNGLINDEXSPROC glad_glIndexs = NULL;\nPFNGLINDEXSVPROC glad_glIndexsv = NULL;\nPFNGLINDEXUBPROC glad_glIndexub = NULL;\nPFNGLINDEXUBVPROC glad_glIndexubv = NULL;\nPFNGLINITNAMESPROC glad_glInitNames = NULL;\nPFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL;\nPFNGLISBUFFERPROC glad_glIsBuffer = NULL;\nPFNGLISENABLEDPROC glad_glIsEnabled = NULL;\nPFNGLISENABLEDIPROC glad_glIsEnabledi = NULL;\nPFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL;\nPFNGLISLISTPROC glad_glIsList = NULL;\nPFNGLISPROGRAMPROC glad_glIsProgram = NULL;\nPFNGLISQUERYPROC glad_glIsQuery = NULL;\nPFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL;\nPFNGLISSAMPLERPROC glad_glIsSampler = NULL;\nPFNGLISSHADERPROC glad_glIsShader = NULL;\nPFNGLISSYNCPROC glad_glIsSync = NULL;\nPFNGLISTEXTUREPROC glad_glIsTexture = NULL;\nPFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL;\nPFNGLLIGHTMODELFPROC glad_glLightModelf = NULL;\nPFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL;\nPFNGLLIGHTMODELIPROC glad_glLightModeli = NULL;\nPFNGLLIGHTMODELIVPROC glad_glLightModeliv = NULL;\nPFNGLLIGHTFPROC glad_glLightf = NULL;\nPFNGLLIGHTFVPROC glad_glLightfv = NULL;\nPFNGLLIGHTIPROC glad_glLighti = NULL;\nPFNGLLIGHTIVPROC glad_glLightiv = NULL;\nPFNGLLINESTIPPLEPROC glad_glLineStipple = NULL;\nPFNGLLINEWIDTHPROC glad_glLineWidth = NULL;\nPFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL;\nPFNGLLISTBASEPROC glad_glListBase = NULL;\nPFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL;\nPFNGLLOADMATRIXDPROC glad_glLoadMatrixd = NULL;\nPFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL;\nPFNGLLOADNAMEPROC glad_glLoadName = NULL;\nPFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd = NULL;\nPFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf = NULL;\nPFNGLLOGICOPPROC glad_glLogicOp = NULL;\nPFNGLMAP1DPROC glad_glMap1d = NULL;\nPFNGLMAP1FPROC glad_glMap1f = NULL;\nPFNGLMAP2DPROC glad_glMap2d = NULL;\nPFNGLMAP2FPROC glad_glMap2f = NULL;\nPFNGLMAPBUFFERPROC glad_glMapBuffer = NULL;\nPFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange = NULL;\nPFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL;\nPFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL;\nPFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL;\nPFNGLMAPGRID2FPROC glad_glMapGrid2f = NULL;\nPFNGLMATERIALFPROC glad_glMaterialf = NULL;\nPFNGLMATERIALFVPROC glad_glMaterialfv = NULL;\nPFNGLMATERIALIPROC glad_glMateriali = NULL;\nPFNGLMATERIALIVPROC glad_glMaterialiv = NULL;\nPFNGLMATRIXMODEPROC glad_glMatrixMode = NULL;\nPFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL;\nPFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL;\nPFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL;\nPFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL;\nPFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL;\nPFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL;\nPFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex = NULL;\nPFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL;\nPFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL;\nPFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL;\nPFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv = NULL;\nPFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i = NULL;\nPFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv = NULL;\nPFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s = NULL;\nPFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv = NULL;\nPFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d = NULL;\nPFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv = NULL;\nPFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f = NULL;\nPFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv = NULL;\nPFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i = NULL;\nPFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv = NULL;\nPFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s = NULL;\nPFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv = NULL;\nPFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d = NULL;\nPFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv = NULL;\nPFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f = NULL;\nPFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv = NULL;\nPFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i = NULL;\nPFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv = NULL;\nPFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s = NULL;\nPFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv = NULL;\nPFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d = NULL;\nPFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv = NULL;\nPFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL;\nPFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv = NULL;\nPFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i = NULL;\nPFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv = NULL;\nPFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s = NULL;\nPFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv = NULL;\nPFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui = NULL;\nPFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv = NULL;\nPFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui = NULL;\nPFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv = NULL;\nPFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui = NULL;\nPFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv = NULL;\nPFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui = NULL;\nPFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv = NULL;\nPFNGLNEWLISTPROC glad_glNewList = NULL;\nPFNGLNORMAL3BPROC glad_glNormal3b = NULL;\nPFNGLNORMAL3BVPROC glad_glNormal3bv = NULL;\nPFNGLNORMAL3DPROC glad_glNormal3d = NULL;\nPFNGLNORMAL3DVPROC glad_glNormal3dv = NULL;\nPFNGLNORMAL3FPROC glad_glNormal3f = NULL;\nPFNGLNORMAL3FVPROC glad_glNormal3fv = NULL;\nPFNGLNORMAL3IPROC glad_glNormal3i = NULL;\nPFNGLNORMAL3IVPROC glad_glNormal3iv = NULL;\nPFNGLNORMAL3SPROC glad_glNormal3s = NULL;\nPFNGLNORMAL3SVPROC glad_glNormal3sv = NULL;\nPFNGLNORMALP3UIPROC glad_glNormalP3ui = NULL;\nPFNGLNORMALP3UIVPROC glad_glNormalP3uiv = NULL;\nPFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL;\nPFNGLORTHOPROC glad_glOrtho = NULL;\nPFNGLPASSTHROUGHPROC glad_glPassThrough = NULL;\nPFNGLPIXELMAPFVPROC glad_glPixelMapfv = NULL;\nPFNGLPIXELMAPUIVPROC glad_glPixelMapuiv = NULL;\nPFNGLPIXELMAPUSVPROC glad_glPixelMapusv = NULL;\nPFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL;\nPFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL;\nPFNGLPIXELTRANSFERFPROC glad_glPixelTransferf = NULL;\nPFNGLPIXELTRANSFERIPROC glad_glPixelTransferi = NULL;\nPFNGLPIXELZOOMPROC glad_glPixelZoom = NULL;\nPFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL;\nPFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL;\nPFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL;\nPFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL;\nPFNGLPOINTSIZEPROC glad_glPointSize = NULL;\nPFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL;\nPFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL;\nPFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple = NULL;\nPFNGLPOPATTRIBPROC glad_glPopAttrib = NULL;\nPFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib = NULL;\nPFNGLPOPMATRIXPROC glad_glPopMatrix = NULL;\nPFNGLPOPNAMEPROC glad_glPopName = NULL;\nPFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex = NULL;\nPFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures = NULL;\nPFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex = NULL;\nPFNGLPUSHATTRIBPROC glad_glPushAttrib = NULL;\nPFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib = NULL;\nPFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL;\nPFNGLPUSHNAMEPROC glad_glPushName = NULL;\nPFNGLQUERYCOUNTERPROC glad_glQueryCounter = NULL;\nPFNGLRASTERPOS2DPROC glad_glRasterPos2d = NULL;\nPFNGLRASTERPOS2DVPROC glad_glRasterPos2dv = NULL;\nPFNGLRASTERPOS2FPROC glad_glRasterPos2f = NULL;\nPFNGLRASTERPOS2FVPROC glad_glRasterPos2fv = NULL;\nPFNGLRASTERPOS2IPROC glad_glRasterPos2i = NULL;\nPFNGLRASTERPOS2IVPROC glad_glRasterPos2iv = NULL;\nPFNGLRASTERPOS2SPROC glad_glRasterPos2s = NULL;\nPFNGLRASTERPOS2SVPROC glad_glRasterPos2sv = NULL;\nPFNGLRASTERPOS3DPROC glad_glRasterPos3d = NULL;\nPFNGLRASTERPOS3DVPROC glad_glRasterPos3dv = NULL;\nPFNGLRASTERPOS3FPROC glad_glRasterPos3f = NULL;\nPFNGLRASTERPOS3FVPROC glad_glRasterPos3fv = NULL;\nPFNGLRASTERPOS3IPROC glad_glRasterPos3i = NULL;\nPFNGLRASTERPOS3IVPROC glad_glRasterPos3iv = NULL;\nPFNGLRASTERPOS3SPROC glad_glRasterPos3s = NULL;\nPFNGLRASTERPOS3SVPROC glad_glRasterPos3sv = NULL;\nPFNGLRASTERPOS4DPROC glad_glRasterPos4d = NULL;\nPFNGLRASTERPOS4DVPROC glad_glRasterPos4dv = NULL;\nPFNGLRASTERPOS4FPROC glad_glRasterPos4f = NULL;\nPFNGLRASTERPOS4FVPROC glad_glRasterPos4fv = NULL;\nPFNGLRASTERPOS4IPROC glad_glRasterPos4i = NULL;\nPFNGLRASTERPOS4IVPROC glad_glRasterPos4iv = NULL;\nPFNGLRASTERPOS4SPROC glad_glRasterPos4s = NULL;\nPFNGLRASTERPOS4SVPROC glad_glRasterPos4sv = NULL;\nPFNGLREADBUFFERPROC glad_glReadBuffer = NULL;\nPFNGLREADPIXELSPROC glad_glReadPixels = NULL;\nPFNGLRECTDPROC glad_glRectd = NULL;\nPFNGLRECTDVPROC glad_glRectdv = NULL;\nPFNGLRECTFPROC glad_glRectf = NULL;\nPFNGLRECTFVPROC glad_glRectfv = NULL;\nPFNGLRECTIPROC glad_glRecti = NULL;\nPFNGLRECTIVPROC glad_glRectiv = NULL;\nPFNGLRECTSPROC glad_glRects = NULL;\nPFNGLRECTSVPROC glad_glRectsv = NULL;\nPFNGLRENDERMODEPROC glad_glRenderMode = NULL;\nPFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL;\nPFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL;\nPFNGLROTATEDPROC glad_glRotated = NULL;\nPFNGLROTATEFPROC glad_glRotatef = NULL;\nPFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL;\nPFNGLSAMPLEMASKIPROC glad_glSampleMaski = NULL;\nPFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv = NULL;\nPFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv = NULL;\nPFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf = NULL;\nPFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv = NULL;\nPFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri = NULL;\nPFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv = NULL;\nPFNGLSCALEDPROC glad_glScaled = NULL;\nPFNGLSCALEFPROC glad_glScalef = NULL;\nPFNGLSCISSORPROC glad_glScissor = NULL;\nPFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b = NULL;\nPFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv = NULL;\nPFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d = NULL;\nPFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv = NULL;\nPFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f = NULL;\nPFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv = NULL;\nPFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i = NULL;\nPFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv = NULL;\nPFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s = NULL;\nPFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv = NULL;\nPFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub = NULL;\nPFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv = NULL;\nPFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui = NULL;\nPFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv = NULL;\nPFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us = NULL;\nPFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv = NULL;\nPFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui = NULL;\nPFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv = NULL;\nPFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL;\nPFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL;\nPFNGLSHADEMODELPROC glad_glShadeModel = NULL;\nPFNGLSHADERSOURCEPROC glad_glShaderSource = NULL;\nPFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL;\nPFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL;\nPFNGLSTENCILMASKPROC glad_glStencilMask = NULL;\nPFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL;\nPFNGLSTENCILOPPROC glad_glStencilOp = NULL;\nPFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL;\nPFNGLTEXBUFFERPROC glad_glTexBuffer = NULL;\nPFNGLTEXCOORD1DPROC glad_glTexCoord1d = NULL;\nPFNGLTEXCOORD1DVPROC glad_glTexCoord1dv = NULL;\nPFNGLTEXCOORD1FPROC glad_glTexCoord1f = NULL;\nPFNGLTEXCOORD1FVPROC glad_glTexCoord1fv = NULL;\nPFNGLTEXCOORD1IPROC glad_glTexCoord1i = NULL;\nPFNGLTEXCOORD1IVPROC glad_glTexCoord1iv = NULL;\nPFNGLTEXCOORD1SPROC glad_glTexCoord1s = NULL;\nPFNGLTEXCOORD1SVPROC glad_glTexCoord1sv = NULL;\nPFNGLTEXCOORD2DPROC glad_glTexCoord2d = NULL;\nPFNGLTEXCOORD2DVPROC glad_glTexCoord2dv = NULL;\nPFNGLTEXCOORD2FPROC glad_glTexCoord2f = NULL;\nPFNGLTEXCOORD2FVPROC glad_glTexCoord2fv = NULL;\nPFNGLTEXCOORD2IPROC glad_glTexCoord2i = NULL;\nPFNGLTEXCOORD2IVPROC glad_glTexCoord2iv = NULL;\nPFNGLTEXCOORD2SPROC glad_glTexCoord2s = NULL;\nPFNGLTEXCOORD2SVPROC glad_glTexCoord2sv = NULL;\nPFNGLTEXCOORD3DPROC glad_glTexCoord3d = NULL;\nPFNGLTEXCOORD3DVPROC glad_glTexCoord3dv = NULL;\nPFNGLTEXCOORD3FPROC glad_glTexCoord3f = NULL;\nPFNGLTEXCOORD3FVPROC glad_glTexCoord3fv = NULL;\nPFNGLTEXCOORD3IPROC glad_glTexCoord3i = NULL;\nPFNGLTEXCOORD3IVPROC glad_glTexCoord3iv = NULL;\nPFNGLTEXCOORD3SPROC glad_glTexCoord3s = NULL;\nPFNGLTEXCOORD3SVPROC glad_glTexCoord3sv = NULL;\nPFNGLTEXCOORD4DPROC glad_glTexCoord4d = NULL;\nPFNGLTEXCOORD4DVPROC glad_glTexCoord4dv = NULL;\nPFNGLTEXCOORD4FPROC glad_glTexCoord4f = NULL;\nPFNGLTEXCOORD4FVPROC glad_glTexCoord4fv = NULL;\nPFNGLTEXCOORD4IPROC glad_glTexCoord4i = NULL;\nPFNGLTEXCOORD4IVPROC glad_glTexCoord4iv = NULL;\nPFNGLTEXCOORD4SPROC glad_glTexCoord4s = NULL;\nPFNGLTEXCOORD4SVPROC glad_glTexCoord4sv = NULL;\nPFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui = NULL;\nPFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv = NULL;\nPFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui = NULL;\nPFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv = NULL;\nPFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui = NULL;\nPFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv = NULL;\nPFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui = NULL;\nPFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv = NULL;\nPFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL;\nPFNGLTEXENVFPROC glad_glTexEnvf = NULL;\nPFNGLTEXENVFVPROC glad_glTexEnvfv = NULL;\nPFNGLTEXENVIPROC glad_glTexEnvi = NULL;\nPFNGLTEXENVIVPROC glad_glTexEnviv = NULL;\nPFNGLTEXGENDPROC glad_glTexGend = NULL;\nPFNGLTEXGENDVPROC glad_glTexGendv = NULL;\nPFNGLTEXGENFPROC glad_glTexGenf = NULL;\nPFNGLTEXGENFVPROC glad_glTexGenfv = NULL;\nPFNGLTEXGENIPROC glad_glTexGeni = NULL;\nPFNGLTEXGENIVPROC glad_glTexGeniv = NULL;\nPFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL;\nPFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL;\nPFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample = NULL;\nPFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL;\nPFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample = NULL;\nPFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv = NULL;\nPFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv = NULL;\nPFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL;\nPFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL;\nPFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL;\nPFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL;\nPFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL;\nPFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL;\nPFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL;\nPFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings = NULL;\nPFNGLTRANSLATEDPROC glad_glTranslated = NULL;\nPFNGLTRANSLATEFPROC glad_glTranslatef = NULL;\nPFNGLUNIFORM1FPROC glad_glUniform1f = NULL;\nPFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL;\nPFNGLUNIFORM1IPROC glad_glUniform1i = NULL;\nPFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL;\nPFNGLUNIFORM1UIPROC glad_glUniform1ui = NULL;\nPFNGLUNIFORM1UIVPROC glad_glUniform1uiv = NULL;\nPFNGLUNIFORM2FPROC glad_glUniform2f = NULL;\nPFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL;\nPFNGLUNIFORM2IPROC glad_glUniform2i = NULL;\nPFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL;\nPFNGLUNIFORM2UIPROC glad_glUniform2ui = NULL;\nPFNGLUNIFORM2UIVPROC glad_glUniform2uiv = NULL;\nPFNGLUNIFORM3FPROC glad_glUniform3f = NULL;\nPFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL;\nPFNGLUNIFORM3IPROC glad_glUniform3i = NULL;\nPFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL;\nPFNGLUNIFORM3UIPROC glad_glUniform3ui = NULL;\nPFNGLUNIFORM3UIVPROC glad_glUniform3uiv = NULL;\nPFNGLUNIFORM4FPROC glad_glUniform4f = NULL;\nPFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL;\nPFNGLUNIFORM4IPROC glad_glUniform4i = NULL;\nPFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL;\nPFNGLUNIFORM4UIPROC glad_glUniform4ui = NULL;\nPFNGLUNIFORM4UIVPROC glad_glUniform4uiv = NULL;\nPFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding = NULL;\nPFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL;\nPFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL;\nPFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL;\nPFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL;\nPFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL;\nPFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL;\nPFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL;\nPFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL;\nPFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL;\nPFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL;\nPFNGLUSEPROGRAMPROC glad_glUseProgram = NULL;\nPFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL;\nPFNGLVERTEX2DPROC glad_glVertex2d = NULL;\nPFNGLVERTEX2DVPROC glad_glVertex2dv = NULL;\nPFNGLVERTEX2FPROC glad_glVertex2f = NULL;\nPFNGLVERTEX2FVPROC glad_glVertex2fv = NULL;\nPFNGLVERTEX2IPROC glad_glVertex2i = NULL;\nPFNGLVERTEX2IVPROC glad_glVertex2iv = NULL;\nPFNGLVERTEX2SPROC glad_glVertex2s = NULL;\nPFNGLVERTEX2SVPROC glad_glVertex2sv = NULL;\nPFNGLVERTEX3DPROC glad_glVertex3d = NULL;\nPFNGLVERTEX3DVPROC glad_glVertex3dv = NULL;\nPFNGLVERTEX3FPROC glad_glVertex3f = NULL;\nPFNGLVERTEX3FVPROC glad_glVertex3fv = NULL;\nPFNGLVERTEX3IPROC glad_glVertex3i = NULL;\nPFNGLVERTEX3IVPROC glad_glVertex3iv = NULL;\nPFNGLVERTEX3SPROC glad_glVertex3s = NULL;\nPFNGLVERTEX3SVPROC glad_glVertex3sv = NULL;\nPFNGLVERTEX4DPROC glad_glVertex4d = NULL;\nPFNGLVERTEX4DVPROC glad_glVertex4dv = NULL;\nPFNGLVERTEX4FPROC glad_glVertex4f = NULL;\nPFNGLVERTEX4FVPROC glad_glVertex4fv = NULL;\nPFNGLVERTEX4IPROC glad_glVertex4i = NULL;\nPFNGLVERTEX4IVPROC glad_glVertex4iv = NULL;\nPFNGLVERTEX4SPROC glad_glVertex4s = NULL;\nPFNGLVERTEX4SVPROC glad_glVertex4sv = NULL;\nPFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL;\nPFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL;\nPFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL;\nPFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL;\nPFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL;\nPFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL;\nPFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL;\nPFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL;\nPFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL;\nPFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL;\nPFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL;\nPFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL;\nPFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL;\nPFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL;\nPFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL;\nPFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL;\nPFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL;\nPFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL;\nPFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL;\nPFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL;\nPFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL;\nPFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL;\nPFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL;\nPFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL;\nPFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL;\nPFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL;\nPFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL;\nPFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL;\nPFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL;\nPFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL;\nPFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL;\nPFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL;\nPFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL;\nPFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL;\nPFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL;\nPFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL;\nPFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor = NULL;\nPFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i = NULL;\nPFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv = NULL;\nPFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui = NULL;\nPFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv = NULL;\nPFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i = NULL;\nPFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv = NULL;\nPFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui = NULL;\nPFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv = NULL;\nPFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i = NULL;\nPFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv = NULL;\nPFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui = NULL;\nPFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv = NULL;\nPFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv = NULL;\nPFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i = NULL;\nPFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv = NULL;\nPFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv = NULL;\nPFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv = NULL;\nPFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui = NULL;\nPFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv = NULL;\nPFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv = NULL;\nPFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL;\nPFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui = NULL;\nPFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv = NULL;\nPFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui = NULL;\nPFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv = NULL;\nPFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui = NULL;\nPFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv = NULL;\nPFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui = NULL;\nPFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv = NULL;\nPFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL;\nPFNGLVERTEXP2UIPROC glad_glVertexP2ui = NULL;\nPFNGLVERTEXP2UIVPROC glad_glVertexP2uiv = NULL;\nPFNGLVERTEXP3UIPROC glad_glVertexP3ui = NULL;\nPFNGLVERTEXP3UIVPROC glad_glVertexP3uiv = NULL;\nPFNGLVERTEXP4UIPROC glad_glVertexP4ui = NULL;\nPFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL;\nPFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL;\nPFNGLVIEWPORTPROC glad_glViewport = NULL;\nPFNGLWAITSYNCPROC glad_glWaitSync = NULL;\nPFNGLWINDOWPOS2DPROC glad_glWindowPos2d = NULL;\nPFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv = NULL;\nPFNGLWINDOWPOS2FPROC glad_glWindowPos2f = NULL;\nPFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv = NULL;\nPFNGLWINDOWPOS2IPROC glad_glWindowPos2i = NULL;\nPFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv = NULL;\nPFNGLWINDOWPOS2SPROC glad_glWindowPos2s = NULL;\nPFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv = NULL;\nPFNGLWINDOWPOS3DPROC glad_glWindowPos3d = NULL;\nPFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv = NULL;\nPFNGLWINDOWPOS3FPROC glad_glWindowPos3f = NULL;\nPFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv = NULL;\nPFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL;\nPFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL;\nPFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL;\nPFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL;\nstatic void load_GL_VERSION_1_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_0) return;\n\tglad_glCullFace = (PFNGLCULLFACEPROC)load(\"glCullFace\");\n\tglad_glFrontFace = (PFNGLFRONTFACEPROC)load(\"glFrontFace\");\n\tglad_glHint = (PFNGLHINTPROC)load(\"glHint\");\n\tglad_glLineWidth = (PFNGLLINEWIDTHPROC)load(\"glLineWidth\");\n\tglad_glPointSize = (PFNGLPOINTSIZEPROC)load(\"glPointSize\");\n\tglad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load(\"glPolygonMode\");\n\tglad_glScissor = (PFNGLSCISSORPROC)load(\"glScissor\");\n\tglad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load(\"glTexParameterf\");\n\tglad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load(\"glTexParameterfv\");\n\tglad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load(\"glTexParameteri\");\n\tglad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load(\"glTexParameteriv\");\n\tglad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load(\"glTexImage1D\");\n\tglad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load(\"glTexImage2D\");\n\tglad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load(\"glDrawBuffer\");\n\tglad_glClear = (PFNGLCLEARPROC)load(\"glClear\");\n\tglad_glClearColor = (PFNGLCLEARCOLORPROC)load(\"glClearColor\");\n\tglad_glClearStencil = (PFNGLCLEARSTENCILPROC)load(\"glClearStencil\");\n\tglad_glClearDepth = (PFNGLCLEARDEPTHPROC)load(\"glClearDepth\");\n\tglad_glStencilMask = (PFNGLSTENCILMASKPROC)load(\"glStencilMask\");\n\tglad_glColorMask = (PFNGLCOLORMASKPROC)load(\"glColorMask\");\n\tglad_glDepthMask = (PFNGLDEPTHMASKPROC)load(\"glDepthMask\");\n\tglad_glDisable = (PFNGLDISABLEPROC)load(\"glDisable\");\n\tglad_glEnable = (PFNGLENABLEPROC)load(\"glEnable\");\n\tglad_glFinish = (PFNGLFINISHPROC)load(\"glFinish\");\n\tglad_glFlush = (PFNGLFLUSHPROC)load(\"glFlush\");\n\tglad_glBlendFunc = (PFNGLBLENDFUNCPROC)load(\"glBlendFunc\");\n\tglad_glLogicOp = (PFNGLLOGICOPPROC)load(\"glLogicOp\");\n\tglad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load(\"glStencilFunc\");\n\tglad_glStencilOp = (PFNGLSTENCILOPPROC)load(\"glStencilOp\");\n\tglad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load(\"glDepthFunc\");\n\tglad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load(\"glPixelStoref\");\n\tglad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load(\"glPixelStorei\");\n\tglad_glReadBuffer = (PFNGLREADBUFFERPROC)load(\"glReadBuffer\");\n\tglad_glReadPixels = (PFNGLREADPIXELSPROC)load(\"glReadPixels\");\n\tglad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load(\"glGetBooleanv\");\n\tglad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load(\"glGetDoublev\");\n\tglad_glGetError = (PFNGLGETERRORPROC)load(\"glGetError\");\n\tglad_glGetFloatv = (PFNGLGETFLOATVPROC)load(\"glGetFloatv\");\n\tglad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load(\"glGetIntegerv\");\n\tglad_glGetString = (PFNGLGETSTRINGPROC)load(\"glGetString\");\n\tglad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load(\"glGetTexImage\");\n\tglad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load(\"glGetTexParameterfv\");\n\tglad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load(\"glGetTexParameteriv\");\n\tglad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load(\"glGetTexLevelParameterfv\");\n\tglad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load(\"glGetTexLevelParameteriv\");\n\tglad_glIsEnabled = (PFNGLISENABLEDPROC)load(\"glIsEnabled\");\n\tglad_glDepthRange = (PFNGLDEPTHRANGEPROC)load(\"glDepthRange\");\n\tglad_glViewport = (PFNGLVIEWPORTPROC)load(\"glViewport\");\n\tglad_glNewList = (PFNGLNEWLISTPROC)load(\"glNewList\");\n\tglad_glEndList = (PFNGLENDLISTPROC)load(\"glEndList\");\n\tglad_glCallList = (PFNGLCALLLISTPROC)load(\"glCallList\");\n\tglad_glCallLists = (PFNGLCALLLISTSPROC)load(\"glCallLists\");\n\tglad_glDeleteLists = (PFNGLDELETELISTSPROC)load(\"glDeleteLists\");\n\tglad_glGenLists = (PFNGLGENLISTSPROC)load(\"glGenLists\");\n\tglad_glListBase = (PFNGLLISTBASEPROC)load(\"glListBase\");\n\tglad_glBegin = (PFNGLBEGINPROC)load(\"glBegin\");\n\tglad_glBitmap = (PFNGLBITMAPPROC)load(\"glBitmap\");\n\tglad_glColor3b = (PFNGLCOLOR3BPROC)load(\"glColor3b\");\n\tglad_glColor3bv = (PFNGLCOLOR3BVPROC)load(\"glColor3bv\");\n\tglad_glColor3d = (PFNGLCOLOR3DPROC)load(\"glColor3d\");\n\tglad_glColor3dv = (PFNGLCOLOR3DVPROC)load(\"glColor3dv\");\n\tglad_glColor3f = (PFNGLCOLOR3FPROC)load(\"glColor3f\");\n\tglad_glColor3fv = (PFNGLCOLOR3FVPROC)load(\"glColor3fv\");\n\tglad_glColor3i = (PFNGLCOLOR3IPROC)load(\"glColor3i\");\n\tglad_glColor3iv = (PFNGLCOLOR3IVPROC)load(\"glColor3iv\");\n\tglad_glColor3s = (PFNGLCOLOR3SPROC)load(\"glColor3s\");\n\tglad_glColor3sv = (PFNGLCOLOR3SVPROC)load(\"glColor3sv\");\n\tglad_glColor3ub = (PFNGLCOLOR3UBPROC)load(\"glColor3ub\");\n\tglad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load(\"glColor3ubv\");\n\tglad_glColor3ui = (PFNGLCOLOR3UIPROC)load(\"glColor3ui\");\n\tglad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load(\"glColor3uiv\");\n\tglad_glColor3us = (PFNGLCOLOR3USPROC)load(\"glColor3us\");\n\tglad_glColor3usv = (PFNGLCOLOR3USVPROC)load(\"glColor3usv\");\n\tglad_glColor4b = (PFNGLCOLOR4BPROC)load(\"glColor4b\");\n\tglad_glColor4bv = (PFNGLCOLOR4BVPROC)load(\"glColor4bv\");\n\tglad_glColor4d = (PFNGLCOLOR4DPROC)load(\"glColor4d\");\n\tglad_glColor4dv = (PFNGLCOLOR4DVPROC)load(\"glColor4dv\");\n\tglad_glColor4f = (PFNGLCOLOR4FPROC)load(\"glColor4f\");\n\tglad_glColor4fv = (PFNGLCOLOR4FVPROC)load(\"glColor4fv\");\n\tglad_glColor4i = (PFNGLCOLOR4IPROC)load(\"glColor4i\");\n\tglad_glColor4iv = (PFNGLCOLOR4IVPROC)load(\"glColor4iv\");\n\tglad_glColor4s = (PFNGLCOLOR4SPROC)load(\"glColor4s\");\n\tglad_glColor4sv = (PFNGLCOLOR4SVPROC)load(\"glColor4sv\");\n\tglad_glColor4ub = (PFNGLCOLOR4UBPROC)load(\"glColor4ub\");\n\tglad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load(\"glColor4ubv\");\n\tglad_glColor4ui = (PFNGLCOLOR4UIPROC)load(\"glColor4ui\");\n\tglad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load(\"glColor4uiv\");\n\tglad_glColor4us = (PFNGLCOLOR4USPROC)load(\"glColor4us\");\n\tglad_glColor4usv = (PFNGLCOLOR4USVPROC)load(\"glColor4usv\");\n\tglad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load(\"glEdgeFlag\");\n\tglad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load(\"glEdgeFlagv\");\n\tglad_glEnd = (PFNGLENDPROC)load(\"glEnd\");\n\tglad_glIndexd = (PFNGLINDEXDPROC)load(\"glIndexd\");\n\tglad_glIndexdv = (PFNGLINDEXDVPROC)load(\"glIndexdv\");\n\tglad_glIndexf = (PFNGLINDEXFPROC)load(\"glIndexf\");\n\tglad_glIndexfv = (PFNGLINDEXFVPROC)load(\"glIndexfv\");\n\tglad_glIndexi = (PFNGLINDEXIPROC)load(\"glIndexi\");\n\tglad_glIndexiv = (PFNGLINDEXIVPROC)load(\"glIndexiv\");\n\tglad_glIndexs = (PFNGLINDEXSPROC)load(\"glIndexs\");\n\tglad_glIndexsv = (PFNGLINDEXSVPROC)load(\"glIndexsv\");\n\tglad_glNormal3b = (PFNGLNORMAL3BPROC)load(\"glNormal3b\");\n\tglad_glNormal3bv = (PFNGLNORMAL3BVPROC)load(\"glNormal3bv\");\n\tglad_glNormal3d = (PFNGLNORMAL3DPROC)load(\"glNormal3d\");\n\tglad_glNormal3dv = (PFNGLNORMAL3DVPROC)load(\"glNormal3dv\");\n\tglad_glNormal3f = (PFNGLNORMAL3FPROC)load(\"glNormal3f\");\n\tglad_glNormal3fv = (PFNGLNORMAL3FVPROC)load(\"glNormal3fv\");\n\tglad_glNormal3i = (PFNGLNORMAL3IPROC)load(\"glNormal3i\");\n\tglad_glNormal3iv = (PFNGLNORMAL3IVPROC)load(\"glNormal3iv\");\n\tglad_glNormal3s = (PFNGLNORMAL3SPROC)load(\"glNormal3s\");\n\tglad_glNormal3sv = (PFNGLNORMAL3SVPROC)load(\"glNormal3sv\");\n\tglad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load(\"glRasterPos2d\");\n\tglad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load(\"glRasterPos2dv\");\n\tglad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load(\"glRasterPos2f\");\n\tglad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load(\"glRasterPos2fv\");\n\tglad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load(\"glRasterPos2i\");\n\tglad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load(\"glRasterPos2iv\");\n\tglad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load(\"glRasterPos2s\");\n\tglad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load(\"glRasterPos2sv\");\n\tglad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load(\"glRasterPos3d\");\n\tglad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load(\"glRasterPos3dv\");\n\tglad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load(\"glRasterPos3f\");\n\tglad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load(\"glRasterPos3fv\");\n\tglad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load(\"glRasterPos3i\");\n\tglad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load(\"glRasterPos3iv\");\n\tglad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load(\"glRasterPos3s\");\n\tglad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load(\"glRasterPos3sv\");\n\tglad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load(\"glRasterPos4d\");\n\tglad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load(\"glRasterPos4dv\");\n\tglad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load(\"glRasterPos4f\");\n\tglad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load(\"glRasterPos4fv\");\n\tglad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load(\"glRasterPos4i\");\n\tglad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load(\"glRasterPos4iv\");\n\tglad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load(\"glRasterPos4s\");\n\tglad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load(\"glRasterPos4sv\");\n\tglad_glRectd = (PFNGLRECTDPROC)load(\"glRectd\");\n\tglad_glRectdv = (PFNGLRECTDVPROC)load(\"glRectdv\");\n\tglad_glRectf = (PFNGLRECTFPROC)load(\"glRectf\");\n\tglad_glRectfv = (PFNGLRECTFVPROC)load(\"glRectfv\");\n\tglad_glRecti = (PFNGLRECTIPROC)load(\"glRecti\");\n\tglad_glRectiv = (PFNGLRECTIVPROC)load(\"glRectiv\");\n\tglad_glRects = (PFNGLRECTSPROC)load(\"glRects\");\n\tglad_glRectsv = (PFNGLRECTSVPROC)load(\"glRectsv\");\n\tglad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load(\"glTexCoord1d\");\n\tglad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load(\"glTexCoord1dv\");\n\tglad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load(\"glTexCoord1f\");\n\tglad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load(\"glTexCoord1fv\");\n\tglad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load(\"glTexCoord1i\");\n\tglad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load(\"glTexCoord1iv\");\n\tglad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load(\"glTexCoord1s\");\n\tglad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load(\"glTexCoord1sv\");\n\tglad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load(\"glTexCoord2d\");\n\tglad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load(\"glTexCoord2dv\");\n\tglad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load(\"glTexCoord2f\");\n\tglad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load(\"glTexCoord2fv\");\n\tglad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load(\"glTexCoord2i\");\n\tglad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load(\"glTexCoord2iv\");\n\tglad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load(\"glTexCoord2s\");\n\tglad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load(\"glTexCoord2sv\");\n\tglad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load(\"glTexCoord3d\");\n\tglad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load(\"glTexCoord3dv\");\n\tglad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load(\"glTexCoord3f\");\n\tglad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load(\"glTexCoord3fv\");\n\tglad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load(\"glTexCoord3i\");\n\tglad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load(\"glTexCoord3iv\");\n\tglad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load(\"glTexCoord3s\");\n\tglad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load(\"glTexCoord3sv\");\n\tglad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load(\"glTexCoord4d\");\n\tglad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load(\"glTexCoord4dv\");\n\tglad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load(\"glTexCoord4f\");\n\tglad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load(\"glTexCoord4fv\");\n\tglad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load(\"glTexCoord4i\");\n\tglad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load(\"glTexCoord4iv\");\n\tglad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load(\"glTexCoord4s\");\n\tglad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load(\"glTexCoord4sv\");\n\tglad_glVertex2d = (PFNGLVERTEX2DPROC)load(\"glVertex2d\");\n\tglad_glVertex2dv = (PFNGLVERTEX2DVPROC)load(\"glVertex2dv\");\n\tglad_glVertex2f = (PFNGLVERTEX2FPROC)load(\"glVertex2f\");\n\tglad_glVertex2fv = (PFNGLVERTEX2FVPROC)load(\"glVertex2fv\");\n\tglad_glVertex2i = (PFNGLVERTEX2IPROC)load(\"glVertex2i\");\n\tglad_glVertex2iv = (PFNGLVERTEX2IVPROC)load(\"glVertex2iv\");\n\tglad_glVertex2s = (PFNGLVERTEX2SPROC)load(\"glVertex2s\");\n\tglad_glVertex2sv = (PFNGLVERTEX2SVPROC)load(\"glVertex2sv\");\n\tglad_glVertex3d = (PFNGLVERTEX3DPROC)load(\"glVertex3d\");\n\tglad_glVertex3dv = (PFNGLVERTEX3DVPROC)load(\"glVertex3dv\");\n\tglad_glVertex3f = (PFNGLVERTEX3FPROC)load(\"glVertex3f\");\n\tglad_glVertex3fv = (PFNGLVERTEX3FVPROC)load(\"glVertex3fv\");\n\tglad_glVertex3i = (PFNGLVERTEX3IPROC)load(\"glVertex3i\");\n\tglad_glVertex3iv = (PFNGLVERTEX3IVPROC)load(\"glVertex3iv\");\n\tglad_glVertex3s = (PFNGLVERTEX3SPROC)load(\"glVertex3s\");\n\tglad_glVertex3sv = (PFNGLVERTEX3SVPROC)load(\"glVertex3sv\");\n\tglad_glVertex4d = (PFNGLVERTEX4DPROC)load(\"glVertex4d\");\n\tglad_glVertex4dv = (PFNGLVERTEX4DVPROC)load(\"glVertex4dv\");\n\tglad_glVertex4f = (PFNGLVERTEX4FPROC)load(\"glVertex4f\");\n\tglad_glVertex4fv = (PFNGLVERTEX4FVPROC)load(\"glVertex4fv\");\n\tglad_glVertex4i = (PFNGLVERTEX4IPROC)load(\"glVertex4i\");\n\tglad_glVertex4iv = (PFNGLVERTEX4IVPROC)load(\"glVertex4iv\");\n\tglad_glVertex4s = (PFNGLVERTEX4SPROC)load(\"glVertex4s\");\n\tglad_glVertex4sv = (PFNGLVERTEX4SVPROC)load(\"glVertex4sv\");\n\tglad_glClipPlane = (PFNGLCLIPPLANEPROC)load(\"glClipPlane\");\n\tglad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load(\"glColorMaterial\");\n\tglad_glFogf = (PFNGLFOGFPROC)load(\"glFogf\");\n\tglad_glFogfv = (PFNGLFOGFVPROC)load(\"glFogfv\");\n\tglad_glFogi = (PFNGLFOGIPROC)load(\"glFogi\");\n\tglad_glFogiv = (PFNGLFOGIVPROC)load(\"glFogiv\");\n\tglad_glLightf = (PFNGLLIGHTFPROC)load(\"glLightf\");\n\tglad_glLightfv = (PFNGLLIGHTFVPROC)load(\"glLightfv\");\n\tglad_glLighti = (PFNGLLIGHTIPROC)load(\"glLighti\");\n\tglad_glLightiv = (PFNGLLIGHTIVPROC)load(\"glLightiv\");\n\tglad_glLightModelf = (PFNGLLIGHTMODELFPROC)load(\"glLightModelf\");\n\tglad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load(\"glLightModelfv\");\n\tglad_glLightModeli = (PFNGLLIGHTMODELIPROC)load(\"glLightModeli\");\n\tglad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load(\"glLightModeliv\");\n\tglad_glLineStipple = (PFNGLLINESTIPPLEPROC)load(\"glLineStipple\");\n\tglad_glMaterialf = (PFNGLMATERIALFPROC)load(\"glMaterialf\");\n\tglad_glMaterialfv = (PFNGLMATERIALFVPROC)load(\"glMaterialfv\");\n\tglad_glMateriali = (PFNGLMATERIALIPROC)load(\"glMateriali\");\n\tglad_glMaterialiv = (PFNGLMATERIALIVPROC)load(\"glMaterialiv\");\n\tglad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load(\"glPolygonStipple\");\n\tglad_glShadeModel = (PFNGLSHADEMODELPROC)load(\"glShadeModel\");\n\tglad_glTexEnvf = (PFNGLTEXENVFPROC)load(\"glTexEnvf\");\n\tglad_glTexEnvfv = (PFNGLTEXENVFVPROC)load(\"glTexEnvfv\");\n\tglad_glTexEnvi = (PFNGLTEXENVIPROC)load(\"glTexEnvi\");\n\tglad_glTexEnviv = (PFNGLTEXENVIVPROC)load(\"glTexEnviv\");\n\tglad_glTexGend = (PFNGLTEXGENDPROC)load(\"glTexGend\");\n\tglad_glTexGendv = (PFNGLTEXGENDVPROC)load(\"glTexGendv\");\n\tglad_glTexGenf = (PFNGLTEXGENFPROC)load(\"glTexGenf\");\n\tglad_glTexGenfv = (PFNGLTEXGENFVPROC)load(\"glTexGenfv\");\n\tglad_glTexGeni = (PFNGLTEXGENIPROC)load(\"glTexGeni\");\n\tglad_glTexGeniv = (PFNGLTEXGENIVPROC)load(\"glTexGeniv\");\n\tglad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load(\"glFeedbackBuffer\");\n\tglad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load(\"glSelectBuffer\");\n\tglad_glRenderMode = (PFNGLRENDERMODEPROC)load(\"glRenderMode\");\n\tglad_glInitNames = (PFNGLINITNAMESPROC)load(\"glInitNames\");\n\tglad_glLoadName = (PFNGLLOADNAMEPROC)load(\"glLoadName\");\n\tglad_glPassThrough = (PFNGLPASSTHROUGHPROC)load(\"glPassThrough\");\n\tglad_glPopName = (PFNGLPOPNAMEPROC)load(\"glPopName\");\n\tglad_glPushName = (PFNGLPUSHNAMEPROC)load(\"glPushName\");\n\tglad_glClearAccum = (PFNGLCLEARACCUMPROC)load(\"glClearAccum\");\n\tglad_glClearIndex = (PFNGLCLEARINDEXPROC)load(\"glClearIndex\");\n\tglad_glIndexMask = (PFNGLINDEXMASKPROC)load(\"glIndexMask\");\n\tglad_glAccum = (PFNGLACCUMPROC)load(\"glAccum\");\n\tglad_glPopAttrib = (PFNGLPOPATTRIBPROC)load(\"glPopAttrib\");\n\tglad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load(\"glPushAttrib\");\n\tglad_glMap1d = (PFNGLMAP1DPROC)load(\"glMap1d\");\n\tglad_glMap1f = (PFNGLMAP1FPROC)load(\"glMap1f\");\n\tglad_glMap2d = (PFNGLMAP2DPROC)load(\"glMap2d\");\n\tglad_glMap2f = (PFNGLMAP2FPROC)load(\"glMap2f\");\n\tglad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load(\"glMapGrid1d\");\n\tglad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load(\"glMapGrid1f\");\n\tglad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load(\"glMapGrid2d\");\n\tglad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load(\"glMapGrid2f\");\n\tglad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load(\"glEvalCoord1d\");\n\tglad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load(\"glEvalCoord1dv\");\n\tglad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load(\"glEvalCoord1f\");\n\tglad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load(\"glEvalCoord1fv\");\n\tglad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load(\"glEvalCoord2d\");\n\tglad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load(\"glEvalCoord2dv\");\n\tglad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load(\"glEvalCoord2f\");\n\tglad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load(\"glEvalCoord2fv\");\n\tglad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load(\"glEvalMesh1\");\n\tglad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load(\"glEvalPoint1\");\n\tglad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load(\"glEvalMesh2\");\n\tglad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load(\"glEvalPoint2\");\n\tglad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load(\"glAlphaFunc\");\n\tglad_glPixelZoom = (PFNGLPIXELZOOMPROC)load(\"glPixelZoom\");\n\tglad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load(\"glPixelTransferf\");\n\tglad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load(\"glPixelTransferi\");\n\tglad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load(\"glPixelMapfv\");\n\tglad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load(\"glPixelMapuiv\");\n\tglad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load(\"glPixelMapusv\");\n\tglad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load(\"glCopyPixels\");\n\tglad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load(\"glDrawPixels\");\n\tglad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load(\"glGetClipPlane\");\n\tglad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load(\"glGetLightfv\");\n\tglad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load(\"glGetLightiv\");\n\tglad_glGetMapdv = (PFNGLGETMAPDVPROC)load(\"glGetMapdv\");\n\tglad_glGetMapfv = (PFNGLGETMAPFVPROC)load(\"glGetMapfv\");\n\tglad_glGetMapiv = (PFNGLGETMAPIVPROC)load(\"glGetMapiv\");\n\tglad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load(\"glGetMaterialfv\");\n\tglad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load(\"glGetMaterialiv\");\n\tglad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load(\"glGetPixelMapfv\");\n\tglad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load(\"glGetPixelMapuiv\");\n\tglad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load(\"glGetPixelMapusv\");\n\tglad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load(\"glGetPolygonStipple\");\n\tglad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load(\"glGetTexEnvfv\");\n\tglad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load(\"glGetTexEnviv\");\n\tglad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load(\"glGetTexGendv\");\n\tglad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load(\"glGetTexGenfv\");\n\tglad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load(\"glGetTexGeniv\");\n\tglad_glIsList = (PFNGLISLISTPROC)load(\"glIsList\");\n\tglad_glFrustum = (PFNGLFRUSTUMPROC)load(\"glFrustum\");\n\tglad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load(\"glLoadIdentity\");\n\tglad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load(\"glLoadMatrixf\");\n\tglad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load(\"glLoadMatrixd\");\n\tglad_glMatrixMode = (PFNGLMATRIXMODEPROC)load(\"glMatrixMode\");\n\tglad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load(\"glMultMatrixf\");\n\tglad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load(\"glMultMatrixd\");\n\tglad_glOrtho = (PFNGLORTHOPROC)load(\"glOrtho\");\n\tglad_glPopMatrix = (PFNGLPOPMATRIXPROC)load(\"glPopMatrix\");\n\tglad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load(\"glPushMatrix\");\n\tglad_glRotated = (PFNGLROTATEDPROC)load(\"glRotated\");\n\tglad_glRotatef = (PFNGLROTATEFPROC)load(\"glRotatef\");\n\tglad_glScaled = (PFNGLSCALEDPROC)load(\"glScaled\");\n\tglad_glScalef = (PFNGLSCALEFPROC)load(\"glScalef\");\n\tglad_glTranslated = (PFNGLTRANSLATEDPROC)load(\"glTranslated\");\n\tglad_glTranslatef = (PFNGLTRANSLATEFPROC)load(\"glTranslatef\");\n}\nstatic void load_GL_VERSION_1_1(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_1) return;\n\tglad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load(\"glDrawArrays\");\n\tglad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load(\"glDrawElements\");\n\tglad_glGetPointerv = (PFNGLGETPOINTERVPROC)load(\"glGetPointerv\");\n\tglad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load(\"glPolygonOffset\");\n\tglad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load(\"glCopyTexImage1D\");\n\tglad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load(\"glCopyTexImage2D\");\n\tglad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load(\"glCopyTexSubImage1D\");\n\tglad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load(\"glCopyTexSubImage2D\");\n\tglad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load(\"glTexSubImage1D\");\n\tglad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load(\"glTexSubImage2D\");\n\tglad_glBindTexture = (PFNGLBINDTEXTUREPROC)load(\"glBindTexture\");\n\tglad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load(\"glDeleteTextures\");\n\tglad_glGenTextures = (PFNGLGENTEXTURESPROC)load(\"glGenTextures\");\n\tglad_glIsTexture = (PFNGLISTEXTUREPROC)load(\"glIsTexture\");\n\tglad_glArrayElement = (PFNGLARRAYELEMENTPROC)load(\"glArrayElement\");\n\tglad_glColorPointer = (PFNGLCOLORPOINTERPROC)load(\"glColorPointer\");\n\tglad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load(\"glDisableClientState\");\n\tglad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load(\"glEdgeFlagPointer\");\n\tglad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load(\"glEnableClientState\");\n\tglad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load(\"glIndexPointer\");\n\tglad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load(\"glInterleavedArrays\");\n\tglad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load(\"glNormalPointer\");\n\tglad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load(\"glTexCoordPointer\");\n\tglad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load(\"glVertexPointer\");\n\tglad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load(\"glAreTexturesResident\");\n\tglad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load(\"glPrioritizeTextures\");\n\tglad_glIndexub = (PFNGLINDEXUBPROC)load(\"glIndexub\");\n\tglad_glIndexubv = (PFNGLINDEXUBVPROC)load(\"glIndexubv\");\n\tglad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load(\"glPopClientAttrib\");\n\tglad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load(\"glPushClientAttrib\");\n}\nstatic void load_GL_VERSION_1_2(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_2) return;\n\tglad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load(\"glDrawRangeElements\");\n\tglad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load(\"glTexImage3D\");\n\tglad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load(\"glTexSubImage3D\");\n\tglad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load(\"glCopyTexSubImage3D\");\n}\nstatic void load_GL_VERSION_1_3(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_3) return;\n\tglad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load(\"glActiveTexture\");\n\tglad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load(\"glSampleCoverage\");\n\tglad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load(\"glCompressedTexImage3D\");\n\tglad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load(\"glCompressedTexImage2D\");\n\tglad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load(\"glCompressedTexImage1D\");\n\tglad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load(\"glCompressedTexSubImage3D\");\n\tglad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load(\"glCompressedTexSubImage2D\");\n\tglad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load(\"glCompressedTexSubImage1D\");\n\tglad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load(\"glGetCompressedTexImage\");\n\tglad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load(\"glClientActiveTexture\");\n\tglad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load(\"glMultiTexCoord1d\");\n\tglad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load(\"glMultiTexCoord1dv\");\n\tglad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load(\"glMultiTexCoord1f\");\n\tglad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load(\"glMultiTexCoord1fv\");\n\tglad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load(\"glMultiTexCoord1i\");\n\tglad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load(\"glMultiTexCoord1iv\");\n\tglad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load(\"glMultiTexCoord1s\");\n\tglad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load(\"glMultiTexCoord1sv\");\n\tglad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load(\"glMultiTexCoord2d\");\n\tglad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load(\"glMultiTexCoord2dv\");\n\tglad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load(\"glMultiTexCoord2f\");\n\tglad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load(\"glMultiTexCoord2fv\");\n\tglad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load(\"glMultiTexCoord2i\");\n\tglad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load(\"glMultiTexCoord2iv\");\n\tglad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load(\"glMultiTexCoord2s\");\n\tglad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load(\"glMultiTexCoord2sv\");\n\tglad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load(\"glMultiTexCoord3d\");\n\tglad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load(\"glMultiTexCoord3dv\");\n\tglad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load(\"glMultiTexCoord3f\");\n\tglad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load(\"glMultiTexCoord3fv\");\n\tglad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load(\"glMultiTexCoord3i\");\n\tglad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load(\"glMultiTexCoord3iv\");\n\tglad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load(\"glMultiTexCoord3s\");\n\tglad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load(\"glMultiTexCoord3sv\");\n\tglad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load(\"glMultiTexCoord4d\");\n\tglad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load(\"glMultiTexCoord4dv\");\n\tglad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load(\"glMultiTexCoord4f\");\n\tglad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load(\"glMultiTexCoord4fv\");\n\tglad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load(\"glMultiTexCoord4i\");\n\tglad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load(\"glMultiTexCoord4iv\");\n\tglad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load(\"glMultiTexCoord4s\");\n\tglad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load(\"glMultiTexCoord4sv\");\n\tglad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load(\"glLoadTransposeMatrixf\");\n\tglad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load(\"glLoadTransposeMatrixd\");\n\tglad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load(\"glMultTransposeMatrixf\");\n\tglad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load(\"glMultTransposeMatrixd\");\n}\nstatic void load_GL_VERSION_1_4(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_4) return;\n\tglad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load(\"glBlendFuncSeparate\");\n\tglad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load(\"glMultiDrawArrays\");\n\tglad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load(\"glMultiDrawElements\");\n\tglad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load(\"glPointParameterf\");\n\tglad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load(\"glPointParameterfv\");\n\tglad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load(\"glPointParameteri\");\n\tglad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load(\"glPointParameteriv\");\n\tglad_glFogCoordf = (PFNGLFOGCOORDFPROC)load(\"glFogCoordf\");\n\tglad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load(\"glFogCoordfv\");\n\tglad_glFogCoordd = (PFNGLFOGCOORDDPROC)load(\"glFogCoordd\");\n\tglad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load(\"glFogCoorddv\");\n\tglad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load(\"glFogCoordPointer\");\n\tglad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load(\"glSecondaryColor3b\");\n\tglad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load(\"glSecondaryColor3bv\");\n\tglad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load(\"glSecondaryColor3d\");\n\tglad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load(\"glSecondaryColor3dv\");\n\tglad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load(\"glSecondaryColor3f\");\n\tglad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load(\"glSecondaryColor3fv\");\n\tglad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load(\"glSecondaryColor3i\");\n\tglad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load(\"glSecondaryColor3iv\");\n\tglad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load(\"glSecondaryColor3s\");\n\tglad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load(\"glSecondaryColor3sv\");\n\tglad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load(\"glSecondaryColor3ub\");\n\tglad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load(\"glSecondaryColor3ubv\");\n\tglad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load(\"glSecondaryColor3ui\");\n\tglad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load(\"glSecondaryColor3uiv\");\n\tglad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load(\"glSecondaryColor3us\");\n\tglad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load(\"glSecondaryColor3usv\");\n\tglad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load(\"glSecondaryColorPointer\");\n\tglad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load(\"glWindowPos2d\");\n\tglad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load(\"glWindowPos2dv\");\n\tglad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load(\"glWindowPos2f\");\n\tglad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load(\"glWindowPos2fv\");\n\tglad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load(\"glWindowPos2i\");\n\tglad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load(\"glWindowPos2iv\");\n\tglad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load(\"glWindowPos2s\");\n\tglad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load(\"glWindowPos2sv\");\n\tglad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load(\"glWindowPos3d\");\n\tglad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load(\"glWindowPos3dv\");\n\tglad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load(\"glWindowPos3f\");\n\tglad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load(\"glWindowPos3fv\");\n\tglad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load(\"glWindowPos3i\");\n\tglad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load(\"glWindowPos3iv\");\n\tglad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load(\"glWindowPos3s\");\n\tglad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load(\"glWindowPos3sv\");\n\tglad_glBlendColor = (PFNGLBLENDCOLORPROC)load(\"glBlendColor\");\n\tglad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load(\"glBlendEquation\");\n}\nstatic void load_GL_VERSION_1_5(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_5) return;\n\tglad_glGenQueries = (PFNGLGENQUERIESPROC)load(\"glGenQueries\");\n\tglad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load(\"glDeleteQueries\");\n\tglad_glIsQuery = (PFNGLISQUERYPROC)load(\"glIsQuery\");\n\tglad_glBeginQuery = (PFNGLBEGINQUERYPROC)load(\"glBeginQuery\");\n\tglad_glEndQuery = (PFNGLENDQUERYPROC)load(\"glEndQuery\");\n\tglad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load(\"glGetQueryiv\");\n\tglad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load(\"glGetQueryObjectiv\");\n\tglad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load(\"glGetQueryObjectuiv\");\n\tglad_glBindBuffer = (PFNGLBINDBUFFERPROC)load(\"glBindBuffer\");\n\tglad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load(\"glDeleteBuffers\");\n\tglad_glGenBuffers = (PFNGLGENBUFFERSPROC)load(\"glGenBuffers\");\n\tglad_glIsBuffer = (PFNGLISBUFFERPROC)load(\"glIsBuffer\");\n\tglad_glBufferData = (PFNGLBUFFERDATAPROC)load(\"glBufferData\");\n\tglad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load(\"glBufferSubData\");\n\tglad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load(\"glGetBufferSubData\");\n\tglad_glMapBuffer = (PFNGLMAPBUFFERPROC)load(\"glMapBuffer\");\n\tglad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load(\"glUnmapBuffer\");\n\tglad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load(\"glGetBufferParameteriv\");\n\tglad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load(\"glGetBufferPointerv\");\n}\nstatic void load_GL_VERSION_2_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_2_0) return;\n\tglad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load(\"glBlendEquationSeparate\");\n\tglad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load(\"glDrawBuffers\");\n\tglad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load(\"glStencilOpSeparate\");\n\tglad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load(\"glStencilFuncSeparate\");\n\tglad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load(\"glStencilMaskSeparate\");\n\tglad_glAttachShader = (PFNGLATTACHSHADERPROC)load(\"glAttachShader\");\n\tglad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load(\"glBindAttribLocation\");\n\tglad_glCompileShader = (PFNGLCOMPILESHADERPROC)load(\"glCompileShader\");\n\tglad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load(\"glCreateProgram\");\n\tglad_glCreateShader = (PFNGLCREATESHADERPROC)load(\"glCreateShader\");\n\tglad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load(\"glDeleteProgram\");\n\tglad_glDeleteShader = (PFNGLDELETESHADERPROC)load(\"glDeleteShader\");\n\tglad_glDetachShader = (PFNGLDETACHSHADERPROC)load(\"glDetachShader\");\n\tglad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load(\"glDisableVertexAttribArray\");\n\tglad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load(\"glEnableVertexAttribArray\");\n\tglad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load(\"glGetActiveAttrib\");\n\tglad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load(\"glGetActiveUniform\");\n\tglad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load(\"glGetAttachedShaders\");\n\tglad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load(\"glGetAttribLocation\");\n\tglad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load(\"glGetProgramiv\");\n\tglad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load(\"glGetProgramInfoLog\");\n\tglad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load(\"glGetShaderiv\");\n\tglad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load(\"glGetShaderInfoLog\");\n\tglad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load(\"glGetShaderSource\");\n\tglad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load(\"glGetUniformLocation\");\n\tglad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load(\"glGetUniformfv\");\n\tglad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load(\"glGetUniformiv\");\n\tglad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load(\"glGetVertexAttribdv\");\n\tglad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load(\"glGetVertexAttribfv\");\n\tglad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load(\"glGetVertexAttribiv\");\n\tglad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load(\"glGetVertexAttribPointerv\");\n\tglad_glIsProgram = (PFNGLISPROGRAMPROC)load(\"glIsProgram\");\n\tglad_glIsShader = (PFNGLISSHADERPROC)load(\"glIsShader\");\n\tglad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load(\"glLinkProgram\");\n\tglad_glShaderSource = (PFNGLSHADERSOURCEPROC)load(\"glShaderSource\");\n\tglad_glUseProgram = (PFNGLUSEPROGRAMPROC)load(\"glUseProgram\");\n\tglad_glUniform1f = (PFNGLUNIFORM1FPROC)load(\"glUniform1f\");\n\tglad_glUniform2f = (PFNGLUNIFORM2FPROC)load(\"glUniform2f\");\n\tglad_glUniform3f = (PFNGLUNIFORM3FPROC)load(\"glUniform3f\");\n\tglad_glUniform4f = (PFNGLUNIFORM4FPROC)load(\"glUniform4f\");\n\tglad_glUniform1i = (PFNGLUNIFORM1IPROC)load(\"glUniform1i\");\n\tglad_glUniform2i = (PFNGLUNIFORM2IPROC)load(\"glUniform2i\");\n\tglad_glUniform3i = (PFNGLUNIFORM3IPROC)load(\"glUniform3i\");\n\tglad_glUniform4i = (PFNGLUNIFORM4IPROC)load(\"glUniform4i\");\n\tglad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load(\"glUniform1fv\");\n\tglad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load(\"glUniform2fv\");\n\tglad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load(\"glUniform3fv\");\n\tglad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load(\"glUniform4fv\");\n\tglad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load(\"glUniform1iv\");\n\tglad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load(\"glUniform2iv\");\n\tglad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load(\"glUniform3iv\");\n\tglad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load(\"glUniform4iv\");\n\tglad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load(\"glUniformMatrix2fv\");\n\tglad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load(\"glUniformMatrix3fv\");\n\tglad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load(\"glUniformMatrix4fv\");\n\tglad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load(\"glValidateProgram\");\n\tglad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load(\"glVertexAttrib1d\");\n\tglad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load(\"glVertexAttrib1dv\");\n\tglad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load(\"glVertexAttrib1f\");\n\tglad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load(\"glVertexAttrib1fv\");\n\tglad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load(\"glVertexAttrib1s\");\n\tglad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load(\"glVertexAttrib1sv\");\n\tglad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load(\"glVertexAttrib2d\");\n\tglad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load(\"glVertexAttrib2dv\");\n\tglad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load(\"glVertexAttrib2f\");\n\tglad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load(\"glVertexAttrib2fv\");\n\tglad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load(\"glVertexAttrib2s\");\n\tglad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load(\"glVertexAttrib2sv\");\n\tglad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load(\"glVertexAttrib3d\");\n\tglad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load(\"glVertexAttrib3dv\");\n\tglad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load(\"glVertexAttrib3f\");\n\tglad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load(\"glVertexAttrib3fv\");\n\tglad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load(\"glVertexAttrib3s\");\n\tglad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load(\"glVertexAttrib3sv\");\n\tglad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load(\"glVertexAttrib4Nbv\");\n\tglad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load(\"glVertexAttrib4Niv\");\n\tglad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load(\"glVertexAttrib4Nsv\");\n\tglad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load(\"glVertexAttrib4Nub\");\n\tglad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load(\"glVertexAttrib4Nubv\");\n\tglad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load(\"glVertexAttrib4Nuiv\");\n\tglad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load(\"glVertexAttrib4Nusv\");\n\tglad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load(\"glVertexAttrib4bv\");\n\tglad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load(\"glVertexAttrib4d\");\n\tglad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load(\"glVertexAttrib4dv\");\n\tglad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load(\"glVertexAttrib4f\");\n\tglad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load(\"glVertexAttrib4fv\");\n\tglad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load(\"glVertexAttrib4iv\");\n\tglad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load(\"glVertexAttrib4s\");\n\tglad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load(\"glVertexAttrib4sv\");\n\tglad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load(\"glVertexAttrib4ubv\");\n\tglad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load(\"glVertexAttrib4uiv\");\n\tglad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load(\"glVertexAttrib4usv\");\n\tglad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load(\"glVertexAttribPointer\");\n}\nstatic void load_GL_VERSION_2_1(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_2_1) return;\n\tglad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load(\"glUniformMatrix2x3fv\");\n\tglad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load(\"glUniformMatrix3x2fv\");\n\tglad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load(\"glUniformMatrix2x4fv\");\n\tglad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load(\"glUniformMatrix4x2fv\");\n\tglad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load(\"glUniformMatrix3x4fv\");\n\tglad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load(\"glUniformMatrix4x3fv\");\n}\nstatic void load_GL_VERSION_3_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_3_0) return;\n\tglad_glColorMaski = (PFNGLCOLORMASKIPROC)load(\"glColorMaski\");\n\tglad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load(\"glGetBooleani_v\");\n\tglad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load(\"glGetIntegeri_v\");\n\tglad_glEnablei = (PFNGLENABLEIPROC)load(\"glEnablei\");\n\tglad_glDisablei = (PFNGLDISABLEIPROC)load(\"glDisablei\");\n\tglad_glIsEnabledi = (PFNGLISENABLEDIPROC)load(\"glIsEnabledi\");\n\tglad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load(\"glBeginTransformFeedback\");\n\tglad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load(\"glEndTransformFeedback\");\n\tglad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load(\"glBindBufferRange\");\n\tglad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load(\"glBindBufferBase\");\n\tglad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load(\"glTransformFeedbackVaryings\");\n\tglad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load(\"glGetTransformFeedbackVarying\");\n\tglad_glClampColor = (PFNGLCLAMPCOLORPROC)load(\"glClampColor\");\n\tglad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load(\"glBeginConditionalRender\");\n\tglad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load(\"glEndConditionalRender\");\n\tglad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load(\"glVertexAttribIPointer\");\n\tglad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load(\"glGetVertexAttribIiv\");\n\tglad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load(\"glGetVertexAttribIuiv\");\n\tglad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load(\"glVertexAttribI1i\");\n\tglad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load(\"glVertexAttribI2i\");\n\tglad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load(\"glVertexAttribI3i\");\n\tglad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load(\"glVertexAttribI4i\");\n\tglad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load(\"glVertexAttribI1ui\");\n\tglad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load(\"glVertexAttribI2ui\");\n\tglad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load(\"glVertexAttribI3ui\");\n\tglad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load(\"glVertexAttribI4ui\");\n\tglad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load(\"glVertexAttribI1iv\");\n\tglad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load(\"glVertexAttribI2iv\");\n\tglad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load(\"glVertexAttribI3iv\");\n\tglad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load(\"glVertexAttribI4iv\");\n\tglad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load(\"glVertexAttribI1uiv\");\n\tglad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load(\"glVertexAttribI2uiv\");\n\tglad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load(\"glVertexAttribI3uiv\");\n\tglad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load(\"glVertexAttribI4uiv\");\n\tglad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load(\"glVertexAttribI4bv\");\n\tglad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load(\"glVertexAttribI4sv\");\n\tglad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load(\"glVertexAttribI4ubv\");\n\tglad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load(\"glVertexAttribI4usv\");\n\tglad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load(\"glGetUniformuiv\");\n\tglad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load(\"glBindFragDataLocation\");\n\tglad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load(\"glGetFragDataLocation\");\n\tglad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load(\"glUniform1ui\");\n\tglad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load(\"glUniform2ui\");\n\tglad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load(\"glUniform3ui\");\n\tglad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load(\"glUniform4ui\");\n\tglad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load(\"glUniform1uiv\");\n\tglad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load(\"glUniform2uiv\");\n\tglad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load(\"glUniform3uiv\");\n\tglad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load(\"glUniform4uiv\");\n\tglad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load(\"glTexParameterIiv\");\n\tglad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load(\"glTexParameterIuiv\");\n\tglad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load(\"glGetTexParameterIiv\");\n\tglad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load(\"glGetTexParameterIuiv\");\n\tglad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load(\"glClearBufferiv\");\n\tglad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load(\"glClearBufferuiv\");\n\tglad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load(\"glClearBufferfv\");\n\tglad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load(\"glClearBufferfi\");\n\tglad_glGetStringi = (PFNGLGETSTRINGIPROC)load(\"glGetStringi\");\n\tglad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load(\"glIsRenderbuffer\");\n\tglad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load(\"glBindRenderbuffer\");\n\tglad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load(\"glDeleteRenderbuffers\");\n\tglad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load(\"glGenRenderbuffers\");\n\tglad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load(\"glRenderbufferStorage\");\n\tglad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load(\"glGetRenderbufferParameteriv\");\n\tglad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load(\"glIsFramebuffer\");\n\tglad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load(\"glBindFramebuffer\");\n\tglad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load(\"glDeleteFramebuffers\");\n\tglad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load(\"glGenFramebuffers\");\n\tglad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load(\"glCheckFramebufferStatus\");\n\tglad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load(\"glFramebufferTexture1D\");\n\tglad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load(\"glFramebufferTexture2D\");\n\tglad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load(\"glFramebufferTexture3D\");\n\tglad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load(\"glFramebufferRenderbuffer\");\n\tglad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load(\"glGetFramebufferAttachmentParameteriv\");\n\tglad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load(\"glGenerateMipmap\");\n\tglad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load(\"glBlitFramebuffer\");\n\tglad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load(\"glRenderbufferStorageMultisample\");\n\tglad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load(\"glFramebufferTextureLayer\");\n\tglad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load(\"glMapBufferRange\");\n\tglad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load(\"glFlushMappedBufferRange\");\n\tglad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load(\"glBindVertexArray\");\n\tglad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load(\"glDeleteVertexArrays\");\n\tglad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load(\"glGenVertexArrays\");\n\tglad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load(\"glIsVertexArray\");\n}\nstatic void load_GL_VERSION_3_1(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_3_1) return;\n\tglad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load(\"glDrawArraysInstanced\");\n\tglad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load(\"glDrawElementsInstanced\");\n\tglad_glTexBuffer = (PFNGLTEXBUFFERPROC)load(\"glTexBuffer\");\n\tglad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load(\"glPrimitiveRestartIndex\");\n\tglad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load(\"glCopyBufferSubData\");\n\tglad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load(\"glGetUniformIndices\");\n\tglad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load(\"glGetActiveUniformsiv\");\n\tglad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load(\"glGetActiveUniformName\");\n\tglad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load(\"glGetUniformBlockIndex\");\n\tglad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load(\"glGetActiveUniformBlockiv\");\n\tglad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load(\"glGetActiveUniformBlockName\");\n\tglad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load(\"glUniformBlockBinding\");\n\tglad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load(\"glBindBufferRange\");\n\tglad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load(\"glBindBufferBase\");\n\tglad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load(\"glGetIntegeri_v\");\n}\nstatic void load_GL_VERSION_3_2(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_3_2) return;\n\tglad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load(\"glDrawElementsBaseVertex\");\n\tglad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load(\"glDrawRangeElementsBaseVertex\");\n\tglad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load(\"glDrawElementsInstancedBaseVertex\");\n\tglad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load(\"glMultiDrawElementsBaseVertex\");\n\tglad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load(\"glProvokingVertex\");\n\tglad_glFenceSync = (PFNGLFENCESYNCPROC)load(\"glFenceSync\");\n\tglad_glIsSync = (PFNGLISSYNCPROC)load(\"glIsSync\");\n\tglad_glDeleteSync = (PFNGLDELETESYNCPROC)load(\"glDeleteSync\");\n\tglad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load(\"glClientWaitSync\");\n\tglad_glWaitSync = (PFNGLWAITSYNCPROC)load(\"glWaitSync\");\n\tglad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load(\"glGetInteger64v\");\n\tglad_glGetSynciv = (PFNGLGETSYNCIVPROC)load(\"glGetSynciv\");\n\tglad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load(\"glGetInteger64i_v\");\n\tglad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load(\"glGetBufferParameteri64v\");\n\tglad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load(\"glFramebufferTexture\");\n\tglad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load(\"glTexImage2DMultisample\");\n\tglad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load(\"glTexImage3DMultisample\");\n\tglad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load(\"glGetMultisamplefv\");\n\tglad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load(\"glSampleMaski\");\n}\nstatic void load_GL_VERSION_3_3(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_3_3) return;\n\tglad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)load(\"glBindFragDataLocationIndexed\");\n\tglad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)load(\"glGetFragDataIndex\");\n\tglad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load(\"glGenSamplers\");\n\tglad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)load(\"glDeleteSamplers\");\n\tglad_glIsSampler = (PFNGLISSAMPLERPROC)load(\"glIsSampler\");\n\tglad_glBindSampler = (PFNGLBINDSAMPLERPROC)load(\"glBindSampler\");\n\tglad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)load(\"glSamplerParameteri\");\n\tglad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)load(\"glSamplerParameteriv\");\n\tglad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)load(\"glSamplerParameterf\");\n\tglad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)load(\"glSamplerParameterfv\");\n\tglad_glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)load(\"glSamplerParameterIiv\");\n\tglad_glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)load(\"glSamplerParameterIuiv\");\n\tglad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)load(\"glGetSamplerParameteriv\");\n\tglad_glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)load(\"glGetSamplerParameterIiv\");\n\tglad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)load(\"glGetSamplerParameterfv\");\n\tglad_glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)load(\"glGetSamplerParameterIuiv\");\n\tglad_glQueryCounter = (PFNGLQUERYCOUNTERPROC)load(\"glQueryCounter\");\n\tglad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)load(\"glGetQueryObjecti64v\");\n\tglad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)load(\"glGetQueryObjectui64v\");\n\tglad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)load(\"glVertexAttribDivisor\");\n\tglad_glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)load(\"glVertexAttribP1ui\");\n\tglad_glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)load(\"glVertexAttribP1uiv\");\n\tglad_glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)load(\"glVertexAttribP2ui\");\n\tglad_glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)load(\"glVertexAttribP2uiv\");\n\tglad_glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)load(\"glVertexAttribP3ui\");\n\tglad_glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)load(\"glVertexAttribP3uiv\");\n\tglad_glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)load(\"glVertexAttribP4ui\");\n\tglad_glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)load(\"glVertexAttribP4uiv\");\n\tglad_glVertexP2ui = (PFNGLVERTEXP2UIPROC)load(\"glVertexP2ui\");\n\tglad_glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)load(\"glVertexP2uiv\");\n\tglad_glVertexP3ui = (PFNGLVERTEXP3UIPROC)load(\"glVertexP3ui\");\n\tglad_glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)load(\"glVertexP3uiv\");\n\tglad_glVertexP4ui = (PFNGLVERTEXP4UIPROC)load(\"glVertexP4ui\");\n\tglad_glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)load(\"glVertexP4uiv\");\n\tglad_glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)load(\"glTexCoordP1ui\");\n\tglad_glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)load(\"glTexCoordP1uiv\");\n\tglad_glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)load(\"glTexCoordP2ui\");\n\tglad_glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)load(\"glTexCoordP2uiv\");\n\tglad_glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)load(\"glTexCoordP3ui\");\n\tglad_glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)load(\"glTexCoordP3uiv\");\n\tglad_glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)load(\"glTexCoordP4ui\");\n\tglad_glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)load("}, {"path": "src/7.in_practice/3.2d_game/0.full_source/particle.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nin vec2 TexCoords;\nin vec4 ParticleColor;\nout vec4 color;\n\nuniform sampler2D sprite;\n\nvoid main()\n{\n color = (texture(sprite, TexCoords) * ParticleColor);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/particle.vs", "language": "glsl", "loc": 14, "comment_density": 0.071, "code": "#version 330 core\nlayout (location = 0) in vec4 vertex; // \n\nout vec2 TexCoords;\nout vec4 ParticleColor;\n\nuniform mat4 projection;\nuniform vec2 offset;\nuniform vec4 color;\n\nvoid main()\n{\n float scale = 10.0f;\n TexCoords = vertex.zw;\n ParticleColor = color;\n gl_Position = projection * vec4((vertex.xy * scale) + offset, 0.0, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/particle_generator.cpp", "language": "code", "loc": 112, "comment_density": 0.205, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"particle_generator.h\"\n\nParticleGenerator::ParticleGenerator(Shader shader, Texture2D texture, unsigned int amount)\n : shader(shader), texture(texture), amount(amount)\n{\n this->init();\n}\n\nvoid ParticleGenerator::Update(float dt, GameObject &object, unsigned int newParticles, glm::vec2 offset)\n{\n // add new particles \n for (unsigned int i = 0; i < newParticles; ++i)\n {\n int unusedParticle = this->firstUnusedParticle();\n this->respawnParticle(this->particles[unusedParticle], object, offset);\n }\n // update all particles\n for (unsigned int i = 0; i < this->amount; ++i)\n {\n Particle &p = this->particles[i];\n p.Life -= dt; // reduce life\n if (p.Life > 0.0f)\n {\t// particle is alive, thus update\n p.Position -= p.Velocity * dt; \n p.Color.a -= dt * 2.5f;\n }\n }\n}\n\n// render all particles\nvoid ParticleGenerator::Draw()\n{\n // use additive blending to give it a 'glow' effect\n glBlendFunc(GL_SRC_ALPHA, GL_ONE);\n this->shader.Use();\n for (Particle particle : this->particles)\n {\n if (particle.Life > 0.0f)\n {\n this->shader.SetVector2f(\"offset\", particle.Position);\n this->shader.SetVector4f(\"color\", particle.Color);\n this->texture.Bind();\n glBindVertexArray(this->VAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n }\n }\n // don't forget to reset to default blending mode\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n}\n\nvoid ParticleGenerator::init()\n{\n // set up mesh and attribute properties\n unsigned int VBO;\n float particle_quad[] = {\n 0.0f, 1.0f, 0.0f, 1.0f,\n 1.0f, 0.0f, 1.0f, 0.0f,\n 0.0f, 0.0f, 0.0f, 0.0f,\n\n 0.0f, 1.0f, 0.0f, 1.0f,\n 1.0f, 1.0f, 1.0f, 1.0f,\n 1.0f, 0.0f, 1.0f, 0.0f\n }; \n glGenVertexArrays(1, &this->VAO);\n glGenBuffers(1, &VBO);\n glBindVertexArray(this->VAO);\n // fill mesh buffer\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(particle_quad), particle_quad, GL_STATIC_DRAW);\n // set mesh attributes\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glBindVertexArray(0);\n\n // create this->amount default particle instances\n for (unsigned int i = 0; i < this->amount; ++i)\n this->particles.push_back(Particle());\n}\n\n// stores the index of the last particle used (for quick access to next dead particle)\nunsigned int lastUsedParticle = 0;\nunsigned int ParticleGenerator::firstUnusedParticle()\n{\n // first search from last used particle, this will usually return almost instantly\n for (unsigned int i = lastUsedParticle; i < this->amount; ++i){\n if (this->particles[i].Life <= 0.0f){\n lastUsedParticle = i;\n return i;\n }\n }\n // otherwise, do a linear search\n for (unsigned int i = 0; i < lastUsedParticle; ++i){\n if (this->particles[i].Life <= 0.0f){\n lastUsedParticle = i;\n return i;\n }\n }\n // all particles are taken, override the first one (note that if it repeatedly hits this case, more particles should be reserved)\n lastUsedParticle = 0;\n return 0;\n}\n\nvoid ParticleGenerator::respawnParticle(Particle &particle, GameObject &object, glm::vec2 offset)\n{\n float random = ((rand() % 100) - 50) / 10.0f;\n float rColor = 0.5f + ((rand() % 100) / 100.0f);\n particle.Position = object.Position + random + offset;\n particle.Color = glm::vec4(rColor, rColor, rColor, 1.0f);\n particle.Life = 1.0f;\n particle.Velocity = object.Velocity * 0.1f;\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/particle_generator.h", "language": "code", "loc": 51, "comment_density": 0.392, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef PARTICLE_GENERATOR_H\n#define PARTICLE_GENERATOR_H\n#include \n\n#include \n#include \n\n#include \"shader.h\"\n#include \"texture.h\"\n#include \"game_object.h\"\n\n\n// Represents a single particle and its state\nstruct Particle {\n glm::vec2 Position, Velocity;\n glm::vec4 Color;\n float Life;\n\n Particle() : Position(0.0f), Velocity(0.0f), Color(1.0f), Life(0.0f) { }\n};\n\n\n// ParticleGenerator acts as a container for rendering a large number of \n// particles by repeatedly spawning and updating particles and killing \n// them after a given amount of time.\nclass ParticleGenerator\n{\npublic:\n // constructor\n ParticleGenerator(Shader shader, Texture2D texture, unsigned int amount);\n // update all particles\n void Update(float dt, GameObject &object, unsigned int newParticles, glm::vec2 offset = glm::vec2(0.0f, 0.0f));\n // render all particles\n void Draw();\nprivate:\n // state\n std::vector particles;\n unsigned int amount;\n // render state\n Shader shader;\n Texture2D texture;\n unsigned int VAO;\n // initializes buffer and vertex attributes\n void init();\n // returns the first Particle index that's currently unused e.g. Life <= 0.0f or 0 if no particle is currently inactive\n unsigned int firstUnusedParticle();\n // respawns particle\n void respawnParticle(Particle &particle, GameObject &object, glm::vec2 offset = glm::vec2(0.0f, 0.0f));\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/post_processing.fs", "language": "glsl", "loc": 41, "comment_density": 0.073, "code": "#version 330 core\nin vec2 TexCoords;\nout vec4 color;\n\nuniform sampler2D scene;\nuniform vec2 offsets[9];\nuniform int edge_kernel[9];\nuniform float blur_kernel[9];\n\nuniform bool chaos;\nuniform bool confuse;\nuniform bool shake;\n\nvoid main()\n{\n // zero out memory since an out variable is initialized with undefined values by default \n color = vec4(0.0f);\n\n vec3 sample[9];\n // sample from texture offsets if using convolution matrix\n if(chaos || shake)\n for(int i = 0; i < 9; i++)\n sample[i] = vec3(texture(scene, TexCoords.st + offsets[i]));\n\n // process effects\n if(chaos)\n { \n for(int i = 0; i < 9; i++)\n color += vec4(sample[i] * edge_kernel[i], 0.0f);\n color.a = 1.0f;\n }\n else if(confuse)\n {\n color = vec4(1.0 - texture(scene, TexCoords).rgb, 1.0);\n }\n else if(shake)\n {\n for(int i = 0; i < 9; i++)\n color += vec4(sample[i] * blur_kernel[i], 0.0f);\n color.a = 1.0f;\n }\n else\n {\n color = texture(scene, TexCoords);\n }\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/post_processing.vs", "language": "glsl", "loc": 32, "comment_density": 0.031, "code": "#version 330 core\nlayout (location = 0) in vec4 vertex; // \n\nout vec2 TexCoords;\n\nuniform bool chaos;\nuniform bool confuse;\nuniform bool shake;\nuniform float time;\n\nvoid main()\n{\n gl_Position = vec4(vertex.xy, 0.0f, 1.0f); \n vec2 texture = vertex.zw;\n if(chaos)\n {\n float strength = 0.3;\n vec2 pos = vec2(texture.x + sin(time) * strength, texture.y + cos(time) * strength); \n TexCoords = pos;\n }\n else if(confuse)\n {\n TexCoords = vec2(1.0 - texture.x, 1.0 - texture.y);\n }\n else\n {\n TexCoords = texture;\n }\n if (shake)\n {\n float strength = 0.01;\n gl_Position.x += cos(time * 10) * strength; \n gl_Position.y += cos(time * 15) * strength; \n }\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/post_processor.cpp", "language": "code", "loc": 112, "comment_density": 0.268, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"post_processor.h\"\n\n#include \n\nPostProcessor::PostProcessor(Shader shader, unsigned int width, unsigned int height) \n : PostProcessingShader(shader), Texture(), Width(width), Height(height), Confuse(false), Chaos(false), Shake(false)\n{\n // initialize renderbuffer/framebuffer object\n glGenFramebuffers(1, &this->MSFBO);\n glGenFramebuffers(1, &this->FBO);\n glGenRenderbuffers(1, &this->RBO);\n // initialize renderbuffer storage with a multisampled color buffer (don't need a depth/stencil buffer)\n glBindFramebuffer(GL_FRAMEBUFFER, this->MSFBO);\n glBindRenderbuffer(GL_RENDERBUFFER, this->RBO);\n glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGB, width, height); // allocate storage for render buffer object\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, this->RBO); // attach MS render buffer object to framebuffer\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"ERROR::POSTPROCESSOR: Failed to initialize MSFBO\" << std::endl;\n // also initialize the FBO/texture to blit multisampled color-buffer to; used for shader operations (for postprocessing effects)\n glBindFramebuffer(GL_FRAMEBUFFER, this->FBO);\n this->Texture.Generate(width, height, NULL);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, this->Texture.ID, 0); // attach texture to framebuffer as its color attachment\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"ERROR::POSTPROCESSOR: Failed to initialize FBO\" << std::endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n // initialize render data and uniforms\n this->initRenderData();\n this->PostProcessingShader.SetInteger(\"scene\", 0, true);\n float offset = 1.0f / 300.0f;\n float offsets[9][2] = {\n { -offset, offset }, // top-left\n { 0.0f, offset }, // top-center\n { offset, offset }, // top-right\n { -offset, 0.0f }, // center-left\n { 0.0f, 0.0f }, // center-center\n { offset, 0.0f }, // center - right\n { -offset, -offset }, // bottom-left\n { 0.0f, -offset }, // bottom-center\n { offset, -offset } // bottom-right \n };\n glUniform2fv(glGetUniformLocation(this->PostProcessingShader.ID, \"offsets\"), 9, (float*)offsets);\n int edge_kernel[9] = {\n -1, -1, -1,\n -1, 8, -1,\n -1, -1, -1\n };\n glUniform1iv(glGetUniformLocation(this->PostProcessingShader.ID, \"edge_kernel\"), 9, edge_kernel);\n float blur_kernel[9] = {\n 1.0f / 16.0f, 2.0f / 16.0f, 1.0f / 16.0f,\n 2.0f / 16.0f, 4.0f / 16.0f, 2.0f / 16.0f,\n 1.0f / 16.0f, 2.0f / 16.0f, 1.0f / 16.0f\n };\n glUniform1fv(glGetUniformLocation(this->PostProcessingShader.ID, \"blur_kernel\"), 9, blur_kernel); \n}\n\nvoid PostProcessor::BeginRender()\n{\n glBindFramebuffer(GL_FRAMEBUFFER, this->MSFBO);\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n}\nvoid PostProcessor::EndRender()\n{\n // now resolve multisampled color-buffer into intermediate FBO to store to texture\n glBindFramebuffer(GL_READ_FRAMEBUFFER, this->MSFBO);\n glBindFramebuffer(GL_DRAW_FRAMEBUFFER, this->FBO);\n glBlitFramebuffer(0, 0, this->Width, this->Height, 0, 0, this->Width, this->Height, GL_COLOR_BUFFER_BIT, GL_NEAREST);\n glBindFramebuffer(GL_FRAMEBUFFER, 0); // binds both READ and WRITE framebuffer to default framebuffer\n}\n\nvoid PostProcessor::Render(float time)\n{\n // set uniforms/options\n this->PostProcessingShader.Use();\n this->PostProcessingShader.SetFloat(\"time\", time);\n this->PostProcessingShader.SetInteger(\"confuse\", this->Confuse);\n this->PostProcessingShader.SetInteger(\"chaos\", this->Chaos);\n this->PostProcessingShader.SetInteger(\"shake\", this->Shake);\n // render textured quad\n glActiveTexture(GL_TEXTURE0);\n this->Texture.Bind();\t\n glBindVertexArray(this->VAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n}\n\nvoid PostProcessor::initRenderData()\n{\n // configure VAO/VBO\n unsigned int VBO;\n float vertices[] = {\n // pos // tex\n -1.0f, -1.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, 0.0f, 1.0f,\n\n -1.0f, -1.0f, 0.0f, 0.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n 1.0f, 1.0f, 1.0f, 1.0f\n };\n glGenVertexArrays(1, &this->VAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(this->VAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/post_processor.h", "language": "code", "loc": 47, "comment_density": 0.511, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef POST_PROCESSOR_H\n#define POST_PROCESSOR_H\n\n#include \n#include \n\n#include \"texture.h\"\n#include \"sprite_renderer.h\"\n#include \"shader.h\"\n\n\n// PostProcessor hosts all PostProcessing effects for the Breakout\n// Game. It renders the game on a textured quad after which one can\n// enable specific effects by enabling either the Confuse, Chaos or \n// Shake boolean. \n// It is required to call BeginRender() before rendering the game\n// and EndRender() after rendering the game for the class to work.\nclass PostProcessor\n{\npublic:\n // state\n Shader PostProcessingShader;\n Texture2D Texture;\n unsigned int Width, Height;\n // options\n bool Confuse, Chaos, Shake;\n // constructor\n PostProcessor(Shader shader, unsigned int width, unsigned int height);\n // prepares the postprocessor's framebuffer operations before rendering the game\n void BeginRender();\n // should be called after rendering the game, so it stores all the rendered data into a texture object\n void EndRender();\n // renders the PostProcessor texture quad (as a screen-encompassing large sprite)\n void Render(float time);\nprivate:\n // render state\n unsigned int MSFBO, FBO; // MSFBO = Multisampled FBO. FBO is regular, used for blitting MS color-buffer to texture\n unsigned int RBO; // RBO is used for multisampled color buffer\n unsigned int VAO;\n // initialize quad for rendering postprocessing texture\n void initRenderData();\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/power_up.h", "language": "code", "loc": 34, "comment_density": 0.471, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef POWER_UP_H\n#define POWER_UP_H\n#include \n\n#include \n#include \n\n#include \"game_object.h\"\n\n\n// The size of a PowerUp block\nconst glm::vec2 POWERUP_SIZE(60.0f, 20.0f);\n// Velocity a PowerUp block has when spawned\nconst glm::vec2 VELOCITY(0.0f, 150.0f);\n\n\n// PowerUp inherits its state and rendering functions from\n// GameObject but also holds extra information to state its\n// active duration and whether it is activated or not. \n// The type of PowerUp is stored as a string.\nclass PowerUp : public GameObject \n{\npublic:\n // powerup state\n std::string Type;\n float Duration;\t\n bool Activated;\n // constructor\n PowerUp(std::string type, glm::vec3 color, float duration, glm::vec2 position, Texture2D texture) \n : GameObject(position, POWERUP_SIZE, texture, color, VELOCITY), Type(type), Duration(duration), Activated() { }\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/program.cpp", "language": "code", "loc": 103, "comment_density": 0.311, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \n#include \n\n#include \"game.h\"\n#include \"resource_manager.h\"\n\n#include \n\n// GLFW function declarations\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);\n\n// The Width of the screen\nconst unsigned int SCREEN_WIDTH = 800;\n// The height of the screen\nconst unsigned int SCREEN_HEIGHT = 600;\n\nGame Breakout(SCREEN_WIDTH, SCREEN_HEIGHT);\n\nint main(int argc, char *argv[])\n{\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n glfwWindowHint(GLFW_RESIZABLE, false);\n\n GLFWwindow* window = glfwCreateWindow(SCREEN_WIDTH, SCREEN_HEIGHT, \"Breakout\", nullptr, nullptr);\n glfwMakeContextCurrent(window);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n glfwSetKeyCallback(window, key_callback);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // OpenGL configuration\n // --------------------\n glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n // initialize game\n // ---------------\n Breakout.Init();\n\n // deltaTime variables\n // -------------------\n float deltaTime = 0.0f;\n float lastFrame = 0.0f;\n\n while (!glfwWindowShouldClose(window))\n {\n // calculate delta time\n // --------------------\n float currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n glfwPollEvents();\n\n // manage user input\n // -----------------\n Breakout.ProcessInput(deltaTime);\n\n // update game state\n // -----------------\n Breakout.Update(deltaTime);\n\n // render\n // ------\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n Breakout.Render();\n\n glfwSwapBuffers(window);\n }\n\n // delete all resources as loaded using the resource manager\n // ---------------------------------------------------------\n ResourceManager::Clear();\n\n glfwTerminate();\n return 0;\n}\n\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)\n{\n // when a user presses the escape key, we set the WindowShouldClose property to true, closing the application\n if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n if (key >= 0 && key < 1024)\n {\n if (action == GLFW_PRESS)\n Breakout.Keys[key] = true;\n else if (action == GLFW_RELEASE)\n {\n Breakout.Keys[key] = false;\n Breakout.KeysProcessed[key] = false;\n }\n }\n}\n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/resource_manager.cpp", "language": "code", "loc": 104, "comment_density": 0.212, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"resource_manager.h\"\n\n#include \n#include \n#include \n\n#include \"stb_image.h\"\n\n// Instantiate static variables\nstd::map ResourceManager::Textures;\nstd::map ResourceManager::Shaders;\n\n\nShader ResourceManager::LoadShader(const char *vShaderFile, const char *fShaderFile, const char *gShaderFile, std::string name)\n{\n Shaders[name] = loadShaderFromFile(vShaderFile, fShaderFile, gShaderFile);\n return Shaders[name];\n}\n\nShader ResourceManager::GetShader(std::string name)\n{\n return Shaders[name];\n}\n\nTexture2D ResourceManager::LoadTexture(const char *file, bool alpha, std::string name)\n{\n Textures[name] = loadTextureFromFile(file, alpha);\n return Textures[name];\n}\n\nTexture2D ResourceManager::GetTexture(std::string name)\n{\n return Textures[name];\n}\n\nvoid ResourceManager::Clear()\n{\n // (properly) delete all shaders\t\n for (auto iter : Shaders)\n glDeleteProgram(iter.second.ID);\n // (properly) delete all textures\n for (auto iter : Textures)\n glDeleteTextures(1, &iter.second.ID);\n}\n\nShader ResourceManager::loadShaderFromFile(const char *vShaderFile, const char *fShaderFile, const char *gShaderFile)\n{\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::string geometryCode;\n try\n {\n // open files\n std::ifstream vertexShaderFile(vShaderFile);\n std::ifstream fragmentShaderFile(fShaderFile);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vertexShaderFile.rdbuf();\n fShaderStream << fragmentShaderFile.rdbuf();\n // close file handlers\n vertexShaderFile.close();\n fragmentShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\n // if geometry shader path is present, also load a geometry shader\n if (gShaderFile != nullptr)\n {\n std::ifstream geometryShaderFile(gShaderFile);\n std::stringstream gShaderStream;\n gShaderStream << geometryShaderFile.rdbuf();\n geometryShaderFile.close();\n geometryCode = gShaderStream.str();\n }\n }\n catch (std::exception e)\n {\n std::cout << \"ERROR::SHADER: Failed to read shader files\" << std::endl;\n }\n const char *vShaderCode = vertexCode.c_str();\n const char *fShaderCode = fragmentCode.c_str();\n const char *gShaderCode = geometryCode.c_str();\n // 2. now create shader object from source code\n Shader shader;\n shader.Compile(vShaderCode, fShaderCode, gShaderFile != nullptr ? gShaderCode : nullptr);\n return shader;\n}\n\nTexture2D ResourceManager::loadTextureFromFile(const char *file, bool alpha)\n{\n // create texture object\n Texture2D texture;\n if (alpha)\n {\n texture.Internal_Format = GL_RGBA;\n texture.Image_Format = GL_RGBA;\n }\n // load image\n int width, height, nrChannels;\n unsigned char* data = stbi_load(file, &width, &height, &nrChannels, 0);\n // now generate texture\n texture.Generate(width, height, data);\n // and finally free image data\n stbi_image_free(data);\n return texture;\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/resource_manager.h", "language": "code", "loc": 45, "comment_density": 0.489, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef RESOURCE_MANAGER_H\n#define RESOURCE_MANAGER_H\n\n#include \n#include \n\n#include \n\n#include \"texture.h\"\n#include \"shader.h\"\n\n\n// A static singleton ResourceManager class that hosts several\n// functions to load Textures and Shaders. Each loaded texture\n// and/or shader is also stored for future reference by string\n// handles. All functions and resources are static and no \n// public constructor is defined.\nclass ResourceManager\n{\npublic:\n // resource storage\n static std::map Shaders;\n static std::map Textures;\n // loads (and generates) a shader program from file loading vertex, fragment (and geometry) shader's source code. If gShaderFile is not nullptr, it also loads a geometry shader\n static Shader LoadShader(const char *vShaderFile, const char *fShaderFile, const char *gShaderFile, std::string name);\n // retrieves a stored sader\n static Shader GetShader(std::string name);\n // loads (and generates) a texture from file\n static Texture2D LoadTexture(const char *file, bool alpha, std::string name);\n // retrieves a stored texture\n static Texture2D GetTexture(std::string name);\n // properly de-allocates all loaded resources\n static void Clear();\nprivate:\n // private constructor, that is we do not want any actual resource manager objects. Its members and functions should be publicly available (static).\n ResourceManager() { }\n // loads and generates a shader from file\n static Shader loadShaderFromFile(const char *vShaderFile, const char *fShaderFile, const char *gShaderFile = nullptr);\n // loads a single texture from file\n static Texture2D loadTextureFromFile(const char *file, bool alpha);\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/shader.cpp", "language": "code", "loc": 131, "comment_density": 0.099, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"shader.h\"\n\n#include \n\nShader &Shader::Use()\n{\n glUseProgram(this->ID);\n return *this;\n}\n\nvoid Shader::Compile(const char* vertexSource, const char* fragmentSource, const char* geometrySource)\n{\n unsigned int sVertex, sFragment, gShader;\n // vertex Shader\n sVertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(sVertex, 1, &vertexSource, NULL);\n glCompileShader(sVertex);\n checkCompileErrors(sVertex, \"VERTEX\");\n // fragment Shader\n sFragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(sFragment, 1, &fragmentSource, NULL);\n glCompileShader(sFragment);\n checkCompileErrors(sFragment, \"FRAGMENT\");\n // if geometry shader source code is given, also compile geometry shader\n if (geometrySource != nullptr)\n {\n gShader = glCreateShader(GL_GEOMETRY_SHADER);\n glShaderSource(gShader, 1, &geometrySource, NULL);\n glCompileShader(gShader);\n checkCompileErrors(gShader, \"GEOMETRY\");\n }\n // shader program\n this->ID = glCreateProgram();\n glAttachShader(this->ID, sVertex);\n glAttachShader(this->ID, sFragment);\n if (geometrySource != nullptr)\n glAttachShader(this->ID, gShader);\n glLinkProgram(this->ID);\n checkCompileErrors(this->ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(sVertex);\n glDeleteShader(sFragment);\n if (geometrySource != nullptr)\n glDeleteShader(gShader);\n}\n\nvoid Shader::SetFloat(const char *name, float value, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniform1f(glGetUniformLocation(this->ID, name), value);\n}\nvoid Shader::SetInteger(const char *name, int value, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniform1i(glGetUniformLocation(this->ID, name), value);\n}\nvoid Shader::SetVector2f(const char *name, float x, float y, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniform2f(glGetUniformLocation(this->ID, name), x, y);\n}\nvoid Shader::SetVector2f(const char *name, const glm::vec2 &value, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniform2f(glGetUniformLocation(this->ID, name), value.x, value.y);\n}\nvoid Shader::SetVector3f(const char *name, float x, float y, float z, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniform3f(glGetUniformLocation(this->ID, name), x, y, z);\n}\nvoid Shader::SetVector3f(const char *name, const glm::vec3 &value, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniform3f(glGetUniformLocation(this->ID, name), value.x, value.y, value.z);\n}\nvoid Shader::SetVector4f(const char *name, float x, float y, float z, float w, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniform4f(glGetUniformLocation(this->ID, name), x, y, z, w);\n}\nvoid Shader::SetVector4f(const char *name, const glm::vec4 &value, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniform4f(glGetUniformLocation(this->ID, name), value.x, value.y, value.z, value.w);\n}\nvoid Shader::SetMatrix4(const char *name, const glm::mat4 &matrix, bool useShader)\n{\n if (useShader)\n this->Use();\n glUniformMatrix4fv(glGetUniformLocation(this->ID, name), 1, false, glm::value_ptr(matrix));\n}\n\n\nvoid Shader::checkCompileErrors(unsigned int object, std::string type)\n{\n int success;\n char infoLog[1024];\n if (type != \"PROGRAM\")\n {\n glGetShaderiv(object, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(object, 1024, NULL, infoLog);\n std::cout << \"| ERROR::SHADER: Compile-time error: Type: \" << type << \"\\n\"\n << infoLog << \"\\n -- --------------------------------------------------- -- \"\n << std::endl;\n }\n }\n else\n {\n glGetProgramiv(object, GL_LINK_STATUS, &success);\n if (!success)\n {\n glGetProgramInfoLog(object, 1024, NULL, infoLog);\n std::cout << \"| ERROR::Shader: Link-time error: Type: \" << type << \"\\n\"\n << infoLog << \"\\n -- --------------------------------------------------- -- \"\n << std::endl;\n }\n }\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/shader.h", "language": "code", "loc": 43, "comment_density": 0.419, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef SHADER_H\n#define SHADER_H\n\n#include \n\n#include \n#include \n#include \n\n\n// General purpose shader object. Compiles from file, generates\n// compile/link-time error messages and hosts several utility \n// functions for easy management.\nclass Shader\n{\npublic:\n // state\n unsigned int ID; \n // constructor\n Shader() { }\n // sets the current shader as active\n Shader &Use();\n // compiles the shader from given source code\n void Compile(const char *vertexSource, const char *fragmentSource, const char *geometrySource = nullptr); // note: geometry source code is optional \n // utility functions\n void SetFloat (const char *name, float value, bool useShader = false);\n void SetInteger (const char *name, int value, bool useShader = false);\n void SetVector2f (const char *name, float x, float y, bool useShader = false);\n void SetVector2f (const char *name, const glm::vec2 &value, bool useShader = false);\n void SetVector3f (const char *name, float x, float y, float z, bool useShader = false);\n void SetVector3f (const char *name, const glm::vec3 &value, bool useShader = false);\n void SetVector4f (const char *name, float x, float y, float z, float w, bool useShader = false);\n void SetVector4f (const char *name, const glm::vec4 &value, bool useShader = false);\n void SetMatrix4 (const char *name, const glm::mat4 &matrix, bool useShader = false);\nprivate:\n // checks if compilation or linking failed and if so, print the error logs\n void checkCompileErrors(unsigned int object, std::string type); \n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/sprite.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nin vec2 TexCoords;\nout vec4 color;\n\nuniform sampler2D sprite;\nuniform vec3 spriteColor;\n\nvoid main()\n{\n \n color = vec4(spriteColor, 1.0) * texture(sprite, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/sprite.vs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nlayout (location = 0) in vec4 vertex; // \n\nout vec2 TexCoords;\n\nuniform mat4 model;\n// note that we're omitting the view matrix; the view never changes so we basically have an identity view matrix and can therefore omit it.\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = vertex.zw;\n gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/sprite_renderer.cpp", "language": "code", "loc": 60, "comment_density": 0.283, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"sprite_renderer.h\"\n\n\nSpriteRenderer::SpriteRenderer(Shader &shader)\n{\n this->shader = shader;\n this->initRenderData();\n}\n\nSpriteRenderer::~SpriteRenderer()\n{\n glDeleteVertexArrays(1, &this->quadVAO);\n}\n\nvoid SpriteRenderer::DrawSprite(Texture2D &texture, glm::vec2 position, glm::vec2 size, float rotate, glm::vec3 color)\n{\n // prepare transformations\n this->shader.Use();\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(position, 0.0f)); // first translate (transformations are: scale happens first, then rotation, and then final translation happens; reversed order)\n\n model = glm::translate(model, glm::vec3(0.5f * size.x, 0.5f * size.y, 0.0f)); // move origin of rotation to center of quad\n model = glm::rotate(model, glm::radians(rotate), glm::vec3(0.0f, 0.0f, 1.0f)); // then rotate\n model = glm::translate(model, glm::vec3(-0.5f * size.x, -0.5f * size.y, 0.0f)); // move origin back\n\n model = glm::scale(model, glm::vec3(size, 1.0f)); // last scale\n\n this->shader.SetMatrix4(\"model\", model);\n\n // render textured quad\n this->shader.SetVector3f(\"spriteColor\", color);\n\n glActiveTexture(GL_TEXTURE0);\n texture.Bind();\n\n glBindVertexArray(this->quadVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n}\n\nvoid SpriteRenderer::initRenderData()\n{\n // configure VAO/VBO\n unsigned int VBO;\n float vertices[] = { \n // pos // tex\n 0.0f, 1.0f, 0.0f, 1.0f,\n 1.0f, 0.0f, 1.0f, 0.0f,\n 0.0f, 0.0f, 0.0f, 0.0f, \n\n 0.0f, 1.0f, 0.0f, 1.0f,\n 1.0f, 1.0f, 1.0f, 1.0f,\n 1.0f, 0.0f, 1.0f, 0.0f\n };\n\n glGenVertexArrays(1, &this->quadVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(this->quadVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/sprite_renderer.h", "language": "code", "loc": 32, "comment_density": 0.406, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef SPRITE_RENDERER_H\n#define SPRITE_RENDERER_H\n\n#include \n#include \n#include \n\n#include \"texture.h\"\n#include \"shader.h\"\n\n\nclass SpriteRenderer\n{\npublic:\n // Constructor (inits shaders/shapes)\n SpriteRenderer(Shader &shader);\n // Destructor\n ~SpriteRenderer();\n // Renders a defined quad textured with given sprite\n void DrawSprite(Texture2D &texture, glm::vec2 position, glm::vec2 size = glm::vec2(10.0f, 10.0f), float rotate = 0.0f, glm::vec3 color = glm::vec3(1.0f));\nprivate:\n // Render state\n Shader shader; \n unsigned int quadVAO;\n // Initializes and configures the quad's buffer and vertex attributes\n void initRenderData();\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/stb_image.cpp", "language": "code", "loc": 2, "comment_density": 0.0, "code": "#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\""}, {"path": "src/7.in_practice/3.2d_game/0.full_source/text_2d.fs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nin vec2 TexCoords;\nout vec4 color;\n\nuniform sampler2D text;\nuniform vec3 textColor;\n\nvoid main()\n{ \n vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r);\n color = vec4(textColor, 1.0) * sampled;\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/text_2d.vs", "language": "glsl", "loc": 9, "comment_density": 0.111, "code": "#version 330 core\nlayout (location = 0) in vec4 vertex; // \nout vec2 TexCoords;\n\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\n TexCoords = vertex.zw;\n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/text_renderer.cpp", "language": "code", "loc": 129, "comment_density": 0.248, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \n\n#include \n#include \n#include FT_FREETYPE_H\n\n#include \"text_renderer.h\"\n#include \"resource_manager.h\"\n\n\nTextRenderer::TextRenderer(unsigned int width, unsigned int height)\n{\n // load and configure shader\n this->TextShader = ResourceManager::LoadShader(\"text_2d.vs\", \"text_2d.fs\", nullptr, \"text\");\n this->TextShader.SetMatrix4(\"projection\", glm::ortho(0.0f, static_cast(width), static_cast(height), 0.0f), true);\n this->TextShader.SetInteger(\"text\", 0);\n // configure VAO/VBO for texture quads\n glGenVertexArrays(1, &this->VAO);\n glGenBuffers(1, &this->VBO);\n glBindVertexArray(this->VAO);\n glBindBuffer(GL_ARRAY_BUFFER, this->VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 6 * 4, NULL, GL_DYNAMIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0);\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n}\n\nvoid TextRenderer::Load(std::string font, unsigned int fontSize)\n{\n // first clear the previously loaded Characters\n this->Characters.clear();\n // then initialize and load the FreeType library\n FT_Library ft; \n if (FT_Init_FreeType(&ft)) // all functions return a value different than 0 whenever an error occurred\n std::cout << \"ERROR::FREETYPE: Could not init FreeType Library\" << std::endl;\n // load font as face\n FT_Face face;\n if (FT_New_Face(ft, font.c_str(), 0, &face))\n std::cout << \"ERROR::FREETYPE: Failed to load font\" << std::endl;\n // set size to load glyphs as\n FT_Set_Pixel_Sizes(face, 0, fontSize);\n // disable byte-alignment restriction\n glPixelStorei(GL_UNPACK_ALIGNMENT, 1); \n // then for the first 128 ASCII characters, pre-load/compile their characters and store them\n for (GLubyte c = 0; c < 128; c++) // lol see what I did there \n {\n // load character glyph \n if (FT_Load_Char(face, c, FT_LOAD_RENDER))\n {\n std::cout << \"ERROR::FREETYTPE: Failed to load Glyph\" << std::endl;\n continue;\n }\n // generate texture\n unsigned int texture;\n glGenTextures(1, &texture);\n glBindTexture(GL_TEXTURE_2D, texture);\n glTexImage2D(\n GL_TEXTURE_2D,\n 0,\n GL_RED,\n face->glyph->bitmap.width,\n face->glyph->bitmap.rows,\n 0,\n GL_RED,\n GL_UNSIGNED_BYTE,\n face->glyph->bitmap.buffer\n );\n // set texture options\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n \n // now store character for later use\n Character character = {\n texture,\n glm::ivec2(face->glyph->bitmap.width, face->glyph->bitmap.rows),\n glm::ivec2(face->glyph->bitmap_left, face->glyph->bitmap_top),\n face->glyph->advance.x\n };\n Characters.insert(std::pair(c, character));\n }\n glBindTexture(GL_TEXTURE_2D, 0);\n // destroy FreeType once we're finished\n FT_Done_Face(face);\n FT_Done_FreeType(ft);\n}\n\nvoid TextRenderer::RenderText(std::string text, float x, float y, float scale, glm::vec3 color)\n{\n // activate corresponding render state\t\n this->TextShader.Use();\n this->TextShader.SetVector3f(\"textColor\", color);\n glActiveTexture(GL_TEXTURE0);\n glBindVertexArray(this->VAO);\n\n // iterate through all characters\n std::string::const_iterator c;\n for (c = text.begin(); c != text.end(); c++)\n {\n Character ch = Characters[*c];\n\n float xpos = x + ch.Bearing.x * scale;\n float ypos = y + (this->Characters['H'].Bearing.y - ch.Bearing.y) * scale;\n\n float w = ch.Size.x * scale;\n float h = ch.Size.y * scale;\n // update VBO for each character\n float vertices[6][4] = {\n { xpos, ypos + h, 0.0f, 1.0f },\n { xpos + w, ypos, 1.0f, 0.0f },\n { xpos, ypos, 0.0f, 0.0f },\n\n { xpos, ypos + h, 0.0f, 1.0f },\n { xpos + w, ypos + h, 1.0f, 1.0f },\n { xpos + w, ypos, 1.0f, 0.0f }\n };\n // render glyph texture over quad\n glBindTexture(GL_TEXTURE_2D, ch.TextureID);\n // update content of VBO memory\n glBindBuffer(GL_ARRAY_BUFFER, this->VBO);\n glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); // be sure to use glBufferSubData and not glBufferData\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n // render quad\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // now advance cursors for next glyph\n x += (ch.Advance >> 6) * scale; // bitshift by 6 to get value in pixels (1/64th times 2^6 = 64)\n }\n glBindVertexArray(0);\n glBindTexture(GL_TEXTURE_2D, 0);\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/text_renderer.h", "language": "code", "loc": 43, "comment_density": 0.512, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef TEXT_RENDERER_H\n#define TEXT_RENDERER_H\n\n#include \n\n#include \n#include \n\n#include \"texture.h\"\n#include \"shader.h\"\n\n\n/// Holds all state information relevant to a character as loaded using FreeType\nstruct Character {\n unsigned int TextureID; // ID handle of the glyph texture\n glm::ivec2 Size; // size of glyph\n glm::ivec2 Bearing; // offset from baseline to left/top of glyph\n unsigned int Advance; // horizontal offset to advance to next glyph\n};\n\n\n// A renderer class for rendering text displayed by a font loaded using the \n// FreeType library. A single font is loaded, processed into a list of Character\n// items for later rendering.\nclass TextRenderer\n{\npublic:\n // holds a list of pre-compiled Characters\n std::map Characters; \n // shader used for text rendering\n Shader TextShader;\n // constructor\n TextRenderer(unsigned int width, unsigned int height);\n // pre-compiles a list of characters from the given font\n void Load(std::string font, unsigned int fontSize);\n // renders a string of text using the precompiled list of characters\n void RenderText(std::string text, float x, float y, float scale, glm::vec3 color = glm::vec3(1.0f));\nprivate:\n // render state\n unsigned int VAO, VBO;\n};\n\n#endif "}, {"path": "src/7.in_practice/3.2d_game/0.full_source/texture.cpp", "language": "code", "loc": 34, "comment_density": 0.324, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \n\n#include \"texture.h\"\n\n\nTexture2D::Texture2D()\n : Width(0), Height(0), Internal_Format(GL_RGB), Image_Format(GL_RGB), Wrap_S(GL_REPEAT), Wrap_T(GL_REPEAT), Filter_Min(GL_LINEAR), Filter_Max(GL_LINEAR)\n{\n glGenTextures(1, &this->ID);\n}\n\nvoid Texture2D::Generate(unsigned int width, unsigned int height, unsigned char* data)\n{\n this->Width = width;\n this->Height = height;\n // create Texture\n glBindTexture(GL_TEXTURE_2D, this->ID);\n glTexImage2D(GL_TEXTURE_2D, 0, this->Internal_Format, width, height, 0, this->Image_Format, GL_UNSIGNED_BYTE, data);\n // set Texture wrap and filter modes\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, this->Wrap_S);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, this->Wrap_T);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, this->Filter_Min);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, this->Filter_Max);\n // unbind texture\n glBindTexture(GL_TEXTURE_2D, 0);\n}\n\nvoid Texture2D::Bind() const\n{\n glBindTexture(GL_TEXTURE_2D, this->ID);\n}\n"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/texture.h", "language": "code", "loc": 36, "comment_density": 0.667, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef TEXTURE_H\n#define TEXTURE_H\n\n#include \n\n// Texture2D is able to store and configure a texture in OpenGL.\n// It also hosts utility functions for easy management.\nclass Texture2D\n{\npublic:\n // holds the ID of the texture object, used for all texture operations to reference to this particular texture\n unsigned int ID;\n // texture image dimensions\n unsigned int Width, Height; // width and height of loaded image in pixels\n // texture Format\n unsigned int Internal_Format; // format of texture object\n unsigned int Image_Format; // format of loaded image\n // texture configuration\n unsigned int Wrap_S; // wrapping mode on S axis\n unsigned int Wrap_T; // wrapping mode on T axis\n unsigned int Filter_Min; // filtering mode if texture pixels < screen pixels\n unsigned int Filter_Max; // filtering mode if texture pixels > screen pixels\n // constructor (sets default texture modes)\n Texture2D();\n // generates texture from image data\n void Generate(unsigned int width, unsigned int height, unsigned char* data);\n // binds the texture as the current active GL_TEXTURE_2D texture object\n void Bind() const;\n};\n\n#endif"}], "validation": {"glslang_valid": 8, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.268, "dedup_hash": "25ea4b7186556d7f", "has_readme": true} +{"id": "joeydevries_learnopengl_src_7_in_practice_3_2d_game_0_full_source_progress", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:23+00:00", "source_type": "repo", "title": "Progress", "api": "OpenGL Core", "glsl_version": null, "topic": "postprocessing/texturing/particles/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/7.in_practice/3.2d_game/0.full_source/progress/2.game.cpp", "language": "code", "loc": 28, "comment_density": 0.286, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"game.h\"\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_ACTIVE), Keys(), Width(width), Height(height)\n{ \n\n}\n\nGame::~Game()\n{\n \n}\n\nvoid Game::Init()\n{\n \n}\n\nvoid Game::Update(float dt)\n{\n \n}\n\nvoid Game::ProcessInput(float dt)\n{\n \n}\n\nvoid Game::Render()\n{\n \n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/2.game.h", "language": "code", "loc": 39, "comment_density": 0.41, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef GAME_H\n#define GAME_H\n\n#include \n#include \n\n// Represents the current state of the game\nenum GameState {\n GAME_ACTIVE,\n GAME_MENU,\n GAME_WIN\n};\n\n// Game holds all game-related state and functionality.\n// Combines all game-related data into a single class for\n// easy access to each of the components and manageability.\nclass Game\n{\npublic:\n // game state\n GameState State;\t\n bool Keys[1024];\n unsigned int Width, Height;\n // constructor/destructor\n Game(unsigned int width, unsigned int height);\n ~Game();\n // initialize game state (load all shaders/textures/levels)\n void Init();\n // game loop\n void ProcessInput(float dt);\n void Update(float dt);\n void Render();\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/2.program.cpp", "language": "code", "loc": 100, "comment_density": 0.32, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \n#include \n\n#include \"game.h\"\n#include \"resource_manager.h\"\n\n#include \n\n// GLFW function declarations\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);\n\n// The Width of the screen\nconst unsigned int SCREEN_WIDTH = 800;\n// The height of the screen\nconst unsigned int SCREEN_HEIGHT = 600;\n\nGame Breakout(SCREEN_WIDTH, SCREEN_HEIGHT);\n\nint main(int argc, char *argv[])\n{\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n glfwWindowHint(GLFW_RESIZABLE, false);\n\n GLFWwindow* window = glfwCreateWindow(SCREEN_WIDTH, SCREEN_HEIGHT, \"Breakout\", nullptr, nullptr);\n glfwMakeContextCurrent(window);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n glfwSetKeyCallback(window, key_callback);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // OpenGL configuration\n // --------------------\n glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n // initialize game\n // ---------------\n Breakout.Init();\n\n // deltaTime variables\n // -------------------\n float deltaTime = 0.0f;\n float lastFrame = 0.0f;\n\n while (!glfwWindowShouldClose(window))\n {\n // calculate delta time\n // --------------------\n float currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n glfwPollEvents();\n\n // manage user input\n // -----------------\n Breakout.ProcessInput(deltaTime);\n\n // update game state\n // -----------------\n Breakout.Update(deltaTime);\n\n // render\n // ------\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n Breakout.Render();\n\n glfwSwapBuffers(window);\n }\n\n // delete all resources as loaded using the resource manager\n // ---------------------------------------------------------\n ResourceManager::Clear();\n\n glfwTerminate();\n return 0;\n}\n\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)\n{\n // when a user presses the escape key, we set the WindowShouldClose property to true, closing the application\n if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n if (key >= 0 && key < 1024)\n {\n if (action == GLFW_PRESS)\n Breakout.Keys[key] = true;\n else if (action == GLFW_RELEASE)\n Breakout.Keys[key] = false;\n }\n}\n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/3.game.cpp", "language": "code", "loc": 45, "comment_density": 0.289, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"game.h\"\n#include \"resource_manager.h\"\n#include \"sprite_renderer.h\"\n\n\n// Game-related State data\nSpriteRenderer *Renderer;\n\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_ACTIVE), Keys(), Width(width), Height(height)\n{ \n\n}\n\nGame::~Game()\n{\n delete Renderer;\n}\n\nvoid Game::Init()\n{\n // load shaders\n ResourceManager::LoadShader(\"shaders/sprite.vs\", \"shaders/sprite.frag\", nullptr, \"sprite\");\n // configure shaders\n glm::mat4 projection = glm::ortho(0.0f, static_cast(this->Width), \n static_cast(this->Height), 0.0f, -1.0f, 1.0f);\n ResourceManager::GetShader(\"sprite\").Use().SetInteger(\"image\", 0);\n ResourceManager::GetShader(\"sprite\").SetMatrix4(\"projection\", projection);\n // set render-specific controls\n Renderer = new SpriteRenderer(ResourceManager::GetShader(\"sprite\"));\n // load textures\n ResourceManager::LoadTexture(\"textures/awesomeface.png\", true, \"face\");\n}\n\nvoid Game::Update(float dt)\n{\n \n}\n\nvoid Game::ProcessInput(float dt)\n{\n \n}\n\nvoid Game::Render()\n{\n Renderer->DrawSprite(ResourceManager::GetTexture(\"face\"), glm::vec2(200.0f, 200.0f), glm::vec2(300.0f, 400.0f), 45.0f, glm::vec3(0.0f, 1.0f, 0.0f));\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/4.game.cpp", "language": "code", "loc": 88, "comment_density": 0.216, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"game.h\"\n#include \"resource_manager.h\"\n#include \"sprite_renderer.h\"\n#include \"game_object.h\"\n\n// Game-related State data\nSpriteRenderer *Renderer;\nGameObject *Player;\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_ACTIVE), Keys(), Width(width), Height(height)\n{ \n\n}\n\nGame::~Game()\n{\n delete Renderer;\n delete Player;\n}\n\nvoid Game::Init()\n{\n // load shaders\n ResourceManager::LoadShader(\"shaders/sprite.vs\", \"shaders/sprite.frag\", nullptr, \"sprite\");\n // configure shaders\n glm::mat4 projection = glm::ortho(0.0f, static_cast(this->Width), \n static_cast(this->Height), 0.0f, -1.0f, 1.0f);\n ResourceManager::GetShader(\"sprite\").Use().SetInteger(\"image\", 0);\n ResourceManager::GetShader(\"sprite\").SetMatrix4(\"projection\", projection);\n // set render-specific controls\n Renderer = new SpriteRenderer(ResourceManager::GetShader(\"sprite\"));\n // load textures\n ResourceManager::LoadTexture(\"textures/background.jpg\", false, \"background\");\n ResourceManager::LoadTexture(\"textures/awesomeface.png\", true, \"face\");\n ResourceManager::LoadTexture(\"textures/block.png\", false, \"block\");\n ResourceManager::LoadTexture(\"textures/block_solid.png\", false, \"block_solid\");\n ResourceManager::LoadTexture(\"textures/paddle.png\", true, \"paddle\");\n // load levels\n GameLevel one; one.Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n GameLevel two; two.Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n GameLevel three; three.Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n GameLevel four; four.Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n this->Levels.push_back(one);\n this->Levels.push_back(two);\n this->Levels.push_back(three);\n this->Levels.push_back(four);\n this->Level = 0;\n // configure game objects\n glm::vec2 playerPos = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Player = new GameObject(playerPos, PLAYER_SIZE, ResourceManager::GetTexture(\"paddle\"));\n}\n\nvoid Game::Update(float dt)\n{\n \n}\n\nvoid Game::ProcessInput(float dt)\n{\n if (this->State == GAME_ACTIVE)\n {\n float velocity = PLAYER_VELOCITY * dt;\n // move playerboard\n if (this->Keys[GLFW_KEY_A])\n {\n if (Player->Position.x >= 0.0f)\n Player->Position.x -= velocity;\n }\n if (this->Keys[GLFW_KEY_D])\n {\n if (Player->Position.x <= this->Width - Player->Size.x)\n Player->Position.x += velocity;\n }\n }\n}\n\nvoid Game::Render()\n{\n if(this->State == GAME_ACTIVE)\n {\n // draw background\n Renderer->DrawSprite(ResourceManager::GetTexture(\"background\"), glm::vec2(0.0f, 0.0f), glm::vec2(this->Width, this->Height), 0.0f);\n // draw level\n this->Levels[this->Level].Draw(*Renderer);\n // draw player\n Player->Draw(*Renderer);\n }\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/4.game.h", "language": "code", "loc": 46, "comment_density": 0.391, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef GAME_H\n#define GAME_H\n\n#include \n#include \n\n#include \"game_level.h\"\n\n// Represents the current state of the game\nenum GameState {\n GAME_ACTIVE,\n GAME_MENU,\n GAME_WIN\n};\n\n// Initial size of the player paddle\nconst glm::vec2 PLAYER_SIZE(100.0f, 20.0f);\n// Initial velocity of the player paddle\nconst float PLAYER_VELOCITY(500.0f);\n\n// Game holds all game-related state and functionality.\n// Combines all game-related data into a single class for\n// easy access to each of the components and manageability.\nclass Game\n{\npublic:\n // game state\n GameState State;\t\n bool Keys[1024];\n unsigned int Width, Height;\n std::vector Levels;\n unsigned int Level;\n // constructor/destructor\n Game(unsigned int width, unsigned int height);\n ~Game();\n // initialize game state (load all shaders/textures/levels)\n void Init();\n // game loop\n void ProcessInput(float dt);\n void Update(float dt);\n void Render();\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/5.1.ball_object_collisions.cpp", "language": "code", "loc": 46, "comment_density": 0.261, "code": "/******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"ball_object.h\"\n\n\nBallObject::BallObject() \n : GameObject(), Radius(12.5f), Stuck(true) { }\n\nBallObject::BallObject(glm::vec2 pos, float radius, glm::vec2 velocity, Texture2D sprite)\n : GameObject(pos, glm::vec2(radius * 2.0f, radius * 2.0f), sprite, glm::vec3(1.0f), velocity), Radius(radius), Stuck(true) { }\n\nglm::vec2 BallObject::Move(float dt, unsigned int window_width)\n{\n // if not stuck to player board\n if (!this->Stuck)\n {\n // move the ball\n this->Position += this->Velocity * dt;\n // then check if outside window bounds and if so, reverse velocity and restore at correct position\n if (this->Position.x <= 0.0f)\n {\n this->Velocity.x = -this->Velocity.x;\n this->Position.x = 0.0f;\n }\n else if (this->Position.x + this->Size.x >= window_width)\n {\n this->Velocity.x = -this->Velocity.x;\n this->Position.x = window_width - this->Size.x;\n }\n if (this->Position.y <= 0.0f)\n {\n this->Velocity.y = -this->Velocity.y;\n this->Position.y = 0.0f;\n }\n }\n return this->Position;\n}\n\n// resets the ball to initial Stuck Position (if ball is outside window bounds)\nvoid BallObject::Reset(glm::vec2 position, glm::vec2 velocity)\n{\n this->Position = position;\n this->Velocity = velocity;\n this->Stuck = true;\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/5.1.ball_object_collisions.h", "language": "code", "loc": 33, "comment_density": 0.485, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef BALLOBJECT_H\n#define BALLOBJECT_H\n\n#include \n#include \n\n#include \"game_object.h\"\n#include \"texture.h\"\n\n\n// BallObject holds the state of the Ball object inheriting\n// relevant state data from GameObject. Contains some extra\n// functionality specific to Breakout's ball object that\n// were too specific for within GameObject alone.\nclass BallObject : public GameObject\n{\npublic:\n // ball state\t\n float Radius;\n bool Stuck;\n // constructor(s)\n BallObject();\n BallObject(glm::vec2 pos, float radius, glm::vec2 velocity, Texture2D sprite);\n // moves the ball, keeping it constrained within the window bounds (except bottom edge); returns new position\n glm::vec2 Move(float dt, unsigned int window_width);\n // resets the ball to original state with given position and velocity\n void Reset(glm::vec2 position, glm::vec2 velocity);\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/5.game.cpp", "language": "code", "loc": 245, "comment_density": 0.249, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"game.h\"\n#include \"resource_manager.h\"\n#include \"sprite_renderer.h\"\n#include \"game_object.h\"\n#include \"ball_object.h\"\n\n// Game-related State data\nSpriteRenderer *Renderer;\nGameObject *Player;\nBallObject *Ball;\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_ACTIVE), Keys(), Width(width), Height(height)\n{ \n\n}\n\nGame::~Game()\n{\n delete Renderer;\n delete Player;\n delete Ball;\n}\n\nvoid Game::Init()\n{\n // load shaders\n ResourceManager::LoadShader(\"shaders/sprite.vs\", \"shaders/sprite.frag\", nullptr, \"sprite\");\n // configure shaders\n glm::mat4 projection = glm::ortho(0.0f, static_cast(this->Width), \n static_cast(this->Height), 0.0f, -1.0f, 1.0f);\n ResourceManager::GetShader(\"sprite\").Use().SetInteger(\"image\", 0);\n ResourceManager::GetShader(\"sprite\").SetMatrix4(\"projection\", projection);\n // set render-specific controls\n Renderer = new SpriteRenderer(ResourceManager::GetShader(\"sprite\"));\n // load textures\n ResourceManager::LoadTexture(\"textures/background.jpg\", false, \"background\");\n ResourceManager::LoadTexture(\"textures/awesomeface.png\", true, \"face\");\n ResourceManager::LoadTexture(\"textures/block.png\", false, \"block\");\n ResourceManager::LoadTexture(\"textures/block_solid.png\", false, \"block_solid\");\n ResourceManager::LoadTexture(\"textures/paddle.png\", true, \"paddle\");\n // load levels\n GameLevel one; one.Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n GameLevel two; two.Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n GameLevel three; three.Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n GameLevel four; four.Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n this->Levels.push_back(one);\n this->Levels.push_back(two);\n this->Levels.push_back(three);\n this->Levels.push_back(four);\n this->Level = 0;\n // configure game objects\n glm::vec2 playerPos = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Player = new GameObject(playerPos, PLAYER_SIZE, ResourceManager::GetTexture(\"paddle\"));\n glm::vec2 ballPos = playerPos + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -BALL_RADIUS * 2.0f);\n Ball = new BallObject(ballPos, BALL_RADIUS, INITIAL_BALL_VELOCITY, ResourceManager::GetTexture(\"face\"));\n}\n\nvoid Game::Update(float dt)\n{\n // update objects\n Ball->Move(dt, this->Width);\n // check for collisions\n this->DoCollisions();\n // check loss condition\n if (Ball->Position.y >= this->Height) // did ball reach bottom edge?\n {\n this->ResetLevel();\n this->ResetPlayer();\n }\n}\n\nvoid Game::ProcessInput(float dt)\n{\n if (this->State == GAME_ACTIVE)\n {\n float velocity = PLAYER_VELOCITY * dt;\n // move playerboard\n if (this->Keys[GLFW_KEY_A])\n {\n if (Player->Position.x >= 0.0f)\n {\n Player->Position.x -= velocity;\n if (Ball->Stuck)\n Ball->Position.x -= velocity;\n }\n }\n if (this->Keys[GLFW_KEY_D])\n {\n if (Player->Position.x <= this->Width - Player->Size.x)\n {\n Player->Position.x += velocity;\n if (Ball->Stuck)\n Ball->Position.x += velocity;\n }\n }\n if (this->Keys[GLFW_KEY_SPACE])\n Ball->Stuck = false;\n }\n}\n\nvoid Game::Render()\n{\n if(this->State == GAME_ACTIVE)\n {\n // draw background\n Renderer->DrawSprite(ResourceManager::GetTexture(\"background\"), glm::vec2(0.0f, 0.0f), glm::vec2(this->Width, this->Height), 0.0f);\n // draw level\n this->Levels[this->Level].Draw(*Renderer);\n // draw player\n Player->Draw(*Renderer);\n // draw ball\n Ball->Draw(*Renderer); \n }\n}\n\n\nvoid Game::ResetLevel()\n{\n if (this->Level == 0)\n this->Levels[0].Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 1)\n this->Levels[1].Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 2)\n this->Levels[2].Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 3)\n this->Levels[3].Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n}\n\nvoid Game::ResetPlayer()\n{\n // reset player/ball stats\n Player->Size = PLAYER_SIZE;\n Player->Position = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Ball->Reset(Player->Position + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -(BALL_RADIUS * 2.0f)), INITIAL_BALL_VELOCITY);\n}\n\n// collision detection\nbool CheckCollision(GameObject &one, GameObject &two);\nCollision CheckCollision(BallObject &one, GameObject &two);\nDirection VectorDirection(glm::vec2 closest);\n\nvoid Game::DoCollisions()\n{\n for (GameObject &box : this->Levels[this->Level].Bricks)\n {\n if (!box.Destroyed)\n {\n Collision collision = CheckCollision(*Ball, box);\n if (std::get<0>(collision)) // if collision is true\n {\n // destroy block if not solid\n if (!box.IsSolid)\n box.Destroyed = true;\n // collision resolution\n Direction dir = std::get<1>(collision);\n glm::vec2 diff_vector = std::get<2>(collision);\n if (dir == LEFT || dir == RIGHT) // horizontal collision\n {\n Ball->Velocity.x = -Ball->Velocity.x; // reverse horizontal velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.x);\n if (dir == LEFT)\n Ball->Position.x += penetration; // move ball to right\n else\n Ball->Position.x -= penetration; // move ball to left;\n }\n else // vertical collision\n {\n Ball->Velocity.y = -Ball->Velocity.y; // reverse vertical velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.y);\n if (dir == UP)\n Ball->Position.y -= penetration; // move ball bback up\n else\n Ball->Position.y += penetration; // move ball back down\n } \n }\n } \n }\n // check collisions for player pad (unless stuck)\n Collision result = CheckCollision(*Ball, *Player);\n if (!Ball->Stuck && std::get<0>(result))\n {\n // check where it hit the board, and change velocity based on where it hit the board\n float centerBoard = Player->Position.x + Player->Size.x / 2.0f;\n float distance = (Ball->Position.x + Ball->Radius) - centerBoard;\n float percentage = distance / (Player->Size.x / 2.0f);\n // then move accordingly\n float strength = 2.0f;\n glm::vec2 oldVelocity = Ball->Velocity;\n Ball->Velocity.x = INITIAL_BALL_VELOCITY.x * percentage * strength; \n //Ball->Velocity.y = -Ball->Velocity.y;\n Ball->Velocity = glm::normalize(Ball->Velocity) * glm::length(oldVelocity); // keep speed consistent over both axes (multiply by length of old velocity, so total strength is not changed)\n // fix sticky paddle\n Ball->Velocity.y = -1.0f * abs(Ball->Velocity.y);\n }\n}\n\nbool CheckCollision(GameObject &one, GameObject &two) // AABB - AABB collision\n{\n // collision x-axis?\n bool collisionX = one.Position.x + one.Size.x >= two.Position.x &&\n two.Position.x + two.Size.x >= one.Position.x;\n // collision y-axis?\n bool collisionY = one.Position.y + one.Size.y >= two.Position.y &&\n two.Position.y + two.Size.y >= one.Position.y;\n // collision only if on both axes\n return collisionX && collisionY;\n}\n\nCollision CheckCollision(BallObject &one, GameObject &two) // AABB - Circle collision\n{\n // get center point circle first \n glm::vec2 center(one.Position + one.Radius);\n // calculate AABB info (center, half-extents)\n glm::vec2 aabb_half_extents(two.Size.x / 2.0f, two.Size.y / 2.0f);\n glm::vec2 aabb_center(two.Position.x + aabb_half_extents.x, two.Position.y + aabb_half_extents.y);\n // get difference vector between both centers\n glm::vec2 difference = center - aabb_center;\n glm::vec2 clamped = glm::clamp(difference, -aabb_half_extents, aabb_half_extents);\n // now that we know the clamped values, add this to AABB_center and we get the value of box closest to circle\n glm::vec2 closest = aabb_center + clamped;\n // now retrieve vector between center circle and closest point AABB and check if length < radius\n difference = closest - center;\n\n if (glm::length(difference) < one.Radius) // not <= since in that case a collision also occurs when object one exactly touches object two, which they are at the end of each collision resolution stage.\n return std::make_tuple(true, VectorDirection(difference), difference);\n else\n return std::make_tuple(false, UP, glm::vec2(0.0f, 0.0f));\n}\n\n// calculates which direction a vector is facing (N,E,S or W)\nDirection VectorDirection(glm::vec2 target)\n{\n glm::vec2 compass[] = {\n glm::vec2(0.0f, 1.0f),\t// up\n glm::vec2(1.0f, 0.0f),\t// right\n glm::vec2(0.0f, -1.0f),\t// down\n glm::vec2(-1.0f, 0.0f)\t// left\n };\n float max = 0.0f;\n unsigned int best_match = -1;\n for (unsigned int i = 0; i < 4; i++)\n {\n float dot_product = glm::dot(glm::normalize(target), compass[i]);\n if (dot_product > max)\n {\n max = dot_product;\n best_match = i;\n }\n }\n return (Direction)best_match;\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/5.game.h", "language": "code", "loc": 63, "comment_density": 0.381, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef GAME_H\n#define GAME_H\n\n#include \n#include \n\n#include \"game_level.h\"\n\n// Represents the current state of the game\nenum GameState {\n GAME_ACTIVE,\n GAME_MENU,\n GAME_WIN\n};\n\n// Represents the four possible (collision) directions\nenum Direction {\n UP,\n RIGHT,\n DOWN,\n LEFT\n};\n// Defines a Collision typedef that represents collision data\ntypedef std::tuple Collision; // \n\n// Initial size of the player paddle\nconst glm::vec2 PLAYER_SIZE(100.0f, 20.0f);\n// Initial velocity of the player paddle\nconst float PLAYER_VELOCITY(500.0f);\n// Initial velocity of the Ball\nconst glm::vec2 INITIAL_BALL_VELOCITY(100.0f, -350.0f);\n// Radius of the ball object\nconst float BALL_RADIUS = 12.5f;\n\n// Game holds all game-related state and functionality.\n// Combines all game-related data into a single class for\n// easy access to each of the components and manageability.\nclass Game\n{\npublic:\n // game state\n GameState State;\t\n bool Keys[1024];\n unsigned int Width, Height;\n std::vector Levels;\n unsigned int Level;\n // constructor/destructor\n Game(unsigned int width, unsigned int height);\n ~Game();\n // initialize game state (load all shaders/textures/levels)\n void Init();\n // game loop\n void ProcessInput(float dt);\n void Update(float dt);\n void Render();\n void DoCollisions();\n // reset\n void ResetLevel();\n void ResetPlayer();\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/6.game.cpp", "language": "code", "loc": 257, "comment_density": 0.245, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"game.h\"\n#include \"resource_manager.h\"\n#include \"sprite_renderer.h\"\n#include \"game_object.h\"\n#include \"ball_object.h\"\n#include \"particle_generator.h\"\n\n// Game-related State data\nSpriteRenderer *Renderer;\nGameObject *Player;\nBallObject *Ball;\nParticleGenerator *Particles;\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_ACTIVE), Keys(), Width(width), Height(height)\n{ \n\n}\n\nGame::~Game()\n{\n delete Renderer;\n delete Player;\n delete Ball;\n delete Particles;\n}\n\nvoid Game::Init()\n{\n // load shaders\n ResourceManager::LoadShader(\"shaders/sprite.vs\", \"shaders/sprite.frag\", nullptr, \"sprite\");\n ResourceManager::LoadShader(\"shaders/particle.vs\", \"shaders/particle.frag\", nullptr, \"particle\");\n // configure shaders\n glm::mat4 projection = glm::ortho(0.0f, static_cast(this->Width), \n static_cast(this->Height), 0.0f, -1.0f, 1.0f);\n ResourceManager::GetShader(\"sprite\").Use().SetInteger(\"image\", 0);\n ResourceManager::GetShader(\"sprite\").SetMatrix4(\"projection\", projection);\n ResourceManager::GetShader(\"particle\").Use().SetInteger(\"sprite\", 0);\n ResourceManager::GetShader(\"particle\").SetMatrix4(\"projection\", projection); \n // load textures\n ResourceManager::LoadTexture(\"textures/background.jpg\", false, \"background\");\n ResourceManager::LoadTexture(\"textures/awesomeface.png\", true, \"face\");\n ResourceManager::LoadTexture(\"textures/block.png\", false, \"block\");\n ResourceManager::LoadTexture(\"textures/block_solid.png\", false, \"block_solid\");\n ResourceManager::LoadTexture(\"textures/paddle.png\", true, \"paddle\");\n ResourceManager::LoadTexture(\"textures/particle.png\", true, \"particle\");\n // set render-specific controls\n Renderer = new SpriteRenderer(ResourceManager::GetShader(\"sprite\"));\n Particles = new ParticleGenerator(ResourceManager::GetShader(\"particle\"), ResourceManager::GetTexture(\"particle\"), 500);\n // load levels\n GameLevel one; one.Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n GameLevel two; two.Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n GameLevel three; three.Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n GameLevel four; four.Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n this->Levels.push_back(one);\n this->Levels.push_back(two);\n this->Levels.push_back(three);\n this->Levels.push_back(four);\n this->Level = 0;\n // configure game objects\n glm::vec2 playerPos = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Player = new GameObject(playerPos, PLAYER_SIZE, ResourceManager::GetTexture(\"paddle\"));\n glm::vec2 ballPos = playerPos + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -BALL_RADIUS * 2.0f);\n Ball = new BallObject(ballPos, BALL_RADIUS, INITIAL_BALL_VELOCITY, ResourceManager::GetTexture(\"face\"));\n}\n\nvoid Game::Update(float dt)\n{\n // update objects\n Ball->Move(dt, this->Width);\n // check for collisions\n this->DoCollisions();\n // update particles\n Particles->Update(dt, *Ball, 2, glm::vec2(Ball->Radius / 2.0f));\n // check loss condition\n if (Ball->Position.y >= this->Height) // did ball reach bottom edge?\n {\n this->ResetLevel();\n this->ResetPlayer();\n }\n}\n\nvoid Game::ProcessInput(float dt)\n{\n if (this->State == GAME_ACTIVE)\n {\n float velocity = PLAYER_VELOCITY * dt;\n // move playerboard\n if (this->Keys[GLFW_KEY_A])\n {\n if (Player->Position.x >= 0.0f)\n {\n Player->Position.x -= velocity;\n if (Ball->Stuck)\n Ball->Position.x -= velocity;\n }\n }\n if (this->Keys[GLFW_KEY_D])\n {\n if (Player->Position.x <= this->Width - Player->Size.x)\n {\n Player->Position.x += velocity;\n if (Ball->Stuck)\n Ball->Position.x += velocity;\n }\n }\n if (this->Keys[GLFW_KEY_SPACE])\n Ball->Stuck = false;\n }\n}\n\nvoid Game::Render()\n{\n if(this->State == GAME_ACTIVE)\n {\n // draw background\n Renderer->DrawSprite(ResourceManager::GetTexture(\"background\"), glm::vec2(0.0f, 0.0f), glm::vec2(this->Width, this->Height), 0.0f);\n // draw level\n this->Levels[this->Level].Draw(*Renderer);\n // draw player\n Player->Draw(*Renderer);\n // draw particles\t\n Particles->Draw();\n // draw ball\n Ball->Draw(*Renderer); \n }\n}\n\n\nvoid Game::ResetLevel()\n{\n if (this->Level == 0)\n this->Levels[0].Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 1)\n this->Levels[1].Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 2)\n this->Levels[2].Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 3)\n this->Levels[3].Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n}\n\nvoid Game::ResetPlayer()\n{\n // reset player/ball stats\n Player->Size = PLAYER_SIZE;\n Player->Position = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Ball->Reset(Player->Position + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -(BALL_RADIUS * 2.0f)), INITIAL_BALL_VELOCITY);\n}\n\n// collision detection\nbool CheckCollision(GameObject &one, GameObject &two);\nCollision CheckCollision(BallObject &one, GameObject &two);\nDirection VectorDirection(glm::vec2 closest);\n\nvoid Game::DoCollisions()\n{\n for (GameObject &box : this->Levels[this->Level].Bricks)\n {\n if (!box.Destroyed)\n {\n Collision collision = CheckCollision(*Ball, box);\n if (std::get<0>(collision)) // if collision is true\n {\n // destroy block if not solid\n if (!box.IsSolid)\n box.Destroyed = true;\n // collision resolution\n Direction dir = std::get<1>(collision);\n glm::vec2 diff_vector = std::get<2>(collision);\n if (dir == LEFT || dir == RIGHT) // horizontal collision\n {\n Ball->Velocity.x = -Ball->Velocity.x; // reverse horizontal velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.x);\n if (dir == LEFT)\n Ball->Position.x += penetration; // move ball to right\n else\n Ball->Position.x -= penetration; // move ball to left;\n }\n else // vertical collision\n {\n Ball->Velocity.y = -Ball->Velocity.y; // reverse vertical velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.y);\n if (dir == UP)\n Ball->Position.y -= penetration; // move ball bback up\n else\n Ball->Position.y += penetration; // move ball back down\n } \n }\n } \n }\n // check collisions for player pad (unless stuck)\n Collision result = CheckCollision(*Ball, *Player);\n if (!Ball->Stuck && std::get<0>(result))\n {\n // check where it hit the board, and change velocity based on where it hit the board\n float centerBoard = Player->Position.x + Player->Size.x / 2.0f;\n float distance = (Ball->Position.x + Ball->Radius) - centerBoard;\n float percentage = distance / (Player->Size.x / 2.0f);\n // then move accordingly\n float strength = 2.0f;\n glm::vec2 oldVelocity = Ball->Velocity;\n Ball->Velocity.x = INITIAL_BALL_VELOCITY.x * percentage * strength; \n //Ball->Velocity.y = -Ball->Velocity.y;\n Ball->Velocity = glm::normalize(Ball->Velocity) * glm::length(oldVelocity); // keep speed consistent over both axes (multiply by length of old velocity, so total strength is not changed)\n // fix sticky paddle\n Ball->Velocity.y = -1.0f * abs(Ball->Velocity.y);\n }\n}\n\nbool CheckCollision(GameObject &one, GameObject &two) // AABB - AABB collision\n{\n // collision x-axis?\n bool collisionX = one.Position.x + one.Size.x >= two.Position.x &&\n two.Position.x + two.Size.x >= one.Position.x;\n // collision y-axis?\n bool collisionY = one.Position.y + one.Size.y >= two.Position.y &&\n two.Position.y + two.Size.y >= one.Position.y;\n // collision only if on both axes\n return collisionX && collisionY;\n}\n\nCollision CheckCollision(BallObject &one, GameObject &two) // AABB - Circle collision\n{\n // get center point circle first \n glm::vec2 center(one.Position + one.Radius);\n // calculate AABB info (center, half-extents)\n glm::vec2 aabb_half_extents(two.Size.x / 2.0f, two.Size.y / 2.0f);\n glm::vec2 aabb_center(two.Position.x + aabb_half_extents.x, two.Position.y + aabb_half_extents.y);\n // get difference vector between both centers\n glm::vec2 difference = center - aabb_center;\n glm::vec2 clamped = glm::clamp(difference, -aabb_half_extents, aabb_half_extents);\n // now that we know the clamped values, add this to AABB_center and we get the value of box closest to circle\n glm::vec2 closest = aabb_center + clamped;\n // now retrieve vector between center circle and closest point AABB and check if length < radius\n difference = closest - center;\n\n if (glm::length(difference) < one.Radius) // not <= since in that case a collision also occurs when object one exactly touches object two, which they are at the end of each collision resolution stage.\n return std::make_tuple(true, VectorDirection(difference), difference);\n else\n return std::make_tuple(false, UP, glm::vec2(0.0f, 0.0f));\n}\n\n// calculates which direction a vector is facing (N,E,S or W)\nDirection VectorDirection(glm::vec2 target)\n{\n glm::vec2 compass[] = {\n glm::vec2(0.0f, 1.0f),\t// up\n glm::vec2(1.0f, 0.0f),\t// right\n glm::vec2(0.0f, -1.0f),\t// down\n glm::vec2(-1.0f, 0.0f)\t// left\n };\n float max = 0.0f;\n unsigned int best_match = -1;\n for (unsigned int i = 0; i < 4; i++)\n {\n float dot_product = glm::dot(glm::normalize(target), compass[i]);\n if (dot_product > max)\n {\n max = dot_product;\n best_match = i;\n }\n }\n return (Direction)best_match;\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/7.game.cpp", "language": "code", "loc": 281, "comment_density": 0.242, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \"game.h\"\n#include \"resource_manager.h\"\n#include \"sprite_renderer.h\"\n#include \"game_object.h\"\n#include \"ball_object.h\"\n#include \"particle_generator.h\"\n#include \"post_processor.h\"\n\n// Game-related State data\nSpriteRenderer *Renderer;\nGameObject *Player;\nBallObject *Ball;\nParticleGenerator *Particles;\nPostProcessor *Effects;\n\nfloat ShakeTime = 0.0f;\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_ACTIVE), Keys(), Width(width), Height(height)\n{ \n\n}\n\nGame::~Game()\n{\n delete Renderer;\n delete Player;\n delete Ball;\n delete Particles;\n delete Effects;\n}\n\nvoid Game::Init()\n{\n // load shaders\n ResourceManager::LoadShader(\"shaders/sprite.vs\", \"shaders/sprite.frag\", nullptr, \"sprite\");\n ResourceManager::LoadShader(\"shaders/particle.vs\", \"shaders/particle.frag\", nullptr, \"particle\");\n ResourceManager::LoadShader(\"shaders/post_processing.vs\", \"shaders/post_processing.frag\", nullptr, \"postprocessing\");\n // configure shaders\n glm::mat4 projection = glm::ortho(0.0f, static_cast(this->Width), \n static_cast(this->Height), 0.0f, -1.0f, 1.0f);\n ResourceManager::GetShader(\"sprite\").Use().SetInteger(\"image\", 0);\n ResourceManager::GetShader(\"sprite\").SetMatrix4(\"projection\", projection);\n ResourceManager::GetShader(\"particle\").Use().SetInteger(\"sprite\", 0);\n ResourceManager::GetShader(\"particle\").SetMatrix4(\"projection\", projection); \n // load textures\n ResourceManager::LoadTexture(\"textures/background.jpg\", false, \"background\");\n ResourceManager::LoadTexture(\"textures/awesomeface.png\", true, \"face\");\n ResourceManager::LoadTexture(\"textures/block.png\", false, \"block\");\n ResourceManager::LoadTexture(\"textures/block_solid.png\", false, \"block_solid\");\n ResourceManager::LoadTexture(\"textures/paddle.png\", true, \"paddle\");\n ResourceManager::LoadTexture(\"textures/particle.png\", true, \"particle\");\n // set render-specific controls\n Renderer = new SpriteRenderer(ResourceManager::GetShader(\"sprite\"));\n Particles = new ParticleGenerator(ResourceManager::GetShader(\"particle\"), ResourceManager::GetTexture(\"particle\"), 500);\n Effects = new PostProcessor(ResourceManager::GetShader(\"postprocessing\"), this->Width, this->Height);\n // load levels\n GameLevel one; one.Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n GameLevel two; two.Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n GameLevel three; three.Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n GameLevel four; four.Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n this->Levels.push_back(one);\n this->Levels.push_back(two);\n this->Levels.push_back(three);\n this->Levels.push_back(four);\n this->Level = 0;\n // configure game objects\n glm::vec2 playerPos = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Player = new GameObject(playerPos, PLAYER_SIZE, ResourceManager::GetTexture(\"paddle\"));\n glm::vec2 ballPos = playerPos + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -BALL_RADIUS * 2.0f);\n Ball = new BallObject(ballPos, BALL_RADIUS, INITIAL_BALL_VELOCITY, ResourceManager::GetTexture(\"face\"));\n}\n\nvoid Game::Update(float dt)\n{\n // update objects\n Ball->Move(dt, this->Width);\n // check for collisions\n this->DoCollisions();\n // update particles\n Particles->Update(dt, *Ball, 2, glm::vec2(Ball->Radius / 2.0f));\n // reduce shake time\n if (ShakeTime > 0.0f)\n {\n ShakeTime -= dt;\n if (ShakeTime <= 0.0f)\n Effects->Shake = false;\n }\n // check loss condition\n if (Ball->Position.y >= this->Height) // did ball reach bottom edge?\n {\n this->ResetLevel();\n this->ResetPlayer();\n }\n}\n\nvoid Game::ProcessInput(float dt)\n{\n if (this->State == GAME_ACTIVE)\n {\n float velocity = PLAYER_VELOCITY * dt;\n // move playerboard\n if (this->Keys[GLFW_KEY_A])\n {\n if (Player->Position.x >= 0.0f)\n {\n Player->Position.x -= velocity;\n if (Ball->Stuck)\n Ball->Position.x -= velocity;\n }\n }\n if (this->Keys[GLFW_KEY_D])\n {\n if (Player->Position.x <= this->Width - Player->Size.x)\n {\n Player->Position.x += velocity;\n if (Ball->Stuck)\n Ball->Position.x += velocity;\n }\n }\n if (this->Keys[GLFW_KEY_SPACE])\n Ball->Stuck = false;\n }\n}\n\nvoid Game::Render()\n{\n if(this->State == GAME_ACTIVE)\n {\n // begin rendering to postprocessing framebuffer\n Effects->BeginRender();\n // draw background\n Renderer->DrawSprite(ResourceManager::GetTexture(\"background\"), glm::vec2(0.0f, 0.0f), glm::vec2(this->Width, this->Height), 0.0f);\n // draw level\n this->Levels[this->Level].Draw(*Renderer);\n // draw player\n Player->Draw(*Renderer); \n // draw particles\t\n Particles->Draw();\n // draw ball\n Ball->Draw(*Renderer); \n // end rendering to postprocessing framebuffer\n Effects->EndRender();\n // render postprocessing quad\n Effects->Render(glfwGetTime());\n }\n}\n\n\nvoid Game::ResetLevel()\n{\n if (this->Level == 0)\n this->Levels[0].Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 1)\n this->Levels[1].Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 2)\n this->Levels[2].Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 3)\n this->Levels[3].Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n}\n\nvoid Game::ResetPlayer()\n{\n // reset player/ball stats\n Player->Size = PLAYER_SIZE;\n Player->Position = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Ball->Reset(Player->Position + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -(BALL_RADIUS * 2.0f)), INITIAL_BALL_VELOCITY);\n}\n\n// collision detection\nbool CheckCollision(GameObject &one, GameObject &two);\nCollision CheckCollision(BallObject &one, GameObject &two);\nDirection VectorDirection(glm::vec2 closest);\n\nvoid Game::DoCollisions()\n{\n for (GameObject &box : this->Levels[this->Level].Bricks)\n {\n if (!box.Destroyed)\n {\n Collision collision = CheckCollision(*Ball, box);\n if (std::get<0>(collision)) // if collision is true\n {\n // destroy block if not solid\n if (!box.IsSolid)\n box.Destroyed = true;\n else\n { // if block is solid, enable shake effect\n ShakeTime = 0.05f;\n Effects->Shake = true;\n }\n // collision resolution\n Direction dir = std::get<1>(collision);\n glm::vec2 diff_vector = std::get<2>(collision);\n if (dir == LEFT || dir == RIGHT) // horizontal collision\n {\n Ball->Velocity.x = -Ball->Velocity.x; // reverse horizontal velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.x);\n if (dir == LEFT)\n Ball->Position.x += penetration; // move ball to right\n else\n Ball->Position.x -= penetration; // move ball to left;\n }\n else // vertical collision\n {\n Ball->Velocity.y = -Ball->Velocity.y; // reverse vertical velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.y);\n if (dir == UP)\n Ball->Position.y -= penetration; // move ball bback up\n else\n Ball->Position.y += penetration; // move ball back down\n } \n }\n } \n }\n // check collisions for player pad (unless stuck)\n Collision result = CheckCollision(*Ball, *Player);\n if (!Ball->Stuck && std::get<0>(result))\n {\n // check where it hit the board, and change velocity based on where it hit the board\n float centerBoard = Player->Position.x + Player->Size.x / 2.0f;\n float distance = (Ball->Position.x + Ball->Radius) - centerBoard;\n float percentage = distance / (Player->Size.x / 2.0f);\n // then move accordingly\n float strength = 2.0f;\n glm::vec2 oldVelocity = Ball->Velocity;\n Ball->Velocity.x = INITIAL_BALL_VELOCITY.x * percentage * strength; \n //Ball->Velocity.y = -Ball->Velocity.y;\n Ball->Velocity = glm::normalize(Ball->Velocity) * glm::length(oldVelocity); // keep speed consistent over both axes (multiply by length of old velocity, so total strength is not changed)\n // fix sticky paddle\n Ball->Velocity.y = -1.0f * abs(Ball->Velocity.y);\n }\n}\n\nbool CheckCollision(GameObject &one, GameObject &two) // AABB - AABB collision\n{\n // collision x-axis?\n bool collisionX = one.Position.x + one.Size.x >= two.Position.x &&\n two.Position.x + two.Size.x >= one.Position.x;\n // collision y-axis?\n bool collisionY = one.Position.y + one.Size.y >= two.Position.y &&\n two.Position.y + two.Size.y >= one.Position.y;\n // collision only if on both axes\n return collisionX && collisionY;\n}\n\nCollision CheckCollision(BallObject &one, GameObject &two) // AABB - Circle collision\n{\n // get center point circle first \n glm::vec2 center(one.Position + one.Radius);\n // calculate AABB info (center, half-extents)\n glm::vec2 aabb_half_extents(two.Size.x / 2.0f, two.Size.y / 2.0f);\n glm::vec2 aabb_center(two.Position.x + aabb_half_extents.x, two.Position.y + aabb_half_extents.y);\n // get difference vector between both centers\n glm::vec2 difference = center - aabb_center;\n glm::vec2 clamped = glm::clamp(difference, -aabb_half_extents, aabb_half_extents);\n // now that we know the clamped values, add this to AABB_center and we get the value of box closest to circle\n glm::vec2 closest = aabb_center + clamped;\n // now retrieve vector between center circle and closest point AABB and check if length < radius\n difference = closest - center;\n\n if (glm::length(difference) < one.Radius) // not <= since in that case a collision also occurs when object one exactly touches object two, which they are at the end of each collision resolution stage.\n return std::make_tuple(true, VectorDirection(difference), difference);\n else\n return std::make_tuple(false, UP, glm::vec2(0.0f, 0.0f));\n}\n\n// calculates which direction a vector is facing (N,E,S or W)\nDirection VectorDirection(glm::vec2 target)\n{\n glm::vec2 compass[] = {\n glm::vec2(0.0f, 1.0f),\t// up\n glm::vec2(1.0f, 0.0f),\t// right\n glm::vec2(0.0f, -1.0f),\t// down\n glm::vec2(-1.0f, 0.0f)\t// left\n };\n float max = 0.0f;\n unsigned int best_match = -1;\n for (unsigned int i = 0; i < 4; i++)\n {\n float dot_product = glm::dot(glm::normalize(target), compass[i]);\n if (dot_product > max)\n {\n max = dot_product;\n best_match = i;\n }\n }\n return (Direction)best_match;\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/8.game.cpp", "language": "code", "loc": 440, "comment_density": 0.205, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \n\n#include \"game.h\"\n#include \"resource_manager.h\"\n#include \"sprite_renderer.h\"\n#include \"game_object.h\"\n#include \"ball_object.h\"\n#include \"particle_generator.h\"\n#include \"post_processor.h\"\n\n// Game-related State data\nSpriteRenderer *Renderer;\nGameObject *Player;\nBallObject *Ball;\nParticleGenerator *Particles;\nPostProcessor *Effects;\n\nfloat ShakeTime = 0.0f;\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_ACTIVE), Keys(), Width(width), Height(height)\n{ \n\n}\n\nGame::~Game()\n{\n delete Renderer;\n delete Player;\n delete Ball;\n delete Particles;\n delete Effects;\n}\n\nvoid Game::Init()\n{\n // load shaders\n ResourceManager::LoadShader(\"shaders/sprite.vs\", \"shaders/sprite.frag\", nullptr, \"sprite\");\n ResourceManager::LoadShader(\"shaders/particle.vs\", \"shaders/particle.frag\", nullptr, \"particle\");\n ResourceManager::LoadShader(\"shaders/post_processing.vs\", \"shaders/post_processing.frag\", nullptr, \"postprocessing\");\n // configure shaders\n glm::mat4 projection = glm::ortho(0.0f, static_cast(this->Width), \n static_cast(this->Height), 0.0f, -1.0f, 1.0f);\n ResourceManager::GetShader(\"sprite\").Use().SetInteger(\"image\", 0);\n ResourceManager::GetShader(\"sprite\").SetMatrix4(\"projection\", projection);\n ResourceManager::GetShader(\"particle\").Use().SetInteger(\"sprite\", 0);\n ResourceManager::GetShader(\"particle\").SetMatrix4(\"projection\", projection); \n // load textures\n ResourceManager::LoadTexture(\"textures/background.jpg\", false, \"background\");\n ResourceManager::LoadTexture(\"textures/awesomeface.png\", true, \"face\");\n ResourceManager::LoadTexture(\"textures/block.png\", false, \"block\");\n ResourceManager::LoadTexture(\"textures/block_solid.png\", false, \"block_solid\");\n ResourceManager::LoadTexture(\"textures/paddle.png\", true, \"paddle\");\n ResourceManager::LoadTexture(\"textures/particle.png\", true, \"particle\");\n ResourceManager::LoadTexture(\"textures/powerup_speed.png\", true, \"powerup_speed\");\n ResourceManager::LoadTexture(\"textures/powerup_sticky.png\", true, \"powerup_sticky\");\n ResourceManager::LoadTexture(\"textures/powerup_increase.png\", true, \"powerup_increase\");\n ResourceManager::LoadTexture(\"textures/powerup_confuse.png\", true, \"powerup_confuse\");\n ResourceManager::LoadTexture(\"textures/powerup_chaos.png\", true, \"powerup_chaos\");\n ResourceManager::LoadTexture(\"textures/powerup_passthrough.png\", true, \"powerup_passthrough\");\n // set render-specific controls\n Renderer = new SpriteRenderer(ResourceManager::GetShader(\"sprite\"));\n Particles = new ParticleGenerator(ResourceManager::GetShader(\"particle\"), ResourceManager::GetTexture(\"particle\"), 500);\n Effects = new PostProcessor(ResourceManager::GetShader(\"postprocessing\"), this->Width, this->Height);\n // load levels\n GameLevel one; one.Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n GameLevel two; two.Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n GameLevel three; three.Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n GameLevel four; four.Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n this->Levels.push_back(one);\n this->Levels.push_back(two);\n this->Levels.push_back(three);\n this->Levels.push_back(four);\n this->Level = 0;\n // configure game objects\n glm::vec2 playerPos = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Player = new GameObject(playerPos, PLAYER_SIZE, ResourceManager::GetTexture(\"paddle\"));\n glm::vec2 ballPos = playerPos + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -BALL_RADIUS * 2.0f);\n Ball = new BallObject(ballPos, BALL_RADIUS, INITIAL_BALL_VELOCITY, ResourceManager::GetTexture(\"face\"));\n}\n\nvoid Game::Update(float dt)\n{\n // update objects\n Ball->Move(dt, this->Width);\n // check for collisions\n this->DoCollisions();\n // update particles\n Particles->Update(dt, *Ball, 2, glm::vec2(Ball->Radius / 2.0f));\n // update PowerUps\n this->UpdatePowerUps(dt);\n // reduce shake time\n if (ShakeTime > 0.0f)\n {\n ShakeTime -= dt;\n if (ShakeTime <= 0.0f)\n Effects->Shake = false;\n }\n // check loss condition\n if (Ball->Position.y >= this->Height) // did ball reach bottom edge?\n {\n this->ResetLevel();\n this->ResetPlayer();\n }\n}\n\nvoid Game::ProcessInput(float dt)\n{\n if (this->State == GAME_ACTIVE)\n {\n float velocity = PLAYER_VELOCITY * dt;\n // move playerboard\n if (this->Keys[GLFW_KEY_A])\n {\n if (Player->Position.x >= 0.0f)\n {\n Player->Position.x -= velocity;\n if (Ball->Stuck)\n Ball->Position.x -= velocity;\n }\n }\n if (this->Keys[GLFW_KEY_D])\n {\n if (Player->Position.x <= this->Width - Player->Size.x)\n {\n Player->Position.x += velocity;\n if (Ball->Stuck)\n Ball->Position.x += velocity;\n }\n }\n if (this->Keys[GLFW_KEY_SPACE])\n Ball->Stuck = false;\n }\n}\n\nvoid Game::Render()\n{\n if(this->State == GAME_ACTIVE)\n {\n // begin rendering to postprocessing framebuffer\n Effects->BeginRender();\n // draw background\n Renderer->DrawSprite(ResourceManager::GetTexture(\"background\"), glm::vec2(0.0f, 0.0f), glm::vec2(this->Width, this->Height), 0.0f);\n // draw level\n this->Levels[this->Level].Draw(*Renderer);\n // draw player\n Player->Draw(*Renderer);\n // draw PowerUps\n for (PowerUp &powerUp : this->PowerUps)\n if (!powerUp.Destroyed)\n powerUp.Draw(*Renderer); \n // draw particles\t\n Particles->Draw();\n // draw ball\n Ball->Draw(*Renderer); \n // end rendering to postprocessing framebuffer\n Effects->EndRender();\n // render postprocessing quad\n Effects->Render(glfwGetTime());\n }\n}\n\n\nvoid Game::ResetLevel()\n{\n if (this->Level == 0)\n this->Levels[0].Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 1)\n this->Levels[1].Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 2)\n this->Levels[2].Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 3)\n this->Levels[3].Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n}\n\nvoid Game::ResetPlayer()\n{\n // reset player/ball stats\n Player->Size = PLAYER_SIZE;\n Player->Position = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Ball->Reset(Player->Position + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -(BALL_RADIUS * 2.0f)), INITIAL_BALL_VELOCITY);\n // also disable all active powerups\n Effects->Chaos = Effects->Confuse = false;\n Ball->PassThrough = Ball->Sticky = false;\n Player->Color = glm::vec3(1.0f);\n Ball->Color = glm::vec3(1.0f);\n}\n\n// powerups\nbool IsOtherPowerUpActive(std::vector &powerUps, std::string type);\n\nvoid Game::UpdatePowerUps(float dt)\n{\n for (PowerUp &powerUp : this->PowerUps)\n {\n powerUp.Position += powerUp.Velocity * dt;\n if (powerUp.Activated)\n {\n powerUp.Duration -= dt;\n\n if (powerUp.Duration <= 0.0f)\n {\n // remove powerup from list (will later be removed)\n powerUp.Activated = false;\n // deactivate effects\n if (powerUp.Type == \"sticky\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"sticky\"))\n {\t// only reset if no other PowerUp of type sticky is active\n Ball->Sticky = false;\n Player->Color = glm::vec3(1.0f);\n }\n }\n else if (powerUp.Type == \"pass-through\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"pass-through\"))\n {\t// only reset if no other PowerUp of type pass-through is active\n Ball->PassThrough = false;\n Ball->Color = glm::vec3(1.0f);\n }\n }\n else if (powerUp.Type == \"confuse\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"confuse\"))\n {\t// only reset if no other PowerUp of type confuse is active\n Effects->Confuse = false;\n }\n }\n else if (powerUp.Type == \"chaos\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"chaos\"))\n {\t// only reset if no other PowerUp of type chaos is active\n Effects->Chaos = false;\n }\n }\n }\n }\n }\n // Remove all PowerUps from vector that are destroyed AND !activated (thus either off the map or finished)\n // Note we use a lambda expression to remove each PowerUp which is destroyed and not activated\n this->PowerUps.erase(std::remove_if(this->PowerUps.begin(), this->PowerUps.end(),\n [](const PowerUp &powerUp) { return powerUp.Destroyed && !powerUp.Activated; }\n ), this->PowerUps.end());\n}\n\nbool ShouldSpawn(unsigned int chance)\n{\n unsigned int random = rand() % chance;\n return random == 0;\n}\nvoid Game::SpawnPowerUps(GameObject &block)\n{\n if (ShouldSpawn(75)) // 1 in 75 chance\n this->PowerUps.push_back(PowerUp(\"speed\", glm::vec3(0.5f, 0.5f, 1.0f), 0.0f, block.Position, ResourceManager::GetTexture(\"powerup_speed\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"sticky\", glm::vec3(1.0f, 0.5f, 1.0f), 20.0f, block.Position, ResourceManager::GetTexture(\"powerup_sticky\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"pass-through\", glm::vec3(0.5f, 1.0f, 0.5f), 10.0f, block.Position, ResourceManager::GetTexture(\"powerup_passthrough\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"pad-size-increase\", glm::vec3(1.0f, 0.6f, 0.4), 0.0f, block.Position, ResourceManager::GetTexture(\"powerup_increase\")));\n if (ShouldSpawn(15)) // Negative powerups should spawn more often\n this->PowerUps.push_back(PowerUp(\"confuse\", glm::vec3(1.0f, 0.3f, 0.3f), 15.0f, block.Position, ResourceManager::GetTexture(\"powerup_confuse\")));\n if (ShouldSpawn(15))\n this->PowerUps.push_back(PowerUp(\"chaos\", glm::vec3(0.9f, 0.25f, 0.25f), 15.0f, block.Position, ResourceManager::GetTexture(\"powerup_chaos\")));\n}\n\nvoid ActivatePowerUp(PowerUp &powerUp)\n{\n if (powerUp.Type == \"speed\")\n {\n Ball->Velocity *= 1.2;\n }\n else if (powerUp.Type == \"sticky\")\n {\n Ball->Sticky = true;\n Player->Color = glm::vec3(1.0f, 0.5f, 1.0f);\n }\n else if (powerUp.Type == \"pass-through\")\n {\n Ball->PassThrough = true;\n Ball->Color = glm::vec3(1.0f, 0.5f, 0.5f);\n }\n else if (powerUp.Type == \"pad-size-increase\")\n {\n Player->Size.x += 50;\n }\n else if (powerUp.Type == \"confuse\")\n {\n if (!Effects->Chaos)\n Effects->Confuse = true; // only activate if chaos wasn't already active\n }\n else if (powerUp.Type == \"chaos\")\n {\n if (!Effects->Confuse)\n Effects->Chaos = true;\n }\n}\n\nbool IsOtherPowerUpActive(std::vector &powerUps, std::string type)\n{\n // Check if another PowerUp of the same type is still active\n // in which case we don't disable its effect (yet)\n for (const PowerUp &powerUp : powerUps)\n {\n if (powerUp.Activated)\n if (powerUp.Type == type)\n return true;\n }\n return false;\n}\n\n// collision detection\nbool CheckCollision(GameObject &one, GameObject &two);\nCollision CheckCollision(BallObject &one, GameObject &two);\nDirection VectorDirection(glm::vec2 closest);\n\nvoid Game::DoCollisions()\n{\n for (GameObject &box : this->Levels[this->Level].Bricks)\n {\n if (!box.Destroyed)\n {\n Collision collision = CheckCollision(*Ball, box);\n if (std::get<0>(collision)) // if collision is true\n {\n // destroy block if not solid\n if (!box.IsSolid)\n {\n box.Destroyed = true;\n this->SpawnPowerUps(box);\n }\n else\n { // if block is solid, enable shake effect\n ShakeTime = 0.05f;\n Effects->Shake = true;\n }\n // collision resolution\n Direction dir = std::get<1>(collision);\n glm::vec2 diff_vector = std::get<2>(collision);\n if (!(Ball->PassThrough && !box.IsSolid)) // don't do collision resolution on non-solid bricks if pass-through is activated\n {\n if (dir == LEFT || dir == RIGHT) // horizontal collision\n {\n Ball->Velocity.x = -Ball->Velocity.x; // reverse horizontal velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.x);\n if (dir == LEFT)\n Ball->Position.x += penetration; // move ball to right\n else\n Ball->Position.x -= penetration; // move ball to left;\n }\n else // vertical collision\n {\n Ball->Velocity.y = -Ball->Velocity.y; // reverse vertical velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.y);\n if (dir == UP)\n Ball->Position.y -= penetration; // move ball bback up\n else\n Ball->Position.y += penetration; // move ball back down\n }\n }\n }\n } \n }\n \n // also check collisions on PowerUps and if so, activate them\n for (PowerUp &powerUp : this->PowerUps)\n {\n if (!powerUp.Destroyed)\n {\n // first check if powerup passed bottom edge, if so: keep as inactive and destroy\n if (powerUp.Position.y >= this->Height)\n powerUp.Destroyed = true;\n\n if (CheckCollision(*Player, powerUp))\n {\t// collided with player, now activate powerup\n ActivatePowerUp(powerUp);\n powerUp.Destroyed = true;\n powerUp.Activated = true;\n }\n }\n }\n \n // and finally check collisions for player pad (unless stuck)\n Collision result = CheckCollision(*Ball, *Player);\n if (!Ball->Stuck && std::get<0>(result))\n {\n // check where it hit the board, and change velocity based on where it hit the board\n float centerBoard = Player->Position.x + Player->Size.x / 2.0f;\n float distance = (Ball->Position.x + Ball->Radius) - centerBoard;\n float percentage = distance / (Player->Size.x / 2.0f);\n // then move accordingly\n float strength = 2.0f;\n glm::vec2 oldVelocity = Ball->Velocity;\n Ball->Velocity.x = INITIAL_BALL_VELOCITY.x * percentage * strength; \n //Ball->Velocity.y = -Ball->Velocity.y;\n Ball->Velocity = glm::normalize(Ball->Velocity) * glm::length(oldVelocity); // keep speed consistent over both axes (multiply by length of old velocity, so total strength is not changed)\n // fix sticky paddle\n Ball->Velocity.y = -1.0f * abs(Ball->Velocity.y);\n \n // if Sticky powerup is activated, also stick ball to paddle once new velocity vectors were calculated\n Ball->Stuck = Ball->Sticky;\n }\n}\n\nbool CheckCollision(GameObject &one, GameObject &two) // AABB - AABB collision\n{\n // collision x-axis?\n bool collisionX = one.Position.x + one.Size.x >= two.Position.x &&\n two.Position.x + two.Size.x >= one.Position.x;\n // collision y-axis?\n bool collisionY = one.Position.y + one.Size.y >= two.Position.y &&\n two.Position.y + two.Size.y >= one.Position.y;\n // collision only if on both axes\n return collisionX && collisionY;\n}\n\nCollision CheckCollision(BallObject &one, GameObject &two) // AABB - Circle collision\n{\n // get center point circle first \n glm::vec2 center(one.Position + one.Radius);\n // calculate AABB info (center, half-extents)\n glm::vec2 aabb_half_extents(two.Size.x / 2.0f, two.Size.y / 2.0f);\n glm::vec2 aabb_center(two.Position.x + aabb_half_extents.x, two.Position.y + aabb_half_extents.y);\n // get difference vector between both centers\n glm::vec2 difference = center - aabb_center;\n glm::vec2 clamped = glm::clamp(difference, -aabb_half_extents, aabb_half_extents);\n // now that we know the clamped values, add this to AABB_center and we get the value of box closest to circle\n glm::vec2 closest = aabb_center + clamped;\n // now retrieve vector between center circle and closest point AABB and check if length < radius\n difference = closest - center;\n\n if (glm::length(difference) < one.Radius) // not <= since in that case a collision also occurs when object one exactly touches object two, which they are at the end of each collision resolution stage.\n return std::make_tuple(true, VectorDirection(difference), difference);\n else\n return std::make_tuple(false, UP, glm::vec2(0.0f, 0.0f));\n}\n\n// calculates which direction a vector is facing (N,E,S or W)\nDirection VectorDirection(glm::vec2 target)\n{\n glm::vec2 compass[] = {\n glm::vec2(0.0f, 1.0f),\t// up\n glm::vec2(1.0f, 0.0f),\t// right\n glm::vec2(0.0f, -1.0f),\t// down\n glm::vec2(-1.0f, 0.0f)\t// left\n };\n float max = 0.0f;\n unsigned int best_match = -1;\n for (unsigned int i = 0; i < 4; i++)\n {\n float dot_product = glm::dot(glm::normalize(target), compass[i]);\n if (dot_product > max)\n {\n max = dot_product;\n best_match = i;\n }\n }\n return (Direction)best_match;\n}"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/8.game.h", "language": "code", "loc": 68, "comment_density": 0.368, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#ifndef GAME_H\n#define GAME_H\n\n#include \n#include \n\n#include \"game_level.h\"\n#include \"power_up.h\"\n\n// Represents the current state of the game\nenum GameState {\n GAME_ACTIVE,\n GAME_MENU,\n GAME_WIN\n};\n\n// Represents the four possible (collision) directions\nenum Direction {\n UP,\n RIGHT,\n DOWN,\n LEFT\n};\n// Defines a Collision typedef that represents collision data\ntypedef std::tuple Collision; // \n\n// Initial size of the player paddle\nconst glm::vec2 PLAYER_SIZE(100.0f, 20.0f);\n// Initial velocity of the player paddle\nconst float PLAYER_VELOCITY(500.0f);\n// Initial velocity of the Ball\nconst glm::vec2 INITIAL_BALL_VELOCITY(100.0f, -350.0f);\n// Radius of the ball object\nconst float BALL_RADIUS = 12.5f;\n\n// Game holds all game-related state and functionality.\n// Combines all game-related data into a single class for\n// easy access to each of the components and manageability.\nclass Game\n{\npublic:\n // game state\n GameState State;\t\n bool Keys[1024];\n unsigned int Width, Height;\n std::vector Levels;\n std::vector PowerUps;\n unsigned int Level;\n // constructor/destructor\n Game(unsigned int width, unsigned int height);\n ~Game();\n // initialize game state (load all shaders/textures/levels)\n void Init();\n // game loop\n void ProcessInput(float dt);\n void Update(float dt);\n void Render();\n void DoCollisions();\n // reset\n void ResetLevel();\n void ResetPlayer();\n // powerups\n void SpawnPowerUps(GameObject &block);\n void UpdatePowerUps(float dt);\n};\n\n#endif"}, {"path": "src/7.in_practice/3.2d_game/0.full_source/progress/9.game.cpp", "language": "code", "loc": 450, "comment_density": 0.202, "code": "/*******************************************************************\n** This code is part of Breakout.\n**\n** Breakout is free software: you can redistribute it and/or modify\n** it under the terms of the CC BY 4.0 license as published by\n** Creative Commons, either version 4 of the License, or (at your\n** option) any later version.\n******************************************************************/\n#include \n\n#include \nusing namespace irrklang;\n\n#include \"game.h\"\n#include \"resource_manager.h\"\n#include \"sprite_renderer.h\"\n#include \"game_object.h\"\n#include \"ball_object.h\"\n#include \"particle_generator.h\"\n#include \"post_processor.h\"\n\n// Game-related State data\nSpriteRenderer *Renderer;\nGameObject *Player;\nBallObject *Ball;\nParticleGenerator *Particles;\nPostProcessor *Effects;\nISoundEngine *SoundEngine = createIrrKlangDevice();\n\nfloat ShakeTime = 0.0f;\n\nGame::Game(unsigned int width, unsigned int height) \n : State(GAME_ACTIVE), Keys(), Width(width), Height(height)\n{ \n\n}\n\nGame::~Game()\n{\n delete Renderer;\n delete Player;\n delete Ball;\n delete Particles;\n delete Effects;\n SoundEngine->drop();\n}\n\nvoid Game::Init()\n{\n // load shaders\n ResourceManager::LoadShader(\"shaders/sprite.vs\", \"shaders/sprite.frag\", nullptr, \"sprite\");\n ResourceManager::LoadShader(\"shaders/particle.vs\", \"shaders/particle.frag\", nullptr, \"particle\");\n ResourceManager::LoadShader(\"shaders/post_processing.vs\", \"shaders/post_processing.frag\", nullptr, \"postprocessing\");\n // configure shaders\n glm::mat4 projection = glm::ortho(0.0f, static_cast(this->Width), \n static_cast(this->Height), 0.0f, -1.0f, 1.0f);\n ResourceManager::GetShader(\"sprite\").Use().SetInteger(\"image\", 0);\n ResourceManager::GetShader(\"sprite\").SetMatrix4(\"projection\", projection);\n ResourceManager::GetShader(\"particle\").Use().SetInteger(\"sprite\", 0);\n ResourceManager::GetShader(\"particle\").SetMatrix4(\"projection\", projection); \n // load textures\n ResourceManager::LoadTexture(\"textures/background.jpg\", false, \"background\");\n ResourceManager::LoadTexture(\"textures/awesomeface.png\", true, \"face\");\n ResourceManager::LoadTexture(\"textures/block.png\", false, \"block\");\n ResourceManager::LoadTexture(\"textures/block_solid.png\", false, \"block_solid\");\n ResourceManager::LoadTexture(\"textures/paddle.png\", true, \"paddle\");\n ResourceManager::LoadTexture(\"textures/particle.png\", true, \"particle\");\n ResourceManager::LoadTexture(\"textures/powerup_speed.png\", true, \"powerup_speed\");\n ResourceManager::LoadTexture(\"textures/powerup_sticky.png\", true, \"powerup_sticky\");\n ResourceManager::LoadTexture(\"textures/powerup_increase.png\", true, \"powerup_increase\");\n ResourceManager::LoadTexture(\"textures/powerup_confuse.png\", true, \"powerup_confuse\");\n ResourceManager::LoadTexture(\"textures/powerup_chaos.png\", true, \"powerup_chaos\");\n ResourceManager::LoadTexture(\"textures/powerup_passthrough.png\", true, \"powerup_passthrough\");\n // set render-specific controls\n Renderer = new SpriteRenderer(ResourceManager::GetShader(\"sprite\"));\n Particles = new ParticleGenerator(ResourceManager::GetShader(\"particle\"), ResourceManager::GetTexture(\"particle\"), 500);\n Effects = new PostProcessor(ResourceManager::GetShader(\"postprocessing\"), this->Width, this->Height);\n // load levels\n GameLevel one; one.Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n GameLevel two; two.Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n GameLevel three; three.Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n GameLevel four; four.Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n this->Levels.push_back(one);\n this->Levels.push_back(two);\n this->Levels.push_back(three);\n this->Levels.push_back(four);\n this->Level = 0;\n // configure game objects\n glm::vec2 playerPos = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Player = new GameObject(playerPos, PLAYER_SIZE, ResourceManager::GetTexture(\"paddle\"));\n glm::vec2 ballPos = playerPos + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -BALL_RADIUS * 2.0f);\n Ball = new BallObject(ballPos, BALL_RADIUS, INITIAL_BALL_VELOCITY, ResourceManager::GetTexture(\"face\"));\n // audio\n SoundEngine->play2D(\"audio/breakout.mp3\", true);\n}\n\nvoid Game::Update(float dt)\n{\n // update objects\n Ball->Move(dt, this->Width);\n // check for collisions\n this->DoCollisions();\n // update particles\n Particles->Update(dt, *Ball, 2, glm::vec2(Ball->Radius / 2.0f));\n // update PowerUps\n this->UpdatePowerUps(dt);\n // reduce shake time\n if (ShakeTime > 0.0f)\n {\n ShakeTime -= dt;\n if (ShakeTime <= 0.0f)\n Effects->Shake = false;\n }\n // check loss condition\n if (Ball->Position.y >= this->Height) // did ball reach bottom edge?\n {\n this->ResetLevel();\n this->ResetPlayer();\n }\n}\n\nvoid Game::ProcessInput(float dt)\n{\n if (this->State == GAME_ACTIVE)\n {\n float velocity = PLAYER_VELOCITY * dt;\n // move playerboard\n if (this->Keys[GLFW_KEY_A])\n {\n if (Player->Position.x >= 0.0f)\n {\n Player->Position.x -= velocity;\n if (Ball->Stuck)\n Ball->Position.x -= velocity;\n }\n }\n if (this->Keys[GLFW_KEY_D])\n {\n if (Player->Position.x <= this->Width - Player->Size.x)\n {\n Player->Position.x += velocity;\n if (Ball->Stuck)\n Ball->Position.x += velocity;\n }\n }\n if (this->Keys[GLFW_KEY_SPACE])\n Ball->Stuck = false;\n }\n}\n\nvoid Game::Render()\n{\n if(this->State == GAME_ACTIVE)\n {\n // begin rendering to postprocessing framebuffer\n Effects->BeginRender();\n // draw background\n Renderer->DrawSprite(ResourceManager::GetTexture(\"background\"), glm::vec2(0.0f, 0.0f), glm::vec2(this->Width, this->Height), 0.0f);\n // draw level\n this->Levels[this->Level].Draw(*Renderer);\n // draw player\n Player->Draw(*Renderer);\n // draw PowerUps\n for (PowerUp &powerUp : this->PowerUps)\n if (!powerUp.Destroyed)\n powerUp.Draw(*Renderer); \n // draw particles\t\n Particles->Draw();\n // draw ball\n Ball->Draw(*Renderer); \n // end rendering to postprocessing framebuffer\n Effects->EndRender();\n // render postprocessing quad\n Effects->Render(glfwGetTime());\n }\n}\n\n\nvoid Game::ResetLevel()\n{\n if (this->Level == 0)\n this->Levels[0].Load(\"levels/one.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 1)\n this->Levels[1].Load(\"levels/two.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 2)\n this->Levels[2].Load(\"levels/three.lvl\", this->Width, this->Height / 2);\n else if (this->Level == 3)\n this->Levels[3].Load(\"levels/four.lvl\", this->Width, this->Height / 2);\n}\n\nvoid Game::ResetPlayer()\n{\n // reset player/ball stats\n Player->Size = PLAYER_SIZE;\n Player->Position = glm::vec2(this->Width / 2.0f - PLAYER_SIZE.x / 2.0f, this->Height - PLAYER_SIZE.y);\n Ball->Reset(Player->Position + glm::vec2(PLAYER_SIZE.x / 2.0f - BALL_RADIUS, -(BALL_RADIUS * 2.0f)), INITIAL_BALL_VELOCITY);\n // also disable all active powerups\n Effects->Chaos = Effects->Confuse = false;\n Ball->PassThrough = Ball->Sticky = false;\n Player->Color = glm::vec3(1.0f);\n Ball->Color = glm::vec3(1.0f);\n}\n\n// powerups\nbool IsOtherPowerUpActive(std::vector &powerUps, std::string type);\n\nvoid Game::UpdatePowerUps(float dt)\n{\n for (PowerUp &powerUp : this->PowerUps)\n {\n powerUp.Position += powerUp.Velocity * dt;\n if (powerUp.Activated)\n {\n powerUp.Duration -= dt;\n\n if (powerUp.Duration <= 0.0f)\n {\n // remove powerup from list (will later be removed)\n powerUp.Activated = false;\n // deactivate effects\n if (powerUp.Type == \"sticky\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"sticky\"))\n {\t// only reset if no other PowerUp of type sticky is active\n Ball->Sticky = false;\n Player->Color = glm::vec3(1.0f);\n }\n }\n else if (powerUp.Type == \"pass-through\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"pass-through\"))\n {\t// only reset if no other PowerUp of type pass-through is active\n Ball->PassThrough = false;\n Ball->Color = glm::vec3(1.0f);\n }\n }\n else if (powerUp.Type == \"confuse\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"confuse\"))\n {\t// only reset if no other PowerUp of type confuse is active\n Effects->Confuse = false;\n }\n }\n else if (powerUp.Type == \"chaos\")\n {\n if (!IsOtherPowerUpActive(this->PowerUps, \"chaos\"))\n {\t// only reset if no other PowerUp of type chaos is active\n Effects->Chaos = false;\n }\n }\n }\n }\n }\n // Remove all PowerUps from vector that are destroyed AND !activated (thus either off the map or finished)\n // Note we use a lambda expression to remove each PowerUp which is destroyed and not activated\n this->PowerUps.erase(std::remove_if(this->PowerUps.begin(), this->PowerUps.end(),\n [](const PowerUp &powerUp) { return powerUp.Destroyed && !powerUp.Activated; }\n ), this->PowerUps.end());\n}\n\nbool ShouldSpawn(unsigned int chance)\n{\n unsigned int random = rand() % chance;\n return random == 0;\n}\nvoid Game::SpawnPowerUps(GameObject &block)\n{\n if (ShouldSpawn(75)) // 1 in 75 chance\n this->PowerUps.push_back(PowerUp(\"speed\", glm::vec3(0.5f, 0.5f, 1.0f), 0.0f, block.Position, ResourceManager::GetTexture(\"powerup_speed\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"sticky\", glm::vec3(1.0f, 0.5f, 1.0f), 20.0f, block.Position, ResourceManager::GetTexture(\"powerup_sticky\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"pass-through\", glm::vec3(0.5f, 1.0f, 0.5f), 10.0f, block.Position, ResourceManager::GetTexture(\"powerup_passthrough\")));\n if (ShouldSpawn(75))\n this->PowerUps.push_back(PowerUp(\"pad-size-increase\", glm::vec3(1.0f, 0.6f, 0.4), 0.0f, block.Position, ResourceManager::GetTexture(\"powerup_increase\")));\n if (ShouldSpawn(15)) // Negative powerups should spawn more often\n this->PowerUps.push_back(PowerUp(\"confuse\", glm::vec3(1.0f, 0.3f, 0.3f), 15.0f, block.Position, ResourceManager::GetTexture(\"powerup_confuse\")));\n if (ShouldSpawn(15))\n this->PowerUps.push_back(PowerUp(\"chaos\", glm::vec3(0.9f, 0.25f, 0.25f), 15.0f, block.Position, ResourceManager::GetTexture(\"powerup_chaos\")));\n}\n\nvoid ActivatePowerUp(PowerUp &powerUp)\n{\n if (powerUp.Type == \"speed\")\n {\n Ball->Velocity *= 1.2;\n }\n else if (powerUp.Type == \"sticky\")\n {\n Ball->Sticky = true;\n Player->Color = glm::vec3(1.0f, 0.5f, 1.0f);\n }\n else if (powerUp.Type == \"pass-through\")\n {\n Ball->PassThrough = true;\n Ball->Color = glm::vec3(1.0f, 0.5f, 0.5f);\n }\n else if (powerUp.Type == \"pad-size-increase\")\n {\n Player->Size.x += 50;\n }\n else if (powerUp.Type == \"confuse\")\n {\n if (!Effects->Chaos)\n Effects->Confuse = true; // only activate if chaos wasn't already active\n }\n else if (powerUp.Type == \"chaos\")\n {\n if (!Effects->Confuse)\n Effects->Chaos = true;\n }\n}\n\nbool IsOtherPowerUpActive(std::vector &powerUps, std::string type)\n{\n // Check if another PowerUp of the same type is still active\n // in which case we don't disable its effect (yet)\n for (const PowerUp &powerUp : powerUps)\n {\n if (powerUp.Activated)\n if (powerUp.Type == type)\n return true;\n }\n return false;\n}\n\n// collision detection\nbool CheckCollision(GameObject &one, GameObject &two);\nCollision CheckCollision(BallObject &one, GameObject &two);\nDirection VectorDirection(glm::vec2 closest);\n\nvoid Game::DoCollisions()\n{\n for (GameObject &box : this->Levels[this->Level].Bricks)\n {\n if (!box.Destroyed)\n {\n Collision collision = CheckCollision(*Ball, box);\n if (std::get<0>(collision)) // if collision is true\n {\n // destroy block if not solid\n if (!box.IsSolid)\n {\n box.Destroyed = true;\n this->SpawnPowerUps(box);\n SoundEngine->play2D(\"audio/bleep.mp3\", false);\n }\n else\n { // if block is solid, enable shake effect\n ShakeTime = 0.05f;\n Effects->Shake = true;\n SoundEngine->play2D(\"audio/solid.wav\", false);\n }\n // collision resolution\n Direction dir = std::get<1>(collision);\n glm::vec2 diff_vector = std::get<2>(collision);\n if (!(Ball->PassThrough && !box.IsSolid)) // don't do collision resolution on non-solid bricks if pass-through is activated\n {\n if (dir == LEFT || dir == RIGHT) // horizontal collision\n {\n Ball->Velocity.x = -Ball->Velocity.x; // reverse horizontal velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.x);\n if (dir == LEFT)\n Ball->Position.x += penetration; // move ball to right\n else\n Ball->Position.x -= penetration; // move ball to left;\n }\n else // vertical collision\n {\n Ball->Velocity.y = -Ball->Velocity.y; // reverse vertical velocity\n // relocate\n float penetration = Ball->Radius - std::abs(diff_vector.y);\n if (dir == UP)\n Ball->Position.y -= penetration; // move ball bback up\n else\n Ball->Position.y += penetration; // move ball back down\n }\n }\n }\n } \n }\n \n // also check collisions on PowerUps and if so, activate them\n for (PowerUp &powerUp : this->PowerUps)\n {\n if (!powerUp.Destroyed)\n {\n // first check if powerup passed bottom edge, if so: keep as inactive and destroy\n if (powerUp.Position.y >= this->Height)\n powerUp.Destroyed = true;\n\n if (CheckCollision(*Player, powerUp))\n {\t// collided with player, now activate powerup\n ActivatePowerUp(powerUp);\n powerUp.Destroyed = true;\n powerUp.Activated = true;\n SoundEngine->play2D(\"audio/powerup.wav\", false);\n }\n }\n }\n \n // and finally check collisions for player pad (unless stuck)\n Collision result = CheckCollision(*Ball, *Player);\n if (!Ball->Stuck && std::get<0>(result))\n {\n // check where it hit the board, and change velocity based on where it hit the board\n float centerBoard = Player->Position.x + Player->Size.x / 2.0f;\n float distance = (Ball->Position.x + Ball->Radius) - centerBoard;\n float percentage = distance / (Player->Size.x / 2.0f);\n // then move accordingly\n float strength = 2.0f;\n glm::vec2 oldVelocity = Ball->Velocity;\n Ball->Velocity.x = INITIAL_BALL_VELOCITY.x * percentage * strength; \n //Ball->Velocity.y = -Ball->Velocity.y;\n Ball->Velocity = glm::normalize(Ball->Velocity) * glm::length(oldVelocity); // keep speed consistent over both axes (multiply by length of old velocity, so total strength is not changed)\n // fix sticky paddle\n Ball->Velocity.y = -1.0f * abs(Ball->Velocity.y);\n \n // if Sticky powerup is activated, also stick ball to paddle once new velocity vectors were calculated\n Ball->Stuck = Ball->Sticky;\n \n SoundEngine->play2D(\"audio/bleep.wav\", false);\n }\n}\n\nbool CheckCollision(GameObject &one, GameObject &two) // AABB - AABB collision\n{\n // collision x-axis?\n bool collisionX = one.Position.x + one.Size.x >= two.Position.x &&\n two.Position.x + two.Size.x >= one.Position.x;\n // collision y-axis?\n bool collisionY = one.Position.y + one.Size.y >= two.Position.y &&\n two.Position.y + two.Size.y >= one.Position.y;\n // collision only if on both axes\n return collisionX && collisionY;\n}\n\nCollision CheckCollision(BallObject &one, GameObject &two) // AABB - Circle collision\n{\n // get center point circle first \n glm::vec2 center(one.Position + one.Radius);\n // calculate AABB info (center, half-extents)\n glm::vec2 aabb_half_extents(two.Size.x / 2.0f, two.Size.y / 2.0f);\n glm::vec2 aabb_center(two.Position.x + aabb_half_extents.x, two.Position.y + aabb_half_extents.y);\n // get difference vector between both centers\n glm::vec2 difference = center - aabb_center;\n glm::vec2 clamped = glm::clamp(difference, -aabb_half_extents, aabb_half_extents);\n // now that we know the clamped values, add this to AABB_center and we get the value of box closest to circle\n glm::vec2 closest = aabb_center + clamped;\n // now retrieve vector between center circle and closest point AABB and check if length < radius\n difference = closest - center;\n\n if (glm::length(difference) < one.Radius) // not <= since in that case a collision also occurs when object one exactly touches object two, which they are at the end of each collision resolution stage.\n return std::make_tuple(true, VectorDirection(difference), difference);\n else\n return std::make_tuple(false, UP, glm::vec2(0.0f, 0.0f));\n}\n\n// calculates which direction a vector is facing (N,E,S or W)\nDirection VectorDirection(glm::vec2 target)\n{\n glm::vec2 compass[] = {\n glm::vec2(0.0f, 1.0f),\t// up\n glm::vec2(1.0f, 0.0f),\t// right\n glm::vec2(0.0f, -1.0f),\t// down\n glm::vec2(-1.0f, 0.0f)\t// left\n };\n float max = 0.0f;\n unsigned int best_match = -1;\n for (unsigned int i = 0; i < 4; i++)\n {\n float dot_product = glm::dot(glm::normalize(target), compass[i]);\n if (dot_product > max)\n {\n max = dot_product;\n best_match = i;\n }\n }\n return (Direction)best_match;\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.303, "dedup_hash": "151a79b256acffaa", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2020_oit", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:24+00:00", "source_type": "repo", "title": "Oit", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/8.guest/2020/oit/composite.fs", "language": "glsl", "loc": 38, "comment_density": 0.342, "code": "#version 420 core\n\n// shader outputs\nlayout (location = 0) out vec4 frag;\n\n// color accumulation buffer\nlayout (binding = 0) uniform sampler2D accum;\n\n// revealage threshold buffer\nlayout (binding = 1) uniform sampler2D reveal;\n\n// epsilon number\nconst float EPSILON = 0.00001f;\n\n// calculate floating point numbers equality accurately\nbool isApproximatelyEqual(float a, float b)\n{\n\treturn abs(a - b) <= (abs(a) < abs(b) ? abs(b) : abs(a)) * EPSILON;\n}\n\n// get the max value between three values\nfloat max3(vec3 v) \n{\n\treturn max(max(v.x, v.y), v.z);\n}\n\nvoid main()\n{\n\t// fragment coordination\n\tivec2 coords = ivec2(gl_FragCoord.xy);\n\t\n\t// fragment revealage\n\tfloat revealage = texelFetch(reveal, coords, 0).r;\n\t\n\t// save the blending and color texture fetch cost if there is not a transparent fragment\n\tif (isApproximatelyEqual(revealage, 1.0f)) \n\t\tdiscard;\n \n\t// fragment color\n\tvec4 accumulation = texelFetch(accum, coords, 0);\n\t\n\t// suppress overflow\n\tif (isinf(max3(abs(accumulation.rgb)))) \n\t\taccumulation.rgb = vec3(accumulation.a);\n\n\t// prevent floating point precision bug\n\tvec3 average_color = accumulation.rgb / max(accumulation.a, EPSILON);\n\n\t// blend pixels\n\tfrag = vec4(average_color, 1.0f - revealage);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2020/oit/composite.vs", "language": "glsl", "loc": 7, "comment_density": 0.143, "code": "#version 420 core\n\n// shader inputs\nlayout (location = 0) in vec3 position;\n\nvoid main()\n{\n\tgl_Position = vec4(position, 1.0f);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2020/oit/screen.fs", "language": "glsl", "loc": 11, "comment_density": 0.273, "code": "#version 420 core\n\n// shader inputs\nin vec2 texture_coords;\n\n// shader outputs\nlayout (location = 0) out vec4 frag;\n\n// screen image\nuniform sampler2D screen;\n\nvoid main()\n{\n\tfrag = vec4(texture(screen, texture_coords).rgb, 1.0f);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2020/oit/screen.vs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 420 core\n\n// shader inputs\nlayout (location = 0) in vec3 position;\nlayout (location = 1) in vec2 uv;\n\n// shader outputs\nout vec2 texture_coords;\n\nvoid main()\n{\n\ttexture_coords = uv;\n\n\tgl_Position = vec4(position, 1.0f);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2020/oit/solid.fs", "language": "glsl", "loc": 9, "comment_density": 0.222, "code": "#version 420 core\n\n// shader outputs\nlayout (location = 0) out vec4 frag;\n\n// material color\nuniform vec3 color;\n\nvoid main()\n{\n\tfrag = vec4(color, 1.0f);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2020/oit/solid.vs", "language": "glsl", "loc": 9, "comment_density": 0.222, "code": "#version 420 core\n\n// shader inputs\nlayout (location = 0) in vec3 position;\n\n// mvp matrix\nuniform mat4 mvp;\n\nvoid main()\n{\n\tgl_Position = mvp * vec4(position, 1.0f);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2020/oit/transparent.fs", "language": "glsl", "loc": 15, "comment_density": 0.333, "code": "#version 420 core\n\n// shader outputs\nlayout (location = 0) out vec4 accum;\nlayout (location = 1) out float reveal;\n\n// material color\nuniform vec4 color;\n\nvoid main()\n{\n\t// weight function\n\tfloat weight = clamp(pow(min(1.0, color.a * 10.0) + 0.01, 3.0) * 1e8 * pow(1.0 - gl_FragCoord.z * 0.9, 3.0), 1e-2, 3e3);\n\t\n\t// store pixel color accumulation\n\taccum = vec4(color.rgb * color.a, color.a) * weight;\n\t\n\t// store pixel revealage threshold\n\treveal = color.a;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2020/oit/transparent.vs", "language": "glsl", "loc": 9, "comment_density": 0.222, "code": "#version 420 core\n\n// shader inputs\nlayout (location = 0) in vec3 position;\n\n// model * view * projection matrix\nuniform mat4 mvp;\n\nvoid main()\n{\n\tgl_Position = mvp * vec4(position, 1.0f);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2020/oit/weighted_blended.cpp", "language": "code", "loc": 312, "comment_density": 0.247, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid process_input(GLFWwindow *window);\nglm::mat4 calculate_model_matrix(const glm::vec3& position, const glm::vec3& rotation = glm::vec3(0.0f), const glm::vec3& scale = glm::vec3(1.0f));\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 5.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main(int argc, char* argv[])\n{\n\t// glfw: initialize and configure\n\t// ------------------------------\n\tglfwInit();\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);\n\tglfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n\t#ifdef __APPLE__\n\t\tglfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n\t#endif\n\n\t// glfw window creation\n\t// --------------------\n\tGLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n\tif (window == NULL)\n\t{\n\t\tstd::cout << \"Failed to create GLFW window\" << std::endl;\n\t\tglfwTerminate();\n\t\treturn -1;\n\t}\n\tglfwMakeContextCurrent(window);\n\tglfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\tglfwSetCursorPosCallback(window, mouse_callback);\n\tglfwSetScrollCallback(window, scroll_callback);\n\n\t// tell GLFW to capture our mouse\n\tglfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n\t// glad: load all OpenGL function pointers\n\t// ---------------------------------------\n\tif (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n\t{\n\t\tstd::cout << \"Failed to initialize GLAD\" << std::endl;\n\t\treturn -1;\n\t}\n\n\t// build and compile shaders\n\t// -------------------------\n\tShader solidShader(\"solid.vs\", \"solid.fs\");\n\tShader transparentShader(\"transparent.vs\", \"transparent.fs\");\n\tShader compositeShader(\"composite.vs\", \"composite.fs\");\n\tShader screenShader(\"screen.vs\", \"screen.fs\");\n\n\t// set up vertex data (and buffer(s)) and configure vertex attributes\n\t// ------------------------------------------------------------------\n\tfloat quadVertices[] = {\n\t\t// positions\t\t// uv\n\t\t-1.0f, -1.0f, 0.0f,\t0.0f, 0.0f,\n\t\t 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n\t\t 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n\n\t\t 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n\t\t-1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n\t\t-1.0f, -1.0f, 0.0f, 0.0f, 0.0f\n\t};\n\n\t// quad VAO\n\tunsigned int quadVAO, quadVBO;\n\tglGenVertexArrays(1, &quadVAO);\n\tglGenBuffers(1, &quadVBO);\n\tglBindVertexArray(quadVAO);\n\tglBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n\tglBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), quadVertices, GL_STATIC_DRAW);\n\tglEnableVertexAttribArray(0);\n\tglVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n\tglEnableVertexAttribArray(1);\n\tglVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n\tglBindVertexArray(0);\n\n\t// set up framebuffers and their texture attachments\n\t// ------------------------------------------------------------------\n\tunsigned int opaqueFBO, transparentFBO;\n\tglGenFramebuffers(1, &opaqueFBO);\n\tglGenFramebuffers(1, &transparentFBO);\n\n\t// set up attachments for opaque framebuffer\n\tunsigned int opaqueTexture;\n\tglGenTextures(1, &opaqueTexture);\n\tglBindTexture(GL_TEXTURE_2D, opaqueTexture);\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_HALF_FLOAT, NULL);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\tglBindTexture(GL_TEXTURE_2D, 0);\n\n\tunsigned int depthTexture;\n\tglGenTextures(1, &depthTexture);\n\tglBindTexture(GL_TEXTURE_2D, depthTexture);\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SCR_WIDTH, SCR_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n\tglBindTexture(GL_TEXTURE_2D, 0);\n\n\tglBindFramebuffer(GL_FRAMEBUFFER, opaqueFBO);\n\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, opaqueTexture, 0);\n\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexture, 0);\n\t\n\tif (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n\t\tstd::cout << \"ERROR::FRAMEBUFFER:: Opaque framebuffer is not complete!\" << std::endl;\n\n\tglBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\t// set up attachments for transparent framebuffer\n\tunsigned int accumTexture;\n\tglGenTextures(1, &accumTexture);\n\tglBindTexture(GL_TEXTURE_2D, accumTexture);\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_HALF_FLOAT, NULL);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\tglBindTexture(GL_TEXTURE_2D, 0);\n\n\tunsigned int revealTexture;\n\tglGenTextures(1, &revealTexture);\n\tglBindTexture(GL_TEXTURE_2D, revealTexture);\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_R8, SCR_WIDTH, SCR_HEIGHT, 0, GL_RED, GL_FLOAT, NULL);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\tglBindTexture(GL_TEXTURE_2D, 0);\n\n\tglBindFramebuffer(GL_FRAMEBUFFER, transparentFBO);\n\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, accumTexture, 0);\n\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, revealTexture, 0);\n\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexture, 0); // opaque framebuffer's depth texture\n\n\tconst GLenum transparentDrawBuffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };\n\tglDrawBuffers(2, transparentDrawBuffers);\n\n\tif (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n\t\tstd::cout << \"ERROR::FRAMEBUFFER:: Transparent framebuffer is not complete!\" << std::endl;\n\n\tglBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\t// set up transformation matrices\n\t// ------------------------------------------------------------------\n\tglm::mat4 redModelMat = calculate_model_matrix(glm::vec3(0.0f, 0.0f, 1.0f));\n\tglm::mat4 greenModelMat = calculate_model_matrix(glm::vec3(0.0f, 0.0f, 0.0f));\n\tglm::mat4 blueModelMat = calculate_model_matrix(glm::vec3(0.0f, 0.0f, 2.0f));\n\n\t// set up intermediate variables\n\t// ------------------------------------------------------------------\n\tglm::vec4 zeroFillerVec(0.0f);\n\tglm::vec4 oneFillerVec(1.0f);\n\t\n\t// render loop\n\t// -----------\n\twhile (!glfwWindowShouldClose(window))\n\t{\n\t\t// per-frame time logic\n\t\t// --------------------\n\t\tfloat currentFrame = glfwGetTime();\n\t\tdeltaTime = currentFrame - lastFrame;\n\t\tlastFrame = currentFrame;\n\n\t\t// camera matrices\n\t\tglm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n\t\tglm::mat4 view = camera.GetViewMatrix();\n\t\tglm::mat4 vp = projection * view;\n\n\t\t// input\n\t\t// -----\n\t\tprocess_input(window);\n\n\t\t// render\n\t\t// ------\n\n\t\t// draw solid objects (solid pass)\n\t\t// ------\n\n\t\t// configure render states\n\t\tglEnable(GL_DEPTH_TEST);\n\t\tglDepthFunc(GL_LESS);\n\t\tglDepthMask(GL_TRUE);\n\t\tglDisable(GL_BLEND);\n\t\tglClearColor(0.0f, 0.0f, 0.0f, 0.0f);\n\n\t\t// bind opaque framebuffer to render solid objects\n\t\tglBindFramebuffer(GL_FRAMEBUFFER, opaqueFBO);\n\t\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n\t\t// use solid shader\n\t\tsolidShader.use();\n\n\t\t// draw red quad\n\t\tsolidShader.setMat4(\"mvp\", vp * redModelMat);\n\t\tsolidShader.setVec3(\"color\", glm::vec3(1.0f, 0.0f, 0.0f));\n\t\tglBindVertexArray(quadVAO);\n\t\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\n\t\t// draw transparent objects (transparent pass)\n\t\t// -----\n\n\t\t// configure render states\n\t\tglDepthMask(GL_FALSE);\n\t\tglEnable(GL_BLEND);\n\t\tglBlendFunci(0, GL_ONE, GL_ONE);\n\t\tglBlendFunci(1, GL_ZERO, GL_ONE_MINUS_SRC_COLOR);\n\t\tglBlendEquation(GL_FUNC_ADD);\n\n\t\t// bind transparent framebuffer to render transparent objects\n\t\tglBindFramebuffer(GL_FRAMEBUFFER, transparentFBO);\n\t\tglClearBufferfv(GL_COLOR, 0, &zeroFillerVec[0]);\n\t\tglClearBufferfv(GL_COLOR, 1, &oneFillerVec[0]);\n\n\t\t// use transparent shader\n\t\ttransparentShader.use();\n\n\t\t// draw green quad\n\t\ttransparentShader.setMat4(\"mvp\", vp * greenModelMat);\n\t\ttransparentShader.setVec4(\"color\", glm::vec4(0.0f, 1.0f, 0.0f, 0.5f));\n\t\tglBindVertexArray(quadVAO);\n\t\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\n\t\t// draw blue quad\n\t\ttransparentShader.setMat4(\"mvp\", vp * blueModelMat);\n\t\ttransparentShader.setVec4(\"color\", glm::vec4(0.0f, 0.0f, 1.0f, 0.5f));\n\t\tglBindVertexArray(quadVAO);\n\t\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\n\t\t// draw composite image (composite pass)\n\t\t// -----\n\n\t\t// set render states\n\t\tglDepthFunc(GL_ALWAYS);\n\t\tglEnable(GL_BLEND);\n\t\tglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n\t\t// bind opaque framebuffer\n\t\tglBindFramebuffer(GL_FRAMEBUFFER, opaqueFBO);\n\n\t\t// use composite shader\n\t\tcompositeShader.use();\n\n\t\t// draw screen quad\n\t\tglActiveTexture(GL_TEXTURE0);\n\t\tglBindTexture(GL_TEXTURE_2D, accumTexture);\n\t\tglActiveTexture(GL_TEXTURE1);\n\t\tglBindTexture(GL_TEXTURE_2D, revealTexture);\n\t\tglBindVertexArray(quadVAO);\n\t\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\n\t\t// draw to backbuffer (final pass)\n\t\t// -----\n\n\t\t// set render states\n\t\tglDisable(GL_DEPTH_TEST);\n\t\tglDepthMask(GL_TRUE); // enable depth writes so glClear won't ignore clearing the depth buffer\n\t\tglDisable(GL_BLEND);\n\n\t\t// bind backbuffer\n\t\tglBindFramebuffer(GL_FRAMEBUFFER, 0);\n\t\tglClearColor(0.0f, 0.0f, 0.0f, 0.0f);\n\t\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);\n\n\t\t// use screen shader\n\t\tscreenShader.use();\n\n\t\t// draw final screen quad\n\t\tglActiveTexture(GL_TEXTURE0);\n\t\tglBindTexture(GL_TEXTURE_2D, opaqueTexture);\n\t\tglBindVertexArray(quadVAO);\n\t\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\n\t\t// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n\t\t// -------------------------------------------------------------------------------\n\t\tglfwSwapBuffers(window);\n\t\tglfwPollEvents();\n\t}\n\n\t// optional: de-allocate all resources once they've outlived their purpose:\n\t// ------------------------------------------------------------------------\n\tglDeleteVertexArrays(1, &quadVAO);\n\tglDeleteBuffers(1, &quadVBO);\n\tglDeleteTextures(1, &opaqueTexture);\n\tglDeleteTextures(1, &depthTexture);\n\tglDeleteTextures(1, &accumTexture);\n\tglDeleteTextures(1, &revealTexture);\n\tglDeleteFramebuffers(1, &opaqueFBO);\n\tglDeleteFramebuffers(1, &transparentFBO);\n\n\tglfwTerminate();\n\n\treturn EXIT_SUCCESS;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n\t// make sure the viewport matches the new window dimensions; note that width and \n\t// height will be significantly larger than specified on retina displays.\n\tglViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n\tif (firstMouse)\n\t{\n\t\tlastX = xpos;\n\t\tlastY = ypos;\n\t\tfirstMouse = false;\n\t}\n\n\tfloat xoffset = xpos - lastX;\n\tfloat yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n\tlastX = xpos;\n\tlastY = ypos;\n\n\tcamera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n\tcamera.ProcessMouseScroll(yoffset);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid process_input(GLFWwindow *window)\n{\n\tif (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n\t\tglfwSetWindowShouldClose(window, true);\n\n\tif (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(FORWARD, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(BACKWARD, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(LEFT, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// generate a model matrix\n// ---------------------------------------------------------------------------------------------------------\nglm::mat4 calculate_model_matrix(const glm::vec3& position, const glm::vec3& rotation, const glm::vec3& scale)\n{\n\tglm::mat4 trans = glm::mat4(1.0f);\n\n\ttrans = glm::translate(trans, position);\n\ttrans = glm::rotate(trans, glm::radians(rotation.x), glm::vec3(1.0, 0.0, 0.0));\n\ttrans = glm::rotate(trans, glm::radians(rotation.y), glm::vec3(0.0, 1.0, 0.0));\n\ttrans = glm::rotate(trans, glm::radians(rotation.z), glm::vec3(0.0, 0.0, 1.0));\n\ttrans = glm::scale(trans, scale);\n\n\treturn trans;\n}\n"}], "validation": {"glslang_valid": 8, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.243, "dedup_hash": "266527a7fd2c13db", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2020_skeletal_animation", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:25+00:00", "source_type": "repo", "title": "Skeletal Animation", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/8.guest/2020/skeletal_animation/anim_model.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{ \n FragColor = texture(texture_diffuse1, TexCoords);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2020/skeletal_animation/anim_model.vs", "language": "glsl", "loc": 35, "comment_density": 0.0, "code": "#version 330 core\n\nlayout(location = 0) in vec3 pos;\nlayout(location = 1) in vec3 norm;\nlayout(location = 2) in vec2 tex;\nlayout(location = 3) in vec3 tangent;\nlayout(location = 4) in vec3 bitangent;\nlayout(location = 5) in ivec4 boneIds; \nlayout(location = 6) in vec4 weights;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nconst int MAX_BONES = 100;\nconst int MAX_BONE_INFLUENCE = 4;\nuniform mat4 finalBonesMatrices[MAX_BONES];\n\nout vec2 TexCoords;\n\nvoid main()\n{\n vec4 totalPosition = vec4(0.0f);\n for(int i = 0 ; i < MAX_BONE_INFLUENCE ; i++)\n {\n if(boneIds[i] == -1) \n continue;\n if(boneIds[i] >=MAX_BONES) \n {\n totalPosition = vec4(pos,1.0f);\n break;\n }\n vec4 localPosition = finalBonesMatrices[boneIds[i]] * vec4(pos,1.0f);\n totalPosition += localPosition * weights[i];\n vec3 localNormal = mat3(finalBonesMatrices[boneIds[i]]) * norm;\n }\n\t\n mat4 viewModel = view * model;\n gl_Position = projection * viewModel * totalPosition;\n\tTexCoords = tex;\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2020/skeletal_animation/skeletal_animation.cpp", "language": "code", "loc": 162, "comment_density": 0.29, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n\n\n\n#include \n\n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow* window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n\t// glfw: initialize and configure\n\t// ------------------------------\n\tglfwInit();\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n\tglfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n\tglfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n\t// glfw window creation\n\t// --------------------\n\tGLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n\tif (window == NULL)\n\t{\n\t\tstd::cout << \"Failed to create GLFW window\" << std::endl;\n\t\tglfwTerminate();\n\t\treturn -1;\n\t}\n\tglfwMakeContextCurrent(window);\n\tglfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\tglfwSetCursorPosCallback(window, mouse_callback);\n\tglfwSetScrollCallback(window, scroll_callback);\n\n\t// tell GLFW to capture our mouse\n\tglfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n\t// glad: load all OpenGL function pointers\n\t// ---------------------------------------\n\tif (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n\t{\n\t\tstd::cout << \"Failed to initialize GLAD\" << std::endl;\n\t\treturn -1;\n\t}\n\n\t// tell stb_image.h to flip loaded texture's on the y-axis (before loading model).\n\tstbi_set_flip_vertically_on_load(true);\n\n\t// configure global opengl state\n\t// -----------------------------\n\tglEnable(GL_DEPTH_TEST);\n\n\t// build and compile shaders\n\t// -------------------------\n\tShader ourShader(\"anim_model.vs\", \"anim_model.fs\");\n\n\t\n\t// load models\n\t// -----------\n\tModel ourModel(FileSystem::getPath(\"resources/objects/vampire/dancing_vampire.dae\"));\n\tAnimation danceAnimation(FileSystem::getPath(\"resources/objects/vampire/dancing_vampire.dae\"),&ourModel);\n\tAnimator animator(&danceAnimation);\n\n\n\t// draw in wireframe\n\t//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n\t// render loop\n\t// -----------\n\twhile (!glfwWindowShouldClose(window))\n\t{\n\t\t// per-frame time logic\n\t\t// --------------------\n\t\tfloat currentFrame = glfwGetTime();\n\t\tdeltaTime = currentFrame - lastFrame;\n\t\tlastFrame = currentFrame;\n\n\t\t// input\n\t\t// -----\n\t\tprocessInput(window);\n\t\tanimator.UpdateAnimation(deltaTime);\n\t\t\n\t\t// render\n\t\t// ------\n\t\tglClearColor(0.05f, 0.05f, 0.05f, 1.0f);\n\t\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n\t\t// don't forget to enable shader before setting uniforms\n\t\tourShader.use();\n\n\t\t// view/projection transformations\n\t\tglm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n\t\tglm::mat4 view = camera.GetViewMatrix();\n\t\tourShader.setMat4(\"projection\", projection);\n\t\tourShader.setMat4(\"view\", view);\n\n auto transforms = animator.GetFinalBoneMatrices();\n\t\tfor (int i = 0; i < transforms.size(); ++i)\n\t\t\tourShader.setMat4(\"finalBonesMatrices[\" + std::to_string(i) + \"]\", transforms[i]);\n\n\n\t\t// render the loaded model\n\t\tglm::mat4 model = glm::mat4(1.0f);\n\t\tmodel = glm::translate(model, glm::vec3(0.0f, -0.4f, 0.0f)); // translate it down so it's at the center of the scene\n\t\tmodel = glm::scale(model, glm::vec3(.5f, .5f, .5f));\t// it's a bit too big for our scene, so scale it down\n\t\tourShader.setMat4(\"model\", model);\n\t\tourModel.Draw(ourShader);\n\n\n\t\t// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n\t\t// -------------------------------------------------------------------------------\n\t\tglfwSwapBuffers(window);\n\t\tglfwPollEvents();\n\t}\n\n\t// glfw: terminate, clearing all previously allocated GLFW resources.\n\t// ------------------------------------------------------------------\n\tglfwTerminate();\n\treturn 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow* window)\n{\n\tif (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n\t\tglfwSetWindowShouldClose(window, true);\n\n\tif (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(FORWARD, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(BACKWARD, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(LEFT, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n\t// make sure the viewport matches the new window dimensions; note that width and \n\t// height will be significantly larger than specified on retina displays.\n\tglViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n\tif (firstMouse)\n\t{\n\t\tlastX = xpos;\n\t\tlastY = ypos;\n\t\tfirstMouse = false;\n\t}\n\n\tfloat xoffset = xpos - lastX;\n\tfloat yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n\tlastX = xpos;\n\tlastY = ypos;\n\n\tcamera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n\tcamera.ProcessMouseScroll(yoffset);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.097, "dedup_hash": "52816f0703c8419d", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2021_1_scene_1_scene_graph", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:25+00:00", "source_type": "repo", "title": "1.Scene Graph", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/8.guest/2021/1.scene/1.scene_graph/1.model_loading.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{ \n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2021/1.scene/1.scene_graph/1.model_loading.vs", "language": "glsl", "loc": 13, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2021/1.scene/1.scene_graph/scene_graph.cpp", "language": "code", "loc": 187, "comment_density": 0.257, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n\n#ifndef ENTITY_H\n#define ENTITY_H\n\n#include //std::list\n#include //std::unique_ptr\n\nclass Entity : public Model\n{\npublic:\n\tlist> children;\n\tEntity* parent;\n};\n#endif\n\n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow* window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n\t// glfw: initialize and configure\n\t// ------------------------------\n\tglfwInit();\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n\tglfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n\tglfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n\t// glfw window creation\n\t// --------------------\n\tGLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n\tif (window == NULL)\n\t{\n\t\tstd::cout << \"Failed to create GLFW window\" << std::endl;\n\t\tglfwTerminate();\n\t\treturn -1;\n\t}\n\tglfwMakeContextCurrent(window);\n\tglfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\tglfwSetCursorPosCallback(window, mouse_callback);\n\tglfwSetScrollCallback(window, scroll_callback);\n\n\t// tell GLFW to capture our mouse\n\tglfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n\t// glad: load all OpenGL function pointers\n\t// ---------------------------------------\n\tif (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n\t{\n\t\tstd::cout << \"Failed to initialize GLAD\" << std::endl;\n\t\treturn -1;\n\t}\n\n\t// tell stb_image.h to flip loaded texture's on the y-axis (before loading model).\n\tstbi_set_flip_vertically_on_load(true);\n\n\t// configure global opengl state\n\t// -----------------------------\n\tglEnable(GL_DEPTH_TEST);\n\n\t// build and compile shaders\n\t// -------------------------\n\tShader ourShader(\"1.model_loading.vs\", \"1.model_loading.fs\");\n\n\t// load entities\n\t// -----------\n\tModel model = Model(FileSystem::getPath(\"resources/objects/planet/planet.obj\"));\n\tEntity ourEntity(model);\n\tourEntity.transform.setLocalPosition({ 10, 0, 0 });\n\tconst float scale = 0.75;\n\tourEntity.transform.setLocalScale({ scale, scale, scale });\n\n\t{\n\t\tEntity* lastEntity = &ourEntity;\n\n\t\tfor (unsigned int i = 0; i < 10; ++i)\n\t\t{\n\t\t\tlastEntity->addChild(model);\n\t\t\tlastEntity = lastEntity->children.back().get();\n\n\t\t\t//Set transform values\n\t\t\tlastEntity->transform.setLocalPosition({ 10, 0, 0 });\n\t\t\tlastEntity->transform.setLocalScale({ scale, scale, scale });\n\t\t}\n\t}\n\tourEntity.updateSelfAndChild();\n\n\t// draw in wireframe\n\t//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n\t// render loop\n\t// -----------\n\twhile (!glfwWindowShouldClose(window))\n\t{\n\t\t// per-frame time logic\n\t\t// --------------------\n\t\tfloat currentFrame = glfwGetTime();\n\t\tdeltaTime = currentFrame - lastFrame;\n\t\tlastFrame = currentFrame;\n\n\t\t// input\n\t\t// -----\n\t\tprocessInput(window);\n\n\t\t// render\n\t\t// ------\n\t\tglClearColor(0.05f, 0.05f, 0.05f, 1.0f);\n\t\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n\t\t// don't forget to enable shader before setting uniforms\n\t\tourShader.use();\n\n\t\t// view/projection transformations\n\t\tglm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n\t\tglm::mat4 view = camera.GetViewMatrix();\n\t\tourShader.setMat4(\"projection\", projection);\n\t\tourShader.setMat4(\"view\", view);\n\n\t\t// draw our scene graph\n\t\tEntity* lastEntity = &ourEntity;\n\t\twhile (lastEntity->children.size())\n\t\t{\n\t\t\tourShader.setMat4(\"model\", lastEntity->transform.getModelMatrix());\n\t\t\tlastEntity->pModel->Draw(ourShader);\n\t\t\tlastEntity = lastEntity->children.back().get();\n\t\t}\n\n\t\tourEntity.transform.setLocalRotation({ 0.f, ourEntity.transform.getLocalRotation().y + 20 * deltaTime, 0.f });\n\t\tourEntity.updateSelfAndChild();\n\n\t\t// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n\t\t// -------------------------------------------------------------------------------\n\t\tglfwSwapBuffers(window);\n\t\tglfwPollEvents();\n\t}\n\n\t// glfw: terminate, clearing all previously allocated GLFW resources.\n\t// ------------------------------------------------------------------\n\tglfwTerminate();\n\treturn 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow* window)\n{\n\tif (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n\t\tglfwSetWindowShouldClose(window, true);\n\n\tif (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(FORWARD, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(BACKWARD, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(LEFT, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n\t// make sure the viewport matches the new window dimensions; note that width and \n\t// height will be significantly larger than specified on retina displays.\n\tglViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n\tif (firstMouse)\n\t{\n\t\tlastX = xpos;\n\t\tlastY = ypos;\n\t\tfirstMouse = false;\n\t}\n\n\tfloat xoffset = xpos - lastX;\n\tfloat yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n\tlastX = xpos;\n\tlastY = ypos;\n\n\tcamera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n\tcamera.ProcessMouseScroll(yoffset);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.086, "dedup_hash": "af34c61b455c55a2", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2021_1_scene_2_frustum_culling", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:25+00:00", "source_type": "repo", "title": "2.Frustum Culling", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/8.guest/2021/1.scene/2.frustum_culling/1.model_loading.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{ \n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2021/1.scene/2.frustum_culling/1.model_loading.vs", "language": "glsl", "loc": 13, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2021/1.scene/2.frustum_culling/frustum_culling.cpp", "language": "code", "loc": 192, "comment_density": 0.271, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n\n#ifndef ENTITY_H\n#define ENTITY_H\n\n#include //std::list\n#include //std::unique_ptr\n\nclass Entity : public Model\n{\npublic:\n\tlist> children;\n\tEntity* parent;\n};\n#endif\n\n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow* window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 10.0f, 0.0f));\nCamera cameraSpy(glm::vec3(0.0f, 10.0f, 0.f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n\t// glfw: initialize and configure\n\t// ------------------------------\n\tglfwInit();\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n\tglfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n\tglfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n\t// glfw window creation\n\t// --------------------\n\tGLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n\tif (window == NULL)\n\t{\n\t\tstd::cout << \"Failed to create GLFW window\" << std::endl;\n\t\tglfwTerminate();\n\t\treturn -1;\n\t}\n\tglfwMakeContextCurrent(window);\n\tglfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\tglfwSetCursorPosCallback(window, mouse_callback);\n\tglfwSetScrollCallback(window, scroll_callback);\n\n\t// tell GLFW to capture our mouse\n\tglfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n\t// glad: load all OpenGL function pointers\n\t// ---------------------------------------\n\tif (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n\t{\n\t\tstd::cout << \"Failed to initialize GLAD\" << std::endl;\n\t\treturn -1;\n\t}\n\n\t// tell stb_image.h to flip loaded texture's on the y-axis (before loading model).\n\tstbi_set_flip_vertically_on_load(true);\n\n\t// configure global opengl state\n\t// -----------------------------\n\tglEnable(GL_DEPTH_TEST);\n\n\tcamera.MovementSpeed = 20.f;\n\n\t// build and compile shaders\n\t// -------------------------\n\tShader ourShader(\"1.model_loading.vs\", \"1.model_loading.fs\");\n\n\t// load entities\n\t// -----------\n\tModel model(FileSystem::getPath(\"resources/objects/planet/planet.obj\"));\n\tEntity ourEntity(model);\n\tourEntity.transform.setLocalPosition({ 0, 0, 0 });\n\tconst float scale = 1.0;\n\tourEntity.transform.setLocalScale({ scale, scale, scale });\n\n\t{\n\t\tEntity* lastEntity = &ourEntity;\n\n\t\tfor (unsigned int x = 0; x < 20; ++x)\n\t\t{\n\t\t\tfor (unsigned int z = 0; z < 20; ++z)\n\t\t\t{\n\t\t\t\tourEntity.addChild(model);\n\t\t\t\tlastEntity = ourEntity.children.back().get();\n\n\t\t\t\t//Set transform values\n\t\t\t\tlastEntity->transform.setLocalPosition({ x * 10.f - 100.f, 0.f, z * 10.f - 100.f });\n\t\t\t}\n\t\t}\n\t}\n\tourEntity.updateSelfAndChild();\n\n\t// draw in wireframe\n\t//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n\t// render loop\n\t// -----------\n\twhile (!glfwWindowShouldClose(window))\n\t{\n\t\t// per-frame time logic\n\t\t// --------------------\n\t\tfloat currentFrame = glfwGetTime();\n\t\tdeltaTime = currentFrame - lastFrame;\n\t\tlastFrame = currentFrame;\n\n\t\t// input\n\t\t// -----\n\t\tprocessInput(window);\n\n\t\t// render\n\t\t// ------\n\t\tglClearColor(0.05f, 0.05f, 0.05f, 1.0f);\n\t\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n\t\t// don't forget to enable shader before setting uniforms\n\t\tourShader.use();\n\n\t\t// view/projection transformations\n\t\tglm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n\t\tconst Frustum camFrustum = createFrustumFromCamera(camera, (float)SCR_WIDTH / (float)SCR_HEIGHT, glm::radians(camera.Zoom), 0.1f, 100.0f);\n\n\t\tcameraSpy.ProcessMouseMovement(2, 0);\n\t\t//static float acc = 0;\n\t\t//acc += deltaTime * 0.0001;\n\t\t//cameraSpy.Position = { cos(acc) * 10, 0.f, sin(acc) * 10 };\n\t\tglm::mat4 view = camera.GetViewMatrix();\n\n\t\tourShader.setMat4(\"projection\", projection);\n\t\tourShader.setMat4(\"view\", view);\n\n\t\t// draw our scene graph\n\t\tunsigned int total = 0, display = 0;\n\t\tourEntity.drawSelfAndChild(camFrustum, ourShader, display, total);\n\t\tstd::cout << \"Total process in CPU : \" << total << \" / Total send to GPU : \" << display << std::endl;\n\n\t\t//ourEntity.transform.setLocalRotation({ 0.f, ourEntity.transform.getLocalRotation().y + 20 * deltaTime, 0.f });\n\t\tourEntity.updateSelfAndChild();\n\n\t\t// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n\t\t// -------------------------------------------------------------------------------\n\t\tglfwSwapBuffers(window);\n\t\tglfwPollEvents();\n\t}\n\n\t// glfw: terminate, clearing all previously allocated GLFW resources.\n\t// ------------------------------------------------------------------\n\tglfwTerminate();\n\treturn 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow* window)\n{\n\tif (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n\t\tglfwSetWindowShouldClose(window, true);\n\n\tif (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(FORWARD, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(BACKWARD, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(LEFT, deltaTime);\n\tif (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n\t\tcamera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n\t// make sure the viewport matches the new window dimensions; note that width and \n\t// height will be significantly larger than specified on retina displays.\n\tglViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n\tif (firstMouse)\n\t{\n\t\tlastX = xpos;\n\t\tlastY = ypos;\n\t\tfirstMouse = false;\n\t}\n\n\tfloat xoffset = xpos - lastX;\n\tfloat yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n\tlastX = xpos;\n\tlastY = ypos;\n\n\tcamera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n\tcamera.ProcessMouseScroll(yoffset);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.09, "dedup_hash": "5dea6cec65fb2b9e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2021_2_csm", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:26+00:00", "source_type": "repo", "title": "2.Csm", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/shadows/geometry_shader/texturing/framebuffer", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/8.guest/2021/2.csm/10.debug_cascade.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 410 core\nout vec4 FragColor;\n\nuniform vec4 color;\n\nvoid main()\n{ \n FragColor = color;\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/10.debug_cascade.vs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 410 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * vec4(aPos, 1.0);\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/10.debug_quad.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 410 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/10.debug_quad_depth.fs", "language": "glsl", "loc": 19, "comment_density": 0.211, "code": "#version 410 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2DArray depthMap;\nuniform float near_plane;\nuniform float far_plane;\nuniform int layer;\n\n// required when using a perspective projection matrix\nfloat LinearizeDepth(float depth)\n{\n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));\t\n}\n\nvoid main()\n{ \n float depthValue = texture(depthMap, vec3(TexCoords, layer)).r;\n // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective\n FragColor = vec4(vec3(depthValue), 1.0); // orthographic\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/10.shadow_mapping.fs", "language": "glsl", "loc": 97, "comment_density": 0.124, "code": "#version 410 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform sampler2DArray shadowMap;\n\nuniform vec3 lightDir;\nuniform vec3 viewPos;\nuniform float farPlane;\n\nuniform mat4 view;\n\nlayout (std140) uniform LightSpaceMatrices\n{\n mat4 lightSpaceMatrices[16];\n};\nuniform float cascadePlaneDistances[16];\nuniform int cascadeCount; // number of frusta - 1\n\nfloat ShadowCalculation(vec3 fragPosWorldSpace)\n{\n // select cascade layer\n vec4 fragPosViewSpace = view * vec4(fragPosWorldSpace, 1.0);\n float depthValue = abs(fragPosViewSpace.z);\n\n int layer = -1;\n for (int i = 0; i < cascadeCount; ++i)\n {\n if (depthValue < cascadePlaneDistances[i])\n {\n layer = i;\n break;\n }\n }\n if (layer == -1)\n {\n layer = cascadeCount;\n }\n\n vec4 fragPosLightSpace = lightSpaceMatrices[layer] * vec4(fragPosWorldSpace, 1.0);\n // perform perspective divide\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n // transform to [0,1] range\n projCoords = projCoords * 0.5 + 0.5;\n\n // get depth of current fragment from light's perspective\n float currentDepth = projCoords.z;\n\n // keep the shadow at 0.0 when outside the far_plane region of the light's frustum.\n if (currentDepth > 1.0)\n {\n return 0.0;\n }\n // calculate bias (based on depth map resolution and slope)\n vec3 normal = normalize(fs_in.Normal);\n float bias = max(0.05 * (1.0 - dot(normal, lightDir)), 0.005);\n const float biasModifier = 0.5f;\n if (layer == cascadeCount)\n {\n bias *= 1 / (farPlane * biasModifier);\n }\n else\n {\n bias *= 1 / (cascadePlaneDistances[layer] * biasModifier);\n }\n\n // PCF\n float shadow = 0.0;\n vec2 texelSize = 1.0 / vec2(textureSize(shadowMap, 0));\n for(int x = -1; x <= 1; ++x)\n {\n for(int y = -1; y <= 1; ++y)\n {\n float pcfDepth = texture(shadowMap, vec3(projCoords.xy + vec2(x, y) * texelSize, layer)).r;\n shadow += (currentDepth - bias) > pcfDepth ? 1.0 : 0.0; \n } \n }\n shadow /= 9.0;\n \n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * color;\n // diffuse\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = ShadowCalculation(fs_in.FragPos); \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/10.shadow_mapping.vs", "language": "glsl", "loc": 20, "comment_density": 0.0, "code": "#version 410 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/10.shadow_mapping_depth.fs", "language": "glsl", "loc": 4, "comment_density": 0.0, "code": "#version 410 core\n\nvoid main()\n{ \n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/10.shadow_mapping_depth.gs", "language": "glsl", "loc": 20, "comment_density": 0.15, "code": "#version 410 core\n\nlayout(triangles, invocations = 5) in;\nlayout(triangle_strip, max_vertices = 3) out;\n\nlayout (std140) uniform LightSpaceMatrices\n{\n mat4 lightSpaceMatrices[16];\n};\n/*\nuniform mat4 lightSpaceMatrices[16];\n*/\n\nvoid main()\n{ \n\tfor (int i = 0; i < 3; ++i)\n\t{\n\t\tgl_Position = lightSpaceMatrices[gl_InvocationID] * gl_in[i].gl_Position;\n\t\tgl_Layer = gl_InvocationID;\n\t\tEmitVertex();\n\t}\n\tEndPrimitive();\n} \n", "stage": "geometry", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/10.shadow_mapping_depth.vs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 410 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = model * vec4(aPos, 1.0);\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2021/2.csm/shadow_mapping.cpp", "language": "code", "loc": 648, "comment_density": 0.199, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\nvoid renderQuad();\nstd::vector getLightSpaceMatrices();\nstd::vector getFrustumCornersWorldSpace(const glm::mat4& projview);\nvoid drawCascadeVolumeVisualizers(const std::vector& lightMatrices, Shader* shader);\n\n// settings\nconst unsigned int SCR_WIDTH = 2560;\nconst unsigned int SCR_HEIGHT = 1440;\n\n// framebuffer size\nint fb_width;\nint fb_height;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\nfloat cameraNearPlane = 0.1f;\nfloat cameraFarPlane = 500.0f;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nstd::vector shadowCascadeLevels{ cameraFarPlane / 50.0f, cameraFarPlane / 25.0f, cameraFarPlane / 10.0f, cameraFarPlane / 2.0f };\nint debugLayer = 0;\n\n// meshes\nunsigned int planeVAO;\n\n// lighting info\n// -------------\nconst glm::vec3 lightDir = glm::normalize(glm::vec3(20.0f, 50, 20.0f));\nunsigned int lightFBO;\nunsigned int lightDepthMaps;\nconstexpr unsigned int depthMapResolution = 4096;\n\nbool showQuad = false;\n\nstd::random_device device;\nstd::mt19937 generator = std::mt19937(device());\n\nstd::vector lightMatricesCache;\n\nint main()\n{\n //generator.seed(2);\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n glfwGetFramebufferSize(window, &fb_width, &fb_height);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"10.shadow_mapping.vs\", \"10.shadow_mapping.fs\");\n Shader simpleDepthShader(\"10.shadow_mapping_depth.vs\", \"10.shadow_mapping_depth.fs\", \"10.shadow_mapping_depth.gs\");\n Shader debugDepthQuad(\"10.debug_quad.vs\", \"10.debug_quad_depth.fs\");\n Shader debugCascadeShader(\"10.debug_cascade.vs\", \"10.debug_cascade.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 25.0f, -2.0f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -2.0f, 25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -25.0f, -2.0f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n 25.0f, -2.0f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -2.0f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n 25.0f, -2.0f, -25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 25.0f\n };\n // plane VAO\n unsigned int planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure light FBO\n // -----------------------\n glGenFramebuffers(1, &lightFBO);\n\n glGenTextures(1, &lightDepthMaps);\n glBindTexture(GL_TEXTURE_2D_ARRAY, lightDepthMaps);\n glTexImage3D(\n GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT32F, depthMapResolution, depthMapResolution, int(shadowCascadeLevels.size()) + 1,\n 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr);\n\n glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);\n glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);\n\n constexpr float bordercolor[] = { 1.0f, 1.0f, 1.0f, 1.0f };\n glTexParameterfv(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BORDER_COLOR, bordercolor);\n\n glBindFramebuffer(GL_FRAMEBUFFER, lightFBO);\n glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, lightDepthMaps, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n\n int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\n if (status != GL_FRAMEBUFFER_COMPLETE)\n {\n std::cout << \"ERROR::FRAMEBUFFER:: Framebuffer is not complete!\";\n throw 0;\n }\n\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // configure UBO\n // --------------------\n unsigned int matricesUBO;\n glGenBuffers(1, &matricesUBO);\n glBindBuffer(GL_UNIFORM_BUFFER, matricesUBO);\n glBufferData(GL_UNIFORM_BUFFER, sizeof(glm::mat4x4) * 16, nullptr, GL_STATIC_DRAW);\n glBindBufferBase(GL_UNIFORM_BUFFER, 0, matricesUBO);\n glBindBuffer(GL_UNIFORM_BUFFER, 0);\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"shadowMap\", 1);\n debugDepthQuad.use();\n debugDepthQuad.setInt(\"depthMap\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // change light position over time\n //lightPos.x = sin(glfwGetTime()) * 3.0f;\n //lightPos.z = cos(glfwGetTime()) * 2.0f;\n //lightPos.y = 5.0 + cos(glfwGetTime()) * 1.0f;\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 0. UBO setup\n const auto lightMatrices = getLightSpaceMatrices();\n glBindBuffer(GL_UNIFORM_BUFFER, matricesUBO);\n for (size_t i = 0; i < lightMatrices.size(); ++i)\n {\n glBufferSubData(GL_UNIFORM_BUFFER, i * sizeof(glm::mat4x4), sizeof(glm::mat4x4), &lightMatrices[i]);\n }\n glBindBuffer(GL_UNIFORM_BUFFER, 0);\n\n // 1. render depth of scene to texture (from light's perspective)\n // --------------------------------------------------------------\n //lightProjection = glm::perspective(glm::radians(45.0f), (GLfloat)SHADOW_WIDTH / (GLfloat)SHADOW_HEIGHT, near_plane, far_plane); // note that if you use a perspective projection matrix you'll have to change the light position as the current light position isn't enough to reflect the whole scene\n // render scene from light's point of view\n simpleDepthShader.use();\n\n glBindFramebuffer(GL_FRAMEBUFFER, lightFBO);\n glViewport(0, 0, depthMapResolution, depthMapResolution);\n glClear(GL_DEPTH_BUFFER_BIT);\n glCullFace(GL_FRONT); // peter panning\n renderScene(simpleDepthShader);\n glCullFace(GL_BACK);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // reset viewport\n glViewport(0, 0, fb_width, fb_height);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 2. render scene as normal using the generated depth/shadow map \n // --------------------------------------------------------------\n glViewport(0, 0, fb_width, fb_height);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shader.use();\n const glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)fb_width / (float)fb_height, cameraNearPlane, cameraFarPlane);\n const glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightDir\", lightDir);\n shader.setFloat(\"farPlane\", cameraFarPlane);\n shader.setInt(\"cascadeCount\", shadowCascadeLevels.size());\n for (size_t i = 0; i < shadowCascadeLevels.size(); ++i)\n {\n shader.setFloat(\"cascadePlaneDistances[\" + std::to_string(i) + \"]\", shadowCascadeLevels[i]);\n }\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D_ARRAY, lightDepthMaps);\n renderScene(shader);\n\n if (lightMatricesCache.size() != 0)\n {\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n debugCascadeShader.use();\n debugCascadeShader.setMat4(\"projection\", projection);\n debugCascadeShader.setMat4(\"view\", view);\n drawCascadeVolumeVisualizers(lightMatricesCache, &debugCascadeShader);\n glDisable(GL_BLEND);\n }\n\n // render Depth map to quad for visual debugging\n // ---------------------------------------------\n debugDepthQuad.use();\n debugDepthQuad.setInt(\"layer\", debugLayer);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D_ARRAY, lightDepthMaps);\n if (showQuad)\n {\n renderQuad();\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // floor\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glBindVertexArray(planeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n static std::vector modelMatrices;\n if (modelMatrices.size() == 0)\n {\n for (int i = 0; i < 10; ++i)\n {\n static std::uniform_real_distribution offsetDistribution = std::uniform_real_distribution(-10, 10);\n static std::uniform_real_distribution scaleDistribution = std::uniform_real_distribution(1.0, 2.0);\n static std::uniform_real_distribution rotationDistribution = std::uniform_real_distribution(0, 180);\n\n auto model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(offsetDistribution(generator), offsetDistribution(generator) + 10.0f, offsetDistribution(generator)));\n model = glm::rotate(model, glm::radians(rotationDistribution(generator)), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(scaleDistribution(generator)));\n modelMatrices.push_back(model);\n }\n }\n\n for (const auto& model : modelMatrices)\n {\n shader.setMat4(\"model\", model);\n renderCube();\n }\n}\n\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\nstd::vector visualizerVAOs;\nstd::vector visualizerVBOs;\nstd::vector visualizerEBOs;\nvoid drawCascadeVolumeVisualizers(const std::vector& lightMatrices, Shader* shader)\n{\n visualizerVAOs.resize(8);\n visualizerEBOs.resize(8);\n visualizerVBOs.resize(8);\n\n const GLuint indices[] = {\n 0, 2, 3,\n 0, 3, 1,\n 4, 6, 2,\n 4, 2, 0,\n 5, 7, 6,\n 5, 6, 4,\n 1, 3, 7,\n 1, 7, 5,\n 6, 7, 3,\n 6, 3, 2,\n 1, 5, 4,\n 0, 1, 4\n };\n\n const glm::vec4 colors[] = {\n {1.0, 0.0, 0.0, 0.5f},\n {0.0, 1.0, 0.0, 0.5f},\n {0.0, 0.0, 1.0, 0.5f},\n };\n\n for (int i = 0; i < lightMatrices.size(); ++i)\n {\n const auto corners = getFrustumCornersWorldSpace(lightMatrices[i]);\n std::vector vec3s;\n for (const auto& v : corners)\n {\n vec3s.push_back(glm::vec3(v));\n }\n\n glGenVertexArrays(1, &visualizerVAOs[i]);\n glGenBuffers(1, &visualizerVBOs[i]);\n glGenBuffers(1, &visualizerEBOs[i]);\n\n glBindVertexArray(visualizerVAOs[i]);\n\n glBindBuffer(GL_ARRAY_BUFFER, visualizerVBOs[i]);\n glBufferData(GL_ARRAY_BUFFER, vec3s.size() * sizeof(glm::vec3), &vec3s[0], GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, visualizerEBOs[i]);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, 36 * sizeof(GLuint), &indices[0], GL_STATIC_DRAW);\n\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(glm::vec3), (void*)0);\n\n glBindVertexArray(visualizerVAOs[i]);\n shader->setVec4(\"color\", colors[i % 3]);\n glDrawElements(GL_TRIANGLES, GLsizei(36), GL_UNSIGNED_INT, 0);\n\n glDeleteBuffers(1, &visualizerVBOs[i]);\n glDeleteBuffers(1, &visualizerEBOs[i]);\n glDeleteVertexArrays(1, &visualizerVAOs[i]);\n\n glBindVertexArray(0);\n }\n\n visualizerVAOs.clear();\n visualizerEBOs.clear();\n visualizerVBOs.clear();\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n camera.MovementSpeed = glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS ? 2.5 * 10 : 2.5;\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n static int fPress = GLFW_RELEASE;\n if (glfwGetKey(window, GLFW_KEY_F) == GLFW_RELEASE && fPress == GLFW_PRESS)\n {\n showQuad = !showQuad;\n }\n fPress = glfwGetKey(window, GLFW_KEY_F);\n\n static int plusPress = GLFW_RELEASE;\n if (glfwGetKey(window, GLFW_KEY_N) == GLFW_RELEASE && plusPress == GLFW_PRESS)\n {\n debugLayer++;\n if (debugLayer > shadowCascadeLevels.size())\n {\n debugLayer = 0;\n }\n }\n plusPress = glfwGetKey(window, GLFW_KEY_N);\n\n static int cPress = GLFW_RELEASE;\n if (glfwGetKey(window, GLFW_KEY_C) == GLFW_RELEASE && cPress == GLFW_PRESS)\n {\n lightMatricesCache = getLightSpaceMatrices();\n }\n cPress = glfwGetKey(window, GLFW_KEY_C);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n fb_width = width;\n fb_height = height;\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(yoffset);\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n\nstd::vector getFrustumCornersWorldSpace(const glm::mat4& projview)\n{\n const auto inv = glm::inverse(projview);\n\n std::vector frustumCorners;\n for (unsigned int x = 0; x < 2; ++x)\n {\n for (unsigned int y = 0; y < 2; ++y)\n {\n for (unsigned int z = 0; z < 2; ++z)\n {\n const glm::vec4 pt = inv * glm::vec4(2.0f * x - 1.0f, 2.0f * y - 1.0f, 2.0f * z - 1.0f, 1.0f);\n frustumCorners.push_back(pt / pt.w);\n }\n }\n }\n\n return frustumCorners;\n}\n\n\nstd::vector getFrustumCornersWorldSpace(const glm::mat4& proj, const glm::mat4& view)\n{\n return getFrustumCornersWorldSpace(proj * view);\n}\n\nglm::mat4 getLightSpaceMatrix(const float nearPlane, const float farPlane)\n{\n const auto proj = glm::perspective(\n glm::radians(camera.Zoom), (float)fb_width / (float)fb_height, nearPlane,\n farPlane);\n const auto corners = getFrustumCornersWorldSpace(proj, camera.GetViewMatrix());\n\n glm::vec3 center = glm::vec3(0, 0, 0);\n for (const auto& v : corners)\n {\n center += glm::vec3(v);\n }\n center /= corners.size();\n\n const auto lightView = glm::lookAt(center + lightDir, center, glm::vec3(0.0f, 1.0f, 0.0f));\n\n float minX = std::numeric_limits::max();\n float maxX = std::numeric_limits::lowest();\n float minY = std::numeric_limits::max();\n float maxY = std::numeric_limits::lowest();\n float minZ = std::numeric_limits::max();\n float maxZ = std::numeric_limits::lowest();\n for (const auto& v : corners)\n {\n const auto trf = lightView * v;\n minX = std::min(minX, trf.x);\n maxX = std::max(maxX, trf.x);\n minY = std::min(minY, trf.y);\n maxY = std::max(maxY, trf.y);\n minZ = std::min(minZ, trf.z);\n maxZ = std::max(maxZ, trf.z);\n }\n\n // Tune this parameter according to the scene\n constexpr float zMult = 10.0f;\n if (minZ < 0)\n {\n minZ *= zMult;\n }\n else\n {\n minZ /= zMult;\n }\n if (maxZ < 0)\n {\n maxZ /= zMult;\n }\n else\n {\n maxZ *= zMult;\n }\n\n const glm::mat4 lightProjection = glm::ortho(minX, maxX, minY, maxY, minZ, maxZ);\n return lightProjection * lightView;\n}\n\nstd::vector getLightSpaceMatrices()\n{\n std::vector ret;\n for (size_t i = 0; i < shadowCascadeLevels.size() + 1; ++i)\n {\n if (i == 0)\n {\n ret.push_back(getLightSpaceMatrix(cameraNearPlane, shadowCascadeLevels[i]));\n }\n else if (i < shadowCascadeLevels.size())\n {\n ret.push_back(getLightSpaceMatrix(shadowCascadeLevels[i - 1], shadowCascadeLevels[i]));\n }\n else\n {\n ret.push_back(getLightSpaceMatrix(shadowCascadeLevels[i - 1], cameraFarPlane));\n }\n }\n return ret;\n}\n"}], "validation": {"glslang_valid": 9, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.068, "dedup_hash": "a7fded8f194c67a7", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_cpu_src", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:26+00:00", "source_type": "repo", "title": "Terrain Cpu Src", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/terrain/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/8.guest/2021/3.tessellation/terrain_cpu_src/8.3.cpuheight.fs", "language": "glsl", "loc": 8, "comment_density": 0.125, "code": "#version 330 core\n\nout vec4 FragColor;\n\nin float Height;\n\nvoid main()\n{\n float h = (Height + 16)/32.0f;\t// shift and scale the height into a grayscale value\n FragColor = vec4(h, h, h, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2021/3.tessellation/terrain_cpu_src/8.3.cpuheight.vs", "language": "glsl", "loc": 13, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout float Height;\nout vec3 Position;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n Height = aPos.y;\n Position = (view * model * vec4(aPos, 1.0)).xyz;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2021/3.tessellation/terrain_cpu_src/main.cpp", "language": "code", "loc": 250, "comment_density": 0.252, "code": "#include \n#include \n\n#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\"\n\n#include \n#include \n\n#include \n#include \n\n#include \n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int modifiers);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nint useWireframe = 0;\nint displayGrayscale = 0;\n\n// camera - give pretty starting point\nCamera camera(glm::vec3(67.0f, 627.5f, 169.9f),\n glm::vec3(0.0f, 1.0f, 0.0f),\n -128.1f, -42.4f);\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL: Terrain CPU\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetKeyCallback(window, key_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader program\n // ------------------------------------\n Shader heightMapShader(\"8.3.cpuheight.vs\",\"8.3.cpuheight.fs\");\n\n // load and create a texture\n // -------------------------\n // load image, create texture and generate mipmaps\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n stbi_set_flip_vertically_on_load(true);\n int width, height, nrChannels;\n unsigned char *data = stbi_load(\"heightmaps/iceland_heightmap.png\", &width, &height, &nrChannels, 0);\n if (data)\n {\n std::cout << \"Loaded heightmap of size \" << height << \" x \" << width << std::endl;\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n std::vector vertices;\n float yScale = 64.0f / 256.0f, yShift = 16.0f;\n int rez = 1;\n unsigned bytePerPixel = nrChannels;\n for(int i = 0; i < height; i++)\n {\n for(int j = 0; j < width; j++)\n {\n unsigned char* pixelOffset = data + (j + width * i) * bytePerPixel;\n unsigned char y = pixelOffset[0];\n\n // vertex\n vertices.push_back( -height/2.0f + height*i/(float)height ); // vx\n vertices.push_back( (int) y * yScale - yShift); // vy\n vertices.push_back( -width/2.0f + width*j/(float)width ); // vz\n }\n }\n std::cout << \"Loaded \" << vertices.size() / 3 << \" vertices\" << std::endl;\n stbi_image_free(data);\n\n std::vector indices;\n for(unsigned i = 0; i < height-1; i += rez)\n {\n for(unsigned j = 0; j < width; j += rez)\n {\n for(unsigned k = 0; k < 2; k++)\n {\n indices.push_back(j + width * (i + k*rez));\n }\n }\n }\n std::cout << \"Loaded \" << indices.size() << \" indices\" << std::endl;\n\n const int numStrips = (height-1)/rez;\n const int numTrisPerStrip = (width/rez)*2-2;\n std::cout << \"Created lattice of \" << numStrips << \" strips with \" << numTrisPerStrip << \" triangles each\" << std::endl;\n std::cout << \"Created \" << numStrips * numTrisPerStrip << \" triangles total\" << std::endl;\n\n // first, configure the cube's VAO (and terrainVBO + terrainIBO)\n unsigned int terrainVAO, terrainVBO, terrainIBO;\n glGenVertexArrays(1, &terrainVAO);\n glBindVertexArray(terrainVAO);\n\n glGenBuffers(1, &terrainVBO);\n glBindBuffer(GL_ARRAY_BUFFER, terrainVBO);\n glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(float), &vertices[0], GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n glGenBuffers(1, &terrainIBO);\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, terrainIBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned), &indices[0], GL_STATIC_DRAW);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n// std::cout << deltaTime << \"ms (\" << 1.0f / deltaTime << \" FPS)\" << std::endl;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n heightMapShader.use();\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100000.0f);\n glm::mat4 view = camera.GetViewMatrix();\n heightMapShader.setMat4(\"projection\", projection);\n heightMapShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n heightMapShader.setMat4(\"model\", model);\n \n // render the cube\n glBindVertexArray(terrainVAO);\n// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n for(unsigned strip = 0; strip < numStrips; strip++)\n {\n glDrawElements(GL_TRIANGLE_STRIP, // primitive type\n numTrisPerStrip+2, // number of indices to render\n GL_UNSIGNED_INT, // index data type\n (void*)(sizeof(unsigned) * (numTrisPerStrip+2) * strip)); // offset to starting index\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &terrainVAO);\n glDeleteBuffers(1, &terrainVBO);\n glDeleteBuffers(1, &terrainIBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and\n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever a key event occurs, this callback is called\n// ---------------------------------------------------------------------------------------------\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int modifiers)\n{\n if(action == GLFW_PRESS)\n {\n switch(key)\n {\n case GLFW_KEY_SPACE:\n useWireframe = 1 - useWireframe;\n break;\n case GLFW_KEY_G:\n displayGrayscale = 1 - displayGrayscale;\n break;\n default:\n break;\n }\n }\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(yoffset);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": "images/joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_cpu_src.png", "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.126, "dedup_hash": "0dc830b335194a16", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_gpu_dist", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:26+00:00", "source_type": "repo", "title": "Terrain Gpu Dist", "api": "OpenGL Core", "glsl_version": null, "topic": "tessellation/texturing/framebuffer/terrain/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/8.guest/2021/3.tessellation/terrain_gpu_dist/8.3.gpuheight.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 410 core\n\nin float Height;\n\nout vec4 FragColor;\n\nvoid main()\n{\n float h = (Height + 16)/64.0f;\n FragColor = vec4(h, h, h, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2021/3.tessellation/terrain_gpu_dist/8.3.gpuheight.tcs", "language": "glsl", "loc": 37, "comment_density": 0.027, "code": "#version 410 core\n\nlayout(vertices=4) out;\n\nuniform mat4 model;\nuniform mat4 view;\n\nin vec2 TexCoord[];\nout vec2 TextureCoord[];\n\nvoid main()\n{\n gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;\n TextureCoord[gl_InvocationID] = TexCoord[gl_InvocationID];\n\n if(gl_InvocationID == 0)\n {\n const int MIN_TESS_LEVEL = 4;\n const int MAX_TESS_LEVEL = 64;\n const float MIN_DISTANCE = 20;\n const float MAX_DISTANCE = 800;\n\n vec4 eyeSpacePos00 = view * model * gl_in[0].gl_Position;\n vec4 eyeSpacePos01 = view * model * gl_in[1].gl_Position;\n vec4 eyeSpacePos10 = view * model * gl_in[2].gl_Position;\n vec4 eyeSpacePos11 = view * model * gl_in[3].gl_Position;\n\n // \"distance\" from camera scaled between 0 and 1\n float distance00 = clamp( (abs(eyeSpacePos00.z) - MIN_DISTANCE) / (MAX_DISTANCE-MIN_DISTANCE), 0.0, 1.0 );\n float distance01 = clamp( (abs(eyeSpacePos01.z) - MIN_DISTANCE) / (MAX_DISTANCE-MIN_DISTANCE), 0.0, 1.0 );\n float distance10 = clamp( (abs(eyeSpacePos10.z) - MIN_DISTANCE) / (MAX_DISTANCE-MIN_DISTANCE), 0.0, 1.0 );\n float distance11 = clamp( (abs(eyeSpacePos11.z) - MIN_DISTANCE) / (MAX_DISTANCE-MIN_DISTANCE), 0.0, 1.0 );\n\n float tessLevel0 = mix( MAX_TESS_LEVEL, MIN_TESS_LEVEL, min(distance10, distance00) );\n float tessLevel1 = mix( MAX_TESS_LEVEL, MIN_TESS_LEVEL, min(distance00, distance01) );\n float tessLevel2 = mix( MAX_TESS_LEVEL, MIN_TESS_LEVEL, min(distance01, distance11) );\n float tessLevel3 = mix( MAX_TESS_LEVEL, MIN_TESS_LEVEL, min(distance11, distance10) );\n\n gl_TessLevelOuter[0] = tessLevel0;\n gl_TessLevelOuter[1] = tessLevel1;\n gl_TessLevelOuter[2] = tessLevel2;\n gl_TessLevelOuter[3] = tessLevel3;\n\n gl_TessLevelInner[0] = max(tessLevel1, tessLevel3);\n gl_TessLevelInner[1] = max(tessLevel0, tessLevel2);\n }\n}", "stage": "tess_control", "validation_status": "valid"}, {"path": "src/8.guest/2021/3.tessellation/terrain_gpu_dist/8.3.gpuheight.tes", "language": "glsl", "loc": 32, "comment_density": 0.0, "code": "#version 410 core\nlayout(quads, fractional_odd_spacing, ccw) in;\n\nuniform sampler2D heightMap;\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nin vec2 TextureCoord[];\n\nout float Height;\n\nvoid main()\n{\n float u = gl_TessCoord.x;\n float v = gl_TessCoord.y;\n\n vec2 t00 = TextureCoord[0];\n vec2 t01 = TextureCoord[1];\n vec2 t10 = TextureCoord[2];\n vec2 t11 = TextureCoord[3];\n\n vec2 t0 = (t01 - t00) * u + t00;\n vec2 t1 = (t11 - t10) * u + t10;\n vec2 texCoord = (t1 - t0) * v + t0;\n\n Height = texture(heightMap, texCoord).y * 64.0 - 16.0;\n\n vec4 p00 = gl_in[0].gl_Position;\n vec4 p01 = gl_in[1].gl_Position;\n vec4 p10 = gl_in[2].gl_Position;\n vec4 p11 = gl_in[3].gl_Position;\n\n vec4 uVec = p01 - p00;\n vec4 vVec = p10 - p00;\n vec4 normal = normalize( vec4(cross(vVec.xyz, uVec.xyz), 0) );\n\n vec4 p0 = (p01 - p00) * u + p00;\n vec4 p1 = (p11 - p10) * u + p10;\n vec4 p = (p1 - p0) * v + p0 + normal * Height;\n\n gl_Position = projection * view * model * p;\n}", "stage": "tess_evaluation", "validation_status": "valid"}, {"path": "src/8.guest/2021/3.tessellation/terrain_gpu_dist/8.3.gpuheight.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 410 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTex;\n\nout vec2 TexCoord;\n\nvoid main()\n{\n gl_Position = vec4(aPos, 1.0);\n TexCoord = aTex;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2021/3.tessellation/terrain_gpu_dist/main.cpp", "language": "code", "loc": 248, "comment_density": 0.319, "code": "#include \n#include \n\n#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\"\n\n#include \n#include \n\n#include \n#include \n\n#include \n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int modifiers);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nconst unsigned int NUM_PATCH_PTS = 4;\n\n// camera - give pretty starting point\nCamera camera(glm::vec3(67.0f, 627.5f, 169.9f),\n glm::vec3(0.0f, 1.0f, 0.0f),\n -128.1f, -42.4f);\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL: Terrain GPU\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetKeyCallback(window, key_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n GLint maxTessLevel;\n glGetIntegerv(GL_MAX_TESS_GEN_LEVEL, &maxTessLevel);\n std::cout << \"Max available tess level: \" << maxTessLevel << std::endl;\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader program\n // ------------------------------------\n Shader tessHeightMapShader(\"8.3.gpuheight.vs\",\"8.3.gpuheight.fs\", nullptr, // if wishing to render as is\n \"8.3.gpuheight.tcs\", \"8.3.gpuheight.tes\");\n\n // load and create a texture\n // -------------------------\n unsigned int texture;\n glGenTextures(1, &texture);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture); // all upcoming GL_TEXTURE_2D operations now have effect on this texture object\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(\"heightmaps/iceland_heightmap.png\", &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n tessHeightMapShader.setInt(\"heightMap\", 0);\n std::cout << \"Loaded heightmap of size \" << height << \" x \" << width << std::endl;\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n std::vector vertices;\n\n unsigned rez = 20;\n for(unsigned i = 0; i <= rez-1; i++)\n {\n for(unsigned j = 0; j <= rez-1; j++)\n {\n vertices.push_back(-width/2.0f + width*i/(float)rez); // v.x\n vertices.push_back(0.0f); // v.y\n vertices.push_back(-height/2.0f + height*j/(float)rez); // v.z\n vertices.push_back(i / (float)rez); // u\n vertices.push_back(j / (float)rez); // v\n\n vertices.push_back(-width/2.0f + width*(i+1)/(float)rez); // v.x\n vertices.push_back(0.0f); // v.y\n vertices.push_back(-height/2.0f + height*j/(float)rez); // v.z\n vertices.push_back((i+1) / (float)rez); // u\n vertices.push_back(j / (float)rez); // v\n\n vertices.push_back(-width/2.0f + width*i/(float)rez); // v.x\n vertices.push_back(0.0f); // v.y\n vertices.push_back(-height/2.0f + height*(j+1)/(float)rez); // v.z\n vertices.push_back(i / (float)rez); // u\n vertices.push_back((j+1) / (float)rez); // v\n\n vertices.push_back(-width/2.0f + width*(i+1)/(float)rez); // v.x\n vertices.push_back(0.0f); // v.y\n vertices.push_back(-height/2.0f + height*(j+1)/(float)rez); // v.z\n vertices.push_back((i+1) / (float)rez); // u\n vertices.push_back((j+1) / (float)rez); // v\n }\n }\n std::cout << \"Loaded \" << rez*rez << \" patches of 4 control points each\" << std::endl;\n std::cout << \"Processing \" << rez*rez*4 << \" vertices in vertex shader\" << std::endl;\n\n // first, configure the cube's VAO (and terrainVBO)\n unsigned int terrainVAO, terrainVBO;\n glGenVertexArrays(1, &terrainVAO);\n glBindVertexArray(terrainVAO);\n\n glGenBuffers(1, &terrainVBO);\n glBindBuffer(GL_ARRAY_BUFFER, terrainVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), &vertices[0], GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texCoord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(sizeof(float) * 3));\n glEnableVertexAttribArray(1);\n\n glPatchParameteri(GL_PATCH_VERTICES, NUM_PATCH_PTS);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n tessHeightMapShader.use();\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100000.0f);\n glm::mat4 view = camera.GetViewMatrix();\n tessHeightMapShader.setMat4(\"projection\", projection);\n tessHeightMapShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n tessHeightMapShader.setMat4(\"model\", model);\n\n // render the terrain\n glBindVertexArray(terrainVAO);\n glDrawArrays(GL_PATCHES, 0, NUM_PATCH_PTS*rez*rez);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &terrainVAO);\n glDeleteBuffers(1, &terrainVBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and\n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever a key event occurs, this callback is called\n// ---------------------------------------------------------------------------------------------\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int modifiers)\n{\n if(action == GLFW_PRESS)\n {\n switch(key)\n {\n default:\n break;\n }\n }\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(yoffset);\n}"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": "images/joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_gpu_dist.png", "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.069, "dedup_hash": "b81c063a97e7c172", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2021_4_dsa", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:26+00:00", "source_type": "repo", "title": "4.Dsa", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/8.guest/2021/4.dsa/hello_triangle_dsa.cpp", "language": "code", "loc": 130, "comment_density": 0.046, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\nconst char* vertexShaderSource = \"#version 330 core\\n\"\n\"layout (location = 0) in vec3 aPos;\\n\"\n\"void main()\\n\"\n\"{\\n\"\n\" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n\"}\\0\";\nconst char* fragmentShaderSource = \"#version 330 core\\n\"\n\"out vec4 FragColor;\\n\"\n\"void main()\\n\"\n\"{\\n\"\n\" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n\"}\\n\\0\";\n\nint main()\n{\n const unsigned int SCR_WIDTH = 800;\n const unsigned int SCR_HEIGHT = 600;\n\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n float vertices[] = {\n 0.5f, 0.5f, 0.0f,\n 0.5f, -0.5f, 0.0f,\n -0.5f, -0.5f, 0.0f,\n -0.5f, 0.5f, 0.0f\n };\n // Here we create the VBO with DSA.\n GLuint vbo = 0;\n // Note how we do not have to call glBindBuffer() after the create call.\n glCreateBuffers(1, &vbo);\n glNamedBufferStorage(vbo, sizeof(vertices), vertices, 0x0);\n\n unsigned int indices[] = {\n 0, 1, 3,\n 1, 2, 3\n };\n // Here we create the EBO with DSA while also specifying that the buffer is mutable from the client side.\n GLuint ebo = 0;\n glCreateBuffers(1, &ebo);\n glNamedBufferStorage(ebo, sizeof(indices), nullptr, GL_DYNAMIC_STORAGE_BIT);\n glNamedBufferSubData(ebo, 0, sizeof(indices), indices);\n\n // Here we create the VAO with DSA and specify its format.\n GLuint vao = 0;\n glCreateVertexArrays(1, &vao);\n\n // Specifying our vertex layout with the VAO.\n glEnableVertexArrayAttrib(vao, 0);\n glVertexArrayAttribFormat(vao, 0, 3, GL_FLOAT, GL_FALSE, 0);\n glVertexArrayAttribBinding(vao, 0, 0);\n\n // Binding the VBO and Element Buffer to the VAO.\n glVertexArrayVertexBuffer(vao, 0, vbo, 0, sizeof(float) * 3);\n glVertexArrayElementBuffer(vao, ebo);\n\n while (!glfwWindowShouldClose(window))\n {\n processInput(window);\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n glUseProgram(shaderProgram);\n glBindVertexArray(vao);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n glDeleteVertexArrays(1, &vao);\n glDeleteBuffers(1, &vbo);\n glDeleteBuffers(1, &ebo);\n glDeleteProgram(shaderProgram);\n glfwTerminate();\n return 0;\n}\n\nvoid processInput(GLFWwindow* window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.046, "dedup_hash": "abbe30994dcb5bf5", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2022_5_computeshader_helloworld", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:26+00:00", "source_type": "repo", "title": "5.Computeshader Helloworld", "api": "OpenGL Core", "glsl_version": null, "topic": "compute/texturing/framebuffer/basics/camera", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/8.guest/2022/5.computeshader_helloworld/computeShader.cs", "language": "glsl", "loc": 24, "comment_density": 0.5, "code": "#version 430 core\n\nlayout (local_size_x = 10, local_size_y = 10, local_size_z = 1) in;\n\n// ----------------------------------------------------------------------------\n//\n// uniforms\n//\n// ----------------------------------------------------------------------------\n\nlayout(rgba32f, binding = 0) uniform image2D imgOutput;\n\nlayout (location = 0) uniform float t; /** Time */\n\n// ----------------------------------------------------------------------------\n//\n// functions\n//\n// ----------------------------------------------------------------------------\n\nvoid main() {\n\tvec4 value = vec4(0.0, 0.0, 0.0, 1.0);\n\tivec2 texelCoord = ivec2(gl_GlobalInvocationID.xy);\n\tfloat speed = 100;\n\t// the width of the texture\n\tfloat width = 1000;\n\n\tvalue.x = mod(float(texelCoord.x) + t * speed, width) / (gl_NumWorkGroups.x * gl_WorkGroupSize.x);\n\tvalue.y = float(texelCoord.y)/(gl_NumWorkGroups.y*gl_WorkGroupSize.y);\n\timageStore(imgOutput, texelCoord, value);\n}", "stage": "compute", "validation_status": "valid"}, {"path": "src/8.guest/2022/5.computeshader_helloworld/compute_shader_hello_world.cpp", "language": "code", "loc": 162, "comment_density": 0.21, "code": "#include \n#include \n\n#include \n#include \n#include \n\n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// texture size\nconst unsigned int TEXTURE_WIDTH = 1000, TEXTURE_HEIGHT = 1000;\n\n// timing \nfloat deltaTime = 0.0f; // time between current frame and last frame\nfloat lastFrame = 0.0f; // time of last frame\n\nint main(int argc, char* argv[])\n{\n\t// glfw: initialize and configure\n\t// ------------------------------\n\tglfwInit();\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);\n\tglfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n\tglfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n\t#ifdef __APPLE__\n\t\tglfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n\t#endif\n\n\t// glfw window creation\n\t// --------------------\n\tGLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n\tif (window == NULL)\n\t{\n\t\tstd::cout << \"Failed to create GLFW window\" << std::endl;\n\t\tglfwTerminate();\n\t\treturn -1;\n\t}\n\tglfwMakeContextCurrent(window);\n\tglfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\tglfwSwapInterval(0);\n\n\t// glad: load all OpenGL function pointers\n\t// ---------------------------------------\n\tif (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n\t{\n\t\tstd::cout << \"Failed to initialize GLAD\" << std::endl;\n\t\treturn -1;\n\t}\n\n\t// query limitations\n\t// -----------------\n\tint max_compute_work_group_count[3];\n\tint max_compute_work_group_size[3];\n\tint max_compute_work_group_invocations;\n\n\tfor (int idx = 0; idx < 3; idx++) {\n\t\tglGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, idx, &max_compute_work_group_count[idx]);\n\t\tglGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, idx, &max_compute_work_group_size[idx]);\n\t}\t\n\tglGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &max_compute_work_group_invocations);\n\n\tstd::cout << \"OpenGL Limitations: \" << std::endl;\n\tstd::cout << \"maximum number of work groups in X dimension \" << max_compute_work_group_count[0] << std::endl;\n\tstd::cout << \"maximum number of work groups in Y dimension \" << max_compute_work_group_count[1] << std::endl;\n\tstd::cout << \"maximum number of work groups in Z dimension \" << max_compute_work_group_count[2] << std::endl;\n\n\tstd::cout << \"maximum size of a work group in X dimension \" << max_compute_work_group_size[0] << std::endl;\n\tstd::cout << \"maximum size of a work group in Y dimension \" << max_compute_work_group_size[1] << std::endl;\n\tstd::cout << \"maximum size of a work group in Z dimension \" << max_compute_work_group_size[2] << std::endl;\n\n\tstd::cout << \"Number of invocations in a single local work group that may be dispatched to a compute shader \" << max_compute_work_group_invocations << std::endl;\n\n\t// build and compile shaders\n\t// -------------------------\n\tShader screenQuad(\"screenQuad.vs\", \"screenQuad.fs\");\n\tComputeShader computeShader(\"computeShader.cs\");\n\n\tscreenQuad.use();\n\tscreenQuad.setInt(\"tex\", 0);\n\n\t// Create texture for opengl operation\n\t// -----------------------------------\n\tunsigned int texture;\n\n\tglGenTextures(1, &texture);\n\tglActiveTexture(GL_TEXTURE0);\n\tglBindTexture(GL_TEXTURE_2D, texture);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, TEXTURE_WIDTH, TEXTURE_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n\n\tglBindImageTexture(0, texture, 0, GL_FALSE, 0, GL_READ_WRITE, GL_RGBA32F);\n\n\tglActiveTexture(GL_TEXTURE0);\n\tglBindTexture(GL_TEXTURE_2D, texture);\n\n\t// render loop\n\t// -----------\n\tint fCounter = 0;\n\twhile (!glfwWindowShouldClose(window))\n\t{\n\t\t// Set frame time\n\t\tfloat currentFrame = glfwGetTime();\n\t\tdeltaTime = currentFrame - lastFrame;\n\t\tlastFrame = currentFrame;\n\t\tif(fCounter > 500) {\n\t\t\tstd::cout << \"FPS: \" << 1 / deltaTime << std::endl;\n\t\t\tfCounter = 0;\n\t\t} else {\n\t\t\tfCounter++;\n\t\t}\t\t\n\n\t\tcomputeShader.use();\n\t\tcomputeShader.setFloat(\"t\", currentFrame);\n\t\tglDispatchCompute((unsigned int)TEXTURE_WIDTH/10, (unsigned int)TEXTURE_HEIGHT/10, 1);\n\n\t\t// make sure writing to image has finished before read\n\t\tglMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);\n\n\t\t// render image to quad\n\t\tglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\t\tscreenQuad.use();\n\t\t\n\t\trenderQuad();\n\n\t\t// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n\t\t// -------------------------------------------------------------------------------\n\t\tglfwSwapBuffers(window);\n\t\tglfwPollEvents();\n\t}\n\n\t// optional: de-allocate all resources once they've outlived their purpose:\n\t// ------------------------------------------------------------------------\n\tglDeleteTextures(1, &texture);\n\tglDeleteProgram(screenQuad.ID);\n\tglDeleteProgram(computeShader.ID);\n\n\tglfwTerminate();\n\n\treturn EXIT_SUCCESS;\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n\tif (quadVAO == 0)\n\t{\n\t\tfloat quadVertices[] = {\n\t\t\t// positions // texture Coords\n\t\t\t-1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n\t\t\t-1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n\t\t\t 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n\t\t\t 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n\t\t};\n\t\t// setup plane VAO\n\t\tglGenVertexArrays(1, &quadVAO);\n\t\tglGenBuffers(1, &quadVBO);\n\t\tglBindVertexArray(quadVAO);\n\t\tglBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n\t\tglBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n\t\tglEnableVertexAttribArray(0);\n\t\tglVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n\t\tglEnableVertexAttribArray(1);\n\t\tglVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n\t}\n\tglBindVertexArray(quadVAO);\n\tglDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n\tglBindVertexArray(0);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n\t// make sure the viewport matches the new window dimensions; note that width and \n\t// height will be significantly larger than specified on retina displays.\n\tglViewport(0, 0, width, height);\n}\n"}, {"path": "src/8.guest/2022/5.computeshader_helloworld/screenQuad.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 430 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D tex;\n\nvoid main()\n{ \n vec3 texCol = texture(tex, TexCoords).rgb; \n FragColor = vec4(texCol, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/5.computeshader_helloworld/screenQuad.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 430 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}\n", "stage": "vertex", "validation_status": "valid"}], "validation": {"glslang_valid": 3, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.177, "dedup_hash": "de8ac0ba0d07c0bd", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2022_6_physically_based_bloom", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:27+00:00", "source_type": "repo", "title": "6.Physically Based Bloom", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/postprocessing/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/8.guest/2022/6.physically_based_bloom/6.bloom.fs", "language": "glsl", "loc": 44, "comment_density": 0.114, "code": "#version 330 core\nlayout (location = 0) out vec4 FragColor;\nlayout (location = 1) out vec4 BrightColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nstruct Light {\n vec3 Position;\n vec3 Color;\n};\n\nuniform Light lights[4];\nuniform sampler2D diffuseTexture;\nuniform vec3 viewPos;\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n // ambient\n vec3 ambient = 0.0 * color;\n // lighting\n vec3 lighting = vec3(0.0);\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n for(int i = 0; i < 4; i++)\n {\n // diffuse\n vec3 lightDir = normalize(lights[i].Position - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 result = lights[i].Color * diff * color; \n // attenuation (use quadratic as we have gamma correction)\n float distance = length(fs_in.FragPos - lights[i].Position);\n result *= 1.0 / (distance * distance);\n lighting += result;\n \n }\n vec3 result = ambient + lighting;\n // check whether result is higher than some threshold, if so, output as bloom threshold color\n float brightness = dot(result, vec3(0.2126, 0.7152, 0.0722));\n if(brightness > 1.0)\n BrightColor = vec4(result, 1.0);\n else\n BrightColor = vec4(0.0, 0.0, 0.0, 1.0);\n FragColor = vec4(result, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.bloom.vs", "language": "glsl", "loc": 20, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); \n vs_out.TexCoords = aTexCoords;\n \n mat3 normalMatrix = transpose(inverse(mat3(model)));\n vs_out.Normal = normalize(normalMatrix * aNormal);\n \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.bloom_final.fs", "language": "glsl", "loc": 44, "comment_density": 0.114, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D scene;\nuniform sampler2D bloomBlur;\nuniform float exposure;\nuniform float bloomStrength = 0.04f;\nuniform int programChoice;\n\nvec3 bloom_none()\n{\n vec3 hdrColor = texture(scene, TexCoords).rgb;\n return hdrColor;\n}\n\nvec3 bloom_old()\n{\n vec3 hdrColor = texture(scene, TexCoords).rgb;\n vec3 bloomColor = texture(bloomBlur, TexCoords).rgb;\n return hdrColor + bloomColor; // additive blending\n}\n\nvec3 bloom_new()\n{\n vec3 hdrColor = texture(scene, TexCoords).rgb;\n vec3 bloomColor = texture(bloomBlur, TexCoords).rgb;\n return mix(hdrColor, bloomColor, bloomStrength); // linear interpolation\n}\n\nvoid main()\n{\n // to bloom or not to bloom\n vec3 result = vec3(0.0);\n switch (programChoice)\n {\n case 1: result = bloom_none(); break;\n case 2: result = bloom_old(); break;\n case 3: result = bloom_new(); break;\n default:\n result = bloom_none(); break;\n }\n // tone mapping\n result = vec3(1.0) - exp(-result * exposure);\n // also gamma correct while we're at it\n const float gamma = 2.2;\n result = pow(result, vec3(1.0 / gamma));\n FragColor = vec4(result, 1.0);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.bloom_final.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.light_box.fs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) out vec4 FragColor;\nlayout (location = 1) out vec4 BrightColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform vec3 lightColor;\n\nvoid main()\n{ \n FragColor = vec4(lightColor, 1.0);\n float brightness = dot(FragColor.rgb, vec3(0.2126, 0.7152, 0.0722));\n if(brightness > 1.0)\n BrightColor = vec4(FragColor.rgb, 1.0);\n\telse\n\t\tBrightColor = vec4(0.0, 0.0, 0.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.new_downsample.fs", "language": "glsl", "loc": 99, "comment_density": 0.394, "code": "#version 330 core\n\n// This shader performs downsampling on a texture,\n// as taken from Call Of Duty method, presented at ACM Siggraph 2014.\n// This particular method was customly designed to eliminate\n// \"pulsating artifacts and temporal stability issues\".\n\n// Remember to add bilinear minification filter for this texture!\n// Remember to use a floating-point texture format (for HDR)!\n// Remember to use edge clamping for this texture!\nuniform sampler2D srcTexture;\nuniform vec2 srcResolution;\n\n// which mip we are writing to, used for Karis average\nuniform int mipLevel = 1;\n\nin vec2 texCoord;\nlayout (location = 0) out vec3 downsample;\n\nvec3 PowVec3(vec3 v, float p)\n{\n return vec3(pow(v.x, p), pow(v.y, p), pow(v.z, p));\n}\n\nconst float invGamma = 1.0 / 2.2;\nvec3 ToSRGB(vec3 v) { return PowVec3(v, invGamma); }\n\nfloat sRGBToLuma(vec3 col)\n{\n //return dot(col, vec3(0.2126f, 0.7152f, 0.0722f));\n\treturn dot(col, vec3(0.299f, 0.587f, 0.114f));\n}\n\nfloat KarisAverage(vec3 col)\n{\n\t// Formula is 1 / (1 + luma)\n\tfloat luma = sRGBToLuma(ToSRGB(col)) * 0.25f;\n\treturn 1.0f / (1.0f + luma);\n}\n\n// NOTE: This is the readable version of this shader. It will be optimized!\nvoid main()\n{\n\tvec2 srcTexelSize = 1.0 / srcResolution;\n\tfloat x = srcTexelSize.x;\n\tfloat y = srcTexelSize.y;\n\n\t// Take 13 samples around current texel:\n\t// a - b - c\n\t// - j - k -\n\t// d - e - f\n\t// - l - m -\n\t// g - h - i\n\t// === ('e' is the current texel) ===\n\tvec3 a = texture(srcTexture, vec2(texCoord.x - 2*x, texCoord.y + 2*y)).rgb;\n\tvec3 b = texture(srcTexture, vec2(texCoord.x, texCoord.y + 2*y)).rgb;\n\tvec3 c = texture(srcTexture, vec2(texCoord.x + 2*x, texCoord.y + 2*y)).rgb;\n\n\tvec3 d = texture(srcTexture, vec2(texCoord.x - 2*x, texCoord.y)).rgb;\n\tvec3 e = texture(srcTexture, vec2(texCoord.x, texCoord.y)).rgb;\n\tvec3 f = texture(srcTexture, vec2(texCoord.x + 2*x, texCoord.y)).rgb;\n\n\tvec3 g = texture(srcTexture, vec2(texCoord.x - 2*x, texCoord.y - 2*y)).rgb;\n\tvec3 h = texture(srcTexture, vec2(texCoord.x, texCoord.y - 2*y)).rgb;\n\tvec3 i = texture(srcTexture, vec2(texCoord.x + 2*x, texCoord.y - 2*y)).rgb;\n\n\tvec3 j = texture(srcTexture, vec2(texCoord.x - x, texCoord.y + y)).rgb;\n\tvec3 k = texture(srcTexture, vec2(texCoord.x + x, texCoord.y + y)).rgb;\n\tvec3 l = texture(srcTexture, vec2(texCoord.x - x, texCoord.y - y)).rgb;\n\tvec3 m = texture(srcTexture, vec2(texCoord.x + x, texCoord.y - y)).rgb;\n\n\t// Apply weighted distribution:\n\t// 0.5 + 0.125 + 0.125 + 0.125 + 0.125 = 1\n\t// a,b,d,e * 0.125\n\t// b,c,e,f * 0.125\n\t// d,e,g,h * 0.125\n\t// e,f,h,i * 0.125\n\t// j,k,l,m * 0.5\n\t// This shows 5 square areas that are being sampled. But some of them overlap,\n\t// so to have an energy preserving downsample we need to make some adjustments.\n\t// The weights are the distributed, so that the sum of j,k,l,m (e.g.)\n\t// contribute 0.5 to the final color output. The code below is written\n\t// to effectively yield this sum. We get:\n\t// 0.125*5 + 0.03125*4 + 0.0625*4 = 1\n\n\t// Check if we need to perform Karis average on each block of 4 samples\n\tvec3 groups[5];\n\tswitch (mipLevel)\n\t{\n\tcase 0:\n\t // We are writing to mip 0, so we need to apply Karis average to each block\n\t // of 4 samples to prevent fireflies (very bright subpixels, leads to pulsating\n\t // artifacts).\n\t groups[0] = (a+b+d+e) * (0.125f/4.0f);\n\t groups[1] = (b+c+e+f) * (0.125f/4.0f);\n\t groups[2] = (d+e+g+h) * (0.125f/4.0f);\n\t groups[3] = (e+f+h+i) * (0.125f/4.0f);\n\t groups[4] = (j+k+l+m) * (0.5f/4.0f);\n\t groups[0] *= KarisAverage(groups[0]);\n\t groups[1] *= KarisAverage(groups[1]);\n\t groups[2] *= KarisAverage(groups[2]);\n\t groups[3] *= KarisAverage(groups[3]);\n\t groups[4] *= KarisAverage(groups[4]);\n\t downsample = groups[0]+groups[1]+groups[2]+groups[3]+groups[4];\n\t downsample = max(downsample, 0.0001f);\n\t break;\n\tdefault:\n\t downsample = e*0.125; // ok\n\t downsample += (a+c+g+i)*0.03125; // ok\n\t downsample += (b+d+f+h)*0.0625; // ok\n\t downsample += (j+k+l+m)*0.125; // ok\n\t break;\n\t}\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.new_downsample.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\n\nlayout (location = 0) in vec2 aPosition;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 texCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPosition.x, aPosition.y, 0.0, 1.0);\n\ttexCoord = aTexCoord;\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.new_upsample.fs", "language": "glsl", "loc": 39, "comment_density": 0.41, "code": "#version 330 core\n\n// This shader performs upsampling on a texture,\n// as taken from Call Of Duty method, presented at ACM Siggraph 2014.\n\n// Remember to add bilinear minification filter for this texture!\n// Remember to use a floating-point texture format (for HDR)!\n// Remember to use edge clamping for this texture!\nuniform sampler2D srcTexture;\nuniform float filterRadius;\n\nin vec2 texCoord;\nlayout (location = 0) out vec3 upsample;\n\nvoid main()\n{\n\t// The filter kernel is applied with a radius, specified in texture\n\t// coordinates, so that the radius will vary across mip resolutions.\n\tfloat x = filterRadius;\n\tfloat y = filterRadius;\n\n\t// Take 9 samples around current texel:\n\t// a - b - c\n\t// d - e - f\n\t// g - h - i\n\t// === ('e' is the current texel) ===\n\tvec3 a = texture(srcTexture, vec2(texCoord.x - x, texCoord.y + y)).rgb;\n\tvec3 b = texture(srcTexture, vec2(texCoord.x, texCoord.y + y)).rgb;\n\tvec3 c = texture(srcTexture, vec2(texCoord.x + x, texCoord.y + y)).rgb;\n\n\tvec3 d = texture(srcTexture, vec2(texCoord.x - x, texCoord.y)).rgb;\n\tvec3 e = texture(srcTexture, vec2(texCoord.x, texCoord.y)).rgb;\n\tvec3 f = texture(srcTexture, vec2(texCoord.x + x, texCoord.y)).rgb;\n\n\tvec3 g = texture(srcTexture, vec2(texCoord.x - x, texCoord.y - y)).rgb;\n\tvec3 h = texture(srcTexture, vec2(texCoord.x, texCoord.y - y)).rgb;\n\tvec3 i = texture(srcTexture, vec2(texCoord.x + x, texCoord.y - y)).rgb;\n\n\t// Apply weighted distribution, by using a 3x3 tent filter:\n\t// 1 | 1 2 1 |\n\t// -- * | 2 4 2 |\n\t// 16 | 1 2 1 |\n\tupsample = e*4.0;\n\tupsample += (b+d+f+h)*2.0;\n\tupsample += (a+c+g+i);\n\tupsample *= 1.0 / 16.0;\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.new_upsample.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\n\nlayout (location = 0) in vec2 aPosition;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 texCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPosition.x, aPosition.y, 0.0, 1.0);\n\ttexCoord = aTexCoord;\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.old_blur.fs", "language": "glsl", "loc": 28, "comment_density": 0.036, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D image;\n\nuniform bool horizontal;\nuniform float weight[5] = float[] (0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162);\n\nvoid main()\n{ \n vec2 tex_offset = 1.0 / textureSize(image, 0); // gets size of single texel\n vec3 result = texture(image, TexCoords).rgb * weight[0];\n if(horizontal)\n {\n for(int i = 1; i < 5; ++i)\n {\n result += texture(image, TexCoords + vec2(tex_offset.x * i, 0.0)).rgb * weight[i];\n result += texture(image, TexCoords - vec2(tex_offset.x * i, 0.0)).rgb * weight[i];\n }\n }\n else\n {\n for(int i = 1; i < 5; ++i)\n {\n result += texture(image, TexCoords + vec2(0.0, tex_offset.y * i)).rgb * weight[i];\n result += texture(image, TexCoords - vec2(0.0, tex_offset.y * i)).rgb * weight[i];\n }\n }\n FragColor = vec4(result, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/6.old_blur.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/6.physically_based_bloom/physically_based_bloom.cpp", "language": "code", "loc": 744, "comment_density": 0.204, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\nvoid renderQuad();\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool bloom = true;\nfloat exposure = 1.0f;\nint programChoice = 1;\nfloat bloomFilterRadius = 0.005f;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 5.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// bloom stuff\nstruct bloomMip\n{\n\tglm::vec2 size;\n\tglm::ivec2 intSize;\n\tunsigned int texture;\n};\n\nclass bloomFBO\n{\npublic:\n\tbloomFBO();\n\t~bloomFBO();\n\tbool Init(unsigned int windowWidth, unsigned int windowHeight, unsigned int mipChainLength);\n\tvoid Destroy();\n\tvoid BindForWriting();\n\tconst std::vector& MipChain() const;\n\nprivate:\n\tbool mInit;\n\tunsigned int mFBO;\n\tstd::vector mMipChain;\n};\n\nbloomFBO::bloomFBO() : mInit(false) {}\nbloomFBO::~bloomFBO() {}\n\nbool bloomFBO::Init(unsigned int windowWidth, unsigned int windowHeight, unsigned int mipChainLength)\n{\n\tif (mInit) return true;\n\n\tglGenFramebuffers(1, &mFBO);\n\tglBindFramebuffer(GL_FRAMEBUFFER, mFBO);\n\n\tglm::vec2 mipSize((float)windowWidth, (float)windowHeight);\n\tglm::ivec2 mipIntSize((int)windowWidth, (int)windowHeight);\n\t// Safety check\n\tif (windowWidth > (unsigned int)INT_MAX || windowHeight > (unsigned int)INT_MAX) {\n\t\tstd::cerr << \"Window size conversion overflow - cannot build bloom FBO!\" << std::endl;\n\t\treturn false;\n\t}\n\n\tfor (GLuint i = 0; i < mipChainLength; i++)\n\t{\n\t\tbloomMip mip;\n\n\t\tmipSize *= 0.5f;\n\t\tmipIntSize /= 2;\n\t\tmip.size = mipSize;\n\t\tmip.intSize = mipIntSize;\n\n\t\tglGenTextures(1, &mip.texture);\n\t\tglBindTexture(GL_TEXTURE_2D, mip.texture);\n\t\t// we are downscaling an HDR color buffer, so we need a float texture format\n\t\tglTexImage2D(GL_TEXTURE_2D, 0, GL_R11F_G11F_B10F,\n\t\t (int)mipSize.x, (int)mipSize.y,\n\t\t 0, GL_RGB, GL_FLOAT, nullptr);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n\n\t\tstd::cout << \"Created bloom mip \" << mipIntSize.x << 'x' << mipIntSize.y << std::endl;\n\t\tmMipChain.emplace_back(mip);\n\t}\n\n\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,\n\t GL_TEXTURE_2D, mMipChain[0].texture, 0);\n\n\t// setup attachments\n\tunsigned int attachments[1] = { GL_COLOR_ATTACHMENT0 };\n\tglDrawBuffers(1, attachments);\n\n\t// check completion status\n\tint status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\n\tif (status != GL_FRAMEBUFFER_COMPLETE)\n\t{\n\t\tprintf(\"gbuffer FBO error, status: 0x%x\\n\", status);\n\t\tglBindFramebuffer(GL_FRAMEBUFFER, 0);\n\t\treturn false;\n\t}\n\n\tglBindFramebuffer(GL_FRAMEBUFFER, 0);\n\tmInit = true;\n\treturn true;\n}\n\nvoid bloomFBO::Destroy()\n{\n\tfor (int i = 0; i < (int)mMipChain.size(); i++) {\n\t\tglDeleteTextures(1, &mMipChain[i].texture);\n\t\tmMipChain[i].texture = 0;\n\t}\n\tglDeleteFramebuffers(1, &mFBO);\n\tmFBO = 0;\n\tmInit = false;\n}\n\nvoid bloomFBO::BindForWriting()\n{\n\tglBindFramebuffer(GL_FRAMEBUFFER, mFBO);\n}\n\nconst std::vector& bloomFBO::MipChain() const\n{\n\treturn mMipChain;\n}\n\n\n\nclass BloomRenderer\n{\npublic:\n\tBloomRenderer();\n\t~BloomRenderer();\n\tbool Init(unsigned int windowWidth, unsigned int windowHeight);\n\tvoid Destroy();\n\tvoid RenderBloomTexture(unsigned int srcTexture, float filterRadius);\n\tunsigned int BloomTexture();\n\tunsigned int BloomMip_i(int index);\n\nprivate:\n\tvoid RenderDownsamples(unsigned int srcTexture);\n\tvoid RenderUpsamples(float filterRadius);\n\n\tbool mInit;\n\tbloomFBO mFBO;\n\tglm::ivec2 mSrcViewportSize;\n\tglm::vec2 mSrcViewportSizeFloat;\n\tShader* mDownsampleShader;\n\tShader* mUpsampleShader;\n\n\tbool mKarisAverageOnDownsample = true;\n};\n\nBloomRenderer::BloomRenderer() : mInit(false) {}\nBloomRenderer::~BloomRenderer() {}\n\nbool BloomRenderer::Init(unsigned int windowWidth, unsigned int windowHeight)\n{\n\tif (mInit) return true;\n\tmSrcViewportSize = glm::ivec2(windowWidth, windowHeight);\n\tmSrcViewportSizeFloat = glm::vec2((float)windowWidth, (float)windowHeight);\n\n\t// Framebuffer\n\tconst unsigned int num_bloom_mips = 6; // TODO: Play around with this value\n\tbool status = mFBO.Init(windowWidth, windowHeight, num_bloom_mips);\n\tif (!status) {\n\t\tstd::cerr << \"Failed to initialize bloom FBO - cannot create bloom renderer!\\n\";\n\t\treturn false;\n\t}\n\n\t// Shaders\n\tmDownsampleShader = new Shader(\"6.new_downsample.vs\", \"6.new_downsample.fs\");\n mUpsampleShader = new Shader(\"6.new_upsample.vs\", \"6.new_upsample.fs\");\n\n\t// Downsample\n mDownsampleShader->use();\n mDownsampleShader->setInt(\"srcTexture\", 0);\n glUseProgram(0);\n\n // Upsample\n mUpsampleShader->use();\n mUpsampleShader->setInt(\"srcTexture\", 0);\n glUseProgram(0);\n\n return true;\n}\n\nvoid BloomRenderer::Destroy()\n{\n\tmFBO.Destroy();\n\tdelete mDownsampleShader;\n\tdelete mUpsampleShader;\n}\n\nvoid BloomRenderer::RenderDownsamples(unsigned int srcTexture)\n{\n\tconst std::vector& mipChain = mFBO.MipChain();\n\n\tmDownsampleShader->use();\n\tmDownsampleShader->setVec2(\"srcResolution\", mSrcViewportSizeFloat);\n\tif (mKarisAverageOnDownsample) {\n\t\tmDownsampleShader->setInt(\"mipLevel\", 0);\n\t}\n\n\t// Bind srcTexture (HDR color buffer) as initial texture input\n\tglActiveTexture(GL_TEXTURE0);\n\tglBindTexture(GL_TEXTURE_2D, srcTexture);\n\n\t// Progressively downsample through the mip chain\n\tfor (int i = 0; i < (int)mipChain.size(); i++)\n\t{\n\t\tconst bloomMip& mip = mipChain[i];\n\t\tglViewport(0, 0, mip.size.x, mip.size.y);\n\t\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,\n\t\t GL_TEXTURE_2D, mip.texture, 0);\n\n\t\t// Render screen-filled quad of resolution of current mip\n\t\trenderQuad();\n\n\t\t// Set current mip resolution as srcResolution for next iteration\n\t\tmDownsampleShader->setVec2(\"srcResolution\", mip.size);\n\t\t// Set current mip as texture input for next iteration\n\t\tglBindTexture(GL_TEXTURE_2D, mip.texture);\n\t\t// Disable Karis average for consequent downsamples\n\t\tif (i == 0) { mDownsampleShader->setInt(\"mipLevel\", 1); }\n\t}\n\n\tglUseProgram(0);\n}\n\nvoid BloomRenderer::RenderUpsamples(float filterRadius)\n{\n\tconst std::vector& mipChain = mFBO.MipChain();\n\n\tmUpsampleShader->use();\n\tmUpsampleShader->setFloat(\"filterRadius\", filterRadius);\n\n\t// Enable additive blending\n\tglEnable(GL_BLEND);\n\tglBlendFunc(GL_ONE, GL_ONE);\n\tglBlendEquation(GL_FUNC_ADD);\n\n\tfor (int i = (int)mipChain.size() - 1; i > 0; i--)\n\t{\n\t\tconst bloomMip& mip = mipChain[i];\n\t\tconst bloomMip& nextMip = mipChain[i-1];\n\n\t\t// Bind viewport and texture from where to read\n\t\tglActiveTexture(GL_TEXTURE0);\n\t\tglBindTexture(GL_TEXTURE_2D, mip.texture);\n\n\t\t// Set framebuffer render target (we write to this texture)\n\t\tglViewport(0, 0, nextMip.size.x, nextMip.size.y);\n\t\tglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,\n\t\t GL_TEXTURE_2D, nextMip.texture, 0);\n\n\t\t// Render screen-filled quad of resolution of current mip\n\t\trenderQuad();\n\t}\n\n\t// Disable additive blending\n\t//glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);\n\tglDisable(GL_BLEND);\n\n\tglUseProgram(0);\n}\n\nvoid BloomRenderer::RenderBloomTexture(unsigned int srcTexture, float filterRadius)\n{\n\tmFBO.BindForWriting();\n\n\tthis->RenderDownsamples(srcTexture);\n\tthis->RenderUpsamples(filterRadius);\n\n\tglBindFramebuffer(GL_FRAMEBUFFER, 0);\n\t// Restore viewport\n\tglViewport(0, 0, mSrcViewportSize.x, mSrcViewportSize.y);\n}\n\nGLuint BloomRenderer::BloomTexture()\n{\n\treturn mFBO.MipChain()[0].texture;\n}\n\nGLuint BloomRenderer::BloomMip_i(int index)\n{\n\tconst std::vector& mipChain = mFBO.MipChain();\n\tint size = (int)mipChain.size();\n\treturn mipChain[(index > size-1) ? size-1 : (index < 0) ? 0 : index].texture;\n}\n\n\n\n\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"6.bloom.vs\", \"6.bloom.fs\");\n Shader shaderLight(\"6.bloom.vs\", \"6.light_box.fs\");\n Shader shaderBlur(\"6.old_blur.vs\", \"6.old_blur.fs\");\n Shader shaderBloomFinal(\"6.bloom_final.vs\", \"6.bloom_final.fs\");\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str(), true); // note that we're loading the texture as an SRGB texture\n unsigned int containerTexture = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str(), true); // note that we're loading the texture as an SRGB texture\n\n // configure (floating point) framebuffers\n // ---------------------------------------\n unsigned int hdrFBO;\n glGenFramebuffers(1, &hdrFBO);\n glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);\n // create 2 floating point color buffers (1 for normal rendering, other for brightness threshold values)\n unsigned int colorBuffers[2];\n glGenTextures(2, colorBuffers);\n for (unsigned int i = 0; i < 2; i++)\n {\n glBindTexture(GL_TEXTURE_2D, colorBuffers[i]);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // we clamp to the edge as the blur filter would otherwise sample repeated texture values!\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n // attach texture to framebuffer\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, colorBuffers[i], 0);\n }\n // create and attach depth buffer (renderbuffer)\n unsigned int rboDepth;\n glGenRenderbuffers(1, &rboDepth);\n glBindRenderbuffer(GL_RENDERBUFFER, rboDepth);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, SCR_WIDTH, SCR_HEIGHT);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepth);\n // tell OpenGL which color attachments we'll use (of this framebuffer) for rendering\n unsigned int attachments[2] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };\n glDrawBuffers(2, attachments);\n // finally check if framebuffer is complete\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"Framebuffer not complete!\" << std::endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // ping-pong-framebuffer for blurring\n unsigned int pingpongFBO[2];\n unsigned int pingpongColorbuffers[2];\n glGenFramebuffers(2, pingpongFBO);\n glGenTextures(2, pingpongColorbuffers);\n for (unsigned int i = 0; i < 2; i++)\n {\n glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[i]);\n glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[i]);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // we clamp to the edge as the blur filter would otherwise sample repeated texture values!\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pingpongColorbuffers[i], 0);\n // also check if framebuffers are complete (no need for depth buffer)\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n std::cout << \"Framebuffer not complete!\" << std::endl;\n }\n\n // lighting info\n // -------------\n // positions\n std::vector lightPositions;\n lightPositions.push_back(glm::vec3( 0.0f, 0.5f, 1.5f));\n lightPositions.push_back(glm::vec3(-4.0f, 0.5f, -3.0f));\n lightPositions.push_back(glm::vec3( 3.0f, 0.5f, 1.0f));\n lightPositions.push_back(glm::vec3(-.8f, 2.4f, -1.0f));\n // colors\n std::vector lightColors;\n lightColors.push_back(glm::vec3(5.0f, 5.0f, 5.0f));\n lightColors.push_back(glm::vec3(10.0f, 0.0f, 0.0f));\n lightColors.push_back(glm::vec3(0.0f, 0.0f, 15.0f));\n lightColors.push_back(glm::vec3(0.0f, 5.0f, 0.0f));\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shaderBlur.use();\n shaderBlur.setInt(\"image\", 0);\n shaderBloomFinal.use();\n shaderBloomFinal.setInt(\"scene\", 0);\n shaderBloomFinal.setInt(\"bloomBlur\", 1);\n\n // bloom renderer\n // --------------\n BloomRenderer bloomRenderer;\n bloomRenderer.Init(SCR_WIDTH, SCR_HEIGHT);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render scene into floating point framebuffer\n // -----------------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n // set lighting uniforms\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n shader.setVec3(\"lights[\" + std::to_string(i) + \"].Position\", lightPositions[i]);\n shader.setVec3(\"lights[\" + std::to_string(i) + \"].Color\", lightColors[i]);\n }\n shader.setVec3(\"viewPos\", camera.Position);\n // create one large cube that acts as the floor\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, -1.0f, 0.0));\n model = glm::scale(model, glm::vec3(12.5f, 0.5f, 12.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n // then create multiple cubes as the scenery\n glBindTexture(GL_TEXTURE_2D, containerTexture);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 1.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, -1.0f, 2.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 2.7f, 4.0));\n model = glm::rotate(model, glm::radians(23.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(1.25));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-2.0f, 1.0f, -3.0));\n model = glm::rotate(model, glm::radians(124.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n shader.setMat4(\"model\", model);\n renderCube();\n\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-3.0f, 0.0f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n\n // finally show all the light sources as bright cubes\n shaderLight.use();\n shaderLight.setMat4(\"projection\", projection);\n shaderLight.setMat4(\"view\", view);\n\n for (unsigned int i = 0; i < lightPositions.size(); i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(lightPositions[i]));\n model = glm::scale(model, glm::vec3(0.25f));\n shaderLight.setMat4(\"model\", model);\n shaderLight.setVec3(\"lightColor\", lightColors[i]);\n renderCube();\n }\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n if (programChoice < 1 || programChoice > 3) { programChoice = 1; }\n bloom = (programChoice == 1) ? false : true;\n bool horizontal = true;\n\n // 2.A) bloom is disabled\n // ----------------------\n if (programChoice == 1)\n {\n\n }\n\n // 2.B) blur bright fragments with two-pass Gaussian Blur\n // ------------------------------------------------------\n else if (programChoice == 2)\n {\n\t bool first_iteration = true;\n\t unsigned int amount = 10;\n\t shaderBlur.use();\n\t for (unsigned int i = 0; i < amount; i++)\n\t {\n\t\t glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[horizontal]);\n\t\t shaderBlur.setInt(\"horizontal\", horizontal);\n\t\t glBindTexture(GL_TEXTURE_2D, first_iteration ? colorBuffers[1] : pingpongColorbuffers[!horizontal]); // bind texture of other framebuffer (or scene if first iteration)\n\t\t renderQuad();\n\t\t horizontal = !horizontal;\n\t\t if (first_iteration)\n\t\t\t first_iteration = false;\n\t }\n\t glBindFramebuffer(GL_FRAMEBUFFER, 0);\n }\n\n // 2.C) use unthresholded bloom with progressive downsample/upsampling\n // -------------------------------------------------------------------\n else if (programChoice == 3)\n {\n\t bloomRenderer.RenderBloomTexture(colorBuffers[1], bloomFilterRadius);\n }\n\n // 3. now render floating point color buffer to 2D quad and tonemap HDR colors to default framebuffer's (clamped) color range\n // --------------------------------------------------------------------------------------------------------------------------\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shaderBloomFinal.use();\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, colorBuffers[0]);\n glActiveTexture(GL_TEXTURE1);\n if (programChoice == 1) {\n\t glBindTexture(GL_TEXTURE_2D, 0); // trick to bind invalid texture \"0\", we don't care either way!\n }\n if (programChoice == 2) {\n\t glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[!horizontal]);\n }\n else if (programChoice == 3) {\n\t glBindTexture(GL_TEXTURE_2D, bloomRenderer.BloomTexture());\n }\n shaderBloomFinal.setInt(\"programChoice\", programChoice);\n shaderBloomFinal.setFloat(\"exposure\", exposure);\n renderQuad();\n\n //std::cout << \"bloom: \" << (bloom ? \"on\" : \"off\") << \"| exposure: \" << exposure << std::endl;\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n bloomRenderer.Destroy();\n glfwTerminate();\n return 0;\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left\n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left\n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)\n {\n if (exposure > 0.0f)\n exposure -= 0.001f;\n else\n exposure = 0.0f;\n }\n else if (glfwGetKey(window, GLFW_KEY_E) == GLFW_PRESS)\n {\n exposure += 0.001f;\n }\n\n if (glfwGetKey(window, GLFW_KEY_1) == GLFW_PRESS)\n {\n\t programChoice = 1;\n }\n else if (glfwGetKey(window, GLFW_KEY_2) == GLFW_PRESS)\n {\n\t programChoice = 2;\n }\n else if (glfwGetKey(window, GLFW_KEY_3) == GLFW_PRESS)\n {\n\t programChoice = 3;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and\n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path, bool gammaCorrection)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum internalFormat;\n GLenum dataFormat;\n if (nrComponents == 1)\n {\n internalFormat = dataFormat = GL_RED;\n }\n else if (nrComponents == 3)\n {\n internalFormat = gammaCorrection ? GL_SRGB : GL_RGB;\n dataFormat = GL_RGB;\n }\n else if (nrComponents == 4)\n {\n internalFormat = gammaCorrection ? GL_SRGB_ALPHA : GL_RGBA;\n dataFormat = GL_RGBA;\n }\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, dataFormat, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 11, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.106, "dedup_hash": "73b63e46db16f873", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2022_7_area_lights", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:27+00:00", "source_type": "repo", "title": "7.Area Lights", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/8.guest/2022/7.area_lights/colors.hpp", "language": "code", "loc": 148, "comment_density": 0.02, "code": "#pragma once\n\n// GLM\n#include \n\n\n// Color values found at:\n// https://www.rapidtables.com/web/color/RGB_Color.html\n\nclass Color\n{\npublic:\n\tstatic inline glm::vec3 Maroon = glm::vec3(0.501961f, 0.0f, 0.0f);\n\tstatic inline glm::vec3 DarkRed = glm::vec3(0.545098f, 0.0f, 0.0f);\n\tstatic inline glm::vec3 Brown = glm::vec3(0.647059f, 0.164706f, 0.164706f);\n\tstatic inline glm::vec3 Firebrick = glm::vec3(0.698039f, 0.133333f, 0.133333f);\n\tstatic inline glm::vec3 Crimson = glm::vec3(0.862745f, 0.0784314f, 0.235294f);\n\tstatic inline glm::vec3 Red = glm::vec3(1.0f, 0.0f, 0.0f);\n\tstatic inline glm::vec3 Tomato = glm::vec3(1.0f, 0.388235f, 0.278431f);\n\tstatic inline glm::vec3 Coral = glm::vec3(1.0f, 0.498039f, 0.313726f);\n\tstatic inline glm::vec3 IndianRed = glm::vec3(0.803922f, 0.360784f, 0.360784f);\n\tstatic inline glm::vec3 LightCoral = glm::vec3(0.941176f, 0.501961f, 0.501961f);\n\tstatic inline glm::vec3 DarkSalmon = glm::vec3(0.913725f, 0.588235f, 0.478431f);\n\tstatic inline glm::vec3 Salmon = glm::vec3(0.980392f, 0.501961f, 0.447059f);\n\tstatic inline glm::vec3 LightSalmon = glm::vec3(1.0f, 0.627451f, 0.478431f);\n\tstatic inline glm::vec3 OrangeRed = glm::vec3(1.0f, 0.270588f, 0.0f);\n\tstatic inline glm::vec3 DarkOrange = glm::vec3(1.0f, 0.54902f, 0.0f);\n\tstatic inline glm::vec3 Orange = glm::vec3(1.0f, 0.647059f, 0.0f);\n\tstatic inline glm::vec3 Gold = glm::vec3(1.0f, 0.843137f, 0.0f);\n\tstatic inline glm::vec3 DarkGoldenRod = glm::vec3(0.721569f, 0.52549f, 0.0431373f);\n\tstatic inline glm::vec3 GoldenRod = glm::vec3(0.854902f, 0.647059f, 0.12549f);\n\tstatic inline glm::vec3 PaleGoldenRod = glm::vec3(0.933333f, 0.909804f, 0.666667f);\n\tstatic inline glm::vec3 DarkKhaki = glm::vec3(0.741176f, 0.717647f, 0.419608f);\n\tstatic inline glm::vec3 Khaki = glm::vec3(0.941176f, 0.901961f, 0.54902f);\n\tstatic inline glm::vec3 Olive = glm::vec3(0.501961f, 0.501961f, 0.0f);\n\tstatic inline glm::vec3 Yellow = glm::vec3(1.0f, 1.0f, 0.0f);\n\tstatic inline glm::vec3 YellowGreen = glm::vec3(0.603922f, 0.803922f, 0.196078f);\n\tstatic inline glm::vec3 DarkOliveGreen = glm::vec3(0.333333f, 0.419608f, 0.184314f);\n\tstatic inline glm::vec3 OliveDrab = glm::vec3(0.419608f, 0.556863f, 0.137255f);\n\tstatic inline glm::vec3 LawnGreen = glm::vec3(0.486275f, 0.988235f, 0.0f);\n\tstatic inline glm::vec3 ChartReuse = glm::vec3(0.498039f, 1.0f, 0.0f);\n\tstatic inline glm::vec3 GreenYellow = glm::vec3(0.678431f, 1.0f, 0.184314f);\n\tstatic inline glm::vec3 DarkGreen = glm::vec3(0.0f, 0.392157f, 0.0f);\n\tstatic inline glm::vec3 Green = glm::vec3(0.0f, 0.501961f, 0.0f);\n\tstatic inline glm::vec3 ForestGreen = glm::vec3(0.133333f, 0.545098f, 0.133333f);\n\tstatic inline glm::vec3 Lime = glm::vec3(0.0f, 1.0f, 0.0f);\n\tstatic inline glm::vec3 LimeGreen = glm::vec3(0.196078f, 0.803922f, 0.196078f);\n\tstatic inline glm::vec3 LightGreen = glm::vec3(0.564706f, 0.933333f, 0.564706f);\n\tstatic inline glm::vec3 PaleGreen = glm::vec3(0.596078f, 0.984314f, 0.596078f);\n\tstatic inline glm::vec3 DarkSeaGreen = glm::vec3(0.560784f, 0.737255f, 0.560784f);\n\tstatic inline glm::vec3 MediumSpringGreen = glm::vec3(0.0f, 0.980392f, 0.603922f);\n\tstatic inline glm::vec3 SpringGreen = glm::vec3(0.0f, 1.0f, 0.498039f);\n\tstatic inline glm::vec3 SeaGreen = glm::vec3(0.180392f, 0.545098f, 0.341176f);\n\tstatic inline glm::vec3 MediumAquaMarine = glm::vec3(0.4f, 0.803922f, 0.666667f);\n\tstatic inline glm::vec3 MediumSeaGreen = glm::vec3(0.235294f, 0.701961f, 0.443137f);\n\tstatic inline glm::vec3 LightSeaGreen = glm::vec3(0.12549f, 0.698039f, 0.666667f);\n\tstatic inline glm::vec3 DarkSlateGray = glm::vec3(0.184314f, 0.309804f, 0.309804f);\n\tstatic inline glm::vec3 Teal = glm::vec3(0.0f, 0.501961f, 0.501961f);\n\tstatic inline glm::vec3 DarkCyan = glm::vec3(0.0f, 0.545098f, 0.545098f);\n\tstatic inline glm::vec3 Aqua = glm::vec3(0.0f, 1.0f, 1.0f);\n\tstatic inline glm::vec3 Cyan = glm::vec3(0.0f, 1.0f, 1.0f);\n\tstatic inline glm::vec3 LightCyan = glm::vec3(0.878431f, 1.0f, 1.0f);\n\tstatic inline glm::vec3 DarkTurquoise = glm::vec3(0.0f, 0.807843f, 0.819608f);\n\tstatic inline glm::vec3 Turquoise = glm::vec3(0.25098f, 0.878431f, 0.815686f);\n\tstatic inline glm::vec3 MediumTurquoise = glm::vec3(0.282353f, 0.819608f, 0.8f);\n\tstatic inline glm::vec3 PaleTurquoise = glm::vec3(0.686275f, 0.933333f, 0.933333f);\n\tstatic inline glm::vec3 Aquamarine = glm::vec3(0.498039f, 1.0f, 0.831373f);\n\tstatic inline glm::vec3 PowderBlue = glm::vec3(0.690196f, 0.878431f, 0.901961f);\n\tstatic inline glm::vec3 CadetBlue = glm::vec3(0.372549f, 0.619608f, 0.627451f);\n\tstatic inline glm::vec3 SteelBlue = glm::vec3(0.27451f, 0.509804f, 0.705882f);\n\tstatic inline glm::vec3 CornflowerBlue = glm::vec3(0.392157f, 0.584314f, 0.929412f);\n\tstatic inline glm::vec3 DeepSkyBlue = glm::vec3(0.0f, 0.74902f, 1.0f);\n\tstatic inline glm::vec3 DodgerBlue = glm::vec3(0.117647f, 0.564706f, 1.0f);\n\tstatic inline glm::vec3 LightBlue = glm::vec3(0.678431f, 0.847059f, 0.901961f);\n\tstatic inline glm::vec3 SkyBlue = glm::vec3(0.529412f, 0.807843f, 0.921569f);\n\tstatic inline glm::vec3 LightSkyBlue = glm::vec3(0.529412f, 0.807843f, 0.980392f);\n\tstatic inline glm::vec3 MidnightBlue = glm::vec3(0.0980392f, 0.0980392f, 0.439216f);\n\tstatic inline glm::vec3 Navy = glm::vec3(0.0f, 0.0f, 0.501961f);\n\tstatic inline glm::vec3 DarkBlue = glm::vec3(0.0f, 0.0f, 0.545098f);\n\tstatic inline glm::vec3 MediumBlue = glm::vec3(0.0f, 0.0f, 0.803922f);\n\tstatic inline glm::vec3 Blue = glm::vec3(0.0f, 0.0f, 1.0f);\n\tstatic inline glm::vec3 RoyalBlue = glm::vec3(0.254902f, 0.411765f, 0.882353f);\n\tstatic inline glm::vec3 BlueViolet = glm::vec3(0.541176f, 0.168627f, 0.886275f);\n\tstatic inline glm::vec3 Indigo = glm::vec3(0.294118f, 0.0f, 0.509804f);\n\tstatic inline glm::vec3 DarkSlateBlue = glm::vec3(0.282353f, 0.239216f, 0.545098f);\n\tstatic inline glm::vec3 SlateBlue = glm::vec3(0.415686f, 0.352941f, 0.803922f);\n\tstatic inline glm::vec3 MediumSlateBlue = glm::vec3(0.482353f, 0.407843f, 0.933333f);\n\tstatic inline glm::vec3 MediumPurple = glm::vec3(0.576471f, 0.439216f, 0.858824f);\n\tstatic inline glm::vec3 DarkMagenta = glm::vec3(0.545098f, 0.0f, 0.545098f);\n\tstatic inline glm::vec3 DarkViolet = glm::vec3(0.580392f, 0.0f, 0.827451f);\n\tstatic inline glm::vec3 DarkOrchid = glm::vec3(0.6f, 0.196078f, 0.8f);\n\tstatic inline glm::vec3 MediumOrchid = glm::vec3(0.729412f, 0.333333f, 0.827451f);\n\tstatic inline glm::vec3 Purple = glm::vec3(0.501961f, 0.0f, 0.501961f);\n\tstatic inline glm::vec3 Thistle = glm::vec3(0.847059f, 0.74902f, 0.847059f);\n\tstatic inline glm::vec3 Plum = glm::vec3(0.866667f, 0.627451f, 0.866667f);\n\tstatic inline glm::vec3 Violet = glm::vec3(0.933333f, 0.509804f, 0.933333f);\n\tstatic inline glm::vec3 Magenta = glm::vec3(1.0f, 0.0f, 1.0f);\n\tstatic inline glm::vec3 Orchid = glm::vec3(0.854902f, 0.439216f, 0.839216f);\n\tstatic inline glm::vec3 MediumVioletRed = glm::vec3(0.780392f, 0.0823529f, 0.521569f);\n\tstatic inline glm::vec3 PaleVioletRed = glm::vec3(0.858824f, 0.439216f, 0.576471f);\n\tstatic inline glm::vec3 DeepPink = glm::vec3(1.0f, 0.0784314f, 0.576471f);\n\tstatic inline glm::vec3 HotPink = glm::vec3(1.0f, 0.411765f, 0.705882f);\n\tstatic inline glm::vec3 LightPink = glm::vec3(1.0f, 0.713726f, 0.756863f);\n\tstatic inline glm::vec3 Pink = glm::vec3(1.0f, 0.752941f, 0.796078f);\n\tstatic inline glm::vec3 AntiqueWhite = glm::vec3(0.980392f, 0.921569f, 0.843137f);\n\tstatic inline glm::vec3 Beige = glm::vec3(0.960784f, 0.960784f, 0.862745f);\n\tstatic inline glm::vec3 Bisque = glm::vec3(1.0f, 0.894118f, 0.768627f);\n\tstatic inline glm::vec3 BlanchedAlmond = glm::vec3(1.0f, 0.921569f, 0.803922f);\n\tstatic inline glm::vec3 Wheat = glm::vec3(0.960784f, 0.870588f, 0.701961f);\n\tstatic inline glm::vec3 CornSilk = glm::vec3(1.0f, 0.972549f, 0.862745f);\n\tstatic inline glm::vec3 LemonChiffon = glm::vec3(1.0f, 0.980392f, 0.803922f);\n\tstatic inline glm::vec3 LightGoldenRodYellow = glm::vec3(0.980392f, 0.980392f, 0.823529f);\n\tstatic inline glm::vec3 LightYellow = glm::vec3(1.0f, 1.0f, 0.878431f);\n\tstatic inline glm::vec3 SaddleBrown = glm::vec3(0.545098f, 0.270588f, 0.0745098f);\n\tstatic inline glm::vec3 Sienna = glm::vec3(0.627451f, 0.321569f, 0.176471f);\n\tstatic inline glm::vec3 Chocolate = glm::vec3(0.823529f, 0.411765f, 0.117647f);\n\tstatic inline glm::vec3 Peru = glm::vec3(0.803922f, 0.521569f, 0.247059f);\n\tstatic inline glm::vec3 SandyBrown = glm::vec3(0.956863f, 0.643137f, 0.376471f);\n\tstatic inline glm::vec3 BurlyWood = glm::vec3(0.870588f, 0.721569f, 0.529412f);\n\tstatic inline glm::vec3 Tan = glm::vec3(0.823529f, 0.705882f, 0.54902f);\n\tstatic inline glm::vec3 RosyBrown = glm::vec3(0.737255f, 0.560784f, 0.560784f);\n\tstatic inline glm::vec3 Moccasin = glm::vec3(1.0f, 0.894118f, 0.709804f);\n\tstatic inline glm::vec3 NavajoWhite = glm::vec3(1.0f, 0.870588f, 0.678431f);\n\tstatic inline glm::vec3 PeachPuff = glm::vec3(1.0f, 0.854902f, 0.72549f);\n\tstatic inline glm::vec3 MistyRose = glm::vec3(1.0f, 0.894118f, 0.882353f);\n\tstatic inline glm::vec3 LavenderBlush = glm::vec3(1.0f, 0.941176f, 0.960784f);\n\tstatic inline glm::vec3 Linen = glm::vec3(0.980392f, 0.941176f, 0.901961f);\n\tstatic inline glm::vec3 OldLace = glm::vec3(0.992157f, 0.960784f, 0.901961f);\n\tstatic inline glm::vec3 PapayaWhip = glm::vec3(1.0f, 0.937255f, 0.835294f);\n\tstatic inline glm::vec3 SeaShell = glm::vec3(1.0f, 0.960784f, 0.933333f);\n\tstatic inline glm::vec3 MintCream = glm::vec3(0.960784f, 1.0f, 0.980392f);\n\tstatic inline glm::vec3 SlateGray = glm::vec3(0.439216f, 0.501961f, 0.564706f);\n\tstatic inline glm::vec3 LightSlateGray = glm::vec3(0.466667f, 0.533333f, 0.6f);\n\tstatic inline glm::vec3 LightSteelBlue = glm::vec3(0.690196f, 0.768627f, 0.870588f);\n\tstatic inline glm::vec3 Lavender = glm::vec3(0.901961f, 0.901961f, 0.980392f);\n\tstatic inline glm::vec3 FloralWhite = glm::vec3(1.0f, 0.980392f, 0.941176f);\n\tstatic inline glm::vec3 AliceBlue = glm::vec3(0.941176f, 0.972549f, 1.0f);\n\tstatic inline glm::vec3 GhostWhite = glm::vec3(0.972549f, 0.972549f, 1.0f);\n\tstatic inline glm::vec3 Honeydew = glm::vec3(0.941176f, 1.0f, 0.941176f);\n\tstatic inline glm::vec3 Ivory = glm::vec3(1.0f, 1.0f, 0.941176f);\n\tstatic inline glm::vec3 Azure = glm::vec3(0.941176f, 1.0f, 1.0f);\n\tstatic inline glm::vec3 Snow = glm::vec3(1.0f, 0.980392f, 0.980392f);\n\tstatic inline glm::vec3 Black = glm::vec3(0.0f, 0.0f, 0.0f);\n\tstatic inline glm::vec3 DimGrey = glm::vec3(0.411765f, 0.411765f, 0.411765f);\n\tstatic inline glm::vec3 Grey = glm::vec3(0.501961f, 0.501961f, 0.501961f);\n\tstatic inline glm::vec3 DarkGrey = glm::vec3(0.662745f, 0.662745f, 0.662745f);\n\tstatic inline glm::vec3 Silver = glm::vec3(0.752941f, 0.752941f, 0.752941f);\n\tstatic inline glm::vec3 LightGrey = glm::vec3(0.827451f, 0.827451f, 0.827451f);\n\tstatic inline glm::vec3 Gainsboro = glm::vec3(0.862745f, 0.862745f, 0.862745f);\n\tstatic inline glm::vec3 WhiteSmoke = glm::vec3(0.960784f, 0.960784f, 0.960784f);\n\tstatic inline glm::vec3 White = glm::vec3(1.0f, 1.0f, 1.0f);\n};\n"}, {"path": "src/8.guest/2022/7.area_lights/ltc_matrix.hpp", "language": "code", "loc": 8199, "comment_density": 0.0, "code": "#pragma once\n\n// LTC1 is the inverse M\n// LTC2 is for (GGX norm, fresnel, 0(unused), sphere for horizon-clipping)\n\nconst float LTC1[] = {\n\t1, 0, 0, 2e-05,\n\t1, 0, 0, 0.000503905,\n\t1, 0, 0, 0.00201562,\n\t1, 0, 0, 0.00453516,\n\t1, 0, 0, 0.00806253,\n\t1, 0, 0, 0.0125978,\n\t1, 0, 0, 0.018141,\n\t1, 0, 0, 0.0246924,\n\t1, 0, 0, 0.0322525,\n\t1, 0, 0, 0.0408213,\n\t1, 0, 0, 0.0503999,\n\t1, 0, 0, 0.0609894,\n\t1, 0, 0, 0.0725906,\n\t1, 0, 0, 0.0852058,\n\t1, 0, 0, 0.0988363,\n\t1, 0, 0, 0.113484,\n\t1, 0, 0, 0.129153,\n\t1, 0, 0, 0.145839,\n\t1, 0, 0, 0.163548,\n\t1, 0, 0, 0.182266,\n\t1, 0, 0, 0.201942,\n\t1, 0, 0, 0.222314,\n\t1, 0, 0, 0.241906,\n\t1, 0, 0, 0.262314,\n\t1, 0, 0, 0.285754,\n\t1, 0, 0, 0.310159,\n\t1, 0, 0, 0.335426,\n\t1, 0, 0, 0.361341,\n\t1, 0, 0, 0.387445,\n\t1, 0, 0, 0.412784,\n\t1, 0, 0, 0.438197,\n\t1, 0, 0, 0.466966,\n\t1, 0, 0, 0.49559,\n\t1, 0, 0, 0.523448,\n\t1, 0, 0, 0.549938,\n\t1, 0, 0, 0.57979,\n\t1, 0, 0, 0.608746,\n\t1, 0, 0, 0.636185,\n\t1, 0, 0, 0.664748,\n\t1, 0, 0, 0.69313,\n\t1, 0, 0, 0.71966,\n\t1, 0, 0, 0.747662,\n\t1, 0, 0, 0.774023,\n\t1, 0, 0, 0.799775,\n\t1, 0, 0, 0.825274,\n\t1, 0, 0, 0.849156,\n\t1, 0, 0, 0.873248,\n\t1, 0, 0, 0.89532,\n\t1, 0, 0, 0.917565,\n\t1, 0, 0, 0.937863,\n\t1, 0, 0, 0.958139,\n\t1, 0, 0, 0.976563,\n\t1, 0, 0, 0.994658,\n\t1, 0, 0, 1.0112,\n\t1, 0, 0, 1.02712,\n\t1, 0, 0, 1.04189,\n\t1, 0, 0, 1.05568,\n\t1, 0, 0, 1.06877,\n\t1, 0, 0, 1.08058,\n\t1, 0, 0, 1.09194,\n\t1, 0, 0, 1.10191,\n\t1, 0, 0, 1.11161,\n\t1, 0, 0, 1.1199,\n\t1, 0, 0, 1.12813,\n\t0.999547, -4.48815e-07, 0.0224417, 1.99902e-05,\n\t0.999495, -1.13079e-05, 0.0224406, 0.000503651,\n\t0.999496, -4.52317e-05, 0.0224406, 0.00201461,\n\t0.999496, -0.000101772, 0.0224406, 0.00453287,\n\t0.999495, -0.000180928, 0.0224406, 0.00805845,\n\t0.999497, -0.000282702, 0.0224406, 0.0125914,\n\t0.999496, -0.000407096, 0.0224406, 0.0181319,\n\t0.999498, -0.000554114, 0.0224406, 0.02468,\n\t0.999499, -0.000723768, 0.0224406, 0.0322363,\n\t0.999495, -0.000916058, 0.0224405, 0.0408009,\n\t0.999499, -0.00113101, 0.0224408, 0.050375,\n\t0.999494, -0.00136863, 0.0224405, 0.0609586,\n\t0.999489, -0.00162896, 0.0224401, 0.0725537,\n\t0.999489, -0.00191201, 0.0224414, 0.0851619,\n\t0.999498, -0.00221787, 0.0224413, 0.0987867,\n\t0.999492, -0.00254642, 0.0224409, 0.113426,\n\t0.999507, -0.00289779, 0.0224417, 0.129088,\n\t0.999494, -0.0032716, 0.0224386, 0.145767,\n\t0.999546, -0.0036673, 0.0224424, 0.163472,\n\t0.999543, -0.00408166, 0.0224387, 0.182182,\n\t0.999499, -0.00450056, 0.0224338, 0.201843,\n\t0.999503, -0.00483661, 0.0224203, 0.222198,\n\t0.999546, -0.00452928, 0.022315, 0.241714,\n\t0.999508, -0.00587403, 0.0224329, 0.262184,\n\t0.999509, -0.00638806, 0.0224271, 0.285609,\n\t0.999501, -0.00691028, 0.0224166, 0.309998,\n\t0.999539, -0.00741979, 0.0223989, 0.335262,\n\t0.999454, -0.00786282, 0.0223675, 0.361154,\n\t0.999529, -0.00811928, 0.0222828, 0.387224,\n\t0.999503, -0.00799941, 0.0221063, 0.41252,\n\t0.999561, -0.00952753, 0.0223057, 0.438006,\n\t0.999557, -0.0099134, 0.0222065, 0.466735,\n\t0.999541, -0.0100935, 0.0220402, 0.495332,\n\t0.999562, -0.00996821, 0.0218067, 0.523197,\n\t0.999556, -0.0105031, 0.0217096, 0.550223,\n\t0.999561, -0.0114191, 0.0217215, 0.579498,\n\t0.999588, -0.0111818, 0.0213357, 0.608416,\n\t0.999633, -0.0107725, 0.0208689, 0.635965,\n\t0.999527, -0.0121671, 0.0210149, 0.664476,\n\t0.999508, -0.0116005, 0.020431, 0.692786,\n\t0.999568, -0.0115604, 0.0199791, 0.719709,\n\t0.999671, -0.0121117, 0.0197415, 0.74737,\n\t0.999688, -0.0110769, 0.0188846, 0.773692,\n\t0.99962, -0.0122368, 0.0188452, 0.799534,\n\t0.999823, -0.0110325, 0.0178001, 0.825046,\n\t0.999599, -0.0114923, 0.0174221, 0.849075,\n\t0.999619, -0.0105923, 0.0164345, 0.872999,\n\t0.999613, -0.0105988, 0.0158227, 0.895371,\n\t0.99964, -0.00979861, 0.0148131, 0.917364,\n\t0.99977, -0.00967238, 0.0140721, 0.938002,\n\t0.999726, -0.00869175, 0.0129543, 0.957917,\n\t0.99973, -0.00866872, 0.0122329, 0.976557,\n\t0.999773, -0.00731956, 0.0108958, 0.994459,\n\t0.999811, -0.00756027, 0.0102715, 1.01118,\n\t0.999862, -0.00583732, 0.00878781, 1.02701,\n\t0.999835, -0.00631438, 0.00827529, 1.04186,\n\t0.999871, -0.00450785, 0.00674583, 1.05569,\n\t0.999867, -0.00486079, 0.00621041, 1.06861,\n\t0.999939, -0.00322072, 0.00478301, 1.08064,\n\t0.999918, -0.00318199, 0.00406395, 1.09181,\n\t1.00003, -0.00193348, 0.00280682, 1.10207,\n\t0.999928, -0.00153729, 0.00198741, 1.11152,\n\t0.999933, -0.000623666, 0.000917714, 1.12009,\n\t1, -1.02387e-06, 9.07581e-07, 1.12813,\n\t0.997866, -8.96716e-07, 0.0448334, 1.99584e-05,\n\t0.997987, -2.25945e-05, 0.0448389, 0.000502891,\n\t0.997987, -9.03781e-05, 0.0448388, 0.00201156,\n\t0.997985, -0.000203351, 0.0448388, 0.00452602,\n\t0.997986, -0.000361514, 0.0448388, 0.00804629,\n\t0.997987, -0.00056487, 0.0448389, 0.0125724,\n\t0.997988, -0.000813423, 0.0448389, 0.0181045,\n\t0.997984, -0.00110718, 0.0448387, 0.0246427,\n\t0.997985, -0.00144616, 0.0448388, 0.0321875,\n\t0.997987, -0.00183038, 0.044839, 0.0407392,\n\t0.997983, -0.00225987, 0.0448387, 0.0502986,\n\t0.997991, -0.00273467, 0.0448389, 0.0608667,\n\t0.997984, -0.00325481, 0.0448384, 0.0724444,\n\t0.998002, -0.00382043, 0.044839, 0.0850348,\n\t0.997997, -0.00443145, 0.0448396, 0.0986372,\n\t0.998007, -0.00508796, 0.0448397, 0.113255,\n\t0.998008, -0.00578985, 0.04484, 0.128891,\n\t0.998003, -0.00653683, 0.0448384, 0.145548,\n\t0.997983, -0.00732713, 0.0448358, 0.163221,\n\t0.997985, -0.00815454, 0.0448358, 0.181899,\n\t0.998005, -0.00898985, 0.0448286, 0.201533,\n\t0.998026, -0.00964404, 0.0447934, 0.221821,\n\t0.998055, -0.00922677, 0.044611, 0.241282,\n\t0.99804, -0.0117361, 0.0448245, 0.261791,\n\t0.998048, -0.0127628, 0.0448159, 0.285181,\n\t0.998088, -0.0138055, 0.0447996, 0.30954,\n\t0.998058, -0.0148206, 0.0447669, 0.334751,\n\t0.998099, -0.0156998, 0.044697, 0.36061,\n\t0.998116, -0.0161976, 0.0445122, 0.386603,\n\t0.998195, -0.015945, 0.0441711, 0.411844,\n\t0.998168, -0.0183947, 0.0444255, 0.43773,\n\t0.998184, -0.0197913, 0.0443809, 0.466009,\n\t0.998251, -0.0201426, 0.0440689, 0.494574,\n\t0.998305, -0.0198847, 0.0435632, 0.522405,\n\t0.998273, -0.0210577, 0.043414, 0.549967,\n\t0.998254, -0.0227901, 0.0433943, 0.578655,\n\t0.998349, -0.0223108, 0.0426529, 0.60758,\n\t0.99843, -0.0223088, 0.042, 0.635524,\n\t0.998373, -0.0241141, 0.0418987, 0.663621,\n\t0.998425, -0.0231446, 0.0408118, 0.691906,\n\t0.998504, -0.0233684, 0.0400565, 0.719339,\n\t0.998443, -0.0241652, 0.0394634, 0.74643,\n\t0.99848, -0.0228715, 0.0380002, 0.773086,\n\t0.998569, -0.023519, 0.0372322, 0.798988,\n\t0.998619, -0.0223108, 0.0356468, 0.824249,\n\t0.998594, -0.0223105, 0.034523, 0.848808,\n\t0.998622, -0.0213426, 0.0328887, 0.87227,\n\t0.998669, -0.0207912, 0.0314374, 0.895157,\n\t0.998705, -0.0198416, 0.0296925, 0.916769,\n\t0.998786, -0.0189168, 0.0279634, 0.937773,\n\t0.998888, -0.0178811, 0.0261597, 0.957431,\n\t0.99906, -0.0166845, 0.0242159, 0.976495,\n\t0.999038, -0.0155464, 0.0222638, 0.994169,\n\t0.999237, -0.0141349, 0.0201967, 1.01112,\n\t0.999378, -0.0129324, 0.0181744, 1.02692,\n\t0.999433, -0.0113192, 0.0159898, 1.04174,\n\t0.999439, -0.0101244, 0.0140385, 1.05559,\n\t0.999614, -0.00837456, 0.0117826, 1.06852,\n\t0.999722, -0.00721769, 0.00983745, 1.08069,\n\t0.999817, -0.00554067, 0.00769002, 1.09176,\n\t0.99983, -0.00426961, 0.005782, 1.10211,\n\t0.999964, -0.00273904, 0.00374503, 1.11152,\n\t1.00001, -0.00136739, 0.00187176, 1.12031,\n\t0.999946, 3.93227e-05, -2.8919e-05, 1.12804,\n\t0.995847, -1.3435e-06, 0.0671785, 1.9916e-05,\n\t0.995464, -3.38387e-05, 0.0671527, 0.000501622,\n\t0.99547, -0.000135355, 0.0671531, 0.00200649,\n\t0.995471, -0.00030455, 0.0671532, 0.00451461,\n\t0.99547, -0.000541423, 0.0671531, 0.008026,\n\t0.995471, -0.00084598, 0.0671531, 0.0125407,\n\t0.99547, -0.00121823, 0.0671531, 0.0180589,\n\t0.99547, -0.00165817, 0.0671531, 0.0245806,\n\t0.995463, -0.00216583, 0.0671526, 0.0321062,\n\t0.995468, -0.00274127, 0.0671527, 0.0406366,\n\t0.995474, -0.00338447, 0.0671534, 0.0501717,\n\t0.995473, -0.00409554, 0.0671533, 0.0607131,\n\t0.995478, -0.00487451, 0.0671531, 0.0722618,\n\t0.995476, -0.00572148, 0.0671532, 0.0848191,\n\t0.995477, -0.00663658, 0.0671539, 0.0983882,\n\t0.995498, -0.00761986, 0.0671541, 0.112972,\n\t0.995509, -0.00867094, 0.0671542, 0.128568,\n\t0.995509, -0.00978951, 0.0671531, 0.145183,\n\t0.995503, -0.0109725, 0.0671491, 0.162808,\n\t0.995501, -0.012211, 0.0671465, 0.181441,\n\t0.99553, -0.0134565, 0.0671371, 0.201015,\n\t0.99555, -0.014391, 0.0670831, 0.221206,\n\t0.99558, -0.014351, 0.0668883, 0.240813,\n\t0.995577, -0.0173997, 0.0671055, 0.261257,\n\t0.995602, -0.0191111, 0.0671178, 0.284467,\n\t0.995623, -0.0206705, 0.0670946, 0.308765,\n\t0.995658, -0.022184, 0.0670472, 0.333905,\n\t0.995705, -0.0234832, 0.0669417, 0.359677,\n\t0.995719, -0.0241933, 0.0666714, 0.385554,\n\t0.995786, -0.0243539, 0.066266, 0.410951,\n\t0.995887, -0.0271866, 0.0664367, 0.437163,\n\t0.995944, -0.0296012, 0.0664931, 0.464842,\n\t0.996004, -0.0301045, 0.0660105, 0.49332,\n\t0.996128, -0.0298311, 0.0652694, 0.521131,\n\t0.996253, -0.0316426, 0.0650739, 0.549167,\n\t0.996244, -0.0339043, 0.0649433, 0.57737,\n\t0.996309, -0.033329, 0.0638926, 0.606073,\n\t0.996417, -0.0338935, 0.0630849, 0.634527,\n\t0.996372, -0.0353104, 0.0625083, 0.66256,\n\t0.996542, -0.0348942, 0.0611986, 0.690516,\n\t0.996568, -0.0351614, 0.060069, 0.718317,\n\t0.996711, -0.0354317, 0.0588522, 0.74528,\n\t0.996671, -0.0349513, 0.0571902, 0.772061,\n\t0.996865, -0.0345622, 0.0555321, 0.798089,\n\t0.996802, -0.0342566, 0.0537816, 0.823178,\n\t0.996992, -0.0330862, 0.0516095, 0.847949,\n\t0.996944, -0.0324666, 0.0495537, 0.871431,\n\t0.997146, -0.0309544, 0.0470302, 0.894357,\n\t0.997189, -0.0299372, 0.0446043, 0.916142,\n\t0.997471, -0.0281389, 0.0418812, 0.937193,\n\t0.997515, -0.0268702, 0.0391823, 0.957,\n\t0.997812, -0.0247166, 0.0361338, 0.975936,\n\t0.998027, -0.0233525, 0.0333945, 0.99391,\n\t0.998233, -0.0209839, 0.0301917, 1.01075,\n\t0.998481, -0.0194309, 0.027271, 1.02669,\n\t0.998859, -0.0169728, 0.0240162, 1.04173,\n\t0.99894, -0.0152322, 0.0210517, 1.05551,\n\t0.999132, -0.0127497, 0.0178632, 1.06856,\n\t0.999369, -0.0108282, 0.014787, 1.08054,\n\t0.999549, -0.00845886, 0.0116185, 1.09185,\n\t0.999805, -0.0063937, 0.00867209, 1.10207,\n\t0.99985, -0.00414582, 0.00566823, 1.1117,\n\t0.999912, -0.00207443, 0.00277562, 1.12022,\n\t1.00001, 8.70226e-05, -5.3766e-05, 1.12832,\n\t0.991943, -1.78672e-06, 0.0893382, 1.98384e-05,\n\t0.991952, -4.50183e-05, 0.089339, 0.000499849,\n\t0.991956, -0.000180074, 0.0893394, 0.0019994,\n\t0.991955, -0.000405167, 0.0893393, 0.00449867,\n\t0.991953, -0.000720298, 0.0893391, 0.00799764,\n\t0.991955, -0.00112548, 0.0893393, 0.0124964,\n\t0.991957, -0.0016207, 0.0893395, 0.0179951,\n\t0.991958, -0.00220601, 0.0893396, 0.0244939,\n\t0.991947, -0.00288137, 0.0893385, 0.0319929,\n\t0.991962, -0.00364693, 0.0893399, 0.0404933,\n\t0.991965, -0.00450264, 0.0893399, 0.049995,\n\t0.99198, -0.00544862, 0.0893411, 0.0604995,\n\t0.99197, -0.00648491, 0.0893397, 0.0720074,\n\t0.991976, -0.00761164, 0.089341, 0.0845207,\n\t0.99198, -0.00882891, 0.0893405, 0.0980413,\n\t0.991982, -0.0101367, 0.0893396, 0.112571,\n\t0.992008, -0.011535, 0.0893415, 0.128115,\n\t0.992026, -0.0130228, 0.0893414, 0.144672,\n\t0.992064, -0.0145966, 0.0893418, 0.162241,\n\t0.992041, -0.0162421, 0.0893359, 0.180801,\n\t0.992086, -0.0178888, 0.0893214, 0.200302,\n\t0.992157, -0.0190368, 0.0892401, 0.220332,\n\t0.992181, -0.0195584, 0.0890525, 0.240144,\n\t0.992175, -0.0227257, 0.0892153, 0.260728,\n\t0.99221, -0.0254195, 0.089304, 0.283473,\n\t0.99222, -0.0274883, 0.0892703, 0.307673,\n\t0.992317, -0.0294905, 0.0892027, 0.332729,\n\t0.992374, -0.0311861, 0.0890577, 0.358387,\n\t0.992505, -0.0320656, 0.0886994, 0.384102,\n\t0.992568, -0.0329715, 0.0883198, 0.409767,\n\t0.992675, -0.036006, 0.0883602, 0.436145,\n\t0.992746, -0.0392897, 0.0884591, 0.463217,\n\t0.992873, -0.0399337, 0.0878287, 0.491557,\n\t0.992934, -0.040231, 0.0870108, 0.519516,\n\t0.993091, -0.0422013, 0.0865857, 0.547741,\n\t0.993259, -0.0443503, 0.0861937, 0.575792,\n\t0.993455, -0.0446368, 0.0851187, 0.604233,\n\t0.993497, -0.0454299, 0.0840576, 0.632925,\n\t0.993694, -0.0463296, 0.0829671, 0.660985,\n\t0.993718, -0.0470619, 0.0817185, 0.688714,\n\t0.993973, -0.0468838, 0.0800294, 0.716743,\n\t0.994207, -0.046705, 0.0781286, 0.74377,\n\t0.994168, -0.0469698, 0.0763337, 0.77042,\n\t0.9945, -0.0456816, 0.0738184, 0.796659,\n\t0.994356, -0.0455518, 0.0715545, 0.821868,\n\t0.994747, -0.0439488, 0.0686085, 0.846572,\n\t0.994937, -0.0430056, 0.065869, 0.870435,\n\t0.995142, -0.0413414, 0.0626446, 0.893272,\n\t0.995451, -0.0396521, 0.05929, 0.915376,\n\t0.995445, -0.0378453, 0.0558503, 0.936196,\n\t0.995967, -0.0355219, 0.0520949, 0.956376,\n\t0.996094, -0.0335146, 0.048377, 0.975327,\n\t0.996622, -0.030682, 0.0442575, 0.993471,\n\t0.996938, -0.0285504, 0.0404693, 1.01052,\n\t0.997383, -0.0253399, 0.0360903, 1.02637,\n\t0.997714, -0.0231651, 0.0322176, 1.04139,\n\t0.998249, -0.0198138, 0.0278433, 1.05542,\n\t0.998596, -0.0174337, 0.0238759, 1.06846,\n\t0.998946, -0.0141349, 0.0195944, 1.08056,\n\t0.99928, -0.0115603, 0.0156279, 1.09181,\n\t0.999507, -0.00839065, 0.0114607, 1.10213,\n\t0.999697, -0.005666, 0.00763325, 1.11169,\n\t0.999869, -0.00269902, 0.00364946, 1.12042,\n\t1.00001, 6.23836e-05, -3.19288e-05, 1.12832,\n\t0.987221, -2.22675e-06, 0.111332, 1.97456e-05,\n\t0.98739, -5.61116e-05, 0.111351, 0.000497563,\n\t0.987448, -0.000224453, 0.111357, 0.00199031,\n\t0.987441, -0.000505019, 0.111357, 0.0044782,\n\t0.987442, -0.000897816, 0.111357, 0.00796129,\n\t0.987442, -0.00140284, 0.111357, 0.0124396,\n\t0.987444, -0.00202012, 0.111357, 0.0179132,\n\t0.987442, -0.00274964, 0.111357, 0.0243824,\n\t0.987446, -0.00359147, 0.111357, 0.0318474,\n\t0.987435, -0.00454562, 0.111356, 0.0403086,\n\t0.987461, -0.00561225, 0.111358, 0.0497678,\n\t0.987458, -0.00679125, 0.111358, 0.0602239,\n\t0.987443, -0.0080828, 0.111356, 0.0716792,\n\t0.987476, -0.0094872, 0.111358, 0.0841364,\n\t0.98749, -0.0110044, 0.111361, 0.097597,\n\t0.987508, -0.0126344, 0.111362, 0.112062,\n\t0.987494, -0.0143767, 0.111357, 0.127533,\n\t0.987526, -0.0162307, 0.111359, 0.144015,\n\t0.987558, -0.0181912, 0.111361, 0.161502,\n\t0.987602, -0.0202393, 0.111355, 0.179979,\n\t0.987692, -0.022273, 0.111346, 0.199386,\n\t0.987702, -0.0235306, 0.111215, 0.219183,\n\t0.987789, -0.0247628, 0.111061, 0.239202,\n\t0.987776, -0.0280668, 0.111171, 0.259957,\n\t0.987856, -0.0316751, 0.111327, 0.282198,\n\t0.987912, -0.0342468, 0.111282, 0.306294,\n\t0.988, -0.0367205, 0.111198, 0.331219,\n\t0.988055, -0.0387766, 0.110994, 0.356708,\n\t0.988241, -0.0397722, 0.110547, 0.382234,\n\t0.988399, -0.0416076, 0.110198, 0.408227,\n\t0.988539, -0.0448192, 0.110137, 0.434662,\n\t0.988661, -0.0483793, 0.110143, 0.461442,\n\t0.988967, -0.0495895, 0.109453, 0.489318,\n\t0.989073, -0.0506797, 0.108628, 0.517516,\n\t0.989274, -0.0526953, 0.108003, 0.545844,\n\t0.989528, -0.054578, 0.107255, 0.573823,\n\t0.989709, -0.0561503, 0.106294, 0.601944,\n\t0.989991, -0.056866, 0.104896, 0.630855,\n\t0.990392, -0.0572914, 0.103336, 0.658925,\n\t0.990374, -0.0586224, 0.10189, 0.686661,\n\t0.990747, -0.0584764, 0.099783, 0.714548,\n\t0.991041, -0.0582662, 0.0974309, 0.74186,\n\t0.991236, -0.0584118, 0.0951678, 0.768422,\n\t0.991585, -0.0573055, 0.0921581, 0.794817,\n\t0.991984, -0.0564241, 0.0891167, 0.820336,\n\t0.9921, -0.0553608, 0.085805, 0.84493,\n\t0.992749, -0.0533816, 0.0820354, 0.868961,\n\t0.99288, -0.0518661, 0.0782181, 0.891931,\n\t0.993511, -0.0492492, 0.0738935, 0.914186,\n\t0.993617, -0.0471956, 0.0696402, 0.93532,\n\t0.99411, -0.044216, 0.0649659, 0.95543,\n\t0.994595, -0.0416654, 0.0603177, 0.974685,\n\t0.994976, -0.0384314, 0.0553493, 0.992807,\n\t0.995579, -0.0353491, 0.0503942, 1.00996,\n\t0.996069, -0.0319787, 0.0452123, 1.02606,\n\t0.996718, -0.028472, 0.0400112, 1.04114,\n\t0.997173, -0.0250789, 0.0349456, 1.05517,\n\t0.997818, -0.0213326, 0.029653, 1.0683,\n\t0.998318, -0.0178509, 0.024549, 1.0805,\n\t0.998853, -0.0141118, 0.0194197, 1.09177,\n\t0.999218, -0.0105914, 0.0143869, 1.1022,\n\t0.999594, -0.00693474, 0.00943517, 1.11175,\n\t0.99975, -0.00340478, 0.00464051, 1.12056,\n\t1.00001, 0.000109172, -0.000112821, 1.12853,\n\t0.983383, -2.66524e-06, 0.133358, 1.96534e-05,\n\t0.981942, -6.71009e-05, 0.133162, 0.000494804,\n\t0.981946, -0.000268405, 0.133163, 0.00197923,\n\t0.981944, -0.000603912, 0.133163, 0.00445326,\n\t0.981941, -0.00107362, 0.133162, 0.00791693,\n\t0.981946, -0.00167755, 0.133163, 0.0123703,\n\t0.981944, -0.00241569, 0.133162, 0.0178135,\n\t0.981945, -0.00328807, 0.133163, 0.0242466,\n\t0.981945, -0.00429472, 0.133162, 0.03167,\n\t0.981955, -0.00543573, 0.133164, 0.0400846,\n\t0.981951, -0.00671105, 0.133163, 0.0494901,\n\t0.981968, -0.00812092, 0.133165, 0.0598886,\n\t0.981979, -0.00966541, 0.133166, 0.0712811,\n\t0.981996, -0.0113446, 0.133168, 0.083669,\n\t0.982014, -0.0131585, 0.133169, 0.0970533,\n\t0.982011, -0.0151073, 0.133167, 0.111438,\n\t0.982062, -0.0171906, 0.133172, 0.126826,\n\t0.9821, -0.0194067, 0.133175, 0.143215,\n\t0.982149, -0.0217502, 0.133176, 0.160609,\n\t0.982163, -0.0241945, 0.133173, 0.178981,\n\t0.982247, -0.0265907, 0.133148, 0.198249,\n\t0.982291, -0.027916, 0.132974, 0.217795,\n\t0.982396, -0.0299663, 0.132868, 0.238042,\n\t0.982456, -0.0334544, 0.132934, 0.258901,\n\t0.982499, -0.0378636, 0.133137, 0.280639,\n\t0.982617, -0.0409274, 0.133085, 0.304604,\n\t0.98274, -0.0438523, 0.132985, 0.329376,\n\t0.982944, -0.0462288, 0.132728, 0.354697,\n\t0.98308, -0.0475995, 0.132228, 0.380102,\n\t0.983391, -0.0501901, 0.131924, 0.406256,\n\t0.983514, -0.0535899, 0.131737, 0.432735,\n\t0.98373, -0.0571858, 0.131567, 0.459359,\n\t0.984056, -0.0592353, 0.130932, 0.486637,\n\t0.984234, -0.0610488, 0.130092, 0.51509,\n\t0.984748, -0.0630758, 0.12923, 0.543461,\n\t0.985073, -0.0647398, 0.128174, 0.571376,\n\t0.985195, -0.0671941, 0.127133, 0.599414,\n\t0.985734, -0.0681345, 0.125576, 0.628134,\n\t0.986241, -0.0686089, 0.123639, 0.656399,\n\t0.986356, -0.0698511, 0.121834, 0.684258,\n\t0.986894, -0.0700931, 0.119454, 0.711818,\n\t0.987382, -0.0698321, 0.116718, 0.739511,\n\t0.988109, -0.0693975, 0.113699, 0.766267,\n\t0.988363, -0.0689584, 0.110454, 0.792456,\n\t0.989112, -0.0672353, 0.106602, 0.81813,\n\t0.989241, -0.0662034, 0.10267, 0.842889,\n\t0.990333, -0.0638938, 0.0981381, 0.867204,\n\t0.990591, -0.0618534, 0.0935388, 0.89038,\n\t0.991106, -0.0593117, 0.088553, 0.912576,\n\t0.991919, -0.0562676, 0.0832187, 0.934118,\n\t0.992111, -0.0534085, 0.0778302, 0.954254,\n\t0.992997, -0.0495459, 0.0720453, 0.973722,\n\t0.993317, -0.0463707, 0.0663458, 0.991949,\n\t0.994133, -0.0421245, 0.0601883, 1.00936,\n\t0.994705, -0.0384977, 0.0542501, 1.02559,\n\t0.995495, -0.0340956, 0.0479862, 1.04083,\n\t0.996206, -0.030105, 0.041887, 1.05497,\n\t0.996971, -0.0256095, 0.0355355, 1.06824,\n\t0.997796, -0.0213932, 0.0293655, 1.08056,\n\t0.998272, -0.0169612, 0.0232926, 1.09182,\n\t0.998857, -0.0126756, 0.0172786, 1.10219,\n\t0.99939, -0.00832486, 0.0113156, 1.11192,\n\t0.999752, -0.00410826, 0.00557892, 1.12075,\n\t1, 0.000150957, -0.000119101, 1.12885,\n\t0.975169, -3.09397e-06, 0.154669, 1.95073e-05,\n\t0.975439, -7.79608e-05, 0.154712, 0.000491534,\n\t0.975464, -0.000311847, 0.154716, 0.00196617,\n\t0.975464, -0.000701656, 0.154716, 0.00442387,\n\t0.975462, -0.0012474, 0.154715, 0.0078647,\n\t0.975461, -0.00194906, 0.154715, 0.0122886,\n\t0.975464, -0.00280667, 0.154715, 0.0176959,\n\t0.975468, -0.00382025, 0.154716, 0.0240867,\n\t0.975471, -0.00498985, 0.154716, 0.0314612,\n\t0.975472, -0.00631541, 0.154717, 0.0398199,\n\t0.975486, -0.00779719, 0.154718, 0.0491639,\n\t0.975489, -0.00943505, 0.154718, 0.0594932,\n\t0.975509, -0.0112295, 0.154721, 0.0708113,\n\t0.97554, -0.0131802, 0.154724, 0.0831176,\n\t0.975557, -0.0152876, 0.154726, 0.096415,\n\t0.975585, -0.0175512, 0.154728, 0.110705,\n\t0.975605, -0.0199713, 0.154729, 0.125992,\n\t0.975645, -0.0225447, 0.154729, 0.142272,\n\t0.975711, -0.0252649, 0.154735, 0.159549,\n\t0.975788, -0.0280986, 0.154736, 0.177805,\n\t0.975872, -0.0308232, 0.154704, 0.196911,\n\t0.975968, -0.0324841, 0.154525, 0.216324,\n\t0.976063, -0.0351281, 0.154432, 0.236628,\n\t0.976157, -0.0388618, 0.15446, 0.257539,\n\t0.976204, -0.0437704, 0.154665, 0.278975,\n\t0.976358, -0.047514, 0.154652, 0.302606,\n\t0.976571, -0.0508638, 0.154535, 0.327204,\n\t0.976725, -0.0534995, 0.154221, 0.352276,\n\t0.977013, -0.0555547, 0.153737, 0.377696,\n\t0.977294, -0.0586728, 0.153403, 0.403855,\n\t0.977602, -0.0622715, 0.15312, 0.430333,\n\t0.977932, -0.0658166, 0.152755, 0.456855,\n\t0.978241, -0.0689877, 0.152233, 0.483668,\n\t0.978602, -0.0712805, 0.15132, 0.512097,\n\t0.979234, -0.0732775, 0.150235, 0.540455,\n\t0.97977, -0.075163, 0.148978, 0.568486,\n\t0.979995, -0.0778026, 0.147755, 0.596524,\n\t0.98078, -0.0791854, 0.146019, 0.624825,\n\t0.981628, -0.0799666, 0.143906, 0.653403,\n\t0.982067, -0.0808532, 0.141561, 0.681445,\n\t0.98271, -0.0816024, 0.139025, 0.708918,\n\t0.983734, -0.0812511, 0.135764, 0.736594,\n\t0.98431, -0.0806201, 0.132152, 0.763576,\n\t0.985071, -0.0801605, 0.12846, 0.789797,\n\t0.98618, -0.0784208, 0.124084, 0.815804,\n\t0.986886, -0.0766643, 0.1193, 0.840869,\n\t0.987485, -0.0747744, 0.114236, 0.864952,\n\t0.988431, -0.0716701, 0.108654, 0.888431,\n\t0.988886, -0.0691609, 0.102994, 0.910963,\n\t0.990024, -0.0654048, 0.0967278, 0.932629,\n\t0.990401, -0.0619765, 0.090384, 0.95313,\n\t0.991093, -0.0579296, 0.0837885, 0.972587,\n\t0.992018, -0.0536576, 0.0770171, 0.991184,\n\t0.992536, -0.0493719, 0.0701486, 1.00863,\n\t0.993421, -0.0444813, 0.062953, 1.02494,\n\t0.993928, -0.040008, 0.0560455, 1.04017,\n\t0.994994, -0.0347982, 0.04856, 1.05463,\n\t0.995866, -0.0301017, 0.0416152, 1.06807,\n\t0.996916, -0.0248225, 0.0342597, 1.08039,\n\t0.997766, -0.0199229, 0.0271668, 1.09177,\n\t0.998479, -0.0147422, 0.0201387, 1.10235,\n\t0.99921, -0.00980173, 0.0131944, 1.11206,\n\t0.999652, -0.0047426, 0.00640712, 1.12104,\n\t0.999998, 8.91673e-05, -0.00010379, 1.12906,\n\t0.967868, -3.51885e-06, 0.175947, 1.93569e-05,\n\t0.968001, -8.86733e-05, 0.175972, 0.000487782,\n\t0.96801, -0.000354697, 0.175973, 0.00195115,\n\t0.968012, -0.000798063, 0.175974, 0.00439006,\n\t0.968011, -0.00141879, 0.175973, 0.00780461,\n\t0.968011, -0.00221686, 0.175973, 0.0121948,\n\t0.968016, -0.00319231, 0.175974, 0.0175607,\n\t0.968019, -0.00434515, 0.175974, 0.0239027,\n\t0.968018, -0.00567538, 0.175974, 0.0312208,\n\t0.968033, -0.00718308, 0.175977, 0.0395158,\n\t0.968049, -0.00886836, 0.175979, 0.0487885,\n\t0.968047, -0.0107312, 0.175978, 0.0590394,\n\t0.968072, -0.0127719, 0.175981, 0.0702705,\n\t0.968108, -0.0149905, 0.175986, 0.0824836,\n\t0.968112, -0.0173866, 0.175985, 0.0956783,\n\t0.968173, -0.0199611, 0.175993, 0.109862,\n\t0.96827, -0.0227128, 0.176008, 0.125033,\n\t0.968292, -0.025639, 0.17601, 0.141193,\n\t0.968339, -0.0287299, 0.176007, 0.158336,\n\t0.968389, -0.0319399, 0.176001, 0.176441,\n\t0.968501, -0.034941, 0.175962, 0.195359,\n\t0.968646, -0.0370812, 0.175793, 0.214686,\n\t0.968789, -0.0402329, 0.175708, 0.234973,\n\t0.96886, -0.0442601, 0.1757, 0.255871,\n\t0.969013, -0.049398, 0.175876, 0.277238,\n\t0.969242, -0.0539932, 0.17594, 0.300326,\n\t0.969419, -0.0577299, 0.175781, 0.324702,\n\t0.969763, -0.0605643, 0.175432, 0.349527,\n\t0.970093, -0.0634488, 0.174992, 0.374976,\n\t0.970361, -0.0670589, 0.174611, 0.401097,\n\t0.970825, -0.0708246, 0.174226, 0.427496,\n\t0.971214, -0.0742871, 0.173684, 0.453858,\n\t0.971622, -0.0782608, 0.173186, 0.480637,\n\t0.972175, -0.0813151, 0.172288, 0.508655,\n\t0.972944, -0.0832678, 0.170979, 0.536973,\n\t0.973595, -0.0855964, 0.169573, 0.565138,\n\t0.974345, -0.0882163, 0.168152, 0.593222,\n\t0.975233, -0.0901671, 0.166314, 0.621201,\n\t0.976239, -0.0912111, 0.163931, 0.649919,\n\t0.977289, -0.0916959, 0.161106, 0.678011,\n\t0.978076, -0.0927061, 0.158272, 0.705717,\n\t0.979533, -0.0925562, 0.15475, 0.733228,\n\t0.980335, -0.0918159, 0.150638, 0.760454,\n\t0.981808, -0.0908508, 0.146201, 0.786918,\n\t0.983061, -0.0896172, 0.141386, 0.812953,\n\t0.984148, -0.0871588, 0.135837, 0.838281,\n\t0.985047, -0.0850624, 0.130135, 0.862594,\n\t0.986219, -0.0818541, 0.123882, 0.88633,\n\t0.987043, -0.0784523, 0.117126, 0.908952,\n\t0.988107, -0.0749601, 0.110341, 0.930744,\n\t0.988955, -0.0703548, 0.102885, 0.951728,\n\t0.989426, -0.0662798, 0.0954167, 0.971166,\n\t0.990421, -0.0610834, 0.0876331, 0.989984,\n\t0.991032, -0.0562936, 0.0797785, 1.00765,\n\t0.992041, -0.0508154, 0.0718166, 1.02434,\n\t0.992794, -0.0454045, 0.0637125, 1.03976,\n\t0.993691, -0.0398194, 0.0555338, 1.05418,\n\t0.994778, -0.0341482, 0.0473388, 1.06772,\n\t0.995915, -0.028428, 0.0391016, 1.08028,\n\t0.997109, -0.022642, 0.0309953, 1.09185,\n\t0.998095, -0.0168738, 0.0230288, 1.10247,\n\t0.998985, -0.0111274, 0.0150722, 1.11229,\n\t0.999581, -0.00543881, 0.00740605, 1.12131,\n\t1.00003, 0.000162239, -0.000105549, 1.12946,\n\t0.959505, -3.93734e-06, 0.196876, 1.91893e-05,\n\t0.959599, -9.92157e-05, 0.196895, 0.000483544,\n\t0.959641, -0.000396868, 0.196903, 0.0019342,\n\t0.959599, -0.000892948, 0.196895, 0.00435193,\n\t0.959603, -0.00158747, 0.196896, 0.0077368,\n\t0.959604, -0.00248042, 0.196896, 0.0120888,\n\t0.959605, -0.00357184, 0.196896, 0.0174082,\n\t0.959605, -0.00486169, 0.196896, 0.0236949,\n\t0.959613, -0.00635008, 0.196897, 0.0309497,\n\t0.959619, -0.00803696, 0.196898, 0.0391725,\n\t0.959636, -0.00992255, 0.196901, 0.0483649,\n\t0.959634, -0.0120067, 0.1969, 0.0585266,\n\t0.959675, -0.0142898, 0.196906, 0.0696609,\n\t0.959712, -0.0167717, 0.196911, 0.0817678,\n\t0.959752, -0.0194524, 0.196918, 0.0948494,\n\t0.959807, -0.0223321, 0.196925, 0.10891,\n\t0.959828, -0.0254091, 0.196924, 0.123947,\n\t0.959906, -0.0286815, 0.196934, 0.139968,\n\t0.960005, -0.0321371, 0.196944, 0.156968,\n\t0.960071, -0.0357114, 0.196936, 0.17491,\n\t0.960237, -0.0389064, 0.196882, 0.193597,\n\t0.960367, -0.041623, 0.196731, 0.21285,\n\t0.960562, -0.0452655, 0.196654, 0.233075,\n\t0.960735, -0.0496207, 0.196643, 0.253941,\n\t0.960913, -0.0549379, 0.196774, 0.275278,\n\t0.961121, -0.0603414, 0.196893, 0.297733,\n\t0.96139, -0.0644244, 0.196717, 0.321877,\n\t0.961818, -0.067556, 0.196314, 0.346476,\n\t0.962175, -0.0712709, 0.195917, 0.371907,\n\t0.96255, -0.0752848, 0.1955, 0.397916,\n\t0.963164, -0.0792073, 0.195026, 0.424229,\n\t0.963782, -0.0828225, 0.194424, 0.450637,\n\t0.964306, -0.0873119, 0.193831, 0.477288,\n\t0.964923, -0.0911051, 0.192973, 0.504716,\n\t0.966048, -0.093251, 0.19151, 0.533053,\n\t0.967024, -0.0958983, 0.190013, 0.561366,\n\t0.968038, -0.09835, 0.188253, 0.589464,\n\t0.969152, -0.100754, 0.186257, 0.617433,\n\t0.970557, -0.102239, 0.183775, 0.645801,\n\t0.972104, -0.102767, 0.180645, 0.674278,\n\t0.973203, -0.103492, 0.177242, 0.702004,\n\t0.975123, -0.103793, 0.17345, 0.729529,\n\t0.97641, -0.102839, 0.168886, 0.756712,\n\t0.978313, -0.101687, 0.163892, 0.783801,\n\t0.980036, -0.100314, 0.158439, 0.809671,\n\t0.981339, -0.097836, 0.152211, 0.835402,\n\t0.982794, -0.0950006, 0.145679, 0.860081,\n\t0.984123, -0.0920994, 0.138949, 0.883757,\n\t0.984918, -0.0878641, 0.131283, 0.90685,\n\t0.985999, -0.083939, 0.123464, 0.928786,\n\t0.987151, -0.0791234, 0.115324, 0.94983,\n\t0.987827, -0.0739332, 0.106854, 0.96962,\n\t0.988806, -0.0688088, 0.0982691, 0.98861,\n\t0.989588, -0.0628962, 0.0893456, 1.00667,\n\t0.990438, -0.0573146, 0.0805392, 1.02344,\n\t0.991506, -0.0509433, 0.0713725, 1.03933,\n\t0.992492, -0.0448724, 0.0623732, 1.05378,\n\t0.993663, -0.0383497, 0.0530838, 1.06747,\n\t0.994956, -0.0319593, 0.0439512, 1.08007,\n\t0.99634, -0.025401, 0.0347803, 1.09182,\n\t0.99761, -0.0189687, 0.0257954, 1.1025,\n\t0.99863, -0.0124441, 0.0169893, 1.11247,\n\t0.99947, -0.00614003, 0.00829498, 1.12151,\n\t1.00008, 0.000216624, -0.000146107, 1.12993,\n\t0.950129, -4.34955e-06, 0.217413, 1.90081e-05,\n\t0.950264, -0.00010957, 0.217444, 0.00047884,\n\t0.9503, -0.000438299, 0.217451, 0.00191543,\n\t0.950246, -0.000986124, 0.21744, 0.00430951,\n\t0.950246, -0.00175311, 0.21744, 0.00766137,\n\t0.950245, -0.00273923, 0.21744, 0.011971,\n\t0.950253, -0.00394453, 0.217441, 0.0172385,\n\t0.950258, -0.00536897, 0.217442, 0.0234641,\n\t0.950267, -0.00701262, 0.217444, 0.030648,\n\t0.950277, -0.00887551, 0.217446, 0.038791,\n\t0.950284, -0.0109576, 0.217446, 0.0478931,\n\t0.950312, -0.0132591, 0.217451, 0.0579568,\n\t0.950334, -0.01578, 0.217454, 0.0689821,\n\t0.950378, -0.0185204, 0.217462, 0.0809714,\n\t0.950417, -0.0214803, 0.217467, 0.0939265,\n\t0.950488, -0.0246594, 0.217479, 0.10785,\n\t0.950534, -0.0280565, 0.217483, 0.122743,\n\t0.950633, -0.0316685, 0.217498, 0.138611,\n\t0.950698, -0.0354787, 0.217499, 0.155442,\n\t0.950844, -0.0394003, 0.217507, 0.173208,\n\t0.950999, -0.0426812, 0.217419, 0.191605,\n\t0.951221, -0.0461302, 0.217317, 0.21084,\n\t0.951412, -0.0502131, 0.217238, 0.230945,\n\t0.951623, -0.0549183, 0.21722, 0.251745,\n\t0.951867, -0.0604493, 0.217306, 0.273001,\n\t0.952069, -0.0665189, 0.217466, 0.294874,\n\t0.952459, -0.0709179, 0.217266, 0.318732,\n\t0.952996, -0.0746112, 0.216891, 0.34318,\n\t0.953425, -0.0789252, 0.216503, 0.36849,\n\t0.953885, -0.0833293, 0.216042, 0.394373,\n\t0.954617, -0.087371, 0.215469, 0.420505,\n\t0.955429, -0.0914054, 0.214802, 0.446907,\n\t0.956068, -0.0961671, 0.214146, 0.473522,\n\t0.957094, -0.10048, 0.213286, 0.50052,\n\t0.958372, -0.103248, 0.211796, 0.528715,\n\t0.959654, -0.106033, 0.21016, 0.557065,\n\t0.961305, -0.108384, 0.208149, 0.585286,\n\t0.962785, -0.111122, 0.206024, 0.613334,\n\t0.964848, -0.112981, 0.203442, 0.641334,\n\t0.966498, -0.113717, 0.19996, 0.669955,\n\t0.968678, -0.114121, 0.196105, 0.698094,\n\t0.970489, -0.114524, 0.191906, 0.725643,\n\t0.972903, -0.113792, 0.186963, 0.752856,\n\t0.974701, -0.112406, 0.181343, 0.780013,\n\t0.976718, -0.110685, 0.175185, 0.806268,\n\t0.978905, -0.108468, 0.168535, 0.832073,\n\t0.980267, -0.105061, 0.161106, 0.857149,\n\t0.981967, -0.101675, 0.153387, 0.881145,\n\t0.983063, -0.0974492, 0.145199, 0.904255,\n\t0.984432, -0.0925815, 0.136527, 0.926686,\n\t0.985734, -0.0877983, 0.127584, 0.947901,\n\t0.986228, -0.081884, 0.118125, 0.968111,\n\t0.98719, -0.0761208, 0.108594, 0.98719,\n\t0.988228, -0.0698196, 0.0989996, 1.00559,\n\t0.989046, -0.0632739, 0.0890074, 1.02246,\n\t0.990242, -0.056522, 0.0790832, 1.03841,\n\t0.991252, -0.0495272, 0.0689182, 1.05347,\n\t0.992542, -0.0425373, 0.0588592, 1.06724,\n\t0.994096, -0.0353198, 0.0486833, 1.08009,\n\t0.995593, -0.028235, 0.0385977, 1.09177,\n\t0.99711, -0.0209511, 0.0286457, 1.10274,\n\t0.998263, -0.0139289, 0.0188497, 1.11262,\n\t0.999254, -0.0067359, 0.009208, 1.12191,\n\t0.999967, 0.000141846, -6.57764e-05, 1.13024,\n\t0.935608, -4.74692e-06, 0.236466, 1.87817e-05,\n\t0.93996, -0.00011971, 0.237568, 0.000473646,\n\t0.939959, -0.000478845, 0.237567, 0.0018946,\n\t0.939954, -0.0010774, 0.237566, 0.00426284,\n\t0.939956, -0.00191538, 0.237566, 0.00757842,\n\t0.939954, -0.00299277, 0.237566, 0.0118413,\n\t0.93996, -0.00430961, 0.237567, 0.0170518,\n\t0.939969, -0.00586589, 0.237569, 0.02321,\n\t0.939982, -0.00766166, 0.237572, 0.0303164,\n\t0.939987, -0.00969686, 0.237572, 0.0383711,\n\t0.939997, -0.0119715, 0.237574, 0.0473751,\n\t0.940031, -0.0144858, 0.237581, 0.0573298,\n\t0.940073, -0.0172399, 0.237589, 0.0682366,\n\t0.94012, -0.0202335, 0.237598, 0.080097,\n\t0.940162, -0.0234663, 0.237604, 0.0929116,\n\t0.940237, -0.0269387, 0.237615, 0.106686,\n\t0.940328, -0.0306489, 0.237632, 0.121421,\n\t0.940419, -0.0345917, 0.237645, 0.137115,\n\t0.940522, -0.0387481, 0.237654, 0.153766,\n\t0.940702, -0.0429906, 0.237661, 0.17133,\n\t0.940871, -0.0465089, 0.237561, 0.189502,\n\t0.941103, -0.050531, 0.23748, 0.208616,\n\t0.941369, -0.0550657, 0.237423, 0.228595,\n\t0.941641, -0.0601337, 0.237399, 0.249287,\n\t0.941903, -0.0658804, 0.237443, 0.270467,\n\t0.942224, -0.0722674, 0.237597, 0.292024,\n\t0.942633, -0.0771788, 0.237419, 0.315272,\n\t0.943172, -0.0815623, 0.237068, 0.339579,\n\t0.943691, -0.0863973, 0.236682, 0.364717,\n\t0.944382, -0.0911536, 0.236213, 0.390435,\n\t0.945392, -0.0952967, 0.235562, 0.416425,\n\t0.946185, -0.0998948, 0.234832, 0.442772,\n\t0.947212, -0.104796, 0.234114, 0.469347,\n\t0.948778, -0.10928, 0.233222, 0.496162,\n\t0.950149, -0.113081, 0.231845, 0.523978,\n\t0.951989, -0.115893, 0.230005, 0.552295,\n\t0.953921, -0.11846, 0.227862, 0.580569,\n\t0.955624, -0.12115, 0.225439, 0.608698,\n\t0.958234, -0.123373, 0.222635, 0.636696,\n\t0.960593, -0.124519, 0.219093, 0.665208,\n\t0.963201, -0.124736, 0.214749, 0.693557,\n\t0.965642, -0.125012, 0.210059, 0.721334,\n\t0.968765, -0.124661, 0.204935, 0.748613,\n\t0.971753, -0.122996, 0.198661, 0.776224,\n\t0.973751, -0.120998, 0.191823, 0.802461,\n\t0.976709, -0.118583, 0.184359, 0.828399,\n\t0.977956, -0.115102, 0.176437, 0.853693,\n\t0.979672, -0.111077, 0.167681, 0.877962,\n\t0.981816, -0.10688, 0.158872, 0.901564,\n\t0.98238, -0.101469, 0.149398, 0.924057,\n\t0.983964, -0.0960013, 0.139436, 0.945751,\n\t0.984933, -0.0899626, 0.12943, 0.966272,\n\t0.985694, -0.0832973, 0.11894, 0.985741,\n\t0.986822, -0.0767082, 0.108349, 1.00407,\n\t0.987725, -0.0693614, 0.0976026, 1.02154,\n\t0.98877, -0.06211, 0.086652, 1.03757,\n\t0.990129, -0.0544143, 0.0756182, 1.05296,\n\t0.991337, -0.046744, 0.0645753, 1.06683,\n\t0.992978, -0.0387931, 0.0534683, 1.0798,\n\t0.994676, -0.030973, 0.0424137, 1.09181,\n\t0.99645, -0.0230311, 0.0314035, 1.10286,\n\t0.997967, -0.0152065, 0.0206869, 1.11291,\n\t0.99922, -0.00744837, 0.010155, 1.12237,\n\t1.00002, 0.000240209, -7.52767e-05, 1.13089,\n\t0.922948, -5.15351e-06, 0.255626, 1.86069e-05,\n\t0.928785, -0.000129623, 0.257244, 0.000468009,\n\t0.928761, -0.00051849, 0.257237, 0.00187202,\n\t0.928751, -0.0011666, 0.257235, 0.00421204,\n\t0.928751, -0.00207395, 0.257234, 0.0074881,\n\t0.928754, -0.00324055, 0.257235, 0.0117002,\n\t0.92876, -0.00466639, 0.257236, 0.0168486,\n\t0.928763, -0.00635149, 0.257237, 0.0229334,\n\t0.928774, -0.00829584, 0.257239, 0.029955,\n\t0.928791, -0.0104995, 0.257243, 0.0379139,\n\t0.928804, -0.0129623, 0.257245, 0.0468108,\n\t0.928847, -0.0156846, 0.257255, 0.0566473,\n\t0.92889, -0.0186661, 0.257263, 0.0674246,\n\t0.928924, -0.0219067, 0.257268, 0.0791433,\n\t0.928989, -0.0254066, 0.257282, 0.0918076,\n\t0.92909, -0.0291651, 0.257301, 0.105419,\n\t0.92918, -0.0331801, 0.257316, 0.119978,\n\t0.92929, -0.0374469, 0.257332, 0.135491,\n\t0.929453, -0.041939, 0.257357, 0.151948,\n\t0.929586, -0.0464612, 0.257347, 0.169275,\n\t0.929858, -0.0503426, 0.257269, 0.187257,\n\t0.930125, -0.0548409, 0.257199, 0.206204,\n\t0.930403, -0.0598063, 0.257149, 0.22601,\n\t0.930726, -0.0652437, 0.257122, 0.246561,\n\t0.931098, -0.0712376, 0.257153, 0.267618,\n\t0.931396, -0.0777506, 0.257237, 0.288993,\n\t0.931947, -0.0832374, 0.257124, 0.311527,\n\t0.932579, -0.0883955, 0.25683, 0.335697,\n\t0.933194, -0.0937037, 0.256444, 0.360634,\n\t0.934013, -0.0987292, 0.255939, 0.386126,\n\t0.935307, -0.103215, 0.255282, 0.412018,\n\t0.936374, -0.108234, 0.254538, 0.438292,\n\t0.93776, -0.113234, 0.253728, 0.464805,\n\t0.939599, -0.118013, 0.25275, 0.491464,\n\t0.941036, -0.122661, 0.251404, 0.518751,\n\t0.94337, -0.125477, 0.249435, 0.547133,\n\t0.945318, -0.128374, 0.247113, 0.575456,\n\t0.947995, -0.130996, 0.244441, 0.60372,\n\t0.950818, -0.133438, 0.241352, 0.63174,\n\t0.954378, -0.135004, 0.237849, 0.659971,\n\t0.957151, -0.135313, 0.233188, 0.688478,\n\t0.960743, -0.13521, 0.228001, 0.716767,\n\t0.964352, -0.135007, 0.222249, 0.744349,\n\t0.967273, -0.133523, 0.21542, 0.771786,\n\t0.969767, -0.131155, 0.208039, 0.798639,\n\t0.973195, -0.128492, 0.200076, 0.824774,\n\t0.975557, -0.125094, 0.191451, 0.850222,\n\t0.977692, -0.120578, 0.18184, 0.874761,\n\t0.98026, -0.115882, 0.172102, 0.898497,\n\t0.981394, -0.110372, 0.161859, 0.921636,\n\t0.982386, -0.10415, 0.15108, 0.943467,\n\t0.983783, -0.0978128, 0.140407, 0.964045,\n\t0.98422, -0.0906171, 0.129058, 0.98398,\n\t0.985447, -0.0832921, 0.117614, 1.00276,\n\t0.986682, -0.0754412, 0.10585, 1.02047,\n\t0.987326, -0.0673885, 0.0940943, 1.03678,\n\t0.988707, -0.0592565, 0.0822093, 1.05218,\n\t0.990185, -0.050717, 0.070192, 1.06652,\n\t0.991866, -0.0423486, 0.0582081, 1.07965,\n\t0.993897, -0.0336118, 0.0460985, 1.09188,\n\t0.995841, -0.0252178, 0.0342737, 1.10307,\n\t0.997605, -0.0164893, 0.0224829, 1.11324,\n\t0.999037, -0.00817112, 0.0110647, 1.12262,\n\t1.00003, 0.000291686, -0.000168673, 1.13139,\n\t0.915304, -5.52675e-06, 0.275999, 1.83285e-05,\n\t0.91668, -0.000139285, 0.276414, 0.000461914,\n\t0.916664, -0.00055713, 0.276409, 0.00184763,\n\t0.916653, -0.00125354, 0.276406, 0.00415715,\n\t0.916651, -0.00222851, 0.276405, 0.00739053,\n\t0.916655, -0.00348205, 0.276406, 0.0115478,\n\t0.916653, -0.00501414, 0.276405, 0.0166291,\n\t0.916667, -0.00682478, 0.276409, 0.0226346,\n\t0.91668, -0.00891398, 0.276412, 0.0295648,\n\t0.91669, -0.0112817, 0.276413, 0.0374199,\n\t0.916727, -0.013928, 0.276422, 0.0462016,\n\t0.916759, -0.0168528, 0.276429, 0.0559101,\n\t0.916793, -0.0200558, 0.276436, 0.0665466,\n\t0.916849, -0.0235373, 0.276448, 0.0781139,\n\t0.916964, -0.0272973, 0.276474, 0.0906156,\n\t0.917047, -0.0313344, 0.276491, 0.104051,\n\t0.917152, -0.0356465, 0.276511, 0.118424,\n\t0.917286, -0.0402271, 0.276533, 0.133736,\n\t0.917469, -0.0450408, 0.276564, 0.149978,\n\t0.917686, -0.0497872, 0.276563, 0.167057,\n\t0.917953, -0.0540937, 0.276493, 0.184846,\n\t0.918228, -0.0590709, 0.276437, 0.203614,\n\t0.918572, -0.0644277, 0.276398, 0.223212,\n\t0.918918, -0.0702326, 0.276362, 0.243584,\n\t0.919356, -0.076484, 0.276383, 0.264465,\n\t0.919842, -0.0830808, 0.276434, 0.285701,\n\t0.920451, -0.0892972, 0.276407, 0.307559,\n\t0.921113, -0.095016, 0.276128, 0.331501,\n\t0.921881, -0.100771, 0.275754, 0.356207,\n\t0.923027, -0.106029, 0.275254, 0.381477,\n\t0.924364, -0.111029, 0.274595, 0.40722,\n\t0.925818, -0.116345, 0.273841, 0.433385,\n\t0.92746, -0.121424, 0.272913, 0.459848,\n\t0.929167, -0.12657, 0.271837, 0.486493,\n\t0.931426, -0.131581, 0.270575, 0.513432,\n\t0.934001, -0.135038, 0.268512, 0.541502,\n\t0.936296, -0.138039, 0.266135, 0.569658,\n\t0.939985, -0.140687, 0.263271, 0.598375,\n\t0.943516, -0.143247, 0.260058, 0.626563,\n\t0.94782, -0.145135, 0.256138, 0.654711,\n\t0.951023, -0.145733, 0.251154, 0.683285,\n\t0.955338, -0.145554, 0.245562, 0.711831,\n\t0.959629, -0.145008, 0.239265, 0.739573,\n\t0.963123, -0.144003, 0.232064, 0.767027,\n\t0.966742, -0.141289, 0.224036, 0.794359,\n\t0.969991, -0.138247, 0.215305, 0.820361,\n\t0.973403, -0.134786, 0.206051, 0.846548,\n\t0.975317, -0.129966, 0.195914, 0.871541,\n\t0.977647, -0.12471, 0.185184, 0.895313,\n\t0.980137, -0.119086, 0.174161, 0.918398,\n\t0.981031, -0.112297, 0.162792, 0.940679,\n\t0.982037, -0.105372, 0.150952, 0.961991,\n\t0.983164, -0.097821, 0.138921, 0.981913,\n\t0.983757, -0.0897245, 0.126611, 1.00109,\n\t0.985036, -0.0815974, 0.114228, 1.01902,\n\t0.986289, -0.0727725, 0.101389, 1.03604,\n\t0.987329, -0.0639323, 0.0886476, 1.05149,\n\t0.989193, -0.0548109, 0.0756837, 1.06619,\n\t0.990716, -0.045687, 0.0627581, 1.07948,\n\t0.992769, -0.0364315, 0.0498337, 1.09172,\n\t0.99524, -0.0271761, 0.0370305, 1.1033,\n\t0.997154, -0.0179609, 0.0243959, 1.11353,\n\t0.998845, -0.00878063, 0.0119567, 1.12319,\n\t1.00002, 0.000259038, -0.000108146, 1.13177,\n\t0.903945, -5.91681e-06, 0.295126, 1.81226e-05,\n\t0.903668, -0.000148672, 0.295037, 0.000455367,\n\t0.903677, -0.000594683, 0.29504, 0.00182145,\n\t0.903673, -0.00133805, 0.295039, 0.00409831,\n\t0.903666, -0.00237872, 0.295036, 0.00728584,\n\t0.903668, -0.00371676, 0.295037, 0.0113842,\n\t0.903679, -0.00535212, 0.29504, 0.0163936,\n\t0.903684, -0.00728479, 0.295041, 0.0223141,\n\t0.903698, -0.00951473, 0.295044, 0.0291462,\n\t0.903718, -0.0120419, 0.295049, 0.0368904,\n\t0.903754, -0.0148664, 0.295058, 0.0455477,\n\t0.903801, -0.017988, 0.29507, 0.0551194,\n\t0.903851, -0.0214064, 0.295082, 0.0656058,\n\t0.903921, -0.0251219, 0.295097, 0.0770109,\n\t0.904002, -0.0291337, 0.295116, 0.0893354,\n\t0.904111, -0.033441, 0.29514, 0.102583,\n\t0.904246, -0.0380415, 0.295169, 0.116755,\n\t0.904408, -0.0429258, 0.295202, 0.131853,\n\t0.904637, -0.0480468, 0.295245, 0.147869,\n\t0.904821, -0.0529208, 0.295214, 0.164658,\n\t0.905163, -0.0577748, 0.295185, 0.182274,\n\t0.905469, -0.0631763, 0.295143, 0.200828,\n\t0.905851, -0.068917, 0.295112, 0.2202,\n\t0.906322, -0.0750861, 0.295104, 0.240372,\n\t0.906761, -0.0815855, 0.295086, 0.261082,\n\t0.90735, -0.0882138, 0.295095, 0.282123,\n\t0.908087, -0.095082, 0.295139, 0.303563,\n\t0.908826, -0.101488, 0.29492, 0.327028,\n\t0.909832, -0.107577, 0.294577, 0.351464,\n\t0.911393, -0.113033, 0.294115, 0.376497,\n\t0.912804, -0.118629, 0.293446, 0.402115,\n\t0.914081, -0.124232, 0.292581, 0.428111,\n\t0.91637, -0.129399, 0.29166, 0.454442,\n\t0.91814, -0.134892, 0.290422, 0.481024,\n\t0.921179, -0.140069, 0.289194, 0.507924,\n\t0.924544, -0.144431, 0.287421, 0.535557,\n\t0.927995, -0.147498, 0.284867, 0.563984,\n\t0.931556, -0.150197, 0.281722, 0.5923,\n\t0.935777, -0.152711, 0.278207, 0.620832,\n\t0.940869, -0.154836, 0.274148, 0.649069,\n\t0.945994, -0.155912, 0.269057, 0.677746,\n\t0.949634, -0.155641, 0.262799, 0.706293,\n\t0.955032, -0.154809, 0.256097, 0.734278,\n\t0.95917, -0.153678, 0.248618, 0.761751,\n\t0.962931, -0.151253, 0.239794, 0.789032,\n\t0.966045, -0.147625, 0.230281, 0.815422,\n\t0.96971, -0.143964, 0.220382, 0.841787,\n\t0.972747, -0.139464, 0.209846, 0.867446,\n\t0.975545, -0.133459, 0.198189, 0.892004,\n\t0.978381, -0.127424, 0.186362, 0.915458,\n\t0.979935, -0.120506, 0.173964, 0.937948,\n\t0.980948, -0.11282, 0.161429, 0.959732,\n\t0.982234, -0.104941, 0.148557, 0.980118,\n\t0.982767, -0.0962905, 0.135508, 0.999463,\n\t0.983544, -0.0873625, 0.122338, 1.01756,\n\t0.984965, -0.0783447, 0.108669, 1.03492,\n\t0.986233, -0.0684798, 0.0949911, 1.05087,\n\t0.987796, -0.0590867, 0.0811386, 1.0656,\n\t0.989885, -0.0489145, 0.0673099, 1.0794,\n\t0.991821, -0.0391, 0.0535665, 1.09174,\n\t0.99448, -0.029087, 0.0397529, 1.10341,\n\t0.996769, -0.019114, 0.0261463, 1.11383,\n\t0.998641, -0.00947007, 0.0128731, 1.1237,\n\t0.999978, 0.000446316, -0.000169093, 1.13253,\n\t0.888362, -6.27064e-06, 0.312578, 1.78215e-05,\n\t0.889988, -0.000157791, 0.313148, 0.000448451,\n\t0.889825, -0.000631076, 0.313092, 0.00179356,\n\t0.88984, -0.00141994, 0.313097, 0.00403554,\n\t0.889828, -0.0025243, 0.313092, 0.00717429,\n\t0.889831, -0.00394421, 0.313093, 0.0112099,\n\t0.889831, -0.00567962, 0.313093, 0.0161425,\n\t0.889844, -0.00773051, 0.313096, 0.0219724,\n\t0.889858, -0.0100968, 0.3131, 0.0286999,\n\t0.889882, -0.0127786, 0.313106, 0.0363256,\n\t0.889918, -0.0157757, 0.313116, 0.0448509,\n\t0.889967, -0.0190878, 0.313129, 0.0542758,\n\t0.89003, -0.022715, 0.313145, 0.0646032,\n\t0.890108, -0.0266566, 0.313165, 0.0758339,\n\t0.890218, -0.0309131, 0.313193, 0.0879729,\n\t0.890351, -0.0354819, 0.313226, 0.101019,\n\t0.89051, -0.0403613, 0.313263, 0.114979,\n\t0.890672, -0.0455385, 0.313294, 0.129848,\n\t0.890882, -0.0509444, 0.313333, 0.145616,\n\t0.891189, -0.0559657, 0.313324, 0.162122,\n\t0.891457, -0.0613123, 0.313281, 0.179524,\n\t0.891856, -0.0671488, 0.313281, 0.197855,\n\t0.892312, -0.0732732, 0.313268, 0.216991,\n\t0.892819, -0.0797865, 0.313263, 0.236924,\n\t0.893369, -0.0865269, 0.313247, 0.257433,\n\t0.894045, -0.0931592, 0.313205, 0.278215,\n\t0.894884, -0.100532, 0.313276, 0.299467,\n\t0.895832, -0.107716, 0.313205, 0.322276,\n\t0.897043, -0.114099, 0.312873, 0.34642,\n\t0.898515, -0.119941, 0.312331, 0.371187,\n\t0.900191, -0.126044, 0.311731, 0.396656,\n\t0.90188, -0.131808, 0.310859, 0.422488,\n\t0.904359, -0.137289, 0.309857, 0.448744,\n\t0.906923, -0.142991, 0.308714, 0.475239,\n\t0.910634, -0.148253, 0.307465, 0.501983,\n\t0.914502, -0.153332, 0.305774, 0.529254,\n\t0.919046, -0.156646, 0.303156, 0.557709,\n\t0.923194, -0.159612, 0.299928, 0.586267,\n\t0.928858, -0.162027, 0.296245, 0.614925,\n\t0.934464, -0.164203, 0.291832, 0.643187,\n\t0.939824, -0.165602, 0.286565, 0.671601,\n\t0.944582, -0.165383, 0.280073, 0.700213,\n\t0.949257, -0.164439, 0.272891, 0.728432,\n\t0.954389, -0.162953, 0.264771, 0.756082,\n\t0.958595, -0.161007, 0.255927, 0.78369,\n\t0.962138, -0.157243, 0.245769, 0.810769,\n\t0.966979, -0.152872, 0.235127, 0.836999,\n\t0.969566, -0.148209, 0.22347, 0.862684,\n\t0.972372, -0.142211, 0.211147, 0.887847,\n\t0.975916, -0.135458, 0.198606, 0.911843,\n\t0.978026, -0.128398, 0.185498, 0.934795,\n\t0.979686, -0.120313, 0.17171, 0.956787,\n\t0.980748, -0.11166, 0.158159, 0.978046,\n\t0.981622, -0.103035, 0.144399, 0.997693,\n\t0.982356, -0.0930328, 0.13001, 1.01642,\n\t0.983308, -0.0834627, 0.115778, 1.03366,\n\t0.985037, -0.0732249, 0.101327, 1.05014,\n\t0.986493, -0.0628145, 0.086554, 1.06507,\n\t0.988484, -0.0526556, 0.0720413, 1.07907,\n\t0.991051, -0.0415744, 0.0571151, 1.09189,\n\t0.993523, -0.0314275, 0.0426643, 1.10369,\n\t0.99628, -0.0203603, 0.0279325, 1.11423,\n\t0.998344, -0.0102446, 0.0138182, 1.12421,\n\t0.999997, 0.00042612, -0.000193628, 1.1333,\n\t0.871555, -6.60007e-06, 0.329176, 1.74749e-05,\n\t0.875255, -0.000166579, 0.330571, 0.000441051,\n\t0.875644, -0.000666394, 0.330718, 0.00176441,\n\t0.875159, -0.00149903, 0.330536, 0.00396899,\n\t0.87516, -0.00266493, 0.330536, 0.007056,\n\t0.875158, -0.00416393, 0.330535, 0.0110251,\n\t0.87516, -0.00599598, 0.330535, 0.0158764,\n\t0.875163, -0.00816108, 0.330536, 0.0216101,\n\t0.875174, -0.0106591, 0.330538, 0.0282266,\n\t0.875199, -0.0134899, 0.330545, 0.0357266,\n\t0.875257, -0.0166538, 0.330563, 0.0441117,\n\t0.875304, -0.0201501, 0.330575, 0.0533821,\n\t0.875373, -0.0239785, 0.330595, 0.0635395,\n\t0.875464, -0.0281389, 0.330619, 0.0745872,\n\t0.875565, -0.0326301, 0.330645, 0.0865255,\n\t0.875691, -0.0374516, 0.330676, 0.0993599,\n\t0.875897, -0.0425993, 0.330733, 0.113093,\n\t0.876091, -0.0480576, 0.330776, 0.127722,\n\t0.876353, -0.0537216, 0.330826, 0.143227,\n\t0.876649, -0.0589807, 0.330809, 0.159462,\n\t0.877034, -0.0647865, 0.330819, 0.176642,\n\t0.877443, -0.0709789, 0.330817, 0.194702,\n\t0.877956, -0.0774782, 0.330832, 0.213577,\n\t0.878499, -0.0843175, 0.330822, 0.233246,\n\t0.879144, -0.0912714, 0.330804, 0.253512,\n\t0.879982, -0.0980824, 0.330766, 0.274137,\n\t0.88097, -0.105823, 0.330864, 0.295209,\n\t0.882051, -0.113671, 0.330896, 0.317226,\n\t0.883397, -0.120303, 0.330545, 0.341068,\n\t0.884987, -0.12667, 0.330068, 0.365613,\n\t0.886789, -0.133118, 0.329418, 0.390807,\n\t0.889311, -0.139024, 0.328683, 0.416494,\n\t0.891995, -0.144971, 0.327729, 0.442618,\n\t0.895106, -0.150747, 0.326521, 0.469131,\n\t0.899527, -0.156283, 0.325229, 0.495921,\n\t0.90504, -0.161707, 0.32378, 0.523162,\n\t0.909875, -0.165661, 0.32122, 0.55092,\n\t0.91561, -0.168755, 0.317942, 0.579928,\n\t0.921225, -0.171193, 0.313983, 0.608539,\n\t0.927308, -0.17319, 0.309636, 0.636854,\n\t0.933077, -0.174819, 0.304262, 0.66523,\n\t0.938766, -0.175002, 0.297563, 0.693609,\n\t0.943667, -0.173946, 0.289613, 0.722157,\n\t0.949033, -0.172221, 0.281227, 0.750021,\n\t0.953765, -0.169869, 0.271545, 0.777466,\n\t0.95804, -0.166578, 0.261034, 0.804853,\n\t0.962302, -0.161761, 0.249434, 0.831569,\n\t0.966544, -0.156636, 0.237484, 0.857779,\n\t0.969372, -0.150784, 0.224395, 0.883051,\n\t0.972486, -0.143672, 0.210786, 0.907864,\n\t0.975853, -0.135772, 0.196556, 0.931223,\n\t0.977975, -0.127942, 0.182307, 0.954061,\n\t0.979122, -0.118347, 0.167607, 0.97531,\n\t0.980719, -0.109112, 0.152739, 0.995666,\n\t0.981223, -0.0991789, 0.137932, 1.01475,\n\t0.98216, -0.0883553, 0.122692, 1.03253,\n\t0.983379, -0.0780825, 0.107493, 1.04917,\n\t0.985434, -0.0665646, 0.0917791, 1.06464,\n\t0.987332, -0.0557714, 0.0764949, 1.07896,\n\t0.990004, -0.0442805, 0.060721, 1.09199,\n\t0.992975, -0.0331676, 0.0452284, 1.10393,\n\t0.995811, -0.0219547, 0.0297934, 1.11476,\n\t0.9982, -0.0107613, 0.0146415, 1.12484,\n\t1.00002, 0.000248678, -0.00014555, 1.13413,\n\t0.859519, -6.93595e-06, 0.347264, 1.71673e-05,\n\t0.859843, -0.00017503, 0.347394, 0.000433219,\n\t0.859656, -0.000700076, 0.347319, 0.00173277,\n\t0.859671, -0.00157517, 0.347325, 0.00389875,\n\t0.859669, -0.00280028, 0.347324, 0.00693112,\n\t0.85967, -0.0043754, 0.347324, 0.01083,\n\t0.859665, -0.00630049, 0.347321, 0.0155954,\n\t0.859685, -0.0085755, 0.347328, 0.0212278,\n\t0.859694, -0.0112003, 0.347329, 0.0277273,\n\t0.859718, -0.0141747, 0.347336, 0.0350946,\n\t0.85976, -0.0174988, 0.347348, 0.0433314,\n\t0.85982, -0.0211722, 0.347366, 0.0524384,\n\t0.859892, -0.0251941, 0.347387, 0.0624168,\n\t0.860006, -0.0295649, 0.347422, 0.0732708,\n\t0.860122, -0.0342825, 0.347453, 0.0849999,\n\t0.860282, -0.0393462, 0.347499, 0.0976102,\n\t0.860482, -0.0447513, 0.347554, 0.111104,\n\t0.860719, -0.0504775, 0.347614, 0.125479,\n\t0.860998, -0.0563577, 0.347666, 0.140703,\n\t0.861322, -0.0619473, 0.347662, 0.156681,\n\t0.861724, -0.0681277, 0.347684, 0.173597,\n\t0.862198, -0.0746567, 0.347709, 0.191371,\n\t0.862733, -0.0815234, 0.347727, 0.209976,\n\t0.863371, -0.0886643, 0.347744, 0.229351,\n\t0.86414, -0.0957908, 0.347734, 0.24934,\n\t0.865138, -0.102912, 0.34772, 0.269797,\n\t0.866182, -0.110924, 0.3478, 0.290654,\n\t0.867436, -0.119223, 0.347911, 0.312074,\n\t0.869087, -0.126197, 0.347649, 0.335438,\n\t0.870859, -0.133145, 0.347222, 0.359732,\n\t0.872997, -0.139869, 0.346645, 0.38467,\n\t0.875939, -0.146089, 0.345935, 0.41019,\n\t0.879012, -0.152334, 0.345012, 0.436218,\n\t0.883353, -0.15821, 0.343924, 0.462641,\n\t0.888362, -0.164097, 0.342636, 0.489449,\n\t0.895026, -0.169528, 0.341351, 0.516629,\n\t0.900753, -0.174408, 0.339115, 0.544109,\n\t0.906814, -0.17751, 0.335809, 0.572857,\n\t0.912855, -0.180101, 0.331597, 0.601554,\n\t0.919438, -0.182116, 0.32698, 0.630198,\n\t0.925962, -0.183494, 0.321449, 0.658404,\n\t0.931734, -0.184159, 0.314595, 0.686625,\n\t0.93762, -0.18304, 0.306462, 0.71531,\n\t0.943858, -0.181323, 0.297514, 0.744272,\n\t0.948662, -0.178683, 0.287447, 0.771462,\n\t0.953299, -0.175379, 0.276166, 0.798593,\n\t0.957346, -0.170395, 0.263758, 0.8256,\n\t0.962565, -0.165042, 0.251019, 0.852575,\n\t0.966075, -0.158655, 0.237011, 0.878316,\n\t0.969048, -0.151707, 0.222518, 0.90329,\n\t0.972423, -0.143271, 0.207848, 0.927745,\n\t0.975833, -0.134824, 0.192463, 0.950859,\n\t0.977629, -0.125444, 0.1768, 0.972947,\n\t0.978995, -0.114949, 0.161033, 0.993263,\n\t0.980533, -0.104936, 0.145523, 1.01337,\n\t0.980745, -0.0935577, 0.129799, 1.03128,\n\t0.981814, -0.0822956, 0.113486, 1.04825,\n\t0.983943, -0.0710082, 0.0972925, 1.06405,\n\t0.986141, -0.0587931, 0.0808138, 1.0785,\n\t0.988878, -0.0472755, 0.0644915, 1.09204,\n\t0.992132, -0.0349128, 0.0478128, 1.10413,\n\t0.9953, -0.0232407, 0.031621, 1.11527,\n\t0.998117, -0.0112713, 0.0154935, 1.12551,\n\t1.00003, 0.000339743, -0.000195763, 1.13504,\n\t0.845441, -7.29126e-06, 0.364305, 1.69208e-05,\n\t0.843588, -0.000183164, 0.363506, 0.000425067,\n\t0.843412, -0.00073253, 0.36343, 0.00169999,\n\t0.843401, -0.00164818, 0.363426, 0.00382495,\n\t0.843399, -0.00293008, 0.363425, 0.00679993,\n\t0.843401, -0.00457822, 0.363425, 0.010625,\n\t0.843394, -0.00659249, 0.363421, 0.0153002,\n\t0.843398, -0.00897282, 0.363421, 0.0208258,\n\t0.843415, -0.0117191, 0.363426, 0.0272024,\n\t0.843438, -0.0148312, 0.363432, 0.0344305,\n\t0.843483, -0.018309, 0.363447, 0.0425116,\n\t0.84356, -0.0221521, 0.363472, 0.0514471,\n\t0.843646, -0.0263597, 0.363499, 0.061238,\n\t0.843743, -0.0309315, 0.363527, 0.0718873,\n\t0.84388, -0.0358658, 0.363569, 0.0833969,\n\t0.844079, -0.0411624, 0.363631, 0.0957742,\n\t0.844279, -0.0468128, 0.363688, 0.109015,\n\t0.844549, -0.0527923, 0.363761, 0.123124,\n\t0.844858, -0.0588204, 0.363817, 0.138044,\n\t0.84522, -0.0647573, 0.36383, 0.153755,\n\t0.845669, -0.0713181, 0.363879, 0.170394,\n\t0.846155, -0.0781697, 0.363908, 0.187861,\n\t0.846789, -0.0853913, 0.363969, 0.206176,\n\t0.847502, -0.0928086, 0.363999, 0.225244,\n\t0.8484, -0.10005, 0.363997, 0.244926,\n\t0.849461, -0.107615, 0.364008, 0.265188,\n\t0.850562, -0.115814, 0.364055, 0.28587,\n\t0.851962, -0.124334, 0.364179, 0.306926,\n\t0.854326, -0.131995, 0.364233, 0.329605,\n\t0.856295, -0.139338, 0.363856, 0.35359,\n\t0.858857, -0.146346, 0.363347, 0.37831,\n\t0.862428, -0.152994, 0.362807, 0.403722,\n\t0.866203, -0.159463, 0.361963, 0.429537,\n\t0.871629, -0.165623, 0.36112, 0.456,\n\t0.877365, -0.171649, 0.359917, 0.482773,\n\t0.883744, -0.177151, 0.35848, 0.509705,\n\t0.890693, -0.182381, 0.356523, 0.537215,\n\t0.897278, -0.186076, 0.3533, 0.565493,\n\t0.903958, -0.188602, 0.349095, 0.594293,\n\t0.910908, -0.190755, 0.344215, 0.623165,\n\t0.918117, -0.192063, 0.338606, 0.651573,\n\t0.924644, -0.192758, 0.331544, 0.679869,\n\t0.931054, -0.192238, 0.323163, 0.708668,\n\t0.937303, -0.190035, 0.313529, 0.737201,\n\t0.943387, -0.187162, 0.303152, 0.764977,\n\t0.948494, -0.183876, 0.29146, 0.792683,\n\t0.952546, -0.178901, 0.277917, 0.819228,\n\t0.958077, -0.173173, 0.264753, 0.846559,\n\t0.962462, -0.16645, 0.25002, 0.872962,\n\t0.966569, -0.159452, 0.234873, 0.898729,\n\t0.969108, -0.15074, 0.218752, 0.923126,\n\t0.973072, -0.141523, 0.202673, 0.947278,\n\t0.975452, -0.132075, 0.186326, 0.969938,\n\t0.977784, -0.121257, 0.169396, 0.991325,\n\t0.97899, -0.110182, 0.153044, 1.01123,\n\t0.979777, -0.0989634, 0.136485, 1.0299,\n\t0.980865, -0.0865894, 0.119343, 1.04727,\n\t0.982432, -0.0746115, 0.102452, 1.06341,\n\t0.984935, -0.0621822, 0.0852423, 1.07834,\n\t0.987776, -0.0495694, 0.0678546, 1.092,\n\t0.99103, -0.0372386, 0.0506917, 1.1043,\n\t0.99474, -0.0244353, 0.0333316, 1.11576,\n\t0.997768, -0.0121448, 0.0164348, 1.12617,\n\t1.00003, 0.00031774, -0.000169504, 1.13598,\n\t0.825551, -7.56799e-06, 0.378425, 1.65099e-05,\n\t0.82664, -0.000190922, 0.378923, 0.000416504,\n\t0.826323, -0.000763495, 0.378779, 0.0016656,\n\t0.826359, -0.00171789, 0.378795, 0.00374768,\n\t0.82636, -0.00305402, 0.378795, 0.00666259,\n\t0.826368, -0.00477185, 0.378798, 0.0104104,\n\t0.826364, -0.00687131, 0.378795, 0.0149912,\n\t0.826368, -0.00935232, 0.378795, 0.0204054,\n\t0.826376, -0.0122146, 0.378797, 0.0266532,\n\t0.826399, -0.0154581, 0.378803, 0.0337355,\n\t0.82646, -0.0190825, 0.378824, 0.0416537,\n\t0.826525, -0.0230873, 0.378846, 0.0504091,\n\t0.826614, -0.0274719, 0.378876, 0.0600032,\n\t0.82674, -0.0322355, 0.378917, 0.0704393,\n\t0.826888, -0.0373766, 0.378964, 0.0817195,\n\t0.827078, -0.0428936, 0.379024, 0.0938492,\n\t0.827318, -0.0487778, 0.379099, 0.106828,\n\t0.82764, -0.0549935, 0.379199, 0.120659,\n\t0.827926, -0.0611058, 0.379227, 0.13526,\n\t0.828325, -0.0675054, 0.379275, 0.150713,\n\t0.828801, -0.0743455, 0.379332, 0.167034,\n\t0.8294, -0.0815523, 0.379415, 0.184209,\n\t0.830094, -0.0890779, 0.379495, 0.202203,\n\t0.8309, -0.096736, 0.379555, 0.220945,\n\t0.831943, -0.104135, 0.379577, 0.240306,\n\t0.833037, -0.112106, 0.379604, 0.260317,\n\t0.834278, -0.120554, 0.379668, 0.2808,\n\t0.836192, -0.129128, 0.3799, 0.301654,\n\t0.838671, -0.137541, 0.380109, 0.323502,\n\t0.840939, -0.14523, 0.379809, 0.347176,\n\t0.844575, -0.15248, 0.379593, 0.371706,\n\t0.848379, -0.159607, 0.37909, 0.39688,\n\t0.853616, -0.166267, 0.378617, 0.422702,\n\t0.858921, -0.172698, 0.377746, 0.448919,\n\t0.865324, -0.178823, 0.376749, 0.475661,\n\t0.872207, -0.184542, 0.375363, 0.502599,\n\t0.880018, -0.189836, 0.373657, 0.529914,\n\t0.88694, -0.194294, 0.370673, 0.557683,\n\t0.894779, -0.197022, 0.36662, 0.586848,\n\t0.902242, -0.199108, 0.36138, 0.615831,\n\t0.909914, -0.200398, 0.355434, 0.644478,\n\t0.917088, -0.20094, 0.348173, 0.672905,\n\t0.923888, -0.200671, 0.339482, 0.701327,\n\t0.930495, -0.198773, 0.32956, 0.730101,\n\t0.937247, -0.195394, 0.318363, 0.758383,\n\t0.943108, -0.191956, 0.306323, 0.786539,\n\t0.948296, -0.187227, 0.292576, 0.813637,\n\t0.953472, -0.181165, 0.278234, 0.840793,\n\t0.958485, -0.174119, 0.263054, 0.867712,\n\t0.962714, -0.166564, 0.246756, 0.893635,\n\t0.966185, -0.158181, 0.229945, 0.919028,\n\t0.970146, -0.148275, 0.212633, 0.943413,\n\t0.973491, -0.138157, 0.195229, 0.966627,\n\t0.975741, -0.127574, 0.178048, 0.988817,\n\t0.977238, -0.11554, 0.160312, 1.00924,\n\t0.978411, -0.10364, 0.142857, 1.02845,\n\t0.979811, -0.0913122, 0.125317, 1.04648,\n\t0.98116, -0.0782558, 0.107627, 1.06284,\n\t0.983543, -0.0655957, 0.0895862, 1.07798,\n\t0.986789, -0.0520411, 0.0713756, 1.092,\n\t0.990292, -0.0389727, 0.053228, 1.10484,\n\t0.994187, -0.025808, 0.0351945, 1.11642,\n\t0.997499, -0.0126071, 0.0173198, 1.12703,\n\t0.999999, 0.000275604, -0.000148602, 1.13674,\n\t0.81075, -7.8735e-06, 0.394456, 1.61829e-05,\n\t0.808692, -0.000198293, 0.393453, 0.000407564,\n\t0.80846, -0.000792877, 0.39334, 0.00162965,\n\t0.808595, -0.00178416, 0.393407, 0.00366711,\n\t0.808597, -0.00317182, 0.393408, 0.00651934,\n\t0.808598, -0.00495589, 0.393408, 0.0101866,\n\t0.808591, -0.00713627, 0.393403, 0.0146689,\n\t0.808592, -0.00971285, 0.393402, 0.0199667,\n\t0.80861, -0.0126855, 0.393407, 0.0260803,\n\t0.808633, -0.0160538, 0.393413, 0.0330107,\n\t0.80868, -0.0198175, 0.393429, 0.0407589,\n\t0.808748, -0.0239758, 0.393453, 0.0493264,\n\t0.808854, -0.0285286, 0.39349, 0.0587161,\n\t0.808992, -0.0334748, 0.39354, 0.0689304,\n\t0.809141, -0.0388116, 0.393588, 0.0799707,\n\t0.809352, -0.0445375, 0.39366, 0.0918432,\n\t0.809608, -0.0506427, 0.393742, 0.104549,\n\t0.809915, -0.0570708, 0.393834, 0.118085,\n\t0.810253, -0.0633526, 0.393885, 0.132377,\n\t0.810687, -0.0700966, 0.393953, 0.147537,\n\t0.811233, -0.0772274, 0.394047, 0.163543,\n\t0.811865, -0.0847629, 0.394148, 0.180394,\n\t0.812648, -0.0925663, 0.394265, 0.198051,\n\t0.813583, -0.100416, 0.394363, 0.216443,\n\t0.814683, -0.108119, 0.394402, 0.235502,\n\t0.815948, -0.11644, 0.394489, 0.255242,\n\t0.817278, -0.125036, 0.394542, 0.275441,\n\t0.819605, -0.133655, 0.39486, 0.296094,\n\t0.822256, -0.142682, 0.395248, 0.317309,\n\t0.825349, -0.150756, 0.395241, 0.340516,\n\t0.829605, -0.158392, 0.395285, 0.364819,\n\t0.83391, -0.165801, 0.394922, 0.389736,\n\t0.839808, -0.172677, 0.394691, 0.415409,\n\t0.845708, -0.179448, 0.394006, 0.441546,\n\t0.853025, -0.185746, 0.393279, 0.46832,\n\t0.859666, -0.191684, 0.391655, 0.495302,\n\t0.86789, -0.197146, 0.390068, 0.52262,\n\t0.875845, -0.201904, 0.38727, 0.550336,\n\t0.882634, -0.205023, 0.382688, 0.578825,\n\t0.891076, -0.207098, 0.377543, 0.608103,\n\t0.900589, -0.208474, 0.371752, 0.63723,\n\t0.90791, -0.209068, 0.364016, 0.665769,\n\t0.915971, -0.208655, 0.355593, 0.694428,\n\t0.923455, -0.20729, 0.345439, 0.723224,\n\t0.931514, -0.203821, 0.334099, 0.751925,\n\t0.937885, -0.19986, 0.321069, 0.780249,\n\t0.943136, -0.194993, 0.306571, 0.8077,\n\t0.948818, -0.189132, 0.291556, 0.83497,\n\t0.954433, -0.181617, 0.275745, 0.86188,\n\t0.959078, -0.173595, 0.258695, 0.888562,\n\t0.962705, -0.164855, 0.240825, 0.914008,\n\t0.966753, -0.155129, 0.22268, 0.939145,\n\t0.970704, -0.144241, 0.204542, 0.963393,\n\t0.973367, -0.133188, 0.185927, 0.985983,\n\t0.975984, -0.121146, 0.167743, 1.00704,\n\t0.976994, -0.108366, 0.149218, 1.02715,\n\t0.978485, -0.0956746, 0.13131, 1.0455,\n\t0.980074, -0.0820733, 0.112513, 1.06221,\n\t0.98225, -0.0684061, 0.0938323, 1.07782,\n\t0.98553, -0.0549503, 0.0749508, 1.09199,\n\t0.989529, -0.0407857, 0.055848, 1.10508,\n\t0.993536, -0.0271978, 0.0368581, 1.11684,\n\t0.997247, -0.0132716, 0.0181845, 1.12789,\n\t1, 0.000431817, -0.000198809, 1.13792,\n\t0.785886, -8.12608e-06, 0.405036, 1.57669e-05,\n\t0.790388, -0.000205278, 0.407355, 0.000398297,\n\t0.790145, -0.000820824, 0.407231, 0.00159263,\n\t0.790135, -0.00184681, 0.407226, 0.00358336,\n\t0.790119, -0.00328316, 0.407218, 0.00637039,\n\t0.790126, -0.00512988, 0.40722, 0.0099539,\n\t0.79013, -0.00738684, 0.407221, 0.0143339,\n\t0.790135, -0.0100538, 0.407221, 0.0195107,\n\t0.790134, -0.0131306, 0.407217, 0.0254848,\n\t0.79016, -0.0166169, 0.407224, 0.0322572,\n\t0.790197, -0.020512, 0.407236, 0.0398284,\n\t0.790273, -0.0248157, 0.407263, 0.0482014,\n\t0.790381, -0.029527, 0.407304, 0.0573777,\n\t0.790521, -0.0346446, 0.407355, 0.0673602,\n\t0.790704, -0.0401665, 0.40742, 0.0781522,\n\t0.790925, -0.0460896, 0.407499, 0.0897582,\n\t0.791195, -0.0524017, 0.407589, 0.10218,\n\t0.791522, -0.0590121, 0.407691, 0.11541,\n\t0.791878, -0.0654876, 0.407748, 0.12939,\n\t0.792361, -0.0725207, 0.407849, 0.144237,\n\t0.792942, -0.0799844, 0.407963, 0.159924,\n\t0.79362, -0.0877896, 0.408087, 0.176425,\n\t0.794529, -0.0958451, 0.408259, 0.193733,\n\t0.795521, -0.103827, 0.408362, 0.211756,\n\t0.796778, -0.111937, 0.408482, 0.230524,\n\t0.798027, -0.120521, 0.408547, 0.249967,\n\t0.799813, -0.129242, 0.408721, 0.269926,\n\t0.802387, -0.138048, 0.409148, 0.290338,\n\t0.805279, -0.147301, 0.409641, 0.311193,\n\t0.809251, -0.155895, 0.410154, 0.333611,\n\t0.813733, -0.163942, 0.410297, 0.357615,\n\t0.819081, -0.171666, 0.410373, 0.382339,\n\t0.825427, -0.178905, 0.410348, 0.407828,\n\t0.83172, -0.185812, 0.409486, 0.434034,\n\t0.83877, -0.192318, 0.408776, 0.460493,\n\t0.845817, -0.198249, 0.407176, 0.487346,\n\t0.854664, -0.204034, 0.405719, 0.514832,\n\t0.863495, -0.208908, 0.403282, 0.542401,\n\t0.871883, -0.212765, 0.399293, 0.570683,\n\t0.88065, -0.214911, 0.393803, 0.599947,\n\t0.89004, -0.216214, 0.387536, 0.62932,\n\t0.898476, -0.216745, 0.379846, 0.658319,\n\t0.906738, -0.216387, 0.370625, 0.687138,\n\t0.914844, -0.215053, 0.360139, 0.71601,\n\t0.923877, -0.212007, 0.348849, 0.745124,\n\t0.931925, -0.207481, 0.335639, 0.773366,\n\t0.938054, -0.202418, 0.320798, 0.801636,\n\t0.943895, -0.196507, 0.304772, 0.829055,\n\t0.949468, -0.189009, 0.288033, 0.856097,\n\t0.955152, -0.180539, 0.270532, 0.88301,\n\t0.959403, -0.171437, 0.251639, 0.909296,\n\t0.963309, -0.161661, 0.232563, 0.934868,\n\t0.967399, -0.150425, 0.213231, 0.959662,\n\t0.972009, -0.138659, 0.194247, 0.98302,\n\t0.97433, -0.126595, 0.174718, 1.00517,\n\t0.975823, -0.113205, 0.155518, 1.02566,\n\t0.976371, -0.0996096, 0.136709, 1.04418,\n\t0.978705, -0.0860754, 0.117571, 1.06146,\n\t0.981477, -0.0714438, 0.0980046, 1.07777,\n\t0.984263, -0.0572304, 0.0782181, 1.09214,\n\t0.988423, -0.0428875, 0.0584052, 1.10553,\n\t0.993, -0.0282442, 0.038522, 1.11758,\n\t0.99704, -0.0140183, 0.0190148, 1.12864,\n\t0.999913, 0.000369494, -0.000145203, 1.13901,\n\t0.777662, -8.4153e-06, 0.423844, 1.54403e-05,\n\t0.770458, -0.000211714, 0.419915, 0.00038845,\n\t0.770716, -0.000846888, 0.420055, 0.00155386,\n\t0.770982, -0.00190567, 0.420202, 0.00349653,\n\t0.770981, -0.00338782, 0.420201, 0.00621606,\n\t0.77098, -0.00529338, 0.4202, 0.00971274,\n\t0.770983, -0.00762223, 0.4202, 0.0139867,\n\t0.770985, -0.0103741, 0.420198, 0.0190381,\n\t0.770996, -0.0135489, 0.4202, 0.0248677,\n\t0.771029, -0.0171461, 0.420212, 0.0314764,\n\t0.771052, -0.0211647, 0.420215, 0.0388648,\n\t0.771131, -0.0256048, 0.420245, 0.047036,\n\t0.771235, -0.0304647, 0.420284, 0.0559911,\n\t0.771383, -0.0357436, 0.420341, 0.0657346,\n\t0.771591, -0.0414392, 0.420423, 0.0762694,\n\t0.771819, -0.0475462, 0.420506, 0.0875984,\n\t0.772123, -0.0540506, 0.420617, 0.099727,\n\t0.772464, -0.060797, 0.42072, 0.112637,\n\t0.772855, -0.0675393, 0.420799, 0.126313,\n\t0.773317, -0.0748323, 0.420893, 0.140824,\n\t0.773981, -0.0825681, 0.421058, 0.15617,\n\t0.774746, -0.0906307, 0.421226, 0.172322,\n\t0.77566, -0.0988982, 0.421397, 0.189253,\n\t0.776837, -0.106994, 0.421569, 0.206912,\n\t0.778097, -0.115528, 0.421704, 0.225359,\n\t0.779588, -0.124317, 0.421849, 0.24447,\n\t0.781574, -0.133139, 0.422097, 0.264156,\n\t0.784451, -0.142179, 0.422615, 0.284318,\n\t0.787682, -0.15165, 0.423269, 0.304902,\n\t0.792433, -0.160771, 0.424396, 0.3265,\n\t0.797359, -0.169166, 0.424772, 0.35014,\n\t0.803986, -0.177149, 0.425475, 0.374768,\n\t0.809504, -0.184745, 0.424996, 0.399928,\n\t0.815885, -0.19173, 0.424247, 0.425796,\n\t0.823513, -0.198525, 0.423515, 0.452287,\n\t0.832549, -0.204709, 0.422787, 0.479321,\n\t0.841653, -0.210447, 0.421187, 0.506718,\n\t0.850401, -0.215501, 0.418519, 0.53432,\n\t0.859854, -0.219752, 0.414715, 0.56242,\n\t0.869364, -0.222305, 0.409462, 0.591558,\n\t0.878837, -0.223744, 0.402926, 0.621074,\n\t0.888636, -0.224065, 0.395043, 0.650538,\n\t0.898132, -0.223742, 0.38564, 0.679538,\n\t0.907181, -0.222308, 0.375378, 0.708674,\n\t0.915621, -0.219837, 0.363212, 0.737714,\n\t0.9239, -0.215233, 0.349313, 0.767014,\n\t0.931644, -0.209592, 0.334162, 0.795133,\n\t0.938887, -0.203644, 0.317943, 0.823228,\n\t0.945282, -0.196349, 0.300581, 0.850822,\n\t0.950758, -0.18742, 0.282195, 0.877594,\n\t0.956146, -0.177879, 0.262481, 0.904564,\n\t0.960355, -0.167643, 0.242487, 0.930741,\n\t0.965256, -0.156671, 0.222668, 0.955868,\n\t0.968029, -0.144123, 0.201907, 0.979869,\n\t0.97251, -0.131305, 0.18202, 1.00291,\n\t0.974925, -0.118335, 0.161909, 1.02392,\n\t0.975402, -0.103714, 0.142129, 1.0433,\n\t0.976987, -0.089415, 0.122447, 1.06089,\n\t0.979677, -0.0748858, 0.102248, 1.07713,\n\t0.983184, -0.0596086, 0.0814851, 1.09218,\n\t0.987466, -0.0447671, 0.0609484, 1.10585,\n\t0.992348, -0.0295217, 0.0401835, 1.11829,\n\t0.996674, -0.0143917, 0.0198163, 1.12966,\n\t1.00003, 0.000321364, -0.000149983, 1.1402,\n\t0.757901, -8.69074e-06, 0.436176, 1.51011e-05,\n\t0.751195, -0.000217848, 0.432317, 0.000378533,\n\t0.751178, -0.000871373, 0.432307, 0.0015141,\n\t0.751195, -0.00196061, 0.432317, 0.0034068,\n\t0.751198, -0.00348552, 0.432318, 0.00605659,\n\t0.751195, -0.00544599, 0.432315, 0.00946353,\n\t0.751207, -0.00784203, 0.43232, 0.013628,\n\t0.751213, -0.0106732, 0.43232, 0.0185499,\n\t0.751221, -0.0139393, 0.432319, 0.0242302,\n\t0.751244, -0.0176398, 0.432325, 0.0306694,\n\t0.7513, -0.0217743, 0.432348, 0.0378698,\n\t0.751358, -0.0263412, 0.432367, 0.0458321,\n\t0.751458, -0.0313396, 0.432404, 0.0545587,\n\t0.751608, -0.0367682, 0.432464, 0.0640543,\n\t0.7518, -0.0426246, 0.43254, 0.0743222,\n\t0.752065, -0.0489031, 0.432645, 0.0853668,\n\t0.752376, -0.0555828, 0.432762, 0.0971911,\n\t0.752715, -0.0623861, 0.432859, 0.109768,\n\t0.753137, -0.069415, 0.432958, 0.123126,\n\t0.753676, -0.0770039, 0.433099, 0.137308,\n\t0.754345, -0.084971, 0.433272, 0.15229,\n\t0.755235, -0.0932681, 0.433504, 0.168075,\n\t0.756186, -0.10171, 0.433693, 0.184625,\n\t0.757363, -0.110019, 0.433857, 0.201897,\n\t0.75884, -0.11887, 0.434102, 0.220014,\n\t0.760467, -0.127881, 0.434306, 0.238778,\n\t0.762969, -0.136766, 0.434751, 0.258172,\n\t0.765823, -0.14612, 0.43529, 0.278062,\n\t0.769676, -0.15566, 0.436236, 0.298437,\n\t0.774909, -0.165177, 0.437754, 0.319532,\n\t0.77994, -0.17402, 0.438343, 0.342505,\n\t0.785757, -0.182201, 0.438609, 0.366693,\n\t0.792487, -0.190104, 0.438762, 0.391668,\n\t0.80038, -0.197438, 0.438795, 0.417494,\n\t0.808494, -0.204365, 0.438226, 0.443933,\n\t0.817695, -0.210714, 0.437283, 0.470929,\n\t0.828111, -0.216651, 0.436087, 0.498569,\n\t0.837901, -0.221804, 0.433717, 0.526165,\n\t0.847813, -0.226318, 0.430133, 0.554155,\n\t0.858314, -0.229297, 0.425213, 0.582822,\n\t0.868891, -0.230999, 0.418576, 0.612847,\n\t0.878941, -0.231155, 0.410405, 0.642445,\n\t0.888809, -0.230935, 0.400544, 0.672024,\n\t0.898089, -0.229343, 0.389613, 0.701366,\n\t0.908081, -0.226886, 0.377197, 0.730763,\n\t0.916819, -0.222676, 0.363397, 0.759642,\n\t0.924968, -0.216835, 0.347437, 0.788775,\n\t0.932906, -0.210245, 0.32995, 0.817135,\n\t0.940025, -0.202992, 0.312262, 0.844912,\n\t0.946101, -0.19436, 0.293313, 0.872164,\n\t0.952835, -0.184125, 0.273638, 0.899443,\n\t0.957347, -0.173657, 0.252385, 0.926389,\n\t0.961434, -0.162204, 0.231038, 0.951947,\n\t0.965522, -0.14979, 0.209834, 0.976751,\n\t0.969412, -0.136307, 0.188821, 1.00022,\n\t0.973902, -0.122527, 0.168013, 1.02229,\n\t0.974045, -0.108213, 0.147634, 1.04199,\n\t0.975775, -0.0927397, 0.12705, 1.06019,\n\t0.978383, -0.0778212, 0.106309, 1.07711,\n\t0.98211, -0.0621216, 0.0849279, 1.09245,\n\t0.986517, -0.0463847, 0.0633519, 1.10651,\n\t0.991696, -0.0309353, 0.0419698, 1.11903,\n\t0.996349, -0.0150914, 0.0206272, 1.13073,\n\t1.00003, 0.000442449, -0.000231396, 1.14146,\n\t0.727498, -8.85074e-06, 0.441528, 1.45832e-05,\n\t0.730897, -0.000223525, 0.443589, 0.000368298,\n\t0.730796, -0.000893996, 0.443528, 0.00147303,\n\t0.730805, -0.00201149, 0.443533, 0.00331433,\n\t0.730814, -0.00357596, 0.443538, 0.00589222,\n\t0.730815, -0.00558734, 0.443538, 0.00920678,\n\t0.730822, -0.00804544, 0.44354, 0.0132582,\n\t0.730836, -0.0109501, 0.443545, 0.0180468,\n\t0.730848, -0.0143008, 0.443546, 0.0235732,\n\t0.730871, -0.0180969, 0.443552, 0.0298382,\n\t0.730915, -0.022338, 0.443567, 0.0368438,\n\t0.730982, -0.0270225, 0.443591, 0.044591,\n\t0.731076, -0.0321491, 0.443627, 0.0530831,\n\t0.731245, -0.0377166, 0.443699, 0.0623243,\n\t0.73144, -0.0437216, 0.443777, 0.0723181,\n\t0.7317, -0.0501576, 0.443881, 0.0830691,\n\t0.732034, -0.0569942, 0.444014, 0.0945809,\n\t0.732388, -0.0638756, 0.444113, 0.106825,\n\t0.732853, -0.071203, 0.444247, 0.119859,\n\t0.733473, -0.0790076, 0.444442, 0.13369,\n\t0.734195, -0.0871937, 0.444645, 0.148304,\n\t0.735069, -0.095696, 0.444877, 0.163702,\n\t0.736169, -0.10426, 0.445133, 0.179861,\n\t0.73747, -0.112853, 0.44537, 0.196778,\n\t0.738991, -0.12199, 0.445651, 0.214496,\n\t0.740865, -0.131153, 0.445958, 0.232913,\n\t0.743637, -0.140245, 0.446548, 0.251977,\n\t0.746797, -0.149722, 0.447246, 0.271551,\n\t0.751517, -0.159341, 0.448656, 0.291774,\n\t0.756156, -0.169106, 0.449866, 0.312455,\n\t0.761519, -0.178436, 0.450919, 0.334552,\n\t0.768295, -0.186904, 0.451776, 0.358491,\n\t0.776613, -0.195117, 0.452832, 0.383446,\n\t0.783966, -0.202695, 0.45249, 0.408945,\n\t0.793542, -0.20985, 0.452587, 0.435364,\n\t0.803192, -0.216403, 0.451852, 0.462336,\n\t0.813892, -0.22251, 0.450708, 0.48987,\n\t0.824968, -0.227676, 0.4486, 0.517697,\n\t0.835859, -0.232443, 0.445156, 0.545975,\n\t0.846825, -0.235775, 0.440351, 0.574483,\n\t0.858085, -0.237897, 0.433641, 0.604246,\n\t0.868825, -0.238074, 0.425354, 0.634101,\n\t0.879638, -0.237661, 0.415383, 0.664201,\n\t0.889966, -0.236186, 0.404136, 0.693918,\n\t0.899479, -0.233599, 0.390917, 0.723481,\n\t0.908769, -0.229737, 0.376352, 0.75258,\n\t0.917966, -0.223836, 0.360372, 0.781764,\n\t0.926304, -0.217067, 0.342551, 0.811139,\n\t0.934626, -0.209309, 0.324238, 0.839585,\n\t0.941841, -0.20071, 0.304484, 0.867044,\n\t0.94789, -0.190602, 0.283607, 0.894579,\n\t0.954196, -0.179253, 0.262205, 0.921743,\n\t0.958383, -0.167646, 0.239847, 0.948026,\n\t0.963119, -0.155073, 0.218078, 0.973296,\n\t0.966941, -0.141426, 0.195899, 0.998135,\n\t0.970836, -0.126849, 0.174121, 1.02021,\n\t0.973301, -0.112296, 0.153052, 1.04085,\n\t0.97448, -0.0964965, 0.131733, 1.05946,\n\t0.977045, -0.080489, 0.10997, 1.07693,\n\t0.980751, -0.064844, 0.0881657, 1.09254,\n\t0.985475, -0.0481938, 0.0657987, 1.10697,\n\t0.991089, -0.0319185, 0.0435215, 1.12004,\n\t0.996122, -0.0158088, 0.0214779, 1.13173,\n\t1.00001, 0.000372455, -0.000200295, 1.14291,\n\t0.708622, -9.07597e-06, 0.45304, 1.41962e-05,\n\t0.711162, -0.000228911, 0.454662, 0.000358052,\n\t0.709812, -0.000914446, 0.453797, 0.00143034,\n\t0.709865, -0.00205819, 0.453834, 0.00321935,\n\t0.709864, -0.00365894, 0.453833, 0.00572331,\n\t0.709855, -0.00571692, 0.453826, 0.00894278,\n\t0.709862, -0.00823201, 0.453828, 0.012878,\n\t0.709875, -0.011204, 0.453832, 0.0175295,\n\t0.709896, -0.0146323, 0.453839, 0.0228978,\n\t0.709925, -0.0185163, 0.453847, 0.0289839,\n\t0.709974, -0.0228551, 0.453866, 0.0357894,\n\t0.710045, -0.0276473, 0.453892, 0.0433161,\n\t0.710133, -0.032891, 0.453924, 0.0515665,\n\t0.710292, -0.0385851, 0.453992, 0.0605458,\n\t0.710485, -0.0447254, 0.45407, 0.0702574,\n\t0.710769, -0.0513051, 0.454192, 0.0807077,\n\t0.711106, -0.0582733, 0.454329, 0.091896,\n\t0.711516, -0.0652866, 0.45446, 0.103814,\n\t0.712071, -0.0728426, 0.454653, 0.116508,\n\t0.712676, -0.0808307, 0.45484, 0.129968,\n\t0.713476, -0.0892216, 0.455096, 0.144206,\n\t0.714377, -0.0979047, 0.455346, 0.159212,\n\t0.715579, -0.106531, 0.455647, 0.174973,\n\t0.716977, -0.115492, 0.455961, 0.191504,\n\t0.71862, -0.124821, 0.456315, 0.208835,\n\t0.72084, -0.134079, 0.4568, 0.226869,\n\t0.723786, -0.143427, 0.457521, 0.245582,\n\t0.727464, -0.153061, 0.458475, 0.264957,\n\t0.732771, -0.162768, 0.460239, 0.284948,\n\t0.736515, -0.172627, 0.460899, 0.30522,\n\t0.743519, -0.182487, 0.463225, 0.326717,\n\t0.750041, -0.191295, 0.464027, 0.350113,\n\t0.758589, -0.199746, 0.465227, 0.374782,\n\t0.767703, -0.207584, 0.465877, 0.400226,\n\t0.777484, -0.214973, 0.465996, 0.426442,\n\t0.788792, -0.221796, 0.466019, 0.453688,\n\t0.800194, -0.228038, 0.465083, 0.481246,\n\t0.811234, -0.233346, 0.462506, 0.509086,\n\t0.822859, -0.238073, 0.459257, 0.537338,\n\t0.835082, -0.241764, 0.454863, 0.566108,\n\t0.846332, -0.244241, 0.448163, 0.595126,\n\t0.858355, -0.244736, 0.439709, 0.625574,\n\t0.87034, -0.244278, 0.429837, 0.65617,\n\t0.881027, -0.24255, 0.418002, 0.686029,\n\t0.891007, -0.239912, 0.404325, 0.716039,\n\t0.900874, -0.236133, 0.389222, 0.745518,\n\t0.911072, -0.230672, 0.373269, 0.775026,\n\t0.920359, -0.22356, 0.355083, 0.804521,\n\t0.928604, -0.215591, 0.335533, 0.834045,\n\t0.937175, -0.206503, 0.315278, 0.861612,\n\t0.942825, -0.196684, 0.293653, 0.889131,\n\t0.949805, -0.185116, 0.271503, 0.916853,\n\t0.955535, -0.172703, 0.248821, 0.943541,\n\t0.959843, -0.159978, 0.225591, 0.970132,\n\t0.964393, -0.146375, 0.202719, 0.994709,\n\t0.968008, -0.131269, 0.179928, 1.0186,\n\t0.971013, -0.11569, 0.158007, 1.03928,\n\t0.973334, -0.1003, 0.13624, 1.05887,\n\t0.975775, -0.0833352, 0.1138, 1.07652,\n\t0.979579, -0.0668981, 0.0913141, 1.09297,\n\t0.984323, -0.0500902, 0.0683051, 1.10734,\n\t0.990351, -0.0332377, 0.0451771, 1.12084,\n\t0.995823, -0.0161491, 0.0221705, 1.13296,\n\t1.0001, 0.000234083, -0.000108712, 1.14441,\n\t0.683895, -9.24677e-06, 0.46015, 1.37429e-05,\n\t0.68833, -0.000233383, 0.463134, 0.000346865,\n\t0.688368, -0.000933547, 0.463159, 0.00138748,\n\t0.688367, -0.00210049, 0.463159, 0.00312187,\n\t0.688369, -0.00373415, 0.463159, 0.00555004,\n\t0.688377, -0.00583449, 0.463163, 0.00867216,\n\t0.688386, -0.00840128, 0.463166, 0.0124884,\n\t0.688398, -0.0114343, 0.463169, 0.0169993,\n\t0.688418, -0.0149329, 0.463175, 0.0222054,\n\t0.688453, -0.0188964, 0.463188, 0.028108,\n\t0.688515, -0.0233239, 0.463214, 0.0347085,\n\t0.68857, -0.0282136, 0.463231, 0.0420091,\n\t0.688679, -0.033564, 0.463276, 0.0500132,\n\t0.688854, -0.0393733, 0.463356, 0.0587255,\n\t0.689038, -0.0456354, 0.46343, 0.0681476,\n\t0.689321, -0.0523433, 0.463553, 0.0782897,\n\t0.689662, -0.059412, 0.463693, 0.0891501,\n\t0.690188, -0.0665736, 0.4639, 0.100735,\n\t0.690755, -0.0743106, 0.464107, 0.113074,\n\t0.691405, -0.0824722, 0.464329, 0.126161,\n\t0.692198, -0.0910484, 0.464585, 0.140007,\n\t0.693196, -0.0998778, 0.464893, 0.154612,\n\t0.69454, -0.108651, 0.465285, 0.169984,\n\t0.695921, -0.117855, 0.465596, 0.186106,\n\t0.697749, -0.12734, 0.466056, 0.203034,\n\t0.700375, -0.136714, 0.466771, 0.220703,\n\t0.703395, -0.146386, 0.467579, 0.239062,\n\t0.707904, -0.156096, 0.469067, 0.258188,\n\t0.711673, -0.165904, 0.469851, 0.277759,\n\t0.717489, -0.175812, 0.471815, 0.297935,\n\t0.724051, -0.185931, 0.47389, 0.318916,\n\t0.731965, -0.195238, 0.47587, 0.341591,\n\t0.741151, -0.204021, 0.477523, 0.366062,\n\t0.751416, -0.212113, 0.478881, 0.391396,\n\t0.761848, -0.21979, 0.479226, 0.417599,\n\t0.771886, -0.2267, 0.478495, 0.444401,\n\t0.783998, -0.232991, 0.477622, 0.472084,\n\t0.796523, -0.238645, 0.475833, 0.500193,\n\t0.808851, -0.243396, 0.472568, 0.52865,\n\t0.821191, -0.247226, 0.467857, 0.557362,\n\t0.834261, -0.250102, 0.461871, 0.586768,\n\t0.846762, -0.251056, 0.453543, 0.617085,\n\t0.859867, -0.250604, 0.443494, 0.647659,\n\t0.871948, -0.248783, 0.431711, 0.678119,\n\t0.882967, -0.245855, 0.417911, 0.708399,\n\t0.892826, -0.242168, 0.401993, 0.738256,\n\t0.90332, -0.237062, 0.385371, 0.767999,\n\t0.913633, -0.22997, 0.366837, 0.798191,\n\t0.922774, -0.221687, 0.346372, 0.827756,\n\t0.931371, -0.212345, 0.325682, 0.856425,\n\t0.938929, -0.20206, 0.303665, 0.884299,\n\t0.944821, -0.190981, 0.280786, 0.912023,\n\t0.951792, -0.178065, 0.2573, 0.939669,\n\t0.957712, -0.164634, 0.233448, 0.96655,\n\t0.961912, -0.150863, 0.209504, 0.992366,\n\t0.966382, -0.13577, 0.18597, 1.01633,\n\t0.969588, -0.119593, 0.162905, 1.03843,\n\t0.971777, -0.103203, 0.14053, 1.05841,\n\t0.97433, -0.0865888, 0.117909, 1.07632,\n\t0.978686, -0.0690829, 0.0944101, 1.09326,\n\t0.983281, -0.0516568, 0.0705671, 1.10796,\n\t0.989562, -0.034558, 0.0468592, 1.12182,\n\t0.995465, -0.0167808, 0.0229846, 1.1342,\n\t0.999991, 0.000373016, -0.000235606, 1.1459,\n\t0.662251, -9.39016e-06, 0.468575, 1.32714e-05,\n\t0.666634, -0.000237624, 0.471675, 0.000335842,\n\t0.666411, -0.000950385, 0.471516, 0.00134321,\n\t0.666399, -0.00213833, 0.471509, 0.00302221,\n\t0.666386, -0.0038014, 0.471499, 0.00537283,\n\t0.666405, -0.00593958, 0.471511, 0.00839533,\n\t0.666406, -0.00855253, 0.471508, 0.0120898,\n\t0.666428, -0.0116401, 0.471519, 0.0164569,\n\t0.666444, -0.0152015, 0.471522, 0.0214971,\n\t0.66649, -0.0192362, 0.471543, 0.027212,\n\t0.666537, -0.0237428, 0.471558, 0.033603,\n\t0.666617, -0.0287198, 0.471591, 0.0406728,\n\t0.666718, -0.0341647, 0.471631, 0.0484238,\n\t0.666889, -0.0400759, 0.47171, 0.0568621,\n\t0.667104, -0.0464479, 0.471805, 0.0659915,\n\t0.667374, -0.0532677, 0.471923, 0.0758178,\n\t0.667772, -0.0603805, 0.472098, 0.0863425,\n\t0.668371, -0.0677392, 0.472363, 0.0975917,\n\t0.668971, -0.0756028, 0.472596, 0.109567,\n\t0.669696, -0.0839293, 0.472869, 0.122272,\n\t0.670481, -0.0926683, 0.473126, 0.135718,\n\t0.6715, -0.1016, 0.473442, 0.149914,\n\t0.672911, -0.110566, 0.47389, 0.164882,\n\t0.674512, -0.119984, 0.474354, 0.180602,\n\t0.67651, -0.129574, 0.474922, 0.19711,\n\t0.679292, -0.139106, 0.475764, 0.214371,\n\t0.682798, -0.148993, 0.476886, 0.232405,\n\t0.686955, -0.158737, 0.478179, 0.251153,\n\t0.691406, -0.168754, 0.479432, 0.270436,\n\t0.697438, -0.178703, 0.481481, 0.290374,\n\t0.704761, -0.188955, 0.484143, 0.311044,\n\t0.713599, -0.198814, 0.487007, 0.333003,\n\t0.723194, -0.207869, 0.488962, 0.357144,\n\t0.732601, -0.216189, 0.489815, 0.382169,\n\t0.744193, -0.22398, 0.490888, 0.408227,\n\t0.754907, -0.231156, 0.490355, 0.434928,\n\t0.767403, -0.23747, 0.489548, 0.462599,\n\t0.78107, -0.243503, 0.488274, 0.490908,\n\t0.793893, -0.248114, 0.484843, 0.519421,\n\t0.807296, -0.25222, 0.4803, 0.548561,\n\t0.820529, -0.255265, 0.474097, 0.577772,\n\t0.833716, -0.256741, 0.466041, 0.607782,\n\t0.848403, -0.25637, 0.456547, 0.638807,\n\t0.860755, -0.254804, 0.443946, 0.670058,\n\t0.874012, -0.251834, 0.430852, 0.700749,\n\t0.885619, -0.247867, 0.414903, 0.731446,\n\t0.896069, -0.242634, 0.397276, 0.761191,\n\t0.906266, -0.236093, 0.378535, 0.791053,\n\t0.916759, -0.227543, 0.358038, 0.821298,\n\t0.92523, -0.21783, 0.335705, 0.850747,\n\t0.93436, -0.207534, 0.313797, 0.879258,\n\t0.941631, -0.195983, 0.289671, 0.907734,\n\t0.947564, -0.183567, 0.265319, 0.935206,\n\t0.953681, -0.169345, 0.240815, 0.962739,\n\t0.960008, -0.154909, 0.216119, 0.989227,\n\t0.964145, -0.140161, 0.192096, 1.01465,\n\t0.968171, -0.123411, 0.167855, 1.03737,\n\t0.969859, -0.106525, 0.144817, 1.05767,\n\t0.972666, -0.0891023, 0.12149, 1.0761,\n\t0.977055, -0.0718094, 0.0975306, 1.09336,\n\t0.982527, -0.0534213, 0.0730217, 1.10878,\n\t0.989001, -0.0355579, 0.0483366, 1.12285,\n\t0.99512, -0.0176383, 0.023938, 1.13548,\n\t1.00007, 0.000368831, -0.000211581, 1.14744,\n\t0.651047, -9.60845e-06, 0.484101, 1.2922e-05,\n\t0.644145, -0.000241347, 0.478968, 0.000324578,\n\t0.64396, -0.000965142, 0.478831, 0.00129798,\n\t0.64396, -0.00217154, 0.47883, 0.00292046,\n\t0.643968, -0.00386049, 0.478835, 0.00519202,\n\t0.643974, -0.00603186, 0.478838, 0.0081128,\n\t0.643977, -0.0086854, 0.478836, 0.011683,\n\t0.643982, -0.0118207, 0.478834, 0.0159031,\n\t0.644024, -0.0154374, 0.478856, 0.0207743,\n\t0.644059, -0.0195343, 0.478868, 0.0262975,\n\t0.644122, -0.0241103, 0.478896, 0.0324747,\n\t0.644207, -0.0291638, 0.478933, 0.039309,\n\t0.64432, -0.0346919, 0.478981, 0.0468029,\n\t0.644481, -0.0406919, 0.479053, 0.0549614,\n\t0.644722, -0.047159, 0.479169, 0.0637909,\n\t0.645013, -0.0540748, 0.479302, 0.0732974,\n\t0.645503, -0.0612001, 0.479541, 0.0834898,\n\t0.646117, -0.0687303, 0.479829, 0.0943873,\n\t0.646707, -0.0767846, 0.480061, 0.105991,\n\t0.647431, -0.0852465, 0.480343, 0.11831,\n\t0.64831, -0.0940719, 0.48066, 0.131348,\n\t0.649486, -0.103056, 0.481083, 0.14514,\n\t0.650864, -0.112261, 0.481528, 0.159676,\n\t0.652604, -0.121852, 0.482102, 0.174979,\n\t0.654825, -0.131505, 0.482813, 0.191079,\n\t0.657876, -0.141189, 0.483876, 0.207927,\n\t0.661339, -0.151239, 0.48499, 0.225586,\n\t0.665463, -0.161091, 0.486279, 0.243947,\n\t0.670542, -0.171235, 0.487968, 0.262957,\n\t0.677361, -0.181347, 0.49053, 0.282781,\n\t0.685672, -0.191679, 0.493862, 0.303311,\n\t0.694551, -0.201781, 0.49699, 0.324607,\n\t0.703753, -0.211164, 0.498884, 0.347916,\n\t0.713703, -0.219675, 0.500086, 0.372628,\n\t0.725911, -0.227836, 0.501554, 0.398694,\n\t0.73862, -0.23533, 0.502193, 0.425529,\n\t0.752118, -0.241786, 0.501811, 0.453209,\n\t0.76579, -0.247865, 0.500185, 0.481381,\n\t0.779568, -0.252696, 0.497159, 0.51011,\n\t0.793991, -0.256802, 0.492765, 0.539322,\n\t0.808182, -0.259942, 0.486827, 0.569078,\n\t0.821698, -0.261703, 0.478386, 0.598818,\n\t0.836009, -0.262006, 0.468772, 0.629762,\n\t0.849824, -0.260333, 0.456352, 0.661366,\n\t0.863888, -0.257398, 0.442533, 0.69295,\n\t0.876585, -0.253264, 0.426573, 0.723608,\n\t0.888665, -0.248026, 0.408964, 0.754378,\n\t0.899537, -0.241487, 0.389677, 0.784761,\n\t0.9094, -0.233463, 0.368516, 0.814688,\n\t0.920166, -0.223397, 0.346624, 0.845009,\n\t0.928899, -0.21255, 0.322717, 0.874431,\n\t0.937156, -0.200869, 0.298698, 0.902922,\n\t0.943861, -0.188387, 0.273491, 0.931356,\n\t0.949557, -0.174341, 0.247866, 0.958854,\n\t0.955862, -0.158994, 0.222496, 0.986098,\n\t0.961721, -0.143664, 0.197522, 1.01229,\n\t0.965976, -0.127412, 0.17302, 1.03571,\n\t0.968652, -0.109798, 0.148954, 1.05699,\n\t0.971084, -0.0916787, 0.125044, 1.07587,\n\t0.975584, -0.0739634, 0.100577, 1.09372,\n\t0.98122, -0.055322, 0.0753666, 1.10948,\n\t0.988253, -0.0366825, 0.0498899, 1.12394,\n\t0.99482, -0.0180389, 0.024611, 1.13694,\n\t1.00001, 0.000229839, -0.000188283, 1.14919,\n\t0.613867, -9.64198e-06, 0.479449, 1.23452e-05,\n\t0.621485, -0.000244534, 0.485399, 0.000313091,\n\t0.621429, -0.000978202, 0.485353, 0.00125245,\n\t0.62112, -0.00220004, 0.485114, 0.00281687,\n\t0.621119, -0.0039111, 0.485112, 0.00500783,\n\t0.621122, -0.00611091, 0.485112, 0.00782498,\n\t0.621133, -0.00879922, 0.485117, 0.0112687,\n\t0.621152, -0.0119756, 0.485125, 0.0153394,\n\t0.621183, -0.0156396, 0.485139, 0.0200382,\n\t0.621227, -0.0197898, 0.485158, 0.0253663,\n\t0.621298, -0.0244253, 0.485192, 0.0313261,\n\t0.621388, -0.0295441, 0.485233, 0.0379204,\n\t0.621507, -0.0351432, 0.485286, 0.0451523,\n\t0.621693, -0.0412198, 0.485378, 0.0530277,\n\t0.621933, -0.0477673, 0.485495, 0.0615522,\n\t0.622232, -0.0547574, 0.485635, 0.0707316,\n\t0.622809, -0.0619417, 0.485943, 0.0805883,\n\t0.623407, -0.069625, 0.486232, 0.0911267,\n\t0.62406, -0.077796, 0.486516, 0.102354,\n\t0.624835, -0.0863731, 0.486838, 0.114279,\n\t0.625758, -0.095251, 0.487188, 0.126902,\n\t0.627043, -0.104299, 0.487695, 0.140285,\n\t0.628438, -0.113724, 0.488163, 0.154397,\n\t0.630325, -0.123417, 0.488858, 0.169267,\n\t0.632801, -0.133137, 0.489754, 0.184941,\n\t0.635784, -0.143052, 0.490815, 0.20136,\n\t0.639406, -0.153132, 0.492048, 0.218643,\n\t0.643872, -0.163143, 0.49363, 0.236615,\n\t0.6499, -0.17333, 0.496009, 0.255449,\n\t0.657201, -0.183622, 0.498994, 0.275006,\n\t0.666221, -0.194019, 0.502888, 0.295354,\n\t0.674419, -0.204192, 0.505459, 0.316244,\n\t0.683729, -0.21406, 0.507771, 0.33849,\n\t0.695584, -0.222854, 0.510245, 0.363166,\n\t0.708583, -0.231315, 0.512293, 0.389071,\n\t0.721233, -0.238911, 0.512747, 0.415737,\n\t0.735134, -0.245657, 0.512482, 0.443331,\n\t0.750179, -0.251879, 0.511526, 0.471891,\n\t0.765073, -0.256911, 0.508935, 0.500892,\n\t0.779794, -0.261144, 0.504341, 0.530294,\n\t0.794801, -0.264316, 0.498515, 0.560144,\n\t0.810339, -0.266276, 0.491015, 0.590213,\n\t0.824818, -0.266981, 0.481126, 0.620865,\n\t0.839375, -0.265778, 0.468685, 0.652687,\n\t0.853043, -0.262748, 0.453925, 0.684759,\n\t0.867335, -0.258474, 0.437912, 0.716209,\n\t0.88037, -0.253187, 0.419648, 0.747508,\n\t0.891711, -0.246476, 0.39982, 0.77797,\n\t0.902896, -0.238735, 0.37879, 0.808586,\n\t0.913601, -0.22885, 0.355891, 0.838843,\n\t0.923019, -0.217656, 0.331773, 0.869014,\n\t0.933432, -0.205539, 0.307356, 0.898512,\n\t0.939691, -0.192595, 0.281321, 0.9269,\n\t0.946938, -0.178945, 0.255441, 0.955297,\n\t0.952372, -0.163587, 0.229013, 0.983231,\n\t0.95909, -0.147214, 0.203179, 1.00971,\n\t0.963675, -0.13064, 0.17792, 1.03438,\n\t0.968247, -0.113121, 0.152898, 1.05625,\n\t0.97001, -0.0945824, 0.128712, 1.07598,\n\t0.974458, -0.0755648, 0.103349, 1.094,\n\t0.980168, -0.0571998, 0.0776731, 1.1104,\n\t0.987295, -0.0377994, 0.0514445, 1.12491,\n\t0.994432, -0.0186417, 0.025429, 1.13851,\n\t0.999975, 0.000542714, -0.000282356, 1.15108,\n\t0.592656, -9.80249e-06, 0.486018, 1.19532e-05,\n\t0.598467, -0.000247275, 0.490781, 0.000301531,\n\t0.597934, -0.000988317, 0.490343, 0.00120517,\n\t0.597903, -0.00222366, 0.490319, 0.0027116,\n\t0.597913, -0.00395315, 0.490327, 0.00482077,\n\t0.597919, -0.00617653, 0.490329, 0.00753264,\n\t0.597936, -0.00889375, 0.490339, 0.0108478,\n\t0.597956, -0.0121043, 0.490347, 0.0147668,\n\t0.597992, -0.0158073, 0.490365, 0.0192905,\n\t0.598032, -0.0200017, 0.490382, 0.0244204,\n\t0.598109, -0.0246865, 0.49042, 0.0301593,\n\t0.598215, -0.0298594, 0.490474, 0.03651,\n\t0.59833, -0.0355167, 0.490524, 0.0434757,\n\t0.598525, -0.0416559, 0.490624, 0.0510629,\n\t0.598778, -0.0482692, 0.490753, 0.0592781,\n\t0.599135, -0.0553114, 0.49094, 0.0681304,\n\t0.599802, -0.062542, 0.491328, 0.0776467,\n\t0.600361, -0.0703638, 0.491598, 0.0878184,\n\t0.60101, -0.0786256, 0.491882, 0.0986573,\n\t0.601811, -0.0872962, 0.492232, 0.11018,\n\t0.602861, -0.0962284, 0.492684, 0.1224,\n\t0.604167, -0.10538, 0.493213, 0.135354,\n\t0.605693, -0.114896, 0.493799, 0.149034,\n\t0.607682, -0.124654, 0.494576, 0.163469,\n\t0.610672, -0.13456, 0.4959, 0.178747,\n\t0.613313, -0.144581, 0.496713, 0.194723,\n\t0.617603, -0.154703, 0.498499, 0.211617,\n\t0.622174, -0.16489, 0.500188, 0.229183,\n\t0.628855, -0.175164, 0.503072, 0.247786,\n\t0.636963, -0.185565, 0.506798, 0.267116,\n\t0.644866, -0.195911, 0.509719, 0.28702,\n\t0.653741, -0.206104, 0.512776, 0.307763,\n\t0.664942, -0.216447, 0.516812, 0.329631,\n\t0.67633, -0.22552, 0.519181, 0.353515,\n\t0.690012, -0.234316, 0.521681, 0.379226,\n\t0.704243, -0.242032, 0.523129, 0.405901,\n\t0.719396, -0.249172, 0.523768, 0.433585,\n\t0.734471, -0.255543, 0.522541, 0.462085,\n\t0.750539, -0.260697, 0.520217, 0.491233,\n\t0.766365, -0.26501, 0.516293, 0.521094,\n\t0.781677, -0.268409, 0.509708, 0.551014,\n\t0.797132, -0.270399, 0.501944, 0.581463,\n\t0.812655, -0.271247, 0.492025, 0.612402,\n\t0.828592, -0.270708, 0.480424, 0.643798,\n\t0.844044, -0.268085, 0.465955, 0.67682,\n\t0.857305, -0.263459, 0.448425, 0.708496,\n\t0.87114, -0.258151, 0.430243, 0.74046,\n\t0.884936, -0.251171, 0.410578, 0.771583,\n\t0.895772, -0.243305, 0.38862, 0.802234,\n\t0.906961, -0.234037, 0.365214, 0.833179,\n\t0.917775, -0.222714, 0.34116, 0.86353,\n\t0.927883, -0.210175, 0.31572, 0.893557,\n\t0.936617, -0.196925, 0.289159, 0.922976,\n\t0.943384, -0.182788, 0.261996, 0.951606,\n\t0.949713, -0.167965, 0.235324, 0.979958,\n\t0.955818, -0.151109, 0.208408, 1.00765,\n\t0.961344, -0.133834, 0.182591, 1.03329,\n\t0.965469, -0.115987, 0.156958, 1.0557,\n\t0.968693, -0.09746, 0.132239, 1.07583,\n\t0.973165, -0.0778514, 0.106195, 1.09451,\n\t0.979387, -0.0585067, 0.0797669, 1.11137,\n\t0.98671, -0.0390409, 0.0530263, 1.12643,\n\t0.994093, -0.019408, 0.0263163, 1.14016,\n\t1.00002, 0.000540029, -0.000194487, 1.15299,\n\t0.574483, -9.89066e-06, 0.494533, 1.14896e-05,\n\t0.574478, -0.000249127, 0.494528, 0.000289403,\n\t0.574607, -0.000996811, 0.494637, 0.00115797,\n\t0.574396, -0.00224241, 0.494458, 0.00260498,\n\t0.574377, -0.00398632, 0.49444, 0.00463102,\n\t0.574386, -0.00622836, 0.494445, 0.00723623,\n\t0.574401, -0.0089683, 0.494453, 0.010421,\n\t0.574419, -0.0122056, 0.49446, 0.0141859,\n\t0.574459, -0.0159396, 0.494481, 0.0185322,\n\t0.574525, -0.0201692, 0.49452, 0.0234617,\n\t0.574587, -0.0248924, 0.494547, 0.0289762,\n\t0.574697, -0.0301074, 0.494604, 0.0350797,\n\t0.574853, -0.0358114, 0.494688, 0.0417767,\n\t0.575027, -0.041999, 0.494772, 0.0490718,\n\t0.575294, -0.0486618, 0.494915, 0.0569728,\n\t0.575733, -0.0557148, 0.495173, 0.0654955,\n\t0.576356, -0.0630489, 0.495537, 0.0746612,\n\t0.576944, -0.0709285, 0.495836, 0.0844615,\n\t0.57765, -0.0792723, 0.496177, 0.0949142,\n\t0.578491, -0.0880167, 0.496563, 0.10603,\n\t0.579639, -0.0969462, 0.497096, 0.117841,\n\t0.580989, -0.10622, 0.497684, 0.130367,\n\t0.582587, -0.115861, 0.498337, 0.143609,\n\t0.584951, -0.125605, 0.499414, 0.157625,\n\t0.587602, -0.135608, 0.500518, 0.172413,\n\t0.59076, -0.145742, 0.501767, 0.187999,\n\t0.594992, -0.155934, 0.503542, 0.20445,\n\t0.600656, -0.166303, 0.506135, 0.221764,\n\t0.607816, -0.176681, 0.509542, 0.24002,\n\t0.61522, -0.187071, 0.51263, 0.258992,\n\t0.623702, -0.197465, 0.516021, 0.278773,\n\t0.634192, -0.207816, 0.520422, 0.299377,\n\t0.644936, -0.218183, 0.524073, 0.320802,\n\t0.657888, -0.2278, 0.528049, 0.34384,\n\t0.670666, -0.236747, 0.52986, 0.36916,\n\t0.685626, -0.24484, 0.531892, 0.395867,\n\t0.701304, -0.252071, 0.532727, 0.423488,\n\t0.717727, -0.258714, 0.532146, 0.452201,\n\t0.733914, -0.264211, 0.529883, 0.481579,\n\t0.750529, -0.26859, 0.5259, 0.511558,\n\t0.76747, -0.272046, 0.51999, 0.542042,\n\t0.785189, -0.274225, 0.513083, 0.572799,\n\t0.800954, -0.275189, 0.502936, 0.603816,\n\t0.816962, -0.274946, 0.490921, 0.635461,\n\t0.83336, -0.272695, 0.47684, 0.6676,\n\t0.848143, -0.268223, 0.459405, 0.70051,\n\t0.861818, -0.262768, 0.440319, 0.732902,\n\t0.876828, -0.255872, 0.420123, 0.765084,\n\t0.889312, -0.247703, 0.398379, 0.796391,\n\t0.900412, -0.238381, 0.374496, 0.827333,\n\t0.912251, -0.227783, 0.349874, 0.858385,\n\t0.921792, -0.214832, 0.323181, 0.888652,\n\t0.931273, -0.200949, 0.296624, 0.917763,\n\t0.940295, -0.186537, 0.269211, 0.947878,\n\t0.946812, -0.171538, 0.241447, 0.977016,\n\t0.953588, -0.155254, 0.213829, 1.00501,\n\t0.958841, -0.137156, 0.186807, 1.03179,\n\t0.963746, -0.118699, 0.160706, 1.05502,\n\t0.966468, -0.0998358, 0.135504, 1.07568,\n\t0.971178, -0.0805186, 0.109131, 1.09479,\n\t0.97831, -0.0599348, 0.0818293, 1.1123,\n\t0.985886, -0.0399661, 0.0545872, 1.12771,\n\t0.994021, -0.0198682, 0.0269405, 1.14186,\n\t1.00009, 0.000271022, -0.00012989, 1.15514,\n\t0.538716, -9.90918e-06, 0.486732, 1.09675e-05,\n\t0.550656, -0.000250642, 0.497518, 0.000277412,\n\t0.55057, -0.00100265, 0.497441, 0.00110974,\n\t0.550903, -0.00225672, 0.497733, 0.00249779,\n\t0.550568, -0.00401046, 0.497438, 0.00443906,\n\t0.550574, -0.00626613, 0.49744, 0.00693637,\n\t0.550591, -0.0090226, 0.497449, 0.00998921,\n\t0.550623, -0.0122795, 0.497469, 0.0135984,\n\t0.550667, -0.0160361, 0.497495, 0.0177654,\n\t0.550724, -0.0202908, 0.497526, 0.0224915,\n\t0.550792, -0.0250421, 0.497557, 0.0277795,\n\t0.550918, -0.0302878, 0.49763, 0.0336334,\n\t0.551058, -0.0360241, 0.497701, 0.0400573,\n\t0.551276, -0.0422473, 0.497824, 0.0470585,\n\t0.551551, -0.0489441, 0.497977, 0.0546433,\n\t0.552074, -0.0559596, 0.498312, 0.0628367,\n\t0.552681, -0.0633978, 0.498679, 0.071646,\n\t0.553324, -0.0713176, 0.499031, 0.0810746,\n\t0.554011, -0.0797268, 0.499365, 0.091129,\n\t0.55488, -0.0885238, 0.499779, 0.101837,\n\t0.556171, -0.0974417, 0.500444, 0.113239,\n\t0.557498, -0.106841, 0.501025, 0.125316,\n\t0.559299, -0.116533, 0.501864, 0.138128,\n\t0.561647, -0.126298, 0.502967, 0.151695,\n\t0.564347, -0.136388, 0.504129, 0.16604,\n\t0.567863, -0.146576, 0.505713, 0.181207,\n\t0.572569, -0.156832, 0.507953, 0.197259,\n\t0.578919, -0.167323, 0.511186, 0.214258,\n\t0.585387, -0.177712, 0.514042, 0.232038,\n\t0.593134, -0.188184, 0.517484, 0.250733,\n\t0.603295, -0.198717, 0.522345, 0.270454,\n\t0.613854, -0.209177, 0.526751, 0.290807,\n\t0.626092, -0.219644, 0.531595, 0.312202,\n\t0.637868, -0.229494, 0.534721, 0.334435,\n\t0.652458, -0.238718, 0.538304, 0.359184,\n\t0.666985, -0.247061, 0.539875, 0.385637,\n\t0.683301, -0.254652, 0.541042, 0.41328,\n\t0.69998, -0.261376, 0.540735, 0.441903,\n\t0.717824, -0.267085, 0.539139, 0.471609,\n\t0.734617, -0.271465, 0.534958, 0.501446,\n\t0.753663, -0.27528, 0.53032, 0.532571,\n\t0.770512, -0.277617, 0.522134, 0.563641,\n\t0.787356, -0.278525, 0.51206, 0.595067,\n\t0.806252, -0.278512, 0.50119, 0.627226,\n\t0.822061, -0.277023, 0.486791, 0.659402,\n\t0.838959, -0.273175, 0.470467, 0.692874,\n\t0.85379, -0.267238, 0.450688, 0.725702,\n\t0.868268, -0.260327, 0.429741, 0.75832,\n\t0.881994, -0.251946, 0.407223, 0.790189,\n\t0.893885, -0.242432, 0.383214, 0.821625,\n\t0.905118, -0.231904, 0.357297, 0.853011,\n\t0.916045, -0.219545, 0.330733, 0.883773,\n\t0.927614, -0.205378, 0.303916, 0.914435,\n\t0.936005, -0.190388, 0.275941, 0.944502,\n\t0.944533, -0.1749, 0.247493, 0.974439,\n\t0.950758, -0.158588, 0.218996, 1.00286,\n\t0.957078, -0.141027, 0.191559, 1.0304,\n\t0.962448, -0.121507, 0.164457, 1.05466,\n\t0.964993, -0.102068, 0.138636, 1.0761,\n\t0.970017, -0.0822598, 0.111861, 1.09541,\n\t0.97661, -0.062033, 0.0843438, 1.11317,\n\t0.985073, -0.0409832, 0.0558496, 1.12911,\n\t0.993515, -0.020146, 0.0275331, 1.1438,\n\t1.00006, 0.00027329, -0.000107883, 1.15736,\n\t0.525324, -9.99341e-06, 0.498153, 1.05385e-05,\n\t0.526513, -0.000251605, 0.499277, 0.000265329,\n\t0.526517, -0.00100641, 0.499282, 0.0010613,\n\t0.526588, -0.00226466, 0.499337, 0.00238823,\n\t0.526539, -0.0040255, 0.499302, 0.00424535,\n\t0.526547, -0.00628954, 0.499306, 0.00663364,\n\t0.526561, -0.00905628, 0.499313, 0.00955337,\n\t0.526593, -0.0123253, 0.499334, 0.0130054,\n\t0.526642, -0.0160957, 0.499365, 0.0169911,\n\t0.5267, -0.0203661, 0.499396, 0.0215122,\n\t0.526792, -0.0251347, 0.499451, 0.0265718,\n\t0.526904, -0.0303985, 0.499511, 0.0321732,\n\t0.527079, -0.0361554, 0.499617, 0.0383231,\n\t0.527285, -0.0423982, 0.499731, 0.045026,\n\t0.527602, -0.0491121, 0.499924, 0.0522936,\n\t0.528166, -0.0561127, 0.500306, 0.0601528,\n\t0.52879, -0.0635988, 0.5007, 0.0686059,\n\t0.529421, -0.071581, 0.501048, 0.0776518,\n\t0.530144, -0.0799854, 0.501421, 0.0873148,\n\t0.531062, -0.0888032, 0.501884, 0.0976084,\n\t0.532374, -0.0977643, 0.50259, 0.108588,\n\t0.533828, -0.107197, 0.50329, 0.120234,\n\t0.53581, -0.116887, 0.504312, 0.132602,\n\t0.538063, -0.126755, 0.505365, 0.145721,\n\t0.5409, -0.136819, 0.506668, 0.159617,\n\t0.544882, -0.147117, 0.508731, 0.174369,\n\t0.550238, -0.157446, 0.511601, 0.190028,\n\t0.556038, -0.167988, 0.514431, 0.206587,\n\t0.563031, -0.178364, 0.517808, 0.224046,\n\t0.571543, -0.189007, 0.521937, 0.242503,\n\t0.582255, -0.199546, 0.527415, 0.261977,\n\t0.59272, -0.210084, 0.531682, 0.282162,\n\t0.605648, -0.220448, 0.537123, 0.303426,\n\t0.61785, -0.230593, 0.540664, 0.325323,\n\t0.632223, -0.240238, 0.544467, 0.348993,\n\t0.648819, -0.24887, 0.547594, 0.375462,\n\t0.665825, -0.256657, 0.54912, 0.403024,\n\t0.683389, -0.263711, 0.549294, 0.431773,\n\t0.701495, -0.269666, 0.547649, 0.461494,\n\t0.719197, -0.274169, 0.543786, 0.491623,\n\t0.737906, -0.278124, 0.538644, 0.522994,\n\t0.756652, -0.280632, 0.531057, 0.554775,\n\t0.775279, -0.281741, 0.521972, 0.586441,\n\t0.792688, -0.281652, 0.509613, 0.618596,\n\t0.811894, -0.280345, 0.496497, 0.651462,\n\t0.827938, -0.277128, 0.47968, 0.684023,\n\t0.844837, -0.271646, 0.460688, 0.718024,\n\t0.859239, -0.264397, 0.438872, 0.751207,\n\t0.874088, -0.256144, 0.41577, 0.784232,\n\t0.887693, -0.246311, 0.391369, 0.816191,\n\t0.899402, -0.235497, 0.365872, 0.847828,\n\t0.910973, -0.223631, 0.338618, 0.87934,\n\t0.92204, -0.209874, 0.310803, 0.910325,\n\t0.930987, -0.194265, 0.281802, 0.940695,\n\t0.94, -0.178125, 0.252836, 0.970958,\n\t0.948018, -0.161479, 0.224239, 1.00078,\n\t0.955141, -0.144038, 0.195857, 1.0288,\n\t0.960513, -0.124915, 0.168487, 1.05371,\n\t0.963964, -0.104284, 0.141495, 1.07596,\n\t0.968713, -0.0838732, 0.114437, 1.09628,\n\t0.975524, -0.0635579, 0.0863105, 1.11448,\n\t0.98431, -0.042291, 0.0574774, 1.13069,\n\t0.992916, -0.0209131, 0.0284343, 1.14568,\n\t0.999926, 0.000743097, -0.000379265, 1.15955,\n\t0.501042, -9.98428e-06, 0.498726, 1.00306e-05,\n\t0.502992, -0.000252112, 0.500665, 0.000253283,\n\t0.502417, -0.00100791, 0.500092, 0.00101259,\n\t0.502965, -0.00226919, 0.500621, 0.00227978,\n\t0.502318, -0.00403109, 0.499994, 0.00405011,\n\t0.502333, -0.00629832, 0.500005, 0.00632868,\n\t0.502362, -0.00906907, 0.500027, 0.00911446,\n\t0.502369, -0.0123423, 0.500023, 0.0124078,\n\t0.50243, -0.0161178, 0.500066, 0.016211,\n\t0.502493, -0.0203937, 0.500103, 0.0205256,\n\t0.502592, -0.0251684, 0.500166, 0.0253548,\n\t0.502707, -0.0304389, 0.50023, 0.0307029,\n\t0.502881, -0.0362015, 0.500335, 0.0365753,\n\t0.503124, -0.0424507, 0.500488, 0.0429798,\n\t0.503443, -0.0491582, 0.500686, 0.0499268,\n\t0.504083, -0.0561476, 0.501155, 0.0574541,\n\t0.504668, -0.0636846, 0.501524, 0.0655408,\n\t0.505319, -0.0716834, 0.501904, 0.0742072,\n\t0.50609, -0.0800925, 0.502321, 0.0834699,\n\t0.507122, -0.0888425, 0.502896, 0.0933603,\n\t0.508414, -0.097855, 0.503603, 0.10391,\n\t0.509955, -0.107304, 0.504416, 0.115113,\n\t0.512061, -0.116921, 0.505565, 0.127054,\n\t0.514419, -0.12689, 0.506732, 0.139709,\n\t0.517529, -0.136934, 0.508338, 0.153173,\n\t0.522085, -0.147327, 0.510987, 0.167528,\n\t0.526986, -0.157612, 0.513527, 0.182708,\n\t0.533122, -0.168213, 0.516717, 0.198881,\n\t0.540807, -0.178688, 0.520832, 0.215986,\n\t0.550687, -0.189511, 0.52632, 0.234335,\n\t0.560567, -0.199998, 0.531009, 0.253375,\n\t0.571698, -0.210652, 0.535839, 0.273499,\n\t0.584364, -0.220917, 0.541091, 0.294355,\n\t0.599066, -0.23137, 0.546875, 0.316525,\n\t0.614148, -0.241206, 0.551306, 0.339671,\n\t0.631157, -0.250379, 0.555187, 0.36531,\n\t0.647919, -0.258397, 0.556595, 0.392767,\n\t0.666112, -0.265528, 0.556949, 0.421397,\n\t0.686158, -0.271827, 0.556617, 0.451433,\n\t0.704838, -0.27674, 0.552975, 0.482131,\n\t0.723957, -0.280733, 0.547814, 0.513458,\n\t0.74262, -0.283359, 0.53997, 0.545446,\n\t0.762009, -0.284541, 0.530422, 0.57775,\n\t0.781314, -0.284507, 0.518546, 0.610434,\n\t0.799116, -0.283309, 0.504178, 0.643178,\n\t0.817604, -0.280378, 0.48843, 0.676248,\n\t0.83459, -0.275619, 0.469457, 0.709698,\n\t0.850974, -0.26856, 0.447698, 0.744245,\n\t0.866747, -0.260094, 0.424791, 0.777695,\n\t0.881412, -0.249929, 0.399913, 0.810392,\n\t0.8936, -0.239137, 0.37308, 0.842872,\n\t0.905943, -0.226818, 0.345705, 0.874677,\n\t0.916408, -0.213699, 0.31706, 0.906257,\n\t0.927215, -0.198428, 0.288444, 0.936881,\n\t0.935625, -0.181643, 0.258329, 0.96795,\n\t0.944076, -0.164386, 0.228488, 0.998216,\n\t0.951229, -0.146339, 0.199763, 1.02689,\n\t0.958793, -0.127709, 0.172153, 1.0535,\n\t0.963219, -0.107244, 0.144989, 1.07646,\n\t0.967562, -0.0857764, 0.11685, 1.09675,\n\t0.974866, -0.0645377, 0.0880571, 1.11576,\n\t0.983353, -0.0431732, 0.0587352, 1.13227,\n\t0.992503, -0.0218356, 0.0294181, 1.1478,\n\t1.00003, 0.000605203, -0.000231013, 1.16207,\n\t0.482935, -1.01177e-05, 0.504695, 9.68142e-06,\n\t0.477554, -0.000251521, 0.499071, 0.000240676,\n\t0.477904, -0.00100683, 0.499436, 0.00096342,\n\t0.478368, -0.00226636, 0.499899, 0.0021687,\n\t0.477977, -0.00402719, 0.499513, 0.00385384,\n\t0.477993, -0.00629226, 0.499525, 0.0060221,\n\t0.478011, -0.00906011, 0.499536, 0.00867289,\n\t0.478051, -0.0123305, 0.499566, 0.0118074,\n\t0.478089, -0.016102, 0.499587, 0.0154269,\n\t0.478171, -0.0203736, 0.499645, 0.0195341,\n\t0.478254, -0.025143, 0.499692, 0.0241318,\n\t0.47839, -0.0304071, 0.499779, 0.0292247,\n\t0.478588, -0.0361631, 0.499911, 0.0348196,\n\t0.478812, -0.0424023, 0.500046, 0.0409231,\n\t0.479208, -0.0490724, 0.500326, 0.047552,\n\t0.479841, -0.0560722, 0.500805, 0.0547377,\n\t0.480392, -0.0636125, 0.501152, 0.0624607,\n\t0.481068, -0.0716134, 0.501561, 0.0707473,\n\t0.481898, -0.0800062, 0.502054, 0.0796118,\n\t0.483022, -0.0886568, 0.502728, 0.0890974,\n\t0.484332, -0.0977553, 0.503479, 0.0992099,\n\t0.486126, -0.107173, 0.504546, 0.10999,\n\t0.488066, -0.11677, 0.50557, 0.121476,\n\t0.490521, -0.126725, 0.506849, 0.133672,\n\t0.494232, -0.136793, 0.50911, 0.146731,\n\t0.498302, -0.147116, 0.511345, 0.160577,\n\t0.50356"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.01, "dedup_hash": "7f8481dd6df92a74", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2022_7_area_lights_1_area_light", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:27+00:00", "source_type": "repo", "title": "1.Area Light", "api": "OpenGL Core", "glsl_version": null, "topic": "pbr/lighting/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/8.guest/2022/7.area_lights/1.area_light/7.area_light.fs", "language": "glsl", "loc": 139, "comment_density": 0.252, "code": "#version 330 core\n\nout vec4 fragColor;\n\nin vec3 worldPosition;\nin vec3 worldNormal;\nin vec2 texcoord;\n\nstruct Light\n{\n float intensity;\n vec3 color;\n vec3 points[4];\n bool twoSided;\n};\nuniform Light areaLight;\nuniform vec3 areaLightTranslate;\n\nstruct Material\n{\n sampler2D diffuse;\n vec4 albedoRoughness; // (x,y,z) = color, w = roughness\n};\nuniform Material material;\n\nuniform vec3 viewPosition;\nuniform sampler2D LTC1; // for inverse M\nuniform sampler2D LTC2; // GGX norm, fresnel, 0(unused), sphere\n\nconst float LUT_SIZE = 64.0; // ltc_texture size\nconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\nconst float LUT_BIAS = 0.5/LUT_SIZE;\n\n\n// Vector form without project to the plane (dot with the normal)\n// Use for proxy sphere clipping\nvec3 IntegrateEdgeVec(vec3 v1, vec3 v2)\n{\n // Using built-in acos() function will result flaws\n // Using fitting result for calculating acos()\n float x = dot(v1, v2);\n float y = abs(x);\n\n float a = 0.8543985 + (0.4965155 + 0.0145206*y)*y;\n float b = 3.4175940 + (4.1616724 + y)*y;\n float v = a / b;\n\n float theta_sintheta = (x > 0.0) ? v : 0.5*inversesqrt(max(1.0 - x*x, 1e-7)) - v;\n\n return cross(v1, v2)*theta_sintheta;\n}\n\nfloat IntegrateEdge(vec3 v1, vec3 v2)\n{\n return IntegrateEdgeVec(v1, v2).z;\n}\n\n// P is fragPos in world space (LTC distribution)\nvec3 LTC_Evaluate(vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4], bool twoSided)\n{\n // construct orthonormal basis around N\n vec3 T1, T2;\n T1 = normalize(V - N * dot(V, N));\n T2 = cross(N, T1);\n\n // rotate area light in (T1, T2, N) basis\n Minv = Minv * transpose(mat3(T1, T2, N));\n\n // polygon (allocate 4 vertices for clipping)\n vec3 L[4];\n // transform polygon from LTC back to origin Do (cosine weighted)\n L[0] = Minv * (points[0] - P);\n L[1] = Minv * (points[1] - P);\n L[2] = Minv * (points[2] - P);\n L[3] = Minv * (points[3] - P);\n\n // use tabulated horizon-clipped sphere\n // check if the shading point is behind the light\n vec3 dir = points[0] - P; // LTC space\n vec3 lightNormal = cross(points[1] - points[0], points[3] - points[0]);\n bool behind = (dot(dir, lightNormal) < 0.0);\n\n // cos weighted space\n L[0] = normalize(L[0]);\n L[1] = normalize(L[1]);\n L[2] = normalize(L[2]);\n L[3] = normalize(L[3]);\n\n // integrate\n vec3 vsum = vec3(0.0);\n vsum += IntegrateEdgeVec(L[0], L[1]);\n vsum += IntegrateEdgeVec(L[1], L[2]);\n vsum += IntegrateEdgeVec(L[2], L[3]);\n vsum += IntegrateEdgeVec(L[3], L[0]);\n\n // form factor of the polygon in direction vsum\n float len = length(vsum);\n\n float z = vsum.z/len;\n if (behind)\n z = -z;\n\n vec2 uv = vec2(z*0.5f + 0.5f, len); // range [0, 1]\n uv = uv*LUT_SCALE + LUT_BIAS;\n\n // Fetch the form factor for horizon clipping\n float scale = texture(LTC2, uv).w;\n\n float sum = len*scale;\n if (!behind && !twoSided)\n sum = 0.0;\n\n // Outgoing radiance (solid angle) for the entire polygon\n vec3 Lo_i = vec3(sum, sum, sum);\n return Lo_i;\n}\n\n// PBR-maps for roughness (and metallic) are usually stored in non-linear\n// color space (sRGB), so we use these functions to convert into linear RGB.\nvec3 PowVec3(vec3 v, float p)\n{\n return vec3(pow(v.x, p), pow(v.y, p), pow(v.z, p));\n}\n\nconst float gamma = 2.2;\nvec3 ToLinear(vec3 v) { return PowVec3(v, gamma); }\nvec3 ToSRGB(vec3 v) { return PowVec3(v, 1.0/gamma); }\n\n\nvoid main()\n{\n // gamma correction\n vec3 mDiffuse = texture(material.diffuse, texcoord).xyz;// * vec3(0.7f, 0.8f, 0.96f);\n vec3 mSpecular = ToLinear(vec3(0.23f, 0.23f, 0.23f)); // mDiffuse\n\n vec3 result = vec3(0.0f);\n\n vec3 N = normalize(worldNormal);\n vec3 V = normalize(viewPosition - worldPosition);\n vec3 P = worldPosition;\n float dotNV = clamp(dot(N, V), 0.0f, 1.0f);\n\n // use roughness and sqrt(1-cos_theta) to sample M_texture\n vec2 uv = vec2(material.albedoRoughness.w, sqrt(1.0f - dotNV));\n uv = uv*LUT_SCALE + LUT_BIAS;\n\n // get 4 parameters for inverse_M\n vec4 t1 = texture(LTC1, uv);\n\n // Get 2 parameters for Fresnel calculation\n vec4 t2 = texture(LTC2, uv);\n\n mat3 Minv = mat3(\n vec3(t1.x, 0, t1.y),\n vec3( 0, 1, 0),\n vec3(t1.z, 0, t1.w)\n );\n\n // translate light source for testing\n vec3 translatedPoints[4];\n translatedPoints[0] = areaLight.points[0] + areaLightTranslate;\n translatedPoints[1] = areaLight.points[1] + areaLightTranslate;\n translatedPoints[2] = areaLight.points[2] + areaLightTranslate;\n translatedPoints[3] = areaLight.points[3] + areaLightTranslate;\n\n // Evaluate LTC shading\n vec3 diffuse = LTC_Evaluate(N, V, P, mat3(1), translatedPoints, areaLight.twoSided);\n vec3 specular = LTC_Evaluate(N, V, P, Minv, translatedPoints, areaLight.twoSided);\n\n // GGX BRDF shadowing and Fresnel\n // t2.x: shadowedF90 (F90 normally it should be 1.0)\n // t2.y: Smith function for Geometric Attenuation Term, it is dot(V or L, H).\n specular *= mSpecular*t2.x + (1.0f - mSpecular) * t2.y;\n\n result = areaLight.color * areaLight.intensity * (specular + mDiffuse * diffuse);\n\n fragColor = vec4(ToSRGB(result), 1.0f);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/7.area_lights/1.area_light/7.area_light.vs", "language": "glsl", "loc": 19, "comment_density": 0.0, "code": "#version 330 core\n\nlayout (location = 0) in vec3 aPosition;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexcoord;\n\nuniform mat4 model;\nuniform mat3 normalMatrix;\nuniform mat4 view;\nuniform mat4 projection;\n\nout vec3 worldPosition;\nout vec3 worldNormal;\nout vec2 texcoord;\n\nvoid main()\n{\n\tvec4 worldpos = model * vec4(aPosition, 1.0f);\n\tworldPosition = worldpos.xyz;\n\tworldNormal = normalMatrix * aNormal;\n\ttexcoord = aTexcoord;\n\n\tgl_Position = projection * view * worldpos;\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/7.area_lights/1.area_light/7.light_plane.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\n\nout vec4 color;\nuniform vec3 lightColor;\n\nvoid main()\n{\n\tcolor = vec4(lightColor, 1.0f);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/7.area_lights/1.area_light/7.light_plane.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\n\nlayout (location = 0) in vec3 aPosition;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexcoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPosition, 1.0f);\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/7.area_lights/1.area_light/area_lights.cpp", "language": "code", "loc": 465, "comment_density": 0.14, "code": "//\n// Implementing Areal Lights with Linearly Transformed Cosines.\n//\n// Inspiration:\n// https://advances.realtimerendering.com/s2016/s2016_ltc_rnd.pdf\n// https://eheitzresearch.wordpress.com/415-2/\n\n// GLAD, GLFW, STB-IMAGE\n#include \n#include \n#include \n\n// GLM\n#include \n#include \n#include \n\n// LEARNOPENGL\n#include \n#include \n#include \n#include \n\n// STANDARD\n#include \n#include \n\n// CUSTOM\n#include \"../ltc_matrix.hpp\"\n#include \"../colors.hpp\" // LOOK FOR DIFFERENT COLORS!\n\n// FUNCTION PROTOTYPES\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid do_movement(GLfloat deltaTime);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\nvoid renderQuad();\nvoid renderCube();\n\n// SETTINGS AND GLOBALS\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nconst glm::vec3 LIGHT_COLOR = Color::BurlyWood; // CHANGE AREA LIGHT COLOR HERE!\nbool keys[1024]; // activated keys\nglm::vec3 areaLightTranslate;\nShader* ltcShaderPtr;\n\n// camera\nCamera camera(glm::vec3(0.0f, 1.0f, 0.5f), glm::vec3(0.0f, 1.0f, 0.0f), 180.0f, 0.0f);\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n\n\n//\n// 2---3-5\n// | / /|\n// | / / |\n// |/ / |\n// 1-4---6\n//\nstruct VertexAL {\n\tglm::vec3 position;\n\tglm::vec3 normal;\n\tglm::vec2 texcoord;\n};\n\nconst GLfloat psize = 10.0f;\nVertexAL planeVertices[6] = {\n\t{ {-psize, 0.0f, -psize}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f} },\n\t{ {-psize, 0.0f, psize}, {0.0f, 1.0f, 0.0f}, {0.0f, 1.0f} },\n\t{ { psize, 0.0f, psize}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f} },\n\t{ {-psize, 0.0f, -psize}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f} },\n\t{ { psize, 0.0f, psize}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f} },\n\t{ { psize, 0.0f, -psize}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f} }\n};\nVertexAL areaLightVertices[6] = {\n\t{ {-8.0f, 2.4f, -1.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f} }, // 0 1 5 4\n\t{ {-8.0f, 2.4f, 1.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f} },\n\t{ {-8.0f, 0.4f, 1.0f}, {1.0f, 0.0f, 0.0f}, {1.0f, 1.0f} },\n\t{ {-8.0f, 2.4f, -1.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f} },\n\t{ {-8.0f, 0.4f, 1.0f}, {1.0f, 0.0f, 0.0f}, {1.0f, 1.0f} },\n\t{ {-8.0f, 0.4f, -1.0f}, {1.0f, 0.0f, 0.0f}, {1.0f, 0.0f} }\n};\n\nGLuint planeVBO, planeVAO;\nGLuint areaLightVBO, areaLightVAO;\n\nvoid configureMockupData()\n{\n // PLANE\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n\n // position\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)0);\n glEnableVertexAttribArray(0);\n\n // normal\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)(3 * sizeof(GLfloat)));\n glEnableVertexAttribArray(1);\n\n // texcoord\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)(6 * sizeof(GLfloat)));\n glEnableVertexAttribArray(2);\n glBindVertexArray(0);\n\n // AREA LIGHT\n glGenVertexArrays(1, &areaLightVAO);\n glBindVertexArray(areaLightVAO);\n\n glGenBuffers(1, &areaLightVBO);\n glBindBuffer(GL_ARRAY_BUFFER, areaLightVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(areaLightVertices), areaLightVertices, GL_STATIC_DRAW);\n\n // position\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)0);\n glEnableVertexAttribArray(0);\n\n // normal\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)(3 * sizeof(GLfloat)));\n glEnableVertexAttribArray(1);\n\n // texcoord\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)(6 * sizeof(GLfloat)));\n glEnableVertexAttribArray(2);\n glBindVertexArray(0);\n\n glBindVertexArray(0);\n}\n\nvoid renderPlane()\n{\n\tglBindVertexArray(planeVAO);\n\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\tglBindVertexArray(0);\n}\n\nvoid renderAreaLight()\n{\n\tglBindVertexArray(areaLightVAO);\n\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\tglBindVertexArray(0);\n}\n\n\n\nstruct LTC_matrices {\n\tGLuint mat1;\n\tGLuint mat2;\n};\n\nGLuint loadMTexture()\n{\n\tGLuint texture = 0;\n\tglGenTextures(1, &texture);\n\tglBindTexture(GL_TEXTURE_2D, texture);\n\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64,\n\t 0, GL_RGBA, GL_FLOAT, LTC1);\n\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\tglBindTexture(GL_TEXTURE_2D, 0);\n\treturn texture;\n}\n\nGLuint loadLUTTexture()\n{\n\tGLuint texture = 0;\n\tglGenTextures(1, &texture);\n\tglBindTexture(GL_TEXTURE_2D, texture);\n\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64,\n\t 0, GL_RGBA, GL_FLOAT, LTC2);\n\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\tglBindTexture(GL_TEXTURE_2D, 0);\n\treturn texture;\n}\n\n\n\nvoid incrementRoughness(float step)\n{\n\tstatic glm::vec3 color = Color::SlateGray;\n\tstatic float roughness = 0.5f;\n\troughness += step;\n\troughness = glm::clamp(roughness, 0.0f, 1.0f);\n\t//std::cout << \"roughness: \" << roughness << '\\n';\n\tltcShaderPtr->use();\n\tltcShaderPtr->setVec4(\"material.albedoRoughness\", glm::vec4(color, roughness));\n\tglUseProgram(0);\n}\n\nvoid incrementLightIntensity(float step)\n{\n\tstatic float intensity = 4.0f;\n\tintensity += step;\n\tintensity = glm::clamp(intensity, 0.0f, 10.0f);\n\t//std::cout << \"intensity: \" << intensity << '\\n';\n\tltcShaderPtr->use();\n\tltcShaderPtr->setFloat(\"areaLight.intensity\", intensity);\n\tglUseProgram(0);\n}\n\nvoid switchTwoSided(bool doSwitch)\n{\n\tstatic bool twoSided = true;\n\tif (doSwitch) twoSided = !twoSided;\n\t//std::cout << \"twoSided: \" << std::boolalpha << twoSided << '\\n';\n\tltcShaderPtr->use();\n\tltcShaderPtr->setFloat(\"areaLight.twoSided\", twoSided);\n\tglUseProgram(0);\n}\n\n\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(\n\t SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL: Area Lights\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n glfwSetKeyCallback(window, key_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // LUT textures\n LTC_matrices mLTC;\n mLTC.mat1 = loadMTexture();\n mLTC.mat2 = loadLUTTexture();\n\n // SHADERS\n Shader shaderLTC(\"7.area_light.vs\", \"7.area_light.fs\");\n ltcShaderPtr = &shaderLTC;\n Shader shaderLightPlane(\"7.light_plane.vs\", \"7.light_plane.fs\");\n\n // TEXTURES\n unsigned int concreteTexture = loadTexture(\n\t FileSystem::getPath(\"resources/textures/concreteTexture.png\").c_str(), true);\n\n // SHADER CONFIGURATION\n shaderLTC.use();\n shaderLTC.setVec3(\"areaLight.points[0]\", areaLightVertices[0].position);\n shaderLTC.setVec3(\"areaLight.points[1]\", areaLightVertices[1].position);\n\tshaderLTC.setVec3(\"areaLight.points[2]\", areaLightVertices[4].position);\n\tshaderLTC.setVec3(\"areaLight.points[3]\", areaLightVertices[5].position);\n\tshaderLTC.setVec3(\"areaLight.color\", LIGHT_COLOR);\n\tshaderLTC.setInt(\"LTC1\", 0);\n\tshaderLTC.setInt(\"LTC2\", 1);\n\tshaderLTC.setInt(\"material.diffuse\", 2);\n\tincrementRoughness(0.0f);\n\tincrementLightIntensity(0.0f);\n\tswitchTwoSided(false);\n\tglUseProgram(0);\n\n\tshaderLightPlane.use();\n\t{\n\t\tglm::mat4 model(1.0f);\n\t\tshaderLightPlane.setMat4(\"model\", model);\n\t}\n\tshaderLightPlane.setVec3(\"lightColor\", LIGHT_COLOR);\n\tglUseProgram(0);\n\n\t// 3D OBJECTS\n\tconfigureMockupData();\n\tareaLightTranslate = glm::vec3(0.0f, 0.0f, 0.0f);\n\n\n // RENDER LOOP\n while (!glfwWindowShouldClose(window))\n {\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n glfwPollEvents();\n\t\tdo_movement(deltaTime);\n\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shaderLTC.use();\n glm::mat4 model(1.0f);\n\t\tglm::mat3 normalMatrix = glm::mat3(model);\n\t\tshaderLTC.setMat4(\"model\", model);\n\t\tshaderLTC.setMat3(\"normalMatrix\", normalMatrix);\n\t\tglm::mat4 view = camera.GetViewMatrix();\n\t\tshaderLTC.setMat4(\"view\", view);\n\t\tglm::mat4 projection = glm::perspective(\n\t\t\tglm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n\t\tshaderLTC.setMat4(\"projection\", projection);\n\t\tshaderLTC.setVec3(\"viewPosition\", camera.Position);\n\t\tshaderLTC.setVec3(\"areaLightTranslate\", areaLightTranslate);\n\n\t\tglActiveTexture(GL_TEXTURE0);\n\t\tglBindTexture(GL_TEXTURE_2D, mLTC.mat1);\n\t\tglActiveTexture(GL_TEXTURE1);\n\t\tglBindTexture(GL_TEXTURE_2D, mLTC.mat2);\n\t\tglActiveTexture(GL_TEXTURE2);\n\t\tglBindTexture(GL_TEXTURE_2D, concreteTexture);\n\t\trenderPlane();\n\t\tglUseProgram(0);\n\n\t\tshaderLightPlane.use();\n\t\tmodel = glm::translate(model, areaLightTranslate);\n\t\tshaderLightPlane.setMat4(\"model\", model);\n\t\tshaderLightPlane.setMat4(\"view\", view);\n\t\tshaderLightPlane.setMat4(\"projection\", projection);\n\t\trenderAreaLight();\n\t\tglUseProgram(0);\n\n glfwSwapBuffers(window);\n }\n\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n glDeleteVertexArrays(1, &areaLightVAO);\n glDeleteBuffers(1, &areaLightVBO);\n\n glfwTerminate();\n return 0;\n}\n\n\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid do_movement(GLfloat deltaTime)\n{\n\tfloat cameraSpeed = deltaTime * 3.0f;\n\n if(keys[GLFW_KEY_W]) {\n camera.ProcessKeyboard(FORWARD, cameraSpeed);\n }\n else if(keys[GLFW_KEY_S]) {\n camera.ProcessKeyboard(BACKWARD, cameraSpeed);\n }\n if(keys[GLFW_KEY_A]) {\n camera.ProcessKeyboard(LEFT, cameraSpeed);\n }\n else if(keys[GLFW_KEY_D]) {\n camera.ProcessKeyboard(RIGHT, cameraSpeed);\n }\n\n if (keys[GLFW_KEY_R]) {\n\t if (keys[GLFW_KEY_LEFT_SHIFT]) incrementRoughness(0.01f);\n\t else incrementRoughness(-0.01f);\n }\n\n if (keys[GLFW_KEY_I]) {\n\t if (keys[GLFW_KEY_LEFT_SHIFT]) incrementLightIntensity(0.025f);\n\t else incrementLightIntensity(-0.025f);\n }\n\n if (keys[GLFW_KEY_LEFT]) {\n\t areaLightTranslate.z += 0.01f;\n }\n if (keys[GLFW_KEY_RIGHT]) {\n\t areaLightTranslate.z -= 0.01f;\n }\n if (keys[GLFW_KEY_UP]) {\n\t areaLightTranslate.y += 0.01f;\n }\n if (keys[GLFW_KEY_DOWN]) {\n\t areaLightTranslate.y -= 0.01f;\n }\n}\n\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)\n{\n static unsigned short wireframe = 0;\n\n if(action == GLFW_PRESS)\n {\n switch(key)\n {\n case GLFW_KEY_ESCAPE:\n glfwSetWindowShouldClose(window, GL_TRUE);\n return;\n case GLFW_KEY_B:\n\t switchTwoSided(true);\n\t break;\n default:\n keys[key] = true;\n break;\n }\n }\n\n if(action == GLFW_RELEASE)\n {\n if(key == GLFW_KEY_SPACE) {\n switch(wireframe)\n {\n case 0:\n glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n wireframe = 1;\n break;\n default:\n glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);\n wireframe = 0;\n break;\n }\n }\n else {\n keys[key] = false;\n }\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and\n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path, bool gammaCorrection)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum internalFormat;\n GLenum dataFormat;\n if (nrComponents == 1)\n {\n internalFormat = dataFormat = GL_RED;\n }\n else if (nrComponents == 3)\n {\n internalFormat = gammaCorrection ? GL_SRGB : GL_RGB;\n dataFormat = GL_RGB;\n }\n else if (nrComponents == 4)\n {\n internalFormat = gammaCorrection ? GL_SRGB_ALPHA : GL_RGBA;\n dataFormat = GL_RGBA;\n }\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, dataFormat, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.078, "dedup_hash": "1ee946b6a8181776", "has_readme": true} +{"id": "joeydevries_learnopengl_src_8_guest_2022_7_area_lights_2_multiple_area_lights", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:28+00:00", "source_type": "repo", "title": "2.Multiple Area Lights", "api": "OpenGL Core", "glsl_version": null, "topic": "pbr/lighting/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/8.guest/2022/7.area_lights/2.multiple_area_lights/7.light_plane.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\n\nout vec4 color;\nuniform vec3 lightColor;\n\nvoid main()\n{\n\tcolor = vec4(lightColor, 1.0f);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/7.area_lights/2.multiple_area_lights/7.light_plane.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\n\nlayout (location = 0) in vec3 aPosition;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexcoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPosition, 1.0f);\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/7.area_lights/2.multiple_area_lights/7.multi_area_light.fs", "language": "glsl", "loc": 136, "comment_density": 0.279, "code": "#version 330 core\n\nout vec4 fragColor;\n\nin vec3 worldPosition;\nin vec3 worldNormal;\nin vec2 texcoord;\n\nstruct AreaLight\n{\n float intensity;\n\tvec3 color;\n vec3 points[4];\n\tbool twoSided;\n};\nuniform AreaLight areaLights[32];\nuniform int numAreaLights;\n\nstruct Material\n{\n\tsampler2D diffuse;\n\tvec4 albedoRoughness; // (x,y,z) = color, w = roughness\n};\nuniform Material material;\n\nuniform vec3 viewPosition;\nuniform sampler2D LTC1; // for inverse M\nuniform sampler2D LTC2; // GGX norm, fresnel, 0(unused), sphere\n\nconst float LUT_SIZE = 64.0; // ltc_texture size\nconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\nconst float LUT_BIAS = 0.5/LUT_SIZE;\n\n\n// Vector form without project to the plane (dot with the normal)\n// Use for proxy sphere clipping\nvec3 IntegrateEdgeVec(vec3 v1, vec3 v2)\n{\n // Using built-in acos() function will result flaws\n // Using fitting result for calculating acos()\n float x = dot(v1, v2);\n float y = abs(x);\n\n float a = 0.8543985 + (0.4965155 + 0.0145206*y)*y;\n float b = 3.4175940 + (4.1616724 + y)*y;\n float v = a / b;\n\n float theta_sintheta = (x > 0.0) ? v : 0.5*inversesqrt(max(1.0 - x*x, 1e-7)) - v;\n\n return cross(v1, v2)*theta_sintheta;\n}\n\n// P is fragPos in world space (LTC distribution)\nvec3 LTC_Evaluate(vec3 N, vec3 V, vec3 P, mat3 Minv, vec3 points[4], bool twoSided)\n{\n // construct orthonormal basis around N\n vec3 T1, T2;\n T1 = normalize(V - N * dot(V, N));\n T2 = cross(N, T1);\n\n // rotate area light in (T1, T2, N) basis\n Minv = Minv * transpose(mat3(T1, T2, N));\n\t//Minv = Minv * transpose(mat3(N, T2, T1));\n\n // polygon (allocate 4 vertices for clipping)\n vec3 L[4];\n // transform polygon from LTC back to origin Do (cosine weighted)\n L[0] = Minv * (points[0] - P);\n L[1] = Minv * (points[1] - P);\n L[2] = Minv * (points[2] - P);\n L[3] = Minv * (points[3] - P);\n\n // use tabulated horizon-clipped sphere\n // check if the shading point is behind the light\n vec3 dir = points[0] - P; // LTC space\n vec3 lightNormal = cross(points[1] - points[0], points[3] - points[0]);\n bool behind = (dot(dir, lightNormal) < 0.0);\n\n // cos weighted space\n L[0] = normalize(L[0]);\n L[1] = normalize(L[1]);\n L[2] = normalize(L[2]);\n L[3] = normalize(L[3]);\n\n\t// integrate\n vec3 vsum = vec3(0.0);\n vsum += IntegrateEdgeVec(L[0], L[1]);\n vsum += IntegrateEdgeVec(L[1], L[2]);\n vsum += IntegrateEdgeVec(L[2], L[3]);\n vsum += IntegrateEdgeVec(L[3], L[0]);\n\n // form factor of the polygon in direction vsum\n float len = length(vsum);\n\n float z = vsum.z/len;\n if (behind)\n z = -z;\n\n vec2 uv = vec2(z*0.5f + 0.5f, len); // range [0, 1]\n uv = uv*LUT_SCALE + LUT_BIAS;\n\n // Fetch the form factor for horizon clipping\n float scale = texture(LTC2, uv).w;\n\n float sum = len*scale;\n if (!behind && !twoSided)\n sum = 0.0;\n\n // Outgoing radiance (solid angle) for the entire polygon\n vec3 Lo_i = vec3(sum, sum, sum);\n return Lo_i;\n}\n\n// PBR-maps for roughness (and metallic) are usually stored in non-linear\n// color space (sRGB), so we use these functions to convert into linear RGB.\nvec3 PowVec3(vec3 v, float p)\n{\n return vec3(pow(v.x, p), pow(v.y, p), pow(v.z, p));\n}\n\nconst float gamma = 2.2;\nvec3 ToLinear(vec3 v) { return PowVec3(v, gamma); }\nvec3 ToSRGB(vec3 v) { return PowVec3(v, 1.0/gamma); }\n\n\nvoid main()\n{\n // gamma correction\n vec3 mDiffuse = texture(material.diffuse, texcoord).xyz;// * vec3(0.7f, 0.8f, 0.96f);\n vec3 mSpecular = ToLinear(vec3(0.23f, 0.23f, 0.23f)); // mDiffuse\n\n vec3 result = vec3(0.0f);\n\n\tvec3 N = normalize(worldNormal);\n\tvec3 V = normalize(viewPosition - worldPosition);\n\tvec3 P = worldPosition;\n\tfloat dotNV = clamp(dot(N, V), 0.0f, 1.0f);\n\n // use roughness and sqrt(1-cos_theta) to sample M_texture\n vec2 uv = vec2(material.albedoRoughness.w, sqrt(1.0f - dotNV));\n uv = uv*LUT_SCALE + LUT_BIAS;\n\n // get 4 parameters for inverse_M\n vec4 t1 = texture(LTC1, uv);\n\n // Get 2 parameters for Fresnel calculation\n vec4 t2 = texture(LTC2, uv);\n\n mat3 Minv = mat3(\n vec3(t1.x, 0, t1.y),\n vec3( 0, 1, 0),\n vec3(t1.z, 0, t1.w)\n );\n\n\t// iterate through all area lights\n\tfor (int i = 0; i < numAreaLights; i++)\n\t{\n\t\t// Evaluate LTC shading\n\t\tvec3 diffuse = LTC_Evaluate(N, V, P, mat3(1), areaLights[i].points, areaLights[i].twoSided);\n\t\tvec3 specular = LTC_Evaluate(N, V, P, Minv, areaLights[i].points, areaLights[i].twoSided);\n\n\t\t// GGX BRDF shadowing and Fresnel\n\t\t// t2.x: shadowedF90 (F90 normally it should be 1.0)\n\t\t// t2.y: Smith function for Geometric Attenuation Term, it is dot(V or L, H).\n\t\tspecular *= mSpecular*t2.x + (1.0f - mSpecular) * t2.y;\n\n\t\t// Add contribution\n\t\tresult += areaLights[i].color * areaLights[i].intensity * (specular + mDiffuse * diffuse);\n\t\t//result += vec3(0.5, 0.5, 0.5);\n\t}\n\n\tfragColor = vec4(ToSRGB(result), 1.0f);\n}\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/8.guest/2022/7.area_lights/2.multiple_area_lights/7.multi_area_light.vs", "language": "glsl", "loc": 19, "comment_density": 0.0, "code": "#version 330 core\n\nlayout (location = 0) in vec3 aPosition;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexcoord;\n\nuniform mat4 model;\nuniform mat3 normalMatrix;\nuniform mat4 view;\nuniform mat4 projection;\n\nout vec3 worldPosition;\nout vec3 worldNormal;\nout vec2 texcoord;\n\nvoid main()\n{\n\tvec4 worldpos = model * vec4(aPosition, 1.0f);\n\tworldPosition = worldpos.xyz;\n\tworldNormal = normalMatrix * aNormal;\n\ttexcoord = aTexcoord;\n\n\tgl_Position = projection * view * worldpos;\n}\n", "stage": "vertex", "validation_status": "valid"}, {"path": "src/8.guest/2022/7.area_lights/2.multiple_area_lights/multiple_area_lights.cpp", "language": "code", "loc": 525, "comment_density": 0.156, "code": "//\n// Implementing Areal Lights with Linearly Transformed Cosines.\n//\n// Inspiration:\n// https://advances.realtimerendering.com/s2016/s2016_ltc_rnd.pdf\n// https://eheitzresearch.wordpress.com/415-2/\n\n// GLAD, GLFW, STB-IMAGE\n#include \n#include \n#include \n\n// GLM\n#include \n#include \n#include \n\n// LEARNOPENGL\n#include \n#include \n#include \n#include \n\n// STANDARD\n#include \n#include \n#include \n#include \n#include \n\n// CUSTOM\n#include \"../ltc_matrix.hpp\"\n#include \"../colors.hpp\" // LOOK FOR DIFFERENT COLORS!\n\n// FUNCTION PROTOTYPES\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid do_movement(GLfloat deltaTime);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\nvoid renderQuad();\nvoid renderCube();\n\n// SETTINGS AND GLOBALS\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nconst glm::vec3 LIGHT_COLOR = Color::BurlyWood; // CHANGE AREA LIGHT COLOR HERE!\nbool keys[1024]; // activated keys\nconst int NUM_AREA_LIGHTS = 16;\nShader* ltcShaderPtr;\n\n// camera\nCamera camera(glm::vec3(-0.224556, 10.4038, -18.9259), glm::vec3(0.0f, 1.0f, 0.0f), 89.3999, -34.3001);\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n\nstruct VertexAL {\n\tglm::vec3 position;\n\tglm::vec3 normal;\n\tglm::vec2 texcoord;\n};\n\nstruct AreaLight {\n\tglm::vec3 offset;\n\tfloat yRotation;\n\n\tglm::vec3 color;\n\tfloat intensity = 4.0f;\n\tbool twoSided = true;\n};\n\nAreaLight areaLights[NUM_AREA_LIGHTS];\n\n\n//\n// 2---3-5\n// | / /|\n// | / / |\n// |/ / |\n// 1-4---6\n//\nconst GLfloat psize = 10.0f;\nVertexAL planeVertices[6] = {\n\t{ {-psize, 0.0f, -psize}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f} },\n\t{ {-psize, 0.0f, psize}, {0.0f, 1.0f, 0.0f}, {0.0f, 1.0f} },\n\t{ { psize, 0.0f, psize}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f} },\n\t{ {-psize, 0.0f, -psize}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f} },\n\t{ { psize, 0.0f, psize}, {0.0f, 1.0f, 0.0f}, {1.0f, 1.0f} },\n\t{ { psize, 0.0f, -psize}, {0.0f, 1.0f, 0.0f}, {1.0f, 0.0f} }\n};\nVertexAL areaLightVertices[6] = {\n\t{ {-8.0f, 2.4f, -1.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f} }, // 0 1 5 4\n\t{ {-8.0f, 2.4f, 1.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 1.0f} },\n\t{ {-8.0f, 0.4f, 1.0f}, {1.0f, 0.0f, 0.0f}, {1.0f, 1.0f} },\n\t{ {-8.0f, 2.4f, -1.0f}, {1.0f, 0.0f, 0.0f}, {0.0f, 0.0f} },\n\t{ {-8.0f, 0.4f, 1.0f}, {1.0f, 0.0f, 0.0f}, {1.0f, 1.0f} },\n\t{ {-8.0f, 0.4f, -1.0f}, {1.0f, 0.0f, 0.0f}, {1.0f, 0.0f} }\n};\n\nGLuint planeVBO, planeVAO;\nGLuint areaLightVBO, areaLightVAO;\n\nvoid configureAreaLights()\n{\n\t// CONFIGURE AREA LIGHTS\n\tstd::uniform_real_distribution random_floats(0.0f, 1.0f);\n\ttypedef std::chrono::high_resolution_clock myclock;\n\tunsigned seed = myclock::now().time_since_epoch().count();\n\tstd::default_random_engine generator(seed);\n\tstd::function fn =\n\t\t[&random_floats, &generator]{ return random_floats(generator); };\n\tfor (int i = 0; i < NUM_AREA_LIGHTS; i++)\n\t{\n\t\tfloat x = fn(); x = (x > 0.5f) ? x : -x;\n\t\tfloat z = fn(); z = (z > 0.5f) ? z : -z;\n\t\tareaLights[i].offset = glm::vec3(x, 0.0f, z) * 8.f;\n\t\tareaLights[i].yRotation = fn() * glm::two_pi();\n\t\tareaLights[i].color = glm::vec3(fn(), fn(), fn());\n\t\t// color\n\t\t// intensity\n\t}\n\n\t// SEND TO GPU\n glGenVertexArrays(1, &areaLightVAO);\n glBindVertexArray(areaLightVAO);\n\n glGenBuffers(1, &areaLightVBO);\n glBindBuffer(GL_ARRAY_BUFFER, areaLightVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(areaLightVertices), areaLightVertices, GL_STATIC_DRAW);\n\n // position\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)0);\n glEnableVertexAttribArray(0);\n\n // normal\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)(3 * sizeof(GLfloat)));\n glEnableVertexAttribArray(1);\n\n // texcoord\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)(6 * sizeof(GLfloat)));\n glEnableVertexAttribArray(2);\n glBindVertexArray(0);\n\n glBindVertexArray(0);\n}\n\nvoid configurePlane()\n{\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n\n // position\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)0);\n glEnableVertexAttribArray(0);\n\n // normal\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)(3 * sizeof(GLfloat)));\n glEnableVertexAttribArray(1);\n\n // texcoord\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat),\n (GLvoid*)(6 * sizeof(GLfloat)));\n glEnableVertexAttribArray(2);\n glBindVertexArray(0);\n}\n\nvoid renderPlane()\n{\n\tglBindVertexArray(planeVAO);\n\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\tglBindVertexArray(0);\n}\n\nvoid renderAreaLight()\n{\n\tglBindVertexArray(areaLightVAO);\n\tglDrawArrays(GL_TRIANGLES, 0, 6);\n\tglBindVertexArray(0);\n}\n\n\n\nstruct LTC_matrices {\n\tGLuint mat1;\n\tGLuint mat2;\n};\n\nGLuint loadMTexture()\n{\n\tGLuint texture = 0;\n\tglGenTextures(1, &texture);\n\tglBindTexture(GL_TEXTURE_2D, texture);\n\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64,\n\t 0, GL_RGBA, GL_FLOAT, LTC1);\n\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\tglBindTexture(GL_TEXTURE_2D, 0);\n\treturn texture;\n}\n\nGLuint loadLUTTexture()\n{\n\tGLuint texture = 0;\n\tglGenTextures(1, &texture);\n\tglBindTexture(GL_TEXTURE_2D, texture);\n\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64,\n\t 0, GL_RGBA, GL_FLOAT, LTC2);\n\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\tglBindTexture(GL_TEXTURE_2D, 0);\n\treturn texture;\n}\n\n\n\nvoid incrementRoughness(float step)\n{\n\tstatic glm::vec3 color = Color::SlateGray;\n\tstatic float roughness = 0.5f;\n\troughness += step;\n\troughness = glm::clamp(roughness, 0.0f, 1.0f);\n\t//std::cout << \"roughness: \" << roughness << '\\n';\n\tltcShaderPtr->use();\n\tltcShaderPtr->setVec4(\"material.albedoRoughness\", glm::vec4(color, roughness));\n\tglUseProgram(0);\n}\n\nvoid incrementLightIntensity(float step)\n{\n\tstatic float intensity = 4.0f;\n\tintensity += step;\n\tintensity = glm::clamp(intensity, 0.0f, 10.0f);\n\t//std::cout << \"intensity: \" << intensity << '\\n';\n\tltcShaderPtr->use();\n\tltcShaderPtr->setFloat(\"areaLight.intensity\", intensity);\n\tglUseProgram(0);\n}\n\nvoid switchTwoSided(bool doSwitch)\n{\n\tstatic bool twoSided = true;\n\tif (doSwitch) twoSided = !twoSided;\n\t//std::cout << \"twoSided: \" << std::boolalpha << twoSided << '\\n';\n\tltcShaderPtr->use();\n\tltcShaderPtr->setFloat(\"areaLight.twoSided\", twoSided);\n\tglUseProgram(0);\n}\n\n\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(\n\t SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL: Multiple Area Lights\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n glfwSetKeyCallback(window, key_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // LUT textures\n LTC_matrices mLTC;\n mLTC.mat1 = loadMTexture();\n mLTC.mat2 = loadLUTTexture();\n\n // SHADERS\n Shader shaderLTC(\"7.multi_area_light.vs\", \"7.multi_area_light.fs\");\n ltcShaderPtr = &shaderLTC;\n Shader shaderLightPlane(\"7.light_plane.vs\", \"7.light_plane.fs\");\n\n // TEXTURES\n unsigned int concreteTexture = loadTexture(\n\t FileSystem::getPath(\"resources/textures/concreteTexture.png\").c_str(), true);\n\n // 3D OBJECTS\n\tconfigurePlane();\n\tconfigureAreaLights();\n\n // SHADER CONFIGURATION\n shaderLTC.use();\n for (int i = 0; i < NUM_AREA_LIGHTS; i++)\n\t{\n\t\tglm::mat4 model(1.0f);\n\t\tmodel = glm::translate(model, areaLights[i].offset);\n\t\tmodel = glm::rotate(model, areaLights[i].yRotation, glm::vec3(0.0f, 1.0f, 0.0f));\n\n\t\tglm::vec3 p0 = glm::vec3(model * glm::vec4(areaLightVertices[0].position, 1.0f));\n\t\tglm::vec3 p1 = glm::vec3(model * glm::vec4(areaLightVertices[1].position, 1.0f));\n\t\tglm::vec3 p2 = glm::vec3(model * glm::vec4(areaLightVertices[4].position, 1.0f));\n\t\tglm::vec3 p3 = glm::vec3(model * glm::vec4(areaLightVertices[5].position, 1.0f));\n\n\t\tstd::string str_pos = \"areaLights[\" + std::to_string(i) + \"].points\";\n\t\tstd::string str_col = \"areaLights[\" + std::to_string(i) + \"].color\";\n\t\tstd::string str_int = \"areaLights[\" + std::to_string(i) + \"].intensity\";\n\t\tstd::string str_two = \"areaLights[\" + std::to_string(i) + \"].twoSided\";\n\t\tshaderLTC.setVec3((str_pos + \"[0]\").c_str(), p0);\n\t\tshaderLTC.setVec3((str_pos + \"[1]\").c_str(), p1);\n\t\tshaderLTC.setVec3((str_pos + \"[2]\").c_str(), p2);\n\t\tshaderLTC.setVec3((str_pos + \"[3]\").c_str(), p3);\n\t\tshaderLTC.setVec3(str_col.c_str(), areaLights[i].color);\n\t\tshaderLTC.setFloat(str_int.c_str(), 2.0f);\n\t\tshaderLTC.setInt(str_two.c_str(), 1);\n\t}\n\tshaderLTC.setInt(\"numAreaLights\", NUM_AREA_LIGHTS);\n\tshaderLTC.setInt(\"LTC1\", 0);\n\tshaderLTC.setInt(\"LTC2\", 1);\n\tshaderLTC.setInt(\"material.diffuse\", 2);\n\tincrementRoughness(0.0f);\n\t//incrementLightIntensity(0.0f);\n\t//switchTwoSided(false);\n\tglUseProgram(0);\n\n\tshaderLightPlane.use();\n\t{\n\t\tglm::mat4 model(1.0f);\n\t\tshaderLightPlane.setMat4(\"model\", model);\n\t}\n\tshaderLightPlane.setVec3(\"lightColor\", LIGHT_COLOR);\n\tglUseProgram(0);\n\n\t// TIME MEASUREMENT\n\tGLuint timeQuery;\n\tglGenQueries(1, &timeQuery);\n\n\tGLuint64 totalQueryTimeNs = 0;\n\tGLuint64 numQueries = 0;\n\n\n // RENDER LOOP\n while (!glfwWindowShouldClose(window))\n {\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n glfwPollEvents();\n\t\tdo_movement(deltaTime);\n\n glClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shaderLTC.use();\n glm::mat4 model(1.0f);\n\t\tglm::mat3 normalMatrix = glm::mat3(model);\n\t\tshaderLTC.setMat4(\"model\", model);\n\t\tshaderLTC.setMat3(\"normalMatrix\", normalMatrix);\n\t\tglm::mat4 view = camera.GetViewMatrix();\n\t\tshaderLTC.setMat4(\"view\", view);\n\t\tglm::mat4 projection = glm::perspective(\n\t\t\tglm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n\t\tshaderLTC.setMat4(\"projection\", projection);\n\t\tshaderLTC.setVec3(\"viewPosition\", camera.Position);\n\n\t\tglActiveTexture(GL_TEXTURE0);\n\t\tglBindTexture(GL_TEXTURE_2D, mLTC.mat1);\n\t\tglActiveTexture(GL_TEXTURE1);\n\t\tglBindTexture(GL_TEXTURE_2D, mLTC.mat2);\n\t\tglActiveTexture(GL_TEXTURE2);\n\t\tglBindTexture(GL_TEXTURE_2D, concreteTexture);\n\n\t\t// measure time\n\t\tglBeginQuery(GL_TIME_ELAPSED, timeQuery);\n\t\trenderPlane();\n\t\tglEndQuery(GL_TIME_ELAPSED);\n\n\t\tglUseProgram(0);\n\n\t\t// draw area light planes\n\t\tshaderLightPlane.use();\n\t\tshaderLightPlane.setMat4(\"view\", view);\n\t\tshaderLightPlane.setMat4(\"projection\", projection);\n\t\tfloat sinNowTime = glm::sin(currentFrame);\n\t\tfor (int i = 0; i < NUM_AREA_LIGHTS; i++)\n\t\t{\n\t\t\tmodel = glm::mat4(1.0f);\n\t\t\tmodel = glm::translate(model, areaLights[i].offset);\n\t\t\tmodel = glm::rotate(model, areaLights[i].yRotation, glm::vec3(0.0f, 1.0f, 0.0f));\n\t\t\tshaderLightPlane.setMat4(\"model\", model);\n\t\t\tshaderLightPlane.setVec3(\"lightColor\", areaLights[i].color);\n\t\t\trenderAreaLight();\n\t\t}\n\t\tglUseProgram(0);\n\n\t\t// fetch timestamp\n\t\tGLuint64 elapsed = 0; // will be in nanoseconds\n\t\tglGetQueryObjectui64v(timeQuery, GL_QUERY_RESULT, &elapsed);\n\t\tnumQueries++;\n\t\ttotalQueryTimeNs += elapsed;\n\n glfwSwapBuffers(window);\n }\n\n // compute average frame time\n\tdouble measuredAverageNs = (double)totalQueryTimeNs / (double)numQueries;\n\tdouble measuredAverageMs = measuredAverageNs * 1.0e-6;\n\tstd::cout << \"Total average time(ms) = \" << measuredAverageMs << '\\n';\n\n\tglDeleteQueries(1, &timeQuery);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n glDeleteVertexArrays(1, &areaLightVAO);\n glDeleteBuffers(1, &areaLightVBO);\n\n glfwTerminate();\n return 0;\n}\n\n\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid do_movement(GLfloat deltaTime)\n{\n\tfloat cameraSpeed = deltaTime * 3.0f;\n\n if(keys[GLFW_KEY_W]) {\n camera.ProcessKeyboard(FORWARD, cameraSpeed);\n }\n else if(keys[GLFW_KEY_S]) {\n camera.ProcessKeyboard(BACKWARD, cameraSpeed);\n }\n if(keys[GLFW_KEY_A]) {\n camera.ProcessKeyboard(LEFT, cameraSpeed);\n }\n else if(keys[GLFW_KEY_D]) {\n camera.ProcessKeyboard(RIGHT, cameraSpeed);\n }\n\n if (keys[GLFW_KEY_R]) {\n\t if (keys[GLFW_KEY_LEFT_SHIFT]) incrementRoughness(0.01f);\n\t else incrementRoughness(-0.01f);\n }\n\n // if (keys[GLFW_KEY_I]) {\n\t// if (keys[GLFW_KEY_LEFT_SHIFT]) incrementLightIntensity(0.025f);\n\t// else incrementLightIntensity(-0.025f);\n // }\n}\n\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)\n{\n static unsigned short wireframe = 0;\n\n if(action == GLFW_PRESS)\n {\n switch(key)\n {\n case GLFW_KEY_ESCAPE:\n glfwSetWindowShouldClose(window, GL_TRUE);\n return;\n // case GLFW_KEY_B:\n\t // switchTwoSided(true);\n\t // break;\n default:\n keys[key] = true;\n break;\n }\n }\n\n if(action == GLFW_RELEASE)\n {\n if(key == GLFW_KEY_SPACE) {\n switch(wireframe)\n {\n case 0:\n glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n wireframe = 1;\n break;\n default:\n glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);\n wireframe = 0;\n break;\n }\n }\n else {\n keys[key] = false;\n }\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and\n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path, bool gammaCorrection)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum internalFormat;\n GLenum dataFormat;\n if (nrComponents == 1)\n {\n internalFormat = dataFormat = GL_RED;\n }\n else if (nrComponents == 3)\n {\n internalFormat = gammaCorrection ? GL_SRGB : GL_RGB;\n dataFormat = GL_RGB;\n }\n else if (nrComponents == 4)\n {\n internalFormat = gammaCorrection ? GL_SRGB_ALPHA : GL_RGBA;\n dataFormat = GL_RGBA;\n }\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, dataFormat, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.087, "dedup_hash": "bde6d0e90eae1493", "has_readme": true} diff --git a/dataset_permissive.jsonl b/dataset_permissive.jsonl index ab60411ab049545a423868a2a4c9763804b81791..184bf78696bfe62071b974bd0c93160641852d29 100644 --- a/dataset_permissive.jsonl +++ b/dataset_permissive.jsonl @@ -1,11 +1,3 @@ -{"id": "ssgl_impl", "source": "https://github.com/local/ssgl", "source_commit": "4d3f2977620be74782a6523fc950e98c0b7f69bb", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Impl", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "compute/texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "impl/gl_helpers.cpp", "language": "cpp", "loc": 86, "comment_density": 0.023, "code": "\n#ifdef _WIN32\n#include \n\n#include \"gl_helpers.h\"\n\n#include \n#pragma comment(lib, \"gdiplus.lib\")\n#include \n#include \n\nTexture loadImage(const wchar_t* path) {\n\tusing namespace Gdiplus;\n\tULONG_PTR token;\n\tGdiplusStartupInput startupInput;\n\tGdiplusStartup(&token, &startupInput, nullptr);\n\n\tTexture result;\n\t// new scope so RAII objects are released before gdi+ shutdown\n\t{\n\t\tImage image(path);\n\t\timage.RotateFlip(RotateNoneFlipY);\n\t\tconst Rect r(0, 0, image.GetWidth(), image.GetHeight());\n\t\tBitmapData data;\n\t\t((Bitmap*)&image)->LockBits(&r, ImageLockModeRead, PixelFormat32bppARGB, &data);\n\n\t\tglBindTexture(GL_TEXTURE_2D, result);\n\t\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.GetWidth(), image.GetHeight(), 0, GL_BGRA, GL_UNSIGNED_BYTE, data.Scan0);\n\t\tglGenerateMipmap(GL_TEXTURE_2D);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\t\t((Bitmap*)&image)->UnlockBits(&data);\n\t}\n\tGdiplusShutdown(token);\n\treturn result;\n}\n\nTexture loadImage(const char* path) {\n\twchar_t str[1024];\n\tMultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, path, -1, str, 1024);\n\treturn loadImage(str);\n}\n#else\n\n#include \n#include \n#include \n#include \n#include \n#include \"gl_helpers.h\"\n\nTexture loadImage(const wchar_t* path) {}\nTexture loadImage(const char* path) {\n unsigned char header[8];\n\n FILE* fp = fopen(path, \"rb\");\n fread(header, 1, 8, fp);\n assert(!png_sig_cmp(header, 0, 8));\n\n png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);\n\n png_infop info = png_create_info_struct(png);\n\n setjmp(png_jmpbuf(png));\n \n\tpng_init_io(png, fp);\n png_set_sig_bytes(png, 8);\n\n png_read_info(png, info);\n\n int width = png_get_image_width(png, info);\n int height = png_get_image_height(png, info);\n png_byte color_type = png_get_color_type(png, info);\n png_byte bit_depth = png_get_bit_depth(png, info);\n\tassert(bit_depth == 8); // let's just support this\n\n int number_of_passes = png_set_interlace_handling(png);\n png_read_update_info(png, info);\n\n\n\tsetjmp(png_jmpbuf(png));\n\n png_bytep* row_pointers = (png_bytep*)malloc(sizeof(png_bytep) * height);\n\tsize_t stride = png_get_rowbytes(png, info);\n for (int i = 0; i < height; i++)\n row_pointers[i] = (png_byte*)malloc(stride);\n\n png_read_image(png, row_pointers);\n\n\tunsigned char* contiguous = (unsigned char*)malloc(stride * height);\n\n\tfor (int i = 0; i < height; i++)\n\t\tmemcpy(contiguous + stride * (height-1-i), row_pointers[i], stride);\n\n\tGLenum format = GL_INVALID_ENUM, order;\n\tif (PNG_COLOR_TYPE_GRAY == color_type) { format = GL_R8; order = GL_RED; }\n\tif (PNG_COLOR_TYPE_RGB == color_type) { format = GL_RGB8; order = GL_RGB; }\n\tif (PNG_COLOR_TYPE_RGB_ALPHA == color_type) { format = GL_RGBA8; order = GL_RGBA; }\n\tassert(format != GL_INVALID_ENUM);\n\n\tTexture result;\n\tglBindTexture(GL_TEXTURE_2D, result);\n\tglTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, order, GL_UNSIGNED_BYTE, contiguous);\n\tglGenerateMipmap(GL_TEXTURE_2D);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\tfree(row_pointers);\n fclose(fp);\n\n\treturn result;\n}\n#endif\n\n"}, {"path": "impl/gl_helpers.h", "language": "c", "loc": 134, "comment_density": 0.007, "code": "#pragma once\n\n#define GL_GLEXT_LEGACY\n#include \n#undef GL_VERSION_1_3\n#include \"glext.h\"\n\n#include \"loadgl46.h\"\n\n#include \n// RAII lifetime handlers for GLuint-based buffers and textures; in principle, very close to unique pointers (with GLuint playing the role of a raw pointer).\n\nstruct Buffer {\npublic:\n\tvoid destroy() { if (object != 0 && owning) { glDeleteBuffers(1, &object); object = 0; } }\n\tBuffer() : owning(true) { glCreateBuffers(1, &object); }\n\tBuffer(size_t size, void* data = nullptr, bool immutable = false, GLenum usage_or_flags = GL_STATIC_DRAW) : owning(true) {\n\t\tglCreateBuffers(1, &object);\n\t\tif(immutable)\n\t\t\tglNamedBufferStorage(object, size, data, usage_or_flags);\n\t\telse\n\t\t\tglNamedBufferData(object, size, data, usage_or_flags);\n\t}\n\ttemplate\n\tBuffer(const std::vector& v, bool immutable = false, GLenum usage_or_flags = GL_STATIC_DRAW) : owning(true) {\n\t\tglCreateBuffers(1, &object);\n\t\tif(immutable)\n\t\t\tglNamedBufferStorage(object, v.size()*sizeof(T), v.data(), usage_or_flags);\n\t\telse\n\t\t\tglNamedBufferData(object, v.size()*sizeof(T), v.data(), usage_or_flags);\n\t}\n\ttemplate\n\toperator std::vector() const {\n\t\tGLint64 size;\n\t\tglGetNamedBufferParameteri64v(object, GL_BUFFER_SIZE, &size);\n\t\tif (size % sizeof(T)) printf(\"warning: buffer and vector types don't align\");\n\t\tstd::vector result(size/sizeof(T));\n\t\tglGetNamedBufferSubData(object, 0, result.size()*sizeof(T), result.data());\n\t\treturn result;\n\t}\n\t~Buffer() { destroy(); }\n\tBuffer(const Buffer& other) : object(other.object), owning(false) { }\n\tBuffer(GLuint object, bool owning = false) : object(object), owning(owning) { }\n\tBuffer(Buffer&& other) : object(other.object), owning(other.owning) { other.owning = false; }\n\tauto& operator=(const Buffer& other) { object = other.object; owning = false; return *this; }\n\tauto& operator=(Buffer&& other) { object = other.object; owning = other.owning; other.owning = false; return *this; }\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\nprivate:\n\tGLuint object = 0; bool owning;\n};\n\ntemplate struct Texture;\n\ntemplate<>\nstruct Texture {\npublic:\n\tvoid destroy() {\n\t\tif (handle != 0) glMakeTextureHandleNonResident(handle);\n\t\tif (object && owning) { glDeleteTextures(1, &object); object = 0; }\n\t}\n\tTexture() : object(0), target(GL_INVALID_INDEX) {}\n\tTexture(GLuint target, bool owning = false) : target(target), owning(owning) { glCreateTextures(target, 1, &object); }\n\t~Texture() { if (object != 0 && owning) destroy(); }\n\ttemplate\n\tTexture(const Texture& other) : object(other.object), level(other.level), layer(other.layer), target(other.target), owning(false) { }\n\tTexture(GLuint object, GLuint target, bool owning = false) : object(object), target(target), owning(owning) { }\n\ttemplate\n\tTexture(Texture&& other) : object(other.object), level(other.level), layer(other.layer), target(other.target), owning(other.owning) { other.owning = false; }\n\ttemplate\n\tauto& operator=(const Texture& other) {\n\t\tdestroy();\n\t\tobject = other.object; level = other.level; layer = other.layer; target = other.target;\n\t\towning = false;\n\t\treturn *this;\n\t}\n\ttemplate\n\tauto& operator=(Texture&& other) {\n\t\tdestroy();\n\t\tobject = other.object; level = other.level; layer = other.layer; target = other.target;\n\t\towning = other.owning;\n\t\tother.owning = false;\n\t\treturn *this;\n\t}\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\n\tGLuint level = 0, layer = GL_INVALID_INDEX, target;\n\tGLuint64 getBindless() {\n\t\tif (handle == 0) {\n\t\t\thandle = glGetTextureHandle(object);\n\t\t\tglMakeTextureHandleResident(handle);\n\t\t}\n\t\treturn handle;\n\t}\nprivate:\n\tGLuint object; bool owning; GLuint64 handle = 0;\n};\n\ntemplate\nstruct Texture {\npublic:\n\tvoid destroy() {\n\t\tif (handle != 0) glMakeTextureHandleNonResident(handle);\n\t\tif (object && owning) { glDeleteTextures(1, &object); object = 0; }\n\t}\n\tTexture() : owning(true) { glCreateTextures(T, 1, &object); }\n\t~Texture() { destroy(); }\n\tTexture(GLuint other, bool owning = false) : object(other), owning(owning) {}\n\tTexture(const Texture& other) : object(other.object), owning(false) { }\n\tTexture(Texture&& other) : object(other.object), owning(other.owning) { other.owning = false; }\n\tTexture& operator=(const Texture& other) { destroy(); object = other.object; owning = false; return *this; }\n\tTexture& operator=(Texture&& other) { destroy(); object = other.object; owning = other.owning; other.owning = false; return *this; }\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\n\tstatic constexpr GLuint level = 0, layer = GL_INVALID_INDEX;\n\tfriend Texture<>;\n\tstatic constexpr GLuint target = T;\n\tGLuint64 getBindless() {\n\t\tif (handle == 0) {\n\t\t\thandle = glGetTextureHandle(object);\n\t\t\tglMakeTextureHandleResident(handle);\n\t\t}\n\t\treturn handle;\n\t}\nprivate:\n\tGLuint object = 0; bool owning; GLuint64 handle = 0;\n};\n\ntemplate\nTexture<> Level(const Texture& t, int level) {\n\tTexture<> result(t);\n\tresult.level = level;\n\treturn result;\n}\n\ntemplate\nTexture<> Layer(const Texture& t, int layer) {\n\tTexture<> result(t);\n\tresult.layer = layer;\n\treturn result;\n}\n\nTexture loadImage(const char* path);\nTexture loadImage(const wchar_t* path);\n"}, {"path": "impl/glsl.h", "language": "c", "loc": 1625, "comment_density": 0.003, "code": "#pragma once\n\nnamespace glsl {\n\n template\n constexpr int maximal(I... i) {\n int max = 0;\n ((max = max < i ? i : max), ...);\n return max;\n }\n\n template struct sequence { using type = sequence; };\n\n template struct append;\n template\n struct append, sequence> :\n sequence {};\n\n template\n struct iota : append::type, typename iota::type> {};\n template<> struct iota<0> : sequence<> {};\n template<> struct iota<1> : sequence<0> {};\n\n template struct Matrix;\n\n template\n auto id_ptr(sequence) {\n if constexpr (R == 1 && C == 1) return (F*) nullptr;\n else return (Matrix*) nullptr;\n }\n\n template struct no_ptr_ { using type = F; };\n template struct no_ptr_ { using type = F; };\n template struct no_ptr_ { using type = const F; };\n template using no_ptr = typename no_ptr_::type;\n\n template\n using identity = no_ptr(iota{})) > ;\n\n template struct no_const_ { using type = F; };\n template struct no_const_ { using type = F; };\n template struct no_const_ { using type = F*; };\n template using no_const = typename no_const_::type;\n\n template constexpr bool is_const = false;\n template constexpr bool is_const = true;\n\n template constexpr int Rows = 1;\n template\n constexpr int Rows> = R;\n\n template constexpr int Columns = 1;\n template\n constexpr int Columns> = C;\n\n template struct Field_ { using type = T; };\n template\n struct Field_> { using type = no_ptr; };\n\n template\n using Field = typename Field_::type;\n\n template\n struct enabler {};\n template<>\n struct enabler { using type = bool; };\n template\n using enable = typename enabler::type;\n\n template\n constexpr bool same = false;\n template\n constexpr bool same = true;\n\n\n template\n constexpr bool broadcastable = ((Rows == maximal(Rows...) && Columns == maximal(Columns...) || Rows == 1 && Columns == 1)&&...);\n template\n constexpr bool matmul_broadcastable = Columns == 1 && Rows == Rows || Columns == Rows || broadcastable;\n\n template\n auto broadcast_type(sequence) {\n constexpr int rows = maximal(Rows...), columns = maximal(Columns...);\n auto sum = (Field{} + ...);\n if constexpr (rows == 1 && columns == 1)\n return sum;\n else\n return Matrix {};\n }\n\n template\n using Iota = iota...)* maximal(Columns...)>;\n template\n using Common = decltype(broadcast_type(Iota{}));\n\n template\n auto matmul_type(sequence) {\n auto sum = Field{} + Field{};\n if constexpr (Columns == 1 && Columns == 1)\n return Matrix, Rows), 1, const decltype(sum), I...> {};\n else if constexpr (Columns == 1)\n return Matrix, 1, const decltype(sum), I...> {};\n else if constexpr (Rows == 1 && Columns == 1) return Second{};\n else if constexpr (Rows == 1 && Columns == 1) return First{};\n else\n return Matrix, Columns, const decltype(sum), I...> {};\n }\n\n template\n constexpr int mult_iota_length() {\n if constexpr (Columns == 1 && Columns == 1) return maximal(Rows, Rows);\n else return ((Columns == 1) ? 1 : Rows) * Columns;\n }\n\n template\n using MultCommon = decltype(matmul_type(iota()>{}));\n\n template\n constexpr int ordering(sequence) {\n return int(((int(I) * (int(1) << int((sizeof...(I) - Id) * 4))) + ... + 0));\n }\n\n template\n struct Container {\n Container() = default;\n no_ptr> data[1 + maximal(I...)];\n };\n\n template\n struct Matrix : Container, I...> {\n\n using Container, I...>::data;\n\n static_assert(sizeof...(I) == R * C);\n //static_assert(R* C > 1);\n\n Matrix() = default;\n\n explicit Matrix(const F& f) {\n if constexpr (C == 1 || is_const) ((data[I] = f), ...);\n else {\n F choice[2] = { F(0), f };\n ((data[I] = choice[I % R == I / R]), ...);\n }\n }\n template 1 && C2 > 1) || (R2==1 && C2==1)> >\n explicit Matrix(const Matrix& other) {\n if constexpr (R2 == 1 && C2 == 1) {\n constexpr int i2[] = { I2... };\n const auto f = F(other.data[i2[0]]);\n if constexpr (C == 1 || is_const) ((data[I] = f), ...);\n else {\n F choice[2] = { F(0), f };\n ((data[I] = choice[I % R == I / R]), ...);\n }\n }\n else if constexpr (R == R2 && C == C2) {\n int i2[] = { I2... };\n ((data[I] = F(other.data[i2[I]])), ...);\n }\n else {\n F choice[2] = { 0, 1 };\n // I%R gives the row and I/R the column\n ((data[I] = (I % R < R2&& I / R < C2) ? F(other.data[((I / R) * R2) + (I % R)]) : choice[I % R == I / R]), ...);\n }\n }\n\n template\n void place(const Matrix& m, int& i) {\n ((data[i++] = F(m.data[I2])), ...);\n }\n template\n void place(const F2& m, int& i) {\n data[i++] = F(m);\n }\n template == 1 && Columns == 1 && ((Columns == 1) && ...) && R * C == ((Rows +Rows) + ... + Rows)>>\n Matrix(const First& first, const Second& second, const Rest&... rest) {\n int i = 0;\n place(first, i); place(second, i); (place(rest, i), ...);\n }\n\n template>>\n operator Matrix() const {\n Matrix result;\n ((result.data[I] = no_ptr(data[I])), ...);\n return result;\n }\n\n template\n auto& operator=(const Matrix other) {\n ((data[I] = F(other.data[I2])), ...);\n return *this;\n }\n auto& operator=(const Matrix& other) {\n ((data[I] = other.data[I]), ...);\n return *this;\n }\n\n static constexpr int inds[] = { I... };\n auto& operator[](int i) {\n if constexpr (C == 1) return data[inds[i]];\n else return *reinterpret_cast*>(data + i * R);\n }\n const auto& operator[](int i) const {\n if constexpr (C == 1) return const_cast(data[inds[i]]);\n else return *reinterpret_cast*const>(data + i * R);\n }\n\n auto& operator+=(const identity& other) {return *this = *this + other;}\n auto& operator-=(const identity& other) {return *this = *this - other;}\n auto& operator/=(const identity& other) {return *this = *this / other;}\n auto& operator+=(const F& other) { return *this = *this + other; }\n auto& operator-=(const F& other) { return *this = *this - other; }\n auto& operator/=(const F& other) { return *this = *this / other; }\n template\n auto& operator*=(const Other& other) { return *this = *this * other; }\n };\n\n template\n struct Matrix {\n\n no_const data[1 + maximal(I...)];\n\n template || same < const decltype(F{} + no_ptr{}), const F > ) && (ordering(iota{}) >= ordering(iota{})) >>\n operator Matrix() const {\n Matrixresult;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n\n template\n auto& operator=(const Matrix other) {\n ((data[I] = F(other.data[I2])), ...);\n return *this;\n }\n auto& operator=(const Matrix& other) {\n ((data[I] = other.data[I]), ...);\n return *this;\n }\n\n auto& operator+=(const identity& other) { return *this = *this + other; }\n auto& operator-=(const identity& other) { return *this = *this - other; }\n auto& operator/=(const identity& other) { return *this = *this / other; }\n auto& operator+=(const F& other) { return *this = *this + other; }\n auto& operator-=(const F& other) { return *this = *this - other; }\n auto& operator/=(const F& other) { return *this = *this / other; }\n template\n auto& operator*=(const Other& other) { return *this = *this * other; }\n };\n\n template\n struct Matrix {\n\n F data[1 + maximal(I...)];\n\n template || same < const decltype(F{} + no_ptr{}), const F > ) && (ordering(iota{}) >= ordering(iota{})) >>\n operator Matrix() const {\n Matrix result;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n template\n operator Matrix, I2...>() const {\n Matrix, I2...> result;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n };\n\n template\n struct Matrix<1, 1, F*, I> {\n\n no_const data[1 + I];\n auto* operator&() {\n return &data[I];\n }\n auto& operator=(const F& other) {\n data[I] = other;\n return *this;\n }\n operator F& () { return data[I]; }\n operator F() const { return data[I]; }\n };\n\n template\n struct Matrix<1, 1, const F*, I> {\n F data[1 + I];\n operator F() const { return data[I]; }\n };\n\n\n template\n struct Container<2, 1, F, 0, 1> {\n Container() = default;\n union {\n no_ptr> data[2];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n };\n };\n\n template\n struct Container<3, 1, F, 0, 1, 2> {\n Container() = default;\n union {\n no_ptr> data[3];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n Matrix<1, 1, no_ptr*, 2> z, b, p;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 0, 2> xz, rb, sp;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n Matrix<2, 1, no_ptr*, 1, 2> yz, gb, tp;\n Matrix<2, 1, no_ptr*, 2, 0> zx, br, ps;\n Matrix<2, 1, no_ptr*, 2, 1> zy, bg, pt;\n Matrix<2, 1, const no_ptr*, 2, 2> zz, bb, pp;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 0, 2> xxz, rrb, ssp;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, no_ptr*, 0, 1, 2> xyz, rgb, stp;\n Matrix<3, 1, const no_ptr*, 0, 2, 0> xzx, rbr, sps;\n Matrix<3, 1, no_ptr*, 0, 2, 1> xzy, rbg, spt;\n Matrix<3, 1, const no_ptr*, 0, 2, 2> xzz, rbb, spp;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, no_ptr*, 1, 0, 2> yxz, grb, tsp;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n Matrix<3, 1, const no_ptr*, 1, 1, 2> yyz, ggb, ttp;\n Matrix<3, 1, no_ptr*, 1, 2, 0> yzx, gbr, tps;\n Matrix<3, 1, const no_ptr*, 1, 2, 1> yzy, gbg, tpt;\n Matrix<3, 1, const no_ptr*, 1, 2, 2> yzz, gbb, tpp;\n Matrix<3, 1, const no_ptr*, 2, 0, 0> zxx, brr, pss;\n Matrix<3, 1, no_ptr*, 2, 0, 1> zxy, brg, pst;\n Matrix<3, 1, const no_ptr*, 2, 0, 2> zxz, brb, psp;\n Matrix<3, 1, no_ptr*, 2, 1, 0> zyx, bgr, pts;\n Matrix<3, 1, const no_ptr*, 2, 1, 1> zyy, bgg, ptt;\n Matrix<3, 1, const no_ptr*, 2, 1, 2> zyz, bgb, ptp;\n Matrix<3, 1, const no_ptr*, 2, 2, 0> zzx, bbr, pps;\n Matrix<3, 1, const no_ptr*, 2, 2, 1> zzy, bbg, ppt;\n Matrix<3, 1, const no_ptr*, 2, 2, 2> zzz, bbb, ppp;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 2> xxxz, rrrb, sssp;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 2> xxyz, rrgb, sstp;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 0> xxzx, rrbr, ssps;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 1> xxzy, rrbg, sspt;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 2> xxzz, rrbb, sspp;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 2> xyxz, rgrb, stsp;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 2> xyyz, rggb, sttp;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 0> xyzx, rgbr, stps;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 1> xyzy, rgbg, stpt;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 2> xyzz, rgbb, stpp;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 0> xzxx, rbrr, spss;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 1> xzxy, rbrg, spst;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 2> xzxz, rbrb, spsp;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 0> xzyx, rbgr, spts;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 1> xzyy, rbgg, sptt;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 2> xzyz, rbgb, sptp;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 0> xzzx, rbbr, spps;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 1> xzzy, rbbg, sppt;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 2> xzzz, rbbb, sppp;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 2> yxxz, grrb, tssp;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 2> yxyz, grgb, tstp;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 0> yxzx, grbr, tsps;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 1> yxzy, grbg, tspt;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 2> yxzz, grbb, tspp;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 2> yyxz, ggrb, ttsp;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 2> yyyz, gggb, tttp;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 0> yyzx, ggbr, ttps;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 1> yyzy, ggbg, ttpt;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 2> yyzz, ggbb, ttpp;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 0> yzxx, gbrr, tpss;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 1> yzxy, gbrg, tpst;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 2> yzxz, gbrb, tpsp;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 0> yzyx, gbgr, tpts;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 1> yzyy, gbgg, tptt;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 2> yzyz, gbgb, tptp;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 0> yzzx, gbbr, tpps;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 1> yzzy, gbbg, tppt;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 2> yzzz, gbbb, tppp;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 0> zxxx, brrr, psss;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 1> zxxy, brrg, psst;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 2> zxxz, brrb, pssp;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 0> zxyx, brgr, psts;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 1> zxyy, brgg, pstt;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 2> zxyz, brgb, pstp;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 0> zxzx, brbr, psps;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 1> zxzy, brbg, pspt;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 2> zxzz, brbb, pspp;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 0> zyxx, bgrr, ptss;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 1> zyxy, bgrg, ptst;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 2> zyxz, bgrb, ptsp;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 0> zyyx, bggr, ptts;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 1> zyyy, bggg, pttt;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 2> zyyz, bggb, pttp;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 0> zyzx, bgbr, ptps;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 1> zyzy, bgbg, ptpt;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 2> zyzz, bgbb, ptpp;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 0> zzxx, bbrr, ppss;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 1> zzxy, bbrg, ppst;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 2> zzxz, bbrb, ppsp;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 0> zzyx, bbgr, ppts;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 1> zzyy, bbgg, pptt;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 2> zzyz, bbgb, pptp;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 0> zzzx, bbbr, ppps;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 1> zzzy, bbbg, pppt;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 2> zzzz, bbbb, pppp;\n };\n };\n template\n struct Container<4, 1, F, 0, 1, 2, 3> {\n Container() = default;\n union {\n no_ptr> data[4];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n Matrix<1, 1, no_ptr*, 2> z, b, p;\n Matrix<1, 1, no_ptr*, 3> w, a, q;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 0, 2> xz, rb, sp;\n Matrix<2, 1, no_ptr*, 0, 3> xw, ra, sq;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n Matrix<2, 1, no_ptr*, 1, 2> yz, gb, tp;\n Matrix<2, 1, no_ptr*, 1, 3> yw, ga, tq;\n Matrix<2, 1, no_ptr*, 2, 0> zx, br, ps;\n Matrix<2, 1, no_ptr*, 2, 1> zy, bg, pt;\n Matrix<2, 1, const no_ptr*, 2, 2> zz, bb, pp;\n Matrix<2, 1, no_ptr*, 2, 3> zw, ba, pq;\n Matrix<2, 1, no_ptr*, 3, 0> wx, ar, qs;\n Matrix<2, 1, no_ptr*, 3, 1> wy, ag, qt;\n Matrix<2, 1, no_ptr*, 3, 2> wz, ab, qp;\n Matrix<2, 1, const no_ptr*, 3, 3> ww, aa, qq;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 0, 2> xxz, rrb, ssp;\n Matrix<3, 1, const no_ptr*, 0, 0, 3> xxw, rra, ssq;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, no_ptr*, 0, 1, 2> xyz, rgb, stp;\n Matrix<3, 1, no_ptr*, 0, 1, 3> xyw, rga, stq;\n Matrix<3, 1, const no_ptr*, 0, 2, 0> xzx, rbr, sps;\n Matrix<3, 1, no_ptr*, 0, 2, 1> xzy, rbg, spt;\n Matrix<3, 1, const no_ptr*, 0, 2, 2> xzz, rbb, spp;\n Matrix<3, 1, no_ptr*, 0, 2, 3> xzw, rba, spq;\n Matrix<3, 1, const no_ptr*, 0, 3, 0> xwx, rar, sqs;\n Matrix<3, 1, no_ptr*, 0, 3, 1> xwy, rag, sqt;\n Matrix<3, 1, no_ptr*, 0, 3, 2> xwz, rab, sqp;\n Matrix<3, 1, const no_ptr*, 0, 3, 3> xww, raa, sqq;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, no_ptr*, 1, 0, 2> yxz, grb, tsp;\n Matrix<3, 1, no_ptr*, 1, 0, 3> yxw, gra, tsq;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n Matrix<3, 1, const no_ptr*, 1, 1, 2> yyz, ggb, ttp;\n Matrix<3, 1, const no_ptr*, 1, 1, 3> yyw, gga, ttq;\n Matrix<3, 1, no_ptr*, 1, 2, 0> yzx, gbr, tps;\n Matrix<3, 1, const no_ptr*, 1, 2, 1> yzy, gbg, tpt;\n Matrix<3, 1, const no_ptr*, 1, 2, 2> yzz, gbb, tpp;\n Matrix<3, 1, no_ptr*, 1, 2, 3> yzw, gba, tpq;\n Matrix<3, 1, no_ptr*, 1, 3, 0> ywx, gar, tqs;\n Matrix<3, 1, const no_ptr*, 1, 3, 1> ywy, gag, tqt;\n Matrix<3, 1, no_ptr*, 1, 3, 2> ywz, gab, tqp;\n Matrix<3, 1, const no_ptr*, 1, 3, 3> yww, gaa, tqq;\n Matrix<3, 1, const no_ptr*, 2, 0, 0> zxx, brr, pss;\n Matrix<3, 1, no_ptr*, 2, 0, 1> zxy, brg, pst;\n Matrix<3, 1, const no_ptr*, 2, 0, 2> zxz, brb, psp;\n Matrix<3, 1, no_ptr*, 2, 0, 3> zxw, bra, psq;\n Matrix<3, 1, no_ptr*, 2, 1, 0> zyx, bgr, pts;\n Matrix<3, 1, const no_ptr*, 2, 1, 1> zyy, bgg, ptt;\n Matrix<3, 1, const no_ptr*, 2, 1, 2> zyz, bgb, ptp;\n Matrix<3, 1, no_ptr*, 2, 1, 3> zyw, bga, ptq;\n Matrix<3, 1, const no_ptr*, 2, 2, 0> zzx, bbr, pps;\n Matrix<3, 1, const no_ptr*, 2, 2, 1> zzy, bbg, ppt;\n Matrix<3, 1, const no_ptr*, 2, 2, 2> zzz, bbb, ppp;\n Matrix<3, 1, const no_ptr*, 2, 2, 3> zzw, bba, ppq;\n Matrix<3, 1, no_ptr*, 2, 3, 0> zwx, bar, pqs;\n Matrix<3, 1, no_ptr*, 2, 3, 1> zwy, bag, pqt;\n Matrix<3, 1, const no_ptr*, 2, 3, 2> zwz, bab, pqp;\n Matrix<3, 1, const no_ptr*, 2, 3, 3> zww, baa, pqq;\n Matrix<3, 1, const no_ptr*, 3, 0, 0> wxx, arr, qss;\n Matrix<3, 1, no_ptr*, 3, 0, 1> wxy, arg, qst;\n Matrix<3, 1, no_ptr*, 3, 0, 2> wxz, arb, qsp;\n Matrix<3, 1, const no_ptr*, 3, 0, 3> wxw, ara, qsq;\n Matrix<3, 1, no_ptr*, 3, 1, 0> wyx, agr, qts;\n Matrix<3, 1, const no_ptr*, 3, 1, 1> wyy, agg, qtt;\n Matrix<3, 1, no_ptr*, 3, 1, 2> wyz, agb, qtp;\n Matrix<3, 1, const no_ptr*, 3, 1, 3> wyw, aga, qtq;\n Matrix<3, 1, no_ptr*, 3, 2, 0> wzx, abr, qps;\n Matrix<3, 1, no_ptr*, 3, 2, 1> wzy, abg, qpt;\n Matrix<3, 1, const no_ptr*, 3, 2, 2> wzz, abb, qpp;\n Matrix<3, 1, const no_ptr*, 3, 2, 3> wzw, aba, qpq;\n Matrix<3, 1, const no_ptr*, 3, 3, 0> wwx, aar, qqs;\n Matrix<3, 1, const no_ptr*, 3, 3, 1> wwy, aag, qqt;\n Matrix<3, 1, const no_ptr*, 3, 3, 2> wwz, aab, qqp;\n Matrix<3, 1, const no_ptr*, 3, 3, 3> www, aaa, qqq;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 2> xxxz, rrrb, sssp;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 3> xxxw, rrra, sssq;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 2> xxyz, rrgb, sstp;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 3> xxyw, rrga, sstq;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 0> xxzx, rrbr, ssps;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 1> xxzy, rrbg, sspt;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 2> xxzz, rrbb, sspp;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 3> xxzw, rrba, sspq;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 0> xxwx, rrar, ssqs;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 1> xxwy, rrag, ssqt;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 2> xxwz, rrab, ssqp;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 3> xxww, rraa, ssqq;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 2> xyxz, rgrb, stsp;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 3> xyxw, rgra, stsq;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 2> xyyz, rggb, sttp;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 3> xyyw, rgga, sttq;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 0> xyzx, rgbr, stps;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 1> xyzy, rgbg, stpt;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 2> xyzz, rgbb, stpp;\n Matrix<4, 1, no_ptr*, 0, 1, 2, 3> xyzw, rgba, stpq;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 0> xywx, rgar, stqs;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 1> xywy, rgag, stqt;\n Matrix<4, 1, no_ptr*, 0, 1, 3, 2> xywz, rgab, stqp;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 3> xyww, rgaa, stqq;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 0> xzxx, rbrr, spss;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 1> xzxy, rbrg, spst;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 2> xzxz, rbrb, spsp;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 3> xzxw, rbra, spsq;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 0> xzyx, rbgr, spts;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 1> xzyy, rbgg, sptt;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 2> xzyz, rbgb, sptp;\n Matrix<4, 1, no_ptr*, 0, 2, 1, 3> xzyw, rbga, sptq;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 0> xzzx, rbbr, spps;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 1> xzzy, rbbg, sppt;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 2> xzzz, rbbb, sppp;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 3> xzzw, rbba, sppq;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 0> xzwx, rbar, spqs;\n Matrix<4, 1, no_ptr*, 0, 2, 3, 1> xzwy, rbag, spqt;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 2> xzwz, rbab, spqp;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 3> xzww, rbaa, spqq;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 0> xwxx, rarr, sqss;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 1> xwxy, rarg, sqst;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 2> xwxz, rarb, sqsp;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 3> xwxw, rara, sqsq;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 0> xwyx, ragr, sqts;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 1> xwyy, ragg, sqtt;\n Matrix<4, 1, no_ptr*, 0, 3, 1, 2> xwyz, ragb, sqtp;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 3> xwyw, raga, sqtq;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 0> xwzx, rabr, sqps;\n Matrix<4, 1, no_ptr*, 0, 3, 2, 1> xwzy, rabg, sqpt;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 2> xwzz, rabb, sqpp;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 3> xwzw, raba, sqpq;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 0> xwwx, raar, sqqs;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 1> xwwy, raag, sqqt;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 2> xwwz, raab, sqqp;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 3> xwww, raaa, sqqq;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 2> yxxz, grrb, tssp;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 3> yxxw, grra, tssq;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 2> yxyz, grgb, tstp;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 3> yxyw, grga, tstq;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 0> yxzx, grbr, tsps;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 1> yxzy, grbg, tspt;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 2> yxzz, grbb, tspp;\n Matrix<4, 1, no_ptr*, 1, 0, 2, 3> yxzw, grba, tspq;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 0> yxwx, grar, tsqs;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 1> yxwy, grag, tsqt;\n Matrix<4, 1, no_ptr*, 1, 0, 3, 2> yxwz, grab, tsqp;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 3> yxww, graa, tsqq;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 2> yyxz, ggrb, ttsp;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 3> yyxw, ggra, ttsq;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 2> yyyz, gggb, tttp;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 3> yyyw, ggga, tttq;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 0> yyzx, ggbr, ttps;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 1> yyzy, ggbg, ttpt;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 2> yyzz, ggbb, ttpp;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 3> yyzw, ggba, ttpq;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 0> yywx, ggar, ttqs;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 1> yywy, ggag, ttqt;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 2> yywz, ggab, ttqp;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 3> yyww, ggaa, ttqq;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 0> yzxx, gbrr, tpss;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 1> yzxy, gbrg, tpst;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 2> yzxz, gbrb, tpsp;\n Matrix<4, 1, no_ptr*, 1, 2, 0, 3> yzxw, gbra, tpsq;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 0> yzyx, gbgr, tpts;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 1> yzyy, gbgg, tptt;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 2> yzyz, gbgb, tptp;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 3> yzyw, gbga, tptq;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 0> yzzx, gbbr, tpps;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 1> yzzy, gbbg, tppt;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 2> yzzz, gbbb, tppp;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 3> yzzw, gbba, tppq;\n Matrix<4, 1, no_ptr*, 1, 2, 3, 0> yzwx, gbar, tpqs;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 1> yzwy, gbag, tpqt;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 2> yzwz, gbab, tpqp;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 3> yzww, gbaa, tpqq;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 0> ywxx, garr, tqss;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 1> ywxy, garg, tqst;\n Matrix<4, 1, no_ptr*, 1, 3, 0, 2> ywxz, garb, tqsp;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 3> ywxw, gara, tqsq;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 0> ywyx, gagr, tqts;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 1> ywyy, gagg, tqtt;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 2> ywyz, gagb, tqtp;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 3> ywyw, gaga, tqtq;\n Matrix<4, 1, no_ptr*, 1, 3, 2, 0> ywzx, gabr, tqps;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 1> ywzy, gabg, tqpt;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 2> ywzz, gabb, tqpp;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 3> ywzw, gaba, tqpq;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 0> ywwx, gaar, tqqs;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 1> ywwy, gaag, tqqt;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 2> ywwz, gaab, tqqp;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 3> ywww, gaaa, tqqq;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 0> zxxx, brrr, psss;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 1> zxxy, brrg, psst;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 2> zxxz, brrb, pssp;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 3> zxxw, brra, pssq;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 0> zxyx, brgr, psts;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 1> zxyy, brgg, pstt;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 2> zxyz, brgb, pstp;\n Matrix<4, 1, no_ptr*, 2, 0, 1, 3> zxyw, brga, pstq;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 0> zxzx, brbr, psps;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 1> zxzy, brbg, pspt;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 2> zxzz, brbb, pspp;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 3> zxzw, brba, pspq;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 0> zxwx, brar, psqs;\n Matrix<4, 1, no_ptr*, 2, 0, 3, 1> zxwy, brag, psqt;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 2> zxwz, brab, psqp;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 3> zxww, braa, psqq;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 0> zyxx, bgrr, ptss;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 1> zyxy, bgrg, ptst;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 2> zyxz, bgrb, ptsp;\n Matrix<4, 1, no_ptr*, 2, 1, 0, 3> zyxw, bgra, ptsq;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 0> zyyx, bggr, ptts;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 1> zyyy, bggg, pttt;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 2> zyyz, bggb, pttp;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 3> zyyw, bgga, pttq;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 0> zyzx, bgbr, ptps;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 1> zyzy, bgbg, ptpt;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 2> zyzz, bgbb, ptpp;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 3> zyzw, bgba, ptpq;\n Matrix<4, 1, no_ptr*, 2, 1, 3, 0> zywx, bgar, ptqs;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 1> zywy, bgag, ptqt;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 2> zywz, bgab, ptqp;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 3> zyww, bgaa, ptqq;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 0> zzxx, bbrr, ppss;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 1> zzxy, bbrg, ppst;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 2> zzxz, bbrb, ppsp;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 3> zzxw, bbra, ppsq;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 0> zzyx, bbgr, ppts;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 1> zzyy, bbgg, pptt;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 2> zzyz, bbgb, pptp;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 3> zzyw, bbga, pptq;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 0> zzzx, bbbr, ppps;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 1> zzzy, bbbg, pppt;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 2> zzzz, bbbb, pppp;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 3> zzzw, bbba, pppq;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 0> zzwx, bbar, ppqs;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 1> zzwy, bbag, ppqt;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 2> zzwz, bbab, ppqp;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 3> zzww, bbaa, ppqq;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 0> zwxx, barr, pqss;\n Matrix<4, 1, no_ptr*, 2, 3, 0, 1> zwxy, barg, pqst;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 2> zwxz, barb, pqsp;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 3> zwxw, bara, pqsq;\n Matrix<4, 1, no_ptr*, 2, 3, 1, 0> zwyx, bagr, pqts;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 1> zwyy, bagg, pqtt;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 2> zwyz, bagb, pqtp;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 3> zwyw, baga, pqtq;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 0> zwzx, babr, pqps;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 1> zwzy, babg, pqpt;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 2> zwzz, babb, pqpp;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 3> zwzw, baba, pqpq;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 0> zwwx, baar, pqqs;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 1> zwwy, baag, pqqt;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 2> zwwz, baab, pqqp;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 3> zwww, baaa, pqqq;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 0> wxxx, arrr, qsss;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 1> wxxy, arrg, qsst;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 2> wxxz, arrb, qssp;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 3> wxxw, arra, qssq;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 0> wxyx, argr, qsts;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 1> wxyy, argg, qstt;\n Matrix<4, 1, no_ptr*, 3, 0, 1, 2> wxyz, argb, qstp;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 3> wxyw, arga, qstq;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 0> wxzx, arbr, qsps;\n Matrix<4, 1, no_ptr*, 3, 0, 2, 1> wxzy, arbg, qspt;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 2> wxzz, arbb, qspp;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 3> wxzw, arba, qspq;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 0> wxwx, arar, qsqs;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 1> wxwy, arag, qsqt;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 2> wxwz, arab, qsqp;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 3> wxww, araa, qsqq;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 0> wyxx, agrr, qtss;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 1> wyxy, agrg, qtst;\n Matrix<4, 1, no_ptr*, 3, 1, 0, 2> wyxz, agrb, qtsp;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 3> wyxw, agra, qtsq;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 0> wyyx, aggr, qtts;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 1> wyyy, aggg, qttt;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 2> wyyz, aggb, qttp;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 3> wyyw, agga, qttq;\n Matrix<4, 1, no_ptr*, 3, 1, 2, 0> wyzx, agbr, qtps;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 1> wyzy, agbg, qtpt;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 2> wyzz, agbb, qtpp;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 3> wyzw, agba, qtpq;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 0> wywx, agar, qtqs;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 1> wywy, agag, qtqt;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 2> wywz, agab, qtqp;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 3> wyww, agaa, qtqq;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 0> wzxx, abrr, qpss;\n Matrix<4, 1, no_ptr*, 3, 2, 0, 1> wzxy, abrg, qpst;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 2> wzxz, abrb, qpsp;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 3> wzxw, abra, qpsq;\n Matrix<4, 1, no_ptr*, 3, 2, 1, 0> wzyx, abgr, qpts;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 1> wzyy, abgg, qptt;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 2> wzyz, abgb, qptp;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 3> wzyw, abga, qptq;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 0> wzzx, abbr, qpps;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 1> wzzy, abbg, qppt;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 2> wzzz, abbb, qppp;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 3> wzzw, abba, qppq;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 0> wzwx, abar, qpqs;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 1> wzwy, abag, qpqt;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 2> wzwz, abab, qpqp;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 3> wzww, abaa, qpqq;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 0> wwxx, aarr, qqss;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 1> wwxy, aarg, qqst;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 2> wwxz, aarb, qqsp;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 3> wwxw, aara, qqsq;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 0> wwyx, aagr, qqts;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 1> wwyy, aagg, qqtt;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 2> wwyz, aagb, qqtp;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 3> wwyw, aaga, qqtq;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 0> wwzx, aabr, qqps;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 1> wwzy, aabg, qqpt;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 2> wwzz, aabb, qqpp;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 3> wwzw, aaba, qqpq;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 0> wwwx, aaar, qqqs;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 1> wwwy, aaag, qqqt;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 2> wwwz, aaab, qqqp;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 3> wwww, aaaa, qqqq;\n };\n };\n}\n\nusing uint = unsigned;\n\n#ifndef UINT64_C\nusing int64_t = long long;\nusing uint64_t = unsigned long long;\n#endif\n\nusing ivec2 = glsl::Matrix<2, 1, int, 0, 1>;\nusing ivec3 = glsl::Matrix<3, 1, int, 0, 1, 2>;\nusing ivec4 = glsl::Matrix<4, 1, int, 0, 1, 2, 3>;\n\nusing uvec2 = glsl::Matrix<2, 1, uint, 0, 1>;\nusing uvec3 = glsl::Matrix<3, 1, uint, 0, 1, 2>;\nusing uvec4 = glsl::Matrix<4, 1, uint, 0, 1, 2, 3>;\n\nusing i64vec2 = glsl::Matrix<2, 1, int64_t, 0, 1>;\nusing i64vec3 = glsl::Matrix<3, 1, int64_t, 0, 1, 2>;\nusing i64vec4 = glsl::Matrix<4, 1, int64_t, 0, 1, 2, 3>;\n\nusing u64vec2 = glsl::Matrix<2, 1, uint64_t, 0, 1>;\nusing u64vec3 = glsl::Matrix<3, 1, uint64_t, 0, 1, 2>;\nusing u64vec4 = glsl::Matrix<4, 1, uint64_t, 0, 1, 2, 3>;\n\nusing bvec2 = glsl::Matrix<2, 1, bool, 0, 1>;\nusing bvec3 = glsl::Matrix<3, 1, bool, 0, 1, 2>;\nusing bvec4 = glsl::Matrix<4, 1, bool, 0, 1, 2, 3>;\n\nusing vec2 = glsl::Matrix<2, 1, float, 0, 1>;\nusing vec3 = glsl::Matrix<3, 1, float, 0, 1, 2>;\nusing vec4 = glsl::Matrix<4, 1, float, 0, 1, 2, 3>;\n\nusing dvec2 = glsl::Matrix<2, 1, double, 0, 1>;\nusing dvec3 = glsl::Matrix<3, 1, double, 0, 1, 2>;\nusing dvec4 = glsl::Matrix<4, 1, double, 0, 1, 2, 3>;\n\nusing mat2x2 = glsl::Matrix<2, 2, float, 0, 1, 2, 3>;\nusing mat2x3 = glsl::Matrix<3, 2, float, 0, 1, 2, 3, 4, 5>;\nusing mat2x4 = glsl::Matrix<4, 2, float, 0, 1, 2, 3, 4, 5, 6, 7>;\n\nusing mat3x2 = glsl::Matrix<2, 3, float, 0, 1, 2, 3, 4, 5>;\nusing mat3x3 = glsl::Matrix<3, 3, float, 0, 1, 2, 3, 4, 5, 6, 7, 8>;\nusing mat3x4 = glsl::Matrix<4, 3, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\n\nusing mat4x2 = glsl::Matrix<2, 4, float, 0, 1, 2, 3, 4, 5, 6, 7>;\nusing mat4x3 = glsl::Matrix<3, 4, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\nusing mat4x4 = glsl::Matrix<4, 4, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15>;\n\nusing mat2 = mat2x2;\nusing mat3 = mat3x3;\nusing mat4 = mat4x4;\n\nusing dmat2x2 = glsl::Matrix<2, 2, double, 0, 1, 2, 3>;\nusing dmat2x3 = glsl::Matrix<3, 2, double, 0, 1, 2, 3, 4, 5>;\nusing dmat2x4 = glsl::Matrix<4, 2, double, 0, 1, 2, 3, 4, 5, 6, 7>;\n\nusing dmat3x2 = glsl::Matrix<2, 3, double, 0, 1, 2, 3, 4, 5>;\nusing dmat3x3 = glsl::Matrix<3, 3, double, 0, 1, 2, 3, 4, 5, 6, 7, 8>;\nusing dmat3x4 = glsl::Matrix<4, 3, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\n\nusing dmat4x2 = glsl::Matrix<2, 4, double, 0, 1, 2, 3, 4, 5, 6, 7>;\nusing dmat4x3 = glsl::Matrix<3, 4, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\nusing dmat4x4 = glsl::Matrix<4, 4, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15>;\n\nusing dmat2 = dmat2x2;\nusing dmat3 = dmat3x3;\nusing dmat4 = dmat4x4;\n\n#include \n#include \n\nnamespace glsl {\n\n template\n inline auto sum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a + b;\n else return M(a.data[I] + b.data[I] ...);\n }\n template\n inline auto sub(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a - b;\n else return M(a.data[I] - b.data[I] ...);\n }\n template\n inline auto neg(const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return -a;\n else return M(-a.data[I] ...);\n }\n template\n inline auto div(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a / b;\n else return M(a.data[I] / b.data[I] ...);\n }\n template\n constexpr bool integral = same || same || same || same;\n template\n constexpr bool moddable = integral && integral;\n\n template\n inline auto mod(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a % b;\n else return M(a.data[I] % b.data[I] ...);\n }\n template\n inline auto bin_neg(const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return -a;\n else return M(~a.data[I] ...);\n }\n template\n inline auto lshift(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a << b;\n else return M(a.data[I] << b.data[I] ...);\n }\n template\n inline auto rshift(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a >> b;\n else return M(a.data[I] >> b.data[I] ...);\n }\n template\n inline auto and_(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a & b;\n else return M(a.data[I] & b.data[I] ...);\n }\n template\n inline auto or_(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a | b;\n else return M(a.data[I] | b.data[I] ...);\n }\n template\n inline auto xor_(const M & a, const M & b, sequence) {\n if constexpr (sizeof...(I) == 1) return a ^ b;\n else return M(a.data[I] ^ b.data[I] ...);\n }\n template\n inline bool equals(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a == b;\n else return ((a.data[I] == b.data[I]) && ...);\n }\n template\n inline auto mul(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a * b;\n else return M(a.data[I] * b.data[I] ...);\n }\n template\n inline auto matmul(const M1& a, const M2& b, sequence, sequence, MultCommon result = {}) {\n int i;\n if constexpr (Columns == 1) return ((i = I, result.data[i] = ((a.data[K] * b.data[K + (i / Columns>) * Rows]) + ...)), ..., result);\n else {\n constexpr int result_rows = Rows>;\n return ((i = I, result.data[i] = ((a.data[(i % result_rows) + K * Rows] * b.data[K + (i / result_rows) * Rows]) + ...)), ..., result);\n }\n }\n template\n inline auto maximum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return (a > b) ? a : b;\n else return M((a.data[I] > b.data[I]) ? a.data[I] : b.data[I] ...);\n }\n template\n inline auto mininum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return (a < b) ? a : b;\n else return M((a.data[I] < b.data[I]) ? a.data[I] : b.data[I] ...);\n }\n template\n inline auto absolute(const M& x, sequence) {\n constexpr Field zero(0);\n if constexpr (sizeof...(I) == 1) return (x < zero) ? -x : x;\n else return M((x.data[I] < zero) ? -x.data[I] : x.data[I] ...);\n }\n\n template\n auto lt(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] < b.data[I]) ...);\n }\n template\n auto lte(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] <= b.data[I]) ...);\n }\n template\n auto gt(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] > b.data[I]) ...);\n }\n template\n auto gte(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] >= b.data[I]) ...);\n }\n template\n auto eq(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] == b.data[I]) ...);\n }\n template\n auto neq(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] != b.data[I]) ...);\n }\n\n template\n auto not_(const M& x, sequence) {\n return M(!x.data[I]...);\n }\n template\n auto isnan(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::isnan(x);\n else return Matrix, Columns, bool, I...>(std::isnan(x.data[I])...);\n }\n template\n auto isinf(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::isinf(x);\n else return Matrix, Columns, bool, I...>(std::isinf(x.data[I])...);\n }\n\n template\n inline auto ceiling(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::ceil(float(x));\n else return M(std::ceil(float(x.data[I])) ...);\n }\n template\n inline auto flooring(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::floor(float(x));\n else return M(std::floor(float(x.data[I])) ...);\n }\n template\n inline auto fraction(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x - std::floor(float(x));\n else return M(x.data[I] - std::floor(float(x.data[I])) ...);\n }\n template\n inline auto rounder(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::round(float(x));\n else return M(std::round(x.data[I]) ...);\n }\n template\n inline auto modulus(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return x - y * std::floor(float(x / y));\n else return M(x.data[I] - y.data[I] * std::floor(float(x.data[I] / y.data[I])) ...);\n }\n template\n inline auto power(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return std::pow(float(x), float(y));\n else return M(std::pow(float(x.data[I]), float(y.data[I])) ...);\n }\n template\n inline auto clamper(const M& x, const M& v, const M& V, sequence) {\n if constexpr (sizeof...(I) == 1) return (x < v) ? v : ((x > V) ? V : x);\n else return M((x.data[I] < v.data[I]) ? v.data[I] : ((x.data[I] > V.data[I]) ? V.data[I] : x.data[I]) ...);\n }\n template\n inline auto mixer(const M& x, const M& y, const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return x * (1 - a) + y * a;\n else return M(x.data[I] * (1 - a.data[I]) + y.data[I] * a.data[I] ...);\n }\n template\n inline auto smoothstepper(const M& e0, const M& e1, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) {\n M t = (x - e0) / (e1 - e0);\n t = t < 0 ? 0 : (t > 1 ? 1 : t);\n return t * t * (3 - 2 * t);\n }\n else {\n M t;\n ((t.data[I] = (x.data[I] - e0.data[I]) / (e1.data[I] - e0.data[I])), ...);\n ((t.data[I] = t.data[I] < 0 ? 0 : (t.data[I] > 1 ? 1 : t.data[I])), ...);\n return M(t.data[I] * t.data[I] * (3 - 2 * t.data[I]) ...);\n }\n }\n template\n inline auto stepper(const M& edge, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x < edge ? 0 : 1;\n else return M(x.data[I] < edge.data[I] ? 0 : 1 ...);\n }\n template\n inline auto sine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::sin(x);\n else return M(std::sin(x.data[I]) ...);\n }\n template\n inline auto arcussine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::asin(x);\n else return M(std::asin(x.data[I]) ...);\n }\n template\n inline auto cosine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::cos(x);\n else return M(std::cos(x.data[I]) ...);\n }\n template\n inline auto arcuscosine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::acos(x);\n else return M(std::acos(x.data[I]) ...);\n }\n template\n inline auto tangent(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::tan(x);\n else return M(std::tan(x.data[I]) ...);\n }\n template\n inline auto arcustangent(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::atan(x);\n else return M(std::tan(x.data[I]) ...);\n }\n template\n inline auto arcustangent(const M& y, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::atan2(y, x);\n else return M(std::atan2(y.data[I], x.data[I]) ...);\n }\n template\n inline auto to_degrees(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x * 180.f / 3.14159265358979f;\n else return M(x.data[I] * 180.f / 3.14159265358979f ...);\n }\n template\n inline auto to_radians(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x * 3.14159265358979f / 180.f;\n else return M(x.data[I] * 3.14159265358979f / 180.f ...);\n }\n\n template\n inline auto dotter(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return x * y;\n else return ((x.data[I] * y.data[I]) + ...);\n }\n template\n inline auto len(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::fabs(x);\n else return std::sqrt(((x.data[I] * x.data[I]) + ...));\n }\n template\n inline auto square_root(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::sqrt(x);\n else return M(std::sqrt(x.data[I]) ...);\n }\n template\n inline auto exper(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::exp(x);\n else return M(std::exp(x.data[I]) ...);\n }\n template\n inline auto exp2er(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::exp2(x);\n else return M(std::exp2f(x.data[I]) ...);\n }\n template\n inline auto loger(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::log(x);\n else return M(std::log(x.data[I]) ...);\n }\n template\n inline auto log2er(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::log2(x);\n else return M(std::log2(x.data[I]) ...);\n }\n template\n inline auto signum(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return M((x < 0) ? (-1) : ((x > 0) ? 1 : 0));\n else return M((x.data[I] < 0) ? (-1) : ((x.data[I] > 0) ? 1 : 0) ...);\n }\n template\n inline auto cast(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) {\n F result; memcpy(&result, &x, sizeof(F));\n return result;\n }\n else {\n identity, Columns, F> result;\n memcpy(result.data, x.data, sizeof(F) * sizeof...(I));\n return result;\n }\n }\n template\n inline auto outer(const M1& c, const M2& r, sequence) {\n constexpr int R1 = Rows, R2 = Rows;\n return identity((c[I/R1]*r[I%R1]) ...);\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator+(const genType& x, const genType_& y) {\n return sum(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator-(const genType& x, const genType_& y) {\n return sub(Common(x), Common(y), Iota{});\n }\n\n template > 1)>>\n inline auto operator-(const genType& x) {\n return neg(identity, Columns, Field>(x), iota* Columns>{});\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator/(const genType& x, const genType_& y) {\n return div(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && broadcastable && moddable, Field>> >\n inline auto operator%(const genType& x, const genType_& y) {\n return mod(Common(x), Common(y), Iota{});\n }\n template > 1) && integral>>>\n inline auto operator~(const genType& x) {\n return bin_neg(identity, Columns, Field>(x), iota* Columns>{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator<<(const genType& x, const genType_& y) {\n return lshift(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator>>(const genType& x, const genType_& y) {\n return rshift(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator&(const genType& x, const genType_& y) {\n return and_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator|(const genType& x, const genType_& y) {\n return or_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator^(const genType& x, const genType_& y) {\n return xor_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable>>\n inline bool operator==(const genType& x, const genType_& y) {\n return equals(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable>>\n inline auto operator!=(const genType& x, const genType_& y) {\n return !equals(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && matmul_broadcastable>>\n inline MultCommon operator*(const genType& x, const genType_& y) {\n if constexpr (Columns == 1 && Columns == 1 || (Rows == 1 && Columns == 1 || Rows == 1 && Columns == 1))\n return mul(Common(x), Common(y), Iota{});\n else\n return matmul(\n identity, Columns, Field>(x),\n identity, Columns, Field>(y),\n iota()>{},\n iota>{});\n }\n}\n\ntemplate > 1 && glsl::Rows > 1) && glsl::Columns == 1 && glsl::Columns == 1>>\ninline auto outerProduct(const genType& c, const genType_& r) {\n return glsl::outer(c, r, glsl::iota< glsl::Rows* glsl::Rows>{});\n}\n\ntemplate\ninline bool any(const glsl::Matrix& x) {\n return (x.data[I] || ...);\n}\ntemplate\ninline bool all(const glsl::Matrix& x) {\n return (x.data[I] && ...);\n}\ntemplate\ninline glsl::Matrix not_(const glsl::Matrix& x) {\n return glsl::not_(x, glsl::iota{});\n}\n\n//#define not not_ // gcc doesn't enjoy this; glsl code should just use not_ then I guess\n\ntemplate && glsl::same, const glsl::Field>>>\nauto lessThan(const genType& x, const genType_& y) {\n return glsl::lt(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto lessThanEqual(const genType& x, const genType_& y) {\n return glsl::lte(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto greaterThan(const genType& x, const genType_& y) {\n return glsl::gt(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto greaterThanEqual(const genType& x, const genType_& y) {\n return glsl::gte(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto equal(const genType& x, const genType_& y) {\n return glsl::eq(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto notEqual(const genType& x, const genType_& y) {\n return glsl::neq(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto isnan_(const genType& x) {\n return glsl::isnan(glsl::Common(x), glsl::Iota{});\n}\ntemplate\ninline auto isinf_(const genType& x) {\n return glsl::isinf(glsl::Common(x), glsl::Iota{});\n}\n#define isnan isnan_\n#define isinf isinf_\n\ntemplate> >\ninline auto max(const genType& x, const genType_& y) {\n return glsl::maximum(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate> >\ninline auto min(const genType& x, const genType_& y) {\n return glsl::mininum(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto abs(const genType& x) {\n return glsl::absolute(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto ceil(const genType& x) {\n return glsl::ceiling(glsl::Common(x), glsl::Iota{});\n}\ntemplate\ninline auto floor(const genType& x) {\n return glsl::flooring(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto fract(const genType& x) {\n return glsl::fraction(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto round(const genType& x) {\n return glsl::rounder(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate>>\ninline auto mod(const genType& x, const genType_& y) {\n return glsl::modulus(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate || (glsl::same && glsl::same)) && glsl::Rows == glsl::Rows&& glsl::broadcastable>>\ninline auto pow(const genType& x, const genType_& y) {\n return glsl::power(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\n\ntemplate>>\ninline auto clamp(const genType& x, const genType_& minVal, const genType__& maxVal) {\n return glsl::clamper(glsl::Common(x), glsl::Common(minVal), glsl::Common(maxVal), glsl::Iota{});\n}\n\ntemplate>>\ninline auto mix(const genType& x, const genType_& y, const genType__& a) {\n return glsl::mixer(glsl::Common(x), glsl::Common(y), glsl::Common(a), glsl::Iota{});\n}\n\n\ntemplate>>\ninline auto smoothstep(const genType& edge0, const genType_& edge1, const genType__& x) {\n return glsl::smoothstepper(glsl::Common(edge0), glsl::Common(edge1), glsl::Common(x), glsl::Iota{});\n}\ntemplate>>\ninline auto step(const genType& edge, const genType_& x) {\n return glsl::stepper(glsl::Common(edge), glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto sin(const genType& angle) {\n return glsl::sine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto asin(const genType& angle) {\n return glsl::arcussine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto cos(const genType& angle) {\n return glsl::cosine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto acos(const genType& angle) {\n return glsl::arcuscosine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto tan(const genType& angle) {\n return glsl::tangent(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto atan(const genType& y_over_x) {\n return glsl::arcustangent(glsl::Common(y_over_x), glsl::Iota{});\n}\n\ntemplate>>\ninline auto atan(const genType& y, const genType_& x) {\n return glsl::arcustangent(glsl::Common(y), glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto degrees(const genType& radians) {\n return glsl::to_degrees(glsl::Common(radians), glsl::Iota{});\n}\n\ntemplate\ninline auto radians(const genType& degrees) {\n return glsl::to_radians(glsl::Common(degrees), glsl::Iota{});\n}\n\ninline vec3 cross(const vec3& x, const vec3& y) {\n return vec3(x.y * y.z - y.y * x.z, x.z * y.x - y.z * x.x, x.x * y.y - y.x * x.y);\n}\n\ninline float determinant(mat2 m) {\n return m[0][0] * m[1][1] - m[0][1] * m[1][0];\n}\ninline float determinant(mat3 m) {\n return m[0][0] * determinant(mat2(m[1].yz, m[2].yz))\n - m[1][0] * determinant(mat2(m[0].yz, m[2].yz))\n + m[2][0] * determinant(mat2(m[0].yz, m[1].yz));\n}\ninline float determinant(mat4 m) {\n return m[0][0] * determinant(mat3(m[1].yzw, m[2].yzw, m[3].yzw))\n - m[1][0] * determinant(mat3(m[0].yzw, m[2].yzw, m[3].yzw))\n + m[2][0] * determinant(mat3(m[0].yzw, m[1].yzw, m[3].yzw))\n - m[3][0] * determinant(mat3(m[0].yzw, m[1].yzw, m[2].yzw));\n}\n\ninline mat2 inverse(mat2 m) {\n return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) / (m[0][0] * m[1][1] - m[0][1] * m[1][0]);\n}\nnamespace glsl {\n inline vec2 givens_rotation(float f, float g) {\n bool swap = false;\n if (abs(f) < abs(g)) {\n float tmp = f;\n f = g;\n g = tmp;\n swap = true;\n }\n if (g == .0f)\n return vec2(copysignf(1.f, f), .0f);\n else {\n float t = g / f, u = copysignf(1.f, f) * sqrtf(1.f + t * t);\n vec2 result = vec2(1.f, t) / u;\n if (swap)\n result = result.yx;\n return result;\n }\n }\n}\ninline mat3 inverse(mat3 m) {\n mat3 result(1.f), rhs(1.f);\n for (int c = 0; c < 2; ++c) {\n for (int r = 2; r > c; --r) {\n mat3 rot(1.f);\n vec2 cs = glsl::givens_rotation(m[c][c], m[c][r]);\n rot[c][c] = rot[r][r] = cs.x;\n rot[c][r] = -(rot[r][c] = cs.y);\n m = rot * m;\n rhs = rot * rhs;\n }\n }\n for (int i = 0; i < 3; ++i) {\n result[i].z = rhs[i].z / m[2].z;\n rhs[i].xy -= result[i].z * m[2].xy;\n result[i].y = rhs[i].y / m[1].y;\n rhs[i].x -= result[i].y * m[1].x;\n result[i].x = rhs[i].x / m[0].x;\n }\n return result;\n}\ninline mat4 inverse(mat4 m) {\n mat4 result(1.f), rhs(1.f);\n for (int c = 0; c < 3; ++c) {\n for (int r = 3; r > c; --r) {\n mat4 rot(1.f);\n vec2 cs = glsl::givens_rotation(m[c][c], m[c][r]);\n rot[c][c] = rot[r][r] = cs.x;\n rot[c][r] = -(rot[r][c] = cs.y);\n m = rot * m;\n rhs = rot * rhs;\n }\n }\n for (int i = 0; i < 4; ++i) {\n result[i].w = rhs[i].w / m[3].w;\n rhs[i].xyz -= result[i].w * m[3].xyz;\n result[i].z = rhs[i].z / m[2].z;\n rhs[i].xy -= result[i].z * m[2].xy;\n result[i].y = rhs[i].y / m[1].y;\n rhs[i].x -= result[i].y * m[1].x;\n result[i].x = rhs[i].x / m[0].x;\n }\n return result;\n}\n\ntemplate1)>>\n glsl::Matrix transpose(const glsl::Matrix& m) {\n glsl::Matrix result;\n ((result.data[I/R+(I%R)*C] = m.data[I]), ...);\n return result;\n}\n\n\ntemplate>>\ninline auto dot(const genType& x, const genType_& y) {\n return glsl::dotter(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto length(const genType& x) {\n return glsl::len(glsl::Common(x), glsl::Iota{});\n}\ntemplate>>\ninline auto distance(const genType& x, const genType_& y) {\n return glsl::len(glsl::Common(x-y), glsl::Iota{});\n}\ntemplate\ninline auto normalize(const genType& x) {\n return x / glsl::len(x, glsl::Iota{});\n}\n\ntemplate\ninline auto sqrt(const genType& x) {\n return glsl::square_root(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto exp(const genType& x) {\n return glsl::exper(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto exp2(const genType& x) {\n return glsl::exp2er(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto log(const genType& x) {\n return glsl::loger(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto log2(const genType& x) {\n return glsl::log2er(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto sign(const genType& x) {\n return glsl::signum(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto reflect(const genType& I, const genType_& N) {\n return I - 2 * dot(N, I) * N;\n}\n\ntemplate\ninline auto refract(const genType& I, const genType_& N, float eta) {\n glsl::Common R(.0f);\n float k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I));\n if (k > 0.0)\n R = eta * I - (eta * dot(N, I) + sqrt(k)) * N;\n return R;\n}\n\ntemplate, float>>>\ninline auto floatBitsToInt(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, float>>>\ninline auto floatBitsToUint(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, int>>>\ninline auto intBitsToFloat(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, uint>>>\ninline auto uintBitsToFloat(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate, double>>>\ninline auto doubleBitsToInt(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, double>>>\ninline auto doubleBitsToUint(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, int64_t>>>\ninline auto int64BitsToDouble(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, uint64_t>>>\ninline auto uint64BitsToDouble(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\n\ninline int64_t packInt2x32(ivec2 v) { return int64_t(v.y) << 32 | v.x; }\ninline uint64_t packUint2x32(uvec2 v) { return uint64_t(v.y) << 32 | v.x; }\n\ninline ivec2 unpackInt2x32(int64_t v) { return ivec2(v, v>>32); }\ninline uvec2 unpackUint2x32(uint64_t v) { return uvec2(v, v >> 32); }\n\ninline int atomicAdd(int& mem, int data) { return 0; }\ninline uint atomicAdd(uint& mem, uint data) { return 0u; }\ninline int64_t atomicAdd(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicAdd(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicAnd(int& mem, int data) { return 0; }\ninline uint atomicAnd(uint& mem, uint data) { return 0u; }\ninline int64_t atomicAnd(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicAnd(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicCompSwap(int& mem, int comp, int data) { return 0; }\ninline uint atomicCompSwap(uint& mem, uint comp, uint data) { return 0u; }\ninline int64_t atomicCompSwap(int64_t& mem, int64_t comp, int64_t data) { return 0; }\ninline uint64_t atomicCompSwap(uint64_t& mem, uint64_t comp, uint64_t data) { return 0; }\n\ninline int atomicExchange(int& mem, int data) { return 0; }\ninline uint atomicExchange(uint& mem, uint data) { return 0u; }\ninline int64_t atomicExchange(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicExchange(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicMax(int& mem, int data) { return 0; }\ninline uint atomicMax(uint& mem, uint data) { return 0u; }\ninline int64_t atomicMax(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicMax(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicMin(int& mem, int data) { return 0; }\ninline uint atomicMin(uint& mem, uint data) { return 0u; }\ninline int64_t atomicMin(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicMin(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicOr(int& mem, int data) { return 0; }\ninline uint atomicOr(uint& mem, uint data) { return 0u; }\ninline int64_t atomicOr(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicOr(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicXor(int& mem, int data) { return 0; }\ninline uint atomicXor(uint& mem, uint data) { return 0u; }\ninline int64_t atomicXor(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicXor(uint64_t& mem, uint64_t data) { return 0; }\n\ninline void barrier() {}\ninline void groupMemoryBarrier() {}\ninline void memoryBarrier() {}\ninline void memoryBarrierAtomicCounter() {}\ninline void memoryBarrierBuffer() {}\ninline void memoryBarrierImage() {}\ninline void memoryBarrierShared() {}\n\ninline const uvec3 gl_GlobalInvocationID = {};\ninline const uvec3 gl_LocalInvocationID = {};\ninline const uvec3 gl_WorkGroupSize = { 1, 1, 1 };\ninline const uvec3 gl_WorkGroupID = {};\ninline const uvec3 gl_NumWorkGroups = { 1, 1, 1 };\ninline const uint gl_LocalInvocationIndex = 0u;\n\ninline const vec4 gl_FragCoord = {};\ninline const vec2 gl_PointCoord = {};\ninline int gl_ViewportIndex;\ninline const int gl_VertexID = 0;\ninline const int gl_InstanceID = 0;\ninline const int gl_InvocationID = 0;\ninline int gl_PrimitiveIDIn;\ninline const int gl_PrimitiveID = 0;\ninline const int gl_PatchVerticesIn = 0;\ninline const int gl_Layer = 0;\n\ninline const vec3 gl_TessCoord = {};\ninline float gl_TessLevelInner[2];\ninline float gl_TessLevelOuter[4];\n\ninline const bool gl_FrontFacing = true;\ninline const bool gl_HelperInvocation = false;\n\ninline vec4 gl_Position;\ninline float gl_PointSize;\ninline float gl_FragDepth;\ninline float gl_ClipDistance[1];\ninline float gl_CullDistance[1];\nstruct gl_PerVertex\n{\n vec4 gl_Position;\n float gl_PointSize;\n float gl_ClipDistance[1];\n} inline gl_in[1];\n\ninline const int gl_NumSamples = 1;\ninline const int gl_SampleID = 0;\ninline int gl_SampleMask[1];\ninline const int gl_SampleMaskIn[1] = { 0 };\ninline const vec2 gl_SamplePosition = {};\n\ntemplate genType dFdx(genType p) { return p; }\ntemplate genType dFdy(genType p) { return p; }\ntemplate genType dFdxCoarse(genType p) { return p; }\ntemplate genType dFdyCoarse(genType p) { return p; }\ntemplate genType dFdxFine(genType p) { return p; }\ntemplate genType dFdyFine(genType p) { return p; }\ntemplate genType fwidth(genType p) { return p; }\ntemplate genType fwidthCoarse(genType p) { return p; }\ntemplate genType fwidthFine(genType p) { return p; }\n\n// subgroup extension: see https://www.khronos.org/blog/vulkan-subgroup-tutorial\n\ninline const uint gl_NumSubgroups = 1, gl_SubgroupID = 0, gl_SubgroupSize = 128, gl_SubgroupInvocationID = 0;\ninline const uvec4 gl_SubgroupEqMask{ 0 }, gl_SubgroupGeMask{ 0 }, gl_SubgroupGtMask{ 0 }, gl_SubgroupLeMask{ 0 }, gl_SubgroupLtMask{ 0 };\ninline void subgroupBarrier() {}\ninline void subgroupMemoryBarrier() {}\ninline void subgroupMemoryBarrierBuffer() {}\ninline void subgroupMemoryBarrierShared() {}\ninline void subgroupMemoryBarrierImage() {}\ninline bool subgroupElect() { return false; }\n\ninline bool subgroupAll(bool value) { return value; }\ninline bool subgroupAny(bool value) { return value; }\ntemplate bool subgroupAllEqual(T value) { (void)value; return false; }\n\ntemplate T subgroupBroadcast(T value, uint id) { (void)id; return value; }\ntemplate T subgroupBroadcastFirst(T value) { return value; }\ninline uvec4 subgroupBallot(bool value) { (void)value; return uvec4(0); }\ninline bool subgroupInverseBallot(uvec4 value) { (void)value; return false; }\ninline bool subgroupBallotBitExtract(uvec4 value, uint index) { (void)value; (void)index; return false; }\ninline uint subgroupBallotBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotInclusiveBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotExclusiveBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotFindLSB(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotFindMSB(uvec4 value) { (void)value; return 0; }\n\ntemplate T subgroupAdd(T value) { return value; }\ntemplate T subgroupMul(T value) { return value; }\ntemplate T subgroupMin(T value) { return value; }\ntemplate T subgroupMax(T value) { return value; }\ntemplate T subgroupAnd(T value) { return value; }\ntemplate T subgroupOr(T value) { return value; }\ntemplate T subgroupXor(T value) { return value; }\n\ntemplate T subgroupInclusiveAdd(T value) { return value; }\ntemplate T subgroupInclusiveMul(T value) { return value; }\ntemplate T subgroupInclusiveMin(T value) { return value; }\ntemplate T subgroupInclusiveMax(T value) { return value; }\ntemplate T subgroupInclusiveAnd(T value) { return value; }\ntemplate T subgroupInclusiveOr(T value) { return value; }\ntemplate T subgroupInclusiveXor(T value) { return value; }\n\ntemplate T subgroupExclusiveAdd(T value) { return value; }\ntemplate T subgroupExclusiveMul(T value) { return value; }\ntemplate T subgroupExclusiveMin(T value) { return value; }\ntemplate T subgroupExclusiveMax(T value) { return value; }\ntemplate T subgroupExclusiveAnd(T value) { return value; }\ntemplate T subgroupExclusiveOr(T value) { return value; }\ntemplate T subgroupExclusiveXor(T value) { return value; }\n\ntemplate T subgroupShuffle(T value, uint index) { (void)index; return value; }\ntemplate T subgroupShuffleXor(T value, uint mask) { (void)mask; return value; }\ntemplate T subgroupShuffleUp(T value, uint delta) { (void)delta; return value; }\ntemplate T subgroupShuffleDown(T value, uint delta) { (void)delta; return value; }\n\ntemplate T subgroupClusteredAdd(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMul(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMin(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMax(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredAnd(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredOr(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredXor(T value, uint clusterSize) { (void)clusterSize; return value; }\n\ntemplate T subgroupQuadBroadcast(T value, uint id) { (void)id; return value; }\ntemplate T subgroupQuadSwapHorizontal(T value) { return value; }\ntemplate T subgroupQuadSwapVertical(T value) { return value; }\ntemplate T subgroupQuadSwapDiagonal(T value) { return value; }\n\n\n// missing: hyperbolic trigonometry, faceforward etc geometric functions.\n"}, {"path": "impl/inline_glsl.cpp", "language": "cpp", "loc": 719, "comment_density": 0.088, "code": "\n#include \"inline_glsl.h\"\n#ifdef _WIN32\n#include \n#endif\n\nivec2 windowSize();\n\nnamespace inline_glsl {\n#ifdef _WIN32\n long ShaderStore::id_counter = 1; // 0 reserved for non-existing shaders\n inline ULONGLONG lastAccess(const char* path) {\n HANDLE file = CreateFileA(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);\n FILETIME writeTime;\n GetFileTime(file, nullptr, nullptr, &writeTime);\n CloseHandle(file);\n return ULARGE_INTEGER{ writeTime.dwLowDateTime, writeTime.dwHighDateTime }.QuadPart;\n }\n#else\n\tstd::atomic ShaderStore::id_counter{1};\n inline auto lastAccess(const char* path) {\n return last_write_time(std::filesystem::path(path));\n }\n#endif\n\n inline bool alphanum_(char input) {\n return 'a' <= input && input <= 'z' || 'A' <= input && input <= 'Z' || '0' <= input && input <= '9' || input == '_';\n }\n\n inline void remove_bind_calls(char* input) {\n char* output = input;\n bool inside = false;\n const char* needle = \" bind\";\n\n while (*input != '\\0') {\n *output = *input;\n if (!alphanum_(*input)) {\n for (int i = 1;; i++) {\n if (needle[i] == '\\0') {\n while (*input != '(' && *input != '\\0') input++;\n inside = true;\n break;\n }\n if (input[i] != needle[i]) break;\n }\n }\n output++; input++;\n if (inside && *input == ')') {\n input++;\n inside = false;\n }\n }\n *output = '\\0';\n }\n\n inline char* search(char* input, const char* needle, int& line) {\n while (*input != '\\0') {\n if (*input == '\\n') line++;\n for (int i = 0;; i++) {\n if (needle[i] == '\\0') return input;\n else if (input[i] != needle[i]) break;\n }\n input++;\n }\n return input;\n }\n\n void remove_comments(char* source_in, uint* lines_in) {\n char* source_out = source_in;\n uint* lines_out = lines_in;\n bool multi_comment = false, single_comment = false;\n\n while(*source_in!='\\0') {\n if (multi_comment) {\n if (*source_in == '\\n') { // keep commented \\ns to preserve lines\n *(source_out++) = '\\n';\n *(lines_out++) = *lines_in;\n }\n else if (*source_in == '/' && *(source_in-1) == '*')\n multi_comment = false;\n }\n else if (single_comment && *source_in == '\\n') {\n *(source_out++) = '\\n';\n *(lines_out++) = *lines_in;\n single_comment = false;\n }\n else {\n if (*source_in == '/') {\n if (*(source_in+1) == '/')\n single_comment = true;\n else if (*(source_in + 1) == '*')\n multi_comment = true;\n }\n if (!single_comment && !multi_comment) {\n *(source_out++) = *source_in;\n *(lines_out++) = *lines_in;\n }\n }\n source_in++;\n lines_in++;\n }\n *source_out = '\\0';\n *lines_out = *lines_in;\n }\n\n void remove_float_suffixes(char* source_in, uint* lines_in) {\n char* source_out = source_in;\n uint* lines_out = lines_in;\n bool number = false;\n while (*source_in!='\\0') {\n bool keep = true;\n if (number) {\n if (*source_in == 'f')\n keep = number = false;\n if (!('0'<=*source_in && *source_in<='9') && *source_in != '.')\n number = false;\n }\n if (!alphanum_(*source_in) && ('0' <= *(source_in+1) && *(source_in+1) <= '9'))\n number = true;\n if (keep) {\n *(source_out++) = *source_in;\n *(lines_out++) = *lines_in;\n }\n source_in++;\n lines_in++;\n }\n *source_out = '\\0';\n *lines_out = *lines_in;\n }\n\n bool is_same(const char* a, const char* b) {\n while (*a == *b) {\n if (*a == '\\0') return true;\n a++; b++;\n }\n return false;\n }\n \n bool SourceStore::update(const char* path) {\n this->path = path;\n\n auto latestUpdate = lastAccess(path);\n for (auto include : includes) {\n //printf(\"checking include %s\\n\", include);\n auto includeUpdate = lastAccess(include);\n if (includeUpdate > latestUpdate)\n latestUpdate = includeUpdate;\n }\n\n if (latestUpdate == currentUpdate)\n return false;\n\n FILE* file = fopen(path, \"rb\");\n if(!file) return false;\n \n fseek(file, 0, SEEK_END);\n size_t size = size_t(ftell(file)) + 1;\n\t\tif(size == 0) return false;\n\n\t\titeration++;\n\n currentUpdate = latestUpdate;\n\n contents.resize(size);\n contents.back() = '\\0';\n fseek(file, 0, SEEK_SET);\n fread(contents.data(), 1, contents.size() - 1, file);\n fclose(file);\n\n lines.resize(contents.size());\n int line = 1;\n for (int i = 0; i < contents.size(); ++i) {\n lines[i] = line;\n if (contents[i] == '\\n') line++;\n }\n remove_comments(contents.data(), lines.data());\n remove_float_suffixes(contents.data(), lines.data());\n\n char* search = contents.data();\n\n for (auto a : includes) delete[] a;\n includes.clear();\n\n // add include files (absolutely beautiful code I know)\n while (true) {\n int dummy;\n //printf(\"%s\", contents.data());\n search = inline_glsl::search(search, \"#in\", dummy);\n\n if (*search != '\\0') {\n char* include_begin = search;\n while (*search != '\\\"' && *search != '<' && *search != '\\0') search++;\n if (*search == '\\\"' || *search == '<') {\n char* path = ++search;\n\n while (*search != '\\\"' && *search != '>' && *search != '\\0') search++;\n int64_t path_length = search - path + 1;\n char* filePath = new char[path_length];\n for (int i = 0; path < search; ++i)\n filePath[i] = *(path++);\n filePath[path_length - 1] = '\\0';\n \n search++;\n int64_t begin_ind = include_begin - contents.data(), search_ind = search - contents.data();\n\n bool already_included = false;\n for (auto& a : includes)\n if (is_same(a, filePath))\n already_included = true;\n\n if (!already_included && !is_same(filePath, \"glext.h\") && !is_same(filePath, \"window.h\") && !is_same(filePath, \"loadgl46.h\") && !is_same(filePath, \"inline_glsl.h\")) {\n\n //printf(\"%s\\n\", filePath);\n FILE* includeFile = fopen(filePath, \"rb\");\n if (includeFile) {\n\t\t\t\t\t\t\tfseek(includeFile, 0, SEEK_END);\n\t\t\t\t\t\t\tsize_t size = size_t(ftell(includeFile));\n includes.push_back(filePath);\n if(size>0) {\n \t uint includeMask = uint(includes.size()) << 20;\n \t if (includes.size() >= 4096)\n\t printf(\"too many includes, errors may be reported in incorrect files\\n\");\n\n \t size_t copy_length = contents.size() - search_ind;\n \t contents.resize(contents.size() + size - (search_ind - begin_ind) - 1);\n \t lines.resize(contents.size());\n \t memcpy(&contents[contents.size() - copy_length], &contents[search_ind], copy_length);\n \t memcpy(&lines[lines.size() - copy_length], &lines[search_ind], copy_length * sizeof(int));\n\t\n \t fseek(includeFile, 0, SEEK_SET);\n\t \t fread(&contents[begin_ind], 1, size, includeFile);\n \t \tfclose(includeFile);\n\t \t line = 1;\n\t\t\t\t\t\t\t\tfor (int i = 0; i < size; ++i) {\n \t lines[begin_ind + i] = includeMask | line;\n \t if (contents[begin_ind + i] == '\\n') line++;\n \t }\n \t remove_comments(contents.data(), lines.data());\n \t remove_float_suffixes(contents.data(), lines.data());\n\t }\n }\n else delete[] filePath;\n }\n else delete[] filePath;\n search = &contents[search_ind];\n }\n else\n search++;\n }\n else break;\n }\n contents.resize(search + 1 - contents.data());\n lines.resize(contents.size());\n\n /*int lineBegin = 0;\n for (int i = 0; i < contents.size(); ++i) {\n if (contents[i] == '\\n' || contents[i] == '\\0') {\n printf(\"%d: %.*s\", lines[lineBegin], i - lineBegin + 1, &contents[lineBegin]);\n lineBegin = i + 1;\n }\n }\n for (int i = 0; i < 5; ++i) {\n printf(\"%d, \", lines[lines.size() - 1 - i]);\n }*/\n\n glsl_mains.clear();\n glsl_main_lines.clear();\n glsl_functions.clear();\n \n search = contents.data();\n\n while (true) {\n search = inline_glsl::search(search, \"glsl_main\", line);\n if (*search != '\\0') {\n glsl_mains.push_back(search);\n glsl_main_lines.push_back(lines[search-contents.data()]);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"#define\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_global\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search + 11);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_function\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search + 13);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_func(\", line);\n if (*search != '\\0') {\n for (int i = 0; i < 3; ++i) {\n char open = i < 2 ? '(' : '{', close = i < 2 ? ')' : '}';\n while (*search != open && *search != '\\0') search++;\n int inside = 1;\n while (inside > 0 && *(++search)!='\\0') {\n if (*search == open) inside++;\n if (*search == close) inside--;\n }\n }\n /*if (*(search + 1) != ';')\n printf(\"wrong character..?\\n\");\n else\n printf(\"semicolon removed!\\n\");*/\n *(search+1) = ' ';\n }\n else break;\n }\n\n glsl_begin_lines = glsl_main_lines;\n for (int i = 0; i < glsl_mains.size(); i++) {\n char*& c = glsl_mains[i];\n int inside = 1;\n char* k = c;\n while (inside > 0 && *k != '\\0') {\n if (*k == '{') inside++;\n if (*k == '}') inside--;\n k++;\n }\n *(k - 1) = '\\0';\n inside = 1;\n while (inside > 0 && c != contents.data()) {\n c--;\n if (*c == '}') inside++;\n if (*c == '{') inside--;\n if (*c == '\\n') glsl_begin_lines[i]--;\n }\n c++;\n\n remove_bind_calls(c);\n }\n for (char* c : glsl_functions) {\n if (*c == '#') {\n while (*c != '\\n' && *c != '\\0') c++;\n *c = '\\0';\n continue;\n }\n while (*c != ';' && *c != '{' && *c != '(' && *c != '\\0') c++;\n if (*c == '{') {\n c++;\n // struct\n int inside = 1;\n while (inside>0 && *c != '\\0') {\n if (*c == '{') inside++;\n if (*c == '}') inside--;\n c++;\n }\n }\n if (*c == ';') *(c + 1) = '\\0'; // variable\n else {\n // function\n c++;\n int inside = 1;\n while (inside > 0 && *c!='\\0') {\n if (*c == '(') inside++;\n if (*c == ')') inside--;\n c++;\n }\n while (*c != '{' && *c!=';' && *c != '\\0') c++;\n if (*c == ';')\n *(c+1) = '\\0';\n else {\n c++;\n inside = 1;\n while (inside > 0 && *c != '\\0') {\n if (*c == '{') inside++;\n if (*c == '}') inside--;\n c++;\n }\n *c = '\\0';\n }\n }\n }\n for (const char* c : includes) {\n while (*c != '\\\"' && *c != '>' && *c != '\\0') ++c;\n *const_cast(c) = '\\0';\n }\n\n return true;\n }\n\n void write_line(char* target, int line, int file) {\n for (int i = 0; i < 7; ++i) target[i] = \"\\n#line \"[i];\n sprintf(target + 7, \"%u %u\\n\", line, file);\n }\n\n bool add_shader(GLuint program, GLenum type, const char* name, const Shader& shader_obj, SourceStore& store) {\n\n GLuint shader = glCreateShader(type);\n\n if (!shader_obj.store->cached) {\n\n const char* stub = \"\\\n#extension GL_ARB_gpu_shader_int64 : enable\\n\\\n#define glsl_main() main()\\n\\\n#define glsl_func(a) a\\n\\\n#define dynamic_array(t, a) t a[]\\n\\\n#define arg_in(a) in a\\n\\\n#define arg_out(a) out a\\n\\\n#define arg_inout(a) inout a\\n\\\n#define arg_layout layout\\n\\\n#define glsl_extension(a,b) int _##a = 1\\n\\\n#define glsl_version(a) int glsl_version = a\\n\\\n#define glsl_subgroup(a) \\n\\\n#define not_(a) not(a)\\n\";\n\n size_t extensions = shader_obj.store->extensions.size();\n size_t functions = store.glsl_functions.size();\n const char** sources = const_cast(new char* [4 + extensions + 2 * functions]);\n\n sources[0] = shader_obj.store->version ? shader_obj.store->version : \"#version 460\\n\";\n for (int i = 0; i < extensions; ++i)\n sources[1 + i] = shader_obj.store->extensions[i];\n sources[extensions + 1] = stub;\n\n uint mask = 0xffffffffu << 20u;\n for (int i = 0; i < functions; ++i) {\n char* k = new char[32];\n uint line_file = store.lines[store.glsl_functions[i] - store.contents.data()];\n write_line(k, line_file & ~mask, (line_file & mask) >> 20u);\n sources[i * 2 + 2 + extensions] = k;\n sources[i * 2 + 3 + extensions] = store.glsl_functions[i];\n }\n char* l = new char[32];\n write_line(l, store.glsl_begin_lines[shader_obj.store->nth_in_file], 0);\n sources[2 + 2 * functions + extensions] = l;\n sources[3 + 2 * functions + extensions] = store.glsl_mains[shader_obj.store->nth_in_file];\n\n //printf(\"source: \\n\");\n //for (int i = 0; i < 4 + extensions + 2 * store.glsl_functions.size(); ++i)\n // printf(\"%s\", sources[i]);\n\n#ifdef _WIN32\n (void)_mkdir(\"shader_cache\");\n#else\n std::filesystem::create_directory(\"shader_cache\");\n#endif\n\n char cache_name[256];\n get_cache_name(cache_name, store.path, shader_obj.store->line);\n FILE* cache = fopen(cache_name, \"wb\");\n for (auto& include : store.includes) {\n int count = 0;\n while (include[count] != '\\0') count++;\n fwrite(include, 1, count, cache);\n fwrite(\",\", 1, 1, cache);\n }\n fwrite(\"\\n\", 1, 1, cache);\n for (int i = 0; i < 4 + extensions + 2 * store.glsl_functions.size(); ++i) {\n int count = 0;\n while (sources[i][count] != '\\0') count++;\n fwrite(sources[i], 1, count, cache);\n }\n fclose(cache);\n\n glShaderSource(shader, GLsizei(4 + extensions + 2 * functions), sources, nullptr);\n\n delete[] l;\n for (int i = 0; i < functions; ++i)\n delete[] const_cast(sources[i * 2 + 2 + extensions]);\n delete[] sources;\n }\n else\n glShaderSource(shader, 1, &shader_obj.store->cached, nullptr);\n \n glCompileShader(shader);\n GLint status;\n glGetShaderiv(shader, GL_COMPILE_STATUS, &status);\n if (status != GL_TRUE) {\n GLint length;\n glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);\n std::vector info_log(length);\n glGetShaderInfoLog(shader, length, nullptr, info_log.data());\n const GLubyte* vendor = glGetString(GL_VENDOR);\n \n if(vendor[0] == 'N' && vendor[1] == 'V') // should be enough :^)\n for (int i = 0; i < info_log.size(); ++i) {\n uint file_number, line_number;\n if ((i==0||info_log[i-1] == '\\n') && 2 == sscanf(info_log.data() + i, \"%u(%u)\", &file_number, &line_number)) {\n int j = 0; while (i+j < info_log.size() && info_log[i+j] != ')') j++; j++;\n \n const char* path = (file_number == 0) ? shader_obj.store->path : shader_obj.store->include_files[file_number-1];\n \n int last_dir = 0;\n for (int k = 0; path[k] != '\\0'; k++)\n if (path[k] == '\\\\' || path[k] == '/')\n last_dir = k;\n if(last_dir)\n path += last_dir + 1;\n\n int k = 0; while (path[k] != '\\0')k++;\n int t = int(ceil(log10(line_number)));\n // \", line \"\n size_t copy_size = info_log.size() - i - j;\n info_log.resize(info_log.size()-j+k+t+7);\n memcpy(info_log.data() + i + k + t + 7, info_log.data() + i + j, copy_size);\n for (int p = 0; p < k; ++p)\n info_log[i + p] = path[p];\n for (int p = 0; p < 7; ++p)\n info_log[i + k + p] = \", line \"[p];\n info_log[i+k+7+sprintf(info_log.data() + i + k + 7, \"%u\", line_number)] = ' ';\n i += k + t + 7;\n }\n }\n // TODO: AMD, Intel, ...? some vendors may have different error reporting schemes for different generations?\n printf(\"\\n%s failed: \\n%s\", name, info_log.data());\n glDeleteShader(shader);\n return false;\n }\n glAttachShader(program, shader);\n glDeleteShader(shader);\n return true;\n }\n\n // maybe make this O(log n) at some point\n inline Program& find_or_insert(int64_t ids[6], std::vector& programs) {\n for (int i = 0; i < programs.size(); ++i) {\n for (int j = 0; j < 6; ++j) {\n if (programs[i].ids[j] != ids[j]) break;\n else if (j == 5) return programs[i].p;\n }\n }\n programs.resize(programs.size() + 1);\n size_t location = programs.size() - 1;\n programs[location].p = Program();\n for (int i = 0; i < 6; ++i)\n programs[location].ids[i] = (long)ids[i];\n return programs[location].p;\n }\n\n std::vector draw_buffers;\n\n void useShader(const Shader& compute, const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment, std::vector& programs, ShaderState& shader_state, SourceStore& store) {\n\n int64_t ids[] = { compute.unique_id, vertex.unique_id, fragment.unique_id, geometry.unique_id, control.unique_id, evaluation.unique_id };\n Program& program = find_or_insert(ids, programs);\n\n shader_state.rebuilt = false;\n if (program.obj == 0 || compute.changed || vertex.changed || fragment.changed || geometry.changed || control.changed || evaluation.changed) {\n printf(\"compiling... \");\n GLuint newProgram = glCreateProgram();\n\n bool csuccess = !compute.unique_id || add_shader(newProgram, GL_COMPUTE_SHADER, \"compute\", compute, store);\n bool vsuccess = !vertex.unique_id || add_shader(newProgram, GL_VERTEX_SHADER, \"vertex\", vertex, store);\n bool gsuccess = !geometry.unique_id || add_shader(newProgram, GL_GEOMETRY_SHADER, \"geometry\", geometry, store);\n bool tsuccess = !control.unique_id || add_shader(newProgram, GL_TESS_CONTROL_SHADER, \"control\", control, store);\n bool esuccess = !evaluation.unique_id || add_shader(newProgram, GL_TESS_EVALUATION_SHADER, \"evaluation\", evaluation, store);\n bool fsuccess = !fragment.unique_id || add_shader(newProgram, GL_FRAGMENT_SHADER, \"fragment\", fragment, store);\n\n bool success = csuccess && vsuccess && gsuccess && tsuccess && esuccess && fsuccess;\n\n if (success) {\n glLinkProgram(newProgram);\n\n GLint status;\n glGetProgramiv(newProgram, GL_LINK_STATUS, &status);\n if (status != GL_TRUE) {\n GLint length;\n glGetProgramiv(newProgram, GL_INFO_LOG_LENGTH, &length);\n std::vector info_log(length);\n glGetProgramInfoLog(newProgram, length, nullptr, info_log.data());\n printf(\"\\ncouldn't link shader: \\n%s\\n\", info_log.data());\n glDeleteProgram(newProgram);\n success = false;\n }\n }\n else printf(\"\\n\");\n if (success) {\n printf(\"success! \\n\");\n if (program.obj != 0)\n glDeleteProgram(program.obj);\n program.obj = newProgram;\n\n if (program.vao != 0)\n glDeleteVertexArrays(1, &program.vao);\n glCreateVertexArrays(1, &program.vao);\n\n shader_state.rebuilt = true;\n }\n }\n\n glBindVertexArray(program.vao);\n\n glUseProgram(program.obj);\n\n if (draw_buffers.size() == 0) {\n GLint maxBuffers;\n glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxBuffers);\n draw_buffers.resize(maxBuffers);\n }\n for (auto& b : draw_buffers)\n b = GL_NONE;\n\n shader_state.fbo = program.fbo;\n shader_state.program = program.obj;\n shader_state.texture_unit = shader_state.image_unit = shader_state.fbo_width = shader_state.fbo_height = 0;\n\n shader_state.use_fbo = false;\n\n if (compute.unique_id) for (auto& f : compute.store->callbacks) f(shader_state);\n if (vertex.unique_id) for (auto& f : vertex.store->callbacks) f(shader_state);\n if (geometry.unique_id) for (auto& f : geometry.store->callbacks) f(shader_state);\n if (control.unique_id) for (auto& f : control.store->callbacks) f(shader_state);\n if (evaluation.unique_id) for (auto& f : evaluation.store->callbacks) f(shader_state);\n if (fragment.unique_id) for (auto& f : fragment.store->callbacks) f(shader_state);\n\n program.fbo = shader_state.fbo;\n\n if (shader_state.use_fbo) {\n glViewport(0, 0, shader_state.fbo_width, shader_state.fbo_height);\n //auto test = glCheckFramebufferStatus(GL_FRAMEBUFFER);\n //if (test != GL_FRAMEBUFFER_COMPLETE)\n // printf(\"framebuffer status %X\\n\", test);\n\n glDrawBuffers(draw_buffers.size(), draw_buffers.data());\n }\n else {\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n auto size = windowSize();\n glViewport(0, 0, size.x, size.y);\n }\n }\n\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of SSBO '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_SHADER_STORAGE_BLOCK, store.name);\n if (store.location != GL_INVALID_INDEX)\n glShaderStorageBlockBinding(shader_state.program, store.location, store.location);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of UBO '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_UNIFORM_BLOCK, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniformBlockBinding(shader_state.program, store.location, store.location);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of color attachment '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_PROGRAM_OUTPUT, store.name);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"'location' of depth attachment '%s' is obvious\\n\", store.name);\n }\n\n#undef bind\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform float '%s' to %g\\n\", store.name, store.item);\n glUniform1f(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform int '%s' to %i\\n\", store.name, store.item);\n glUniform1i(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uint '%s' to %ui\\n\", store.name, store.item);\n glUniform1ui(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uint '%s' to %ui\\n\", store.name, store.item);\n glUniform1ui64(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec2 '%s'\\n\", store.name);\n glUniform2fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec2 '%s'\\n\", store.name);\n glUniform2iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec2 '%s'\\n\", store.name);\n glUniform2uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec3 '%s'\\n\", store.name);\n glUniform3fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec3 '%s'\\n\", store.name);\n glUniform3iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec3 '%s'\\n\", store.name);\n glUniform3uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec4 '%s'\\n\", store.name);\n glUniform4fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec4 '%s'\\n\", store.name);\n glUniform4iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec4 '%s'\\n\", store.name);\n glUniform4uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2 '%s'\\n\", store.name);\n glUniformMatrix2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3 '%s'\\n\", store.name);\n glUniformMatrix3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4 '%s'\\n\", store.name);\n glUniformMatrix4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3x2 '%s'\\n\", store.name);\n glUniformMatrix3x2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4x2 '%s'\\n\", store.name);\n glUniformMatrix4x2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2x3 '%s'\\n\", store.name);\n glUniformMatrix2x3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4x3 '%s'\\n\", store.name);\n glUniformMatrix4x3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2x4 '%s'\\n\", store.name);\n glUniformMatrix2x4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3x4 '%s'\\n\", store.name);\n glUniformMatrix3x4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"bind SSBO '%s'\\n\", store.name);\n glBindBufferBase(GL_SHADER_STORAGE_BUFFER, store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"bind UBO '%s'\\n\", store.name);\n glBindBufferBase(GL_UNIFORM_BUFFER, store.location, store.item);\n }\n\n void set_fbo_size(GLuint texture, GLint level, ShaderState& state) {\n glGetTextureLevelParameteriv(texture, level, GL_TEXTURE_WIDTH, &state.fbo_width);\n glGetTextureLevelParameteriv(texture, level, GL_TEXTURE_HEIGHT, &state.fbo_height);\n }\n\n bool layered(GLenum type) {\n return type == GL_TEXTURE_2D_ARRAY || type == GL_TEXTURE_3D || type == GL_TEXTURE_CUBE_MAP || type == GL_TEXTURE_CUBE_MAP_ARRAY || type == GL_TEXTURE_2D_MULTISAMPLE_ARRAY;\n }\n\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"attach color '%s'\\n\", store.name);\n if (store.item == 0) return;\n if (shader_state.fbo == 0)\n glGenFramebuffers(1, &shader_state.fbo);\n if(!shader_state.use_fbo)\n glBindFramebuffer(GL_FRAMEBUFFER, shader_state.fbo);\n shader_state.use_fbo = true;\n if (shader_state.fbo_width == 0) set_fbo_size(store.item, store.item.level, shader_state);\n if (layered(store.item.type))\n glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + store.location, store.item, store.item.level, store.item.layer);\n else\n glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + store.location, store.item, store.item.level);\n draw_buffers[store.location] = GL_COLOR_ATTACHMENT0 + store.location;\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"attach %s to depth\\n\", store.name);\n if (store.item == 0) return;\n if (shader_state.fbo == 0)\n glGenFramebuffers(1, &shader_state.fbo);\n if (!shader_state.use_fbo)\n glBindFramebuffer(GL_FRAMEBUFFER, shader_state.fbo);\n shader_state.use_fbo = true;\n if (shader_state.fbo_width == 0) set_fbo_size(store.item, store.item.level, shader_state);\n if (layered(store.item.type))\n glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, store.item, store.item.level, store.item.layer);\n else\n glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, store.item, store.item.level);\n }\n}\n"}, {"path": "impl/inline_glsl.h", "language": "c", "loc": 456, "comment_density": 0.033, "code": "#pragma once\n\n#include \n\n#ifdef _WIN32\n#define VC_EXTRALEAN\n#define WIN32_LEAN_AND_MEAN\n#define NOMINMAX\n#include \n#else\n#include \n#endif\n\n#include \"glsl.h\"\n#include \"shader_types.h\"\n\n#ifndef _WIN32\n#include \n#include \n#endif\n\nnamespace inline_glsl {\n \n struct SourceStore {\n std::vector contents;\n std::vector glsl_mains;\n std::vector glsl_functions;\n std::vector glsl_main_lines, glsl_begin_lines;\n std::vector includes;\n char const* path;\n std::vector lines;\n#ifdef _WIN32\n ULONGLONG currentUpdate = 0;\n#else\n std::filesystem::file_time_type currentUpdate = {};\n#endif\n uint iteration = 0;\n bool update(const char* path);\n ~SourceStore() {\n for (auto include : includes) delete[] include;\n }\n };\n\n static SourceStore store;\n\n // filled prior to invoking a program\n struct ShaderState {\n GLuint program;\n GLuint fbo;\n GLuint image_format, image_access;\n GLubyte texture_unit;\n GLubyte image_unit;\n GLint fbo_width, fbo_height;\n bool rebuilt, use_fbo;\n } static shader_state;\n\n struct Function {\n virtual void operator()(ShaderState&) = 0;\n virtual ~Function() {}\n };\n\n template\n struct Specific : Function {\n T func;\n Specific(T func) : func(func) {}\n virtual void operator()(ShaderState& state) { func(state); }\n };\n\n struct Func {\n Function* func = nullptr;\n template\n Func(T func) : func(new Specific(func)) {}\n Func(Func&& other) : func(other.func) { other.func = nullptr; }\n void operator()(ShaderState& state) { (*func)(state); }\n ~Func() { if (func) delete func; }\n };\n\n using ShaderSetup = std::vector;\n inline ShaderSetup* current_callbacks;\n inline std::vector* extensions;\n inline const char** version;\n\n inline void get_cache_name(char* result, const char* path, int line) {\n\n const char* path_name = path;\n while (*path_name != '\\0') path_name++;\n while (*path_name != '\\\\' && *path_name != '/' && path_name > path)path_name--;\n if (path_name > path) path_name++;\n\n int i = 0;\n for (i = 0; i < 13; ++i)\n result[i] = \"shader_cache/\"[i];\n while (*path_name != '.' && *path_name != '\\0')\n result[i++] = *path_name++;\n result[i++] = '_';\n\n i += sprintf(result+i, \"%d\", line);\n\n for (int j = 0; j < 6; ++j)\n result[i++] = \".glsl\"[j];\n }\n\n struct ShaderStore {\n ShaderSetup callbacks;\n std::vector extensions, include_files;\n const char* version;\n const char* path; int line;\n const char* cached = nullptr;\n uint nth_in_file, iteration = 0;\n long unique_id;\n#ifdef _WIN32\n static long id_counter;\n#else\n\t\tstatic std::atomic id_counter;\n#endif\n ShaderStore(const char* path, int line, SourceStore& store) : path(path), line(line) {\n#ifdef _WIN32\n unique_id = InterlockedAdd(&id_counter, 1);\n#else\n unique_id = id_counter++;\n#endif\n FILE* test = fopen(path, \"r\");\n if (test) {\n fclose(test);\n store.update(path);\n include_files = store.includes;\n for (nth_in_file = 0; nth_in_file < store.glsl_main_lines.size() && store.glsl_main_lines[nth_in_file] != line; ++nth_in_file);\n //printf(\"glsl_main %d at line %d\\n\", nth_in_file, line);\n }\n else {\n char name_buffer[256];\n get_cache_name(name_buffer, path, line);\n FILE* file = fopen(name_buffer, \"rb\");\n fseek(file, 0, SEEK_END);\n size_t size = size_t(ftell(file)) + 1;\n char* cache = new char[size];\n cache[size - 1] = '\\0';\n\n fseek(file, 0, SEEK_SET);\n fread(cache, 1, size - 1, file);\n fclose(file);\n\n while (*cache != '\\0' && *cache != '\\n') {\n include_files.push_back(cache);\n while (*cache != '\\0' && *cache != ',') cache++;\n if (*cache != '\\0') {\n *cache = '\\0';\n cache++;\n }\n }\n\n cached = cache+1;\n }\n }\n\n bool update(SourceStore& store) {\n callbacks.clear();\n extensions.clear();\n version = nullptr;\n inline_glsl::current_callbacks = &callbacks;\n inline_glsl::extensions = &extensions;\n inline_glsl::version = &version;\n if (cached) return false;\n store.update(path);\n uint old_iteration = iteration;\n iteration = store.iteration;\n return old_iteration != iteration;\n }\n ~ShaderStore() { delete[] cached; }\n };\n\n struct Extension {\n const char* ext;\n Extension(const char* ext) : ext(ext) {}\n ~Extension() { inline_glsl::extensions->push_back(ext); }\n };\n struct Version {\n const char* version;\n Version(const char* version) : version(version) {}\n ~Version() { *inline_glsl::version = version; }\n };\n}\nstruct Shader {\n uint unique_id = 0; bool changed = false;\n inline_glsl::ShaderStore* store = nullptr;\n Shader() {}\n Shader(inline_glsl::ShaderStore& shader, inline_glsl::SourceStore& source) {\n changed = shader.update(source);\n unique_id = shader.unique_id;\n store = &shader;\n }\n};\n\nnamespace inline_glsl {\n struct Program {\n GLuint obj = 0, vao = 0, fbo = 0;\n };\n\n struct ProgramEntry {\n long ids[6] = { 0 };\n Program p;\n };\n\n static std::vector programs;\n void useShader(const Shader& compute, const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment, std::vector& programs, ShaderState& shader_state, SourceStore& store);\n\n\n template\n struct ArgStore {\n const char* name;\n GLuint location, program;\n T item;\n ArgStore(const char* name, T i) : name(name), item(i) {\n //printf(\"retainer for %s\\n\", name);\n }\n };\n\n using glsl::same, glsl::Field, glsl::Rows;\n\n template\n constexpr bool is_image = false;\n template\n constexpr bool is_image> = true;\n\n struct Arg {\n template\n void findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"glGetUniformLocation(%s)\\n\", store.name);\n store.location = glGetUniformLocation(shader_state.program, store.name);\n }\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"glGetUniformLocation(%s)\\n\", store.name);\n store.location = glGetUniformLocation(shader_state.program, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniform1i(store.location, shader_state.texture_unit);\n if constexpr (shadow) {\n glTextureParameteri(store.item, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);\n glTextureParameteri(store.item, GL_TEXTURE_COMPARE_FUNC, GL_LESS);\n }\n }\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n store.location = glGetUniformLocation(shader_state.program, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniform1i(store.location, shader_state.image_unit);\n }\n void findLocation(ShaderState& shader_state, ArgStore& store);\n void findLocation(ShaderState& shader_state, ArgStore& store);\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"find location of vertex attribute '%s'\\n\", store.name);\n store.location = glGetAttribLocation(shader_state.program, store.name);\n if(store.location!= GL_INVALID_INDEX)\n glEnableVertexAttribArray(store.location);\n }\n void findLocation(ShaderState& shader_state, ArgStore& store);\n void findLocation(ShaderState& shader_state, ArgStore& store);\n\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n template\n void bind(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"bind vertex attribute '%s'\\n\", store.name);\n glBindBuffer(GL_ARRAY_BUFFER, store.item);\n\n static_assert(same, float> || same, int> || same,uint>, \"attribute base type not supported\");\n if constexpr (same, float>)\n glVertexAttribPointer(store.location, Rows, store.item.type, store.item.normalized, store.item.stride, (void*)(size_t)store.item.offset);\n else\n glVertexAttribIPointer(store.location, Rows, store.item.type, store.item.stride, (void*)(size_t)store.item.offset);\n }\n\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n\n template\n void bind(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"bind sampler2D '%s'\\n\", store.name);\n glBindTextureUnit(shader_state.texture_unit, store.item);\n shader_state.texture_unit++;\n }\n template\n void bind(ShaderState& shader_state, ArgStore>& store, GLuint access, GLuint format) {\n //printf(\"bind image2D '%s'\\n\", store.name);\n if (access == 1) access = GL_READ_ONLY;\n else if (access == 2) access = GL_WRITE_ONLY;\n else access = GL_READ_WRITE;\n\n bool layered = store.item.layer == GL_INVALID_INDEX;\n GLint tex_format, tex_size, bind_size;\n glGetTextureLevelParameteriv(store.item, store.item.level, GL_TEXTURE_INTERNAL_FORMAT, &tex_format);\n glGetInternalformativ(type, tex_format, GL_IMAGE_TEXEL_SIZE, 1, &tex_size);\n glGetInternalformativ(type, format, GL_IMAGE_TEXEL_SIZE, 1, &bind_size);\n if (tex_size != bind_size) {\n printf(\"warning: texture and shader image have different texel sizes\\n\");\n#ifdef _WIN32\n __debugbreak();\n#endif\n }\n glBindImageTexture(shader_state.image_unit, store.item, store.item.level, layered, layered ? 0 : store.item.layer, access, format);\n shader_state.image_unit++;\n }\n\n Func func;\n template\n Arg(volatile ArgStore& store_, const U& j) : func([&, j, state = shader_state](ShaderState& shader_state) {\n ArgStore& store = const_cast&>(store_); // volatile is a legit keyword for images and buffers; the variable is not actually volatile so we cast it away\n\n if (shader_state.rebuilt || store.program != shader_state.program) {\n store.program = shader_state.program;\n findLocation(shader_state, store);\n }\n\n store.item = j;\n if (store.location != -1)\n if constexpr (!is_image)\n bind(shader_state, store);\n else\n bind(shader_state, store, state.image_access, state.image_format);\n }) {}\n\n ~Arg() { current_callbacks->push_back(std::move(func)); }\n };\n}\n\n#define UNIQUE_(a, b) ___ ## a ## b\n#define UNIQUE(a, b) UNIQUE_(a, b)\n\n#define REPEAT1(m, a) m(a)\n#define REPEAT2(m, a, b) m(a), m(b)\n#define REPEAT3(m, a, b, c) m(a), m(b), m(c)\n#define REPEAT4(m, a, b, c, d) m(a), m(b), m(c), m(d)\n#define REPEAT5(m, a, b, c, d, e) m(a), m(b), m(c), m(d), m(e)\n#define REPEAT6(m, a, b, c, d, e, f) m(a), m(b), m(c), m(d), m(e), m(f)\n#define REPEAT7(m, a, b, c, d, e, f, g) m(a), m(b), m(c), m(d), m(e), m(f), m(g)\n#define REPEAT8(m, a, b, c, d, e, f, g, h) m(a), m(b), m(c), m(d), m(e), m(f), m(g), m(h)\n\n#define SELECT(a, b, c, d, e, f, g, h, macro, ...) macro\n#define REPEAT(...) SELECT(__VA_ARGS__, REPEAT8, REPEAT7, REPEAT6, REPEAT5, REPEAT4, REPEAT3, REPEAT2, REPEAT1)\n\n\n#define STORE(a) UNIQUE(a,0)(#a, a)\n#define ARG(a) UNIQUE(a##_,0)(UNIQUE(a, 0), (decltype(UNIQUE(a,0).item))a)\n#define SHADOW(a) a = {}\n\n#define UNIFORM static inline_glsl::ArgStore<\n#define BUFFER static inline_glsl::ArgStore REPEAT(__VA_ARGS__)(STORE, __VA_ARGS__); inline_glsl::Arg REPEAT(__VA_ARGS__)(ARG, __VA_ARGS__); const FIRSTTYPE(__VA_ARGS__, 0) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__); inline_glsl::shader_state.image_access = 0\n#define BIND_BLOCK(a) > UNIQUE(a,0)(#a, a); inline_glsl::Arg UNIQUE(a##_,0)(UNIQUE(a,0), (decltype(UNIQUE(a,0).item))a); inline_glsl::shader_state.image_access = 0; union\n\n// bind(uniform_1, uniform_2, ...)\n#define bind(...) BIND(__VA_ARGS__)\n\n// bind_block(ssbo/ubo) {...};\n#define bind_block(a) BIND_BLOCK(a)\n\n#define DECL_TARGET_(a) UNIQUE(a##_,0)(#a, a)\n#define SELECT_TARGET_DECLARE_(...) REPEAT(__VA_ARGS__)(DECL_TARGET_, __VA_ARGS__)\n\n#define DECL_TARGET(a) UNIQUE(a,0)(#a, a)\n#define SELECT_TARGET_DECLARE(...) REPEAT(__VA_ARGS__)(DECL_TARGET, __VA_ARGS__)\n\n#define TARGET_SETTER(a) UNIQUE(a##_,0)(UNIQUE(a, 0), Target(a))\n#define SELECT_TARGET_SET(...) REPEAT(__VA_ARGS__)(TARGET_SETTER, __VA_ARGS__)\n\n#define SET_ATTR(a) UNIQUE(a##_,0)(UNIQUE(a, 0), Attribute(a))\n#define SELECT_ATTRIB_SET(...) REPEAT(__VA_ARGS__)(SET_ATTR, __VA_ARGS__)\n\n\n#define BIND_ATTRIBUTE(...) UNIQUE(type, __LINE__);(void)UNIQUE(type, __LINE__); static inline_glsl::ArgStore> SELECT_TARGET_DECLARE(__VA_ARGS__); inline_glsl::Arg SELECT_ATTRIB_SET(__VA_ARGS__); const decltype(UNIQUE(type, __LINE__)) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__)\n#define BIND_TARGET(...) UNIQUE(type, __LINE__);(void)UNIQUE(type, __LINE__); static inline_glsl::ArgStore SELECT_TARGET_DECLARE(__VA_ARGS__); inline_glsl::Arg SELECT_TARGET_SET(__VA_ARGS__); decltype(UNIQUE(type, __LINE__)) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__)\n\n// bind_attribute(attribute_1, attribute_2, ...)\n#define bind_attribute(...) BIND_ATTRIBUTE(__VA_ARGS__)\n\n// bind_target(texture_1, texture_2, ...)\n#define bind_target(...) BIND_TARGET(__VA_ARGS__)\n\n#define glsl_func(name) *UNIQUE(type, __LINE__); (void)(UNIQUE(type, __LINE__)); auto name = [&]\n\n#define in\n#define out\n\n#define arg_in(type) type\n#define arg_out(type) type&\n#define arg_inout(type) type&\n\n#define flat\n#define noperspective\n#define smooth\n\n#define layout(...) __VA_ARGS__;\n\n#define std140 0\n#define std430 0\n\n#define shared\n\n#define glsl_extension(name, behavior) inline_glsl::Extension _##name(\"#extension \" #name \" : \" #behavior \"\\n\")\n#define glsl_version(version) inline_glsl::Version glsl_version(\"#version \" #version \"\\n\")\n#define glsl_subgroup(behavior) \\\n glsl_extension(GL_KHR_shader_subgroup_basic, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_vote, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_ballot, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_arithmetic, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_shuffle, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_shuffle_relative, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_clustered, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_quad, behavior)\n\ninline unsigned location, binding, component, offset, vertices, max_vertices, primitive, invocations, local_size_x, local_size_y, local_size_z;\ninline unsigned points, lines, lines_adjacency, triangles, triangles_adjacency, line_strip, triangle_strip;\n\n#define IMAGE_FORMAT(a) inline_glsl::shader_state.image_format = a\ntemplate\nstruct DynamicArray {\n T val;\n T& operator[](int){ return val; }\n int length() { return 0; }\n};\n#define dynamic_array(type, name) DynamicArray name;\n\n#define arg_layout(...)\n\n#define r11f_g11f_b10f IMAGE_FORMAT(GL_R11F_G11F_B10F)\n#define rgb10_a2 IMAGE_FORMAT(GL_RGB10_A2)\n#define rgba32f IMAGE_FORMAT(GL_RGBA32F)\n#define rgba16f IMAGE_FORMAT(GL_RGBA16F)\n#define rgba16 IMAGE_FORMAT(GL_RGBA16)\n#define rgba8 IMAGE_FORMAT(GL_RGBA8)\n#define rg32f IMAGE_FORMAT(GL_RG32F)\n#define rg16f IMAGE_FORMAT(GL_RG16F)\n#define rg16 IMAGE_FORMAT(GL_RG16)\n#define rg8 IMAGE_FORMAT(GL_RG8)\n#define r32f IMAGE_FORMAT(GL_R32F)\n#define r16f IMAGE_FORMAT(GL_R16F)\n#define r16 IMAGE_FORMAT(GL_R16)\n#define r8 IMAGE_FORMAT(GL_R8)\n#define rgba16_snorm IMAGE_FORMAT(GL_RGBA16_SNORM)\n#define rgba8_snorm IMAGE_FORMAT(GL_RGBA8_SNORM)\n#define rg16_snorm IMAGE_FORMAT(GL_RG16_SNORM)\n#define rg8_snorm IMAGE_FORMAT(GL_RG8_SNORM)\n#define r16_snorm IMAGE_FORMAT(GL_R16_SNORM)\n#define r8_snorm IMAGE_FORMAT(GL_R8_SNORM)\n\n#define rgba32i IMAGE_FORMAT(GL_RGBA32I)\n#define rgba16i IMAGE_FORMAT(GL_RGBA16I)\n#define rgba8i IMAGE_FORMAT(GL_RGBA8I)\n#define rg32i IMAGE_FORMAT(GL_RG32I)\n#define rg16i IMAGE_FORMAT(GL_RG16I)\n#define rg8i IMAGE_FORMAT(GL_RG8I)\n#define r32i IMAGE_FORMAT(GL_R32I)\n#define r16i IMAGE_FORMAT(GL_R16I)\n#define r8i IMAGE_FORMAT(GL_R8I)\n\n\n#define rgb10_a2ui IMAGE_FORMAT(GL_RGB10_A2UI)\n#define rgba32ui IMAGE_FORMAT(GL_RGBA32UI)\n#define rgba16ui IMAGE_FORMAT(GL_RGBA16UI)\n#define rgba8ui IMAGE_FORMAT(GL_RGBA8UI)\n#define rg32ui IMAGE_FORMAT(GL_RG32UI)\n#define rg16ui IMAGE_FORMAT(GL_RG16UI)\n#define rg8ui IMAGE_FORMAT(GL_RG8UI)\n#define r32ui IMAGE_FORMAT(GL_R32UI)\n#define r16ui IMAGE_FORMAT(GL_R16UI)\n#define r8ui IMAGE_FORMAT(GL_R8UI)\n\n#define READONLY inline_glsl::shader_state.image_access |= 1;\n#define readonly READONLY\n#define WRITEONLY inline_glsl::shader_state.image_access |= 2;\n#define writeonly WRITEONLY\n\n#define coherent\n#define restrict\n\n#define early_fragment_tests\n\n#define glsl_function\n#define glsl_global\n\n#define EmitVertex()\n#define EndPrimitive()\n#define EmitStreamVertex()\n\n#define GLSL_MAIN ();static inline_glsl::ShaderStore __s(__FILE__, __LINE__, inline_glsl::store); return Shader(__s, inline_glsl::store); if constexpr(false)\n#define glsl_main() GLSL_MAIN\n\n#define BIND_DEPTH(a) ();static inline_glsl::ArgStore UNIQUE(a,__LINE__)(#a, a); inline_glsl::Arg UNIQUE(a##_,__LINE__)(UNIQUE(a, __LINE__), DepthTarget(a))\n// bind_depth(texture)\n#define bind_depth(a) BIND_DEPTH(a)\n\nstatic void useShader(const Shader& compute) {\n inline_glsl::useShader(compute, Shader{}, Shader{}, Shader{}, Shader{}, Shader{}, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, Shader{}, Shader{}, Shader{}, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& geometry, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, geometry, Shader{}, Shader{}, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& control, const Shader& evaluation, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, Shader{}, control, evaluation, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, geometry, control, evaluation, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\n\ninline const Texture<> screen = {};\ninline const Texture<> screen_depth = {};\n"}, {"path": "impl/shader_types.h", "language": "c", "loc": 354, "comment_density": 0.008, "code": "#pragma once\n\n#include \n#include \"gl_helpers.h\"\n\ntemplate\nstruct Image {\n GLuint obj, level, layer;\n Image() : obj(0) { }\n template\n Image(const Texture& t) : obj(t), level(t.level), layer(t.layer) { }\n operator int() { return obj; }\n bool operator !=(const Image& other) {\n return obj != other.obj;\n }\n};\n\n#define IMAGEBASIC(name, sizetype, prefix, ...)\\\ninline sizetype imageSize(prefix##name image) { return {}; }\\\ninline prefix##vec4 imageLoad(prefix##name image, __VA_ARGS__) { return {}; }\\\ninline void imageStore(prefix##name image, __VA_ARGS__, prefix##vec4 data) { }\\\n\n#define IMAGEATOMIC(func, name, ...)\\\ninline int func(i##name, __VA_ARGS__, int data){ return {}; }\\\ninline uint func(u##name, __VA_ARGS__, uint data){ return {}; }\n\n#define IMAGEDEF(name, glenum, sizetype, ...)\\\nusing name = Image < glenum, float>;\\\nusing i ## name = Image < glenum, int>;\\\nusing u ## name = Image < glenum, uint>;\\\nIMAGEBASIC(name, sizetype, , __VA_ARGS__)\\\nIMAGEBASIC(name, sizetype, i, __VA_ARGS__)\\\nIMAGEBASIC(name, sizetype, u, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicAdd, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicMin, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicMax, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicAnd, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicOr, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicXor, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicExchange, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicCompSwap, name, __VA_ARGS__)\n\nIMAGEDEF(image1D, GL_TEXTURE_1D, int, int P)\nIMAGEDEF(image2D, GL_TEXTURE_2D, ivec2, ivec2 P)\nIMAGEDEF(image3D, GL_TEXTURE_3D, ivec3, ivec3 P)\nIMAGEDEF(imageCube, GL_TEXTURE_CUBE_MAP, ivec2, ivec3 P)\nIMAGEDEF(image2DRect, GL_TEXTURE_RECTANGLE, ivec2, ivec2 P)\nIMAGEDEF(image1DArray, GL_TEXTURE_1D_ARRAY, ivec2, ivec2 P)\nIMAGEDEF(image2DArray, GL_TEXTURE_2D_ARRAY, ivec3, ivec3 P)\nIMAGEDEF(imageCubeArray, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3, ivec3 P)\nIMAGEDEF(imageBuffer, GL_TEXTURE_BUFFER, int, int P)\nIMAGEDEF(image2DMS, GL_TEXTURE_2D_MULTISAMPLE, ivec2, ivec2 P, int sample)\nIMAGEDEF(image2DMSArray, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, ivec3, ivec3 P, int sample)\n\ninline int imageSamples(image2DMS image) { return 0; }\ninline int imageSamples(iimage2DMS image) { return 0; }\ninline int imageSamples(uimage2DMS image) { return 0; }\ninline int imageSamples(image2DMSArray image) { return 0; }\ninline int imageSamples(iimage2DMSArray image) { return 0; }\ninline int imageSamples(uimage2DMSArray image) { return 0; }\n\n#undef IMAGEBASIC\n#undef IMAGEATOMIC\n#undef IMAGEDEF\n\ntemplate\nstruct Sampler {\n GLuint obj;\n Sampler() : obj(0) { }\n Sampler(uint64_t) : obj(0) { }\n template\n Sampler(const Texture& t) : obj(t) {}\n operator int() { return obj; }\n bool operator !=(const Sampler& other) {\n return obj != other.obj;\n }\n};\n\n#define COMMA ,\n\n#define SAMPLEFUNC(func, name, params)\\\ninline vec4 func(name sampler params) {return {};}\\\ninline ivec4 func(i##name sampler params) {return {};}\\\ninline uvec4 func(u##name sampler params) {return {};}\n\n#define TEXFUNC(func, name, params)\\\ninline func(name sampler params) { return {}; }\\\ninline func(i##name sampler params) { return {}; }\\\ninline func(u##name sampler params) { return {}; }\n\n#define MIPPABLE(name, glenum, sizetype)\\\nusing name = Sampler;\\\nusing i ## name= Sampler;\\\nusing u ## name = Sampler;\\\nTEXFUNC(sizetype textureSize, name,COMMA int lod)\\\nTEXFUNC(int textureQueryLevels, name,)\n\n#define UNMIPPABLE(name, glenum, sizetype)\\\nusing name = Sampler;\\\nusing i ## name= Sampler;\\\nusing u ## name = Sampler;\\\nTEXFUNC(sizetype textureSize, name,)\n\nMIPPABLE(sampler1D, GL_TEXTURE_1D, int)\nMIPPABLE(sampler2D, GL_TEXTURE_2D, ivec2)\nMIPPABLE(sampler3D, GL_TEXTURE_3D, ivec3)\nMIPPABLE(samplerCube, GL_TEXTURE_CUBE_MAP, ivec2)\nMIPPABLE(sampler1DArray, GL_TEXTURE_1D_ARRAY, ivec2)\nMIPPABLE(sampler2DArray, GL_TEXTURE_2D_ARRAY, ivec3)\nMIPPABLE(samplerCubeArray, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3)\n\nUNMIPPABLE(sampler2DRect, GL_TEXTURE_RECTANGLE, ivec2)\nUNMIPPABLE(samplerBuffer, GL_TEXTURE_BUFFER, int)\nUNMIPPABLE(sampler2DMS, GL_TEXTURE_2D_MULTISAMPLE, ivec2)\nUNMIPPABLE(sampler2DMSArray, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, ivec3)\n\ninline int textureSamples(sampler2DMS image) { return 0; }\ninline int textureSamples(isampler2DMS image) { return 0; }\ninline int textureSamples(usampler2DMS image) { return 0; }\ninline int textureSamples(sampler2DMSArray image) { return 0; }\ninline int textureSamples(isampler2DMSArray image) { return 0; }\ninline int textureSamples(usampler2DMSArray image) { return 0; }\n\n#define MIPPABLE_SHADOW(name, glenum, sizetype)\\\nusing name = Sampler;\\\ninline sizetype textureSize(name sampler, int lod) {return {};}\\\ninline int textureQueryLevels(name sampler) {return 0;}\n\nMIPPABLE_SHADOW(sampler1DShadow, GL_TEXTURE_1D, int)\nMIPPABLE_SHADOW(sampler2DShadow, GL_TEXTURE_2D, ivec2)\nMIPPABLE_SHADOW(samplerCubeShadow, GL_TEXTURE_CUBE_MAP, ivec2)\nMIPPABLE_SHADOW(sampler1DArrayShadow, GL_TEXTURE_1D_ARRAY, ivec2)\nMIPPABLE_SHADOW(sampler2DArrayShadow, GL_TEXTURE_2D_ARRAY, ivec3)\nMIPPABLE_SHADOW(samplerCubeArrayShadow, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3)\nusing sampler2DRectShadow = Sampler;\ninline ivec2 textureSize(sampler2DRectShadow sampler) { return {}; }\n\n\nSAMPLEFUNC(texelFetch, sampler1D, COMMA int P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2D, COMMA ivec2 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler3D, COMMA ivec3 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2DRect, COMMA ivec2 P)\nSAMPLEFUNC(texelFetch, sampler1DArray, COMMA ivec2 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2DArray, COMMA ivec3 P COMMA int lod)\nSAMPLEFUNC(texelFetch, samplerBuffer, COMMA int P)\nSAMPLEFUNC(texelFetch, sampler2DMS, COMMA ivec2 P COMMA int sample)\nSAMPLEFUNC(texelFetch, sampler2DMSArray, COMMA ivec3 P COMMA int sample)\n\nSAMPLEFUNC(texelFetchOffset, sampler1D, COMMA int P COMMA int lod COMMA int offset)\nSAMPLEFUNC(texelFetchOffset, sampler2D, COMMA ivec2 P COMMA int lod COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler3D, COMMA ivec3 P COMMA int lod COMMA ivec3 offset)\nSAMPLEFUNC(texelFetchOffset, sampler2DRect, COMMA ivec2 P COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler1DArray, COMMA ivec2 P COMMA int lod COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler2DArray, COMMA ivec3 P COMMA int lod COMMA ivec3 offset)\n\nSAMPLEFUNC(texture, sampler1D, COMMA float P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2D, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler3D, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, samplerCube, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler1DArray, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2DArray, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, samplerCubeArray, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2DRect, COMMA vec2 P)\ninline float texture(sampler1DShadow sampler, vec3 P, float bias = .0f) { return {}; } // ... why does this take in a vec3???\ninline float texture(sampler2DShadow sampler, vec3 P, float bias = .0f) { return {}; }\ninline float texture(samplerCubeShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float texture(sampler1DArrayShadow sampler, vec3 P, float bias = .0f) { return {}; }\ninline float texture(sampler2DArrayShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float texture(sampler2DRectShadow sampler, vec3 P) { return {}; }\ninline float texture(samplerCubeArrayShadow sampler, vec4 P, float compare) { return {}; }\n\nSAMPLEFUNC(textureGather, sampler2D, COMMA vec2 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, sampler2DArray, COMMA vec3 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, samplerCube, COMMA vec3 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, samplerCubeArray, COMMA vec4 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, sampler2DRect, COMMA vec2 P COMMA int comp = 0)\ninline float textureGather(sampler2DShadow sampler, vec2 P, float refZ) { return {}; }\ninline float textureGather(sampler2DArrayShadow sampler, vec3 P, float refZ) { return {}; }\ninline float textureGather(samplerCubeShadow sampler, vec3 P, float refZ) { return {}; }\ninline float textureGather(samplerCubeArrayShadow sampler, vec4 P, float refZ) { return {}; }\ninline float textureGather(sampler2DRectShadow sampler, vec2 P, float refZ) { return {}; }\n\nSAMPLEFUNC(textureGatherOffset, sampler2D, COMMA vec2 P COMMA ivec2 offset COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffset, sampler2DArray, COMMA vec3 P COMMA ivec2 offset COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffset, sampler2DRect, COMMA vec2 P COMMA ivec2 offset COMMA int comp = 0)\ninline float textureGatherOffset(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offset) { return {}; }\ninline float textureGatherOffset(sampler2DArrayShadow sampler, vec3 P, float refZ, ivec2 offset) { return {}; }\ninline float textureGatherOffset(sampler2DRectShadow sampler, vec2 P, float refZ, ivec2 offset) { return {}; }\n\n\nSAMPLEFUNC(textureGatherOffsets, sampler2D, COMMA vec2 P COMMA ivec2 offsets[4] COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffsets, sampler2DArray, COMMA vec3 P COMMA ivec2 offsets[4] COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffsets, sampler2DRect, COMMA vec2 P COMMA ivec2 offsets[4] COMMA int comp = 0)\ninline float textureGatherOffsets(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offsets[4]) { return {}; }\ninline float textureGatherOffsets(sampler2DArrayShadow sampler, vec3 P, float refZ, ivec2 offsets[4]) { return {}; }\ninline float textureGatherOffsets(sampler2DRectShadow sampler, vec2 P, float refZ, ivec2 offsets[4]) { return {}; }\n\nSAMPLEFUNC(textureGrad, sampler1D, COMMA float P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureGrad, sampler2D, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureGrad, sampler3D, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, samplerCube, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, sampler1DArray, COMMA vec2 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureGrad, sampler2DArray, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureGrad, samplerCubeArray, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, sampler2DRect, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy)\ninline float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy) { return {}; }\ninline float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy) { return {}; }\ninline float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy) { return {}; }\ninline float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureGrad(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy) { return {}; }\n\nSAMPLEFUNC(textureGradOffset, sampler1D, COMMA float P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureGradOffset, sampler2D, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureGradOffset, sampler3D, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy COMMA ivec3 offset)\nSAMPLEFUNC(textureGradOffset, sampler1DArray, COMMA vec2 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureGradOffset, sampler2DArray, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureGradOffset, sampler2DRect, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\ninline float textureGradOffset(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureGradOffset(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureGradOffset(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureGradOffset(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureGradOffset(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureLod, sampler1D, COMMA float P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler2D, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler3D, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, samplerCube, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler1DArray, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler2DArray, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, samplerCubeArray, COMMA vec4 P COMMA float lod)\ninline float textureLod(sampler1DShadow sampler, vec3 P, float lod) { return {}; }\ninline float textureLod(sampler2DShadow sampler, vec3 P, float lod) { return {}; }\ninline float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod) { return {}; }\n\nSAMPLEFUNC(textureLodOffset, sampler1D, COMMA float P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureLodOffset, sampler2D, COMMA vec2 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureLodOffset, sampler3D, COMMA vec3 P COMMA float lod COMMA ivec3 offset)\nSAMPLEFUNC(textureLodOffset, sampler1DArray, COMMA vec2 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureLodOffset, sampler2DArray, COMMA vec3 P COMMA float lod COMMA ivec2 offset)\ninline float textureLodOffset(sampler1DShadow sampler, vec3 P, float lod, int offset) { return {}; }\ninline float textureLodOffset(sampler2DShadow sampler, vec3 P, float lod, ivec2 offset) { return {}; }\ninline float textureLodOffset(sampler1DArrayShadow sampler, vec3 P, float lod, int offset) { return {}; }\n\nSAMPLEFUNC(textureProjLod, sampler1D, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler1D, COMMA vec4 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler2D, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler2D, COMMA vec4 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler3D, COMMA vec4 P COMMA float lod)\ninline float textureProjLod(sampler1DShadow sampler, vec4 P, float lod) { return {}; }\ninline float textureProjLod(sampler2DShadow sampler, vec4 P, float lod) { return {}; }\n\nSAMPLEFUNC(textureProjLodOffset, sampler1D, COMMA vec2 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureProjLodOffset, sampler1D, COMMA vec4 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureProjLodOffset, sampler2D, COMMA vec3 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureProjLodOffset, sampler2D, COMMA vec4 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureProjLodOffset, sampler3D, COMMA vec4 P COMMA float lod COMMA ivec3 offset)\ninline float textureProjLodOffset(sampler1DShadow sampler, vec4 P, float lod, int offset) { return {}; }\ninline float textureProjLodOffset(sampler2DShadow sampler, vec4 P, float lod, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProj, sampler1D, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler1D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2D, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler3D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2DRect, COMMA vec3 P)\nSAMPLEFUNC(textureProj, sampler2DRect, COMMA vec4 P)\ninline float textureProj(sampler1DShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float textureProj(sampler2DShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float textureProj(sampler2DRectShadow sampler, vec4 P) { return {}; }\n\nSAMPLEFUNC(textureOffset, sampler1D, COMMA float P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2D, COMMA vec2 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler3D, COMMA vec3 P COMMA ivec3 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler1DArray, COMMA vec2 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2DArray, COMMA vec3 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2DRect, COMMA vec2 P COMMA ivec2 offset)\ninline float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias = .0f) { return {}; } // ... why does this take in a vec3???\ninline float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler2DArrayShadow sampler, vec4 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler2DRectShadow sampler, vec3 P, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProjGrad, sampler1D, COMMA vec2 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureProjGrad, sampler1D, COMMA vec4 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2D, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2D, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler3D, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2DRect, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2DRect, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy)\ninline float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy) { return {}; }\ninline float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureProjGrad(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\n\nSAMPLEFUNC(textureProjGradOffset, sampler1D, COMMA vec2 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureProjGradOffset, sampler1D, COMMA vec4 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2D, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2D, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler3D, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy COMMA ivec3 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2DRect, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2DRect, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\ninline float textureProjGradOffset(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureProjGradOffset(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureProjGradOffset(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProjOffset, sampler1D, COMMA vec2 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler1D, COMMA vec4 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2D, COMMA vec3 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2D, COMMA vec4 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler3D, COMMA vec4 P COMMA ivec3 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2DRect, COMMA vec3 P COMMA ivec2 offset)\nSAMPLEFUNC(textureProjOffset, sampler2DRect, COMMA vec4 P COMMA ivec2 offset)\ninline float textureProjOffset(sampler1DShadow sampler, vec4 P, int offset, float bias = .0f) { return {}; }\ninline float textureProjOffset(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureProjOffset(sampler2DRectShadow sampler, vec4 P, ivec2 offset) { return {}; }\n\nTEXFUNC(vec2 textureQueryLod, sampler1D, COMMA float P)\nTEXFUNC(vec2 textureQueryLod, sampler2D, COMMA vec2 P)\nTEXFUNC(vec2 textureQueryLod, sampler3D, COMMA vec3 P)\nTEXFUNC(vec2 textureQueryLod, samplerCube, COMMA vec3 P)\nTEXFUNC(vec2 textureQueryLod, sampler1DArray, COMMA float P)\nTEXFUNC(vec2 textureQueryLod, sampler2DArray, COMMA vec2 P)\nTEXFUNC(vec2 textureQueryLod, samplerCubeArray, COMMA vec3 P)\ninline vec2 textureQueryLod(sampler1DShadow sampler, float P) { return {}; } // ... why does this take in a vec3???\ninline vec2 textureQueryLod(sampler2DShadow sampler, vec2 P) { return {}; }\ninline vec2 textureQueryLod(samplerCubeShadow sampler, vec3 P) { return {}; }\ninline vec2 textureQueryLod(sampler1DArrayShadow sampler, float P) { return {}; }\ninline vec2 textureQueryLod(sampler2DArrayShadow sampler, vec2 P) { return {}; }\ninline vec2 textureQueryLod(samplerCubeArrayShadow sampler, vec3 P) { return {}; }\n\n#undef COMMA\n#undef SAMPLEFUNC\n#undef TEXFUNC\n#undef MIPPABLE\n#undef UNMIPPABLE\n#undef MIPPABLE_SHADOW\n\nstruct Target {\n GLuint obj, level, layer, type;\n Target() : obj(0) {}\n template\n Target(const Texture& t) : obj(t), level(t.level), layer(t.layer), type(t.target) { }\n operator int() { return obj; }\n bool operator !=(const Target& other) {\n return obj != other.obj;\n }\n};\n\nstruct DepthTarget {\n GLuint obj, level, layer, type;\n template\n DepthTarget(const Texture& t) : obj(t), level(t.level), layer(t.layer), type(t.target) { }\n operator int() { return obj; }\n bool operator !=(const DepthTarget& other) {\n return obj != other.obj;\n }\n};\n\nstruct UBO {\n GLuint obj;\n UBO(const Buffer& t) : obj(t) {}\n operator int() { return obj; };\n bool operator!=(const UBO& other) {\n return obj != other.obj;\n }\n};\nstruct SSBO {\n GLuint obj;\n SSBO(const Buffer& t) : obj(t) {}\n operator int() { return obj; };\n bool operator!=(const SSBO& other) {\n return obj != other.obj;\n }\n};\n\ntemplate\nstruct Attribute {\n GLuint obj, stride, offset, type;\n bool normalized;\n Attribute(const Buffer& b, int stride, int offset = 0, GLuint type = -1, bool normalized = false)\n : obj(b), stride(stride), offset(offset), type(type), normalized(normalized)\n {\n if (this->type == -1) {\n if constexpr (glsl::same, float>)\n this->type = GL_FLOAT;\n else if constexpr (glsl::same, int>)\n this->type = GL_INT;\n else if constexpr (glsl::same, uint>)\n this->type = GL_UNSIGNED_INT;\n else\n printf(\"vertex attribute type not given and couldn't be deduced from T in Attribute\\n\");\n }\n }\n\n operator int() { return obj; }\n bool operator!=(const Attribute& other) {\n return obj != other.obj || stride != other.stride || offset != other.offset || type != other.type || normalized != other.normalized;\n }\n};\n"}, {"path": "impl/ssgl.h", "language": "c", "loc": 4, "comment_density": 0.0, "code": "#pragma once\n\n#include \"window.h\"\n#include \"inline_glsl.h\"\n#include \"gl_timing.h\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "MIT", "non_commercial": false, "comment_density": 0.023, "dedup_hash": "9942bbbbbd69206f", "has_readme": true, "build_system": "make", "dependency_count": 31, "has_demo": false} -{"id": "ssgl_utils", "source": "https://github.com/local/ssgl", "source_commit": "4d3f2977620be74782a6523fc950e98c0b7f69bb", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Utils", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "utils/gl_timing.h", "language": "c", "loc": 49, "comment_density": 0.163, "code": "#pragma once\n\n#include \n\n#include \n#include \"glext.h\"\n#include \"loadgl46.h\"\n\n// GPU timing object\nstruct TimeStamp {\n\t// todo: move construct, etc? might want map of string to stamp for global use\n\tGLint64 asynchronous;\n\tGLuint synchronousObject;\n\tmutable GLuint available = GL_FALSE;\n\tmutable GLint64 synchronous;\n\tTimeStamp() {\n\t\t// create GPU query\n\t\tglCreateQueries(GL_TIMESTAMP, 1, &synchronousObject);\n\t\tglQueryCounter(synchronousObject, GL_TIMESTAMP);\n\t\t// query CPU counter directly\n\t\tglGetInteger64v(GL_TIMESTAMP, &asynchronous);\n\t}\n\tvoid check() const {\n\t\twhile (available == GL_FALSE) {\n\t\t\tglGetQueryObjectuiv(synchronousObject, GL_QUERY_RESULT_AVAILABLE, &available);\n\t\t\tif(available == GL_TRUE)\n\t\t\t\tglGetQueryObjecti64v(synchronousObject, GL_QUERY_RESULT, &synchronous);\n\t\t}\n\t}\n\t// latency between CPU call and GPU execution, in ms\n\tdouble latency() const {\n\t\tcheck();\n\t\treturn double(synchronous - asynchronous)*1.0e-6;\n\t}\n\t~TimeStamp() {\n\t\tglDeleteQueries(1, &synchronousObject);\n\t}\n};\n\n// GPU time between two stamps, ms\ninline double operator-(const TimeStamp& end, const TimeStamp& begin) {\n\tbegin.check();\n\tend.check();\n\treturn double(end.synchronous - begin.synchronous)*1.0e-6;\n}\n\n// GPU time between two stamps, ms\ninline double gpuTime(const TimeStamp& begin, const TimeStamp& end) {\n\treturn end - begin;\n}\n\n// CPU-side time between two stamps, ms\ninline double cpuTime(const TimeStamp& begin, const TimeStamp& end) {\n\treturn double(end.asynchronous - begin.asynchronous)*1.0e-6;\n}\n"}, {"path": "utils/glext.h", "language": "c", "loc": 12484, "comment_density": 0.065}, {"path": "utils/loadgl46.cpp", "language": "cpp", "loc": 2312, "comment_density": 0.0}, {"path": "utils/loadgl46.h", "language": "c", "loc": 767, "comment_density": 0.0, "code": "#pragma once\nint loadgl();\nvoid unloadgl();\nextern PFNGLDRAWRANGEELEMENTSPROC ptr_glDrawRangeElements; void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);\nextern PFNGLTEXIMAGE3DPROC ptr_glTexImage3D; void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXSUBIMAGE3DPROC ptr_glTexSubImage3D; void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);\nextern PFNGLCOPYTEXSUBIMAGE3DPROC ptr_glCopyTexSubImage3D; void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLACTIVETEXTUREPROC ptr_glActiveTexture; void glActiveTexture(GLenum texture);\nextern PFNGLSAMPLECOVERAGEPROC ptr_glSampleCoverage; void glSampleCoverage(GLfloat value, GLboolean invert);\nextern PFNGLCOMPRESSEDTEXIMAGE3DPROC ptr_glCompressedTexImage3D; void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXIMAGE2DPROC ptr_glCompressedTexImage2D; void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXIMAGE1DPROC ptr_glCompressedTexImage1D; void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC ptr_glCompressedTexSubImage3D; void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC ptr_glCompressedTexSubImage2D; void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC ptr_glCompressedTexSubImage1D; void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLGETCOMPRESSEDTEXIMAGEPROC ptr_glGetCompressedTexImage; void glGetCompressedTexImage(GLenum target, GLint level, void *img);\nextern PFNGLCLIENTACTIVETEXTUREPROC ptr_glClientActiveTexture; void glClientActiveTexture(GLenum texture);\nextern PFNGLMULTITEXCOORD1DPROC ptr_glMultiTexCoord1d; void glMultiTexCoord1d(GLenum target, GLdouble s);\nextern PFNGLMULTITEXCOORD1DVPROC ptr_glMultiTexCoord1dv; void glMultiTexCoord1dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD1FPROC ptr_glMultiTexCoord1f; void glMultiTexCoord1f(GLenum target, GLfloat s);\nextern PFNGLMULTITEXCOORD1FVPROC ptr_glMultiTexCoord1fv; void glMultiTexCoord1fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD1IPROC ptr_glMultiTexCoord1i; void glMultiTexCoord1i(GLenum target, GLint s);\nextern PFNGLMULTITEXCOORD1IVPROC ptr_glMultiTexCoord1iv; void glMultiTexCoord1iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD1SPROC ptr_glMultiTexCoord1s; void glMultiTexCoord1s(GLenum target, GLshort s);\nextern PFNGLMULTITEXCOORD1SVPROC ptr_glMultiTexCoord1sv; void glMultiTexCoord1sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD2DPROC ptr_glMultiTexCoord2d; void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);\nextern PFNGLMULTITEXCOORD2DVPROC ptr_glMultiTexCoord2dv; void glMultiTexCoord2dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD2FPROC ptr_glMultiTexCoord2f; void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);\nextern PFNGLMULTITEXCOORD2FVPROC ptr_glMultiTexCoord2fv; void glMultiTexCoord2fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD2IPROC ptr_glMultiTexCoord2i; void glMultiTexCoord2i(GLenum target, GLint s, GLint t);\nextern PFNGLMULTITEXCOORD2IVPROC ptr_glMultiTexCoord2iv; void glMultiTexCoord2iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD2SPROC ptr_glMultiTexCoord2s; void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);\nextern PFNGLMULTITEXCOORD2SVPROC ptr_glMultiTexCoord2sv; void glMultiTexCoord2sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD3DPROC ptr_glMultiTexCoord3d; void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);\nextern PFNGLMULTITEXCOORD3DVPROC ptr_glMultiTexCoord3dv; void glMultiTexCoord3dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD3FPROC ptr_glMultiTexCoord3f; void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);\nextern PFNGLMULTITEXCOORD3FVPROC ptr_glMultiTexCoord3fv; void glMultiTexCoord3fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD3IPROC ptr_glMultiTexCoord3i; void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);\nextern PFNGLMULTITEXCOORD3IVPROC ptr_glMultiTexCoord3iv; void glMultiTexCoord3iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD3SPROC ptr_glMultiTexCoord3s; void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);\nextern PFNGLMULTITEXCOORD3SVPROC ptr_glMultiTexCoord3sv; void glMultiTexCoord3sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD4DPROC ptr_glMultiTexCoord4d; void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\nextern PFNGLMULTITEXCOORD4DVPROC ptr_glMultiTexCoord4dv; void glMultiTexCoord4dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD4FPROC ptr_glMultiTexCoord4f; void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\nextern PFNGLMULTITEXCOORD4FVPROC ptr_glMultiTexCoord4fv; void glMultiTexCoord4fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD4IPROC ptr_glMultiTexCoord4i; void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);\nextern PFNGLMULTITEXCOORD4IVPROC ptr_glMultiTexCoord4iv; void glMultiTexCoord4iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD4SPROC ptr_glMultiTexCoord4s; void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\nextern PFNGLMULTITEXCOORD4SVPROC ptr_glMultiTexCoord4sv; void glMultiTexCoord4sv(GLenum target, const GLshort *v);\nextern PFNGLLOADTRANSPOSEMATRIXFPROC ptr_glLoadTransposeMatrixf; void glLoadTransposeMatrixf(const GLfloat *m);\nextern PFNGLLOADTRANSPOSEMATRIXDPROC ptr_glLoadTransposeMatrixd; void glLoadTransposeMatrixd(const GLdouble *m);\nextern PFNGLMULTTRANSPOSEMATRIXFPROC ptr_glMultTransposeMatrixf; void glMultTransposeMatrixf(const GLfloat *m);\nextern PFNGLMULTTRANSPOSEMATRIXDPROC ptr_glMultTransposeMatrixd; void glMultTransposeMatrixd(const GLdouble *m);\nextern PFNGLBLENDFUNCSEPARATEPROC ptr_glBlendFuncSeparate; void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\nextern PFNGLMULTIDRAWARRAYSPROC ptr_glMultiDrawArrays; void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\nextern PFNGLMULTIDRAWELEMENTSPROC ptr_glMultiDrawElements; void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);\nextern PFNGLPOINTPARAMETERFPROC ptr_glPointParameterf; void glPointParameterf(GLenum pname, GLfloat param);\nextern PFNGLPOINTPARAMETERFVPROC ptr_glPointParameterfv; void glPointParameterfv(GLenum pname, const GLfloat *params);\nextern PFNGLPOINTPARAMETERIPROC ptr_glPointParameteri; void glPointParameteri(GLenum pname, GLint param);\nextern PFNGLPOINTPARAMETERIVPROC ptr_glPointParameteriv; void glPointParameteriv(GLenum pname, const GLint *params);\nextern PFNGLFOGCOORDFPROC ptr_glFogCoordf; void glFogCoordf(GLfloat coord);\nextern PFNGLFOGCOORDFVPROC ptr_glFogCoordfv; void glFogCoordfv(const GLfloat *coord);\nextern PFNGLFOGCOORDDPROC ptr_glFogCoordd; void glFogCoordd(GLdouble coord);\nextern PFNGLFOGCOORDDVPROC ptr_glFogCoorddv; void glFogCoorddv(const GLdouble *coord);\nextern PFNGLFOGCOORDPOINTERPROC ptr_glFogCoordPointer; void glFogCoordPointer(GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLSECONDARYCOLOR3BPROC ptr_glSecondaryColor3b; void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);\nextern PFNGLSECONDARYCOLOR3BVPROC ptr_glSecondaryColor3bv; void glSecondaryColor3bv(const GLbyte *v);\nextern PFNGLSECONDARYCOLOR3DPROC ptr_glSecondaryColor3d; void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);\nextern PFNGLSECONDARYCOLOR3DVPROC ptr_glSecondaryColor3dv; void glSecondaryColor3dv(const GLdouble *v);\nextern PFNGLSECONDARYCOLOR3FPROC ptr_glSecondaryColor3f; void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);\nextern PFNGLSECONDARYCOLOR3FVPROC ptr_glSecondaryColor3fv; void glSecondaryColor3fv(const GLfloat *v);\nextern PFNGLSECONDARYCOLOR3IPROC ptr_glSecondaryColor3i; void glSecondaryColor3i(GLint red, GLint green, GLint blue);\nextern PFNGLSECONDARYCOLOR3IVPROC ptr_glSecondaryColor3iv; void glSecondaryColor3iv(const GLint *v);\nextern PFNGLSECONDARYCOLOR3SPROC ptr_glSecondaryColor3s; void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);\nextern PFNGLSECONDARYCOLOR3SVPROC ptr_glSecondaryColor3sv; void glSecondaryColor3sv(const GLshort *v);\nextern PFNGLSECONDARYCOLOR3UBPROC ptr_glSecondaryColor3ub; void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);\nextern PFNGLSECONDARYCOLOR3UBVPROC ptr_glSecondaryColor3ubv; void glSecondaryColor3ubv(const GLubyte *v);\nextern PFNGLSECONDARYCOLOR3UIPROC ptr_glSecondaryColor3ui; void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);\nextern PFNGLSECONDARYCOLOR3UIVPROC ptr_glSecondaryColor3uiv; void glSecondaryColor3uiv(const GLuint *v);\nextern PFNGLSECONDARYCOLOR3USPROC ptr_glSecondaryColor3us; void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);\nextern PFNGLSECONDARYCOLOR3USVPROC ptr_glSecondaryColor3usv; void glSecondaryColor3usv(const GLushort *v);\nextern PFNGLSECONDARYCOLORPOINTERPROC ptr_glSecondaryColorPointer; void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLWINDOWPOS2DPROC ptr_glWindowPos2d; void glWindowPos2d(GLdouble x, GLdouble y);\nextern PFNGLWINDOWPOS2DVPROC ptr_glWindowPos2dv; void glWindowPos2dv(const GLdouble *v);\nextern PFNGLWINDOWPOS2FPROC ptr_glWindowPos2f; void glWindowPos2f(GLfloat x, GLfloat y);\nextern PFNGLWINDOWPOS2FVPROC ptr_glWindowPos2fv; void glWindowPos2fv(const GLfloat *v);\nextern PFNGLWINDOWPOS2IPROC ptr_glWindowPos2i; void glWindowPos2i(GLint x, GLint y);\nextern PFNGLWINDOWPOS2IVPROC ptr_glWindowPos2iv; void glWindowPos2iv(const GLint *v);\nextern PFNGLWINDOWPOS2SPROC ptr_glWindowPos2s; void glWindowPos2s(GLshort x, GLshort y);\nextern PFNGLWINDOWPOS2SVPROC ptr_glWindowPos2sv; void glWindowPos2sv(const GLshort *v);\nextern PFNGLWINDOWPOS3DPROC ptr_glWindowPos3d; void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLWINDOWPOS3DVPROC ptr_glWindowPos3dv; void glWindowPos3dv(const GLdouble *v);\nextern PFNGLWINDOWPOS3FPROC ptr_glWindowPos3f; void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);\nextern PFNGLWINDOWPOS3FVPROC ptr_glWindowPos3fv; void glWindowPos3fv(const GLfloat *v);\nextern PFNGLWINDOWPOS3IPROC ptr_glWindowPos3i; void glWindowPos3i(GLint x, GLint y, GLint z);\nextern PFNGLWINDOWPOS3IVPROC ptr_glWindowPos3iv; void glWindowPos3iv(const GLint *v);\nextern PFNGLWINDOWPOS3SPROC ptr_glWindowPos3s; void glWindowPos3s(GLshort x, GLshort y, GLshort z);\nextern PFNGLWINDOWPOS3SVPROC ptr_glWindowPos3sv; void glWindowPos3sv(const GLshort *v);\nextern PFNGLBLENDCOLORPROC ptr_glBlendColor; void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nextern PFNGLBLENDEQUATIONPROC ptr_glBlendEquation; void glBlendEquation(GLenum mode);\nextern PFNGLGENQUERIESPROC ptr_glGenQueries; void glGenQueries(GLsizei n, GLuint *ids);\nextern PFNGLDELETEQUERIESPROC ptr_glDeleteQueries; void glDeleteQueries(GLsizei n, const GLuint *ids);\nextern PFNGLISQUERYPROC ptr_glIsQuery; GLboolean glIsQuery(GLuint id);\nextern PFNGLBEGINQUERYPROC ptr_glBeginQuery; void glBeginQuery(GLenum target, GLuint id);\nextern PFNGLENDQUERYPROC ptr_glEndQuery; void glEndQuery(GLenum target);\nextern PFNGLGETQUERYIVPROC ptr_glGetQueryiv; void glGetQueryiv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETQUERYOBJECTIVPROC ptr_glGetQueryObjectiv; void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);\nextern PFNGLGETQUERYOBJECTUIVPROC ptr_glGetQueryObjectuiv; void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);\nextern PFNGLBINDBUFFERPROC ptr_glBindBuffer; void glBindBuffer(GLenum target, GLuint buffer);\nextern PFNGLDELETEBUFFERSPROC ptr_glDeleteBuffers; void glDeleteBuffers(GLsizei n, const GLuint *buffers);\nextern PFNGLGENBUFFERSPROC ptr_glGenBuffers; void glGenBuffers(GLsizei n, GLuint *buffers);\nextern PFNGLISBUFFERPROC ptr_glIsBuffer; GLboolean glIsBuffer(GLuint buffer);\nextern PFNGLBUFFERDATAPROC ptr_glBufferData; void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);\nextern PFNGLBUFFERSUBDATAPROC ptr_glBufferSubData; void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);\nextern PFNGLGETBUFFERSUBDATAPROC ptr_glGetBufferSubData; void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data);\nextern PFNGLMAPBUFFERPROC ptr_glMapBuffer; void * glMapBuffer(GLenum target, GLenum access);\nextern PFNGLUNMAPBUFFERPROC ptr_glUnmapBuffer; GLboolean glUnmapBuffer(GLenum target);\nextern PFNGLGETBUFFERPARAMETERIVPROC ptr_glGetBufferParameteriv; void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETBUFFERPOINTERVPROC ptr_glGetBufferPointerv; void glGetBufferPointerv(GLenum target, GLenum pname, void **params);\nextern PFNGLBLENDEQUATIONSEPARATEPROC ptr_glBlendEquationSeparate; void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);\nextern PFNGLDRAWBUFFERSPROC ptr_glDrawBuffers; void glDrawBuffers(GLsizei n, const GLenum *bufs);\nextern PFNGLSTENCILOPSEPARATEPROC ptr_glStencilOpSeparate; void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\nextern PFNGLSTENCILFUNCSEPARATEPROC ptr_glStencilFuncSeparate; void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);\nextern PFNGLSTENCILMASKSEPARATEPROC ptr_glStencilMaskSeparate; void glStencilMaskSeparate(GLenum face, GLuint mask);\nextern PFNGLATTACHSHADERPROC ptr_glAttachShader; void glAttachShader(GLuint program, GLuint shader);\nextern PFNGLBINDATTRIBLOCATIONPROC ptr_glBindAttribLocation; void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);\nextern PFNGLCOMPILESHADERPROC ptr_glCompileShader; void glCompileShader(GLuint shader);\nextern PFNGLCREATEPROGRAMPROC ptr_glCreateProgram; GLuint glCreateProgram(void);\nextern PFNGLCREATESHADERPROC ptr_glCreateShader; GLuint glCreateShader(GLenum type);\nextern PFNGLDELETEPROGRAMPROC ptr_glDeleteProgram; void glDeleteProgram(GLuint program);\nextern PFNGLDELETESHADERPROC ptr_glDeleteShader; void glDeleteShader(GLuint shader);\nextern PFNGLDETACHSHADERPROC ptr_glDetachShader; void glDetachShader(GLuint program, GLuint shader);\nextern PFNGLDISABLEVERTEXATTRIBARRAYPROC ptr_glDisableVertexAttribArray; void glDisableVertexAttribArray(GLuint index);\nextern PFNGLENABLEVERTEXATTRIBARRAYPROC ptr_glEnableVertexAttribArray; void glEnableVertexAttribArray(GLuint index);\nextern PFNGLGETACTIVEATTRIBPROC ptr_glGetActiveAttrib; void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\nextern PFNGLGETACTIVEUNIFORMPROC ptr_glGetActiveUniform; void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\nextern PFNGLGETATTACHEDSHADERSPROC ptr_glGetAttachedShaders; void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);\nextern PFNGLGETATTRIBLOCATIONPROC ptr_glGetAttribLocation; GLint glGetAttribLocation(GLuint program, const GLchar *name);\nextern PFNGLGETPROGRAMIVPROC ptr_glGetProgramiv; void glGetProgramiv(GLuint program, GLenum pname, GLint *params);\nextern PFNGLGETPROGRAMINFOLOGPROC ptr_glGetProgramInfoLog; void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLGETSHADERIVPROC ptr_glGetShaderiv; void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);\nextern PFNGLGETSHADERINFOLOGPROC ptr_glGetShaderInfoLog; void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLGETSHADERSOURCEPROC ptr_glGetShaderSource; void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);\nextern PFNGLGETUNIFORMLOCATIONPROC ptr_glGetUniformLocation; GLint glGetUniformLocation(GLuint program, const GLchar *name);\nextern PFNGLGETUNIFORMFVPROC ptr_glGetUniformfv; void glGetUniformfv(GLuint program, GLint location, GLfloat *params);\nextern PFNGLGETUNIFORMIVPROC ptr_glGetUniformiv; void glGetUniformiv(GLuint program, GLint location, GLint *params);\nextern PFNGLGETVERTEXATTRIBDVPROC ptr_glGetVertexAttribdv; void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);\nextern PFNGLGETVERTEXATTRIBFVPROC ptr_glGetVertexAttribfv; void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);\nextern PFNGLGETVERTEXATTRIBIVPROC ptr_glGetVertexAttribiv; void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);\nextern PFNGLGETVERTEXATTRIBPOINTERVPROC ptr_glGetVertexAttribPointerv; void glGetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer);\nextern PFNGLISPROGRAMPROC ptr_glIsProgram; GLboolean glIsProgram(GLuint program);\nextern PFNGLISSHADERPROC ptr_glIsShader; GLboolean glIsShader(GLuint shader);\nextern PFNGLLINKPROGRAMPROC ptr_glLinkProgram; void glLinkProgram(GLuint program);\nextern PFNGLSHADERSOURCEPROC ptr_glShaderSource; void glShaderSource(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);\nextern PFNGLUSEPROGRAMPROC ptr_glUseProgram; void glUseProgram(GLuint program);\nextern PFNGLUNIFORM1FPROC ptr_glUniform1f; void glUniform1f(GLint location, GLfloat v0);\nextern PFNGLUNIFORM2FPROC ptr_glUniform2f; void glUniform2f(GLint location, GLfloat v0, GLfloat v1);\nextern PFNGLUNIFORM3FPROC ptr_glUniform3f; void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\nextern PFNGLUNIFORM4FPROC ptr_glUniform4f; void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\nextern PFNGLUNIFORM1IPROC ptr_glUniform1i; void glUniform1i(GLint location, GLint v0);\nextern PFNGLUNIFORM2IPROC ptr_glUniform2i; void glUniform2i(GLint location, GLint v0, GLint v1);\nextern PFNGLUNIFORM3IPROC ptr_glUniform3i; void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);\nextern PFNGLUNIFORM4IPROC ptr_glUniform4i; void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\nextern PFNGLUNIFORM1FVPROC ptr_glUniform1fv; void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM2FVPROC ptr_glUniform2fv; void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM3FVPROC ptr_glUniform3fv; void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM4FVPROC ptr_glUniform4fv; void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM1IVPROC ptr_glUniform1iv; void glUniform1iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM2IVPROC ptr_glUniform2iv; void glUniform2iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM3IVPROC ptr_glUniform3iv; void glUniform3iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM4IVPROC ptr_glUniform4iv; void glUniform4iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORMMATRIX2FVPROC ptr_glUniformMatrix2fv; void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3FVPROC ptr_glUniformMatrix3fv; void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4FVPROC ptr_glUniformMatrix4fv; void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLVALIDATEPROGRAMPROC ptr_glValidateProgram; void glValidateProgram(GLuint program);\nextern PFNGLVERTEXATTRIB1DPROC ptr_glVertexAttrib1d; void glVertexAttrib1d(GLuint index, GLdouble x);\nextern PFNGLVERTEXATTRIB1DVPROC ptr_glVertexAttrib1dv; void glVertexAttrib1dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB1FPROC ptr_glVertexAttrib1f; void glVertexAttrib1f(GLuint index, GLfloat x);\nextern PFNGLVERTEXATTRIB1FVPROC ptr_glVertexAttrib1fv; void glVertexAttrib1fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB1SPROC ptr_glVertexAttrib1s; void glVertexAttrib1s(GLuint index, GLshort x);\nextern PFNGLVERTEXATTRIB1SVPROC ptr_glVertexAttrib1sv; void glVertexAttrib1sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB2DPROC ptr_glVertexAttrib2d; void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);\nextern PFNGLVERTEXATTRIB2DVPROC ptr_glVertexAttrib2dv; void glVertexAttrib2dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB2FPROC ptr_glVertexAttrib2f; void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);\nextern PFNGLVERTEXATTRIB2FVPROC ptr_glVertexAttrib2fv; void glVertexAttrib2fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB2SPROC ptr_glVertexAttrib2s; void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);\nextern PFNGLVERTEXATTRIB2SVPROC ptr_glVertexAttrib2sv; void glVertexAttrib2sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB3DPROC ptr_glVertexAttrib3d; void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLVERTEXATTRIB3DVPROC ptr_glVertexAttrib3dv; void glVertexAttrib3dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB3FPROC ptr_glVertexAttrib3f; void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);\nextern PFNGLVERTEXATTRIB3FVPROC ptr_glVertexAttrib3fv; void glVertexAttrib3fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB3SPROC ptr_glVertexAttrib3s; void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);\nextern PFNGLVERTEXATTRIB3SVPROC ptr_glVertexAttrib3sv; void glVertexAttrib3sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4NBVPROC ptr_glVertexAttrib4Nbv; void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIB4NIVPROC ptr_glVertexAttrib4Niv; void glVertexAttrib4Niv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIB4NSVPROC ptr_glVertexAttrib4Nsv; void glVertexAttrib4Nsv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4NUBPROC ptr_glVertexAttrib4Nub; void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\nextern PFNGLVERTEXATTRIB4NUBVPROC ptr_glVertexAttrib4Nubv; void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIB4NUIVPROC ptr_glVertexAttrib4Nuiv; void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIB4NUSVPROC ptr_glVertexAttrib4Nusv; void glVertexAttrib4Nusv(GLuint index, const GLushort *v);\nextern PFNGLVERTEXATTRIB4BVPROC ptr_glVertexAttrib4bv; void glVertexAttrib4bv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIB4DPROC ptr_glVertexAttrib4d; void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLVERTEXATTRIB4DVPROC ptr_glVertexAttrib4dv; void glVertexAttrib4dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB4FPROC ptr_glVertexAttrib4f; void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nextern PFNGLVERTEXATTRIB4FVPROC ptr_glVertexAttrib4fv; void glVertexAttrib4fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB4IVPROC ptr_glVertexAttrib4iv; void glVertexAttrib4iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIB4SPROC ptr_glVertexAttrib4s; void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\nextern PFNGLVERTEXATTRIB4SVPROC ptr_glVertexAttrib4sv; void glVertexAttrib4sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4UBVPROC ptr_glVertexAttrib4ubv; void glVertexAttrib4ubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIB4UIVPROC ptr_glVertexAttrib4uiv; void glVertexAttrib4uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIB4USVPROC ptr_glVertexAttrib4usv; void glVertexAttrib4usv(GLuint index, const GLushort *v);\nextern PFNGLVERTEXATTRIBPOINTERPROC ptr_glVertexAttribPointer; void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);\nextern PFNGLUNIFORMMATRIX2X3FVPROC ptr_glUniformMatrix2x3fv; void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3X2FVPROC ptr_glUniformMatrix3x2fv; void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX2X4FVPROC ptr_glUniformMatrix2x4fv; void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4X2FVPROC ptr_glUniformMatrix4x2fv; void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3X4FVPROC ptr_glUniformMatrix3x4fv; void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4X3FVPROC ptr_glUniformMatrix4x3fv; void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLCOLORMASKIPROC ptr_glColorMaski; void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\nextern PFNGLGETBOOLEANI_VPROC ptr_glGetBooleani_v; void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);\nextern PFNGLGETINTEGERI_VPROC ptr_glGetIntegeri_v; void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);\nextern PFNGLENABLEIPROC ptr_glEnablei; void glEnablei(GLenum target, GLuint index);\nextern PFNGLDISABLEIPROC ptr_glDisablei; void glDisablei(GLenum target, GLuint index);\nextern PFNGLISENABLEDIPROC ptr_glIsEnabledi; GLboolean glIsEnabledi(GLenum target, GLuint index);\nextern PFNGLBEGINTRANSFORMFEEDBACKPROC ptr_glBeginTransformFeedback; void glBeginTransformFeedback(GLenum primitiveMode);\nextern PFNGLENDTRANSFORMFEEDBACKPROC ptr_glEndTransformFeedback; void glEndTransformFeedback(void);\nextern PFNGLBINDBUFFERRANGEPROC ptr_glBindBufferRange; void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLBINDBUFFERBASEPROC ptr_glBindBufferBase; void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);\nextern PFNGLTRANSFORMFEEDBACKVARYINGSPROC ptr_glTransformFeedbackVaryings; void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);\nextern PFNGLGETTRANSFORMFEEDBACKVARYINGPROC ptr_glGetTransformFeedbackVarying; void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\nextern PFNGLCLAMPCOLORPROC ptr_glClampColor; void glClampColor(GLenum target, GLenum clamp);\nextern PFNGLBEGINCONDITIONALRENDERPROC ptr_glBeginConditionalRender; void glBeginConditionalRender(GLuint id, GLenum mode);\nextern PFNGLENDCONDITIONALRENDERPROC ptr_glEndConditionalRender; void glEndConditionalRender(void);\nextern PFNGLVERTEXATTRIBIPOINTERPROC ptr_glVertexAttribIPointer; void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLGETVERTEXATTRIBIIVPROC ptr_glGetVertexAttribIiv; void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);\nextern PFNGLGETVERTEXATTRIBIUIVPROC ptr_glGetVertexAttribIuiv; void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);\nextern PFNGLVERTEXATTRIBI1IPROC ptr_glVertexAttribI1i; void glVertexAttribI1i(GLuint index, GLint x);\nextern PFNGLVERTEXATTRIBI2IPROC ptr_glVertexAttribI2i; void glVertexAttribI2i(GLuint index, GLint x, GLint y);\nextern PFNGLVERTEXATTRIBI3IPROC ptr_glVertexAttribI3i; void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);\nextern PFNGLVERTEXATTRIBI4IPROC ptr_glVertexAttribI4i; void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);\nextern PFNGLVERTEXATTRIBI1UIPROC ptr_glVertexAttribI1ui; void glVertexAttribI1ui(GLuint index, GLuint x);\nextern PFNGLVERTEXATTRIBI2UIPROC ptr_glVertexAttribI2ui; void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);\nextern PFNGLVERTEXATTRIBI3UIPROC ptr_glVertexAttribI3ui; void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);\nextern PFNGLVERTEXATTRIBI4UIPROC ptr_glVertexAttribI4ui; void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\nextern PFNGLVERTEXATTRIBI1IVPROC ptr_glVertexAttribI1iv; void glVertexAttribI1iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI2IVPROC ptr_glVertexAttribI2iv; void glVertexAttribI2iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI3IVPROC ptr_glVertexAttribI3iv; void glVertexAttribI3iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI4IVPROC ptr_glVertexAttribI4iv; void glVertexAttribI4iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI1UIVPROC ptr_glVertexAttribI1uiv; void glVertexAttribI1uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI2UIVPROC ptr_glVertexAttribI2uiv; void glVertexAttribI2uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI3UIVPROC ptr_glVertexAttribI3uiv; void glVertexAttribI3uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI4UIVPROC ptr_glVertexAttribI4uiv; void glVertexAttribI4uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI4BVPROC ptr_glVertexAttribI4bv; void glVertexAttribI4bv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIBI4SVPROC ptr_glVertexAttribI4sv; void glVertexAttribI4sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIBI4UBVPROC ptr_glVertexAttribI4ubv; void glVertexAttribI4ubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIBI4USVPROC ptr_glVertexAttribI4usv; void glVertexAttribI4usv(GLuint index, const GLushort *v);\nextern PFNGLGETUNIFORMUIVPROC ptr_glGetUniformuiv; void glGetUniformuiv(GLuint program, GLint location, GLuint *params);\nextern PFNGLBINDFRAGDATALOCATIONPROC ptr_glBindFragDataLocation; void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);\nextern PFNGLGETFRAGDATALOCATIONPROC ptr_glGetFragDataLocation; GLint glGetFragDataLocation(GLuint program, const GLchar *name);\nextern PFNGLUNIFORM1UIPROC ptr_glUniform1ui; void glUniform1ui(GLint location, GLuint v0);\nextern PFNGLUNIFORM2UIPROC ptr_glUniform2ui; void glUniform2ui(GLint location, GLuint v0, GLuint v1);\nextern PFNGLUNIFORM3UIPROC ptr_glUniform3ui; void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);\nextern PFNGLUNIFORM4UIPROC ptr_glUniform4ui; void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\nextern PFNGLUNIFORM1UIVPROC ptr_glUniform1uiv; void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM2UIVPROC ptr_glUniform2uiv; void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM3UIVPROC ptr_glUniform3uiv; void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM4UIVPROC ptr_glUniform4uiv; void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLTEXPARAMETERIIVPROC ptr_glTexParameterIiv; void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);\nextern PFNGLTEXPARAMETERIUIVPROC ptr_glTexParameterIuiv; void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);\nextern PFNGLGETTEXPARAMETERIIVPROC ptr_glGetTexParameterIiv; void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETTEXPARAMETERIUIVPROC ptr_glGetTexParameterIuiv; void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);\nextern PFNGLCLEARBUFFERIVPROC ptr_glClearBufferiv; void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);\nextern PFNGLCLEARBUFFERUIVPROC ptr_glClearBufferuiv; void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);\nextern PFNGLCLEARBUFFERFVPROC ptr_glClearBufferfv; void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);\nextern PFNGLCLEARBUFFERFIPROC ptr_glClearBufferfi; void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);\nextern PFNGLGETSTRINGIPROC ptr_glGetStringi; const GLubyte * glGetStringi(GLenum name, GLuint index);\nextern PFNGLISRENDERBUFFERPROC ptr_glIsRenderbuffer; GLboolean glIsRenderbuffer(GLuint renderbuffer);\nextern PFNGLBINDRENDERBUFFERPROC ptr_glBindRenderbuffer; void glBindRenderbuffer(GLenum target, GLuint renderbuffer);\nextern PFNGLDELETERENDERBUFFERSPROC ptr_glDeleteRenderbuffers; void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);\nextern PFNGLGENRENDERBUFFERSPROC ptr_glGenRenderbuffers; void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);\nextern PFNGLRENDERBUFFERSTORAGEPROC ptr_glRenderbufferStorage; void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLGETRENDERBUFFERPARAMETERIVPROC ptr_glGetRenderbufferParameteriv; void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLISFRAMEBUFFERPROC ptr_glIsFramebuffer; GLboolean glIsFramebuffer(GLuint framebuffer);\nextern PFNGLBINDFRAMEBUFFERPROC ptr_glBindFramebuffer; void glBindFramebuffer(GLenum target, GLuint framebuffer);\nextern PFNGLDELETEFRAMEBUFFERSPROC ptr_glDeleteFramebuffers; void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);\nextern PFNGLGENFRAMEBUFFERSPROC ptr_glGenFramebuffers; void glGenFramebuffers(GLsizei n, GLuint *framebuffers);\nextern PFNGLCHECKFRAMEBUFFERSTATUSPROC ptr_glCheckFramebufferStatus; GLenum glCheckFramebufferStatus(GLenum target);\nextern PFNGLFRAMEBUFFERTEXTURE1DPROC ptr_glFramebufferTexture1D; void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\nextern PFNGLFRAMEBUFFERTEXTURE2DPROC ptr_glFramebufferTexture2D; void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\nextern PFNGLFRAMEBUFFERTEXTURE3DPROC ptr_glFramebufferTexture3D; void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\nextern PFNGLFRAMEBUFFERRENDERBUFFERPROC ptr_glFramebufferRenderbuffer; void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\nextern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC ptr_glGetFramebufferAttachmentParameteriv; void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);\nextern PFNGLGENERATEMIPMAPPROC ptr_glGenerateMipmap; void glGenerateMipmap(GLenum target);\nextern PFNGLBLITFRAMEBUFFERPROC ptr_glBlitFramebuffer; void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\nextern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC ptr_glRenderbufferStorageMultisample; void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLFRAMEBUFFERTEXTURELAYERPROC ptr_glFramebufferTextureLayer; void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\nextern PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);\nextern PFNGLFLUSHMAPPEDBUFFERRANGEPROC ptr_glFlushMappedBufferRange; void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);\nextern PFNGLBINDVERTEXARRAYPROC ptr_glBindVertexArray; void glBindVertexArray(GLuint array);\nextern PFNGLDELETEVERTEXARRAYSPROC ptr_glDeleteVertexArrays; void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);\nextern PFNGLGENVERTEXARRAYSPROC ptr_glGenVertexArrays; void glGenVertexArrays(GLsizei n, GLuint *arrays);\nextern PFNGLISVERTEXARRAYPROC ptr_glIsVertexArray; GLboolean glIsVertexArray(GLuint array);\nextern PFNGLDRAWARRAYSINSTANCEDPROC ptr_glDrawArraysInstanced; void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);\nextern PFNGLDRAWELEMENTSINSTANCEDPROC ptr_glDrawElementsInstanced; void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);\nextern PFNGLTEXBUFFERPROC ptr_glTexBuffer; void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);\nextern PFNGLPRIMITIVERESTARTINDEXPROC ptr_glPrimitiveRestartIndex; void glPrimitiveRestartIndex(GLuint index);\nextern PFNGLCOPYBUFFERSUBDATAPROC ptr_glCopyBufferSubData; void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\nextern PFNGLGETUNIFORMINDICESPROC ptr_glGetUniformIndices; void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);\nextern PFNGLGETACTIVEUNIFORMSIVPROC ptr_glGetActiveUniformsiv; void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);\nextern PFNGLGETACTIVEUNIFORMNAMEPROC ptr_glGetActiveUniformName; void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);\nextern PFNGLGETUNIFORMBLOCKINDEXPROC ptr_glGetUniformBlockIndex; GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);\nextern PFNGLGETACTIVEUNIFORMBLOCKIVPROC ptr_glGetActiveUniformBlockiv; void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);\nextern PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC ptr_glGetActiveUniformBlockName; void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);\nextern PFNGLUNIFORMBLOCKBINDINGPROC ptr_glUniformBlockBinding; void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);\nextern PFNGLDRAWELEMENTSBASEVERTEXPROC ptr_glDrawElementsBaseVertex; void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);\nextern PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC ptr_glDrawRangeElementsBaseVertex; void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC ptr_glDrawElementsInstancedBaseVertex; void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);\nextern PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC ptr_glMultiDrawElementsBaseVertex; void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);\nextern PFNGLPROVOKINGVERTEXPROC ptr_glProvokingVertex; void glProvokingVertex(GLenum mode);\nextern PFNGLFENCESYNCPROC ptr_glFenceSync; GLsync glFenceSync(GLenum condition, GLbitfield flags);\nextern PFNGLISSYNCPROC ptr_glIsSync; GLboolean glIsSync(GLsync sync);\nextern PFNGLDELETESYNCPROC ptr_glDeleteSync; void glDeleteSync(GLsync sync);\nextern PFNGLCLIENTWAITSYNCPROC ptr_glClientWaitSync; GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);\nextern PFNGLWAITSYNCPROC ptr_glWaitSync; void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);\nextern PFNGLGETINTEGER64VPROC ptr_glGetInteger64v; void glGetInteger64v(GLenum pname, GLint64 *data);\nextern PFNGLGETSYNCIVPROC ptr_glGetSynciv; void glGetSynciv(GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values);\nextern PFNGLGETINTEGER64I_VPROC ptr_glGetInteger64i_v; void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);\nextern PFNGLGETBUFFERPARAMETERI64VPROC ptr_glGetBufferParameteri64v; void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);\nextern PFNGLFRAMEBUFFERTEXTUREPROC ptr_glFramebufferTexture; void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);\nextern PFNGLTEXIMAGE2DMULTISAMPLEPROC ptr_glTexImage2DMultisample; void glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXIMAGE3DMULTISAMPLEPROC ptr_glTexImage3DMultisample; void glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLGETMULTISAMPLEFVPROC ptr_glGetMultisamplefv; void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);\nextern PFNGLSAMPLEMASKIPROC ptr_glSampleMaski; void glSampleMaski(GLuint maskNumber, GLbitfield mask);\nextern PFNGLBINDFRAGDATALOCATIONINDEXEDPROC ptr_glBindFragDataLocationIndexed; void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);\nextern PFNGLGETFRAGDATAINDEXPROC ptr_glGetFragDataIndex; GLint glGetFragDataIndex(GLuint program, const GLchar *name);\nextern PFNGLGENSAMPLERSPROC ptr_glGenSamplers; void glGenSamplers(GLsizei count, GLuint *samplers);\nextern PFNGLDELETESAMPLERSPROC ptr_glDeleteSamplers; void glDeleteSamplers(GLsizei count, const GLuint *samplers);\nextern PFNGLISSAMPLERPROC ptr_glIsSampler; GLboolean glIsSampler(GLuint sampler);\nextern PFNGLBINDSAMPLERPROC ptr_glBindSampler; void glBindSampler(GLuint unit, GLuint sampler);\nextern PFNGLSAMPLERPARAMETERIPROC ptr_glSamplerParameteri; void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);\nextern PFNGLSAMPLERPARAMETERIVPROC ptr_glSamplerParameteriv; void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);\nextern PFNGLSAMPLERPARAMETERFPROC ptr_glSamplerParameterf; void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);\nextern PFNGLSAMPLERPARAMETERFVPROC ptr_glSamplerParameterfv; void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);\nextern PFNGLSAMPLERPARAMETERIIVPROC ptr_glSamplerParameterIiv; void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);\nextern PFNGLSAMPLERPARAMETERIUIVPROC ptr_glSamplerParameterIuiv; void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);\nextern PFNGLGETSAMPLERPARAMETERIVPROC ptr_glGetSamplerParameteriv; void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);\nextern PFNGLGETSAMPLERPARAMETERIIVPROC ptr_glGetSamplerParameterIiv; void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);\nextern PFNGLGETSAMPLERPARAMETERFVPROC ptr_glGetSamplerParameterfv; void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);\nextern PFNGLGETSAMPLERPARAMETERIUIVPROC ptr_glGetSamplerParameterIuiv; void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);\nextern PFNGLQUERYCOUNTERPROC ptr_glQueryCounter; void glQueryCounter(GLuint id, GLenum target);\nextern PFNGLGETQUERYOBJECTI64VPROC ptr_glGetQueryObjecti64v; void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);\nextern PFNGLGETQUERYOBJECTUI64VPROC ptr_glGetQueryObjectui64v; void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);\nextern PFNGLVERTEXATTRIBDIVISORPROC ptr_glVertexAttribDivisor; void glVertexAttribDivisor(GLuint index, GLuint divisor);\nextern PFNGLVERTEXATTRIBP1UIPROC ptr_glVertexAttribP1ui; void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP1UIVPROC ptr_glVertexAttribP1uiv; void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP2UIPROC ptr_glVertexAttribP2ui; void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP2UIVPROC ptr_glVertexAttribP2uiv; void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP3UIPROC ptr_glVertexAttribP3ui; void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP3UIVPROC ptr_glVertexAttribP3uiv; void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP4UIPROC ptr_glVertexAttribP4ui; void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP4UIVPROC ptr_glVertexAttribP4uiv; void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXP2UIPROC ptr_glVertexP2ui; void glVertexP2ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP2UIVPROC ptr_glVertexP2uiv; void glVertexP2uiv(GLenum type, const GLuint *value);\nextern PFNGLVERTEXP3UIPROC ptr_glVertexP3ui; void glVertexP3ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP3UIVPROC ptr_glVertexP3uiv; void glVertexP3uiv(GLenum type, const GLuint *value);\nextern PFNGLVERTEXP4UIPROC ptr_glVertexP4ui; void glVertexP4ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP4UIVPROC ptr_glVertexP4uiv; void glVertexP4uiv(GLenum type, const GLuint *value);\nextern PFNGLTEXCOORDP1UIPROC ptr_glTexCoordP1ui; void glTexCoordP1ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP1UIVPROC ptr_glTexCoordP1uiv; void glTexCoordP1uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP2UIPROC ptr_glTexCoordP2ui; void glTexCoordP2ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP2UIVPROC ptr_glTexCoordP2uiv; void glTexCoordP2uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP3UIPROC ptr_glTexCoordP3ui; void glTexCoordP3ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP3UIVPROC ptr_glTexCoordP3uiv; void glTexCoordP3uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP4UIPROC ptr_glTexCoordP4ui; void glTexCoordP4ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP4UIVPROC ptr_glTexCoordP4uiv; void glTexCoordP4uiv(GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP1UIPROC ptr_glMultiTexCoordP1ui; void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP1UIVPROC ptr_glMultiTexCoordP1uiv; void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP2UIPROC ptr_glMultiTexCoordP2ui; void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP2UIVPROC ptr_glMultiTexCoordP2uiv; void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP3UIPROC ptr_glMultiTexCoordP3ui; void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP3UIVPROC ptr_glMultiTexCoordP3uiv; void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP4UIPROC ptr_glMultiTexCoordP4ui; void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP4UIVPROC ptr_glMultiTexCoordP4uiv; void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLNORMALP3UIPROC ptr_glNormalP3ui; void glNormalP3ui(GLenum type, GLuint coords);\nextern PFNGLNORMALP3UIVPROC ptr_glNormalP3uiv; void glNormalP3uiv(GLenum type, const GLuint *coords);\nextern PFNGLCOLORP3UIPROC ptr_glColorP3ui; void glColorP3ui(GLenum type, GLuint color);\nextern PFNGLCOLORP3UIVPROC ptr_glColorP3uiv; void glColorP3uiv(GLenum type, const GLuint *color);\nextern PFNGLCOLORP4UIPROC ptr_glColorP4ui; void glColorP4ui(GLenum type, GLuint color);\nextern PFNGLCOLORP4UIVPROC ptr_glColorP4uiv; void glColorP4uiv(GLenum type, const GLuint *color);\nextern PFNGLSECONDARYCOLORP3UIPROC ptr_glSecondaryColorP3ui; void glSecondaryColorP3ui(GLenum type, GLuint color);\nextern PFNGLSECONDARYCOLORP3UIVPROC ptr_glSecondaryColorP3uiv; void glSecondaryColorP3uiv(GLenum type, const GLuint *color);\nextern PFNGLMINSAMPLESHADINGPROC ptr_glMinSampleShading; void glMinSampleShading(GLfloat value);\nextern PFNGLBLENDEQUATIONIPROC ptr_glBlendEquationi; void glBlendEquationi(GLuint buf, GLenum mode);\nextern PFNGLBLENDEQUATIONSEPARATEIPROC ptr_glBlendEquationSeparatei; void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);\nextern PFNGLBLENDFUNCIPROC ptr_glBlendFunci; void glBlendFunci(GLuint buf, GLenum src, GLenum dst);\nextern PFNGLBLENDFUNCSEPARATEIPROC ptr_glBlendFuncSeparatei; void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\nextern PFNGLDRAWARRAYSINDIRECTPROC ptr_glDrawArraysIndirect; void glDrawArraysIndirect(GLenum mode, const void *indirect);\nextern PFNGLDRAWELEMENTSINDIRECTPROC ptr_glDrawElementsIndirect; void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);\nextern PFNGLUNIFORM1DPROC ptr_glUniform1d; void glUniform1d(GLint location, GLdouble x);\nextern PFNGLUNIFORM2DPROC ptr_glUniform2d; void glUniform2d(GLint location, GLdouble x, GLdouble y);\nextern PFNGLUNIFORM3DPROC ptr_glUniform3d; void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLUNIFORM4DPROC ptr_glUniform4d; void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLUNIFORM1DVPROC ptr_glUniform1dv; void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM2DVPROC ptr_glUniform2dv; void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM3DVPROC ptr_glUniform3dv; void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM4DVPROC ptr_glUniform4dv; void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2DVPROC ptr_glUniformMatrix2dv; void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3DVPROC ptr_glUniformMatrix3dv; void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4DVPROC ptr_glUniformMatrix4dv; void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2X3DVPROC ptr_glUniformMatrix2x3dv; void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2X4DVPROC ptr_glUniformMatrix2x4dv; void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3X2DVPROC ptr_glUniformMatrix3x2dv; void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3X4DVPROC ptr_glUniformMatrix3x4dv; void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4X2DVPROC ptr_glUniformMatrix4x2dv; void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4X3DVPROC ptr_glUniformMatrix4x3dv; void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLGETUNIFORMDVPROC ptr_glGetUniformdv; void glGetUniformdv(GLuint program, GLint location, GLdouble *params);\nextern PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC ptr_glGetSubroutineUniformLocation; GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);\nextern PFNGLGETSUBROUTINEINDEXPROC ptr_glGetSubroutineIndex; GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);\nextern PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC ptr_glGetActiveSubroutineUniformiv; void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);\nextern PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC ptr_glGetActiveSubroutineUniformName; void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLGETACTIVESUBROUTINENAMEPROC ptr_glGetActiveSubroutineName; void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLUNIFORMSUBROUTINESUIVPROC ptr_glUniformSubroutinesuiv; void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);\nextern PFNGLGETUNIFORMSUBROUTINEUIVPROC ptr_glGetUniformSubroutineuiv; void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);\nextern PFNGLGETPROGRAMSTAGEIVPROC ptr_glGetProgramStageiv; void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);\nextern PFNGLPATCHPARAMETERIPROC ptr_glPatchParameteri; void glPatchParameteri(GLenum pname, GLint value);\nextern PFNGLPATCHPARAMETERFVPROC ptr_glPatchParameterfv; void glPatchParameterfv(GLenum pname, const GLfloat *values);\nextern PFNGLBINDTRANSFORMFEEDBACKPROC ptr_glBindTransformFeedback; void glBindTransformFeedback(GLenum target, GLuint id);\nextern PFNGLDELETETRANSFORMFEEDBACKSPROC ptr_glDeleteTransformFeedbacks; void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);\nextern PFNGLGENTRANSFORMFEEDBACKSPROC ptr_glGenTransformFeedbacks; void glGenTransformFeedbacks(GLsizei n, GLuint *ids);\nextern PFNGLISTRANSFORMFEEDBACKPROC ptr_glIsTransformFeedback; GLboolean glIsTransformFeedback(GLuint id);\nextern PFNGLPAUSETRANSFORMFEEDBACKPROC ptr_glPauseTransformFeedback; void glPauseTransformFeedback(void);\nextern PFNGLRESUMETRANSFORMFEEDBACKPROC ptr_glResumeTransformFeedback; void glResumeTransformFeedback(void);\nextern PFNGLDRAWTRANSFORMFEEDBACKPROC ptr_glDrawTransformFeedback; void glDrawTransformFeedback(GLenum mode, GLuint id);\nextern PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC ptr_glDrawTransformFeedbackStream; void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);\nextern PFNGLBEGINQUERYINDEXEDPROC ptr_glBeginQueryIndexed; void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);\nextern PFNGLENDQUERYINDEXEDPROC ptr_glEndQueryIndexed; void glEndQueryIndexed(GLenum target, GLuint index);\nextern PFNGLGETQUERYINDEXEDIVPROC ptr_glGetQueryIndexediv; void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);\nextern PFNGLRELEASESHADERCOMPILERPROC ptr_glReleaseShaderCompiler; void glReleaseShaderCompiler(void);\nextern PFNGLSHADERBINARYPROC ptr_glShaderBinary; void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length);\nextern PFNGLGETSHADERPRECISIONFORMATPROC ptr_glGetShaderPrecisionFormat; void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);\nextern PFNGLDEPTHRANGEFPROC ptr_glDepthRangef; void glDepthRangef(GLfloat n, GLfloat f);\nextern PFNGLCLEARDEPTHFPROC ptr_glClearDepthf; void glClearDepthf(GLfloat d);\nextern PFNGLGETPROGRAMBINARYPROC ptr_glGetProgramBinary; void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);\nextern PFNGLPROGRAMBINARYPROC ptr_glProgramBinary; void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);\nextern PFNGLPROGRAMPARAMETERIPROC ptr_glProgramParameteri; void glProgramParameteri(GLuint program, GLenum pname, GLint value);\nextern PFNGLUSEPROGRAMSTAGESPROC ptr_glUseProgramStages; void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);\nextern PFNGLACTIVESHADERPROGRAMPROC ptr_glActiveShaderProgram; void glActiveShaderProgram(GLuint pipeline, GLuint program);\nextern PFNGLCREATESHADERPROGRAMVPROC ptr_glCreateShaderProgramv; GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const*strings);\nextern PFNGLBINDPROGRAMPIPELINEPROC ptr_glBindProgramPipeline; void glBindProgramPipeline(GLuint pipeline);\nextern PFNGLDELETEPROGRAMPIPELINESPROC ptr_glDeleteProgramPipelines; void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);\nextern PFNGLGENPROGRAMPIPELINESPROC ptr_glGenProgramPipelines; void glGenProgramPipelines(GLsizei n, GLuint *pipelines);\nextern PFNGLISPROGRAMPIPELINEPROC ptr_glIsProgramPipeline; GLboolean glIsProgramPipeline(GLuint pipeline);\nextern PFNGLGETPROGRAMPIPELINEIVPROC ptr_glGetProgramPipelineiv; void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);\nextern PFNGLPROGRAMUNIFORM1IPROC ptr_glProgramUniform1i; void glProgramUniform1i(GLuint program, GLint location, GLint v0);\nextern PFNGLPROGRAMUNIFORM1IVPROC ptr_glProgramUniform1iv; void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM1FPROC ptr_glProgramUniform1f; void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);\nextern PFNGLPROGRAMUNIFORM1FVPROC ptr_glProgramUniform1fv; void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM1DPROC ptr_glProgramUniform1d; void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);\nextern PFNGLPROGRAMUNIFORM1DVPROC ptr_glProgramUniform1dv; void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM1UIPROC ptr_glProgramUniform1ui; void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);\nextern PFNGLPROGRAMUNIFORM1UIVPROC ptr_glProgramUniform1uiv; void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM2IPROC ptr_glProgramUniform2i; void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);\nextern PFNGLPROGRAMUNIFORM2IVPROC ptr_glProgramUniform2iv; void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM2FPROC ptr_glProgramUniform2f; void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);\nextern PFNGLPROGRAMUNIFORM2FVPROC ptr_glProgramUniform2fv; void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM2DPROC ptr_glProgramUniform2d; void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);\nextern PFNGLPROGRAMUNIFORM2DVPROC ptr_glProgramUniform2dv; void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM2UIPROC ptr_glProgramUniform2ui; void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);\nextern PFNGLPROGRAMUNIFORM2UIVPROC ptr_glProgramUniform2uiv; void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM3IPROC ptr_glProgramUniform3i; void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\nextern PFNGLPROGRAMUNIFORM3IVPROC ptr_glProgramUniform3iv; void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM3FPROC ptr_glProgramUniform3f; void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\nextern PFNGLPROGRAMUNIFORM3FVPROC ptr_glProgramUniform3fv; void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM3DPROC ptr_glProgramUniform3d; void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);\nextern PFNGLPROGRAMUNIFORM3DVPROC ptr_glProgramUniform3dv; void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM3UIPROC ptr_glProgramUniform3ui; void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\nextern PFNGLPROGRAMUNIFORM3UIVPROC ptr_glProgramUniform3uiv; void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM4IPROC ptr_glProgramUniform4i; void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\nextern PFNGLPROGRAMUNIFORM4IVPROC ptr_glProgramUniform4iv; void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM4FPROC ptr_glProgramUniform4f; void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\nextern PFNGLPROGRAMUNIFORM4FVPROC ptr_glProgramUniform4fv; void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM4DPROC ptr_glProgramUniform4d; void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);\nextern PFNGLPROGRAMUNIFORM4DVPROC ptr_glProgramUniform4dv; void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM4UIPROC ptr_glProgramUniform4ui; void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\nextern PFNGLPROGRAMUNIFORM4UIVPROC ptr_glProgramUniform4uiv; void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2FVPROC ptr_glProgramUniformMatrix2fv; void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3FVPROC ptr_glProgramUniformMatrix3fv; void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4FVPROC ptr_glProgramUniformMatrix4fv; void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2DVPROC ptr_glProgramUniformMatrix2dv; void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3DVPROC ptr_glProgramUniformMatrix3dv; void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4DVPROC ptr_glProgramUniformMatrix4dv; void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC ptr_glProgramUniformMatrix2x3fv; void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC ptr_glProgramUniformMatrix3x2fv; void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC ptr_glProgramUniformMatrix2x4fv; void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC ptr_glProgramUniformMatrix4x2fv; void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC ptr_glProgramUniformMatrix3x4fv; void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC ptr_glProgramUniformMatrix4x3fv; void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC ptr_glProgramUniformMatrix2x3dv; void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC ptr_glProgramUniformMatrix3x2dv; void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC ptr_glProgramUniformMatrix2x4dv; void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC ptr_glProgramUniformMatrix4x2dv; void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC ptr_glProgramUniformMatrix3x4dv; void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC ptr_glProgramUniformMatrix4x3dv; void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLVALIDATEPROGRAMPIPELINEPROC ptr_glValidateProgramPipeline; void glValidateProgramPipeline(GLuint pipeline);\nextern PFNGLGETPROGRAMPIPELINEINFOLOGPROC ptr_glGetProgramPipelineInfoLog; void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLVERTEXATTRIBL1DPROC ptr_glVertexAttribL1d; void glVertexAttribL1d(GLuint index, GLdouble x);\nextern PFNGLVERTEXATTRIBL2DPROC ptr_glVertexAttribL2d; void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);\nextern PFNGLVERTEXATTRIBL3DPROC ptr_glVertexAttribL3d; void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLVERTEXATTRIBL4DPROC ptr_glVertexAttribL4d; void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLVERTEXATTRIBL1DVPROC ptr_glVertexAttribL1dv; void glVertexAttribL1dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL2DVPROC ptr_glVertexAttribL2dv; void glVertexAttribL2dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL3DVPROC ptr_glVertexAttribL3dv; void glVertexAttribL3dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL4DVPROC ptr_glVertexAttribL4dv; void glVertexAttribL4dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBLPOINTERPROC ptr_glVertexAttribLPointer; void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLGETVERTEXATTRIBLDVPROC ptr_glGetVertexAttribLdv; void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);\nextern PFNGLVIEWPORTARRAYVPROC ptr_glViewportArrayv; void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);\nextern PFNGLVIEWPORTINDEXEDFPROC ptr_glViewportIndexedf; void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);\nextern PFNGLVIEWPORTINDEXEDFVPROC ptr_glViewportIndexedfv; void glViewportIndexedfv(GLuint index, const GLfloat *v);\nextern PFNGLSCISSORARRAYVPROC ptr_glScissorArrayv; void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);\nextern PFNGLSCISSORINDEXEDPROC ptr_glScissorIndexed; void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);\nextern PFNGLSCISSORINDEXEDVPROC ptr_glScissorIndexedv; void glScissorIndexedv(GLuint index, const GLint *v);\nextern PFNGLDEPTHRANGEARRAYVPROC ptr_glDepthRangeArrayv; void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);\nextern PFNGLDEPTHRANGEINDEXEDPROC ptr_glDepthRangeIndexed; void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);\nextern PFNGLGETFLOATI_VPROC ptr_glGetFloati_v; void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);\nextern PFNGLGETDOUBLEI_VPROC ptr_glGetDoublei_v; void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);\nextern PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC ptr_glDrawArraysInstancedBaseInstance; void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC ptr_glDrawElementsInstancedBaseInstance; void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC ptr_glDrawElementsInstancedBaseVertexBaseInstance; void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);\nextern PFNGLGETINTERNALFORMATIVPROC ptr_glGetInternalformativ; void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params);\nextern PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC ptr_glGetActiveAtomicCounterBufferiv; void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);\nextern PFNGLBINDIMAGETEXTUREPROC ptr_glBindImageTexture; void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);\nextern PFNGLMEMORYBARRIERPROC ptr_glMemoryBarrier; void glMemoryBarrier(GLbitfield barriers);\nextern PFNGLTEXSTORAGE1DPROC ptr_glTexStorage1D; void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\nextern PFNGLTEXSTORAGE2DPROC ptr_glTexStorage2D; void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLTEXSTORAGE3DPROC ptr_glTexStorage3D; void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC ptr_glDrawTransformFeedbackInstanced; void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);\nextern PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC ptr_glDrawTransformFeedbackStreamInstanced; void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);\nextern PFNGLCLEARBUFFERDATAPROC ptr_glClearBufferData; void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARBUFFERSUBDATAPROC ptr_glClearBufferSubData; void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);\nextern PFNGLDISPATCHCOMPUTEPROC ptr_glDispatchCompute; void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);\nextern PFNGLDISPATCHCOMPUTEINDIRECTPROC ptr_glDispatchComputeIndirect; void glDispatchComputeIndirect(GLintptr indirect);\nextern PFNGLCOPYIMAGESUBDATAPROC ptr_glCopyImageSubData; void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);\nextern PFNGLFRAMEBUFFERPARAMETERIPROC ptr_glFramebufferParameteri; void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);\nextern PFNGLGETFRAMEBUFFERPARAMETERIVPROC ptr_glGetFramebufferParameteriv; void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETINTERNALFORMATI64VPROC ptr_glGetInternalformati64v; void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params);\nextern PFNGLINVALIDATETEXSUBIMAGEPROC ptr_glInvalidateTexSubImage; void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLINVALIDATETEXIMAGEPROC ptr_glInvalidateTexImage; void glInvalidateTexImage(GLuint texture, GLint level);\nextern PFNGLINVALIDATEBUFFERSUBDATAPROC ptr_glInvalidateBufferSubData; void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);\nextern PFNGLINVALIDATEBUFFERDATAPROC ptr_glInvalidateBufferData; void glInvalidateBufferData(GLuint buffer);\nextern PFNGLINVALIDATEFRAMEBUFFERPROC ptr_glInvalidateFramebuffer; void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);\nextern PFNGLINVALIDATESUBFRAMEBUFFERPROC ptr_glInvalidateSubFramebuffer; void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLMULTIDRAWARRAYSINDIRECTPROC ptr_glMultiDrawArraysIndirect; void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);\nextern PFNGLMULTIDRAWELEMENTSINDIRECTPROC ptr_glMultiDrawElementsIndirect; void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);\nextern PFNGLGETPROGRAMINTERFACEIVPROC ptr_glGetProgramInterfaceiv; void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);\nextern PFNGLGETPROGRAMRESOURCEINDEXPROC ptr_glGetProgramResourceIndex; GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLGETPROGRAMRESOURCENAMEPROC ptr_glGetProgramResourceName; void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLGETPROGRAMRESOURCEIVPROC ptr_glGetProgramResourceiv; void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params);\nextern PFNGLGETPROGRAMRESOURCELOCATIONPROC ptr_glGetProgramResourceLocation; GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC ptr_glGetProgramResourceLocationIndex; GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLSHADERSTORAGEBLOCKBINDINGPROC ptr_glShaderStorageBlockBinding; void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);\nextern PFNGLTEXBUFFERRANGEPROC ptr_glTexBufferRange; void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLTEXSTORAGE2DMULTISAMPLEPROC ptr_glTexStorage2DMultisample; void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXSTORAGE3DMULTISAMPLEPROC ptr_glTexStorage3DMultisample; void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLTEXTUREVIEWPROC ptr_glTextureView; void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);\nextern PFNGLBINDVERTEXBUFFERPROC ptr_glBindVertexBuffer; void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\nextern PFNGLVERTEXATTRIBFORMATPROC ptr_glVertexAttribFormat; void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBIFORMATPROC ptr_glVertexAttribIFormat; void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBLFORMATPROC ptr_glVertexAttribLFormat; void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBBINDINGPROC ptr_glVertexAttribBinding; void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);\nextern PFNGLVERTEXBINDINGDIVISORPROC ptr_glVertexBindingDivisor; void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);\nextern PFNGLDEBUGMESSAGECONTROLPROC ptr_glDebugMessageControl; void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\nextern PFNGLDEBUGMESSAGEINSERTPROC ptr_glDebugMessageInsert; void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);\nextern PFNGLDEBUGMESSAGECALLBACKPROC ptr_glDebugMessageCallback; void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);\nextern PFNGLGETDEBUGMESSAGELOGPROC ptr_glGetDebugMessageLog; GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);\nextern PFNGLPUSHDEBUGGROUPPROC ptr_glPushDebugGroup; void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);\nextern PFNGLPOPDEBUGGROUPPROC ptr_glPopDebugGroup; void glPopDebugGroup(void);\nextern PFNGLOBJECTLABELPROC ptr_glObjectLabel; void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);\nextern PFNGLGETOBJECTLABELPROC ptr_glGetObjectLabel; void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);\nextern PFNGLOBJECTPTRLABELPROC ptr_glObjectPtrLabel; void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);\nextern PFNGLGETOBJECTPTRLABELPROC ptr_glGetObjectPtrLabel; void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);\nextern PFNGLBUFFERSTORAGEPROC ptr_glBufferStorage; void glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);\nextern PFNGLCLEARTEXIMAGEPROC ptr_glClearTexImage; void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARTEXSUBIMAGEPROC ptr_glClearTexSubImage; void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);\nextern PFNGLBINDBUFFERSBASEPROC ptr_glBindBuffersBase; void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers);\nextern PFNGLBINDBUFFERSRANGEPROC ptr_glBindBuffersRange; void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);\nextern PFNGLBINDTEXTURESPROC ptr_glBindTextures; void glBindTextures(GLuint first, GLsizei count, const GLuint *textures);\nextern PFNGLBINDSAMPLERSPROC ptr_glBindSamplers; void glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers);\nextern PFNGLBINDIMAGETEXTURESPROC ptr_glBindImageTextures; void glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures);\nextern PFNGLBINDVERTEXBUFFERSPROC ptr_glBindVertexBuffers; void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);\nextern PFNGLCLIPCONTROLPROC ptr_glClipControl; void glClipControl(GLenum origin, GLenum depth);\nextern PFNGLCREATETRANSFORMFEEDBACKSPROC ptr_glCreateTransformFeedbacks; void glCreateTransformFeedbacks(GLsizei n, GLuint *ids);\nextern PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC ptr_glTransformFeedbackBufferBase; void glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer);\nextern PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC ptr_glTransformFeedbackBufferRange; void glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLGETTRANSFORMFEEDBACKIVPROC ptr_glGetTransformFeedbackiv; void glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param);\nextern PFNGLGETTRANSFORMFEEDBACKI_VPROC ptr_glGetTransformFeedbacki_v; void glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param);\nextern PFNGLGETTRANSFORMFEEDBACKI64_VPROC ptr_glGetTransformFeedbacki64_v; void glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param);\nextern PFNGLCREATEBUFFERSPROC ptr_glCreateBuffers; void glCreateBuffers(GLsizei n, GLuint *buffers);\nextern PFNGLNAMEDBUFFERSTORAGEPROC ptr_glNamedBufferStorage; void glNamedBufferStorage(GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);\nextern PFNGLNAMEDBUFFERDATAPROC ptr_glNamedBufferData; void glNamedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);\nextern PFNGLNAMEDBUFFERSUBDATAPROC ptr_glNamedBufferSubData; void glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);\nextern PFNGLCOPYNAMEDBUFFERSUBDATAPROC ptr_glCopyNamedBufferSubData; void glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\nextern PFNGLCLEARNAMEDBUFFERDATAPROC ptr_glClearNamedBufferData; void glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARNAMEDBUFFERSUBDATAPROC ptr_glClearNamedBufferSubData; void glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);\nextern PFNGLMAPNAMEDBUFFERPROC ptr_glMapNamedBuffer; void * glMapNamedBuffer(GLuint buffer, GLenum access);\nextern PFNGLMAPNAMEDBUFFERRANGEPROC ptr_glMapNamedBufferRange; void * glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);\nextern PFNGLUNMAPNAMEDBUFFERPROC ptr_glUnmapNamedBuffer; GLboolean glUnmapNamedBuffer(GLuint buffer);\nextern PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC ptr_glFlushMappedNamedBufferRange; void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length);\nextern PFNGLGETNAMEDBUFFERPARAMETERIVPROC ptr_glGetNamedBufferParameteriv; void glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);\nextern PFNGLGETNAMEDBUFFERPARAMETERI64VPROC ptr_glGetNamedBufferParameteri64v; void glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params);\nextern PFNGLGETNAMEDBUFFERPOINTERVPROC ptr_glGetNamedBufferPointerv; void glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void **params);\nextern PFNGLGETNAMEDBUFFERSUBDATAPROC ptr_glGetNamedBufferSubData; void glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);\nextern PFNGLCREATEFRAMEBUFFERSPROC ptr_glCreateFramebuffers; void glCreateFramebuffers(GLsizei n, GLuint *framebuffers);\nextern PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC ptr_glNamedFramebufferRenderbuffer; void glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\nextern PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC ptr_glNamedFramebufferParameteri; void glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param);\nextern PFNGLNAMEDFRAMEBUFFERTEXTUREPROC ptr_glNamedFramebufferTexture; void glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);\nextern PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC ptr_glNamedFramebufferTextureLayer; void glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);\nextern PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC ptr_glNamedFramebufferDrawBuffer; void glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf);\nextern PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC ptr_glNamedFramebufferDrawBuffers; void glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs);\nextern PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC ptr_glNamedFramebufferReadBuffer; void glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src);\nextern PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC ptr_glInvalidateNamedFramebufferData; void glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);\nextern PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC ptr_glInvalidateNamedFramebufferSubData; void glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLCLEARNAMEDFRAMEBUFFERIVPROC ptr_glClearNamedFramebufferiv; void glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC ptr_glClearNamedFramebufferuiv; void glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERFVPROC ptr_glClearNamedFramebufferfv; void glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERFIPROC ptr_glClearNamedFramebufferfi; void glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);\nextern PFNGLBLITNAMEDFRAMEBUFFERPROC ptr_glBlitNamedFramebuffer; void glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\nextern PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC ptr_glCheckNamedFramebufferStatus; GLenum glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);\nextern PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC ptr_glGetNamedFramebufferParameteriv; void glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param);\nextern PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC ptr_glGetNamedFramebufferAttachmentParameteriv; void glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);\nextern PFNGLCREATERENDERBUFFERSPROC ptr_glCreateRenderbuffers; void glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers);\nextern PFNGLNAMEDRENDERBUFFERSTORAGEPROC ptr_glNamedRenderbufferStorage; void glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC ptr_glNamedRenderbufferStorageMultisample; void glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC ptr_glGetNamedRenderbufferParameteriv; void glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params);\nextern PFNGLCREATETEXTURESPROC ptr_glCreateTextures; void glCreateTextures(GLenum target, GLsizei n, GLuint *textures);\nextern PFNGLTEXTUREBUFFERPROC ptr_glTextureBuffer; void glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer);\nextern PFNGLTEXTUREBUFFERRANGEPROC ptr_glTextureBufferRange; void glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLTEXTURESTORAGE1DPROC ptr_glTextureStorage1D; void glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);\nextern PFNGLTEXTURESTORAGE2DPROC ptr_glTextureStorage2D; void glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLTEXTURESTORAGE3DPROC ptr_glTextureStorage3D; void glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC ptr_glTextureStorage2DMultisample; void glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC ptr_glTextureStorage3DMultisample; void glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLTEXTURESUBIMAGE1DPROC ptr_glTextureSubImage1D; void glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXTURESUBIMAGE2DPROC ptr_glTextureSubImage2D; void glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXTURESUBIMAGE3DPROC ptr_glTextureSubImage3D; void glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC ptr_glCompressedTextureSubImage1D; void glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC ptr_glCompressedTextureSubImage2D; void glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC ptr_glCompressedTextureSubImage3D; void glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOPYTEXTURESUBIMAGE1DPROC ptr_glCopyTextureSubImage1D; void glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\nextern PFNGLCOPYTEXTURESUBIMAGE2DPROC ptr_glCopyTextureSubImage2D; void glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLCOPYTEXTURESUBIMAGE3DPROC ptr_glCopyTextureSubImage3D; void glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLTEXTUREPARAMETERFPROC ptr_glTextureParameterf; void glTextureParameterf(GLuint texture, GLenum pname, GLfloat param);\nextern PFNGLTEXTUREPARAMETERFVPROC ptr_glTextureParameterfv; void glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param);\nextern PFNGLTEXTUREPARAMETERIPROC ptr_glTextureParameteri; void glTextureParameteri(GLuint texture, GLenum pname, GLint param);\nextern PFNGLTEXTUREPARAMETERIIVPROC ptr_glTextureParameterIiv; void glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params);\nextern PFNGLTEXTUREPARAMETERIUIVPROC ptr_glTextureParameterIuiv; void glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params);\nextern PFNGLTEXTUREPARAMETERIVPROC ptr_glTextureParameteriv; void glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param);\nextern PFNGLGENERATETEXTUREMIPMAPPROC ptr_glGenerateTextureMipmap; void glGenerateTextureMipmap(GLuint texture);\nextern PFNGLBINDTEXTUREUNITPROC ptr_glBindTextureUnit; void glBindTextureUnit(GLuint unit, GLuint texture);\nextern PFNGLGETTEXTUREIMAGEPROC ptr_glGetTextureImage; void glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC ptr_glGetCompressedTextureImage; void glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels);\nextern PFNGLGETTEXTURELEVELPARAMETERFVPROC ptr_glGetTextureLevelParameterfv; void glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params);\nextern PFNGLGETTEXTURELEVELPARAMETERIVPROC ptr_glGetTextureLevelParameteriv; void glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params);\nextern PFNGLGETTEXTUREPARAMETERFVPROC ptr_glGetTextureParameterfv; void glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params);\nextern PFNGLGETTEXTUREPARAMETERIIVPROC ptr_glGetTextureParameterIiv; void glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params);\nextern PFNGLGETTEXTUREPARAMETERIUIVPROC ptr_glGetTextureParameterIuiv; void glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params);\nextern PFNGLGETTEXTUREPARAMETERIVPROC ptr_glGetTextureParameteriv; void glGetTextureParameteriv(GLuint texture, GLenum pname, GLint *params);\nextern PFNGLCREATEVERTEXARRAYSPROC ptr_glCreateVertexArrays; void glCreateVertexArrays(GLsizei n, GLuint *arrays);\nextern PFNGLDISABLEVERTEXARRAYATTRIBPROC ptr_glDisableVertexArrayAttrib; void glDisableVertexArrayAttrib(GLuint vaobj, GLuint index);\nextern PFNGLENABLEVERTEXARRAYATTRIBPROC ptr_glEnableVertexArrayAttrib; void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index);\nextern PFNGLVERTEXARRAYELEMENTBUFFERPROC ptr_glVertexArrayElementBuffer; void glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer);\nextern PFNGLVERTEXARRAYVERTEXBUFFERPROC ptr_glVertexArrayVertexBuffer; void glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\nextern PFNGLVERTEXARRAYVERTEXBUFFERSPROC ptr_glVertexArrayVertexBuffers; void glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);\nextern PFNGLVERTEXARRAYATTRIBBINDINGPROC ptr_glVertexArrayAttribBinding; void glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex);\nextern PFNGLVERTEXARRAYATTRIBFORMATPROC ptr_glVertexArrayAttribFormat; void glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYATTRIBIFORMATPROC ptr_glVertexArrayAttribIFormat; void glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYATTRIBLFORMATPROC ptr_glVertexArrayAttribLFormat; void glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYBINDINGDIVISORPROC ptr_glVertexArrayBindingDivisor; void glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor);\nextern PFNGLGETVERTEXARRAYIVPROC ptr_glGetVertexArrayiv; void glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param);\nextern PFNGLGETVERTEXARRAYINDEXEDIVPROC ptr_glGetVertexArrayIndexediv; void glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param);\nextern PFNGLGETVERTEXARRAYINDEXED64IVPROC ptr_glGetVertexArrayIndexed64iv; void glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);\nextern PFNGLCREATESAMPLERSPROC ptr_glCreateSamplers; void glCreateSamplers(GLsizei n, GLuint *samplers);\nextern PFNGLCREATEPROGRAMPIPELINESPROC ptr_glCreateProgramPipelines; void glCreateProgramPipelines(GLsizei n, GLuint *pipelines);\nextern PFNGLCREATEQUERIESPROC ptr_glCreateQueries; void glCreateQueries(GLenum target, GLsizei n, GLuint *ids);\nextern PFNGLGETQUERYBUFFEROBJECTI64VPROC ptr_glGetQueryBufferObjecti64v; void glGetQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTIVPROC ptr_glGetQueryBufferObjectiv; void glGetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTUI64VPROC ptr_glGetQueryBufferObjectui64v; void glGetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTUIVPROC ptr_glGetQueryBufferObjectuiv; void glGetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLMEMORYBARRIERBYREGIONPROC ptr_glMemoryBarrierByRegion; void glMemoryBarrierByRegion(GLbitfield barriers);\nextern PFNGLGETTEXTURESUBIMAGEPROC ptr_glGetTextureSubImage; void glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC ptr_glGetCompressedTextureSubImage; void glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);\nextern PFNGLGETGRAPHICSRESETSTATUSPROC ptr_glGetGraphicsResetStatus; GLenum glGetGraphicsResetStatus(void);\nextern PFNGLGETNCOMPRESSEDTEXIMAGEPROC ptr_glGetnCompressedTexImage; void glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels);\nextern PFNGLGETNTEXIMAGEPROC ptr_glGetnTexImage; void glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETNUNIFORMDVPROC ptr_glGetnUniformdv; void glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params);\nextern PFNGLGETNUNIFORMFVPROC ptr_glGetnUniformfv; void glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params);\nextern PFNGLGETNUNIFORMIVPROC ptr_glGetnUniformiv; void glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params);\nextern PFNGLGETNUNIFORMUIVPROC ptr_glGetnUniformuiv; void glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params);\nextern PFNGLREADNPIXELSPROC ptr_glReadnPixels; void glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);\nextern PFNGLGETNMAPDVPROC ptr_glGetnMapdv; void glGetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);\nextern PFNGLGETNMAPFVPROC ptr_glGetnMapfv; void glGetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);\nextern PFNGLGETNMAPIVPROC ptr_glGetnMapiv; void glGetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v);\nextern PFNGLGETNPIXELMAPFVPROC ptr_glGetnPixelMapfv; void glGetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values);\nextern PFNGLGETNPIXELMAPUIVPROC ptr_glGetnPixelMapuiv; void glGetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values);\nextern PFNGLGETNPIXELMAPUSVPROC ptr_glGetnPixelMapusv; void glGetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values);\nextern PFNGLGETNPOLYGONSTIPPLEPROC ptr_glGetnPolygonStipple; void glGetnPolygonStipple(GLsizei bufSize, GLubyte *pattern);\nextern PFNGLGETNCOLORTABLEPROC ptr_glGetnColorTable; void glGetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);\nextern PFNGLGETNCONVOLUTIONFILTERPROC ptr_glGetnConvolutionFilter; void glGetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);\nextern PFNGLGETNSEPARABLEFILTERPROC ptr_glGetnSeparableFilter; void glGetnSeparableFilter(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);\nextern PFNGLGETNHISTOGRAMPROC ptr_glGetnHistogram; void glGetnHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);\nextern PFNGLGETNMINMAXPROC ptr_glGetnMinmax; void glGetnMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);\nextern PFNGLTEXTUREBARRIERPROC ptr_glTextureBarrier; void glTextureBarrier(void);\nextern PFNGLSPECIALIZESHADERPROC ptr_glSpecializeShader; void glSpecializeShader(GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);\nextern PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC ptr_glMultiDrawArraysIndirectCount; void glMultiDrawArraysIndirectCount(GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);\nextern PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC ptr_glMultiDrawElementsIndirectCount; void glMultiDrawElementsIndirectCount(GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);\nextern PFNGLPOLYGONOFFSETCLAMPPROC ptr_glPolygonOffsetClamp; void glPolygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp);\nextern PFNGLGETTEXTUREHANDLEARBPROC ptr_glGetTextureHandle; GLuint64 glGetTextureHandle(GLuint texture);\nextern PFNGLGETTEXTURESAMPLERHANDLEARBPROC ptr_glGetTextureSamplerHandle; GLuint64 glGetTextureSamplerHandle(GLuint texture, GLuint sampler);\nextern PFNGLMAKETEXTUREHANDLERESIDENTARBPROC ptr_glMakeTextureHandleResident; void glMakeTextureHandleResident(GLuint64 handle);\nextern PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC ptr_glMakeTextureHandleNonResident; void glMakeTextureHandleNonResident(GLuint64 handle);\nextern PFNGLGETIMAGEHANDLEARBPROC ptr_glGetImageHandle; GLuint64 glGetImageHandle(GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);\nextern PFNGLMAKEIMAGEHANDLERESIDENTARBPROC ptr_glMakeImageHandleResident; void glMakeImageHandleResident(GLuint64 handle, GLenum access);\nextern PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC ptr_glMakeImageHandleNonResident; void glMakeImageHandleNonResident(GLuint64 handle);\nextern PFNGLUNIFORMHANDLEUI64ARBPROC ptr_glUniformHandleui64; void glUniformHandleui64(GLint location, GLuint64 value);\nextern PFNGLUNIFORMHANDLEUI64VARBPROC ptr_glUniformHandleui64v; void glUniformHandleui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC ptr_glProgramUniformHandleui64; void glProgramUniformHandleui64(GLuint program, GLint location, GLuint64 value);\nextern PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC ptr_glProgramUniformHandleui64v; void glProgramUniformHandleui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *values);\nextern PFNGLISTEXTUREHANDLERESIDENTARBPROC ptr_glIsTextureHandleResident; GLboolean glIsTextureHandleResident(GLuint64 handle);\nextern PFNGLISIMAGEHANDLERESIDENTARBPROC ptr_glIsImageHandleResident; GLboolean glIsImageHandleResident(GLuint64 handle);\nextern PFNGLVERTEXATTRIBL1UI64ARBPROC ptr_glVertexAttribL1ui64; void glVertexAttribL1ui64(GLuint index, GLuint64EXT x);\nextern PFNGLVERTEXATTRIBL1UI64VARBPROC ptr_glVertexAttribL1ui64v; void glVertexAttribL1ui64v(GLuint index, const GLuint64EXT *v);\nextern PFNGLGETVERTEXATTRIBLUI64VARBPROC ptr_glGetVertexAttribLui64v; void glGetVertexAttribLui64v(GLuint index, GLenum pname, GLuint64EXT *params);\nextern PFNGLUNIFORM1I64ARBPROC ptr_glUniform1i64; void glUniform1i64(GLint location, GLint64 x);\nextern PFNGLUNIFORM2I64ARBPROC ptr_glUniform2i64; void glUniform2i64(GLint location, GLint64 x, GLint64 y);\nextern PFNGLUNIFORM3I64ARBPROC ptr_glUniform3i64; void glUniform3i64(GLint location, GLint64 x, GLint64 y, GLint64 z);\nextern PFNGLUNIFORM4I64ARBPROC ptr_glUniform4i64; void glUniform4i64(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);\nextern PFNGLUNIFORM1I64VARBPROC ptr_glUniform1i64v; void glUniform1i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM2I64VARBPROC ptr_glUniform2i64v; void glUniform2i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM3I64VARBPROC ptr_glUniform3i64v; void glUniform3i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM4I64VARBPROC ptr_glUniform4i64v; void glUniform4i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM1UI64ARBPROC ptr_glUniform1ui64; void glUniform1ui64(GLint location, GLuint64 x);\nextern PFNGLUNIFORM2UI64ARBPROC ptr_glUniform2ui64; void glUniform2ui64(GLint location, GLuint64 x, GLuint64 y);\nextern PFNGLUNIFORM3UI64ARBPROC ptr_glUniform3ui64; void glUniform3ui64(GLint location, GLuint64 x, GLuint64 y, GLuint64 z);\nextern PFNGLUNIFORM4UI64ARBPROC ptr_glUniform4ui64; void glUniform4ui64(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);\nextern PFNGLUNIFORM1UI64VARBPROC ptr_glUniform1ui64v; void glUniform1ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM2UI64VARBPROC ptr_glUniform2ui64v; void glUniform2ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM3UI64VARBPROC ptr_glUniform3ui64v; void glUniform3ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM4UI64VARBPROC ptr_glUniform4ui64v; void glUniform4ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLGETUNIFORMI64VARBPROC ptr_glGetUniformi64v; void glGetUniformi64v(GLuint program, GLint location, GLint64 *params);\nextern PFNGLGETUNIFORMUI64VARBPROC ptr_glGetUniformui64v; void glGetUniformui64v(GLuint program, GLint location, GLuint64 *params);\nextern PFNGLGETNUNIFORMI64VARBPROC ptr_glGetnUniformi64v; void glGetnUniformi64v(GLuint program, GLint location, GLsizei bufSize, GLint64 *params);\nextern PFNGLGETNUNIFORMUI64VARBPROC ptr_glGetnUniformui64v; void glGetnUniformui64v(GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);\nextern PFNGLPROGRAMUNIFORM1I64ARBPROC ptr_glProgramUniform1i64; void glProgramUniform1i64(GLuint program, GLint location, GLint64 x);\nextern PFNGLPROGRAMUNIFORM2I64ARBPROC ptr_glProgramUniform2i64; void glProgramUniform2i64(GLuint program, GLint location, GLint64 x, GLint64 y);\nextern PFNGLPROGRAMUNIFORM3I64ARBPROC ptr_glProgramUniform3i64; void glProgramUniform3i64(GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);\nextern PFNGLPROGRAMUNIFORM4I64ARBPROC ptr_glProgramUniform4i64; void glProgramUniform4i64(GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);\nextern PFNGLPROGRAMUNIFORM1I64VARBPROC ptr_glProgramUniform1i64v; void glProgramUniform1i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM2I64VARBPROC ptr_glProgramUniform2i64v; void glProgramUniform2i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM3I64VARBPROC ptr_glProgramUniform3i64v; void glProgramUniform3i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM4I64VARBPROC ptr_glProgramUniform4i64v; void glProgramUniform4i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM1UI64ARBPROC ptr_glProgramUniform1ui64; void glProgramUniform1ui64(GLuint program, GLint location, GLuint64 x);\nextern PFNGLPROGRAMUNIFORM2UI64ARBPROC ptr_glProgramUniform2ui64; void glProgramUniform2ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y);\nextern PFNGLPROGRAMUNIFORM3UI64ARBPROC ptr_glProgramUniform3ui64; void glProgramUniform3ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);\nextern PFNGLPROGRAMUNIFORM4UI64ARBPROC ptr_glProgramUniform4ui64; void glProgramUniform4ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);\nextern PFNGLPROGRAMUNIFORM1UI64VARBPROC ptr_glProgramUniform1ui64v; void glProgramUniform1ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM2UI64VARBPROC ptr_glProgramUniform2ui64v; void glProgramUniform2ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM3UI64VARBPROC ptr_glProgramUniform3ui64v; void glProgramUniform3ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM4UI64VARBPROC ptr_glProgramUniform4ui64v; void glProgramUniform4ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\n"}, {"path": "utils/mesh.cpp", "language": "cpp", "loc": 215, "comment_density": 0.019, "code": "\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \"mesh.h\"\n#include \"math_helpers.h\"\n\nstruct ind_type { uint32_t position, uv, normal, material; };\n\nbool operator==(const ind_type& a, const ind_type& b) {\n\treturn a.position == b.position && a.uv == b.uv && a.normal == b.normal && a.material == b.material;\n}\n\nnamespace std {\n\ttemplate<>\n\tstruct hash {\n\t\tsize_t operator()(const ind_type& i) const {\n\t\t\tsize_t result = 0;\n\t\t\tfor (uint32_t k : {i.position, i.uv, i.normal, i.material}) {\n\t\t\t\tsrnd(k); rnd();\n\t\t\t\tresult ^= rnd_seed + 0x9e3779b9 + (result << 6) + (result >> 2);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t};\n}\n\nvoid get_mesh(const char* filename, void* meshPtr, bool smooth_shaded) {\n\t\n\tusing namespace std;\n\t\n\tstruct binary_header {\n\t\tuint32_t position_count, uv_count, normal_count, material_count, triangle_count;\n\t};\n\n\tvector positions;\n\tvector uvs;\n\tvector normals;\n\tvector material_albedos;\n\tvector indices;\n\t\n\tfilesystem::path path(filename);\n\t\n\tpath.replace_extension(\".bin\");\n\tif (!filesystem::exists(path)) {\n\n\t\tpath.replace_extension(\".mtl\");\n\t\tFILE* mtlFile = fopen(path.string().c_str(), \"rb\");\n\t\tfseek(mtlFile, 0, SEEK_END);\n\t\tconst size_t mtlSize = size_t(ftell(mtlFile)) + 1;\n\n\t\tvector mtlContents(mtlSize);\n\t\tmtlContents.back() = '\\0';\n\t\tfseek(mtlFile, 0, SEEK_SET);\n\t\tfread(mtlContents.data(), 1, mtlSize - 1, mtlFile);\n\t\tfclose(mtlFile);\n\n\t\tvector mtlNameIndices;\n\t\tvec3 color(1.f);\n\t\tint i = 0;\n\t\twhile (i < mtlSize - 1) {\n\t\t\tif (mtlContents[i] == 'n') {\n\t\t\t\ti += 7; // skip \"newmtl \"\n\t\t\t\twhile (mtlContents[i] == ' ' || mtlContents[i] == '\\t') i++;\n\n\t\t\t\tif (mtlNameIndices.size() > 0)\n\t\t\t\t\tmaterial_albedos.push_back(color);\n\t\t\t\tmtlNameIndices.push_back(i);\n\t\t\t}\n\t\t\telse if (mtlContents[i] == 'K' && mtlContents[i+1] == 'd')\n\t\t\t\tsscanf(mtlContents.data() + i + 2, \" %g %g %g\", color.data, color.data+1, color.data+2);\n\t\t\twhile (i < mtlSize - 1 && mtlContents[i++] != '\\n');\n\t\t}\n\t\tmaterial_albedos.push_back(color);\n\t\n\t\tpath.replace_extension(\".obj\");\n\n\t\tFILE* objFile = fopen(path.string().c_str(), \"rb\");\n\t\tfseek(objFile, 0, SEEK_END);\n\t\tconst size_t objSize = size_t(ftell(objFile)) + 1;\n\n\t\tvector objContents(objSize);\n\t\tobjContents.back() = '\\0';\n\t\tfseek(objFile, 0, SEEK_SET);\n\t\tfread(objContents.data(), 1, objSize - 1, objFile);\n\t\tfclose(objFile);\n\n\t\tint use_mtl_index = 0;\n\t\ti = 0;\n\t\twhile (i= 2)\n\t\t\t\t\t\tfor(int k = 0; k<3; ++k)\n\t\t\t\t\t\t\tindices.push_back(sweep_inds[k]);\n\n\t\t\t\t\tsweep_inds[1] = sweep_inds[2];\n\t\t\t\t\tj++; write_index = 2;\n\n\t\t\t\t\twhile (objContents[i] == ' ' || objContents[i] == '\\t') i++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (objContents[i] == 'u' && objContents[i+1] == 's') {\n\t\t\t\tuse_mtl_index = -1;\n\t\t\t\ti += 7; // skip \"usemtl \"\n\t\t\t\twhile (objContents[i] == ' ' || objContents[i] == '\\t') i++;\n\t\t\t\tfor (auto j: mtlNameIndices) {\n\t\t\t\t\tuse_mtl_index++;\n\t\t\t\t\tint k = i;\n\t\t\t\t\tbool match = false;\n\t\t\t\t\twhile (objContents[k] == mtlContents[j] && objContents[k] != '\\0') {\n\t\t\t\t\t\tif (objContents[k] == ' ' || objContents[k] == '\\t' || objContents[k] == '\\n' || objContents[k] == '\\0') {\n\t\t\t\t\t\t\tmatch = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tk++; j++;\n\t\t\t\t\t}\n\t\t\t\t\tif (match) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (i < objSize - 1 && objContents[i] != '\\n') i++;\n\t\t\ti++;\n\t\t}\n\t\tpath.replace_extension(\".bin\");\n\t\tFILE* binFile = fopen(path.string().c_str(), \"wb\");\n\t\tbinary_header header = { uint32_t(positions.size()), uint32_t(uvs.size()), uint32_t(normals.size()), uint32_t(material_albedos.size()), uint32_t(indices.size()) };\n\t\tfwrite(&header, sizeof(header), 1, binFile);\n\t\tfwrite(positions.data(), sizeof(positions[0]), positions.size(), binFile);\n\t\tfwrite(uvs.data(), sizeof(uvs[0]), uvs.size(), binFile);\n\t\tfwrite(normals.data(), sizeof(normals[0]), normals.size(), binFile);\n\t\tfwrite(material_albedos.data(), sizeof(material_albedos[0]), material_albedos.size(), binFile);\n\t\tfwrite(indices.data(), sizeof(indices[0]), indices.size(), binFile);\n\t\tfclose(binFile);\n\t}\n\telse {\n\t\tFILE* binFile = fopen(path.string().c_str(), \"rb\");\n\t\tbinary_header header;\n\t\tfread(&header, sizeof(header), 1, binFile);\n\t\tpositions.resize(header.position_count); uvs.resize(header.uv_count); normals.resize(header.normal_count);\n\t\tmaterial_albedos.resize(header.material_count); indices.resize(header.triangle_count);\n\t\tfread(positions.data(), sizeof(positions[0]), positions.size(), binFile);\n\t\tfread(uvs.data(), sizeof(uvs[0]), uvs.size(), binFile);\n\t\tfread(normals.data(), sizeof(normals[0]), normals.size(), binFile);\n\t\tfread(material_albedos.data(), sizeof(material_albedos[0]), material_albedos.size(), binFile);\n\t\tfread(indices.data(), sizeof(indices[0]), indices.size(), binFile);\n\t\tfclose(binFile);\n\t}\n\n\tif (!smooth_shaded) {\n\t\tFlatMesh* mesh = (FlatMesh*)meshPtr;\n\t\tmesh->triangle_count = int(indices.size()/3);\n#ifdef _WIN32\n\t\tmesh->triangles = (FlatMesh::triangle*)_aligned_malloc(mesh->triangle_count * sizeof(FlatMesh::triangle), 16);\n#else\t\t\t\t\t\t\t\t\t\t\t// see how the arguments are flipped? pretty funny joke by whoever defined these :)\n\t\tmesh->triangles = (FlatMesh::triangle*)aligned_alloc(16, mesh->triangle_count * sizeof(FlatMesh::triangle));\n#endif\n\t\tfor (int i = 0; i < mesh->triangle_count; ++i) {\n\t\t\tvec3 color = material_albedos[indices[i * 3].material];\n\t\t\tfor (int j = 0; j < 3; ++j) {\n\t\t\t\tconst auto ind = indices[i * 3 + j];\n\t\t\t\tvec3 position = positions[ind.position];\n\t\t\t\t\n\t\t\t\tmesh->triangles[i].vertices[j].position = _mm_setr_ps(position.x, position.y, position.z, 1.f);\n\t\t\t\tvec3 normal = normals[ind.normal];\n\t\t\t\tmesh->triangles[i].vertices[j].normal = _mm_setr_ps(normal.x, normal.y, normal.z, 1.f);\n\t\t\t\tmesh->triangles[i].vertices[j].color = _mm_setr_ps(color.r, color.g, color.b, 1.f);\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tMesh* mesh = (Mesh*)meshPtr;\n\t\tmesh->triangle_count = int(indices.size() / 3);\n\t\tmesh->vertex_count = int(positions.size());\n\n\t\tstd::unordered_map ind_to_vert;\n\t\tstd::vector verts;\n\t\tstd::vector inds;\n\n\t\tfor (ind_type i : indices) {\n\t\t\tif(i.position > mesh->vertex_count) continue;\n\t\t\tif (!ind_to_vert.count(i)) {\n\t\t\t\tind_to_vert[i] = verts.size();\n\t\t\t\tverts.push_back({});\n\t\t\t\tverts.back().position = vec4(positions[i.position], 1.f);\n\t\t\t\tverts.back().normal = i.normal < normals.size() ? vec4(normals[i.normal], 1.f) : vec4(.0f);\n\t\t\t\tverts.back().uv = i.uvvertex_count = verts.size();\n\t\tmesh->verts = new Mesh::vertex[mesh->vertex_count];\n\t\tmemcpy(mesh->verts, verts.data(), sizeof(Mesh::vertex)*verts.size());\n\t\tmesh->indices = new uint32_t[mesh->triangle_count * 3];\n\t\tmemcpy(mesh->indices, inds.data(), sizeof(uint32_t)*inds.size());\n\t}\n}\n\n"}, {"path": "utils/mesh.h", "language": "c", "loc": 35, "comment_density": 0.0, "code": "#pragma once\n\n\n#include \n\nvoid get_mesh(const char* filename, void* mesh, bool smooth_shaded);\n\nstruct FlatMesh {\n\tstruct vertex {\n\t\t__m128 position, normal, color;\n\t};\n\tstruct triangle {\n\t\tvertex vertices[3];\n\t} *triangles = nullptr;\n\tint triangle_count = 0;\n\n\tFlatMesh(const char* filename) {\n\t\tget_mesh(filename, this, false);\n\t}\n\t~FlatMesh() {\n#ifdef _WIN32\n\t\t_aligned_free(triangles);\n#else\n\t\tfree(triangles);\n#endif\n\t}\n};\n\n#include \"glsl.h\"\n\nstruct Mesh {\n\tstruct vertex {\n\t\tvec4 position, normal, color;\n\t\tvec2 uv;\n\t} *verts = nullptr;\n\tuint32_t* indices = nullptr;\n\tint vertex_count = 0, triangle_count = 0;\n\n\tMesh(const char* filename) {\n\t\tget_mesh(filename, this, true);\n\t}\n\t~Mesh() { delete[] verts; delete[] indices; }\n};\n"}, {"path": "utils/wglext.h", "language": "c", "loc": 788, "comment_density": 0.115, "code": "#ifndef __wglext_h_\n#define __wglext_h_ 1\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\t/*\n\t** Copyright (c) 2013-2017 The Khronos Group Inc.\n\t**\n\t** Permission is hereby granted, free of charge, to any person obtaining a\n\t** copy of this software and/or associated documentation files (the\n\t** \"Materials\"), to deal in the Materials without restriction, including\n\t** without limitation the rights to use, copy, modify, merge, publish,\n\t** distribute, sublicense, and/or sell copies of the Materials, and to\n\t** permit persons to whom the Materials are furnished to do so, subject to\n\t** the following conditions:\n\t**\n\t** The above copyright notice and this permission notice shall be included\n\t** in all copies or substantial portions of the Materials.\n\t**\n\t** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n\t** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\t** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n\t** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\t** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n\t** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n\t*/\n\t/*\n\t** This header is generated from the Khronos OpenGL / OpenGL ES XML\n\t** API Registry. The current version of the Registry, generator scripts\n\t** used to make the header, and the header can be found at\n\t** https://github.com/KhronosGroup/OpenGL-Registry\n\t*/\n\n#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)\n#define WIN32_LEAN_AND_MEAN 1\n#include \n#endif\n\n#define WGL_WGLEXT_VERSION 20170817\n\n\t/* Generated C header for:\n\t* API: wgl\n\t* Versions considered: .*\n\t* Versions emitted: _nomatch_^\n\t* Default extensions included: wgl\n\t* Additional extensions included: _nomatch_^\n\t* Extensions removed: _nomatch_^\n\t*/\n\n#ifndef WGL_ARB_buffer_region\n#define WGL_ARB_buffer_region 1\n#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001\n#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002\n#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004\n#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008\n\ttypedef HANDLE(WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);\n\ttypedef VOID(WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);\n\ttypedef BOOL(WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);\n\ttypedef BOOL(WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHANDLE WINAPI wglCreateBufferRegionARB(HDC hDC, int iLayerPlane, UINT uType);\n\tVOID WINAPI wglDeleteBufferRegionARB(HANDLE hRegion);\n\tBOOL WINAPI wglSaveBufferRegionARB(HANDLE hRegion, int x, int y, int width, int height);\n\tBOOL WINAPI wglRestoreBufferRegionARB(HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\n#endif\n#endif /* WGL_ARB_buffer_region */\n\n#ifndef WGL_ARB_context_flush_control\n#define WGL_ARB_context_flush_control 1\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098\n#endif /* WGL_ARB_context_flush_control */\n\n#ifndef WGL_ARB_create_context\n#define WGL_ARB_create_context 1\n#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001\n#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002\n#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093\n#define WGL_CONTEXT_FLAGS_ARB 0x2094\n#define ERROR_INVALID_VERSION_ARB 0x2095\n\ttypedef HGLRC(WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHGLRC WINAPI wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList);\n#endif\n#endif /* WGL_ARB_create_context */\n\n#ifndef WGL_ARB_create_context_no_error\n#define WGL_ARB_create_context_no_error 1\n#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3\n#endif /* WGL_ARB_create_context_no_error */\n\n#ifndef WGL_ARB_create_context_profile\n#define WGL_ARB_create_context_profile 1\n#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126\n#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define ERROR_INVALID_PROFILE_ARB 0x2096\n#endif /* WGL_ARB_create_context_profile */\n\n#ifndef WGL_ARB_create_context_robustness\n#define WGL_ARB_create_context_robustness 1\n#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261\n#endif /* WGL_ARB_create_context_robustness */\n\n#ifndef WGL_ARB_extensions_string\n#define WGL_ARB_extensions_string 1\n\ttypedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tconst char *WINAPI wglGetExtensionsStringARB(HDC hdc);\n#endif\n#endif /* WGL_ARB_extensions_string */\n\n#ifndef WGL_ARB_framebuffer_sRGB\n#define WGL_ARB_framebuffer_sRGB 1\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9\n#endif /* WGL_ARB_framebuffer_sRGB */\n\n#ifndef WGL_ARB_make_current_read\n#define WGL_ARB_make_current_read 1\n#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043\n#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054\n\ttypedef BOOL(WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\ttypedef HDC(WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\tHDC WINAPI wglGetCurrentReadDCARB(void);\n#endif\n#endif /* WGL_ARB_make_current_read */\n\n#ifndef WGL_ARB_multisample\n#define WGL_ARB_multisample 1\n#define WGL_SAMPLE_BUFFERS_ARB 0x2041\n#define WGL_SAMPLES_ARB 0x2042\n#endif /* WGL_ARB_multisample */\n\n#ifndef WGL_ARB_pbuffer\n#define WGL_ARB_pbuffer 1\n\tDECLARE_HANDLE(HPBUFFERARB);\n#define WGL_DRAW_TO_PBUFFER_ARB 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030\n#define WGL_PBUFFER_LARGEST_ARB 0x2033\n#define WGL_PBUFFER_WIDTH_ARB 0x2034\n#define WGL_PBUFFER_HEIGHT_ARB 0x2035\n#define WGL_PBUFFER_LOST_ARB 0x2036\n\ttypedef HPBUFFERARB(WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\ttypedef HDC(WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);\n\ttypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHPBUFFERARB WINAPI wglCreatePbufferARB(HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\tHDC WINAPI wglGetPbufferDCARB(HPBUFFERARB hPbuffer);\n\tint WINAPI wglReleasePbufferDCARB(HPBUFFERARB hPbuffer, HDC hDC);\n\tBOOL WINAPI wglDestroyPbufferARB(HPBUFFERARB hPbuffer);\n\tBOOL WINAPI wglQueryPbufferARB(HPBUFFERARB hPbuffer, int iAttribute, int *piValue);\n#endif\n#endif /* WGL_ARB_pbuffer */\n\n#ifndef WGL_ARB_pixel_format\n#define WGL_ARB_pixel_format 1\n#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000\n#define WGL_DRAW_TO_WINDOW_ARB 0x2001\n#define WGL_DRAW_TO_BITMAP_ARB 0x2002\n#define WGL_ACCELERATION_ARB 0x2003\n#define WGL_NEED_PALETTE_ARB 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006\n#define WGL_SWAP_METHOD_ARB 0x2007\n#define WGL_NUMBER_OVERLAYS_ARB 0x2008\n#define WGL_NUMBER_UNDERLAYS_ARB 0x2009\n#define WGL_TRANSPARENT_ARB 0x200A\n#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037\n#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038\n#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039\n#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A\n#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B\n#define WGL_SHARE_DEPTH_ARB 0x200C\n#define WGL_SHARE_STENCIL_ARB 0x200D\n#define WGL_SHARE_ACCUM_ARB 0x200E\n#define WGL_SUPPORT_GDI_ARB 0x200F\n#define WGL_SUPPORT_OPENGL_ARB 0x2010\n#define WGL_DOUBLE_BUFFER_ARB 0x2011\n#define WGL_STEREO_ARB 0x2012\n#define WGL_PIXEL_TYPE_ARB 0x2013\n#define WGL_COLOR_BITS_ARB 0x2014\n#define WGL_RED_BITS_ARB 0x2015\n#define WGL_RED_SHIFT_ARB 0x2016\n#define WGL_GREEN_BITS_ARB 0x2017\n#define WGL_GREEN_SHIFT_ARB 0x2018\n#define WGL_BLUE_BITS_ARB 0x2019\n#define WGL_BLUE_SHIFT_ARB 0x201A\n#define WGL_ALPHA_BITS_ARB 0x201B\n#define WGL_ALPHA_SHIFT_ARB 0x201C\n#define WGL_ACCUM_BITS_ARB 0x201D\n#define WGL_ACCUM_RED_BITS_ARB 0x201E\n#define WGL_ACCUM_GREEN_BITS_ARB 0x201F\n#define WGL_ACCUM_BLUE_BITS_ARB 0x2020\n#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021\n#define WGL_DEPTH_BITS_ARB 0x2022\n#define WGL_STENCIL_BITS_ARB 0x2023\n#define WGL_AUX_BUFFERS_ARB 0x2024\n#define WGL_NO_ACCELERATION_ARB 0x2025\n#define WGL_GENERIC_ACCELERATION_ARB 0x2026\n#define WGL_FULL_ACCELERATION_ARB 0x2027\n#define WGL_SWAP_EXCHANGE_ARB 0x2028\n#define WGL_SWAP_COPY_ARB 0x2029\n#define WGL_SWAP_UNDEFINED_ARB 0x202A\n#define WGL_TYPE_RGBA_ARB 0x202B\n#define WGL_TYPE_COLORINDEX_ARB 0x202C\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);\n\ttypedef BOOL(WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetPixelFormatAttribivARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);\n\tBOOL WINAPI wglGetPixelFormatAttribfvARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);\n\tBOOL WINAPI wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#endif\n#endif /* WGL_ARB_pixel_format */\n\n#ifndef WGL_ARB_pixel_format_float\n#define WGL_ARB_pixel_format_float 1\n#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0\n#endif /* WGL_ARB_pixel_format_float */\n\n#ifndef WGL_ARB_render_texture\n#define WGL_ARB_render_texture 1\n#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070\n#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071\n#define WGL_TEXTURE_FORMAT_ARB 0x2072\n#define WGL_TEXTURE_TARGET_ARB 0x2073\n#define WGL_MIPMAP_TEXTURE_ARB 0x2074\n#define WGL_TEXTURE_RGB_ARB 0x2075\n#define WGL_TEXTURE_RGBA_ARB 0x2076\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078\n#define WGL_TEXTURE_1D_ARB 0x2079\n#define WGL_TEXTURE_2D_ARB 0x207A\n#define WGL_MIPMAP_LEVEL_ARB 0x207B\n#define WGL_CUBE_MAP_FACE_ARB 0x207C\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082\n#define WGL_FRONT_LEFT_ARB 0x2083\n#define WGL_FRONT_RIGHT_ARB 0x2084\n#define WGL_BACK_LEFT_ARB 0x2085\n#define WGL_BACK_RIGHT_ARB 0x2086\n#define WGL_AUX0_ARB 0x2087\n#define WGL_AUX1_ARB 0x2088\n#define WGL_AUX2_ARB 0x2089\n#define WGL_AUX3_ARB 0x208A\n#define WGL_AUX4_ARB 0x208B\n#define WGL_AUX5_ARB 0x208C\n#define WGL_AUX6_ARB 0x208D\n#define WGL_AUX7_ARB 0x208E\n#define WGL_AUX8_ARB 0x208F\n#define WGL_AUX9_ARB 0x2090\n\ttypedef BOOL(WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer);\n\tBOOL WINAPI wglReleaseTexImageARB(HPBUFFERARB hPbuffer, int iBuffer);\n\tBOOL WINAPI wglSetPbufferAttribARB(HPBUFFERARB hPbuffer, const int *piAttribList);\n#endif\n#endif /* WGL_ARB_render_texture */\n\n#ifndef WGL_ARB_robustness_application_isolation\n#define WGL_ARB_robustness_application_isolation 1\n#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n#endif /* WGL_ARB_robustness_application_isolation */\n\n#ifndef WGL_ARB_robustness_share_group_isolation\n#define WGL_ARB_robustness_share_group_isolation 1\n#endif /* WGL_ARB_robustness_share_group_isolation */\n\n#ifndef WGL_3DFX_multisample\n#define WGL_3DFX_multisample 1\n#define WGL_SAMPLE_BUFFERS_3DFX 0x2060\n#define WGL_SAMPLES_3DFX 0x2061\n#endif /* WGL_3DFX_multisample */\n\n#ifndef WGL_3DL_stereo_control\n#define WGL_3DL_stereo_control 1\n#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055\n#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056\n#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057\n#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058\n\ttypedef BOOL(WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglSetStereoEmitterState3DL(HDC hDC, UINT uState);\n#endif\n#endif /* WGL_3DL_stereo_control */\n\n#ifndef WGL_AMD_gpu_association\n#define WGL_AMD_gpu_association 1\n#define WGL_GPU_VENDOR_AMD 0x1F00\n#define WGL_GPU_RENDERER_STRING_AMD 0x1F01\n#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define WGL_GPU_RAM_AMD 0x21A3\n#define WGL_GPU_CLOCK_AMD 0x21A4\n#define WGL_GPU_NUM_PIPES_AMD 0x21A5\n#define WGL_GPU_NUM_SIMD_AMD 0x21A6\n#define WGL_GPU_NUM_RB_AMD 0x21A7\n#define WGL_GPU_NUM_SPI_AMD 0x21A8\n\ttypedef UINT(WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);\n\ttypedef INT(WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);\n\ttypedef UINT(WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);\n\ttypedef HGLRC(WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);\n\ttypedef HGLRC(WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);\n\ttypedef BOOL(WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);\n\ttypedef BOOL(WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);\n\ttypedef HGLRC(WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);\n\ttypedef VOID(WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tUINT WINAPI wglGetGPUIDsAMD(UINT maxCount, UINT *ids);\n\tINT WINAPI wglGetGPUInfoAMD(UINT id, int property, GLenum dataType, UINT size, void *data);\n\tUINT WINAPI wglGetContextGPUIDAMD(HGLRC hglrc);\n\tHGLRC WINAPI wglCreateAssociatedContextAMD(UINT id);\n\tHGLRC WINAPI wglCreateAssociatedContextAttribsAMD(UINT id, HGLRC hShareContext, const int *attribList);\n\tBOOL WINAPI wglDeleteAssociatedContextAMD(HGLRC hglrc);\n\tBOOL WINAPI wglMakeAssociatedContextCurrentAMD(HGLRC hglrc);\n\tHGLRC WINAPI wglGetCurrentAssociatedContextAMD(void);\n\tVOID WINAPI wglBlitContextFramebufferAMD(HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\n#endif\n#endif /* WGL_AMD_gpu_association */\n\n#ifndef WGL_ATI_pixel_format_float\n#define WGL_ATI_pixel_format_float 1\n#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0\n#endif /* WGL_ATI_pixel_format_float */\n\n#ifndef WGL_EXT_colorspace\n#define WGL_EXT_colorspace 1\n#define WGL_COLORSPACE_EXT 0x3087\n#define WGL_COLORSPACE_SRGB_EXT 0x3089\n#define WGL_COLORSPACE_LINEAR_EXT 0x308A\n#endif /* WGL_EXT_colorspace */\n\n#ifndef WGL_EXT_create_context_es2_profile\n#define WGL_EXT_create_context_es2_profile 1\n#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n#endif /* WGL_EXT_create_context_es2_profile */\n\n#ifndef WGL_EXT_create_context_es_profile\n#define WGL_EXT_create_context_es_profile 1\n#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n#endif /* WGL_EXT_create_context_es_profile */\n\n#ifndef WGL_EXT_depth_float\n#define WGL_EXT_depth_float 1\n#define WGL_DEPTH_FLOAT_EXT 0x2040\n#endif /* WGL_EXT_depth_float */\n\n#ifndef WGL_EXT_display_color_table\n#define WGL_EXT_display_color_table 1\n\ttypedef GLboolean(WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n\ttypedef GLboolean(WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);\n\ttypedef GLboolean(WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n\ttypedef VOID(WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tGLboolean WINAPI wglCreateDisplayColorTableEXT(GLushort id);\n\tGLboolean WINAPI wglLoadDisplayColorTableEXT(const GLushort *table, GLuint length);\n\tGLboolean WINAPI wglBindDisplayColorTableEXT(GLushort id);\n\tVOID WINAPI wglDestroyDisplayColorTableEXT(GLushort id);\n#endif\n#endif /* WGL_EXT_display_color_table */\n\n#ifndef WGL_EXT_extensions_string\n#define WGL_EXT_extensions_string 1\n\ttypedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tconst char *WINAPI wglGetExtensionsStringEXT(void);\n#endif\n#endif /* WGL_EXT_extensions_string */\n\n#ifndef WGL_EXT_framebuffer_sRGB\n#define WGL_EXT_framebuffer_sRGB 1\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9\n#endif /* WGL_EXT_framebuffer_sRGB */\n\n#ifndef WGL_EXT_make_current_read\n#define WGL_EXT_make_current_read 1\n#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043\n\ttypedef BOOL(WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\ttypedef HDC(WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglMakeContextCurrentEXT(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\tHDC WINAPI wglGetCurrentReadDCEXT(void);\n#endif\n#endif /* WGL_EXT_make_current_read */\n\n#ifndef WGL_EXT_multisample\n#define WGL_EXT_multisample 1\n#define WGL_SAMPLE_BUFFERS_EXT 0x2041\n#define WGL_SAMPLES_EXT 0x2042\n#endif /* WGL_EXT_multisample */\n\n#ifndef WGL_EXT_pbuffer\n#define WGL_EXT_pbuffer 1\n\tDECLARE_HANDLE(HPBUFFEREXT);\n#define WGL_DRAW_TO_PBUFFER_EXT 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030\n#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031\n#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032\n#define WGL_PBUFFER_LARGEST_EXT 0x2033\n#define WGL_PBUFFER_WIDTH_EXT 0x2034\n#define WGL_PBUFFER_HEIGHT_EXT 0x2035\n\ttypedef HPBUFFEREXT(WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\ttypedef HDC(WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);\n\ttypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHPBUFFEREXT WINAPI wglCreatePbufferEXT(HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\tHDC WINAPI wglGetPbufferDCEXT(HPBUFFEREXT hPbuffer);\n\tint WINAPI wglReleasePbufferDCEXT(HPBUFFEREXT hPbuffer, HDC hDC);\n\tBOOL WINAPI wglDestroyPbufferEXT(HPBUFFEREXT hPbuffer);\n\tBOOL WINAPI wglQueryPbufferEXT(HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);\n#endif\n#endif /* WGL_EXT_pbuffer */\n\n#ifndef WGL_EXT_pixel_format\n#define WGL_EXT_pixel_format 1\n#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000\n#define WGL_DRAW_TO_WINDOW_EXT 0x2001\n#define WGL_DRAW_TO_BITMAP_EXT 0x2002\n#define WGL_ACCELERATION_EXT 0x2003\n#define WGL_NEED_PALETTE_EXT 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006\n#define WGL_SWAP_METHOD_EXT 0x2007\n#define WGL_NUMBER_OVERLAYS_EXT 0x2008\n#define WGL_NUMBER_UNDERLAYS_EXT 0x2009\n#define WGL_TRANSPARENT_EXT 0x200A\n#define WGL_TRANSPARENT_VALUE_EXT 0x200B\n#define WGL_SHARE_DEPTH_EXT 0x200C\n#define WGL_SHARE_STENCIL_EXT 0x200D\n#define WGL_SHARE_ACCUM_EXT 0x200E\n#define WGL_SUPPORT_GDI_EXT 0x200F\n#define WGL_SUPPORT_OPENGL_EXT 0x2010\n#define WGL_DOUBLE_BUFFER_EXT 0x2011\n#define WGL_STEREO_EXT 0x2012\n#define WGL_PIXEL_TYPE_EXT 0x2013\n#define WGL_COLOR_BITS_EXT 0x2014\n#define WGL_RED_BITS_EXT 0x2015\n#define WGL_RED_SHIFT_EXT 0x2016\n#define WGL_GREEN_BITS_EXT 0x2017\n#define WGL_GREEN_SHIFT_EXT 0x2018\n#define WGL_BLUE_BITS_EXT 0x2019\n#define WGL_BLUE_SHIFT_EXT 0x201A\n#define WGL_ALPHA_BITS_EXT 0x201B\n#define WGL_ALPHA_SHIFT_EXT 0x201C\n#define WGL_ACCUM_BITS_EXT 0x201D\n#define WGL_ACCUM_RED_BITS_EXT 0x201E\n#define WGL_ACCUM_GREEN_BITS_EXT 0x201F\n#define WGL_ACCUM_BLUE_BITS_EXT 0x2020\n#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021\n#define WGL_DEPTH_BITS_EXT 0x2022\n#define WGL_STENCIL_BITS_EXT 0x2023\n#define WGL_AUX_BUFFERS_EXT 0x2024\n#define WGL_NO_ACCELERATION_EXT 0x2025\n#define WGL_GENERIC_ACCELERATION_EXT 0x2026\n#define WGL_FULL_ACCELERATION_EXT 0x2027\n#define WGL_SWAP_EXCHANGE_EXT 0x2028\n#define WGL_SWAP_COPY_EXT 0x2029\n#define WGL_SWAP_UNDEFINED_EXT 0x202A\n#define WGL_TYPE_RGBA_EXT 0x202B\n#define WGL_TYPE_COLORINDEX_EXT 0x202C\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);\n\ttypedef BOOL(WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetPixelFormatAttribivEXT(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);\n\tBOOL WINAPI wglGetPixelFormatAttribfvEXT(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);\n\tBOOL WINAPI wglChoosePixelFormatEXT(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#endif\n#endif /* WGL_EXT_pixel_format */\n\n#ifndef WGL_EXT_pixel_format_packed_float\n#define WGL_EXT_pixel_format_packed_float 1\n#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8\n#endif /* WGL_EXT_pixel_format_packed_float */\n\n#ifndef WGL_EXT_swap_control\n#define WGL_EXT_swap_control 1\n\ttypedef BOOL(WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);\n\ttypedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglSwapIntervalEXT(int interval);\n\tint WINAPI wglGetSwapIntervalEXT(void);\n#endif\n#endif /* WGL_EXT_swap_control */\n\n#ifndef WGL_EXT_swap_control_tear\n#define WGL_EXT_swap_control_tear 1\n#endif /* WGL_EXT_swap_control_tear */\n\n#ifndef WGL_I3D_digital_video_control\n#define WGL_I3D_digital_video_control 1\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051\n#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052\n#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053\n\ttypedef BOOL(WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetDigitalVideoParametersI3D(HDC hDC, int iAttribute, int *piValue);\n\tBOOL WINAPI wglSetDigitalVideoParametersI3D(HDC hDC, int iAttribute, const int *piValue);\n#endif\n#endif /* WGL_I3D_digital_video_control */\n\n#ifndef WGL_I3D_gamma\n#define WGL_I3D_gamma 1\n#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E\n#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F\n\ttypedef BOOL(WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);\n\ttypedef BOOL(WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetGammaTableParametersI3D(HDC hDC, int iAttribute, int *piValue);\n\tBOOL WINAPI wglSetGammaTableParametersI3D(HDC hDC, int iAttribute, const int *piValue);\n\tBOOL WINAPI wglGetGammaTableI3D(HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);\n\tBOOL WINAPI wglSetGammaTableI3D(HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);\n#endif\n#endif /* WGL_I3D_gamma */\n\n#ifndef WGL_I3D_genlock\n#define WGL_I3D_genlock 1\n#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044\n#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045\n#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046\n#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047\n#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048\n#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049\n#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A\n#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B\n#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C\n\ttypedef BOOL(WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnableGenlockI3D(HDC hDC);\n\tBOOL WINAPI wglDisableGenlockI3D(HDC hDC);\n\tBOOL WINAPI wglIsEnabledGenlockI3D(HDC hDC, BOOL *pFlag);\n\tBOOL WINAPI wglGenlockSourceI3D(HDC hDC, UINT uSource);\n\tBOOL WINAPI wglGetGenlockSourceI3D(HDC hDC, UINT *uSource);\n\tBOOL WINAPI wglGenlockSourceEdgeI3D(HDC hDC, UINT uEdge);\n\tBOOL WINAPI wglGetGenlockSourceEdgeI3D(HDC hDC, UINT *uEdge);\n\tBOOL WINAPI wglGenlockSampleRateI3D(HDC hDC, UINT uRate);\n\tBOOL WINAPI wglGetGenlockSampleRateI3D(HDC hDC, UINT *uRate);\n\tBOOL WINAPI wglGenlockSourceDelayI3D(HDC hDC, UINT uDelay);\n\tBOOL WINAPI wglGetGenlockSourceDelayI3D(HDC hDC, UINT *uDelay);\n\tBOOL WINAPI wglQueryGenlockMaxSourceDelayI3D(HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);\n#endif\n#endif /* WGL_I3D_genlock */\n\n#ifndef WGL_I3D_image_buffer\n#define WGL_I3D_image_buffer 1\n#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001\n#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002\n\ttypedef LPVOID(WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);\n\ttypedef BOOL(WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tLPVOID WINAPI wglCreateImageBufferI3D(HDC hDC, DWORD dwSize, UINT uFlags);\n\tBOOL WINAPI wglDestroyImageBufferI3D(HDC hDC, LPVOID pAddress);\n\tBOOL WINAPI wglAssociateImageBufferEventsI3D(HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);\n\tBOOL WINAPI wglReleaseImageBufferEventsI3D(HDC hDC, const LPVOID *pAddress, UINT count);\n#endif\n#endif /* WGL_I3D_image_buffer */\n\n#ifndef WGL_I3D_swap_frame_lock\n#define WGL_I3D_swap_frame_lock 1\n\ttypedef BOOL(WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnableFrameLockI3D(void);\n\tBOOL WINAPI wglDisableFrameLockI3D(void);\n\tBOOL WINAPI wglIsEnabledFrameLockI3D(BOOL *pFlag);\n\tBOOL WINAPI wglQueryFrameLockMasterI3D(BOOL *pFlag);\n#endif\n#endif /* WGL_I3D_swap_frame_lock */\n\n#ifndef WGL_I3D_swap_frame_usage\n#define WGL_I3D_swap_frame_usage 1\n\ttypedef BOOL(WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);\n\ttypedef BOOL(WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetFrameUsageI3D(float *pUsage);\n\tBOOL WINAPI wglBeginFrameTrackingI3D(void);\n\tBOOL WINAPI wglEndFrameTrackingI3D(void);\n\tBOOL WINAPI wglQueryFrameTrackingI3D(DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n#endif\n#endif /* WGL_I3D_swap_frame_usage */\n\n#ifndef WGL_NV_DX_interop\n#define WGL_NV_DX_interop 1\n#define WGL_ACCESS_READ_ONLY_NV 0x00000000\n#define WGL_ACCESS_READ_WRITE_NV 0x00000001\n#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002\n\ttypedef BOOL(WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);\n\ttypedef HANDLE(WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);\n\ttypedef BOOL(WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);\n\ttypedef HANDLE(WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);\n\ttypedef BOOL(WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);\n\ttypedef BOOL(WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);\n\ttypedef BOOL(WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);\n\ttypedef BOOL(WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglDXSetResourceShareHandleNV(void *dxObject, HANDLE shareHandle);\n\tHANDLE WINAPI wglDXOpenDeviceNV(void *dxDevice);\n\tBOOL WINAPI wglDXCloseDeviceNV(HANDLE hDevice);\n\tHANDLE WINAPI wglDXRegisterObjectNV(HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);\n\tBOOL WINAPI wglDXUnregisterObjectNV(HANDLE hDevice, HANDLE hObject);\n\tBOOL WINAPI wglDXObjectAccessNV(HANDLE hObject, GLenum access);\n\tBOOL WINAPI wglDXLockObjectsNV(HANDLE hDevice, GLint count, HANDLE *hObjects);\n\tBOOL WINAPI wglDXUnlockObjectsNV(HANDLE hDevice, GLint count, HANDLE *hObjects);\n#endif\n#endif /* WGL_NV_DX_interop */\n\n#ifndef WGL_NV_DX_interop2\n#define WGL_NV_DX_interop2 1\n#endif /* WGL_NV_DX_interop2 */\n\n#ifndef WGL_NV_copy_image\n#define WGL_NV_copy_image 1\n\ttypedef BOOL(WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglCopyImageSubDataNV(HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n#endif\n#endif /* WGL_NV_copy_image */\n\n#ifndef WGL_NV_delay_before_swap\n#define WGL_NV_delay_before_swap 1\n\ttypedef BOOL(WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglDelayBeforeSwapNV(HDC hDC, GLfloat seconds);\n#endif\n#endif /* WGL_NV_delay_before_swap */\n\n#ifndef WGL_NV_float_buffer\n#define WGL_NV_float_buffer 1\n#define WGL_FLOAT_COMPONENTS_NV 0x20B0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4\n#define WGL_TEXTURE_FLOAT_R_NV 0x20B5\n#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6\n#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7\n#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8\n#endif /* WGL_NV_float_buffer */\n\n#ifndef WGL_NV_gpu_affinity\n#define WGL_NV_gpu_affinity 1\n\tDECLARE_HANDLE(HGPUNV);\n\tstruct _GPU_DEVICE {\n\t\tDWORD cb;\n\t\tCHAR DeviceName[32];\n\t\tCHAR DeviceString[128];\n\t\tDWORD Flags;\n\t\tRECT rcVirtualScreen;\n\t};\n\ttypedef struct _GPU_DEVICE *PGPU_DEVICE;\n#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0\n#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\n\ttypedef HDC(WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\n\ttypedef BOOL(WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnumGpusNV(UINT iGpuIndex, HGPUNV *phGpu);\n\tBOOL WINAPI wglEnumGpuDevicesNV(HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\n\tHDC WINAPI wglCreateAffinityDCNV(const HGPUNV *phGpuList);\n\tBOOL WINAPI wglEnumGpusFromAffinityDCNV(HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\n\tBOOL WINAPI wglDeleteDCNV(HDC hdc);\n#endif\n#endif /* WGL_NV_gpu_affinity */\n\n#ifndef WGL_NV_multisample_coverage\n#define WGL_NV_multisample_coverage 1\n#define WGL_COVERAGE_SAMPLES_NV 0x2042\n#define WGL_COLOR_SAMPLES_NV 0x20B9\n#endif /* WGL_NV_multisample_coverage */\n\n#ifndef WGL_NV_present_video\n#define WGL_NV_present_video 1\n\tDECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);\n#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0\n\ttypedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tint WINAPI wglEnumerateVideoDevicesNV(HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);\n\tBOOL WINAPI wglBindVideoDeviceNV(HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);\n\tBOOL WINAPI wglQueryCurrentContextNV(int iAttribute, int *piValue);\n#endif\n#endif /* WGL_NV_present_video */\n\n#ifndef WGL_NV_render_depth_texture\n#define WGL_NV_render_depth_texture 1\n#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4\n#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5\n#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6\n#define WGL_DEPTH_COMPONENT_NV 0x20A7\n#endif /* WGL_NV_render_depth_texture */\n\n#ifndef WGL_NV_render_texture_rectangle\n#define WGL_NV_render_texture_rectangle 1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1\n#define WGL_TEXTURE_RECTANGLE_NV 0x20A2\n#endif /* WGL_NV_render_texture_rectangle */\n\n#ifndef WGL_NV_swap_group\n#define WGL_NV_swap_group 1\n\ttypedef BOOL(WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);\n\ttypedef BOOL(WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);\n\ttypedef BOOL(WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglJoinSwapGroupNV(HDC hDC, GLuint group);\n\tBOOL WINAPI wglBindSwapBarrierNV(GLuint group, GLuint barrier);\n\tBOOL WINAPI wglQuerySwapGroupNV(HDC hDC, GLuint *group, GLuint *barrier);\n\tBOOL WINAPI wglQueryMaxSwapGroupsNV(HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);\n\tBOOL WINAPI wglQueryFrameCountNV(HDC hDC, GLuint *count);\n\tBOOL WINAPI wglResetFrameCountNV(HDC hDC);\n#endif\n#endif /* WGL_NV_swap_group */\n\n#ifndef WGL_NV_vertex_array_range\n#define WGL_NV_vertex_array_range 1\n\ttypedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);\n\ttypedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tvoid *WINAPI wglAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);\n\tvoid WINAPI wglFreeMemoryNV(void *pointer);\n#endif\n#endif /* WGL_NV_vertex_array_range */\n\n#ifndef WGL_NV_video_capture\n#define WGL_NV_video_capture 1\n\tDECLARE_HANDLE(HVIDEOINPUTDEVICENV);\n#define WGL_UNIQUE_ID_NV 0x20CE\n#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\n\ttypedef UINT(WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);\n\ttypedef BOOL(WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglBindVideoCaptureDeviceNV(UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\n\tUINT WINAPI wglEnumerateVideoCaptureDevicesNV(HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);\n\tBOOL WINAPI wglLockVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\tBOOL WINAPI wglQueryVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);\n\tBOOL WINAPI wglReleaseVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n#endif\n#endif /* WGL_NV_video_capture */\n\n#ifndef WGL_NV_video_output\n#define WGL_NV_video_output 1\n\tDECLARE_HANDLE(HPVIDEODEV);\n#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0\n#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1\n#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2\n#define WGL_VIDEO_OUT_COLOR_NV 0x20C3\n#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4\n#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5\n#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define WGL_VIDEO_OUT_FRAME 0x20C8\n#define WGL_VIDEO_OUT_FIELD_1 0x20C9\n#define WGL_VIDEO_OUT_FIELD_2 0x20CA\n#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB\n#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC\n\ttypedef BOOL(WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);\n\ttypedef BOOL(WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetVideoDeviceNV(HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);\n\tBOOL WINAPI wglReleaseVideoDeviceNV(HPVIDEODEV hVideoDevice);\n\tBOOL WINAPI wglBindVideoImageNV(HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\n\tBOOL WINAPI wglReleaseVideoImageNV(HPBUFFERARB hPbuffer, int iVideoBuffer);\n\tBOOL WINAPI wglSendPbufferToVideoNV(HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);\n\tBOOL WINAPI wglGetVideoInfoNV(HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\n#endif\n#endif /* WGL_NV_video_output */\n\n#ifndef WGL_OML_sync_control\n#define WGL_OML_sync_control 1\n\ttypedef BOOL(WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);\n\ttypedef BOOL(WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);\n\ttypedef INT64(WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\n\ttypedef INT64(WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\n\ttypedef BOOL(WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);\n\ttypedef BOOL(WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetSyncValuesOML(HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);\n\tBOOL WINAPI wglGetMscRateOML(HDC hdc, INT32 *numerator, INT32 *denominator);\n\tINT64 WINAPI wglSwapBuffersMscOML(HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\n\tINT64 WINAPI wglSwapLayerBuffersMscOML(HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\n\tBOOL WINAPI wglWaitForMscOML(HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);\n\tBOOL WINAPI wglWaitForSbcOML(HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);\n#endif\n#endif /* WGL_OML_sync_control */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif"}, {"path": "utils/window.cpp", "language": "cpp", "loc": 371, "comment_density": 0.065, "code": "\n#include \"window.h\"\n\n#ifndef _WIN32\n#include \n#endif\n\nvoid APIENTRY glDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, void*) {\n\n\t// format the message nicely\n\tauto output = printf(\"OpenGL \");\n\n\tswitch (type) {\n\tcase GL_DEBUG_TYPE_ERROR:\t\t\t\t\tprintf(\"error\");\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_PORTABILITY:\t\t\t\tprintf(\"portability issue\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_PERFORMANCE:\t\t\t\tprintf(\"performance issue\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_OTHER:\t\t\t\t\tprintf(\"issue\");\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:\t\tprintf(\"undefined behavior\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:\t\tprintf(\"deprecated behavior\");\t\t\t\tbreak;\n\tdefault:\t\t\t\t\t\t\t\t\tprintf(\"issue(?)\");\t\t\t\t\t\t\tbreak;\n\t}\n\tswitch (source) {\n\tcase GL_DEBUG_SOURCE_API:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_WINDOW_SYSTEM:\t\t\tprintf(\" in the window system\");\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_SHADER_COMPILER:\t\tprintf(\" in the shader compiler\");\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_THIRD_PARTY:\t\t\tprintf(\" in third party code\");\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_APPLICATION:\t\t\tprintf(\" in this program\");\t\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_OTHER:\t\t\t\t\tprintf(\" in an undefined source\");\t\t\tbreak;\n\tdefault:\t\t\t\t\t\t\t\t\tprintf(\" nowhere(?)\");\t\t\t\t\t\tbreak;\n\t}\n\n\tprintf(\", id %u:\\n%.*s\\n\", id, length, message);\n\t// this is invaluable; you can directly see where any opengl error originated by checking the call stack at this breakpoint\n\tif (type == GL_DEBUG_TYPE_ERROR)\n#ifdef _WIN32\n\t\t__debugbreak();\n#else\n\t\traise(SIGTRAP);\n#endif\n}\n\nvoid setupDebug() {\n\t// enable debug output\n\tglEnable(GL_DEBUG_OUTPUT);\n\t// debug output from main thread: get the correct stack frame when breaking\n\tglEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);\n\n\tglDebugMessageCallback((GLDEBUGPROC)glDebugCallback, 0);\n\n\t// query everything about errors, deprecated and undefined things\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\n\t// disable misc info. might want to check these from time to time!\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 0, 0, GL_FALSE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_PERFORMANCE, GL_DONT_CARE, 0, 0, GL_FALSE);\n}\n\n#ifdef _WIN32\n\n#include \"wglext.h\"\n\n#pragma comment(lib, \"opengl32.lib\")\n\nconst int GL_WINDOW_ATTRIBUTES[] = {\n\tWGL_DRAW_TO_WINDOW_ARB, GL_TRUE,\n\tWGL_SUPPORT_OPENGL_ARB, GL_TRUE,\n\tWGL_DOUBLE_BUFFER_ARB, GL_TRUE,\n\tWGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, GL_TRUE,\n\t//WGL_SAMPLES_ARB, 8, // MSAA\n\n\tWGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,\n\tWGL_COLOR_BITS_ARB, 32,\n\tWGL_DEPTH_BITS_ARB, 24,\n0 };\n\nconst int GL_CONTEXT_ATTRIBUTES[] = {\n\tWGL_CONTEXT_MAJOR_VERSION_ARB, 4,\n\tWGL_CONTEXT_MINOR_VERSION_ARB, 6,\n\tWGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,\n\t//WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,\n0 };\n\nHWND wnd = nullptr;\nHDC dc;\nHGLRC rc;\n\n// update the frame onto screen\nvoid swapBuffers() {\n\tSwapBuffers(dc);\n}\n\nvoid setTitle(const char* title) {\n\tSetWindowTextA(wnd, title);\n}\n\nivec2 getMouse() {\n\tPOINT mouse;\n\tGetCursorPos(&mouse);\n\tScreenToClient(wnd, &mouse);\n\treturn ivec2(mouse.x, mouse.y);\n}\n\nvoid setMouse(ivec2 p) {\n\tPOINT p_{ p.x, p.y };\n\tClientToScreen(wnd, &p_);\n\tSetCursorPos(p_.x, p_.y);\n}\n\nivec2 windowSize() {\n\tRECT r;\n\tGetClientRect(wnd, &r);\n\treturn { r.right - r.left, r.bottom - r.top };\n}\n\nWPARAM down[256]; int downptr = 0;\nWPARAM hit[256]; int hitptr = 0;\n\nbool keyDown(uint vk_code) {\n\tfor (int i = 0; i < downptr; ++i)\n\t\tif (vk_code == down[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nbool keyHit(uint vk_code) {\n\tfor (int i = 0; i < hitptr; ++i)\n\t\tif (vk_code == hit[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nvoid resetHits() {\n\thitptr = 0;\n}\n\ninline WPARAM mapExtended(WPARAM wParam, LPARAM lParam) {\n\tint ext = (lParam>>24)&1;\n\tswitch(wParam) {\n\t\tcase VK_SHIFT: return MapVirtualKeyEx((lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK_EX, GetKeyboardLayout(0));\n\t\tcase VK_CONTROL: return VK_LCONTROL+ext;\n\t\tcase VK_MENU: return VK_LMENU+ext;\n\t\tcase VK_RETURN: return VK_RETURN + ext*(VK_SEPARATOR-VK_RETURN);\n\t\tdefault: return wParam;\n\t}\n}\n\nLRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {\n\tswitch (uMsg) {\n\tcase WM_CLOSE:\n\t\tPostQuitMessage(0);\n\t\treturn 0;\n\tcase WM_SYSKEYDOWN:\n\tcase WM_KEYDOWN:\n\t\twParam = mapExtended(wParam, lParam);\n\t\tif (!keyDown((UINT)wParam))\n\t\t\tdown[downptr++] = hit[hitptr++] = wParam; // todo: if mapNarrowed(wParam)!=wParam: also add mapNarrowed()\n\t\tif (wParam == VK_ESCAPE)\n\t\t\tPostQuitMessage(0);\n\t\treturn 0;\n\tcase WM_SYSKEYUP:\n\tcase WM_KEYUP:\n\t\twParam = mapExtended(wParam, lParam);\n\t\tfor (int i = 0; i < downptr - 1; ++i) // todo: if mapNarrowed(wParam)!=wParam: also remove mapNarrowed()\n\t\t\tif (wParam == down[i]) {\n\t\t\t\tdown[i] = down[downptr-1];\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif (downptr > 0) downptr--;\n\t\treturn 0;\n\tcase WM_KILLFOCUS:\n\t//\thitptr = downptr = 0;\n\t\treturn 0;\n\t}\n\treturn DefWindowProc(hwnd, uMsg, wParam, lParam);\n}\n\nbool loop() {\n\thitptr = 0;\n\tMSG msg;\n\tbool result = true;\n\twhile (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {\n\t\tTranslateMessage(&msg);\n\t\tDispatchMessage(&msg);\n\t\tif (msg.message == WM_QUIT) {\n\t\t\tresult = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show) {\n\n\tif (glOpen()) return;\n\n\tWNDCLASSEX windowClass = { 0 };\n\twindowClass.cbSize = sizeof(windowClass);\n\twindowClass.hInstance = GetModuleHandle(nullptr);\n\twindowClass.lpszClassName = TEXT(\"classy class\");\n\twindowClass.hCursor = LoadCursor(nullptr, IDC_ARROW);\n\twindowClass.style = CS_OWNDC;\n\twindowClass.lpfnWndProc = wndProc;\n\tRegisterClassEx(&windowClass);\n\n\tPIXELFORMATDESCRIPTOR formatDesc = { 0 };\n\tformatDesc.nVersion = 1;\n\tformatDesc.nSize = sizeof(formatDesc);\n\tformatDesc.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;\n\tformatDesc.iLayerType = PFD_MAIN_PLANE;\n\tformatDesc.iPixelType = PFD_TYPE_RGBA;\n\tformatDesc.cColorBits = 32;\n\tformatDesc.cDepthBits = 24;\n\tformatDesc.cStencilBits = 8;\n\n\t// create a temporary window to have a functional opengl context in order to get some extension function pointers\n\tHWND tempWnd = CreateWindow(TEXT(\"classy class\"), TEXT(\"windy window\"), WS_POPUP, 0, 0, width, height, nullptr, nullptr, GetModuleHandle(nullptr), nullptr);\n\tHDC tempDC = GetDC(tempWnd);\n\tSetPixelFormat(tempDC, ChoosePixelFormat(tempDC, &formatDesc), &formatDesc);\n\tHGLRC tempRC = wglCreateContext(tempDC);\n\twglMakeCurrent(tempDC, tempRC);\n\n\t// these are why we made the temporary context; can set more pixel format attributes (multisample, floating point etc.) and create debug/core/etc contexts\n\tauto wglChoosePixelFormat = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress(\"wglChoosePixelFormatARB\");\n\tauto wglCreateContextAttribs = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress(\"wglCreateContextAttribsARB\");\n\n\t// adjust the window borders away, center the window\n\tRECT area = { 0, 0, width, height };\n\tconst DWORD style = (fullscreen ? WS_POPUP : (WS_SYSMENU|WS_CAPTION|WS_MINIMIZEBOX)) | ((fullscreen||show)?WS_VISIBLE:0);\n\tif (fullscreen) {\n\t\tDEVMODE mode = { 0 };\n\t\tmode.dmSize = sizeof(mode);\n\t\tmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;\n\t\tmode.dmPelsWidth = width; mode.dmPelsHeight = height;\n\t\tmode.dmBitsPerPel = 32;\n\t\tChangeDisplaySettings(&mode, CDS_FULLSCREEN);\n\t}\n\n\tAdjustWindowRect(&area, style, false);\n\tint adjustedWidth = fullscreen ? width : area.right - area.left, adjustedHeight = fullscreen ? height : area.bottom - area.top;\n\tint centerX = (GetSystemMetrics(SM_CXSCREEN) - adjustedWidth) / 2, centerY = (GetSystemMetrics(SM_CYSCREEN) - adjustedHeight) / 2;\n\tif (fullscreen)\n\t\tcenterX = centerY = 0;\n\n\t// create the final window and context\n\tdc = GetDC(wnd = CreateWindowA(\"classy class\", title, style, centerX, centerY, adjustedWidth, adjustedHeight, nullptr, nullptr, GetModuleHandle(nullptr), nullptr));\n\n\tint format; UINT numFormats;\n\twglChoosePixelFormat(dc, GL_WINDOW_ATTRIBUTES, nullptr, 1, &format, &numFormats);\n\n\tSetPixelFormat(dc, format, &formatDesc);\n\n\trc = wglCreateContextAttribs(dc, 0, GL_CONTEXT_ATTRIBUTES);\n\n\twglMakeCurrent(dc, rc);\n\tglViewport(0, 0, width, height);\n\n\t// release the temporary window and context\n\twglDeleteContext(tempRC);\n\tReleaseDC(tempWnd, tempDC);\n\tDestroyWindow(tempWnd);\n\n\t// what GL did we get?\n\tprintf(\"gl %s\\non %s\\nby %s\\nsl %s\\n\", glGetString(GL_VERSION), glGetString(GL_RENDERER), glGetString(GL_VENDOR), glGetString(GL_SHADING_LANGUAGE_VERSION));\n\n\tloadgl();\n\n\tsetupDebug();\n\tglEnable(GL_FRAMEBUFFER_SRGB);\n\t((PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress(\"wglSwapIntervalEXT\"))(-1); // freesync\n}\n\n#include \nvoid closeGL() {\n\tif (!glOpen()) return;\n\n\t// release context, window\n\tChangeDisplaySettings(nullptr, CDS_FULLSCREEN);\n\twglMakeCurrent(0, 0);\n\twglDeleteContext(rc);\n\tReleaseDC(wnd, dc);\n\tDestroyWindow(wnd);\n\twnd = nullptr;\n\tUnregisterClass(TEXT(\"classy class\"), GetModuleHandle(nullptr));\n\t_CrtDumpMemoryLeaks();\n}\n\nbool glOpen() {\n\treturn wnd != nullptr;\n}\n\nvoid showWindow() {\n\tShowWindow(wnd, SW_SHOW);\n}\n\nvoid hideWindow() {\n\tShowWindow(wnd, SW_HIDE);\n}\n\n#else\n\n#ifdef HEADLESS\n#define EGL_NO_X11\n#define MESA_EGL_NO_X11_HEADERS\n#else\n#include \nDisplay* xdisplay = nullptr;\nWindow xwindow;\n#endif\n\n#include \n#include \n\n#define GLAPIENTRY\n\n#include \n\nEGLDisplay display;\nEGLContext context;\n\nEGLSurface surface = EGL_NO_SURFACE;\n\nivec2 windowsize{};\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show) {\n\twindowsize = ivec2(width, height);\n#ifndef HEADLESS\n\txdisplay = XOpenDisplay(nullptr);\n\tXSetWindowAttributes window_attributes = {0};\n\twindow_attributes.event_mask = ExposureMask | PointerMotionMask | KeyPressMask;\n\txwindow = XCreateWindow(xdisplay, DefaultRootWindow(xdisplay), 0, 0, width, height, 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask, &window_attributes);\n\tXStoreName(xdisplay, xwindow, title);\n\tXMapWindow(xdisplay, xwindow);\n\tdisplay = eglGetDisplay((EGLNativeDisplayType)xdisplay);\n#else\n\tdisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);\n#endif\n\tEGLint major, minor;\n\teglInitialize(display, &major, &minor);\n\tconst EGLint config_attributes[] = {\n\t\tEGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,\n\t\tEGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8,\n\t\tEGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,\n#ifdef HEADLESS\n\t\tEGL_SURFACE_TYPE, EGL_PBUFFER_BIT,\n#endif\n\t\tEGL_NONE\n\t};\n\n\teglBindAPI(EGL_OPENGL_API);\n\n\tEGLConfig config; EGLint configCount;\n\teglChooseConfig(display, config_attributes, &config, 1, &configCount);\n\n\tconst EGLint context_attributes[] = {\n\t\tEGL_CONTEXT_MAJOR_VERSION, 4,\n\t\tEGL_CONTEXT_MINOR_VERSION, 6,\n\t\tEGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,\n\t\tEGL_NONE\n\t};\n\tcontext = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attributes);\n#ifndef HEADLESS\n\tEGLint surface_attributes[] = {\n\t\tEGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR,\n\t\tEGL_RENDER_BUFFER, EGL_BACK_BUFFER,\n\t\tEGL_NONE\n\t};\n\tsurface = eglCreateWindowSurface(display, config, xwindow, surface_attributes);\n#else\n\tEGLint surface_attributes[] = {\n\t\t//EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR,\n\t\t//EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,\n\t\t//EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,\n\t\tEGL_WIDTH, width, EGL_HEIGHT, height,\n\t\tEGL_NONE\n\t};\n\tsurface = eglCreatePbufferSurface(display, config, surface_attributes);\n#endif\n\teglMakeCurrent(display, surface, surface, context);\n\tloadgl();\n\n\tsetupDebug();\n\tglEnable(GL_FRAMEBUFFER_SRGB);\n}\nvoid closeGL() {\n\teglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);\n\teglDestroySurface(display, surface);\n\teglDestroyContext(display, context);\n\teglTerminate(display);\n#ifndef HEADLESS\n\tXDestroyWindow(xdisplay, xwindow);\n\tXCloseDisplay(xdisplay);\n#endif\n}\nbool loop() {\n#ifdef HEADLESS\n\treturn false;\n#else\n\treturn true;\n#endif\n}\nbool glOpen() {\n\treturn surface!=EGL_NO_SURFACE;\n}\nvoid swapBuffers() {\n\t//printf(\"oh lord is it this\\n\");\n\teglSwapBuffers(display, surface);\n}\nvoid setTitle(const char* title) {}\nvoid showWindow() {}\nvoid hideWindow() {}\n\nint down[256]; int downptr = 0;\nint hit[256]; int hitptr = 0;\n\nbool keyDown(uint vk_code) {\n\tfor (int i = 0; i < downptr; ++i)\n\t\tif (vk_code == down[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nbool keyHit(uint vk_code) {\n\tfor (int i = 0; i < hitptr; ++i)\n\t\tif (vk_code == hit[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nvoid resetHits() {\n\thitptr = 0;\n}\n\nivec2 getMouse() { return {};}\nvoid setMouse(ivec2) {}\n\nivec2 windowSize() {\n\treturn windowsize;\n}\n\n#endif\n"}, {"path": "utils/window.h", "language": "c", "loc": 48, "comment_density": 0.062, "code": "\n#pragma once\n\n#ifdef _WIN32\n\n#define VC_EXTRALEAN\n#define WIN32_LEAN_AND_MEAN\n#define NOMINMAX\n#include \n#endif\n#include \n\n#define GL_GLEXT_LEGACY\n#include \n#undef GL_VERSION_1_3\n#include \"glext.h\"\n#include \"loadgl46.h\"\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show);\nvoid closeGL();\nbool loop();\nbool glOpen();\nvoid swapBuffers();\nvoid setTitle(const char* title);\nvoid showWindow();\nvoid hideWindow();\n\n#include \"glsl.h\"\n\nbool keyDown(uint vk_code);\nbool keyHit(uint vk_code);\nvoid resetHits();\n\nivec2 getMouse();\nvoid setMouse(ivec2);\n\nivec2 windowSize();\n\n// todo: make this a true class? or use some kind of \"finally\" for the close?\n// possible reasoning: don't really want singleton, but don't really want to support multiple contexts either\n// why not just global functions: to be nice, we want to free all RAII objects before closing the GL context, so this has to be RAII as well\nstruct OpenGL {\n\tOpenGL(\n\t\tint width, int height,\n\t\tconst char* title = \"\",\n\t\tbool fullscreen = false,\n\t\tbool show = true)\n\t{\n\t\tif (glOpen()) return;\n\t\tisOwning = true;\n\t\tsetupGL(width, height, title, fullscreen, show);\n\t}\n\t~OpenGL() {\n\t\tif(isOwning)\n\t\t\tcloseGL();\n\t}\n\tbool isOwning = false;\n};\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "MIT", "non_commercial": false, "comment_density": 0.054, "dedup_hash": "33c86aeadedeffdd", "has_readme": true, "build_system": "make", "dependency_count": 40, "has_demo": false} -{"id": "webgl_examples_bumpmapping", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Bumpmapping", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "bumpmapping/bumpmapping.html", "language": "html", "loc": 20, "comment_density": 0.0, "code": "\n\n\n\nCamera height: \n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "bumpmapping/bumpmapping.js", "language": "javascript", "loc": 95, "comment_density": 0.105, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-5.0, cam_height, 0];\n\nvar light_pos_radius = 5;\nvar light_pos = [-1, 5.0, 0];\n\nvar plane = new Plane;\nvar normal_map_size = 512;\nvar texture_gen_bumps = new Texture_generation_bumps;\nvar texture_gen_triangles = new Texture_generation_triangles;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if(gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n //needed to be able to have floating point textures in webgl1\n if(gl.getExtension('OES_texture_float') == null){\n alert(\"cannot have floating point textures\");\n return;\n }\n\n if(gl.getExtension('OES_texture_float_linear') == null){\n alert(\"cannot have linear floating point textures\");\n return;\n }\n\n plane.setup(gl);\n\n texture_gen_bumps.generate_normal_map(normal_map_size);\n texture_gen_triangles.generate_normal_map(normal_map_size);\n\n plane.set_normal_map(texture_gen_bumps.array_texture, normal_map_size);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n model_matrix_plane = mat4.rotate(model_matrix_plane, model_matrix_plane, 0.1*Math.PI, [0,1,0]);\n}\n\nfunction change_selection(){\n var bump_selection = document.getElementById(\"bumps\");\n var triangles_selection = document.getElementById(\"triangles\");\n\n if(bump_selection.checked == true){\n plane.set_normal_map(texture_gen_bumps.array_texture, normal_map_size);\n }\n if(triangles_selection.checked == true){\n plane.set_normal_map(texture_gen_triangles.array_texture, normal_map_size);\n }\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independent\n time_diff = time-last_time;\n\n var camera_height = document.getElementById(\"slider_height\").value;\n\n var light_speed = 80;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 5;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n plane.set_light_pos(light_pos_scaled)\n\n position_cam[1] = camera_height/10;\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "bumpmapping/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n pixel_pos = vec3(model*vertex_pos);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "bumpmapping/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 15, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform vec3 light_pos;\n\n uniform sampler2D texture;\n\n void main() {\n vec3 pixel_normal = texture2D(texture, frag_uv).xyz;\n\n //calculate phong according to the normal map\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n //have white plane affected by light\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "bumpmapping/plane.js", "language": "javascript", "loc": 138, "comment_density": 0.058, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n //prepare buffer for texture\n this.texture_id = gl.createTexture();\n }\n\n set_normal_map(normal_map_float, size){\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, size, size, 0, gl.RGB, gl.FLOAT, new Float32Array(normal_map_float));\n\n // gl.generateMipmap(gl.TEXTURE_2D);\n // or\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n pixel_pos = vec3(model*vertex_pos);\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform vec3 light_pos;\n\n uniform sampler2D texture;\n\n void main() {\n vec3 pixel_normal = texture2D(texture, frag_uv).xyz;\n\n //calculate phong according to the normal map\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n //have white plane affected by light\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "bumpmapping/texture_generation.js", "language": "javascript", "loc": 90, "comment_density": 0.111, "code": "class Texture_generation{\n\n normalize3(vec){\n var length = Math.sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])\n return [vec[0]/length, vec[1]/length, vec[2]/length]\n }\n\n cross(vec_a, vec_b){\n return [vec_a[1]*vec_b[2]-vec_a[2]*vec_b[1], vec_a[2]*vec_b[0]-vec_a[0]*vec_b[2], vec_a[0]*vec_b[1]-vec_a[1]*vec_b[0]];\n }\n\n //default flat normal map\n generate_value(x, y, size){\n return 0;\n }\n\n //generate a normal map from the texture values\n generate_normal_map(size){\n this.array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var EPSILON = 0.001;\n\n //find derivatives in both direction\n var ddi = this.generate_value(i+EPSILON, j, size)-this.generate_value(i, j, size);\n var ddj = this.generate_value(i, j+EPSILON, size)-this.generate_value(i, j, size);\n\n //make vectors from derivatives\n var der_x = [EPSILON, ddi, 0];\n var der_y = [0, ddj, EPSILON];\n\n der_x = this.normalize3(der_x)\n der_y = this.normalize3(der_y)\n\n //cross should be the normal\n var normal = this.cross(der_y, der_x);\n\n normal = this.normalize3(normal);\n\n this.array_texture.push( normal[2] ); //X\n this.array_texture.push( normal[1] ); //Y\n this.array_texture.push( normal[0] ); //Z\n }\n }\n }\n}\n\n//returns pixel for a \"bumpy\" normal map\nclass Texture_generation_bumps extends Texture_generation{\n\n generate_value(x, y, size){\n //have a flat surface with only shallow holes in it\n var sine_frequency = 8*3.1415/size;\n var val = Math.sin(sine_frequency*x)*Math.sin(sine_frequency*y);\n if (val < 0.5){\n return 0;\n }\n\n return -(val-0.5)*8;\n }\n}\n\nclass Texture_generation_triangles extends Texture_generation{\n\n generate_value_sub(x, y, center_x, center_y, size){\n var relative_x = Math.abs(x-center_x);\n var relative_y = Math.abs(y-center_y);\n\n var depth = size/4;\n\n var x_min = center_x-size;\n var x_max = center_x+size;\n var y_min = center_y-size;\n var y_max = center_y+size;\n\n if(x > x_min && x < x_max){\n if(y > y_min && y < y_max){\n if(y <= center_y && relative_y >= relative_x){\n return (y-y_min)/depth;\n }\n if(y > center_y && relative_y > relative_x){\n return (y_max-y)/depth;\n }\n if(x < center_x){\n return (x-x_min)/depth;\n }\n if(x > center_x){\n return (x_max-x)/depth;\n }\n\n }\n }\n\n return 0;\n }\n\n generate_value(x, y, size){\n var sub_div = 64;\n var square_size = 32;\n\n for (var i = 0; i < size; i+=sub_div) {\n for (var j = 0; j < size; j+=sub_div) {\n if(x > i && x < (i+sub_div)){\n if(y > j && y < (j+sub_div)){\n return this.generate_value_sub(x ,y , i+square_size, j+square_size, square_size/2);\n }\n }\n }\n }\n return 0;\n }\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.079, "dedup_hash": "150c45cd54df3d87", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_cube_rotation", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Cube Rotation", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "cube_rotation/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/cube.js", "language": "javascript", "loc": 206, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //buffers for colours\n this.col_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.colours), this.gl.STATIC_DRAW);\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"colour\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"colour\"));\n\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n text_coord = [\n // Front\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n // Back\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Top\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Bottom\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // right\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Left\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n ];\n\n colours = [\n // Front face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Back face\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Right face\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n\n // Left face\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n ];\n}\n"}, {"path": "cube_rotation/cube_rotation.html", "language": "html", "loc": 15, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "cube_rotation/cube_rotation.js", "language": "javascript", "loc": 59, "comment_density": 0.119, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar cube = new Cube;\nvar plane = new Plane;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n cube.setup(gl);\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n cube.set_vp(view_matrix, proj_matrix);\n cube.draw();\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the cube by a little bit\n var model = cube.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n cube.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "cube_rotation/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 6, "comment_density": 0.167, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/plane.js", "language": "javascript", "loc": 86, "comment_density": 0.012, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.082, "dedup_hash": "1739cc2d304a11cf", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_framebuffer", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Framebuffer", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "postprocessing/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "framebuffer/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/cube.js", "language": "javascript", "loc": 206, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //buffers for colours\n this.col_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.colours), this.gl.STATIC_DRAW);\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"colour\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"colour\"));\n\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n text_coord = [\n // Front\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n // Back\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Top\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Bottom\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // right\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Left\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n ];\n\n colours = [\n // Front face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Back face\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Right face\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n\n // Left face\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n ];\n}\n"}, {"path": "framebuffer/framebuffer.html", "language": "html", "loc": 29, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\nEffect:\n\n\n\n\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "framebuffer/framebuffer.js", "language": "javascript", "loc": 38, "comment_density": 0.158, "code": "class Framebuffer{\n\n setup(gl, image_width, image_height) {\n this.gl = gl;\n\n this.image_width = image_width;\n this.image_height = image_height;\n\n this.fb_tex = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.fb_tex);\n\n //allocate space for the texture, but feed nothing to it (null)\n //will be filled later by rendering in the framebuffer\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.image_width, this.image_height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n this.fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n\n //key part, we associate the texture with the framebuffer\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.fb_tex, 0);\n\n //create a depth buffer for the framebuffer, otherwise 3d rendering will be weird\n this.depth_buffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.depth_buffer);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, this.image_width, this.image_height);\n\n //associate the render buffer with the framebuffer\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depth_buffer);\n\n //unbind everything to avoid pollution\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n bind(){\n this.gl.viewport(0, 0, this.image_width, this.image_height);\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n }\n\n unbind(){\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n get_texture(){\n return this.fb_tex;\n }\n\n}"}, {"path": "framebuffer/main.js", "language": "javascript", "loc": 91, "comment_density": 0.099, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar cube = new Cube;\nvar plane = new Plane;\n\nvar quad_screen = new Quad_screen;\n\nvar framebuffer = new Framebuffer;\n\nvar last_time = 0;\n\nvar canvas_width = 1600;\nvar canvas_height = 900;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n canvas_width = gl.canvas.width;\n canvas_height = gl.canvas.height;\n\n cube.setup(gl);\n\n plane.setup(gl);\n\n quad_screen.setup(gl, canvas_width, canvas_height);\n\n framebuffer.setup(gl, canvas_width, canvas_height);\n\n quad_screen.set_framebuffer_texture(framebuffer.get_texture());\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n change_selection();\n}\n\nfunction change_selection(){\n\n if(document.getElementById(\"nothing\").checked == true){\n quad_screen.set_effect_active(0);\n }\n if(document.getElementById(\"invert\").checked == true){\n quad_screen.set_effect_active(1);\n }\n if(document.getElementById(\"gaussian\").checked == true){\n quad_screen.set_effect_active(2);\n }\n if(document.getElementById(\"sobel\").checked == true){\n quad_screen.set_effect_active(3);\n }\n if(document.getElementById(\"glass\").checked == true){\n quad_screen.set_effect_active(4);\n }\n}\n\nfunction draw(){\n //will render in frambuffer\n framebuffer.bind();\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n cube.set_vp(view_matrix, proj_matrix);\n cube.draw();\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the cube by a little bit\n var model = cube.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n cube.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n //everything after that will be rendered in the canvas\n framebuffer.unbind();\n\n quad_screen.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "framebuffer/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 6, "comment_density": 0.167, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/plane.js", "language": "javascript", "loc": 86, "comment_density": 0.012, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "framebuffer/quad_screen.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n gl_Position = vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/quad_screen.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 93, "comment_density": 0.054, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n uniform int effect_select;\n\n uniform float tex_width;\n uniform float tex_height;\n\n //grayscale\n float col_to_gs(vec3 vec){\n return 0.21*vec.x + 0.72*vec.y + 0.07*vec.z;\n }\n\n void main() {\n vec3 color_out = vec3(0.0, 0.0, 0.0);\n\n if(effect_select == 0){\n gl_FragColor = texture2D(texture, frag_uv);\n }\n else if(effect_select == 1){\n gl_FragColor = vec4(vec3(1.0)-texture2D(texture, frag_uv).rgb, 1.0);\n }\n else if(effect_select == 2){\n\n const int gauss_mat_size = 12;\n float variance = 10.0;\n float mean = float(gauss_mat_size)/2.0;\n float gauss_mat[gauss_mat_size];\n float gauss_mat_coef = 0.0;\n\n //init the blurring mat\n for(int i = 0; i < gauss_mat_size; i++){\n float val = 1.0/sqrt(2.0*3.1415*variance);\n val = val*pow(2.7182818, -pow((float(i)-mean), 2.0)/(2.0*variance));\n gauss_mat[i] = val;\n gauss_mat_coef += val;\n }\n\n gauss_mat_coef = 1.0/(gauss_mat_coef*gauss_mat_coef);\n\n for(int i = 0; i < gauss_mat_size; i++){\n float rel_i = float(i-(gauss_mat_size-1)/2);\n float sum = 0.0;\n for(int j = 0; j < gauss_mat_size; j++){\n float rel_j = float(j-(gauss_mat_size-1)/2);\n float matrix_val = gauss_mat[i]*gauss_mat[j];\n color_out += matrix_val*texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb;\n }\n }\n\n color_out = color_out*gauss_mat_coef;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 3){\n\n const int sobel_x_size = 3;\n // float sobel_x[sobel_x_size*sobel_x_size] = float[](1, 0, -1, 2, 0, -2, 1, 0, -1); //only glsl3.0\n float sobel_x[sobel_x_size*sobel_x_size];\n sobel_x[0] = 1.0;\n sobel_x[1] = 0.0;\n sobel_x[2] = -1.0;\n sobel_x[3] = 2.0;\n sobel_x[4] = 0.0;\n sobel_x[5] = -2.0;\n sobel_x[6] = 1.0;\n sobel_x[7] = 0.0;\n sobel_x[8] = -1.0;\n\n const int sobel_y_size = 3;\n // float sobel_y[sobel_y_size*sobel_y_size] = float[](1, 2, 1, 0, 0, 0, -1, -2, -1); //only glsl3.0\n float sobel_y[sobel_y_size*sobel_y_size];\n sobel_y[0] = 1.0;\n sobel_y[1] = 2.0;\n sobel_y[2] = 1.0;\n sobel_y[3] = 0.0;\n sobel_y[4] = 0.0;\n sobel_y[5] = 0.0;\n sobel_y[6] = -1.0;\n sobel_y[7] = -2.0;\n sobel_y[8] = -1.0;\n\n float edge_x = 0.0;\n float edge_y = 0.0;\n\n for(int i = 0; i < sobel_x_size; i++){\n float rel_i = float(i)-(float(sobel_x_size)-1.0)/2.0;\n\n for(int j = 0; j < sobel_y_size; j++){\n float rel_j = float(j)-(float(sobel_y_size)-1.0)/2.0;\n float grayscale_pixel = col_to_gs(texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb);\n edge_x += sobel_x[j*3+i]*grayscale_pixel;\n edge_y += sobel_y[j*3+i]*grayscale_pixel;\n }\n }\n\n color_out = vec3(sqrt(edge_x*edge_x+edge_y*edge_y));\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 4){\n float move_x = sin(frag_uv.x*500.0)*10.0;\n float move_y = sin(frag_uv.y*500.0)*10.0;\n\n color_out = texture2D(texture, frag_uv+vec2(move_x/tex_width,move_y/tex_height)).rgb;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else{\n gl_FragColor = texture2D(texture, frag_uv);\n }\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/quad_screen.js", "language": "javascript", "loc": 175, "comment_density": 0.034, "code": "\nclass Quad_screen{\n\n setup(gl, screen_width, screen_height){\n this.gl = gl;\n\n this.screen_width = screen_width;\n this.screen_height = screen_height;\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n this.effect_active = 0;\n }\n\n set_framebuffer_texture(tex){\n this.fb_texture_id = tex;\n }\n\n set_effect_active(effect){\n this.effect_active = effect;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.fb_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"effect_select\"), this.effect_active);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"tex_width\"), this.screen_width);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"tex_height\"), this.screen_height);\n\n\n this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n gl_Position = vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n uniform int effect_select;\n\n uniform float tex_width;\n uniform float tex_height;\n\n //grayscale\n float col_to_gs(vec3 vec){\n return 0.21*vec.x + 0.72*vec.y + 0.07*vec.z;\n }\n\n void main() {\n vec3 color_out = vec3(0.0, 0.0, 0.0);\n\n if(effect_select == 0){\n gl_FragColor = texture2D(texture, frag_uv);\n }\n else if(effect_select == 1){\n gl_FragColor = vec4(vec3(1.0)-texture2D(texture, frag_uv).rgb, 1.0);\n }\n else if(effect_select == 2){\n\n const int gauss_mat_size = 12;\n float variance = 10.0;\n float mean = float(gauss_mat_size)/2.0;\n float gauss_mat[gauss_mat_size];\n float gauss_mat_coef = 0.0;\n\n //init the blurring mat\n for(int i = 0; i < gauss_mat_size; i++){\n float val = 1.0/sqrt(2.0*3.1415*variance);\n val = val*pow(2.7182818, -pow((float(i)-mean), 2.0)/(2.0*variance));\n gauss_mat[i] = val;\n gauss_mat_coef += val;\n }\n\n gauss_mat_coef = 1.0/(gauss_mat_coef*gauss_mat_coef);\n\n for(int i = 0; i < gauss_mat_size; i++){\n float rel_i = float(i-(gauss_mat_size-1)/2);\n float sum = 0.0;\n for(int j = 0; j < gauss_mat_size; j++){\n float rel_j = float(j-(gauss_mat_size-1)/2);\n float matrix_val = gauss_mat[i]*gauss_mat[j];\n color_out += matrix_val*texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb;\n }\n }\n\n color_out = color_out*gauss_mat_coef;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 3){\n\n const int sobel_x_size = 3;\n // float sobel_x[sobel_x_size*sobel_x_size] = float[](1, 0, -1, 2, 0, -2, 1, 0, -1); //only glsl3.0\n float sobel_x[sobel_x_size*sobel_x_size];\n sobel_x[0] = 1.0;\n sobel_x[1] = 0.0;\n sobel_x[2] = -1.0;\n sobel_x[3] = 2.0;\n sobel_x[4] = 0.0;\n sobel_x[5] = -2.0;\n sobel_x[6] = 1.0;\n sobel_x[7] = 0.0;\n sobel_x[8] = -1.0;\n\n const int sobel_y_size = 3;\n // float sobel_y[sobel_y_size*sobel_y_size] = float[](1, 2, 1, 0, 0, 0, -1, -2, -1); //only glsl3.0\n float sobel_y[sobel_y_size*sobel_y_size];\n sobel_y[0] = 1.0;\n sobel_y[1] = 2.0;\n sobel_y[2] = 1.0;\n sobel_y[3] = 0.0;\n sobel_y[4] = 0.0;\n sobel_y[5] = 0.0;\n sobel_y[6] = -1.0;\n sobel_y[7] = -2.0;\n sobel_y[8] = -1.0;\n\n float edge_x = 0.0;\n float edge_y = 0.0;\n\n for(int i = 0; i < sobel_x_size; i++){\n float rel_i = float(i)-(float(sobel_x_size)-1.0)/2.0;\n\n for(int j = 0; j < sobel_y_size; j++){\n float rel_j = float(j)-(float(sobel_y_size)-1.0)/2.0;\n float grayscale_pixel = col_to_gs(texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb);\n edge_x += sobel_x[j*3+i]*grayscale_pixel;\n edge_y += sobel_y[j*3+i]*grayscale_pixel;\n }\n }\n\n color_out = vec3(sqrt(edge_x*edge_x+edge_y*edge_y));\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 4){\n float move_x = sin(frag_uv.x*500.0)*10.0;\n float move_y = sin(frag_uv.y*500.0)*10.0;\n\n color_out = texture2D(texture, frag_uv+vec2(move_x/tex_width,move_y/tex_height)).rgb;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else{\n gl_FragColor = texture2D(texture, frag_uv);\n }\n }\n `;\n\n positions = [\n -1.0, -1.0, 0.0,\n +1.0, -1.0, 0.0,\n -1.0, +1.0, 0.0,\n +1.0, +1.0, 0.0,\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 0.0, 1.0,\n 1.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_framebuffer.png", "license": "none-found", "non_commercial": false, "comment_density": 0.073, "dedup_hash": "030154224714a88c", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} -{"id": "webgl_examples_grass", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Grass", "api": "OpenGL/WebGL", "glsl_version": "300 es", "topic": "instancing/texturing/vegetation/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "grass/grass.html", "language": "html", "loc": 24, "comment_density": 0.0, "code": "\n\n\n\nWind speed: \nCamera position:
\nNumber of grass blades:\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "grass/grass_manager.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 51, "comment_density": 0.039, "code": "#version 300 es\n precision mediump float;\n in vec4 vertex_pos;\n\n in mat4 mat_model;\n in vec2 uv;\n\n out vec3 pixel_pos;\n out vec2 global_uv;\n out vec2 frag_uv;\n out vec2 rel_tex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n uniform sampler2D tex_wind;\n\n void main() {\n pixel_pos = vec3(mat_model*vertex_pos);\n\n vec2 relative_tex_pos = vec2(pixel_pos.x/100.0+0.5, pixel_pos.z/100.0+0.5);\n global_uv = relative_tex_pos;\n\n frag_uv = uv;\n\n vec2 wind_dir = vec2(time, time);\n float wind_x = texture(tex_wind, relative_tex_pos+wind_dir ).r-0.5;\n float wind_z = texture(tex_wind, relative_tex_pos+vec2(0.5, 0.5)+wind_dir ).r-0.5;\n\n //make wind a bit more dramatic\n wind_x *= 2.0;\n wind_z *= 2.0;\n\n rel_tex_pos = relative_tex_pos;\n\n vec3 new_pos = vec3(mat_model*vertex_pos);\n\n //move the top vertex of the grass move more than the lower ones\n if(gl_VertexID == 0){\n wind_x *= 3.0;\n wind_z *= 3.0;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 1 || gl_VertexID == 2 ){\n wind_x *= 1.5;\n wind_z *= 1.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 3 || gl_VertexID == 4 ){\n wind_x *= 0.5;\n wind_z *= 0.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n\n gl_Position = proj*view*vec4(new_pos, 1.0);\n }", "glsl_version": "300 es", "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/grass_manager.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 19, "comment_density": 0.158, "code": "#version 300 es\n precision mediump float;\n\n in vec3 pixel_pos;\n in vec2 global_uv;\n in vec2 frag_uv;\n in vec2 rel_tex_pos;\n\n out vec4 color;\n\n uniform vec3 light_pos;\n uniform sampler2D tex_wind;\n\n uniform float time;\n\n void main() {\n //get a random value for this blade from its position, will be used to vary the colour a bit from grass to grass\n float rand_val = mod((global_uv.x*global_uv.x)+(0.13-global_uv.x*global_uv.y), 0.01)/0.01;\n\n //make the edges of the blade lighter\n float dist_to_centre = pow(distance(frag_uv, vec2(0.5, 0.5)), 2.0);\n\n //make the base a bit darker\n float dist_to_ground = clamp((1.0-frag_uv.y)*1.0, 0.0, 1.0);\n\n color = vec4( (0.1+rand_val/6.0+dist_to_centre)*dist_to_ground, (0.3+dist_to_centre)*dist_to_ground, (0.0+dist_to_centre)*dist_to_ground, 1.0);\n }", "glsl_version": "300 es", "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/grass_manager.js", "language": "javascript", "loc": 256, "comment_density": 0.105, "code": "class Grass_manager{\n\n setup(gl, plane){\n this.gl = gl;\n\n this.base = plane;\n\n this.max_grass = 16000;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), gl.STATIC_DRAW);\n\n //generate a model matrix for each grass blade, that will be put in a buffer, to be drawn with instanced rendering\n this.lst_transforms = []\n\n for (let i = 0; i < this.max_grass; i++) {\n var pos_x = 100*(Math.random()-0.5)\n var pos_y = 100*(Math.random()-0.5)\n this.lst_transforms[i] = this.get_grass_matrix(pos_x, pos_y);\n }\n\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.lst_transforms.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n //generate the wind texture\n var wind_tex_size = 512;\n\n this.generate_wind_texture(wind_tex_size);\n\n this.texture_id = gl.createTexture();\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, wind_tex_size, wind_tex_size, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.wind_array_texture));\n\n //mirrored repeat as we will pan over the texture multiple times\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n\n this.time = 0;\n }\n\n set_max_grass(mg){\n this.max_grass = mg;\n }\n\n //do a bit of matrix rotations (with randomness) to get a blade of grass standing up\n get_grass_matrix(pos_x, pos_y){\n var model_matrix_grass = mat4.create();\n\n mat4.translate(model_matrix_grass, model_matrix_grass, [0, this.base.get_height(pos_x,pos_y), 0]);\n mat4.translate(model_matrix_grass, model_matrix_grass, [pos_x, 0, pos_y]);\n mat4.scale(model_matrix_grass, model_matrix_grass, [0.3, 1.7, 0.3]);\n mat4.scale(model_matrix_grass, model_matrix_grass, [1, 1+Math.random(), 1]);\n mat4.translate(model_matrix_grass, model_matrix_grass, [0, 2, 0]);\n mat4.rotate(model_matrix_grass, model_matrix_grass, 3.1415/4.0*pos_x*pos_y*5.244 ,[0, 1, 0]);\n mat4.rotate(model_matrix_grass, model_matrix_grass, 3.1415/2.0 ,[1, 0, 0]);\n\n return model_matrix_grass;\n }\n\n //generate wind texture, which will impact the position of the grass\n //only R component of the texture will be used\n generate_wind_texture(size){\n this.wind_array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var val = Math.sin(i/size*16)*Math.cos(j/size*8);\n val += 0.25*Math.sin(i/size*32)*Math.cos(j/size*64);\n this.wind_array_texture.push( val*64+128 ); //R\n this.wind_array_texture.push( 0.0 ); //G useless\n this.wind_array_texture.push( 0.0 ); //B useless\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_time(t){\n this.time = t;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //setup the buffer to tell webgl to use a single mat4 matrix per instanced rendering, a bit wordy$\n //webgl2 was needed for the instanced rendering\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"mat_model\");\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.lst_transforms[0] );\n\n this.gl.uniform1f( this.gl.getUniformLocation(this.shader_program, \"time\"), this.time );\n\n this.gl.activeTexture(gl.TEXTURE0);\n\n this.gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n this.gl.uniform1i(gl.getUniformLocation(this.shader_program, \"tex_wind\"), 0);\n\n\n this.gl.disable(this.gl.CULL_FACE);\n\n //tell webgl we will draw max_grass blades that each contains 15 vertices\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, 15, this.gl.UNSIGNED_SHORT, 0, this.max_grass);\n\n this.gl.enable(this.gl.CULL_FACE);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n }\n\n //needed glsl 3 for gl_VertexID\n vertex_shader_code = `#version 300 es\n precision mediump float;\n in vec4 vertex_pos;\n\n in mat4 mat_model;\n in vec2 uv;\n\n out vec3 pixel_pos;\n out vec2 global_uv;\n out vec2 frag_uv;\n out vec2 rel_tex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n uniform sampler2D tex_wind;\n\n void main() {\n pixel_pos = vec3(mat_model*vertex_pos);\n\n vec2 relative_tex_pos = vec2(pixel_pos.x/100.0+0.5, pixel_pos.z/100.0+0.5);\n global_uv = relative_tex_pos;\n\n frag_uv = uv;\n\n vec2 wind_dir = vec2(time, time);\n float wind_x = texture(tex_wind, relative_tex_pos+wind_dir ).r-0.5;\n float wind_z = texture(tex_wind, relative_tex_pos+vec2(0.5, 0.5)+wind_dir ).r-0.5;\n\n //make wind a bit more dramatic\n wind_x *= 2.0;\n wind_z *= 2.0;\n\n rel_tex_pos = relative_tex_pos;\n\n vec3 new_pos = vec3(mat_model*vertex_pos);\n\n //move the top vertex of the grass move more than the lower ones\n if(gl_VertexID == 0){\n wind_x *= 3.0;\n wind_z *= 3.0;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 1 || gl_VertexID == 2 ){\n wind_x *= 1.5;\n wind_z *= 1.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 3 || gl_VertexID == 4 ){\n wind_x *= 0.5;\n wind_z *= 0.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n\n gl_Position = proj*view*vec4(new_pos, 1.0);\n }\n `;\n\n fragment_shader_code = `#version 300 es\n precision mediump float;\n\n in vec3 pixel_pos;\n in vec2 global_uv;\n in vec2 frag_uv;\n in vec2 rel_tex_pos;\n\n out vec4 color;\n\n uniform vec3 light_pos;\n uniform sampler2D tex_wind;\n\n uniform float time;\n\n void main() {\n //get a random value for this blade from its position, will be used to vary the colour a bit from grass to grass\n float rand_val = mod((global_uv.x*global_uv.x)+(0.13-global_uv.x*global_uv.y), 0.01)/0.01;\n\n //make the edges of the blade lighter\n float dist_to_centre = pow(distance(frag_uv, vec2(0.5, 0.5)), 2.0);\n\n //make the base a bit darker\n float dist_to_ground = clamp((1.0-frag_uv.y)*1.0, 0.0, 1.0);\n\n color = vec4( (0.1+rand_val/6.0+dist_to_centre)*dist_to_ground, (0.3+dist_to_centre)*dist_to_ground, (0.0+dist_to_centre)*dist_to_ground, 1.0);\n }\n `;\n\n positions = [\n 0.0, 0.0, -2.0, // 0\n -1.0, 0.0, 0.0, // 1\n 1.0, 0.0, 0.0, // 2\n -1.0, 0.0, 1.0, // 3\n 1.0, 0.0, 1.0, // 4\n -1.0, 0.0, 2.0, // 5\n 1.0, 0.0, 2.0, // 6\n ];\n\n indices = [\n 0, 1, 2,\n 2, 1, 3,\n 2, 3, 4,\n 4, 3, 5,\n 4, 5, 6,\n ];\n\n tex_coord = [\n 0.5, 0.0,\n 0.0, 0.5,\n 1.0, 0.5,\n 0.0, 0.75,\n 1.0, 0.75,\n 0.0, 1.0,\n 1.0, 1.0,\n ];\n}\n\n"}, {"path": "grass/main.js", "language": "javascript", "loc": 69, "comment_density": 0.087, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\nvar model_matrix_grass_manager = mat4.create();\n\nvar cam_height = 25;\nvar position_cam = [-70.0, cam_height, 0];\n\nvar plane = new Plane_sine;\nvar grass_manager = new Grass_manager;\n\nvar last_time = 0;\n\nvar time_wind = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl2\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL2\");\n return;\n }\n\n plane.setup(gl);\n\n mat4.scale(model_matrix_plane, model_matrix_plane, [50, 3, 50]);\n mat4.scale(model_matrix_grass_manager, model_matrix_grass_manager, [1, 1, 1]);\n mat4.translate(model_matrix_grass_manager, model_matrix_grass_manager, [0, 0, 0]);\n\n plane.set_model_matrix(model_matrix_plane);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n grass_manager.setup(gl, plane);\n}\n\nfunction draw(){\n var cam_pos = document.getElementById(\"camera_position\").value;\n\n position_cam[0] = -cam_pos;\n\n mat4.lookAt(view_matrix, position_cam, [70-cam_pos, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independent\n time_diff = time-last_time;\n\n var wind_speed = document.getElementById(\"slider_speed\").value;\n // wind_speed = wind_speed/50.0;\n time_wind += wind_speed/70000.0;\n\n if(document.getElementById(\"16000\").checked == true){\n grass_manager.set_max_grass(16000);\n }\n else if(document.getElementById(\"8000\").checked == true){\n grass_manager.set_max_grass(8000);\n }\n else if(document.getElementById(\"4000\").checked == true){\n grass_manager.set_max_grass(4000);\n }\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n grass_manager.set_time( time_wind);\n grass_manager.set_mvp(model_matrix_grass_manager, view_matrix, proj_matrix);\n grass_manager.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "grass/plane_sine.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/plane_sine.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float;\n\n void main() {\n // just output some brown color\n gl_FragColor = vec4(0.3, 0.14, 0.07, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/plane_sine.js", "language": "javascript", "loc": 137, "comment_density": 0.226, "code": "class Plane_sine{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n this.nb_vertices_side = 48;//default\n\n this.generate_geometry();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.vertices), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n }\n\n //the shape of the plane\n get_height_priv(x, z){\n return Math.sin(x*5)+Math.sin(z*5);\n }\n\n generate_geometry()\n {\n var increment = 1.0/(this.nb_vertices_side-1);\n\n this.vertices = [];\n\n //the vertices\n for (let y = 0; y < this.nb_vertices_side; y++) {\n for (let x = 0; x < this.nb_vertices_side; x++) {\n this.vertices.push(-1.0+2*increment*x);\n this.vertices.push(this.get_height_priv(-1.0+2*increment*x, -1.0+2*increment*y));\n this.vertices.push(-1.0+2*increment*y);\n }\n }\n\n this.indices = [];\n\n //generate the indices\n for (let y = 0; y < this.nb_vertices_side-1; y++) {\n for (let x = 0; x < this.nb_vertices_side-1; x++) {\n var this_vertice = y*this.nb_vertices_side+x;\n //one of the triangle\n this.indices.push(this_vertice+1); //top right\n this.indices.push(this_vertice);\n this.indices.push(this_vertice+this.nb_vertices_side);\n\n this.indices.push(this_vertice+this.nb_vertices_side);\n this.indices.push(this_vertice+this.nb_vertices_side+1);\n this.indices.push(this_vertice+1);\n }\n }\n }\n\n //get the height of the plane from position, but taking into account a model matrix for the shape (ex scale)\n get_height(pos_x, pos_y){\n //just assume a simple scale matrix, to simplify the matrix manipulations\n\n var pos_x_transf = pos_x/this.model[0]; // [0][0];\n var pos_y_transf = pos_y/this.model[10]; // [2][2] as mat4 is a 1D array\n\n var height = this.get_height_priv(pos_x_transf, pos_y_transf);\n\n return height*this.model[5] //[1][1];\n }\n\n //old version with any type of model matrix, annoying\n // get_height_old(pos_x, pos_y){\n // var vec = vec4.create();\n // vec[0] = pos_x;\n // vec[1] = 0;\n // vec[2] = pos_y;\n // vec[3] = 1.0;\n\n // var vec_transf = vec4.create();\n // vec4.transformMat4(vec_transf, vec, this.model);\n\n // var height = this.get_height_priv(vec_transf[0], vec_transf[2]);\n\n // var vec_height = vec4.create();\n // vec[0] = 0;\n // vec[1] = height;\n // vec[2] = 0;\n // vec[3] = 1.0;\n\n // var model_height = vec4.create();\n // vec4.transformMat4(model_height, vec_height, this.model);\n\n // return model_height[1];\n // }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n var nb_squares = this.nb_vertices_side-1;\n var nb_vertices_to_draw = nb_squares*nb_squares*6;\n\n this.gl.drawElements(this.gl.TRIANGLES, nb_vertices_to_draw, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float;\n\n void main() {\n // just output some brown color\n gl_FragColor = vec4(0.3, 0.14, 0.07, 1.0);\n }\n `;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_grass.png", "license": "none-found", "non_commercial": false, "comment_density": 0.102, "dedup_hash": "4a699a3f1c50ebec", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_shading", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Shading", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "shading/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/cube.js", "language": "javascript", "loc": 193, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "shading/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/plane.js", "language": "javascript", "loc": 112, "comment_density": 0.009, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n}\n"}, {"path": "shading/shading.html", "language": "html", "loc": 16, "comment_density": 0.0, "code": "\n\n\n\nLight Speed: \nLight Height:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "shading/shading.js", "language": "javascript", "loc": 91, "comment_density": 0.11, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\nvar model_matrix_cubes = [mat4.create(), mat4.create()];\n\nvar cam_height = 5;\nvar position_cam = [-20.0, cam_height, -20.0];\n\nvar rotating_cube = new Cube;\n\nvar cubes = [new Cube, new Cube];\nvar plane = new Plane;\n\nvar light_pos_radius = 10;\nvar light_pos = [-1, 5.0, 0];\n\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n rotating_cube.setup(gl);\n cubes[0].setup(gl);\n cubes[1].setup(gl);\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [10, 1, 10]);\n\n mat4.translate(model_matrix_cubes[0], model_matrix_cubes[0], [0, 1, 5]);\n mat4.translate(model_matrix_cubes[1], model_matrix_cubes[1], [5, 1, -5]);\n\n cubes[0].set_model_matrix(model_matrix_cubes[0]);\n cubes[1].set_model_matrix(model_matrix_cubes[1]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independant\n time_diff = time-last_time;\n\n var light_speed = document.getElementById(\"slider_speed\").value;\n var light_height = document.getElementById(\"slider_height\").value;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 11.0-light_height;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n plane.set_light_pos(light_pos_scaled);\n rotating_cube.set_light_pos(light_pos_scaled);\n cubes[0].set_light_pos(light_pos_scaled);\n cubes[1].set_light_pos(light_pos_scaled);\n\n //rotate the model matrix of the cube by a little bit\n var model = rotating_cube.get_model_matrix();\n model = mat4.rotate(model, model, 2*Math.PI*time_diff*10, [0,1,0]);\n rotating_cube.set_model_matrix(model);\n\n rotating_cube.set_vp(view_matrix, proj_matrix);\n rotating_cube.draw();\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n cubes[0].set_mvp(model_matrix_cubes[0], view_matrix, proj_matrix);\n cubes[0].draw();\n\n cubes[1].set_mvp(model_matrix_cubes[1], view_matrix, proj_matrix);\n cubes[1].draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.086, "dedup_hash": "bbda8f24a4fd9735", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_texturing", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Texturing", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "texturing/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "texturing/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 7, "comment_density": 0.286, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = texture2D(texture, frag_uv);\n // gl_FragColor = vec4(frag_uv, 0.0, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "texturing/plane.js", "language": "javascript", "loc": 134, "comment_density": 0.082, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n //generate texture\n this.size_texture = 8;\n this.generate_texture(this.size_texture)\n\n //prepare buffer for texture\n this.texture_id = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, this.size_texture, this.size_texture, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.array_texture));\n\n // gl.generateMipmap(gl.TEXTURE_2D);\n //or\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n\n }\n\n generate_texture(size){\n this.array_texture = [];\n\n //for normalization\n var max_size = size*size;\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n this.array_texture.push( (i*j)/max_size*255 ); //R\n this.array_texture.push( (size-i)*j/max_size*255 ); //G\n this.array_texture.push( i*(size-j)/max_size*255 ); //B\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = texture2D(texture, frag_uv);\n // gl_FragColor = vec4(frag_uv, 0.0, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "texturing/texturing.html", "language": "html", "loc": 14, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n"}, {"path": "texturing/texturing.js", "language": "javascript", "loc": 55, "comment_density": 0.127, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar plane = new Plane;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the plane by a little bit\n var model = plane.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n plane.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.099, "dedup_hash": "9b7ee98367e2a266", "has_readme": true, "build_system": null, "dependency_count": 4, "has_demo": true} -{"id": "webgl_examples_tree", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Tree", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "lighting/texturing/vegetation/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "tree/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.0, "code": "precision highp float;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/cube.js", "language": "javascript", "loc": 197, "comment_density": 0.147, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n this.light_pos = [0,0,0];\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.useProgram(this.shader_program);\n this.gl.bindVertexArray(this.vao);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision highp float;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "tree/leaves.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 44, "comment_density": 0.159, "code": "precision mediump float;\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n attribute vec3 raw_position;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n uniform vec2 wind_offset;\n\n uniform sampler2D tex_wind;\n\n void main() {\n mat4 global_model = model*model_mat;\n\n vec3 new_pos_tex = vec3(global_model*vertex_pos);\n\n //rotate a bit the leaves according to a wind texture map\n vec2 relative_tex_pos = vec2(new_pos_tex.x/40.0+0.5, new_pos_tex.z/40.0+0.5);\n\n float wind_x = texture2D(tex_wind, (relative_tex_pos+wind_offset) ).r;\n float wind_z = texture2D(tex_wind, (relative_tex_pos+vec2(0.5, 0.5)+wind_offset) ).r;\n\n //rotation around x axis\n mat4 rot_mat_x = mat4(1, 0, 0, 0,\n 0, cos(wind_x), -sin(wind_x), 0,\n 0, sin(wind_x), cos(wind_x), 0,\n 0, 0, 0, 1);\n\n //rotation around z axis\n mat4 rot_mat_z = mat4(cos(wind_z), -sin(wind_z), 0, 0,\n sin(wind_z), cos(wind_x), 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 1);\n\n vec4 new_pos = (global_model*rot_mat_x*rot_mat_z*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(global_model)));\n mat3 normal_mat = mat3(global_model);\n\n pixel_pos = vec3(new_pos);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*new_pos;\n\n frag_relative_ground_pos = raw_position.y;\n\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/leaves.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 22, "comment_density": 0.182, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform vec3 light_pos;\n uniform vec2 wind_offset;\n\n void main() {\n\n float distance_to_middle = distance(frag_uv, vec2(0.5, 0.5));\n\n //have some sort of leaf shape instead of a rough triangle\n if(distance_to_middle > 0.5 ){\n discard;\n }\n\n //have a repeatable random value according to relative position of the leaf to the centre of the batch\n float rand_val = sin(pixel_pos.x*pixel_pos.z/10.0)+cos( (0.13-pixel_pos.x*pixel_pos.y) / 10.0 );\n\n gl_FragColor.a = 1.0;\n\n //if the leaf is under the \"centre\" of the batch, draw it darker (to have a canopy effect)\n float light_intensity = (frag_relative_ground_pos+0.6)*1.5;\n light_intensity = clamp(light_intensity, 0.0, 1.0);\n float reverse_dist_to_middle = 1.0-distance_to_middle;\n\n gl_FragColor.rgb = vec3(0.1+rand_val/6.0, 0.4, 0.05)*light_intensity*reverse_dist_to_middle;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/leaves.js", "language": "javascript", "loc": 284, "comment_density": 0.12, "code": "class Leaves{\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n // indices for the texture pos\n this.texcoord_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), this.gl.STATIC_DRAW)\n\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.mat_vector.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n this.rel_pos_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.rel_pos_list);\n\n var pos_vec_flat = this.pos_vector.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(pos_vec_flat), this.gl.STATIC_DRAW);\n\n this.nb_leaves = this.mat_vector.length;\n this.light_pos = [0, 0, 0];\n\n //generate the wind texture\n var wind_tex_size = 512;\n\n this.generate_wind_texture(wind_tex_size);\n\n this.texture_id = gl.createTexture();\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, wind_tex_size, wind_tex_size, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.wind_array_texture));\n\n //mirrored repeat as we will pan over the texture multiple times\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n\n this.wind_offset = [1,1];\n }\n\n generate(end_point_matrices){\n this.mat_vector = []\n this.pos_vector = []\n\n var leaves_scale = 1.0/32.0;\n\n for (let i = 0; i < end_point_matrices.length; i++) {\n var incr = 0.4;\n for (let x = -1.0; x < 1.0; x+=incr) {\n for (let y = -1.0; y < 1.0; y+=incr) {\n for (let z = -1.0; z < 1.0; z+=incr) {\n var dist_to_centre = Math.sqrt(x*x+y*y+z*z);\n if(dist_to_centre < 1.0){\n var t = mat4.create();\n var random_rot = mat4.create();\n //add a bit of randomness to not have a grid of leaves\n mat4.rotate(random_rot, random_rot, Math.random(), [1.0, 0.0, 0.0] );\n mat4.rotate(random_rot, random_rot, Math.random(), [0.0, 1.0, 0.0] );\n mat4.rotate(random_rot, random_rot, Math.random(), [0.0, 0.0, 1.0] );\n\n mat4.multiply(t, t, random_rot);\n mat4.translate(t, t, [x*leaves_scale*4, y*leaves_scale*4, z*leaves_scale*4]);\n mat4.multiply(t, t, random_rot);//rotates again the leaves so they don't have the same orientation\n mat4.scale(t, t, [leaves_scale, leaves_scale, leaves_scale]);\n\n var end_mat = mat4.create();\n mat4.multiply(end_mat, end_point_matrices[i], t);\n this.mat_vector.push(end_mat);\n\n var val = vec4.create();\n val[0] = x;\n val[1] = y;\n val[2] = z;\n val[3] = 1;\n var val_transf = vec4.create();\n vec4.transformMat4(val_transf, val, random_rot);\n var val_transf3 = [val_transf[0], val_transf[1], val_transf[2]];\n this.pos_vector.push(val_transf3);\n }\n }\n }\n }\n\n }\n }\n\n //generate wind texture, which will impact the position of the grass\n //only R component of the texture will be used\n generate_wind_texture(size){\n this.wind_array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var val = Math.sin(i/size*16)*Math.cos(j/size*8);\n this.wind_array_texture.push( val*64+128 ); //R\n this.wind_array_texture.push( 0.0 ); //G useless\n this.wind_array_texture.push( 0.0 ); //B useless\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_time(t){\n var time_delta = t-this.time;\n this.wind_offset[0] = (t*16)%10\n this.wind_offset[1] = (t*8)%10\n this.time = t;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.uniform2fv(\n this.gl.getUniformLocation(this.shader_program, \"wind_offset\"),\n this.wind_offset);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"model_mat\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"raw_position\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.rel_pos_list);\n\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"raw_position\"));\n this.gl.vertexAttribPointer(this.gl.getAttribLocation(this.shader_program, \"raw_position\"), 3, this.gl.FLOAT, this.gl.FALSE, 12, 0);\n\n this.gl.vertexAttribDivisor(this.gl.getAttribLocation(this.shader_program, \"raw_position\"), 1);\n\n\n this.gl.activeTexture(gl.TEXTURE0);\n\n this.gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n this.gl.uniform1i(gl.getUniformLocation(this.shader_program, \"tex_wind\"), 0);\n\n this.gl.disable(this.gl.CULL_FACE);\n\n // this.gl.drawElements(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0);\n\n //this.transf.length\n // this.gl.drawElements(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0);\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, 3, this.gl.UNSIGNED_SHORT, 0, this.nb_leaves);\n\n this.gl.enable(this.gl.CULL_FACE);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n }\n\n vertex_shader_code = `\n precision mediump float;\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n attribute vec3 raw_position;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n uniform vec2 wind_offset;\n\n uniform sampler2D tex_wind;\n\n void main() {\n mat4 global_model = model*model_mat;\n\n vec3 new_pos_tex = vec3(global_model*vertex_pos);\n\n //rotate a bit the leaves according to a wind texture map\n vec2 relative_tex_pos = vec2(new_pos_tex.x/40.0+0.5, new_pos_tex.z/40.0+0.5);\n\n float wind_x = texture2D(tex_wind, (relative_tex_pos+wind_offset) ).r;\n float wind_z = texture2D(tex_wind, (relative_tex_pos+vec2(0.5, 0.5)+wind_offset) ).r;\n\n //rotation around x axis\n mat4 rot_mat_x = mat4(1, 0, 0, 0,\n 0, cos(wind_x), -sin(wind_x), 0,\n 0, sin(wind_x), cos(wind_x), 0,\n 0, 0, 0, 1);\n\n //rotation around z axis\n mat4 rot_mat_z = mat4(cos(wind_z), -sin(wind_z), 0, 0,\n sin(wind_z), cos(wind_x), 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 1);\n\n vec4 new_pos = (global_model*rot_mat_x*rot_mat_z*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(global_model)));\n mat3 normal_mat = mat3(global_model);\n\n pixel_pos = vec3(new_pos);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*new_pos;\n\n frag_relative_ground_pos = raw_position.y;\n\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform vec3 light_pos;\n uniform vec2 wind_offset;\n\n void main() {\n\n float distance_to_middle = distance(frag_uv, vec2(0.5, 0.5));\n\n //have some sort of leaf shape instead of a rough triangle\n if(distance_to_middle > 0.5 ){\n discard;\n }\n\n //have a repeatable random value according to relative position of the leaf to the centre of the batch\n float rand_val = sin(pixel_pos.x*pixel_pos.z/10.0)+cos( (0.13-pixel_pos.x*pixel_pos.y) / 10.0 );\n\n gl_FragColor.a = 1.0;\n\n //if the leaf is under the \"centre\" of the batch, draw it darker (to have a canopy effect)\n float light_intensity = (frag_relative_ground_pos+0.6)*1.5;\n light_intensity = clamp(light_intensity, 0.0, 1.0);\n float reverse_dist_to_middle = 1.0-distance_to_middle;\n\n gl_FragColor.rgb = vec3(0.1+rand_val/6.0, 0.4, 0.05)*light_intensity*reverse_dist_to_middle;\n }\n `;\n\n positions = [\n -1.0, -1.0, 0.0, // 0 bottom left\n 1.0, -1.0, 0.0, // 1 bottom right\n 0.0, 1.0, 0.0, // 2 top\n ];\n\n indices = [\n 0, 1, 2,\n ];\n\n normals = [\n 0, 1, 0,\n 0, 1, 0,\n ];\n\n tex_coord = [\n 0.0, 1.0,\n 1.0, 1.0,\n 0.5, 0.0,\n ];\n}"}, {"path": "tree/main.js", "language": "javascript", "loc": 72, "comment_density": 0.139, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar cam_height = 15;\nvar position_cam = [-28.0, cam_height, 0];\n\nvar light_pos = [-10, 5.0, 20];\n\nvar cube = new Cube;\nvar cube_transf = mat4.create();\n\nvar tree = new Tree;\nvar tree_transf = mat4.create();\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl2\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n // plane.setup(gl);\n cube.setup(gl);\n\n tree.setup(gl);\n\n //base platform for the tree\n mat4.scale(cube_transf, cube_transf, [20, 0.5, 20]);\n\n mat4.scale(tree_transf, tree_transf, [5, 5, 5]);\n mat4.translate(tree_transf, tree_transf, [0, 0.5, 0]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction reload_tree(){\n tree = new Tree;\n tree.setup(gl);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 10, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_active = document.getElementById(\"rotation\").checked;\n var draw_leaves_active = document.getElementById(\"leaves\").checked;\n\n //rotate the model matrix of the plane by a little bit\n var model = mat4.create();\n if(rotation_active){\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*10, [0,1,0]);\n }\n\n mat4.multiply(tree_transf, tree_transf, model);\n mat4.multiply(cube_transf, cube_transf, model);\n\n cube.set_light_pos(light_pos);\n cube.set_mvp(cube_transf, view_matrix, proj_matrix);\n cube.draw();\n\n //wind effect not that nice, leave it for now\n // tree.set_time(d.getTime()/10000.0);\n tree.set_light_pos(light_pos);\n tree.set_mvp(tree_transf, view_matrix, proj_matrix);\n tree.draw(draw_leaves_active);\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "tree/tree.html", "language": "html", "loc": 21, "comment_density": 0.048, "code": "\n\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "tree/tree.js", "language": "javascript", "loc": 33, "comment_density": 0.0, "code": "class Tree{\n setup(gl){\n this.gl = gl;\n\n this.trunk = new Trunk\n this.trunk.setup(gl);\n\n this.leaves = new Leaves;\n\n this.leaves.generate(this.trunk.get_end_point_matrices());\n\n this.leaves.setup(gl);\n }\n\n set_time(t){\n this.leaves.set_time(t);\n }\n\n draw_trunks(){\n this.trunk.draw();\n }\n\n set_mvp(model, view, proj){\n this.trunk.set_mvp(model, view, proj);\n this.leaves.set_mvp(model, view, proj);\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.trunk.set_light_pos(light_pos);\n this.light_pos = light_pos;\n }\n\n draw(draw_leaves_active){\n this.trunk.draw();\n if(draw_leaves_active){\n this.leaves.draw();\n }\n }\n}"}, {"path": "tree/trunk.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 22, "comment_density": 0.182, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n mat4 model_global = model*model_mat;\n pixel_pos = vec3(model_global*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model_global);\n\n frag_uv = uv;\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model_global*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/trunk.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 34, "comment_density": 0.059, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform vec3 light_pos;\n\n vec3 bark_high = vec3(0.6, 0.4, 0.2);\n vec3 bark_low = vec3(0.4, 0.25, 0.2);\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max);\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = dot(light_dir, pixel_normal);\n\n vec3 texture_col = get_billin(frag_uv*4.0, bark_low, bark_high);\n\n vec3 color_trunk = texture_col*diffuse_light;\n\n gl_FragColor = vec4( color_trunk , 1.0);;\n }\n\n float rand(vec2 pt)\n {\n float x = pt.x*3.13;\n float y = pt.y*7.17;\n return fract(x*y/17.0);\n }\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max)\n {\n\n float val00 = rand((pos));\n float val10 = rand((vec2(pos.x, pos.y+1.0)));\n float val01 = rand((vec2(pos.x+1.0, pos.y)));\n float val11 = rand((vec2(pos.x+1.0, pos.y+1.0)));\n\n vec2 pos_fract = fract(pos);\n\n //2d linear interpolation\n float val_x0 = mix(val00, val01, pos_fract.x);\n float val_x1 = mix(val10, val11, pos_fract.x);\n\n float final_val = mix(val_x0, val_x1, pos_fract.y);\n\n return mix(max, min, final_val);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/trunk.js", "language": "javascript", "loc": 349, "comment_density": 0.112, "code": "class Trunk{\n setup(gl){\n this.gl = gl;\n\n this.create_positions();\n\n this.transf = [];\n\n this.rand_vals = [];\n this.end_point_matrices = [];\n\n //have fixed random values for each iteration of the trunks\n for (let i = 0; i < 32; i++) {\n this.rand_vals.push( Math.random());\n }\n\n //first trunk (axiom or root of the lsystem)\n var trunk_initial_transf = mat4.create();\n mat4.translate(trunk_initial_transf, trunk_initial_transf, [0, 0.5, 0]);\n mat4.scale(trunk_initial_transf, trunk_initial_transf, [1.5/14, 1, 1.5/14]);\n\n this.add_sub_trunks_lsystem_random(trunk_initial_transf, 0, 5, true);\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n //indices for the texture pos\n this.texcoord_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), this.gl.STATIC_DRAW)\n\n //this.transf\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.transf.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n this.nb_trunks = this.transf.length;\n this.light_pos = [0, 0, 0];\n }\n\n get_end_point_matrices(){\n return this.end_point_matrices;\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"model_mat\");\n\n const ext = this.gl.getExtension(\"ANGLE_instanced_arrays\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0, this.nb_trunks);\n // gl.drawElementsInstancedANGLE(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0, this.nb_trunksindices, this.nb_trunks);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n this.gl.useProgram(null);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n mat4 model_global = model*model_mat;\n pixel_pos = vec3(model_global*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model_global);\n\n frag_uv = uv;\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model_global*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform vec3 light_pos;\n\n vec3 bark_high = vec3(0.6, 0.4, 0.2);\n vec3 bark_low = vec3(0.4, 0.25, 0.2);\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max);\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = dot(light_dir, pixel_normal);\n\n vec3 texture_col = get_billin(frag_uv*4.0, bark_low, bark_high);\n\n vec3 color_trunk = texture_col*diffuse_light;\n\n gl_FragColor = vec4( color_trunk , 1.0);;\n }\n\n float rand(vec2 pt)\n {\n float x = pt.x*3.13;\n float y = pt.y*7.17;\n return fract(x*y/17.0);\n }\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max)\n {\n\n float val00 = rand((pos));\n float val10 = rand((vec2(pos.x, pos.y+1.0)));\n float val01 = rand((vec2(pos.x+1.0, pos.y)));\n float val11 = rand((vec2(pos.x+1.0, pos.y+1.0)));\n\n vec2 pos_fract = fract(pos);\n\n //2d linear interpolation\n float val_x0 = mix(val00, val01, pos_fract.x);\n float val_x1 = mix(val10, val11, pos_fract.x);\n\n float final_val = mix(val_x0, val_x1, pos_fract.y);\n\n return mix(max, min, final_val);\n }\n `;\n\n lerp(val, min, max){\n return (1-val)*min+val*max;\n }\n\n //recursive function for generating a l-system tree structure\n add_sub_trunks_lsystem_random(t, level, max_level, is_end_point){\n\n //if this trunk section is the last one, generate the matrix and end point for this bit\n //and add them in a list\n if(level >= max_level){\n //model matrix for the trunk model\n this.transf.push(t);\n\n //model matrix for the leaves\n if(is_end_point){\n var point = vec4.create();\n point[0] = 0;\n point[1] = 0.5;\n point[2] = 0;\n point[3] = 1.0;\n vec4.transformMat4(point, point, t);\n var end_point_translation = mat4.create();\n mat4.translate(end_point_translation, end_point_translation, [point[0], point[1], point[2]]);\n\n this.end_point_matrices.push(end_point_translation);\n }\n return;\n }\n\n //base trunk\n var t0 = mat4.create();\n mat4.translate(t0, t0, [0, 0, 0]);\n mat4.scale(t0, t0, [1, 1, 1]);\n mat4.multiply(t0, t0, t);\n this.add_sub_trunks_lsystem_random(t0, level+1000, max_level, false);\n\n //top trunk\n var t1 = mat4.create();\n mat4.translate(t1, t1, [0, 0.98, 0]);\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[2], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[0], 3.1415/14.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[1], 3.1415/14.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(t1, t1, [0.8, 0.8, 0.8]);\n mat4.multiply(t1, t1, t);\n this.add_sub_trunks_lsystem_random(t1, level+1, max_level, true);\n\n //side trunks / twigs\n var b0 = mat4.create();\n mat4.translate(b0, b0, [0, this.lerp(this.rand_vals[16], 0.5, 0.9), 0] );\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[8], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[6], 3.1415/4.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[7], 3.1415/4.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b0, b0, [0.6, 0.6, 0.6]);\n mat4.multiply(b0, b0, t);\n this.add_sub_trunks_lsystem_random(b0, level+1, max_level, true);\n\n var b1 = mat4.create();\n mat4.translate(b1, b1, [0, this.lerp(this.rand_vals[17], 0.5, 0.9), 0] );\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[11], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[9], 3.1415/3.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[10], 3.1415/3.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b1, b1, [0.5, 0.5, 0.5]);\n mat4.multiply(b1, b1, t);\n this.add_sub_trunks_lsystem_random(b1, level+1, max_level, true);\n\n var b2 = mat4.create();\n mat4.translate(b2, b2, [0, this.lerp(this.rand_vals[18], 0.5, 0.9), 0] );\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[14], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[12], 3.1415/2.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[13], 3.1415/2.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b2, b2, [0.4, 0.4, 0.4]);\n mat4.multiply(b2, b2, t);\n this.add_sub_trunks_lsystem_random(b2, level+1, max_level, true);\n }\n\n //create vertices, normals, indices for a cylinder that would represent a trunk section\n create_positions(){\n var nb_vertices = 6;\n\n this.positions = [];\n\n this.positions.push(0);\n this.positions.push(-1.0/2.0);\n this.positions.push(0);\n this.positions.push(0);\n this.positions.push(1.0/2.0);\n this.positions.push(0);\n\n //to make base of trunk slightly larger\n var bigger_base = 1.1;\n\n for (let i = 0; i < nb_vertices; i++) {\n var angle_val = 3.1415*2.0*(1.0/nb_vertices)*i;\n this.positions.push((Math.sin(angle_val)/2.0)*bigger_base);\n this.positions.push(-1.0/2.0);\n this.positions.push((Math.cos(angle_val)/2.0)*bigger_base);\n this.positions.push((Math.sin(angle_val)/2.0)*(1.0/bigger_base));\n this.positions.push(1.0/2.0);\n this.positions.push((Math.cos(angle_val)/2.0)*(1.0/bigger_base));\n }\n\n\n this.nb_indices = 3*nb_vertices*2+3*nb_vertices*2;\n this.indices = [];\n for (let i = 0; i < nb_vertices; i++) {\n var start_idx_face = 2+2*i; // 12 points per face\n var up_left = start_idx_face+1; //may be another one\n var up_right = start_idx_face+3;\n if(up_right >= 2+2*nb_vertices){\n up_right = 2+1;\n }\n var down_left = start_idx_face+0;\n var down_right = start_idx_face+2;\n if(down_right >= 2+2*nb_vertices){\n down_right = 2;\n }\n\n //top\n this.indices.push(1);\n this.indices.push(up_left);\n this.indices.push(up_right);\n //side\n this.indices.push( up_left);\n this.indices.push(down_left);\n this.indices.push(down_right);\n\n this.indices.push(up_right);\n this.indices.push( up_left);\n this.indices.push(down_right);\n\n //bottom\n this.indices.push( 0);\n this.indices.push(down_right);\n this.indices.push(down_left);\n }\n\n //per vertex textcoord\n this.tex_coord = [];\n\n this.tex_coord.push(1);\n this.tex_coord.push(1);\n this.tex_coord.push(0);\n this.tex_coord.push(0);\n\n for (let i = 0; i < nb_vertices; i++) {\n // i: 0 -> 0.5 == 0 -> 1\n // i: 0.5 -> 1.0 == 1 -> 0\n var relative_pos = i/nb_vertices;\n\n if ( relative_pos < 0.5){\n relative_pos = relative_pos*2;\n }\n else{ //relative_pos > 0.5f (0.5=1, 1.0=0)\n relative_pos = relative_pos*(-2)+2;\n }\n\n this.tex_coord.push(relative_pos); //bottom\n this.tex_coord.push(1.0);\n\n this.tex_coord.push(relative_pos); //top\n this.tex_coord.push(0.0);\n }\n\n //per vertex normal\n\n this.normals = []\n\n this.normals.push(0.0);\n this.normals.push(-1.0);\n this.normals.push(0.0);\n\n this.normals.push(0.0);\n this.normals.push(1.0);\n this.normals.push(0.0);\n\n for (let i = 0; i < nb_vertices; i++) {\n var angle_val = 3.1415*2.0*(1.0/nb_vertices)*i;\n this.normals.push(Math.sin(angle_val));\n this.normals.push(0.0);\n this.normals.push(Math.cos(angle_val));\n\n this.normals.push(Math.sin(angle_val));\n this.normals.push(0.0);\n this.normals.push(Math.cos(angle_val));\n }\n }\n}"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_tree.png", "license": "none-found", "non_commercial": false, "comment_density": 0.115, "dedup_hash": "4deb9b0cb20007af", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} -{"id": "webgl_examples_triangle", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Triangle", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "triangle/triangle.html", "language": "html", "loc": 11, "comment_density": 0.0, "code": "\n\n\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n"}, {"path": "triangle/triangle.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n void main() {\n frag_colour = colour;\n gl_Position = vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "triangle/triangle.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //this is necessary in webgl glsl\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "triangle/triangle.js", "language": "javascript", "loc": 93, "comment_density": 0.14, "code": "var canvas;\nvar gl;\n\nvar shader_program;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\")\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"Cannot init WebGL\");\n return;\n }\n\n init_triangle();\n}\n\n//init the shaders and the buffers\nfunction init_triangle(){\n vertex_shader_glsl = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n void main() {\n frag_colour = colour;\n gl_Position = vertex_pos;\n }\n `;\n\n fragment_shader_glsl = `\n precision mediump float; //this is necessary in webgl glsl\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n const vertex_shader = loadShader(gl, gl.VERTEX_SHADER, vertex_shader_glsl);\n const fragment_shader = loadShader(gl, gl.FRAGMENT_SHADER, fragment_shader_glsl);\n\n shader_program = gl.createProgram();\n gl.attachShader(shader_program, vertex_shader);\n gl.attachShader(shader_program, fragment_shader);\n gl.linkProgram(shader_program);\n\n if (!gl.getProgramParameter(shader_program, gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + gl.getProgramInfoLog(shader_program));\n return null;\n }\n\n //create buffers and populate them for the triangle\n\n pos_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, pos_buffer);\n //position for each vertex of the triangle\n var triangle_points = new Float32Array([\n -1.0, -1.0, 0.0,\n 1.0, -1.0, 0.0,\n 0.0, 1.0, 0.0]);\n gl.bufferData(gl.ARRAY_BUFFER, triangle_points, gl.STATIC_DRAW);\n\n col_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, col_buffer);\n //the colours for each points in RGB\n var triangle_colours = new Float32Array([\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0]);\n gl.bufferData(gl.ARRAY_BUFFER, triangle_colours, gl.STATIC_DRAW);\n}\n\nfunction draw(){\n\n gl.clearColor(0.0, 0.0, 0.2, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n gl.useProgram(shader_program);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, pos_buffer);\n gl.vertexAttribPointer(\n gl.getAttribLocation(shader_program, \"vertex_pos\"), //the name of the attribute\n 3, //how many data per vertex point\n gl.FLOAT, //type\n true, //normalize, no effect for float\n 0, //stride\n 0); //offset\n\n gl.enableVertexAttribArray(gl.getAttribLocation(shader_program, \"vertex_pos\"));\n\n gl.bindBuffer(gl.ARRAY_BUFFER, col_buffer);\n gl.vertexAttribPointer(\n gl.getAttribLocation(shader_program, \"colour\"),\n 3,\n gl.FLOAT,\n true,\n 0,\n 0);\n\n gl.enableVertexAttribArray(gl.getAttribLocation(shader_program, \"colour\"));\n\n //will draw 3 points\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.085, "dedup_hash": "ff1d839d47d87d6d", "has_readme": true, "build_system": null, "dependency_count": 2, "has_demo": true} -{"id": "webgl_examples_water", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Water", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "water/lighting/texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "water/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 17, "comment_density": 0.118, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n uniform int active_clip;\n uniform float clip_height;\n\n void main() {\n\n //do not draw anything under the clip height\n if(active_clip != 0 && pixel_pos.y < clip_height){\n discard;\n }\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/cube.js", "language": "javascript", "loc": 208, "comment_density": 0.149, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n this.light_pos = [0,0,0];\n\n this.active_clip = 0;\n this.clip_height = 0;\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_clip(active_clip, clip_height){\n this.active_clip = active_clip;\n this.clip_height = clip_height;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniform1i(this.gl.getUniformLocation(this.shader_program, \"active_clip\"), this.active_clip);\n this.gl.uniform1f(this.gl.getUniformLocation(this.shader_program, \"clip_height\"), this.clip_height);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n uniform int active_clip;\n uniform float clip_height;\n\n void main() {\n\n //do not draw anything under the clip height\n if(active_clip != 0 && pixel_pos.y < clip_height){\n discard;\n }\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "water/framebuffer.js", "language": "javascript", "loc": 38, "comment_density": 0.158, "code": "class Framebuffer{\n\n setup(gl, image_width, image_height) {\n this.gl = gl;\n\n this.image_width = image_width;\n this.image_height = image_height;\n\n this.fb_tex = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.fb_tex);\n\n //allocate space for the texture, but feed nothing to it (null)\n //will be filled later by rendering in the framebuffer\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.image_width, this.image_height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n this.fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n\n //key part, we associate the texture with the framebuffer\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.fb_tex, 0);\n\n //create a depth buffer for the framebuffer, otherwise 3d rendering will be weird\n this.depth_buffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.depth_buffer);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, this.image_width, this.image_height);\n\n //associate the render buffer with the framebuffer\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depth_buffer);\n\n //unbind everything to avoid pollution\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n bind(){\n this.gl.viewport(0, 0, this.image_width, this.image_height);\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n }\n\n unbind(){\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n get_texture(){\n return this.fb_tex;\n }\n\n}"}, {"path": "water/main.js", "language": "javascript", "loc": 162, "comment_density": 0.099, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\nvar view_matrix_reflection = mat4.create();\n\nvar cam_height = 10;\nvar cam_radius = 20;\nvar position_cam = [cam_radius, cam_height, 0.0];\n\nvar water = new Water;\nvar water_transf = mat4.create();\n\nvar cubes_base = [new Cube, new Cube, new Cube, new Cube, new Cube];\nvar model_matrix_cubes_base = [mat4.create(), mat4.create(), mat4.create(), mat4.create(), mat4.create()];\n\nvar cubes_decoration = [new Cube, new Cube];\nvar model_matrix_cubes_decoration = [mat4.create(), mat4.create()]\n\nvar light_pos_radius = 15;\nvar light_pos = [-1, 5.0, 0];\n\nvar framebuffer_reflection = new Framebuffer;\nvar framebuffer_refraction = new Framebuffer;\n\nvar canvas_width = 1600;\nvar canvas_height = 900;\n\nvar last_time = 0;\n\n//needed for reflection matrix calculation\nvar water_height = 2;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n canvas_width = gl.canvas.width;\n canvas_height = gl.canvas.height;\n\n\n framebuffer_reflection.setup(gl, canvas_width, canvas_height);\n framebuffer_refraction.setup(gl, canvas_width, canvas_height);\n\n water.setup(gl);\n\n water.set_reflection_texture(framebuffer_reflection.get_texture());;\n water.set_refraction_texture(framebuffer_refraction.get_texture());;\n\n mat4.translate(model_matrix_cubes_base[0], model_matrix_cubes_base[0], [15, 0, 0]);\n mat4.scale(model_matrix_cubes_base[0], model_matrix_cubes_base[0], [5, 2.5, 20]);\n\n mat4.translate(model_matrix_cubes_base[1], model_matrix_cubes_base[1], [-5, 0, -15]);\n mat4.scale(model_matrix_cubes_base[1], model_matrix_cubes_base[1], [15, 2.5, 5]);\n\n mat4.translate(model_matrix_cubes_base[2], model_matrix_cubes_base[2], [-5, 0, 15]);\n mat4.scale(model_matrix_cubes_base[2], model_matrix_cubes_base[2], [15, 2.5, 5]);\n\n mat4.translate(model_matrix_cubes_base[3], model_matrix_cubes_base[3], [-15, 0, 0]);\n mat4.scale(model_matrix_cubes_base[3], model_matrix_cubes_base[3], [5, 2.5, 10]);\n\n mat4.translate(model_matrix_cubes_base[4], model_matrix_cubes_base[4], [0, -2.5, 0]);\n mat4.scale(model_matrix_cubes_base[4], model_matrix_cubes_base[4], [20, 0.5, 20]);\n\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].setup(gl);\n cubes_base[i].set_model_matrix(model_matrix_cubes_base[i]);\n }\n\n mat4.translate(model_matrix_cubes_decoration[0], model_matrix_cubes_decoration[0], [0, 0, -4]);\n mat4.scale(model_matrix_cubes_decoration[0], model_matrix_cubes_decoration[0], [2.5, 2.5, 2.5]);\n\n mat4.translate(model_matrix_cubes_decoration[1], model_matrix_cubes_decoration[1], [-15, 5, 4]);\n mat4.scale(model_matrix_cubes_decoration[1], model_matrix_cubes_decoration[1], [2.5, 2.5, 2.5]);\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].setup(gl);\n cubes_decoration[i].set_model_matrix(model_matrix_cubes_decoration[i]);\n }\n\n\n mat4.translate(water_transf, water_transf, [0, water_height, 0]);\n mat4.scale(water_transf, water_transf, [20, 20, 20]);\n\n water.set_model_matrix(water_transf);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n var pos_cam_from_underneath = [...position_cam]; //clone array\n pos_cam_from_underneath[1] = -position_cam[1]+water_height*2;\n mat4.lookAt(view_matrix_reflection, pos_cam_from_underneath, [0, water_height*2, 0], [0, 1, 0]);\n\n this.gl.viewport(0, 0, canvas_width, canvas_height);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independant\n time_diff = time-last_time;\n\n var light_speed = document.getElementById(\"slider_speed\").value;\n var light_height = document.getElementById(\"slider_height\").value;\n var cam_height = document.getElementById(\"cam_height\").value;\n var cam_rotation = -document.getElementById(\"cam_rotation\").value;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 11.0-light_height;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n\n position_cam[0] = cam_radius*Math.cos(cam_rotation/10);\n position_cam[1] = cam_height;\n position_cam[2] = cam_radius*Math.sin(cam_rotation/10);\n\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].set_light_pos(light_pos_scaled);\n cubes_base[i].set_vp(view_matrix, proj_matrix);\n cubes_base[i].draw();\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].set_light_pos(light_pos_scaled);\n cubes_decoration[i].set_vp(view_matrix, proj_matrix);\n cubes_decoration[i].draw();\n }\n\n water.set_time( (d.getTime()/500.0)%1000);\n water.set_vp(view_matrix, proj_matrix);\n water.set_light_pos(light_pos_scaled); //for specularity on the water\n water.set_camera_pos(position_cam); //for specularity on the water\n water.draw();\n\n //refraction step is just drawing the normal shapes again, but in a framebuffer\n framebuffer_refraction.bind();\n\n gl.clearColor(0.7, 0.8, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n //we need to clip everything underwater when rendering the reflection framebuffer\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].draw();\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].draw();\n }\n\n framebuffer_refraction.unbind();\n\n //for reflection step we draw every thing from underneath\n framebuffer_reflection.bind();\n\n gl.clearColor(0.7, 0.8, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n //we need to clip everything underwater when rendering the reflection framebuffer\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].set_clip(1, water_height);\n cubes_base[i].set_vp(view_matrix_reflection, proj_matrix);\n cubes_base[i].draw();\n cubes_base[i].set_clip(0, 0);\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].set_clip(1, water_height);\n cubes_decoration[i].set_vp(view_matrix_reflection, proj_matrix);\n cubes_decoration[i].draw();\n cubes_decoration[i].set_clip(0, 0);\n }\n\n framebuffer_reflection.unbind();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "water/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/plane.js", "language": "javascript", "loc": 118, "comment_density": 0.008, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n}\n"}, {"path": "water/water.html", "language": "html", "loc": 20, "comment_density": 0.0, "code": "\n\n\n\nLight Speed: \nLight Height: \nCam Height: \nCam Rotation:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "water/water.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 16, "comment_density": 0.062, "code": "precision highp float; //high precision needed in mobile for light to display correctly\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/water.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 52, "comment_density": 0.115, "code": "precision highp float; //high precision needed in mobile for light to display correctly\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 camera_pos;\n uniform vec3 light_pos;\n\n varying vec2 frag_uv;\n\n uniform sampler2D texture_reflection;\n uniform sampler2D texture_refraction;\n\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n float get_wave_1(float x, float y){\n float wave = 0.01*sin( dot(normalize(vec2(1,0)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(15,1)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(10,-1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.01*sin( dot(normalize(vec2(3,1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.02*sin( dot(normalize(vec2(6,-1)), vec2(x, y)) *64.0+time*0.8);\n wave += 0.015*sin( dot(normalize(vec2(8,1)), vec2(x, y)) *128.0+time*0.7);\n return wave/24.0;\n }\n\n void main() {\n\n float wave = get_wave_1(frag_uv.x, frag_uv.y);\n\n //interestingly the normal_wave would not be calculated correctly on mobile\n //if the float precision was only medium\n vec3 pos_before_x = vec3(frag_uv.x-0.001, get_wave_1(frag_uv.x-0.001, frag_uv.y), frag_uv.y);\n vec3 pos_after_x = vec3(frag_uv.x+0.001, get_wave_1(frag_uv.x+0.001, frag_uv.y), frag_uv.y);\n vec3 pos_before_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y-0.001), frag_uv.y-0.001);\n vec3 pos_after_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y+0.001), frag_uv.y+0.001);\n\n //get normal of wave, for lighting purpose\n vec3 normal_wave = normalize(cross( pos_after_x-pos_before_x, pos_after_y-pos_before_y));\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = 0.0;\n\n diffuse_light = dot(normal_wave, light_dir);\n float light_dist = length(light_pos-pixel_pos);\n diffuse_light /= (1.0+pow(light_dist, -0.5));\n\n //reflexion of light for specular light calculation, not the image reflexion\n vec3 reflexion = 2.0*normal_wave*dot(normal_wave, light_dir)-light_dir;\n reflexion = normalize(reflexion);\n vec3 view_dir = normalize(camera_pos-pixel_pos);\n\n float spec_light = pow(max(dot(reflexion, view_dir), 0.0), 256.0);\n spec_light = clamp(spec_light, 0.0, 1.0);\n\n float lum = 0.5*diffuse_light+spec_light;\n\n vec4 screen_pos = proj*view*vec4(pixel_pos, 1.0);\n vec2 corr_screen_pos_refraction = screen_pos.xy*0.5/screen_pos.w+vec2(0.5, 0.5);\n vec2 corr_screen_pos_reflection = vec2(corr_screen_pos_refraction.x, 1.0-corr_screen_pos_refraction.y); //must invert y\n\n corr_screen_pos_refraction += vec2(wave, wave);\n corr_screen_pos_reflection += vec2(wave, wave);\n\n vec3 colour_refraction = texture2D( texture_refraction, corr_screen_pos_refraction ).rgb;\n vec3 colour_reflection = texture2D( texture_reflection, corr_screen_pos_reflection ).rgb;\n vec4 lighting = vec4(lum, lum, lum, 1.0);\n gl_FragColor = vec4(0.25*colour_refraction, 1.0)+vec4(0.75*colour_reflection, 1.0)+ lighting;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/water.js", "language": "javascript", "loc": 209, "comment_density": 0.038, "code": "class Water{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n this.gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n this.time = 0;\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_camera_pos(cam_pos){\n this.cam_pos = cam_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_reflection_texture(tex){\n this.reflection_texture_id = tex;\n }\n\n set_refraction_texture(tex){\n this.refraction_texture_id = tex;\n }\n\n set_time(time){\n this.time = time;\n }\n\n draw(){\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.reflection_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture_reflection\"), 0);\n\n gl.activeTexture(gl.TEXTURE1);\n\n gl.bindTexture(gl.TEXTURE_2D, this.refraction_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture_refraction\"), 1);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"time\"), this.time);\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"camera_pos\"),\n this.cam_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n precision highp float; //high precision needed in mobile for light to display correctly\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision highp float; //high precision needed in mobile for light to display correctly\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 camera_pos;\n uniform vec3 light_pos;\n\n varying vec2 frag_uv;\n\n uniform sampler2D texture_reflection;\n uniform sampler2D texture_refraction;\n\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n float get_wave_1(float x, float y){\n float wave = 0.01*sin( dot(normalize(vec2(1,0)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(15,1)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(10,-1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.01*sin( dot(normalize(vec2(3,1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.02*sin( dot(normalize(vec2(6,-1)), vec2(x, y)) *64.0+time*0.8);\n wave += 0.015*sin( dot(normalize(vec2(8,1)), vec2(x, y)) *128.0+time*0.7);\n return wave/24.0;\n }\n\n void main() {\n\n float wave = get_wave_1(frag_uv.x, frag_uv.y);\n\n //interestingly the normal_wave would not be calculated correctly on mobile\n //if the float precision was only medium\n vec3 pos_before_x = vec3(frag_uv.x-0.001, get_wave_1(frag_uv.x-0.001, frag_uv.y), frag_uv.y);\n vec3 pos_after_x = vec3(frag_uv.x+0.001, get_wave_1(frag_uv.x+0.001, frag_uv.y), frag_uv.y);\n vec3 pos_before_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y-0.001), frag_uv.y-0.001);\n vec3 pos_after_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y+0.001), frag_uv.y+0.001);\n\n //get normal of wave, for lighting purpose\n vec3 normal_wave = normalize(cross( pos_after_x-pos_before_x, pos_after_y-pos_before_y));\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = 0.0;\n\n diffuse_light = dot(normal_wave, light_dir);\n float light_dist = length(light_pos-pixel_pos);\n diffuse_light /= (1.0+pow(light_dist, -0.5));\n\n //reflexion of light for specular light calculation, not the image reflexion\n vec3 reflexion = 2.0*normal_wave*dot(normal_wave, light_dir)-light_dir;\n reflexion = normalize(reflexion);\n vec3 view_dir = normalize(camera_pos-pixel_pos);\n\n float spec_light = pow(max(dot(reflexion, view_dir), 0.0), 256.0);\n spec_light = clamp(spec_light, 0.0, 1.0);\n\n float lum = 0.5*diffuse_light+spec_light;\n\n vec4 screen_pos = proj*view*vec4(pixel_pos, 1.0);\n vec2 corr_screen_pos_refraction = screen_pos.xy*0.5/screen_pos.w+vec2(0.5, 0.5);\n vec2 corr_screen_pos_reflection = vec2(corr_screen_pos_refraction.x, 1.0-corr_screen_pos_refraction.y); //must invert y\n\n corr_screen_pos_refraction += vec2(wave, wave);\n corr_screen_pos_reflection += vec2(wave, wave);\n\n vec3 colour_refraction = texture2D( texture_refraction, corr_screen_pos_refraction ).rgb;\n vec3 colour_reflection = texture2D( texture_reflection, corr_screen_pos_reflection ).rgb;\n vec4 lighting = vec4(lum, lum, lum, 1.0);\n gl_FragColor = vec4(0.25*colour_refraction, 1.0)+vec4(0.75*colour_reflection, 1.0)+ lighting;\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_water.png", "license": "none-found", "non_commercial": false, "comment_density": 0.089, "dedup_hash": "efc55ff0924657c7", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} +version https://git-lfs.github.com/spec/v1 +oid sha256:e511f2ce8efce60dd1a38871a3a2a9e8be34787b8221a4d3df263d29eeaf2615 +size 146385310 diff --git a/images/gfxfundamentals_webgl2_fundamentals_root.png b/images/gfxfundamentals_webgl2_fundamentals_root.png new file mode 100644 index 0000000000000000000000000000000000000000..e34a03afea9f7719e5a8b5375a9c235d22324a18 --- /dev/null +++ b/images/gfxfundamentals_webgl2_fundamentals_root.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0e0d95a9c8abcdfabf46348e2d4285829bb0491f5f6af0e05af52bffb6324c4 +size 8777 diff --git a/images/gfxfundamentals_webgl2_fundamentals_webgl_lessons.png b/images/gfxfundamentals_webgl2_fundamentals_webgl_lessons.png new file mode 100644 index 0000000000000000000000000000000000000000..7c7d9198473f98579519081904d3be2eaff29ac5 --- /dev/null +++ b/images/gfxfundamentals_webgl2_fundamentals_webgl_lessons.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11cbbdc37aca00587875d7f7ad21629eac49cf6eb7e257f29c7dd176dcf97534 +size 1257 diff --git a/images/gfxfundamentals_webgl2_fundamentals_webgl_lessons_resources.png b/images/gfxfundamentals_webgl2_fundamentals_webgl_lessons_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..7c7d9198473f98579519081904d3be2eaff29ac5 --- /dev/null +++ b/images/gfxfundamentals_webgl2_fundamentals_webgl_lessons_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11cbbdc37aca00587875d7f7ad21629eac49cf6eb7e257f29c7dd176dcf97534 +size 1257 diff --git a/images/gfxfundamentals_webgl2_fundamentals_webgl_resources.png b/images/gfxfundamentals_webgl2_fundamentals_webgl_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..c30adc5ed9bb19c2087723a045a2bdd8cf307b3d --- /dev/null +++ b/images/gfxfundamentals_webgl2_fundamentals_webgl_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e3a526c343b93e35925ef984c52974c1278220e100f5f845fd3d15b45eaba4c +size 912 diff --git a/images/gfxfundamentals_webgl2_fundamentals_webgl_resources_tdl.jpg b/images/gfxfundamentals_webgl2_fundamentals_webgl_resources_tdl.jpg new file mode 100644 index 0000000000000000000000000000000000000000..24879f9583f2ffd69d43d23589fee01c77baa5aa --- /dev/null +++ b/images/gfxfundamentals_webgl2_fundamentals_webgl_resources_tdl.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:372bb5b7b7576f090b81e55cdae63be765e0262319dafacd09bc9834a109986b +size 16157 diff --git a/images/gfxfundamentals_webgl_fundamentals_root.png b/images/gfxfundamentals_webgl_fundamentals_root.png new file mode 100644 index 0000000000000000000000000000000000000000..e34a03afea9f7719e5a8b5375a9c235d22324a18 --- /dev/null +++ b/images/gfxfundamentals_webgl_fundamentals_root.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0e0d95a9c8abcdfabf46348e2d4285829bb0491f5f6af0e05af52bffb6324c4 +size 8777 diff --git a/images/gfxfundamentals_webgl_fundamentals_webgl_lessons.png b/images/gfxfundamentals_webgl_fundamentals_webgl_lessons.png new file mode 100644 index 0000000000000000000000000000000000000000..39f9512c23cefe634b464270984ff3501db0bdba --- /dev/null +++ b/images/gfxfundamentals_webgl_fundamentals_webgl_lessons.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fc8f3528d182ea600f3f8ce115314cf37feca581168931eaa8c6a1e25fad8fa +size 1254 diff --git a/images/gfxfundamentals_webgl_fundamentals_webgl_lessons_resources.png b/images/gfxfundamentals_webgl_fundamentals_webgl_lessons_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..39f9512c23cefe634b464270984ff3501db0bdba --- /dev/null +++ b/images/gfxfundamentals_webgl_fundamentals_webgl_lessons_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fc8f3528d182ea600f3f8ce115314cf37feca581168931eaa8c6a1e25fad8fa +size 1254 diff --git a/images/gfxfundamentals_webgl_fundamentals_webgl_resources.png b/images/gfxfundamentals_webgl_fundamentals_webgl_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..c30adc5ed9bb19c2087723a045a2bdd8cf307b3d --- /dev/null +++ b/images/gfxfundamentals_webgl_fundamentals_webgl_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e3a526c343b93e35925ef984c52974c1278220e100f5f845fd3d15b45eaba4c +size 912 diff --git a/images/gfxfundamentals_webgl_fundamentals_webgl_resources_tdl.jpg b/images/gfxfundamentals_webgl_fundamentals_webgl_resources_tdl.jpg new file mode 100644 index 0000000000000000000000000000000000000000..24879f9583f2ffd69d43d23589fee01c77baa5aa --- /dev/null +++ b/images/gfxfundamentals_webgl_fundamentals_webgl_resources_tdl.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:372bb5b7b7576f090b81e55cdae63be765e0262319dafacd09bc9834a109986b +size 16157 diff --git a/images/gl_transitions_gl_transitions_scripts.jpg b/images/gl_transitions_gl_transitions_scripts.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8f93a05b658a2d9c7ec4882ecf9ef4068bb1cc03 --- /dev/null +++ b/images/gl_transitions_gl_transitions_scripts.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8620afe99d25406a8a4edeec95e2933b78ee62d2a77522097b36a0d3b44589da +size 252006 diff --git a/images/gl_transitions_gl_transitions_scripts_preview.jpg b/images/gl_transitions_gl_transitions_scripts_preview.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8f93a05b658a2d9c7ec4882ecf9ef4068bb1cc03 --- /dev/null +++ b/images/gl_transitions_gl_transitions_scripts_preview.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8620afe99d25406a8a4edeec95e2933b78ee62d2a77522097b36a0d3b44589da +size 252006 diff --git a/images/jaeger47_opengl_glut_cpp_g_2_texture_wrapping_texture_wrap.jpg b/images/jaeger47_opengl_glut_cpp_g_2_texture_wrapping_texture_wrap.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9a4b6e06348817227fdb3378d87765247f6b4cae --- /dev/null +++ b/images/jaeger47_opengl_glut_cpp_g_2_texture_wrapping_texture_wrap.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:207b1aafce682b0899e3d77b8eed4cf15ad53d29a917ef3451c5c0a6aff547f4 +size 180589 diff --git a/images/jaeger47_opengl_glut_cpp_z_extra_tutorials_full_model_animation_with_textures.png b/images/jaeger47_opengl_glut_cpp_z_extra_tutorials_full_model_animation_with_textures.png new file mode 100644 index 0000000000000000000000000000000000000000..e47948340845d1a12b08c86be87448658203333c --- /dev/null +++ b/images/jaeger47_opengl_glut_cpp_z_extra_tutorials_full_model_animation_with_textures.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e54a6276b74d7f15fb13665c767cf2bf1f7b76691c034d11ca7d773b0e2fa8a6 +size 31580 diff --git a/images/joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_cpu_src.png b/images/joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_cpu_src.png new file mode 100644 index 0000000000000000000000000000000000000000..079590226b02266bb7490c8951b1c8771fa018f8 --- /dev/null +++ b/images/joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_cpu_src.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ebacba038d0b035c4b02dbd9c38434f7d104a9d3077501b4cd205248cc13579 +size 1492397 diff --git a/images/joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_gpu_dist.png b/images/joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_gpu_dist.png new file mode 100644 index 0000000000000000000000000000000000000000..079590226b02266bb7490c8951b1c8771fa018f8 --- /dev/null +++ b/images/joeydevries_learnopengl_src_8_guest_2021_3_tessellation_terrain_gpu_dist.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ebacba038d0b035c4b02dbd9c38434f7d104a9d3077501b4cd205248cc13579 +size 1492397 diff --git a/images/khronosgroup_vulkan_samples_app.png b/images/khronosgroup_vulkan_samples_app.png new file mode 100644 index 0000000000000000000000000000000000000000..b6095a5a1b033e37bce39ada8b00184d0ab50fda --- /dev/null +++ b/images/khronosgroup_vulkan_samples_app.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72591446fd3cfd8b71ca6e8898c0c68154602ef95d58c884a81ac66696939cb0 +size 28543 diff --git a/images/khronosgroup_vulkan_samples_samples_api_oit_depth_peeling.png b/images/khronosgroup_vulkan_samples_samples_api_oit_depth_peeling.png new file mode 100644 index 0000000000000000000000000000000000000000..1050274aa873bc45a70b6eccc3d7e7b41b30a323 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_api_oit_depth_peeling.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55b598c91d191fc2868f9d0a3c97065d2ff6bc937046edb549197e377192172a +size 296517 diff --git a/images/khronosgroup_vulkan_samples_samples_api_oit_linked_lists.png b/images/khronosgroup_vulkan_samples_samples_api_oit_linked_lists.png new file mode 100644 index 0000000000000000000000000000000000000000..70a2498ab2fa56a9c14ead766754c0f36ba76f3e --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_api_oit_linked_lists.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90d1f5cbae4edce14ec91778584dfb7a0adff51a0e05b38b392e25b6effa08d7 +size 198749 diff --git a/images/khronosgroup_vulkan_samples_samples_api_texture_mipmap_generation.jpg b/images/khronosgroup_vulkan_samples_samples_api_texture_mipmap_generation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..037e7db5f5caccc5a52f921798759ac75cc86da0 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_api_texture_mipmap_generation.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d31ee20eae9b32f7923658ffd64a78cc66ef1f614b27f506c9933f04b64fa24 +size 150268 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_buffer_device_address.png b/images/khronosgroup_vulkan_samples_samples_extensions_buffer_device_address.png new file mode 100644 index 0000000000000000000000000000000000000000..1c898cfd10fe1e48dced768a9bf9640eb6985a4a --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_buffer_device_address.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c349b88956adf16ef125d587aa7feeba471933b38853c36b7c67ff1d24c5d9d +size 342479 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_compute_shader_derivatives.png b/images/khronosgroup_vulkan_samples_samples_extensions_compute_shader_derivatives.png new file mode 100644 index 0000000000000000000000000000000000000000..563ef9151f071f1dba1c01ede704628a2d0b2c48 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_compute_shader_derivatives.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a630f7d5fd5e757e74d7385090db43f9dcf07f1867bc1e62fff56bd5f26685d1 +size 370717 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_conditional_rendering.png b/images/khronosgroup_vulkan_samples_samples_extensions_conditional_rendering.png new file mode 100644 index 0000000000000000000000000000000000000000..2e299cc3c328f31a734b672de83db95aa9b70147 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_conditional_rendering.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52be15240c6ed327921d13a913669bb446d0b6c79a81dae34c71bbff7292ca4d +size 23922 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_debug_utils.jpg b/images/khronosgroup_vulkan_samples_samples_extensions_debug_utils.jpg new file mode 100644 index 0000000000000000000000000000000000000000..536bbc67853ba60c0f1f270b349f593b7cc2db6b --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_debug_utils.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a759285ba14a4735cfde088b1ab86d17a446048acfa609d36504939c0ad3c22d +size 265672 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_descriptor_indexing.png b/images/khronosgroup_vulkan_samples_samples_extensions_descriptor_indexing.png new file mode 100644 index 0000000000000000000000000000000000000000..8125d7bbdd6187633f3da86d78ec5351dd0fcf06 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_descriptor_indexing.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fae6f389f6e3f2cff3b9312508072947ddb4ae3db8155b23c326de7a31b21431 +size 544976 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_device_fault.png b/images/khronosgroup_vulkan_samples_samples_extensions_device_fault.png new file mode 100644 index 0000000000000000000000000000000000000000..4301ceb8429c1c65cb1b719a6562cfd69acb4c66 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_device_fault.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9163beeaf2fedb2b4e340d41520a67d3ac641960e18613aceef9ddf0173c4b2 +size 240345 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_line_rasterization.png b/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_line_rasterization.png new file mode 100644 index 0000000000000000000000000000000000000000..a3c3b00835f0d96d7675cfc43f28653857d0111f --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_line_rasterization.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48bf4fecd6c76b7072a0d123e907d33c1fec8467caa3b70634b6098cf67f7388 +size 107422 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_multisample_rasterization.png b/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_multisample_rasterization.png new file mode 100644 index 0000000000000000000000000000000000000000..50a1cabf9d22f067ff98e127e231e0f9e6c5c5a6 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_multisample_rasterization.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d94833c396cd93e81f31f18b68eab42fdd4beec98689899c31c641f1fc6c8c47 +size 527543 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_primitive_clipping.png b/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_primitive_clipping.png new file mode 100644 index 0000000000000000000000000000000000000000..217f453ad50d543c085a37ba9d91250ec4faf58d --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_primitive_clipping.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb8e848c69f7641c560b3ad67888ebff508c0087939f199ecf1559ba8b8e08bc +size 156548 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_rendering_local_read.png b/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_rendering_local_read.png new file mode 100644 index 0000000000000000000000000000000000000000..5e68b70833bfe70837f3d15d0aa36bc1a7d534d6 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_dynamic_rendering_local_read.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34a3e90a424927e149e4b770219e79226671e911c7b016065c4d9aee2f7ff138 +size 199539 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_extended_dynamic_state2.png b/images/khronosgroup_vulkan_samples_samples_extensions_extended_dynamic_state2.png new file mode 100644 index 0000000000000000000000000000000000000000..85ac0818bf7280a4ab4be45500e61f1adc50c88c --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_extended_dynamic_state2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0f163d0e362447532b2001dcf9df220200f6d36d805a2c024b2327d59008064 +size 1257262 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_fragment_density_map.png b/images/khronosgroup_vulkan_samples_samples_extensions_fragment_density_map.png new file mode 100644 index 0000000000000000000000000000000000000000..da172acab1ae95107695b5695e8475f7305a27f8 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_fragment_density_map.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ae6e7dbc41dd5d87e79d06976892587507951ecbd03096d9327084ce2cd9c9c +size 1979046 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_fragment_shader_barycentric.png b/images/khronosgroup_vulkan_samples_samples_extensions_fragment_shader_barycentric.png new file mode 100644 index 0000000000000000000000000000000000000000..9840d6c027d32583a89ecf159c6730a95a9b1138 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_fragment_shader_barycentric.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1767235d0d8ff25ee57a7e65b7b2d6a308b53aca70fbe945d9b226f639a9eb2 +size 1662487 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_fragment_shading_rate_dynamic.png b/images/khronosgroup_vulkan_samples_samples_extensions_fragment_shading_rate_dynamic.png new file mode 100644 index 0000000000000000000000000000000000000000..dd2c22b49f12d67334e6220dd1338b95fdcb9191 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_fragment_shading_rate_dynamic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89ecd04e4ae36f83842be3c9a77924967ce99f2efc5ee7f94632aa1084e152d1 +size 96077 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_graphics_pipeline_library.jpg b/images/khronosgroup_vulkan_samples_samples_extensions_graphics_pipeline_library.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2b12b084d46da0082ca5013dc7d23914d3b69d8c --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_graphics_pipeline_library.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6e6cedc974b7e7905de990a9fe858cc3a8b52ad91b98c229559fb6d6055a877 +size 107818 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_gshader_to_mshader.png b/images/khronosgroup_vulkan_samples_samples_extensions_gshader_to_mshader.png new file mode 100644 index 0000000000000000000000000000000000000000..d6691c4f7501c86e8a349ec92f0ddedc71104914 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_gshader_to_mshader.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a42effd3100faae39344e23ef3c46c5d836096e2f2911bf2b3a9134442c593b +size 429246 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_logic_op_dynamic_state.png b/images/khronosgroup_vulkan_samples_samples_extensions_logic_op_dynamic_state.png new file mode 100644 index 0000000000000000000000000000000000000000..514645c74884cb62583db5cca8a8998ccc0dbbfc --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_logic_op_dynamic_state.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9626d0a2057dcf7f7c1e5fe6c6033dc93892f563c82070abf271ff0e5829f70 +size 1437046 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_memory_budget.png b/images/khronosgroup_vulkan_samples_samples_extensions_memory_budget.png new file mode 100644 index 0000000000000000000000000000000000000000..9f90f25804c3aa5311c1877c1b53ffe33bb2048d --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_memory_budget.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a89daa7eb1df8cf046553479ab2820908adb1d831d829cdee08f09a15fb5801 +size 24264 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_mesh_shader_culling.png b/images/khronosgroup_vulkan_samples_samples_extensions_mesh_shader_culling.png new file mode 100644 index 0000000000000000000000000000000000000000..96f74ab272b3620ee015197b3c99e52e677289f1 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_mesh_shader_culling.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:890ac0a441b19bc7d97498a7c5fece7e0f58de33b0333a45b96f8c55263633fa +size 47650 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_open_cl_interop.jpg b/images/khronosgroup_vulkan_samples_samples_extensions_open_cl_interop.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f8af7a6fc74228483168b1556dc4020e980e230b --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_open_cl_interop.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0dbfa30ef82f364adb845ec5c0518e79e9bfa5dce45cef1ffb9210fad580df2 +size 76751 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_open_cl_interop_arm.png b/images/khronosgroup_vulkan_samples_samples_extensions_open_cl_interop_arm.png new file mode 100644 index 0000000000000000000000000000000000000000..d567adf1761566f1d6f87d162e43f66b690854cc --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_open_cl_interop_arm.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fda2b4ed399b016da94f23756e2bb5c61dedd498ae6cbc2126985dbfdf1f613e +size 609339 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_patch_control_points.png b/images/khronosgroup_vulkan_samples_samples_extensions_patch_control_points.png new file mode 100644 index 0000000000000000000000000000000000000000..57122ed3bc455a62d666f91ae5ef3e42ffebcf4c --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_patch_control_points.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73843cd1a0b868ae0c7ab871f745942339ad4518d7a3bb28b09759e778972e05 +size 159777 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_rasterization_order_attachment_access.png b/images/khronosgroup_vulkan_samples_samples_extensions_rasterization_order_attachment_access.png new file mode 100644 index 0000000000000000000000000000000000000000..b64824483069927151972bb2c14068ea720fa6db --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_rasterization_order_attachment_access.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d6b361bd7c25a8c122e713562dd9a079c87d8dd021ee339b81e4a570cc6acec +size 361275 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_ray_tracing_position_fetch.png b/images/khronosgroup_vulkan_samples_samples_extensions_ray_tracing_position_fetch.png new file mode 100644 index 0000000000000000000000000000000000000000..769d4c4153eee8d1ca75f5c949340878c2b5ba67 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_ray_tracing_position_fetch.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40e8ca08325b5193d0f58e01af72cf2191045f3c4c198d5ad6cacab5ac09546b +size 97203 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_ray_tracing_reflection.png b/images/khronosgroup_vulkan_samples_samples_extensions_ray_tracing_reflection.png new file mode 100644 index 0000000000000000000000000000000000000000..3038d00f0fd81f48e759755092a1e944c0dd5309 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_ray_tracing_reflection.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce139983cf4923fd762dc182855baf6ac254fe088a9524f9ec48faed6cf33cbb +size 38583 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_shader_debugprintf.png b/images/khronosgroup_vulkan_samples_samples_extensions_shader_debugprintf.png new file mode 100644 index 0000000000000000000000000000000000000000..ef827b4168e710bfafa1bbab7866fd08806e2a4c --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_shader_debugprintf.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a90279684452c7316662e7c5f7e48f41299c0ebee394198d0288913ae64acc62 +size 149147 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_shader_object.png b/images/khronosgroup_vulkan_samples_samples_extensions_shader_object.png new file mode 100644 index 0000000000000000000000000000000000000000..742ea03d57ee62c1d3c42dd1dc33efd5c1823959 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_shader_object.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ef87f1118ffa59eb5408ee37ca40e2cabfe2235d05e5e26bec3b32d1ae30d32 +size 882864 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_sparse_image.png b/images/khronosgroup_vulkan_samples_samples_extensions_sparse_image.png new file mode 100644 index 0000000000000000000000000000000000000000..56b3c772dcd570f005f36c7ee271c87b81930160 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_sparse_image.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0176a4b7de49c642929a75478b6fa1889dacbe12f6482aa3ac7dedd4bd4655c +size 286224 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph.png b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph.png new file mode 100644 index 0000000000000000000000000000000000000000..0bd6cf23aa8df592851ed27cf31da4dc23c2225e --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05ac6a3126920f59c768ebd1874f3c051e6e5ea6a25af6f08bac5abcba95e6bb +size 48131 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_compute_shaders_with_tensors.png b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_compute_shaders_with_tensors.png new file mode 100644 index 0000000000000000000000000000000000000000..0bd6cf23aa8df592851ed27cf31da4dc23c2225e --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_compute_shaders_with_tensors.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05ac6a3126920f59c768ebd1874f3c051e6e5ea6a25af6f08bac5abcba95e6bb +size 48131 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_graph_constants.png b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_graph_constants.png new file mode 100644 index 0000000000000000000000000000000000000000..dbdea2564df63e27e23bcb5fa2693417c040aa1a --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_graph_constants.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6df40781af8dd629cf062e3d6d223d9f59b68a5d59192feef2664171c23e5091 +size 47770 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_postprocessing_with_vgf.png b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_postprocessing_with_vgf.png new file mode 100644 index 0000000000000000000000000000000000000000..a3f7a2af40883856b422448d6df5b7ec3fc6eedb --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_postprocessing_with_vgf.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af4a1e798bd6e23343140f03e10ef8b1c3d911a0103ac771dec2aea25862e1ba +size 2083929 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_simple_tensor_and_data_graph.png b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_simple_tensor_and_data_graph.png new file mode 100644 index 0000000000000000000000000000000000000000..82729cb01c1bf0b9aa93b396243df58887d6ed7e --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_simple_tensor_and_data_graph.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df3d124bc13a10e313709abe04c3ca3b6cde55c0de24562c6f37188131f0e996 +size 31455 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_tensor_image_aliasing.png b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_tensor_image_aliasing.png new file mode 100644 index 0000000000000000000000000000000000000000..4cc33efa257393c1e752cad29bf3c9f94443dc03 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_tensor_and_data_graph_tensor_image_aliasing.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30ec884c01d49f671b5c81437757374572f9a896ead5a485a437eb816943a7f2 +size 2084785 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_timeline_semaphore.png b/images/khronosgroup_vulkan_samples_samples_extensions_timeline_semaphore.png new file mode 100644 index 0000000000000000000000000000000000000000..998b3da485afd3c4a34ee4997e495159bbb3ef05 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_timeline_semaphore.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ff5eb96cde25d7b38e574d54349d0a253130490e0904b2c70d8eed3d6600511 +size 45055 diff --git a/images/khronosgroup_vulkan_samples_samples_extensions_vertex_dynamic_state.png b/images/khronosgroup_vulkan_samples_samples_extensions_vertex_dynamic_state.png new file mode 100644 index 0000000000000000000000000000000000000000..614f25039ad25c49169e796c61ecb09b42ca182c --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_extensions_vertex_dynamic_state.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb3ee10803b4f1d3525be197d7e14041003e39d2165545b1457de9fc54737441 +size 822426 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_16bit_arithmetic.jpg b/images/khronosgroup_vulkan_samples_samples_performance_16bit_arithmetic.jpg new file mode 100644 index 0000000000000000000000000000000000000000..21349cfa90e72540ea326c6d06cd612033abc02f --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_16bit_arithmetic.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c1b381e989ea44ef7b30c7c4ee403d5decaccb69b33a2a7fdd1d21e88ea884a +size 320299 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_16bit_storage_input_output.jpg b/images/khronosgroup_vulkan_samples_samples_performance_16bit_storage_input_output.jpg new file mode 100644 index 0000000000000000000000000000000000000000..522045bdc0913120c79ff12e0ea6e9c1e7a54794 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_16bit_storage_input_output.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea94f890a705ed50c2a84ef61b8509c64fd3dedfac6830c5e6e0ed8735f00e3b +size 503284 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_afbc.jpg b/images/khronosgroup_vulkan_samples_samples_performance_afbc.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ff0bf44041ab03a9a4e8586067de7e1749f6701d --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_afbc.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a91b0883399e2ca5bc252f9f9050ede0efa5f2a7bf5affadf36160f29884cf05 +size 134234 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_async_compute.jpg b/images/khronosgroup_vulkan_samples_samples_performance_async_compute.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b7706a9fc9399a0c7417acc82052e830823b70bc --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_async_compute.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc97a58aefac8f4517793dba1849063fdb46e1af1595410a94766dd513c029a7 +size 2220345 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_command_buffer_usage.jpg b/images/khronosgroup_vulkan_samples_samples_performance_command_buffer_usage.jpg new file mode 100644 index 0000000000000000000000000000000000000000..94492e4728c0d2f05b749d9b39be414807b3b035 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_command_buffer_usage.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4e68e4605bd8f3c4d839567c3e76c0810d9eda51339cfc48e7d4c499587d1b0 +size 103146 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_constant_data.png b/images/khronosgroup_vulkan_samples_samples_performance_constant_data.png new file mode 100644 index 0000000000000000000000000000000000000000..b2080d0e19d399941c8b79187b42489707db86e2 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_constant_data.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b23ea39bac5564e40165a7d8b513a19caef3a2cec3448c7fdeedefa579bd325b +size 301025 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_descriptor_management.jpg b/images/khronosgroup_vulkan_samples_samples_performance_descriptor_management.jpg new file mode 100644 index 0000000000000000000000000000000000000000..937ac6f90d235ebbc9cc6ca3224cf7248df015dc --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_descriptor_management.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7226108fc5cd59ac3f69118023e099677096b555b546b96f9b90566896d8a6b0 +size 163953 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_image_compression_control.png b/images/khronosgroup_vulkan_samples_samples_performance_image_compression_control.png new file mode 100644 index 0000000000000000000000000000000000000000..e500519f7704483c27c4e7db4811e04c3456d5c3 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_image_compression_control.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0feb554cf3eaa591e256fae5ce88c5a69de005ba3c88a5640e884fa25cd3d03 +size 30126 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_layout_transitions.jpg b/images/khronosgroup_vulkan_samples_samples_performance_layout_transitions.jpg new file mode 100644 index 0000000000000000000000000000000000000000..13fe73244f68b4d216c1af370c5d63a11cd3ee39 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_layout_transitions.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2445ffc1c00d092177fc848859db6f2d91f1a45c6893648a4971f55f7fb39bee +size 163425 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_msaa.png b/images/khronosgroup_vulkan_samples_samples_performance_msaa.png new file mode 100644 index 0000000000000000000000000000000000000000..ef2ffaffd998ce7575ef6f6804d51f78cc028d4b --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_msaa.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd9db247f234cc972bb65511b9686f1c71c29248a19394c066414ed00d2126a7 +size 487126 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_multithreading_render_passes.png b/images/khronosgroup_vulkan_samples_samples_performance_multithreading_render_passes.png new file mode 100644 index 0000000000000000000000000000000000000000..5585782e3acc23de0d50c06b9bef51466a51da2b --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_multithreading_render_passes.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d396c059be6fa2a6435b06b429b34392baa4e9b12ec219738b7957e225e0133a +size 66275 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_pipeline_barriers.png b/images/khronosgroup_vulkan_samples_samples_performance_pipeline_barriers.png new file mode 100644 index 0000000000000000000000000000000000000000..6dbaf81759748771fcb1b863b18f76424763cb1b --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_pipeline_barriers.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0df3c75e098e7a3a231319eb391da7e315389e190397dde7a95cde3fa8c05010 +size 19111 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_pipeline_cache.png b/images/khronosgroup_vulkan_samples_samples_performance_pipeline_cache.png new file mode 100644 index 0000000000000000000000000000000000000000..6f7a11077651051377ffea71b3c1ed08d7687fb1 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_pipeline_cache.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fbc0c3adcddd9ffad5d34d6b9061b865d4e30d49c3a63bff84c33101dfdb43a +size 38638 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_render_passes.jpg b/images/khronosgroup_vulkan_samples_samples_performance_render_passes.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cec75de09f03d33f1742bd3df442e2fd72cf0afa --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_render_passes.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95017f291e21cd67344c97b74eb266db4b4f4c3134e65730686f82c86b3b7eb5 +size 94693 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_specialization_constants.png b/images/khronosgroup_vulkan_samples_samples_performance_specialization_constants.png new file mode 100644 index 0000000000000000000000000000000000000000..23671c228836b3b617caeb0bb02dcae69c61f8fd --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_specialization_constants.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e896fcf83cebbf0f1ab2b30be87fac964541844bde5597981454a8a7e8ebb4e +size 11056 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_subpasses.jpg b/images/khronosgroup_vulkan_samples_samples_performance_subpasses.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3ea35e6c9408242cd79e0349531fb0e9c715fb06 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_subpasses.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb921ec45caceffa0c5e95d2dad621d2058f51b5a1f3dda8c98bab4f23dc923a +size 160222 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_surface_rotation.jpg b/images/khronosgroup_vulkan_samples_samples_performance_surface_rotation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8c61d10e3413dfd548c0c45cb76a30a00e32e1dd --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_surface_rotation.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da6a0b0140477615a8154755f3f4ea3b46dedcdc31e7d7570260970f4d2bd44e +size 189513 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_swapchain_images.jpg b/images/khronosgroup_vulkan_samples_samples_performance_swapchain_images.jpg new file mode 100644 index 0000000000000000000000000000000000000000..efb99f2810c4c2f4ace811199b2356eddf572994 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_swapchain_images.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be5e77fb4ef84635590b4b4d699f1248fd351fc253d51af2f4c3ba3ffc33e8ea +size 141264 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_texture_compression_basisu.png b/images/khronosgroup_vulkan_samples_samples_performance_texture_compression_basisu.png new file mode 100644 index 0000000000000000000000000000000000000000..5ab979c758c97e6a25a288bdd62acb05c7e87cf5 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_texture_compression_basisu.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99443ee2a4ce5b7e157ab8645241c74bc6165ac25f82f47fd049dc075f49f95d +size 197382 diff --git a/images/khronosgroup_vulkan_samples_samples_performance_wait_idle.png b/images/khronosgroup_vulkan_samples_samples_performance_wait_idle.png new file mode 100644 index 0000000000000000000000000000000000000000..8fc2ab82402a21249d41c08a6468207c3c76fec9 --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_performance_wait_idle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4c89d19c5230004f80746c8dd2c1eb4dac2b6919301698b39e24a498ae108b9 +size 13638 diff --git a/images/khronosgroup_vulkan_samples_samples_tooling_profiles.png b/images/khronosgroup_vulkan_samples_samples_tooling_profiles.png new file mode 100644 index 0000000000000000000000000000000000000000..e99b34d7ac08d53ec9d67b83b095765985d34dbf --- /dev/null +++ b/images/khronosgroup_vulkan_samples_samples_tooling_profiles.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:955f4b73dc6f44475167754da06a2b03efbd7824f9ddff38620a0c28bfced52f +size 34460 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_0.png b/images/khronosgroup_webgl_conformance_suites_1_0_0.png new file mode 100644 index 0000000000000000000000000000000000000000..81acac37a389552d591c4150404d5af5b7aaa955 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8582d947c0243d5e967801b65fed37eab9ae5e939fd028fe58f60af042923e17 +size 2806 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_0_conformance.png b/images/khronosgroup_webgl_conformance_suites_1_0_0_conformance.png new file mode 100644 index 0000000000000000000000000000000000000000..81acac37a389552d591c4150404d5af5b7aaa955 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_0_conformance.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8582d947c0243d5e967801b65fed37eab9ae5e939fd028fe58f60af042923e17 +size 2806 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_0_conformance_resources.png b/images/khronosgroup_webgl_conformance_suites_1_0_0_conformance_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..81acac37a389552d591c4150404d5af5b7aaa955 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_0_conformance_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8582d947c0243d5e967801b65fed37eab9ae5e939fd028fe58f60af042923e17 +size 2806 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_0_extra.png b/images/khronosgroup_webgl_conformance_suites_1_0_0_extra.png new file mode 100644 index 0000000000000000000000000000000000000000..61b03df232b3519b81fb60ad5e22e2472c375c69 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_0_extra.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:271784dd8689e69df465c83afbd59468071c62f323846b0a26c78715ff241a63 +size 3032 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_1.png b/images/khronosgroup_webgl_conformance_suites_1_0_1.png new file mode 100644 index 0000000000000000000000000000000000000000..81acac37a389552d591c4150404d5af5b7aaa955 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8582d947c0243d5e967801b65fed37eab9ae5e939fd028fe58f60af042923e17 +size 2806 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_1_conformance_resources.png b/images/khronosgroup_webgl_conformance_suites_1_0_1_conformance_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..81acac37a389552d591c4150404d5af5b7aaa955 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_1_conformance_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8582d947c0243d5e967801b65fed37eab9ae5e939fd028fe58f60af042923e17 +size 2806 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_1_extra.png b/images/khronosgroup_webgl_conformance_suites_1_0_1_extra.png new file mode 100644 index 0000000000000000000000000000000000000000..61b03df232b3519b81fb60ad5e22e2472c375c69 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_1_extra.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:271784dd8689e69df465c83afbd59468071c62f323846b0a26c78715ff241a63 +size 3032 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_1_resources.png b/images/khronosgroup_webgl_conformance_suites_1_0_1_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..114f540b085f8ae85c610c98933ed12812b78a4a --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_1_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b05138f73da39135d32e3369aa60935f63bc919c839644c62e4fd7eb07cea17 +size 11020 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_2.png b/images/khronosgroup_webgl_conformance_suites_1_0_2.png new file mode 100644 index 0000000000000000000000000000000000000000..81acac37a389552d591c4150404d5af5b7aaa955 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8582d947c0243d5e967801b65fed37eab9ae5e939fd028fe58f60af042923e17 +size 2806 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_2_conformance_resources.png b/images/khronosgroup_webgl_conformance_suites_1_0_2_conformance_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..81acac37a389552d591c4150404d5af5b7aaa955 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_2_conformance_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8582d947c0243d5e967801b65fed37eab9ae5e939fd028fe58f60af042923e17 +size 2806 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_2_extra.png b/images/khronosgroup_webgl_conformance_suites_1_0_2_extra.png new file mode 100644 index 0000000000000000000000000000000000000000..61b03df232b3519b81fb60ad5e22e2472c375c69 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_2_extra.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:271784dd8689e69df465c83afbd59468071c62f323846b0a26c78715ff241a63 +size 3032 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_2_resources.png b/images/khronosgroup_webgl_conformance_suites_1_0_2_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..114f540b085f8ae85c610c98933ed12812b78a4a --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_2_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b05138f73da39135d32e3369aa60935f63bc919c839644c62e4fd7eb07cea17 +size 11020 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_3.jpg b/images/khronosgroup_webgl_conformance_suites_1_0_3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d41705b96a90206b51d9a69c2ca14d94741055fb --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_3.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6bb2551ac0fb7ac79246b2998eec8465076953e6b6da710868f488686267e4a +size 16799 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_3_conformance_resources.jpg b/images/khronosgroup_webgl_conformance_suites_1_0_3_conformance_resources.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d41705b96a90206b51d9a69c2ca14d94741055fb --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_3_conformance_resources.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6bb2551ac0fb7ac79246b2998eec8465076953e6b6da710868f488686267e4a +size 16799 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_3_extra.png b/images/khronosgroup_webgl_conformance_suites_1_0_3_extra.png new file mode 100644 index 0000000000000000000000000000000000000000..61b03df232b3519b81fb60ad5e22e2472c375c69 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_3_extra.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:271784dd8689e69df465c83afbd59468071c62f323846b0a26c78715ff241a63 +size 3032 diff --git a/images/khronosgroup_webgl_conformance_suites_1_0_3_resources.png b/images/khronosgroup_webgl_conformance_suites_1_0_3_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..fc95bc0363f315d2f125f5413b0a27c5463a25ed --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_1_0_3_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f93a5837510f9241c4fa8c9eae3e5b3fae4dd275991bb99dff1c6b071a9ca730 +size 9077 diff --git a/images/khronosgroup_webgl_conformance_suites_2_0_0.png b/images/khronosgroup_webgl_conformance_suites_2_0_0.png new file mode 100644 index 0000000000000000000000000000000000000000..61b03df232b3519b81fb60ad5e22e2472c375c69 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_2_0_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:271784dd8689e69df465c83afbd59468071c62f323846b0a26c78715ff241a63 +size 3032 diff --git a/images/khronosgroup_webgl_conformance_suites_2_0_0_extra.png b/images/khronosgroup_webgl_conformance_suites_2_0_0_extra.png new file mode 100644 index 0000000000000000000000000000000000000000..61b03df232b3519b81fb60ad5e22e2472c375c69 --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_2_0_0_extra.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:271784dd8689e69df465c83afbd59468071c62f323846b0a26c78715ff241a63 +size 3032 diff --git a/images/khronosgroup_webgl_conformance_suites_2_0_0_resources.jpg b/images/khronosgroup_webgl_conformance_suites_2_0_0_resources.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d41705b96a90206b51d9a69c2ca14d94741055fb --- /dev/null +++ b/images/khronosgroup_webgl_conformance_suites_2_0_0_resources.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6bb2551ac0fb7ac79246b2998eec8465076953e6b6da710868f488686267e4a +size 16799 diff --git a/images/khronosgroup_webgl_other_get_webgl_org.jpg b/images/khronosgroup_webgl_other_get_webgl_org.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d2faf9086826a925ee256a6fc768b35e0924ea2a --- /dev/null +++ b/images/khronosgroup_webgl_other_get_webgl_org.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ac1eadfe55e82a627775d4f522f69deb7c2e8689a8fbcaa81881701079c074e +size 985 diff --git a/images/khronosgroup_webgl_sdk_demos_google_high_dpi.jpg b/images/khronosgroup_webgl_sdk_demos_google_high_dpi.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6a8c29a7f93ea85fe6051f3e208c55b30d1d21da --- /dev/null +++ b/images/khronosgroup_webgl_sdk_demos_google_high_dpi.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b2d70f46b8f8d83ab75d9a7b4fa49fba6a99a8f40f007f1b6484b46d27f598f +size 3130 diff --git a/images/khronosgroup_webgl_sdk_demos_google_image_texture_test.jpg b/images/khronosgroup_webgl_sdk_demos_google_image_texture_test.jpg new file mode 100644 index 0000000000000000000000000000000000000000..229d65c87d9929ab6c12bd4162393ef73223aaf4 --- /dev/null +++ b/images/khronosgroup_webgl_sdk_demos_google_image_texture_test.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4c359e56c954646cd8433d235cca5b10fc191f33e960e67ddcd74a9c31ccfed +size 17635 diff --git a/images/khronosgroup_webgl_sdk_demos_google_particles.png b/images/khronosgroup_webgl_sdk_demos_google_particles.png new file mode 100644 index 0000000000000000000000000000000000000000..f49dcb0cb6bbd18118f29e53b58352d021b7edef --- /dev/null +++ b/images/khronosgroup_webgl_sdk_demos_google_particles.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbb4dcb177ac718c5d21e5130ce9a2e14998223e72babc0b7f5e9cb0acd237a2 +size 10050 diff --git a/images/khronosgroup_webgl_sdk_demos_google_shiny_teapot.jpg b/images/khronosgroup_webgl_sdk_demos_google_shiny_teapot.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6a8c29a7f93ea85fe6051f3e208c55b30d1d21da --- /dev/null +++ b/images/khronosgroup_webgl_sdk_demos_google_shiny_teapot.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b2d70f46b8f8d83ab75d9a7b4fa49fba6a99a8f40f007f1b6484b46d27f598f +size 3130 diff --git a/images/khronosgroup_webgl_sdk_demos_mozilla_spore.png b/images/khronosgroup_webgl_sdk_demos_mozilla_spore.png new file mode 100644 index 0000000000000000000000000000000000000000..a7937885c24b68acfc090b88b08d4d67430faf3b --- /dev/null +++ b/images/khronosgroup_webgl_sdk_demos_mozilla_spore.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:894cb1845219dc807c692708cd3f3581c39b3501a166799c39e28531b6f6ba82 +size 242516 diff --git a/images/khronosgroup_webgl_sdk_demos_webkit.jpg b/images/khronosgroup_webgl_sdk_demos_webkit.jpg new file mode 100644 index 0000000000000000000000000000000000000000..718740c9cd7320ded513302ff346424c59f3b541 --- /dev/null +++ b/images/khronosgroup_webgl_sdk_demos_webkit.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b20f80f72b246134b2d5591dbf7d944e9e7ed0517490b8258cc7d79593aee343 +size 680481 diff --git a/images/khronosgroup_webgl_sdk_demos_webkit_resources.jpg b/images/khronosgroup_webgl_sdk_demos_webkit_resources.jpg new file mode 100644 index 0000000000000000000000000000000000000000..718740c9cd7320ded513302ff346424c59f3b541 --- /dev/null +++ b/images/khronosgroup_webgl_sdk_demos_webkit_resources.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b20f80f72b246134b2d5591dbf7d944e9e7ed0517490b8258cc7d79593aee343 +size 680481 diff --git a/images/khronosgroup_webgl_sdk_tests.png b/images/khronosgroup_webgl_sdk_tests.png new file mode 100644 index 0000000000000000000000000000000000000000..61b03df232b3519b81fb60ad5e22e2472c375c69 --- /dev/null +++ b/images/khronosgroup_webgl_sdk_tests.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:271784dd8689e69df465c83afbd59468071c62f323846b0a26c78715ff241a63 +size 3032 diff --git a/images/khronosgroup_webgl_sdk_tests_extra.png b/images/khronosgroup_webgl_sdk_tests_extra.png new file mode 100644 index 0000000000000000000000000000000000000000..61b03df232b3519b81fb60ad5e22e2472c375c69 --- /dev/null +++ b/images/khronosgroup_webgl_sdk_tests_extra.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:271784dd8689e69df465c83afbd59468071c62f323846b0a26c78715ff241a63 +size 3032 diff --git a/images/khronosgroup_webgl_sdk_tests_resources.jpg b/images/khronosgroup_webgl_sdk_tests_resources.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d41705b96a90206b51d9a69c2ca14d94741055fb --- /dev/null +++ b/images/khronosgroup_webgl_sdk_tests_resources.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6bb2551ac0fb7ac79246b2998eec8465076953e6b6da710868f488686267e4a +size 16799 diff --git a/images/khronosgroup_webgl_specs_2_0_0.png b/images/khronosgroup_webgl_specs_2_0_0.png new file mode 100644 index 0000000000000000000000000000000000000000..87ffcf5c6cdd59151a0bc710ba60d455c15778fc --- /dev/null +++ b/images/khronosgroup_webgl_specs_2_0_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f99666406fae2d27be1441750eece5afbcba51eea75815aa90a1f38f2e4ccba6 +size 192 diff --git a/images/khronosgroup_webgl_specs_latest.png b/images/khronosgroup_webgl_specs_latest.png new file mode 100644 index 0000000000000000000000000000000000000000..87ffcf5c6cdd59151a0bc710ba60d455c15778fc --- /dev/null +++ b/images/khronosgroup_webgl_specs_latest.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f99666406fae2d27be1441750eece5afbcba51eea75815aa90a1f38f2e4ccba6 +size 192 diff --git a/images/khronosgroup_webgl_specs_latest_2_0.png b/images/khronosgroup_webgl_specs_latest_2_0.png new file mode 100644 index 0000000000000000000000000000000000000000..87ffcf5c6cdd59151a0bc710ba60d455c15778fc --- /dev/null +++ b/images/khronosgroup_webgl_specs_latest_2_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f99666406fae2d27be1441750eece5afbcba51eea75815aa90a1f38f2e4ccba6 +size 192 diff --git a/images/mdn_dom_examples_canvas_chroma_keying.png b/images/mdn_dom_examples_canvas_chroma_keying.png new file mode 100644 index 0000000000000000000000000000000000000000..8ff3dea6cf7881955cb914f3591e7eb79a71b52d --- /dev/null +++ b/images/mdn_dom_examples_canvas_chroma_keying.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:885af53dfd66857efc4e72ca0cbae81ee948fc07641186bad6fc8ab10e3e45cd +size 510902 diff --git a/images/mdn_dom_examples_canvas_pixel_manipulation.jpg b/images/mdn_dom_examples_canvas_pixel_manipulation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..afce1b9213abfaf93ff72991706b52af327739bd --- /dev/null +++ b/images/mdn_dom_examples_canvas_pixel_manipulation.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbf374e9c6fc4cb90df245e1b6283f314c11ab966c1a62b607dc0c2d969ff474 +size 31802 diff --git a/images/mdn_dom_examples_fetch_basic_fetch.jpg b/images/mdn_dom_examples_fetch_basic_fetch.jpg new file mode 100644 index 0000000000000000000000000000000000000000..580e282ef450745a4e8c1c91d72c1ac81036ff53 --- /dev/null +++ b/images/mdn_dom_examples_fetch_basic_fetch.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0252048feadecb0a6c45ef8e7c1eb3c9c0623a567f14a99f9488ab9c61c9a2c5 +size 60615 diff --git a/images/mdn_dom_examples_fetch_fetch_request.jpg b/images/mdn_dom_examples_fetch_fetch_request.jpg new file mode 100644 index 0000000000000000000000000000000000000000..580e282ef450745a4e8c1c91d72c1ac81036ff53 --- /dev/null +++ b/images/mdn_dom_examples_fetch_fetch_request.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0252048feadecb0a6c45ef8e7c1eb3c9c0623a567f14a99f9488ab9c61c9a2c5 +size 60615 diff --git a/images/mdn_dom_examples_fetch_fetch_request_with_init.jpg b/images/mdn_dom_examples_fetch_fetch_request_with_init.jpg new file mode 100644 index 0000000000000000000000000000000000000000..580e282ef450745a4e8c1c91d72c1ac81036ff53 --- /dev/null +++ b/images/mdn_dom_examples_fetch_fetch_request_with_init.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0252048feadecb0a6c45ef8e7c1eb3c9c0623a567f14a99f9488ab9c61c9a2c5 +size 60615 diff --git a/images/mdn_dom_examples_fetch_fetch_response.jpg b/images/mdn_dom_examples_fetch_fetch_response.jpg new file mode 100644 index 0000000000000000000000000000000000000000..580e282ef450745a4e8c1c91d72c1ac81036ff53 --- /dev/null +++ b/images/mdn_dom_examples_fetch_fetch_response.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0252048feadecb0a6c45ef8e7c1eb3c9c0623a567f14a99f9488ab9c61c9a2c5 +size 60615 diff --git a/images/mdn_dom_examples_fetch_fetch_response_clone.jpg b/images/mdn_dom_examples_fetch_fetch_response_clone.jpg new file mode 100644 index 0000000000000000000000000000000000000000..580e282ef450745a4e8c1c91d72c1ac81036ff53 --- /dev/null +++ b/images/mdn_dom_examples_fetch_fetch_response_clone.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0252048feadecb0a6c45ef8e7c1eb3c9c0623a567f14a99f9488ab9c61c9a2c5 +size 60615 diff --git a/images/mdn_dom_examples_fetch_object_fit_gallery_fetch.jpg b/images/mdn_dom_examples_fetch_object_fit_gallery_fetch.jpg new file mode 100644 index 0000000000000000000000000000000000000000..48402793724a4e236fff1f5a9e958f69c8732ab3 --- /dev/null +++ b/images/mdn_dom_examples_fetch_object_fit_gallery_fetch.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b3a490a7193e572ff4bc8dcbf8e31c56ecf709b578682eb389b72942f6c75d1 +size 19504 diff --git a/images/mdn_dom_examples_interest_invokers_popover_examples.jpg b/images/mdn_dom_examples_interest_invokers_popover_examples.jpg new file mode 100644 index 0000000000000000000000000000000000000000..37d0281ad196a94268a37a3a3d2eb38b4f53e608 --- /dev/null +++ b/images/mdn_dom_examples_interest_invokers_popover_examples.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b62610074b8abe87f97d8307ae8a1fa3ec85ca1d4bc649becdacba02283e259 +size 11114 diff --git a/images/mdn_dom_examples_media_web_dictaphone.png b/images/mdn_dom_examples_media_web_dictaphone.png new file mode 100644 index 0000000000000000000000000000000000000000..c7dbe57241e78c559d6b798599f888e83a07efed --- /dev/null +++ b/images/mdn_dom_examples_media_web_dictaphone.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6338a19126065bf1c376f46ba2bd092da49bb9500d047c40334c557feeacde60 +size 11425 diff --git a/images/mdn_dom_examples_popover_api_blur_background.png b/images/mdn_dom_examples_popover_api_blur_background.png new file mode 100644 index 0000000000000000000000000000000000000000..1757a2c928146811ac983798dd87fc5244b2c920 --- /dev/null +++ b/images/mdn_dom_examples_popover_api_blur_background.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1ec87e7b74134229e7ff7a8bc81cb71e1cd4965ebff7b0f53a043a06c92290a +size 7530 diff --git a/images/mdn_dom_examples_service_worker_simple_service_worker.jpg b/images/mdn_dom_examples_service_worker_simple_service_worker.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4c195ac7b467fdd364e9f9844e0e888eb8cf2b7c --- /dev/null +++ b/images/mdn_dom_examples_service_worker_simple_service_worker.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6655eeed22e4b28cf2a0f518b0de7062cfb12a9a110ffb12367a2ab826d0c1a4 +size 99682 diff --git a/images/mdn_dom_examples_streams_grayscale_png.png b/images/mdn_dom_examples_streams_grayscale_png.png new file mode 100644 index 0000000000000000000000000000000000000000..035dda1f3a73b909ac6cda7c4d1b1ebc92e5b64f --- /dev/null +++ b/images/mdn_dom_examples_streams_grayscale_png.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84edccd581390a4744a985f65078571fb4d099b46c8b896d0cc9abd9fd80b380 +size 19366 diff --git a/images/mdn_dom_examples_streams_png_transform_stream.png b/images/mdn_dom_examples_streams_png_transform_stream.png new file mode 100644 index 0000000000000000000000000000000000000000..526b4ed9ee3e006e41553048356dbeb61b88a912 --- /dev/null +++ b/images/mdn_dom_examples_streams_png_transform_stream.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0370fd977c02a2c083117d448bb87038b05947badd8adc70e06e834f2599253d +size 811068 diff --git a/images/mdn_dom_examples_streams_simple_pump.png b/images/mdn_dom_examples_streams_simple_pump.png new file mode 100644 index 0000000000000000000000000000000000000000..035dda1f3a73b909ac6cda7c4d1b1ebc92e5b64f --- /dev/null +++ b/images/mdn_dom_examples_streams_simple_pump.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84edccd581390a4744a985f65078571fb4d099b46c8b896d0cc9abd9fd80b380 +size 19366 diff --git a/images/mdn_dom_examples_to_do_notifications.png b/images/mdn_dom_examples_to_do_notifications.png new file mode 100644 index 0000000000000000000000000000000000000000..fc8459e1fd3bbe1be24850e89cc619c58238a861 --- /dev/null +++ b/images/mdn_dom_examples_to_do_notifications.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c61ab274c48e99beb048e92a478eb9b842ae74c4d91bf1c514e60a03dc8e6e2 +size 3316 diff --git a/images/mdn_dom_examples_view_transitions_mpa.jpg b/images/mdn_dom_examples_view_transitions_mpa.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cae22f20822906e9975e6f5744a503a0bd0da3cb --- /dev/null +++ b/images/mdn_dom_examples_view_transitions_mpa.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55aa69a96a5a2865c05428ddf7980d41120c37928a52eda41bca0e7650b718d3 +size 260002 diff --git a/images/mdn_dom_examples_view_transitions_spa.jpg b/images/mdn_dom_examples_view_transitions_spa.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c68db4a7cc5e32f8f613d2040b48417a36ca2c14 --- /dev/null +++ b/images/mdn_dom_examples_view_transitions_spa.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad64741d6bae1cd5e320f9a834db8d991856481d733655278ad9e89d40db9cb8 +size 190607 diff --git a/images/mdn_dom_examples_web_speech_api.png b/images/mdn_dom_examples_web_speech_api.png new file mode 100644 index 0000000000000000000000000000000000000000..e90e9994ec8bd05163e2903cbaf16c8b3f04a0c1 --- /dev/null +++ b/images/mdn_dom_examples_web_speech_api.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b57aa1dc185667f812cd731d8a965c7d0f9933766e5855312605d24b88640ee +size 62552 diff --git a/images/mdn_dom_examples_web_speech_api_speak_easy_synthesis.png b/images/mdn_dom_examples_web_speech_api_speak_easy_synthesis.png new file mode 100644 index 0000000000000000000000000000000000000000..e90e9994ec8bd05163e2903cbaf16c8b3f04a0c1 --- /dev/null +++ b/images/mdn_dom_examples_web_speech_api_speak_easy_synthesis.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b57aa1dc185667f812cd731d8a965c7d0f9933766e5855312605d24b88640ee +size 62552 diff --git a/images/mdn_dom_examples_web_speech_api_speech_color_changer.png b/images/mdn_dom_examples_web_speech_api_speech_color_changer.png new file mode 100644 index 0000000000000000000000000000000000000000..2ca9150186fdfc88c07140d27e57890ef0463fa5 --- /dev/null +++ b/images/mdn_dom_examples_web_speech_api_speech_color_changer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:082b60ffb3e97833b25f27acfc9813116fcb99362d9b77290782c3a112240616 +size 2853 diff --git a/images/mdn_dom_examples_web_storage.png b/images/mdn_dom_examples_web_storage.png new file mode 100644 index 0000000000000000000000000000000000000000..cf467ebf09b4d5fbd422d1271a1d467d3114f171 --- /dev/null +++ b/images/mdn_dom_examples_web_storage.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6684813ca6ef60d6e74bf4c9ff0b8477173b5e70e17ac209d9009f03b592765 +size 8077 diff --git a/images/mdn_dom_examples_web_storage_jscolor.gif b/images/mdn_dom_examples_web_storage_jscolor.gif new file mode 100644 index 0000000000000000000000000000000000000000..a22d107b434ddbb1dc6fbe81be01bdf93b825ff6 --- /dev/null +++ b/images/mdn_dom_examples_web_storage_jscolor.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:096eb936bc9301c1c6fa86715eb306bec1b168dc5beb69b53cd4a81b9cb6a1a3 +size 66 diff --git a/images/mdn_dom_examples_webgl_examples_tutorial_sample6.png b/images/mdn_dom_examples_webgl_examples_tutorial_sample6.png new file mode 100644 index 0000000000000000000000000000000000000000..a562afff2b3d7c839845b1c5e920892a9d12464a --- /dev/null +++ b/images/mdn_dom_examples_webgl_examples_tutorial_sample6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04503467a68c63ccbd61b301fd3c23eeee3a26058c79af0defa32b966a993442 +size 95370 diff --git a/images/mdn_dom_examples_webgl_examples_tutorial_sample7.png b/images/mdn_dom_examples_webgl_examples_tutorial_sample7.png new file mode 100644 index 0000000000000000000000000000000000000000..a562afff2b3d7c839845b1c5e920892a9d12464a --- /dev/null +++ b/images/mdn_dom_examples_webgl_examples_tutorial_sample7.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04503467a68c63ccbd61b301fd3c23eeee3a26058c79af0defa32b966a993442 +size 95370 diff --git a/images/mdn_dom_examples_window_management_api.png b/images/mdn_dom_examples_window_management_api.png new file mode 100644 index 0000000000000000000000000000000000000000..d064a3d0f3441de32122578f9379cb684e893677 --- /dev/null +++ b/images/mdn_dom_examples_window_management_api.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcb76b14abb0c8680459884abd23b6757441fe757e76e84caeb109937ed25938 +size 7957 diff --git a/images/mrdoob_three_js_manual_examples.png b/images/mrdoob_three_js_manual_examples.png new file mode 100644 index 0000000000000000000000000000000000000000..8127708796b3bb06a0c63f0bd2e1b39944e275c5 --- /dev/null +++ b/images/mrdoob_three_js_manual_examples.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5ec6bbcfed1d3ce5b43c6aec7dbc0c86c33b8b60a91882fffc468b183040613 +size 79290 diff --git a/images/mrdoob_three_js_manual_examples_resources.png b/images/mrdoob_three_js_manual_examples_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..8127708796b3bb06a0c63f0bd2e1b39944e275c5 --- /dev/null +++ b/images/mrdoob_three_js_manual_examples_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5ec6bbcfed1d3ce5b43c6aec7dbc0c86c33b8b60a91882fffc468b183040613 +size 79290 diff --git a/images/mrdoob_three_js_manual_resources.png b/images/mrdoob_three_js_manual_resources.png new file mode 100644 index 0000000000000000000000000000000000000000..0ee75ad01c1465d845765c7455ee1f91a680597b --- /dev/null +++ b/images/mrdoob_three_js_manual_resources.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68cabc009a28d47307bc3ce6e2cb5856560ac433b72c12f349133be46b0d3e40 +size 148 diff --git a/images/mrdoob_three_js_root.png b/images/mrdoob_three_js_root.png new file mode 100644 index 0000000000000000000000000000000000000000..0f8129b107255c9e65180d4e45c75f66c8139f58 --- /dev/null +++ b/images/mrdoob_three_js_root.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e01c7797a59e90e69da8c4ff4f65a29be9f4cbfc9002a15d3dc96e8d8034826 +size 3159 diff --git a/images/opengl_tutorials_ogl_external_glew_1_13_0_doc.png b/images/opengl_tutorials_ogl_external_glew_1_13_0_doc.png new file mode 100644 index 0000000000000000000000000000000000000000..bb96aff548a5c734c048e29909cd629a89d7497c --- /dev/null +++ b/images/opengl_tutorials_ogl_external_glew_1_13_0_doc.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef0c079c56fcab7fe66b9c38a90f107c1bb686f00e306fdef3abe7bdcd2a28e8 +size 1219 diff --git a/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs.png b/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs.png new file mode 100644 index 0000000000000000000000000000000000000000..2eba412ecca83c30447f1017269d43b2f536aa6b --- /dev/null +++ b/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e7ed0ef70f99bb7f763a48ddd95d5990e103bb145eedfd0a76d19c122374be2 +size 676 diff --git a/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs_html.png b/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs_html.png new file mode 100644 index 0000000000000000000000000000000000000000..2eba412ecca83c30447f1017269d43b2f536aa6b --- /dev/null +++ b/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs_html.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e7ed0ef70f99bb7f763a48ddd95d5990e103bb145eedfd0a76d19c122374be2 +size 676 diff --git a/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs_html_search.png b/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs_html_search.png new file mode 100644 index 0000000000000000000000000000000000000000..2f6e5cac33ea003772ffb8a6d2fc16759ba172cb --- /dev/null +++ b/images/opengl_tutorials_ogl_external_glfw_3_1_2_docs_html_search.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6eb1d3449c4157f13cba9fea540652efca373c12cbec11d43e7e458364e747e +size 273 diff --git a/images/opengl_tutorials_ogl_external_glm_0_9_7_1_doc_api.png b/images/opengl_tutorials_ogl_external_glm_0_9_7_1_doc_api.png new file mode 100644 index 0000000000000000000000000000000000000000..76a5b4aa21c1ae1d01766170c68c18cca7748c92 --- /dev/null +++ b/images/opengl_tutorials_ogl_external_glm_0_9_7_1_doc_api.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78feabe3c5c148145751813bd515c36ae5a63e1453778550ea17a16116afe64d +size 246 diff --git a/images/opengl_tutorials_ogl_external_rpavlik_cmake_modules_fe2273.jpg b/images/opengl_tutorials_ogl_external_rpavlik_cmake_modules_fe2273.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d59914278b013150b2f09a1b6856cb06177d1cb2 --- /dev/null +++ b/images/opengl_tutorials_ogl_external_rpavlik_cmake_modules_fe2273.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0496b15b2f1e935fd6261b7f2d63be7cf4f9c75a37766dc0426c718e4aa2b19d +size 15485 diff --git a/images/opengl_tutorials_ogl_misc05_picking.png b/images/opengl_tutorials_ogl_misc05_picking.png new file mode 100644 index 0000000000000000000000000000000000000000..acb3451226d19626ca6f2e34664673667ab9bb1c --- /dev/null +++ b/images/opengl_tutorials_ogl_misc05_picking.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d13d29dc89c8cf26c8882499268c269b406ceab60b5fa58a79962c0b5348e94 +size 75893 diff --git a/images/opengl_tutorials_ogl_tutorial01_first_window.png b/images/opengl_tutorials_ogl_tutorial01_first_window.png new file mode 100644 index 0000000000000000000000000000000000000000..5fa5864d6f0fefb5b4114d2efb940e31ee5511fd --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial01_first_window.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3be953d46bfa53ef100eecfa4a4c2901c1b97f4652ca6a205a50ece4528c71d0 +size 31360 diff --git a/images/opengl_tutorials_ogl_tutorial02_red_triangle.png b/images/opengl_tutorials_ogl_tutorial02_red_triangle.png new file mode 100644 index 0000000000000000000000000000000000000000..e199397de1d438af6d8d7bbede84d0ce2959c7a5 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial02_red_triangle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56f8e8dee557cb21c5cc6f151219098435f61291b45c5bcf3b05fc4d023e0b13 +size 7215 diff --git a/images/opengl_tutorials_ogl_tutorial03_matrices.png b/images/opengl_tutorials_ogl_tutorial03_matrices.png new file mode 100644 index 0000000000000000000000000000000000000000..d059808fb8d10c300fe91898901cd2d6f0d3bc22 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial03_matrices.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f9e08e1dc2ea7ec0a78fafacff0cf547a78caf12a1e9fbe89efe9257a8aa835 +size 597 diff --git a/images/opengl_tutorials_ogl_tutorial04_colored_cube.png b/images/opengl_tutorials_ogl_tutorial04_colored_cube.png new file mode 100644 index 0000000000000000000000000000000000000000..e384b8fe6edd76cd2486f3a7bedf77f8d4e50470 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial04_colored_cube.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35714360fa70f2fde006efb09066c0c0b724b1846bc0c37108f93d9e607c1278 +size 6485 diff --git a/images/opengl_tutorials_ogl_tutorial05_textured_cube.png b/images/opengl_tutorials_ogl_tutorial05_textured_cube.png new file mode 100644 index 0000000000000000000000000000000000000000..d3835c355c5ab4d3bc9771d89401e6a23f0377e2 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial05_textured_cube.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e939002ae5077950e3907e013679f9d30321b4fba0cc691855552d2bde8c625 +size 72941 diff --git a/images/opengl_tutorials_ogl_tutorial06_keyboard_and_mouse.png b/images/opengl_tutorials_ogl_tutorial06_keyboard_and_mouse.png new file mode 100644 index 0000000000000000000000000000000000000000..a1fefd1a6b68c3ccb09a06986d78542384fd4870 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial06_keyboard_and_mouse.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e8f0e1b0b61a49b6004cb5539c9467ee7783fee6a94a40b6c74b4c3c105f4bb +size 158750 diff --git a/images/opengl_tutorials_ogl_tutorial07_model_loading.png b/images/opengl_tutorials_ogl_tutorial07_model_loading.png new file mode 100644 index 0000000000000000000000000000000000000000..36b2bccdae38e41a92485bef902587851f54a22f --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial07_model_loading.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fe307218ab2739edbf06fd119e359ca61eec0119361bb78831720fd09fdad0e +size 118324 diff --git a/images/opengl_tutorials_ogl_tutorial08_basic_shading.png b/images/opengl_tutorials_ogl_tutorial08_basic_shading.png new file mode 100644 index 0000000000000000000000000000000000000000..c087f465c68d1bce45b2fe086d65003f3e1e05c4 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial08_basic_shading.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27592e77eedb5426fd7e900e8dc410007fac59ec76db417e94dc3c89353b7344 +size 7018 diff --git a/images/opengl_tutorials_ogl_tutorial09_vbo_indexing.png b/images/opengl_tutorials_ogl_tutorial09_vbo_indexing.png new file mode 100644 index 0000000000000000000000000000000000000000..b61ff7fcad50b397f19b5610e1994c7fbdc5bd68 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial09_vbo_indexing.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81ec3812d1f0f0013eff5f890ca4eece558b049fc2d7bce834a313646942ee94 +size 35702 diff --git a/images/opengl_tutorials_ogl_tutorial10_transparency.png b/images/opengl_tutorials_ogl_tutorial10_transparency.png new file mode 100644 index 0000000000000000000000000000000000000000..2d2abb31e03e3632590122efa20a9cabf52bd550 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial10_transparency.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ca7c92580e793d27d1db99982cc7b1fb87971933821d9b62ea008867c2c0ccc +size 88158 diff --git a/images/opengl_tutorials_ogl_tutorial11_2d_fonts.png b/images/opengl_tutorials_ogl_tutorial11_2d_fonts.png new file mode 100644 index 0000000000000000000000000000000000000000..9d3a0a35c3179a225fad0e451c273d1ce007ee4e --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial11_2d_fonts.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f267d3e59800499305a3ec89e50cce2ba054539736c1ef7aac34f8cbfbc66504 +size 104108 diff --git a/images/opengl_tutorials_ogl_tutorial12_extensions.png b/images/opengl_tutorials_ogl_tutorial12_extensions.png new file mode 100644 index 0000000000000000000000000000000000000000..7e649dc552bd57e6ab1aa6a4fd916de32ef1e689 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial12_extensions.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3021e72fd5f7c9a1af2378ada599333a830d288e6c6dd33c223a9970a8bec664 +size 110312 diff --git a/images/opengl_tutorials_ogl_tutorial13_normal_mapping.png b/images/opengl_tutorials_ogl_tutorial13_normal_mapping.png new file mode 100644 index 0000000000000000000000000000000000000000..c57ccd61bed9334d3985fe4d3f44992ced2edd82 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial13_normal_mapping.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cda2ac99802abd49b77ad2b50c8153945e5cd1a5a5a90e17c8dbcb0c7af37211 +size 918 diff --git a/images/opengl_tutorials_ogl_tutorial14_render_to_texture.png b/images/opengl_tutorials_ogl_tutorial14_render_to_texture.png new file mode 100644 index 0000000000000000000000000000000000000000..1520a8821cf7cef1b21ae0e06e341b6ecbb4cdc5 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial14_render_to_texture.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae24662c28cec3b0a762042cb0d0c6cbd9dfc2c6df28417a80ac1b669d8aa3c8 +size 130158 diff --git a/images/opengl_tutorials_ogl_tutorial15_lightmaps.png b/images/opengl_tutorials_ogl_tutorial15_lightmaps.png new file mode 100644 index 0000000000000000000000000000000000000000..9eb3f6bb5689e3fe2716cdb6feced8fb942abe92 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial15_lightmaps.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4124458aeda921bf4e5fa82edcaabdf371a31e79a35799677486db9b6aa175a7 +size 157795 diff --git a/images/opengl_tutorials_ogl_tutorial16_shadowmaps.png b/images/opengl_tutorials_ogl_tutorial16_shadowmaps.png new file mode 100644 index 0000000000000000000000000000000000000000..bb4fdcdc8a33d26610d0d7808cbb12b4cb2f04ff --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial16_shadowmaps.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e9fcd5bb062a7d1f2c02edecfc8c41e0b16173b6723bbc3fb305331fce814c0 +size 56957 diff --git a/images/opengl_tutorials_ogl_tutorial17_rotations.png b/images/opengl_tutorials_ogl_tutorial17_rotations.png new file mode 100644 index 0000000000000000000000000000000000000000..8aade8c09ea7dba258ba6cb2f293fccfee0d0fb3 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial17_rotations.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7a889880eacec8c643946422003527f8caf7e03eca996fd5115ed0404c324d3 +size 250469 diff --git a/images/opengl_tutorials_ogl_tutorial18_billboards_and_particles.gif b/images/opengl_tutorials_ogl_tutorial18_billboards_and_particles.gif new file mode 100644 index 0000000000000000000000000000000000000000..722a70f6a555697abe5bbbd90983e92bfb7eb413 --- /dev/null +++ b/images/opengl_tutorials_ogl_tutorial18_billboards_and_particles.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd0d4ee713ae5fb4d78dc9f00884ffb62034301739a868a17a0c3fc045a8157f +size 370610 diff --git a/images/openglredbook_examples_lib.png b/images/openglredbook_examples_lib.png new file mode 100644 index 0000000000000000000000000000000000000000..2eba412ecca83c30447f1017269d43b2f536aa6b --- /dev/null +++ b/images/openglredbook_examples_lib.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e7ed0ef70f99bb7f763a48ddd95d5990e103bb145eedfd0a76d19c122374be2 +size 676 diff --git a/images/openglredbook_examples_lib_glfw_docs.png b/images/openglredbook_examples_lib_glfw_docs.png new file mode 100644 index 0000000000000000000000000000000000000000..2eba412ecca83c30447f1017269d43b2f536aa6b --- /dev/null +++ b/images/openglredbook_examples_lib_glfw_docs.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e7ed0ef70f99bb7f763a48ddd95d5990e103bb145eedfd0a76d19c122374be2 +size 676 diff --git a/images/openglredbook_examples_lib_glfw_docs_html.png b/images/openglredbook_examples_lib_glfw_docs_html.png new file mode 100644 index 0000000000000000000000000000000000000000..2eba412ecca83c30447f1017269d43b2f536aa6b --- /dev/null +++ b/images/openglredbook_examples_lib_glfw_docs_html.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e7ed0ef70f99bb7f763a48ddd95d5990e103bb145eedfd0a76d19c122374be2 +size 676 diff --git a/images/openglredbook_examples_lib_glfw_docs_html_search.png b/images/openglredbook_examples_lib_glfw_docs_html_search.png new file mode 100644 index 0000000000000000000000000000000000000000..2f6e5cac33ea003772ffb8a6d2fc16759ba172cb --- /dev/null +++ b/images/openglredbook_examples_lib_glfw_docs_html_search.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6eb1d3449c4157f13cba9fea540652efca373c12cbec11d43e7e458364e747e +size 273 diff --git a/images/patriciogonzalezvivo_lygia_examples_root.jpg b/images/patriciogonzalezvivo_lygia_examples_root.jpg new file mode 100644 index 0000000000000000000000000000000000000000..288cd95772ae3fe033117305dd282f4daaefb649 --- /dev/null +++ b/images/patriciogonzalezvivo_lygia_examples_root.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13a629b965462aa7a8c6998545e85594f3fe0b6725c68d8dc91d526a1786cdfd +size 2263244 diff --git a/images/patriciogonzalezvivo_lygia_root.png b/images/patriciogonzalezvivo_lygia_root.png new file mode 100644 index 0000000000000000000000000000000000000000..ae276dae3070730a790232c8cfc03b5bcd411154 --- /dev/null +++ b/images/patriciogonzalezvivo_lygia_root.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c34c76beb7f0deba0795182c71c2e971592922ec9768360271d0feaa7f3e566 +size 15848 diff --git a/images/patriciogonzalezvivo_lygia_test_wesl.png b/images/patriciogonzalezvivo_lygia_test_wesl.png new file mode 100644 index 0000000000000000000000000000000000000000..ae276dae3070730a790232c8cfc03b5bcd411154 --- /dev/null +++ b/images/patriciogonzalezvivo_lygia_test_wesl.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c34c76beb7f0deba0795182c71c2e971592922ec9768360271d0feaa7f3e566 +size 15848 diff --git a/images/patriciogonzalezvivo_thebookofshaders_root.png b/images/patriciogonzalezvivo_thebookofshaders_root.png new file mode 100644 index 0000000000000000000000000000000000000000..86592d72ebda0b439b24608fe596cfe8312f2be9 --- /dev/null +++ b/images/patriciogonzalezvivo_thebookofshaders_root.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0dad7ffa94a4a9f13ae3878e37bff1b965407d4c05345078bd6bda870b2bcf0d +size 154240 diff --git a/images/patriciogonzalezvivo_thebookofshaders_src_moon.jpg b/images/patriciogonzalezvivo_thebookofshaders_src_moon.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ae47f613f4ebccf8af9b1810ab2bfa14dd5ca25c --- /dev/null +++ b/images/patriciogonzalezvivo_thebookofshaders_src_moon.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcfc21aaebbbad4063d1c2f26f2444167df76939d475bb08eb24465a70359054 +size 336854 diff --git a/images/saschawillems_openglcpp_root.png b/images/saschawillems_openglcpp_root.png new file mode 100644 index 0000000000000000000000000000000000000000..88d213664b6859b971e908d107ac085c87b05126 --- /dev/null +++ b/images/saschawillems_openglcpp_root.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aac071db003f67bdc61f3c13445818e48e21ba16424e313833e57541f3dad2c6 +size 114547 diff --git a/images/saschawillems_vulkan_apple_ios.png b/images/saschawillems_vulkan_apple_ios.png new file mode 100644 index 0000000000000000000000000000000000000000..bb063877353c7366af03b9d8c66852d5cbd4f649 --- /dev/null +++ b/images/saschawillems_vulkan_apple_ios.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6327100a5d5ec2df8b1a11aba092c6f32512acfc99ece0c111850ee14c94f0cf +size 48497 diff --git a/images/saschawillems_vulkan_apple_macos.png b/images/saschawillems_vulkan_apple_macos.png new file mode 100644 index 0000000000000000000000000000000000000000..3f01c6854b57e6a7971f4adc16aa46f008df5822 --- /dev/null +++ b/images/saschawillems_vulkan_apple_macos.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:693e5918779099daf92420b346903e9757fbbfb4b3e1e645b6d5409b75837d48 +size 12449 diff --git a/images/saschawillems_vulkan_examples_vertexattributes.png b/images/saschawillems_vulkan_examples_vertexattributes.png new file mode 100644 index 0000000000000000000000000000000000000000..0f1480f6170924051ff0ca1f5950392fd5117665 --- /dev/null +++ b/images/saschawillems_vulkan_examples_vertexattributes.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:969e635cf8b72db9969a0b97ae8978dcad697b8282985ec7294e3f4c539ccb09 +size 9565 diff --git a/images/tsherif_webgl2examples_root.png b/images/tsherif_webgl2examples_root.png new file mode 100644 index 0000000000000000000000000000000000000000..10d560e9905eef25bd665a8676139887050d919e --- /dev/null +++ b/images/tsherif_webgl2examples_root.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7d9cfba52f9035384ec82790122457014e68409097c6aee23e236af7f1d0557 +size 31640 diff --git a/images/vanruesc_postprocessing_demo_static.jpg b/images/vanruesc_postprocessing_demo_static.jpg new file mode 100644 index 0000000000000000000000000000000000000000..de5758090ab8ab0aaa374110aa08df6c7f53d599 --- /dev/null +++ b/images/vanruesc_postprocessing_demo_static.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:728dd0fe3b570103e51dbfcc1eac64ad09916a7a31603c62a4090a2f2afaa6f8 +size 876227 diff --git a/images/vanruesc_postprocessing_root.jpg b/images/vanruesc_postprocessing_root.jpg new file mode 100644 index 0000000000000000000000000000000000000000..de5758090ab8ab0aaa374110aa08df6c7f53d599 --- /dev/null +++ b/images/vanruesc_postprocessing_root.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:728dd0fe3b570103e51dbfcc1eac64ad09916a7a31603c62a4090a2f2afaa6f8 +size 876227 diff --git a/images/vanruesc_postprocessing_src.png b/images/vanruesc_postprocessing_src.png new file mode 100644 index 0000000000000000000000000000000000000000..075bb239c035be2a3dbcd304de7a7f6b89e14d7d --- /dev/null +++ b/images/vanruesc_postprocessing_src.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61765e87819b91a77d8939f1c479c67917eeb0f8cc5bcd17d21684d53dadff4a +size 50067 diff --git a/images/vanruesc_postprocessing_src_textures.png b/images/vanruesc_postprocessing_src_textures.png new file mode 100644 index 0000000000000000000000000000000000000000..075bb239c035be2a3dbcd304de7a7f6b89e14d7d --- /dev/null +++ b/images/vanruesc_postprocessing_src_textures.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61765e87819b91a77d8939f1c479c67917eeb0f8cc5bcd17d21684d53dadff4a +size 50067 diff --git a/images/vanruesc_postprocessing_src_textures_smaa.png b/images/vanruesc_postprocessing_src_textures_smaa.png new file mode 100644 index 0000000000000000000000000000000000000000..075bb239c035be2a3dbcd304de7a7f6b89e14d7d --- /dev/null +++ b/images/vanruesc_postprocessing_src_textures_smaa.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61765e87819b91a77d8939f1c479c67917eeb0f8cc5bcd17d21684d53dadff4a +size 50067 diff --git a/sample.jsonl b/sample.jsonl index 29aa06729a4bace0cc3c08498a4fd55cbd261cdc..d4c2d6901a8044f2f5e5e6f63e575197c63ad909 100644 --- a/sample.jsonl +++ b/sample.jsonl @@ -1,13 +1,100 @@ -{"id": "ssgl_impl", "source": "https://github.com/local/ssgl", "source_commit": "4d3f2977620be74782a6523fc950e98c0b7f69bb", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Impl", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "compute/texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "impl/gl_helpers.cpp", "language": "cpp", "loc": 86, "comment_density": 0.023, "code": "\n#ifdef _WIN32\n#include \n\n#include \"gl_helpers.h\"\n\n#include \n#pragma comment(lib, \"gdiplus.lib\")\n#include \n#include \n\nTexture loadImage(const wchar_t* path) {\n\tusing namespace Gdiplus;\n\tULONG_PTR token;\n\tGdiplusStartupInput startupInput;\n\tGdiplusStartup(&token, &startupInput, nullptr);\n\n\tTexture result;\n\t// new scope so RAII objects are released before gdi+ shutdown\n\t{\n\t\tImage image(path);\n\t\timage.RotateFlip(RotateNoneFlipY);\n\t\tconst Rect r(0, 0, image.GetWidth(), image.GetHeight());\n\t\tBitmapData data;\n\t\t((Bitmap*)&image)->LockBits(&r, ImageLockModeRead, PixelFormat32bppARGB, &data);\n\n\t\tglBindTexture(GL_TEXTURE_2D, result);\n\t\tglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.GetWidth(), image.GetHeight(), 0, GL_BGRA, GL_UNSIGNED_BYTE, data.Scan0);\n\t\tglGenerateMipmap(GL_TEXTURE_2D);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\t\t((Bitmap*)&image)->UnlockBits(&data);\n\t}\n\tGdiplusShutdown(token);\n\treturn result;\n}\n\nTexture loadImage(const char* path) {\n\twchar_t str[1024];\n\tMultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, path, -1, str, 1024);\n\treturn loadImage(str);\n}\n#else\n\n#include \n#include \n#include \n#include \n#include \n#include \"gl_helpers.h\"\n\nTexture loadImage(const wchar_t* path) {}\nTexture loadImage(const char* path) {\n unsigned char header[8];\n\n FILE* fp = fopen(path, \"rb\");\n fread(header, 1, 8, fp);\n assert(!png_sig_cmp(header, 0, 8));\n\n png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);\n\n png_infop info = png_create_info_struct(png);\n\n setjmp(png_jmpbuf(png));\n \n\tpng_init_io(png, fp);\n png_set_sig_bytes(png, 8);\n\n png_read_info(png, info);\n\n int width = png_get_image_width(png, info);\n int height = png_get_image_height(png, info);\n png_byte color_type = png_get_color_type(png, info);\n png_byte bit_depth = png_get_bit_depth(png, info);\n\tassert(bit_depth == 8); // let's just support this\n\n int number_of_passes = png_set_interlace_handling(png);\n png_read_update_info(png, info);\n\n\n\tsetjmp(png_jmpbuf(png));\n\n png_bytep* row_pointers = (png_bytep*)malloc(sizeof(png_bytep) * height);\n\tsize_t stride = png_get_rowbytes(png, info);\n for (int i = 0; i < height; i++)\n row_pointers[i] = (png_byte*)malloc(stride);\n\n png_read_image(png, row_pointers);\n\n\tunsigned char* contiguous = (unsigned char*)malloc(stride * height);\n\n\tfor (int i = 0; i < height; i++)\n\t\tmemcpy(contiguous + stride * (height-1-i), row_pointers[i], stride);\n\n\tGLenum format = GL_INVALID_ENUM, order;\n\tif (PNG_COLOR_TYPE_GRAY == color_type) { format = GL_R8; order = GL_RED; }\n\tif (PNG_COLOR_TYPE_RGB == color_type) { format = GL_RGB8; order = GL_RGB; }\n\tif (PNG_COLOR_TYPE_RGB_ALPHA == color_type) { format = GL_RGBA8; order = GL_RGBA; }\n\tassert(format != GL_INVALID_ENUM);\n\n\tTexture result;\n\tglBindTexture(GL_TEXTURE_2D, result);\n\tglTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, order, GL_UNSIGNED_BYTE, contiguous);\n\tglGenerateMipmap(GL_TEXTURE_2D);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\tfree(row_pointers);\n fclose(fp);\n\n\treturn result;\n}\n#endif\n\n"}, {"path": "impl/gl_helpers.h", "language": "c", "loc": 134, "comment_density": 0.007, "code": "#pragma once\n\n#define GL_GLEXT_LEGACY\n#include \n#undef GL_VERSION_1_3\n#include \"glext.h\"\n\n#include \"loadgl46.h\"\n\n#include \n// RAII lifetime handlers for GLuint-based buffers and textures; in principle, very close to unique pointers (with GLuint playing the role of a raw pointer).\n\nstruct Buffer {\npublic:\n\tvoid destroy() { if (object != 0 && owning) { glDeleteBuffers(1, &object); object = 0; } }\n\tBuffer() : owning(true) { glCreateBuffers(1, &object); }\n\tBuffer(size_t size, void* data = nullptr, bool immutable = false, GLenum usage_or_flags = GL_STATIC_DRAW) : owning(true) {\n\t\tglCreateBuffers(1, &object);\n\t\tif(immutable)\n\t\t\tglNamedBufferStorage(object, size, data, usage_or_flags);\n\t\telse\n\t\t\tglNamedBufferData(object, size, data, usage_or_flags);\n\t}\n\ttemplate\n\tBuffer(const std::vector& v, bool immutable = false, GLenum usage_or_flags = GL_STATIC_DRAW) : owning(true) {\n\t\tglCreateBuffers(1, &object);\n\t\tif(immutable)\n\t\t\tglNamedBufferStorage(object, v.size()*sizeof(T), v.data(), usage_or_flags);\n\t\telse\n\t\t\tglNamedBufferData(object, v.size()*sizeof(T), v.data(), usage_or_flags);\n\t}\n\ttemplate\n\toperator std::vector() const {\n\t\tGLint64 size;\n\t\tglGetNamedBufferParameteri64v(object, GL_BUFFER_SIZE, &size);\n\t\tif (size % sizeof(T)) printf(\"warning: buffer and vector types don't align\");\n\t\tstd::vector result(size/sizeof(T));\n\t\tglGetNamedBufferSubData(object, 0, result.size()*sizeof(T), result.data());\n\t\treturn result;\n\t}\n\t~Buffer() { destroy(); }\n\tBuffer(const Buffer& other) : object(other.object), owning(false) { }\n\tBuffer(GLuint object, bool owning = false) : object(object), owning(owning) { }\n\tBuffer(Buffer&& other) : object(other.object), owning(other.owning) { other.owning = false; }\n\tauto& operator=(const Buffer& other) { object = other.object; owning = false; return *this; }\n\tauto& operator=(Buffer&& other) { object = other.object; owning = other.owning; other.owning = false; return *this; }\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\nprivate:\n\tGLuint object = 0; bool owning;\n};\n\ntemplate struct Texture;\n\ntemplate<>\nstruct Texture {\npublic:\n\tvoid destroy() {\n\t\tif (handle != 0) glMakeTextureHandleNonResident(handle);\n\t\tif (object && owning) { glDeleteTextures(1, &object); object = 0; }\n\t}\n\tTexture() : object(0), target(GL_INVALID_INDEX) {}\n\tTexture(GLuint target, bool owning = false) : target(target), owning(owning) { glCreateTextures(target, 1, &object); }\n\t~Texture() { if (object != 0 && owning) destroy(); }\n\ttemplate\n\tTexture(const Texture& other) : object(other.object), level(other.level), layer(other.layer), target(other.target), owning(false) { }\n\tTexture(GLuint object, GLuint target, bool owning = false) : object(object), target(target), owning(owning) { }\n\ttemplate\n\tTexture(Texture&& other) : object(other.object), level(other.level), layer(other.layer), target(other.target), owning(other.owning) { other.owning = false; }\n\ttemplate\n\tauto& operator=(const Texture& other) {\n\t\tdestroy();\n\t\tobject = other.object; level = other.level; layer = other.layer; target = other.target;\n\t\towning = false;\n\t\treturn *this;\n\t}\n\ttemplate\n\tauto& operator=(Texture&& other) {\n\t\tdestroy();\n\t\tobject = other.object; level = other.level; layer = other.layer; target = other.target;\n\t\towning = other.owning;\n\t\tother.owning = false;\n\t\treturn *this;\n\t}\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\n\tGLuint level = 0, layer = GL_INVALID_INDEX, target;\n\tGLuint64 getBindless() {\n\t\tif (handle == 0) {\n\t\t\thandle = glGetTextureHandle(object);\n\t\t\tglMakeTextureHandleResident(handle);\n\t\t}\n\t\treturn handle;\n\t}\nprivate:\n\tGLuint object; bool owning; GLuint64 handle = 0;\n};\n\ntemplate\nstruct Texture {\npublic:\n\tvoid destroy() {\n\t\tif (handle != 0) glMakeTextureHandleNonResident(handle);\n\t\tif (object && owning) { glDeleteTextures(1, &object); object = 0; }\n\t}\n\tTexture() : owning(true) { glCreateTextures(T, 1, &object); }\n\t~Texture() { destroy(); }\n\tTexture(GLuint other, bool owning = false) : object(other), owning(owning) {}\n\tTexture(const Texture& other) : object(other.object), owning(false) { }\n\tTexture(Texture&& other) : object(other.object), owning(other.owning) { other.owning = false; }\n\tTexture& operator=(const Texture& other) { destroy(); object = other.object; owning = false; return *this; }\n\tTexture& operator=(Texture&& other) { destroy(); object = other.object; owning = other.owning; other.owning = false; return *this; }\n\toperator GLuint() const { return object; }\n\toperator bool() const { return object != 0; }\n\tstatic constexpr GLuint level = 0, layer = GL_INVALID_INDEX;\n\tfriend Texture<>;\n\tstatic constexpr GLuint target = T;\n\tGLuint64 getBindless() {\n\t\tif (handle == 0) {\n\t\t\thandle = glGetTextureHandle(object);\n\t\t\tglMakeTextureHandleResident(handle);\n\t\t}\n\t\treturn handle;\n\t}\nprivate:\n\tGLuint object = 0; bool owning; GLuint64 handle = 0;\n};\n\ntemplate\nTexture<> Level(const Texture& t, int level) {\n\tTexture<> result(t);\n\tresult.level = level;\n\treturn result;\n}\n\ntemplate\nTexture<> Layer(const Texture& t, int layer) {\n\tTexture<> result(t);\n\tresult.layer = layer;\n\treturn result;\n}\n\nTexture loadImage(const char* path);\nTexture loadImage(const wchar_t* path);\n"}, {"path": "impl/glsl.h", "language": "c", "loc": 1625, "comment_density": 0.003, "code": "#pragma once\n\nnamespace glsl {\n\n template\n constexpr int maximal(I... i) {\n int max = 0;\n ((max = max < i ? i : max), ...);\n return max;\n }\n\n template struct sequence { using type = sequence; };\n\n template struct append;\n template\n struct append, sequence> :\n sequence {};\n\n template\n struct iota : append::type, typename iota::type> {};\n template<> struct iota<0> : sequence<> {};\n template<> struct iota<1> : sequence<0> {};\n\n template struct Matrix;\n\n template\n auto id_ptr(sequence) {\n if constexpr (R == 1 && C == 1) return (F*) nullptr;\n else return (Matrix*) nullptr;\n }\n\n template struct no_ptr_ { using type = F; };\n template struct no_ptr_ { using type = F; };\n template struct no_ptr_ { using type = const F; };\n template using no_ptr = typename no_ptr_::type;\n\n template\n using identity = no_ptr(iota{})) > ;\n\n template struct no_const_ { using type = F; };\n template struct no_const_ { using type = F; };\n template struct no_const_ { using type = F*; };\n template using no_const = typename no_const_::type;\n\n template constexpr bool is_const = false;\n template constexpr bool is_const = true;\n\n template constexpr int Rows = 1;\n template\n constexpr int Rows> = R;\n\n template constexpr int Columns = 1;\n template\n constexpr int Columns> = C;\n\n template struct Field_ { using type = T; };\n template\n struct Field_> { using type = no_ptr; };\n\n template\n using Field = typename Field_::type;\n\n template\n struct enabler {};\n template<>\n struct enabler { using type = bool; };\n template\n using enable = typename enabler::type;\n\n template\n constexpr bool same = false;\n template\n constexpr bool same = true;\n\n\n template\n constexpr bool broadcastable = ((Rows == maximal(Rows...) && Columns == maximal(Columns...) || Rows == 1 && Columns == 1)&&...);\n template\n constexpr bool matmul_broadcastable = Columns == 1 && Rows == Rows || Columns == Rows || broadcastable;\n\n template\n auto broadcast_type(sequence) {\n constexpr int rows = maximal(Rows...), columns = maximal(Columns...);\n auto sum = (Field{} + ...);\n if constexpr (rows == 1 && columns == 1)\n return sum;\n else\n return Matrix {};\n }\n\n template\n using Iota = iota...)* maximal(Columns...)>;\n template\n using Common = decltype(broadcast_type(Iota{}));\n\n template\n auto matmul_type(sequence) {\n auto sum = Field{} + Field{};\n if constexpr (Columns == 1 && Columns == 1)\n return Matrix, Rows), 1, const decltype(sum), I...> {};\n else if constexpr (Columns == 1)\n return Matrix, 1, const decltype(sum), I...> {};\n else if constexpr (Rows == 1 && Columns == 1) return Second{};\n else if constexpr (Rows == 1 && Columns == 1) return First{};\n else\n return Matrix, Columns, const decltype(sum), I...> {};\n }\n\n template\n constexpr int mult_iota_length() {\n if constexpr (Columns == 1 && Columns == 1) return maximal(Rows, Rows);\n else return ((Columns == 1) ? 1 : Rows) * Columns;\n }\n\n template\n using MultCommon = decltype(matmul_type(iota()>{}));\n\n template\n constexpr int ordering(sequence) {\n return int(((int(I) * (int(1) << int((sizeof...(I) - Id) * 4))) + ... + 0));\n }\n\n template\n struct Container {\n Container() = default;\n no_ptr> data[1 + maximal(I...)];\n };\n\n template\n struct Matrix : Container, I...> {\n\n using Container, I...>::data;\n\n static_assert(sizeof...(I) == R * C);\n //static_assert(R* C > 1);\n\n Matrix() = default;\n\n explicit Matrix(const F& f) {\n if constexpr (C == 1 || is_const) ((data[I] = f), ...);\n else {\n F choice[2] = { F(0), f };\n ((data[I] = choice[I % R == I / R]), ...);\n }\n }\n template 1 && C2 > 1) || (R2==1 && C2==1)> >\n explicit Matrix(const Matrix& other) {\n if constexpr (R2 == 1 && C2 == 1) {\n constexpr int i2[] = { I2... };\n const auto f = F(other.data[i2[0]]);\n if constexpr (C == 1 || is_const) ((data[I] = f), ...);\n else {\n F choice[2] = { F(0), f };\n ((data[I] = choice[I % R == I / R]), ...);\n }\n }\n else if constexpr (R == R2 && C == C2) {\n int i2[] = { I2... };\n ((data[I] = F(other.data[i2[I]])), ...);\n }\n else {\n F choice[2] = { 0, 1 };\n // I%R gives the row and I/R the column\n ((data[I] = (I % R < R2&& I / R < C2) ? F(other.data[((I / R) * R2) + (I % R)]) : choice[I % R == I / R]), ...);\n }\n }\n\n template\n void place(const Matrix& m, int& i) {\n ((data[i++] = F(m.data[I2])), ...);\n }\n template\n void place(const F2& m, int& i) {\n data[i++] = F(m);\n }\n template == 1 && Columns == 1 && ((Columns == 1) && ...) && R * C == ((Rows +Rows) + ... + Rows)>>\n Matrix(const First& first, const Second& second, const Rest&... rest) {\n int i = 0;\n place(first, i); place(second, i); (place(rest, i), ...);\n }\n\n template>>\n operator Matrix() const {\n Matrix result;\n ((result.data[I] = no_ptr(data[I])), ...);\n return result;\n }\n\n template\n auto& operator=(const Matrix other) {\n ((data[I] = F(other.data[I2])), ...);\n return *this;\n }\n auto& operator=(const Matrix& other) {\n ((data[I] = other.data[I]), ...);\n return *this;\n }\n\n static constexpr int inds[] = { I... };\n auto& operator[](int i) {\n if constexpr (C == 1) return data[inds[i]];\n else return *reinterpret_cast*>(data + i * R);\n }\n const auto& operator[](int i) const {\n if constexpr (C == 1) return const_cast(data[inds[i]]);\n else return *reinterpret_cast*const>(data + i * R);\n }\n\n auto& operator+=(const identity& other) {return *this = *this + other;}\n auto& operator-=(const identity& other) {return *this = *this - other;}\n auto& operator/=(const identity& other) {return *this = *this / other;}\n auto& operator+=(const F& other) { return *this = *this + other; }\n auto& operator-=(const F& other) { return *this = *this - other; }\n auto& operator/=(const F& other) { return *this = *this / other; }\n template\n auto& operator*=(const Other& other) { return *this = *this * other; }\n };\n\n template\n struct Matrix {\n\n no_const data[1 + maximal(I...)];\n\n template || same < const decltype(F{} + no_ptr{}), const F > ) && (ordering(iota{}) >= ordering(iota{})) >>\n operator Matrix() const {\n Matrixresult;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n\n template\n auto& operator=(const Matrix other) {\n ((data[I] = F(other.data[I2])), ...);\n return *this;\n }\n auto& operator=(const Matrix& other) {\n ((data[I] = other.data[I]), ...);\n return *this;\n }\n\n auto& operator+=(const identity& other) { return *this = *this + other; }\n auto& operator-=(const identity& other) { return *this = *this - other; }\n auto& operator/=(const identity& other) { return *this = *this / other; }\n auto& operator+=(const F& other) { return *this = *this + other; }\n auto& operator-=(const F& other) { return *this = *this - other; }\n auto& operator/=(const F& other) { return *this = *this / other; }\n template\n auto& operator*=(const Other& other) { return *this = *this * other; }\n };\n\n template\n struct Matrix {\n\n F data[1 + maximal(I...)];\n\n template || same < const decltype(F{} + no_ptr{}), const F > ) && (ordering(iota{}) >= ordering(iota{})) >>\n operator Matrix() const {\n Matrix result;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n template\n operator Matrix, I2...>() const {\n Matrix, I2...> result;\n ((result.data[I2] = no_ptr(data[I])), ...);\n return result;\n }\n };\n\n template\n struct Matrix<1, 1, F*, I> {\n\n no_const data[1 + I];\n auto* operator&() {\n return &data[I];\n }\n auto& operator=(const F& other) {\n data[I] = other;\n return *this;\n }\n operator F& () { return data[I]; }\n operator F() const { return data[I]; }\n };\n\n template\n struct Matrix<1, 1, const F*, I> {\n F data[1 + I];\n operator F() const { return data[I]; }\n };\n\n\n template\n struct Container<2, 1, F, 0, 1> {\n Container() = default;\n union {\n no_ptr> data[2];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n };\n };\n\n template\n struct Container<3, 1, F, 0, 1, 2> {\n Container() = default;\n union {\n no_ptr> data[3];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n Matrix<1, 1, no_ptr*, 2> z, b, p;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 0, 2> xz, rb, sp;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n Matrix<2, 1, no_ptr*, 1, 2> yz, gb, tp;\n Matrix<2, 1, no_ptr*, 2, 0> zx, br, ps;\n Matrix<2, 1, no_ptr*, 2, 1> zy, bg, pt;\n Matrix<2, 1, const no_ptr*, 2, 2> zz, bb, pp;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 0, 2> xxz, rrb, ssp;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, no_ptr*, 0, 1, 2> xyz, rgb, stp;\n Matrix<3, 1, const no_ptr*, 0, 2, 0> xzx, rbr, sps;\n Matrix<3, 1, no_ptr*, 0, 2, 1> xzy, rbg, spt;\n Matrix<3, 1, const no_ptr*, 0, 2, 2> xzz, rbb, spp;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, no_ptr*, 1, 0, 2> yxz, grb, tsp;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n Matrix<3, 1, const no_ptr*, 1, 1, 2> yyz, ggb, ttp;\n Matrix<3, 1, no_ptr*, 1, 2, 0> yzx, gbr, tps;\n Matrix<3, 1, const no_ptr*, 1, 2, 1> yzy, gbg, tpt;\n Matrix<3, 1, const no_ptr*, 1, 2, 2> yzz, gbb, tpp;\n Matrix<3, 1, const no_ptr*, 2, 0, 0> zxx, brr, pss;\n Matrix<3, 1, no_ptr*, 2, 0, 1> zxy, brg, pst;\n Matrix<3, 1, const no_ptr*, 2, 0, 2> zxz, brb, psp;\n Matrix<3, 1, no_ptr*, 2, 1, 0> zyx, bgr, pts;\n Matrix<3, 1, const no_ptr*, 2, 1, 1> zyy, bgg, ptt;\n Matrix<3, 1, const no_ptr*, 2, 1, 2> zyz, bgb, ptp;\n Matrix<3, 1, const no_ptr*, 2, 2, 0> zzx, bbr, pps;\n Matrix<3, 1, const no_ptr*, 2, 2, 1> zzy, bbg, ppt;\n Matrix<3, 1, const no_ptr*, 2, 2, 2> zzz, bbb, ppp;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 2> xxxz, rrrb, sssp;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 2> xxyz, rrgb, sstp;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 0> xxzx, rrbr, ssps;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 1> xxzy, rrbg, sspt;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 2> xxzz, rrbb, sspp;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 2> xyxz, rgrb, stsp;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 2> xyyz, rggb, sttp;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 0> xyzx, rgbr, stps;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 1> xyzy, rgbg, stpt;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 2> xyzz, rgbb, stpp;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 0> xzxx, rbrr, spss;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 1> xzxy, rbrg, spst;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 2> xzxz, rbrb, spsp;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 0> xzyx, rbgr, spts;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 1> xzyy, rbgg, sptt;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 2> xzyz, rbgb, sptp;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 0> xzzx, rbbr, spps;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 1> xzzy, rbbg, sppt;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 2> xzzz, rbbb, sppp;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 2> yxxz, grrb, tssp;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 2> yxyz, grgb, tstp;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 0> yxzx, grbr, tsps;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 1> yxzy, grbg, tspt;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 2> yxzz, grbb, tspp;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 2> yyxz, ggrb, ttsp;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 2> yyyz, gggb, tttp;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 0> yyzx, ggbr, ttps;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 1> yyzy, ggbg, ttpt;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 2> yyzz, ggbb, ttpp;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 0> yzxx, gbrr, tpss;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 1> yzxy, gbrg, tpst;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 2> yzxz, gbrb, tpsp;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 0> yzyx, gbgr, tpts;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 1> yzyy, gbgg, tptt;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 2> yzyz, gbgb, tptp;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 0> yzzx, gbbr, tpps;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 1> yzzy, gbbg, tppt;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 2> yzzz, gbbb, tppp;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 0> zxxx, brrr, psss;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 1> zxxy, brrg, psst;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 2> zxxz, brrb, pssp;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 0> zxyx, brgr, psts;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 1> zxyy, brgg, pstt;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 2> zxyz, brgb, pstp;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 0> zxzx, brbr, psps;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 1> zxzy, brbg, pspt;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 2> zxzz, brbb, pspp;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 0> zyxx, bgrr, ptss;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 1> zyxy, bgrg, ptst;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 2> zyxz, bgrb, ptsp;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 0> zyyx, bggr, ptts;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 1> zyyy, bggg, pttt;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 2> zyyz, bggb, pttp;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 0> zyzx, bgbr, ptps;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 1> zyzy, bgbg, ptpt;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 2> zyzz, bgbb, ptpp;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 0> zzxx, bbrr, ppss;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 1> zzxy, bbrg, ppst;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 2> zzxz, bbrb, ppsp;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 0> zzyx, bbgr, ppts;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 1> zzyy, bbgg, pptt;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 2> zzyz, bbgb, pptp;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 0> zzzx, bbbr, ppps;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 1> zzzy, bbbg, pppt;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 2> zzzz, bbbb, pppp;\n };\n };\n template\n struct Container<4, 1, F, 0, 1, 2, 3> {\n Container() = default;\n union {\n no_ptr> data[4];\n\n Matrix<1, 1, no_ptr*, 0> x, r, s;\n Matrix<1, 1, no_ptr*, 1> y, g, t;\n Matrix<1, 1, no_ptr*, 2> z, b, p;\n Matrix<1, 1, no_ptr*, 3> w, a, q;\n\n Matrix<2, 1, const no_ptr*, 0, 0> xx, rr, ss;\n Matrix<2, 1, no_ptr*, 0, 1> xy, rg, st;\n Matrix<2, 1, no_ptr*, 0, 2> xz, rb, sp;\n Matrix<2, 1, no_ptr*, 0, 3> xw, ra, sq;\n Matrix<2, 1, no_ptr*, 1, 0> yx, gr, ts;\n Matrix<2, 1, const no_ptr*, 1, 1> yy, gg, tt;\n Matrix<2, 1, no_ptr*, 1, 2> yz, gb, tp;\n Matrix<2, 1, no_ptr*, 1, 3> yw, ga, tq;\n Matrix<2, 1, no_ptr*, 2, 0> zx, br, ps;\n Matrix<2, 1, no_ptr*, 2, 1> zy, bg, pt;\n Matrix<2, 1, const no_ptr*, 2, 2> zz, bb, pp;\n Matrix<2, 1, no_ptr*, 2, 3> zw, ba, pq;\n Matrix<2, 1, no_ptr*, 3, 0> wx, ar, qs;\n Matrix<2, 1, no_ptr*, 3, 1> wy, ag, qt;\n Matrix<2, 1, no_ptr*, 3, 2> wz, ab, qp;\n Matrix<2, 1, const no_ptr*, 3, 3> ww, aa, qq;\n\n Matrix<3, 1, const no_ptr*, 0, 0, 0> xxx, rrr, sss;\n Matrix<3, 1, const no_ptr*, 0, 0, 1> xxy, rrg, sst;\n Matrix<3, 1, const no_ptr*, 0, 0, 2> xxz, rrb, ssp;\n Matrix<3, 1, const no_ptr*, 0, 0, 3> xxw, rra, ssq;\n Matrix<3, 1, const no_ptr*, 0, 1, 0> xyx, rgr, sts;\n Matrix<3, 1, const no_ptr*, 0, 1, 1> xyy, rgg, stt;\n Matrix<3, 1, no_ptr*, 0, 1, 2> xyz, rgb, stp;\n Matrix<3, 1, no_ptr*, 0, 1, 3> xyw, rga, stq;\n Matrix<3, 1, const no_ptr*, 0, 2, 0> xzx, rbr, sps;\n Matrix<3, 1, no_ptr*, 0, 2, 1> xzy, rbg, spt;\n Matrix<3, 1, const no_ptr*, 0, 2, 2> xzz, rbb, spp;\n Matrix<3, 1, no_ptr*, 0, 2, 3> xzw, rba, spq;\n Matrix<3, 1, const no_ptr*, 0, 3, 0> xwx, rar, sqs;\n Matrix<3, 1, no_ptr*, 0, 3, 1> xwy, rag, sqt;\n Matrix<3, 1, no_ptr*, 0, 3, 2> xwz, rab, sqp;\n Matrix<3, 1, const no_ptr*, 0, 3, 3> xww, raa, sqq;\n Matrix<3, 1, const no_ptr*, 1, 0, 0> yxx, grr, tss;\n Matrix<3, 1, const no_ptr*, 1, 0, 1> yxy, grg, tst;\n Matrix<3, 1, no_ptr*, 1, 0, 2> yxz, grb, tsp;\n Matrix<3, 1, no_ptr*, 1, 0, 3> yxw, gra, tsq;\n Matrix<3, 1, const no_ptr*, 1, 1, 0> yyx, ggr, tts;\n Matrix<3, 1, const no_ptr*, 1, 1, 1> yyy, ggg, ttt;\n Matrix<3, 1, const no_ptr*, 1, 1, 2> yyz, ggb, ttp;\n Matrix<3, 1, const no_ptr*, 1, 1, 3> yyw, gga, ttq;\n Matrix<3, 1, no_ptr*, 1, 2, 0> yzx, gbr, tps;\n Matrix<3, 1, const no_ptr*, 1, 2, 1> yzy, gbg, tpt;\n Matrix<3, 1, const no_ptr*, 1, 2, 2> yzz, gbb, tpp;\n Matrix<3, 1, no_ptr*, 1, 2, 3> yzw, gba, tpq;\n Matrix<3, 1, no_ptr*, 1, 3, 0> ywx, gar, tqs;\n Matrix<3, 1, const no_ptr*, 1, 3, 1> ywy, gag, tqt;\n Matrix<3, 1, no_ptr*, 1, 3, 2> ywz, gab, tqp;\n Matrix<3, 1, const no_ptr*, 1, 3, 3> yww, gaa, tqq;\n Matrix<3, 1, const no_ptr*, 2, 0, 0> zxx, brr, pss;\n Matrix<3, 1, no_ptr*, 2, 0, 1> zxy, brg, pst;\n Matrix<3, 1, const no_ptr*, 2, 0, 2> zxz, brb, psp;\n Matrix<3, 1, no_ptr*, 2, 0, 3> zxw, bra, psq;\n Matrix<3, 1, no_ptr*, 2, 1, 0> zyx, bgr, pts;\n Matrix<3, 1, const no_ptr*, 2, 1, 1> zyy, bgg, ptt;\n Matrix<3, 1, const no_ptr*, 2, 1, 2> zyz, bgb, ptp;\n Matrix<3, 1, no_ptr*, 2, 1, 3> zyw, bga, ptq;\n Matrix<3, 1, const no_ptr*, 2, 2, 0> zzx, bbr, pps;\n Matrix<3, 1, const no_ptr*, 2, 2, 1> zzy, bbg, ppt;\n Matrix<3, 1, const no_ptr*, 2, 2, 2> zzz, bbb, ppp;\n Matrix<3, 1, const no_ptr*, 2, 2, 3> zzw, bba, ppq;\n Matrix<3, 1, no_ptr*, 2, 3, 0> zwx, bar, pqs;\n Matrix<3, 1, no_ptr*, 2, 3, 1> zwy, bag, pqt;\n Matrix<3, 1, const no_ptr*, 2, 3, 2> zwz, bab, pqp;\n Matrix<3, 1, const no_ptr*, 2, 3, 3> zww, baa, pqq;\n Matrix<3, 1, const no_ptr*, 3, 0, 0> wxx, arr, qss;\n Matrix<3, 1, no_ptr*, 3, 0, 1> wxy, arg, qst;\n Matrix<3, 1, no_ptr*, 3, 0, 2> wxz, arb, qsp;\n Matrix<3, 1, const no_ptr*, 3, 0, 3> wxw, ara, qsq;\n Matrix<3, 1, no_ptr*, 3, 1, 0> wyx, agr, qts;\n Matrix<3, 1, const no_ptr*, 3, 1, 1> wyy, agg, qtt;\n Matrix<3, 1, no_ptr*, 3, 1, 2> wyz, agb, qtp;\n Matrix<3, 1, const no_ptr*, 3, 1, 3> wyw, aga, qtq;\n Matrix<3, 1, no_ptr*, 3, 2, 0> wzx, abr, qps;\n Matrix<3, 1, no_ptr*, 3, 2, 1> wzy, abg, qpt;\n Matrix<3, 1, const no_ptr*, 3, 2, 2> wzz, abb, qpp;\n Matrix<3, 1, const no_ptr*, 3, 2, 3> wzw, aba, qpq;\n Matrix<3, 1, const no_ptr*, 3, 3, 0> wwx, aar, qqs;\n Matrix<3, 1, const no_ptr*, 3, 3, 1> wwy, aag, qqt;\n Matrix<3, 1, const no_ptr*, 3, 3, 2> wwz, aab, qqp;\n Matrix<3, 1, const no_ptr*, 3, 3, 3> www, aaa, qqq;\n\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 0> xxxx, rrrr, ssss;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 1> xxxy, rrrg, ssst;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 2> xxxz, rrrb, sssp;\n Matrix<4, 1, const no_ptr*, 0, 0, 0, 3> xxxw, rrra, sssq;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 0> xxyx, rrgr, ssts;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 1> xxyy, rrgg, sstt;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 2> xxyz, rrgb, sstp;\n Matrix<4, 1, const no_ptr*, 0, 0, 1, 3> xxyw, rrga, sstq;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 0> xxzx, rrbr, ssps;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 1> xxzy, rrbg, sspt;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 2> xxzz, rrbb, sspp;\n Matrix<4, 1, const no_ptr*, 0, 0, 2, 3> xxzw, rrba, sspq;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 0> xxwx, rrar, ssqs;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 1> xxwy, rrag, ssqt;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 2> xxwz, rrab, ssqp;\n Matrix<4, 1, const no_ptr*, 0, 0, 3, 3> xxww, rraa, ssqq;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 0> xyxx, rgrr, stss;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 1> xyxy, rgrg, stst;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 2> xyxz, rgrb, stsp;\n Matrix<4, 1, const no_ptr*, 0, 1, 0, 3> xyxw, rgra, stsq;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 0> xyyx, rggr, stts;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 1> xyyy, rggg, sttt;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 2> xyyz, rggb, sttp;\n Matrix<4, 1, const no_ptr*, 0, 1, 1, 3> xyyw, rgga, sttq;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 0> xyzx, rgbr, stps;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 1> xyzy, rgbg, stpt;\n Matrix<4, 1, const no_ptr*, 0, 1, 2, 2> xyzz, rgbb, stpp;\n Matrix<4, 1, no_ptr*, 0, 1, 2, 3> xyzw, rgba, stpq;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 0> xywx, rgar, stqs;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 1> xywy, rgag, stqt;\n Matrix<4, 1, no_ptr*, 0, 1, 3, 2> xywz, rgab, stqp;\n Matrix<4, 1, const no_ptr*, 0, 1, 3, 3> xyww, rgaa, stqq;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 0> xzxx, rbrr, spss;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 1> xzxy, rbrg, spst;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 2> xzxz, rbrb, spsp;\n Matrix<4, 1, const no_ptr*, 0, 2, 0, 3> xzxw, rbra, spsq;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 0> xzyx, rbgr, spts;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 1> xzyy, rbgg, sptt;\n Matrix<4, 1, const no_ptr*, 0, 2, 1, 2> xzyz, rbgb, sptp;\n Matrix<4, 1, no_ptr*, 0, 2, 1, 3> xzyw, rbga, sptq;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 0> xzzx, rbbr, spps;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 1> xzzy, rbbg, sppt;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 2> xzzz, rbbb, sppp;\n Matrix<4, 1, const no_ptr*, 0, 2, 2, 3> xzzw, rbba, sppq;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 0> xzwx, rbar, spqs;\n Matrix<4, 1, no_ptr*, 0, 2, 3, 1> xzwy, rbag, spqt;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 2> xzwz, rbab, spqp;\n Matrix<4, 1, const no_ptr*, 0, 2, 3, 3> xzww, rbaa, spqq;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 0> xwxx, rarr, sqss;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 1> xwxy, rarg, sqst;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 2> xwxz, rarb, sqsp;\n Matrix<4, 1, const no_ptr*, 0, 3, 0, 3> xwxw, rara, sqsq;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 0> xwyx, ragr, sqts;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 1> xwyy, ragg, sqtt;\n Matrix<4, 1, no_ptr*, 0, 3, 1, 2> xwyz, ragb, sqtp;\n Matrix<4, 1, const no_ptr*, 0, 3, 1, 3> xwyw, raga, sqtq;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 0> xwzx, rabr, sqps;\n Matrix<4, 1, no_ptr*, 0, 3, 2, 1> xwzy, rabg, sqpt;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 2> xwzz, rabb, sqpp;\n Matrix<4, 1, const no_ptr*, 0, 3, 2, 3> xwzw, raba, sqpq;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 0> xwwx, raar, sqqs;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 1> xwwy, raag, sqqt;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 2> xwwz, raab, sqqp;\n Matrix<4, 1, const no_ptr*, 0, 3, 3, 3> xwww, raaa, sqqq;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 0> yxxx, grrr, tsss;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 1> yxxy, grrg, tsst;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 2> yxxz, grrb, tssp;\n Matrix<4, 1, const no_ptr*, 1, 0, 0, 3> yxxw, grra, tssq;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 0> yxyx, grgr, tsts;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 1> yxyy, grgg, tstt;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 2> yxyz, grgb, tstp;\n Matrix<4, 1, const no_ptr*, 1, 0, 1, 3> yxyw, grga, tstq;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 0> yxzx, grbr, tsps;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 1> yxzy, grbg, tspt;\n Matrix<4, 1, const no_ptr*, 1, 0, 2, 2> yxzz, grbb, tspp;\n Matrix<4, 1, no_ptr*, 1, 0, 2, 3> yxzw, grba, tspq;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 0> yxwx, grar, tsqs;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 1> yxwy, grag, tsqt;\n Matrix<4, 1, no_ptr*, 1, 0, 3, 2> yxwz, grab, tsqp;\n Matrix<4, 1, const no_ptr*, 1, 0, 3, 3> yxww, graa, tsqq;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 0> yyxx, ggrr, ttss;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 1> yyxy, ggrg, ttst;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 2> yyxz, ggrb, ttsp;\n Matrix<4, 1, const no_ptr*, 1, 1, 0, 3> yyxw, ggra, ttsq;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 0> yyyx, gggr, ttts;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 1> yyyy, gggg, tttt;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 2> yyyz, gggb, tttp;\n Matrix<4, 1, const no_ptr*, 1, 1, 1, 3> yyyw, ggga, tttq;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 0> yyzx, ggbr, ttps;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 1> yyzy, ggbg, ttpt;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 2> yyzz, ggbb, ttpp;\n Matrix<4, 1, const no_ptr*, 1, 1, 2, 3> yyzw, ggba, ttpq;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 0> yywx, ggar, ttqs;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 1> yywy, ggag, ttqt;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 2> yywz, ggab, ttqp;\n Matrix<4, 1, const no_ptr*, 1, 1, 3, 3> yyww, ggaa, ttqq;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 0> yzxx, gbrr, tpss;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 1> yzxy, gbrg, tpst;\n Matrix<4, 1, const no_ptr*, 1, 2, 0, 2> yzxz, gbrb, tpsp;\n Matrix<4, 1, no_ptr*, 1, 2, 0, 3> yzxw, gbra, tpsq;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 0> yzyx, gbgr, tpts;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 1> yzyy, gbgg, tptt;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 2> yzyz, gbgb, tptp;\n Matrix<4, 1, const no_ptr*, 1, 2, 1, 3> yzyw, gbga, tptq;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 0> yzzx, gbbr, tpps;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 1> yzzy, gbbg, tppt;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 2> yzzz, gbbb, tppp;\n Matrix<4, 1, const no_ptr*, 1, 2, 2, 3> yzzw, gbba, tppq;\n Matrix<4, 1, no_ptr*, 1, 2, 3, 0> yzwx, gbar, tpqs;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 1> yzwy, gbag, tpqt;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 2> yzwz, gbab, tpqp;\n Matrix<4, 1, const no_ptr*, 1, 2, 3, 3> yzww, gbaa, tpqq;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 0> ywxx, garr, tqss;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 1> ywxy, garg, tqst;\n Matrix<4, 1, no_ptr*, 1, 3, 0, 2> ywxz, garb, tqsp;\n Matrix<4, 1, const no_ptr*, 1, 3, 0, 3> ywxw, gara, tqsq;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 0> ywyx, gagr, tqts;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 1> ywyy, gagg, tqtt;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 2> ywyz, gagb, tqtp;\n Matrix<4, 1, const no_ptr*, 1, 3, 1, 3> ywyw, gaga, tqtq;\n Matrix<4, 1, no_ptr*, 1, 3, 2, 0> ywzx, gabr, tqps;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 1> ywzy, gabg, tqpt;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 2> ywzz, gabb, tqpp;\n Matrix<4, 1, const no_ptr*, 1, 3, 2, 3> ywzw, gaba, tqpq;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 0> ywwx, gaar, tqqs;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 1> ywwy, gaag, tqqt;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 2> ywwz, gaab, tqqp;\n Matrix<4, 1, const no_ptr*, 1, 3, 3, 3> ywww, gaaa, tqqq;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 0> zxxx, brrr, psss;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 1> zxxy, brrg, psst;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 2> zxxz, brrb, pssp;\n Matrix<4, 1, const no_ptr*, 2, 0, 0, 3> zxxw, brra, pssq;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 0> zxyx, brgr, psts;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 1> zxyy, brgg, pstt;\n Matrix<4, 1, const no_ptr*, 2, 0, 1, 2> zxyz, brgb, pstp;\n Matrix<4, 1, no_ptr*, 2, 0, 1, 3> zxyw, brga, pstq;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 0> zxzx, brbr, psps;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 1> zxzy, brbg, pspt;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 2> zxzz, brbb, pspp;\n Matrix<4, 1, const no_ptr*, 2, 0, 2, 3> zxzw, brba, pspq;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 0> zxwx, brar, psqs;\n Matrix<4, 1, no_ptr*, 2, 0, 3, 1> zxwy, brag, psqt;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 2> zxwz, brab, psqp;\n Matrix<4, 1, const no_ptr*, 2, 0, 3, 3> zxww, braa, psqq;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 0> zyxx, bgrr, ptss;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 1> zyxy, bgrg, ptst;\n Matrix<4, 1, const no_ptr*, 2, 1, 0, 2> zyxz, bgrb, ptsp;\n Matrix<4, 1, no_ptr*, 2, 1, 0, 3> zyxw, bgra, ptsq;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 0> zyyx, bggr, ptts;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 1> zyyy, bggg, pttt;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 2> zyyz, bggb, pttp;\n Matrix<4, 1, const no_ptr*, 2, 1, 1, 3> zyyw, bgga, pttq;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 0> zyzx, bgbr, ptps;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 1> zyzy, bgbg, ptpt;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 2> zyzz, bgbb, ptpp;\n Matrix<4, 1, const no_ptr*, 2, 1, 2, 3> zyzw, bgba, ptpq;\n Matrix<4, 1, no_ptr*, 2, 1, 3, 0> zywx, bgar, ptqs;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 1> zywy, bgag, ptqt;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 2> zywz, bgab, ptqp;\n Matrix<4, 1, const no_ptr*, 2, 1, 3, 3> zyww, bgaa, ptqq;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 0> zzxx, bbrr, ppss;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 1> zzxy, bbrg, ppst;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 2> zzxz, bbrb, ppsp;\n Matrix<4, 1, const no_ptr*, 2, 2, 0, 3> zzxw, bbra, ppsq;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 0> zzyx, bbgr, ppts;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 1> zzyy, bbgg, pptt;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 2> zzyz, bbgb, pptp;\n Matrix<4, 1, const no_ptr*, 2, 2, 1, 3> zzyw, bbga, pptq;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 0> zzzx, bbbr, ppps;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 1> zzzy, bbbg, pppt;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 2> zzzz, bbbb, pppp;\n Matrix<4, 1, const no_ptr*, 2, 2, 2, 3> zzzw, bbba, pppq;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 0> zzwx, bbar, ppqs;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 1> zzwy, bbag, ppqt;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 2> zzwz, bbab, ppqp;\n Matrix<4, 1, const no_ptr*, 2, 2, 3, 3> zzww, bbaa, ppqq;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 0> zwxx, barr, pqss;\n Matrix<4, 1, no_ptr*, 2, 3, 0, 1> zwxy, barg, pqst;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 2> zwxz, barb, pqsp;\n Matrix<4, 1, const no_ptr*, 2, 3, 0, 3> zwxw, bara, pqsq;\n Matrix<4, 1, no_ptr*, 2, 3, 1, 0> zwyx, bagr, pqts;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 1> zwyy, bagg, pqtt;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 2> zwyz, bagb, pqtp;\n Matrix<4, 1, const no_ptr*, 2, 3, 1, 3> zwyw, baga, pqtq;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 0> zwzx, babr, pqps;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 1> zwzy, babg, pqpt;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 2> zwzz, babb, pqpp;\n Matrix<4, 1, const no_ptr*, 2, 3, 2, 3> zwzw, baba, pqpq;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 0> zwwx, baar, pqqs;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 1> zwwy, baag, pqqt;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 2> zwwz, baab, pqqp;\n Matrix<4, 1, const no_ptr*, 2, 3, 3, 3> zwww, baaa, pqqq;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 0> wxxx, arrr, qsss;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 1> wxxy, arrg, qsst;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 2> wxxz, arrb, qssp;\n Matrix<4, 1, const no_ptr*, 3, 0, 0, 3> wxxw, arra, qssq;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 0> wxyx, argr, qsts;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 1> wxyy, argg, qstt;\n Matrix<4, 1, no_ptr*, 3, 0, 1, 2> wxyz, argb, qstp;\n Matrix<4, 1, const no_ptr*, 3, 0, 1, 3> wxyw, arga, qstq;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 0> wxzx, arbr, qsps;\n Matrix<4, 1, no_ptr*, 3, 0, 2, 1> wxzy, arbg, qspt;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 2> wxzz, arbb, qspp;\n Matrix<4, 1, const no_ptr*, 3, 0, 2, 3> wxzw, arba, qspq;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 0> wxwx, arar, qsqs;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 1> wxwy, arag, qsqt;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 2> wxwz, arab, qsqp;\n Matrix<4, 1, const no_ptr*, 3, 0, 3, 3> wxww, araa, qsqq;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 0> wyxx, agrr, qtss;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 1> wyxy, agrg, qtst;\n Matrix<4, 1, no_ptr*, 3, 1, 0, 2> wyxz, agrb, qtsp;\n Matrix<4, 1, const no_ptr*, 3, 1, 0, 3> wyxw, agra, qtsq;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 0> wyyx, aggr, qtts;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 1> wyyy, aggg, qttt;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 2> wyyz, aggb, qttp;\n Matrix<4, 1, const no_ptr*, 3, 1, 1, 3> wyyw, agga, qttq;\n Matrix<4, 1, no_ptr*, 3, 1, 2, 0> wyzx, agbr, qtps;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 1> wyzy, agbg, qtpt;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 2> wyzz, agbb, qtpp;\n Matrix<4, 1, const no_ptr*, 3, 1, 2, 3> wyzw, agba, qtpq;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 0> wywx, agar, qtqs;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 1> wywy, agag, qtqt;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 2> wywz, agab, qtqp;\n Matrix<4, 1, const no_ptr*, 3, 1, 3, 3> wyww, agaa, qtqq;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 0> wzxx, abrr, qpss;\n Matrix<4, 1, no_ptr*, 3, 2, 0, 1> wzxy, abrg, qpst;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 2> wzxz, abrb, qpsp;\n Matrix<4, 1, const no_ptr*, 3, 2, 0, 3> wzxw, abra, qpsq;\n Matrix<4, 1, no_ptr*, 3, 2, 1, 0> wzyx, abgr, qpts;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 1> wzyy, abgg, qptt;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 2> wzyz, abgb, qptp;\n Matrix<4, 1, const no_ptr*, 3, 2, 1, 3> wzyw, abga, qptq;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 0> wzzx, abbr, qpps;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 1> wzzy, abbg, qppt;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 2> wzzz, abbb, qppp;\n Matrix<4, 1, const no_ptr*, 3, 2, 2, 3> wzzw, abba, qppq;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 0> wzwx, abar, qpqs;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 1> wzwy, abag, qpqt;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 2> wzwz, abab, qpqp;\n Matrix<4, 1, const no_ptr*, 3, 2, 3, 3> wzww, abaa, qpqq;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 0> wwxx, aarr, qqss;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 1> wwxy, aarg, qqst;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 2> wwxz, aarb, qqsp;\n Matrix<4, 1, const no_ptr*, 3, 3, 0, 3> wwxw, aara, qqsq;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 0> wwyx, aagr, qqts;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 1> wwyy, aagg, qqtt;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 2> wwyz, aagb, qqtp;\n Matrix<4, 1, const no_ptr*, 3, 3, 1, 3> wwyw, aaga, qqtq;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 0> wwzx, aabr, qqps;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 1> wwzy, aabg, qqpt;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 2> wwzz, aabb, qqpp;\n Matrix<4, 1, const no_ptr*, 3, 3, 2, 3> wwzw, aaba, qqpq;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 0> wwwx, aaar, qqqs;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 1> wwwy, aaag, qqqt;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 2> wwwz, aaab, qqqp;\n Matrix<4, 1, const no_ptr*, 3, 3, 3, 3> wwww, aaaa, qqqq;\n };\n };\n}\n\nusing uint = unsigned;\n\n#ifndef UINT64_C\nusing int64_t = long long;\nusing uint64_t = unsigned long long;\n#endif\n\nusing ivec2 = glsl::Matrix<2, 1, int, 0, 1>;\nusing ivec3 = glsl::Matrix<3, 1, int, 0, 1, 2>;\nusing ivec4 = glsl::Matrix<4, 1, int, 0, 1, 2, 3>;\n\nusing uvec2 = glsl::Matrix<2, 1, uint, 0, 1>;\nusing uvec3 = glsl::Matrix<3, 1, uint, 0, 1, 2>;\nusing uvec4 = glsl::Matrix<4, 1, uint, 0, 1, 2, 3>;\n\nusing i64vec2 = glsl::Matrix<2, 1, int64_t, 0, 1>;\nusing i64vec3 = glsl::Matrix<3, 1, int64_t, 0, 1, 2>;\nusing i64vec4 = glsl::Matrix<4, 1, int64_t, 0, 1, 2, 3>;\n\nusing u64vec2 = glsl::Matrix<2, 1, uint64_t, 0, 1>;\nusing u64vec3 = glsl::Matrix<3, 1, uint64_t, 0, 1, 2>;\nusing u64vec4 = glsl::Matrix<4, 1, uint64_t, 0, 1, 2, 3>;\n\nusing bvec2 = glsl::Matrix<2, 1, bool, 0, 1>;\nusing bvec3 = glsl::Matrix<3, 1, bool, 0, 1, 2>;\nusing bvec4 = glsl::Matrix<4, 1, bool, 0, 1, 2, 3>;\n\nusing vec2 = glsl::Matrix<2, 1, float, 0, 1>;\nusing vec3 = glsl::Matrix<3, 1, float, 0, 1, 2>;\nusing vec4 = glsl::Matrix<4, 1, float, 0, 1, 2, 3>;\n\nusing dvec2 = glsl::Matrix<2, 1, double, 0, 1>;\nusing dvec3 = glsl::Matrix<3, 1, double, 0, 1, 2>;\nusing dvec4 = glsl::Matrix<4, 1, double, 0, 1, 2, 3>;\n\nusing mat2x2 = glsl::Matrix<2, 2, float, 0, 1, 2, 3>;\nusing mat2x3 = glsl::Matrix<3, 2, float, 0, 1, 2, 3, 4, 5>;\nusing mat2x4 = glsl::Matrix<4, 2, float, 0, 1, 2, 3, 4, 5, 6, 7>;\n\nusing mat3x2 = glsl::Matrix<2, 3, float, 0, 1, 2, 3, 4, 5>;\nusing mat3x3 = glsl::Matrix<3, 3, float, 0, 1, 2, 3, 4, 5, 6, 7, 8>;\nusing mat3x4 = glsl::Matrix<4, 3, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\n\nusing mat4x2 = glsl::Matrix<2, 4, float, 0, 1, 2, 3, 4, 5, 6, 7>;\nusing mat4x3 = glsl::Matrix<3, 4, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\nusing mat4x4 = glsl::Matrix<4, 4, float, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15>;\n\nusing mat2 = mat2x2;\nusing mat3 = mat3x3;\nusing mat4 = mat4x4;\n\nusing dmat2x2 = glsl::Matrix<2, 2, double, 0, 1, 2, 3>;\nusing dmat2x3 = glsl::Matrix<3, 2, double, 0, 1, 2, 3, 4, 5>;\nusing dmat2x4 = glsl::Matrix<4, 2, double, 0, 1, 2, 3, 4, 5, 6, 7>;\n\nusing dmat3x2 = glsl::Matrix<2, 3, double, 0, 1, 2, 3, 4, 5>;\nusing dmat3x3 = glsl::Matrix<3, 3, double, 0, 1, 2, 3, 4, 5, 6, 7, 8>;\nusing dmat3x4 = glsl::Matrix<4, 3, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\n\nusing dmat4x2 = glsl::Matrix<2, 4, double, 0, 1, 2, 3, 4, 5, 6, 7>;\nusing dmat4x3 = glsl::Matrix<3, 4, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11>;\nusing dmat4x4 = glsl::Matrix<4, 4, double, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15>;\n\nusing dmat2 = dmat2x2;\nusing dmat3 = dmat3x3;\nusing dmat4 = dmat4x4;\n\n#include \n#include \n\nnamespace glsl {\n\n template\n inline auto sum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a + b;\n else return M(a.data[I] + b.data[I] ...);\n }\n template\n inline auto sub(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a - b;\n else return M(a.data[I] - b.data[I] ...);\n }\n template\n inline auto neg(const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return -a;\n else return M(-a.data[I] ...);\n }\n template\n inline auto div(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a / b;\n else return M(a.data[I] / b.data[I] ...);\n }\n template\n constexpr bool integral = same || same || same || same;\n template\n constexpr bool moddable = integral && integral;\n\n template\n inline auto mod(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a % b;\n else return M(a.data[I] % b.data[I] ...);\n }\n template\n inline auto bin_neg(const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return -a;\n else return M(~a.data[I] ...);\n }\n template\n inline auto lshift(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a << b;\n else return M(a.data[I] << b.data[I] ...);\n }\n template\n inline auto rshift(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a >> b;\n else return M(a.data[I] >> b.data[I] ...);\n }\n template\n inline auto and_(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a & b;\n else return M(a.data[I] & b.data[I] ...);\n }\n template\n inline auto or_(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a | b;\n else return M(a.data[I] | b.data[I] ...);\n }\n template\n inline auto xor_(const M & a, const M & b, sequence) {\n if constexpr (sizeof...(I) == 1) return a ^ b;\n else return M(a.data[I] ^ b.data[I] ...);\n }\n template\n inline bool equals(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a == b;\n else return ((a.data[I] == b.data[I]) && ...);\n }\n template\n inline auto mul(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return a * b;\n else return M(a.data[I] * b.data[I] ...);\n }\n template\n inline auto matmul(const M1& a, const M2& b, sequence, sequence, MultCommon result = {}) {\n int i;\n if constexpr (Columns == 1) return ((i = I, result.data[i] = ((a.data[K] * b.data[K + (i / Columns>) * Rows]) + ...)), ..., result);\n else {\n constexpr int result_rows = Rows>;\n return ((i = I, result.data[i] = ((a.data[(i % result_rows) + K * Rows] * b.data[K + (i / result_rows) * Rows]) + ...)), ..., result);\n }\n }\n template\n inline auto maximum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return (a > b) ? a : b;\n else return M((a.data[I] > b.data[I]) ? a.data[I] : b.data[I] ...);\n }\n template\n inline auto mininum(const M& a, const M& b, sequence) {\n if constexpr (sizeof...(I) == 1) return (a < b) ? a : b;\n else return M((a.data[I] < b.data[I]) ? a.data[I] : b.data[I] ...);\n }\n template\n inline auto absolute(const M& x, sequence) {\n constexpr Field zero(0);\n if constexpr (sizeof...(I) == 1) return (x < zero) ? -x : x;\n else return M((x.data[I] < zero) ? -x.data[I] : x.data[I] ...);\n }\n\n template\n auto lt(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] < b.data[I]) ...);\n }\n template\n auto lte(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] <= b.data[I]) ...);\n }\n template\n auto gt(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] > b.data[I]) ...);\n }\n template\n auto gte(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] >= b.data[I]) ...);\n }\n template\n auto eq(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] == b.data[I]) ...);\n }\n template\n auto neq(const M& a, const M& b, sequence) {\n return Matrix, 1, bool, I...>((a.data[I] != b.data[I]) ...);\n }\n\n template\n auto not_(const M& x, sequence) {\n return M(!x.data[I]...);\n }\n template\n auto isnan(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::isnan(x);\n else return Matrix, Columns, bool, I...>(std::isnan(x.data[I])...);\n }\n template\n auto isinf(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::isinf(x);\n else return Matrix, Columns, bool, I...>(std::isinf(x.data[I])...);\n }\n\n template\n inline auto ceiling(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::ceil(float(x));\n else return M(std::ceil(float(x.data[I])) ...);\n }\n template\n inline auto flooring(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::floor(float(x));\n else return M(std::floor(float(x.data[I])) ...);\n }\n template\n inline auto fraction(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x - std::floor(float(x));\n else return M(x.data[I] - std::floor(float(x.data[I])) ...);\n }\n template\n inline auto rounder(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::round(float(x));\n else return M(std::round(x.data[I]) ...);\n }\n template\n inline auto modulus(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return x - y * std::floor(float(x / y));\n else return M(x.data[I] - y.data[I] * std::floor(float(x.data[I] / y.data[I])) ...);\n }\n template\n inline auto power(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return std::pow(float(x), float(y));\n else return M(std::pow(float(x.data[I]), float(y.data[I])) ...);\n }\n template\n inline auto clamper(const M& x, const M& v, const M& V, sequence) {\n if constexpr (sizeof...(I) == 1) return (x < v) ? v : ((x > V) ? V : x);\n else return M((x.data[I] < v.data[I]) ? v.data[I] : ((x.data[I] > V.data[I]) ? V.data[I] : x.data[I]) ...);\n }\n template\n inline auto mixer(const M& x, const M& y, const M& a, sequence) {\n if constexpr (sizeof...(I) == 1) return x * (1 - a) + y * a;\n else return M(x.data[I] * (1 - a.data[I]) + y.data[I] * a.data[I] ...);\n }\n template\n inline auto smoothstepper(const M& e0, const M& e1, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) {\n M t = (x - e0) / (e1 - e0);\n t = t < 0 ? 0 : (t > 1 ? 1 : t);\n return t * t * (3 - 2 * t);\n }\n else {\n M t;\n ((t.data[I] = (x.data[I] - e0.data[I]) / (e1.data[I] - e0.data[I])), ...);\n ((t.data[I] = t.data[I] < 0 ? 0 : (t.data[I] > 1 ? 1 : t.data[I])), ...);\n return M(t.data[I] * t.data[I] * (3 - 2 * t.data[I]) ...);\n }\n }\n template\n inline auto stepper(const M& edge, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x < edge ? 0 : 1;\n else return M(x.data[I] < edge.data[I] ? 0 : 1 ...);\n }\n template\n inline auto sine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::sin(x);\n else return M(std::sin(x.data[I]) ...);\n }\n template\n inline auto arcussine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::asin(x);\n else return M(std::asin(x.data[I]) ...);\n }\n template\n inline auto cosine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::cos(x);\n else return M(std::cos(x.data[I]) ...);\n }\n template\n inline auto arcuscosine(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::acos(x);\n else return M(std::acos(x.data[I]) ...);\n }\n template\n inline auto tangent(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::tan(x);\n else return M(std::tan(x.data[I]) ...);\n }\n template\n inline auto arcustangent(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::atan(x);\n else return M(std::tan(x.data[I]) ...);\n }\n template\n inline auto arcustangent(const M& y, const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::atan2(y, x);\n else return M(std::atan2(y.data[I], x.data[I]) ...);\n }\n template\n inline auto to_degrees(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x * 180.f / 3.14159265358979f;\n else return M(x.data[I] * 180.f / 3.14159265358979f ...);\n }\n template\n inline auto to_radians(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return x * 3.14159265358979f / 180.f;\n else return M(x.data[I] * 3.14159265358979f / 180.f ...);\n }\n\n template\n inline auto dotter(const M& x, const M& y, sequence) {\n if constexpr (sizeof...(I) == 1) return x * y;\n else return ((x.data[I] * y.data[I]) + ...);\n }\n template\n inline auto len(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::fabs(x);\n else return std::sqrt(((x.data[I] * x.data[I]) + ...));\n }\n template\n inline auto square_root(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::sqrt(x);\n else return M(std::sqrt(x.data[I]) ...);\n }\n template\n inline auto exper(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::exp(x);\n else return M(std::exp(x.data[I]) ...);\n }\n template\n inline auto exp2er(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::exp2(x);\n else return M(std::exp2f(x.data[I]) ...);\n }\n template\n inline auto loger(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::log(x);\n else return M(std::log(x.data[I]) ...);\n }\n template\n inline auto log2er(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return std::log2(x);\n else return M(std::log2(x.data[I]) ...);\n }\n template\n inline auto signum(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) return M((x < 0) ? (-1) : ((x > 0) ? 1 : 0));\n else return M((x.data[I] < 0) ? (-1) : ((x.data[I] > 0) ? 1 : 0) ...);\n }\n template\n inline auto cast(const M& x, sequence) {\n if constexpr (sizeof...(I) == 1) {\n F result; memcpy(&result, &x, sizeof(F));\n return result;\n }\n else {\n identity, Columns, F> result;\n memcpy(result.data, x.data, sizeof(F) * sizeof...(I));\n return result;\n }\n }\n template\n inline auto outer(const M1& c, const M2& r, sequence) {\n constexpr int R1 = Rows, R2 = Rows;\n return identity((c[I/R1]*r[I%R1]) ...);\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator+(const genType& x, const genType_& y) {\n return sum(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator-(const genType& x, const genType_& y) {\n return sub(Common(x), Common(y), Iota{});\n }\n\n template > 1)>>\n inline auto operator-(const genType& x) {\n return neg(identity, Columns, Field>(x), iota* Columns>{});\n }\n\n template > 1 || Rows > 1) && broadcastable> >\n inline Common operator/(const genType& x, const genType_& y) {\n return div(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && broadcastable && moddable, Field>> >\n inline auto operator%(const genType& x, const genType_& y) {\n return mod(Common(x), Common(y), Iota{});\n }\n template > 1) && integral>>>\n inline auto operator~(const genType& x) {\n return bin_neg(identity, Columns, Field>(x), iota* Columns>{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator<<(const genType& x, const genType_& y) {\n return lshift(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator>>(const genType& x, const genType_& y) {\n return rshift(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator&(const genType& x, const genType_& y) {\n return and_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator|(const genType& x, const genType_& y) {\n return or_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable&& moddable, Field>> >\n inline auto operator^(const genType& x, const genType_& y) {\n return xor_(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable>>\n inline bool operator==(const genType& x, const genType_& y) {\n return equals(Common(x), Common(y), Iota{});\n }\n template > 1 || Rows > 1) && broadcastable>>\n inline auto operator!=(const genType& x, const genType_& y) {\n return !equals(Common(x), Common(y), Iota{});\n }\n\n template > 1 || Rows > 1) && matmul_broadcastable>>\n inline MultCommon operator*(const genType& x, const genType_& y) {\n if constexpr (Columns == 1 && Columns == 1 || (Rows == 1 && Columns == 1 || Rows == 1 && Columns == 1))\n return mul(Common(x), Common(y), Iota{});\n else\n return matmul(\n identity, Columns, Field>(x),\n identity, Columns, Field>(y),\n iota()>{},\n iota>{});\n }\n}\n\ntemplate > 1 && glsl::Rows > 1) && glsl::Columns == 1 && glsl::Columns == 1>>\ninline auto outerProduct(const genType& c, const genType_& r) {\n return glsl::outer(c, r, glsl::iota< glsl::Rows* glsl::Rows>{});\n}\n\ntemplate\ninline bool any(const glsl::Matrix& x) {\n return (x.data[I] || ...);\n}\ntemplate\ninline bool all(const glsl::Matrix& x) {\n return (x.data[I] && ...);\n}\ntemplate\ninline glsl::Matrix not_(const glsl::Matrix& x) {\n return glsl::not_(x, glsl::iota{});\n}\n\n//#define not not_ // gcc doesn't enjoy this; glsl code should just use not_ then I guess\n\ntemplate && glsl::same, const glsl::Field>>>\nauto lessThan(const genType& x, const genType_& y) {\n return glsl::lt(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto lessThanEqual(const genType& x, const genType_& y) {\n return glsl::lte(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto greaterThan(const genType& x, const genType_& y) {\n return glsl::gt(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto greaterThanEqual(const genType& x, const genType_& y) {\n return glsl::gte(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto equal(const genType& x, const genType_& y) {\n return glsl::eq(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\ntemplate&& glsl::same, const glsl::Field>>>\nauto notEqual(const genType& x, const genType_& y) {\n return glsl::neq(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto isnan_(const genType& x) {\n return glsl::isnan(glsl::Common(x), glsl::Iota{});\n}\ntemplate\ninline auto isinf_(const genType& x) {\n return glsl::isinf(glsl::Common(x), glsl::Iota{});\n}\n#define isnan isnan_\n#define isinf isinf_\n\ntemplate> >\ninline auto max(const genType& x, const genType_& y) {\n return glsl::maximum(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate> >\ninline auto min(const genType& x, const genType_& y) {\n return glsl::mininum(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto abs(const genType& x) {\n return glsl::absolute(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto ceil(const genType& x) {\n return glsl::ceiling(glsl::Common(x), glsl::Iota{});\n}\ntemplate\ninline auto floor(const genType& x) {\n return glsl::flooring(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto fract(const genType& x) {\n return glsl::fraction(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto round(const genType& x) {\n return glsl::rounder(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate>>\ninline auto mod(const genType& x, const genType_& y) {\n return glsl::modulus(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate || (glsl::same && glsl::same)) && glsl::Rows == glsl::Rows&& glsl::broadcastable>>\ninline auto pow(const genType& x, const genType_& y) {\n return glsl::power(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\n\ntemplate>>\ninline auto clamp(const genType& x, const genType_& minVal, const genType__& maxVal) {\n return glsl::clamper(glsl::Common(x), glsl::Common(minVal), glsl::Common(maxVal), glsl::Iota{});\n}\n\ntemplate>>\ninline auto mix(const genType& x, const genType_& y, const genType__& a) {\n return glsl::mixer(glsl::Common(x), glsl::Common(y), glsl::Common(a), glsl::Iota{});\n}\n\n\ntemplate>>\ninline auto smoothstep(const genType& edge0, const genType_& edge1, const genType__& x) {\n return glsl::smoothstepper(glsl::Common(edge0), glsl::Common(edge1), glsl::Common(x), glsl::Iota{});\n}\ntemplate>>\ninline auto step(const genType& edge, const genType_& x) {\n return glsl::stepper(glsl::Common(edge), glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto sin(const genType& angle) {\n return glsl::sine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto asin(const genType& angle) {\n return glsl::arcussine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto cos(const genType& angle) {\n return glsl::cosine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto acos(const genType& angle) {\n return glsl::arcuscosine(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto tan(const genType& angle) {\n return glsl::tangent(glsl::Common(angle), glsl::Iota{});\n}\n\ntemplate\ninline auto atan(const genType& y_over_x) {\n return glsl::arcustangent(glsl::Common(y_over_x), glsl::Iota{});\n}\n\ntemplate>>\ninline auto atan(const genType& y, const genType_& x) {\n return glsl::arcustangent(glsl::Common(y), glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto degrees(const genType& radians) {\n return glsl::to_degrees(glsl::Common(radians), glsl::Iota{});\n}\n\ntemplate\ninline auto radians(const genType& degrees) {\n return glsl::to_radians(glsl::Common(degrees), glsl::Iota{});\n}\n\ninline vec3 cross(const vec3& x, const vec3& y) {\n return vec3(x.y * y.z - y.y * x.z, x.z * y.x - y.z * x.x, x.x * y.y - y.x * x.y);\n}\n\ninline float determinant(mat2 m) {\n return m[0][0] * m[1][1] - m[0][1] * m[1][0];\n}\ninline float determinant(mat3 m) {\n return m[0][0] * determinant(mat2(m[1].yz, m[2].yz))\n - m[1][0] * determinant(mat2(m[0].yz, m[2].yz))\n + m[2][0] * determinant(mat2(m[0].yz, m[1].yz));\n}\ninline float determinant(mat4 m) {\n return m[0][0] * determinant(mat3(m[1].yzw, m[2].yzw, m[3].yzw))\n - m[1][0] * determinant(mat3(m[0].yzw, m[2].yzw, m[3].yzw))\n + m[2][0] * determinant(mat3(m[0].yzw, m[1].yzw, m[3].yzw))\n - m[3][0] * determinant(mat3(m[0].yzw, m[1].yzw, m[2].yzw));\n}\n\ninline mat2 inverse(mat2 m) {\n return mat2(m[1][1], -m[0][1], -m[1][0], m[0][0]) / (m[0][0] * m[1][1] - m[0][1] * m[1][0]);\n}\nnamespace glsl {\n inline vec2 givens_rotation(float f, float g) {\n bool swap = false;\n if (abs(f) < abs(g)) {\n float tmp = f;\n f = g;\n g = tmp;\n swap = true;\n }\n if (g == .0f)\n return vec2(copysignf(1.f, f), .0f);\n else {\n float t = g / f, u = copysignf(1.f, f) * sqrtf(1.f + t * t);\n vec2 result = vec2(1.f, t) / u;\n if (swap)\n result = result.yx;\n return result;\n }\n }\n}\ninline mat3 inverse(mat3 m) {\n mat3 result(1.f), rhs(1.f);\n for (int c = 0; c < 2; ++c) {\n for (int r = 2; r > c; --r) {\n mat3 rot(1.f);\n vec2 cs = glsl::givens_rotation(m[c][c], m[c][r]);\n rot[c][c] = rot[r][r] = cs.x;\n rot[c][r] = -(rot[r][c] = cs.y);\n m = rot * m;\n rhs = rot * rhs;\n }\n }\n for (int i = 0; i < 3; ++i) {\n result[i].z = rhs[i].z / m[2].z;\n rhs[i].xy -= result[i].z * m[2].xy;\n result[i].y = rhs[i].y / m[1].y;\n rhs[i].x -= result[i].y * m[1].x;\n result[i].x = rhs[i].x / m[0].x;\n }\n return result;\n}\ninline mat4 inverse(mat4 m) {\n mat4 result(1.f), rhs(1.f);\n for (int c = 0; c < 3; ++c) {\n for (int r = 3; r > c; --r) {\n mat4 rot(1.f);\n vec2 cs = glsl::givens_rotation(m[c][c], m[c][r]);\n rot[c][c] = rot[r][r] = cs.x;\n rot[c][r] = -(rot[r][c] = cs.y);\n m = rot * m;\n rhs = rot * rhs;\n }\n }\n for (int i = 0; i < 4; ++i) {\n result[i].w = rhs[i].w / m[3].w;\n rhs[i].xyz -= result[i].w * m[3].xyz;\n result[i].z = rhs[i].z / m[2].z;\n rhs[i].xy -= result[i].z * m[2].xy;\n result[i].y = rhs[i].y / m[1].y;\n rhs[i].x -= result[i].y * m[1].x;\n result[i].x = rhs[i].x / m[0].x;\n }\n return result;\n}\n\ntemplate1)>>\n glsl::Matrix transpose(const glsl::Matrix& m) {\n glsl::Matrix result;\n ((result.data[I/R+(I%R)*C] = m.data[I]), ...);\n return result;\n}\n\n\ntemplate>>\ninline auto dot(const genType& x, const genType_& y) {\n return glsl::dotter(glsl::Common(x), glsl::Common(y), glsl::Iota{});\n}\n\ntemplate\ninline auto length(const genType& x) {\n return glsl::len(glsl::Common(x), glsl::Iota{});\n}\ntemplate>>\ninline auto distance(const genType& x, const genType_& y) {\n return glsl::len(glsl::Common(x-y), glsl::Iota{});\n}\ntemplate\ninline auto normalize(const genType& x) {\n return x / glsl::len(x, glsl::Iota{});\n}\n\ntemplate\ninline auto sqrt(const genType& x) {\n return glsl::square_root(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto exp(const genType& x) {\n return glsl::exper(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto exp2(const genType& x) {\n return glsl::exp2er(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto log(const genType& x) {\n return glsl::loger(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto log2(const genType& x) {\n return glsl::log2er(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto sign(const genType& x) {\n return glsl::signum(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate\ninline auto reflect(const genType& I, const genType_& N) {\n return I - 2 * dot(N, I) * N;\n}\n\ntemplate\ninline auto refract(const genType& I, const genType_& N, float eta) {\n glsl::Common R(.0f);\n float k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I));\n if (k > 0.0)\n R = eta * I - (eta * dot(N, I) + sqrt(k)) * N;\n return R;\n}\n\ntemplate, float>>>\ninline auto floatBitsToInt(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, float>>>\ninline auto floatBitsToUint(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, int>>>\ninline auto intBitsToFloat(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, uint>>>\ninline auto uintBitsToFloat(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\n\ntemplate, double>>>\ninline auto doubleBitsToInt(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, double>>>\ninline auto doubleBitsToUint(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, int64_t>>>\ninline auto int64BitsToDouble(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\ntemplate, uint64_t>>>\ninline auto uint64BitsToDouble(const genType& x) {\n return glsl::cast(glsl::Common(x), glsl::Iota{});\n}\n\ninline int64_t packInt2x32(ivec2 v) { return int64_t(v.y) << 32 | v.x; }\ninline uint64_t packUint2x32(uvec2 v) { return uint64_t(v.y) << 32 | v.x; }\n\ninline ivec2 unpackInt2x32(int64_t v) { return ivec2(v, v>>32); }\ninline uvec2 unpackUint2x32(uint64_t v) { return uvec2(v, v >> 32); }\n\ninline int atomicAdd(int& mem, int data) { return 0; }\ninline uint atomicAdd(uint& mem, uint data) { return 0u; }\ninline int64_t atomicAdd(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicAdd(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicAnd(int& mem, int data) { return 0; }\ninline uint atomicAnd(uint& mem, uint data) { return 0u; }\ninline int64_t atomicAnd(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicAnd(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicCompSwap(int& mem, int comp, int data) { return 0; }\ninline uint atomicCompSwap(uint& mem, uint comp, uint data) { return 0u; }\ninline int64_t atomicCompSwap(int64_t& mem, int64_t comp, int64_t data) { return 0; }\ninline uint64_t atomicCompSwap(uint64_t& mem, uint64_t comp, uint64_t data) { return 0; }\n\ninline int atomicExchange(int& mem, int data) { return 0; }\ninline uint atomicExchange(uint& mem, uint data) { return 0u; }\ninline int64_t atomicExchange(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicExchange(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicMax(int& mem, int data) { return 0; }\ninline uint atomicMax(uint& mem, uint data) { return 0u; }\ninline int64_t atomicMax(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicMax(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicMin(int& mem, int data) { return 0; }\ninline uint atomicMin(uint& mem, uint data) { return 0u; }\ninline int64_t atomicMin(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicMin(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicOr(int& mem, int data) { return 0; }\ninline uint atomicOr(uint& mem, uint data) { return 0u; }\ninline int64_t atomicOr(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicOr(uint64_t& mem, uint64_t data) { return 0; }\n\ninline int atomicXor(int& mem, int data) { return 0; }\ninline uint atomicXor(uint& mem, uint data) { return 0u; }\ninline int64_t atomicXor(int64_t& mem, int64_t data) { return 0; }\ninline uint64_t atomicXor(uint64_t& mem, uint64_t data) { return 0; }\n\ninline void barrier() {}\ninline void groupMemoryBarrier() {}\ninline void memoryBarrier() {}\ninline void memoryBarrierAtomicCounter() {}\ninline void memoryBarrierBuffer() {}\ninline void memoryBarrierImage() {}\ninline void memoryBarrierShared() {}\n\ninline const uvec3 gl_GlobalInvocationID = {};\ninline const uvec3 gl_LocalInvocationID = {};\ninline const uvec3 gl_WorkGroupSize = { 1, 1, 1 };\ninline const uvec3 gl_WorkGroupID = {};\ninline const uvec3 gl_NumWorkGroups = { 1, 1, 1 };\ninline const uint gl_LocalInvocationIndex = 0u;\n\ninline const vec4 gl_FragCoord = {};\ninline const vec2 gl_PointCoord = {};\ninline int gl_ViewportIndex;\ninline const int gl_VertexID = 0;\ninline const int gl_InstanceID = 0;\ninline const int gl_InvocationID = 0;\ninline int gl_PrimitiveIDIn;\ninline const int gl_PrimitiveID = 0;\ninline const int gl_PatchVerticesIn = 0;\ninline const int gl_Layer = 0;\n\ninline const vec3 gl_TessCoord = {};\ninline float gl_TessLevelInner[2];\ninline float gl_TessLevelOuter[4];\n\ninline const bool gl_FrontFacing = true;\ninline const bool gl_HelperInvocation = false;\n\ninline vec4 gl_Position;\ninline float gl_PointSize;\ninline float gl_FragDepth;\ninline float gl_ClipDistance[1];\ninline float gl_CullDistance[1];\nstruct gl_PerVertex\n{\n vec4 gl_Position;\n float gl_PointSize;\n float gl_ClipDistance[1];\n} inline gl_in[1];\n\ninline const int gl_NumSamples = 1;\ninline const int gl_SampleID = 0;\ninline int gl_SampleMask[1];\ninline const int gl_SampleMaskIn[1] = { 0 };\ninline const vec2 gl_SamplePosition = {};\n\ntemplate genType dFdx(genType p) { return p; }\ntemplate genType dFdy(genType p) { return p; }\ntemplate genType dFdxCoarse(genType p) { return p; }\ntemplate genType dFdyCoarse(genType p) { return p; }\ntemplate genType dFdxFine(genType p) { return p; }\ntemplate genType dFdyFine(genType p) { return p; }\ntemplate genType fwidth(genType p) { return p; }\ntemplate genType fwidthCoarse(genType p) { return p; }\ntemplate genType fwidthFine(genType p) { return p; }\n\n// subgroup extension: see https://www.khronos.org/blog/vulkan-subgroup-tutorial\n\ninline const uint gl_NumSubgroups = 1, gl_SubgroupID = 0, gl_SubgroupSize = 128, gl_SubgroupInvocationID = 0;\ninline const uvec4 gl_SubgroupEqMask{ 0 }, gl_SubgroupGeMask{ 0 }, gl_SubgroupGtMask{ 0 }, gl_SubgroupLeMask{ 0 }, gl_SubgroupLtMask{ 0 };\ninline void subgroupBarrier() {}\ninline void subgroupMemoryBarrier() {}\ninline void subgroupMemoryBarrierBuffer() {}\ninline void subgroupMemoryBarrierShared() {}\ninline void subgroupMemoryBarrierImage() {}\ninline bool subgroupElect() { return false; }\n\ninline bool subgroupAll(bool value) { return value; }\ninline bool subgroupAny(bool value) { return value; }\ntemplate bool subgroupAllEqual(T value) { (void)value; return false; }\n\ntemplate T subgroupBroadcast(T value, uint id) { (void)id; return value; }\ntemplate T subgroupBroadcastFirst(T value) { return value; }\ninline uvec4 subgroupBallot(bool value) { (void)value; return uvec4(0); }\ninline bool subgroupInverseBallot(uvec4 value) { (void)value; return false; }\ninline bool subgroupBallotBitExtract(uvec4 value, uint index) { (void)value; (void)index; return false; }\ninline uint subgroupBallotBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotInclusiveBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotExclusiveBitCount(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotFindLSB(uvec4 value) { (void)value; return 0; }\ninline uint subgroupBallotFindMSB(uvec4 value) { (void)value; return 0; }\n\ntemplate T subgroupAdd(T value) { return value; }\ntemplate T subgroupMul(T value) { return value; }\ntemplate T subgroupMin(T value) { return value; }\ntemplate T subgroupMax(T value) { return value; }\ntemplate T subgroupAnd(T value) { return value; }\ntemplate T subgroupOr(T value) { return value; }\ntemplate T subgroupXor(T value) { return value; }\n\ntemplate T subgroupInclusiveAdd(T value) { return value; }\ntemplate T subgroupInclusiveMul(T value) { return value; }\ntemplate T subgroupInclusiveMin(T value) { return value; }\ntemplate T subgroupInclusiveMax(T value) { return value; }\ntemplate T subgroupInclusiveAnd(T value) { return value; }\ntemplate T subgroupInclusiveOr(T value) { return value; }\ntemplate T subgroupInclusiveXor(T value) { return value; }\n\ntemplate T subgroupExclusiveAdd(T value) { return value; }\ntemplate T subgroupExclusiveMul(T value) { return value; }\ntemplate T subgroupExclusiveMin(T value) { return value; }\ntemplate T subgroupExclusiveMax(T value) { return value; }\ntemplate T subgroupExclusiveAnd(T value) { return value; }\ntemplate T subgroupExclusiveOr(T value) { return value; }\ntemplate T subgroupExclusiveXor(T value) { return value; }\n\ntemplate T subgroupShuffle(T value, uint index) { (void)index; return value; }\ntemplate T subgroupShuffleXor(T value, uint mask) { (void)mask; return value; }\ntemplate T subgroupShuffleUp(T value, uint delta) { (void)delta; return value; }\ntemplate T subgroupShuffleDown(T value, uint delta) { (void)delta; return value; }\n\ntemplate T subgroupClusteredAdd(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMul(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMin(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredMax(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredAnd(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredOr(T value, uint clusterSize) { (void)clusterSize; return value; }\ntemplate T subgroupClusteredXor(T value, uint clusterSize) { (void)clusterSize; return value; }\n\ntemplate T subgroupQuadBroadcast(T value, uint id) { (void)id; return value; }\ntemplate T subgroupQuadSwapHorizontal(T value) { return value; }\ntemplate T subgroupQuadSwapVertical(T value) { return value; }\ntemplate T subgroupQuadSwapDiagonal(T value) { return value; }\n\n\n// missing: hyperbolic trigonometry, faceforward etc geometric functions.\n"}, {"path": "impl/inline_glsl.cpp", "language": "cpp", "loc": 719, "comment_density": 0.088, "code": "\n#include \"inline_glsl.h\"\n#ifdef _WIN32\n#include \n#endif\n\nivec2 windowSize();\n\nnamespace inline_glsl {\n#ifdef _WIN32\n long ShaderStore::id_counter = 1; // 0 reserved for non-existing shaders\n inline ULONGLONG lastAccess(const char* path) {\n HANDLE file = CreateFileA(path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);\n FILETIME writeTime;\n GetFileTime(file, nullptr, nullptr, &writeTime);\n CloseHandle(file);\n return ULARGE_INTEGER{ writeTime.dwLowDateTime, writeTime.dwHighDateTime }.QuadPart;\n }\n#else\n\tstd::atomic ShaderStore::id_counter{1};\n inline auto lastAccess(const char* path) {\n return last_write_time(std::filesystem::path(path));\n }\n#endif\n\n inline bool alphanum_(char input) {\n return 'a' <= input && input <= 'z' || 'A' <= input && input <= 'Z' || '0' <= input && input <= '9' || input == '_';\n }\n\n inline void remove_bind_calls(char* input) {\n char* output = input;\n bool inside = false;\n const char* needle = \" bind\";\n\n while (*input != '\\0') {\n *output = *input;\n if (!alphanum_(*input)) {\n for (int i = 1;; i++) {\n if (needle[i] == '\\0') {\n while (*input != '(' && *input != '\\0') input++;\n inside = true;\n break;\n }\n if (input[i] != needle[i]) break;\n }\n }\n output++; input++;\n if (inside && *input == ')') {\n input++;\n inside = false;\n }\n }\n *output = '\\0';\n }\n\n inline char* search(char* input, const char* needle, int& line) {\n while (*input != '\\0') {\n if (*input == '\\n') line++;\n for (int i = 0;; i++) {\n if (needle[i] == '\\0') return input;\n else if (input[i] != needle[i]) break;\n }\n input++;\n }\n return input;\n }\n\n void remove_comments(char* source_in, uint* lines_in) {\n char* source_out = source_in;\n uint* lines_out = lines_in;\n bool multi_comment = false, single_comment = false;\n\n while(*source_in!='\\0') {\n if (multi_comment) {\n if (*source_in == '\\n') { // keep commented \\ns to preserve lines\n *(source_out++) = '\\n';\n *(lines_out++) = *lines_in;\n }\n else if (*source_in == '/' && *(source_in-1) == '*')\n multi_comment = false;\n }\n else if (single_comment && *source_in == '\\n') {\n *(source_out++) = '\\n';\n *(lines_out++) = *lines_in;\n single_comment = false;\n }\n else {\n if (*source_in == '/') {\n if (*(source_in+1) == '/')\n single_comment = true;\n else if (*(source_in + 1) == '*')\n multi_comment = true;\n }\n if (!single_comment && !multi_comment) {\n *(source_out++) = *source_in;\n *(lines_out++) = *lines_in;\n }\n }\n source_in++;\n lines_in++;\n }\n *source_out = '\\0';\n *lines_out = *lines_in;\n }\n\n void remove_float_suffixes(char* source_in, uint* lines_in) {\n char* source_out = source_in;\n uint* lines_out = lines_in;\n bool number = false;\n while (*source_in!='\\0') {\n bool keep = true;\n if (number) {\n if (*source_in == 'f')\n keep = number = false;\n if (!('0'<=*source_in && *source_in<='9') && *source_in != '.')\n number = false;\n }\n if (!alphanum_(*source_in) && ('0' <= *(source_in+1) && *(source_in+1) <= '9'))\n number = true;\n if (keep) {\n *(source_out++) = *source_in;\n *(lines_out++) = *lines_in;\n }\n source_in++;\n lines_in++;\n }\n *source_out = '\\0';\n *lines_out = *lines_in;\n }\n\n bool is_same(const char* a, const char* b) {\n while (*a == *b) {\n if (*a == '\\0') return true;\n a++; b++;\n }\n return false;\n }\n \n bool SourceStore::update(const char* path) {\n this->path = path;\n\n auto latestUpdate = lastAccess(path);\n for (auto include : includes) {\n //printf(\"checking include %s\\n\", include);\n auto includeUpdate = lastAccess(include);\n if (includeUpdate > latestUpdate)\n latestUpdate = includeUpdate;\n }\n\n if (latestUpdate == currentUpdate)\n return false;\n\n FILE* file = fopen(path, \"rb\");\n if(!file) return false;\n \n fseek(file, 0, SEEK_END);\n size_t size = size_t(ftell(file)) + 1;\n\t\tif(size == 0) return false;\n\n\t\titeration++;\n\n currentUpdate = latestUpdate;\n\n contents.resize(size);\n contents.back() = '\\0';\n fseek(file, 0, SEEK_SET);\n fread(contents.data(), 1, contents.size() - 1, file);\n fclose(file);\n\n lines.resize(contents.size());\n int line = 1;\n for (int i = 0; i < contents.size(); ++i) {\n lines[i] = line;\n if (contents[i] == '\\n') line++;\n }\n remove_comments(contents.data(), lines.data());\n remove_float_suffixes(contents.data(), lines.data());\n\n char* search = contents.data();\n\n for (auto a : includes) delete[] a;\n includes.clear();\n\n // add include files (absolutely beautiful code I know)\n while (true) {\n int dummy;\n //printf(\"%s\", contents.data());\n search = inline_glsl::search(search, \"#in\", dummy);\n\n if (*search != '\\0') {\n char* include_begin = search;\n while (*search != '\\\"' && *search != '<' && *search != '\\0') search++;\n if (*search == '\\\"' || *search == '<') {\n char* path = ++search;\n\n while (*search != '\\\"' && *search != '>' && *search != '\\0') search++;\n int64_t path_length = search - path + 1;\n char* filePath = new char[path_length];\n for (int i = 0; path < search; ++i)\n filePath[i] = *(path++);\n filePath[path_length - 1] = '\\0';\n \n search++;\n int64_t begin_ind = include_begin - contents.data(), search_ind = search - contents.data();\n\n bool already_included = false;\n for (auto& a : includes)\n if (is_same(a, filePath))\n already_included = true;\n\n if (!already_included && !is_same(filePath, \"glext.h\") && !is_same(filePath, \"window.h\") && !is_same(filePath, \"loadgl46.h\") && !is_same(filePath, \"inline_glsl.h\")) {\n\n //printf(\"%s\\n\", filePath);\n FILE* includeFile = fopen(filePath, \"rb\");\n if (includeFile) {\n\t\t\t\t\t\t\tfseek(includeFile, 0, SEEK_END);\n\t\t\t\t\t\t\tsize_t size = size_t(ftell(includeFile));\n includes.push_back(filePath);\n if(size>0) {\n \t uint includeMask = uint(includes.size()) << 20;\n \t if (includes.size() >= 4096)\n\t printf(\"too many includes, errors may be reported in incorrect files\\n\");\n\n \t size_t copy_length = contents.size() - search_ind;\n \t contents.resize(contents.size() + size - (search_ind - begin_ind) - 1);\n \t lines.resize(contents.size());\n \t memcpy(&contents[contents.size() - copy_length], &contents[search_ind], copy_length);\n \t memcpy(&lines[lines.size() - copy_length], &lines[search_ind], copy_length * sizeof(int));\n\t\n \t fseek(includeFile, 0, SEEK_SET);\n\t \t fread(&contents[begin_ind], 1, size, includeFile);\n \t \tfclose(includeFile);\n\t \t line = 1;\n\t\t\t\t\t\t\t\tfor (int i = 0; i < size; ++i) {\n \t lines[begin_ind + i] = includeMask | line;\n \t if (contents[begin_ind + i] == '\\n') line++;\n \t }\n \t remove_comments(contents.data(), lines.data());\n \t remove_float_suffixes(contents.data(), lines.data());\n\t }\n }\n else delete[] filePath;\n }\n else delete[] filePath;\n search = &contents[search_ind];\n }\n else\n search++;\n }\n else break;\n }\n contents.resize(search + 1 - contents.data());\n lines.resize(contents.size());\n\n /*int lineBegin = 0;\n for (int i = 0; i < contents.size(); ++i) {\n if (contents[i] == '\\n' || contents[i] == '\\0') {\n printf(\"%d: %.*s\", lines[lineBegin], i - lineBegin + 1, &contents[lineBegin]);\n lineBegin = i + 1;\n }\n }\n for (int i = 0; i < 5; ++i) {\n printf(\"%d, \", lines[lines.size() - 1 - i]);\n }*/\n\n glsl_mains.clear();\n glsl_main_lines.clear();\n glsl_functions.clear();\n \n search = contents.data();\n\n while (true) {\n search = inline_glsl::search(search, \"glsl_main\", line);\n if (*search != '\\0') {\n glsl_mains.push_back(search);\n glsl_main_lines.push_back(lines[search-contents.data()]);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"#define\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_global\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search + 11);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_function\", line);\n if (*search != '\\0') {\n glsl_functions.push_back(search + 13);\n search++;\n }\n else break;\n }\n search = contents.data();\n while (true) {\n search = inline_glsl::search(search + 1, \"glsl_func(\", line);\n if (*search != '\\0') {\n for (int i = 0; i < 3; ++i) {\n char open = i < 2 ? '(' : '{', close = i < 2 ? ')' : '}';\n while (*search != open && *search != '\\0') search++;\n int inside = 1;\n while (inside > 0 && *(++search)!='\\0') {\n if (*search == open) inside++;\n if (*search == close) inside--;\n }\n }\n /*if (*(search + 1) != ';')\n printf(\"wrong character..?\\n\");\n else\n printf(\"semicolon removed!\\n\");*/\n *(search+1) = ' ';\n }\n else break;\n }\n\n glsl_begin_lines = glsl_main_lines;\n for (int i = 0; i < glsl_mains.size(); i++) {\n char*& c = glsl_mains[i];\n int inside = 1;\n char* k = c;\n while (inside > 0 && *k != '\\0') {\n if (*k == '{') inside++;\n if (*k == '}') inside--;\n k++;\n }\n *(k - 1) = '\\0';\n inside = 1;\n while (inside > 0 && c != contents.data()) {\n c--;\n if (*c == '}') inside++;\n if (*c == '{') inside--;\n if (*c == '\\n') glsl_begin_lines[i]--;\n }\n c++;\n\n remove_bind_calls(c);\n }\n for (char* c : glsl_functions) {\n if (*c == '#') {\n while (*c != '\\n' && *c != '\\0') c++;\n *c = '\\0';\n continue;\n }\n while (*c != ';' && *c != '{' && *c != '(' && *c != '\\0') c++;\n if (*c == '{') {\n c++;\n // struct\n int inside = 1;\n while (inside>0 && *c != '\\0') {\n if (*c == '{') inside++;\n if (*c == '}') inside--;\n c++;\n }\n }\n if (*c == ';') *(c + 1) = '\\0'; // variable\n else {\n // function\n c++;\n int inside = 1;\n while (inside > 0 && *c!='\\0') {\n if (*c == '(') inside++;\n if (*c == ')') inside--;\n c++;\n }\n while (*c != '{' && *c!=';' && *c != '\\0') c++;\n if (*c == ';')\n *(c+1) = '\\0';\n else {\n c++;\n inside = 1;\n while (inside > 0 && *c != '\\0') {\n if (*c == '{') inside++;\n if (*c == '}') inside--;\n c++;\n }\n *c = '\\0';\n }\n }\n }\n for (const char* c : includes) {\n while (*c != '\\\"' && *c != '>' && *c != '\\0') ++c;\n *const_cast(c) = '\\0';\n }\n\n return true;\n }\n\n void write_line(char* target, int line, int file) {\n for (int i = 0; i < 7; ++i) target[i] = \"\\n#line \"[i];\n sprintf(target + 7, \"%u %u\\n\", line, file);\n }\n\n bool add_shader(GLuint program, GLenum type, const char* name, const Shader& shader_obj, SourceStore& store) {\n\n GLuint shader = glCreateShader(type);\n\n if (!shader_obj.store->cached) {\n\n const char* stub = \"\\\n#extension GL_ARB_gpu_shader_int64 : enable\\n\\\n#define glsl_main() main()\\n\\\n#define glsl_func(a) a\\n\\\n#define dynamic_array(t, a) t a[]\\n\\\n#define arg_in(a) in a\\n\\\n#define arg_out(a) out a\\n\\\n#define arg_inout(a) inout a\\n\\\n#define arg_layout layout\\n\\\n#define glsl_extension(a,b) int _##a = 1\\n\\\n#define glsl_version(a) int glsl_version = a\\n\\\n#define glsl_subgroup(a) \\n\\\n#define not_(a) not(a)\\n\";\n\n size_t extensions = shader_obj.store->extensions.size();\n size_t functions = store.glsl_functions.size();\n const char** sources = const_cast(new char* [4 + extensions + 2 * functions]);\n\n sources[0] = shader_obj.store->version ? shader_obj.store->version : \"#version 460\\n\";\n for (int i = 0; i < extensions; ++i)\n sources[1 + i] = shader_obj.store->extensions[i];\n sources[extensions + 1] = stub;\n\n uint mask = 0xffffffffu << 20u;\n for (int i = 0; i < functions; ++i) {\n char* k = new char[32];\n uint line_file = store.lines[store.glsl_functions[i] - store.contents.data()];\n write_line(k, line_file & ~mask, (line_file & mask) >> 20u);\n sources[i * 2 + 2 + extensions] = k;\n sources[i * 2 + 3 + extensions] = store.glsl_functions[i];\n }\n char* l = new char[32];\n write_line(l, store.glsl_begin_lines[shader_obj.store->nth_in_file], 0);\n sources[2 + 2 * functions + extensions] = l;\n sources[3 + 2 * functions + extensions] = store.glsl_mains[shader_obj.store->nth_in_file];\n\n //printf(\"source: \\n\");\n //for (int i = 0; i < 4 + extensions + 2 * store.glsl_functions.size(); ++i)\n // printf(\"%s\", sources[i]);\n\n#ifdef _WIN32\n (void)_mkdir(\"shader_cache\");\n#else\n std::filesystem::create_directory(\"shader_cache\");\n#endif\n\n char cache_name[256];\n get_cache_name(cache_name, store.path, shader_obj.store->line);\n FILE* cache = fopen(cache_name, \"wb\");\n for (auto& include : store.includes) {\n int count = 0;\n while (include[count] != '\\0') count++;\n fwrite(include, 1, count, cache);\n fwrite(\",\", 1, 1, cache);\n }\n fwrite(\"\\n\", 1, 1, cache);\n for (int i = 0; i < 4 + extensions + 2 * store.glsl_functions.size(); ++i) {\n int count = 0;\n while (sources[i][count] != '\\0') count++;\n fwrite(sources[i], 1, count, cache);\n }\n fclose(cache);\n\n glShaderSource(shader, GLsizei(4 + extensions + 2 * functions), sources, nullptr);\n\n delete[] l;\n for (int i = 0; i < functions; ++i)\n delete[] const_cast(sources[i * 2 + 2 + extensions]);\n delete[] sources;\n }\n else\n glShaderSource(shader, 1, &shader_obj.store->cached, nullptr);\n \n glCompileShader(shader);\n GLint status;\n glGetShaderiv(shader, GL_COMPILE_STATUS, &status);\n if (status != GL_TRUE) {\n GLint length;\n glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);\n std::vector info_log(length);\n glGetShaderInfoLog(shader, length, nullptr, info_log.data());\n const GLubyte* vendor = glGetString(GL_VENDOR);\n \n if(vendor[0] == 'N' && vendor[1] == 'V') // should be enough :^)\n for (int i = 0; i < info_log.size(); ++i) {\n uint file_number, line_number;\n if ((i==0||info_log[i-1] == '\\n') && 2 == sscanf(info_log.data() + i, \"%u(%u)\", &file_number, &line_number)) {\n int j = 0; while (i+j < info_log.size() && info_log[i+j] != ')') j++; j++;\n \n const char* path = (file_number == 0) ? shader_obj.store->path : shader_obj.store->include_files[file_number-1];\n \n int last_dir = 0;\n for (int k = 0; path[k] != '\\0'; k++)\n if (path[k] == '\\\\' || path[k] == '/')\n last_dir = k;\n if(last_dir)\n path += last_dir + 1;\n\n int k = 0; while (path[k] != '\\0')k++;\n int t = int(ceil(log10(line_number)));\n // \", line \"\n size_t copy_size = info_log.size() - i - j;\n info_log.resize(info_log.size()-j+k+t+7);\n memcpy(info_log.data() + i + k + t + 7, info_log.data() + i + j, copy_size);\n for (int p = 0; p < k; ++p)\n info_log[i + p] = path[p];\n for (int p = 0; p < 7; ++p)\n info_log[i + k + p] = \", line \"[p];\n info_log[i+k+7+sprintf(info_log.data() + i + k + 7, \"%u\", line_number)] = ' ';\n i += k + t + 7;\n }\n }\n // TODO: AMD, Intel, ...? some vendors may have different error reporting schemes for different generations?\n printf(\"\\n%s failed: \\n%s\", name, info_log.data());\n glDeleteShader(shader);\n return false;\n }\n glAttachShader(program, shader);\n glDeleteShader(shader);\n return true;\n }\n\n // maybe make this O(log n) at some point\n inline Program& find_or_insert(int64_t ids[6], std::vector& programs) {\n for (int i = 0; i < programs.size(); ++i) {\n for (int j = 0; j < 6; ++j) {\n if (programs[i].ids[j] != ids[j]) break;\n else if (j == 5) return programs[i].p;\n }\n }\n programs.resize(programs.size() + 1);\n size_t location = programs.size() - 1;\n programs[location].p = Program();\n for (int i = 0; i < 6; ++i)\n programs[location].ids[i] = (long)ids[i];\n return programs[location].p;\n }\n\n std::vector draw_buffers;\n\n void useShader(const Shader& compute, const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment, std::vector& programs, ShaderState& shader_state, SourceStore& store) {\n\n int64_t ids[] = { compute.unique_id, vertex.unique_id, fragment.unique_id, geometry.unique_id, control.unique_id, evaluation.unique_id };\n Program& program = find_or_insert(ids, programs);\n\n shader_state.rebuilt = false;\n if (program.obj == 0 || compute.changed || vertex.changed || fragment.changed || geometry.changed || control.changed || evaluation.changed) {\n printf(\"compiling... \");\n GLuint newProgram = glCreateProgram();\n\n bool csuccess = !compute.unique_id || add_shader(newProgram, GL_COMPUTE_SHADER, \"compute\", compute, store);\n bool vsuccess = !vertex.unique_id || add_shader(newProgram, GL_VERTEX_SHADER, \"vertex\", vertex, store);\n bool gsuccess = !geometry.unique_id || add_shader(newProgram, GL_GEOMETRY_SHADER, \"geometry\", geometry, store);\n bool tsuccess = !control.unique_id || add_shader(newProgram, GL_TESS_CONTROL_SHADER, \"control\", control, store);\n bool esuccess = !evaluation.unique_id || add_shader(newProgram, GL_TESS_EVALUATION_SHADER, \"evaluation\", evaluation, store);\n bool fsuccess = !fragment.unique_id || add_shader(newProgram, GL_FRAGMENT_SHADER, \"fragment\", fragment, store);\n\n bool success = csuccess && vsuccess && gsuccess && tsuccess && esuccess && fsuccess;\n\n if (success) {\n glLinkProgram(newProgram);\n\n GLint status;\n glGetProgramiv(newProgram, GL_LINK_STATUS, &status);\n if (status != GL_TRUE) {\n GLint length;\n glGetProgramiv(newProgram, GL_INFO_LOG_LENGTH, &length);\n std::vector info_log(length);\n glGetProgramInfoLog(newProgram, length, nullptr, info_log.data());\n printf(\"\\ncouldn't link shader: \\n%s\\n\", info_log.data());\n glDeleteProgram(newProgram);\n success = false;\n }\n }\n else printf(\"\\n\");\n if (success) {\n printf(\"success! \\n\");\n if (program.obj != 0)\n glDeleteProgram(program.obj);\n program.obj = newProgram;\n\n if (program.vao != 0)\n glDeleteVertexArrays(1, &program.vao);\n glCreateVertexArrays(1, &program.vao);\n\n shader_state.rebuilt = true;\n }\n }\n\n glBindVertexArray(program.vao);\n\n glUseProgram(program.obj);\n\n if (draw_buffers.size() == 0) {\n GLint maxBuffers;\n glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxBuffers);\n draw_buffers.resize(maxBuffers);\n }\n for (auto& b : draw_buffers)\n b = GL_NONE;\n\n shader_state.fbo = program.fbo;\n shader_state.program = program.obj;\n shader_state.texture_unit = shader_state.image_unit = shader_state.fbo_width = shader_state.fbo_height = 0;\n\n shader_state.use_fbo = false;\n\n if (compute.unique_id) for (auto& f : compute.store->callbacks) f(shader_state);\n if (vertex.unique_id) for (auto& f : vertex.store->callbacks) f(shader_state);\n if (geometry.unique_id) for (auto& f : geometry.store->callbacks) f(shader_state);\n if (control.unique_id) for (auto& f : control.store->callbacks) f(shader_state);\n if (evaluation.unique_id) for (auto& f : evaluation.store->callbacks) f(shader_state);\n if (fragment.unique_id) for (auto& f : fragment.store->callbacks) f(shader_state);\n\n program.fbo = shader_state.fbo;\n\n if (shader_state.use_fbo) {\n glViewport(0, 0, shader_state.fbo_width, shader_state.fbo_height);\n //auto test = glCheckFramebufferStatus(GL_FRAMEBUFFER);\n //if (test != GL_FRAMEBUFFER_COMPLETE)\n // printf(\"framebuffer status %X\\n\", test);\n\n glDrawBuffers(draw_buffers.size(), draw_buffers.data());\n }\n else {\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n auto size = windowSize();\n glViewport(0, 0, size.x, size.y);\n }\n }\n\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of SSBO '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_SHADER_STORAGE_BLOCK, store.name);\n if (store.location != GL_INVALID_INDEX)\n glShaderStorageBlockBinding(shader_state.program, store.location, store.location);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of UBO '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_UNIFORM_BLOCK, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniformBlockBinding(shader_state.program, store.location, store.location);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"find location of color attachment '%s'\\n\", store.name);\n store.location = glGetProgramResourceIndex(shader_state.program, GL_PROGRAM_OUTPUT, store.name);\n }\n void Arg::findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"'location' of depth attachment '%s' is obvious\\n\", store.name);\n }\n\n#undef bind\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform float '%s' to %g\\n\", store.name, store.item);\n glUniform1f(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform int '%s' to %i\\n\", store.name, store.item);\n glUniform1i(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uint '%s' to %ui\\n\", store.name, store.item);\n glUniform1ui(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uint '%s' to %ui\\n\", store.name, store.item);\n glUniform1ui64(store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec2 '%s'\\n\", store.name);\n glUniform2fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec2 '%s'\\n\", store.name);\n glUniform2iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec2 '%s'\\n\", store.name);\n glUniform2uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec3 '%s'\\n\", store.name);\n glUniform3fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec3 '%s'\\n\", store.name);\n glUniform3iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec3 '%s'\\n\", store.name);\n glUniform3uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform vec4 '%s'\\n\", store.name);\n glUniform4fv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform ivec4 '%s'\\n\", store.name);\n glUniform4iv(store.location, 1, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform uvec4 '%s'\\n\", store.name);\n glUniform4uiv(store.location, 1, (const GLuint*)store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2 '%s'\\n\", store.name);\n glUniformMatrix2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3 '%s'\\n\", store.name);\n glUniformMatrix3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4 '%s'\\n\", store.name);\n glUniformMatrix4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3x2 '%s'\\n\", store.name);\n glUniformMatrix3x2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4x2 '%s'\\n\", store.name);\n glUniformMatrix4x2fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2x3 '%s'\\n\", store.name);\n glUniformMatrix2x3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat4x3 '%s'\\n\", store.name);\n glUniformMatrix4x3fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat2x4 '%s'\\n\", store.name);\n glUniformMatrix2x4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"set uniform mat3x4 '%s'\\n\", store.name);\n glUniformMatrix3x4fv(store.location, 1, false, store.item.data);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"bind SSBO '%s'\\n\", store.name);\n glBindBufferBase(GL_SHADER_STORAGE_BUFFER, store.location, store.item);\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"bind UBO '%s'\\n\", store.name);\n glBindBufferBase(GL_UNIFORM_BUFFER, store.location, store.item);\n }\n\n void set_fbo_size(GLuint texture, GLint level, ShaderState& state) {\n glGetTextureLevelParameteriv(texture, level, GL_TEXTURE_WIDTH, &state.fbo_width);\n glGetTextureLevelParameteriv(texture, level, GL_TEXTURE_HEIGHT, &state.fbo_height);\n }\n\n bool layered(GLenum type) {\n return type == GL_TEXTURE_2D_ARRAY || type == GL_TEXTURE_3D || type == GL_TEXTURE_CUBE_MAP || type == GL_TEXTURE_CUBE_MAP_ARRAY || type == GL_TEXTURE_2D_MULTISAMPLE_ARRAY;\n }\n\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"attach color '%s'\\n\", store.name);\n if (store.item == 0) return;\n if (shader_state.fbo == 0)\n glGenFramebuffers(1, &shader_state.fbo);\n if(!shader_state.use_fbo)\n glBindFramebuffer(GL_FRAMEBUFFER, shader_state.fbo);\n shader_state.use_fbo = true;\n if (shader_state.fbo_width == 0) set_fbo_size(store.item, store.item.level, shader_state);\n if (layered(store.item.type))\n glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + store.location, store.item, store.item.level, store.item.layer);\n else\n glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + store.location, store.item, store.item.level);\n draw_buffers[store.location] = GL_COLOR_ATTACHMENT0 + store.location;\n }\n void Arg::bind(ShaderState& shader_state, ArgStore& store) {\n //printf(\"attach %s to depth\\n\", store.name);\n if (store.item == 0) return;\n if (shader_state.fbo == 0)\n glGenFramebuffers(1, &shader_state.fbo);\n if (!shader_state.use_fbo)\n glBindFramebuffer(GL_FRAMEBUFFER, shader_state.fbo);\n shader_state.use_fbo = true;\n if (shader_state.fbo_width == 0) set_fbo_size(store.item, store.item.level, shader_state);\n if (layered(store.item.type))\n glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, store.item, store.item.level, store.item.layer);\n else\n glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, store.item, store.item.level);\n }\n}\n"}, {"path": "impl/inline_glsl.h", "language": "c", "loc": 456, "comment_density": 0.033, "code": "#pragma once\n\n#include \n\n#ifdef _WIN32\n#define VC_EXTRALEAN\n#define WIN32_LEAN_AND_MEAN\n#define NOMINMAX\n#include \n#else\n#include \n#endif\n\n#include \"glsl.h\"\n#include \"shader_types.h\"\n\n#ifndef _WIN32\n#include \n#include \n#endif\n\nnamespace inline_glsl {\n \n struct SourceStore {\n std::vector contents;\n std::vector glsl_mains;\n std::vector glsl_functions;\n std::vector glsl_main_lines, glsl_begin_lines;\n std::vector includes;\n char const* path;\n std::vector lines;\n#ifdef _WIN32\n ULONGLONG currentUpdate = 0;\n#else\n std::filesystem::file_time_type currentUpdate = {};\n#endif\n uint iteration = 0;\n bool update(const char* path);\n ~SourceStore() {\n for (auto include : includes) delete[] include;\n }\n };\n\n static SourceStore store;\n\n // filled prior to invoking a program\n struct ShaderState {\n GLuint program;\n GLuint fbo;\n GLuint image_format, image_access;\n GLubyte texture_unit;\n GLubyte image_unit;\n GLint fbo_width, fbo_height;\n bool rebuilt, use_fbo;\n } static shader_state;\n\n struct Function {\n virtual void operator()(ShaderState&) = 0;\n virtual ~Function() {}\n };\n\n template\n struct Specific : Function {\n T func;\n Specific(T func) : func(func) {}\n virtual void operator()(ShaderState& state) { func(state); }\n };\n\n struct Func {\n Function* func = nullptr;\n template\n Func(T func) : func(new Specific(func)) {}\n Func(Func&& other) : func(other.func) { other.func = nullptr; }\n void operator()(ShaderState& state) { (*func)(state); }\n ~Func() { if (func) delete func; }\n };\n\n using ShaderSetup = std::vector;\n inline ShaderSetup* current_callbacks;\n inline std::vector* extensions;\n inline const char** version;\n\n inline void get_cache_name(char* result, const char* path, int line) {\n\n const char* path_name = path;\n while (*path_name != '\\0') path_name++;\n while (*path_name != '\\\\' && *path_name != '/' && path_name > path)path_name--;\n if (path_name > path) path_name++;\n\n int i = 0;\n for (i = 0; i < 13; ++i)\n result[i] = \"shader_cache/\"[i];\n while (*path_name != '.' && *path_name != '\\0')\n result[i++] = *path_name++;\n result[i++] = '_';\n\n i += sprintf(result+i, \"%d\", line);\n\n for (int j = 0; j < 6; ++j)\n result[i++] = \".glsl\"[j];\n }\n\n struct ShaderStore {\n ShaderSetup callbacks;\n std::vector extensions, include_files;\n const char* version;\n const char* path; int line;\n const char* cached = nullptr;\n uint nth_in_file, iteration = 0;\n long unique_id;\n#ifdef _WIN32\n static long id_counter;\n#else\n\t\tstatic std::atomic id_counter;\n#endif\n ShaderStore(const char* path, int line, SourceStore& store) : path(path), line(line) {\n#ifdef _WIN32\n unique_id = InterlockedAdd(&id_counter, 1);\n#else\n unique_id = id_counter++;\n#endif\n FILE* test = fopen(path, \"r\");\n if (test) {\n fclose(test);\n store.update(path);\n include_files = store.includes;\n for (nth_in_file = 0; nth_in_file < store.glsl_main_lines.size() && store.glsl_main_lines[nth_in_file] != line; ++nth_in_file);\n //printf(\"glsl_main %d at line %d\\n\", nth_in_file, line);\n }\n else {\n char name_buffer[256];\n get_cache_name(name_buffer, path, line);\n FILE* file = fopen(name_buffer, \"rb\");\n fseek(file, 0, SEEK_END);\n size_t size = size_t(ftell(file)) + 1;\n char* cache = new char[size];\n cache[size - 1] = '\\0';\n\n fseek(file, 0, SEEK_SET);\n fread(cache, 1, size - 1, file);\n fclose(file);\n\n while (*cache != '\\0' && *cache != '\\n') {\n include_files.push_back(cache);\n while (*cache != '\\0' && *cache != ',') cache++;\n if (*cache != '\\0') {\n *cache = '\\0';\n cache++;\n }\n }\n\n cached = cache+1;\n }\n }\n\n bool update(SourceStore& store) {\n callbacks.clear();\n extensions.clear();\n version = nullptr;\n inline_glsl::current_callbacks = &callbacks;\n inline_glsl::extensions = &extensions;\n inline_glsl::version = &version;\n if (cached) return false;\n store.update(path);\n uint old_iteration = iteration;\n iteration = store.iteration;\n return old_iteration != iteration;\n }\n ~ShaderStore() { delete[] cached; }\n };\n\n struct Extension {\n const char* ext;\n Extension(const char* ext) : ext(ext) {}\n ~Extension() { inline_glsl::extensions->push_back(ext); }\n };\n struct Version {\n const char* version;\n Version(const char* version) : version(version) {}\n ~Version() { *inline_glsl::version = version; }\n };\n}\nstruct Shader {\n uint unique_id = 0; bool changed = false;\n inline_glsl::ShaderStore* store = nullptr;\n Shader() {}\n Shader(inline_glsl::ShaderStore& shader, inline_glsl::SourceStore& source) {\n changed = shader.update(source);\n unique_id = shader.unique_id;\n store = &shader;\n }\n};\n\nnamespace inline_glsl {\n struct Program {\n GLuint obj = 0, vao = 0, fbo = 0;\n };\n\n struct ProgramEntry {\n long ids[6] = { 0 };\n Program p;\n };\n\n static std::vector programs;\n void useShader(const Shader& compute, const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment, std::vector& programs, ShaderState& shader_state, SourceStore& store);\n\n\n template\n struct ArgStore {\n const char* name;\n GLuint location, program;\n T item;\n ArgStore(const char* name, T i) : name(name), item(i) {\n //printf(\"retainer for %s\\n\", name);\n }\n };\n\n using glsl::same, glsl::Field, glsl::Rows;\n\n template\n constexpr bool is_image = false;\n template\n constexpr bool is_image> = true;\n\n struct Arg {\n template\n void findLocation(ShaderState& shader_state, ArgStore& store) {\n //printf(\"glGetUniformLocation(%s)\\n\", store.name);\n store.location = glGetUniformLocation(shader_state.program, store.name);\n }\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"glGetUniformLocation(%s)\\n\", store.name);\n store.location = glGetUniformLocation(shader_state.program, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniform1i(store.location, shader_state.texture_unit);\n if constexpr (shadow) {\n glTextureParameteri(store.item, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);\n glTextureParameteri(store.item, GL_TEXTURE_COMPARE_FUNC, GL_LESS);\n }\n }\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n store.location = glGetUniformLocation(shader_state.program, store.name);\n if (store.location != GL_INVALID_INDEX)\n glUniform1i(store.location, shader_state.image_unit);\n }\n void findLocation(ShaderState& shader_state, ArgStore& store);\n void findLocation(ShaderState& shader_state, ArgStore& store);\n template\n void findLocation(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"find location of vertex attribute '%s'\\n\", store.name);\n store.location = glGetAttribLocation(shader_state.program, store.name);\n if(store.location!= GL_INVALID_INDEX)\n glEnableVertexAttribArray(store.location);\n }\n void findLocation(ShaderState& shader_state, ArgStore& store);\n void findLocation(ShaderState& shader_state, ArgStore& store);\n\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n template\n void bind(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"bind vertex attribute '%s'\\n\", store.name);\n glBindBuffer(GL_ARRAY_BUFFER, store.item);\n\n static_assert(same, float> || same, int> || same,uint>, \"attribute base type not supported\");\n if constexpr (same, float>)\n glVertexAttribPointer(store.location, Rows, store.item.type, store.item.normalized, store.item.stride, (void*)(size_t)store.item.offset);\n else\n glVertexAttribIPointer(store.location, Rows, store.item.type, store.item.stride, (void*)(size_t)store.item.offset);\n }\n\n void bind(ShaderState& shader_state, ArgStore& store);\n void bind(ShaderState& shader_state, ArgStore& store);\n\n template\n void bind(ShaderState& shader_state, ArgStore>& store) {\n //printf(\"bind sampler2D '%s'\\n\", store.name);\n glBindTextureUnit(shader_state.texture_unit, store.item);\n shader_state.texture_unit++;\n }\n template\n void bind(ShaderState& shader_state, ArgStore>& store, GLuint access, GLuint format) {\n //printf(\"bind image2D '%s'\\n\", store.name);\n if (access == 1) access = GL_READ_ONLY;\n else if (access == 2) access = GL_WRITE_ONLY;\n else access = GL_READ_WRITE;\n\n bool layered = store.item.layer == GL_INVALID_INDEX;\n GLint tex_format, tex_size, bind_size;\n glGetTextureLevelParameteriv(store.item, store.item.level, GL_TEXTURE_INTERNAL_FORMAT, &tex_format);\n glGetInternalformativ(type, tex_format, GL_IMAGE_TEXEL_SIZE, 1, &tex_size);\n glGetInternalformativ(type, format, GL_IMAGE_TEXEL_SIZE, 1, &bind_size);\n if (tex_size != bind_size) {\n printf(\"warning: texture and shader image have different texel sizes\\n\");\n#ifdef _WIN32\n __debugbreak();\n#endif\n }\n glBindImageTexture(shader_state.image_unit, store.item, store.item.level, layered, layered ? 0 : store.item.layer, access, format);\n shader_state.image_unit++;\n }\n\n Func func;\n template\n Arg(volatile ArgStore& store_, const U& j) : func([&, j, state = shader_state](ShaderState& shader_state) {\n ArgStore& store = const_cast&>(store_); // volatile is a legit keyword for images and buffers; the variable is not actually volatile so we cast it away\n\n if (shader_state.rebuilt || store.program != shader_state.program) {\n store.program = shader_state.program;\n findLocation(shader_state, store);\n }\n\n store.item = j;\n if (store.location != -1)\n if constexpr (!is_image)\n bind(shader_state, store);\n else\n bind(shader_state, store, state.image_access, state.image_format);\n }) {}\n\n ~Arg() { current_callbacks->push_back(std::move(func)); }\n };\n}\n\n#define UNIQUE_(a, b) ___ ## a ## b\n#define UNIQUE(a, b) UNIQUE_(a, b)\n\n#define REPEAT1(m, a) m(a)\n#define REPEAT2(m, a, b) m(a), m(b)\n#define REPEAT3(m, a, b, c) m(a), m(b), m(c)\n#define REPEAT4(m, a, b, c, d) m(a), m(b), m(c), m(d)\n#define REPEAT5(m, a, b, c, d, e) m(a), m(b), m(c), m(d), m(e)\n#define REPEAT6(m, a, b, c, d, e, f) m(a), m(b), m(c), m(d), m(e), m(f)\n#define REPEAT7(m, a, b, c, d, e, f, g) m(a), m(b), m(c), m(d), m(e), m(f), m(g)\n#define REPEAT8(m, a, b, c, d, e, f, g, h) m(a), m(b), m(c), m(d), m(e), m(f), m(g), m(h)\n\n#define SELECT(a, b, c, d, e, f, g, h, macro, ...) macro\n#define REPEAT(...) SELECT(__VA_ARGS__, REPEAT8, REPEAT7, REPEAT6, REPEAT5, REPEAT4, REPEAT3, REPEAT2, REPEAT1)\n\n\n#define STORE(a) UNIQUE(a,0)(#a, a)\n#define ARG(a) UNIQUE(a##_,0)(UNIQUE(a, 0), (decltype(UNIQUE(a,0).item))a)\n#define SHADOW(a) a = {}\n\n#define UNIFORM static inline_glsl::ArgStore<\n#define BUFFER static inline_glsl::ArgStore REPEAT(__VA_ARGS__)(STORE, __VA_ARGS__); inline_glsl::Arg REPEAT(__VA_ARGS__)(ARG, __VA_ARGS__); const FIRSTTYPE(__VA_ARGS__, 0) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__); inline_glsl::shader_state.image_access = 0\n#define BIND_BLOCK(a) > UNIQUE(a,0)(#a, a); inline_glsl::Arg UNIQUE(a##_,0)(UNIQUE(a,0), (decltype(UNIQUE(a,0).item))a); inline_glsl::shader_state.image_access = 0; union\n\n// bind(uniform_1, uniform_2, ...)\n#define bind(...) BIND(__VA_ARGS__)\n\n// bind_block(ssbo/ubo) {...};\n#define bind_block(a) BIND_BLOCK(a)\n\n#define DECL_TARGET_(a) UNIQUE(a##_,0)(#a, a)\n#define SELECT_TARGET_DECLARE_(...) REPEAT(__VA_ARGS__)(DECL_TARGET_, __VA_ARGS__)\n\n#define DECL_TARGET(a) UNIQUE(a,0)(#a, a)\n#define SELECT_TARGET_DECLARE(...) REPEAT(__VA_ARGS__)(DECL_TARGET, __VA_ARGS__)\n\n#define TARGET_SETTER(a) UNIQUE(a##_,0)(UNIQUE(a, 0), Target(a))\n#define SELECT_TARGET_SET(...) REPEAT(__VA_ARGS__)(TARGET_SETTER, __VA_ARGS__)\n\n#define SET_ATTR(a) UNIQUE(a##_,0)(UNIQUE(a, 0), Attribute(a))\n#define SELECT_ATTRIB_SET(...) REPEAT(__VA_ARGS__)(SET_ATTR, __VA_ARGS__)\n\n\n#define BIND_ATTRIBUTE(...) UNIQUE(type, __LINE__);(void)UNIQUE(type, __LINE__); static inline_glsl::ArgStore> SELECT_TARGET_DECLARE(__VA_ARGS__); inline_glsl::Arg SELECT_ATTRIB_SET(__VA_ARGS__); const decltype(UNIQUE(type, __LINE__)) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__)\n#define BIND_TARGET(...) UNIQUE(type, __LINE__);(void)UNIQUE(type, __LINE__); static inline_glsl::ArgStore SELECT_TARGET_DECLARE(__VA_ARGS__); inline_glsl::Arg SELECT_TARGET_SET(__VA_ARGS__); decltype(UNIQUE(type, __LINE__)) REPEAT(__VA_ARGS__)(SHADOW, __VA_ARGS__)\n\n// bind_attribute(attribute_1, attribute_2, ...)\n#define bind_attribute(...) BIND_ATTRIBUTE(__VA_ARGS__)\n\n// bind_target(texture_1, texture_2, ...)\n#define bind_target(...) BIND_TARGET(__VA_ARGS__)\n\n#define glsl_func(name) *UNIQUE(type, __LINE__); (void)(UNIQUE(type, __LINE__)); auto name = [&]\n\n#define in\n#define out\n\n#define arg_in(type) type\n#define arg_out(type) type&\n#define arg_inout(type) type&\n\n#define flat\n#define noperspective\n#define smooth\n\n#define layout(...) __VA_ARGS__;\n\n#define std140 0\n#define std430 0\n\n#define shared\n\n#define glsl_extension(name, behavior) inline_glsl::Extension _##name(\"#extension \" #name \" : \" #behavior \"\\n\")\n#define glsl_version(version) inline_glsl::Version glsl_version(\"#version \" #version \"\\n\")\n#define glsl_subgroup(behavior) \\\n glsl_extension(GL_KHR_shader_subgroup_basic, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_vote, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_ballot, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_arithmetic, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_shuffle, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_shuffle_relative, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_clustered, behavior);\\\n glsl_extension(GL_KHR_shader_subgroup_quad, behavior)\n\ninline unsigned location, binding, component, offset, vertices, max_vertices, primitive, invocations, local_size_x, local_size_y, local_size_z;\ninline unsigned points, lines, lines_adjacency, triangles, triangles_adjacency, line_strip, triangle_strip;\n\n#define IMAGE_FORMAT(a) inline_glsl::shader_state.image_format = a\ntemplate\nstruct DynamicArray {\n T val;\n T& operator[](int){ return val; }\n int length() { return 0; }\n};\n#define dynamic_array(type, name) DynamicArray name;\n\n#define arg_layout(...)\n\n#define r11f_g11f_b10f IMAGE_FORMAT(GL_R11F_G11F_B10F)\n#define rgb10_a2 IMAGE_FORMAT(GL_RGB10_A2)\n#define rgba32f IMAGE_FORMAT(GL_RGBA32F)\n#define rgba16f IMAGE_FORMAT(GL_RGBA16F)\n#define rgba16 IMAGE_FORMAT(GL_RGBA16)\n#define rgba8 IMAGE_FORMAT(GL_RGBA8)\n#define rg32f IMAGE_FORMAT(GL_RG32F)\n#define rg16f IMAGE_FORMAT(GL_RG16F)\n#define rg16 IMAGE_FORMAT(GL_RG16)\n#define rg8 IMAGE_FORMAT(GL_RG8)\n#define r32f IMAGE_FORMAT(GL_R32F)\n#define r16f IMAGE_FORMAT(GL_R16F)\n#define r16 IMAGE_FORMAT(GL_R16)\n#define r8 IMAGE_FORMAT(GL_R8)\n#define rgba16_snorm IMAGE_FORMAT(GL_RGBA16_SNORM)\n#define rgba8_snorm IMAGE_FORMAT(GL_RGBA8_SNORM)\n#define rg16_snorm IMAGE_FORMAT(GL_RG16_SNORM)\n#define rg8_snorm IMAGE_FORMAT(GL_RG8_SNORM)\n#define r16_snorm IMAGE_FORMAT(GL_R16_SNORM)\n#define r8_snorm IMAGE_FORMAT(GL_R8_SNORM)\n\n#define rgba32i IMAGE_FORMAT(GL_RGBA32I)\n#define rgba16i IMAGE_FORMAT(GL_RGBA16I)\n#define rgba8i IMAGE_FORMAT(GL_RGBA8I)\n#define rg32i IMAGE_FORMAT(GL_RG32I)\n#define rg16i IMAGE_FORMAT(GL_RG16I)\n#define rg8i IMAGE_FORMAT(GL_RG8I)\n#define r32i IMAGE_FORMAT(GL_R32I)\n#define r16i IMAGE_FORMAT(GL_R16I)\n#define r8i IMAGE_FORMAT(GL_R8I)\n\n\n#define rgb10_a2ui IMAGE_FORMAT(GL_RGB10_A2UI)\n#define rgba32ui IMAGE_FORMAT(GL_RGBA32UI)\n#define rgba16ui IMAGE_FORMAT(GL_RGBA16UI)\n#define rgba8ui IMAGE_FORMAT(GL_RGBA8UI)\n#define rg32ui IMAGE_FORMAT(GL_RG32UI)\n#define rg16ui IMAGE_FORMAT(GL_RG16UI)\n#define rg8ui IMAGE_FORMAT(GL_RG8UI)\n#define r32ui IMAGE_FORMAT(GL_R32UI)\n#define r16ui IMAGE_FORMAT(GL_R16UI)\n#define r8ui IMAGE_FORMAT(GL_R8UI)\n\n#define READONLY inline_glsl::shader_state.image_access |= 1;\n#define readonly READONLY\n#define WRITEONLY inline_glsl::shader_state.image_access |= 2;\n#define writeonly WRITEONLY\n\n#define coherent\n#define restrict\n\n#define early_fragment_tests\n\n#define glsl_function\n#define glsl_global\n\n#define EmitVertex()\n#define EndPrimitive()\n#define EmitStreamVertex()\n\n#define GLSL_MAIN ();static inline_glsl::ShaderStore __s(__FILE__, __LINE__, inline_glsl::store); return Shader(__s, inline_glsl::store); if constexpr(false)\n#define glsl_main() GLSL_MAIN\n\n#define BIND_DEPTH(a) ();static inline_glsl::ArgStore UNIQUE(a,__LINE__)(#a, a); inline_glsl::Arg UNIQUE(a##_,__LINE__)(UNIQUE(a, __LINE__), DepthTarget(a))\n// bind_depth(texture)\n#define bind_depth(a) BIND_DEPTH(a)\n\nstatic void useShader(const Shader& compute) {\n inline_glsl::useShader(compute, Shader{}, Shader{}, Shader{}, Shader{}, Shader{}, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, Shader{}, Shader{}, Shader{}, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& geometry, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, geometry, Shader{}, Shader{}, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& control, const Shader& evaluation, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, Shader{}, control, evaluation, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\nstatic void useShader(const Shader& vertex, const Shader& geometry, const Shader& control, const Shader& evaluation, const Shader& fragment) {\n inline_glsl::useShader(Shader{}, vertex, geometry, control, evaluation, fragment, inline_glsl::programs, inline_glsl::shader_state, inline_glsl::store);\n}\n\ninline const Texture<> screen = {};\ninline const Texture<> screen_depth = {};\n"}, {"path": "impl/shader_types.h", "language": "c", "loc": 354, "comment_density": 0.008, "code": "#pragma once\n\n#include \n#include \"gl_helpers.h\"\n\ntemplate\nstruct Image {\n GLuint obj, level, layer;\n Image() : obj(0) { }\n template\n Image(const Texture& t) : obj(t), level(t.level), layer(t.layer) { }\n operator int() { return obj; }\n bool operator !=(const Image& other) {\n return obj != other.obj;\n }\n};\n\n#define IMAGEBASIC(name, sizetype, prefix, ...)\\\ninline sizetype imageSize(prefix##name image) { return {}; }\\\ninline prefix##vec4 imageLoad(prefix##name image, __VA_ARGS__) { return {}; }\\\ninline void imageStore(prefix##name image, __VA_ARGS__, prefix##vec4 data) { }\\\n\n#define IMAGEATOMIC(func, name, ...)\\\ninline int func(i##name, __VA_ARGS__, int data){ return {}; }\\\ninline uint func(u##name, __VA_ARGS__, uint data){ return {}; }\n\n#define IMAGEDEF(name, glenum, sizetype, ...)\\\nusing name = Image < glenum, float>;\\\nusing i ## name = Image < glenum, int>;\\\nusing u ## name = Image < glenum, uint>;\\\nIMAGEBASIC(name, sizetype, , __VA_ARGS__)\\\nIMAGEBASIC(name, sizetype, i, __VA_ARGS__)\\\nIMAGEBASIC(name, sizetype, u, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicAdd, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicMin, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicMax, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicAnd, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicOr, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicXor, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicExchange, name, __VA_ARGS__)\\\nIMAGEATOMIC(imageAtomicCompSwap, name, __VA_ARGS__)\n\nIMAGEDEF(image1D, GL_TEXTURE_1D, int, int P)\nIMAGEDEF(image2D, GL_TEXTURE_2D, ivec2, ivec2 P)\nIMAGEDEF(image3D, GL_TEXTURE_3D, ivec3, ivec3 P)\nIMAGEDEF(imageCube, GL_TEXTURE_CUBE_MAP, ivec2, ivec3 P)\nIMAGEDEF(image2DRect, GL_TEXTURE_RECTANGLE, ivec2, ivec2 P)\nIMAGEDEF(image1DArray, GL_TEXTURE_1D_ARRAY, ivec2, ivec2 P)\nIMAGEDEF(image2DArray, GL_TEXTURE_2D_ARRAY, ivec3, ivec3 P)\nIMAGEDEF(imageCubeArray, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3, ivec3 P)\nIMAGEDEF(imageBuffer, GL_TEXTURE_BUFFER, int, int P)\nIMAGEDEF(image2DMS, GL_TEXTURE_2D_MULTISAMPLE, ivec2, ivec2 P, int sample)\nIMAGEDEF(image2DMSArray, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, ivec3, ivec3 P, int sample)\n\ninline int imageSamples(image2DMS image) { return 0; }\ninline int imageSamples(iimage2DMS image) { return 0; }\ninline int imageSamples(uimage2DMS image) { return 0; }\ninline int imageSamples(image2DMSArray image) { return 0; }\ninline int imageSamples(iimage2DMSArray image) { return 0; }\ninline int imageSamples(uimage2DMSArray image) { return 0; }\n\n#undef IMAGEBASIC\n#undef IMAGEATOMIC\n#undef IMAGEDEF\n\ntemplate\nstruct Sampler {\n GLuint obj;\n Sampler() : obj(0) { }\n Sampler(uint64_t) : obj(0) { }\n template\n Sampler(const Texture& t) : obj(t) {}\n operator int() { return obj; }\n bool operator !=(const Sampler& other) {\n return obj != other.obj;\n }\n};\n\n#define COMMA ,\n\n#define SAMPLEFUNC(func, name, params)\\\ninline vec4 func(name sampler params) {return {};}\\\ninline ivec4 func(i##name sampler params) {return {};}\\\ninline uvec4 func(u##name sampler params) {return {};}\n\n#define TEXFUNC(func, name, params)\\\ninline func(name sampler params) { return {}; }\\\ninline func(i##name sampler params) { return {}; }\\\ninline func(u##name sampler params) { return {}; }\n\n#define MIPPABLE(name, glenum, sizetype)\\\nusing name = Sampler;\\\nusing i ## name= Sampler;\\\nusing u ## name = Sampler;\\\nTEXFUNC(sizetype textureSize, name,COMMA int lod)\\\nTEXFUNC(int textureQueryLevels, name,)\n\n#define UNMIPPABLE(name, glenum, sizetype)\\\nusing name = Sampler;\\\nusing i ## name= Sampler;\\\nusing u ## name = Sampler;\\\nTEXFUNC(sizetype textureSize, name,)\n\nMIPPABLE(sampler1D, GL_TEXTURE_1D, int)\nMIPPABLE(sampler2D, GL_TEXTURE_2D, ivec2)\nMIPPABLE(sampler3D, GL_TEXTURE_3D, ivec3)\nMIPPABLE(samplerCube, GL_TEXTURE_CUBE_MAP, ivec2)\nMIPPABLE(sampler1DArray, GL_TEXTURE_1D_ARRAY, ivec2)\nMIPPABLE(sampler2DArray, GL_TEXTURE_2D_ARRAY, ivec3)\nMIPPABLE(samplerCubeArray, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3)\n\nUNMIPPABLE(sampler2DRect, GL_TEXTURE_RECTANGLE, ivec2)\nUNMIPPABLE(samplerBuffer, GL_TEXTURE_BUFFER, int)\nUNMIPPABLE(sampler2DMS, GL_TEXTURE_2D_MULTISAMPLE, ivec2)\nUNMIPPABLE(sampler2DMSArray, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, ivec3)\n\ninline int textureSamples(sampler2DMS image) { return 0; }\ninline int textureSamples(isampler2DMS image) { return 0; }\ninline int textureSamples(usampler2DMS image) { return 0; }\ninline int textureSamples(sampler2DMSArray image) { return 0; }\ninline int textureSamples(isampler2DMSArray image) { return 0; }\ninline int textureSamples(usampler2DMSArray image) { return 0; }\n\n#define MIPPABLE_SHADOW(name, glenum, sizetype)\\\nusing name = Sampler;\\\ninline sizetype textureSize(name sampler, int lod) {return {};}\\\ninline int textureQueryLevels(name sampler) {return 0;}\n\nMIPPABLE_SHADOW(sampler1DShadow, GL_TEXTURE_1D, int)\nMIPPABLE_SHADOW(sampler2DShadow, GL_TEXTURE_2D, ivec2)\nMIPPABLE_SHADOW(samplerCubeShadow, GL_TEXTURE_CUBE_MAP, ivec2)\nMIPPABLE_SHADOW(sampler1DArrayShadow, GL_TEXTURE_1D_ARRAY, ivec2)\nMIPPABLE_SHADOW(sampler2DArrayShadow, GL_TEXTURE_2D_ARRAY, ivec3)\nMIPPABLE_SHADOW(samplerCubeArrayShadow, GL_TEXTURE_CUBE_MAP_ARRAY, ivec3)\nusing sampler2DRectShadow = Sampler;\ninline ivec2 textureSize(sampler2DRectShadow sampler) { return {}; }\n\n\nSAMPLEFUNC(texelFetch, sampler1D, COMMA int P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2D, COMMA ivec2 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler3D, COMMA ivec3 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2DRect, COMMA ivec2 P)\nSAMPLEFUNC(texelFetch, sampler1DArray, COMMA ivec2 P COMMA int lod)\nSAMPLEFUNC(texelFetch, sampler2DArray, COMMA ivec3 P COMMA int lod)\nSAMPLEFUNC(texelFetch, samplerBuffer, COMMA int P)\nSAMPLEFUNC(texelFetch, sampler2DMS, COMMA ivec2 P COMMA int sample)\nSAMPLEFUNC(texelFetch, sampler2DMSArray, COMMA ivec3 P COMMA int sample)\n\nSAMPLEFUNC(texelFetchOffset, sampler1D, COMMA int P COMMA int lod COMMA int offset)\nSAMPLEFUNC(texelFetchOffset, sampler2D, COMMA ivec2 P COMMA int lod COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler3D, COMMA ivec3 P COMMA int lod COMMA ivec3 offset)\nSAMPLEFUNC(texelFetchOffset, sampler2DRect, COMMA ivec2 P COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler1DArray, COMMA ivec2 P COMMA int lod COMMA ivec2 offset)\nSAMPLEFUNC(texelFetchOffset, sampler2DArray, COMMA ivec3 P COMMA int lod COMMA ivec3 offset)\n\nSAMPLEFUNC(texture, sampler1D, COMMA float P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2D, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler3D, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, samplerCube, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler1DArray, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2DArray, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, samplerCubeArray, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(texture, sampler2DRect, COMMA vec2 P)\ninline float texture(sampler1DShadow sampler, vec3 P, float bias = .0f) { return {}; } // ... why does this take in a vec3???\ninline float texture(sampler2DShadow sampler, vec3 P, float bias = .0f) { return {}; }\ninline float texture(samplerCubeShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float texture(sampler1DArrayShadow sampler, vec3 P, float bias = .0f) { return {}; }\ninline float texture(sampler2DArrayShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float texture(sampler2DRectShadow sampler, vec3 P) { return {}; }\ninline float texture(samplerCubeArrayShadow sampler, vec4 P, float compare) { return {}; }\n\nSAMPLEFUNC(textureGather, sampler2D, COMMA vec2 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, sampler2DArray, COMMA vec3 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, samplerCube, COMMA vec3 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, samplerCubeArray, COMMA vec4 P COMMA int comp = 0)\nSAMPLEFUNC(textureGather, sampler2DRect, COMMA vec2 P COMMA int comp = 0)\ninline float textureGather(sampler2DShadow sampler, vec2 P, float refZ) { return {}; }\ninline float textureGather(sampler2DArrayShadow sampler, vec3 P, float refZ) { return {}; }\ninline float textureGather(samplerCubeShadow sampler, vec3 P, float refZ) { return {}; }\ninline float textureGather(samplerCubeArrayShadow sampler, vec4 P, float refZ) { return {}; }\ninline float textureGather(sampler2DRectShadow sampler, vec2 P, float refZ) { return {}; }\n\nSAMPLEFUNC(textureGatherOffset, sampler2D, COMMA vec2 P COMMA ivec2 offset COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffset, sampler2DArray, COMMA vec3 P COMMA ivec2 offset COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffset, sampler2DRect, COMMA vec2 P COMMA ivec2 offset COMMA int comp = 0)\ninline float textureGatherOffset(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offset) { return {}; }\ninline float textureGatherOffset(sampler2DArrayShadow sampler, vec3 P, float refZ, ivec2 offset) { return {}; }\ninline float textureGatherOffset(sampler2DRectShadow sampler, vec2 P, float refZ, ivec2 offset) { return {}; }\n\n\nSAMPLEFUNC(textureGatherOffsets, sampler2D, COMMA vec2 P COMMA ivec2 offsets[4] COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffsets, sampler2DArray, COMMA vec3 P COMMA ivec2 offsets[4] COMMA int comp = 0)\nSAMPLEFUNC(textureGatherOffsets, sampler2DRect, COMMA vec2 P COMMA ivec2 offsets[4] COMMA int comp = 0)\ninline float textureGatherOffsets(sampler2DShadow sampler, vec2 P, float refZ, ivec2 offsets[4]) { return {}; }\ninline float textureGatherOffsets(sampler2DArrayShadow sampler, vec3 P, float refZ, ivec2 offsets[4]) { return {}; }\ninline float textureGatherOffsets(sampler2DRectShadow sampler, vec2 P, float refZ, ivec2 offsets[4]) { return {}; }\n\nSAMPLEFUNC(textureGrad, sampler1D, COMMA float P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureGrad, sampler2D, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureGrad, sampler3D, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, samplerCube, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, sampler1DArray, COMMA vec2 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureGrad, sampler2DArray, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureGrad, samplerCubeArray, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureGrad, sampler2DRect, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy)\ninline float textureGrad(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy) { return {}; }\ninline float textureGrad(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureGrad(samplerCubeShadow sampler, vec4 P, vec3 dPdx, vec3 dPdy) { return {}; }\ninline float textureGrad(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy) { return {}; }\ninline float textureGrad(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureGrad(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy) { return {}; }\n\nSAMPLEFUNC(textureGradOffset, sampler1D, COMMA float P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureGradOffset, sampler2D, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureGradOffset, sampler3D, COMMA vec3 P COMMA vec3 dPdx COMMA vec3 dPdy COMMA ivec3 offset)\nSAMPLEFUNC(textureGradOffset, sampler1DArray, COMMA vec2 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureGradOffset, sampler2DArray, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureGradOffset, sampler2DRect, COMMA vec2 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\ninline float textureGradOffset(sampler1DShadow sampler, vec3 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureGradOffset(sampler2DShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureGradOffset(sampler1DArrayShadow sampler, vec3 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureGradOffset(sampler2DArrayShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureGradOffset(sampler2DRectShadow sampler, vec3 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureLod, sampler1D, COMMA float P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler2D, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler3D, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, samplerCube, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler1DArray, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureLod, sampler2DArray, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureLod, samplerCubeArray, COMMA vec4 P COMMA float lod)\ninline float textureLod(sampler1DShadow sampler, vec3 P, float lod) { return {}; }\ninline float textureLod(sampler2DShadow sampler, vec3 P, float lod) { return {}; }\ninline float textureLod(sampler1DArrayShadow sampler, vec3 P, float lod) { return {}; }\n\nSAMPLEFUNC(textureLodOffset, sampler1D, COMMA float P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureLodOffset, sampler2D, COMMA vec2 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureLodOffset, sampler3D, COMMA vec3 P COMMA float lod COMMA ivec3 offset)\nSAMPLEFUNC(textureLodOffset, sampler1DArray, COMMA vec2 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureLodOffset, sampler2DArray, COMMA vec3 P COMMA float lod COMMA ivec2 offset)\ninline float textureLodOffset(sampler1DShadow sampler, vec3 P, float lod, int offset) { return {}; }\ninline float textureLodOffset(sampler2DShadow sampler, vec3 P, float lod, ivec2 offset) { return {}; }\ninline float textureLodOffset(sampler1DArrayShadow sampler, vec3 P, float lod, int offset) { return {}; }\n\nSAMPLEFUNC(textureProjLod, sampler1D, COMMA vec2 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler1D, COMMA vec4 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler2D, COMMA vec3 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler2D, COMMA vec4 P COMMA float lod)\nSAMPLEFUNC(textureProjLod, sampler3D, COMMA vec4 P COMMA float lod)\ninline float textureProjLod(sampler1DShadow sampler, vec4 P, float lod) { return {}; }\ninline float textureProjLod(sampler2DShadow sampler, vec4 P, float lod) { return {}; }\n\nSAMPLEFUNC(textureProjLodOffset, sampler1D, COMMA vec2 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureProjLodOffset, sampler1D, COMMA vec4 P COMMA float lod COMMA int offset)\nSAMPLEFUNC(textureProjLodOffset, sampler2D, COMMA vec3 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureProjLodOffset, sampler2D, COMMA vec4 P COMMA float lod COMMA ivec2 offset)\nSAMPLEFUNC(textureProjLodOffset, sampler3D, COMMA vec4 P COMMA float lod COMMA ivec3 offset)\ninline float textureProjLodOffset(sampler1DShadow sampler, vec4 P, float lod, int offset) { return {}; }\ninline float textureProjLodOffset(sampler2DShadow sampler, vec4 P, float lod, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProj, sampler1D, COMMA vec2 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler1D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2D, COMMA vec3 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler3D, COMMA vec4 P COMMA float bias = .0f)\nSAMPLEFUNC(textureProj, sampler2DRect, COMMA vec3 P)\nSAMPLEFUNC(textureProj, sampler2DRect, COMMA vec4 P)\ninline float textureProj(sampler1DShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float textureProj(sampler2DShadow sampler, vec4 P, float bias = .0f) { return {}; }\ninline float textureProj(sampler2DRectShadow sampler, vec4 P) { return {}; }\n\nSAMPLEFUNC(textureOffset, sampler1D, COMMA float P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2D, COMMA vec2 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler3D, COMMA vec3 P COMMA ivec3 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler1DArray, COMMA vec2 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2DArray, COMMA vec3 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureOffset, sampler2DRect, COMMA vec2 P COMMA ivec2 offset)\ninline float textureOffset(sampler1DShadow sampler, vec3 P, int offset, float bias = .0f) { return {}; } // ... why does this take in a vec3???\ninline float textureOffset(sampler2DShadow sampler, vec3 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler2DArrayShadow sampler, vec4 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureOffset(sampler2DRectShadow sampler, vec3 P, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProjGrad, sampler1D, COMMA vec2 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureProjGrad, sampler1D, COMMA vec4 P COMMA float dPdx COMMA float dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2D, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2D, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler3D, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2DRect, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy)\nSAMPLEFUNC(textureProjGrad, sampler2DRect, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy)\ninline float textureProjGrad(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy) { return {}; }\ninline float textureProjGrad(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\ninline float textureProjGrad(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy) { return {}; }\n\nSAMPLEFUNC(textureProjGradOffset, sampler1D, COMMA vec2 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureProjGradOffset, sampler1D, COMMA vec4 P COMMA float dPdx COMMA float dPdy COMMA int offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2D, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2D, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler3D, COMMA vec4 P COMMA vec3 dPdx COMMA vec3 dPdy COMMA ivec3 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2DRect, COMMA vec3 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\nSAMPLEFUNC(textureProjGradOffset, sampler2DRect, COMMA vec4 P COMMA vec2 dPdx COMMA vec2 dPdy COMMA ivec2 offset)\ninline float textureProjGradOffset(sampler1DShadow sampler, vec4 P, float dPdx, float dPdy, int offset) { return {}; }\ninline float textureProjGradOffset(sampler2DShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\ninline float textureProjGradOffset(sampler2DRectShadow sampler, vec4 P, vec2 dPdx, vec2 dPdy, ivec2 offset) { return {}; }\n\nSAMPLEFUNC(textureProjOffset, sampler1D, COMMA vec2 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler1D, COMMA vec4 P COMMA int offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2D, COMMA vec3 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2D, COMMA vec4 P COMMA ivec2 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler3D, COMMA vec4 P COMMA ivec3 offset COMMA float bias = .0f)\nSAMPLEFUNC(textureProjOffset, sampler2DRect, COMMA vec3 P COMMA ivec2 offset)\nSAMPLEFUNC(textureProjOffset, sampler2DRect, COMMA vec4 P COMMA ivec2 offset)\ninline float textureProjOffset(sampler1DShadow sampler, vec4 P, int offset, float bias = .0f) { return {}; }\ninline float textureProjOffset(sampler2DShadow sampler, vec4 P, ivec2 offset, float bias = .0f) { return {}; }\ninline float textureProjOffset(sampler2DRectShadow sampler, vec4 P, ivec2 offset) { return {}; }\n\nTEXFUNC(vec2 textureQueryLod, sampler1D, COMMA float P)\nTEXFUNC(vec2 textureQueryLod, sampler2D, COMMA vec2 P)\nTEXFUNC(vec2 textureQueryLod, sampler3D, COMMA vec3 P)\nTEXFUNC(vec2 textureQueryLod, samplerCube, COMMA vec3 P)\nTEXFUNC(vec2 textureQueryLod, sampler1DArray, COMMA float P)\nTEXFUNC(vec2 textureQueryLod, sampler2DArray, COMMA vec2 P)\nTEXFUNC(vec2 textureQueryLod, samplerCubeArray, COMMA vec3 P)\ninline vec2 textureQueryLod(sampler1DShadow sampler, float P) { return {}; } // ... why does this take in a vec3???\ninline vec2 textureQueryLod(sampler2DShadow sampler, vec2 P) { return {}; }\ninline vec2 textureQueryLod(samplerCubeShadow sampler, vec3 P) { return {}; }\ninline vec2 textureQueryLod(sampler1DArrayShadow sampler, float P) { return {}; }\ninline vec2 textureQueryLod(sampler2DArrayShadow sampler, vec2 P) { return {}; }\ninline vec2 textureQueryLod(samplerCubeArrayShadow sampler, vec3 P) { return {}; }\n\n#undef COMMA\n#undef SAMPLEFUNC\n#undef TEXFUNC\n#undef MIPPABLE\n#undef UNMIPPABLE\n#undef MIPPABLE_SHADOW\n\nstruct Target {\n GLuint obj, level, layer, type;\n Target() : obj(0) {}\n template\n Target(const Texture& t) : obj(t), level(t.level), layer(t.layer), type(t.target) { }\n operator int() { return obj; }\n bool operator !=(const Target& other) {\n return obj != other.obj;\n }\n};\n\nstruct DepthTarget {\n GLuint obj, level, layer, type;\n template\n DepthTarget(const Texture& t) : obj(t), level(t.level), layer(t.layer), type(t.target) { }\n operator int() { return obj; }\n bool operator !=(const DepthTarget& other) {\n return obj != other.obj;\n }\n};\n\nstruct UBO {\n GLuint obj;\n UBO(const Buffer& t) : obj(t) {}\n operator int() { return obj; };\n bool operator!=(const UBO& other) {\n return obj != other.obj;\n }\n};\nstruct SSBO {\n GLuint obj;\n SSBO(const Buffer& t) : obj(t) {}\n operator int() { return obj; };\n bool operator!=(const SSBO& other) {\n return obj != other.obj;\n }\n};\n\ntemplate\nstruct Attribute {\n GLuint obj, stride, offset, type;\n bool normalized;\n Attribute(const Buffer& b, int stride, int offset = 0, GLuint type = -1, bool normalized = false)\n : obj(b), stride(stride), offset(offset), type(type), normalized(normalized)\n {\n if (this->type == -1) {\n if constexpr (glsl::same, float>)\n this->type = GL_FLOAT;\n else if constexpr (glsl::same, int>)\n this->type = GL_INT;\n else if constexpr (glsl::same, uint>)\n this->type = GL_UNSIGNED_INT;\n else\n printf(\"vertex attribute type not given and couldn't be deduced from T in Attribute\\n\");\n }\n }\n\n operator int() { return obj; }\n bool operator!=(const Attribute& other) {\n return obj != other.obj || stride != other.stride || offset != other.offset || type != other.type || normalized != other.normalized;\n }\n};\n"}, {"path": "impl/ssgl.h", "language": "c", "loc": 4, "comment_density": 0.0, "code": "#pragma once\n\n#include \"window.h\"\n#include \"inline_glsl.h\"\n#include \"gl_timing.h\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "MIT", "non_commercial": false, "comment_density": 0.023, "dedup_hash": "9942bbbbbd69206f", "has_readme": true, "build_system": "make", "dependency_count": 31, "has_demo": false} -{"id": "ssgl_utils", "source": "https://github.com/local/ssgl", "source_commit": "4d3f2977620be74782a6523fc950e98c0b7f69bb", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Utils", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "utils/gl_timing.h", "language": "c", "loc": 49, "comment_density": 0.163, "code": "#pragma once\n\n#include \n\n#include \n#include \"glext.h\"\n#include \"loadgl46.h\"\n\n// GPU timing object\nstruct TimeStamp {\n\t// todo: move construct, etc? might want map of string to stamp for global use\n\tGLint64 asynchronous;\n\tGLuint synchronousObject;\n\tmutable GLuint available = GL_FALSE;\n\tmutable GLint64 synchronous;\n\tTimeStamp() {\n\t\t// create GPU query\n\t\tglCreateQueries(GL_TIMESTAMP, 1, &synchronousObject);\n\t\tglQueryCounter(synchronousObject, GL_TIMESTAMP);\n\t\t// query CPU counter directly\n\t\tglGetInteger64v(GL_TIMESTAMP, &asynchronous);\n\t}\n\tvoid check() const {\n\t\twhile (available == GL_FALSE) {\n\t\t\tglGetQueryObjectuiv(synchronousObject, GL_QUERY_RESULT_AVAILABLE, &available);\n\t\t\tif(available == GL_TRUE)\n\t\t\t\tglGetQueryObjecti64v(synchronousObject, GL_QUERY_RESULT, &synchronous);\n\t\t}\n\t}\n\t// latency between CPU call and GPU execution, in ms\n\tdouble latency() const {\n\t\tcheck();\n\t\treturn double(synchronous - asynchronous)*1.0e-6;\n\t}\n\t~TimeStamp() {\n\t\tglDeleteQueries(1, &synchronousObject);\n\t}\n};\n\n// GPU time between two stamps, ms\ninline double operator-(const TimeStamp& end, const TimeStamp& begin) {\n\tbegin.check();\n\tend.check();\n\treturn double(end.synchronous - begin.synchronous)*1.0e-6;\n}\n\n// GPU time between two stamps, ms\ninline double gpuTime(const TimeStamp& begin, const TimeStamp& end) {\n\treturn end - begin;\n}\n\n// CPU-side time between two stamps, ms\ninline double cpuTime(const TimeStamp& begin, const TimeStamp& end) {\n\treturn double(end.asynchronous - begin.asynchronous)*1.0e-6;\n}\n"}, {"path": "utils/glext.h", "language": "c", "loc": 12484, "comment_density": 0.065}, {"path": "utils/loadgl46.cpp", "language": "cpp", "loc": 2312, "comment_density": 0.0}, {"path": "utils/loadgl46.h", "language": "c", "loc": 767, "comment_density": 0.0, "code": "#pragma once\nint loadgl();\nvoid unloadgl();\nextern PFNGLDRAWRANGEELEMENTSPROC ptr_glDrawRangeElements; void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);\nextern PFNGLTEXIMAGE3DPROC ptr_glTexImage3D; void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXSUBIMAGE3DPROC ptr_glTexSubImage3D; void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);\nextern PFNGLCOPYTEXSUBIMAGE3DPROC ptr_glCopyTexSubImage3D; void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLACTIVETEXTUREPROC ptr_glActiveTexture; void glActiveTexture(GLenum texture);\nextern PFNGLSAMPLECOVERAGEPROC ptr_glSampleCoverage; void glSampleCoverage(GLfloat value, GLboolean invert);\nextern PFNGLCOMPRESSEDTEXIMAGE3DPROC ptr_glCompressedTexImage3D; void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXIMAGE2DPROC ptr_glCompressedTexImage2D; void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXIMAGE1DPROC ptr_glCompressedTexImage1D; void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC ptr_glCompressedTexSubImage3D; void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC ptr_glCompressedTexSubImage2D; void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC ptr_glCompressedTexSubImage1D; void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLGETCOMPRESSEDTEXIMAGEPROC ptr_glGetCompressedTexImage; void glGetCompressedTexImage(GLenum target, GLint level, void *img);\nextern PFNGLCLIENTACTIVETEXTUREPROC ptr_glClientActiveTexture; void glClientActiveTexture(GLenum texture);\nextern PFNGLMULTITEXCOORD1DPROC ptr_glMultiTexCoord1d; void glMultiTexCoord1d(GLenum target, GLdouble s);\nextern PFNGLMULTITEXCOORD1DVPROC ptr_glMultiTexCoord1dv; void glMultiTexCoord1dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD1FPROC ptr_glMultiTexCoord1f; void glMultiTexCoord1f(GLenum target, GLfloat s);\nextern PFNGLMULTITEXCOORD1FVPROC ptr_glMultiTexCoord1fv; void glMultiTexCoord1fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD1IPROC ptr_glMultiTexCoord1i; void glMultiTexCoord1i(GLenum target, GLint s);\nextern PFNGLMULTITEXCOORD1IVPROC ptr_glMultiTexCoord1iv; void glMultiTexCoord1iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD1SPROC ptr_glMultiTexCoord1s; void glMultiTexCoord1s(GLenum target, GLshort s);\nextern PFNGLMULTITEXCOORD1SVPROC ptr_glMultiTexCoord1sv; void glMultiTexCoord1sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD2DPROC ptr_glMultiTexCoord2d; void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t);\nextern PFNGLMULTITEXCOORD2DVPROC ptr_glMultiTexCoord2dv; void glMultiTexCoord2dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD2FPROC ptr_glMultiTexCoord2f; void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t);\nextern PFNGLMULTITEXCOORD2FVPROC ptr_glMultiTexCoord2fv; void glMultiTexCoord2fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD2IPROC ptr_glMultiTexCoord2i; void glMultiTexCoord2i(GLenum target, GLint s, GLint t);\nextern PFNGLMULTITEXCOORD2IVPROC ptr_glMultiTexCoord2iv; void glMultiTexCoord2iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD2SPROC ptr_glMultiTexCoord2s; void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t);\nextern PFNGLMULTITEXCOORD2SVPROC ptr_glMultiTexCoord2sv; void glMultiTexCoord2sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD3DPROC ptr_glMultiTexCoord3d; void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r);\nextern PFNGLMULTITEXCOORD3DVPROC ptr_glMultiTexCoord3dv; void glMultiTexCoord3dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD3FPROC ptr_glMultiTexCoord3f; void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r);\nextern PFNGLMULTITEXCOORD3FVPROC ptr_glMultiTexCoord3fv; void glMultiTexCoord3fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD3IPROC ptr_glMultiTexCoord3i; void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r);\nextern PFNGLMULTITEXCOORD3IVPROC ptr_glMultiTexCoord3iv; void glMultiTexCoord3iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD3SPROC ptr_glMultiTexCoord3s; void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r);\nextern PFNGLMULTITEXCOORD3SVPROC ptr_glMultiTexCoord3sv; void glMultiTexCoord3sv(GLenum target, const GLshort *v);\nextern PFNGLMULTITEXCOORD4DPROC ptr_glMultiTexCoord4d; void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\nextern PFNGLMULTITEXCOORD4DVPROC ptr_glMultiTexCoord4dv; void glMultiTexCoord4dv(GLenum target, const GLdouble *v);\nextern PFNGLMULTITEXCOORD4FPROC ptr_glMultiTexCoord4f; void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\nextern PFNGLMULTITEXCOORD4FVPROC ptr_glMultiTexCoord4fv; void glMultiTexCoord4fv(GLenum target, const GLfloat *v);\nextern PFNGLMULTITEXCOORD4IPROC ptr_glMultiTexCoord4i; void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q);\nextern PFNGLMULTITEXCOORD4IVPROC ptr_glMultiTexCoord4iv; void glMultiTexCoord4iv(GLenum target, const GLint *v);\nextern PFNGLMULTITEXCOORD4SPROC ptr_glMultiTexCoord4s; void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\nextern PFNGLMULTITEXCOORD4SVPROC ptr_glMultiTexCoord4sv; void glMultiTexCoord4sv(GLenum target, const GLshort *v);\nextern PFNGLLOADTRANSPOSEMATRIXFPROC ptr_glLoadTransposeMatrixf; void glLoadTransposeMatrixf(const GLfloat *m);\nextern PFNGLLOADTRANSPOSEMATRIXDPROC ptr_glLoadTransposeMatrixd; void glLoadTransposeMatrixd(const GLdouble *m);\nextern PFNGLMULTTRANSPOSEMATRIXFPROC ptr_glMultTransposeMatrixf; void glMultTransposeMatrixf(const GLfloat *m);\nextern PFNGLMULTTRANSPOSEMATRIXDPROC ptr_glMultTransposeMatrixd; void glMultTransposeMatrixd(const GLdouble *m);\nextern PFNGLBLENDFUNCSEPARATEPROC ptr_glBlendFuncSeparate; void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\nextern PFNGLMULTIDRAWARRAYSPROC ptr_glMultiDrawArrays; void glMultiDrawArrays(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\nextern PFNGLMULTIDRAWELEMENTSPROC ptr_glMultiDrawElements; void glMultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);\nextern PFNGLPOINTPARAMETERFPROC ptr_glPointParameterf; void glPointParameterf(GLenum pname, GLfloat param);\nextern PFNGLPOINTPARAMETERFVPROC ptr_glPointParameterfv; void glPointParameterfv(GLenum pname, const GLfloat *params);\nextern PFNGLPOINTPARAMETERIPROC ptr_glPointParameteri; void glPointParameteri(GLenum pname, GLint param);\nextern PFNGLPOINTPARAMETERIVPROC ptr_glPointParameteriv; void glPointParameteriv(GLenum pname, const GLint *params);\nextern PFNGLFOGCOORDFPROC ptr_glFogCoordf; void glFogCoordf(GLfloat coord);\nextern PFNGLFOGCOORDFVPROC ptr_glFogCoordfv; void glFogCoordfv(const GLfloat *coord);\nextern PFNGLFOGCOORDDPROC ptr_glFogCoordd; void glFogCoordd(GLdouble coord);\nextern PFNGLFOGCOORDDVPROC ptr_glFogCoorddv; void glFogCoorddv(const GLdouble *coord);\nextern PFNGLFOGCOORDPOINTERPROC ptr_glFogCoordPointer; void glFogCoordPointer(GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLSECONDARYCOLOR3BPROC ptr_glSecondaryColor3b; void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue);\nextern PFNGLSECONDARYCOLOR3BVPROC ptr_glSecondaryColor3bv; void glSecondaryColor3bv(const GLbyte *v);\nextern PFNGLSECONDARYCOLOR3DPROC ptr_glSecondaryColor3d; void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue);\nextern PFNGLSECONDARYCOLOR3DVPROC ptr_glSecondaryColor3dv; void glSecondaryColor3dv(const GLdouble *v);\nextern PFNGLSECONDARYCOLOR3FPROC ptr_glSecondaryColor3f; void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue);\nextern PFNGLSECONDARYCOLOR3FVPROC ptr_glSecondaryColor3fv; void glSecondaryColor3fv(const GLfloat *v);\nextern PFNGLSECONDARYCOLOR3IPROC ptr_glSecondaryColor3i; void glSecondaryColor3i(GLint red, GLint green, GLint blue);\nextern PFNGLSECONDARYCOLOR3IVPROC ptr_glSecondaryColor3iv; void glSecondaryColor3iv(const GLint *v);\nextern PFNGLSECONDARYCOLOR3SPROC ptr_glSecondaryColor3s; void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue);\nextern PFNGLSECONDARYCOLOR3SVPROC ptr_glSecondaryColor3sv; void glSecondaryColor3sv(const GLshort *v);\nextern PFNGLSECONDARYCOLOR3UBPROC ptr_glSecondaryColor3ub; void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue);\nextern PFNGLSECONDARYCOLOR3UBVPROC ptr_glSecondaryColor3ubv; void glSecondaryColor3ubv(const GLubyte *v);\nextern PFNGLSECONDARYCOLOR3UIPROC ptr_glSecondaryColor3ui; void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue);\nextern PFNGLSECONDARYCOLOR3UIVPROC ptr_glSecondaryColor3uiv; void glSecondaryColor3uiv(const GLuint *v);\nextern PFNGLSECONDARYCOLOR3USPROC ptr_glSecondaryColor3us; void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue);\nextern PFNGLSECONDARYCOLOR3USVPROC ptr_glSecondaryColor3usv; void glSecondaryColor3usv(const GLushort *v);\nextern PFNGLSECONDARYCOLORPOINTERPROC ptr_glSecondaryColorPointer; void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLWINDOWPOS2DPROC ptr_glWindowPos2d; void glWindowPos2d(GLdouble x, GLdouble y);\nextern PFNGLWINDOWPOS2DVPROC ptr_glWindowPos2dv; void glWindowPos2dv(const GLdouble *v);\nextern PFNGLWINDOWPOS2FPROC ptr_glWindowPos2f; void glWindowPos2f(GLfloat x, GLfloat y);\nextern PFNGLWINDOWPOS2FVPROC ptr_glWindowPos2fv; void glWindowPos2fv(const GLfloat *v);\nextern PFNGLWINDOWPOS2IPROC ptr_glWindowPos2i; void glWindowPos2i(GLint x, GLint y);\nextern PFNGLWINDOWPOS2IVPROC ptr_glWindowPos2iv; void glWindowPos2iv(const GLint *v);\nextern PFNGLWINDOWPOS2SPROC ptr_glWindowPos2s; void glWindowPos2s(GLshort x, GLshort y);\nextern PFNGLWINDOWPOS2SVPROC ptr_glWindowPos2sv; void glWindowPos2sv(const GLshort *v);\nextern PFNGLWINDOWPOS3DPROC ptr_glWindowPos3d; void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLWINDOWPOS3DVPROC ptr_glWindowPos3dv; void glWindowPos3dv(const GLdouble *v);\nextern PFNGLWINDOWPOS3FPROC ptr_glWindowPos3f; void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z);\nextern PFNGLWINDOWPOS3FVPROC ptr_glWindowPos3fv; void glWindowPos3fv(const GLfloat *v);\nextern PFNGLWINDOWPOS3IPROC ptr_glWindowPos3i; void glWindowPos3i(GLint x, GLint y, GLint z);\nextern PFNGLWINDOWPOS3IVPROC ptr_glWindowPos3iv; void glWindowPos3iv(const GLint *v);\nextern PFNGLWINDOWPOS3SPROC ptr_glWindowPos3s; void glWindowPos3s(GLshort x, GLshort y, GLshort z);\nextern PFNGLWINDOWPOS3SVPROC ptr_glWindowPos3sv; void glWindowPos3sv(const GLshort *v);\nextern PFNGLBLENDCOLORPROC ptr_glBlendColor; void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nextern PFNGLBLENDEQUATIONPROC ptr_glBlendEquation; void glBlendEquation(GLenum mode);\nextern PFNGLGENQUERIESPROC ptr_glGenQueries; void glGenQueries(GLsizei n, GLuint *ids);\nextern PFNGLDELETEQUERIESPROC ptr_glDeleteQueries; void glDeleteQueries(GLsizei n, const GLuint *ids);\nextern PFNGLISQUERYPROC ptr_glIsQuery; GLboolean glIsQuery(GLuint id);\nextern PFNGLBEGINQUERYPROC ptr_glBeginQuery; void glBeginQuery(GLenum target, GLuint id);\nextern PFNGLENDQUERYPROC ptr_glEndQuery; void glEndQuery(GLenum target);\nextern PFNGLGETQUERYIVPROC ptr_glGetQueryiv; void glGetQueryiv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETQUERYOBJECTIVPROC ptr_glGetQueryObjectiv; void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params);\nextern PFNGLGETQUERYOBJECTUIVPROC ptr_glGetQueryObjectuiv; void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);\nextern PFNGLBINDBUFFERPROC ptr_glBindBuffer; void glBindBuffer(GLenum target, GLuint buffer);\nextern PFNGLDELETEBUFFERSPROC ptr_glDeleteBuffers; void glDeleteBuffers(GLsizei n, const GLuint *buffers);\nextern PFNGLGENBUFFERSPROC ptr_glGenBuffers; void glGenBuffers(GLsizei n, GLuint *buffers);\nextern PFNGLISBUFFERPROC ptr_glIsBuffer; GLboolean glIsBuffer(GLuint buffer);\nextern PFNGLBUFFERDATAPROC ptr_glBufferData; void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);\nextern PFNGLBUFFERSUBDATAPROC ptr_glBufferSubData; void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);\nextern PFNGLGETBUFFERSUBDATAPROC ptr_glGetBufferSubData; void glGetBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void *data);\nextern PFNGLMAPBUFFERPROC ptr_glMapBuffer; void * glMapBuffer(GLenum target, GLenum access);\nextern PFNGLUNMAPBUFFERPROC ptr_glUnmapBuffer; GLboolean glUnmapBuffer(GLenum target);\nextern PFNGLGETBUFFERPARAMETERIVPROC ptr_glGetBufferParameteriv; void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETBUFFERPOINTERVPROC ptr_glGetBufferPointerv; void glGetBufferPointerv(GLenum target, GLenum pname, void **params);\nextern PFNGLBLENDEQUATIONSEPARATEPROC ptr_glBlendEquationSeparate; void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);\nextern PFNGLDRAWBUFFERSPROC ptr_glDrawBuffers; void glDrawBuffers(GLsizei n, const GLenum *bufs);\nextern PFNGLSTENCILOPSEPARATEPROC ptr_glStencilOpSeparate; void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\nextern PFNGLSTENCILFUNCSEPARATEPROC ptr_glStencilFuncSeparate; void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);\nextern PFNGLSTENCILMASKSEPARATEPROC ptr_glStencilMaskSeparate; void glStencilMaskSeparate(GLenum face, GLuint mask);\nextern PFNGLATTACHSHADERPROC ptr_glAttachShader; void glAttachShader(GLuint program, GLuint shader);\nextern PFNGLBINDATTRIBLOCATIONPROC ptr_glBindAttribLocation; void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);\nextern PFNGLCOMPILESHADERPROC ptr_glCompileShader; void glCompileShader(GLuint shader);\nextern PFNGLCREATEPROGRAMPROC ptr_glCreateProgram; GLuint glCreateProgram(void);\nextern PFNGLCREATESHADERPROC ptr_glCreateShader; GLuint glCreateShader(GLenum type);\nextern PFNGLDELETEPROGRAMPROC ptr_glDeleteProgram; void glDeleteProgram(GLuint program);\nextern PFNGLDELETESHADERPROC ptr_glDeleteShader; void glDeleteShader(GLuint shader);\nextern PFNGLDETACHSHADERPROC ptr_glDetachShader; void glDetachShader(GLuint program, GLuint shader);\nextern PFNGLDISABLEVERTEXATTRIBARRAYPROC ptr_glDisableVertexAttribArray; void glDisableVertexAttribArray(GLuint index);\nextern PFNGLENABLEVERTEXATTRIBARRAYPROC ptr_glEnableVertexAttribArray; void glEnableVertexAttribArray(GLuint index);\nextern PFNGLGETACTIVEATTRIBPROC ptr_glGetActiveAttrib; void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\nextern PFNGLGETACTIVEUNIFORMPROC ptr_glGetActiveUniform; void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);\nextern PFNGLGETATTACHEDSHADERSPROC ptr_glGetAttachedShaders; void glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);\nextern PFNGLGETATTRIBLOCATIONPROC ptr_glGetAttribLocation; GLint glGetAttribLocation(GLuint program, const GLchar *name);\nextern PFNGLGETPROGRAMIVPROC ptr_glGetProgramiv; void glGetProgramiv(GLuint program, GLenum pname, GLint *params);\nextern PFNGLGETPROGRAMINFOLOGPROC ptr_glGetProgramInfoLog; void glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLGETSHADERIVPROC ptr_glGetShaderiv; void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);\nextern PFNGLGETSHADERINFOLOGPROC ptr_glGetShaderInfoLog; void glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLGETSHADERSOURCEPROC ptr_glGetShaderSource; void glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);\nextern PFNGLGETUNIFORMLOCATIONPROC ptr_glGetUniformLocation; GLint glGetUniformLocation(GLuint program, const GLchar *name);\nextern PFNGLGETUNIFORMFVPROC ptr_glGetUniformfv; void glGetUniformfv(GLuint program, GLint location, GLfloat *params);\nextern PFNGLGETUNIFORMIVPROC ptr_glGetUniformiv; void glGetUniformiv(GLuint program, GLint location, GLint *params);\nextern PFNGLGETVERTEXATTRIBDVPROC ptr_glGetVertexAttribdv; void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);\nextern PFNGLGETVERTEXATTRIBFVPROC ptr_glGetVertexAttribfv; void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);\nextern PFNGLGETVERTEXATTRIBIVPROC ptr_glGetVertexAttribiv; void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);\nextern PFNGLGETVERTEXATTRIBPOINTERVPROC ptr_glGetVertexAttribPointerv; void glGetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer);\nextern PFNGLISPROGRAMPROC ptr_glIsProgram; GLboolean glIsProgram(GLuint program);\nextern PFNGLISSHADERPROC ptr_glIsShader; GLboolean glIsShader(GLuint shader);\nextern PFNGLLINKPROGRAMPROC ptr_glLinkProgram; void glLinkProgram(GLuint program);\nextern PFNGLSHADERSOURCEPROC ptr_glShaderSource; void glShaderSource(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);\nextern PFNGLUSEPROGRAMPROC ptr_glUseProgram; void glUseProgram(GLuint program);\nextern PFNGLUNIFORM1FPROC ptr_glUniform1f; void glUniform1f(GLint location, GLfloat v0);\nextern PFNGLUNIFORM2FPROC ptr_glUniform2f; void glUniform2f(GLint location, GLfloat v0, GLfloat v1);\nextern PFNGLUNIFORM3FPROC ptr_glUniform3f; void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\nextern PFNGLUNIFORM4FPROC ptr_glUniform4f; void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\nextern PFNGLUNIFORM1IPROC ptr_glUniform1i; void glUniform1i(GLint location, GLint v0);\nextern PFNGLUNIFORM2IPROC ptr_glUniform2i; void glUniform2i(GLint location, GLint v0, GLint v1);\nextern PFNGLUNIFORM3IPROC ptr_glUniform3i; void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);\nextern PFNGLUNIFORM4IPROC ptr_glUniform4i; void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\nextern PFNGLUNIFORM1FVPROC ptr_glUniform1fv; void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM2FVPROC ptr_glUniform2fv; void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM3FVPROC ptr_glUniform3fv; void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM4FVPROC ptr_glUniform4fv; void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLUNIFORM1IVPROC ptr_glUniform1iv; void glUniform1iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM2IVPROC ptr_glUniform2iv; void glUniform2iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM3IVPROC ptr_glUniform3iv; void glUniform3iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORM4IVPROC ptr_glUniform4iv; void glUniform4iv(GLint location, GLsizei count, const GLint *value);\nextern PFNGLUNIFORMMATRIX2FVPROC ptr_glUniformMatrix2fv; void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3FVPROC ptr_glUniformMatrix3fv; void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4FVPROC ptr_glUniformMatrix4fv; void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLVALIDATEPROGRAMPROC ptr_glValidateProgram; void glValidateProgram(GLuint program);\nextern PFNGLVERTEXATTRIB1DPROC ptr_glVertexAttrib1d; void glVertexAttrib1d(GLuint index, GLdouble x);\nextern PFNGLVERTEXATTRIB1DVPROC ptr_glVertexAttrib1dv; void glVertexAttrib1dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB1FPROC ptr_glVertexAttrib1f; void glVertexAttrib1f(GLuint index, GLfloat x);\nextern PFNGLVERTEXATTRIB1FVPROC ptr_glVertexAttrib1fv; void glVertexAttrib1fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB1SPROC ptr_glVertexAttrib1s; void glVertexAttrib1s(GLuint index, GLshort x);\nextern PFNGLVERTEXATTRIB1SVPROC ptr_glVertexAttrib1sv; void glVertexAttrib1sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB2DPROC ptr_glVertexAttrib2d; void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y);\nextern PFNGLVERTEXATTRIB2DVPROC ptr_glVertexAttrib2dv; void glVertexAttrib2dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB2FPROC ptr_glVertexAttrib2f; void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);\nextern PFNGLVERTEXATTRIB2FVPROC ptr_glVertexAttrib2fv; void glVertexAttrib2fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB2SPROC ptr_glVertexAttrib2s; void glVertexAttrib2s(GLuint index, GLshort x, GLshort y);\nextern PFNGLVERTEXATTRIB2SVPROC ptr_glVertexAttrib2sv; void glVertexAttrib2sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB3DPROC ptr_glVertexAttrib3d; void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLVERTEXATTRIB3DVPROC ptr_glVertexAttrib3dv; void glVertexAttrib3dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB3FPROC ptr_glVertexAttrib3f; void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);\nextern PFNGLVERTEXATTRIB3FVPROC ptr_glVertexAttrib3fv; void glVertexAttrib3fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB3SPROC ptr_glVertexAttrib3s; void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z);\nextern PFNGLVERTEXATTRIB3SVPROC ptr_glVertexAttrib3sv; void glVertexAttrib3sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4NBVPROC ptr_glVertexAttrib4Nbv; void glVertexAttrib4Nbv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIB4NIVPROC ptr_glVertexAttrib4Niv; void glVertexAttrib4Niv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIB4NSVPROC ptr_glVertexAttrib4Nsv; void glVertexAttrib4Nsv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4NUBPROC ptr_glVertexAttrib4Nub; void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\nextern PFNGLVERTEXATTRIB4NUBVPROC ptr_glVertexAttrib4Nubv; void glVertexAttrib4Nubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIB4NUIVPROC ptr_glVertexAttrib4Nuiv; void glVertexAttrib4Nuiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIB4NUSVPROC ptr_glVertexAttrib4Nusv; void glVertexAttrib4Nusv(GLuint index, const GLushort *v);\nextern PFNGLVERTEXATTRIB4BVPROC ptr_glVertexAttrib4bv; void glVertexAttrib4bv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIB4DPROC ptr_glVertexAttrib4d; void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLVERTEXATTRIB4DVPROC ptr_glVertexAttrib4dv; void glVertexAttrib4dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIB4FPROC ptr_glVertexAttrib4f; void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nextern PFNGLVERTEXATTRIB4FVPROC ptr_glVertexAttrib4fv; void glVertexAttrib4fv(GLuint index, const GLfloat *v);\nextern PFNGLVERTEXATTRIB4IVPROC ptr_glVertexAttrib4iv; void glVertexAttrib4iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIB4SPROC ptr_glVertexAttrib4s; void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\nextern PFNGLVERTEXATTRIB4SVPROC ptr_glVertexAttrib4sv; void glVertexAttrib4sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIB4UBVPROC ptr_glVertexAttrib4ubv; void glVertexAttrib4ubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIB4UIVPROC ptr_glVertexAttrib4uiv; void glVertexAttrib4uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIB4USVPROC ptr_glVertexAttrib4usv; void glVertexAttrib4usv(GLuint index, const GLushort *v);\nextern PFNGLVERTEXATTRIBPOINTERPROC ptr_glVertexAttribPointer; void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);\nextern PFNGLUNIFORMMATRIX2X3FVPROC ptr_glUniformMatrix2x3fv; void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3X2FVPROC ptr_glUniformMatrix3x2fv; void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX2X4FVPROC ptr_glUniformMatrix2x4fv; void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4X2FVPROC ptr_glUniformMatrix4x2fv; void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX3X4FVPROC ptr_glUniformMatrix3x4fv; void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLUNIFORMMATRIX4X3FVPROC ptr_glUniformMatrix4x3fv; void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLCOLORMASKIPROC ptr_glColorMaski; void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);\nextern PFNGLGETBOOLEANI_VPROC ptr_glGetBooleani_v; void glGetBooleani_v(GLenum target, GLuint index, GLboolean *data);\nextern PFNGLGETINTEGERI_VPROC ptr_glGetIntegeri_v; void glGetIntegeri_v(GLenum target, GLuint index, GLint *data);\nextern PFNGLENABLEIPROC ptr_glEnablei; void glEnablei(GLenum target, GLuint index);\nextern PFNGLDISABLEIPROC ptr_glDisablei; void glDisablei(GLenum target, GLuint index);\nextern PFNGLISENABLEDIPROC ptr_glIsEnabledi; GLboolean glIsEnabledi(GLenum target, GLuint index);\nextern PFNGLBEGINTRANSFORMFEEDBACKPROC ptr_glBeginTransformFeedback; void glBeginTransformFeedback(GLenum primitiveMode);\nextern PFNGLENDTRANSFORMFEEDBACKPROC ptr_glEndTransformFeedback; void glEndTransformFeedback(void);\nextern PFNGLBINDBUFFERRANGEPROC ptr_glBindBufferRange; void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLBINDBUFFERBASEPROC ptr_glBindBufferBase; void glBindBufferBase(GLenum target, GLuint index, GLuint buffer);\nextern PFNGLTRANSFORMFEEDBACKVARYINGSPROC ptr_glTransformFeedbackVaryings; void glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);\nextern PFNGLGETTRANSFORMFEEDBACKVARYINGPROC ptr_glGetTransformFeedbackVarying; void glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);\nextern PFNGLCLAMPCOLORPROC ptr_glClampColor; void glClampColor(GLenum target, GLenum clamp);\nextern PFNGLBEGINCONDITIONALRENDERPROC ptr_glBeginConditionalRender; void glBeginConditionalRender(GLuint id, GLenum mode);\nextern PFNGLENDCONDITIONALRENDERPROC ptr_glEndConditionalRender; void glEndConditionalRender(void);\nextern PFNGLVERTEXATTRIBIPOINTERPROC ptr_glVertexAttribIPointer; void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLGETVERTEXATTRIBIIVPROC ptr_glGetVertexAttribIiv; void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);\nextern PFNGLGETVERTEXATTRIBIUIVPROC ptr_glGetVertexAttribIuiv; void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);\nextern PFNGLVERTEXATTRIBI1IPROC ptr_glVertexAttribI1i; void glVertexAttribI1i(GLuint index, GLint x);\nextern PFNGLVERTEXATTRIBI2IPROC ptr_glVertexAttribI2i; void glVertexAttribI2i(GLuint index, GLint x, GLint y);\nextern PFNGLVERTEXATTRIBI3IPROC ptr_glVertexAttribI3i; void glVertexAttribI3i(GLuint index, GLint x, GLint y, GLint z);\nextern PFNGLVERTEXATTRIBI4IPROC ptr_glVertexAttribI4i; void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);\nextern PFNGLVERTEXATTRIBI1UIPROC ptr_glVertexAttribI1ui; void glVertexAttribI1ui(GLuint index, GLuint x);\nextern PFNGLVERTEXATTRIBI2UIPROC ptr_glVertexAttribI2ui; void glVertexAttribI2ui(GLuint index, GLuint x, GLuint y);\nextern PFNGLVERTEXATTRIBI3UIPROC ptr_glVertexAttribI3ui; void glVertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z);\nextern PFNGLVERTEXATTRIBI4UIPROC ptr_glVertexAttribI4ui; void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);\nextern PFNGLVERTEXATTRIBI1IVPROC ptr_glVertexAttribI1iv; void glVertexAttribI1iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI2IVPROC ptr_glVertexAttribI2iv; void glVertexAttribI2iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI3IVPROC ptr_glVertexAttribI3iv; void glVertexAttribI3iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI4IVPROC ptr_glVertexAttribI4iv; void glVertexAttribI4iv(GLuint index, const GLint *v);\nextern PFNGLVERTEXATTRIBI1UIVPROC ptr_glVertexAttribI1uiv; void glVertexAttribI1uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI2UIVPROC ptr_glVertexAttribI2uiv; void glVertexAttribI2uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI3UIVPROC ptr_glVertexAttribI3uiv; void glVertexAttribI3uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI4UIVPROC ptr_glVertexAttribI4uiv; void glVertexAttribI4uiv(GLuint index, const GLuint *v);\nextern PFNGLVERTEXATTRIBI4BVPROC ptr_glVertexAttribI4bv; void glVertexAttribI4bv(GLuint index, const GLbyte *v);\nextern PFNGLVERTEXATTRIBI4SVPROC ptr_glVertexAttribI4sv; void glVertexAttribI4sv(GLuint index, const GLshort *v);\nextern PFNGLVERTEXATTRIBI4UBVPROC ptr_glVertexAttribI4ubv; void glVertexAttribI4ubv(GLuint index, const GLubyte *v);\nextern PFNGLVERTEXATTRIBI4USVPROC ptr_glVertexAttribI4usv; void glVertexAttribI4usv(GLuint index, const GLushort *v);\nextern PFNGLGETUNIFORMUIVPROC ptr_glGetUniformuiv; void glGetUniformuiv(GLuint program, GLint location, GLuint *params);\nextern PFNGLBINDFRAGDATALOCATIONPROC ptr_glBindFragDataLocation; void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name);\nextern PFNGLGETFRAGDATALOCATIONPROC ptr_glGetFragDataLocation; GLint glGetFragDataLocation(GLuint program, const GLchar *name);\nextern PFNGLUNIFORM1UIPROC ptr_glUniform1ui; void glUniform1ui(GLint location, GLuint v0);\nextern PFNGLUNIFORM2UIPROC ptr_glUniform2ui; void glUniform2ui(GLint location, GLuint v0, GLuint v1);\nextern PFNGLUNIFORM3UIPROC ptr_glUniform3ui; void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);\nextern PFNGLUNIFORM4UIPROC ptr_glUniform4ui; void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\nextern PFNGLUNIFORM1UIVPROC ptr_glUniform1uiv; void glUniform1uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM2UIVPROC ptr_glUniform2uiv; void glUniform2uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM3UIVPROC ptr_glUniform3uiv; void glUniform3uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLUNIFORM4UIVPROC ptr_glUniform4uiv; void glUniform4uiv(GLint location, GLsizei count, const GLuint *value);\nextern PFNGLTEXPARAMETERIIVPROC ptr_glTexParameterIiv; void glTexParameterIiv(GLenum target, GLenum pname, const GLint *params);\nextern PFNGLTEXPARAMETERIUIVPROC ptr_glTexParameterIuiv; void glTexParameterIuiv(GLenum target, GLenum pname, const GLuint *params);\nextern PFNGLGETTEXPARAMETERIIVPROC ptr_glGetTexParameterIiv; void glGetTexParameterIiv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETTEXPARAMETERIUIVPROC ptr_glGetTexParameterIuiv; void glGetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params);\nextern PFNGLCLEARBUFFERIVPROC ptr_glClearBufferiv; void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);\nextern PFNGLCLEARBUFFERUIVPROC ptr_glClearBufferuiv; void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);\nextern PFNGLCLEARBUFFERFVPROC ptr_glClearBufferfv; void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);\nextern PFNGLCLEARBUFFERFIPROC ptr_glClearBufferfi; void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);\nextern PFNGLGETSTRINGIPROC ptr_glGetStringi; const GLubyte * glGetStringi(GLenum name, GLuint index);\nextern PFNGLISRENDERBUFFERPROC ptr_glIsRenderbuffer; GLboolean glIsRenderbuffer(GLuint renderbuffer);\nextern PFNGLBINDRENDERBUFFERPROC ptr_glBindRenderbuffer; void glBindRenderbuffer(GLenum target, GLuint renderbuffer);\nextern PFNGLDELETERENDERBUFFERSPROC ptr_glDeleteRenderbuffers; void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);\nextern PFNGLGENRENDERBUFFERSPROC ptr_glGenRenderbuffers; void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);\nextern PFNGLRENDERBUFFERSTORAGEPROC ptr_glRenderbufferStorage; void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLGETRENDERBUFFERPARAMETERIVPROC ptr_glGetRenderbufferParameteriv; void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLISFRAMEBUFFERPROC ptr_glIsFramebuffer; GLboolean glIsFramebuffer(GLuint framebuffer);\nextern PFNGLBINDFRAMEBUFFERPROC ptr_glBindFramebuffer; void glBindFramebuffer(GLenum target, GLuint framebuffer);\nextern PFNGLDELETEFRAMEBUFFERSPROC ptr_glDeleteFramebuffers; void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);\nextern PFNGLGENFRAMEBUFFERSPROC ptr_glGenFramebuffers; void glGenFramebuffers(GLsizei n, GLuint *framebuffers);\nextern PFNGLCHECKFRAMEBUFFERSTATUSPROC ptr_glCheckFramebufferStatus; GLenum glCheckFramebufferStatus(GLenum target);\nextern PFNGLFRAMEBUFFERTEXTURE1DPROC ptr_glFramebufferTexture1D; void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\nextern PFNGLFRAMEBUFFERTEXTURE2DPROC ptr_glFramebufferTexture2D; void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);\nextern PFNGLFRAMEBUFFERTEXTURE3DPROC ptr_glFramebufferTexture3D; void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);\nextern PFNGLFRAMEBUFFERRENDERBUFFERPROC ptr_glFramebufferRenderbuffer; void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\nextern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC ptr_glGetFramebufferAttachmentParameteriv; void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);\nextern PFNGLGENERATEMIPMAPPROC ptr_glGenerateMipmap; void glGenerateMipmap(GLenum target);\nextern PFNGLBLITFRAMEBUFFERPROC ptr_glBlitFramebuffer; void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\nextern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC ptr_glRenderbufferStorageMultisample; void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLFRAMEBUFFERTEXTURELAYERPROC ptr_glFramebufferTextureLayer; void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);\nextern PFNGLMAPBUFFERRANGEPROC ptr_glMapBufferRange; void * glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);\nextern PFNGLFLUSHMAPPEDBUFFERRANGEPROC ptr_glFlushMappedBufferRange; void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);\nextern PFNGLBINDVERTEXARRAYPROC ptr_glBindVertexArray; void glBindVertexArray(GLuint array);\nextern PFNGLDELETEVERTEXARRAYSPROC ptr_glDeleteVertexArrays; void glDeleteVertexArrays(GLsizei n, const GLuint *arrays);\nextern PFNGLGENVERTEXARRAYSPROC ptr_glGenVertexArrays; void glGenVertexArrays(GLsizei n, GLuint *arrays);\nextern PFNGLISVERTEXARRAYPROC ptr_glIsVertexArray; GLboolean glIsVertexArray(GLuint array);\nextern PFNGLDRAWARRAYSINSTANCEDPROC ptr_glDrawArraysInstanced; void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);\nextern PFNGLDRAWELEMENTSINSTANCEDPROC ptr_glDrawElementsInstanced; void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);\nextern PFNGLTEXBUFFERPROC ptr_glTexBuffer; void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);\nextern PFNGLPRIMITIVERESTARTINDEXPROC ptr_glPrimitiveRestartIndex; void glPrimitiveRestartIndex(GLuint index);\nextern PFNGLCOPYBUFFERSUBDATAPROC ptr_glCopyBufferSubData; void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\nextern PFNGLGETUNIFORMINDICESPROC ptr_glGetUniformIndices; void glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);\nextern PFNGLGETACTIVEUNIFORMSIVPROC ptr_glGetActiveUniformsiv; void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);\nextern PFNGLGETACTIVEUNIFORMNAMEPROC ptr_glGetActiveUniformName; void glGetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);\nextern PFNGLGETUNIFORMBLOCKINDEXPROC ptr_glGetUniformBlockIndex; GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);\nextern PFNGLGETACTIVEUNIFORMBLOCKIVPROC ptr_glGetActiveUniformBlockiv; void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);\nextern PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC ptr_glGetActiveUniformBlockName; void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);\nextern PFNGLUNIFORMBLOCKBINDINGPROC ptr_glUniformBlockBinding; void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);\nextern PFNGLDRAWELEMENTSBASEVERTEXPROC ptr_glDrawElementsBaseVertex; void glDrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);\nextern PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC ptr_glDrawRangeElementsBaseVertex; void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC ptr_glDrawElementsInstancedBaseVertex; void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);\nextern PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC ptr_glMultiDrawElementsBaseVertex; void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);\nextern PFNGLPROVOKINGVERTEXPROC ptr_glProvokingVertex; void glProvokingVertex(GLenum mode);\nextern PFNGLFENCESYNCPROC ptr_glFenceSync; GLsync glFenceSync(GLenum condition, GLbitfield flags);\nextern PFNGLISSYNCPROC ptr_glIsSync; GLboolean glIsSync(GLsync sync);\nextern PFNGLDELETESYNCPROC ptr_glDeleteSync; void glDeleteSync(GLsync sync);\nextern PFNGLCLIENTWAITSYNCPROC ptr_glClientWaitSync; GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);\nextern PFNGLWAITSYNCPROC ptr_glWaitSync; void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);\nextern PFNGLGETINTEGER64VPROC ptr_glGetInteger64v; void glGetInteger64v(GLenum pname, GLint64 *data);\nextern PFNGLGETSYNCIVPROC ptr_glGetSynciv; void glGetSynciv(GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values);\nextern PFNGLGETINTEGER64I_VPROC ptr_glGetInteger64i_v; void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data);\nextern PFNGLGETBUFFERPARAMETERI64VPROC ptr_glGetBufferParameteri64v; void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);\nextern PFNGLFRAMEBUFFERTEXTUREPROC ptr_glFramebufferTexture; void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level);\nextern PFNGLTEXIMAGE2DMULTISAMPLEPROC ptr_glTexImage2DMultisample; void glTexImage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXIMAGE3DMULTISAMPLEPROC ptr_glTexImage3DMultisample; void glTexImage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLGETMULTISAMPLEFVPROC ptr_glGetMultisamplefv; void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);\nextern PFNGLSAMPLEMASKIPROC ptr_glSampleMaski; void glSampleMaski(GLuint maskNumber, GLbitfield mask);\nextern PFNGLBINDFRAGDATALOCATIONINDEXEDPROC ptr_glBindFragDataLocationIndexed; void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);\nextern PFNGLGETFRAGDATAINDEXPROC ptr_glGetFragDataIndex; GLint glGetFragDataIndex(GLuint program, const GLchar *name);\nextern PFNGLGENSAMPLERSPROC ptr_glGenSamplers; void glGenSamplers(GLsizei count, GLuint *samplers);\nextern PFNGLDELETESAMPLERSPROC ptr_glDeleteSamplers; void glDeleteSamplers(GLsizei count, const GLuint *samplers);\nextern PFNGLISSAMPLERPROC ptr_glIsSampler; GLboolean glIsSampler(GLuint sampler);\nextern PFNGLBINDSAMPLERPROC ptr_glBindSampler; void glBindSampler(GLuint unit, GLuint sampler);\nextern PFNGLSAMPLERPARAMETERIPROC ptr_glSamplerParameteri; void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);\nextern PFNGLSAMPLERPARAMETERIVPROC ptr_glSamplerParameteriv; void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);\nextern PFNGLSAMPLERPARAMETERFPROC ptr_glSamplerParameterf; void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);\nextern PFNGLSAMPLERPARAMETERFVPROC ptr_glSamplerParameterfv; void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);\nextern PFNGLSAMPLERPARAMETERIIVPROC ptr_glSamplerParameterIiv; void glSamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param);\nextern PFNGLSAMPLERPARAMETERIUIVPROC ptr_glSamplerParameterIuiv; void glSamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param);\nextern PFNGLGETSAMPLERPARAMETERIVPROC ptr_glGetSamplerParameteriv; void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);\nextern PFNGLGETSAMPLERPARAMETERIIVPROC ptr_glGetSamplerParameterIiv; void glGetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params);\nextern PFNGLGETSAMPLERPARAMETERFVPROC ptr_glGetSamplerParameterfv; void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);\nextern PFNGLGETSAMPLERPARAMETERIUIVPROC ptr_glGetSamplerParameterIuiv; void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);\nextern PFNGLQUERYCOUNTERPROC ptr_glQueryCounter; void glQueryCounter(GLuint id, GLenum target);\nextern PFNGLGETQUERYOBJECTI64VPROC ptr_glGetQueryObjecti64v; void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);\nextern PFNGLGETQUERYOBJECTUI64VPROC ptr_glGetQueryObjectui64v; void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);\nextern PFNGLVERTEXATTRIBDIVISORPROC ptr_glVertexAttribDivisor; void glVertexAttribDivisor(GLuint index, GLuint divisor);\nextern PFNGLVERTEXATTRIBP1UIPROC ptr_glVertexAttribP1ui; void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP1UIVPROC ptr_glVertexAttribP1uiv; void glVertexAttribP1uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP2UIPROC ptr_glVertexAttribP2ui; void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP2UIVPROC ptr_glVertexAttribP2uiv; void glVertexAttribP2uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP3UIPROC ptr_glVertexAttribP3ui; void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP3UIVPROC ptr_glVertexAttribP3uiv; void glVertexAttribP3uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXATTRIBP4UIPROC ptr_glVertexAttribP4ui; void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);\nextern PFNGLVERTEXATTRIBP4UIVPROC ptr_glVertexAttribP4uiv; void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);\nextern PFNGLVERTEXP2UIPROC ptr_glVertexP2ui; void glVertexP2ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP2UIVPROC ptr_glVertexP2uiv; void glVertexP2uiv(GLenum type, const GLuint *value);\nextern PFNGLVERTEXP3UIPROC ptr_glVertexP3ui; void glVertexP3ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP3UIVPROC ptr_glVertexP3uiv; void glVertexP3uiv(GLenum type, const GLuint *value);\nextern PFNGLVERTEXP4UIPROC ptr_glVertexP4ui; void glVertexP4ui(GLenum type, GLuint value);\nextern PFNGLVERTEXP4UIVPROC ptr_glVertexP4uiv; void glVertexP4uiv(GLenum type, const GLuint *value);\nextern PFNGLTEXCOORDP1UIPROC ptr_glTexCoordP1ui; void glTexCoordP1ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP1UIVPROC ptr_glTexCoordP1uiv; void glTexCoordP1uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP2UIPROC ptr_glTexCoordP2ui; void glTexCoordP2ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP2UIVPROC ptr_glTexCoordP2uiv; void glTexCoordP2uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP3UIPROC ptr_glTexCoordP3ui; void glTexCoordP3ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP3UIVPROC ptr_glTexCoordP3uiv; void glTexCoordP3uiv(GLenum type, const GLuint *coords);\nextern PFNGLTEXCOORDP4UIPROC ptr_glTexCoordP4ui; void glTexCoordP4ui(GLenum type, GLuint coords);\nextern PFNGLTEXCOORDP4UIVPROC ptr_glTexCoordP4uiv; void glTexCoordP4uiv(GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP1UIPROC ptr_glMultiTexCoordP1ui; void glMultiTexCoordP1ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP1UIVPROC ptr_glMultiTexCoordP1uiv; void glMultiTexCoordP1uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP2UIPROC ptr_glMultiTexCoordP2ui; void glMultiTexCoordP2ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP2UIVPROC ptr_glMultiTexCoordP2uiv; void glMultiTexCoordP2uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP3UIPROC ptr_glMultiTexCoordP3ui; void glMultiTexCoordP3ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP3UIVPROC ptr_glMultiTexCoordP3uiv; void glMultiTexCoordP3uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLMULTITEXCOORDP4UIPROC ptr_glMultiTexCoordP4ui; void glMultiTexCoordP4ui(GLenum texture, GLenum type, GLuint coords);\nextern PFNGLMULTITEXCOORDP4UIVPROC ptr_glMultiTexCoordP4uiv; void glMultiTexCoordP4uiv(GLenum texture, GLenum type, const GLuint *coords);\nextern PFNGLNORMALP3UIPROC ptr_glNormalP3ui; void glNormalP3ui(GLenum type, GLuint coords);\nextern PFNGLNORMALP3UIVPROC ptr_glNormalP3uiv; void glNormalP3uiv(GLenum type, const GLuint *coords);\nextern PFNGLCOLORP3UIPROC ptr_glColorP3ui; void glColorP3ui(GLenum type, GLuint color);\nextern PFNGLCOLORP3UIVPROC ptr_glColorP3uiv; void glColorP3uiv(GLenum type, const GLuint *color);\nextern PFNGLCOLORP4UIPROC ptr_glColorP4ui; void glColorP4ui(GLenum type, GLuint color);\nextern PFNGLCOLORP4UIVPROC ptr_glColorP4uiv; void glColorP4uiv(GLenum type, const GLuint *color);\nextern PFNGLSECONDARYCOLORP3UIPROC ptr_glSecondaryColorP3ui; void glSecondaryColorP3ui(GLenum type, GLuint color);\nextern PFNGLSECONDARYCOLORP3UIVPROC ptr_glSecondaryColorP3uiv; void glSecondaryColorP3uiv(GLenum type, const GLuint *color);\nextern PFNGLMINSAMPLESHADINGPROC ptr_glMinSampleShading; void glMinSampleShading(GLfloat value);\nextern PFNGLBLENDEQUATIONIPROC ptr_glBlendEquationi; void glBlendEquationi(GLuint buf, GLenum mode);\nextern PFNGLBLENDEQUATIONSEPARATEIPROC ptr_glBlendEquationSeparatei; void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha);\nextern PFNGLBLENDFUNCIPROC ptr_glBlendFunci; void glBlendFunci(GLuint buf, GLenum src, GLenum dst);\nextern PFNGLBLENDFUNCSEPARATEIPROC ptr_glBlendFuncSeparatei; void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);\nextern PFNGLDRAWARRAYSINDIRECTPROC ptr_glDrawArraysIndirect; void glDrawArraysIndirect(GLenum mode, const void *indirect);\nextern PFNGLDRAWELEMENTSINDIRECTPROC ptr_glDrawElementsIndirect; void glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect);\nextern PFNGLUNIFORM1DPROC ptr_glUniform1d; void glUniform1d(GLint location, GLdouble x);\nextern PFNGLUNIFORM2DPROC ptr_glUniform2d; void glUniform2d(GLint location, GLdouble x, GLdouble y);\nextern PFNGLUNIFORM3DPROC ptr_glUniform3d; void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLUNIFORM4DPROC ptr_glUniform4d; void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLUNIFORM1DVPROC ptr_glUniform1dv; void glUniform1dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM2DVPROC ptr_glUniform2dv; void glUniform2dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM3DVPROC ptr_glUniform3dv; void glUniform3dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORM4DVPROC ptr_glUniform4dv; void glUniform4dv(GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2DVPROC ptr_glUniformMatrix2dv; void glUniformMatrix2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3DVPROC ptr_glUniformMatrix3dv; void glUniformMatrix3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4DVPROC ptr_glUniformMatrix4dv; void glUniformMatrix4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2X3DVPROC ptr_glUniformMatrix2x3dv; void glUniformMatrix2x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX2X4DVPROC ptr_glUniformMatrix2x4dv; void glUniformMatrix2x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3X2DVPROC ptr_glUniformMatrix3x2dv; void glUniformMatrix3x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX3X4DVPROC ptr_glUniformMatrix3x4dv; void glUniformMatrix3x4dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4X2DVPROC ptr_glUniformMatrix4x2dv; void glUniformMatrix4x2dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLUNIFORMMATRIX4X3DVPROC ptr_glUniformMatrix4x3dv; void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLGETUNIFORMDVPROC ptr_glGetUniformdv; void glGetUniformdv(GLuint program, GLint location, GLdouble *params);\nextern PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC ptr_glGetSubroutineUniformLocation; GLint glGetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name);\nextern PFNGLGETSUBROUTINEINDEXPROC ptr_glGetSubroutineIndex; GLuint glGetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name);\nextern PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC ptr_glGetActiveSubroutineUniformiv; void glGetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);\nextern PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC ptr_glGetActiveSubroutineUniformName; void glGetActiveSubroutineUniformName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLGETACTIVESUBROUTINENAMEPROC ptr_glGetActiveSubroutineName; void glGetActiveSubroutineName(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLUNIFORMSUBROUTINESUIVPROC ptr_glUniformSubroutinesuiv; void glUniformSubroutinesuiv(GLenum shadertype, GLsizei count, const GLuint *indices);\nextern PFNGLGETUNIFORMSUBROUTINEUIVPROC ptr_glGetUniformSubroutineuiv; void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);\nextern PFNGLGETPROGRAMSTAGEIVPROC ptr_glGetProgramStageiv; void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);\nextern PFNGLPATCHPARAMETERIPROC ptr_glPatchParameteri; void glPatchParameteri(GLenum pname, GLint value);\nextern PFNGLPATCHPARAMETERFVPROC ptr_glPatchParameterfv; void glPatchParameterfv(GLenum pname, const GLfloat *values);\nextern PFNGLBINDTRANSFORMFEEDBACKPROC ptr_glBindTransformFeedback; void glBindTransformFeedback(GLenum target, GLuint id);\nextern PFNGLDELETETRANSFORMFEEDBACKSPROC ptr_glDeleteTransformFeedbacks; void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids);\nextern PFNGLGENTRANSFORMFEEDBACKSPROC ptr_glGenTransformFeedbacks; void glGenTransformFeedbacks(GLsizei n, GLuint *ids);\nextern PFNGLISTRANSFORMFEEDBACKPROC ptr_glIsTransformFeedback; GLboolean glIsTransformFeedback(GLuint id);\nextern PFNGLPAUSETRANSFORMFEEDBACKPROC ptr_glPauseTransformFeedback; void glPauseTransformFeedback(void);\nextern PFNGLRESUMETRANSFORMFEEDBACKPROC ptr_glResumeTransformFeedback; void glResumeTransformFeedback(void);\nextern PFNGLDRAWTRANSFORMFEEDBACKPROC ptr_glDrawTransformFeedback; void glDrawTransformFeedback(GLenum mode, GLuint id);\nextern PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC ptr_glDrawTransformFeedbackStream; void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream);\nextern PFNGLBEGINQUERYINDEXEDPROC ptr_glBeginQueryIndexed; void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id);\nextern PFNGLENDQUERYINDEXEDPROC ptr_glEndQueryIndexed; void glEndQueryIndexed(GLenum target, GLuint index);\nextern PFNGLGETQUERYINDEXEDIVPROC ptr_glGetQueryIndexediv; void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);\nextern PFNGLRELEASESHADERCOMPILERPROC ptr_glReleaseShaderCompiler; void glReleaseShaderCompiler(void);\nextern PFNGLSHADERBINARYPROC ptr_glShaderBinary; void glShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length);\nextern PFNGLGETSHADERPRECISIONFORMATPROC ptr_glGetShaderPrecisionFormat; void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);\nextern PFNGLDEPTHRANGEFPROC ptr_glDepthRangef; void glDepthRangef(GLfloat n, GLfloat f);\nextern PFNGLCLEARDEPTHFPROC ptr_glClearDepthf; void glClearDepthf(GLfloat d);\nextern PFNGLGETPROGRAMBINARYPROC ptr_glGetProgramBinary; void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);\nextern PFNGLPROGRAMBINARYPROC ptr_glProgramBinary; void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);\nextern PFNGLPROGRAMPARAMETERIPROC ptr_glProgramParameteri; void glProgramParameteri(GLuint program, GLenum pname, GLint value);\nextern PFNGLUSEPROGRAMSTAGESPROC ptr_glUseProgramStages; void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);\nextern PFNGLACTIVESHADERPROGRAMPROC ptr_glActiveShaderProgram; void glActiveShaderProgram(GLuint pipeline, GLuint program);\nextern PFNGLCREATESHADERPROGRAMVPROC ptr_glCreateShaderProgramv; GLuint glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const*strings);\nextern PFNGLBINDPROGRAMPIPELINEPROC ptr_glBindProgramPipeline; void glBindProgramPipeline(GLuint pipeline);\nextern PFNGLDELETEPROGRAMPIPELINESPROC ptr_glDeleteProgramPipelines; void glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines);\nextern PFNGLGENPROGRAMPIPELINESPROC ptr_glGenProgramPipelines; void glGenProgramPipelines(GLsizei n, GLuint *pipelines);\nextern PFNGLISPROGRAMPIPELINEPROC ptr_glIsProgramPipeline; GLboolean glIsProgramPipeline(GLuint pipeline);\nextern PFNGLGETPROGRAMPIPELINEIVPROC ptr_glGetProgramPipelineiv; void glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);\nextern PFNGLPROGRAMUNIFORM1IPROC ptr_glProgramUniform1i; void glProgramUniform1i(GLuint program, GLint location, GLint v0);\nextern PFNGLPROGRAMUNIFORM1IVPROC ptr_glProgramUniform1iv; void glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM1FPROC ptr_glProgramUniform1f; void glProgramUniform1f(GLuint program, GLint location, GLfloat v0);\nextern PFNGLPROGRAMUNIFORM1FVPROC ptr_glProgramUniform1fv; void glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM1DPROC ptr_glProgramUniform1d; void glProgramUniform1d(GLuint program, GLint location, GLdouble v0);\nextern PFNGLPROGRAMUNIFORM1DVPROC ptr_glProgramUniform1dv; void glProgramUniform1dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM1UIPROC ptr_glProgramUniform1ui; void glProgramUniform1ui(GLuint program, GLint location, GLuint v0);\nextern PFNGLPROGRAMUNIFORM1UIVPROC ptr_glProgramUniform1uiv; void glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM2IPROC ptr_glProgramUniform2i; void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1);\nextern PFNGLPROGRAMUNIFORM2IVPROC ptr_glProgramUniform2iv; void glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM2FPROC ptr_glProgramUniform2f; void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);\nextern PFNGLPROGRAMUNIFORM2FVPROC ptr_glProgramUniform2fv; void glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM2DPROC ptr_glProgramUniform2d; void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1);\nextern PFNGLPROGRAMUNIFORM2DVPROC ptr_glProgramUniform2dv; void glProgramUniform2dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM2UIPROC ptr_glProgramUniform2ui; void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);\nextern PFNGLPROGRAMUNIFORM2UIVPROC ptr_glProgramUniform2uiv; void glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM3IPROC ptr_glProgramUniform3i; void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);\nextern PFNGLPROGRAMUNIFORM3IVPROC ptr_glProgramUniform3iv; void glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM3FPROC ptr_glProgramUniform3f; void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\nextern PFNGLPROGRAMUNIFORM3FVPROC ptr_glProgramUniform3fv; void glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM3DPROC ptr_glProgramUniform3d; void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);\nextern PFNGLPROGRAMUNIFORM3DVPROC ptr_glProgramUniform3dv; void glProgramUniform3dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM3UIPROC ptr_glProgramUniform3ui; void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);\nextern PFNGLPROGRAMUNIFORM3UIVPROC ptr_glProgramUniform3uiv; void glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORM4IPROC ptr_glProgramUniform4i; void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\nextern PFNGLPROGRAMUNIFORM4IVPROC ptr_glProgramUniform4iv; void glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);\nextern PFNGLPROGRAMUNIFORM4FPROC ptr_glProgramUniform4f; void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\nextern PFNGLPROGRAMUNIFORM4FVPROC ptr_glProgramUniform4fv; void glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORM4DPROC ptr_glProgramUniform4d; void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);\nextern PFNGLPROGRAMUNIFORM4DVPROC ptr_glProgramUniform4dv; void glProgramUniform4dv(GLuint program, GLint location, GLsizei count, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORM4UIPROC ptr_glProgramUniform4ui; void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);\nextern PFNGLPROGRAMUNIFORM4UIVPROC ptr_glProgramUniform4uiv; void glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2FVPROC ptr_glProgramUniformMatrix2fv; void glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3FVPROC ptr_glProgramUniformMatrix3fv; void glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4FVPROC ptr_glProgramUniformMatrix4fv; void glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2DVPROC ptr_glProgramUniformMatrix2dv; void glProgramUniformMatrix2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3DVPROC ptr_glProgramUniformMatrix3dv; void glProgramUniformMatrix3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4DVPROC ptr_glProgramUniformMatrix4dv; void glProgramUniformMatrix4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC ptr_glProgramUniformMatrix2x3fv; void glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC ptr_glProgramUniformMatrix3x2fv; void glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC ptr_glProgramUniformMatrix2x4fv; void glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC ptr_glProgramUniformMatrix4x2fv; void glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC ptr_glProgramUniformMatrix3x4fv; void glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC ptr_glProgramUniformMatrix4x3fv; void glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC ptr_glProgramUniformMatrix2x3dv; void glProgramUniformMatrix2x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC ptr_glProgramUniformMatrix3x2dv; void glProgramUniformMatrix3x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC ptr_glProgramUniformMatrix2x4dv; void glProgramUniformMatrix2x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC ptr_glProgramUniformMatrix4x2dv; void glProgramUniformMatrix4x2dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC ptr_glProgramUniformMatrix3x4dv; void glProgramUniformMatrix3x4dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC ptr_glProgramUniformMatrix4x3dv; void glProgramUniformMatrix4x3dv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);\nextern PFNGLVALIDATEPROGRAMPIPELINEPROC ptr_glValidateProgramPipeline; void glValidateProgramPipeline(GLuint pipeline);\nextern PFNGLGETPROGRAMPIPELINEINFOLOGPROC ptr_glGetProgramPipelineInfoLog; void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);\nextern PFNGLVERTEXATTRIBL1DPROC ptr_glVertexAttribL1d; void glVertexAttribL1d(GLuint index, GLdouble x);\nextern PFNGLVERTEXATTRIBL2DPROC ptr_glVertexAttribL2d; void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y);\nextern PFNGLVERTEXATTRIBL3DPROC ptr_glVertexAttribL3d; void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z);\nextern PFNGLVERTEXATTRIBL4DPROC ptr_glVertexAttribL4d; void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nextern PFNGLVERTEXATTRIBL1DVPROC ptr_glVertexAttribL1dv; void glVertexAttribL1dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL2DVPROC ptr_glVertexAttribL2dv; void glVertexAttribL2dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL3DVPROC ptr_glVertexAttribL3dv; void glVertexAttribL3dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBL4DVPROC ptr_glVertexAttribL4dv; void glVertexAttribL4dv(GLuint index, const GLdouble *v);\nextern PFNGLVERTEXATTRIBLPOINTERPROC ptr_glVertexAttribLPointer; void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);\nextern PFNGLGETVERTEXATTRIBLDVPROC ptr_glGetVertexAttribLdv; void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);\nextern PFNGLVIEWPORTARRAYVPROC ptr_glViewportArrayv; void glViewportArrayv(GLuint first, GLsizei count, const GLfloat *v);\nextern PFNGLVIEWPORTINDEXEDFPROC ptr_glViewportIndexedf; void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);\nextern PFNGLVIEWPORTINDEXEDFVPROC ptr_glViewportIndexedfv; void glViewportIndexedfv(GLuint index, const GLfloat *v);\nextern PFNGLSCISSORARRAYVPROC ptr_glScissorArrayv; void glScissorArrayv(GLuint first, GLsizei count, const GLint *v);\nextern PFNGLSCISSORINDEXEDPROC ptr_glScissorIndexed; void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);\nextern PFNGLSCISSORINDEXEDVPROC ptr_glScissorIndexedv; void glScissorIndexedv(GLuint index, const GLint *v);\nextern PFNGLDEPTHRANGEARRAYVPROC ptr_glDepthRangeArrayv; void glDepthRangeArrayv(GLuint first, GLsizei count, const GLdouble *v);\nextern PFNGLDEPTHRANGEINDEXEDPROC ptr_glDepthRangeIndexed; void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f);\nextern PFNGLGETFLOATI_VPROC ptr_glGetFloati_v; void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);\nextern PFNGLGETDOUBLEI_VPROC ptr_glGetDoublei_v; void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);\nextern PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC ptr_glDrawArraysInstancedBaseInstance; void glDrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC ptr_glDrawElementsInstancedBaseInstance; void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);\nextern PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC ptr_glDrawElementsInstancedBaseVertexBaseInstance; void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);\nextern PFNGLGETINTERNALFORMATIVPROC ptr_glGetInternalformativ; void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params);\nextern PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC ptr_glGetActiveAtomicCounterBufferiv; void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);\nextern PFNGLBINDIMAGETEXTUREPROC ptr_glBindImageTexture; void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);\nextern PFNGLMEMORYBARRIERPROC ptr_glMemoryBarrier; void glMemoryBarrier(GLbitfield barriers);\nextern PFNGLTEXSTORAGE1DPROC ptr_glTexStorage1D; void glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);\nextern PFNGLTEXSTORAGE2DPROC ptr_glTexStorage2D; void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLTEXSTORAGE3DPROC ptr_glTexStorage3D; void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC ptr_glDrawTransformFeedbackInstanced; void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);\nextern PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC ptr_glDrawTransformFeedbackStreamInstanced; void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);\nextern PFNGLCLEARBUFFERDATAPROC ptr_glClearBufferData; void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARBUFFERSUBDATAPROC ptr_glClearBufferSubData; void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);\nextern PFNGLDISPATCHCOMPUTEPROC ptr_glDispatchCompute; void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);\nextern PFNGLDISPATCHCOMPUTEINDIRECTPROC ptr_glDispatchComputeIndirect; void glDispatchComputeIndirect(GLintptr indirect);\nextern PFNGLCOPYIMAGESUBDATAPROC ptr_glCopyImageSubData; void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);\nextern PFNGLFRAMEBUFFERPARAMETERIPROC ptr_glFramebufferParameteri; void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);\nextern PFNGLGETFRAMEBUFFERPARAMETERIVPROC ptr_glGetFramebufferParameteriv; void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);\nextern PFNGLGETINTERNALFORMATI64VPROC ptr_glGetInternalformati64v; void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 *params);\nextern PFNGLINVALIDATETEXSUBIMAGEPROC ptr_glInvalidateTexSubImage; void glInvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLINVALIDATETEXIMAGEPROC ptr_glInvalidateTexImage; void glInvalidateTexImage(GLuint texture, GLint level);\nextern PFNGLINVALIDATEBUFFERSUBDATAPROC ptr_glInvalidateBufferSubData; void glInvalidateBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr length);\nextern PFNGLINVALIDATEBUFFERDATAPROC ptr_glInvalidateBufferData; void glInvalidateBufferData(GLuint buffer);\nextern PFNGLINVALIDATEFRAMEBUFFERPROC ptr_glInvalidateFramebuffer; void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);\nextern PFNGLINVALIDATESUBFRAMEBUFFERPROC ptr_glInvalidateSubFramebuffer; void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLMULTIDRAWARRAYSINDIRECTPROC ptr_glMultiDrawArraysIndirect; void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);\nextern PFNGLMULTIDRAWELEMENTSINDIRECTPROC ptr_glMultiDrawElementsIndirect; void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);\nextern PFNGLGETPROGRAMINTERFACEIVPROC ptr_glGetProgramInterfaceiv; void glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint *params);\nextern PFNGLGETPROGRAMRESOURCEINDEXPROC ptr_glGetProgramResourceIndex; GLuint glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLGETPROGRAMRESOURCENAMEPROC ptr_glGetProgramResourceName; void glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);\nextern PFNGLGETPROGRAMRESOURCEIVPROC ptr_glGetProgramResourceiv; void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei count, GLsizei *length, GLint *params);\nextern PFNGLGETPROGRAMRESOURCELOCATIONPROC ptr_glGetProgramResourceLocation; GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC ptr_glGetProgramResourceLocationIndex; GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);\nextern PFNGLSHADERSTORAGEBLOCKBINDINGPROC ptr_glShaderStorageBlockBinding; void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);\nextern PFNGLTEXBUFFERRANGEPROC ptr_glTexBufferRange; void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLTEXSTORAGE2DMULTISAMPLEPROC ptr_glTexStorage2DMultisample; void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXSTORAGE3DMULTISAMPLEPROC ptr_glTexStorage3DMultisample; void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLTEXTUREVIEWPROC ptr_glTextureView; void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);\nextern PFNGLBINDVERTEXBUFFERPROC ptr_glBindVertexBuffer; void glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\nextern PFNGLVERTEXATTRIBFORMATPROC ptr_glVertexAttribFormat; void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBIFORMATPROC ptr_glVertexAttribIFormat; void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBLFORMATPROC ptr_glVertexAttribLFormat; void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXATTRIBBINDINGPROC ptr_glVertexAttribBinding; void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);\nextern PFNGLVERTEXBINDINGDIVISORPROC ptr_glVertexBindingDivisor; void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);\nextern PFNGLDEBUGMESSAGECONTROLPROC ptr_glDebugMessageControl; void glDebugMessageControl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);\nextern PFNGLDEBUGMESSAGEINSERTPROC ptr_glDebugMessageInsert; void glDebugMessageInsert(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);\nextern PFNGLDEBUGMESSAGECALLBACKPROC ptr_glDebugMessageCallback; void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);\nextern PFNGLGETDEBUGMESSAGELOGPROC ptr_glGetDebugMessageLog; GLuint glGetDebugMessageLog(GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);\nextern PFNGLPUSHDEBUGGROUPPROC ptr_glPushDebugGroup; void glPushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message);\nextern PFNGLPOPDEBUGGROUPPROC ptr_glPopDebugGroup; void glPopDebugGroup(void);\nextern PFNGLOBJECTLABELPROC ptr_glObjectLabel; void glObjectLabel(GLenum identifier, GLuint name, GLsizei length, const GLchar *label);\nextern PFNGLGETOBJECTLABELPROC ptr_glGetObjectLabel; void glGetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);\nextern PFNGLOBJECTPTRLABELPROC ptr_glObjectPtrLabel; void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);\nextern PFNGLGETOBJECTPTRLABELPROC ptr_glGetObjectPtrLabel; void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);\nextern PFNGLBUFFERSTORAGEPROC ptr_glBufferStorage; void glBufferStorage(GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);\nextern PFNGLCLEARTEXIMAGEPROC ptr_glClearTexImage; void glClearTexImage(GLuint texture, GLint level, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARTEXSUBIMAGEPROC ptr_glClearTexSubImage; void glClearTexSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);\nextern PFNGLBINDBUFFERSBASEPROC ptr_glBindBuffersBase; void glBindBuffersBase(GLenum target, GLuint first, GLsizei count, const GLuint *buffers);\nextern PFNGLBINDBUFFERSRANGEPROC ptr_glBindBuffersRange; void glBindBuffersRange(GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);\nextern PFNGLBINDTEXTURESPROC ptr_glBindTextures; void glBindTextures(GLuint first, GLsizei count, const GLuint *textures);\nextern PFNGLBINDSAMPLERSPROC ptr_glBindSamplers; void glBindSamplers(GLuint first, GLsizei count, const GLuint *samplers);\nextern PFNGLBINDIMAGETEXTURESPROC ptr_glBindImageTextures; void glBindImageTextures(GLuint first, GLsizei count, const GLuint *textures);\nextern PFNGLBINDVERTEXBUFFERSPROC ptr_glBindVertexBuffers; void glBindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);\nextern PFNGLCLIPCONTROLPROC ptr_glClipControl; void glClipControl(GLenum origin, GLenum depth);\nextern PFNGLCREATETRANSFORMFEEDBACKSPROC ptr_glCreateTransformFeedbacks; void glCreateTransformFeedbacks(GLsizei n, GLuint *ids);\nextern PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC ptr_glTransformFeedbackBufferBase; void glTransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer);\nextern PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC ptr_glTransformFeedbackBufferRange; void glTransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLGETTRANSFORMFEEDBACKIVPROC ptr_glGetTransformFeedbackiv; void glGetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param);\nextern PFNGLGETTRANSFORMFEEDBACKI_VPROC ptr_glGetTransformFeedbacki_v; void glGetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, GLint *param);\nextern PFNGLGETTRANSFORMFEEDBACKI64_VPROC ptr_glGetTransformFeedbacki64_v; void glGetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, GLint64 *param);\nextern PFNGLCREATEBUFFERSPROC ptr_glCreateBuffers; void glCreateBuffers(GLsizei n, GLuint *buffers);\nextern PFNGLNAMEDBUFFERSTORAGEPROC ptr_glNamedBufferStorage; void glNamedBufferStorage(GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);\nextern PFNGLNAMEDBUFFERDATAPROC ptr_glNamedBufferData; void glNamedBufferData(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);\nextern PFNGLNAMEDBUFFERSUBDATAPROC ptr_glNamedBufferSubData; void glNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);\nextern PFNGLCOPYNAMEDBUFFERSUBDATAPROC ptr_glCopyNamedBufferSubData; void glCopyNamedBufferSubData(GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);\nextern PFNGLCLEARNAMEDBUFFERDATAPROC ptr_glClearNamedBufferData; void glClearNamedBufferData(GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);\nextern PFNGLCLEARNAMEDBUFFERSUBDATAPROC ptr_glClearNamedBufferSubData; void glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);\nextern PFNGLMAPNAMEDBUFFERPROC ptr_glMapNamedBuffer; void * glMapNamedBuffer(GLuint buffer, GLenum access);\nextern PFNGLMAPNAMEDBUFFERRANGEPROC ptr_glMapNamedBufferRange; void * glMapNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);\nextern PFNGLUNMAPNAMEDBUFFERPROC ptr_glUnmapNamedBuffer; GLboolean glUnmapNamedBuffer(GLuint buffer);\nextern PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC ptr_glFlushMappedNamedBufferRange; void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length);\nextern PFNGLGETNAMEDBUFFERPARAMETERIVPROC ptr_glGetNamedBufferParameteriv; void glGetNamedBufferParameteriv(GLuint buffer, GLenum pname, GLint *params);\nextern PFNGLGETNAMEDBUFFERPARAMETERI64VPROC ptr_glGetNamedBufferParameteri64v; void glGetNamedBufferParameteri64v(GLuint buffer, GLenum pname, GLint64 *params);\nextern PFNGLGETNAMEDBUFFERPOINTERVPROC ptr_glGetNamedBufferPointerv; void glGetNamedBufferPointerv(GLuint buffer, GLenum pname, void **params);\nextern PFNGLGETNAMEDBUFFERSUBDATAPROC ptr_glGetNamedBufferSubData; void glGetNamedBufferSubData(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);\nextern PFNGLCREATEFRAMEBUFFERSPROC ptr_glCreateFramebuffers; void glCreateFramebuffers(GLsizei n, GLuint *framebuffers);\nextern PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC ptr_glNamedFramebufferRenderbuffer; void glNamedFramebufferRenderbuffer(GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);\nextern PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC ptr_glNamedFramebufferParameteri; void glNamedFramebufferParameteri(GLuint framebuffer, GLenum pname, GLint param);\nextern PFNGLNAMEDFRAMEBUFFERTEXTUREPROC ptr_glNamedFramebufferTexture; void glNamedFramebufferTexture(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);\nextern PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC ptr_glNamedFramebufferTextureLayer; void glNamedFramebufferTextureLayer(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);\nextern PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC ptr_glNamedFramebufferDrawBuffer; void glNamedFramebufferDrawBuffer(GLuint framebuffer, GLenum buf);\nextern PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC ptr_glNamedFramebufferDrawBuffers; void glNamedFramebufferDrawBuffers(GLuint framebuffer, GLsizei n, const GLenum *bufs);\nextern PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC ptr_glNamedFramebufferReadBuffer; void glNamedFramebufferReadBuffer(GLuint framebuffer, GLenum src);\nextern PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC ptr_glInvalidateNamedFramebufferData; void glInvalidateNamedFramebufferData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);\nextern PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC ptr_glInvalidateNamedFramebufferSubData; void glInvalidateNamedFramebufferSubData(GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLCLEARNAMEDFRAMEBUFFERIVPROC ptr_glClearNamedFramebufferiv; void glClearNamedFramebufferiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC ptr_glClearNamedFramebufferuiv; void glClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERFVPROC ptr_glClearNamedFramebufferfv; void glClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);\nextern PFNGLCLEARNAMEDFRAMEBUFFERFIPROC ptr_glClearNamedFramebufferfi; void glClearNamedFramebufferfi(GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);\nextern PFNGLBLITNAMEDFRAMEBUFFERPROC ptr_glBlitNamedFramebuffer; void glBlitNamedFramebuffer(GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\nextern PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC ptr_glCheckNamedFramebufferStatus; GLenum glCheckNamedFramebufferStatus(GLuint framebuffer, GLenum target);\nextern PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC ptr_glGetNamedFramebufferParameteriv; void glGetNamedFramebufferParameteriv(GLuint framebuffer, GLenum pname, GLint *param);\nextern PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC ptr_glGetNamedFramebufferAttachmentParameteriv; void glGetNamedFramebufferAttachmentParameteriv(GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);\nextern PFNGLCREATERENDERBUFFERSPROC ptr_glCreateRenderbuffers; void glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers);\nextern PFNGLNAMEDRENDERBUFFERSTORAGEPROC ptr_glNamedRenderbufferStorage; void glNamedRenderbufferStorage(GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC ptr_glNamedRenderbufferStorageMultisample; void glNamedRenderbufferStorageMultisample(GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC ptr_glGetNamedRenderbufferParameteriv; void glGetNamedRenderbufferParameteriv(GLuint renderbuffer, GLenum pname, GLint *params);\nextern PFNGLCREATETEXTURESPROC ptr_glCreateTextures; void glCreateTextures(GLenum target, GLsizei n, GLuint *textures);\nextern PFNGLTEXTUREBUFFERPROC ptr_glTextureBuffer; void glTextureBuffer(GLuint texture, GLenum internalformat, GLuint buffer);\nextern PFNGLTEXTUREBUFFERRANGEPROC ptr_glTextureBufferRange; void glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);\nextern PFNGLTEXTURESTORAGE1DPROC ptr_glTextureStorage1D; void glTextureStorage1D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);\nextern PFNGLTEXTURESTORAGE2DPROC ptr_glTextureStorage2D; void glTextureStorage2D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);\nextern PFNGLTEXTURESTORAGE3DPROC ptr_glTextureStorage3D; void glTextureStorage3D(GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);\nextern PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC ptr_glTextureStorage2DMultisample; void glTextureStorage2DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);\nextern PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC ptr_glTextureStorage3DMultisample; void glTextureStorage3DMultisample(GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);\nextern PFNGLTEXTURESUBIMAGE1DPROC ptr_glTextureSubImage1D; void glTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXTURESUBIMAGE2DPROC ptr_glTextureSubImage2D; void glTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);\nextern PFNGLTEXTURESUBIMAGE3DPROC ptr_glTextureSubImage3D; void glTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC ptr_glCompressedTextureSubImage1D; void glCompressedTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC ptr_glCompressedTextureSubImage2D; void glCompressedTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC ptr_glCompressedTextureSubImage3D; void glCompressedTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);\nextern PFNGLCOPYTEXTURESUBIMAGE1DPROC ptr_glCopyTextureSubImage1D; void glCopyTextureSubImage1D(GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\nextern PFNGLCOPYTEXTURESUBIMAGE2DPROC ptr_glCopyTextureSubImage2D; void glCopyTextureSubImage2D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLCOPYTEXTURESUBIMAGE3DPROC ptr_glCopyTextureSubImage3D; void glCopyTextureSubImage3D(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nextern PFNGLTEXTUREPARAMETERFPROC ptr_glTextureParameterf; void glTextureParameterf(GLuint texture, GLenum pname, GLfloat param);\nextern PFNGLTEXTUREPARAMETERFVPROC ptr_glTextureParameterfv; void glTextureParameterfv(GLuint texture, GLenum pname, const GLfloat *param);\nextern PFNGLTEXTUREPARAMETERIPROC ptr_glTextureParameteri; void glTextureParameteri(GLuint texture, GLenum pname, GLint param);\nextern PFNGLTEXTUREPARAMETERIIVPROC ptr_glTextureParameterIiv; void glTextureParameterIiv(GLuint texture, GLenum pname, const GLint *params);\nextern PFNGLTEXTUREPARAMETERIUIVPROC ptr_glTextureParameterIuiv; void glTextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params);\nextern PFNGLTEXTUREPARAMETERIVPROC ptr_glTextureParameteriv; void glTextureParameteriv(GLuint texture, GLenum pname, const GLint *param);\nextern PFNGLGENERATETEXTUREMIPMAPPROC ptr_glGenerateTextureMipmap; void glGenerateTextureMipmap(GLuint texture);\nextern PFNGLBINDTEXTUREUNITPROC ptr_glBindTextureUnit; void glBindTextureUnit(GLuint unit, GLuint texture);\nextern PFNGLGETTEXTUREIMAGEPROC ptr_glGetTextureImage; void glGetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC ptr_glGetCompressedTextureImage; void glGetCompressedTextureImage(GLuint texture, GLint level, GLsizei bufSize, void *pixels);\nextern PFNGLGETTEXTURELEVELPARAMETERFVPROC ptr_glGetTextureLevelParameterfv; void glGetTextureLevelParameterfv(GLuint texture, GLint level, GLenum pname, GLfloat *params);\nextern PFNGLGETTEXTURELEVELPARAMETERIVPROC ptr_glGetTextureLevelParameteriv; void glGetTextureLevelParameteriv(GLuint texture, GLint level, GLenum pname, GLint *params);\nextern PFNGLGETTEXTUREPARAMETERFVPROC ptr_glGetTextureParameterfv; void glGetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params);\nextern PFNGLGETTEXTUREPARAMETERIIVPROC ptr_glGetTextureParameterIiv; void glGetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params);\nextern PFNGLGETTEXTUREPARAMETERIUIVPROC ptr_glGetTextureParameterIuiv; void glGetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params);\nextern PFNGLGETTEXTUREPARAMETERIVPROC ptr_glGetTextureParameteriv; void glGetTextureParameteriv(GLuint texture, GLenum pname, GLint *params);\nextern PFNGLCREATEVERTEXARRAYSPROC ptr_glCreateVertexArrays; void glCreateVertexArrays(GLsizei n, GLuint *arrays);\nextern PFNGLDISABLEVERTEXARRAYATTRIBPROC ptr_glDisableVertexArrayAttrib; void glDisableVertexArrayAttrib(GLuint vaobj, GLuint index);\nextern PFNGLENABLEVERTEXARRAYATTRIBPROC ptr_glEnableVertexArrayAttrib; void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index);\nextern PFNGLVERTEXARRAYELEMENTBUFFERPROC ptr_glVertexArrayElementBuffer; void glVertexArrayElementBuffer(GLuint vaobj, GLuint buffer);\nextern PFNGLVERTEXARRAYVERTEXBUFFERPROC ptr_glVertexArrayVertexBuffer; void glVertexArrayVertexBuffer(GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);\nextern PFNGLVERTEXARRAYVERTEXBUFFERSPROC ptr_glVertexArrayVertexBuffers; void glVertexArrayVertexBuffers(GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);\nextern PFNGLVERTEXARRAYATTRIBBINDINGPROC ptr_glVertexArrayAttribBinding; void glVertexArrayAttribBinding(GLuint vaobj, GLuint attribindex, GLuint bindingindex);\nextern PFNGLVERTEXARRAYATTRIBFORMATPROC ptr_glVertexArrayAttribFormat; void glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYATTRIBIFORMATPROC ptr_glVertexArrayAttribIFormat; void glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYATTRIBLFORMATPROC ptr_glVertexArrayAttribLFormat; void glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);\nextern PFNGLVERTEXARRAYBINDINGDIVISORPROC ptr_glVertexArrayBindingDivisor; void glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex, GLuint divisor);\nextern PFNGLGETVERTEXARRAYIVPROC ptr_glGetVertexArrayiv; void glGetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param);\nextern PFNGLGETVERTEXARRAYINDEXEDIVPROC ptr_glGetVertexArrayIndexediv; void glGetVertexArrayIndexediv(GLuint vaobj, GLuint index, GLenum pname, GLint *param);\nextern PFNGLGETVERTEXARRAYINDEXED64IVPROC ptr_glGetVertexArrayIndexed64iv; void glGetVertexArrayIndexed64iv(GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);\nextern PFNGLCREATESAMPLERSPROC ptr_glCreateSamplers; void glCreateSamplers(GLsizei n, GLuint *samplers);\nextern PFNGLCREATEPROGRAMPIPELINESPROC ptr_glCreateProgramPipelines; void glCreateProgramPipelines(GLsizei n, GLuint *pipelines);\nextern PFNGLCREATEQUERIESPROC ptr_glCreateQueries; void glCreateQueries(GLenum target, GLsizei n, GLuint *ids);\nextern PFNGLGETQUERYBUFFEROBJECTI64VPROC ptr_glGetQueryBufferObjecti64v; void glGetQueryBufferObjecti64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTIVPROC ptr_glGetQueryBufferObjectiv; void glGetQueryBufferObjectiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTUI64VPROC ptr_glGetQueryBufferObjectui64v; void glGetQueryBufferObjectui64v(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLGETQUERYBUFFEROBJECTUIVPROC ptr_glGetQueryBufferObjectuiv; void glGetQueryBufferObjectuiv(GLuint id, GLuint buffer, GLenum pname, GLintptr offset);\nextern PFNGLMEMORYBARRIERBYREGIONPROC ptr_glMemoryBarrierByRegion; void glMemoryBarrierByRegion(GLbitfield barriers);\nextern PFNGLGETTEXTURESUBIMAGEPROC ptr_glGetTextureSubImage; void glGetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC ptr_glGetCompressedTextureSubImage; void glGetCompressedTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);\nextern PFNGLGETGRAPHICSRESETSTATUSPROC ptr_glGetGraphicsResetStatus; GLenum glGetGraphicsResetStatus(void);\nextern PFNGLGETNCOMPRESSEDTEXIMAGEPROC ptr_glGetnCompressedTexImage; void glGetnCompressedTexImage(GLenum target, GLint lod, GLsizei bufSize, void *pixels);\nextern PFNGLGETNTEXIMAGEPROC ptr_glGetnTexImage; void glGetnTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);\nextern PFNGLGETNUNIFORMDVPROC ptr_glGetnUniformdv; void glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize, GLdouble *params);\nextern PFNGLGETNUNIFORMFVPROC ptr_glGetnUniformfv; void glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params);\nextern PFNGLGETNUNIFORMIVPROC ptr_glGetnUniformiv; void glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params);\nextern PFNGLGETNUNIFORMUIVPROC ptr_glGetnUniformuiv; void glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize, GLuint *params);\nextern PFNGLREADNPIXELSPROC ptr_glReadnPixels; void glReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);\nextern PFNGLGETNMAPDVPROC ptr_glGetnMapdv; void glGetnMapdv(GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);\nextern PFNGLGETNMAPFVPROC ptr_glGetnMapfv; void glGetnMapfv(GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);\nextern PFNGLGETNMAPIVPROC ptr_glGetnMapiv; void glGetnMapiv(GLenum target, GLenum query, GLsizei bufSize, GLint *v);\nextern PFNGLGETNPIXELMAPFVPROC ptr_glGetnPixelMapfv; void glGetnPixelMapfv(GLenum map, GLsizei bufSize, GLfloat *values);\nextern PFNGLGETNPIXELMAPUIVPROC ptr_glGetnPixelMapuiv; void glGetnPixelMapuiv(GLenum map, GLsizei bufSize, GLuint *values);\nextern PFNGLGETNPIXELMAPUSVPROC ptr_glGetnPixelMapusv; void glGetnPixelMapusv(GLenum map, GLsizei bufSize, GLushort *values);\nextern PFNGLGETNPOLYGONSTIPPLEPROC ptr_glGetnPolygonStipple; void glGetnPolygonStipple(GLsizei bufSize, GLubyte *pattern);\nextern PFNGLGETNCOLORTABLEPROC ptr_glGetnColorTable; void glGetnColorTable(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);\nextern PFNGLGETNCONVOLUTIONFILTERPROC ptr_glGetnConvolutionFilter; void glGetnConvolutionFilter(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);\nextern PFNGLGETNSEPARABLEFILTERPROC ptr_glGetnSeparableFilter; void glGetnSeparableFilter(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);\nextern PFNGLGETNHISTOGRAMPROC ptr_glGetnHistogram; void glGetnHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);\nextern PFNGLGETNMINMAXPROC ptr_glGetnMinmax; void glGetnMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);\nextern PFNGLTEXTUREBARRIERPROC ptr_glTextureBarrier; void glTextureBarrier(void);\nextern PFNGLSPECIALIZESHADERPROC ptr_glSpecializeShader; void glSpecializeShader(GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);\nextern PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC ptr_glMultiDrawArraysIndirectCount; void glMultiDrawArraysIndirectCount(GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);\nextern PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC ptr_glMultiDrawElementsIndirectCount; void glMultiDrawElementsIndirectCount(GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);\nextern PFNGLPOLYGONOFFSETCLAMPPROC ptr_glPolygonOffsetClamp; void glPolygonOffsetClamp(GLfloat factor, GLfloat units, GLfloat clamp);\nextern PFNGLGETTEXTUREHANDLEARBPROC ptr_glGetTextureHandle; GLuint64 glGetTextureHandle(GLuint texture);\nextern PFNGLGETTEXTURESAMPLERHANDLEARBPROC ptr_glGetTextureSamplerHandle; GLuint64 glGetTextureSamplerHandle(GLuint texture, GLuint sampler);\nextern PFNGLMAKETEXTUREHANDLERESIDENTARBPROC ptr_glMakeTextureHandleResident; void glMakeTextureHandleResident(GLuint64 handle);\nextern PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC ptr_glMakeTextureHandleNonResident; void glMakeTextureHandleNonResident(GLuint64 handle);\nextern PFNGLGETIMAGEHANDLEARBPROC ptr_glGetImageHandle; GLuint64 glGetImageHandle(GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);\nextern PFNGLMAKEIMAGEHANDLERESIDENTARBPROC ptr_glMakeImageHandleResident; void glMakeImageHandleResident(GLuint64 handle, GLenum access);\nextern PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC ptr_glMakeImageHandleNonResident; void glMakeImageHandleNonResident(GLuint64 handle);\nextern PFNGLUNIFORMHANDLEUI64ARBPROC ptr_glUniformHandleui64; void glUniformHandleui64(GLint location, GLuint64 value);\nextern PFNGLUNIFORMHANDLEUI64VARBPROC ptr_glUniformHandleui64v; void glUniformHandleui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC ptr_glProgramUniformHandleui64; void glProgramUniformHandleui64(GLuint program, GLint location, GLuint64 value);\nextern PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC ptr_glProgramUniformHandleui64v; void glProgramUniformHandleui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *values);\nextern PFNGLISTEXTUREHANDLERESIDENTARBPROC ptr_glIsTextureHandleResident; GLboolean glIsTextureHandleResident(GLuint64 handle);\nextern PFNGLISIMAGEHANDLERESIDENTARBPROC ptr_glIsImageHandleResident; GLboolean glIsImageHandleResident(GLuint64 handle);\nextern PFNGLVERTEXATTRIBL1UI64ARBPROC ptr_glVertexAttribL1ui64; void glVertexAttribL1ui64(GLuint index, GLuint64EXT x);\nextern PFNGLVERTEXATTRIBL1UI64VARBPROC ptr_glVertexAttribL1ui64v; void glVertexAttribL1ui64v(GLuint index, const GLuint64EXT *v);\nextern PFNGLGETVERTEXATTRIBLUI64VARBPROC ptr_glGetVertexAttribLui64v; void glGetVertexAttribLui64v(GLuint index, GLenum pname, GLuint64EXT *params);\nextern PFNGLUNIFORM1I64ARBPROC ptr_glUniform1i64; void glUniform1i64(GLint location, GLint64 x);\nextern PFNGLUNIFORM2I64ARBPROC ptr_glUniform2i64; void glUniform2i64(GLint location, GLint64 x, GLint64 y);\nextern PFNGLUNIFORM3I64ARBPROC ptr_glUniform3i64; void glUniform3i64(GLint location, GLint64 x, GLint64 y, GLint64 z);\nextern PFNGLUNIFORM4I64ARBPROC ptr_glUniform4i64; void glUniform4i64(GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);\nextern PFNGLUNIFORM1I64VARBPROC ptr_glUniform1i64v; void glUniform1i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM2I64VARBPROC ptr_glUniform2i64v; void glUniform2i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM3I64VARBPROC ptr_glUniform3i64v; void glUniform3i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM4I64VARBPROC ptr_glUniform4i64v; void glUniform4i64v(GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLUNIFORM1UI64ARBPROC ptr_glUniform1ui64; void glUniform1ui64(GLint location, GLuint64 x);\nextern PFNGLUNIFORM2UI64ARBPROC ptr_glUniform2ui64; void glUniform2ui64(GLint location, GLuint64 x, GLuint64 y);\nextern PFNGLUNIFORM3UI64ARBPROC ptr_glUniform3ui64; void glUniform3ui64(GLint location, GLuint64 x, GLuint64 y, GLuint64 z);\nextern PFNGLUNIFORM4UI64ARBPROC ptr_glUniform4ui64; void glUniform4ui64(GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);\nextern PFNGLUNIFORM1UI64VARBPROC ptr_glUniform1ui64v; void glUniform1ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM2UI64VARBPROC ptr_glUniform2ui64v; void glUniform2ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM3UI64VARBPROC ptr_glUniform3ui64v; void glUniform3ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLUNIFORM4UI64VARBPROC ptr_glUniform4ui64v; void glUniform4ui64v(GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLGETUNIFORMI64VARBPROC ptr_glGetUniformi64v; void glGetUniformi64v(GLuint program, GLint location, GLint64 *params);\nextern PFNGLGETUNIFORMUI64VARBPROC ptr_glGetUniformui64v; void glGetUniformui64v(GLuint program, GLint location, GLuint64 *params);\nextern PFNGLGETNUNIFORMI64VARBPROC ptr_glGetnUniformi64v; void glGetnUniformi64v(GLuint program, GLint location, GLsizei bufSize, GLint64 *params);\nextern PFNGLGETNUNIFORMUI64VARBPROC ptr_glGetnUniformui64v; void glGetnUniformui64v(GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);\nextern PFNGLPROGRAMUNIFORM1I64ARBPROC ptr_glProgramUniform1i64; void glProgramUniform1i64(GLuint program, GLint location, GLint64 x);\nextern PFNGLPROGRAMUNIFORM2I64ARBPROC ptr_glProgramUniform2i64; void glProgramUniform2i64(GLuint program, GLint location, GLint64 x, GLint64 y);\nextern PFNGLPROGRAMUNIFORM3I64ARBPROC ptr_glProgramUniform3i64; void glProgramUniform3i64(GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);\nextern PFNGLPROGRAMUNIFORM4I64ARBPROC ptr_glProgramUniform4i64; void glProgramUniform4i64(GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);\nextern PFNGLPROGRAMUNIFORM1I64VARBPROC ptr_glProgramUniform1i64v; void glProgramUniform1i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM2I64VARBPROC ptr_glProgramUniform2i64v; void glProgramUniform2i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM3I64VARBPROC ptr_glProgramUniform3i64v; void glProgramUniform3i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM4I64VARBPROC ptr_glProgramUniform4i64v; void glProgramUniform4i64v(GLuint program, GLint location, GLsizei count, const GLint64 *value);\nextern PFNGLPROGRAMUNIFORM1UI64ARBPROC ptr_glProgramUniform1ui64; void glProgramUniform1ui64(GLuint program, GLint location, GLuint64 x);\nextern PFNGLPROGRAMUNIFORM2UI64ARBPROC ptr_glProgramUniform2ui64; void glProgramUniform2ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y);\nextern PFNGLPROGRAMUNIFORM3UI64ARBPROC ptr_glProgramUniform3ui64; void glProgramUniform3ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);\nextern PFNGLPROGRAMUNIFORM4UI64ARBPROC ptr_glProgramUniform4ui64; void glProgramUniform4ui64(GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);\nextern PFNGLPROGRAMUNIFORM1UI64VARBPROC ptr_glProgramUniform1ui64v; void glProgramUniform1ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM2UI64VARBPROC ptr_glProgramUniform2ui64v; void glProgramUniform2ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM3UI64VARBPROC ptr_glProgramUniform3ui64v; void glProgramUniform3ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\nextern PFNGLPROGRAMUNIFORM4UI64VARBPROC ptr_glProgramUniform4ui64v; void glProgramUniform4ui64v(GLuint program, GLint location, GLsizei count, const GLuint64 *value);\n"}, {"path": "utils/mesh.cpp", "language": "cpp", "loc": 215, "comment_density": 0.019, "code": "\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \"mesh.h\"\n#include \"math_helpers.h\"\n\nstruct ind_type { uint32_t position, uv, normal, material; };\n\nbool operator==(const ind_type& a, const ind_type& b) {\n\treturn a.position == b.position && a.uv == b.uv && a.normal == b.normal && a.material == b.material;\n}\n\nnamespace std {\n\ttemplate<>\n\tstruct hash {\n\t\tsize_t operator()(const ind_type& i) const {\n\t\t\tsize_t result = 0;\n\t\t\tfor (uint32_t k : {i.position, i.uv, i.normal, i.material}) {\n\t\t\t\tsrnd(k); rnd();\n\t\t\t\tresult ^= rnd_seed + 0x9e3779b9 + (result << 6) + (result >> 2);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t};\n}\n\nvoid get_mesh(const char* filename, void* meshPtr, bool smooth_shaded) {\n\t\n\tusing namespace std;\n\t\n\tstruct binary_header {\n\t\tuint32_t position_count, uv_count, normal_count, material_count, triangle_count;\n\t};\n\n\tvector positions;\n\tvector uvs;\n\tvector normals;\n\tvector material_albedos;\n\tvector indices;\n\t\n\tfilesystem::path path(filename);\n\t\n\tpath.replace_extension(\".bin\");\n\tif (!filesystem::exists(path)) {\n\n\t\tpath.replace_extension(\".mtl\");\n\t\tFILE* mtlFile = fopen(path.string().c_str(), \"rb\");\n\t\tfseek(mtlFile, 0, SEEK_END);\n\t\tconst size_t mtlSize = size_t(ftell(mtlFile)) + 1;\n\n\t\tvector mtlContents(mtlSize);\n\t\tmtlContents.back() = '\\0';\n\t\tfseek(mtlFile, 0, SEEK_SET);\n\t\tfread(mtlContents.data(), 1, mtlSize - 1, mtlFile);\n\t\tfclose(mtlFile);\n\n\t\tvector mtlNameIndices;\n\t\tvec3 color(1.f);\n\t\tint i = 0;\n\t\twhile (i < mtlSize - 1) {\n\t\t\tif (mtlContents[i] == 'n') {\n\t\t\t\ti += 7; // skip \"newmtl \"\n\t\t\t\twhile (mtlContents[i] == ' ' || mtlContents[i] == '\\t') i++;\n\n\t\t\t\tif (mtlNameIndices.size() > 0)\n\t\t\t\t\tmaterial_albedos.push_back(color);\n\t\t\t\tmtlNameIndices.push_back(i);\n\t\t\t}\n\t\t\telse if (mtlContents[i] == 'K' && mtlContents[i+1] == 'd')\n\t\t\t\tsscanf(mtlContents.data() + i + 2, \" %g %g %g\", color.data, color.data+1, color.data+2);\n\t\t\twhile (i < mtlSize - 1 && mtlContents[i++] != '\\n');\n\t\t}\n\t\tmaterial_albedos.push_back(color);\n\t\n\t\tpath.replace_extension(\".obj\");\n\n\t\tFILE* objFile = fopen(path.string().c_str(), \"rb\");\n\t\tfseek(objFile, 0, SEEK_END);\n\t\tconst size_t objSize = size_t(ftell(objFile)) + 1;\n\n\t\tvector objContents(objSize);\n\t\tobjContents.back() = '\\0';\n\t\tfseek(objFile, 0, SEEK_SET);\n\t\tfread(objContents.data(), 1, objSize - 1, objFile);\n\t\tfclose(objFile);\n\n\t\tint use_mtl_index = 0;\n\t\ti = 0;\n\t\twhile (i= 2)\n\t\t\t\t\t\tfor(int k = 0; k<3; ++k)\n\t\t\t\t\t\t\tindices.push_back(sweep_inds[k]);\n\n\t\t\t\t\tsweep_inds[1] = sweep_inds[2];\n\t\t\t\t\tj++; write_index = 2;\n\n\t\t\t\t\twhile (objContents[i] == ' ' || objContents[i] == '\\t') i++;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (objContents[i] == 'u' && objContents[i+1] == 's') {\n\t\t\t\tuse_mtl_index = -1;\n\t\t\t\ti += 7; // skip \"usemtl \"\n\t\t\t\twhile (objContents[i] == ' ' || objContents[i] == '\\t') i++;\n\t\t\t\tfor (auto j: mtlNameIndices) {\n\t\t\t\t\tuse_mtl_index++;\n\t\t\t\t\tint k = i;\n\t\t\t\t\tbool match = false;\n\t\t\t\t\twhile (objContents[k] == mtlContents[j] && objContents[k] != '\\0') {\n\t\t\t\t\t\tif (objContents[k] == ' ' || objContents[k] == '\\t' || objContents[k] == '\\n' || objContents[k] == '\\0') {\n\t\t\t\t\t\t\tmatch = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tk++; j++;\n\t\t\t\t\t}\n\t\t\t\t\tif (match) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (i < objSize - 1 && objContents[i] != '\\n') i++;\n\t\t\ti++;\n\t\t}\n\t\tpath.replace_extension(\".bin\");\n\t\tFILE* binFile = fopen(path.string().c_str(), \"wb\");\n\t\tbinary_header header = { uint32_t(positions.size()), uint32_t(uvs.size()), uint32_t(normals.size()), uint32_t(material_albedos.size()), uint32_t(indices.size()) };\n\t\tfwrite(&header, sizeof(header), 1, binFile);\n\t\tfwrite(positions.data(), sizeof(positions[0]), positions.size(), binFile);\n\t\tfwrite(uvs.data(), sizeof(uvs[0]), uvs.size(), binFile);\n\t\tfwrite(normals.data(), sizeof(normals[0]), normals.size(), binFile);\n\t\tfwrite(material_albedos.data(), sizeof(material_albedos[0]), material_albedos.size(), binFile);\n\t\tfwrite(indices.data(), sizeof(indices[0]), indices.size(), binFile);\n\t\tfclose(binFile);\n\t}\n\telse {\n\t\tFILE* binFile = fopen(path.string().c_str(), \"rb\");\n\t\tbinary_header header;\n\t\tfread(&header, sizeof(header), 1, binFile);\n\t\tpositions.resize(header.position_count); uvs.resize(header.uv_count); normals.resize(header.normal_count);\n\t\tmaterial_albedos.resize(header.material_count); indices.resize(header.triangle_count);\n\t\tfread(positions.data(), sizeof(positions[0]), positions.size(), binFile);\n\t\tfread(uvs.data(), sizeof(uvs[0]), uvs.size(), binFile);\n\t\tfread(normals.data(), sizeof(normals[0]), normals.size(), binFile);\n\t\tfread(material_albedos.data(), sizeof(material_albedos[0]), material_albedos.size(), binFile);\n\t\tfread(indices.data(), sizeof(indices[0]), indices.size(), binFile);\n\t\tfclose(binFile);\n\t}\n\n\tif (!smooth_shaded) {\n\t\tFlatMesh* mesh = (FlatMesh*)meshPtr;\n\t\tmesh->triangle_count = int(indices.size()/3);\n#ifdef _WIN32\n\t\tmesh->triangles = (FlatMesh::triangle*)_aligned_malloc(mesh->triangle_count * sizeof(FlatMesh::triangle), 16);\n#else\t\t\t\t\t\t\t\t\t\t\t// see how the arguments are flipped? pretty funny joke by whoever defined these :)\n\t\tmesh->triangles = (FlatMesh::triangle*)aligned_alloc(16, mesh->triangle_count * sizeof(FlatMesh::triangle));\n#endif\n\t\tfor (int i = 0; i < mesh->triangle_count; ++i) {\n\t\t\tvec3 color = material_albedos[indices[i * 3].material];\n\t\t\tfor (int j = 0; j < 3; ++j) {\n\t\t\t\tconst auto ind = indices[i * 3 + j];\n\t\t\t\tvec3 position = positions[ind.position];\n\t\t\t\t\n\t\t\t\tmesh->triangles[i].vertices[j].position = _mm_setr_ps(position.x, position.y, position.z, 1.f);\n\t\t\t\tvec3 normal = normals[ind.normal];\n\t\t\t\tmesh->triangles[i].vertices[j].normal = _mm_setr_ps(normal.x, normal.y, normal.z, 1.f);\n\t\t\t\tmesh->triangles[i].vertices[j].color = _mm_setr_ps(color.r, color.g, color.b, 1.f);\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\tMesh* mesh = (Mesh*)meshPtr;\n\t\tmesh->triangle_count = int(indices.size() / 3);\n\t\tmesh->vertex_count = int(positions.size());\n\n\t\tstd::unordered_map ind_to_vert;\n\t\tstd::vector verts;\n\t\tstd::vector inds;\n\n\t\tfor (ind_type i : indices) {\n\t\t\tif(i.position > mesh->vertex_count) continue;\n\t\t\tif (!ind_to_vert.count(i)) {\n\t\t\t\tind_to_vert[i] = verts.size();\n\t\t\t\tverts.push_back({});\n\t\t\t\tverts.back().position = vec4(positions[i.position], 1.f);\n\t\t\t\tverts.back().normal = i.normal < normals.size() ? vec4(normals[i.normal], 1.f) : vec4(.0f);\n\t\t\t\tverts.back().uv = i.uvvertex_count = verts.size();\n\t\tmesh->verts = new Mesh::vertex[mesh->vertex_count];\n\t\tmemcpy(mesh->verts, verts.data(), sizeof(Mesh::vertex)*verts.size());\n\t\tmesh->indices = new uint32_t[mesh->triangle_count * 3];\n\t\tmemcpy(mesh->indices, inds.data(), sizeof(uint32_t)*inds.size());\n\t}\n}\n\n"}, {"path": "utils/mesh.h", "language": "c", "loc": 35, "comment_density": 0.0, "code": "#pragma once\n\n\n#include \n\nvoid get_mesh(const char* filename, void* mesh, bool smooth_shaded);\n\nstruct FlatMesh {\n\tstruct vertex {\n\t\t__m128 position, normal, color;\n\t};\n\tstruct triangle {\n\t\tvertex vertices[3];\n\t} *triangles = nullptr;\n\tint triangle_count = 0;\n\n\tFlatMesh(const char* filename) {\n\t\tget_mesh(filename, this, false);\n\t}\n\t~FlatMesh() {\n#ifdef _WIN32\n\t\t_aligned_free(triangles);\n#else\n\t\tfree(triangles);\n#endif\n\t}\n};\n\n#include \"glsl.h\"\n\nstruct Mesh {\n\tstruct vertex {\n\t\tvec4 position, normal, color;\n\t\tvec2 uv;\n\t} *verts = nullptr;\n\tuint32_t* indices = nullptr;\n\tint vertex_count = 0, triangle_count = 0;\n\n\tMesh(const char* filename) {\n\t\tget_mesh(filename, this, true);\n\t}\n\t~Mesh() { delete[] verts; delete[] indices; }\n};\n"}, {"path": "utils/wglext.h", "language": "c", "loc": 788, "comment_density": 0.115, "code": "#ifndef __wglext_h_\n#define __wglext_h_ 1\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\t/*\n\t** Copyright (c) 2013-2017 The Khronos Group Inc.\n\t**\n\t** Permission is hereby granted, free of charge, to any person obtaining a\n\t** copy of this software and/or associated documentation files (the\n\t** \"Materials\"), to deal in the Materials without restriction, including\n\t** without limitation the rights to use, copy, modify, merge, publish,\n\t** distribute, sublicense, and/or sell copies of the Materials, and to\n\t** permit persons to whom the Materials are furnished to do so, subject to\n\t** the following conditions:\n\t**\n\t** The above copyright notice and this permission notice shall be included\n\t** in all copies or substantial portions of the Materials.\n\t**\n\t** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n\t** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n\t** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n\t** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n\t** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n\t** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n\t*/\n\t/*\n\t** This header is generated from the Khronos OpenGL / OpenGL ES XML\n\t** API Registry. The current version of the Registry, generator scripts\n\t** used to make the header, and the header can be found at\n\t** https://github.com/KhronosGroup/OpenGL-Registry\n\t*/\n\n#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)\n#define WIN32_LEAN_AND_MEAN 1\n#include \n#endif\n\n#define WGL_WGLEXT_VERSION 20170817\n\n\t/* Generated C header for:\n\t* API: wgl\n\t* Versions considered: .*\n\t* Versions emitted: _nomatch_^\n\t* Default extensions included: wgl\n\t* Additional extensions included: _nomatch_^\n\t* Extensions removed: _nomatch_^\n\t*/\n\n#ifndef WGL_ARB_buffer_region\n#define WGL_ARB_buffer_region 1\n#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001\n#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002\n#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004\n#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008\n\ttypedef HANDLE(WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);\n\ttypedef VOID(WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);\n\ttypedef BOOL(WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);\n\ttypedef BOOL(WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHANDLE WINAPI wglCreateBufferRegionARB(HDC hDC, int iLayerPlane, UINT uType);\n\tVOID WINAPI wglDeleteBufferRegionARB(HANDLE hRegion);\n\tBOOL WINAPI wglSaveBufferRegionARB(HANDLE hRegion, int x, int y, int width, int height);\n\tBOOL WINAPI wglRestoreBufferRegionARB(HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\n#endif\n#endif /* WGL_ARB_buffer_region */\n\n#ifndef WGL_ARB_context_flush_control\n#define WGL_ARB_context_flush_control 1\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0\n#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098\n#endif /* WGL_ARB_context_flush_control */\n\n#ifndef WGL_ARB_create_context\n#define WGL_ARB_create_context 1\n#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001\n#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002\n#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093\n#define WGL_CONTEXT_FLAGS_ARB 0x2094\n#define ERROR_INVALID_VERSION_ARB 0x2095\n\ttypedef HGLRC(WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHGLRC WINAPI wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList);\n#endif\n#endif /* WGL_ARB_create_context */\n\n#ifndef WGL_ARB_create_context_no_error\n#define WGL_ARB_create_context_no_error 1\n#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3\n#endif /* WGL_ARB_create_context_no_error */\n\n#ifndef WGL_ARB_create_context_profile\n#define WGL_ARB_create_context_profile 1\n#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126\n#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define ERROR_INVALID_PROFILE_ARB 0x2096\n#endif /* WGL_ARB_create_context_profile */\n\n#ifndef WGL_ARB_create_context_robustness\n#define WGL_ARB_create_context_robustness 1\n#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261\n#endif /* WGL_ARB_create_context_robustness */\n\n#ifndef WGL_ARB_extensions_string\n#define WGL_ARB_extensions_string 1\n\ttypedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tconst char *WINAPI wglGetExtensionsStringARB(HDC hdc);\n#endif\n#endif /* WGL_ARB_extensions_string */\n\n#ifndef WGL_ARB_framebuffer_sRGB\n#define WGL_ARB_framebuffer_sRGB 1\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9\n#endif /* WGL_ARB_framebuffer_sRGB */\n\n#ifndef WGL_ARB_make_current_read\n#define WGL_ARB_make_current_read 1\n#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043\n#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054\n\ttypedef BOOL(WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\ttypedef HDC(WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglMakeContextCurrentARB(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\tHDC WINAPI wglGetCurrentReadDCARB(void);\n#endif\n#endif /* WGL_ARB_make_current_read */\n\n#ifndef WGL_ARB_multisample\n#define WGL_ARB_multisample 1\n#define WGL_SAMPLE_BUFFERS_ARB 0x2041\n#define WGL_SAMPLES_ARB 0x2042\n#endif /* WGL_ARB_multisample */\n\n#ifndef WGL_ARB_pbuffer\n#define WGL_ARB_pbuffer 1\n\tDECLARE_HANDLE(HPBUFFERARB);\n#define WGL_DRAW_TO_PBUFFER_ARB 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030\n#define WGL_PBUFFER_LARGEST_ARB 0x2033\n#define WGL_PBUFFER_WIDTH_ARB 0x2034\n#define WGL_PBUFFER_HEIGHT_ARB 0x2035\n#define WGL_PBUFFER_LOST_ARB 0x2036\n\ttypedef HPBUFFERARB(WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\ttypedef HDC(WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);\n\ttypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHPBUFFERARB WINAPI wglCreatePbufferARB(HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\tHDC WINAPI wglGetPbufferDCARB(HPBUFFERARB hPbuffer);\n\tint WINAPI wglReleasePbufferDCARB(HPBUFFERARB hPbuffer, HDC hDC);\n\tBOOL WINAPI wglDestroyPbufferARB(HPBUFFERARB hPbuffer);\n\tBOOL WINAPI wglQueryPbufferARB(HPBUFFERARB hPbuffer, int iAttribute, int *piValue);\n#endif\n#endif /* WGL_ARB_pbuffer */\n\n#ifndef WGL_ARB_pixel_format\n#define WGL_ARB_pixel_format 1\n#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000\n#define WGL_DRAW_TO_WINDOW_ARB 0x2001\n#define WGL_DRAW_TO_BITMAP_ARB 0x2002\n#define WGL_ACCELERATION_ARB 0x2003\n#define WGL_NEED_PALETTE_ARB 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006\n#define WGL_SWAP_METHOD_ARB 0x2007\n#define WGL_NUMBER_OVERLAYS_ARB 0x2008\n#define WGL_NUMBER_UNDERLAYS_ARB 0x2009\n#define WGL_TRANSPARENT_ARB 0x200A\n#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037\n#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038\n#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039\n#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A\n#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B\n#define WGL_SHARE_DEPTH_ARB 0x200C\n#define WGL_SHARE_STENCIL_ARB 0x200D\n#define WGL_SHARE_ACCUM_ARB 0x200E\n#define WGL_SUPPORT_GDI_ARB 0x200F\n#define WGL_SUPPORT_OPENGL_ARB 0x2010\n#define WGL_DOUBLE_BUFFER_ARB 0x2011\n#define WGL_STEREO_ARB 0x2012\n#define WGL_PIXEL_TYPE_ARB 0x2013\n#define WGL_COLOR_BITS_ARB 0x2014\n#define WGL_RED_BITS_ARB 0x2015\n#define WGL_RED_SHIFT_ARB 0x2016\n#define WGL_GREEN_BITS_ARB 0x2017\n#define WGL_GREEN_SHIFT_ARB 0x2018\n#define WGL_BLUE_BITS_ARB 0x2019\n#define WGL_BLUE_SHIFT_ARB 0x201A\n#define WGL_ALPHA_BITS_ARB 0x201B\n#define WGL_ALPHA_SHIFT_ARB 0x201C\n#define WGL_ACCUM_BITS_ARB 0x201D\n#define WGL_ACCUM_RED_BITS_ARB 0x201E\n#define WGL_ACCUM_GREEN_BITS_ARB 0x201F\n#define WGL_ACCUM_BLUE_BITS_ARB 0x2020\n#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021\n#define WGL_DEPTH_BITS_ARB 0x2022\n#define WGL_STENCIL_BITS_ARB 0x2023\n#define WGL_AUX_BUFFERS_ARB 0x2024\n#define WGL_NO_ACCELERATION_ARB 0x2025\n#define WGL_GENERIC_ACCELERATION_ARB 0x2026\n#define WGL_FULL_ACCELERATION_ARB 0x2027\n#define WGL_SWAP_EXCHANGE_ARB 0x2028\n#define WGL_SWAP_COPY_ARB 0x2029\n#define WGL_SWAP_UNDEFINED_ARB 0x202A\n#define WGL_TYPE_RGBA_ARB 0x202B\n#define WGL_TYPE_COLORINDEX_ARB 0x202C\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);\n\ttypedef BOOL(WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetPixelFormatAttribivARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);\n\tBOOL WINAPI wglGetPixelFormatAttribfvARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);\n\tBOOL WINAPI wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#endif\n#endif /* WGL_ARB_pixel_format */\n\n#ifndef WGL_ARB_pixel_format_float\n#define WGL_ARB_pixel_format_float 1\n#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0\n#endif /* WGL_ARB_pixel_format_float */\n\n#ifndef WGL_ARB_render_texture\n#define WGL_ARB_render_texture 1\n#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070\n#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071\n#define WGL_TEXTURE_FORMAT_ARB 0x2072\n#define WGL_TEXTURE_TARGET_ARB 0x2073\n#define WGL_MIPMAP_TEXTURE_ARB 0x2074\n#define WGL_TEXTURE_RGB_ARB 0x2075\n#define WGL_TEXTURE_RGBA_ARB 0x2076\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078\n#define WGL_TEXTURE_1D_ARB 0x2079\n#define WGL_TEXTURE_2D_ARB 0x207A\n#define WGL_MIPMAP_LEVEL_ARB 0x207B\n#define WGL_CUBE_MAP_FACE_ARB 0x207C\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082\n#define WGL_FRONT_LEFT_ARB 0x2083\n#define WGL_FRONT_RIGHT_ARB 0x2084\n#define WGL_BACK_LEFT_ARB 0x2085\n#define WGL_BACK_RIGHT_ARB 0x2086\n#define WGL_AUX0_ARB 0x2087\n#define WGL_AUX1_ARB 0x2088\n#define WGL_AUX2_ARB 0x2089\n#define WGL_AUX3_ARB 0x208A\n#define WGL_AUX4_ARB 0x208B\n#define WGL_AUX5_ARB 0x208C\n#define WGL_AUX6_ARB 0x208D\n#define WGL_AUX7_ARB 0x208E\n#define WGL_AUX8_ARB 0x208F\n#define WGL_AUX9_ARB 0x2090\n\ttypedef BOOL(WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer);\n\tBOOL WINAPI wglReleaseTexImageARB(HPBUFFERARB hPbuffer, int iBuffer);\n\tBOOL WINAPI wglSetPbufferAttribARB(HPBUFFERARB hPbuffer, const int *piAttribList);\n#endif\n#endif /* WGL_ARB_render_texture */\n\n#ifndef WGL_ARB_robustness_application_isolation\n#define WGL_ARB_robustness_application_isolation 1\n#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n#endif /* WGL_ARB_robustness_application_isolation */\n\n#ifndef WGL_ARB_robustness_share_group_isolation\n#define WGL_ARB_robustness_share_group_isolation 1\n#endif /* WGL_ARB_robustness_share_group_isolation */\n\n#ifndef WGL_3DFX_multisample\n#define WGL_3DFX_multisample 1\n#define WGL_SAMPLE_BUFFERS_3DFX 0x2060\n#define WGL_SAMPLES_3DFX 0x2061\n#endif /* WGL_3DFX_multisample */\n\n#ifndef WGL_3DL_stereo_control\n#define WGL_3DL_stereo_control 1\n#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055\n#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056\n#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057\n#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058\n\ttypedef BOOL(WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglSetStereoEmitterState3DL(HDC hDC, UINT uState);\n#endif\n#endif /* WGL_3DL_stereo_control */\n\n#ifndef WGL_AMD_gpu_association\n#define WGL_AMD_gpu_association 1\n#define WGL_GPU_VENDOR_AMD 0x1F00\n#define WGL_GPU_RENDERER_STRING_AMD 0x1F01\n#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define WGL_GPU_RAM_AMD 0x21A3\n#define WGL_GPU_CLOCK_AMD 0x21A4\n#define WGL_GPU_NUM_PIPES_AMD 0x21A5\n#define WGL_GPU_NUM_SIMD_AMD 0x21A6\n#define WGL_GPU_NUM_RB_AMD 0x21A7\n#define WGL_GPU_NUM_SPI_AMD 0x21A8\n\ttypedef UINT(WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);\n\ttypedef INT(WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);\n\ttypedef UINT(WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);\n\ttypedef HGLRC(WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);\n\ttypedef HGLRC(WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);\n\ttypedef BOOL(WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);\n\ttypedef BOOL(WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);\n\ttypedef HGLRC(WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);\n\ttypedef VOID(WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tUINT WINAPI wglGetGPUIDsAMD(UINT maxCount, UINT *ids);\n\tINT WINAPI wglGetGPUInfoAMD(UINT id, int property, GLenum dataType, UINT size, void *data);\n\tUINT WINAPI wglGetContextGPUIDAMD(HGLRC hglrc);\n\tHGLRC WINAPI wglCreateAssociatedContextAMD(UINT id);\n\tHGLRC WINAPI wglCreateAssociatedContextAttribsAMD(UINT id, HGLRC hShareContext, const int *attribList);\n\tBOOL WINAPI wglDeleteAssociatedContextAMD(HGLRC hglrc);\n\tBOOL WINAPI wglMakeAssociatedContextCurrentAMD(HGLRC hglrc);\n\tHGLRC WINAPI wglGetCurrentAssociatedContextAMD(void);\n\tVOID WINAPI wglBlitContextFramebufferAMD(HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\n#endif\n#endif /* WGL_AMD_gpu_association */\n\n#ifndef WGL_ATI_pixel_format_float\n#define WGL_ATI_pixel_format_float 1\n#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0\n#endif /* WGL_ATI_pixel_format_float */\n\n#ifndef WGL_EXT_colorspace\n#define WGL_EXT_colorspace 1\n#define WGL_COLORSPACE_EXT 0x3087\n#define WGL_COLORSPACE_SRGB_EXT 0x3089\n#define WGL_COLORSPACE_LINEAR_EXT 0x308A\n#endif /* WGL_EXT_colorspace */\n\n#ifndef WGL_EXT_create_context_es2_profile\n#define WGL_EXT_create_context_es2_profile 1\n#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n#endif /* WGL_EXT_create_context_es2_profile */\n\n#ifndef WGL_EXT_create_context_es_profile\n#define WGL_EXT_create_context_es_profile 1\n#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n#endif /* WGL_EXT_create_context_es_profile */\n\n#ifndef WGL_EXT_depth_float\n#define WGL_EXT_depth_float 1\n#define WGL_DEPTH_FLOAT_EXT 0x2040\n#endif /* WGL_EXT_depth_float */\n\n#ifndef WGL_EXT_display_color_table\n#define WGL_EXT_display_color_table 1\n\ttypedef GLboolean(WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n\ttypedef GLboolean(WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);\n\ttypedef GLboolean(WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n\ttypedef VOID(WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tGLboolean WINAPI wglCreateDisplayColorTableEXT(GLushort id);\n\tGLboolean WINAPI wglLoadDisplayColorTableEXT(const GLushort *table, GLuint length);\n\tGLboolean WINAPI wglBindDisplayColorTableEXT(GLushort id);\n\tVOID WINAPI wglDestroyDisplayColorTableEXT(GLushort id);\n#endif\n#endif /* WGL_EXT_display_color_table */\n\n#ifndef WGL_EXT_extensions_string\n#define WGL_EXT_extensions_string 1\n\ttypedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tconst char *WINAPI wglGetExtensionsStringEXT(void);\n#endif\n#endif /* WGL_EXT_extensions_string */\n\n#ifndef WGL_EXT_framebuffer_sRGB\n#define WGL_EXT_framebuffer_sRGB 1\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9\n#endif /* WGL_EXT_framebuffer_sRGB */\n\n#ifndef WGL_EXT_make_current_read\n#define WGL_EXT_make_current_read 1\n#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043\n\ttypedef BOOL(WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\ttypedef HDC(WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglMakeContextCurrentEXT(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\tHDC WINAPI wglGetCurrentReadDCEXT(void);\n#endif\n#endif /* WGL_EXT_make_current_read */\n\n#ifndef WGL_EXT_multisample\n#define WGL_EXT_multisample 1\n#define WGL_SAMPLE_BUFFERS_EXT 0x2041\n#define WGL_SAMPLES_EXT 0x2042\n#endif /* WGL_EXT_multisample */\n\n#ifndef WGL_EXT_pbuffer\n#define WGL_EXT_pbuffer 1\n\tDECLARE_HANDLE(HPBUFFEREXT);\n#define WGL_DRAW_TO_PBUFFER_EXT 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030\n#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031\n#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032\n#define WGL_PBUFFER_LARGEST_EXT 0x2033\n#define WGL_PBUFFER_WIDTH_EXT 0x2034\n#define WGL_PBUFFER_HEIGHT_EXT 0x2035\n\ttypedef HPBUFFEREXT(WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\ttypedef HDC(WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);\n\ttypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tHPBUFFEREXT WINAPI wglCreatePbufferEXT(HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);\n\tHDC WINAPI wglGetPbufferDCEXT(HPBUFFEREXT hPbuffer);\n\tint WINAPI wglReleasePbufferDCEXT(HPBUFFEREXT hPbuffer, HDC hDC);\n\tBOOL WINAPI wglDestroyPbufferEXT(HPBUFFEREXT hPbuffer);\n\tBOOL WINAPI wglQueryPbufferEXT(HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);\n#endif\n#endif /* WGL_EXT_pbuffer */\n\n#ifndef WGL_EXT_pixel_format\n#define WGL_EXT_pixel_format 1\n#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000\n#define WGL_DRAW_TO_WINDOW_EXT 0x2001\n#define WGL_DRAW_TO_BITMAP_EXT 0x2002\n#define WGL_ACCELERATION_EXT 0x2003\n#define WGL_NEED_PALETTE_EXT 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006\n#define WGL_SWAP_METHOD_EXT 0x2007\n#define WGL_NUMBER_OVERLAYS_EXT 0x2008\n#define WGL_NUMBER_UNDERLAYS_EXT 0x2009\n#define WGL_TRANSPARENT_EXT 0x200A\n#define WGL_TRANSPARENT_VALUE_EXT 0x200B\n#define WGL_SHARE_DEPTH_EXT 0x200C\n#define WGL_SHARE_STENCIL_EXT 0x200D\n#define WGL_SHARE_ACCUM_EXT 0x200E\n#define WGL_SUPPORT_GDI_EXT 0x200F\n#define WGL_SUPPORT_OPENGL_EXT 0x2010\n#define WGL_DOUBLE_BUFFER_EXT 0x2011\n#define WGL_STEREO_EXT 0x2012\n#define WGL_PIXEL_TYPE_EXT 0x2013\n#define WGL_COLOR_BITS_EXT 0x2014\n#define WGL_RED_BITS_EXT 0x2015\n#define WGL_RED_SHIFT_EXT 0x2016\n#define WGL_GREEN_BITS_EXT 0x2017\n#define WGL_GREEN_SHIFT_EXT 0x2018\n#define WGL_BLUE_BITS_EXT 0x2019\n#define WGL_BLUE_SHIFT_EXT 0x201A\n#define WGL_ALPHA_BITS_EXT 0x201B\n#define WGL_ALPHA_SHIFT_EXT 0x201C\n#define WGL_ACCUM_BITS_EXT 0x201D\n#define WGL_ACCUM_RED_BITS_EXT 0x201E\n#define WGL_ACCUM_GREEN_BITS_EXT 0x201F\n#define WGL_ACCUM_BLUE_BITS_EXT 0x2020\n#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021\n#define WGL_DEPTH_BITS_EXT 0x2022\n#define WGL_STENCIL_BITS_EXT 0x2023\n#define WGL_AUX_BUFFERS_EXT 0x2024\n#define WGL_NO_ACCELERATION_EXT 0x2025\n#define WGL_GENERIC_ACCELERATION_EXT 0x2026\n#define WGL_FULL_ACCELERATION_EXT 0x2027\n#define WGL_SWAP_EXCHANGE_EXT 0x2028\n#define WGL_SWAP_COPY_EXT 0x2029\n#define WGL_SWAP_UNDEFINED_EXT 0x202A\n#define WGL_TYPE_RGBA_EXT 0x202B\n#define WGL_TYPE_COLORINDEX_EXT 0x202C\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);\n\ttypedef BOOL(WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);\n\ttypedef BOOL(WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetPixelFormatAttribivEXT(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);\n\tBOOL WINAPI wglGetPixelFormatAttribfvEXT(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);\n\tBOOL WINAPI wglChoosePixelFormatEXT(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\n#endif\n#endif /* WGL_EXT_pixel_format */\n\n#ifndef WGL_EXT_pixel_format_packed_float\n#define WGL_EXT_pixel_format_packed_float 1\n#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8\n#endif /* WGL_EXT_pixel_format_packed_float */\n\n#ifndef WGL_EXT_swap_control\n#define WGL_EXT_swap_control 1\n\ttypedef BOOL(WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);\n\ttypedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglSwapIntervalEXT(int interval);\n\tint WINAPI wglGetSwapIntervalEXT(void);\n#endif\n#endif /* WGL_EXT_swap_control */\n\n#ifndef WGL_EXT_swap_control_tear\n#define WGL_EXT_swap_control_tear 1\n#endif /* WGL_EXT_swap_control_tear */\n\n#ifndef WGL_I3D_digital_video_control\n#define WGL_I3D_digital_video_control 1\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051\n#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052\n#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053\n\ttypedef BOOL(WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetDigitalVideoParametersI3D(HDC hDC, int iAttribute, int *piValue);\n\tBOOL WINAPI wglSetDigitalVideoParametersI3D(HDC hDC, int iAttribute, const int *piValue);\n#endif\n#endif /* WGL_I3D_digital_video_control */\n\n#ifndef WGL_I3D_gamma\n#define WGL_I3D_gamma 1\n#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E\n#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F\n\ttypedef BOOL(WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);\n\ttypedef BOOL(WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetGammaTableParametersI3D(HDC hDC, int iAttribute, int *piValue);\n\tBOOL WINAPI wglSetGammaTableParametersI3D(HDC hDC, int iAttribute, const int *piValue);\n\tBOOL WINAPI wglGetGammaTableI3D(HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);\n\tBOOL WINAPI wglSetGammaTableI3D(HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);\n#endif\n#endif /* WGL_I3D_gamma */\n\n#ifndef WGL_I3D_genlock\n#define WGL_I3D_genlock 1\n#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044\n#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045\n#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046\n#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047\n#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048\n#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049\n#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A\n#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B\n#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C\n\ttypedef BOOL(WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);\n\ttypedef BOOL(WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);\n\ttypedef BOOL(WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);\n\ttypedef BOOL(WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnableGenlockI3D(HDC hDC);\n\tBOOL WINAPI wglDisableGenlockI3D(HDC hDC);\n\tBOOL WINAPI wglIsEnabledGenlockI3D(HDC hDC, BOOL *pFlag);\n\tBOOL WINAPI wglGenlockSourceI3D(HDC hDC, UINT uSource);\n\tBOOL WINAPI wglGetGenlockSourceI3D(HDC hDC, UINT *uSource);\n\tBOOL WINAPI wglGenlockSourceEdgeI3D(HDC hDC, UINT uEdge);\n\tBOOL WINAPI wglGetGenlockSourceEdgeI3D(HDC hDC, UINT *uEdge);\n\tBOOL WINAPI wglGenlockSampleRateI3D(HDC hDC, UINT uRate);\n\tBOOL WINAPI wglGetGenlockSampleRateI3D(HDC hDC, UINT *uRate);\n\tBOOL WINAPI wglGenlockSourceDelayI3D(HDC hDC, UINT uDelay);\n\tBOOL WINAPI wglGetGenlockSourceDelayI3D(HDC hDC, UINT *uDelay);\n\tBOOL WINAPI wglQueryGenlockMaxSourceDelayI3D(HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);\n#endif\n#endif /* WGL_I3D_genlock */\n\n#ifndef WGL_I3D_image_buffer\n#define WGL_I3D_image_buffer 1\n#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001\n#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002\n\ttypedef LPVOID(WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);\n\ttypedef BOOL(WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);\n\ttypedef BOOL(WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tLPVOID WINAPI wglCreateImageBufferI3D(HDC hDC, DWORD dwSize, UINT uFlags);\n\tBOOL WINAPI wglDestroyImageBufferI3D(HDC hDC, LPVOID pAddress);\n\tBOOL WINAPI wglAssociateImageBufferEventsI3D(HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);\n\tBOOL WINAPI wglReleaseImageBufferEventsI3D(HDC hDC, const LPVOID *pAddress, UINT count);\n#endif\n#endif /* WGL_I3D_image_buffer */\n\n#ifndef WGL_I3D_swap_frame_lock\n#define WGL_I3D_swap_frame_lock 1\n\ttypedef BOOL(WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnableFrameLockI3D(void);\n\tBOOL WINAPI wglDisableFrameLockI3D(void);\n\tBOOL WINAPI wglIsEnabledFrameLockI3D(BOOL *pFlag);\n\tBOOL WINAPI wglQueryFrameLockMasterI3D(BOOL *pFlag);\n#endif\n#endif /* WGL_I3D_swap_frame_lock */\n\n#ifndef WGL_I3D_swap_frame_usage\n#define WGL_I3D_swap_frame_usage 1\n\ttypedef BOOL(WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);\n\ttypedef BOOL(WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetFrameUsageI3D(float *pUsage);\n\tBOOL WINAPI wglBeginFrameTrackingI3D(void);\n\tBOOL WINAPI wglEndFrameTrackingI3D(void);\n\tBOOL WINAPI wglQueryFrameTrackingI3D(DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n#endif\n#endif /* WGL_I3D_swap_frame_usage */\n\n#ifndef WGL_NV_DX_interop\n#define WGL_NV_DX_interop 1\n#define WGL_ACCESS_READ_ONLY_NV 0x00000000\n#define WGL_ACCESS_READ_WRITE_NV 0x00000001\n#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002\n\ttypedef BOOL(WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);\n\ttypedef HANDLE(WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);\n\ttypedef BOOL(WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);\n\ttypedef HANDLE(WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);\n\ttypedef BOOL(WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);\n\ttypedef BOOL(WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);\n\ttypedef BOOL(WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);\n\ttypedef BOOL(WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglDXSetResourceShareHandleNV(void *dxObject, HANDLE shareHandle);\n\tHANDLE WINAPI wglDXOpenDeviceNV(void *dxDevice);\n\tBOOL WINAPI wglDXCloseDeviceNV(HANDLE hDevice);\n\tHANDLE WINAPI wglDXRegisterObjectNV(HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);\n\tBOOL WINAPI wglDXUnregisterObjectNV(HANDLE hDevice, HANDLE hObject);\n\tBOOL WINAPI wglDXObjectAccessNV(HANDLE hObject, GLenum access);\n\tBOOL WINAPI wglDXLockObjectsNV(HANDLE hDevice, GLint count, HANDLE *hObjects);\n\tBOOL WINAPI wglDXUnlockObjectsNV(HANDLE hDevice, GLint count, HANDLE *hObjects);\n#endif\n#endif /* WGL_NV_DX_interop */\n\n#ifndef WGL_NV_DX_interop2\n#define WGL_NV_DX_interop2 1\n#endif /* WGL_NV_DX_interop2 */\n\n#ifndef WGL_NV_copy_image\n#define WGL_NV_copy_image 1\n\ttypedef BOOL(WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglCopyImageSubDataNV(HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n#endif\n#endif /* WGL_NV_copy_image */\n\n#ifndef WGL_NV_delay_before_swap\n#define WGL_NV_delay_before_swap 1\n\ttypedef BOOL(WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglDelayBeforeSwapNV(HDC hDC, GLfloat seconds);\n#endif\n#endif /* WGL_NV_delay_before_swap */\n\n#ifndef WGL_NV_float_buffer\n#define WGL_NV_float_buffer 1\n#define WGL_FLOAT_COMPONENTS_NV 0x20B0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4\n#define WGL_TEXTURE_FLOAT_R_NV 0x20B5\n#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6\n#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7\n#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8\n#endif /* WGL_NV_float_buffer */\n\n#ifndef WGL_NV_gpu_affinity\n#define WGL_NV_gpu_affinity 1\n\tDECLARE_HANDLE(HGPUNV);\n\tstruct _GPU_DEVICE {\n\t\tDWORD cb;\n\t\tCHAR DeviceName[32];\n\t\tCHAR DeviceString[128];\n\t\tDWORD Flags;\n\t\tRECT rcVirtualScreen;\n\t};\n\ttypedef struct _GPU_DEVICE *PGPU_DEVICE;\n#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0\n#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\n\ttypedef HDC(WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);\n\ttypedef BOOL(WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\n\ttypedef BOOL(WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglEnumGpusNV(UINT iGpuIndex, HGPUNV *phGpu);\n\tBOOL WINAPI wglEnumGpuDevicesNV(HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\n\tHDC WINAPI wglCreateAffinityDCNV(const HGPUNV *phGpuList);\n\tBOOL WINAPI wglEnumGpusFromAffinityDCNV(HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\n\tBOOL WINAPI wglDeleteDCNV(HDC hdc);\n#endif\n#endif /* WGL_NV_gpu_affinity */\n\n#ifndef WGL_NV_multisample_coverage\n#define WGL_NV_multisample_coverage 1\n#define WGL_COVERAGE_SAMPLES_NV 0x2042\n#define WGL_COLOR_SAMPLES_NV 0x20B9\n#endif /* WGL_NV_multisample_coverage */\n\n#ifndef WGL_NV_present_video\n#define WGL_NV_present_video 1\n\tDECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);\n#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0\n\ttypedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tint WINAPI wglEnumerateVideoDevicesNV(HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);\n\tBOOL WINAPI wglBindVideoDeviceNV(HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);\n\tBOOL WINAPI wglQueryCurrentContextNV(int iAttribute, int *piValue);\n#endif\n#endif /* WGL_NV_present_video */\n\n#ifndef WGL_NV_render_depth_texture\n#define WGL_NV_render_depth_texture 1\n#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4\n#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5\n#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6\n#define WGL_DEPTH_COMPONENT_NV 0x20A7\n#endif /* WGL_NV_render_depth_texture */\n\n#ifndef WGL_NV_render_texture_rectangle\n#define WGL_NV_render_texture_rectangle 1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1\n#define WGL_TEXTURE_RECTANGLE_NV 0x20A2\n#endif /* WGL_NV_render_texture_rectangle */\n\n#ifndef WGL_NV_swap_group\n#define WGL_NV_swap_group 1\n\ttypedef BOOL(WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);\n\ttypedef BOOL(WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);\n\ttypedef BOOL(WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglJoinSwapGroupNV(HDC hDC, GLuint group);\n\tBOOL WINAPI wglBindSwapBarrierNV(GLuint group, GLuint barrier);\n\tBOOL WINAPI wglQuerySwapGroupNV(HDC hDC, GLuint *group, GLuint *barrier);\n\tBOOL WINAPI wglQueryMaxSwapGroupsNV(HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);\n\tBOOL WINAPI wglQueryFrameCountNV(HDC hDC, GLuint *count);\n\tBOOL WINAPI wglResetFrameCountNV(HDC hDC);\n#endif\n#endif /* WGL_NV_swap_group */\n\n#ifndef WGL_NV_vertex_array_range\n#define WGL_NV_vertex_array_range 1\n\ttypedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);\n\ttypedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tvoid *WINAPI wglAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);\n\tvoid WINAPI wglFreeMemoryNV(void *pointer);\n#endif\n#endif /* WGL_NV_vertex_array_range */\n\n#ifndef WGL_NV_video_capture\n#define WGL_NV_video_capture 1\n\tDECLARE_HANDLE(HVIDEOINPUTDEVICENV);\n#define WGL_UNIQUE_ID_NV 0x20CE\n#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\n\ttypedef UINT(WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);\n\ttypedef BOOL(WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\ttypedef BOOL(WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglBindVideoCaptureDeviceNV(UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\n\tUINT WINAPI wglEnumerateVideoCaptureDevicesNV(HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);\n\tBOOL WINAPI wglLockVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\tBOOL WINAPI wglQueryVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);\n\tBOOL WINAPI wglReleaseVideoCaptureDeviceNV(HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n#endif\n#endif /* WGL_NV_video_capture */\n\n#ifndef WGL_NV_video_output\n#define WGL_NV_video_output 1\n\tDECLARE_HANDLE(HPVIDEODEV);\n#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0\n#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1\n#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2\n#define WGL_VIDEO_OUT_COLOR_NV 0x20C3\n#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4\n#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5\n#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define WGL_VIDEO_OUT_FRAME 0x20C8\n#define WGL_VIDEO_OUT_FIELD_1 0x20C9\n#define WGL_VIDEO_OUT_FIELD_2 0x20CA\n#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB\n#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC\n\ttypedef BOOL(WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);\n\ttypedef BOOL(WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);\n\ttypedef BOOL(WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);\n\ttypedef BOOL(WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetVideoDeviceNV(HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);\n\tBOOL WINAPI wglReleaseVideoDeviceNV(HPVIDEODEV hVideoDevice);\n\tBOOL WINAPI wglBindVideoImageNV(HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\n\tBOOL WINAPI wglReleaseVideoImageNV(HPBUFFERARB hPbuffer, int iVideoBuffer);\n\tBOOL WINAPI wglSendPbufferToVideoNV(HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);\n\tBOOL WINAPI wglGetVideoInfoNV(HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\n#endif\n#endif /* WGL_NV_video_output */\n\n#ifndef WGL_OML_sync_control\n#define WGL_OML_sync_control 1\n\ttypedef BOOL(WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);\n\ttypedef BOOL(WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);\n\ttypedef INT64(WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\n\ttypedef INT64(WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\n\ttypedef BOOL(WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);\n\ttypedef BOOL(WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);\n#ifdef WGL_WGLEXT_PROTOTYPES\n\tBOOL WINAPI wglGetSyncValuesOML(HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);\n\tBOOL WINAPI wglGetMscRateOML(HDC hdc, INT32 *numerator, INT32 *denominator);\n\tINT64 WINAPI wglSwapBuffersMscOML(HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\n\tINT64 WINAPI wglSwapLayerBuffersMscOML(HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\n\tBOOL WINAPI wglWaitForMscOML(HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);\n\tBOOL WINAPI wglWaitForSbcOML(HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);\n#endif\n#endif /* WGL_OML_sync_control */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif"}, {"path": "utils/window.cpp", "language": "cpp", "loc": 371, "comment_density": 0.065, "code": "\n#include \"window.h\"\n\n#ifndef _WIN32\n#include \n#endif\n\nvoid APIENTRY glDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, void*) {\n\n\t// format the message nicely\n\tauto output = printf(\"OpenGL \");\n\n\tswitch (type) {\n\tcase GL_DEBUG_TYPE_ERROR:\t\t\t\t\tprintf(\"error\");\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_PORTABILITY:\t\t\t\tprintf(\"portability issue\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_PERFORMANCE:\t\t\t\tprintf(\"performance issue\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_OTHER:\t\t\t\t\tprintf(\"issue\");\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:\t\tprintf(\"undefined behavior\");\t\t\t\tbreak;\n\tcase GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:\t\tprintf(\"deprecated behavior\");\t\t\t\tbreak;\n\tdefault:\t\t\t\t\t\t\t\t\tprintf(\"issue(?)\");\t\t\t\t\t\t\tbreak;\n\t}\n\tswitch (source) {\n\tcase GL_DEBUG_SOURCE_API:\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_WINDOW_SYSTEM:\t\t\tprintf(\" in the window system\");\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_SHADER_COMPILER:\t\tprintf(\" in the shader compiler\");\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_THIRD_PARTY:\t\t\tprintf(\" in third party code\");\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_APPLICATION:\t\t\tprintf(\" in this program\");\t\t\t\t\tbreak;\n\tcase GL_DEBUG_SOURCE_OTHER:\t\t\t\t\tprintf(\" in an undefined source\");\t\t\tbreak;\n\tdefault:\t\t\t\t\t\t\t\t\tprintf(\" nowhere(?)\");\t\t\t\t\t\tbreak;\n\t}\n\n\tprintf(\", id %u:\\n%.*s\\n\", id, length, message);\n\t// this is invaluable; you can directly see where any opengl error originated by checking the call stack at this breakpoint\n\tif (type == GL_DEBUG_TYPE_ERROR)\n#ifdef _WIN32\n\t\t__debugbreak();\n#else\n\t\traise(SIGTRAP);\n#endif\n}\n\nvoid setupDebug() {\n\t// enable debug output\n\tglEnable(GL_DEBUG_OUTPUT);\n\t// debug output from main thread: get the correct stack frame when breaking\n\tglEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);\n\n\tglDebugMessageCallback((GLDEBUGPROC)glDebugCallback, 0);\n\n\t// query everything about errors, deprecated and undefined things\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_ERROR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, GL_DONT_CARE, 0, 0, GL_TRUE);\n\n\t// disable misc info. might want to check these from time to time!\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 0, 0, GL_FALSE);\n\tglDebugMessageControl(GL_DONT_CARE, GL_DEBUG_TYPE_PERFORMANCE, GL_DONT_CARE, 0, 0, GL_FALSE);\n}\n\n#ifdef _WIN32\n\n#include \"wglext.h\"\n\n#pragma comment(lib, \"opengl32.lib\")\n\nconst int GL_WINDOW_ATTRIBUTES[] = {\n\tWGL_DRAW_TO_WINDOW_ARB, GL_TRUE,\n\tWGL_SUPPORT_OPENGL_ARB, GL_TRUE,\n\tWGL_DOUBLE_BUFFER_ARB, GL_TRUE,\n\tWGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, GL_TRUE,\n\t//WGL_SAMPLES_ARB, 8, // MSAA\n\n\tWGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,\n\tWGL_COLOR_BITS_ARB, 32,\n\tWGL_DEPTH_BITS_ARB, 24,\n0 };\n\nconst int GL_CONTEXT_ATTRIBUTES[] = {\n\tWGL_CONTEXT_MAJOR_VERSION_ARB, 4,\n\tWGL_CONTEXT_MINOR_VERSION_ARB, 6,\n\tWGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,\n\t//WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,\n0 };\n\nHWND wnd = nullptr;\nHDC dc;\nHGLRC rc;\n\n// update the frame onto screen\nvoid swapBuffers() {\n\tSwapBuffers(dc);\n}\n\nvoid setTitle(const char* title) {\n\tSetWindowTextA(wnd, title);\n}\n\nivec2 getMouse() {\n\tPOINT mouse;\n\tGetCursorPos(&mouse);\n\tScreenToClient(wnd, &mouse);\n\treturn ivec2(mouse.x, mouse.y);\n}\n\nvoid setMouse(ivec2 p) {\n\tPOINT p_{ p.x, p.y };\n\tClientToScreen(wnd, &p_);\n\tSetCursorPos(p_.x, p_.y);\n}\n\nivec2 windowSize() {\n\tRECT r;\n\tGetClientRect(wnd, &r);\n\treturn { r.right - r.left, r.bottom - r.top };\n}\n\nWPARAM down[256]; int downptr = 0;\nWPARAM hit[256]; int hitptr = 0;\n\nbool keyDown(uint vk_code) {\n\tfor (int i = 0; i < downptr; ++i)\n\t\tif (vk_code == down[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nbool keyHit(uint vk_code) {\n\tfor (int i = 0; i < hitptr; ++i)\n\t\tif (vk_code == hit[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nvoid resetHits() {\n\thitptr = 0;\n}\n\ninline WPARAM mapExtended(WPARAM wParam, LPARAM lParam) {\n\tint ext = (lParam>>24)&1;\n\tswitch(wParam) {\n\t\tcase VK_SHIFT: return MapVirtualKeyEx((lParam >> 16) & 0xFF, MAPVK_VSC_TO_VK_EX, GetKeyboardLayout(0));\n\t\tcase VK_CONTROL: return VK_LCONTROL+ext;\n\t\tcase VK_MENU: return VK_LMENU+ext;\n\t\tcase VK_RETURN: return VK_RETURN + ext*(VK_SEPARATOR-VK_RETURN);\n\t\tdefault: return wParam;\n\t}\n}\n\nLRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {\n\tswitch (uMsg) {\n\tcase WM_CLOSE:\n\t\tPostQuitMessage(0);\n\t\treturn 0;\n\tcase WM_SYSKEYDOWN:\n\tcase WM_KEYDOWN:\n\t\twParam = mapExtended(wParam, lParam);\n\t\tif (!keyDown((UINT)wParam))\n\t\t\tdown[downptr++] = hit[hitptr++] = wParam; // todo: if mapNarrowed(wParam)!=wParam: also add mapNarrowed()\n\t\tif (wParam == VK_ESCAPE)\n\t\t\tPostQuitMessage(0);\n\t\treturn 0;\n\tcase WM_SYSKEYUP:\n\tcase WM_KEYUP:\n\t\twParam = mapExtended(wParam, lParam);\n\t\tfor (int i = 0; i < downptr - 1; ++i) // todo: if mapNarrowed(wParam)!=wParam: also remove mapNarrowed()\n\t\t\tif (wParam == down[i]) {\n\t\t\t\tdown[i] = down[downptr-1];\n\t\t\t\tbreak;\n\t\t\t}\n\t\tif (downptr > 0) downptr--;\n\t\treturn 0;\n\tcase WM_KILLFOCUS:\n\t//\thitptr = downptr = 0;\n\t\treturn 0;\n\t}\n\treturn DefWindowProc(hwnd, uMsg, wParam, lParam);\n}\n\nbool loop() {\n\thitptr = 0;\n\tMSG msg;\n\tbool result = true;\n\twhile (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {\n\t\tTranslateMessage(&msg);\n\t\tDispatchMessage(&msg);\n\t\tif (msg.message == WM_QUIT) {\n\t\t\tresult = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show) {\n\n\tif (glOpen()) return;\n\n\tWNDCLASSEX windowClass = { 0 };\n\twindowClass.cbSize = sizeof(windowClass);\n\twindowClass.hInstance = GetModuleHandle(nullptr);\n\twindowClass.lpszClassName = TEXT(\"classy class\");\n\twindowClass.hCursor = LoadCursor(nullptr, IDC_ARROW);\n\twindowClass.style = CS_OWNDC;\n\twindowClass.lpfnWndProc = wndProc;\n\tRegisterClassEx(&windowClass);\n\n\tPIXELFORMATDESCRIPTOR formatDesc = { 0 };\n\tformatDesc.nVersion = 1;\n\tformatDesc.nSize = sizeof(formatDesc);\n\tformatDesc.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;\n\tformatDesc.iLayerType = PFD_MAIN_PLANE;\n\tformatDesc.iPixelType = PFD_TYPE_RGBA;\n\tformatDesc.cColorBits = 32;\n\tformatDesc.cDepthBits = 24;\n\tformatDesc.cStencilBits = 8;\n\n\t// create a temporary window to have a functional opengl context in order to get some extension function pointers\n\tHWND tempWnd = CreateWindow(TEXT(\"classy class\"), TEXT(\"windy window\"), WS_POPUP, 0, 0, width, height, nullptr, nullptr, GetModuleHandle(nullptr), nullptr);\n\tHDC tempDC = GetDC(tempWnd);\n\tSetPixelFormat(tempDC, ChoosePixelFormat(tempDC, &formatDesc), &formatDesc);\n\tHGLRC tempRC = wglCreateContext(tempDC);\n\twglMakeCurrent(tempDC, tempRC);\n\n\t// these are why we made the temporary context; can set more pixel format attributes (multisample, floating point etc.) and create debug/core/etc contexts\n\tauto wglChoosePixelFormat = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress(\"wglChoosePixelFormatARB\");\n\tauto wglCreateContextAttribs = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress(\"wglCreateContextAttribsARB\");\n\n\t// adjust the window borders away, center the window\n\tRECT area = { 0, 0, width, height };\n\tconst DWORD style = (fullscreen ? WS_POPUP : (WS_SYSMENU|WS_CAPTION|WS_MINIMIZEBOX)) | ((fullscreen||show)?WS_VISIBLE:0);\n\tif (fullscreen) {\n\t\tDEVMODE mode = { 0 };\n\t\tmode.dmSize = sizeof(mode);\n\t\tmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;\n\t\tmode.dmPelsWidth = width; mode.dmPelsHeight = height;\n\t\tmode.dmBitsPerPel = 32;\n\t\tChangeDisplaySettings(&mode, CDS_FULLSCREEN);\n\t}\n\n\tAdjustWindowRect(&area, style, false);\n\tint adjustedWidth = fullscreen ? width : area.right - area.left, adjustedHeight = fullscreen ? height : area.bottom - area.top;\n\tint centerX = (GetSystemMetrics(SM_CXSCREEN) - adjustedWidth) / 2, centerY = (GetSystemMetrics(SM_CYSCREEN) - adjustedHeight) / 2;\n\tif (fullscreen)\n\t\tcenterX = centerY = 0;\n\n\t// create the final window and context\n\tdc = GetDC(wnd = CreateWindowA(\"classy class\", title, style, centerX, centerY, adjustedWidth, adjustedHeight, nullptr, nullptr, GetModuleHandle(nullptr), nullptr));\n\n\tint format; UINT numFormats;\n\twglChoosePixelFormat(dc, GL_WINDOW_ATTRIBUTES, nullptr, 1, &format, &numFormats);\n\n\tSetPixelFormat(dc, format, &formatDesc);\n\n\trc = wglCreateContextAttribs(dc, 0, GL_CONTEXT_ATTRIBUTES);\n\n\twglMakeCurrent(dc, rc);\n\tglViewport(0, 0, width, height);\n\n\t// release the temporary window and context\n\twglDeleteContext(tempRC);\n\tReleaseDC(tempWnd, tempDC);\n\tDestroyWindow(tempWnd);\n\n\t// what GL did we get?\n\tprintf(\"gl %s\\non %s\\nby %s\\nsl %s\\n\", glGetString(GL_VERSION), glGetString(GL_RENDERER), glGetString(GL_VENDOR), glGetString(GL_SHADING_LANGUAGE_VERSION));\n\n\tloadgl();\n\n\tsetupDebug();\n\tglEnable(GL_FRAMEBUFFER_SRGB);\n\t((PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress(\"wglSwapIntervalEXT\"))(-1); // freesync\n}\n\n#include \nvoid closeGL() {\n\tif (!glOpen()) return;\n\n\t// release context, window\n\tChangeDisplaySettings(nullptr, CDS_FULLSCREEN);\n\twglMakeCurrent(0, 0);\n\twglDeleteContext(rc);\n\tReleaseDC(wnd, dc);\n\tDestroyWindow(wnd);\n\twnd = nullptr;\n\tUnregisterClass(TEXT(\"classy class\"), GetModuleHandle(nullptr));\n\t_CrtDumpMemoryLeaks();\n}\n\nbool glOpen() {\n\treturn wnd != nullptr;\n}\n\nvoid showWindow() {\n\tShowWindow(wnd, SW_SHOW);\n}\n\nvoid hideWindow() {\n\tShowWindow(wnd, SW_HIDE);\n}\n\n#else\n\n#ifdef HEADLESS\n#define EGL_NO_X11\n#define MESA_EGL_NO_X11_HEADERS\n#else\n#include \nDisplay* xdisplay = nullptr;\nWindow xwindow;\n#endif\n\n#include \n#include \n\n#define GLAPIENTRY\n\n#include \n\nEGLDisplay display;\nEGLContext context;\n\nEGLSurface surface = EGL_NO_SURFACE;\n\nivec2 windowsize{};\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show) {\n\twindowsize = ivec2(width, height);\n#ifndef HEADLESS\n\txdisplay = XOpenDisplay(nullptr);\n\tXSetWindowAttributes window_attributes = {0};\n\twindow_attributes.event_mask = ExposureMask | PointerMotionMask | KeyPressMask;\n\txwindow = XCreateWindow(xdisplay, DefaultRootWindow(xdisplay), 0, 0, width, height, 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask, &window_attributes);\n\tXStoreName(xdisplay, xwindow, title);\n\tXMapWindow(xdisplay, xwindow);\n\tdisplay = eglGetDisplay((EGLNativeDisplayType)xdisplay);\n#else\n\tdisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);\n#endif\n\tEGLint major, minor;\n\teglInitialize(display, &major, &minor);\n\tconst EGLint config_attributes[] = {\n\t\tEGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,\n\t\tEGL_DEPTH_SIZE, 24, EGL_STENCIL_SIZE, 8,\n\t\tEGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,\n#ifdef HEADLESS\n\t\tEGL_SURFACE_TYPE, EGL_PBUFFER_BIT,\n#endif\n\t\tEGL_NONE\n\t};\n\n\teglBindAPI(EGL_OPENGL_API);\n\n\tEGLConfig config; EGLint configCount;\n\teglChooseConfig(display, config_attributes, &config, 1, &configCount);\n\n\tconst EGLint context_attributes[] = {\n\t\tEGL_CONTEXT_MAJOR_VERSION, 4,\n\t\tEGL_CONTEXT_MINOR_VERSION, 6,\n\t\tEGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,\n\t\tEGL_NONE\n\t};\n\tcontext = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attributes);\n#ifndef HEADLESS\n\tEGLint surface_attributes[] = {\n\t\tEGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR,\n\t\tEGL_RENDER_BUFFER, EGL_BACK_BUFFER,\n\t\tEGL_NONE\n\t};\n\tsurface = eglCreateWindowSurface(display, config, xwindow, surface_attributes);\n#else\n\tEGLint surface_attributes[] = {\n\t\t//EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR,\n\t\t//EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,\n\t\t//EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,\n\t\tEGL_WIDTH, width, EGL_HEIGHT, height,\n\t\tEGL_NONE\n\t};\n\tsurface = eglCreatePbufferSurface(display, config, surface_attributes);\n#endif\n\teglMakeCurrent(display, surface, surface, context);\n\tloadgl();\n\n\tsetupDebug();\n\tglEnable(GL_FRAMEBUFFER_SRGB);\n}\nvoid closeGL() {\n\teglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);\n\teglDestroySurface(display, surface);\n\teglDestroyContext(display, context);\n\teglTerminate(display);\n#ifndef HEADLESS\n\tXDestroyWindow(xdisplay, xwindow);\n\tXCloseDisplay(xdisplay);\n#endif\n}\nbool loop() {\n#ifdef HEADLESS\n\treturn false;\n#else\n\treturn true;\n#endif\n}\nbool glOpen() {\n\treturn surface!=EGL_NO_SURFACE;\n}\nvoid swapBuffers() {\n\t//printf(\"oh lord is it this\\n\");\n\teglSwapBuffers(display, surface);\n}\nvoid setTitle(const char* title) {}\nvoid showWindow() {}\nvoid hideWindow() {}\n\nint down[256]; int downptr = 0;\nint hit[256]; int hitptr = 0;\n\nbool keyDown(uint vk_code) {\n\tfor (int i = 0; i < downptr; ++i)\n\t\tif (vk_code == down[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nbool keyHit(uint vk_code) {\n\tfor (int i = 0; i < hitptr; ++i)\n\t\tif (vk_code == hit[i])\n\t\t\treturn true;\n\treturn false;\n}\n\nvoid resetHits() {\n\thitptr = 0;\n}\n\nivec2 getMouse() { return {};}\nvoid setMouse(ivec2) {}\n\nivec2 windowSize() {\n\treturn windowsize;\n}\n\n#endif\n"}, {"path": "utils/window.h", "language": "c", "loc": 48, "comment_density": 0.062, "code": "\n#pragma once\n\n#ifdef _WIN32\n\n#define VC_EXTRALEAN\n#define WIN32_LEAN_AND_MEAN\n#define NOMINMAX\n#include \n#endif\n#include \n\n#define GL_GLEXT_LEGACY\n#include \n#undef GL_VERSION_1_3\n#include \"glext.h\"\n#include \"loadgl46.h\"\n\nvoid setupGL(int width, int height, const char* title, bool fullscreen, bool show);\nvoid closeGL();\nbool loop();\nbool glOpen();\nvoid swapBuffers();\nvoid setTitle(const char* title);\nvoid showWindow();\nvoid hideWindow();\n\n#include \"glsl.h\"\n\nbool keyDown(uint vk_code);\nbool keyHit(uint vk_code);\nvoid resetHits();\n\nivec2 getMouse();\nvoid setMouse(ivec2);\n\nivec2 windowSize();\n\n// todo: make this a true class? or use some kind of \"finally\" for the close?\n// possible reasoning: don't really want singleton, but don't really want to support multiple contexts either\n// why not just global functions: to be nice, we want to free all RAII objects before closing the GL context, so this has to be RAII as well\nstruct OpenGL {\n\tOpenGL(\n\t\tint width, int height,\n\t\tconst char* title = \"\",\n\t\tbool fullscreen = false,\n\t\tbool show = true)\n\t{\n\t\tif (glOpen()) return;\n\t\tisOwning = true;\n\t\tsetupGL(width, height, title, fullscreen, show);\n\t}\n\t~OpenGL() {\n\t\tif(isOwning)\n\t\t\tcloseGL();\n\t}\n\tbool isOwning = false;\n};\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "MIT", "non_commercial": false, "comment_density": 0.054, "dedup_hash": "33c86aeadedeffdd", "has_readme": true, "build_system": "make", "dependency_count": 40, "has_demo": false} -{"id": "webgl_examples_bumpmapping", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Bumpmapping", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "bumpmapping/bumpmapping.html", "language": "html", "loc": 20, "comment_density": 0.0, "code": "\n\n\n\nCamera height: \n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "bumpmapping/bumpmapping.js", "language": "javascript", "loc": 95, "comment_density": 0.105, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-5.0, cam_height, 0];\n\nvar light_pos_radius = 5;\nvar light_pos = [-1, 5.0, 0];\n\nvar plane = new Plane;\nvar normal_map_size = 512;\nvar texture_gen_bumps = new Texture_generation_bumps;\nvar texture_gen_triangles = new Texture_generation_triangles;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if(gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n //needed to be able to have floating point textures in webgl1\n if(gl.getExtension('OES_texture_float') == null){\n alert(\"cannot have floating point textures\");\n return;\n }\n\n if(gl.getExtension('OES_texture_float_linear') == null){\n alert(\"cannot have linear floating point textures\");\n return;\n }\n\n plane.setup(gl);\n\n texture_gen_bumps.generate_normal_map(normal_map_size);\n texture_gen_triangles.generate_normal_map(normal_map_size);\n\n plane.set_normal_map(texture_gen_bumps.array_texture, normal_map_size);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n model_matrix_plane = mat4.rotate(model_matrix_plane, model_matrix_plane, 0.1*Math.PI, [0,1,0]);\n}\n\nfunction change_selection(){\n var bump_selection = document.getElementById(\"bumps\");\n var triangles_selection = document.getElementById(\"triangles\");\n\n if(bump_selection.checked == true){\n plane.set_normal_map(texture_gen_bumps.array_texture, normal_map_size);\n }\n if(triangles_selection.checked == true){\n plane.set_normal_map(texture_gen_triangles.array_texture, normal_map_size);\n }\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independent\n time_diff = time-last_time;\n\n var camera_height = document.getElementById(\"slider_height\").value;\n\n var light_speed = 80;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 5;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n plane.set_light_pos(light_pos_scaled)\n\n position_cam[1] = camera_height/10;\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "bumpmapping/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n pixel_pos = vec3(model*vertex_pos);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "bumpmapping/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 15, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform vec3 light_pos;\n\n uniform sampler2D texture;\n\n void main() {\n vec3 pixel_normal = texture2D(texture, frag_uv).xyz;\n\n //calculate phong according to the normal map\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n //have white plane affected by light\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "bumpmapping/plane.js", "language": "javascript", "loc": 138, "comment_density": 0.058, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n //prepare buffer for texture\n this.texture_id = gl.createTexture();\n }\n\n set_normal_map(normal_map_float, size){\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, size, size, 0, gl.RGB, gl.FLOAT, new Float32Array(normal_map_float));\n\n // gl.generateMipmap(gl.TEXTURE_2D);\n // or\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n pixel_pos = vec3(model*vertex_pos);\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n varying vec3 pixel_pos;\n\n uniform vec3 light_pos;\n\n uniform sampler2D texture;\n\n void main() {\n vec3 pixel_normal = texture2D(texture, frag_uv).xyz;\n\n //calculate phong according to the normal map\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n //have white plane affected by light\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "bumpmapping/texture_generation.js", "language": "javascript", "loc": 90, "comment_density": 0.111, "code": "class Texture_generation{\n\n normalize3(vec){\n var length = Math.sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])\n return [vec[0]/length, vec[1]/length, vec[2]/length]\n }\n\n cross(vec_a, vec_b){\n return [vec_a[1]*vec_b[2]-vec_a[2]*vec_b[1], vec_a[2]*vec_b[0]-vec_a[0]*vec_b[2], vec_a[0]*vec_b[1]-vec_a[1]*vec_b[0]];\n }\n\n //default flat normal map\n generate_value(x, y, size){\n return 0;\n }\n\n //generate a normal map from the texture values\n generate_normal_map(size){\n this.array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var EPSILON = 0.001;\n\n //find derivatives in both direction\n var ddi = this.generate_value(i+EPSILON, j, size)-this.generate_value(i, j, size);\n var ddj = this.generate_value(i, j+EPSILON, size)-this.generate_value(i, j, size);\n\n //make vectors from derivatives\n var der_x = [EPSILON, ddi, 0];\n var der_y = [0, ddj, EPSILON];\n\n der_x = this.normalize3(der_x)\n der_y = this.normalize3(der_y)\n\n //cross should be the normal\n var normal = this.cross(der_y, der_x);\n\n normal = this.normalize3(normal);\n\n this.array_texture.push( normal[2] ); //X\n this.array_texture.push( normal[1] ); //Y\n this.array_texture.push( normal[0] ); //Z\n }\n }\n }\n}\n\n//returns pixel for a \"bumpy\" normal map\nclass Texture_generation_bumps extends Texture_generation{\n\n generate_value(x, y, size){\n //have a flat surface with only shallow holes in it\n var sine_frequency = 8*3.1415/size;\n var val = Math.sin(sine_frequency*x)*Math.sin(sine_frequency*y);\n if (val < 0.5){\n return 0;\n }\n\n return -(val-0.5)*8;\n }\n}\n\nclass Texture_generation_triangles extends Texture_generation{\n\n generate_value_sub(x, y, center_x, center_y, size){\n var relative_x = Math.abs(x-center_x);\n var relative_y = Math.abs(y-center_y);\n\n var depth = size/4;\n\n var x_min = center_x-size;\n var x_max = center_x+size;\n var y_min = center_y-size;\n var y_max = center_y+size;\n\n if(x > x_min && x < x_max){\n if(y > y_min && y < y_max){\n if(y <= center_y && relative_y >= relative_x){\n return (y-y_min)/depth;\n }\n if(y > center_y && relative_y > relative_x){\n return (y_max-y)/depth;\n }\n if(x < center_x){\n return (x-x_min)/depth;\n }\n if(x > center_x){\n return (x_max-x)/depth;\n }\n\n }\n }\n\n return 0;\n }\n\n generate_value(x, y, size){\n var sub_div = 64;\n var square_size = 32;\n\n for (var i = 0; i < size; i+=sub_div) {\n for (var j = 0; j < size; j+=sub_div) {\n if(x > i && x < (i+sub_div)){\n if(y > j && y < (j+sub_div)){\n return this.generate_value_sub(x ,y , i+square_size, j+square_size, square_size/2);\n }\n }\n }\n }\n return 0;\n }\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.079, "dedup_hash": "150c45cd54df3d87", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_cube_rotation", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Cube Rotation", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "cube_rotation/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/cube.js", "language": "javascript", "loc": 206, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //buffers for colours\n this.col_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.colours), this.gl.STATIC_DRAW);\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"colour\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"colour\"));\n\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n text_coord = [\n // Front\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n // Back\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Top\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Bottom\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // right\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Left\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n ];\n\n colours = [\n // Front face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Back face\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Right face\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n\n // Left face\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n ];\n}\n"}, {"path": "cube_rotation/cube_rotation.html", "language": "html", "loc": 15, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "cube_rotation/cube_rotation.js", "language": "javascript", "loc": 59, "comment_density": 0.119, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar cube = new Cube;\nvar plane = new Plane;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n cube.setup(gl);\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n cube.set_vp(view_matrix, proj_matrix);\n cube.draw();\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the cube by a little bit\n var model = cube.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n cube.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "cube_rotation/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 6, "comment_density": 0.167, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "cube_rotation/plane.js", "language": "javascript", "loc": 86, "comment_density": 0.012, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.082, "dedup_hash": "1739cc2d304a11cf", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_framebuffer", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:31+00:00", "source_type": "repo", "title": "Framebuffer", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "postprocessing/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "framebuffer/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/cube.js", "language": "javascript", "loc": 206, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //buffers for colours\n this.col_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.colours), this.gl.STATIC_DRAW);\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.col_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"colour\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"colour\"));\n\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n frag_colour = colour;\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n text_coord = [\n // Front\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n // Back\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Top\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // Bottom\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n // right\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n 0.0, 1.0,\n // Left\n 0.0, 1.0,\n 1.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n ];\n\n colours = [\n // Front face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Back face\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n 1.0, 1.0, 0.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Right face\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n 0.0, 1.0, 1.0,\n\n // Left face\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n 1.0, 0.0, 1.0,\n ];\n}\n"}, {"path": "framebuffer/framebuffer.html", "language": "html", "loc": 29, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\nEffect:\n\n\n\n\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "framebuffer/framebuffer.js", "language": "javascript", "loc": 38, "comment_density": 0.158, "code": "class Framebuffer{\n\n setup(gl, image_width, image_height) {\n this.gl = gl;\n\n this.image_width = image_width;\n this.image_height = image_height;\n\n this.fb_tex = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.fb_tex);\n\n //allocate space for the texture, but feed nothing to it (null)\n //will be filled later by rendering in the framebuffer\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.image_width, this.image_height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n this.fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n\n //key part, we associate the texture with the framebuffer\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.fb_tex, 0);\n\n //create a depth buffer for the framebuffer, otherwise 3d rendering will be weird\n this.depth_buffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.depth_buffer);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, this.image_width, this.image_height);\n\n //associate the render buffer with the framebuffer\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depth_buffer);\n\n //unbind everything to avoid pollution\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n bind(){\n this.gl.viewport(0, 0, this.image_width, this.image_height);\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n }\n\n unbind(){\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n get_texture(){\n return this.fb_tex;\n }\n\n}"}, {"path": "framebuffer/main.js", "language": "javascript", "loc": 91, "comment_density": 0.099, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar cube = new Cube;\nvar plane = new Plane;\n\nvar quad_screen = new Quad_screen;\n\nvar framebuffer = new Framebuffer;\n\nvar last_time = 0;\n\nvar canvas_width = 1600;\nvar canvas_height = 900;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n canvas_width = gl.canvas.width;\n canvas_height = gl.canvas.height;\n\n cube.setup(gl);\n\n plane.setup(gl);\n\n quad_screen.setup(gl, canvas_width, canvas_height);\n\n framebuffer.setup(gl, canvas_width, canvas_height);\n\n quad_screen.set_framebuffer_texture(framebuffer.get_texture());\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n change_selection();\n}\n\nfunction change_selection(){\n\n if(document.getElementById(\"nothing\").checked == true){\n quad_screen.set_effect_active(0);\n }\n if(document.getElementById(\"invert\").checked == true){\n quad_screen.set_effect_active(1);\n }\n if(document.getElementById(\"gaussian\").checked == true){\n quad_screen.set_effect_active(2);\n }\n if(document.getElementById(\"sobel\").checked == true){\n quad_screen.set_effect_active(3);\n }\n if(document.getElementById(\"glass\").checked == true){\n quad_screen.set_effect_active(4);\n }\n}\n\nfunction draw(){\n //will render in frambuffer\n framebuffer.bind();\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n cube.set_vp(view_matrix, proj_matrix);\n cube.draw();\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the cube by a little bit\n var model = cube.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n cube.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n //everything after that will be rendered in the canvas\n framebuffer.unbind();\n\n quad_screen.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "framebuffer/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 6, "comment_density": 0.167, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/plane.js", "language": "javascript", "loc": 86, "comment_density": 0.012, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "framebuffer/quad_screen.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n gl_Position = vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/quad_screen.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 93, "comment_density": 0.054, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n uniform int effect_select;\n\n uniform float tex_width;\n uniform float tex_height;\n\n //grayscale\n float col_to_gs(vec3 vec){\n return 0.21*vec.x + 0.72*vec.y + 0.07*vec.z;\n }\n\n void main() {\n vec3 color_out = vec3(0.0, 0.0, 0.0);\n\n if(effect_select == 0){\n gl_FragColor = texture2D(texture, frag_uv);\n }\n else if(effect_select == 1){\n gl_FragColor = vec4(vec3(1.0)-texture2D(texture, frag_uv).rgb, 1.0);\n }\n else if(effect_select == 2){\n\n const int gauss_mat_size = 12;\n float variance = 10.0;\n float mean = float(gauss_mat_size)/2.0;\n float gauss_mat[gauss_mat_size];\n float gauss_mat_coef = 0.0;\n\n //init the blurring mat\n for(int i = 0; i < gauss_mat_size; i++){\n float val = 1.0/sqrt(2.0*3.1415*variance);\n val = val*pow(2.7182818, -pow((float(i)-mean), 2.0)/(2.0*variance));\n gauss_mat[i] = val;\n gauss_mat_coef += val;\n }\n\n gauss_mat_coef = 1.0/(gauss_mat_coef*gauss_mat_coef);\n\n for(int i = 0; i < gauss_mat_size; i++){\n float rel_i = float(i-(gauss_mat_size-1)/2);\n float sum = 0.0;\n for(int j = 0; j < gauss_mat_size; j++){\n float rel_j = float(j-(gauss_mat_size-1)/2);\n float matrix_val = gauss_mat[i]*gauss_mat[j];\n color_out += matrix_val*texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb;\n }\n }\n\n color_out = color_out*gauss_mat_coef;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 3){\n\n const int sobel_x_size = 3;\n // float sobel_x[sobel_x_size*sobel_x_size] = float[](1, 0, -1, 2, 0, -2, 1, 0, -1); //only glsl3.0\n float sobel_x[sobel_x_size*sobel_x_size];\n sobel_x[0] = 1.0;\n sobel_x[1] = 0.0;\n sobel_x[2] = -1.0;\n sobel_x[3] = 2.0;\n sobel_x[4] = 0.0;\n sobel_x[5] = -2.0;\n sobel_x[6] = 1.0;\n sobel_x[7] = 0.0;\n sobel_x[8] = -1.0;\n\n const int sobel_y_size = 3;\n // float sobel_y[sobel_y_size*sobel_y_size] = float[](1, 2, 1, 0, 0, 0, -1, -2, -1); //only glsl3.0\n float sobel_y[sobel_y_size*sobel_y_size];\n sobel_y[0] = 1.0;\n sobel_y[1] = 2.0;\n sobel_y[2] = 1.0;\n sobel_y[3] = 0.0;\n sobel_y[4] = 0.0;\n sobel_y[5] = 0.0;\n sobel_y[6] = -1.0;\n sobel_y[7] = -2.0;\n sobel_y[8] = -1.0;\n\n float edge_x = 0.0;\n float edge_y = 0.0;\n\n for(int i = 0; i < sobel_x_size; i++){\n float rel_i = float(i)-(float(sobel_x_size)-1.0)/2.0;\n\n for(int j = 0; j < sobel_y_size; j++){\n float rel_j = float(j)-(float(sobel_y_size)-1.0)/2.0;\n float grayscale_pixel = col_to_gs(texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb);\n edge_x += sobel_x[j*3+i]*grayscale_pixel;\n edge_y += sobel_y[j*3+i]*grayscale_pixel;\n }\n }\n\n color_out = vec3(sqrt(edge_x*edge_x+edge_y*edge_y));\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 4){\n float move_x = sin(frag_uv.x*500.0)*10.0;\n float move_y = sin(frag_uv.y*500.0)*10.0;\n\n color_out = texture2D(texture, frag_uv+vec2(move_x/tex_width,move_y/tex_height)).rgb;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else{\n gl_FragColor = texture2D(texture, frag_uv);\n }\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "framebuffer/quad_screen.js", "language": "javascript", "loc": 175, "comment_density": 0.034, "code": "\nclass Quad_screen{\n\n setup(gl, screen_width, screen_height){\n this.gl = gl;\n\n this.screen_width = screen_width;\n this.screen_height = screen_height;\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n this.effect_active = 0;\n }\n\n set_framebuffer_texture(tex){\n this.fb_texture_id = tex;\n }\n\n set_effect_active(effect){\n this.effect_active = effect;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.fb_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"effect_select\"), this.effect_active);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"tex_width\"), this.screen_width);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"tex_height\"), this.screen_height);\n\n\n this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n gl_Position = vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n uniform int effect_select;\n\n uniform float tex_width;\n uniform float tex_height;\n\n //grayscale\n float col_to_gs(vec3 vec){\n return 0.21*vec.x + 0.72*vec.y + 0.07*vec.z;\n }\n\n void main() {\n vec3 color_out = vec3(0.0, 0.0, 0.0);\n\n if(effect_select == 0){\n gl_FragColor = texture2D(texture, frag_uv);\n }\n else if(effect_select == 1){\n gl_FragColor = vec4(vec3(1.0)-texture2D(texture, frag_uv).rgb, 1.0);\n }\n else if(effect_select == 2){\n\n const int gauss_mat_size = 12;\n float variance = 10.0;\n float mean = float(gauss_mat_size)/2.0;\n float gauss_mat[gauss_mat_size];\n float gauss_mat_coef = 0.0;\n\n //init the blurring mat\n for(int i = 0; i < gauss_mat_size; i++){\n float val = 1.0/sqrt(2.0*3.1415*variance);\n val = val*pow(2.7182818, -pow((float(i)-mean), 2.0)/(2.0*variance));\n gauss_mat[i] = val;\n gauss_mat_coef += val;\n }\n\n gauss_mat_coef = 1.0/(gauss_mat_coef*gauss_mat_coef);\n\n for(int i = 0; i < gauss_mat_size; i++){\n float rel_i = float(i-(gauss_mat_size-1)/2);\n float sum = 0.0;\n for(int j = 0; j < gauss_mat_size; j++){\n float rel_j = float(j-(gauss_mat_size-1)/2);\n float matrix_val = gauss_mat[i]*gauss_mat[j];\n color_out += matrix_val*texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb;\n }\n }\n\n color_out = color_out*gauss_mat_coef;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 3){\n\n const int sobel_x_size = 3;\n // float sobel_x[sobel_x_size*sobel_x_size] = float[](1, 0, -1, 2, 0, -2, 1, 0, -1); //only glsl3.0\n float sobel_x[sobel_x_size*sobel_x_size];\n sobel_x[0] = 1.0;\n sobel_x[1] = 0.0;\n sobel_x[2] = -1.0;\n sobel_x[3] = 2.0;\n sobel_x[4] = 0.0;\n sobel_x[5] = -2.0;\n sobel_x[6] = 1.0;\n sobel_x[7] = 0.0;\n sobel_x[8] = -1.0;\n\n const int sobel_y_size = 3;\n // float sobel_y[sobel_y_size*sobel_y_size] = float[](1, 2, 1, 0, 0, 0, -1, -2, -1); //only glsl3.0\n float sobel_y[sobel_y_size*sobel_y_size];\n sobel_y[0] = 1.0;\n sobel_y[1] = 2.0;\n sobel_y[2] = 1.0;\n sobel_y[3] = 0.0;\n sobel_y[4] = 0.0;\n sobel_y[5] = 0.0;\n sobel_y[6] = -1.0;\n sobel_y[7] = -2.0;\n sobel_y[8] = -1.0;\n\n float edge_x = 0.0;\n float edge_y = 0.0;\n\n for(int i = 0; i < sobel_x_size; i++){\n float rel_i = float(i)-(float(sobel_x_size)-1.0)/2.0;\n\n for(int j = 0; j < sobel_y_size; j++){\n float rel_j = float(j)-(float(sobel_y_size)-1.0)/2.0;\n float grayscale_pixel = col_to_gs(texture2D(texture, frag_uv+vec2(rel_i/tex_width,rel_j/tex_height)).rgb);\n edge_x += sobel_x[j*3+i]*grayscale_pixel;\n edge_y += sobel_y[j*3+i]*grayscale_pixel;\n }\n }\n\n color_out = vec3(sqrt(edge_x*edge_x+edge_y*edge_y));\n gl_FragColor = vec4(color_out, 1.0);\n }\n else if(effect_select == 4){\n float move_x = sin(frag_uv.x*500.0)*10.0;\n float move_y = sin(frag_uv.y*500.0)*10.0;\n\n color_out = texture2D(texture, frag_uv+vec2(move_x/tex_width,move_y/tex_height)).rgb;\n gl_FragColor = vec4(color_out, 1.0);\n }\n else{\n gl_FragColor = texture2D(texture, frag_uv);\n }\n }\n `;\n\n positions = [\n -1.0, -1.0, 0.0,\n +1.0, -1.0, 0.0,\n -1.0, +1.0, 0.0,\n +1.0, +1.0, 0.0,\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 0.0, 1.0,\n 1.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_framebuffer.png", "license": "none-found", "non_commercial": false, "comment_density": 0.073, "dedup_hash": "030154224714a88c", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} -{"id": "webgl_examples_grass", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Grass", "api": "OpenGL/WebGL", "glsl_version": "300 es", "topic": "instancing/texturing/vegetation/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "grass/grass.html", "language": "html", "loc": 24, "comment_density": 0.0, "code": "\n\n\n\nWind speed: \nCamera position:
\nNumber of grass blades:\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "grass/grass_manager.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 51, "comment_density": 0.039, "code": "#version 300 es\n precision mediump float;\n in vec4 vertex_pos;\n\n in mat4 mat_model;\n in vec2 uv;\n\n out vec3 pixel_pos;\n out vec2 global_uv;\n out vec2 frag_uv;\n out vec2 rel_tex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n uniform sampler2D tex_wind;\n\n void main() {\n pixel_pos = vec3(mat_model*vertex_pos);\n\n vec2 relative_tex_pos = vec2(pixel_pos.x/100.0+0.5, pixel_pos.z/100.0+0.5);\n global_uv = relative_tex_pos;\n\n frag_uv = uv;\n\n vec2 wind_dir = vec2(time, time);\n float wind_x = texture(tex_wind, relative_tex_pos+wind_dir ).r-0.5;\n float wind_z = texture(tex_wind, relative_tex_pos+vec2(0.5, 0.5)+wind_dir ).r-0.5;\n\n //make wind a bit more dramatic\n wind_x *= 2.0;\n wind_z *= 2.0;\n\n rel_tex_pos = relative_tex_pos;\n\n vec3 new_pos = vec3(mat_model*vertex_pos);\n\n //move the top vertex of the grass move more than the lower ones\n if(gl_VertexID == 0){\n wind_x *= 3.0;\n wind_z *= 3.0;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 1 || gl_VertexID == 2 ){\n wind_x *= 1.5;\n wind_z *= 1.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 3 || gl_VertexID == 4 ){\n wind_x *= 0.5;\n wind_z *= 0.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n\n gl_Position = proj*view*vec4(new_pos, 1.0);\n }", "glsl_version": "300 es", "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/grass_manager.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 19, "comment_density": 0.158, "code": "#version 300 es\n precision mediump float;\n\n in vec3 pixel_pos;\n in vec2 global_uv;\n in vec2 frag_uv;\n in vec2 rel_tex_pos;\n\n out vec4 color;\n\n uniform vec3 light_pos;\n uniform sampler2D tex_wind;\n\n uniform float time;\n\n void main() {\n //get a random value for this blade from its position, will be used to vary the colour a bit from grass to grass\n float rand_val = mod((global_uv.x*global_uv.x)+(0.13-global_uv.x*global_uv.y), 0.01)/0.01;\n\n //make the edges of the blade lighter\n float dist_to_centre = pow(distance(frag_uv, vec2(0.5, 0.5)), 2.0);\n\n //make the base a bit darker\n float dist_to_ground = clamp((1.0-frag_uv.y)*1.0, 0.0, 1.0);\n\n color = vec4( (0.1+rand_val/6.0+dist_to_centre)*dist_to_ground, (0.3+dist_to_centre)*dist_to_ground, (0.0+dist_to_centre)*dist_to_ground, 1.0);\n }", "glsl_version": "300 es", "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/grass_manager.js", "language": "javascript", "loc": 256, "comment_density": 0.105, "code": "class Grass_manager{\n\n setup(gl, plane){\n this.gl = gl;\n\n this.base = plane;\n\n this.max_grass = 16000;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), gl.STATIC_DRAW);\n\n //generate a model matrix for each grass blade, that will be put in a buffer, to be drawn with instanced rendering\n this.lst_transforms = []\n\n for (let i = 0; i < this.max_grass; i++) {\n var pos_x = 100*(Math.random()-0.5)\n var pos_y = 100*(Math.random()-0.5)\n this.lst_transforms[i] = this.get_grass_matrix(pos_x, pos_y);\n }\n\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.lst_transforms.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n //generate the wind texture\n var wind_tex_size = 512;\n\n this.generate_wind_texture(wind_tex_size);\n\n this.texture_id = gl.createTexture();\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, wind_tex_size, wind_tex_size, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.wind_array_texture));\n\n //mirrored repeat as we will pan over the texture multiple times\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n\n this.time = 0;\n }\n\n set_max_grass(mg){\n this.max_grass = mg;\n }\n\n //do a bit of matrix rotations (with randomness) to get a blade of grass standing up\n get_grass_matrix(pos_x, pos_y){\n var model_matrix_grass = mat4.create();\n\n mat4.translate(model_matrix_grass, model_matrix_grass, [0, this.base.get_height(pos_x,pos_y), 0]);\n mat4.translate(model_matrix_grass, model_matrix_grass, [pos_x, 0, pos_y]);\n mat4.scale(model_matrix_grass, model_matrix_grass, [0.3, 1.7, 0.3]);\n mat4.scale(model_matrix_grass, model_matrix_grass, [1, 1+Math.random(), 1]);\n mat4.translate(model_matrix_grass, model_matrix_grass, [0, 2, 0]);\n mat4.rotate(model_matrix_grass, model_matrix_grass, 3.1415/4.0*pos_x*pos_y*5.244 ,[0, 1, 0]);\n mat4.rotate(model_matrix_grass, model_matrix_grass, 3.1415/2.0 ,[1, 0, 0]);\n\n return model_matrix_grass;\n }\n\n //generate wind texture, which will impact the position of the grass\n //only R component of the texture will be used\n generate_wind_texture(size){\n this.wind_array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var val = Math.sin(i/size*16)*Math.cos(j/size*8);\n val += 0.25*Math.sin(i/size*32)*Math.cos(j/size*64);\n this.wind_array_texture.push( val*64+128 ); //R\n this.wind_array_texture.push( 0.0 ); //G useless\n this.wind_array_texture.push( 0.0 ); //B useless\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_time(t){\n this.time = t;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //setup the buffer to tell webgl to use a single mat4 matrix per instanced rendering, a bit wordy$\n //webgl2 was needed for the instanced rendering\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"mat_model\");\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.lst_transforms[0] );\n\n this.gl.uniform1f( this.gl.getUniformLocation(this.shader_program, \"time\"), this.time );\n\n this.gl.activeTexture(gl.TEXTURE0);\n\n this.gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n this.gl.uniform1i(gl.getUniformLocation(this.shader_program, \"tex_wind\"), 0);\n\n\n this.gl.disable(this.gl.CULL_FACE);\n\n //tell webgl we will draw max_grass blades that each contains 15 vertices\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, 15, this.gl.UNSIGNED_SHORT, 0, this.max_grass);\n\n this.gl.enable(this.gl.CULL_FACE);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n }\n\n //needed glsl 3 for gl_VertexID\n vertex_shader_code = `#version 300 es\n precision mediump float;\n in vec4 vertex_pos;\n\n in mat4 mat_model;\n in vec2 uv;\n\n out vec3 pixel_pos;\n out vec2 global_uv;\n out vec2 frag_uv;\n out vec2 rel_tex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n uniform sampler2D tex_wind;\n\n void main() {\n pixel_pos = vec3(mat_model*vertex_pos);\n\n vec2 relative_tex_pos = vec2(pixel_pos.x/100.0+0.5, pixel_pos.z/100.0+0.5);\n global_uv = relative_tex_pos;\n\n frag_uv = uv;\n\n vec2 wind_dir = vec2(time, time);\n float wind_x = texture(tex_wind, relative_tex_pos+wind_dir ).r-0.5;\n float wind_z = texture(tex_wind, relative_tex_pos+vec2(0.5, 0.5)+wind_dir ).r-0.5;\n\n //make wind a bit more dramatic\n wind_x *= 2.0;\n wind_z *= 2.0;\n\n rel_tex_pos = relative_tex_pos;\n\n vec3 new_pos = vec3(mat_model*vertex_pos);\n\n //move the top vertex of the grass move more than the lower ones\n if(gl_VertexID == 0){\n wind_x *= 3.0;\n wind_z *= 3.0;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 1 || gl_VertexID == 2 ){\n wind_x *= 1.5;\n wind_z *= 1.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n if(gl_VertexID == 3 || gl_VertexID == 4 ){\n wind_x *= 0.5;\n wind_z *= 0.5;\n new_pos.x += wind_x;\n new_pos.y -= (abs(wind_x)+abs(wind_z))*0.5;\n new_pos.z += wind_z;\n }\n\n gl_Position = proj*view*vec4(new_pos, 1.0);\n }\n `;\n\n fragment_shader_code = `#version 300 es\n precision mediump float;\n\n in vec3 pixel_pos;\n in vec2 global_uv;\n in vec2 frag_uv;\n in vec2 rel_tex_pos;\n\n out vec4 color;\n\n uniform vec3 light_pos;\n uniform sampler2D tex_wind;\n\n uniform float time;\n\n void main() {\n //get a random value for this blade from its position, will be used to vary the colour a bit from grass to grass\n float rand_val = mod((global_uv.x*global_uv.x)+(0.13-global_uv.x*global_uv.y), 0.01)/0.01;\n\n //make the edges of the blade lighter\n float dist_to_centre = pow(distance(frag_uv, vec2(0.5, 0.5)), 2.0);\n\n //make the base a bit darker\n float dist_to_ground = clamp((1.0-frag_uv.y)*1.0, 0.0, 1.0);\n\n color = vec4( (0.1+rand_val/6.0+dist_to_centre)*dist_to_ground, (0.3+dist_to_centre)*dist_to_ground, (0.0+dist_to_centre)*dist_to_ground, 1.0);\n }\n `;\n\n positions = [\n 0.0, 0.0, -2.0, // 0\n -1.0, 0.0, 0.0, // 1\n 1.0, 0.0, 0.0, // 2\n -1.0, 0.0, 1.0, // 3\n 1.0, 0.0, 1.0, // 4\n -1.0, 0.0, 2.0, // 5\n 1.0, 0.0, 2.0, // 6\n ];\n\n indices = [\n 0, 1, 2,\n 2, 1, 3,\n 2, 3, 4,\n 4, 3, 5,\n 4, 5, 6,\n ];\n\n tex_coord = [\n 0.5, 0.0,\n 0.0, 0.5,\n 1.0, 0.5,\n 0.0, 0.75,\n 1.0, 0.75,\n 0.0, 1.0,\n 1.0, 1.0,\n ];\n}\n\n"}, {"path": "grass/main.js", "language": "javascript", "loc": 69, "comment_density": 0.087, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\nvar model_matrix_grass_manager = mat4.create();\n\nvar cam_height = 25;\nvar position_cam = [-70.0, cam_height, 0];\n\nvar plane = new Plane_sine;\nvar grass_manager = new Grass_manager;\n\nvar last_time = 0;\n\nvar time_wind = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl2\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL2\");\n return;\n }\n\n plane.setup(gl);\n\n mat4.scale(model_matrix_plane, model_matrix_plane, [50, 3, 50]);\n mat4.scale(model_matrix_grass_manager, model_matrix_grass_manager, [1, 1, 1]);\n mat4.translate(model_matrix_grass_manager, model_matrix_grass_manager, [0, 0, 0]);\n\n plane.set_model_matrix(model_matrix_plane);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n\n grass_manager.setup(gl, plane);\n}\n\nfunction draw(){\n var cam_pos = document.getElementById(\"camera_position\").value;\n\n position_cam[0] = -cam_pos;\n\n mat4.lookAt(view_matrix, position_cam, [70-cam_pos, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independent\n time_diff = time-last_time;\n\n var wind_speed = document.getElementById(\"slider_speed\").value;\n // wind_speed = wind_speed/50.0;\n time_wind += wind_speed/70000.0;\n\n if(document.getElementById(\"16000\").checked == true){\n grass_manager.set_max_grass(16000);\n }\n else if(document.getElementById(\"8000\").checked == true){\n grass_manager.set_max_grass(8000);\n }\n else if(document.getElementById(\"4000\").checked == true){\n grass_manager.set_max_grass(4000);\n }\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n grass_manager.set_time( time_wind);\n grass_manager.set_mvp(model_matrix_grass_manager, view_matrix, proj_matrix);\n grass_manager.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "grass/plane_sine.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/plane_sine.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float;\n\n void main() {\n // just output some brown color\n gl_FragColor = vec4(0.3, 0.14, 0.07, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "grass/plane_sine.js", "language": "javascript", "loc": 137, "comment_density": 0.226, "code": "class Plane_sine{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n this.nb_vertices_side = 48;//default\n\n this.generate_geometry();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.vertices), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n }\n\n //the shape of the plane\n get_height_priv(x, z){\n return Math.sin(x*5)+Math.sin(z*5);\n }\n\n generate_geometry()\n {\n var increment = 1.0/(this.nb_vertices_side-1);\n\n this.vertices = [];\n\n //the vertices\n for (let y = 0; y < this.nb_vertices_side; y++) {\n for (let x = 0; x < this.nb_vertices_side; x++) {\n this.vertices.push(-1.0+2*increment*x);\n this.vertices.push(this.get_height_priv(-1.0+2*increment*x, -1.0+2*increment*y));\n this.vertices.push(-1.0+2*increment*y);\n }\n }\n\n this.indices = [];\n\n //generate the indices\n for (let y = 0; y < this.nb_vertices_side-1; y++) {\n for (let x = 0; x < this.nb_vertices_side-1; x++) {\n var this_vertice = y*this.nb_vertices_side+x;\n //one of the triangle\n this.indices.push(this_vertice+1); //top right\n this.indices.push(this_vertice);\n this.indices.push(this_vertice+this.nb_vertices_side);\n\n this.indices.push(this_vertice+this.nb_vertices_side);\n this.indices.push(this_vertice+this.nb_vertices_side+1);\n this.indices.push(this_vertice+1);\n }\n }\n }\n\n //get the height of the plane from position, but taking into account a model matrix for the shape (ex scale)\n get_height(pos_x, pos_y){\n //just assume a simple scale matrix, to simplify the matrix manipulations\n\n var pos_x_transf = pos_x/this.model[0]; // [0][0];\n var pos_y_transf = pos_y/this.model[10]; // [2][2] as mat4 is a 1D array\n\n var height = this.get_height_priv(pos_x_transf, pos_y_transf);\n\n return height*this.model[5] //[1][1];\n }\n\n //old version with any type of model matrix, annoying\n // get_height_old(pos_x, pos_y){\n // var vec = vec4.create();\n // vec[0] = pos_x;\n // vec[1] = 0;\n // vec[2] = pos_y;\n // vec[3] = 1.0;\n\n // var vec_transf = vec4.create();\n // vec4.transformMat4(vec_transf, vec, this.model);\n\n // var height = this.get_height_priv(vec_transf[0], vec_transf[2]);\n\n // var vec_height = vec4.create();\n // vec[0] = 0;\n // vec[1] = height;\n // vec[2] = 0;\n // vec[3] = 1.0;\n\n // var model_height = vec4.create();\n // vec4.transformMat4(model_height, vec_height, this.model);\n\n // return model_height[1];\n // }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n var nb_squares = this.nb_vertices_side-1;\n var nb_vertices_to_draw = nb_squares*nb_squares*6;\n\n this.gl.drawElements(this.gl.TRIANGLES, nb_vertices_to_draw, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float;\n\n void main() {\n // just output some brown color\n gl_FragColor = vec4(0.3, 0.14, 0.07, 1.0);\n }\n `;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_grass.png", "license": "none-found", "non_commercial": false, "comment_density": 0.102, "dedup_hash": "4a699a3f1c50ebec", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_shading", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Shading", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "shading/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/cube.js", "language": "javascript", "loc": 193, "comment_density": 0.155, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "shading/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "shading/plane.js", "language": "javascript", "loc": 112, "comment_density": 0.009, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n}\n"}, {"path": "shading/shading.html", "language": "html", "loc": 16, "comment_density": 0.0, "code": "\n\n\n\nLight Speed: \nLight Height:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "shading/shading.js", "language": "javascript", "loc": 91, "comment_density": 0.11, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\nvar model_matrix_cubes = [mat4.create(), mat4.create()];\n\nvar cam_height = 5;\nvar position_cam = [-20.0, cam_height, -20.0];\n\nvar rotating_cube = new Cube;\n\nvar cubes = [new Cube, new Cube];\nvar plane = new Plane;\n\nvar light_pos_radius = 10;\nvar light_pos = [-1, 5.0, 0];\n\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n rotating_cube.setup(gl);\n cubes[0].setup(gl);\n cubes[1].setup(gl);\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [10, 1, 10]);\n\n mat4.translate(model_matrix_cubes[0], model_matrix_cubes[0], [0, 1, 5]);\n mat4.translate(model_matrix_cubes[1], model_matrix_cubes[1], [5, 1, -5]);\n\n cubes[0].set_model_matrix(model_matrix_cubes[0]);\n cubes[1].set_model_matrix(model_matrix_cubes[1]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independant\n time_diff = time-last_time;\n\n var light_speed = document.getElementById(\"slider_speed\").value;\n var light_height = document.getElementById(\"slider_height\").value;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 11.0-light_height;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n plane.set_light_pos(light_pos_scaled);\n rotating_cube.set_light_pos(light_pos_scaled);\n cubes[0].set_light_pos(light_pos_scaled);\n cubes[1].set_light_pos(light_pos_scaled);\n\n //rotate the model matrix of the cube by a little bit\n var model = rotating_cube.get_model_matrix();\n model = mat4.rotate(model, model, 2*Math.PI*time_diff*10, [0,1,0]);\n rotating_cube.set_model_matrix(model);\n\n rotating_cube.set_vp(view_matrix, proj_matrix);\n rotating_cube.draw();\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n cubes[0].set_mvp(model_matrix_cubes[0], view_matrix, proj_matrix);\n cubes[0].draw();\n\n cubes[1].set_mvp(model_matrix_cubes[1], view_matrix, proj_matrix);\n cubes[1].draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.086, "dedup_hash": "bbda8f24a4fd9735", "has_readme": true, "build_system": null, "dependency_count": 5, "has_demo": true} -{"id": "webgl_examples_texturing", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Texturing", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "texturing/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "texturing/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 10, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "texturing/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 7, "comment_density": 0.286, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = texture2D(texture, frag_uv);\n // gl_FragColor = vec4(frag_uv, 0.0, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "texturing/plane.js", "language": "javascript", "loc": 134, "comment_density": 0.082, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n //generate texture\n this.size_texture = 8;\n this.generate_texture(this.size_texture)\n\n //prepare buffer for texture\n this.texture_id = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, this.size_texture, this.size_texture, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.array_texture));\n\n // gl.generateMipmap(gl.TEXTURE_2D);\n //or\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n\n }\n\n generate_texture(size){\n this.array_texture = [];\n\n //for normalization\n var max_size = size*size;\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n this.array_texture.push( (i*j)/max_size*255 ); //R\n this.array_texture.push( (size-i)*j/max_size*255 ); //G\n this.array_texture.push( i*(size-j)/max_size*255 ); //B\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture\"), 0);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n varying vec2 frag_uv;\n\n uniform sampler2D texture;\n\n void main() {\n gl_FragColor = texture2D(texture, frag_uv);\n // gl_FragColor = vec4(frag_uv, 0.0, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}, {"path": "texturing/texturing.html", "language": "html", "loc": 14, "comment_density": 0.0, "code": "\n\n\n\nRotation Speed:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n"}, {"path": "texturing/texturing.js", "language": "javascript", "loc": 55, "comment_density": 0.127, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar model_matrix_plane = mat4.create();\n\nvar cam_height = 5;\nvar position_cam = [-6.0, cam_height, 0];\n\nvar plane = new Plane;\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n plane.setup(gl);\n\n //model matrix for the plane\n mat4.scale(model_matrix_plane, model_matrix_plane, [2, 0, 2]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_speed = document.getElementById(\"slider_speed\").value;\n\n //rotate the model matrix of the plane by a little bit\n var model = plane.get_model_matrix();\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*rotation_speed, [0,1,0]);\n plane.set_model_matrix(model);\n\n plane.set_mvp(model_matrix_plane, view_matrix, proj_matrix);\n plane.draw();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.099, "dedup_hash": "9b7ee98367e2a266", "has_readme": true, "build_system": null, "dependency_count": 4, "has_demo": true} -{"id": "webgl_examples_tree", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Tree", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "lighting/texturing/vegetation/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "tree/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.0, "code": "precision highp float;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/cube.js", "language": "javascript", "loc": 197, "comment_density": 0.147, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n this.light_pos = [0,0,0];\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.useProgram(this.shader_program);\n this.gl.bindVertexArray(this.vao);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision highp float;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "tree/leaves.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 44, "comment_density": 0.159, "code": "precision mediump float;\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n attribute vec3 raw_position;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n uniform vec2 wind_offset;\n\n uniform sampler2D tex_wind;\n\n void main() {\n mat4 global_model = model*model_mat;\n\n vec3 new_pos_tex = vec3(global_model*vertex_pos);\n\n //rotate a bit the leaves according to a wind texture map\n vec2 relative_tex_pos = vec2(new_pos_tex.x/40.0+0.5, new_pos_tex.z/40.0+0.5);\n\n float wind_x = texture2D(tex_wind, (relative_tex_pos+wind_offset) ).r;\n float wind_z = texture2D(tex_wind, (relative_tex_pos+vec2(0.5, 0.5)+wind_offset) ).r;\n\n //rotation around x axis\n mat4 rot_mat_x = mat4(1, 0, 0, 0,\n 0, cos(wind_x), -sin(wind_x), 0,\n 0, sin(wind_x), cos(wind_x), 0,\n 0, 0, 0, 1);\n\n //rotation around z axis\n mat4 rot_mat_z = mat4(cos(wind_z), -sin(wind_z), 0, 0,\n sin(wind_z), cos(wind_x), 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 1);\n\n vec4 new_pos = (global_model*rot_mat_x*rot_mat_z*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(global_model)));\n mat3 normal_mat = mat3(global_model);\n\n pixel_pos = vec3(new_pos);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*new_pos;\n\n frag_relative_ground_pos = raw_position.y;\n\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/leaves.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 22, "comment_density": 0.182, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform vec3 light_pos;\n uniform vec2 wind_offset;\n\n void main() {\n\n float distance_to_middle = distance(frag_uv, vec2(0.5, 0.5));\n\n //have some sort of leaf shape instead of a rough triangle\n if(distance_to_middle > 0.5 ){\n discard;\n }\n\n //have a repeatable random value according to relative position of the leaf to the centre of the batch\n float rand_val = sin(pixel_pos.x*pixel_pos.z/10.0)+cos( (0.13-pixel_pos.x*pixel_pos.y) / 10.0 );\n\n gl_FragColor.a = 1.0;\n\n //if the leaf is under the \"centre\" of the batch, draw it darker (to have a canopy effect)\n float light_intensity = (frag_relative_ground_pos+0.6)*1.5;\n light_intensity = clamp(light_intensity, 0.0, 1.0);\n float reverse_dist_to_middle = 1.0-distance_to_middle;\n\n gl_FragColor.rgb = vec3(0.1+rand_val/6.0, 0.4, 0.05)*light_intensity*reverse_dist_to_middle;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/leaves.js", "language": "javascript", "loc": 284, "comment_density": 0.12, "code": "class Leaves{\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n // indices for the texture pos\n this.texcoord_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), this.gl.STATIC_DRAW)\n\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.mat_vector.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n this.rel_pos_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.rel_pos_list);\n\n var pos_vec_flat = this.pos_vector.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(pos_vec_flat), this.gl.STATIC_DRAW);\n\n this.nb_leaves = this.mat_vector.length;\n this.light_pos = [0, 0, 0];\n\n //generate the wind texture\n var wind_tex_size = 512;\n\n this.generate_wind_texture(wind_tex_size);\n\n this.texture_id = gl.createTexture();\n\n gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, wind_tex_size, wind_tex_size, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(this.wind_array_texture));\n\n //mirrored repeat as we will pan over the texture multiple times\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); //do not forget this for float textures\n\n this.wind_offset = [1,1];\n }\n\n generate(end_point_matrices){\n this.mat_vector = []\n this.pos_vector = []\n\n var leaves_scale = 1.0/32.0;\n\n for (let i = 0; i < end_point_matrices.length; i++) {\n var incr = 0.4;\n for (let x = -1.0; x < 1.0; x+=incr) {\n for (let y = -1.0; y < 1.0; y+=incr) {\n for (let z = -1.0; z < 1.0; z+=incr) {\n var dist_to_centre = Math.sqrt(x*x+y*y+z*z);\n if(dist_to_centre < 1.0){\n var t = mat4.create();\n var random_rot = mat4.create();\n //add a bit of randomness to not have a grid of leaves\n mat4.rotate(random_rot, random_rot, Math.random(), [1.0, 0.0, 0.0] );\n mat4.rotate(random_rot, random_rot, Math.random(), [0.0, 1.0, 0.0] );\n mat4.rotate(random_rot, random_rot, Math.random(), [0.0, 0.0, 1.0] );\n\n mat4.multiply(t, t, random_rot);\n mat4.translate(t, t, [x*leaves_scale*4, y*leaves_scale*4, z*leaves_scale*4]);\n mat4.multiply(t, t, random_rot);//rotates again the leaves so they don't have the same orientation\n mat4.scale(t, t, [leaves_scale, leaves_scale, leaves_scale]);\n\n var end_mat = mat4.create();\n mat4.multiply(end_mat, end_point_matrices[i], t);\n this.mat_vector.push(end_mat);\n\n var val = vec4.create();\n val[0] = x;\n val[1] = y;\n val[2] = z;\n val[3] = 1;\n var val_transf = vec4.create();\n vec4.transformMat4(val_transf, val, random_rot);\n var val_transf3 = [val_transf[0], val_transf[1], val_transf[2]];\n this.pos_vector.push(val_transf3);\n }\n }\n }\n }\n\n }\n }\n\n //generate wind texture, which will impact the position of the grass\n //only R component of the texture will be used\n generate_wind_texture(size){\n this.wind_array_texture = [];\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n var val = Math.sin(i/size*16)*Math.cos(j/size*8);\n this.wind_array_texture.push( val*64+128 ); //R\n this.wind_array_texture.push( 0.0 ); //G useless\n this.wind_array_texture.push( 0.0 ); //B useless\n }\n }\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_time(t){\n var time_delta = t-this.time;\n this.wind_offset[0] = (t*16)%10\n this.wind_offset[1] = (t*8)%10\n this.time = t;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.uniform2fv(\n this.gl.getUniformLocation(this.shader_program, \"wind_offset\"),\n this.wind_offset);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"model_mat\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"raw_position\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.rel_pos_list);\n\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"raw_position\"));\n this.gl.vertexAttribPointer(this.gl.getAttribLocation(this.shader_program, \"raw_position\"), 3, this.gl.FLOAT, this.gl.FALSE, 12, 0);\n\n this.gl.vertexAttribDivisor(this.gl.getAttribLocation(this.shader_program, \"raw_position\"), 1);\n\n\n this.gl.activeTexture(gl.TEXTURE0);\n\n this.gl.bindTexture(gl.TEXTURE_2D, this.texture_id);\n\n this.gl.uniform1i(gl.getUniformLocation(this.shader_program, \"tex_wind\"), 0);\n\n this.gl.disable(this.gl.CULL_FACE);\n\n // this.gl.drawElements(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0);\n\n //this.transf.length\n // this.gl.drawElements(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0);\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, 3, this.gl.UNSIGNED_SHORT, 0, this.nb_leaves);\n\n this.gl.enable(this.gl.CULL_FACE);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n }\n\n vertex_shader_code = `\n precision mediump float;\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n attribute vec3 raw_position;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n uniform vec2 wind_offset;\n\n uniform sampler2D tex_wind;\n\n void main() {\n mat4 global_model = model*model_mat;\n\n vec3 new_pos_tex = vec3(global_model*vertex_pos);\n\n //rotate a bit the leaves according to a wind texture map\n vec2 relative_tex_pos = vec2(new_pos_tex.x/40.0+0.5, new_pos_tex.z/40.0+0.5);\n\n float wind_x = texture2D(tex_wind, (relative_tex_pos+wind_offset) ).r;\n float wind_z = texture2D(tex_wind, (relative_tex_pos+vec2(0.5, 0.5)+wind_offset) ).r;\n\n //rotation around x axis\n mat4 rot_mat_x = mat4(1, 0, 0, 0,\n 0, cos(wind_x), -sin(wind_x), 0,\n 0, sin(wind_x), cos(wind_x), 0,\n 0, 0, 0, 1);\n\n //rotation around z axis\n mat4 rot_mat_z = mat4(cos(wind_z), -sin(wind_z), 0, 0,\n sin(wind_z), cos(wind_x), 0, 0,\n 0, 0, 0, 0,\n 0, 0, 0, 1);\n\n vec4 new_pos = (global_model*rot_mat_x*rot_mat_z*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(global_model)));\n mat3 normal_mat = mat3(global_model);\n\n pixel_pos = vec3(new_pos);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*new_pos;\n\n frag_relative_ground_pos = raw_position.y;\n\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n varying float frag_relative_ground_pos;\n\n uniform vec3 light_pos;\n uniform vec2 wind_offset;\n\n void main() {\n\n float distance_to_middle = distance(frag_uv, vec2(0.5, 0.5));\n\n //have some sort of leaf shape instead of a rough triangle\n if(distance_to_middle > 0.5 ){\n discard;\n }\n\n //have a repeatable random value according to relative position of the leaf to the centre of the batch\n float rand_val = sin(pixel_pos.x*pixel_pos.z/10.0)+cos( (0.13-pixel_pos.x*pixel_pos.y) / 10.0 );\n\n gl_FragColor.a = 1.0;\n\n //if the leaf is under the \"centre\" of the batch, draw it darker (to have a canopy effect)\n float light_intensity = (frag_relative_ground_pos+0.6)*1.5;\n light_intensity = clamp(light_intensity, 0.0, 1.0);\n float reverse_dist_to_middle = 1.0-distance_to_middle;\n\n gl_FragColor.rgb = vec3(0.1+rand_val/6.0, 0.4, 0.05)*light_intensity*reverse_dist_to_middle;\n }\n `;\n\n positions = [\n -1.0, -1.0, 0.0, // 0 bottom left\n 1.0, -1.0, 0.0, // 1 bottom right\n 0.0, 1.0, 0.0, // 2 top\n ];\n\n indices = [\n 0, 1, 2,\n ];\n\n normals = [\n 0, 1, 0,\n 0, 1, 0,\n ];\n\n tex_coord = [\n 0.0, 1.0,\n 1.0, 1.0,\n 0.5, 0.0,\n ];\n}"}, {"path": "tree/main.js", "language": "javascript", "loc": 72, "comment_density": 0.139, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\n\nvar cam_height = 15;\nvar position_cam = [-28.0, cam_height, 0];\n\nvar light_pos = [-10, 5.0, 20];\n\nvar cube = new Cube;\nvar cube_transf = mat4.create();\n\nvar tree = new Tree;\nvar tree_transf = mat4.create();\n\nvar last_time = 0;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl2\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n // plane.setup(gl);\n cube.setup(gl);\n\n tree.setup(gl);\n\n //base platform for the tree\n mat4.scale(cube_transf, cube_transf, [20, 0.5, 20]);\n\n mat4.scale(tree_transf, tree_transf, [5, 5, 5]);\n mat4.translate(tree_transf, tree_transf, [0, 0.5, 0]);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction reload_tree(){\n tree = new Tree;\n tree.setup(gl);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 10, 0], [0, 1, 0]);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n d = new Date();\n time = d.getTime()/100000.0;\n //make it framerate independant\n time_diff = time-last_time;\n\n var rotation_active = document.getElementById(\"rotation\").checked;\n var draw_leaves_active = document.getElementById(\"leaves\").checked;\n\n //rotate the model matrix of the plane by a little bit\n var model = mat4.create();\n if(rotation_active){\n model = mat4.rotate(model, model, -2*Math.PI*time_diff*10, [0,1,0]);\n }\n\n mat4.multiply(tree_transf, tree_transf, model);\n mat4.multiply(cube_transf, cube_transf, model);\n\n cube.set_light_pos(light_pos);\n cube.set_mvp(cube_transf, view_matrix, proj_matrix);\n cube.draw();\n\n //wind effect not that nice, leave it for now\n // tree.set_time(d.getTime()/10000.0);\n tree.set_light_pos(light_pos);\n tree.set_mvp(tree_transf, view_matrix, proj_matrix);\n tree.draw(draw_leaves_active);\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "tree/tree.html", "language": "html", "loc": 21, "comment_density": 0.048, "code": "\n\n\n\n\n\n\n\n
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "tree/tree.js", "language": "javascript", "loc": 33, "comment_density": 0.0, "code": "class Tree{\n setup(gl){\n this.gl = gl;\n\n this.trunk = new Trunk\n this.trunk.setup(gl);\n\n this.leaves = new Leaves;\n\n this.leaves.generate(this.trunk.get_end_point_matrices());\n\n this.leaves.setup(gl);\n }\n\n set_time(t){\n this.leaves.set_time(t);\n }\n\n draw_trunks(){\n this.trunk.draw();\n }\n\n set_mvp(model, view, proj){\n this.trunk.set_mvp(model, view, proj);\n this.leaves.set_mvp(model, view, proj);\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.trunk.set_light_pos(light_pos);\n this.light_pos = light_pos;\n }\n\n draw(draw_leaves_active){\n this.trunk.draw();\n if(draw_leaves_active){\n this.leaves.draw();\n }\n }\n}"}, {"path": "tree/trunk.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 22, "comment_density": 0.182, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n mat4 model_global = model*model_mat;\n pixel_pos = vec3(model_global*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model_global);\n\n frag_uv = uv;\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model_global*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/trunk.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 34, "comment_density": 0.059, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform vec3 light_pos;\n\n vec3 bark_high = vec3(0.6, 0.4, 0.2);\n vec3 bark_low = vec3(0.4, 0.25, 0.2);\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max);\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = dot(light_dir, pixel_normal);\n\n vec3 texture_col = get_billin(frag_uv*4.0, bark_low, bark_high);\n\n vec3 color_trunk = texture_col*diffuse_light;\n\n gl_FragColor = vec4( color_trunk , 1.0);;\n }\n\n float rand(vec2 pt)\n {\n float x = pt.x*3.13;\n float y = pt.y*7.17;\n return fract(x*y/17.0);\n }\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max)\n {\n\n float val00 = rand((pos));\n float val10 = rand((vec2(pos.x, pos.y+1.0)));\n float val01 = rand((vec2(pos.x+1.0, pos.y)));\n float val11 = rand((vec2(pos.x+1.0, pos.y+1.0)));\n\n vec2 pos_fract = fract(pos);\n\n //2d linear interpolation\n float val_x0 = mix(val00, val01, pos_fract.x);\n float val_x1 = mix(val10, val11, pos_fract.x);\n\n float final_val = mix(val_x0, val_x1, pos_fract.y);\n\n return mix(max, min, final_val);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "tree/trunk.js", "language": "javascript", "loc": 349, "comment_density": 0.112, "code": "class Trunk{\n setup(gl){\n this.gl = gl;\n\n this.create_positions();\n\n this.transf = [];\n\n this.rand_vals = [];\n this.end_point_matrices = [];\n\n //have fixed random values for each iteration of the trunks\n for (let i = 0; i < 32; i++) {\n this.rand_vals.push( Math.random());\n }\n\n //first trunk (axiom or root of the lsystem)\n var trunk_initial_transf = mat4.create();\n mat4.translate(trunk_initial_transf, trunk_initial_transf, [0, 0.5, 0]);\n mat4.scale(trunk_initial_transf, trunk_initial_transf, [1.5/14, 1, 1.5/14]);\n\n this.add_sub_trunks_lsystem_random(trunk_initial_transf, 0, 5, true);\n\n this.model = mat4.create();\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.vao = this.gl.createVertexArray();\n\n this.gl.bindVertexArray(this.vao);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n //indices for the texture pos\n this.texcoord_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.tex_coord), this.gl.STATIC_DRAW)\n\n //this.transf\n this.transforms_list = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n //put all the model matrices in a buffer, need the mat4 in a flat structure, a list\n var lst_model_flat = this.transf.map(a=>[...a]).flat();\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(lst_model_flat), this.gl.STATIC_DRAW);\n\n this.nb_trunks = this.transf.length;\n this.light_pos = [0, 0, 0];\n }\n\n get_end_point_matrices(){\n return this.end_point_matrices;\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n draw(){\n this.gl.bindVertexArray(this.vao);\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.texcoord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n var uniform_loc = this.gl.getAttribLocation(this.shader_program, \"model_mat\");\n\n const ext = this.gl.getExtension(\"ANGLE_instanced_arrays\");\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.transforms_list);\n\n this.gl.enableVertexAttribArray(uniform_loc);\n this.gl.vertexAttribPointer(uniform_loc, 4, this.gl.FLOAT, this.gl.FALSE, 64, 0);\n\n this.gl.enableVertexAttribArray(uniform_loc+1);\n this.gl.vertexAttribPointer(uniform_loc+1, 4, this.gl.FLOAT, this.gl.FALSE, 64, 16);\n\n this.gl.enableVertexAttribArray(uniform_loc+2);\n this.gl.vertexAttribPointer(uniform_loc+2, 4, this.gl.FLOAT, this.gl.FALSE, 64, 32);\n\n this.gl.enableVertexAttribArray(uniform_loc+3);\n this.gl.vertexAttribPointer(uniform_loc+3, 4, this.gl.FLOAT, this.gl.FALSE, 64, 48);\n\n this.gl.vertexAttribDivisor(uniform_loc, 1);\n this.gl.vertexAttribDivisor(uniform_loc+1, 1);\n this.gl.vertexAttribDivisor(uniform_loc+2, 1);\n this.gl.vertexAttribDivisor(uniform_loc+3, 1);\n\n this.gl.drawElementsInstanced(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0, this.nb_trunks);\n // gl.drawElementsInstancedANGLE(this.gl.TRIANGLES, this.nb_indices, this.gl.UNSIGNED_SHORT, 0, this.nb_trunksindices, this.nb_trunks);\n\n this.gl.vertexAttribDivisor(uniform_loc, 0);\n this.gl.useProgram(null);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n attribute vec2 uv;\n attribute mat4 model_mat;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n mat4 model_global = model*model_mat;\n pixel_pos = vec3(model_global*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model_global);\n\n frag_uv = uv;\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model_global*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n varying vec2 frag_uv;\n\n uniform vec3 light_pos;\n\n vec3 bark_high = vec3(0.6, 0.4, 0.2);\n vec3 bark_low = vec3(0.4, 0.25, 0.2);\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max);\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = dot(light_dir, pixel_normal);\n\n vec3 texture_col = get_billin(frag_uv*4.0, bark_low, bark_high);\n\n vec3 color_trunk = texture_col*diffuse_light;\n\n gl_FragColor = vec4( color_trunk , 1.0);;\n }\n\n float rand(vec2 pt)\n {\n float x = pt.x*3.13;\n float y = pt.y*7.17;\n return fract(x*y/17.0);\n }\n\n vec3 get_billin(vec2 pos, vec3 min, vec3 max)\n {\n\n float val00 = rand((pos));\n float val10 = rand((vec2(pos.x, pos.y+1.0)));\n float val01 = rand((vec2(pos.x+1.0, pos.y)));\n float val11 = rand((vec2(pos.x+1.0, pos.y+1.0)));\n\n vec2 pos_fract = fract(pos);\n\n //2d linear interpolation\n float val_x0 = mix(val00, val01, pos_fract.x);\n float val_x1 = mix(val10, val11, pos_fract.x);\n\n float final_val = mix(val_x0, val_x1, pos_fract.y);\n\n return mix(max, min, final_val);\n }\n `;\n\n lerp(val, min, max){\n return (1-val)*min+val*max;\n }\n\n //recursive function for generating a l-system tree structure\n add_sub_trunks_lsystem_random(t, level, max_level, is_end_point){\n\n //if this trunk section is the last one, generate the matrix and end point for this bit\n //and add them in a list\n if(level >= max_level){\n //model matrix for the trunk model\n this.transf.push(t);\n\n //model matrix for the leaves\n if(is_end_point){\n var point = vec4.create();\n point[0] = 0;\n point[1] = 0.5;\n point[2] = 0;\n point[3] = 1.0;\n vec4.transformMat4(point, point, t);\n var end_point_translation = mat4.create();\n mat4.translate(end_point_translation, end_point_translation, [point[0], point[1], point[2]]);\n\n this.end_point_matrices.push(end_point_translation);\n }\n return;\n }\n\n //base trunk\n var t0 = mat4.create();\n mat4.translate(t0, t0, [0, 0, 0]);\n mat4.scale(t0, t0, [1, 1, 1]);\n mat4.multiply(t0, t0, t);\n this.add_sub_trunks_lsystem_random(t0, level+1000, max_level, false);\n\n //top trunk\n var t1 = mat4.create();\n mat4.translate(t1, t1, [0, 0.98, 0]);\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[2], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[0], 3.1415/14.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(t1, t1, this.lerp(this.rand_vals[1], 3.1415/14.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(t1, t1, [0.8, 0.8, 0.8]);\n mat4.multiply(t1, t1, t);\n this.add_sub_trunks_lsystem_random(t1, level+1, max_level, true);\n\n //side trunks / twigs\n var b0 = mat4.create();\n mat4.translate(b0, b0, [0, this.lerp(this.rand_vals[16], 0.5, 0.9), 0] );\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[8], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[6], 3.1415/4.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b0, b0, this.lerp(this.rand_vals[7], 3.1415/4.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b0, b0, [0.6, 0.6, 0.6]);\n mat4.multiply(b0, b0, t);\n this.add_sub_trunks_lsystem_random(b0, level+1, max_level, true);\n\n var b1 = mat4.create();\n mat4.translate(b1, b1, [0, this.lerp(this.rand_vals[17], 0.5, 0.9), 0] );\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[11], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[9], 3.1415/3.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b1, b1, this.lerp(this.rand_vals[10], 3.1415/3.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b1, b1, [0.5, 0.5, 0.5]);\n mat4.multiply(b1, b1, t);\n this.add_sub_trunks_lsystem_random(b1, level+1, max_level, true);\n\n var b2 = mat4.create();\n mat4.translate(b2, b2, [0, this.lerp(this.rand_vals[18], 0.5, 0.9), 0] );\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[14], 0, 2*3.1415), [0.0, 1.0, 0.0])\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[12], 3.1415/2.0, 3.1415/10.0), [0.0, 0.0, 1.0])\n mat4.rotate(b2, b2, this.lerp(this.rand_vals[13], 3.1415/2.0, 3.1415/10.0), [1.0, 0.0, 0.0])\n mat4.scale(b2, b2, [0.4, 0.4, 0.4]);\n mat4.multiply(b2, b2, t);\n this.add_sub_trunks_lsystem_random(b2, level+1, max_level, true);\n }\n\n //create vertices, normals, indices for a cylinder that would represent a trunk section\n create_positions(){\n var nb_vertices = 6;\n\n this.positions = [];\n\n this.positions.push(0);\n this.positions.push(-1.0/2.0);\n this.positions.push(0);\n this.positions.push(0);\n this.positions.push(1.0/2.0);\n this.positions.push(0);\n\n //to make base of trunk slightly larger\n var bigger_base = 1.1;\n\n for (let i = 0; i < nb_vertices; i++) {\n var angle_val = 3.1415*2.0*(1.0/nb_vertices)*i;\n this.positions.push((Math.sin(angle_val)/2.0)*bigger_base);\n this.positions.push(-1.0/2.0);\n this.positions.push((Math.cos(angle_val)/2.0)*bigger_base);\n this.positions.push((Math.sin(angle_val)/2.0)*(1.0/bigger_base));\n this.positions.push(1.0/2.0);\n this.positions.push((Math.cos(angle_val)/2.0)*(1.0/bigger_base));\n }\n\n\n this.nb_indices = 3*nb_vertices*2+3*nb_vertices*2;\n this.indices = [];\n for (let i = 0; i < nb_vertices; i++) {\n var start_idx_face = 2+2*i; // 12 points per face\n var up_left = start_idx_face+1; //may be another one\n var up_right = start_idx_face+3;\n if(up_right >= 2+2*nb_vertices){\n up_right = 2+1;\n }\n var down_left = start_idx_face+0;\n var down_right = start_idx_face+2;\n if(down_right >= 2+2*nb_vertices){\n down_right = 2;\n }\n\n //top\n this.indices.push(1);\n this.indices.push(up_left);\n this.indices.push(up_right);\n //side\n this.indices.push( up_left);\n this.indices.push(down_left);\n this.indices.push(down_right);\n\n this.indices.push(up_right);\n this.indices.push( up_left);\n this.indices.push(down_right);\n\n //bottom\n this.indices.push( 0);\n this.indices.push(down_right);\n this.indices.push(down_left);\n }\n\n //per vertex textcoord\n this.tex_coord = [];\n\n this.tex_coord.push(1);\n this.tex_coord.push(1);\n this.tex_coord.push(0);\n this.tex_coord.push(0);\n\n for (let i = 0; i < nb_vertices; i++) {\n // i: 0 -> 0.5 == 0 -> 1\n // i: 0.5 -> 1.0 == 1 -> 0\n var relative_pos = i/nb_vertices;\n\n if ( relative_pos < 0.5){\n relative_pos = relative_pos*2;\n }\n else{ //relative_pos > 0.5f (0.5=1, 1.0=0)\n relative_pos = relative_pos*(-2)+2;\n }\n\n this.tex_coord.push(relative_pos); //bottom\n this.tex_coord.push(1.0);\n\n this.tex_coord.push(relative_pos); //top\n this.tex_coord.push(0.0);\n }\n\n //per vertex normal\n\n this.normals = []\n\n this.normals.push(0.0);\n this.normals.push(-1.0);\n this.normals.push(0.0);\n\n this.normals.push(0.0);\n this.normals.push(1.0);\n this.normals.push(0.0);\n\n for (let i = 0; i < nb_vertices; i++) {\n var angle_val = 3.1415*2.0*(1.0/nb_vertices)*i;\n this.normals.push(Math.sin(angle_val));\n this.normals.push(0.0);\n this.normals.push(Math.cos(angle_val));\n\n this.normals.push(Math.sin(angle_val));\n this.normals.push(0.0);\n this.normals.push(Math.cos(angle_val));\n }\n }\n}"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 1, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_tree.png", "license": "none-found", "non_commercial": false, "comment_density": 0.115, "dedup_hash": "4deb9b0cb20007af", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} -{"id": "webgl_examples_triangle", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Triangle", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "triangle/triangle.html", "language": "html", "loc": 11, "comment_density": 0.0, "code": "\n\n\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n"}, {"path": "triangle/triangle.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 7, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n void main() {\n frag_colour = colour;\n gl_Position = vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "triangle/triangle.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 5, "comment_density": 0.2, "code": "precision mediump float; //this is necessary in webgl glsl\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "triangle/triangle.js", "language": "javascript", "loc": 93, "comment_density": 0.14, "code": "var canvas;\nvar gl;\n\nvar shader_program;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\")\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"Cannot init WebGL\");\n return;\n }\n\n init_triangle();\n}\n\n//init the shaders and the buffers\nfunction init_triangle(){\n vertex_shader_glsl = `\n attribute vec4 vertex_pos;\n attribute vec3 colour;\n\n varying vec3 frag_colour;\n void main() {\n frag_colour = colour;\n gl_Position = vertex_pos;\n }\n `;\n\n fragment_shader_glsl = `\n precision mediump float; //this is necessary in webgl glsl\n varying vec3 frag_colour;\n\n void main() {\n gl_FragColor = vec4(frag_colour, 1.0);\n }\n `;\n\n const vertex_shader = loadShader(gl, gl.VERTEX_SHADER, vertex_shader_glsl);\n const fragment_shader = loadShader(gl, gl.FRAGMENT_SHADER, fragment_shader_glsl);\n\n shader_program = gl.createProgram();\n gl.attachShader(shader_program, vertex_shader);\n gl.attachShader(shader_program, fragment_shader);\n gl.linkProgram(shader_program);\n\n if (!gl.getProgramParameter(shader_program, gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + gl.getProgramInfoLog(shader_program));\n return null;\n }\n\n //create buffers and populate them for the triangle\n\n pos_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, pos_buffer);\n //position for each vertex of the triangle\n var triangle_points = new Float32Array([\n -1.0, -1.0, 0.0,\n 1.0, -1.0, 0.0,\n 0.0, 1.0, 0.0]);\n gl.bufferData(gl.ARRAY_BUFFER, triangle_points, gl.STATIC_DRAW);\n\n col_buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, col_buffer);\n //the colours for each points in RGB\n var triangle_colours = new Float32Array([\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0]);\n gl.bufferData(gl.ARRAY_BUFFER, triangle_colours, gl.STATIC_DRAW);\n}\n\nfunction draw(){\n\n gl.clearColor(0.0, 0.0, 0.2, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n gl.useProgram(shader_program);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, pos_buffer);\n gl.vertexAttribPointer(\n gl.getAttribLocation(shader_program, \"vertex_pos\"), //the name of the attribute\n 3, //how many data per vertex point\n gl.FLOAT, //type\n true, //normalize, no effect for float\n 0, //stride\n 0); //offset\n\n gl.enableVertexAttribArray(gl.getAttribLocation(shader_program, \"vertex_pos\"));\n\n gl.bindBuffer(gl.ARRAY_BUFFER, col_buffer);\n gl.vertexAttribPointer(\n gl.getAttribLocation(shader_program, \"colour\"),\n 3,\n gl.FLOAT,\n true,\n 0,\n 0);\n\n gl.enableVertexAttribArray(gl.getAttribLocation(shader_program, \"colour\"));\n\n //will draw 3 points\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "none-found", "non_commercial": false, "comment_density": 0.085, "dedup_hash": "ff1d839d47d87d6d", "has_readme": true, "build_system": null, "dependency_count": 2, "has_demo": true} -{"id": "webgl_examples_water", "source": "https://github.com/local/webgl_examples", "source_commit": "b2c0c5339a94083480a77fcc75a5578639918805", "collected_at": "2026-08-17T14:37:32+00:00", "source_type": "repo", "title": "Water", "api": "OpenGL/WebGL", "glsl_version": null, "topic": "water/lighting/texturing/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "water/cube.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 17, "comment_density": 0.235, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/cube.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 17, "comment_density": 0.118, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n uniform int active_clip;\n uniform float clip_height;\n\n void main() {\n\n //do not draw anything under the clip height\n if(active_clip != 0 && pixel_pos.y < clip_height){\n discard;\n }\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/cube.js", "language": "javascript", "loc": 208, "comment_density": 0.149, "code": "class Cube{\n\n setup(gl){\n this.gl = gl;\n\n this.model = mat4.create();\n mat4.translate(this.model, this.model, [0, 1, 0]);\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n //create shader\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n //buffer for the vertices pos of the cube\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n //buffer containings the normals\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n //indices for the vertices\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW)\n\n this.light_pos = [0,0,0];\n\n this.active_clip = 0;\n this.clip_height = 0;\n }\n\n //sets model view projection matrix\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_clip(active_clip, clip_height){\n this.active_clip = active_clip;\n this.clip_height = clip_height;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniform1i(this.gl.getUniformLocation(this.shader_program, \"active_clip\"), this.active_clip);\n this.gl.uniform1f(this.gl.getUniformLocation(this.shader_program, \"clip_height\"), this.clip_height);\n\n //send the matrices to the shader via the uniformMatrix\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n //draw the cube\n this.gl.drawElements(this.gl.TRIANGLES, 36, this.gl.UNSIGNED_SHORT, 0);\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n\n //normally the model matrix for normals should be different to keep orientation of normals\n //but it is a pain in webgl as we dont seem to have the inverse and transpose, so i don't do it\n // mat3 normal_mat = mat3(transpose(inverse(model)));\n mat3 normal_mat = mat3(model);\n\n //also transform the normals according to the model matrix\n pixel_normal = normalize(normal_mat*normal);\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n uniform int active_clip;\n uniform float clip_height;\n\n void main() {\n\n //do not draw anything under the clip height\n if(active_clip != 0 && pixel_pos.y < clip_height){\n discard;\n }\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/500.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n // Front face\n -1.0, -1.0, 1.0,\n 1.0, -1.0, 1.0,\n 1.0, 1.0, 1.0,\n -1.0, 1.0, 1.0,\n\n // Back face\n -1.0, -1.0, -1.0,\n -1.0, 1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, -1.0, -1.0,\n\n // Top face\n -1.0, 1.0, -1.0,\n -1.0, 1.0, 1.0,\n 1.0, 1.0, 1.0,\n 1.0, 1.0, -1.0,\n\n // Bottom face\n -1.0, -1.0, -1.0,\n 1.0, -1.0, -1.0,\n 1.0, -1.0, 1.0,\n -1.0, -1.0, 1.0,\n\n // Right face\n 1.0, -1.0, -1.0,\n 1.0, 1.0, -1.0,\n 1.0, 1.0, 1.0,\n 1.0, -1.0, 1.0,\n\n // Left face\n -1.0, -1.0, -1.0,\n -1.0, -1.0, 1.0,\n -1.0, 1.0, 1.0,\n -1.0, 1.0, -1.0,\n ];\n\n indices = [\n 0, 1, 2, 0, 2, 3, // front\n 4, 5, 6, 4, 6, 7, // back\n 8, 9, 10, 8, 10, 11, // top\n 12, 13, 14, 12, 14, 15, // bottom\n 16, 17, 18, 16, 18, 19, // right\n 20, 21, 22, 20, 22, 23, // left\n ];\n\n normals = [\n // Front face\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n 0.0, 0.0, 1.0,\n\n // Back face\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n 0.0, 0.0, -1.0,\n\n // Top face\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n\n // Bottom face\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n 0.0, -1.0, 0.0,\n\n // Right face\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n 1.0, 0.0, 0.0,\n\n // Left face\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n -1.0, 0.0, 0.0,\n ];\n}\n"}, {"path": "water/framebuffer.js", "language": "javascript", "loc": 38, "comment_density": 0.158, "code": "class Framebuffer{\n\n setup(gl, image_width, image_height) {\n this.gl = gl;\n\n this.image_width = image_width;\n this.image_height = image_height;\n\n this.fb_tex = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, this.fb_tex);\n\n //allocate space for the texture, but feed nothing to it (null)\n //will be filled later by rendering in the framebuffer\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.image_width, this.image_height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\n this.fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n\n //key part, we associate the texture with the framebuffer\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.fb_tex, 0);\n\n //create a depth buffer for the framebuffer, otherwise 3d rendering will be weird\n this.depth_buffer = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, this.depth_buffer);\n\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, this.image_width, this.image_height);\n\n //associate the render buffer with the framebuffer\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depth_buffer);\n\n //unbind everything to avoid pollution\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n bind(){\n this.gl.viewport(0, 0, this.image_width, this.image_height);\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.fb);\n }\n\n unbind(){\n this.gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n get_texture(){\n return this.fb_tex;\n }\n\n}"}, {"path": "water/main.js", "language": "javascript", "loc": 162, "comment_density": 0.099, "code": "var canvas;\n// Initialize the GL context\nvar gl;\n\nvar shaderProgram;\nvar indexBuffer;\nvar pos_buffer;\nvar col_buffer;\n\nvar proj_matrix = mat4.create();\nvar view_matrix = mat4.create();\nvar view_matrix_reflection = mat4.create();\n\nvar cam_height = 10;\nvar cam_radius = 20;\nvar position_cam = [cam_radius, cam_height, 0.0];\n\nvar water = new Water;\nvar water_transf = mat4.create();\n\nvar cubes_base = [new Cube, new Cube, new Cube, new Cube, new Cube];\nvar model_matrix_cubes_base = [mat4.create(), mat4.create(), mat4.create(), mat4.create(), mat4.create()];\n\nvar cubes_decoration = [new Cube, new Cube];\nvar model_matrix_cubes_decoration = [mat4.create(), mat4.create()]\n\nvar light_pos_radius = 15;\nvar light_pos = [-1, 5.0, 0];\n\nvar framebuffer_reflection = new Framebuffer;\nvar framebuffer_refraction = new Framebuffer;\n\nvar canvas_width = 1600;\nvar canvas_height = 900;\n\nvar last_time = 0;\n\n//needed for reflection matrix calculation\nvar water_height = 2;\n\nfunction main() {\n canvas = document.querySelector(\"#glCanvas\");\n gl = canvas.getContext(\"webgl\");\n // Only continue if WebGL is available and working\n if (gl === null) {\n alert(\"cannot init WebGL\");\n return;\n }\n\n canvas_width = gl.canvas.width;\n canvas_height = gl.canvas.height;\n\n\n framebuffer_reflection.setup(gl, canvas_width, canvas_height);\n framebuffer_refraction.setup(gl, canvas_width, canvas_height);\n\n water.setup(gl);\n\n water.set_reflection_texture(framebuffer_reflection.get_texture());;\n water.set_refraction_texture(framebuffer_refraction.get_texture());;\n\n mat4.translate(model_matrix_cubes_base[0], model_matrix_cubes_base[0], [15, 0, 0]);\n mat4.scale(model_matrix_cubes_base[0], model_matrix_cubes_base[0], [5, 2.5, 20]);\n\n mat4.translate(model_matrix_cubes_base[1], model_matrix_cubes_base[1], [-5, 0, -15]);\n mat4.scale(model_matrix_cubes_base[1], model_matrix_cubes_base[1], [15, 2.5, 5]);\n\n mat4.translate(model_matrix_cubes_base[2], model_matrix_cubes_base[2], [-5, 0, 15]);\n mat4.scale(model_matrix_cubes_base[2], model_matrix_cubes_base[2], [15, 2.5, 5]);\n\n mat4.translate(model_matrix_cubes_base[3], model_matrix_cubes_base[3], [-15, 0, 0]);\n mat4.scale(model_matrix_cubes_base[3], model_matrix_cubes_base[3], [5, 2.5, 10]);\n\n mat4.translate(model_matrix_cubes_base[4], model_matrix_cubes_base[4], [0, -2.5, 0]);\n mat4.scale(model_matrix_cubes_base[4], model_matrix_cubes_base[4], [20, 0.5, 20]);\n\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].setup(gl);\n cubes_base[i].set_model_matrix(model_matrix_cubes_base[i]);\n }\n\n mat4.translate(model_matrix_cubes_decoration[0], model_matrix_cubes_decoration[0], [0, 0, -4]);\n mat4.scale(model_matrix_cubes_decoration[0], model_matrix_cubes_decoration[0], [2.5, 2.5, 2.5]);\n\n mat4.translate(model_matrix_cubes_decoration[1], model_matrix_cubes_decoration[1], [-15, 5, 4]);\n mat4.scale(model_matrix_cubes_decoration[1], model_matrix_cubes_decoration[1], [2.5, 2.5, 2.5]);\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].setup(gl);\n cubes_decoration[i].set_model_matrix(model_matrix_cubes_decoration[i]);\n }\n\n\n mat4.translate(water_transf, water_transf, [0, water_height, 0]);\n mat4.scale(water_transf, water_transf, [20, 20, 20]);\n\n water.set_model_matrix(water_transf);\n\n //setup camera\n const fieldOfView = 45 * Math.PI / 180; // in radians\n const aspect = gl.canvas.clientWidth / gl.canvas.clientHeight;\n const zNear = 0.1;\n const zFar = 1000.0;\n\n mat4.perspective(proj_matrix, fieldOfView, aspect, zNear, zFar);\n}\n\nfunction draw(){\n\n mat4.lookAt(view_matrix, position_cam, [0, 0, 0], [0, 1, 0]);\n\n var pos_cam_from_underneath = [...position_cam]; //clone array\n pos_cam_from_underneath[1] = -position_cam[1]+water_height*2;\n mat4.lookAt(view_matrix_reflection, pos_cam_from_underneath, [0, water_height*2, 0], [0, 1, 0]);\n\n this.gl.viewport(0, 0, canvas_width, canvas_height);\n\n gl.clearColor(0.5, 0.7, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.enable(gl.DEPTH_TEST);\n gl.depthFunc(gl.LEQUAL);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n d = new Date();\n time = d.getTime()/100000.0;\n\n //so that first time we do the loop, time_diff does not contain crazy value\n if(last_time == 0){\n last_time = time;\n }\n\n //make it framerate independant\n time_diff = time-last_time;\n\n var light_speed = document.getElementById(\"slider_speed\").value;\n var light_height = document.getElementById(\"slider_height\").value;\n var cam_height = document.getElementById(\"cam_height\").value;\n var cam_rotation = -document.getElementById(\"cam_rotation\").value;\n\n //apply a rotation matrix on the light pos to make it rotate around the origin\n light_pos[0] = light_pos[0]*Math.cos(time_diff*light_speed)-light_pos[2]*Math.sin(time_diff*light_speed);\n light_pos[1] = 11.0-light_height;\n light_pos[2] = light_pos[0]*Math.sin(time_diff*light_speed)+light_pos[2]*Math.cos(time_diff*light_speed);\n\n //renormalize the rotating bit of the light position, to not lose precision\n var vec_rot_length = light_pos[0]*light_pos[0]+light_pos[2]*light_pos[2];\n light_pos[0] = light_pos[0]/vec_rot_length;\n light_pos[2] = light_pos[2]/vec_rot_length;\n\n var light_pos_scaled = [light_pos[0]*light_pos_radius, light_pos[1], light_pos[2]*light_pos_radius];\n\n position_cam[0] = cam_radius*Math.cos(cam_rotation/10);\n position_cam[1] = cam_height;\n position_cam[2] = cam_radius*Math.sin(cam_rotation/10);\n\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].set_light_pos(light_pos_scaled);\n cubes_base[i].set_vp(view_matrix, proj_matrix);\n cubes_base[i].draw();\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].set_light_pos(light_pos_scaled);\n cubes_decoration[i].set_vp(view_matrix, proj_matrix);\n cubes_decoration[i].draw();\n }\n\n water.set_time( (d.getTime()/500.0)%1000);\n water.set_vp(view_matrix, proj_matrix);\n water.set_light_pos(light_pos_scaled); //for specularity on the water\n water.set_camera_pos(position_cam); //for specularity on the water\n water.draw();\n\n //refraction step is just drawing the normal shapes again, but in a framebuffer\n framebuffer_refraction.bind();\n\n gl.clearColor(0.7, 0.8, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n //we need to clip everything underwater when rendering the reflection framebuffer\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].draw();\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].draw();\n }\n\n framebuffer_refraction.unbind();\n\n //for reflection step we draw every thing from underneath\n framebuffer_reflection.bind();\n\n gl.clearColor(0.7, 0.8, 0.9, 1.0);\n gl.clearDepth(1.0);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n\n //we need to clip everything underwater when rendering the reflection framebuffer\n for (let i = 0; i < cubes_base.length; i++) {\n cubes_base[i].set_clip(1, water_height);\n cubes_base[i].set_vp(view_matrix_reflection, proj_matrix);\n cubes_base[i].draw();\n cubes_base[i].set_clip(0, 0);\n }\n\n for (let i = 0; i < cubes_decoration.length; i++) {\n cubes_decoration[i].set_clip(1, water_height);\n cubes_decoration[i].set_vp(view_matrix_reflection, proj_matrix);\n cubes_decoration[i].draw();\n cubes_decoration[i].set_clip(0, 0);\n }\n\n framebuffer_reflection.unbind();\n\n last_time = time;\n\n requestAnimationFrame(draw);\n}\n\nmain();\nrequestAnimationFrame(draw);\n"}, {"path": "water/plane.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 12, "comment_density": 0.0, "code": "attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/plane.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 11, "comment_density": 0.091, "code": "precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/plane.js", "language": "javascript", "loc": 118, "comment_density": 0.008, "code": "class Plane{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n draw(){\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.useProgram(this.shader_program);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n }\n `;\n\n fragment_shader_code = `\n precision mediump float; //necessary in webgl glsl, medium precision for performance?\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 light_pos;\n\n void main() {\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float angle_light = dot(light_dir, pixel_normal);\n float dist_light = distance(pixel_pos, light_pos);\n\n float light_amount = angle_light-dist_light/50.0;\n\n gl_FragColor = vec4(1.0*light_amount, 1.0*light_amount, 1.0*light_amount, 1.0);\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n}\n"}, {"path": "water/water.html", "language": "html", "loc": 20, "comment_density": 0.0, "code": "\n\n\n\nLight Speed: \nLight Height: \nCam Height: \nCam Rotation:
\n\n\nYour browser does not support the canvas element.\n\n\n\n\n\n\n\n\n\n\n\n\n"}, {"path": "water/water.js#[inline_1_vertex]", "language": "glsl", "stage": "vertex", "loc": 16, "comment_density": 0.062, "code": "precision highp float; //high precision needed in mobile for light to display correctly\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/water.js#[inline_2_fragment]", "language": "glsl", "stage": "fragment", "loc": 52, "comment_density": 0.115, "code": "precision highp float; //high precision needed in mobile for light to display correctly\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 camera_pos;\n uniform vec3 light_pos;\n\n varying vec2 frag_uv;\n\n uniform sampler2D texture_reflection;\n uniform sampler2D texture_refraction;\n\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n float get_wave_1(float x, float y){\n float wave = 0.01*sin( dot(normalize(vec2(1,0)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(15,1)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(10,-1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.01*sin( dot(normalize(vec2(3,1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.02*sin( dot(normalize(vec2(6,-1)), vec2(x, y)) *64.0+time*0.8);\n wave += 0.015*sin( dot(normalize(vec2(8,1)), vec2(x, y)) *128.0+time*0.7);\n return wave/24.0;\n }\n\n void main() {\n\n float wave = get_wave_1(frag_uv.x, frag_uv.y);\n\n //interestingly the normal_wave would not be calculated correctly on mobile\n //if the float precision was only medium\n vec3 pos_before_x = vec3(frag_uv.x-0.001, get_wave_1(frag_uv.x-0.001, frag_uv.y), frag_uv.y);\n vec3 pos_after_x = vec3(frag_uv.x+0.001, get_wave_1(frag_uv.x+0.001, frag_uv.y), frag_uv.y);\n vec3 pos_before_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y-0.001), frag_uv.y-0.001);\n vec3 pos_after_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y+0.001), frag_uv.y+0.001);\n\n //get normal of wave, for lighting purpose\n vec3 normal_wave = normalize(cross( pos_after_x-pos_before_x, pos_after_y-pos_before_y));\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = 0.0;\n\n diffuse_light = dot(normal_wave, light_dir);\n float light_dist = length(light_pos-pixel_pos);\n diffuse_light /= (1.0+pow(light_dist, -0.5));\n\n //reflexion of light for specular light calculation, not the image reflexion\n vec3 reflexion = 2.0*normal_wave*dot(normal_wave, light_dir)-light_dir;\n reflexion = normalize(reflexion);\n vec3 view_dir = normalize(camera_pos-pixel_pos);\n\n float spec_light = pow(max(dot(reflexion, view_dir), 0.0), 256.0);\n spec_light = clamp(spec_light, 0.0, 1.0);\n\n float lum = 0.5*diffuse_light+spec_light;\n\n vec4 screen_pos = proj*view*vec4(pixel_pos, 1.0);\n vec2 corr_screen_pos_refraction = screen_pos.xy*0.5/screen_pos.w+vec2(0.5, 0.5);\n vec2 corr_screen_pos_reflection = vec2(corr_screen_pos_refraction.x, 1.0-corr_screen_pos_refraction.y); //must invert y\n\n corr_screen_pos_refraction += vec2(wave, wave);\n corr_screen_pos_reflection += vec2(wave, wave);\n\n vec3 colour_refraction = texture2D( texture_refraction, corr_screen_pos_refraction ).rgb;\n vec3 colour_reflection = texture2D( texture_reflection, corr_screen_pos_reflection ).rgb;\n vec4 lighting = vec4(lum, lum, lum, 1.0);\n gl_FragColor = vec4(0.25*colour_refraction, 1.0)+vec4(0.75*colour_reflection, 1.0)+ lighting;\n }", "glsl_version": null, "validation_status": "valid", "extraction_type": "js_template_literal"}, {"path": "water/water.js", "language": "javascript", "loc": 209, "comment_density": 0.038, "code": "class Water{\n\n setup(gl){\n this.gl = gl;\n\n const vertexShader = loadShader(this.gl, this.gl.VERTEX_SHADER, this.vertex_shader_code);\n const fragmentShader = loadShader(this.gl, this.gl.FRAGMENT_SHADER, this.fragment_shader_code);\n\n this.shader_program = this.gl.createProgram();\n this.gl.attachShader(this.shader_program, vertexShader);\n this.gl.attachShader(this.shader_program, fragmentShader);\n this.gl.linkProgram(this.shader_program);\n\n if (!this.gl.getProgramParameter(this.shader_program, this.gl.LINK_STATUS)) {\n alert('Unable to initialize the shader program: ' + this.gl.getProgramInfoLog(this.shader_program));\n return null;\n }\n\n this.pos_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.positions), this.gl.STATIC_DRAW);\n\n this.normal_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(this.normals), this.gl.STATIC_DRAW);\n\n this.idx_buffer = this.gl.createBuffer();\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(this.indices), this.gl.STATIC_DRAW);\n\n //texture coordinate buffer\n this.tex_coord_buffer = gl.createBuffer();\n this.gl.bindBuffer(gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.text_coord), gl.STATIC_DRAW);\n\n this.time = 0;\n }\n\n set_mvp(model, view, proj){\n this.model = model;\n this.view = view;\n this.proj = proj;\n }\n\n set_vp(view, proj){\n this.view = view;\n this.proj = proj;\n }\n\n set_light_pos(light_pos){\n this.light_pos = light_pos;\n }\n\n set_camera_pos(cam_pos){\n this.cam_pos = cam_pos;\n }\n\n set_model_matrix(model){\n this.model = model;\n }\n\n get_model_matrix(){\n return this.model;\n }\n\n set_reflection_texture(tex){\n this.reflection_texture_id = tex;\n }\n\n set_refraction_texture(tex){\n this.refraction_texture_id = tex;\n }\n\n set_time(time){\n this.time = time;\n }\n\n draw(){\n this.gl.useProgram(this.shader_program);\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.pos_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"vertex_pos\"));\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.normal_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"normal\"),\n 3,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"normal\"));\n\n\n this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.tex_coord_buffer);\n this.gl.vertexAttribPointer(\n this.gl.getAttribLocation(this.shader_program, \"uv\"),\n 2,\n this.gl.FLOAT,\n true,\n 0,\n 0);\n this.gl.enableVertexAttribArray(this.gl.getAttribLocation(this.shader_program, \"uv\"));\n\n gl.activeTexture(gl.TEXTURE0);\n\n gl.bindTexture(gl.TEXTURE_2D, this.reflection_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture_reflection\"), 0);\n\n gl.activeTexture(gl.TEXTURE1);\n\n gl.bindTexture(gl.TEXTURE_2D, this.refraction_texture_id);\n\n gl.uniform1i(gl.getUniformLocation(this.shader_program, \"texture_refraction\"), 1);\n gl.uniform1f(gl.getUniformLocation(this.shader_program, \"time\"), this.time);\n\n this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, this.idx_buffer);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"light_pos\"),\n this.light_pos);\n\n this.gl.uniform3fv(\n this.gl.getUniformLocation(this.shader_program, \"camera_pos\"),\n this.cam_pos);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"proj\"),\n false,\n this.proj);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"view\"),\n false,\n this.view);\n\n this.gl.uniformMatrix4fv(\n this.gl.getUniformLocation(this.shader_program, \"model\"),\n false,\n this.model);\n\n this.gl.drawElements(this.gl.TRIANGLES, 6, this.gl.UNSIGNED_SHORT, 0);\n }\n\n vertex_shader_code = `\n precision highp float; //high precision needed in mobile for light to display correctly\n attribute vec4 vertex_pos;\n attribute vec3 normal;\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform mat4 model;\n uniform mat4 view;\n uniform mat4 proj;\n\n attribute vec2 uv;\n\n varying vec2 frag_uv;\n\n void main() {\n pixel_pos = vec3(model*vertex_pos);\n pixel_normal = normalize(vec3(model*vec4(normal, 0.0)));\n gl_Position = proj*view*model*vertex_pos;\n frag_uv = uv;\n }\n `;\n\n fragment_shader_code = `\n precision highp float; //high precision needed in mobile for light to display correctly\n\n varying vec3 pixel_pos;\n varying vec3 pixel_normal;\n\n uniform vec3 camera_pos;\n uniform vec3 light_pos;\n\n varying vec2 frag_uv;\n\n uniform sampler2D texture_reflection;\n uniform sampler2D texture_refraction;\n\n uniform mat4 view;\n uniform mat4 proj;\n\n uniform float time;\n\n float get_wave_1(float x, float y){\n float wave = 0.01*sin( dot(normalize(vec2(1,0)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(15,1)), vec2(x, y)) *128.0+time);\n wave += 0.01*sin( dot(normalize(vec2(10,-1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.01*sin( dot(normalize(vec2(3,1)), vec2(x, y)) *256.0+time*1.5);\n wave += 0.02*sin( dot(normalize(vec2(6,-1)), vec2(x, y)) *64.0+time*0.8);\n wave += 0.015*sin( dot(normalize(vec2(8,1)), vec2(x, y)) *128.0+time*0.7);\n return wave/24.0;\n }\n\n void main() {\n\n float wave = get_wave_1(frag_uv.x, frag_uv.y);\n\n //interestingly the normal_wave would not be calculated correctly on mobile\n //if the float precision was only medium\n vec3 pos_before_x = vec3(frag_uv.x-0.001, get_wave_1(frag_uv.x-0.001, frag_uv.y), frag_uv.y);\n vec3 pos_after_x = vec3(frag_uv.x+0.001, get_wave_1(frag_uv.x+0.001, frag_uv.y), frag_uv.y);\n vec3 pos_before_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y-0.001), frag_uv.y-0.001);\n vec3 pos_after_y = vec3(frag_uv.x, get_wave_1(frag_uv.x, frag_uv.y+0.001), frag_uv.y+0.001);\n\n //get normal of wave, for lighting purpose\n vec3 normal_wave = normalize(cross( pos_after_x-pos_before_x, pos_after_y-pos_before_y));\n\n vec3 light_dir = normalize(light_pos-pixel_pos);\n float diffuse_light = 0.0;\n\n diffuse_light = dot(normal_wave, light_dir);\n float light_dist = length(light_pos-pixel_pos);\n diffuse_light /= (1.0+pow(light_dist, -0.5));\n\n //reflexion of light for specular light calculation, not the image reflexion\n vec3 reflexion = 2.0*normal_wave*dot(normal_wave, light_dir)-light_dir;\n reflexion = normalize(reflexion);\n vec3 view_dir = normalize(camera_pos-pixel_pos);\n\n float spec_light = pow(max(dot(reflexion, view_dir), 0.0), 256.0);\n spec_light = clamp(spec_light, 0.0, 1.0);\n\n float lum = 0.5*diffuse_light+spec_light;\n\n vec4 screen_pos = proj*view*vec4(pixel_pos, 1.0);\n vec2 corr_screen_pos_refraction = screen_pos.xy*0.5/screen_pos.w+vec2(0.5, 0.5);\n vec2 corr_screen_pos_reflection = vec2(corr_screen_pos_refraction.x, 1.0-corr_screen_pos_refraction.y); //must invert y\n\n corr_screen_pos_refraction += vec2(wave, wave);\n corr_screen_pos_reflection += vec2(wave, wave);\n\n vec3 colour_refraction = texture2D( texture_refraction, corr_screen_pos_refraction ).rgb;\n vec3 colour_reflection = texture2D( texture_reflection, corr_screen_pos_reflection ).rgb;\n vec4 lighting = vec4(lum, lum, lum, 1.0);\n gl_FragColor = vec4(0.25*colour_refraction, 1.0)+vec4(0.75*colour_reflection, 1.0)+ lighting;\n }\n `;\n\n positions = [\n -1.0, 0.0, -1.0,\n 1.0, 0.0, -1.0,\n 1.0, 0.0, 1.0,\n -1.0, 0.0, 1.0,\n ];\n\n indices = [\n 0, 2, 1, 0, 3, 2\n ];\n\n normals = [\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 1.0, 0.0,\n ];\n\n text_coord = [\n 0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0,\n ];\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "has_ubo": false, "has_ssbo": false, "texture_samplers": 2, "has_compute_barriers": false, "has_instancing": false}, "preview_image": "images/webgl_examples_water.png", "license": "none-found", "non_commercial": false, "comment_density": 0.089, "dedup_hash": "efc55ff0924657c7", "has_readme": true, "build_system": null, "dependency_count": 7, "has_demo": true} -{"id": "shadertoy_4dfgzs", "source": "https://www.shadertoy.com/view/4dfGzs", "source_commit": null, "collected_at": "2026-08-17T14:37:36+00:00", "source_type": "shadertoy", "title": "Raymarching Primitives", "author": "iquilezles", "description": "Raymarching distance fields (primitives, operations, lighting, soft shadows, ambient occlusion).", "api": "WebGL2", "glsl_version": "300 es", "topic": "raymarching/lighting/gi/basics", "difficulty": "intermediate", "source_quality": "curated_gallery", "files": [{"path": "image.frag", "language": "glsl", "stage": "fragment", "loc": 37, "comment_density": 0.027, "code": "// Inigo Quilez - Raymarching Primitives\nfloat sdSphere(vec3 p, float s) { return length(p) - s; }\nfloat sdBox(vec3 p, vec3 b) { vec3 d = abs(p) - b; return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0)); }\n\nfloat map(vec3 p) {\n float d1 = sdSphere(p - vec3(0.0, 0.25, 0.0), 0.75);\n float d2 = sdBox(p - vec3(0.0, -0.5, 0.0), vec3(1.5, 0.1, 1.5));\n return min(d1, d2);\n}\n\nvec3 calcNormal(vec3 p) {\n const float h = 0.001;\n const vec2 k = vec2(1, -1);\n return normalize(k.xyy*map(p + k.xyy*h) + \n k.yyx*map(p + k.yyx*h) + \n k.yxy*map(p + k.yxy*h) + \n k.xxx*map(p + k.xxx*h));\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 p = (2.0 * fragCoord - iResolution.xy) / iResolution.y;\n vec3 ro = vec3(0.0, 1.5, 3.0);\n vec3 rd = normalize(vec3(p, -1.5));\n\n float t = 0.0;\n for (int i = 0; i < 64; i++) {\n vec3 pos = ro + t * rd;\n float h = map(pos);\n if (h < 0.001 || t > 20.0) break;\n t += h;\n }\n\n vec3 col = vec3(0.1, 0.1, 0.15);\n if (t < 20.0) {\n vec3 pos = ro + t * rd;\n vec3 nor = calcNormal(pos);\n vec3 lig = normalize(vec3(0.8, 0.7, 0.6));\n float dif = clamp(dot(nor, lig), 0.0, 1.0);\n col = vec3(0.9, 0.6, 0.3) * dif + vec3(0.05, 0.1, 0.15);\n }\n\n fragColor = vec4(col, 1.0);\n}", "glsl_version": "300 es", "validation_status": "valid", "pass_type": "image"}], "validation": {"glslang_valid": 1, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "CC-BY-NC-SA-3.0", "non_commercial": true, "comment_density": 0.027, "dedup_hash": "77b7ba394cac7613", "has_readme": true, "build_system": null, "dependency_count": 0, "has_demo": true, "views": 182400, "likes": 1420, "tags": ["raymarching", "sdf", "distancefields", "lighting", "shadows", "primitives"]} -{"id": "shadertoy_lsf3rh", "source": "https://www.shadertoy.com/view/lsf3RH", "source_commit": null, "collected_at": "2026-08-17T14:37:36+00:00", "source_type": "shadertoy", "title": "Procedural Simplex Noise 2D/3D", "author": "ashima", "description": "Procedural cellular and simplex noise functions in pure GLSL.", "api": "WebGL2", "glsl_version": "300 es", "topic": "procedural/basics", "difficulty": "intermediate", "source_quality": "curated_gallery", "files": [{"path": "image.frag", "language": "glsl", "stage": "fragment", "loc": 31, "comment_density": 0.0, "code": "vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod289(i);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\n m = m*m;\n m = m*m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n float n = snoise(uv * 6.0 + iTime * 0.5);\n vec3 col = vec3(0.5 + 0.5 * n);\n fragColor = vec4(col, 1.0);\n}", "glsl_version": "300 es", "validation_status": "valid", "pass_type": "image"}], "validation": {"glslang_valid": 1, "invalid": 0, "unverified": 0, "has_ubo_or_ssbo": false, "texture_samplers": 0, "has_compute_barriers": false, "has_instancing": false}, "preview_image": null, "license": "CC-BY-NC-SA-3.0", "non_commercial": true, "comment_density": 0.0, "dedup_hash": "c855c26862ff313f", "has_readme": true, "build_system": null, "dependency_count": 0, "has_demo": true, "views": 94300, "likes": 560, "tags": ["noise", "procedural", "simplex", "fbm", "texture"]} +{"id": "joeydevries_learnopengl_includes", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:05+00:00", "source_type": "repo", "title": "Includes", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/particles/vegetation/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/SOIL.c", "language": "code", "loc": 1984, "comment_density": 0.172, "code": "/*\n\tJonathan Dummer\n\t2007-07-26-10.36\n\n\tSimple OpenGL Image Library\n\n\tPublic Domain\n\tusing Sean Barret's stb_image as a base\n\n\tThanks to:\n\t* Sean Barret - for the awesome stb_image\n\t* Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts\n\t* everybody at gamedev.net\n*/\n\n#define SOIL_CHECK_FOR_GL_ERRORS 0\n\n#ifdef WIN32\n\t#define WIN32_LEAN_AND_MEAN\n\t#include \n\t#include \n\t#include \n#elif defined(__APPLE__) || defined(__APPLE_CC__)\n\t/*\tI can't test this Apple stuff!\t*/\n\t#include \n\t#include \n\t#define APIENTRY\n#else\n\t#include \n\t#include \n#endif\n\n#include \"SOIL.h\"\n#include \"stb_image_aug.h\"\n#include \"image_helper.h\"\n#include \"image_DXT.h\"\n\n#include \n#include \n\n/*\terror reporting\t*/\nchar *result_string_pointer = \"SOIL initialized\";\n\n/*\tfor loading cube maps\t*/\nenum{\n\tSOIL_CAPABILITY_UNKNOWN = -1,\n\tSOIL_CAPABILITY_NONE = 0,\n\tSOIL_CAPABILITY_PRESENT = 1\n};\nstatic int has_cubemap_capability = SOIL_CAPABILITY_UNKNOWN;\nint query_cubemap_capability( void );\n#define SOIL_TEXTURE_WRAP_R\t\t\t\t\t0x8072\n#define SOIL_CLAMP_TO_EDGE\t\t\t\t\t0x812F\n#define SOIL_NORMAL_MAP\t\t\t\t\t\t0x8511\n#define SOIL_REFLECTION_MAP\t\t\t\t\t0x8512\n#define SOIL_TEXTURE_CUBE_MAP\t\t\t\t0x8513\n#define SOIL_TEXTURE_BINDING_CUBE_MAP\t\t0x8514\n#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_X\t0x8515\n#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X\t0x8516\n#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y\t0x8517\n#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y\t0x8518\n#define SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z\t0x8519\n#define SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z\t0x851A\n#define SOIL_PROXY_TEXTURE_CUBE_MAP\t\t\t0x851B\n#define SOIL_MAX_CUBE_MAP_TEXTURE_SIZE\t\t0x851C\n/*\tfor non-power-of-two texture\t*/\nstatic int has_NPOT_capability = SOIL_CAPABILITY_UNKNOWN;\nint query_NPOT_capability( void );\n/*\tfor texture rectangles\t*/\nstatic int has_tex_rectangle_capability = SOIL_CAPABILITY_UNKNOWN;\nint query_tex_rectangle_capability( void );\n#define SOIL_TEXTURE_RECTANGLE_ARB\t\t\t\t0x84F5\n#define SOIL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\t\t0x84F8\n/*\tfor using DXT compression\t*/\nstatic int has_DXT_capability = SOIL_CAPABILITY_UNKNOWN;\nint query_DXT_capability( void );\n#define SOIL_RGB_S3TC_DXT1\t\t0x83F0\n#define SOIL_RGBA_S3TC_DXT1\t\t0x83F1\n#define SOIL_RGBA_S3TC_DXT3\t\t0x83F2\n#define SOIL_RGBA_S3TC_DXT5\t\t0x83F3\ntypedef void (APIENTRY * P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data);\nP_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC soilGlCompressedTexImage2D = NULL;\nunsigned int SOIL_direct_load_DDS(\n\t\tconst char *filename,\n\t\tunsigned int reuse_texture_ID,\n\t\tint flags,\n\t\tint loading_as_cubemap );\nunsigned int SOIL_direct_load_DDS_from_memory(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tunsigned int reuse_texture_ID,\n\t\tint flags,\n\t\tint loading_as_cubemap );\n/*\tother functions\t*/\nunsigned int\n\tSOIL_internal_create_OGL_texture\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags,\n\t\tunsigned int opengl_texture_type,\n\t\tunsigned int opengl_texture_target,\n\t\tunsigned int texture_check_size_enum\n\t);\n\n/*\tand the code magic begins here [8^)\t*/\nunsigned int\n\tSOIL_load_OGL_texture\n\t(\n\t\tconst char *filename,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\tdoes the user want direct uploading of the image as a DDS file?\t*/\n\tif( flags & SOIL_FLAG_DDS_LOAD_DIRECT )\n\t{\n\t\t/*\t1st try direct loading of the image as a DDS file\n\t\t\tnote: direct uploading will only load what is in the\n\t\t\tDDS file, no MIPmaps will be generated, the image will\n\t\t\tnot be flipped, etc.\t*/\n\t\ttex_id = SOIL_direct_load_DDS( filename, reuse_texture_ID, flags, 0 );\n\t\tif( tex_id )\n\t\t{\n\t\t\t/*\they, it worked!!\t*/\n\t\t\treturn tex_id;\n\t\t}\n\t}\n\t/*\ttry to load the image\t*/\n\timg = SOIL_load_image( filename, &width, &height, &channels, force_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tOK, make it a texture!\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tGL_TEXTURE_2D, GL_TEXTURE_2D,\n\t\t\tGL_MAX_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_HDR_texture\n\t(\n\t\tconst char *filename,\n\t\tint fake_HDR_format,\n\t\tint rescale_to_max,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\tno direct uploading of the image as a DDS file\t*/\n\t/* error check */\n\tif( (fake_HDR_format != SOIL_HDR_RGBE) &&\n\t\t(fake_HDR_format != SOIL_HDR_RGBdivA) &&\n\t\t(fake_HDR_format != SOIL_HDR_RGBdivA2) )\n\t{\n\t\tresult_string_pointer = \"Invalid fake HDR format specified\";\n\t\treturn 0;\n\t}\n\t/*\ttry to load the image (only the HDR type) */\n\timg = stbi_hdr_load_rgbe( filename, &width, &height, &channels, 4 );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/* the load worked, do I need to convert it? */\n\tif( fake_HDR_format == SOIL_HDR_RGBdivA )\n\t{\n\t\tRGBE_to_RGBdivA( img, width, height, rescale_to_max );\n\t} else if( fake_HDR_format == SOIL_HDR_RGBdivA2 )\n\t{\n\t\tRGBE_to_RGBdivA2( img, width, height, rescale_to_max );\n\t}\n\t/*\tOK, make it a texture!\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tGL_TEXTURE_2D, GL_TEXTURE_2D,\n\t\t\tGL_MAX_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_texture_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\tdoes the user want direct uploading of the image as a DDS file?\t*/\n\tif( flags & SOIL_FLAG_DDS_LOAD_DIRECT )\n\t{\n\t\t/*\t1st try direct loading of the image as a DDS file\n\t\t\tnote: direct uploading will only load what is in the\n\t\t\tDDS file, no MIPmaps will be generated, the image will\n\t\t\tnot be flipped, etc.\t*/\n\t\ttex_id = SOIL_direct_load_DDS_from_memory(\n\t\t\t\tbuffer, buffer_length,\n\t\t\t\treuse_texture_ID, flags, 0 );\n\t\tif( tex_id )\n\t\t{\n\t\t\t/*\they, it worked!!\t*/\n\t\t\treturn tex_id;\n\t\t}\n\t}\n\t/*\ttry to load the image\t*/\n\timg = SOIL_load_image_from_memory(\n\t\t\t\t\tbuffer, buffer_length,\n\t\t\t\t\t&width, &height, &channels,\n\t\t\t\t\tforce_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tOK, make it a texture!\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tGL_TEXTURE_2D, GL_TEXTURE_2D,\n\t\t\tGL_MAX_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_cubemap\n\t(\n\t\tconst char *x_pos_file,\n\t\tconst char *x_neg_file,\n\t\tconst char *y_pos_file,\n\t\tconst char *y_neg_file,\n\t\tconst char *z_pos_file,\n\t\tconst char *z_neg_file,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\terror checking\t*/\n\tif( (x_pos_file == NULL) ||\n\t\t(x_neg_file == NULL) ||\n\t\t(y_pos_file == NULL) ||\n\t\t(y_neg_file == NULL) ||\n\t\t(z_pos_file == NULL) ||\n\t\t(z_neg_file == NULL) )\n\t{\n\t\tresult_string_pointer = \"Invalid cube map files list\";\n\t\treturn 0;\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\t1st face: try to load the image\t*/\n\timg = SOIL_load_image( x_pos_file, &width, &height, &channels, force_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tupload the texture, and create a texture ID if necessary\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_X,\n\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( x_neg_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( y_pos_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( y_neg_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( z_pos_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image( z_neg_file, &width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_cubemap_from_memory\n\t(\n\t\tconst unsigned char *const x_pos_buffer,\n\t\tint x_pos_buffer_length,\n\t\tconst unsigned char *const x_neg_buffer,\n\t\tint x_neg_buffer_length,\n\t\tconst unsigned char *const y_pos_buffer,\n\t\tint y_pos_buffer_length,\n\t\tconst unsigned char *const y_neg_buffer,\n\t\tint y_neg_buffer_length,\n\t\tconst unsigned char *const z_pos_buffer,\n\t\tint z_pos_buffer_length,\n\t\tconst unsigned char *const z_neg_buffer,\n\t\tint z_neg_buffer_length,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels;\n\tunsigned int tex_id;\n\t/*\terror checking\t*/\n\tif( (x_pos_buffer == NULL) ||\n\t\t(x_neg_buffer == NULL) ||\n\t\t(y_pos_buffer == NULL) ||\n\t\t(y_neg_buffer == NULL) ||\n\t\t(z_pos_buffer == NULL) ||\n\t\t(z_neg_buffer == NULL) )\n\t{\n\t\tresult_string_pointer = \"Invalid cube map buffers list\";\n\t\treturn 0;\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\t1st face: try to load the image\t*/\n\timg = SOIL_load_image_from_memory(\n\t\t\tx_pos_buffer, x_pos_buffer_length,\n\t\t\t&width, &height, &channels, force_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tupload the texture, and create a texture ID if necessary\t*/\n\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\timg, width, height, channels,\n\t\t\treuse_texture_ID, flags,\n\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_X,\n\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t/*\tand nuke the image data\t*/\n\tSOIL_free_image_data( img );\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\tx_neg_buffer, x_neg_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\ty_pos_buffer, y_pos_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\ty_neg_buffer, y_neg_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\tz_pos_buffer, z_pos_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tcontinue?\t*/\n\tif( tex_id != 0 )\n\t{\n\t\t/*\t1st face: try to load the image\t*/\n\t\timg = SOIL_load_image_from_memory(\n\t\t\t\tz_neg_buffer, z_neg_buffer_length,\n\t\t\t\t&width, &height, &channels, force_channels );\n\t\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\t\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t\t{\n\t\t\tchannels = force_channels;\n\t\t}\n\t\tif( NULL == img )\n\t\t{\n\t\t\t/*\timage loading failed\t*/\n\t\t\tresult_string_pointer = stbi_failure_reason();\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tupload the texture, but reuse the assigned texture ID\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\timg, width, height, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP, SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t\t/*\tand nuke the image data\t*/\n\t\tSOIL_free_image_data( img );\n\t}\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_single_cubemap\n\t(\n\t\tconst char *filename,\n\t\tconst char face_order[6],\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels, i;\n\tunsigned int tex_id = 0;\n\t/*\terror checking\t*/\n\tif( filename == NULL )\n\t{\n\t\tresult_string_pointer = \"Invalid single cube map file name\";\n\t\treturn 0;\n\t}\n\t/*\tdoes the user want direct uploading of the image as a DDS file?\t*/\n\tif( flags & SOIL_FLAG_DDS_LOAD_DIRECT )\n\t{\n\t\t/*\t1st try direct loading of the image as a DDS file\n\t\t\tnote: direct uploading will only load what is in the\n\t\t\tDDS file, no MIPmaps will be generated, the image will\n\t\t\tnot be flipped, etc.\t*/\n\t\ttex_id = SOIL_direct_load_DDS( filename, reuse_texture_ID, flags, 1 );\n\t\tif( tex_id )\n\t\t{\n\t\t\t/*\they, it worked!!\t*/\n\t\t\treturn tex_id;\n\t\t}\n\t}\n\t/*\tface order checking\t*/\n\tfor( i = 0; i < 6; ++i )\n\t{\n\t\tif( (face_order[i] != 'N') &&\n\t\t\t(face_order[i] != 'S') &&\n\t\t\t(face_order[i] != 'W') &&\n\t\t\t(face_order[i] != 'E') &&\n\t\t\t(face_order[i] != 'U') &&\n\t\t\t(face_order[i] != 'D') )\n\t\t{\n\t\t\tresult_string_pointer = \"Invalid single cube map face order\";\n\t\t\treturn 0;\n\t\t};\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\t1st off, try to load the full image\t*/\n\timg = SOIL_load_image( filename, &width, &height, &channels, force_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tnow, does this image have the right dimensions?\t*/\n\tif( (width != 6*height) &&\n\t\t(6*width != height) )\n\t{\n\t\tSOIL_free_image_data( img );\n\t\tresult_string_pointer = \"Single cubemap image must have a 6:1 ratio\";\n\t\treturn 0;\n\t}\n\t/*\ttry the image split and create\t*/\n\ttex_id = SOIL_create_OGL_single_cubemap(\n\t\t\timg, width, height, channels,\n\t\t\tface_order, reuse_texture_ID, flags\n\t\t\t);\n\t/*\tnuke the temporary image data and return the texture handle\t*/\n\tSOIL_free_image_data( img );\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_load_OGL_single_cubemap_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tconst char face_order[6],\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tint width, height, channels, i;\n\tunsigned int tex_id = 0;\n\t/*\terror checking\t*/\n\tif( buffer == NULL )\n\t{\n\t\tresult_string_pointer = \"Invalid single cube map buffer\";\n\t\treturn 0;\n\t}\n\t/*\tdoes the user want direct uploading of the image as a DDS file?\t*/\n\tif( flags & SOIL_FLAG_DDS_LOAD_DIRECT )\n\t{\n\t\t/*\t1st try direct loading of the image as a DDS file\n\t\t\tnote: direct uploading will only load what is in the\n\t\t\tDDS file, no MIPmaps will be generated, the image will\n\t\t\tnot be flipped, etc.\t*/\n\t\ttex_id = SOIL_direct_load_DDS_from_memory(\n\t\t\t\tbuffer, buffer_length,\n\t\t\t\treuse_texture_ID, flags, 1 );\n\t\tif( tex_id )\n\t\t{\n\t\t\t/*\they, it worked!!\t*/\n\t\t\treturn tex_id;\n\t\t}\n\t}\n\t/*\tface order checking\t*/\n\tfor( i = 0; i < 6; ++i )\n\t{\n\t\tif( (face_order[i] != 'N') &&\n\t\t\t(face_order[i] != 'S') &&\n\t\t\t(face_order[i] != 'W') &&\n\t\t\t(face_order[i] != 'E') &&\n\t\t\t(face_order[i] != 'U') &&\n\t\t\t(face_order[i] != 'D') )\n\t\t{\n\t\t\tresult_string_pointer = \"Invalid single cube map face order\";\n\t\t\treturn 0;\n\t\t};\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\t1st off, try to load the full image\t*/\n\timg = SOIL_load_image_from_memory(\n\t\t\tbuffer, buffer_length,\n\t\t\t&width, &height, &channels,\n\t\t\tforce_channels );\n\t/*\tchannels holds the original number of channels, which may have been forced\t*/\n\tif( (force_channels >= 1) && (force_channels <= 4) )\n\t{\n\t\tchannels = force_channels;\n\t}\n\tif( NULL == img )\n\t{\n\t\t/*\timage loading failed\t*/\n\t\tresult_string_pointer = stbi_failure_reason();\n\t\treturn 0;\n\t}\n\t/*\tnow, does this image have the right dimensions?\t*/\n\tif( (width != 6*height) &&\n\t\t(6*width != height) )\n\t{\n\t\tSOIL_free_image_data( img );\n\t\tresult_string_pointer = \"Single cubemap image must have a 6:1 ratio\";\n\t\treturn 0;\n\t}\n\t/*\ttry the image split and create\t*/\n\ttex_id = SOIL_create_OGL_single_cubemap(\n\t\t\timg, width, height, channels,\n\t\t\tface_order, reuse_texture_ID, flags\n\t\t\t);\n\t/*\tnuke the temporary image data and return the texture handle\t*/\n\tSOIL_free_image_data( img );\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_create_OGL_single_cubemap\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tconst char face_order[6],\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* sub_img;\n\tint dw, dh, sz, i;\n\tunsigned int tex_id;\n\t/*\terror checking\t*/\n\tif( data == NULL )\n\t{\n\t\tresult_string_pointer = \"Invalid single cube map image data\";\n\t\treturn 0;\n\t}\n\t/*\tface order checking\t*/\n\tfor( i = 0; i < 6; ++i )\n\t{\n\t\tif( (face_order[i] != 'N') &&\n\t\t\t(face_order[i] != 'S') &&\n\t\t\t(face_order[i] != 'W') &&\n\t\t\t(face_order[i] != 'E') &&\n\t\t\t(face_order[i] != 'U') &&\n\t\t\t(face_order[i] != 'D') )\n\t\t{\n\t\t\tresult_string_pointer = \"Invalid single cube map face order\";\n\t\t\treturn 0;\n\t\t};\n\t}\n\t/*\tcapability checking\t*/\n\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t{\n\t\tresult_string_pointer = \"No cube map capability present\";\n\t\treturn 0;\n\t}\n\t/*\tnow, does this image have the right dimensions?\t*/\n\tif( (width != 6*height) &&\n\t\t(6*width != height) )\n\t{\n\t\tresult_string_pointer = \"Single cubemap image must have a 6:1 ratio\";\n\t\treturn 0;\n\t}\n\t/*\twhich way am I stepping?\t*/\n\tif( width > height )\n\t{\n\t\tdw = height;\n\t\tdh = 0;\n\t} else\n\t{\n\t\tdw = 0;\n\t\tdh = width;\n\t}\n\tsz = dw+dh;\n\tsub_img = (unsigned char *)malloc( sz*sz*channels );\n\t/*\tdo the splitting and uploading\t*/\n\ttex_id = reuse_texture_ID;\n\tfor( i = 0; i < 6; ++i )\n\t{\n\t\tint x, y, idx = 0;\n\t\tunsigned int cubemap_target = 0;\n\t\t/*\tcopy in the sub-image\t*/\n\t\tfor( y = i*dh; y < i*dh+sz; ++y )\n\t\t{\n\t\t\tfor( x = i*dw*channels; x < (i*dw+sz)*channels; ++x )\n\t\t\t{\n\t\t\t\tsub_img[idx++] = data[y*width*channels+x];\n\t\t\t}\n\t\t}\n\t\t/*\twhat is my texture target?\n\t\t\tremember, this coordinate system is\n\t\t\tLHS if viewed from inside the cube!\t*/\n\t\tswitch( face_order[i] )\n\t\t{\n\t\tcase 'N':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_Z;\n\t\t\tbreak;\n\t\tcase 'S':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z;\n\t\t\tbreak;\n\t\tcase 'W':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_X;\n\t\t\tbreak;\n\t\tcase 'E':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_X;\n\t\t\tbreak;\n\t\tcase 'U':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_POSITIVE_Y;\n\t\t\tbreak;\n\t\tcase 'D':\n\t\t\tcubemap_target = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Y;\n\t\t\tbreak;\n\t\t}\n\t\t/*\tupload it as a texture\t*/\n\t\ttex_id = SOIL_internal_create_OGL_texture(\n\t\t\t\tsub_img, sz, sz, channels,\n\t\t\t\ttex_id, flags,\n\t\t\t\tSOIL_TEXTURE_CUBE_MAP,\n\t\t\t\tcubemap_target,\n\t\t\t\tSOIL_MAX_CUBE_MAP_TEXTURE_SIZE );\n\t}\n\t/*\tand nuke the image and sub-image data\t*/\n\tSOIL_free_image_data( sub_img );\n\t/*\tand return the handle, such as it is\t*/\n\treturn tex_id;\n}\n\nunsigned int\n\tSOIL_create_OGL_texture\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t)\n{\n\t/*\twrapper function for 2D textures\t*/\n\treturn SOIL_internal_create_OGL_texture(\n\t\t\t\tdata, width, height, channels,\n\t\t\t\treuse_texture_ID, flags,\n\t\t\t\tGL_TEXTURE_2D, GL_TEXTURE_2D,\n\t\t\t\tGL_MAX_TEXTURE_SIZE );\n}\n\n#if SOIL_CHECK_FOR_GL_ERRORS\nvoid check_for_GL_errors( const char *calling_location )\n{\n\t/*\tcheck for errors\t*/\n\tGLenum err_code = glGetError();\n\twhile( GL_NO_ERROR != err_code )\n\t{\n\t\tprintf( \"OpenGL Error @ %s: %i\", calling_location, err_code );\n\t\terr_code = glGetError();\n\t}\n}\n#else\nvoid check_for_GL_errors( const char *calling_location )\n{\n\t/*\tno check for errors\t*/\n}\n#endif\n\nunsigned int\n\tSOIL_internal_create_OGL_texture\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags,\n\t\tunsigned int opengl_texture_type,\n\t\tunsigned int opengl_texture_target,\n\t\tunsigned int texture_check_size_enum\n\t)\n{\n\t/*\tvariables\t*/\n\tunsigned char* img;\n\tunsigned int tex_id;\n\tunsigned int internal_texture_format = 0, original_texture_format = 0;\n\tint DXT_mode = SOIL_CAPABILITY_UNKNOWN;\n\tint max_supported_size;\n\t/*\tIf the user wants to use the texture rectangle I kill a few flags\t*/\n\tif( flags & SOIL_FLAG_TEXTURE_RECTANGLE )\n\t{\n\t\t/*\twell, the user asked for it, can we do that?\t*/\n\t\tif( query_tex_rectangle_capability() == SOIL_CAPABILITY_PRESENT )\n\t\t{\n\t\t\t/*\tonly allow this if the user in _NOT_ trying to do a cubemap!\t*/\n\t\t\tif( opengl_texture_type == GL_TEXTURE_2D )\n\t\t\t{\n\t\t\t\t/*\tclean out the flags that cannot be used with texture rectangles\t*/\n\t\t\t\tflags &= ~(\n\t\t\t\t\t\tSOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS |\n\t\t\t\t\t\tSOIL_FLAG_TEXTURE_REPEATS\n\t\t\t\t\t);\n\t\t\t\t/*\tand change my target\t*/\n\t\t\t\topengl_texture_target = SOIL_TEXTURE_RECTANGLE_ARB;\n\t\t\t\topengl_texture_type = SOIL_TEXTURE_RECTANGLE_ARB;\n\t\t\t} else\n\t\t\t{\n\t\t\t\t/*\tnot allowed for any other uses (yes, I'm looking at you, cubemaps!)\t*/\n\t\t\t\tflags &= ~SOIL_FLAG_TEXTURE_RECTANGLE;\n\t\t\t}\n\n\t\t} else\n\t\t{\n\t\t\t/*\tcan't do it, and that is a breakable offense (uv coords use pixels instead of [0,1]!)\t*/\n\t\t\tresult_string_pointer = \"Texture Rectangle extension unsupported\";\n\t\t\treturn 0;\n\t\t}\n\t}\n\t/*\tcreate a copy the image data\t*/\n\timg = (unsigned char*)malloc( width*height*channels );\n\tmemcpy( img, data, width*height*channels );\n\t/*\tdoes the user want me to invert the image?\t*/\n\tif( flags & SOIL_FLAG_INVERT_Y )\n\t{\n\t\tint i, j;\n\t\tfor( j = 0; j*2 < height; ++j )\n\t\t{\n\t\t\tint index1 = j * width * channels;\n\t\t\tint index2 = (height - 1 - j) * width * channels;\n\t\t\tfor( i = width * channels; i > 0; --i )\n\t\t\t{\n\t\t\t\tunsigned char temp = img[index1];\n\t\t\t\timg[index1] = img[index2];\n\t\t\t\timg[index2] = temp;\n\t\t\t\t++index1;\n\t\t\t\t++index2;\n\t\t\t}\n\t\t}\n\t}\n\t/*\tdoes the user want me to scale the colors into the NTSC safe RGB range?\t*/\n\tif( flags & SOIL_FLAG_NTSC_SAFE_RGB )\n\t{\n\t\tscale_image_RGB_to_NTSC_safe( img, width, height, channels );\n\t}\n\t/*\tdoes the user want me to convert from straight to pre-multiplied alpha?\n\t\t(and do we even _have_ alpha?)\t*/\n\tif( flags & SOIL_FLAG_MULTIPLY_ALPHA )\n\t{\n\t\tint i;\n\t\tswitch( channels )\n\t\t{\n\t\tcase 2:\n\t\t\tfor( i = 0; i < 2*width*height; i += 2 )\n\t\t\t{\n\t\t\t\timg[i] = (img[i] * img[i+1] + 128) >> 8;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tfor( i = 0; i < 4*width*height; i += 4 )\n\t\t\t{\n\t\t\t\timg[i+0] = (img[i+0] * img[i+3] + 128) >> 8;\n\t\t\t\timg[i+1] = (img[i+1] * img[i+3] + 128) >> 8;\n\t\t\t\timg[i+2] = (img[i+2] * img[i+3] + 128) >> 8;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/*\tno other number of channels contains alpha data\t*/\n\t\t\tbreak;\n\t\t}\n\t}\n\t/*\tif the user can't support NPOT textures, make sure we force the POT option\t*/\n\tif( (query_NPOT_capability() == SOIL_CAPABILITY_NONE) &&\n\t\t!(flags & SOIL_FLAG_TEXTURE_RECTANGLE) )\n\t{\n\t\t/*\tadd in the POT flag */\n\t\tflags |= SOIL_FLAG_POWER_OF_TWO;\n\t}\n\t/*\thow large of a texture can this OpenGL implementation handle?\t*/\n\t/*\ttexture_check_size_enum will be GL_MAX_TEXTURE_SIZE or SOIL_MAX_CUBE_MAP_TEXTURE_SIZE\t*/\n\tglGetIntegerv( texture_check_size_enum, &max_supported_size );\n\t/*\tdo I need to make it a power of 2?\t*/\n\tif(\n\t\t(flags & SOIL_FLAG_POWER_OF_TWO) ||\t/*\tuser asked for it\t*/\n\t\t(flags & SOIL_FLAG_MIPMAPS) ||\t\t/*\tneed it for the MIP-maps\t*/\n\t\t(width > max_supported_size) ||\t\t/*\tit's too big, (make sure it's\t*/\n\t\t(height > max_supported_size) )\t\t/*\t2^n for later down-sampling)\t*/\n\t{\n\t\tint new_width = 1;\n\t\tint new_height = 1;\n\t\twhile( new_width < width )\n\t\t{\n\t\t\tnew_width *= 2;\n\t\t}\n\t\twhile( new_height < height )\n\t\t{\n\t\t\tnew_height *= 2;\n\t\t}\n\t\t/*\tstill?\t*/\n\t\tif( (new_width != width) || (new_height != height) )\n\t\t{\n\t\t\t/*\tyep, resize\t*/\n\t\t\tunsigned char *resampled = (unsigned char*)malloc( channels*new_width*new_height );\n\t\t\tup_scale_image(\n\t\t\t\t\timg, width, height, channels,\n\t\t\t\t\tresampled, new_width, new_height );\n\t\t\t/*\tOJO\tthis is for debug only!\t*/\n\t\t\t/*\n\t\t\tSOIL_save_image( \"\\\\showme.bmp\", SOIL_SAVE_TYPE_BMP,\n\t\t\t\t\t\t\tnew_width, new_height, channels,\n\t\t\t\t\t\t\tresampled );\n\t\t\t*/\n\t\t\t/*\tnuke the old guy, then point it at the new guy\t*/\n\t\t\tSOIL_free_image_data( img );\n\t\t\timg = resampled;\n\t\t\twidth = new_width;\n\t\t\theight = new_height;\n\t\t}\n\t}\n\t/*\tnow, if it is too large...\t*/\n\tif( (width > max_supported_size) || (height > max_supported_size) )\n\t{\n\t\t/*\tI've already made it a power of two, so simply use the MIPmapping\n\t\t\tcode to reduce its size to the allowable maximum.\t*/\n\t\tunsigned char *resampled;\n\t\tint reduce_block_x = 1, reduce_block_y = 1;\n\t\tint new_width, new_height;\n\t\tif( width > max_supported_size )\n\t\t{\n\t\t\treduce_block_x = width / max_supported_size;\n\t\t}\n\t\tif( height > max_supported_size )\n\t\t{\n\t\t\treduce_block_y = height / max_supported_size;\n\t\t}\n\t\tnew_width = width / reduce_block_x;\n\t\tnew_height = height / reduce_block_y;\n\t\tresampled = (unsigned char*)malloc( channels*new_width*new_height );\n\t\t/*\tperform the actual reduction\t*/\n\t\tmipmap_image(\timg, width, height, channels,\n\t\t\t\t\t\tresampled, reduce_block_x, reduce_block_y );\n\t\t/*\tnuke the old guy, then point it at the new guy\t*/\n\t\tSOIL_free_image_data( img );\n\t\timg = resampled;\n\t\twidth = new_width;\n\t\theight = new_height;\n\t}\n\t/*\tdoes the user want us to use YCoCg color space?\t*/\n\tif( flags & SOIL_FLAG_CoCg_Y )\n\t{\n\t\t/*\tthis will only work with RGB and RGBA images */\n\t\tconvert_RGB_to_YCoCg( img, width, height, channels );\n\t\t/*\n\t\tsave_image_as_DDS( \"CoCg_Y.dds\", width, height, channels, img );\n\t\t*/\n\t}\n\t/*\tcreate the OpenGL texture ID handle\n \t(note: allowing a forced texture ID lets me reload a texture)\t*/\n tex_id = reuse_texture_ID;\n if( tex_id == 0 )\n {\n\t\tglGenTextures( 1, &tex_id );\n }\n\tcheck_for_GL_errors( \"glGenTextures\" );\n\t/* Note: sometimes glGenTextures fails (usually no OpenGL context)\t*/\n\tif( tex_id )\n\t{\n\t\t/*\tand what type am I using as the internal texture format?\t*/\n\t\tswitch( channels )\n\t\t{\n\t\tcase 1:\n\t\t\toriginal_texture_format = GL_LUMINANCE;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\toriginal_texture_format = GL_LUMINANCE_ALPHA;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\toriginal_texture_format = GL_RGB;\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\toriginal_texture_format = GL_RGBA;\n\t\t\tbreak;\n\t\t}\n\t\tinternal_texture_format = original_texture_format;\n\t\t/*\tdoes the user want me to, and can I, save as DXT?\t*/\n\t\tif( flags & SOIL_FLAG_COMPRESS_TO_DXT )\n\t\t{\n\t\t\tDXT_mode = query_DXT_capability();\n\t\t\tif( DXT_mode == SOIL_CAPABILITY_PRESENT )\n\t\t\t{\n\t\t\t\t/*\tI can use DXT, whether I compress it or OpenGL does\t*/\n\t\t\t\tif( (channels & 1) == 1 )\n\t\t\t\t{\n\t\t\t\t\t/*\t1 or 3 channels = DXT1\t*/\n\t\t\t\t\tinternal_texture_format = SOIL_RGB_S3TC_DXT1;\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\t/*\t2 or 4 channels = DXT5\t*/\n\t\t\t\t\tinternal_texture_format = SOIL_RGBA_S3TC_DXT5;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/* bind an OpenGL texture ID\t*/\n\t\tglBindTexture( opengl_texture_type, tex_id );\n\t\tcheck_for_GL_errors( \"glBindTexture\" );\n\t\t/* upload the main image\t*/\n\t\tif( DXT_mode == SOIL_CAPABILITY_PRESENT )\n\t\t{\n\t\t\t/*\tuser wants me to do the DXT conversion!\t*/\n\t\t\tint DDS_size;\n\t\t\tunsigned char *DDS_data = NULL;\n\t\t\tif( (channels & 1) == 1 )\n\t\t\t{\n\t\t\t\t/*\tRGB, use DXT1\t*/\n\t\t\t\tDDS_data = convert_image_to_DXT1( img, width, height, channels, &DDS_size );\n\t\t\t} else\n\t\t\t{\n\t\t\t\t/*\tRGBA, use DXT5\t*/\n\t\t\t\tDDS_data = convert_image_to_DXT5( img, width, height, channels, &DDS_size );\n\t\t\t}\n\t\t\tif( DDS_data )\n\t\t\t{\n\t\t\t\tsoilGlCompressedTexImage2D(\n\t\t\t\t\topengl_texture_target, 0,\n\t\t\t\t\tinternal_texture_format, width, height, 0,\n\t\t\t\t\tDDS_size, DDS_data );\n\t\t\t\tcheck_for_GL_errors( \"glCompressedTexImage2D\" );\n\t\t\t\tSOIL_free_image_data( DDS_data );\n\t\t\t\t/*\tprintf( \"Internal DXT compressor\\n\" );\t*/\n\t\t\t} else\n\t\t\t{\n\t\t\t\t/*\tmy compression failed, try the OpenGL driver's version\t*/\n\t\t\t\tglTexImage2D(\n\t\t\t\t\topengl_texture_target, 0,\n\t\t\t\t\tinternal_texture_format, width, height, 0,\n\t\t\t\t\toriginal_texture_format, GL_UNSIGNED_BYTE, img );\n\t\t\t\tcheck_for_GL_errors( \"glTexImage2D\" );\n\t\t\t\t/*\tprintf( \"OpenGL DXT compressor\\n\" );\t*/\n\t\t\t}\n\t\t} else\n\t\t{\n\t\t\t/*\tuser want OpenGL to do all the work!\t*/\n\t\t\tglTexImage2D(\n\t\t\t\topengl_texture_target, 0,\n\t\t\t\tinternal_texture_format, width, height, 0,\n\t\t\t\toriginal_texture_format, GL_UNSIGNED_BYTE, img );\n\t\t\tcheck_for_GL_errors( \"glTexImage2D\" );\n\t\t\t/*printf( \"OpenGL DXT compressor\\n\" );\t*/\n\t\t}\n\t\t/*\tare any MIPmaps desired?\t*/\n\t\tif( flags & SOIL_FLAG_MIPMAPS )\n\t\t{\n\t\t\tint MIPlevel = 1;\n\t\t\tint MIPwidth = (width+1) / 2;\n\t\t\tint MIPheight = (height+1) / 2;\n\t\t\tunsigned char *resampled = (unsigned char*)malloc( channels*MIPwidth*MIPheight );\n\t\t\twhile( ((1< 0; --i )\n\t\t{\n\t\t\tunsigned char temp = pixel_data[index1];\n\t\t\tpixel_data[index1] = pixel_data[index2];\n\t\t\tpixel_data[index2] = temp;\n\t\t\t++index1;\n\t\t\t++index2;\n\t\t}\n\t}\n\n /*\tsave the image\t*/\n save_result = SOIL_save_image( filename, image_type, width, height, 3, pixel_data);\n\n /* And free the memory\t*/\n SOIL_free_image_data( pixel_data );\n\treturn save_result;\n}\n\nunsigned char*\n\tSOIL_load_image\n\t(\n\t\tconst char *filename,\n\t\tint *width, int *height, int *channels,\n\t\tint force_channels\n\t)\n{\n\tunsigned char *result = stbi_load( filename,\n\t\t\twidth, height, channels, force_channels );\n\tif( result == NULL )\n\t{\n\t\tresult_string_pointer = stbi_failure_reason();\n\t} else\n\t{\n\t\tresult_string_pointer = \"Image loaded\";\n\t}\n\treturn result;\n}\n\nunsigned char*\n\tSOIL_load_image_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tint *width, int *height, int *channels,\n\t\tint force_channels\n\t)\n{\n\tunsigned char *result = stbi_load_from_memory(\n\t\t\t\tbuffer, buffer_length,\n\t\t\t\twidth, height, channels,\n\t\t\t\tforce_channels );\n\tif( result == NULL )\n\t{\n\t\tresult_string_pointer = stbi_failure_reason();\n\t} else\n\t{\n\t\tresult_string_pointer = \"Image loaded from memory\";\n\t}\n\treturn result;\n}\n\nint\n\tSOIL_save_image\n\t(\n\t\tconst char *filename,\n\t\tint image_type,\n\t\tint width, int height, int channels,\n\t\tconst unsigned char *const data\n\t)\n{\n\tint save_result;\n\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 1) || (channels > 4) ||\n\t\t(data == NULL) ||\n\t\t(filename == NULL) )\n\t{\n\t\treturn 0;\n\t}\n\tif( image_type == SOIL_SAVE_TYPE_BMP )\n\t{\n\t\tsave_result = stbi_write_bmp( filename,\n\t\t\t\twidth, height, channels, (void*)data );\n\t} else\n\tif( image_type == SOIL_SAVE_TYPE_TGA )\n\t{\n\t\tsave_result = stbi_write_tga( filename,\n\t\t\t\twidth, height, channels, (void*)data );\n\t} else\n\tif( image_type == SOIL_SAVE_TYPE_DDS )\n\t{\n\t\tsave_result = save_image_as_DDS( filename,\n\t\t\t\twidth, height, channels, (const unsigned char *const)data );\n\t} else\n\t{\n\t\tsave_result = 0;\n\t}\n\tif( save_result == 0 )\n\t{\n\t\tresult_string_pointer = \"Saving the image failed\";\n\t} else\n\t{\n\t\tresult_string_pointer = \"Image saved\";\n\t}\n\treturn save_result;\n}\n\nvoid\n\tSOIL_free_image_data\n\t(\n\t\tunsigned char *img_data\n\t)\n{\n\tfree( (void*)img_data );\n}\n\nconst char*\n\tSOIL_last_result\n\t(\n\t\tvoid\n\t)\n{\n\treturn result_string_pointer;\n}\n\nunsigned int SOIL_direct_load_DDS_from_memory(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tunsigned int reuse_texture_ID,\n\t\tint flags,\n\t\tint loading_as_cubemap )\n{\n\t/*\tvariables\t*/\n\tDDS_header header;\n\tunsigned int buffer_index = 0;\n\tunsigned int tex_ID = 0;\n\t/*\tfile reading variables\t*/\n\tunsigned int S3TC_type = 0;\n\tunsigned char *DDS_data;\n\tunsigned int DDS_main_size;\n\tunsigned int DDS_full_size;\n\tunsigned int width, height;\n\tint mipmaps, cubemap, uncompressed, block_size = 16;\n\tunsigned int flag;\n\tunsigned int cf_target, ogl_target_start, ogl_target_end;\n\tunsigned int opengl_texture_type;\n\tint i;\n\t/*\t1st off, does the filename even exist?\t*/\n\tif( NULL == buffer )\n\t{\n\t\t/*\twe can't do it!\t*/\n\t\tresult_string_pointer = \"NULL buffer\";\n\t\treturn 0;\n\t}\n\tif( buffer_length < sizeof( DDS_header ) )\n\t{\n\t\t/*\twe can't do it!\t*/\n\t\tresult_string_pointer = \"DDS file was too small to contain the DDS header\";\n\t\treturn 0;\n\t}\n\t/*\ttry reading in the header\t*/\n\tmemcpy ( (void*)(&header), (const void *)buffer, sizeof( DDS_header ) );\n\tbuffer_index = sizeof( DDS_header );\n\t/*\tguilty until proven innocent\t*/\n\tresult_string_pointer = \"Failed to read a known DDS header\";\n\t/*\tvalidate the header (warning, \"goto\"'s ahead, shield your eyes!!)\t*/\n\tflag = ('D'<<0)|('D'<<8)|('S'<<16)|(' '<<24);\n\tif( header.dwMagic != flag ) {goto quick_exit;}\n\tif( header.dwSize != 124 ) {goto quick_exit;}\n\t/*\tI need all of these\t*/\n\tflag = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;\n\tif( (header.dwFlags & flag) != flag ) {goto quick_exit;}\n\t/*\tAccording to the MSDN spec, the dwFlags should contain\n\t\tDDSD_LINEARSIZE if it's compressed, or DDSD_PITCH if\n\t\tuncompressed. Some DDS writers do not conform to the\n\t\tspec, so I need to make my reader more tolerant\t*/\n\t/*\tI need one of these\t*/\n\tflag = DDPF_FOURCC | DDPF_RGB;\n\tif( (header.sPixelFormat.dwFlags & flag) == 0 ) {goto quick_exit;}\n\tif( header.sPixelFormat.dwSize != 32 ) {goto quick_exit;}\n\tif( (header.sCaps.dwCaps1 & DDSCAPS_TEXTURE) == 0 ) {goto quick_exit;}\n\t/*\tmake sure it is a type we can upload\t*/\n\tif( (header.sPixelFormat.dwFlags & DDPF_FOURCC) &&\n\t\t!(\n\t\t(header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('1'<<24))) ||\n\t\t(header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('3'<<24))) ||\n\t\t(header.sPixelFormat.dwFourCC == (('D'<<0)|('X'<<8)|('T'<<16)|('5'<<24)))\n\t\t) )\n\t{\n\t\tgoto quick_exit;\n\t}\n\t/*\tOK, validated the header, let's load the image data\t*/\n\tresult_string_pointer = \"DDS header loaded and validated\";\n\twidth = header.dwWidth;\n\theight = header.dwHeight;\n\tuncompressed = 1 - (header.sPixelFormat.dwFlags & DDPF_FOURCC) / DDPF_FOURCC;\n\tcubemap = (header.sCaps.dwCaps2 & DDSCAPS2_CUBEMAP) / DDSCAPS2_CUBEMAP;\n\tif( uncompressed )\n\t{\n\t\tS3TC_type = GL_RGB;\n\t\tblock_size = 3;\n\t\tif( header.sPixelFormat.dwFlags & DDPF_ALPHAPIXELS )\n\t\t{\n\t\t\tS3TC_type = GL_RGBA;\n\t\t\tblock_size = 4;\n\t\t}\n\t\tDDS_main_size = width * height * block_size;\n\t} else\n\t{\n\t\t/*\tcan we even handle direct uploading to OpenGL DXT compressed images?\t*/\n\t\tif( query_DXT_capability() != SOIL_CAPABILITY_PRESENT )\n\t\t{\n\t\t\t/*\twe can't do it!\t*/\n\t\t\tresult_string_pointer = \"Direct upload of S3TC images not supported by the OpenGL driver\";\n\t\t\treturn 0;\n\t\t}\n\t\t/*\twell, we know it is DXT1/3/5, because we checked above\t*/\n\t\tswitch( (header.sPixelFormat.dwFourCC >> 24) - '0' )\n\t\t{\n\t\tcase 1:\n\t\t\tS3TC_type = SOIL_RGBA_S3TC_DXT1;\n\t\t\tblock_size = 8;\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tS3TC_type = SOIL_RGBA_S3TC_DXT3;\n\t\t\tblock_size = 16;\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tS3TC_type = SOIL_RGBA_S3TC_DXT5;\n\t\t\tblock_size = 16;\n\t\t\tbreak;\n\t\t}\n\t\tDDS_main_size = ((width+3)>>2)*((height+3)>>2)*block_size;\n\t}\n\tif( cubemap )\n\t{\n\t\t/* does the user want a cubemap?\t*/\n\t\tif( !loading_as_cubemap )\n\t\t{\n\t\t\t/*\twe can't do it!\t*/\n\t\t\tresult_string_pointer = \"DDS image was a cubemap\";\n\t\t\treturn 0;\n\t\t}\n\t\t/*\tcan we even handle cubemaps with the OpenGL driver?\t*/\n\t\tif( query_cubemap_capability() != SOIL_CAPABILITY_PRESENT )\n\t\t{\n\t\t\t/*\twe can't do it!\t*/\n\t\t\tresult_string_pointer = \"Direct upload of cubemap images not supported by the OpenGL driver\";\n\t\t\treturn 0;\n\t\t}\n\t\togl_target_start = SOIL_TEXTURE_CUBE_MAP_POSITIVE_X;\n\t\togl_target_end = SOIL_TEXTURE_CUBE_MAP_NEGATIVE_Z;\n\t\topengl_texture_type = SOIL_TEXTURE_CUBE_MAP;\n\t} else\n\t{\n\t\t/* does the user want a non-cubemap?\t*/\n\t\tif( loading_as_cubemap )\n\t\t{\n\t\t\t/*\twe can't do it!\t*/\n\t\t\tresult_string_pointer = \"DDS image was not a cubemap\";\n\t\t\treturn 0;\n\t\t}\n\t\togl_target_start = GL_TEXTURE_2D;\n\t\togl_target_end = GL_TEXTURE_2D;\n\t\topengl_texture_type = GL_TEXTURE_2D;\n\t}\n\tif( (header.sCaps.dwCaps1 & DDSCAPS_MIPMAP) && (header.dwMipMapCount > 1) )\n\t{\n\t\tint shift_offset;\n\t\tmipmaps = header.dwMipMapCount - 1;\n\t\tDDS_full_size = DDS_main_size;\n\t\tif( uncompressed )\n\t\t{\n\t\t\t/*\tuncompressed DDS, simple MIPmap size calculation\t*/\n\t\t\tshift_offset = 0;\n\t\t} else\n\t\t{\n\t\t\t/*\tcompressed DDS, MIPmap size calculation is block based\t*/\n\t\t\tshift_offset = 2;\n\t\t}\n\t\tfor( i = 1; i <= mipmaps; ++ i )\n\t\t{\n\t\t\tint w, h;\n\t\t\tw = width >> (shift_offset + i);\n\t\t\th = height >> (shift_offset + i);\n\t\t\tif( w < 1 )\n\t\t\t{\n\t\t\t\tw = 1;\n\t\t\t}\n\t\t\tif( h < 1 )\n\t\t\t{\n\t\t\t\th = 1;\n\t\t\t}\n\t\t\tDDS_full_size += w*h*block_size;\n\t\t}\n\t} else\n\t{\n\t\tmipmaps = 0;\n\t\tDDS_full_size = DDS_main_size;\n\t}\n\tDDS_data = (unsigned char*)malloc( DDS_full_size );\n\t/*\tgot the image data RAM, create or use an existing OpenGL texture handle\t*/\n\ttex_ID = reuse_texture_ID;\n\tif( tex_ID == 0 )\n\t{\n\t\tglGenTextures( 1, &tex_ID );\n\t}\n\t/* bind an OpenGL texture ID\t*/\n\tglBindTexture( opengl_texture_type, tex_ID );\n\t/*\tdo this for each face of the cubemap!\t*/\n\tfor( cf_target = ogl_target_start; cf_target <= ogl_target_end; ++cf_target )\n\t{\n\t\tif( buffer_index + DDS_full_size <= buffer_length )\n\t\t{\n\t\t\tunsigned int byte_offset = DDS_main_size;\n\t\t\tmemcpy( (void*)DDS_data, (const void*)(&buffer[buffer_index]), DDS_full_size );\n\t\t\tbuffer_index += DDS_full_size;\n\t\t\t/*\tupload the main chunk\t*/\n\t\t\tif( uncompressed )\n\t\t\t{\n\t\t\t\t/*\tand remember, DXT uncompressed uses BGR(A),\n\t\t\t\t\tso swap to RGB(A) for ALL MIPmap levels\t*/\n\t\t\t\tfor( i = 0; i < DDS_full_size; i += block_size )\n\t\t\t\t{\n\t\t\t\t\tunsigned char temp = DDS_data[i];\n\t\t\t\t\tDDS_data[i] = DDS_data[i+2];\n\t\t\t\t\tDDS_data[i+2] = temp;\n\t\t\t\t}\n\t\t\t\tglTexImage2D(\n\t\t\t\t\tcf_target, 0,\n\t\t\t\t\tS3TC_type, width, height, 0,\n\t\t\t\t\tS3TC_type, GL_UNSIGNED_BYTE, DDS_data );\n\t\t\t} else\n\t\t\t{\n\t\t\t\tsoilGlCompressedTexImage2D(\n\t\t\t\t\tcf_target, 0,\n\t\t\t\t\tS3TC_type, width, height, 0,\n\t\t\t\t\tDDS_main_size, DDS_data );\n\t\t\t}\n\t\t\t/*\tupload the mipmaps, if we have them\t*/\n\t\t\tfor( i = 1; i <= mipmaps; ++i )\n\t\t\t{\n\t\t\t\tint w, h, mip_size;\n\t\t\t\tw = width >> i;\n\t\t\t\th = height >> i;\n\t\t\t\tif( w < 1 )\n\t\t\t\t{\n\t\t\t\t\tw = 1;\n\t\t\t\t}\n\t\t\t\tif( h < 1 )\n\t\t\t\t{\n\t\t\t\t\th = 1;\n\t\t\t\t}\n\t\t\t\t/*\tupload this mipmap\t*/\n\t\t\t\tif( uncompressed )\n\t\t\t\t{\n\t\t\t\t\tmip_size = w*h*block_size;\n\t\t\t\t\tglTexImage2D(\n\t\t\t\t\t\tcf_target, i,\n\t\t\t\t\t\tS3TC_type, w, h, 0,\n\t\t\t\t\t\tS3TC_type, GL_UNSIGNED_BYTE, &DDS_data[byte_offset] );\n\t\t\t\t} else\n\t\t\t\t{\n\t\t\t\t\tmip_size = ((w+3)/4)*((h+3)/4)*block_size;\n\t\t\t\t\tsoilGlCompressedTexImage2D(\n\t\t\t\t\t\tcf_target, i,\n\t\t\t\t\t\tS3TC_type, w, h, 0,\n\t\t\t\t\t\tmip_size, &DDS_data[byte_offset] );\n\t\t\t\t}\n\t\t\t\t/*\tand move to the next mipmap\t*/\n\t\t\t\tbyte_offset += mip_size;\n\t\t\t}\n\t\t\t/*\tit worked!\t*/\n\t\t\tresult_string_pointer = \"DDS file loaded\";\n\t\t} else\n\t\t{\n\t\t\tglDeleteTextures( 1, & tex_ID );\n\t\t\ttex_ID = 0;\n\t\t\tcf_target = ogl_target_end + 1;\n\t\t\tresult_string_pointer = \"DDS file was too small for expected image data\";\n\t\t}\n\t}/* end reading each face */\n\tSOIL_free_image_data( DDS_data );\n\tif( tex_ID )\n\t{\n\t\t/*\tdid I have MIPmaps?\t*/\n\t\tif( mipmaps > 0 )\n\t\t{\n\t\t\t/*\tinstruct OpenGL to use the MIPmaps\t*/\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR );\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );\n\t\t} else\n\t\t{\n\t\t\t/*\tinstruct OpenGL _NOT_ to use the MIPmaps\t*/\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR );\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR );\n\t\t}\n\t\t/*\tdoes the user want clamping, or wrapping?\t*/\n\t\tif( flags & SOIL_FLAG_TEXTURE_REPEATS )\n\t\t{\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_S, GL_REPEAT );\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_T, GL_REPEAT );\n\t\t\tglTexParameteri( opengl_texture_type, SOIL_TEXTURE_WRAP_R, GL_REPEAT );\n\t\t} else\n\t\t{\n\t\t\t/*\tunsigned int clamp_mode = SOIL_CLAMP_TO_EDGE;\t*/\n\t\t\tunsigned int clamp_mode = GL_CLAMP;\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_S, clamp_mode );\n\t\t\tglTexParameteri( opengl_texture_type, GL_TEXTURE_WRAP_T, clamp_mode );\n\t\t\tglTexParameteri( opengl_texture_type, SOIL_TEXTURE_WRAP_R, clamp_mode );\n\t\t}\n\t}\n\nquick_exit:\n\t/*\treport success or failure\t*/\n\treturn tex_ID;\n}\n\nunsigned int SOIL_direct_load_DDS(\n\t\tconst char *filename,\n\t\tunsigned int reuse_texture_ID,\n\t\tint flags,\n\t\tint loading_as_cubemap )\n{\n\tFILE *f;\n\tunsigned char *buffer;\n\tsize_t buffer_length, bytes_read;\n\tunsigned int tex_ID = 0;\n\t/*\terror checks\t*/\n\tif( NULL == filename )\n\t{\n\t\tresult_string_pointer = \"NULL filename\";\n\t\treturn 0;\n\t}\n\tf = fopen( filename, \"rb\" );\n\tif( NULL == f )\n\t{\n\t\t/*\tthe file doesn't seem to exist (or be open-able)\t*/\n\t\tresult_string_pointer = \"Can not find DDS file\";\n\t\treturn 0;\n\t}\n\tfseek( f, 0, SEEK_END );\n\tbuffer_length = ftell( f );\n\tfseek( f, 0, SEEK_SET );\n\tbuffer = (unsigned char *) malloc( buffer_length );\n\tif( NULL == buffer )\n\t{\n\t\tresult_string_pointer = \"malloc failed\";\n\t\tfclose( f );\n\t\treturn 0;\n\t}\n\tbytes_read = fread( (void*)buffer, 1, buffer_length, f );\n\tfclose( f );\n\tif( bytes_read < buffer_length )\n\t{\n\t\t/*\thuh?\t*/\n\t\tbuffer_length = bytes_read;\n\t}\n\t/*\tnow try to do the loading\t*/\n\ttex_ID = SOIL_direct_load_DDS_from_memory(\n\t\t(const unsigned char *const)buffer, buffer_length,\n\t\treuse_texture_ID, flags, loading_as_cubemap );\n\tSOIL_free_image_data( buffer );\n\treturn tex_ID;\n}\n\nint query_NPOT_capability( void )\n{\n\t/*\tcheck for the capability\t*/\n\tif( has_NPOT_capability == SOIL_CAPABILITY_UNKNOWN )\n\t{\n\t\t/*\twe haven't yet checked for the capability, do so\t*/\n\t\tif(\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_ARB_texture_non_power_of_two\" ) )\n\t\t\t)\n\t\t{\n\t\t\t/*\tnot there, flag the failure\t*/\n\t\t\thas_NPOT_capability = SOIL_CAPABILITY_NONE;\n\t\t} else\n\t\t{\n\t\t\t/*\tit's there!\t*/\n\t\t\thas_NPOT_capability = SOIL_CAPABILITY_PRESENT;\n\t\t}\n\t}\n\t/*\tlet the user know if we can do non-power-of-two textures or not\t*/\n\treturn has_NPOT_capability;\n}\n\nint query_tex_rectangle_capability( void )\n{\n\t/*\tcheck for the capability\t*/\n\tif( has_tex_rectangle_capability == SOIL_CAPABILITY_UNKNOWN )\n\t{\n\t\t/*\twe haven't yet checked for the capability, do so\t*/\n\t\tif(\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_ARB_texture_rectangle\" ) )\n\t\t&&\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_EXT_texture_rectangle\" ) )\n\t\t&&\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_NV_texture_rectangle\" ) )\n\t\t\t)\n\t\t{\n\t\t\t/*\tnot there, flag the failure\t*/\n\t\t\thas_tex_rectangle_capability = SOIL_CAPABILITY_NONE;\n\t\t} else\n\t\t{\n\t\t\t/*\tit's there!\t*/\n\t\t\thas_tex_rectangle_capability = SOIL_CAPABILITY_PRESENT;\n\t\t}\n\t}\n\t/*\tlet the user know if we can do texture rectangles or not\t*/\n\treturn has_tex_rectangle_capability;\n}\n\nint query_cubemap_capability( void )\n{\n\t/*\tcheck for the capability\t*/\n\tif( has_cubemap_capability == SOIL_CAPABILITY_UNKNOWN )\n\t{\n\t\t/*\twe haven't yet checked for the capability, do so\t*/\n\t\tif(\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_ARB_texture_cube_map\" ) )\n\t\t&&\n\t\t\t(NULL == strstr( (char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_EXT_texture_cube_map\" ) )\n\t\t\t)\n\t\t{\n\t\t\t/*\tnot there, flag the failure\t*/\n\t\t\thas_cubemap_capability = SOIL_CAPABILITY_NONE;\n\t\t} else\n\t\t{\n\t\t\t/*\tit's there!\t*/\n\t\t\thas_cubemap_capability = SOIL_CAPABILITY_PRESENT;\n\t\t}\n\t}\n\t/*\tlet the user know if we can do cubemaps or not\t*/\n\treturn has_cubemap_capability;\n}\n\nint query_DXT_capability( void )\n{\n\t/*\tcheck for the capability\t*/\n\tif( has_DXT_capability == SOIL_CAPABILITY_UNKNOWN )\n\t{\n\t\t/*\twe haven't yet checked for the capability, do so\t*/\n\t\tif( NULL == strstr(\n\t\t\t\t(char const*)glGetString( GL_EXTENSIONS ),\n\t\t\t\t\"GL_EXT_texture_compression_s3tc\" ) )\n\t\t{\n\t\t\t/*\tnot there, flag the failure\t*/\n\t\t\thas_DXT_capability = SOIL_CAPABILITY_NONE;\n\t\t} else\n\t\t{\n\t\t\t/*\tand find the address of the extension function\t*/\n\t\t\tP_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC ext_addr = NULL;\n\t\t\t#ifdef WIN32\n\t\t\t\text_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC)\n\t\t\t\t\t\twglGetProcAddress\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\"glCompressedTexImage2DARB\"\n\t\t\t\t\t\t);\n\t\t\t#elif defined(__APPLE__) || defined(__APPLE_CC__)\n\t\t\t\t/*\tI can't test this Apple stuff!\t*/\n\t\t\t\tCFBundleRef bundle;\n\t\t\t\tCFURLRef bundleURL =\n\t\t\t\t\tCFURLCreateWithFileSystemPath(\n\t\t\t\t\t\tkCFAllocatorDefault,\n\t\t\t\t\t\tCFSTR(\"/System/Library/Frameworks/OpenGL.framework\"),\n\t\t\t\t\t\tkCFURLPOSIXPathStyle,\n\t\t\t\t\t\ttrue );\n\t\t\t\tCFStringRef extensionName =\n\t\t\t\t\tCFStringCreateWithCString(\n\t\t\t\t\t\tkCFAllocatorDefault,\n\t\t\t\t\t\t\"glCompressedTexImage2DARB\",\n\t\t\t\t\t\tkCFStringEncodingASCII );\n\t\t\t\tbundle = CFBundleCreate( kCFAllocatorDefault, bundleURL );\n\t\t\t\tassert( bundle != NULL );\n\t\t\t\text_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC)\n\t\t\t\t\t\tCFBundleGetFunctionPointerForName\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tbundle, extensionName\n\t\t\t\t\t\t);\n\t\t\t\tCFRelease( bundleURL );\n\t\t\t\tCFRelease( extensionName );\n\t\t\t\tCFRelease( bundle );\n\t\t\t#else\n\t\t\t\text_addr = (P_SOIL_GLCOMPRESSEDTEXIMAGE2DPROC)\n\t\t\t\t\t\tglXGetProcAddressARB\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(const GLubyte *)\"glCompressedTexImage2DARB\"\n\t\t\t\t\t\t);\n\t\t\t#endif\n\t\t\t/*\tFlag it so no checks needed later\t*/\n\t\t\tif( NULL == ext_addr )\n\t\t\t{\n\t\t\t\t/*\thmm, not good!! This should not happen, but does on my\n\t\t\t\t\tlaptop's VIA chipset. The GL_EXT_texture_compression_s3tc\n\t\t\t\t\tspec requires that ARB_texture_compression be present too.\n\t\t\t\t\tthis means I can upload and have the OpenGL drive do the\n\t\t\t\t\tconversion, but I can't use my own routines or load DDS files\n\t\t\t\t\tfrom disk and upload them directly [8^(\t*/\n\t\t\t\thas_DXT_capability = SOIL_CAPABILITY_NONE;\n\t\t\t} else\n\t\t\t{\n\t\t\t\t/*\tall's well!\t*/\n\t\t\t\tsoilGlCompressedTexImage2D = ext_addr;\n\t\t\t\thas_DXT_capability = SOIL_CAPABILITY_PRESENT;\n\t\t\t}\n\t\t}\n\t}\n\t/*\tlet the user know if we can do DXT or not\t*/\n\treturn has_DXT_capability;\n}\n"}, {"path": "includes/SOIL.h", "language": "code", "loc": 397, "comment_density": 0.544, "code": "/**\n\t@mainpage SOIL\n\n\tJonathan Dummer\n\t2007-07-26-10.36\n\n\tSimple OpenGL Image Library\n\n\tA tiny c library for uploading images as\n\ttextures into OpenGL. Also saving and\n\tloading of images is supported.\n\n\tI'm using Sean's Tool Box image loader as a base:\n\thttp://www.nothings.org/\n\n\tI'm upgrading it to load TGA and DDS files, and a direct\n\tpath for loading DDS files straight into OpenGL textures,\n\twhen applicable.\n\n\tImage Formats:\n\t- BMP\t\tload & save\n\t- TGA\t\tload & save\n\t- DDS\t\tload & save\n\t- PNG\t\tload\n\t- JPG\t\tload\n\n\tOpenGL Texture Features:\n\t- resample to power-of-two sizes\n\t- MIPmap generation\n\t- compressed texture S3TC formats (if supported)\n\t- can pre-multiply alpha for you, for better compositing\n\t- can flip image about the y-axis (except pre-compressed DDS files)\n\n\tThanks to:\n\t* Sean Barret - for the awesome stb_image\n\t* Dan Venkitachalam - for finding some non-compliant DDS files, and patching some explicit casts\n\t* everybody at gamedev.net\n**/\n\n#ifndef HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY\n#define HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/**\n\tThe format of images that may be loaded (force_channels).\n\tSOIL_LOAD_AUTO leaves the image in whatever format it was found.\n\tSOIL_LOAD_L forces the image to load as Luminous (greyscale)\n\tSOIL_LOAD_LA forces the image to load as Luminous with Alpha\n\tSOIL_LOAD_RGB forces the image to load as Red Green Blue\n\tSOIL_LOAD_RGBA forces the image to load as Red Green Blue Alpha\n**/\nenum\n{\n\tSOIL_LOAD_AUTO = 0,\n\tSOIL_LOAD_L = 1,\n\tSOIL_LOAD_LA = 2,\n\tSOIL_LOAD_RGB = 3,\n\tSOIL_LOAD_RGBA = 4\n};\n\n/**\n\tPassed in as reuse_texture_ID, will cause SOIL to\n\tregister a new texture ID using glGenTextures().\n\tIf the value passed into reuse_texture_ID > 0 then\n\tSOIL will just re-use that texture ID (great for\n\treloading image assets in-game!)\n**/\nenum\n{\n\tSOIL_CREATE_NEW_ID = 0\n};\n\n/**\n\tflags you can pass into SOIL_load_OGL_texture()\n\tand SOIL_create_OGL_texture().\n\t(note that if SOIL_FLAG_DDS_LOAD_DIRECT is used\n\tthe rest of the flags with the exception of\n\tSOIL_FLAG_TEXTURE_REPEATS will be ignored while\n\tloading already-compressed DDS files.)\n\n\tSOIL_FLAG_POWER_OF_TWO: force the image to be POT\n\tSOIL_FLAG_MIPMAPS: generate mipmaps for the texture\n\tSOIL_FLAG_TEXTURE_REPEATS: otherwise will clamp\n\tSOIL_FLAG_MULTIPLY_ALPHA: for using (GL_ONE,GL_ONE_MINUS_SRC_ALPHA) blending\n\tSOIL_FLAG_INVERT_Y: flip the image vertically\n\tSOIL_FLAG_COMPRESS_TO_DXT: if the card can display them, will convert RGB to DXT1, RGBA to DXT5\n\tSOIL_FLAG_DDS_LOAD_DIRECT: will load DDS files directly without _ANY_ additional processing\n\tSOIL_FLAG_NTSC_SAFE_RGB: clamps RGB components to the range [16,235]\n\tSOIL_FLAG_CoCg_Y: Google YCoCg; RGB=>CoYCg, RGBA=>CoCgAY\n\tSOIL_FLAG_TEXTURE_RECTANGLE: uses ARB_texture_rectangle ; pixel indexed & no repeat or MIPmaps or cubemaps\n**/\nenum\n{\n\tSOIL_FLAG_POWER_OF_TWO = 1,\n\tSOIL_FLAG_MIPMAPS = 2,\n\tSOIL_FLAG_TEXTURE_REPEATS = 4,\n\tSOIL_FLAG_MULTIPLY_ALPHA = 8,\n\tSOIL_FLAG_INVERT_Y = 16,\n\tSOIL_FLAG_COMPRESS_TO_DXT = 32,\n\tSOIL_FLAG_DDS_LOAD_DIRECT = 64,\n\tSOIL_FLAG_NTSC_SAFE_RGB = 128,\n\tSOIL_FLAG_CoCg_Y = 256,\n\tSOIL_FLAG_TEXTURE_RECTANGLE = 512\n};\n\n/**\n\tThe types of images that may be saved.\n\t(TGA supports uncompressed RGB / RGBA)\n\t(BMP supports uncompressed RGB)\n\t(DDS supports DXT1 and DXT5)\n**/\nenum\n{\n\tSOIL_SAVE_TYPE_TGA = 0,\n\tSOIL_SAVE_TYPE_BMP = 1,\n\tSOIL_SAVE_TYPE_DDS = 2\n};\n\n/**\n\tDefines the order of faces in a DDS cubemap.\n\tI recommend that you use the same order in single\n\timage cubemap files, so they will be interchangeable\n\twith DDS cubemaps when using SOIL.\n**/\n#define SOIL_DDS_CUBEMAP_FACE_ORDER \"EWUDNS\"\n\n/**\n\tThe types of internal fake HDR representations\n\n\tSOIL_HDR_RGBE:\t\tRGB * pow( 2.0, A - 128.0 )\n\tSOIL_HDR_RGBdivA:\tRGB / A\n\tSOIL_HDR_RGBdivA2:\tRGB / (A*A)\n**/\nenum\n{\n\tSOIL_HDR_RGBE = 0,\n\tSOIL_HDR_RGBdivA = 1,\n\tSOIL_HDR_RGBdivA2 = 2\n};\n\n/**\n\tLoads an image from disk into an OpenGL texture.\n\t\\param filename the name of the file to upload as a texture\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_texture\n\t(\n\t\tconst char *filename,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads 6 images from disk into an OpenGL cubemap texture.\n\t\\param x_pos_file the name of the file to upload as the +x cube face\n\t\\param x_neg_file the name of the file to upload as the -x cube face\n\t\\param y_pos_file the name of the file to upload as the +y cube face\n\t\\param y_neg_file the name of the file to upload as the -y cube face\n\t\\param z_pos_file the name of the file to upload as the +z cube face\n\t\\param z_neg_file the name of the file to upload as the -z cube face\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_cubemap\n\t(\n\t\tconst char *x_pos_file,\n\t\tconst char *x_neg_file,\n\t\tconst char *y_pos_file,\n\t\tconst char *y_neg_file,\n\t\tconst char *z_pos_file,\n\t\tconst char *z_neg_file,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads 1 image from disk and splits it into an OpenGL cubemap texture.\n\t\\param filename the name of the file to upload as a texture\n\t\\param face_order the order of the faces in the file, any combination of NSWEUD, for North, South, Up, etc.\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_single_cubemap\n\t(\n\t\tconst char *filename,\n\t\tconst char face_order[6],\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads an HDR image from disk into an OpenGL texture.\n\t\\param filename the name of the file to upload as a texture\n\t\\param fake_HDR_format SOIL_HDR_RGBE, SOIL_HDR_RGBdivA, SOIL_HDR_RGBdivA2\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_HDR_texture\n\t(\n\t\tconst char *filename,\n\t\tint fake_HDR_format,\n\t\tint rescale_to_max,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads an image from RAM into an OpenGL texture.\n\t\\param buffer the image data in RAM just as if it were still in a file\n\t\\param buffer_length the size of the buffer in bytes\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_texture_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads 6 images from memory into an OpenGL cubemap texture.\n\t\\param x_pos_buffer the image data in RAM to upload as the +x cube face\n\t\\param x_pos_buffer_length the size of the above buffer\n\t\\param x_neg_buffer the image data in RAM to upload as the +x cube face\n\t\\param x_neg_buffer_length the size of the above buffer\n\t\\param y_pos_buffer the image data in RAM to upload as the +x cube face\n\t\\param y_pos_buffer_length the size of the above buffer\n\t\\param y_neg_buffer the image data in RAM to upload as the +x cube face\n\t\\param y_neg_buffer_length the size of the above buffer\n\t\\param z_pos_buffer the image data in RAM to upload as the +x cube face\n\t\\param z_pos_buffer_length the size of the above buffer\n\t\\param z_neg_buffer the image data in RAM to upload as the +x cube face\n\t\\param z_neg_buffer_length the size of the above buffer\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_cubemap_from_memory\n\t(\n\t\tconst unsigned char *const x_pos_buffer,\n\t\tint x_pos_buffer_length,\n\t\tconst unsigned char *const x_neg_buffer,\n\t\tint x_neg_buffer_length,\n\t\tconst unsigned char *const y_pos_buffer,\n\t\tint y_pos_buffer_length,\n\t\tconst unsigned char *const y_neg_buffer,\n\t\tint y_neg_buffer_length,\n\t\tconst unsigned char *const z_pos_buffer,\n\t\tint z_pos_buffer_length,\n\t\tconst unsigned char *const z_neg_buffer,\n\t\tint z_neg_buffer_length,\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tLoads 1 image from RAM and splits it into an OpenGL cubemap texture.\n\t\\param buffer the image data in RAM just as if it were still in a file\n\t\\param buffer_length the size of the buffer in bytes\n\t\\param face_order the order of the faces in the file, any combination of NSWEUD, for North, South, Up, etc.\n\t\\param force_channels 0-image format, 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_load_OGL_single_cubemap_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tconst char face_order[6],\n\t\tint force_channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tCreates a 2D OpenGL texture from raw image data. Note that the raw data is\n\t_NOT_ freed after the upload (so the user can load various versions).\n\t\\param data the raw data to be uploaded as an OpenGL texture\n\t\\param width the width of the image in pixels\n\t\\param height the height of the image in pixels\n\t\\param channels the number of channels: 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_create_OGL_texture\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tCreates an OpenGL cubemap texture by splitting up 1 image into 6 parts.\n\t\\param data the raw data to be uploaded as an OpenGL texture\n\t\\param width the width of the image in pixels\n\t\\param height the height of the image in pixels\n\t\\param channels the number of channels: 1-luminous, 2-luminous/alpha, 3-RGB, 4-RGBA\n\t\\param face_order the order of the faces in the file, and combination of NSWEUD, for North, South, Up, etc.\n\t\\param reuse_texture_ID 0-generate a new texture ID, otherwise reuse the texture ID (overwriting the old texture)\n\t\\param flags can be any of SOIL_FLAG_POWER_OF_TWO | SOIL_FLAG_MIPMAPS | SOIL_FLAG_TEXTURE_REPEATS | SOIL_FLAG_MULTIPLY_ALPHA | SOIL_FLAG_INVERT_Y | SOIL_FLAG_COMPRESS_TO_DXT | SOIL_FLAG_DDS_LOAD_DIRECT\n\t\\return 0-failed, otherwise returns the OpenGL texture handle\n**/\nunsigned int\n\tSOIL_create_OGL_single_cubemap\n\t(\n\t\tconst unsigned char *const data,\n\t\tint width, int height, int channels,\n\t\tconst char face_order[6],\n\t\tunsigned int reuse_texture_ID,\n\t\tunsigned int flags\n\t);\n\n/**\n\tCaptures the OpenGL window (RGB) and saves it to disk\n\t\\return 0 if it failed, otherwise returns 1\n**/\nint\n\tSOIL_save_screenshot\n\t(\n\t\tconst char *filename,\n\t\tint image_type,\n\t\tint x, int y,\n\t\tint width, int height\n\t);\n\n/**\n\tLoads an image from disk into an array of unsigned chars.\n\tNote that *channels return the original channel count of the\n\timage. If force_channels was other than SOIL_LOAD_AUTO,\n\tthe resulting image has force_channels, but *channels may be\n\tdifferent (if the original image had a different channel\n\tcount).\n\t\\return 0 if failed, otherwise returns 1\n**/\nunsigned char*\n\tSOIL_load_image\n\t(\n\t\tconst char *filename,\n\t\tint *width, int *height, int *channels,\n\t\tint force_channels\n\t);\n\n/**\n\tLoads an image from memory into an array of unsigned chars.\n\tNote that *channels return the original channel count of the\n\timage. If force_channels was other than SOIL_LOAD_AUTO,\n\tthe resulting image has force_channels, but *channels may be\n\tdifferent (if the original image had a different channel\n\tcount).\n\t\\return 0 if failed, otherwise returns 1\n**/\nunsigned char*\n\tSOIL_load_image_from_memory\n\t(\n\t\tconst unsigned char *const buffer,\n\t\tint buffer_length,\n\t\tint *width, int *height, int *channels,\n\t\tint force_channels\n\t);\n\n/**\n\tSaves an image from an array of unsigned chars (RGBA) to disk\n\t\\return 0 if failed, otherwise returns 1\n**/\nint\n\tSOIL_save_image\n\t(\n\t\tconst char *filename,\n\t\tint image_type,\n\t\tint width, int height, int channels,\n\t\tconst unsigned char *const data\n\t);\n\n/**\n\tFrees the image data (note, this is just C's \"free()\"...this function is\n\tpresent mostly so C++ programmers don't forget to use \"free()\" and call\n\t\"delete []\" instead [8^)\n**/\nvoid\n\tSOIL_free_image_data\n\t(\n\t\tunsigned char *img_data\n\t);\n\n/**\n\tThis function resturn a pointer to a string describing the last thing\n\tthat happened inside SOIL. It can be used to determine why an image\n\tfailed to load.\n**/\nconst char*\n\tSOIL_last_result\n\t(\n\t\tvoid\n\t);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* HEADER_SIMPLE_OPENGL_IMAGE_LIBRARY\t*/\n"}, {"path": "includes/ft2build.h", "language": "code", "loc": 36, "comment_density": 0.917, "code": "/****************************************************************************\n *\n * ft2build.h\n *\n * FreeType 2 build and setup macros.\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This is the 'entry point' for FreeType header file inclusions. It is\n * the only header file which should be included directly; all other\n * FreeType header files should be accessed with macro names (after\n * including `ft2build.h`).\n *\n * A typical example is\n *\n * ```\n * #include \n * #include FT_FREETYPE_H\n * ```\n *\n */\n\n\n#ifndef FT2BUILD_H_\n#define FT2BUILD_H_\n\n#include \n\n#endif /* FT2BUILD_H_ */\n\n\n/* END */\n"}, {"path": "includes/image_DXT.c", "language": "code", "loc": 615, "comment_density": 0.185, "code": "/*\n\tJonathan Dummer\n\t2007-07-31-10.32\n\n\tsimple DXT compression / decompression code\n\n\tpublic domain\n*/\n\n#include \"image_DXT.h\"\n#include \n#include \n#include \n#include \n\n/*\tset this =1 if you want to use the covariance matrix method...\n\twhich is better than my method of using standard deviations\n\toverall, except on the infinitesimal chance that the power\n\tmethod fails for finding the largest eigenvector\t*/\n#define USE_COV_MAT\t1\n\n/********* Function Prototypes *********/\n/*\n\tTakes a 4x4 block of pixels and compresses it into 8 bytes\n\tin DXT1 format (color only, no alpha). Speed is valued\n\tover prettiness, at least for now.\n*/\nvoid compress_DDS_color_block(\n\t\t\t\tint channels,\n\t\t\t\tconst unsigned char *const uncompressed,\n\t\t\t\tunsigned char compressed[8] );\n/*\n\tTakes a 4x4 block of pixels and compresses the alpha\n\tcomponent it into 8 bytes for use in DXT5 DDS files.\n\tSpeed is valued over prettiness, at least for now.\n*/\nvoid compress_DDS_alpha_block(\n\t\t\t\tconst unsigned char *const uncompressed,\n\t\t\t\tunsigned char compressed[8] );\n\n/********* Actual Exposed Functions *********/\nint\n\tsave_image_as_DDS\n\t(\n\t\tconst char *filename,\n\t\tint width, int height, int channels,\n\t\tconst unsigned char *const data\n\t)\n{\n\t/*\tvariables\t*/\n\tFILE *fout;\n\tunsigned char *DDS_data;\n\tDDS_header header;\n\tint DDS_size;\n\t/*\terror check\t*/\n\tif( (NULL == filename) ||\n\t\t(width < 1) || (height < 1) ||\n\t\t(channels < 1) || (channels > 4) ||\n\t\t(data == NULL ) )\n\t{\n\t\treturn 0;\n\t}\n\t/*\tConvert the image\t*/\n\tif( (channels & 1) == 1 )\n\t{\n\t\t/*\tno alpha, just use DXT1\t*/\n\t\tDDS_data = convert_image_to_DXT1( data, width, height, channels, &DDS_size );\n\t} else\n\t{\n\t\t/*\thas alpha, so use DXT5\t*/\n\t\tDDS_data = convert_image_to_DXT5( data, width, height, channels, &DDS_size );\n\t}\n\t/*\tsave it\t*/\n\tmemset( &header, 0, sizeof( DDS_header ) );\n\theader.dwMagic = ('D' << 0) | ('D' << 8) | ('S' << 16) | (' ' << 24);\n\theader.dwSize = 124;\n\theader.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_LINEARSIZE;\n\theader.dwWidth = width;\n\theader.dwHeight = height;\n\theader.dwPitchOrLinearSize = DDS_size;\n\theader.sPixelFormat.dwSize = 32;\n\theader.sPixelFormat.dwFlags = DDPF_FOURCC;\n\tif( (channels & 1) == 1 )\n\t{\n\t\theader.sPixelFormat.dwFourCC = ('D' << 0) | ('X' << 8) | ('T' << 16) | ('1' << 24);\n\t} else\n\t{\n\t\theader.sPixelFormat.dwFourCC = ('D' << 0) | ('X' << 8) | ('T' << 16) | ('5' << 24);\n\t}\n\theader.sCaps.dwCaps1 = DDSCAPS_TEXTURE;\n\t/*\twrite it out\t*/\n\tfout = fopen( filename, \"wb\");\n\tfwrite( &header, sizeof( DDS_header ), 1, fout );\n\tfwrite( DDS_data, 1, DDS_size, fout );\n\tfclose( fout );\n\t/*\tdone\t*/\n\tfree( DDS_data );\n\treturn 1;\n}\n\nunsigned char* convert_image_to_DXT1(\n\t\tconst unsigned char *const uncompressed,\n\t\tint width, int height, int channels,\n\t\tint *out_size )\n{\n\tunsigned char *compressed;\n\tint i, j, x, y;\n\tunsigned char ublock[16*3];\n\tunsigned char cblock[8];\n\tint index = 0, chan_step = 1;\n\tint block_count = 0;\n\t/*\terror check\t*/\n\t*out_size = 0;\n\tif( (width < 1) || (height < 1) ||\n\t\t(NULL == uncompressed) ||\n\t\t(channels < 1) || (channels > 4) )\n\t{\n\t\treturn NULL;\n\t}\n\t/*\tfor channels == 1 or 2, I do not step forward for R,G,B values\t*/\n\tif( channels < 3 )\n\t{\n\t\tchan_step = 0;\n\t}\n\t/*\tget the RAM for the compressed image\n\t\t(8 bytes per 4x4 pixel block)\t*/\n\t*out_size = ((width+3) >> 2) * ((height+3) >> 2) * 8;\n\tcompressed = (unsigned char*)malloc( *out_size );\n\t/*\tgo through each block\t*/\n\tfor( j = 0; j < height; j += 4 )\n\t{\n\t\tfor( i = 0; i < width; i += 4 )\n\t\t{\n\t\t\t/*\tcopy this block into a new one\t*/\n\t\t\tint idx = 0;\n\t\t\tint mx = 4, my = 4;\n\t\t\tif( j+4 >= height )\n\t\t\t{\n\t\t\t\tmy = height - j;\n\t\t\t}\n\t\t\tif( i+4 >= width )\n\t\t\t{\n\t\t\t\tmx = width - i;\n\t\t\t}\n\t\t\tfor( y = 0; y < my; ++y )\n\t\t\t{\n\t\t\t\tfor( x = 0; x < mx; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels];\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step];\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step+chan_step];\n\t\t\t\t}\n\t\t\t\tfor( x = mx; x < 4; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = ublock[0];\n\t\t\t\t\tublock[idx++] = ublock[1];\n\t\t\t\t\tublock[idx++] = ublock[2];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor( y = my; y < 4; ++y )\n\t\t\t{\n\t\t\t\tfor( x = 0; x < 4; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = ublock[0];\n\t\t\t\t\tublock[idx++] = ublock[1];\n\t\t\t\t\tublock[idx++] = ublock[2];\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\tcompress the block\t*/\n\t\t\t++block_count;\n\t\t\tcompress_DDS_color_block( 3, ublock, cblock );\n\t\t\t/*\tcopy the data from the block into the main block\t*/\n\t\t\tfor( x = 0; x < 8; ++x )\n\t\t\t{\n\t\t\t\tcompressed[index++] = cblock[x];\n\t\t\t}\n\t\t}\n\t}\n\treturn compressed;\n}\n\nunsigned char* convert_image_to_DXT5(\n\t\tconst unsigned char *const uncompressed,\n\t\tint width, int height, int channels,\n\t\tint *out_size )\n{\n\tunsigned char *compressed;\n\tint i, j, x, y;\n\tunsigned char ublock[16*4];\n\tunsigned char cblock[8];\n\tint index = 0, chan_step = 1;\n\tint block_count = 0, has_alpha;\n\t/*\terror check\t*/\n\t*out_size = 0;\n\tif( (width < 1) || (height < 1) ||\n\t\t(NULL == uncompressed) ||\n\t\t(channels < 1) || ( channels > 4) )\n\t{\n\t\treturn NULL;\n\t}\n\t/*\tfor channels == 1 or 2, I do not step forward for R,G,B vales\t*/\n\tif( channels < 3 )\n\t{\n\t\tchan_step = 0;\n\t}\n\t/*\t# channels = 1 or 3 have no alpha, 2 & 4 do have alpha\t*/\n\thas_alpha = 1 - (channels & 1);\n\t/*\tget the RAM for the compressed image\n\t\t(16 bytes per 4x4 pixel block)\t*/\n\t*out_size = ((width+3) >> 2) * ((height+3) >> 2) * 16;\n\tcompressed = (unsigned char*)malloc( *out_size );\n\t/*\tgo through each block\t*/\n\tfor( j = 0; j < height; j += 4 )\n\t{\n\t\tfor( i = 0; i < width; i += 4 )\n\t\t{\n\t\t\t/*\tlocal variables, and my block counter\t*/\n\t\t\tint idx = 0;\n\t\t\tint mx = 4, my = 4;\n\t\t\tif( j+4 >= height )\n\t\t\t{\n\t\t\t\tmy = height - j;\n\t\t\t}\n\t\t\tif( i+4 >= width )\n\t\t\t{\n\t\t\t\tmx = width - i;\n\t\t\t}\n\t\t\tfor( y = 0; y < my; ++y )\n\t\t\t{\n\t\t\t\tfor( x = 0; x < mx; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels];\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step];\n\t\t\t\t\tublock[idx++] = uncompressed[(j+y)*width*channels+(i+x)*channels+chan_step+chan_step];\n\t\t\t\t\tublock[idx++] =\n\t\t\t\t\t\thas_alpha * uncompressed[(j+y)*width*channels+(i+x)*channels+channels-1]\n\t\t\t\t\t\t+ (1-has_alpha)*255;\n\t\t\t\t}\n\t\t\t\tfor( x = mx; x < 4; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = ublock[0];\n\t\t\t\t\tublock[idx++] = ublock[1];\n\t\t\t\t\tublock[idx++] = ublock[2];\n\t\t\t\t\tublock[idx++] = ublock[3];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor( y = my; y < 4; ++y )\n\t\t\t{\n\t\t\t\tfor( x = 0; x < 4; ++x )\n\t\t\t\t{\n\t\t\t\t\tublock[idx++] = ublock[0];\n\t\t\t\t\tublock[idx++] = ublock[1];\n\t\t\t\t\tublock[idx++] = ublock[2];\n\t\t\t\t\tublock[idx++] = ublock[3];\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\tnow compress the alpha block\t*/\n\t\t\tcompress_DDS_alpha_block( ublock, cblock );\n\t\t\t/*\tcopy the data from the compressed alpha block into the main buffer\t*/\n\t\t\tfor( x = 0; x < 8; ++x )\n\t\t\t{\n\t\t\t\tcompressed[index++] = cblock[x];\n\t\t\t}\n\t\t\t/*\tthen compress the color block\t*/\n\t\t\t++block_count;\n\t\t\tcompress_DDS_color_block( 4, ublock, cblock );\n\t\t\t/*\tcopy the data from the compressed color block into the main buffer\t*/\n\t\t\tfor( x = 0; x < 8; ++x )\n\t\t\t{\n\t\t\t\tcompressed[index++] = cblock[x];\n\t\t\t}\n\t\t}\n\t}\n\treturn compressed;\n}\n\n/********* Helper Functions *********/\nint convert_bit_range( int c, int from_bits, int to_bits )\n{\n\tint b = (1 << (from_bits - 1)) + c * ((1 << to_bits) - 1);\n\treturn (b + (b >> from_bits)) >> from_bits;\n}\n\nint rgb_to_565( int r, int g, int b )\n{\n\treturn\n\t\t(convert_bit_range( r, 8, 5 ) << 11) |\n\t\t(convert_bit_range( g, 8, 6 ) << 05) |\n\t\t(convert_bit_range( b, 8, 5 ) << 00);\n}\n\nvoid rgb_888_from_565( unsigned int c, int *r, int *g, int *b )\n{\n\t*r = convert_bit_range( (c >> 11) & 31, 5, 8 );\n\t*g = convert_bit_range( (c >> 05) & 63, 6, 8 );\n\t*b = convert_bit_range( (c >> 00) & 31, 5, 8 );\n}\n\nvoid compute_color_line_STDEV(\n\t\tconst unsigned char *const uncompressed,\n\t\tint channels,\n\t\tfloat point[3], float direction[3] )\n{\n\tconst float inv_16 = 1.0f / 16.0f;\n\tint i;\n\tfloat sum_r = 0.0f, sum_g = 0.0f, sum_b = 0.0f;\n\tfloat sum_rr = 0.0f, sum_gg = 0.0f, sum_bb = 0.0f;\n\tfloat sum_rg = 0.0f, sum_rb = 0.0f, sum_gb = 0.0f;\n\t/*\tcalculate all data needed for the covariance matrix\n\t\t( to compare with _rygdxt code)\t*/\n\tfor( i = 0; i < 16*channels; i += channels )\n\t{\n\t\tsum_r += uncompressed[i+0];\n\t\tsum_rr += uncompressed[i+0] * uncompressed[i+0];\n\t\tsum_g += uncompressed[i+1];\n\t\tsum_gg += uncompressed[i+1] * uncompressed[i+1];\n\t\tsum_b += uncompressed[i+2];\n\t\tsum_bb += uncompressed[i+2] * uncompressed[i+2];\n\t\tsum_rg += uncompressed[i+0] * uncompressed[i+1];\n\t\tsum_rb += uncompressed[i+0] * uncompressed[i+2];\n\t\tsum_gb += uncompressed[i+1] * uncompressed[i+2];\n\t}\n\t/*\tconvert the sums to averages\t*/\n\tsum_r *= inv_16;\n\tsum_g *= inv_16;\n\tsum_b *= inv_16;\n\t/*\tand convert the squares to the squares of the value - avg_value\t*/\n\tsum_rr -= 16.0f * sum_r * sum_r;\n\tsum_gg -= 16.0f * sum_g * sum_g;\n\tsum_bb -= 16.0f * sum_b * sum_b;\n\tsum_rg -= 16.0f * sum_r * sum_g;\n\tsum_rb -= 16.0f * sum_r * sum_b;\n\tsum_gb -= 16.0f * sum_g * sum_b;\n\t/*\tthe point on the color line is the average\t*/\n\tpoint[0] = sum_r;\n\tpoint[1] = sum_g;\n\tpoint[2] = sum_b;\n\t#if USE_COV_MAT\n\t/*\n\t\tThe following idea was from ryg.\n\t\t(https://mollyrocket.com/forums/viewtopic.php?t=392)\n\t\tThe method worked great (less RMSE than mine) most of\n\t\tthe time, but had some issues handling some simple\n\t\tboundary cases, like full green next to full red,\n\t\twhich would generate a covariance matrix like this:\n\n\t\t| 1 -1 0 |\n\t\t| -1 1 0 |\n\t\t| 0 0 0 |\n\n\t\tFor a given starting vector, the power method can\n\t\tgenerate all zeros! So no starting with {1,1,1}\n\t\tas I was doing! This kind of error is still a\n\t\tslight possibility, but will be very rare.\n\t*/\n\t/*\tuse the covariance matrix directly\n\t\t(1st iteration, don't use all 1.0 values!)\t*/\n\tsum_r = 1.0f;\n\tsum_g = 2.718281828f;\n\tsum_b = 3.141592654f;\n\tdirection[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb;\n\tdirection[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb;\n\tdirection[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb;\n\t/*\t2nd iteration, use results from the 1st guy\t*/\n\tsum_r = direction[0];\n\tsum_g = direction[1];\n\tsum_b = direction[2];\n\tdirection[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb;\n\tdirection[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb;\n\tdirection[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb;\n\t/*\t3rd iteration, use results from the 2nd guy\t*/\n\tsum_r = direction[0];\n\tsum_g = direction[1];\n\tsum_b = direction[2];\n\tdirection[0] = sum_r*sum_rr + sum_g*sum_rg + sum_b*sum_rb;\n\tdirection[1] = sum_r*sum_rg + sum_g*sum_gg + sum_b*sum_gb;\n\tdirection[2] = sum_r*sum_rb + sum_g*sum_gb + sum_b*sum_bb;\n\t#else\n\t/*\tuse my standard deviation method\n\t\t(very robust, a tiny bit slower and less accurate)\t*/\n\tdirection[0] = sqrt( sum_rr );\n\tdirection[1] = sqrt( sum_gg );\n\tdirection[2] = sqrt( sum_bb );\n\t/*\twhich has a greater component\t*/\n\tif( sum_gg > sum_rr )\n\t{\n\t\t/*\tgreen has greater component, so base the other signs off of green\t*/\n\t\tif( sum_rg < 0.0f )\n\t\t{\n\t\t\tdirection[0] = -direction[0];\n\t\t}\n\t\tif( sum_gb < 0.0f )\n\t\t{\n\t\t\tdirection[2] = -direction[2];\n\t\t}\n\t} else\n\t{\n\t\t/*\tred has a greater component\t*/\n\t\tif( sum_rg < 0.0f )\n\t\t{\n\t\t\tdirection[1] = -direction[1];\n\t\t}\n\t\tif( sum_rb < 0.0f )\n\t\t{\n\t\t\tdirection[2] = -direction[2];\n\t\t}\n\t}\n\t#endif\n}\n\nvoid LSE_master_colors_max_min(\n\t\tint *cmax, int *cmin,\n\t\tint channels,\n\t\tconst unsigned char *const uncompressed )\n{\n\tint i, j;\n\t/*\tthe master colors\t*/\n\tint c0[3], c1[3];\n\t/*\tused for fitting the line\t*/\n\tfloat sum_x[] = { 0.0f, 0.0f, 0.0f };\n\tfloat sum_x2[] = { 0.0f, 0.0f, 0.0f };\n\tfloat dot_max = 1.0f, dot_min = -1.0f;\n\tfloat vec_len2 = 0.0f;\n\tfloat dot;\n\t/*\terror check\t*/\n\tif( (channels < 3) || (channels > 4) )\n\t{\n\t\treturn;\n\t}\n\tcompute_color_line_STDEV( uncompressed, channels, sum_x, sum_x2 );\n\tvec_len2 = 1.0f / ( 0.00001f +\n\t\t\tsum_x2[0]*sum_x2[0] + sum_x2[1]*sum_x2[1] + sum_x2[2]*sum_x2[2] );\n\t/*\tfinding the max and min vector values\t*/\n\tdot_max =\n\t\t\t(\n\t\t\t\tsum_x2[0] * uncompressed[0] +\n\t\t\t\tsum_x2[1] * uncompressed[1] +\n\t\t\t\tsum_x2[2] * uncompressed[2]\n\t\t\t);\n\tdot_min = dot_max;\n\tfor( i = 1; i < 16; ++i )\n\t{\n\t\tdot =\n\t\t\t(\n\t\t\t\tsum_x2[0] * uncompressed[i*channels+0] +\n\t\t\t\tsum_x2[1] * uncompressed[i*channels+1] +\n\t\t\t\tsum_x2[2] * uncompressed[i*channels+2]\n\t\t\t);\n\t\tif( dot < dot_min )\n\t\t{\n\t\t\tdot_min = dot;\n\t\t} else if( dot > dot_max )\n\t\t{\n\t\t\tdot_max = dot;\n\t\t}\n\t}\n\t/*\tand the offset (from the average location)\t*/\n\tdot = sum_x2[0]*sum_x[0] + sum_x2[1]*sum_x[1] + sum_x2[2]*sum_x[2];\n\tdot_min -= dot;\n\tdot_max -= dot;\n\t/*\tpost multiply by the scaling factor\t*/\n\tdot_min *= vec_len2;\n\tdot_max *= vec_len2;\n\t/*\tOK, build the master colors\t*/\n\tfor( i = 0; i < 3; ++i )\n\t{\n\t\t/*\tcolor 0\t*/\n\t\tc0[i] = (int)(0.5f + sum_x[i] + dot_max * sum_x2[i]);\n\t\tif( c0[i] < 0 )\n\t\t{\n\t\t\tc0[i] = 0;\n\t\t} else if( c0[i] > 255 )\n\t\t{\n\t\t\tc0[i] = 255;\n\t\t}\n\t\t/*\tcolor 1\t*/\n\t\tc1[i] = (int)(0.5f + sum_x[i] + dot_min * sum_x2[i]);\n\t\tif( c1[i] < 0 )\n\t\t{\n\t\t\tc1[i] = 0;\n\t\t} else if( c1[i] > 255 )\n\t\t{\n\t\t\tc1[i] = 255;\n\t\t}\n\t}\n\t/*\tdown_sample (with rounding?)\t*/\n\ti = rgb_to_565( c0[0], c0[1], c0[2] );\n\tj = rgb_to_565( c1[0], c1[1], c1[2] );\n\tif( i > j )\n\t{\n\t\t*cmax = i;\n\t\t*cmin = j;\n\t} else\n\t{\n\t\t*cmax = j;\n\t\t*cmin = i;\n\t}\n}\n\nvoid\n\tcompress_DDS_color_block\n\t(\n\t\tint channels,\n\t\tconst unsigned char *const uncompressed,\n\t\tunsigned char compressed[8]\n\t)\n{\n\t/*\tvariables\t*/\n\tint i;\n\tint next_bit;\n\tint enc_c0, enc_c1;\n\tint c0[4], c1[4];\n\tfloat color_line[] = { 0.0f, 0.0f, 0.0f, 0.0f };\n\tfloat vec_len2 = 0.0f, dot_offset = 0.0f;\n\t/*\tstupid order\t*/\n\tint swizzle4[] = { 0, 2, 3, 1 };\n\t/*\tget the master colors\t*/\n\tLSE_master_colors_max_min( &enc_c0, &enc_c1, channels, uncompressed );\n\t/*\tstore the 565 color 0 and color 1\t*/\n\tcompressed[0] = (enc_c0 >> 0) & 255;\n\tcompressed[1] = (enc_c0 >> 8) & 255;\n\tcompressed[2] = (enc_c1 >> 0) & 255;\n\tcompressed[3] = (enc_c1 >> 8) & 255;\n\t/*\tzero out the compressed data\t*/\n\tcompressed[4] = 0;\n\tcompressed[5] = 0;\n\tcompressed[6] = 0;\n\tcompressed[7] = 0;\n\t/*\treconstitute the master color vectors\t*/\n\trgb_888_from_565( enc_c0, &c0[0], &c0[1], &c0[2] );\n\trgb_888_from_565( enc_c1, &c1[0], &c1[1], &c1[2] );\n\t/*\tthe new vector\t*/\n\tvec_len2 = 0.0f;\n\tfor( i = 0; i < 3; ++i )\n\t{\n\t\tcolor_line[i] = (float)(c1[i] - c0[i]);\n\t\tvec_len2 += color_line[i] * color_line[i];\n\t}\n\tif( vec_len2 > 0.0f )\n\t{\n\t\tvec_len2 = 1.0f / vec_len2;\n\t}\n\t/*\tpre-proform the scaling\t*/\n\tcolor_line[0] *= vec_len2;\n\tcolor_line[1] *= vec_len2;\n\tcolor_line[2] *= vec_len2;\n\t/*\tcompute the offset (constant) portion of the dot product\t*/\n\tdot_offset = color_line[0]*c0[0] + color_line[1]*c0[1] + color_line[2]*c0[2];\n\t/*\tstore the rest of the bits\t*/\n\tnext_bit = 8*4;\n\tfor( i = 0; i < 16; ++i )\n\t{\n\t\t/*\tfind the dot product of this color, to place it on the line\n\t\t\t(should be [-1,1])\t*/\n\t\tint next_value = 0;\n\t\tfloat dot_product =\n\t\t\tcolor_line[0] * uncompressed[i*channels+0] +\n\t\t\tcolor_line[1] * uncompressed[i*channels+1] +\n\t\t\tcolor_line[2] * uncompressed[i*channels+2] -\n\t\t\tdot_offset;\n\t\t/*\tmap to [0,3]\t*/\n\t\tnext_value = (int)( dot_product * 3.0f + 0.5f );\n\t\tif( next_value > 3 )\n\t\t{\n\t\t\tnext_value = 3;\n\t\t} else if( next_value < 0 )\n\t\t{\n\t\t\tnext_value = 0;\n\t\t}\n\t\t/*\tOK, store this value\t*/\n\t\tcompressed[next_bit >> 3] |= swizzle4[ next_value ] << (next_bit & 7);\n\t\tnext_bit += 2;\n\t}\n\t/*\tdone compressing to DXT1\t*/\n}\n\nvoid\n\tcompress_DDS_alpha_block\n\t(\n\t\tconst unsigned char *const uncompressed,\n\t\tunsigned char compressed[8]\n\t)\n{\n\t/*\tvariables\t*/\n\tint i;\n\tint next_bit;\n\tint a0, a1;\n\tfloat scale_me;\n\t/*\tstupid order\t*/\n\tint swizzle8[] = { 1, 7, 6, 5, 4, 3, 2, 0 };\n\t/*\tget the alpha limits (a0 > a1)\t*/\n\ta0 = a1 = uncompressed[3];\n\tfor( i = 4+3; i < 16*4; i += 4 )\n\t{\n\t\tif( uncompressed[i] > a0 )\n\t\t{\n\t\t\ta0 = uncompressed[i];\n\t\t} else if( uncompressed[i] < a1 )\n\t\t{\n\t\t\ta1 = uncompressed[i];\n\t\t}\n\t}\n\t/*\tstore those limits, and zero the rest of the compressed dataset\t*/\n\tcompressed[0] = a0;\n\tcompressed[1] = a1;\n\t/*\tzero out the compressed data\t*/\n\tcompressed[2] = 0;\n\tcompressed[3] = 0;\n\tcompressed[4] = 0;\n\tcompressed[5] = 0;\n\tcompressed[6] = 0;\n\tcompressed[7] = 0;\n\t/*\tstore the all of the alpha values\t*/\n\tnext_bit = 8*2;\n\tscale_me = 7.9999f / (a0 - a1);\n\tfor( i = 3; i < 16*4; i += 4 )\n\t{\n\t\t/*\tconvert this alpha value to a 3 bit number\t*/\n\t\tint svalue;\n\t\tint value = (int)((uncompressed[i] - a1) * scale_me);\n\t\tsvalue = swizzle8[ value&7 ];\n\t\t/*\tOK, store this value, start with the 1st byte\t*/\n\t\tcompressed[next_bit >> 3] |= svalue << (next_bit & 7);\n\t\tif( (next_bit & 7) > 5 )\n\t\t{\n\t\t\t/*\tspans 2 bytes, fill in the start of the 2nd byte\t*/\n\t\t\tcompressed[1 + (next_bit >> 3)] |= svalue >> (8 - (next_bit & 7) );\n\t\t}\n\t\tnext_bit += 3;\n\t}\n\t/*\tdone compressing to DXT1\t*/\n}\n"}, {"path": "includes/image_DXT.h", "language": "code", "loc": 108, "comment_density": 0.269, "code": "/*\n\tJonathan Dummer\n\t2007-07-31-10.32\n\n\tsimple DXT compression / decompression code\n\n\tpublic domain\n*/\n\n#ifndef HEADER_IMAGE_DXT\n#define HEADER_IMAGE_DXT\n\n/**\n\tConverts an image from an array of unsigned chars (RGB or RGBA) to\n\tDXT1 or DXT5, then saves the converted image to disk.\n\t\\return 0 if failed, otherwise returns 1\n**/\nint\nsave_image_as_DDS\n(\n const char *filename,\n int width, int height, int channels,\n const unsigned char *const data\n);\n\n/**\n\ttake an image and convert it to DXT1 (no alpha)\n**/\nunsigned char*\nconvert_image_to_DXT1\n(\n const unsigned char *const uncompressed,\n int width, int height, int channels,\n int *out_size\n);\n\n/**\n\ttake an image and convert it to DXT5 (with alpha)\n**/\nunsigned char*\nconvert_image_to_DXT5\n(\n const unsigned char *const uncompressed,\n int width, int height, int channels,\n int *out_size\n);\n\n/**\tA bunch of DirectDraw Surface structures and flags **/\ntypedef struct\n{\n unsigned int dwMagic;\n unsigned int dwSize;\n unsigned int dwFlags;\n unsigned int dwHeight;\n unsigned int dwWidth;\n unsigned int dwPitchOrLinearSize;\n unsigned int dwDepth;\n unsigned int dwMipMapCount;\n unsigned int dwReserved1[ 11 ];\n\n /* DDPIXELFORMAT\t*/\n struct\n {\n unsigned int dwSize;\n unsigned int dwFlags;\n unsigned int dwFourCC;\n unsigned int dwRGBBitCount;\n unsigned int dwRBitMask;\n unsigned int dwGBitMask;\n unsigned int dwBBitMask;\n unsigned int dwAlphaBitMask;\n }\n sPixelFormat;\n\n /* DDCAPS2\t*/\n struct\n {\n unsigned int dwCaps1;\n unsigned int dwCaps2;\n unsigned int dwDDSX;\n unsigned int dwReserved;\n }\n sCaps;\n unsigned int dwReserved2;\n}\nDDS_header ;\n\n/*\tthe following constants were copied directly off the MSDN website\t*/\n\n/*\tThe dwFlags member of the original DDSURFACEDESC2 structure\n\tcan be set to one or more of the following values.\t*/\n#define DDSD_CAPS\t0x00000001\n#define DDSD_HEIGHT\t0x00000002\n#define DDSD_WIDTH\t0x00000004\n#define DDSD_PITCH\t0x00000008\n#define DDSD_PIXELFORMAT\t0x00001000\n#define DDSD_MIPMAPCOUNT\t0x00020000\n#define DDSD_LINEARSIZE\t0x00080000\n#define DDSD_DEPTH\t0x00800000\n\n/*\tDirectDraw Pixel Format\t*/\n#define DDPF_ALPHAPIXELS\t0x00000001\n#define DDPF_FOURCC\t0x00000004\n#define DDPF_RGB\t0x00000040\n\n/*\tThe dwCaps1 member of the DDSCAPS2 structure can be\n\tset to one or more of the following values.\t*/\n#define DDSCAPS_COMPLEX\t0x00000008\n#define DDSCAPS_TEXTURE\t0x00001000\n#define DDSCAPS_MIPMAP\t0x00400000\n\n/*\tThe dwCaps2 member of the DDSCAPS2 structure can be\n\tset to one or more of the following values.\t\t*/\n#define DDSCAPS2_CUBEMAP\t0x00000200\n#define DDSCAPS2_CUBEMAP_POSITIVEX\t0x00000400\n#define DDSCAPS2_CUBEMAP_NEGATIVEX\t0x00000800\n#define DDSCAPS2_CUBEMAP_POSITIVEY\t0x00001000\n#define DDSCAPS2_CUBEMAP_NEGATIVEY\t0x00002000\n#define DDSCAPS2_CUBEMAP_POSITIVEZ\t0x00004000\n#define DDSCAPS2_CUBEMAP_NEGATIVEZ\t0x00008000\n#define DDSCAPS2_VOLUME\t0x00200000\n\n#endif /* HEADER_IMAGE_DXT\t*/\n"}, {"path": "includes/image_helper.c", "language": "code", "loc": 421, "comment_density": 0.195, "code": "/*\n Jonathan Dummer\n\n image helper functions\n\n MIT license\n*/\n\n#include \"image_helper.h\"\n#include \n#include \n\n/*\tUpscaling the image uses simple bilinear interpolation\t*/\nint\n\tup_scale_image\n\t(\n\t\tconst unsigned char* const orig,\n\t\tint width, int height, int channels,\n\t\tunsigned char* resampled,\n\t\tint resampled_width, int resampled_height\n\t)\n{\n\tfloat dx, dy;\n\tint x, y, c;\n\n /* error(s) check\t*/\n if ( \t(width < 1) || (height < 1) ||\n (resampled_width < 2) || (resampled_height < 2) ||\n (channels < 1) ||\n (NULL == orig) || (NULL == resampled) )\n {\n /*\tsignify badness\t*/\n return 0;\n }\n /*\n\t\tfor each given pixel in the new map, find the exact location\n\t\tfrom the original map which would contribute to this guy\n\t*/\n dx = (width - 1.0f) / (resampled_width - 1.0f);\n dy = (height - 1.0f) / (resampled_height - 1.0f);\n for ( y = 0; y < resampled_height; ++y )\n {\n \t/* find the base y index and fractional offset from that\t*/\n \tfloat sampley = y * dy;\n \tint inty = (int)sampley;\n \t/*\tif( inty < 0 ) { inty = 0; } else\t*/\n\t\tif( inty > height - 2 ) { inty = height - 2; }\n\t\tsampley -= inty;\n for ( x = 0; x < resampled_width; ++x )\n {\n\t\t\tfloat samplex = x * dx;\n\t\t\tint intx = (int)samplex;\n\t\t\tint base_index;\n\t\t\t/* find the base x index and fractional offset from that\t*/\n\t\t\t/*\tif( intx < 0 ) { intx = 0; } else\t*/\n\t\t\tif( intx > width - 2 ) { intx = width - 2; }\n\t\t\tsamplex -= intx;\n\t\t\t/*\tbase index into the original image\t*/\n\t\t\tbase_index = (inty * width + intx) * channels;\n for ( c = 0; c < channels; ++c )\n {\n \t/*\tdo the sampling\t*/\n\t\t\t\tfloat value = 0.5f;\n\t\t\t\tvalue += orig[base_index]\n\t\t\t\t\t\t\t*(1.0f-samplex)*(1.0f-sampley);\n\t\t\t\tvalue += orig[base_index+channels]\n\t\t\t\t\t\t\t*(samplex)*(1.0f-sampley);\n\t\t\t\tvalue += orig[base_index+width*channels]\n\t\t\t\t\t\t\t*(1.0f-samplex)*(sampley);\n\t\t\t\tvalue += orig[base_index+width*channels+channels]\n\t\t\t\t\t\t\t*(samplex)*(sampley);\n\t\t\t\t/*\tmove to the next channel\t*/\n\t\t\t\t++base_index;\n \t/*\tsave the new value\t*/\n \tresampled[y*resampled_width*channels+x*channels+c] =\n\t\t\t\t\t\t(unsigned char)(value);\n }\n }\n }\n /*\tdone\t*/\n return 1;\n}\n\nint\n\tmipmap_image\n\t(\n\t\tconst unsigned char* const orig,\n\t\tint width, int height, int channels,\n\t\tunsigned char* resampled,\n\t\tint block_size_x, int block_size_y\n\t)\n{\n\tint mip_width, mip_height;\n\tint i, j, c;\n\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 1) || (orig == NULL) ||\n\t\t(resampled == NULL) ||\n\t\t(block_size_x < 1) || (block_size_y < 1) )\n\t{\n\t\t/*\tnothing to do\t*/\n\t\treturn 0;\n\t}\n\tmip_width = width / block_size_x;\n\tmip_height = height / block_size_y;\n\tif( mip_width < 1 )\n\t{\n\t\tmip_width = 1;\n\t}\n\tif( mip_height < 1 )\n\t{\n\t\tmip_height = 1;\n\t}\n\tfor( j = 0; j < mip_height; ++j )\n\t{\n\t\tfor( i = 0; i < mip_width; ++i )\n\t\t{\n\t\t\tfor( c = 0; c < channels; ++c )\n\t\t\t{\n\t\t\t\tconst int index = (j*block_size_y)*width*channels + (i*block_size_x)*channels + c;\n\t\t\t\tint sum_value;\n\t\t\t\tint u,v;\n\t\t\t\tint u_block = block_size_x;\n\t\t\t\tint v_block = block_size_y;\n\t\t\t\tint block_area;\n\t\t\t\t/*\tdo a bit of checking so we don't over-run the boundaries\n\t\t\t\t\t(necessary for non-square textures!)\t*/\n\t\t\t\tif( block_size_x * (i+1) > width )\n\t\t\t\t{\n\t\t\t\t\tu_block = width - i*block_size_y;\n\t\t\t\t}\n\t\t\t\tif( block_size_y * (j+1) > height )\n\t\t\t\t{\n\t\t\t\t\tv_block = height - j*block_size_y;\n\t\t\t\t}\n\t\t\t\tblock_area = u_block*v_block;\n\t\t\t\t/*\tfor this pixel, see what the average\n\t\t\t\t\tof all the values in the block are.\n\t\t\t\t\tnote: start the sum at the rounding value, not at 0\t*/\n\t\t\t\tsum_value = block_area >> 1;\n\t\t\t\tfor( v = 0; v < v_block; ++v )\n\t\t\t\tfor( u = 0; u < u_block; ++u )\n\t\t\t\t{\n\t\t\t\t\tsum_value += orig[index + v*width*channels + u*channels];\n\t\t\t\t}\n\t\t\t\tresampled[j*mip_width*channels + i*channels + c] = sum_value / block_area;\n\t\t\t}\n\t\t}\n\t}\n\treturn 1;\n}\n\nint\n\tscale_image_RGB_to_NTSC_safe\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t)\n{\n\tconst float scale_lo = 16.0f - 0.499f;\n\tconst float scale_hi = 235.0f + 0.499f;\n\tint i, j;\n\tint nc = channels;\n\tunsigned char scale_LUT[256];\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 1) || (orig == NULL) )\n\t{\n\t\t/*\tnothing to do\t*/\n\t\treturn 0;\n\t}\n\t/*\tset up the scaling Look Up Table\t*/\n\tfor( i = 0; i < 256; ++i )\n\t{\n\t\tscale_LUT[i] = (unsigned char)((scale_hi - scale_lo) * i / 255.0f + scale_lo);\n\t}\n\t/*\tfor channels = 2 or 4, ignore the alpha component\t*/\n\tnc -= 1 - (channels & 1);\n\t/*\tOK, go through the image and scale any non-alpha components\t*/\n\tfor( i = 0; i < width*height*channels; i += channels )\n\t{\n\t\tfor( j = 0; j < nc; ++j )\n\t\t{\n\t\t\torig[i+j] = scale_LUT[orig[i+j]];\n\t\t}\n\t}\n\treturn 1;\n}\n\nunsigned char clamp_byte( int x ) { return ( (x) < 0 ? (0) : ( (x) > 255 ? 255 : (x) ) ); }\n\n/*\n\tThis function takes the RGB components of the image\n\tand converts them into YCoCg. 3 components will be\n\tre-ordered to CoYCg (for optimum DXT1 compression),\n\twhile 4 components will be ordered CoCgAY (for DXT5\n\tcompression).\n*/\nint\n\tconvert_RGB_to_YCoCg\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t)\n{\n\tint i;\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 3) || (channels > 4) ||\n\t\t(orig == NULL) )\n\t{\n\t\t/*\tnothing to do\t*/\n\t\treturn -1;\n\t}\n\t/*\tdo the conversion\t*/\n\tif( channels == 3 )\n\t{\n\t\tfor( i = 0; i < width*height*3; i += 3 )\n\t\t{\n\t\t\tint r = orig[i+0];\n\t\t\tint g = (orig[i+1] + 1) >> 1;\n\t\t\tint b = orig[i+2];\n\t\t\tint tmp = (2 + r + b) >> 2;\n\t\t\t/*\tCo\t*/\n\t\t\torig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) );\n\t\t\t/*\tY\t*/\n\t\t\torig[i+1] = clamp_byte( g + tmp );\n\t\t\t/*\tCg\t*/\n\t\t\torig[i+2] = clamp_byte( 128 + g - tmp );\n\t\t}\n\t} else\n\t{\n\t\tfor( i = 0; i < width*height*4; i += 4 )\n\t\t{\n\t\t\tint r = orig[i+0];\n\t\t\tint g = (orig[i+1] + 1) >> 1;\n\t\t\tint b = orig[i+2];\n\t\t\tunsigned char a = orig[i+3];\n\t\t\tint tmp = (2 + r + b) >> 2;\n\t\t\t/*\tCo\t*/\n\t\t\torig[i+0] = clamp_byte( 128 + ((r - b + 1) >> 1) );\n\t\t\t/*\tCg\t*/\n\t\t\torig[i+1] = clamp_byte( 128 + g - tmp );\n\t\t\t/*\tAlpha\t*/\n\t\t\torig[i+2] = a;\n\t\t\t/*\tY\t*/\n\t\t\torig[i+3] = clamp_byte( g + tmp );\n\t\t}\n\t}\n\t/*\tdone\t*/\n\treturn 0;\n}\n\n/*\n\tThis function takes the YCoCg components of the image\n\tand converts them into RGB. See above.\n*/\nint\n\tconvert_YCoCg_to_RGB\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t)\n{\n\tint i;\n\t/*\terror check\t*/\n\tif( (width < 1) || (height < 1) ||\n\t\t(channels < 3) || (channels > 4) ||\n\t\t(orig == NULL) )\n\t{\n\t\t/*\tnothing to do\t*/\n\t\treturn -1;\n\t}\n\t/*\tdo the conversion\t*/\n\tif( channels == 3 )\n\t{\n\t\tfor( i = 0; i < width*height*3; i += 3 )\n\t\t{\n\t\t\tint co = orig[i+0] - 128;\n\t\t\tint y = orig[i+1];\n\t\t\tint cg = orig[i+2] - 128;\n\t\t\t/*\tR\t*/\n\t\t\torig[i+0] = clamp_byte( y + co - cg );\n\t\t\t/*\tG\t*/\n\t\t\torig[i+1] = clamp_byte( y + cg );\n\t\t\t/*\tB\t*/\n\t\t\torig[i+2] = clamp_byte( y - co - cg );\n\t\t}\n\t} else\n\t{\n\t\tfor( i = 0; i < width*height*4; i += 4 )\n\t\t{\n\t\t\tint co = orig[i+0] - 128;\n\t\t\tint cg = orig[i+1] - 128;\n\t\t\tunsigned char a = orig[i+2];\n\t\t\tint y = orig[i+3];\n\t\t\t/*\tR\t*/\n\t\t\torig[i+0] = clamp_byte( y + co - cg );\n\t\t\t/*\tG\t*/\n\t\t\torig[i+1] = clamp_byte( y + cg );\n\t\t\t/*\tB\t*/\n\t\t\torig[i+2] = clamp_byte( y - co - cg );\n\t\t\t/*\tA\t*/\n\t\t\torig[i+3] = a;\n\t\t}\n\t}\n\t/*\tdone\t*/\n\treturn 0;\n}\n\nfloat\nfind_max_RGBE\n(\n\tunsigned char *image,\n int width, int height\n)\n{\n\tfloat max_val = 0.0f;\n\tunsigned char *img = image;\n\tint i, j;\n\tfor( i = width * height; i > 0; --i )\n\t{\n\t\t/* float scale = powf( 2.0f, img[3] - 128.0f ) / 255.0f; */\n\t\tfloat scale = ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );\n\t\tfor( j = 0; j < 3; ++j )\n\t\t{\n\t\t\tif( img[j] * scale > max_val )\n\t\t\t{\n\t\t\t\tmax_val = img[j] * scale;\n\t\t\t}\n\t\t}\n\t\t/* next pixel */\n\t\timg += 4;\n\t}\n\treturn max_val;\n}\n\nint\nRGBE_to_RGBdivA\n(\n unsigned char *image,\n int width, int height,\n int rescale_to_max\n)\n{\n\t/* local variables */\n\tint i, iv;\n\tunsigned char *img = image;\n\tfloat scale = 1.0f;\n\t/* error check */\n\tif( (!image) || (width < 1) || (height < 1) )\n\t{\n\t\treturn 0;\n\t}\n\t/* convert (note: no negative numbers, but 0.0 is possible) */\n\tif( rescale_to_max )\n\t{\n\t\tscale = 255.0f / find_max_RGBE( image, width, height );\n\t}\n\tfor( i = width * height; i > 0; --i )\n\t{\n\t\t/* decode this pixel, and find the max */\n\t\tfloat r,g,b,e, m;\n\t\t/* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */\n\t\te = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );\n\t\tr = e * img[0];\n\t\tg = e * img[1];\n\t\tb = e * img[2];\n\t\tm = (r > g) ? r : g;\n\t\tm = (b > m) ? b : m;\n\t\t/* and encode it into RGBdivA */\n\t\tiv = (m != 0.0f) ? (int)(255.0f / m) : 1.0f;\n\t\tiv = (iv < 1) ? 1 : iv;\n\t\timg[3] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * r + 0.5f);\n\t\timg[0] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * g + 0.5f);\n\t\timg[1] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * b + 0.5f);\n\t\timg[2] = (iv > 255) ? 255 : iv;\n\t\t/* and on to the next pixel */\n\t\timg += 4;\n\t}\n\treturn 1;\n}\n\nint\nRGBE_to_RGBdivA2\n(\n unsigned char *image,\n int width, int height,\n int rescale_to_max\n)\n{\n\t/* local variables */\n\tint i, iv;\n\tunsigned char *img = image;\n\tfloat scale = 1.0f;\n\t/* error check */\n\tif( (!image) || (width < 1) || (height < 1) )\n\t{\n\t\treturn 0;\n\t}\n\t/* convert (note: no negative numbers, but 0.0 is possible) */\n\tif( rescale_to_max )\n\t{\n\t\tscale = 255.0f * 255.0f / find_max_RGBE( image, width, height );\n\t}\n\tfor( i = width * height; i > 0; --i )\n\t{\n\t\t/* decode this pixel, and find the max */\n\t\tfloat r,g,b,e, m;\n\t\t/* e = scale * powf( 2.0f, img[3] - 128.0f ) / 255.0f; */\n\t\te = scale * ldexp( 1.0f / 255.0f, (int)(img[3]) - 128 );\n\t\tr = e * img[0];\n\t\tg = e * img[1];\n\t\tb = e * img[2];\n\t\tm = (r > g) ? r : g;\n\t\tm = (b > m) ? b : m;\n\t\t/* and encode it into RGBdivA */\n\t\tiv = (m != 0.0f) ? (int)sqrtf( 255.0f * 255.0f / m ) : 1.0f;\n\t\tiv = (iv < 1) ? 1 : iv;\n\t\timg[3] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * img[3] * r / 255.0f + 0.5f);\n\t\timg[0] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * img[3] * g / 255.0f + 0.5f);\n\t\timg[1] = (iv > 255) ? 255 : iv;\n\t\tiv = (int)(img[3] * img[3] * b / 255.0f + 0.5f);\n\t\timg[2] = (iv > 255) ? 255 : iv;\n\t\t/* and on to the next pixel */\n\t\timg += 4;\n\t}\n\treturn 1;\n}\n"}, {"path": "includes/image_helper.h", "language": "code", "loc": 102, "comment_density": 0.451, "code": "/*\n Jonathan Dummer\n\n Image helper functions\n\n MIT license\n*/\n\n#ifndef HEADER_IMAGE_HELPER\n#define HEADER_IMAGE_HELPER\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/**\n\tThis function upscales an image.\n\tNot to be used to create MIPmaps,\n\tbut to make it square,\n\tor to make it a power-of-two sized.\n**/\nint\n\tup_scale_image\n\t(\n\t\tconst unsigned char* const orig,\n\t\tint width, int height, int channels,\n\t\tunsigned char* resampled,\n\t\tint resampled_width, int resampled_height\n\t);\n\n/**\n\tThis function downscales an image.\n\tUsed for creating MIPmaps,\n\tthe incoming image should be a\n\tpower-of-two sized.\n**/\nint\n\tmipmap_image\n\t(\n\t\tconst unsigned char* const orig,\n\t\tint width, int height, int channels,\n\t\tunsigned char* resampled,\n\t\tint block_size_x, int block_size_y\n\t);\n\n/**\n\tThis function takes the RGB components of the image\n\tand scales each channel from [0,255] to [16,235].\n\tThis makes the colors \"Safe\" for display on NTSC\n\tdisplays. Note that this is _NOT_ a good idea for\n\tloading images like normal- or height-maps!\n**/\nint\n\tscale_image_RGB_to_NTSC_safe\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t);\n\n/**\n\tThis function takes the RGB components of the image\n\tand converts them into YCoCg. 3 components will be\n\tre-ordered to CoYCg (for optimum DXT1 compression),\n\twhile 4 components will be ordered CoCgAY (for DXT5\n\tcompression).\n**/\nint\n\tconvert_RGB_to_YCoCg\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t);\n\n/**\n\tThis function takes the YCoCg components of the image\n\tand converts them into RGB. See above.\n**/\nint\n\tconvert_YCoCg_to_RGB\n\t(\n\t\tunsigned char* orig,\n\t\tint width, int height, int channels\n\t);\n\n/**\n\tConverts an HDR image from an array\n\tof unsigned chars (RGBE) to RGBdivA\n\t\\return 0 if failed, otherwise returns 1\n**/\nint\n\tRGBE_to_RGBdivA\n\t(\n\t\tunsigned char *image,\n\t\tint width, int height,\n\t\tint rescale_to_max\n\t);\n\n/**\n\tConverts an HDR image from an array\n\tof unsigned chars (RGBE) to RGBdivA2\n\t\\return 0 if failed, otherwise returns 1\n**/\nint\n\tRGBE_to_RGBdivA2\n\t(\n\t\tunsigned char *image,\n\t\tint width, int height,\n\t\tint rescale_to_max\n\t);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* HEADER_IMAGE_HELPER\t*/\n"}, {"path": "includes/stb_image.h", "language": "code", "loc": 6376, "comment_density": 0.21, "code": "/* stb_image - v2.14 - public domain image loader - http://nothings.org/stb_image.h\nno warranty implied; use at your own risk\n\nDo this:\n#define STB_IMAGE_IMPLEMENTATION\nbefore you include this file in *one* C or C++ file to create the implementation.\n\n// i.e. it should look like this:\n#include ...\n#include ...\n#include ...\n#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\"\n\nYou can #define STBI_ASSERT(x) before the #include to avoid using assert.h.\nAnd #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free\n\n\nQUICK NOTES:\nPrimarily of interest to game developers and other people who can\navoid problematic images and only need the trivial interface\n\nJPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib)\nPNG 1/2/4/8-bit-per-channel (16 bpc not supported)\n\nTGA (not sure what subset, if a subset)\nBMP non-1bpp, non-RLE\nPSD (composited view only, no extra channels, 8/16 bit-per-channel)\n\nGIF (*comp always reports as 4-channel)\nHDR (radiance rgbE format)\nPIC (Softimage PIC)\nPNM (PPM and PGM binary only)\n\nAnimated GIF still needs a proper API, but here's one way to do it:\nhttp://gist.github.com/urraka/685d9a6340b26b830d49\n\n- decode from memory or through FILE (define STBI_NO_STDIO to remove code)\n- decode from arbitrary I/O callbacks\n- SIMD acceleration on x86/x64 (SSE2) and ARM (NEON)\n\nFull documentation under \"DOCUMENTATION\" below.\n\n\nRevision 2.00 release notes:\n\n- Progressive JPEG is now supported.\n\n- PPM and PGM binary formats are now supported, thanks to Ken Miller.\n\n- x86 platforms now make use of SSE2 SIMD instructions for\nJPEG decoding, and ARM platforms can use NEON SIMD if requested.\nThis work was done by Fabian \"ryg\" Giesen. SSE2 is used by\ndefault, but NEON must be enabled explicitly; see docs.\n\nWith other JPEG optimizations included in this version, we see\n2x speedup on a JPEG on an x86 machine, and a 1.5x speedup\non a JPEG on an ARM machine, relative to previous versions of this\nlibrary. The same results will not obtain for all JPGs and for all\nx86/ARM machines. (Note that progressive JPEGs are significantly\nslower to decode than regular JPEGs.) This doesn't mean that this\nis the fastest JPEG decoder in the land; rather, it brings it\ncloser to parity with standard libraries. If you want the fastest\ndecode, look elsewhere. (See \"Philosophy\" section of docs below.)\n\nSee final bullet items below for more info on SIMD.\n\n- Added STBI_MALLOC, STBI_REALLOC, and STBI_FREE macros for replacing\nthe memory allocator. Unlike other STBI libraries, these macros don't\nsupport a context parameter, so if you need to pass a context into\nthe allocator, you'll have to store it in a global or a thread-local\nvariable.\n\n- Split existing STBI_NO_HDR flag into two flags, STBI_NO_HDR and\nSTBI_NO_LINEAR.\nSTBI_NO_HDR: suppress implementation of .hdr reader format\nSTBI_NO_LINEAR: suppress high-dynamic-range light-linear float API\n\n- You can suppress implementation of any of the decoders to reduce\nyour code footprint by #defining one or more of the following\nsymbols before creating the implementation.\n\nSTBI_NO_JPEG\nSTBI_NO_PNG\nSTBI_NO_BMP\nSTBI_NO_PSD\nSTBI_NO_TGA\nSTBI_NO_GIF\nSTBI_NO_HDR\nSTBI_NO_PIC\nSTBI_NO_PNM (.ppm and .pgm)\n\n- You can request *only* certain decoders and suppress all other ones\n(this will be more forward-compatible, as addition of new decoders\ndoesn't require you to disable them explicitly):\n\nSTBI_ONLY_JPEG\nSTBI_ONLY_PNG\nSTBI_ONLY_BMP\nSTBI_ONLY_PSD\nSTBI_ONLY_TGA\nSTBI_ONLY_GIF\nSTBI_ONLY_HDR\nSTBI_ONLY_PIC\nSTBI_ONLY_PNM (.ppm and .pgm)\n\nNote that you can define multiples of these, and you will get all\nof them (\"only x\" and \"only y\" is interpreted to mean \"only x&y\").\n\n- If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still\nwant the zlib decoder to be available, #define STBI_SUPPORT_ZLIB\n\n- Compilation of all SIMD code can be suppressed with\n#define STBI_NO_SIMD\nIt should not be necessary to disable SIMD unless you have issues\ncompiling (e.g. using an x86 compiler which doesn't support SSE\nintrinsics or that doesn't support the method used to detect\nSSE2 support at run-time), and even those can be reported as\nbugs so I can refine the built-in compile-time checking to be\nsmarter.\n\n- The old STBI_SIMD system which allowed installing a user-defined\nIDCT etc. has been removed. If you need this, don't upgrade. My\nassumption is that almost nobody was doing this, and those who\nwere will find the built-in SIMD more satisfactory anyway.\n\n- RGB values computed for JPEG images are slightly different from\nprevious versions of stb_image. (This is due to using less\ninteger precision in SIMD.) The C code has been adjusted so\nthat the same RGB values will be computed regardless of whether\nSIMD support is available, so your app should always produce\nconsistent results. But these results are slightly different from\nprevious versions. (Specifically, about 3% of available YCbCr values\nwill compute different RGB results from pre-1.49 versions by +-1;\nmost of the deviating values are one smaller in the G channel.)\n\n- If you must produce consistent results with previous versions of\nstb_image, #define STBI_JPEG_OLD and you will get the same results\nyou used to; however, you will not get the SIMD speedups for\nthe YCbCr-to-RGB conversion step (although you should still see\nsignificant JPEG speedup from the other changes).\n\nPlease note that STBI_JPEG_OLD is a temporary feature; it will be\nremoved in future versions of the library. It is only intended for\nnear-term back-compatibility use.\n\n\nLatest revision history:\n2.13 (2016-12-04) experimental 16-bit API, only for PNG so far; fixes\n2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes\n2.11 (2016-04-02) 16-bit PNGS; enable SSE2 in non-gcc x64\nRGB-format JPEG; remove white matting in PSD;\nallocate large structures on the stack;\ncorrect channel count for PNG & BMP\n2.10 (2016-01-22) avoid warning introduced in 2.09\n2.09 (2016-01-16) 16-bit TGA; comments in PNM files; STBI_REALLOC_SIZED\n2.08 (2015-09-13) fix to 2.07 cleanup, reading RGB PSD as RGBA\n2.07 (2015-09-13) partial animated GIF support\nlimited 16-bit PSD support\nminor bugs, code cleanup, and compiler warnings\n\nSee end of file for full revision history.\n\n\n============================ Contributors =========================\n\nImage formats Extensions, features\nSean Barrett (jpeg, png, bmp) Jetro Lauha (stbi_info)\nNicolas Schulz (hdr, psd) Martin \"SpartanJ\" Golini (stbi_info)\nJonathan Dummer (tga) James \"moose2000\" Brown (iPhone PNG)\nJean-Marc Lienher (gif) Ben \"Disch\" Wenger (io callbacks)\nTom Seddon (pic) Omar Cornut (1/2/4-bit PNG)\nThatcher Ulrich (psd) Nicolas Guillemot (vertical flip)\nKen Miller (pgm, ppm) Richard Mitton (16-bit PSD)\ngithub:urraka (animated gif) Junggon Kim (PNM comments)\nDaniel Gibson (16-bit TGA)\nsocks-the-fox (16-bit TGA)\nOptimizations & bugfixes\nFabian \"ryg\" Giesen\nArseny Kapoulkine\n\nBug & warning fixes\nMarc LeBlanc David Woo Guillaume George Martins Mozeiko\nChristpher Lloyd Martin Golini Jerry Jansson Joseph Thomson\nDave Moore Roy Eltham Hayaki Saito Phil Jordan\nWon Chun Luke Graham Johan Duparc Nathan Reed\nthe Horde3D community Thomas Ruf Ronny Chevalier Nick Verigakis\nJanez Zemva John Bartholomew Michal Cichon github:svdijk\nJonathan Blow Ken Hamada Tero Hanninen Baldur Karlsson\nLaurent Gomila Cort Stratton Sergio Gonzalez github:romigrou\nAruelien Pocheville Thibault Reuille Cass Everitt Matthew Gregan\nRyamond Barbiero Paul Du Bois Engin Manap github:snagar\nMichaelangel007@github Oriol Ferrer Mesia Dale Weiler github:Zelex\nPhilipp Wiesemann Josh Tobin github:rlyeh github:grim210@github\nBlazej Dariusz Roszkowski github:sammyhw\n\n\nLICENSE\n\nThis software is dual-licensed to the public domain and under the following\nlicense: you are granted a perpetual, irrevocable license to copy, modify,\npublish, and distribute this file as you see fit.\n\n*/\n\n#ifndef STBI_INCLUDE_STB_IMAGE_H\n#define STBI_INCLUDE_STB_IMAGE_H\n\n// DOCUMENTATION\n//\n// Limitations:\n// - no 16-bit-per-channel PNG\n// - no 12-bit-per-channel JPEG\n// - no JPEGs with arithmetic coding\n// - no 1-bit BMP\n// - GIF always returns *comp=4\n//\n// Basic usage (see HDR discussion below for HDR usage):\n// int x,y,n;\n// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);\n// // ... process data if not NULL ...\n// // ... x = width, y = height, n = # 8-bit components per pixel ...\n// // ... replace '0' with '1'..'4' to force that many components per pixel\n// // ... but 'n' will always be the number that it would have been if you said 0\n// stbi_image_free(data)\n//\n// Standard parameters:\n// int *x -- outputs image width in pixels\n// int *y -- outputs image height in pixels\n// int *channels_in_file -- outputs # of image components in image file\n// int desired_channels -- if non-zero, # of image components requested in result\n//\n// The return value from an image loader is an 'unsigned char *' which points\n// to the pixel data, or NULL on an allocation failure or if the image is\n// corrupt or invalid. The pixel data consists of *y scanlines of *x pixels,\n// with each pixel consisting of N interleaved 8-bit components; the first\n// pixel pointed to is top-left-most in the image. There is no padding between\n// image scanlines or between pixels, regardless of format. The number of\n// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.\n// If req_comp is non-zero, *comp has the number of components that _would_\n// have been output otherwise. E.g. if you set req_comp to 4, you will always\n// get RGBA output, but you can check *comp to see if it's trivially opaque\n// because e.g. there were only 3 channels in the source image.\n//\n// An output image with N components has the following components interleaved\n// in this order in each pixel:\n//\n// N=#comp components\n// 1 grey\n// 2 grey, alpha\n// 3 red, green, blue\n// 4 red, green, blue, alpha\n//\n// If image loading fails for any reason, the return value will be NULL,\n// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()\n// can be queried for an extremely brief, end-user unfriendly explanation\n// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid\n// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly\n// more user-friendly ones.\n//\n// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.\n//\n// ===========================================================================\n//\n// Philosophy\n//\n// stb libraries are designed with the following priorities:\n//\n// 1. easy to use\n// 2. easy to maintain\n// 3. good performance\n//\n// Sometimes I let \"good performance\" creep up in priority over \"easy to maintain\",\n// and for best performance I may provide less-easy-to-use APIs that give higher\n// performance, in addition to the easy to use ones. Nevertheless, it's important\n// to keep in mind that from the standpoint of you, a client of this library,\n// all you care about is #1 and #3, and stb libraries do not emphasize #3 above all.\n//\n// Some secondary priorities arise directly from the first two, some of which\n// make more explicit reasons why performance can't be emphasized.\n//\n// - Portable (\"ease of use\")\n// - Small footprint (\"easy to maintain\")\n// - No dependencies (\"ease of use\")\n//\n// ===========================================================================\n//\n// I/O callbacks\n//\n// I/O callbacks allow you to read from arbitrary sources, like packaged\n// files or some other source. Data read from callbacks are processed\n// through a small internal buffer (currently 128 bytes) to try to reduce\n// overhead.\n//\n// The three functions you must define are \"read\" (reads some bytes of data),\n// \"skip\" (skips some bytes of data), \"eof\" (reports if the stream is at the end).\n//\n// ===========================================================================\n//\n// SIMD support\n//\n// The JPEG decoder will try to automatically use SIMD kernels on x86 when\n// supported by the compiler. For ARM Neon support, you must explicitly\n// request it.\n//\n// (The old do-it-yourself SIMD API is no longer supported in the current\n// code.)\n//\n// On x86, SSE2 will automatically be used when available based on a run-time\n// test; if not, the generic C versions are used as a fall-back. On ARM targets,\n// the typical path is to have separate builds for NEON and non-NEON devices\n// (at least this is true for iOS and Android). Therefore, the NEON support is\n// toggled by a build flag: define STBI_NEON to get NEON loops.\n//\n// The output of the JPEG decoder is slightly different from versions where\n// SIMD support was introduced (that is, for versions before 1.49). The\n// difference is only +-1 in the 8-bit RGB channels, and only on a small\n// fraction of pixels. You can force the pre-1.49 behavior by defining\n// STBI_JPEG_OLD, but this will disable some of the SIMD decoding path\n// and hence cost some performance.\n//\n// If for some reason you do not want to use any of SIMD code, or if\n// you have issues compiling it, you can disable it entirely by\n// defining STBI_NO_SIMD.\n//\n// ===========================================================================\n//\n// HDR image support (disable by defining STBI_NO_HDR)\n//\n// stb_image now supports loading HDR images in general, and currently\n// the Radiance .HDR file format, although the support is provided\n// generically. You can still load any file through the existing interface;\n// if you attempt to load an HDR file, it will be automatically remapped to\n// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;\n// both of these constants can be reconfigured through this interface:\n//\n// stbi_hdr_to_ldr_gamma(2.2f);\n// stbi_hdr_to_ldr_scale(1.0f);\n//\n// (note, do not use _inverse_ constants; stbi_image will invert them\n// appropriately).\n//\n// Additionally, there is a new, parallel interface for loading files as\n// (linear) floats to preserve the full dynamic range:\n//\n// float *data = stbi_loadf(filename, &x, &y, &n, 0);\n//\n// If you load LDR images through this interface, those images will\n// be promoted to floating point values, run through the inverse of\n// constants corresponding to the above:\n//\n// stbi_ldr_to_hdr_scale(1.0f);\n// stbi_ldr_to_hdr_gamma(2.2f);\n//\n// Finally, given a filename (or an open file or memory block--see header\n// file for details) containing image data, you can query for the \"most\n// appropriate\" interface to use (that is, whether the image is HDR or\n// not), using:\n//\n// stbi_is_hdr(char *filename);\n//\n// ===========================================================================\n//\n// iPhone PNG support:\n//\n// By default we convert iphone-formatted PNGs back to RGB, even though\n// they are internally encoded differently. You can disable this conversion\n// by by calling stbi_convert_iphone_png_to_rgb(0), in which case\n// you will always just get the native iphone \"format\" through (which\n// is BGR stored in RGB).\n//\n// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per\n// pixel to remove any premultiplied alpha *only* if the image file explicitly\n// says there's premultiplied data (currently only happens in iPhone images,\n// and only if iPhone convert-to-rgb processing is on).\n//\n\n\n#ifndef STBI_NO_STDIO\n#include \n#endif // STBI_NO_STDIO\n\n#define STBI_VERSION 1\n\nenum\n{\n STBI_default = 0, // only used for req_comp\n\n STBI_grey = 1,\n STBI_grey_alpha = 2,\n STBI_rgb = 3,\n STBI_rgb_alpha = 4\n};\n\ntypedef unsigned char stbi_uc;\ntypedef unsigned short stbi_us;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef STB_IMAGE_STATIC\n#define STBIDEF static\n#else\n#define STBIDEF extern\n#endif\n\n //////////////////////////////////////////////////////////////////////////////\n //\n // PRIMARY API - works on images of any type\n //\n\n //\n // load image by filename, open file, or memory buffer\n //\n\n typedef struct\n {\n int(*read) (void *user, char *data, int size); // fill 'data' with 'size' bytes. return number of bytes actually read\n void(*skip) (void *user, int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative\n int(*eof) (void *user); // returns nonzero if we are at end of file/data\n } stbi_io_callbacks;\n\n ////////////////////////////////////\n //\n // 8-bits-per-channel interface\n //\n\n STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);\n STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);\n STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels);\n\n#ifndef STBI_NO_STDIO\n STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);\n // for stbi_load_from_file, file pointer is left pointing immediately after image\n#endif\n\n ////////////////////////////////////\n //\n // 16-bits-per-channel interface\n //\n\n STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);\n#ifndef STBI_NO_STDIO\n STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);\n#endif\n // @TODO the other variants\n\n ////////////////////////////////////\n //\n // float-per-channel interface\n //\n#ifndef STBI_NO_LINEAR\n STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);\n STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);\n STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels);\n\n#ifndef STBI_NO_STDIO\n STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);\n#endif\n#endif\n\n#ifndef STBI_NO_HDR\n STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);\n STBIDEF void stbi_hdr_to_ldr_scale(float scale);\n#endif // STBI_NO_HDR\n\n#ifndef STBI_NO_LINEAR\n STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);\n STBIDEF void stbi_ldr_to_hdr_scale(float scale);\n#endif // STBI_NO_LINEAR\n\n // stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR\n STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user);\n STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);\n#ifndef STBI_NO_STDIO\n STBIDEF int stbi_is_hdr(char const *filename);\n STBIDEF int stbi_is_hdr_from_file(FILE *f);\n#endif // STBI_NO_STDIO\n\n\n // get a VERY brief reason for failure\n // NOT THREADSAFE\n STBIDEF const char *stbi_failure_reason(void);\n\n // free the loaded image -- this is just free()\n STBIDEF void stbi_image_free(void *retval_from_stbi_load);\n\n // get image dimensions & components without fully decoding\n STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp);\n\n#ifndef STBI_NO_STDIO\n STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp);\n STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp);\n\n#endif\n\n\n\n // for image formats that explicitly notate that they have premultiplied alpha,\n // we just return the colors as stored in the file. set this flag to force\n // unpremultiplication. results are undefined if the unpremultiply overflow.\n STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);\n\n // indicate whether we should process iphone images back to canonical format,\n // or just pass them through \"as-is\"\n STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);\n\n // flip the image vertically, so the first pixel in the output array is the bottom left\n STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip);\n\n // ZLIB client - used by PNG, available for other purposes\n\n STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);\n STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header);\n STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);\n STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);\n\n STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);\n STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);\n\n\n#ifdef __cplusplus\n}\n#endif\n\n//\n//\n//// end header file /////////////////////////////////////////////////////\n#endif // STBI_INCLUDE_STB_IMAGE_H\n\n#ifdef STB_IMAGE_IMPLEMENTATION\n\n#if defined(STBI_ONLY_JPEG) || defined(STBI_ONLY_PNG) || defined(STBI_ONLY_BMP) \\\n || defined(STBI_ONLY_TGA) || defined(STBI_ONLY_GIF) || defined(STBI_ONLY_PSD) \\\n || defined(STBI_ONLY_HDR) || defined(STBI_ONLY_PIC) || defined(STBI_ONLY_PNM) \\\n || defined(STBI_ONLY_ZLIB)\n#ifndef STBI_ONLY_JPEG\n#define STBI_NO_JPEG\n#endif\n#ifndef STBI_ONLY_PNG\n#define STBI_NO_PNG\n#endif\n#ifndef STBI_ONLY_BMP\n#define STBI_NO_BMP\n#endif\n#ifndef STBI_ONLY_PSD\n#define STBI_NO_PSD\n#endif\n#ifndef STBI_ONLY_TGA\n#define STBI_NO_TGA\n#endif\n#ifndef STBI_ONLY_GIF\n#define STBI_NO_GIF\n#endif\n#ifndef STBI_ONLY_HDR\n#define STBI_NO_HDR\n#endif\n#ifndef STBI_ONLY_PIC\n#define STBI_NO_PIC\n#endif\n#ifndef STBI_ONLY_PNM\n#define STBI_NO_PNM\n#endif\n#endif\n\n#if defined(STBI_NO_PNG) && !defined(STBI_SUPPORT_ZLIB) && !defined(STBI_NO_ZLIB)\n#define STBI_NO_ZLIB\n#endif\n\n\n#include \n#include // ptrdiff_t on osx\n#include \n#include \n#include \n\n#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)\n#include // ldexp\n#endif\n\n#ifndef STBI_NO_STDIO\n#include \n#endif\n\n#ifndef STBI_ASSERT\n#include \n#define STBI_ASSERT(x) assert(x)\n#endif\n\n\n#ifndef _MSC_VER\n#ifdef __cplusplus\n#define stbi_inline inline\n#else\n#define stbi_inline\n#endif\n#else\n#define stbi_inline __forceinline\n#endif\n\n\n#ifdef _MSC_VER\ntypedef unsigned short stbi__uint16;\ntypedef signed short stbi__int16;\ntypedef unsigned int stbi__uint32;\ntypedef signed int stbi__int32;\n#else\n#include \ntypedef uint16_t stbi__uint16;\ntypedef int16_t stbi__int16;\ntypedef uint32_t stbi__uint32;\ntypedef int32_t stbi__int32;\n#endif\n\n// should produce compiler error if size is wrong\ntypedef unsigned char validate_uint32[sizeof(stbi__uint32) == 4 ? 1 : -1];\n\n#ifdef _MSC_VER\n#define STBI_NOTUSED(v) (void)(v)\n#else\n#define STBI_NOTUSED(v) (void)sizeof(v)\n#endif\n\n#ifdef _MSC_VER\n#define STBI_HAS_LROTL\n#endif\n\n#ifdef STBI_HAS_LROTL\n#define stbi_lrot(x,y) _lrotl(x,y)\n#else\n#define stbi_lrot(x,y) (((x) << (y)) | ((x) >> (32 - (y))))\n#endif\n\n#if defined(STBI_MALLOC) && defined(STBI_FREE) && (defined(STBI_REALLOC) || defined(STBI_REALLOC_SIZED))\n// ok\n#elif !defined(STBI_MALLOC) && !defined(STBI_FREE) && !defined(STBI_REALLOC) && !defined(STBI_REALLOC_SIZED)\n// ok\n#else\n#error \"Must define all or none of STBI_MALLOC, STBI_FREE, and STBI_REALLOC (or STBI_REALLOC_SIZED).\"\n#endif\n\n#ifndef STBI_MALLOC\n#define STBI_MALLOC(sz) malloc(sz)\n#define STBI_REALLOC(p,newsz) realloc(p,newsz)\n#define STBI_FREE(p) free(p)\n#endif\n\n#ifndef STBI_REALLOC_SIZED\n#define STBI_REALLOC_SIZED(p,oldsz,newsz) STBI_REALLOC(p,newsz)\n#endif\n\n// x86/x64 detection\n#if defined(__x86_64__) || defined(_M_X64)\n#define STBI__X64_TARGET\n#elif defined(__i386) || defined(_M_IX86)\n#define STBI__X86_TARGET\n#endif\n\n#if defined(__GNUC__) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET)) && !defined(__SSE2__) && !defined(STBI_NO_SIMD)\n// NOTE: not clear do we actually need this for the 64-bit path?\n// gcc doesn't support sse2 intrinsics unless you compile with -msse2,\n// (but compiling with -msse2 allows the compiler to use SSE2 everywhere;\n// this is just broken and gcc are jerks for not fixing it properly\n// http://www.virtualdub.org/blog/pivot/entry.php?id=363 )\n#define STBI_NO_SIMD\n#endif\n\n#if defined(__MINGW32__) && defined(STBI__X86_TARGET) && !defined(STBI_MINGW_ENABLE_SSE2) && !defined(STBI_NO_SIMD)\n// Note that __MINGW32__ doesn't actually mean 32-bit, so we have to avoid STBI__X64_TARGET\n//\n// 32-bit MinGW wants ESP to be 16-byte aligned, but this is not in the\n// Windows ABI and VC++ as well as Windows DLLs don't maintain that invariant.\n// As a result, enabling SSE2 on 32-bit MinGW is dangerous when not\n// simultaneously enabling \"-mstackrealign\".\n//\n// See https://github.com/nothings/stb/issues/81 for more information.\n//\n// So default to no SSE2 on 32-bit MinGW. If you've read this far and added\n// -mstackrealign to your build settings, feel free to #define STBI_MINGW_ENABLE_SSE2.\n#define STBI_NO_SIMD\n#endif\n\n#if !defined(STBI_NO_SIMD) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET))\n#define STBI_SSE2\n#include \n\n#ifdef _MSC_VER\n\n#if _MSC_VER >= 1400 // not VC6\n#include // __cpuid\nstatic int stbi__cpuid3(void)\n{\n int info[4];\n __cpuid(info, 1);\n return info[3];\n}\n#else\nstatic int stbi__cpuid3(void)\n{\n int res;\n __asm {\n mov eax, 1\n cpuid\n mov res, edx\n }\n return res;\n}\n#endif\n\n#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name\n\nstatic int stbi__sse2_available()\n{\n int info3 = stbi__cpuid3();\n return ((info3 >> 26) & 1) != 0;\n}\n#else // assume GCC-style if not VC++\n#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16)))\n\nstatic int stbi__sse2_available()\n{\n#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 // GCC 4.8 or later\n // GCC 4.8+ has a nice way to do this\n return __builtin_cpu_supports(\"sse2\");\n#else\n // portable way to do this, preferably without using GCC inline ASM?\n // just bail for now.\n return 0;\n#endif\n}\n#endif\n#endif\n\n// ARM NEON\n#if defined(STBI_NO_SIMD) && defined(STBI_NEON)\n#undef STBI_NEON\n#endif\n\n#ifdef STBI_NEON\n#include \n// assume GCC or Clang on ARM targets\n#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16)))\n#endif\n\n#ifndef STBI_SIMD_ALIGN\n#define STBI_SIMD_ALIGN(type, name) type name\n#endif\n\n///////////////////////////////////////////////\n//\n// stbi__context struct and start_xxx functions\n\n// stbi__context structure is our basic context used by all images, so it\n// contains all the IO context, plus some basic image information\ntypedef struct\n{\n stbi__uint32 img_x, img_y;\n int img_n, img_out_n;\n\n stbi_io_callbacks io;\n void *io_user_data;\n\n int read_from_callbacks;\n int buflen;\n stbi_uc buffer_start[128];\n\n stbi_uc *img_buffer, *img_buffer_end;\n stbi_uc *img_buffer_original, *img_buffer_original_end;\n} stbi__context;\n\n\nstatic void stbi__refill_buffer(stbi__context *s);\n\n// initialize a memory-decode context\nstatic void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len)\n{\n s->io.read = NULL;\n s->read_from_callbacks = 0;\n s->img_buffer = s->img_buffer_original = (stbi_uc *)buffer;\n s->img_buffer_end = s->img_buffer_original_end = (stbi_uc *)buffer + len;\n}\n\n// initialize a callback-based context\nstatic void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user)\n{\n s->io = *c;\n s->io_user_data = user;\n s->buflen = sizeof(s->buffer_start);\n s->read_from_callbacks = 1;\n s->img_buffer_original = s->buffer_start;\n stbi__refill_buffer(s);\n s->img_buffer_original_end = s->img_buffer_end;\n}\n\n#ifndef STBI_NO_STDIO\n\nstatic int stbi__stdio_read(void *user, char *data, int size)\n{\n return (int)fread(data, 1, size, (FILE*)user);\n}\n\nstatic void stbi__stdio_skip(void *user, int n)\n{\n fseek((FILE*)user, n, SEEK_CUR);\n}\n\nstatic int stbi__stdio_eof(void *user)\n{\n return feof((FILE*)user);\n}\n\nstatic stbi_io_callbacks stbi__stdio_callbacks =\n{\n stbi__stdio_read,\n stbi__stdio_skip,\n stbi__stdio_eof,\n};\n\nstatic void stbi__start_file(stbi__context *s, FILE *f)\n{\n stbi__start_callbacks(s, &stbi__stdio_callbacks, (void *)f);\n}\n\n//static void stop_file(stbi__context *s) { }\n\n#endif // !STBI_NO_STDIO\n\nstatic void stbi__rewind(stbi__context *s)\n{\n // conceptually rewind SHOULD rewind to the beginning of the stream,\n // but we just rewind to the beginning of the initial buffer, because\n // we only use it after doing 'test', which only ever looks at at most 92 bytes\n s->img_buffer = s->img_buffer_original;\n s->img_buffer_end = s->img_buffer_original_end;\n}\n\nenum\n{\n STBI_ORDER_RGB,\n STBI_ORDER_BGR\n};\n\ntypedef struct\n{\n int bits_per_channel;\n int num_channels;\n int channel_order;\n} stbi__result_info;\n\n#ifndef STBI_NO_JPEG\nstatic int stbi__jpeg_test(stbi__context *s);\nstatic void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_PNG\nstatic int stbi__png_test(stbi__context *s);\nstatic void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__png_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_BMP\nstatic int stbi__bmp_test(stbi__context *s);\nstatic void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_TGA\nstatic int stbi__tga_test(stbi__context *s);\nstatic void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_PSD\nstatic int stbi__psd_test(stbi__context *s);\nstatic void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc);\nstatic int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_HDR\nstatic int stbi__hdr_test(stbi__context *s);\nstatic float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_PIC\nstatic int stbi__pic_test(stbi__context *s);\nstatic void *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_GIF\nstatic int stbi__gif_test(stbi__context *s);\nstatic void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n#ifndef STBI_NO_PNM\nstatic int stbi__pnm_test(stbi__context *s);\nstatic void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri);\nstatic int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp);\n#endif\n\n// this is not threadsafe\nstatic const char *stbi__g_failure_reason;\n\nSTBIDEF const char *stbi_failure_reason(void)\n{\n return stbi__g_failure_reason;\n}\n\nstatic int stbi__err(const char *str)\n{\n stbi__g_failure_reason = str;\n return 0;\n}\n\nstatic void *stbi__malloc(size_t size)\n{\n return STBI_MALLOC(size);\n}\n\n// stb_image uses ints pervasively, including for offset calculations.\n// therefore the largest decoded image size we can support with the\n// current code, even on 64-bit targets, is INT_MAX. this is not a\n// significant limitation for the intended use case.\n//\n// we do, however, need to make sure our size calculations don't\n// overflow. hence a few helper functions for size calculations that\n// multiply integers together, making sure that they're non-negative\n// and no overflow occurs.\n\n// return 1 if the sum is valid, 0 on overflow.\n// negative terms are considered invalid.\nstatic int stbi__addsizes_valid(int a, int b)\n{\n if (b < 0) return 0;\n // now 0 <= b <= INT_MAX, hence also\n // 0 <= INT_MAX - b <= INTMAX.\n // And \"a + b <= INT_MAX\" (which might overflow) is the\n // same as a <= INT_MAX - b (no overflow)\n return a <= INT_MAX - b;\n}\n\n// returns 1 if the product is valid, 0 on overflow.\n// negative factors are considered invalid.\nstatic int stbi__mul2sizes_valid(int a, int b)\n{\n if (a < 0 || b < 0) return 0;\n if (b == 0) return 1; // mul-by-0 is always safe\n // portable way to check for no overflows in a*b\n return a <= INT_MAX / b;\n}\n\n// returns 1 if \"a*b + add\" has no negative terms/factors and doesn't overflow\nstatic int stbi__mad2sizes_valid(int a, int b, int add)\n{\n return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add);\n}\n\n// returns 1 if \"a*b*c + add\" has no negative terms/factors and doesn't overflow\nstatic int stbi__mad3sizes_valid(int a, int b, int c, int add)\n{\n return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&\n stbi__addsizes_valid(a*b*c, add);\n}\n\n// returns 1 if \"a*b*c*d + add\" has no negative terms/factors and doesn't overflow\nstatic int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)\n{\n return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&\n stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);\n}\n\n// mallocs with size overflow checking\nstatic void *stbi__malloc_mad2(int a, int b, int add)\n{\n if (!stbi__mad2sizes_valid(a, b, add)) return NULL;\n return stbi__malloc(a*b + add);\n}\n\nstatic void *stbi__malloc_mad3(int a, int b, int c, int add)\n{\n if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL;\n return stbi__malloc(a*b*c + add);\n}\n\nstatic void *stbi__malloc_mad4(int a, int b, int c, int d, int add)\n{\n if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL;\n return stbi__malloc(a*b*c*d + add);\n}\n\n// stbi__err - error\n// stbi__errpf - error returning pointer to float\n// stbi__errpuc - error returning pointer to unsigned char\n\n#ifdef STBI_NO_FAILURE_STRINGS\n#define stbi__err(x,y) 0\n#elif defined(STBI_FAILURE_USERMSG)\n#define stbi__err(x,y) stbi__err(y)\n#else\n#define stbi__err(x,y) stbi__err(x)\n#endif\n\n#define stbi__errpf(x,y) ((float *)(size_t) (stbi__err(x,y)?NULL:NULL))\n#define stbi__errpuc(x,y) ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL))\n\nSTBIDEF void stbi_image_free(void *retval_from_stbi_load)\n{\n STBI_FREE(retval_from_stbi_load);\n}\n\n#ifndef STBI_NO_LINEAR\nstatic float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp);\n#endif\n\n#ifndef STBI_NO_HDR\nstatic stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp);\n#endif\n\nstatic int stbi__vertically_flip_on_load = 0;\n\nSTBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip)\n{\n stbi__vertically_flip_on_load = flag_true_if_should_flip;\n}\n\nstatic void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc)\n{\n memset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields\n ri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed\n ri->channel_order = STBI_ORDER_RGB; // all current input & output are this, but this is here so we can add BGR order\n ri->num_channels = 0;\n\n#ifndef STBI_NO_JPEG\n if (stbi__jpeg_test(s)) return stbi__jpeg_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_PNG\n if (stbi__png_test(s)) return stbi__png_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_BMP\n if (stbi__bmp_test(s)) return stbi__bmp_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_GIF\n if (stbi__gif_test(s)) return stbi__gif_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_PSD\n if (stbi__psd_test(s)) return stbi__psd_load(s, x, y, comp, req_comp, ri, bpc);\n#endif\n#ifndef STBI_NO_PIC\n if (stbi__pic_test(s)) return stbi__pic_load(s, x, y, comp, req_comp, ri);\n#endif\n#ifndef STBI_NO_PNM\n if (stbi__pnm_test(s)) return stbi__pnm_load(s, x, y, comp, req_comp, ri);\n#endif\n\n#ifndef STBI_NO_HDR\n if (stbi__hdr_test(s)) {\n float *hdr = stbi__hdr_load(s, x, y, comp, req_comp, ri);\n return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);\n }\n#endif\n\n#ifndef STBI_NO_TGA\n // test tga last because it's a crappy test!\n if (stbi__tga_test(s))\n return stbi__tga_load(s, x, y, comp, req_comp, ri);\n#endif\n\n return stbi__errpuc(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n\nstatic stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, int channels)\n{\n int i;\n int img_len = w * h * channels;\n stbi_uc *reduced;\n\n reduced = (stbi_uc *)stbi__malloc(img_len);\n if (reduced == NULL) return stbi__errpuc(\"outofmem\", \"Out of memory\");\n\n for (i = 0; i < img_len; ++i)\n reduced[i] = (stbi_uc)((orig[i] >> 8) & 0xFF); // top half of each byte is sufficient approx of 16->8 bit scaling\n\n STBI_FREE(orig);\n return reduced;\n}\n\nstatic stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels)\n{\n int i;\n int img_len = w * h * channels;\n stbi__uint16 *enlarged;\n\n enlarged = (stbi__uint16 *)stbi__malloc(img_len * 2);\n if (enlarged == NULL) return (stbi__uint16 *)stbi__errpuc(\"outofmem\", \"Out of memory\");\n\n for (i = 0; i < img_len; ++i)\n enlarged[i] = (stbi__uint16)((orig[i] << 8) + orig[i]); // replicate to high and low byte, maps 0->0, 255->0xffff\n\n STBI_FREE(orig);\n return enlarged;\n}\n\nstatic unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\n stbi__result_info ri;\n void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8);\n\n if (result == NULL)\n return NULL;\n\n if (ri.bits_per_channel != 8) {\n STBI_ASSERT(ri.bits_per_channel == 16);\n result = stbi__convert_16_to_8((stbi__uint16 *)result, *x, *y, req_comp == 0 ? *comp : req_comp);\n ri.bits_per_channel = 8;\n }\n\n // @TODO: move stbi__convert_format to here\n\n if (stbi__vertically_flip_on_load) {\n int w = *x, h = *y;\n int channels = req_comp ? req_comp : *comp;\n int row, col, z;\n stbi_uc *image = (stbi_uc *)result;\n\n // @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once\n for (row = 0; row < (h >> 1); row++) {\n for (col = 0; col < w; col++) {\n for (z = 0; z < channels; z++) {\n stbi_uc temp = image[(row * w + col) * channels + z];\n image[(row * w + col) * channels + z] = image[((h - row - 1) * w + col) * channels + z];\n image[((h - row - 1) * w + col) * channels + z] = temp;\n }\n }\n }\n }\n\n return (unsigned char *)result;\n}\n\nstatic stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\n stbi__result_info ri;\n void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 16);\n\n if (result == NULL)\n return NULL;\n\n if (ri.bits_per_channel != 16) {\n STBI_ASSERT(ri.bits_per_channel == 8);\n result = stbi__convert_8_to_16((stbi_uc *)result, *x, *y, req_comp == 0 ? *comp : req_comp);\n ri.bits_per_channel = 16;\n }\n\n // @TODO: move stbi__convert_format16 to here\n // @TODO: special case RGB-to-Y (and RGBA-to-YA) for 8-bit-to-16-bit case to keep more precision\n\n if (stbi__vertically_flip_on_load) {\n int w = *x, h = *y;\n int channels = req_comp ? req_comp : *comp;\n int row, col, z;\n stbi__uint16 *image = (stbi__uint16 *)result;\n\n // @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once\n for (row = 0; row < (h >> 1); row++) {\n for (col = 0; col < w; col++) {\n for (z = 0; z < channels; z++) {\n stbi__uint16 temp = image[(row * w + col) * channels + z];\n image[(row * w + col) * channels + z] = image[((h - row - 1) * w + col) * channels + z];\n image[((h - row - 1) * w + col) * channels + z] = temp;\n }\n }\n }\n }\n\n return (stbi__uint16 *)result;\n}\n\n#ifndef STBI_NO_HDR\nstatic void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp)\n{\n if (stbi__vertically_flip_on_load && result != NULL) {\n int w = *x, h = *y;\n int depth = req_comp ? req_comp : *comp;\n int row, col, z;\n float temp;\n\n // @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once\n for (row = 0; row < (h >> 1); row++) {\n for (col = 0; col < w; col++) {\n for (z = 0; z < depth; z++) {\n temp = result[(row * w + col) * depth + z];\n result[(row * w + col) * depth + z] = result[((h - row - 1) * w + col) * depth + z];\n result[((h - row - 1) * w + col) * depth + z] = temp;\n }\n }\n }\n }\n}\n#endif\n\n#ifndef STBI_NO_STDIO\n\nstatic FILE *stbi__fopen(char const *filename, char const *mode)\n{\n FILE *f;\n#if defined(_MSC_VER) && _MSC_VER >= 1400\n if (0 != fopen_s(&f, filename, mode))\n f = 0;\n#else\n f = fopen(filename, mode);\n#endif\n return f;\n}\n\n\nSTBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n FILE *f = stbi__fopen(filename, \"rb\");\n unsigned char *result;\n if (!f) return stbi__errpuc(\"can't fopen\", \"Unable to open file\");\n result = stbi_load_from_file(f, x, y, comp, req_comp);\n fclose(f);\n return result;\n}\n\nSTBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *result;\n stbi__context s;\n stbi__start_file(&s, f);\n result = stbi__load_and_postprocess_8bit(&s, x, y, comp, req_comp);\n if (result) {\n // need to 'unget' all the characters in the IO buffer\n fseek(f, -(int)(s.img_buffer_end - s.img_buffer), SEEK_CUR);\n }\n return result;\n}\n\nSTBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n stbi__uint16 *result;\n stbi__context s;\n stbi__start_file(&s, f);\n result = stbi__load_and_postprocess_16bit(&s, x, y, comp, req_comp);\n if (result) {\n // need to 'unget' all the characters in the IO buffer\n fseek(f, -(int)(s.img_buffer_end - s.img_buffer), SEEK_CUR);\n }\n return result;\n}\n\nSTBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n FILE *f = stbi__fopen(filename, \"rb\");\n stbi__uint16 *result;\n if (!f) return (stbi_us *)stbi__errpuc(\"can't fopen\", \"Unable to open file\");\n result = stbi_load_from_file_16(f, x, y, comp, req_comp);\n fclose(f);\n return result;\n}\n\n\n#endif //!STBI_NO_STDIO\n\nSTBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_mem(&s, buffer, len);\n return stbi__load_and_postprocess_8bit(&s, x, y, comp, req_comp);\n}\n\nSTBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user);\n return stbi__load_and_postprocess_8bit(&s, x, y, comp, req_comp);\n}\n\n#ifndef STBI_NO_LINEAR\nstatic float *stbi__loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *data;\n#ifndef STBI_NO_HDR\n if (stbi__hdr_test(s)) {\n stbi__result_info ri;\n float *hdr_data = stbi__hdr_load(s, x, y, comp, req_comp, &ri);\n if (hdr_data)\n stbi__float_postprocess(hdr_data, x, y, comp, req_comp);\n return hdr_data;\n }\n#endif\n data = stbi__load_and_postprocess_8bit(s, x, y, comp, req_comp);\n if (data)\n return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);\n return stbi__errpf(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n\nSTBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_mem(&s, buffer, len);\n return stbi__loadf_main(&s, x, y, comp, req_comp);\n}\n\nSTBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user);\n return stbi__loadf_main(&s, x, y, comp, req_comp);\n}\n\n#ifndef STBI_NO_STDIO\nSTBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n float *result;\n FILE *f = stbi__fopen(filename, \"rb\");\n if (!f) return stbi__errpf(\"can't fopen\", \"Unable to open file\");\n result = stbi_loadf_from_file(f, x, y, comp, req_comp);\n fclose(f);\n return result;\n}\n\nSTBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n stbi__context s;\n stbi__start_file(&s, f);\n return stbi__loadf_main(&s, x, y, comp, req_comp);\n}\n#endif // !STBI_NO_STDIO\n\n#endif // !STBI_NO_LINEAR\n\n// these is-hdr-or-not is defined independent of whether STBI_NO_LINEAR is\n// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always\n// reports false!\n\nSTBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)\n{\n#ifndef STBI_NO_HDR\n stbi__context s;\n stbi__start_mem(&s, buffer, len);\n return stbi__hdr_test(&s);\n#else\n STBI_NOTUSED(buffer);\n STBI_NOTUSED(len);\n return 0;\n#endif\n}\n\n#ifndef STBI_NO_STDIO\nSTBIDEF int stbi_is_hdr(char const *filename)\n{\n FILE *f = stbi__fopen(filename, \"rb\");\n int result = 0;\n if (f) {\n result = stbi_is_hdr_from_file(f);\n fclose(f);\n }\n return result;\n}\n\nSTBIDEF int stbi_is_hdr_from_file(FILE *f)\n{\n#ifndef STBI_NO_HDR\n stbi__context s;\n stbi__start_file(&s, f);\n return stbi__hdr_test(&s);\n#else\n STBI_NOTUSED(f);\n return 0;\n#endif\n}\n#endif // !STBI_NO_STDIO\n\nSTBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user)\n{\n#ifndef STBI_NO_HDR\n stbi__context s;\n stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user);\n return stbi__hdr_test(&s);\n#else\n STBI_NOTUSED(clbk);\n STBI_NOTUSED(user);\n return 0;\n#endif\n}\n\n#ifndef STBI_NO_LINEAR\nstatic float stbi__l2h_gamma = 2.2f, stbi__l2h_scale = 1.0f;\n\nSTBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; }\nSTBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; }\n#endif\n\nstatic float stbi__h2l_gamma_i = 1.0f / 2.2f, stbi__h2l_scale_i = 1.0f;\n\nSTBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1 / gamma; }\nSTBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1 / scale; }\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// Common code used by all image loaders\n//\n\nenum\n{\n STBI__SCAN_load = 0,\n STBI__SCAN_type,\n STBI__SCAN_header\n};\n\nstatic void stbi__refill_buffer(stbi__context *s)\n{\n int n = (s->io.read)(s->io_user_data, (char*)s->buffer_start, s->buflen);\n if (n == 0) {\n // at end of file, treat same as if from memory, but need to handle case\n // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file\n s->read_from_callbacks = 0;\n s->img_buffer = s->buffer_start;\n s->img_buffer_end = s->buffer_start + 1;\n *s->img_buffer = 0;\n }\n else {\n s->img_buffer = s->buffer_start;\n s->img_buffer_end = s->buffer_start + n;\n }\n}\n\nstbi_inline static stbi_uc stbi__get8(stbi__context *s)\n{\n if (s->img_buffer < s->img_buffer_end)\n return *s->img_buffer++;\n if (s->read_from_callbacks) {\n stbi__refill_buffer(s);\n return *s->img_buffer++;\n }\n return 0;\n}\n\nstbi_inline static int stbi__at_eof(stbi__context *s)\n{\n if (s->io.read) {\n if (!(s->io.eof)(s->io_user_data)) return 0;\n // if feof() is true, check if buffer = end\n // special case: we've only got the special 0 character at the end\n if (s->read_from_callbacks == 0) return 1;\n }\n\n return s->img_buffer >= s->img_buffer_end;\n}\n\nstatic void stbi__skip(stbi__context *s, int n)\n{\n if (n < 0) {\n s->img_buffer = s->img_buffer_end;\n return;\n }\n if (s->io.read) {\n int blen = (int)(s->img_buffer_end - s->img_buffer);\n if (blen < n) {\n s->img_buffer = s->img_buffer_end;\n (s->io.skip)(s->io_user_data, n - blen);\n return;\n }\n }\n s->img_buffer += n;\n}\n\nstatic int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)\n{\n if (s->io.read) {\n int blen = (int)(s->img_buffer_end - s->img_buffer);\n if (blen < n) {\n int res, count;\n\n memcpy(buffer, s->img_buffer, blen);\n\n count = (s->io.read)(s->io_user_data, (char*)buffer + blen, n - blen);\n res = (count == (n - blen));\n s->img_buffer = s->img_buffer_end;\n return res;\n }\n }\n\n if (s->img_buffer + n <= s->img_buffer_end) {\n memcpy(buffer, s->img_buffer, n);\n s->img_buffer += n;\n return 1;\n }\n else\n return 0;\n}\n\nstatic int stbi__get16be(stbi__context *s)\n{\n int z = stbi__get8(s);\n return (z << 8) + stbi__get8(s);\n}\n\nstatic stbi__uint32 stbi__get32be(stbi__context *s)\n{\n stbi__uint32 z = stbi__get16be(s);\n return (z << 16) + stbi__get16be(s);\n}\n\n#if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF)\n// nothing\n#else\nstatic int stbi__get16le(stbi__context *s)\n{\n int z = stbi__get8(s);\n return z + (stbi__get8(s) << 8);\n}\n#endif\n\n#ifndef STBI_NO_BMP\nstatic stbi__uint32 stbi__get32le(stbi__context *s)\n{\n stbi__uint32 z = stbi__get16le(s);\n return z + (stbi__get16le(s) << 16);\n}\n#endif\n\n#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// generic converter from built-in img_n to req_comp\n// individual types do this automatically as much as possible (e.g. jpeg\n// does all cases internally since it needs to colorspace convert anyway,\n// and it never has alpha, so very few cases ). png can automatically\n// interleave an alpha=255 channel, but falls back to this for other cases\n//\n// assume data buffer is malloced, so malloc a new one and free that one\n// only failure mode is malloc failing\n\nstatic stbi_uc stbi__compute_y(int r, int g, int b)\n{\n return (stbi_uc)(((r * 77) + (g * 150) + (29 * b)) >> 8);\n}\n\nstatic unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y)\n{\n int i, j;\n unsigned char *good;\n\n if (req_comp == img_n) return data;\n STBI_ASSERT(req_comp >= 1 && req_comp <= 4);\n\n good = (unsigned char *)stbi__malloc_mad3(req_comp, x, y, 0);\n if (good == NULL) {\n STBI_FREE(data);\n return stbi__errpuc(\"outofmem\", \"Out of memory\");\n }\n\n for (j = 0; j < (int)y; ++j) {\n unsigned char *src = data + j * x * img_n;\n unsigned char *dest = good + j * x * req_comp;\n\n#define STBI__COMBO(a,b) ((a)*8+(b))\n#define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)\n // convert source image with img_n components to one with req_comp components;\n // avoid switch per pixel, so use switch per scanline and massive macros\n switch (STBI__COMBO(img_n, req_comp)) {\n STBI__CASE(1, 2) { dest[0] = src[0], dest[1] = 255; } break;\n STBI__CASE(1, 3) { dest[0] = dest[1] = dest[2] = src[0]; } break;\n STBI__CASE(1, 4) { dest[0] = dest[1] = dest[2] = src[0], dest[3] = 255; } break;\n STBI__CASE(2, 1) { dest[0] = src[0]; } break;\n STBI__CASE(2, 3) { dest[0] = dest[1] = dest[2] = src[0]; } break;\n STBI__CASE(2, 4) { dest[0] = dest[1] = dest[2] = src[0], dest[3] = src[1]; } break;\n STBI__CASE(3, 4) { dest[0] = src[0], dest[1] = src[1], dest[2] = src[2], dest[3] = 255; } break;\n STBI__CASE(3, 1) { dest[0] = stbi__compute_y(src[0], src[1], src[2]); } break;\n STBI__CASE(3, 2) { dest[0] = stbi__compute_y(src[0], src[1], src[2]), dest[1] = 255; } break;\n STBI__CASE(4, 1) { dest[0] = stbi__compute_y(src[0], src[1], src[2]); } break;\n STBI__CASE(4, 2) { dest[0] = stbi__compute_y(src[0], src[1], src[2]), dest[1] = src[3]; } break;\n STBI__CASE(4, 3) { dest[0] = src[0], dest[1] = src[1], dest[2] = src[2]; } break;\n default: STBI_ASSERT(0);\n }\n#undef STBI__CASE\n }\n\n STBI_FREE(data);\n return good;\n}\n\nstatic stbi__uint16 stbi__compute_y_16(int r, int g, int b)\n{\n return (stbi__uint16)(((r * 77) + (g * 150) + (29 * b)) >> 8);\n}\n\nstatic stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y)\n{\n int i, j;\n stbi__uint16 *good;\n\n if (req_comp == img_n) return data;\n STBI_ASSERT(req_comp >= 1 && req_comp <= 4);\n\n good = (stbi__uint16 *)stbi__malloc(req_comp * x * y * 2);\n if (good == NULL) {\n STBI_FREE(data);\n return (stbi__uint16 *)stbi__errpuc(\"outofmem\", \"Out of memory\");\n }\n\n for (j = 0; j < (int)y; ++j) {\n stbi__uint16 *src = data + j * x * img_n;\n stbi__uint16 *dest = good + j * x * req_comp;\n\n#define STBI__COMBO(a,b) ((a)*8+(b))\n#define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)\n // convert source image with img_n components to one with req_comp components;\n // avoid switch per pixel, so use switch per scanline and massive macros\n switch (STBI__COMBO(img_n, req_comp)) {\n STBI__CASE(1, 2) { dest[0] = src[0], dest[1] = 0xffff; } break;\n STBI__CASE(1, 3) { dest[0] = dest[1] = dest[2] = src[0]; } break;\n STBI__CASE(1, 4) { dest[0] = dest[1] = dest[2] = src[0], dest[3] = 0xffff; } break;\n STBI__CASE(2, 1) { dest[0] = src[0]; } break;\n STBI__CASE(2, 3) { dest[0] = dest[1] = dest[2] = src[0]; } break;\n STBI__CASE(2, 4) { dest[0] = dest[1] = dest[2] = src[0], dest[3] = src[1]; } break;\n STBI__CASE(3, 4) { dest[0] = src[0], dest[1] = src[1], dest[2] = src[2], dest[3] = 0xffff; } break;\n STBI__CASE(3, 1) { dest[0] = stbi__compute_y_16(src[0], src[1], src[2]); } break;\n STBI__CASE(3, 2) { dest[0] = stbi__compute_y_16(src[0], src[1], src[2]), dest[1] = 0xffff; } break;\n STBI__CASE(4, 1) { dest[0] = stbi__compute_y_16(src[0], src[1], src[2]); } break;\n STBI__CASE(4, 2) { dest[0] = stbi__compute_y_16(src[0], src[1], src[2]), dest[1] = src[3]; } break;\n STBI__CASE(4, 3) { dest[0] = src[0], dest[1] = src[1], dest[2] = src[2]; } break;\n default: STBI_ASSERT(0);\n }\n#undef STBI__CASE\n }\n\n STBI_FREE(data);\n return good;\n}\n\n#ifndef STBI_NO_LINEAR\nstatic float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)\n{\n int i, k, n;\n float *output;\n if (!data) return NULL;\n output = (float *)stbi__malloc_mad4(x, y, comp, sizeof(float), 0);\n if (output == NULL) { STBI_FREE(data); return stbi__errpf(\"outofmem\", \"Out of memory\"); }\n // compute number of non-alpha components\n if (comp & 1) n = comp; else n = comp - 1;\n for (i = 0; i < x*y; ++i) {\n for (k = 0; k < n; ++k) {\n output[i*comp + k] = (float)(pow(data[i*comp + k] / 255.0f, stbi__l2h_gamma) * stbi__l2h_scale);\n }\n if (k < comp) output[i*comp + k] = data[i*comp + k] / 255.0f;\n }\n STBI_FREE(data);\n return output;\n}\n#endif\n\n#ifndef STBI_NO_HDR\n#define stbi__float2int(x) ((int) (x))\nstatic stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp)\n{\n int i, k, n;\n stbi_uc *output;\n if (!data) return NULL;\n output = (stbi_uc *)stbi__malloc_mad3(x, y, comp, 0);\n if (output == NULL) { STBI_FREE(data); return stbi__errpuc(\"outofmem\", \"Out of memory\"); }\n // compute number of non-alpha components\n if (comp & 1) n = comp; else n = comp - 1;\n for (i = 0; i < x*y; ++i) {\n for (k = 0; k < n; ++k) {\n float z = (float)pow(data[i*comp + k] * stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f;\n if (z < 0) z = 0;\n if (z > 255) z = 255;\n output[i*comp + k] = (stbi_uc)stbi__float2int(z);\n }\n if (k < comp) {\n float z = data[i*comp + k] * 255 + 0.5f;\n if (z < 0) z = 0;\n if (z > 255) z = 255;\n output[i*comp + k] = (stbi_uc)stbi__float2int(z);\n }\n }\n STBI_FREE(data);\n return output;\n}\n#endif\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// \"baseline\" JPEG/JFIF decoder\n//\n// simple implementation\n// - doesn't support delayed output of y-dimension\n// - simple interface (only one output format: 8-bit interleaved RGB)\n// - doesn't try to recover corrupt jpegs\n// - doesn't allow partial loading, loading multiple at once\n// - still fast on x86 (copying globals into locals doesn't help x86)\n// - allocates lots of intermediate memory (full size of all components)\n// - non-interleaved case requires this anyway\n// - allows good upsampling (see next)\n// high-quality\n// - upsampled channels are bilinearly interpolated, even across blocks\n// - quality integer IDCT derived from IJG's 'slow'\n// performance\n// - fast huffman; reasonable integer IDCT\n// - some SIMD kernels for common paths on targets with SSE2/NEON\n// - uses a lot of intermediate memory, could cache poorly\n\n#ifndef STBI_NO_JPEG\n\n// huffman decoding acceleration\n#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache\n\ntypedef struct\n{\n stbi_uc fast[1 << FAST_BITS];\n // weirdly, repacking this into AoS is a 10% speed loss, instead of a win\n stbi__uint16 code[256];\n stbi_uc values[256];\n stbi_uc size[257];\n unsigned int maxcode[18];\n int delta[17]; // old 'firstsymbol' - old 'firstcode'\n} stbi__huffman;\n\ntypedef struct\n{\n stbi__context *s;\n stbi__huffman huff_dc[4];\n stbi__huffman huff_ac[4];\n stbi_uc dequant[4][64];\n stbi__int16 fast_ac[4][1 << FAST_BITS];\n\n // sizes for components, interleaved MCUs\n int img_h_max, img_v_max;\n int img_mcu_x, img_mcu_y;\n int img_mcu_w, img_mcu_h;\n\n // definition of jpeg image component\n struct\n {\n int id;\n int h, v;\n int tq;\n int hd, ha;\n int dc_pred;\n\n int x, y, w2, h2;\n stbi_uc *data;\n void *raw_data, *raw_coeff;\n stbi_uc *linebuf;\n short *coeff; // progressive only\n int coeff_w, coeff_h; // number of 8x8 coefficient blocks\n } img_comp[4];\n\n stbi__uint32 code_buffer; // jpeg entropy-coded buffer\n int code_bits; // number of valid bits\n unsigned char marker; // marker seen while filling entropy buffer\n int nomore; // flag if we saw a marker so must stop\n\n int progressive;\n int spec_start;\n int spec_end;\n int succ_high;\n int succ_low;\n int eob_run;\n int rgb;\n\n int scan_n, order[4];\n int restart_interval, todo;\n\n // kernels\n void(*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]);\n void(*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step);\n stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs);\n} stbi__jpeg;\n\nstatic int stbi__build_huffman(stbi__huffman *h, int *count)\n{\n int i, j, k = 0, code;\n // build size list for each symbol (from JPEG spec)\n for (i = 0; i < 16; ++i)\n for (j = 0; j < count[i]; ++j)\n h->size[k++] = (stbi_uc)(i + 1);\n h->size[k] = 0;\n\n // compute actual symbols (from jpeg spec)\n code = 0;\n k = 0;\n for (j = 1; j <= 16; ++j) {\n // compute delta to add to code to compute symbol id\n h->delta[j] = k - code;\n if (h->size[k] == j) {\n while (h->size[k] == j)\n h->code[k++] = (stbi__uint16)(code++);\n if (code - 1 >= (1 << j)) return stbi__err(\"bad code lengths\", \"Corrupt JPEG\");\n }\n // compute largest code + 1 for this size, preshifted as needed later\n h->maxcode[j] = code << (16 - j);\n code <<= 1;\n }\n h->maxcode[j] = 0xffffffff;\n\n // build non-spec acceleration table; 255 is flag for not-accelerated\n memset(h->fast, 255, 1 << FAST_BITS);\n for (i = 0; i < k; ++i) {\n int s = h->size[i];\n if (s <= FAST_BITS) {\n int c = h->code[i] << (FAST_BITS - s);\n int m = 1 << (FAST_BITS - s);\n for (j = 0; j < m; ++j) {\n h->fast[c + j] = (stbi_uc)i;\n }\n }\n }\n return 1;\n}\n\n// build a table that decodes both magnitude and value of small ACs in\n// one go.\nstatic void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h)\n{\n int i;\n for (i = 0; i < (1 << FAST_BITS); ++i) {\n stbi_uc fast = h->fast[i];\n fast_ac[i] = 0;\n if (fast < 255) {\n int rs = h->values[fast];\n int run = (rs >> 4) & 15;\n int magbits = rs & 15;\n int len = h->size[fast];\n\n if (magbits && len + magbits <= FAST_BITS) {\n // magnitude code followed by receive_extend code\n int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits);\n int m = 1 << (magbits - 1);\n if (k < m) k += (-1 << magbits) + 1;\n // if the result is small enough, we can fit it in fast_ac table\n if (k >= -128 && k <= 127)\n fast_ac[i] = (stbi__int16)((k << 8) + (run << 4) + (len + magbits));\n }\n }\n }\n}\n\nstatic void stbi__grow_buffer_unsafe(stbi__jpeg *j)\n{\n do {\n int b = j->nomore ? 0 : stbi__get8(j->s);\n if (b == 0xff) {\n int c = stbi__get8(j->s);\n if (c != 0) {\n j->marker = (unsigned char)c;\n j->nomore = 1;\n return;\n }\n }\n j->code_buffer |= b << (24 - j->code_bits);\n j->code_bits += 8;\n } while (j->code_bits <= 24);\n}\n\n// (1 << n) - 1\nstatic stbi__uint32 stbi__bmask[17] = { 0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535 };\n\n// decode a jpeg huffman value from the bitstream\nstbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h)\n{\n unsigned int temp;\n int c, k;\n\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n\n // look at the top FAST_BITS and determine what symbol ID it is,\n // if the code is <= FAST_BITS\n c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS) - 1);\n k = h->fast[c];\n if (k < 255) {\n int s = h->size[k];\n if (s > j->code_bits)\n return -1;\n j->code_buffer <<= s;\n j->code_bits -= s;\n return h->values[k];\n }\n\n // naive test is to shift the code_buffer down so k bits are\n // valid, then test against maxcode. To speed this up, we've\n // preshifted maxcode left so that it has (16-k) 0s at the\n // end; in other words, regardless of the number of bits, it\n // wants to be compared against something shifted to have 16;\n // that way we don't need to shift inside the loop.\n temp = j->code_buffer >> 16;\n for (k = FAST_BITS + 1; ; ++k)\n if (temp < h->maxcode[k])\n break;\n if (k == 17) {\n // error! code not found\n j->code_bits -= 16;\n return -1;\n }\n\n if (k > j->code_bits)\n return -1;\n\n // convert the huffman code to the symbol id\n c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k];\n STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]);\n\n // convert the id to a symbol\n j->code_bits -= k;\n j->code_buffer <<= k;\n return h->values[c];\n}\n\n// bias[n] = (-1<code_bits < n) stbi__grow_buffer_unsafe(j);\n\n sgn = (stbi__int32)j->code_buffer >> 31; // sign bit is always in MSB\n k = stbi_lrot(j->code_buffer, n);\n STBI_ASSERT(n >= 0 && n < (int)(sizeof(stbi__bmask) / sizeof(*stbi__bmask)));\n j->code_buffer = k & ~stbi__bmask[n];\n k &= stbi__bmask[n];\n j->code_bits -= n;\n return k + (stbi__jbias[n] & ~sgn);\n}\n\n// get some unsigned bits\nstbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n)\n{\n unsigned int k;\n if (j->code_bits < n) stbi__grow_buffer_unsafe(j);\n k = stbi_lrot(j->code_buffer, n);\n j->code_buffer = k & ~stbi__bmask[n];\n k &= stbi__bmask[n];\n j->code_bits -= n;\n return k;\n}\n\nstbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)\n{\n unsigned int k;\n if (j->code_bits < 1) stbi__grow_buffer_unsafe(j);\n k = j->code_buffer;\n j->code_buffer <<= 1;\n --j->code_bits;\n return k & 0x80000000;\n}\n\n// given a value that's at position X in the zigzag stream,\n// where does it appear in the 8x8 matrix coded as row-major?\nstatic stbi_uc stbi__jpeg_dezigzag[64 + 15] =\n{\n 0, 1, 8, 16, 9, 2, 3, 10,\n 17, 24, 32, 25, 18, 11, 4, 5,\n 12, 19, 26, 33, 40, 48, 41, 34,\n 27, 20, 13, 6, 7, 14, 21, 28,\n 35, 42, 49, 56, 57, 50, 43, 36,\n 29, 22, 15, 23, 30, 37, 44, 51,\n 58, 59, 52, 45, 38, 31, 39, 46,\n 53, 60, 61, 54, 47, 55, 62, 63,\n // let corrupt input sample past end\n 63, 63, 63, 63, 63, 63, 63, 63,\n 63, 63, 63, 63, 63, 63, 63\n};\n\n// decode one 64-entry block--\nstatic int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant)\n{\n int diff, dc, k;\n int t;\n\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n t = stbi__jpeg_huff_decode(j, hdc);\n if (t < 0) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n\n // 0 all the ac values now so we can do it 32-bits at a time\n memset(data, 0, 64 * sizeof(data[0]));\n\n diff = t ? stbi__extend_receive(j, t) : 0;\n dc = j->img_comp[b].dc_pred + diff;\n j->img_comp[b].dc_pred = dc;\n data[0] = (short)(dc * dequant[0]);\n\n // decode AC components, see JPEG spec\n k = 1;\n do {\n unsigned int zig;\n int c, r, s;\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS) - 1);\n r = fac[c];\n if (r) { // fast-AC path\n k += (r >> 4) & 15; // run\n s = r & 15; // combined length\n j->code_buffer <<= s;\n j->code_bits -= s;\n // decode into unzigzag'd location\n zig = stbi__jpeg_dezigzag[k++];\n data[zig] = (short)((r >> 8) * dequant[zig]);\n }\n else {\n int rs = stbi__jpeg_huff_decode(j, hac);\n if (rs < 0) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n s = rs & 15;\n r = rs >> 4;\n if (s == 0) {\n if (rs != 0xf0) break; // end block\n k += 16;\n }\n else {\n k += r;\n // decode into unzigzag'd location\n zig = stbi__jpeg_dezigzag[k++];\n data[zig] = (short)(stbi__extend_receive(j, s) * dequant[zig]);\n }\n }\n } while (k < 64);\n return 1;\n}\n\nstatic int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b)\n{\n int diff, dc;\n int t;\n if (j->spec_end != 0) return stbi__err(\"can't merge dc and ac\", \"Corrupt JPEG\");\n\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n\n if (j->succ_high == 0) {\n // first scan for DC coefficient, must be first\n memset(data, 0, 64 * sizeof(data[0])); // 0 all the ac values now\n t = stbi__jpeg_huff_decode(j, hdc);\n diff = t ? stbi__extend_receive(j, t) : 0;\n\n dc = j->img_comp[b].dc_pred + diff;\n j->img_comp[b].dc_pred = dc;\n data[0] = (short)(dc << j->succ_low);\n }\n else {\n // refinement scan for DC coefficient\n if (stbi__jpeg_get_bit(j))\n data[0] += (short)(1 << j->succ_low);\n }\n return 1;\n}\n\n// @OPTIMIZE: store non-zigzagged during the decode passes,\n// and only de-zigzag when dequantizing\nstatic int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac)\n{\n int k;\n if (j->spec_start == 0) return stbi__err(\"can't merge dc and ac\", \"Corrupt JPEG\");\n\n if (j->succ_high == 0) {\n int shift = j->succ_low;\n\n if (j->eob_run) {\n --j->eob_run;\n return 1;\n }\n\n k = j->spec_start;\n do {\n unsigned int zig;\n int c, r, s;\n if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);\n c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS) - 1);\n r = fac[c];\n if (r) { // fast-AC path\n k += (r >> 4) & 15; // run\n s = r & 15; // combined length\n j->code_buffer <<= s;\n j->code_bits -= s;\n zig = stbi__jpeg_dezigzag[k++];\n data[zig] = (short)((r >> 8) << shift);\n }\n else {\n int rs = stbi__jpeg_huff_decode(j, hac);\n if (rs < 0) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n s = rs & 15;\n r = rs >> 4;\n if (s == 0) {\n if (r < 15) {\n j->eob_run = (1 << r);\n if (r)\n j->eob_run += stbi__jpeg_get_bits(j, r);\n --j->eob_run;\n break;\n }\n k += 16;\n }\n else {\n k += r;\n zig = stbi__jpeg_dezigzag[k++];\n data[zig] = (short)(stbi__extend_receive(j, s) << shift);\n }\n }\n } while (k <= j->spec_end);\n }\n else {\n // refinement scan for these AC coefficients\n\n short bit = (short)(1 << j->succ_low);\n\n if (j->eob_run) {\n --j->eob_run;\n for (k = j->spec_start; k <= j->spec_end; ++k) {\n short *p = &data[stbi__jpeg_dezigzag[k]];\n if (*p != 0)\n if (stbi__jpeg_get_bit(j))\n if ((*p & bit) == 0) {\n if (*p > 0)\n *p += bit;\n else\n *p -= bit;\n }\n }\n }\n else {\n k = j->spec_start;\n do {\n int r, s;\n int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh\n if (rs < 0) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n s = rs & 15;\n r = rs >> 4;\n if (s == 0) {\n if (r < 15) {\n j->eob_run = (1 << r) - 1;\n if (r)\n j->eob_run += stbi__jpeg_get_bits(j, r);\n r = 64; // force end of block\n }\n else {\n // r=15 s=0 should write 16 0s, so we just do\n // a run of 15 0s and then write s (which is 0),\n // so we don't have to do anything special here\n }\n }\n else {\n if (s != 1) return stbi__err(\"bad huffman code\", \"Corrupt JPEG\");\n // sign bit\n if (stbi__jpeg_get_bit(j))\n s = bit;\n else\n s = -bit;\n }\n\n // advance by r\n while (k <= j->spec_end) {\n short *p = &data[stbi__jpeg_dezigzag[k++]];\n if (*p != 0) {\n if (stbi__jpeg_get_bit(j))\n if ((*p & bit) == 0) {\n if (*p > 0)\n *p += bit;\n else\n *p -= bit;\n }\n }\n else {\n if (r == 0) {\n *p = (short)s;\n break;\n }\n --r;\n }\n }\n } while (k <= j->spec_end);\n }\n }\n return 1;\n}\n\n// take a -128..127 value and stbi__clamp it and convert to 0..255\nstbi_inline static stbi_uc stbi__clamp(int x)\n{\n // trick to use a single test to catch both cases\n if ((unsigned int)x > 255) {\n if (x < 0) return 0;\n if (x > 255) return 255;\n }\n return (stbi_uc)x;\n}\n\n#define stbi__f2f(x) ((int) (((x) * 4096 + 0.5)))\n#define stbi__fsh(x) ((x) << 12)\n\n// derived from jidctint -- DCT_ISLOW\n#define STBI__IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \\\n int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \\\n p2 = s2; \\\n p3 = s6; \\\n p1 = (p2+p3) * stbi__f2f(0.5411961f); \\\n t2 = p1 + p3*stbi__f2f(-1.847759065f); \\\n t3 = p1 + p2*stbi__f2f( 0.765366865f); \\\n p2 = s0; \\\n p3 = s4; \\\n t0 = stbi__fsh(p2+p3); \\\n t1 = stbi__fsh(p2-p3); \\\n x0 = t0+t3; \\\n x3 = t0-t3; \\\n x1 = t1+t2; \\\n x2 = t1-t2; \\\n t0 = s7; \\\n t1 = s5; \\\n t2 = s3; \\\n t3 = s1; \\\n p3 = t0+t2; \\\n p4 = t1+t3; \\\n p1 = t0+t3; \\\n p2 = t1+t2; \\\n p5 = (p3+p4)*stbi__f2f( 1.175875602f); \\\n t0 = t0*stbi__f2f( 0.298631336f); \\\n t1 = t1*stbi__f2f( 2.053119869f); \\\n t2 = t2*stbi__f2f( 3.072711026f); \\\n t3 = t3*stbi__f2f( 1.501321110f); \\\n p1 = p5 + p1*stbi__f2f(-0.899976223f); \\\n p2 = p5 + p2*stbi__f2f(-2.562915447f); \\\n p3 = p3*stbi__f2f(-1.961570560f); \\\n p4 = p4*stbi__f2f(-0.390180644f); \\\n t3 += p1+p4; \\\n t2 += p2+p3; \\\n t1 += p2+p4; \\\n t0 += p1+p3;\n\nstatic void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])\n{\n int i, val[64], *v = val;\n stbi_uc *o;\n short *d = data;\n\n // columns\n for (i = 0; i < 8; ++i, ++d, ++v) {\n // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing\n if (d[8] == 0 && d[16] == 0 && d[24] == 0 && d[32] == 0\n && d[40] == 0 && d[48] == 0 && d[56] == 0) {\n // no shortcut 0 seconds\n // (1|2|3|4|5|6|7)==0 0 seconds\n // all separate -0.047 seconds\n // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds\n int dcterm = d[0] << 2;\n v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;\n }\n else {\n STBI__IDCT_1D(d[0], d[8], d[16], d[24], d[32], d[40], d[48], d[56])\n // constants scaled things up by 1<<12; let's bring them back\n // down, but keep 2 extra bits of precision\n x0 += 512; x1 += 512; x2 += 512; x3 += 512;\n v[0] = (x0 + t3) >> 10;\n v[56] = (x0 - t3) >> 10;\n v[8] = (x1 + t2) >> 10;\n v[48] = (x1 - t2) >> 10;\n v[16] = (x2 + t1) >> 10;\n v[40] = (x2 - t1) >> 10;\n v[24] = (x3 + t0) >> 10;\n v[32] = (x3 - t0) >> 10;\n }\n }\n\n for (i = 0, v = val, o = out; i < 8; ++i, v += 8, o += out_stride) {\n // no fast case since the first 1D IDCT spread components out\n STBI__IDCT_1D(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7])\n // constants scaled things up by 1<<12, plus we had 1<<2 from first\n // loop, plus horizontal and vertical each scale by sqrt(8) so together\n // we've got an extra 1<<3, so 1<<17 total we need to remove.\n // so we want to round that, which means adding 0.5 * 1<<17,\n // aka 65536. Also, we'll end up with -128 to 127 that we want\n // to encode as 0..255 by adding 128, so we'll add that before the shift\n x0 += 65536 + (128 << 17);\n x1 += 65536 + (128 << 17);\n x2 += 65536 + (128 << 17);\n x3 += 65536 + (128 << 17);\n // tried computing the shifts into temps, or'ing the temps to see\n // if any were out of range, but that was slower\n o[0] = stbi__clamp((x0 + t3) >> 17);\n o[7] = stbi__clamp((x0 - t3) >> 17);\n o[1] = stbi__clamp((x1 + t2) >> 17);\n o[6] = stbi__clamp((x1 - t2) >> 17);\n o[2] = stbi__clamp((x2 + t1) >> 17);\n o[5] = stbi__clamp((x2 - t1) >> 17);\n o[3] = stbi__clamp((x3 + t0) >> 17);\n o[4] = stbi__clamp((x3 - t0) >> 17);\n }\n}\n\n#ifdef STBI_SSE2\n// sse2 integer IDCT. not the fastest possible implementation but it\n// produces bit-identical results to the generic C version so it's\n// fully \"transparent\".\nstatic void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])\n{\n // This is constructed to match our regular (generic) integer IDCT exactly.\n __m128i row0, row1, row2, row3, row4, row5, row6, row7;\n __m128i tmp;\n\n // dot product constant: even elems=x, odd elems=y\n#define dct_const(x,y) _mm_setr_epi16((x),(y),(x),(y),(x),(y),(x),(y))\n\n // out(0) = c0[even]*x + c0[odd]*y (c0, x, y 16-bit, out 32-bit)\n // out(1) = c1[even]*x + c1[odd]*y\n#define dct_rot(out0,out1, x,y,c0,c1) \\\n __m128i c0##lo = _mm_unpacklo_epi16((x),(y)); \\\n __m128i c0##hi = _mm_unpackhi_epi16((x),(y)); \\\n __m128i out0##_l = _mm_madd_epi16(c0##lo, c0); \\\n __m128i out0##_h = _mm_madd_epi16(c0##hi, c0); \\\n __m128i out1##_l = _mm_madd_epi16(c0##lo, c1); \\\n __m128i out1##_h = _mm_madd_epi16(c0##hi, c1)\n\n // out = in << 12 (in 16-bit, out 32-bit)\n#define dct_widen(out, in) \\\n __m128i out##_l = _mm_srai_epi32(_mm_unpacklo_epi16(_mm_setzero_si128(), (in)), 4); \\\n __m128i out##_h = _mm_srai_epi32(_mm_unpackhi_epi16(_mm_setzero_si128(), (in)), 4)\n\n // wide add\n#define dct_wadd(out, a, b) \\\n __m128i out##_l = _mm_add_epi32(a##_l, b##_l); \\\n __m128i out##_h = _mm_add_epi32(a##_h, b##_h)\n\n // wide sub\n#define dct_wsub(out, a, b) \\\n __m128i out##_l = _mm_sub_epi32(a##_l, b##_l); \\\n __m128i out##_h = _mm_sub_epi32(a##_h, b##_h)\n\n // butterfly a/b, add bias, then shift by \"s\" and pack\n#define dct_bfly32o(out0, out1, a,b,bias,s) \\\n { \\\n __m128i abiased_l = _mm_add_epi32(a##_l, bias); \\\n __m128i abiased_h = _mm_add_epi32(a##_h, bias); \\\n dct_wadd(sum, abiased, b); \\\n dct_wsub(dif, abiased, b); \\\n out0 = _mm_packs_epi32(_mm_srai_epi32(sum_l, s), _mm_srai_epi32(sum_h, s)); \\\n out1 = _mm_packs_epi32(_mm_srai_epi32(dif_l, s), _mm_srai_epi32(dif_h, s)); \\\n }\n\n // 8-bit interleave step (for transposes)\n#define dct_interleave8(a, b) \\\n tmp = a; \\\n a = _mm_unpacklo_epi8(a, b); \\\n b = _mm_unpackhi_epi8(tmp, b)\n\n // 16-bit interleave step (for transposes)\n#define dct_interleave16(a, b) \\\n tmp = a; \\\n a = _mm_unpacklo_epi16(a, b); \\\n b = _mm_unpackhi_epi16(tmp, b)\n\n#define dct_pass(bias,shift) \\\n { \\\n /* even part */ \\\n dct_rot(t2e,t3e, row2,row6, rot0_0,rot0_1); \\\n __m128i sum04 = _mm_add_epi16(row0, row4); \\\n __m128i dif04 = _mm_sub_epi16(row0, row4); \\\n dct_widen(t0e, sum04); \\\n dct_widen(t1e, dif04); \\\n dct_wadd(x0, t0e, t3e); \\\n dct_wsub(x3, t0e, t3e); \\\n dct_wadd(x1, t1e, t2e); \\\n dct_wsub(x2, t1e, t2e); \\\n /* odd part */ \\\n dct_rot(y0o,y2o, row7,row3, rot2_0,rot2_1); \\\n dct_rot(y1o,y3o, row5,row1, rot3_0,rot3_1); \\\n __m128i sum17 = _mm_add_epi16(row1, row7); \\\n __m128i sum35 = _mm_add_epi16(row3, row5); \\\n dct_rot(y4o,y5o, sum17,sum35, rot1_0,rot1_1); \\\n dct_wadd(x4, y0o, y4o); \\\n dct_wadd(x5, y1o, y5o); \\\n dct_wadd(x6, y2o, y5o); \\\n dct_wadd(x7, y3o, y4o); \\\n dct_bfly32o(row0,row7, x0,x7,bias,shift); \\\n dct_bfly32o(row1,row6, x1,x6,bias,shift); \\\n dct_bfly32o(row2,row5, x2,x5,bias,shift); \\\n dct_bfly32o(row3,row4, x3,x4,bias,shift); \\\n }\n\n __m128i rot0_0 = dct_const(stbi__f2f(0.5411961f), stbi__f2f(0.5411961f) + stbi__f2f(-1.847759065f));\n __m128i rot0_1 = dct_const(stbi__f2f(0.5411961f) + stbi__f2f(0.765366865f), stbi__f2f(0.5411961f));\n __m128i rot1_0 = dct_const(stbi__f2f(1.175875602f) + stbi__f2f(-0.899976223f), stbi__f2f(1.175875602f));\n __m128i rot1_1 = dct_const(stbi__f2f(1.175875602f), stbi__f2f(1.175875602f) + stbi__f2f(-2.562915447f));\n __m128i rot2_0 = dct_const(stbi__f2f(-1.961570560f) + stbi__f2f(0.298631336f), stbi__f2f(-1.961570560f));\n __m128i rot2_1 = dct_const(stbi__f2f(-1.961570560f), stbi__f2f(-1.961570560f) + stbi__f2f(3.072711026f));\n __m128i rot3_0 = dct_const(stbi__f2f(-0.390180644f) + stbi__f2f(2.053119869f), stbi__f2f(-0.390180644f));\n __m128i rot3_1 = dct_const(stbi__f2f(-0.390180644f), stbi__f2f(-0.390180644f) + stbi__f2f(1.501321110f));\n\n // rounding biases in column/row passes, see stbi__idct_block for explanation.\n __m128i bias_0 = _mm_set1_epi32(512);\n __m128i bias_1 = _mm_set1_epi32(65536 + (128 << 17));\n\n // load\n row0 = _mm_load_si128((const __m128i *) (data + 0 * 8));\n row1 = _mm_load_si128((const __m128i *) (data + 1 * 8));\n row2 = _mm_load_si128((const __m128i *) (data + 2 * 8));\n row3 = _mm_load_si128((const __m128i *) (data + 3 * 8));\n row4 = _mm_load_si128((const __m128i *) (data + 4 * 8));\n row5 = _mm_load_si128((const __m128i *) (data + 5 * 8));\n row6 = _mm_load_si128((const __m128i *) (data + 6 * 8));\n row7 = _mm_load_si128((const __m128i *) (data + 7 * 8));\n\n // column pass\n dct_pass(bias_0, 10);\n\n {\n // 16bit 8x8 transpose pass 1\n dct_interleave16(row0, row4);\n dct_interleave16(row1, row5);\n dct_interleave16(row2, row6);\n dct_interleave16(row3, row7);\n\n // transpose pass 2\n dct_interleave16(row0, row2);\n dct_interleave16(row1, row3);\n dct_interleave16(row4, row6);\n dct_interleave16(row5, row7);\n\n // transpose pass 3\n dct_interleave16(row0, row1);\n dct_interleave16(row2, row3);\n dct_interleave16(row4, row5);\n dct_interleave16(row6, row7);\n }\n\n // row pass\n dct_pass(bias_1, 17);\n\n {\n // pack\n __m128i p0 = _mm_packus_epi16(row0, row1); // a0a1a2a3...a7b0b1b2b3...b7\n __m128i p1 = _mm_packus_epi16(row2, row3);\n __m128i p2 = _mm_packus_epi16(row4, row5);\n __m128i p3 = _mm_packus_epi16(row6, row7);\n\n // 8bit 8x8 transpose pass 1\n dct_interleave8(p0, p2); // a0e0a1e1...\n dct_interleave8(p1, p3); // c0g0c1g1...\n\n // transpose pass 2\n dct_interleave8(p0, p1); // a0c0e0g0...\n dct_interleave8(p2, p3); // b0d0f0h0...\n\n // transpose pass 3\n dct_interleave8(p0, p2); // a0b0c0d0...\n dct_interleave8(p1, p3); // a4b4c4d4...\n\n // store\n _mm_storel_epi64((__m128i *) out, p0); out += out_stride;\n _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p0, 0x4e)); out += out_stride;\n _mm_storel_epi64((__m128i *) out, p2); out += out_stride;\n _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p2, 0x4e)); out += out_stride;\n _mm_storel_epi64((__m128i *) out, p1); out += out_stride;\n _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p1, 0x4e)); out += out_stride;\n _mm_storel_epi64((__m128i *) out, p3); out += out_stride;\n _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p3, 0x4e));\n }\n\n#undef dct_const\n#undef dct_rot\n#undef dct_widen\n#undef dct_wadd\n#undef dct_wsub\n#undef dct_bfly32o\n#undef dct_interleave8\n#undef dct_interleave16\n#undef dct_pass\n}\n\n#endif // STBI_SSE2\n\n#ifdef STBI_NEON\n\n// NEON integer IDCT. should produce bit-identical\n// results to the generic C version.\nstatic void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])\n{\n int16x8_t row0, row1, row2, row3, row4, row5, row6, row7;\n\n int16x4_t rot0_0 = vdup_n_s16(stbi__f2f(0.5411961f));\n int16x4_t rot0_1 = vdup_n_s16(stbi__f2f(-1.847759065f));\n int16x4_t rot0_2 = vdup_n_s16(stbi__f2f(0.765366865f));\n int16x4_t rot1_0 = vdup_n_s16(stbi__f2f(1.175875602f));\n int16x4_t rot1_1 = vdup_n_s16(stbi__f2f(-0.899976223f));\n int16x4_t rot1_2 = vdup_n_s16(stbi__f2f(-2.562915447f));\n int16x4_t rot2_0 = vdup_n_s16(stbi__f2f(-1.961570560f));\n int16x4_t rot2_1 = vdup_n_s16(stbi__f2f(-0.390180644f));\n int16x4_t rot3_0 = vdup_n_s16(stbi__f2f(0.298631336f));\n int16x4_t rot3_1 = vdup_n_s16(stbi__f2f(2.053119869f));\n int16x4_t rot3_2 = vdup_n_s16(stbi__f2f(3.072711026f));\n int16x4_t rot3_3 = vdup_n_s16(stbi__f2f(1.501321110f));\n\n#define dct_long_mul(out, inq, coeff) \\\n int32x4_t out##_l = vmull_s16(vget_low_s16(inq), coeff); \\\n int32x4_t out##_h = vmull_s16(vget_high_s16(inq), coeff)\n\n#define dct_long_mac(out, acc, inq, coeff) \\\n int32x4_t out##_l = vmlal_s16(acc##_l, vget_low_s16(inq), coeff); \\\n int32x4_t out##_h = vmlal_s16(acc##_h, vget_high_s16(inq), coeff)\n\n#define dct_widen(out, inq) \\\n int32x4_t out##_l = vshll_n_s16(vget_low_s16(inq), 12); \\\n int32x4_t out##_h = vshll_n_s16(vget_high_s16(inq), 12)\n\n // wide add\n#define dct_wadd(out, a, b) \\\n int32x4_t out##_l = vaddq_s32(a##_l, b##_l); \\\n int32x4_t out##_h = vaddq_s32(a##_h, b##_h)\n\n // wide sub\n#define dct_wsub(out, a, b) \\\n int32x4_t out##_l = vsubq_s32(a##_l, b##_l); \\\n int32x4_t out##_h = vsubq_s32(a##_h, b##_h)\n\n // butterfly a/b, then shift using \"shiftop\" by \"s\" and pack\n#define dct_bfly32o(out0,out1, a,b,shiftop,s) \\\n { \\\n dct_wadd(sum, a, b); \\\n dct_wsub(dif, a, b); \\\n out0 = vcombine_s16(shiftop(sum_l, s), shiftop(sum_h, s)); \\\n out1 = vcombine_s16(shiftop(dif_l, s), shiftop(dif_h, s)); \\\n }\n\n#define dct_pass(shiftop, shift) \\\n { \\\n /* even part */ \\\n int16x8_t sum26 = vaddq_s16(row2, row6); \\\n dct_long_mul(p1e, sum26, rot0_0); \\\n dct_long_mac(t2e, p1e, row6, rot0_1); \\\n dct_long_mac(t3e, p1e, row2, rot0_2); \\\n int16x8_t sum04 = vaddq_s16(row0, row4); \\\n int16x8_t dif04 = vsubq_s16(row0, row4); \\\n dct_widen(t0e, sum04); \\\n dct_widen(t1e, dif04); \\\n dct_wadd(x0, t0e, t3e); \\\n dct_wsub(x3, t0e, t3e); \\\n dct_wadd(x1, t1e, t2e); \\\n dct_wsub(x2, t1e, t2e); \\\n /* odd part */ \\\n int16x8_t sum15 = vaddq_s16(row1, row5); \\\n int16x8_t sum17 = vaddq_s16(row1, row7); \\\n int16x8_t sum35 = vaddq_s16(row3, row5); \\\n int16x8_t sum37 = vaddq_s16(row3, row7); \\\n int16x8_t sumodd = vaddq_s16(sum17, sum35); \\\n dct_long_mul(p5o, sumodd, rot1_0); \\\n dct_long_mac(p1o, p5o, sum17, rot1_1); \\\n dct_long_mac(p2o, p5o, sum35, rot1_2); \\\n dct_long_mul(p3o, sum37, rot2_0); \\\n dct_long_mul(p4o, sum15, rot2_1); \\\n dct_wadd(sump13o, p1o, p3o); \\\n dct_wadd(sump24o, p2o, p4o); \\\n dct_wadd(sump23o, p2o, p3o); \\\n dct_wadd(sump14o, p1o, p4o); \\\n dct_long_mac(x4, sump13o, row7, rot3_0); \\\n dct_long_mac(x5, sump24o, row5, rot3_1); \\\n dct_long_mac(x6, sump23o, row3, rot3_2); \\\n dct_long_mac(x7, sump14o, row1, rot3_3); \\\n dct_bfly32o(row0,row7, x0,x7,shiftop,shift); \\\n dct_bfly32o(row1,row6, x1,x6,shiftop,shift); \\\n dct_bfly32o(row2,row5, x2,x5,shiftop,shift); \\\n dct_bfly32o(row3,row4, x3,x4,shiftop,shift); \\\n }\n\n // load\n row0 = vld1q_s16(data + 0 * 8);\n row1 = vld1q_s16(data + 1 * 8);\n row2 = vld1q_s16(data + 2 * 8);\n row3 = vld1q_s16(data + 3 * 8);\n row4 = vld1q_s16(data + 4 * 8);\n row5 = vld1q_s16(data + 5 * 8);\n row6 = vld1q_s16(data + 6 * 8);\n row7 = vld1q_s16(data + 7 * 8);\n\n // add DC bias\n row0 = vaddq_s16(row0, vsetq_lane_s16(1024, vdupq_n_s16(0), 0));\n\n // column pass\n dct_pass(vrshrn_n_s32, 10);\n\n // 16bit 8x8 transpose\n {\n // these three map to a single VTRN.16, VTRN.32, and VSWP, respectively.\n // whether compilers actually get this is another story, sadly.\n#define dct_trn16(x, y) { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; }\n#define dct_trn32(x, y) { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); }\n#define dct_trn64(x, y) { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); }\n\n // pass 1\n dct_trn16(row0, row1); // a0b0a2b2a4b4a6b6\n dct_trn16(row2, row3);\n dct_trn16(row4, row5);\n dct_trn16(row6, row7);\n\n // pass 2\n dct_trn32(row0, row2); // a0b0c0d0a4b4c4d4\n dct_trn32(row1, row3);\n dct_trn32(row4, row6);\n dct_trn32(row5, row7);\n\n // pass 3\n dct_trn64(row0, row4); // a0b0c0d0e0f0g0h0\n dct_trn64(row1, row5);\n dct_trn64(row2, row6);\n dct_trn64(row3, row7);\n\n#undef dct_trn16\n#undef dct_trn32\n#undef dct_trn64\n }\n\n // row pass\n // vrshrn_n_s32 only supports shifts up to 16, we need\n // 17. so do a non-rounding shift of 16 first then follow\n // up with a rounding shift by 1.\n dct_pass(vshrn_n_s32, 16);\n\n {\n // pack and round\n uint8x8_t p0 = vqrshrun_n_s16(row0, 1);\n uint8x8_t p1 = vqrshrun_n_s16(row1, 1);\n uint8x8_t p2 = vqrshrun_n_s16(row2, 1);\n uint8x8_t p3 = vqrshrun_n_s16(row3, 1);\n uint8x8_t p4 = vqrshrun_n_s16(row4, 1);\n uint8x8_t p5 = vqrshrun_n_s16(row5, 1);\n uint8x8_t p6 = vqrshrun_n_s16(row6, 1);\n uint8x8_t p7 = vqrshrun_n_s16(row7, 1);\n\n // again, these can translate into one instruction, but often don't.\n#define dct_trn8_8(x, y) { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; }\n#define dct_trn8_16(x, y) { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); }\n#define dct_trn8_32(x, y) { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); }\n\n // sadly can't use interleaved stores here since we only write\n // 8 bytes to each scan line!\n\n // 8x8 8-bit transpose pass 1\n dct_trn8_8(p0, p1);\n dct_trn8_8(p2, p3);\n dct_trn8_8(p4, p5);\n dct_trn8_8(p6, p7);\n\n // pass 2\n dct_trn8_16(p0, p2);\n dct_trn8_16(p1, p3);\n dct_trn8_16(p4, p6);\n dct_trn8_16(p5, p7);\n\n // pass 3\n dct_trn8_32(p0, p4);\n dct_trn8_32(p1, p5);\n dct_trn8_32(p2, p6);\n dct_trn8_32(p3, p7);\n\n // store\n vst1_u8(out, p0); out += out_stride;\n vst1_u8(out, p1); out += out_stride;\n vst1_u8(out, p2); out += out_stride;\n vst1_u8(out, p3); out += out_stride;\n vst1_u8(out, p4); out += out_stride;\n vst1_u8(out, p5); out += out_stride;\n vst1_u8(out, p6); out += out_stride;\n vst1_u8(out, p7);\n\n#undef dct_trn8_8\n#undef dct_trn8_16\n#undef dct_trn8_32\n }\n\n#undef dct_long_mul\n#undef dct_long_mac\n#undef dct_widen\n#undef dct_wadd\n#undef dct_wsub\n#undef dct_bfly32o\n#undef dct_pass\n}\n\n#endif // STBI_NEON\n\n#define STBI__MARKER_none 0xff\n// if there's a pending marker from the entropy stream, return that\n// otherwise, fetch from the stream and get a marker. if there's no\n// marker, return 0xff, which is never a valid marker value\nstatic stbi_uc stbi__get_marker(stbi__jpeg *j)\n{\n stbi_uc x;\n if (j->marker != STBI__MARKER_none) { x = j->marker; j->marker = STBI__MARKER_none; return x; }\n x = stbi__get8(j->s);\n if (x != 0xff) return STBI__MARKER_none;\n while (x == 0xff)\n x = stbi__get8(j->s);\n return x;\n}\n\n// in each scan, we'll have scan_n components, and the order\n// of the components is specified by order[]\n#define STBI__RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)\n\n// after a restart interval, stbi__jpeg_reset the entropy decoder and\n// the dc prediction\nstatic void stbi__jpeg_reset(stbi__jpeg *j)\n{\n j->code_bits = 0;\n j->code_buffer = 0;\n j->nomore = 0;\n j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0;\n j->marker = STBI__MARKER_none;\n j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff;\n j->eob_run = 0;\n // no more than 1<<31 MCUs if no restart_interal? that's plenty safe,\n // since we don't even allow 1<<30 pixels\n}\n\nstatic int stbi__parse_entropy_coded_data(stbi__jpeg *z)\n{\n stbi__jpeg_reset(z);\n if (!z->progressive) {\n if (z->scan_n == 1) {\n int i, j;\n STBI_SIMD_ALIGN(short, data[64]);\n int n = z->order[0];\n // non-interleaved data, we just need to process one block at a time,\n // in trivial scanline order\n // number of blocks to do just depends on how many actual \"pixels\" this\n // component has, independent of interleaved MCU blocking and such\n int w = (z->img_comp[n].x + 7) >> 3;\n int h = (z->img_comp[n].y + 7) >> 3;\n for (j = 0; j < h; ++j) {\n for (i = 0; i < w; ++i) {\n int ha = z->img_comp[n].ha;\n "}, {"path": "includes/stb_image_aug.c", "language": "code", "loc": 3334, "comment_density": 0.157, "code": "/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c\n when you control the images you're loading\n\n QUICK NOTES:\n Primarily of interest to game developers and other people who can\n avoid problematic images and only need the trivial interface\n\n JPEG baseline (no JPEG progressive, no oddball channel decimations)\n PNG non-interlaced\n BMP non-1bpp, non-RLE\n TGA (not sure what subset, if a subset)\n PSD (composited view only, no extra channels)\n HDR (radiance rgbE format)\n writes BMP,TGA (define STBI_NO_WRITE to remove code)\n decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)\n supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)\n\n TODO:\n stbi_info_*\n\n history:\n 1.16 major bugfix - convert_format converted one too many pixels\n 1.15 initialize some fields for thread safety\n 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)\n 1.13 threadsafe\n 1.12 const qualifiers in the API\n 1.11 Support installable IDCT, colorspace conversion routines\n 1.10 Fixes for 64-bit (don't use \"unsigned long\")\n optimized upsampling by Fabian \"ryg\" Giesen\n 1.09 Fix format-conversion for PSD code (bad global variables!)\n 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz\n 1.07 attempt to fix C++ warning/errors again\n 1.06 attempt to fix C++ warning/errors again\n 1.05 fix TGA loading to return correct *comp and use good luminance calc\n 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free\n 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR\n 1.02 support for (subset of) HDR files, float interface for preferred access to them\n 1.01 fix bug: possible bug in handling right-side up bmps... not sure\n fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all\n 1.00 interface to zlib that skips zlib header\n 0.99 correct handling of alpha in palette\n 0.98 TGA loader by lonesock; dynamically add loaders (untested)\n 0.97 jpeg errors on too large a file; also catch another malloc failure\n 0.96 fix detection of invalid v value - particleman@mollyrocket forum\n 0.95 during header scan, seek to markers in case of padding\n 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same\n 0.93 handle jpegtran output; verbose errors\n 0.92 read 4,8,16,24,32-bit BMP files of several formats\n 0.91 output 24-bit Windows 3.0 BMP files\n 0.90 fix a few more warnings; bump version number to approach 1.0\n 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd\n 0.60 fix compiling as c++\n 0.59 fix warnings: merge Dave Moore's -Wall fixes\n 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian\n 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less\n than 16 available\n 0.56 fix bug: zlib uncompressed mode len vs. nlen\n 0.55 fix bug: restart_interval not initialized to 0\n 0.54 allow NULL for 'int *comp'\n 0.53 fix bug in png 3->4; speedup png decoding\n 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments\n 0.51 obey req_comp requests, 1-component jpegs return as 1-component,\n on 'test' only check type, not whether we support this variant\n*/\n\n#include \"stb_image_aug.h\"\n\n#ifndef STBI_NO_HDR\n#include // ldexp\n#include // strcmp\n#endif\n\n#ifndef STBI_NO_STDIO\n#include \n#endif\n#include \n#include \n#include \n#include \n\n#ifndef _MSC_VER\n #ifdef __cplusplus\n #define __forceinline inline\n #else\n #define __forceinline\n #endif\n#endif\n\n\n// implementation:\ntypedef unsigned char uint8;\ntypedef unsigned short uint16;\ntypedef signed short int16;\ntypedef unsigned int uint32;\ntypedef signed int int32;\ntypedef unsigned int uint;\n\n// should produce compiler error if size is wrong\ntypedef unsigned char validate_uint32[sizeof(uint32)==4];\n\n#if defined(STBI_NO_STDIO) && !defined(STBI_NO_WRITE)\n#define STBI_NO_WRITE\n#endif\n\n#ifndef STBI_NO_DDS\n#include \"stbi_DDS_aug.h\"\n#endif\n\n//\tI (JLD) want full messages for SOIL\n#define STBI_FAILURE_USERMSG 1\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// Generic API that works on all image types\n//\n\n// this is not threadsafe\nstatic char *failure_reason;\n\nchar *stbi_failure_reason(void)\n{\n return failure_reason;\n}\n\nstatic int e(char *str)\n{\n failure_reason = str;\n return 0;\n}\n\n#ifdef STBI_NO_FAILURE_STRINGS\n #define e(x,y) 0\n#elif defined(STBI_FAILURE_USERMSG)\n #define e(x,y) e(y)\n#else\n #define e(x,y) e(x)\n#endif\n\n#define epf(x,y) ((float *) (e(x,y)?NULL:NULL))\n#define epuc(x,y) ((unsigned char *) (e(x,y)?NULL:NULL))\n\nvoid stbi_image_free(void *retval_from_stbi_load)\n{\n free(retval_from_stbi_load);\n}\n\n#define MAX_LOADERS 32\nstbi_loader *loaders[MAX_LOADERS];\nstatic int max_loaders = 0;\n\nint stbi_register_loader(stbi_loader *loader)\n{\n int i;\n for (i=0; i < MAX_LOADERS; ++i) {\n // already present?\n if (loaders[i] == loader)\n return 1;\n // end of the list?\n if (loaders[i] == NULL) {\n loaders[i] = loader;\n max_loaders = i+1;\n return 1;\n }\n }\n // no room for it\n return 0;\n}\n\n#ifndef STBI_NO_HDR\nstatic float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp);\nstatic stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp);\n#endif\n\n#ifndef STBI_NO_STDIO\nunsigned char *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n FILE *f = fopen(filename, \"rb\");\n unsigned char *result;\n if (!f) return epuc(\"can't fopen\", \"Unable to open file\");\n result = stbi_load_from_file(f,x,y,comp,req_comp);\n fclose(f);\n return result;\n}\n\nunsigned char *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n int i;\n if (stbi_jpeg_test_file(f))\n return stbi_jpeg_load_from_file(f,x,y,comp,req_comp);\n if (stbi_png_test_file(f))\n return stbi_png_load_from_file(f,x,y,comp,req_comp);\n if (stbi_bmp_test_file(f))\n return stbi_bmp_load_from_file(f,x,y,comp,req_comp);\n if (stbi_psd_test_file(f))\n return stbi_psd_load_from_file(f,x,y,comp,req_comp);\n #ifndef STBI_NO_DDS\n if (stbi_dds_test_file(f))\n return stbi_dds_load_from_file(f,x,y,comp,req_comp);\n #endif\n #ifndef STBI_NO_HDR\n if (stbi_hdr_test_file(f)) {\n float *hdr = stbi_hdr_load_from_file(f, x,y,comp,req_comp);\n return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);\n }\n #endif\n for (i=0; i < max_loaders; ++i)\n if (loaders[i]->test_file(f))\n return loaders[i]->load_from_file(f,x,y,comp,req_comp);\n // test tga last because it's a crappy test!\n if (stbi_tga_test_file(f))\n return stbi_tga_load_from_file(f,x,y,comp,req_comp);\n return epuc(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n#endif\n\nunsigned char *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n int i;\n if (stbi_jpeg_test_memory(buffer,len))\n return stbi_jpeg_load_from_memory(buffer,len,x,y,comp,req_comp);\n if (stbi_png_test_memory(buffer,len))\n return stbi_png_load_from_memory(buffer,len,x,y,comp,req_comp);\n if (stbi_bmp_test_memory(buffer,len))\n return stbi_bmp_load_from_memory(buffer,len,x,y,comp,req_comp);\n if (stbi_psd_test_memory(buffer,len))\n return stbi_psd_load_from_memory(buffer,len,x,y,comp,req_comp);\n #ifndef STBI_NO_DDS\n if (stbi_dds_test_memory(buffer,len))\n return stbi_dds_load_from_memory(buffer,len,x,y,comp,req_comp);\n #endif\n #ifndef STBI_NO_HDR\n if (stbi_hdr_test_memory(buffer, len)) {\n float *hdr = stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);\n return hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);\n }\n #endif\n for (i=0; i < max_loaders; ++i)\n if (loaders[i]->test_memory(buffer,len))\n return loaders[i]->load_from_memory(buffer,len,x,y,comp,req_comp);\n // test tga last because it's a crappy test!\n if (stbi_tga_test_memory(buffer,len))\n return stbi_tga_load_from_memory(buffer,len,x,y,comp,req_comp);\n return epuc(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n\n#ifndef STBI_NO_HDR\n\n#ifndef STBI_NO_STDIO\nfloat *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n FILE *f = fopen(filename, \"rb\");\n float *result;\n if (!f) return epf(\"can't fopen\", \"Unable to open file\");\n result = stbi_loadf_from_file(f,x,y,comp,req_comp);\n fclose(f);\n return result;\n}\n\nfloat *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *data;\n #ifndef STBI_NO_HDR\n if (stbi_hdr_test_file(f))\n return stbi_hdr_load_from_file(f,x,y,comp,req_comp);\n #endif\n data = stbi_load_from_file(f, x, y, comp, req_comp);\n if (data)\n return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);\n return epf(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n#endif\n\nfloat *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi_uc *data;\n #ifndef STBI_NO_HDR\n if (stbi_hdr_test_memory(buffer, len))\n return stbi_hdr_load_from_memory(buffer, len,x,y,comp,req_comp);\n #endif\n data = stbi_load_from_memory(buffer, len, x, y, comp, req_comp);\n if (data)\n return ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);\n return epf(\"unknown image type\", \"Image not of any known type, or corrupt\");\n}\n#endif\n\n// these is-hdr-or-not is defined independent of whether STBI_NO_HDR is\n// defined, for API simplicity; if STBI_NO_HDR is defined, it always\n// reports false!\n\nint stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)\n{\n #ifndef STBI_NO_HDR\n return stbi_hdr_test_memory(buffer, len);\n #else\n return 0;\n #endif\n}\n\n#ifndef STBI_NO_STDIO\nextern int stbi_is_hdr (char const *filename)\n{\n FILE *f = fopen(filename, \"rb\");\n int result=0;\n if (f) {\n result = stbi_is_hdr_from_file(f);\n fclose(f);\n }\n return result;\n}\n\nextern int stbi_is_hdr_from_file(FILE *f)\n{\n #ifndef STBI_NO_HDR\n return stbi_hdr_test_file(f);\n #else\n return 0;\n #endif\n}\n\n#endif\n\n// @TODO: get image dimensions & components without fully decoding\n#ifndef STBI_NO_STDIO\nextern int stbi_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\nextern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n#ifndef STBI_NO_HDR\nstatic float h2l_gamma_i=1.0f/2.2f, h2l_scale_i=1.0f;\nstatic float l2h_gamma=2.2f, l2h_scale=1.0f;\n\nvoid stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; }\nvoid stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; }\n\nvoid stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; }\nvoid stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; }\n#endif\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// Common code used by all image loaders\n//\n\nenum\n{\n SCAN_load=0,\n SCAN_type,\n SCAN_header,\n};\n\ntypedef struct\n{\n uint32 img_x, img_y;\n int img_n, img_out_n;\n\n #ifndef STBI_NO_STDIO\n FILE *img_file;\n #endif\n uint8 *img_buffer, *img_buffer_end;\n} stbi;\n\n#ifndef STBI_NO_STDIO\nstatic void start_file(stbi *s, FILE *f)\n{\n s->img_file = f;\n}\n#endif\n\nstatic void start_mem(stbi *s, uint8 const *buffer, int len)\n{\n#ifndef STBI_NO_STDIO\n s->img_file = NULL;\n#endif\n s->img_buffer = (uint8 *) buffer;\n s->img_buffer_end = (uint8 *) buffer+len;\n}\n\n__forceinline static int get8(stbi *s)\n{\n#ifndef STBI_NO_STDIO\n if (s->img_file) {\n int c = fgetc(s->img_file);\n return c == EOF ? 0 : c;\n }\n#endif\n if (s->img_buffer < s->img_buffer_end)\n return *s->img_buffer++;\n return 0;\n}\n\n__forceinline static int at_eof(stbi *s)\n{\n#ifndef STBI_NO_STDIO\n if (s->img_file)\n return feof(s->img_file);\n#endif\n return s->img_buffer >= s->img_buffer_end;\n}\n\n__forceinline static uint8 get8u(stbi *s)\n{\n return (uint8) get8(s);\n}\n\nstatic void skip(stbi *s, int n)\n{\n#ifndef STBI_NO_STDIO\n if (s->img_file)\n fseek(s->img_file, n, SEEK_CUR);\n else\n#endif\n s->img_buffer += n;\n}\n\nstatic int get16(stbi *s)\n{\n int z = get8(s);\n return (z << 8) + get8(s);\n}\n\nstatic uint32 get32(stbi *s)\n{\n uint32 z = get16(s);\n return (z << 16) + get16(s);\n}\n\nstatic int get16le(stbi *s)\n{\n int z = get8(s);\n return z + (get8(s) << 8);\n}\n\nstatic uint32 get32le(stbi *s)\n{\n uint32 z = get16le(s);\n return z + (get16le(s) << 16);\n}\n\nstatic void getn(stbi *s, stbi_uc *buffer, int n)\n{\n#ifndef STBI_NO_STDIO\n if (s->img_file) {\n fread(buffer, 1, n, s->img_file);\n return;\n }\n#endif\n memcpy(buffer, s->img_buffer, n);\n s->img_buffer += n;\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// generic converter from built-in img_n to req_comp\n// individual types do this automatically as much as possible (e.g. jpeg\n// does all cases internally since it needs to colorspace convert anyway,\n// and it never has alpha, so very few cases ). png can automatically\n// interleave an alpha=255 channel, but falls back to this for other cases\n//\n// assume data buffer is malloced, so malloc a new one and free that one\n// only failure mode is malloc failing\n\nstatic uint8 compute_y(int r, int g, int b)\n{\n return (uint8) (((r*77) + (g*150) + (29*b)) >> 8);\n}\n\nstatic unsigned char *convert_format(unsigned char *data, int img_n, int req_comp, uint x, uint y)\n{\n int i,j;\n unsigned char *good;\n\n if (req_comp == img_n) return data;\n assert(req_comp >= 1 && req_comp <= 4);\n\n good = (unsigned char *) malloc(req_comp * x * y);\n if (good == NULL) {\n free(data);\n return epuc(\"outofmem\", \"Out of memory\");\n }\n\n for (j=0; j < (int) y; ++j) {\n unsigned char *src = data + j * x * img_n ;\n unsigned char *dest = good + j * x * req_comp;\n\n #define COMBO(a,b) ((a)*8+(b))\n #define CASE(a,b) case COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)\n // convert source image with img_n components to one with req_comp components;\n // avoid switch per pixel, so use switch per scanline and massive macros\n switch(COMBO(img_n, req_comp)) {\n CASE(1,2) dest[0]=src[0], dest[1]=255; break;\n CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break;\n CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break;\n CASE(2,1) dest[0]=src[0]; break;\n CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break;\n CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break;\n CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break;\n CASE(3,1) dest[0]=compute_y(src[0],src[1],src[2]); break;\n CASE(3,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = 255; break;\n CASE(4,1) dest[0]=compute_y(src[0],src[1],src[2]); break;\n CASE(4,2) dest[0]=compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break;\n CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break;\n default: assert(0);\n }\n #undef CASE\n }\n\n free(data);\n return good;\n}\n\n#ifndef STBI_NO_HDR\nstatic float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp)\n{\n int i,k,n;\n float *output = (float *) malloc(x * y * comp * sizeof(float));\n if (output == NULL) { free(data); return epf(\"outofmem\", \"Out of memory\"); }\n // compute number of non-alpha components\n if (comp & 1) n = comp; else n = comp-1;\n for (i=0; i < x*y; ++i) {\n for (k=0; k < n; ++k) {\n output[i*comp + k] = (float) pow(data[i*comp+k]/255.0f, l2h_gamma) * l2h_scale;\n }\n if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f;\n }\n free(data);\n return output;\n}\n\n#define float2int(x) ((int) (x))\nstatic stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp)\n{\n int i,k,n;\n stbi_uc *output = (stbi_uc *) malloc(x * y * comp);\n if (output == NULL) { free(data); return epuc(\"outofmem\", \"Out of memory\"); }\n // compute number of non-alpha components\n if (comp & 1) n = comp; else n = comp-1;\n for (i=0; i < x*y; ++i) {\n for (k=0; k < n; ++k) {\n float z = (float) pow(data[i*comp+k]*h2l_scale_i, h2l_gamma_i) * 255 + 0.5f;\n if (z < 0) z = 0;\n if (z > 255) z = 255;\n output[i*comp + k] = float2int(z);\n }\n if (k < comp) {\n float z = data[i*comp+k] * 255 + 0.5f;\n if (z < 0) z = 0;\n if (z > 255) z = 255;\n output[i*comp + k] = float2int(z);\n }\n }\n free(data);\n return output;\n}\n#endif\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// \"baseline\" JPEG/JFIF decoder (not actually fully baseline implementation)\n//\n// simple implementation\n// - channel subsampling of at most 2 in each dimension\n// - doesn't support delayed output of y-dimension\n// - simple interface (only one output format: 8-bit interleaved RGB)\n// - doesn't try to recover corrupt jpegs\n// - doesn't allow partial loading, loading multiple at once\n// - still fast on x86 (copying globals into locals doesn't help x86)\n// - allocates lots of intermediate memory (full size of all components)\n// - non-interleaved case requires this anyway\n// - allows good upsampling (see next)\n// high-quality\n// - upsampled channels are bilinearly interpolated, even across blocks\n// - quality integer IDCT derived from IJG's 'slow'\n// performance\n// - fast huffman; reasonable integer IDCT\n// - uses a lot of intermediate memory, could cache poorly\n// - load http://nothings.org/remote/anemones.jpg 3 times on 2.8Ghz P4\n// stb_jpeg: 1.34 seconds (MSVC6, default release build)\n// stb_jpeg: 1.06 seconds (MSVC6, processor = Pentium Pro)\n// IJL11.dll: 1.08 seconds (compiled by intel)\n// IJG 1998: 0.98 seconds (MSVC6, makefile provided by IJG)\n// IJG 1998: 0.95 seconds (MSVC6, makefile + proc=PPro)\n\n// huffman decoding acceleration\n#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache\n\ntypedef struct\n{\n uint8 fast[1 << FAST_BITS];\n // weirdly, repacking this into AoS is a 10% speed loss, instead of a win\n uint16 code[256];\n uint8 values[256];\n uint8 size[257];\n unsigned int maxcode[18];\n int delta[17]; // old 'firstsymbol' - old 'firstcode'\n} huffman;\n\ntypedef struct\n{\n #if STBI_SIMD\n unsigned short dequant2[4][64];\n #endif\n stbi s;\n huffman huff_dc[4];\n huffman huff_ac[4];\n uint8 dequant[4][64];\n\n// sizes for components, interleaved MCUs\n int img_h_max, img_v_max;\n int img_mcu_x, img_mcu_y;\n int img_mcu_w, img_mcu_h;\n\n// definition of jpeg image component\n struct\n {\n int id;\n int h,v;\n int tq;\n int hd,ha;\n int dc_pred;\n\n int x,y,w2,h2;\n uint8 *data;\n void *raw_data;\n uint8 *linebuf;\n } img_comp[4];\n\n uint32 code_buffer; // jpeg entropy-coded buffer\n int code_bits; // number of valid bits\n unsigned char marker; // marker seen while filling entropy buffer\n int nomore; // flag if we saw a marker so must stop\n\n int scan_n, order[4];\n int restart_interval, todo;\n} jpeg;\n\nstatic int build_huffman(huffman *h, int *count)\n{\n int i,j,k=0,code;\n // build size list for each symbol (from JPEG spec)\n for (i=0; i < 16; ++i)\n for (j=0; j < count[i]; ++j)\n h->size[k++] = (uint8) (i+1);\n h->size[k] = 0;\n\n // compute actual symbols (from jpeg spec)\n code = 0;\n k = 0;\n for(j=1; j <= 16; ++j) {\n // compute delta to add to code to compute symbol id\n h->delta[j] = k - code;\n if (h->size[k] == j) {\n while (h->size[k] == j)\n h->code[k++] = (uint16) (code++);\n if (code-1 >= (1 << j)) return e(\"bad code lengths\",\"Corrupt JPEG\");\n }\n // compute largest code + 1 for this size, preshifted as needed later\n h->maxcode[j] = code << (16-j);\n code <<= 1;\n }\n h->maxcode[j] = 0xffffffff;\n\n // build non-spec acceleration table; 255 is flag for not-accelerated\n memset(h->fast, 255, 1 << FAST_BITS);\n for (i=0; i < k; ++i) {\n int s = h->size[i];\n if (s <= FAST_BITS) {\n int c = h->code[i] << (FAST_BITS-s);\n int m = 1 << (FAST_BITS-s);\n for (j=0; j < m; ++j) {\n h->fast[c+j] = (uint8) i;\n }\n }\n }\n return 1;\n}\n\nstatic void grow_buffer_unsafe(jpeg *j)\n{\n do {\n int b = j->nomore ? 0 : get8(&j->s);\n if (b == 0xff) {\n int c = get8(&j->s);\n if (c != 0) {\n j->marker = (unsigned char) c;\n j->nomore = 1;\n return;\n }\n }\n j->code_buffer = (j->code_buffer << 8) | b;\n j->code_bits += 8;\n } while (j->code_bits <= 24);\n}\n\n// (1 << n) - 1\nstatic uint32 bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};\n\n// decode a jpeg huffman value from the bitstream\n__forceinline static int decode(jpeg *j, huffman *h)\n{\n unsigned int temp;\n int c,k;\n\n if (j->code_bits < 16) grow_buffer_unsafe(j);\n\n // look at the top FAST_BITS and determine what symbol ID it is,\n // if the code is <= FAST_BITS\n c = (j->code_buffer >> (j->code_bits - FAST_BITS)) & ((1 << FAST_BITS)-1);\n k = h->fast[c];\n if (k < 255) {\n if (h->size[k] > j->code_bits)\n return -1;\n j->code_bits -= h->size[k];\n return h->values[k];\n }\n\n // naive test is to shift the code_buffer down so k bits are\n // valid, then test against maxcode. To speed this up, we've\n // preshifted maxcode left so that it has (16-k) 0s at the\n // end; in other words, regardless of the number of bits, it\n // wants to be compared against something shifted to have 16;\n // that way we don't need to shift inside the loop.\n if (j->code_bits < 16)\n temp = (j->code_buffer << (16 - j->code_bits)) & 0xffff;\n else\n temp = (j->code_buffer >> (j->code_bits - 16)) & 0xffff;\n for (k=FAST_BITS+1 ; ; ++k)\n if (temp < h->maxcode[k])\n break;\n if (k == 17) {\n // error! code not found\n j->code_bits -= 16;\n return -1;\n }\n\n if (k > j->code_bits)\n return -1;\n\n // convert the huffman code to the symbol id\n c = ((j->code_buffer >> (j->code_bits - k)) & bmask[k]) + h->delta[k];\n assert((((j->code_buffer) >> (j->code_bits - h->size[c])) & bmask[h->size[c]]) == h->code[c]);\n\n // convert the id to a symbol\n j->code_bits -= k;\n return h->values[c];\n}\n\n// combined JPEG 'receive' and JPEG 'extend', since baseline\n// always extends everything it receives.\n__forceinline static int extend_receive(jpeg *j, int n)\n{\n unsigned int m = 1 << (n-1);\n unsigned int k;\n if (j->code_bits < n) grow_buffer_unsafe(j);\n k = (j->code_buffer >> (j->code_bits - n)) & bmask[n];\n j->code_bits -= n;\n // the following test is probably a random branch that won't\n // predict well. I tried to table accelerate it but failed.\n // maybe it's compiling as a conditional move?\n if (k < m)\n return (-1 << n) + k + 1;\n else\n return k;\n}\n\n// given a value that's at position X in the zigzag stream,\n// where does it appear in the 8x8 matrix coded as row-major?\nstatic uint8 dezigzag[64+15] =\n{\n 0, 1, 8, 16, 9, 2, 3, 10,\n 17, 24, 32, 25, 18, 11, 4, 5,\n 12, 19, 26, 33, 40, 48, 41, 34,\n 27, 20, 13, 6, 7, 14, 21, 28,\n 35, 42, 49, 56, 57, 50, 43, 36,\n 29, 22, 15, 23, 30, 37, 44, 51,\n 58, 59, 52, 45, 38, 31, 39, 46,\n 53, 60, 61, 54, 47, 55, 62, 63,\n // let corrupt input sample past end\n 63, 63, 63, 63, 63, 63, 63, 63,\n 63, 63, 63, 63, 63, 63, 63\n};\n\n// decode one 64-entry block--\nstatic int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *hac, int b)\n{\n int diff,dc,k;\n int t = decode(j, hdc);\n if (t < 0) return e(\"bad huffman code\",\"Corrupt JPEG\");\n\n // 0 all the ac values now so we can do it 32-bits at a time\n memset(data,0,64*sizeof(data[0]));\n\n diff = t ? extend_receive(j, t) : 0;\n dc = j->img_comp[b].dc_pred + diff;\n j->img_comp[b].dc_pred = dc;\n data[0] = (short) dc;\n\n // decode AC components, see JPEG spec\n k = 1;\n do {\n int r,s;\n int rs = decode(j, hac);\n if (rs < 0) return e(\"bad huffman code\",\"Corrupt JPEG\");\n s = rs & 15;\n r = rs >> 4;\n if (s == 0) {\n if (rs != 0xf0) break; // end block\n k += 16;\n } else {\n k += r;\n // decode into unzigzag'd location\n data[dezigzag[k++]] = (short) extend_receive(j,s);\n }\n } while (k < 64);\n return 1;\n}\n\n// take a -128..127 value and clamp it and convert to 0..255\n__forceinline static uint8 clamp(int x)\n{\n x += 128;\n // trick to use a single test to catch both cases\n if ((unsigned int) x > 255) {\n if (x < 0) return 0;\n if (x > 255) return 255;\n }\n return (uint8) x;\n}\n\n#define f2f(x) (int) (((x) * 4096 + 0.5))\n#define fsh(x) ((x) << 12)\n\n// derived from jidctint -- DCT_ISLOW\n#define IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \\\n int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \\\n p2 = s2; \\\n p3 = s6; \\\n p1 = (p2+p3) * f2f(0.5411961f); \\\n t2 = p1 + p3*f2f(-1.847759065f); \\\n t3 = p1 + p2*f2f( 0.765366865f); \\\n p2 = s0; \\\n p3 = s4; \\\n t0 = fsh(p2+p3); \\\n t1 = fsh(p2-p3); \\\n x0 = t0+t3; \\\n x3 = t0-t3; \\\n x1 = t1+t2; \\\n x2 = t1-t2; \\\n t0 = s7; \\\n t1 = s5; \\\n t2 = s3; \\\n t3 = s1; \\\n p3 = t0+t2; \\\n p4 = t1+t3; \\\n p1 = t0+t3; \\\n p2 = t1+t2; \\\n p5 = (p3+p4)*f2f( 1.175875602f); \\\n t0 = t0*f2f( 0.298631336f); \\\n t1 = t1*f2f( 2.053119869f); \\\n t2 = t2*f2f( 3.072711026f); \\\n t3 = t3*f2f( 1.501321110f); \\\n p1 = p5 + p1*f2f(-0.899976223f); \\\n p2 = p5 + p2*f2f(-2.562915447f); \\\n p3 = p3*f2f(-1.961570560f); \\\n p4 = p4*f2f(-0.390180644f); \\\n t3 += p1+p4; \\\n t2 += p2+p3; \\\n t1 += p2+p4; \\\n t0 += p1+p3;\n\n#if !STBI_SIMD\n// .344 seconds on 3*anemones.jpg\nstatic void idct_block(uint8 *out, int out_stride, short data[64], uint8 *dequantize)\n{\n int i,val[64],*v=val;\n uint8 *o,*dq = dequantize;\n short *d = data;\n\n // columns\n for (i=0; i < 8; ++i,++d,++dq, ++v) {\n // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing\n if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0\n && d[40]==0 && d[48]==0 && d[56]==0) {\n // no shortcut 0 seconds\n // (1|2|3|4|5|6|7)==0 0 seconds\n // all separate -0.047 seconds\n // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds\n int dcterm = d[0] * dq[0] << 2;\n v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;\n } else {\n IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],\n d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])\n // constants scaled things up by 1<<12; let's bring them back\n // down, but keep 2 extra bits of precision\n x0 += 512; x1 += 512; x2 += 512; x3 += 512;\n v[ 0] = (x0+t3) >> 10;\n v[56] = (x0-t3) >> 10;\n v[ 8] = (x1+t2) >> 10;\n v[48] = (x1-t2) >> 10;\n v[16] = (x2+t1) >> 10;\n v[40] = (x2-t1) >> 10;\n v[24] = (x3+t0) >> 10;\n v[32] = (x3-t0) >> 10;\n }\n }\n\n for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {\n // no fast case since the first 1D IDCT spread components out\n IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])\n // constants scaled things up by 1<<12, plus we had 1<<2 from first\n // loop, plus horizontal and vertical each scale by sqrt(8) so together\n // we've got an extra 1<<3, so 1<<17 total we need to remove.\n x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;\n o[0] = clamp((x0+t3) >> 17);\n o[7] = clamp((x0-t3) >> 17);\n o[1] = clamp((x1+t2) >> 17);\n o[6] = clamp((x1-t2) >> 17);\n o[2] = clamp((x2+t1) >> 17);\n o[5] = clamp((x2-t1) >> 17);\n o[3] = clamp((x3+t0) >> 17);\n o[4] = clamp((x3-t0) >> 17);\n }\n}\n#else\nstatic void idct_block(uint8 *out, int out_stride, short data[64], unsigned short *dequantize)\n{\n int i,val[64],*v=val;\n uint8 *o;\n unsigned short *dq = dequantize;\n short *d = data;\n\n // columns\n for (i=0; i < 8; ++i,++d,++dq, ++v) {\n // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing\n if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0\n && d[40]==0 && d[48]==0 && d[56]==0) {\n // no shortcut 0 seconds\n // (1|2|3|4|5|6|7)==0 0 seconds\n // all separate -0.047 seconds\n // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds\n int dcterm = d[0] * dq[0] << 2;\n v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;\n } else {\n IDCT_1D(d[ 0]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],\n d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[56])\n // constants scaled things up by 1<<12; let's bring them back\n // down, but keep 2 extra bits of precision\n x0 += 512; x1 += 512; x2 += 512; x3 += 512;\n v[ 0] = (x0+t3) >> 10;\n v[56] = (x0-t3) >> 10;\n v[ 8] = (x1+t2) >> 10;\n v[48] = (x1-t2) >> 10;\n v[16] = (x2+t1) >> 10;\n v[40] = (x2-t1) >> 10;\n v[24] = (x3+t0) >> 10;\n v[32] = (x3-t0) >> 10;\n }\n }\n\n for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {\n // no fast case since the first 1D IDCT spread components out\n IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])\n // constants scaled things up by 1<<12, plus we had 1<<2 from first\n // loop, plus horizontal and vertical each scale by sqrt(8) so together\n // we've got an extra 1<<3, so 1<<17 total we need to remove.\n x0 += 65536; x1 += 65536; x2 += 65536; x3 += 65536;\n o[0] = clamp((x0+t3) >> 17);\n o[7] = clamp((x0-t3) >> 17);\n o[1] = clamp((x1+t2) >> 17);\n o[6] = clamp((x1-t2) >> 17);\n o[2] = clamp((x2+t1) >> 17);\n o[5] = clamp((x2-t1) >> 17);\n o[3] = clamp((x3+t0) >> 17);\n o[4] = clamp((x3-t0) >> 17);\n }\n}\nstatic stbi_idct_8x8 stbi_idct_installed = idct_block;\n\nextern void stbi_install_idct(stbi_idct_8x8 func)\n{\n stbi_idct_installed = func;\n}\n#endif\n\n#define MARKER_none 0xff\n// if there's a pending marker from the entropy stream, return that\n// otherwise, fetch from the stream and get a marker. if there's no\n// marker, return 0xff, which is never a valid marker value\nstatic uint8 get_marker(jpeg *j)\n{\n uint8 x;\n if (j->marker != MARKER_none) { x = j->marker; j->marker = MARKER_none; return x; }\n x = get8u(&j->s);\n if (x != 0xff) return MARKER_none;\n while (x == 0xff)\n x = get8u(&j->s);\n return x;\n}\n\n// in each scan, we'll have scan_n components, and the order\n// of the components is specified by order[]\n#define RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)\n\n// after a restart interval, reset the entropy decoder and\n// the dc prediction\nstatic void reset(jpeg *j)\n{\n j->code_bits = 0;\n j->code_buffer = 0;\n j->nomore = 0;\n j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0;\n j->marker = MARKER_none;\n j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff;\n // no more than 1<<31 MCUs if no restart_interal? that's plenty safe,\n // since we don't even allow 1<<30 pixels\n}\n\nstatic int parse_entropy_coded_data(jpeg *z)\n{\n reset(z);\n if (z->scan_n == 1) {\n int i,j;\n #if STBI_SIMD\n __declspec(align(16))\n #endif\n short data[64];\n int n = z->order[0];\n // non-interleaved data, we just need to process one block at a time,\n // in trivial scanline order\n // number of blocks to do just depends on how many actual \"pixels\" this\n // component has, independent of interleaved MCU blocking and such\n int w = (z->img_comp[n].x+7) >> 3;\n int h = (z->img_comp[n].y+7) >> 3;\n for (j=0; j < h; ++j) {\n for (i=0; i < w; ++i) {\n if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;\n #if STBI_SIMD\n stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);\n #else\n idct_block(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);\n #endif\n // every data block is an MCU, so countdown the restart interval\n if (--z->todo <= 0) {\n if (z->code_bits < 24) grow_buffer_unsafe(z);\n // if it's NOT a restart, then just bail, so we get corrupt data\n // rather than no data\n if (!RESTART(z->marker)) return 1;\n reset(z);\n }\n }\n }\n } else { // interleaved!\n int i,j,k,x,y;\n short data[64];\n for (j=0; j < z->img_mcu_y; ++j) {\n for (i=0; i < z->img_mcu_x; ++i) {\n // scan an interleaved mcu... process scan_n components in order\n for (k=0; k < z->scan_n; ++k) {\n int n = z->order[k];\n // scan out an mcu's worth of this component; that's just determined\n // by the basic H and V specified for the component\n for (y=0; y < z->img_comp[n].v; ++y) {\n for (x=0; x < z->img_comp[n].h; ++x) {\n int x2 = (i*z->img_comp[n].h + x)*8;\n int y2 = (j*z->img_comp[n].v + y)*8;\n if (!decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+z->img_comp[n].ha, n)) return 0;\n #if STBI_SIMD\n stbi_idct_installed(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant2[z->img_comp[n].tq]);\n #else\n idct_block(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data, z->dequant[z->img_comp[n].tq]);\n #endif\n }\n }\n }\n // after all interleaved components, that's an interleaved MCU,\n // so now count down the restart interval\n if (--z->todo <= 0) {\n if (z->code_bits < 24) grow_buffer_unsafe(z);\n // if it's NOT a restart, then just bail, so we get corrupt data\n // rather than no data\n if (!RESTART(z->marker)) return 1;\n reset(z);\n }\n }\n }\n }\n return 1;\n}\n\nstatic int process_marker(jpeg *z, int m)\n{\n int L;\n switch (m) {\n case MARKER_none: // no marker found\n return e(\"expected marker\",\"Corrupt JPEG\");\n\n case 0xC2: // SOF - progressive\n return e(\"progressive jpeg\",\"JPEG format not supported (progressive)\");\n\n case 0xDD: // DRI - specify restart interval\n if (get16(&z->s) != 4) return e(\"bad DRI len\",\"Corrupt JPEG\");\n z->restart_interval = get16(&z->s);\n return 1;\n\n case 0xDB: // DQT - define quantization table\n L = get16(&z->s)-2;\n while (L > 0) {\n int q = get8(&z->s);\n int p = q >> 4;\n int t = q & 15,i;\n if (p != 0) return e(\"bad DQT type\",\"Corrupt JPEG\");\n if (t > 3) return e(\"bad DQT table\",\"Corrupt JPEG\");\n for (i=0; i < 64; ++i)\n z->dequant[t][dezigzag[i]] = get8u(&z->s);\n #if STBI_SIMD\n for (i=0; i < 64; ++i)\n z->dequant2[t][i] = dequant[t][i];\n #endif\n L -= 65;\n }\n return L==0;\n\n case 0xC4: // DHT - define huffman table\n L = get16(&z->s)-2;\n while (L > 0) {\n uint8 *v;\n int sizes[16],i,m=0;\n int q = get8(&z->s);\n int tc = q >> 4;\n int th = q & 15;\n if (tc > 1 || th > 3) return e(\"bad DHT header\",\"Corrupt JPEG\");\n for (i=0; i < 16; ++i) {\n sizes[i] = get8(&z->s);\n m += sizes[i];\n }\n L -= 17;\n if (tc == 0) {\n if (!build_huffman(z->huff_dc+th, sizes)) return 0;\n v = z->huff_dc[th].values;\n } else {\n if (!build_huffman(z->huff_ac+th, sizes)) return 0;\n v = z->huff_ac[th].values;\n }\n for (i=0; i < m; ++i)\n v[i] = get8u(&z->s);\n L -= m;\n }\n return L==0;\n }\n // check for comment block or APP blocks\n if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) {\n skip(&z->s, get16(&z->s)-2);\n return 1;\n }\n return 0;\n}\n\n// after we see SOS\nstatic int process_scan_header(jpeg *z)\n{\n int i;\n int Ls = get16(&z->s);\n z->scan_n = get8(&z->s);\n if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s.img_n) return e(\"bad SOS component count\",\"Corrupt JPEG\");\n if (Ls != 6+2*z->scan_n) return e(\"bad SOS len\",\"Corrupt JPEG\");\n for (i=0; i < z->scan_n; ++i) {\n int id = get8(&z->s), which;\n int q = get8(&z->s);\n for (which = 0; which < z->s.img_n; ++which)\n if (z->img_comp[which].id == id)\n break;\n if (which == z->s.img_n) return 0;\n z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return e(\"bad DC huff\",\"Corrupt JPEG\");\n z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return e(\"bad AC huff\",\"Corrupt JPEG\");\n z->order[i] = which;\n }\n if (get8(&z->s) != 0) return e(\"bad SOS\",\"Corrupt JPEG\");\n get8(&z->s); // should be 63, but might be 0\n if (get8(&z->s) != 0) return e(\"bad SOS\",\"Corrupt JPEG\");\n\n return 1;\n}\n\nstatic int process_frame_header(jpeg *z, int scan)\n{\n stbi *s = &z->s;\n int Lf,p,i,q, h_max=1,v_max=1,c;\n Lf = get16(s); if (Lf < 11) return e(\"bad SOF len\",\"Corrupt JPEG\"); // JPEG\n p = get8(s); if (p != 8) return e(\"only 8-bit\",\"JPEG format not supported: 8-bit only\"); // JPEG baseline\n s->img_y = get16(s); if (s->img_y == 0) return e(\"no header height\", \"JPEG format not supported: delayed height\"); // Legal, but we don't handle it--but neither does IJG\n s->img_x = get16(s); if (s->img_x == 0) return e(\"0 width\",\"Corrupt JPEG\"); // JPEG requires\n c = get8(s);\n if (c != 3 && c != 1) return e(\"bad component count\",\"Corrupt JPEG\"); // JFIF requires\n s->img_n = c;\n for (i=0; i < c; ++i) {\n z->img_comp[i].data = NULL;\n z->img_comp[i].linebuf = NULL;\n }\n\n if (Lf != 8+3*s->img_n) return e(\"bad SOF len\",\"Corrupt JPEG\");\n\n for (i=0; i < s->img_n; ++i) {\n z->img_comp[i].id = get8(s);\n if (z->img_comp[i].id != i+1) // JFIF requires\n if (z->img_comp[i].id != i) // some version of jpegtran outputs non-JFIF-compliant files!\n return e(\"bad component ID\",\"Corrupt JPEG\");\n q = get8(s);\n z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return e(\"bad H\",\"Corrupt JPEG\");\n z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return e(\"bad V\",\"Corrupt JPEG\");\n z->img_comp[i].tq = get8(s); if (z->img_comp[i].tq > 3) return e(\"bad TQ\",\"Corrupt JPEG\");\n }\n\n if (scan != SCAN_load) return 1;\n\n if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e(\"too large\", \"Image too large to decode\");\n\n for (i=0; i < s->img_n; ++i) {\n if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h;\n if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v;\n }\n\n // compute interleaved mcu info\n z->img_h_max = h_max;\n z->img_v_max = v_max;\n z->img_mcu_w = h_max * 8;\n z->img_mcu_h = v_max * 8;\n z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w;\n z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h;\n\n for (i=0; i < s->img_n; ++i) {\n // number of effective pixels (e.g. for non-interleaved MCU)\n z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max;\n z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max;\n // to simplify generation, we'll allocate enough memory to decode\n // the bogus oversized data from using interleaved MCUs and their\n // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't\n // discard the extra data until colorspace conversion\n z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;\n z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;\n z->img_comp[i].raw_data = malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15);\n if (z->img_comp[i].raw_data == NULL) {\n for(--i; i >= 0; --i) {\n free(z->img_comp[i].raw_data);\n z->img_comp[i].data = NULL;\n }\n return e(\"outofmem\", \"Out of memory\");\n }\n // align blocks for installable-idct using mmx/sse\n z->img_comp[i].data = (uint8*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);\n z->img_comp[i].linebuf = NULL;\n }\n\n return 1;\n}\n\n// use comparisons since in some cases we handle more than one case (e.g. SOF)\n#define DNL(x) ((x) == 0xdc)\n#define SOI(x) ((x) == 0xd8)\n#define EOI(x) ((x) == 0xd9)\n#define SOF(x) ((x) == 0xc0 || (x) == 0xc1)\n#define SOS(x) ((x) == 0xda)\n\nstatic int decode_jpeg_header(jpeg *z, int scan)\n{\n int m;\n z->marker = MARKER_none; // initialize cached marker to empty\n m = get_marker(z);\n if (!SOI(m)) return e(\"no SOI\",\"Corrupt JPEG\");\n if (scan == SCAN_type) return 1;\n m = get_marker(z);\n while (!SOF(m)) {\n if (!process_marker(z,m)) return 0;\n m = get_marker(z);\n while (m == MARKER_none) {\n // some files have extra padding after their blocks, so ok, we'll scan\n if (at_eof(&z->s)) return e(\"no SOF\", \"Corrupt JPEG\");\n m = get_marker(z);\n }\n }\n if (!process_frame_header(z, scan)) return 0;\n return 1;\n}\n\nstatic int decode_jpeg_image(jpeg *j)\n{\n int m;\n j->restart_interval = 0;\n if (!decode_jpeg_header(j, SCAN_load)) return 0;\n m = get_marker(j);\n while (!EOI(m)) {\n if (SOS(m)) {\n if (!process_scan_header(j)) return 0;\n if (!parse_entropy_coded_data(j)) return 0;\n } else {\n if (!process_marker(j, m)) return 0;\n }\n m = get_marker(j);\n }\n return 1;\n}\n\n// static jfif-centered resampling (across block boundaries)\n\ntypedef uint8 *(*resample_row_func)(uint8 *out, uint8 *in0, uint8 *in1,\n int w, int hs);\n\n#define div4(x) ((uint8) ((x) >> 2))\n\nstatic uint8 *resample_row_1(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n return in_near;\n}\n\nstatic uint8* resample_row_v_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n // need to generate two samples vertically for every one in input\n int i;\n for (i=0; i < w; ++i)\n out[i] = div4(3*in_near[i] + in_far[i] + 2);\n return out;\n}\n\nstatic uint8* resample_row_h_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n // need to generate two samples horizontally for every one in input\n int i;\n uint8 *input = in_near;\n if (w == 1) {\n // if only one sample, can't do any interpolation\n out[0] = out[1] = input[0];\n return out;\n }\n\n out[0] = input[0];\n out[1] = div4(input[0]*3 + input[1] + 2);\n for (i=1; i < w-1; ++i) {\n int n = 3*input[i]+2;\n out[i*2+0] = div4(n+input[i-1]);\n out[i*2+1] = div4(n+input[i+1]);\n }\n out[i*2+0] = div4(input[w-2]*3 + input[w-1] + 2);\n out[i*2+1] = input[w-1];\n return out;\n}\n\n#define div16(x) ((uint8) ((x) >> 4))\n\nstatic uint8 *resample_row_hv_2(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n // need to generate 2x2 samples for every one in input\n int i,t0,t1;\n if (w == 1) {\n out[0] = out[1] = div4(3*in_near[0] + in_far[0] + 2);\n return out;\n }\n\n t1 = 3*in_near[0] + in_far[0];\n out[0] = div4(t1+2);\n for (i=1; i < w; ++i) {\n t0 = t1;\n t1 = 3*in_near[i]+in_far[i];\n out[i*2-1] = div16(3*t0 + t1 + 8);\n out[i*2 ] = div16(3*t1 + t0 + 8);\n }\n out[w*2-1] = div4(t1+2);\n return out;\n}\n\nstatic uint8 *resample_row_generic(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)\n{\n // resample with nearest-neighbor\n int i,j;\n for (i=0; i < w; ++i)\n for (j=0; j < hs; ++j)\n out[i*hs+j] = in_near[i];\n return out;\n}\n\n#define float2fixed(x) ((int) ((x) * 65536 + 0.5))\n\n// 0.38 seconds on 3*anemones.jpg (0.25 with processor = Pro)\n// VC6 without processor=Pro is generating multiple LEAs per multiply!\nstatic void YCbCr_to_RGB_row(uint8 *out, uint8 *y, uint8 *pcb, uint8 *pcr, int count, int step)\n{\n int i;\n for (i=0; i < count; ++i) {\n int y_fixed = (y[i] << 16) + 32768; // rounding\n int r,g,b;\n int cr = pcr[i] - 128;\n int cb = pcb[i] - 128;\n r = y_fixed + cr*float2fixed(1.40200f);\n g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f);\n b = y_fixed + cb*float2fixed(1.77200f);\n r >>= 16;\n g >>= 16;\n b >>= 16;\n if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; }\n if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; }\n if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; }\n out[0] = (uint8)r;\n out[1] = (uint8)g;\n out[2] = (uint8)b;\n out[3] = 255;\n out += step;\n }\n}\n\n#if STBI_SIMD\nstatic stbi_YCbCr_to_RGB_run stbi_YCbCr_installed = YCbCr_to_RGB_row;\n\nvoid stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func)\n{\n stbi_YCbCr_installed = func;\n}\n#endif\n\n\n// clean up the temporary component buffers\nstatic void cleanup_jpeg(jpeg *j)\n{\n int i;\n for (i=0; i < j->s.img_n; ++i) {\n if (j->img_comp[i].data) {\n free(j->img_comp[i].raw_data);\n j->img_comp[i].data = NULL;\n }\n if (j->img_comp[i].linebuf) {\n free(j->img_comp[i].linebuf);\n j->img_comp[i].linebuf = NULL;\n }\n }\n}\n\ntypedef struct\n{\n resample_row_func resample;\n uint8 *line0,*line1;\n int hs,vs; // expansion factor in each axis\n int w_lores; // horizontal pixels pre-expansion\n int ystep; // how far through vertical expansion we are\n int ypos; // which pre-expansion row we're on\n} stbi_resample;\n\nstatic uint8 *load_jpeg_image(jpeg *z, int *out_x, int *out_y, int *comp, int req_comp)\n{\n int n, decode_n;\n // validate req_comp\n if (req_comp < 0 || req_comp > 4) return epuc(\"bad req_comp\", \"Internal error\");\n z->s.img_n = 0;\n\n // load a jpeg image from whichever source\n if (!decode_jpeg_image(z)) { cleanup_jpeg(z); return NULL; }\n\n // determine actual number of components to generate\n n = req_comp ? req_comp : z->s.img_n;\n\n if (z->s.img_n == 3 && n < 3)\n decode_n = 1;\n else\n decode_n = z->s.img_n;\n\n // resample and color-convert\n {\n int k;\n uint i,j;\n uint8 *output;\n uint8 *coutput[4];\n\n stbi_resample res_comp[4];\n\n for (k=0; k < decode_n; ++k) {\n stbi_resample *r = &res_comp[k];\n\n // allocate line buffer big enough for upsampling off the edges\n // with upsample factor of 4\n z->img_comp[k].linebuf = (uint8 *) malloc(z->s.img_x + 3);\n if (!z->img_comp[k].linebuf) { cleanup_jpeg(z); return epuc(\"outofmem\", \"Out of memory\"); }\n\n r->hs = z->img_h_max / z->img_comp[k].h;\n r->vs = z->img_v_max / z->img_comp[k].v;\n r->ystep = r->vs >> 1;\n r->w_lores = (z->s.img_x + r->hs-1) / r->hs;\n r->ypos = 0;\n r->line0 = r->line1 = z->img_comp[k].data;\n\n if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1;\n else if (r->hs == 1 && r->vs == 2) r->resample = resample_row_v_2;\n else if (r->hs == 2 && r->vs == 1) r->resample = resample_row_h_2;\n else if (r->hs == 2 && r->vs == 2) r->resample = resample_row_hv_2;\n else r->resample = resample_row_generic;\n }\n\n // can't error after this so, this is safe\n output = (uint8 *) malloc(n * z->s.img_x * z->s.img_y + 1);\n if (!output) { cleanup_jpeg(z); return epuc(\"outofmem\", \"Out of memory\"); }\n\n // now go ahead and resample\n for (j=0; j < z->s.img_y; ++j) {\n uint8 *out = output + n * z->s.img_x * j;\n for (k=0; k < decode_n; ++k) {\n stbi_resample *r = &res_comp[k];\n int y_bot = r->ystep >= (r->vs >> 1);\n coutput[k] = r->resample(z->img_comp[k].linebuf,\n y_bot ? r->line1 : r->line0,\n y_bot ? r->line0 : r->line1,\n r->w_lores, r->hs);\n if (++r->ystep >= r->vs) {\n r->ystep = 0;\n r->line0 = r->line1;\n if (++r->ypos < z->img_comp[k].y)\n r->line1 += z->img_comp[k].w2;\n }\n }\n if (n >= 3) {\n uint8 *y = coutput[0];\n if (z->s.img_n == 3) {\n #if STBI_SIMD\n stbi_YCbCr_installed(out, y, coutput[1], coutput[2], z->s.img_x, n);\n #else\n YCbCr_to_RGB_row(out, y, coutput[1], coutput[2], z->s.img_x, n);\n #endif\n } else\n for (i=0; i < z->s.img_x; ++i) {\n out[0] = out[1] = out[2] = y[i];\n out[3] = 255; // not used if n==3\n out += n;\n }\n } else {\n uint8 *y = coutput[0];\n if (n == 1)\n for (i=0; i < z->s.img_x; ++i) out[i] = y[i];\n else\n for (i=0; i < z->s.img_x; ++i) *out++ = y[i], *out++ = 255;\n }\n }\n cleanup_jpeg(z);\n *out_x = z->s.img_x;\n *out_y = z->s.img_y;\n if (comp) *comp = z->s.img_n; // report original components, not output\n return output;\n }\n}\n\n#ifndef STBI_NO_STDIO\nunsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n jpeg j;\n start_file(&j.s, f);\n return load_jpeg_image(&j, x,y,comp,req_comp);\n}\n\nunsigned char *stbi_jpeg_load(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *data;\n FILE *f = fopen(filename, \"rb\");\n if (!f) return NULL;\n data = stbi_jpeg_load_from_file(f,x,y,comp,req_comp);\n fclose(f);\n return data;\n}\n#endif\n\nunsigned char *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n jpeg j;\n start_mem(&j.s, buffer,len);\n return load_jpeg_image(&j, x,y,comp,req_comp);\n}\n\n#ifndef STBI_NO_STDIO\nint stbi_jpeg_test_file(FILE *f)\n{\n int n,r;\n jpeg j;\n n = ftell(f);\n start_file(&j.s, f);\n r = decode_jpeg_header(&j, SCAN_type);\n fseek(f,n,SEEK_SET);\n return r;\n}\n#endif\n\nint stbi_jpeg_test_memory(stbi_uc const *buffer, int len)\n{\n jpeg j;\n start_mem(&j.s, buffer,len);\n return decode_jpeg_header(&j, SCAN_type);\n}\n\n// @TODO:\n#ifndef STBI_NO_STDIO\nextern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\nextern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n// public domain zlib decode v0.2 Sean Barrett 2006-11-18\n// simple implementation\n// - all input must be provided in an upfront buffer\n// - all output is written to a single output buffer (can malloc/realloc)\n// performance\n// - fast huffman\n\n// fast-way is faster to check than jpeg huffman, but slow way is slower\n#define ZFAST_BITS 9 // accelerate all cases in default tables\n#define ZFAST_MASK ((1 << ZFAST_BITS) - 1)\n\n// zlib-style huffman encoding\n// (jpegs packs from left, zlib from right, so can't share code)\ntypedef struct\n{\n uint16 fast[1 << ZFAST_BITS];\n uint16 firstcode[16];\n int maxcode[17];\n uint16 firstsymbol[16];\n uint8 size[288];\n uint16 value[288];\n} zhuffman;\n\n__forceinline static int bitreverse16(int n)\n{\n n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1);\n n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2);\n n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4);\n n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8);\n return n;\n}\n\n__forceinline static int bit_reverse(int v, int bits)\n{\n assert(bits <= 16);\n // to bit reverse n bits, reverse 16 and shift\n // e.g. 11 bits, bit reverse and shift away 5\n return bitreverse16(v) >> (16-bits);\n}\n\nstatic int zbuild_huffman(zhuffman *z, uint8 *sizelist, int num)\n{\n int i,k=0;\n int code, next_code[16], sizes[17];\n\n // DEFLATE spec for generating codes\n memset(sizes, 0, sizeof(sizes));\n memset(z->fast, 255, sizeof(z->fast));\n for (i=0; i < num; ++i)\n ++sizes[sizelist[i]];\n sizes[0] = 0;\n for (i=1; i < 16; ++i)\n assert(sizes[i] <= (1 << i));\n code = 0;\n for (i=1; i < 16; ++i) {\n next_code[i] = code;\n z->firstcode[i] = (uint16) code;\n z->firstsymbol[i] = (uint16) k;\n code = (code + sizes[i]);\n if (sizes[i])\n if (code-1 >= (1 << i)) return e(\"bad codelengths\",\"Corrupt JPEG\");\n z->maxcode[i] = code << (16-i); // preshift for inner loop\n code <<= 1;\n k += sizes[i];\n }\n z->maxcode[16] = 0x10000; // sentinel\n for (i=0; i < num; ++i) {\n int s = sizelist[i];\n if (s) {\n int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s];\n z->size[c] = (uint8)s;\n z->value[c] = (uint16)i;\n if (s <= ZFAST_BITS) {\n int k = bit_reverse(next_code[s],s);\n while (k < (1 << ZFAST_BITS)) {\n z->fast[k] = (uint16) c;\n k += (1 << s);\n }\n }\n ++next_code[s];\n }\n }\n return 1;\n}\n\n// zlib-from-memory implementation for PNG reading\n// because PNG allows splitting the zlib stream arbitrarily,\n// and it's annoying structurally to have PNG call ZLIB call PNG,\n// we require PNG read all the IDATs and combine them into a single\n// memory buffer\n\ntypedef struct\n{\n uint8 *zbuffer, *zbuffer_end;\n int num_bits;\n uint32 code_buffer;\n\n char *zout;\n char *zout_start;\n char *zout_end;\n int z_expandable;\n\n zhuffman z_length, z_distance;\n} zbuf;\n\n__forceinline static int zget8(zbuf *z)\n{\n if (z->zbuffer >= z->zbuffer_end) return 0;\n return *z->zbuffer++;\n}\n\nstatic void fill_bits(zbuf *z)\n{\n do {\n assert(z->code_buffer < (1U << z->num_bits));\n z->code_buffer |= zget8(z) << z->num_bits;\n z->num_bits += 8;\n } while (z->num_bits <= 24);\n}\n\n__forceinline static unsigned int zreceive(zbuf *z, int n)\n{\n unsigned int k;\n if (z->num_bits < n) fill_bits(z);\n k = z->code_buffer & ((1 << n) - 1);\n z->code_buffer >>= n;\n z->num_bits -= n;\n return k;\n}\n\n__forceinline static int zhuffman_decode(zbuf *a, zhuffman *z)\n{\n int b,s,k;\n if (a->num_bits < 16) fill_bits(a);\n b = z->fast[a->code_buffer & ZFAST_MASK];\n if (b < 0xffff) {\n s = z->size[b];\n a->code_buffer >>= s;\n a->num_bits -= s;\n return z->value[b];\n }\n\n // not resolved by fast table, so compute it the slow way\n // use jpeg approach, which requires MSbits at top\n k = bit_reverse(a->code_buffer, 16);\n for (s=ZFAST_BITS+1; ; ++s)\n if (k < z->maxcode[s])\n break;\n if (s == 16) return -1; // invalid code!\n // code size is s, so:\n b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];\n assert(z->size[b] == s);\n a->code_buffer >>= s;\n a->num_bits -= s;\n return z->value[b];\n}\n\nstatic int expand(zbuf *z, int n) // need to make room for n bytes\n{\n char *q;\n int cur, limit;\n if (!z->z_expandable) return e(\"output buffer limit\",\"Corrupt PNG\");\n cur = (int) (z->zout - z->zout_start);\n limit = (int) (z->zout_end - z->zout_start);\n while (cur + n > limit)\n limit *= 2;\n q = (char *) realloc(z->zout_start, limit);\n if (q == NULL) return e(\"outofmem\", \"Out of memory\");\n z->zout_start = q;\n z->zout = q + cur;\n z->zout_end = q + limit;\n return 1;\n}\n\nstatic int length_base[31] = {\n 3,4,5,6,7,8,9,10,11,13,\n 15,17,19,23,27,31,35,43,51,59,\n 67,83,99,115,131,163,195,227,258,0,0 };\n\nstatic int length_extra[31]=\n{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 };\n\nstatic int dist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,\n257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0};\n\nstatic int dist_extra[32] =\n{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};\n\nstatic int parse_huffman_block(zbuf *a)\n{\n for(;;) {\n int z = zhuffman_decode(a, &a->z_length);\n if (z < 256) {\n if (z < 0) return e(\"bad huffman code\",\"Corrupt PNG\"); // error in huffman codes\n if (a->zout >= a->zout_end) if (!expand(a, 1)) return 0;\n *a->zout++ = (char) z;\n } else {\n uint8 *p;\n int len,dist;\n if (z == 256) return 1;\n z -= 257;\n len = length_base[z];\n if (length_extra[z]) len += zreceive(a, length_extra[z]);\n z = zhuffman_decode(a, &a->z_distance);\n if (z < 0) return e(\"bad huffman code\",\"Corrupt PNG\");\n dist = dist_base[z];\n if (dist_extra[z]) dist += zreceive(a, dist_extra[z]);\n if (a->zout - a->zout_start < dist) return e(\"bad dist\",\"Corrupt PNG\");\n if (a->zout + len > a->zout_end) if (!expand(a, len)) return 0;\n p = (uint8 *) (a->zout - dist);\n while (len--)\n *a->zout++ = *p++;\n }\n }\n}\n\nstatic int compute_huffman_codes(zbuf *a)\n{\n static uint8 length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };\n static zhuffman z_codelength; // static just to save stack space\n uint8 lencodes[286+32+137];//padding for maximum single op\n uint8 codelength_sizes[19];\n int i,n;\n\n int hlit = zreceive(a,5) + 257;\n int hdist = zreceive(a,5) + 1;\n int hclen = zreceive(a,4) + 4;\n\n memset(codelength_sizes, 0, sizeof(codelength_sizes));\n for (i=0; i < hclen; ++i) {\n int s = zreceive(a,3);\n codelength_sizes[length_dezigzag[i]] = (uint8) s;\n }\n if (!zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0;\n\n n = 0;\n while (n < hlit + hdist) {\n int c = zhuffman_decode(a, &z_codelength);\n assert(c >= 0 && c < 19);\n if (c < 16)\n lencodes[n++] = (uint8) c;\n else if (c == 16) {\n c = zreceive(a,2)+3;\n memset(lencodes+n, lencodes[n-1], c);\n n += c;\n } else if (c == 17) {\n c = zreceive(a,3)+3;\n memset(lencodes+n, 0, c);\n n += c;\n } else {\n assert(c == 18);\n c = zreceive(a,7)+11;\n memset(lencodes+n, 0, c);\n n += c;\n }\n }\n if (n != hlit+hdist) return e(\"bad codelengths\",\"Corrupt PNG\");\n if (!zbuild_huffman(&a->z_length, lencodes, hlit)) return 0;\n if (!zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0;\n return 1;\n}\n\nstatic int parse_uncompressed_block(zbuf *a)\n{\n uint8 header[4];\n int len,nlen,k;\n if (a->num_bits & 7)\n zreceive(a, a->num_bits & 7); // discard\n // drain the bit-packed data into header\n k = 0;\n while (a->num_bits > 0) {\n header[k++] = (uint8) (a->code_buffer & 255); // wtf this warns?\n a->code_buffer >>= 8;\n a->num_bits -= 8;\n }\n assert(a->num_bits == 0);\n // now fill header the normal way\n while (k < 4)\n header[k++] = (uint8) zget8(a);\n len = header[1] * 256 + header[0];\n nlen = header[3] * 256 + header[2];\n if (nlen != (len ^ 0xffff)) return e(\"zlib corrupt\",\"Corrupt PNG\");\n if (a->zbuffer + len > a->zbuffer_end) return e(\"read past buffer\",\"Corrupt PNG\");\n if (a->zout + len > a->zout_end)\n if (!expand(a, len)) return 0;\n memcpy(a->zout, a->zbuffer, len);\n a->zbuffer += len;\n a->zout += len;\n return 1;\n}\n\nstatic int parse_zlib_header(zbuf *a)\n{\n int cmf = zget8(a);\n int cm = cmf & 15;\n /* int cinfo = cmf >> 4; */\n int flg = zget8(a);\n if ((cmf*256+flg) % 31 != 0) return e(\"bad zlib header\",\"Corrupt PNG\"); // zlib spec\n if (flg & 32) return e(\"no preset dict\",\"Corrupt PNG\"); // preset dictionary not allowed in png\n if (cm != 8) return e(\"bad compression\",\"Corrupt PNG\"); // DEFLATE required for png\n // window = 1 << (8 + cinfo)... but who cares, we fully buffer output\n return 1;\n}\n\n// @TODO: should statically initialize these for optimal thread safety\nstatic uint8 default_length[288], default_distance[32];\nstatic void init_defaults(void)\n{\n int i; // use <= to match clearly with spec\n for (i=0; i <= 143; ++i) default_length[i] = 8;\n for ( ; i <= 255; ++i) default_length[i] = 9;\n for ( ; i <= 279; ++i) default_length[i] = 7;\n for ( ; i <= 287; ++i) default_length[i] = 8;\n\n for (i=0; i <= 31; ++i) default_distance[i] = 5;\n}\n\nstatic int parse_zlib(zbuf *a, int parse_header)\n{\n int final, type;\n if (parse_header)\n if (!parse_zlib_header(a)) return 0;\n a->num_bits = 0;\n a->code_buffer = 0;\n do {\n final = zreceive(a,1);\n type = zreceive(a,2);\n if (type == 0) {\n if (!parse_uncompressed_block(a)) return 0;\n } else if (type == 3) {\n return 0;\n } else {\n if (type == 1) {\n // use fixed code lengths\n if (!default_distance[31]) init_defaults();\n if (!zbuild_huffman(&a->z_length , default_length , 288)) return 0;\n if (!zbuild_huffman(&a->z_distance, default_distance, 32)) return 0;\n } else {\n if (!compute_huffman_codes(a)) return 0;\n }\n if (!parse_huffman_block(a)) return 0;\n }\n } while (!final);\n return 1;\n}\n\nstatic int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_header)\n{\n a->zout_start = obuf;\n a->zout = obuf;\n a->zout_end = obuf + olen;\n a->z_expandable = exp;\n\n return parse_zlib(a, parse_header);\n}\n\nchar *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen)\n{\n zbuf a;\n char *p = (char *) malloc(initial_size);\n if (p == NULL) return NULL;\n a.zbuffer = (uint8 *) buffer;\n a.zbuffer_end = (uint8 *) buffer + len;\n if (do_zlib(&a, p, initial_size, 1, 1)) {\n if (outlen) *outlen = (int) (a.zout - a.zout_start);\n return a.zout_start;\n } else {\n free(a.zout_start);\n return NULL;\n }\n}\n\nchar *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen)\n{\n return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen);\n}\n\nint stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen)\n{\n zbuf a;\n a.zbuffer = (uint8 *) ibuffer;\n a.zbuffer_end = (uint8 *) ibuffer + ilen;\n if (do_zlib(&a, obuffer, olen, 0, 1))\n return (int) (a.zout - a.zout_start);\n else\n return -1;\n}\n\nchar *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)\n{\n zbuf a;\n char *p = (char *) malloc(16384);\n if (p == NULL) return NULL;\n a.zbuffer = (uint8 *) buffer;\n a.zbuffer_end = (uint8 *) buffer+len;\n if (do_zlib(&a, p, 16384, 1, 0)) {\n if (outlen) *outlen = (int) (a.zout - a.zout_start);\n return a.zout_start;\n } else {\n free(a.zout_start);\n return NULL;\n }\n}\n\nint stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen)\n{\n zbuf a;\n a.zbuffer = (uint8 *) ibuffer;\n a.zbuffer_end = (uint8 *) ibuffer + ilen;\n if (do_zlib(&a, obuffer, olen, 0, 0))\n return (int) (a.zout - a.zout_start);\n else\n return -1;\n}\n\n// public domain \"baseline\" PNG decoder v0.10 Sean Barrett 2006-11-18\n// simple implementation\n// - only 8-bit samples\n// - no CRC checking\n// - allocates lots of intermediate memory\n// - avoids problem of streaming data between subsystems\n// - avoids explicit window management\n// performance\n// - uses stb_zlib, a PD zlib implementation with fast huffman decoding\n\n\ntypedef struct\n{\n uint32 length;\n uint32 type;\n} chunk;\n\n#define PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))\n\nstatic chunk get_chunk_header(stbi *s)\n{\n chunk c;\n c.length = get32(s);\n c.type = get32(s);\n return c;\n}\n\nstatic int check_png_header(stbi *s)\n{\n static uint8 png_sig[8] = { 137,80,78,71,13,10,26,10 };\n int i;\n for (i=0; i < 8; ++i)\n if (get8(s) != png_sig[i]) return e(\"bad png sig\",\"Not a PNG\");\n return 1;\n}\n\ntypedef struct\n{\n stbi s;\n uint8 *idata, *expanded, *out;\n} png;\n\n\nenum {\n F_none=0, F_sub=1, F_up=2, F_avg=3, F_paeth=4,\n F_avg_first, F_paeth_first,\n};\n\nstatic uint8 first_row_filter[5] =\n{\n F_none, F_sub, F_none, F_avg_first, F_paeth_first\n};\n\nstatic int paeth(int a, int b, int c)\n{\n int p = a + b - c;\n int pa = abs(p-a);\n int pb = abs(p-b);\n int pc = abs(p-c);\n if (pa <= pb && pa <= pc) return a;\n if (pb <= pc) return b;\n return c;\n}\n\n// create the png data from post-deflated data\nstatic int create_png_image(png *a, uint8 *raw, uint32 raw_len, int out_n)\n{\n stbi *s = &a->s;\n uint32 i,j,stride = s->img_x*out_n;\n int k;\n int img_n = s->img_n; // copy it into a local for later\n assert(out_n == s->img_n || out_n == s->img_n+1);\n a->out = (uint8 *) malloc(s->img_x * s->img_y * out_n);\n if (!a->out) return e(\"outofmem\", \"Out of memory\");\n if (raw_len != (img_n * s->img_x + 1) * s->img_y) return e(\"not enough pixels\",\"Corrupt PNG\");\n for (j=0; j < s->img_y; ++j) {\n uint8 *cur = a->out + stride*j;\n uint8 *prior = cur - stride;\n int filter = *raw++;\n if (filter > 4) return e(\"invalid filter\",\"Corrupt PNG\");\n // if first row, use special filter that doesn't sample previous row\n if (j == 0) filter = first_row_filter[filter];\n // handle first pixel explicitly\n for (k=0; k < img_n; ++k) {\n switch(filter) {\n case F_none : cur[k] = raw[k]; break;\n case F_sub : cur[k] = raw[k]; break;\n case F_up : cur[k] = raw[k] + prior[k]; break;\n case F_avg : cur[k] = raw[k] + (prior[k]>>1); break;\n case F_paeth : cur[k] = (uint8) (raw[k] + paeth(0,prior[k],0)); break;\n case F_avg_first : cur[k] = raw[k]; break;\n case F_paeth_first: cur[k] = raw[k]; break;\n }\n }\n if (img_n != out_n) cur[img_n] = 255;\n raw += img_n;\n cur += out_n;\n prior += out_n;\n // this is a little gross, so that we don't switch per-pixel or per-component\n if (img_n == out_n) {\n #define CASE(f) \\\n case f: \\\n for (i=s->img_x-1; i >= 1; --i, raw+=img_n,cur+=img_n,prior+=img_n) \\\n for (k=0; k < img_n; ++k)\n switch(filter) {\n CASE(F_none) cur[k] = raw[k]; break;\n CASE(F_sub) cur[k] = raw[k] + cur[k-img_n]; break;\n CASE(F_up) cur[k] = raw[k] + prior[k]; break;\n CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-img_n])>>1); break;\n CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],prior[k],prior[k-img_n])); break;\n CASE(F_avg_first) cur[k] = raw[k] + (cur[k-img_n] >> 1); break;\n CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-img_n],0,0)); break;\n }\n #undef CASE\n } else {\n assert(img_n+1 == out_n);\n #define CASE(f) \\\n case f: \\\n for (i=s->img_x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \\\n for (k=0; k < img_n; ++k)\n switch(filter) {\n CASE(F_none) cur[k] = raw[k]; break;\n CASE(F_sub) cur[k] = raw[k] + cur[k-out_n]; break;\n CASE(F_up) cur[k] = raw[k] + prior[k]; break;\n CASE(F_avg) cur[k] = raw[k] + ((prior[k] + cur[k-out_n])>>1); break;\n CASE(F_paeth) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;\n CASE(F_avg_first) cur[k] = raw[k] + (cur[k-out_n] >> 1); break;\n CASE(F_paeth_first) cur[k] = (uint8) (raw[k] + paeth(cur[k-out_n],0,0)); break;\n }\n #undef CASE\n }\n }\n return 1;\n}\n\nstatic int compute_transparency(png *z, uint8 tc[3], int out_n)\n{\n stbi *s = &z->s;\n uint32 i, pixel_count = s->img_x * s->img_y;\n uint8 *p = z->out;\n\n // compute color-based transparency, assuming we've\n // already got 255 as the alpha value in the output\n assert(out_n == 2 || out_n == 4);\n\n if (out_n == 2) {\n for (i=0; i < pixel_count; ++i) {\n p[1] = (p[0] == tc[0] ? 0 : 255);\n p += 2;\n }\n } else {\n for (i=0; i < pixel_count; ++i) {\n if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])\n p[3] = 0;\n p += 4;\n }\n }\n return 1;\n}\n\nstatic int expand_palette(png *a, uint8 *palette, int len, int pal_img_n)\n{\n uint32 i, pixel_count = a->s.img_x * a->s.img_y;\n uint8 *p, *temp_out, *orig = a->out;\n\n p = (uint8 *) malloc(pixel_count * pal_img_n);\n if (p == NULL) return e(\"outofmem\", \"Out of memory\");\n\n // between here and free(out) below, exitting would leak\n temp_out = p;\n\n if (pal_img_n == 3) {\n for (i=0; i < pixel_count; ++i) {\n int n = orig[i]*4;\n p[0] = palette[n ];\n p[1] = palette[n+1];\n p[2] = palette[n+2];\n p += 3;\n }\n } else {\n for (i=0; i < pixel_count; ++i) {\n int n = orig[i]*4;\n p[0] = palette[n ];\n p[1] = palette[n+1];\n p[2] = palette[n+2];\n p[3] = palette[n+3];\n p += 4;\n }\n }\n free(a->out);\n a->out = temp_out;\n return 1;\n}\n\nstatic int parse_png_file(png *z, int scan, int req_comp)\n{\n uint8 palette[1024], pal_img_n=0;\n uint8 has_trans=0, tc[3];\n uint32 ioff=0, idata_limit=0, i, pal_len=0;\n int first=1,k;\n stbi *s = &z->s;\n\n if (!check_png_header(s)) return 0;\n\n if (scan == SCAN_type) return 1;\n\n for(;;first=0) {\n chunk c = get_chunk_header(s);\n if (first && c.type != PNG_TYPE('I','H','D','R'))\n return e(\"first not IHDR\",\"Corrupt PNG\");\n switch (c.type) {\n case PNG_TYPE('I','H','D','R'): {\n int depth,color,interlace,comp,filter;\n if (!first) return e(\"multiple IHDR\",\"Corrupt PNG\");\n if (c.length != 13) return e(\"bad IHDR len\",\"Corrupt PNG\");\n s->img_x = get32(s); if (s->img_x > (1 << 24)) return e(\"too large\",\"Very large image (corrupt?)\");\n s->img_y = get32(s); if (s->img_y > (1 << 24)) return e(\"too large\",\"Very large image (corrupt?)\");\n depth = get8(s); if (depth != 8) return e(\"8bit only\",\"PNG not supported: 8-bit only\");\n color = get8(s); if (color > 6) return e(\"bad ctype\",\"Corrupt PNG\");\n if (color == 3) pal_img_n = 3; else if (color & 1) return e(\"bad ctype\",\"Corrupt PNG\");\n comp = get8(s); if (comp) return e(\"bad comp method\",\"Corrupt PNG\");\n filter= get8(s); if (filter) return e(\"bad filter method\",\"Corrupt PNG\");\n interlace = get8(s); if (interlace) return e(\"interlaced\",\"PNG not supported: interlaced mode\");\n if (!s->img_x || !s->img_y) return e(\"0-pixel image\",\"Corrupt PNG\");\n if (!pal_img_n) {\n s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);\n if ((1 << 30) / s->img_x / s->img_n < s->img_y) return e(\"too large\", \"Image too large to decode\");\n if (scan == SCAN_header) return 1;\n } else {\n // if paletted, then pal_n is our final components, and\n // img_n is # components to decompress/filter.\n s->img_n = 1;\n if ((1 << 30) / s->img_x / 4 < s->img_y) return e(\"too large\",\"Corrupt PNG\");\n // if SCAN_header, have to scan to see if we have a tRNS\n }\n break;\n }\n\n case PNG_TYPE('P','L','T','E'): {\n if (c.length > 256*3) return e(\"invalid PLTE\",\"Corrupt PNG\");\n pal_len = c.length / 3;\n if (pal_len * 3 != c.length) return e(\"invalid PLTE\",\"Corrupt PNG\");\n for (i=0; i < pal_len; ++i) {\n palette[i*4+0] = get8u(s);\n palette[i*4+1] = get8u(s);\n palette[i*4+2] = get8u(s);\n palette[i*4+3] = 255;\n }\n break;\n }\n\n case PNG_TYPE('t','R','N','S'): {\n if (z->idata) return e(\"tRNS after IDAT\",\"Corrupt PNG\");\n if (pal_img_n) {\n if (scan == SCAN_header) { s->img_n = 4; return 1; }\n if (pal_len == 0) return e(\"tRNS before PLTE\",\"Corrupt PNG\");\n if (c.length > pal_len) return e(\"bad tRNS len\",\"Corrupt PNG\");\n pal_img_n = 4;\n for (i=0; i < c.length; ++i)\n palette[i*4+3] = get8u(s);\n } else {\n if (!(s->img_n & 1)) return e(\"tRNS with alpha\",\"Corrupt PNG\");\n if (c.length != (uint32) s->img_n*2) return e(\"bad tRNS len\",\"Corrupt PNG\");\n has_trans = 1;\n for (k=0; k < s->img_n; ++k)\n tc[k] = (uint8) get16(s); // non 8-bit images will be larger\n }\n break;\n }\n\n case PNG_TYPE('I','D','A','T'): {\n if (pal_img_n && !pal_len) return e(\"no PLTE\",\"Corrupt PNG\");\n if (scan == SCAN_header) { s->img_n = pal_img_n; return 1; }\n if (ioff + c.length > idata_limit) {\n uint8 *p;\n if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096;\n while (ioff + c.length > idata_limit)\n idata_limit *= 2;\n p = (uint8 *) realloc(z->idata, idata_limit); if (p == NULL) return e(\"outofmem\", \"Out of memory\");\n z->idata = p;\n }\n #ifndef STBI_NO_STDIO\n if (s->img_file)\n {\n if (fread(z->idata+ioff,1,c.length,s->img_file) != c.length) return e(\"outofdata\",\"Corrupt PNG\");\n }\n else\n #endif\n {\n memcpy(z->idata+ioff, s->img_buffer, c.length);\n s->img_buffer += c.length;\n }\n ioff += c.length;\n break;\n }\n\n case PNG_TYPE('I','E','N','D'): {\n uint32 raw_len;\n if (scan != SCAN_load) return 1;\n if (z->idata == NULL) return e(\"no IDAT\",\"Corrupt PNG\");\n z->expanded = (uint8 *) stbi_zlib_decode_malloc((char *) z->idata, ioff, (int *) &raw_len);\n if (z->expanded == NULL) return 0; // zlib should set error\n free(z->idata); z->idata = NULL;\n if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans)\n s->img_out_n = s->img_n+1;\n else\n s->img_out_n = s->img_n;\n if (!create_png_image(z, z->expanded, raw_len, s->img_out_n)) return 0;\n if (has_trans)\n if (!compute_transparency(z, tc, s->img_out_n)) return 0;\n if (pal_img_n) {\n // pal_img_n == 3 or 4\n s->img_n = pal_img_n; // record the actual colors we had\n s->img_out_n = pal_img_n;\n if (req_comp >= 3) s->img_out_n = req_comp;\n if (!expand_palette(z, palette, pal_len, s->img_out_n))\n return 0;\n }\n free(z->expanded); z->expanded = NULL;\n return 1;\n }\n\n default:\n // if critical, fail\n if ((c.type & (1 << 29)) == 0) {\n #ifndef STBI_NO_FAILURE_STRINGS\n // not threadsafe\n static char invalid_chunk[] = \"XXXX chunk not known\";\n invalid_chunk[0] = (uint8) (c.type >> 24);\n invalid_chunk[1] = (uint8) (c.type >> 16);\n invalid_chunk[2] = (uint8) (c.type >> 8);\n invalid_chunk[3] = (uint8) (c.type >> 0);\n #endif\n return e(invalid_chunk, \"PNG not supported: unknown chunk type\");\n }\n skip(s, c.length);\n break;\n }\n // end of chunk, read and skip CRC\n get32(s);\n }\n}\n\nstatic unsigned char *do_png(png *p, int *x, int *y, int *n, int req_comp)\n{\n unsigned char *result=NULL;\n p->expanded = NULL;\n p->idata = NULL;\n p->out = NULL;\n if (req_comp < 0 || req_comp > 4) return epuc(\"bad req_comp\", \"Internal error\");\n if (parse_png_file(p, SCAN_load, req_comp)) {\n result = p->out;\n p->out = NULL;\n if (req_comp && req_comp != p->s.img_out_n) {\n result = convert_format(result, p->s.img_out_n, req_comp, p->s.img_x, p->s.img_y);\n p->s.img_out_n = req_comp;\n if (result == NULL) return result;\n }\n *x = p->s.img_x;\n *y = p->s.img_y;\n if (n) *n = p->s.img_n;\n }\n free(p->out); p->out = NULL;\n free(p->expanded); p->expanded = NULL;\n free(p->idata); p->idata = NULL;\n\n return result;\n}\n\n#ifndef STBI_NO_STDIO\nunsigned char *stbi_png_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n png p;\n start_file(&p.s, f);\n return do_png(&p, x,y,comp,req_comp);\n}\n\nunsigned char *stbi_png_load(char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n unsigned char *data;\n FILE *f = fopen(filename, \"rb\");\n if (!f) return NULL;\n data = stbi_png_load_from_file(f,x,y,comp,req_comp);\n fclose(f);\n return data;\n}\n#endif\n\nunsigned char *stbi_png_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n png p;\n start_mem(&p.s, buffer,len);\n return do_png(&p, x,y,comp,req_comp);\n}\n\n#ifndef STBI_NO_STDIO\nint stbi_png_test_file(FILE *f)\n{\n png p;\n int n,r;\n n = ftell(f);\n start_file(&p.s, f);\n r = parse_png_file(&p, SCAN_type,STBI_default);\n fseek(f,n,SEEK_SET);\n return r;\n}\n#endif\n\nint stbi_png_test_memory(stbi_uc const *buffer, int len)\n{\n png p;\n start_mem(&p.s, buffer, len);\n return parse_png_file(&p, SCAN_type,STBI_default);\n}\n\n// TODO: load header from png\n#ifndef STBI_NO_STDIO\nextern int stbi_png_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\nextern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n// Microsoft/Windows BMP image\n\nstatic int bmp_test(stbi *s)\n{\n int sz;\n if (get8(s) != 'B') return 0;\n if (get8(s) != 'M') return 0;\n get32le(s); // discard filesize\n get16le(s); // discard reserved\n get16le(s); // discard reserved\n get32le(s); // discard data offset\n sz = get32le(s);\n if (sz == 12 || sz == 40 || sz == 56 || sz == 108) return 1;\n return 0;\n}\n\n#ifndef STBI_NO_STDIO\nint stbi_bmp_test_file (FILE *f)\n{\n stbi s;\n int r,n = ftell(f);\n start_file(&s,f);\n r = bmp_test(&s);\n fseek(f,n,SEEK_SET);\n return r;\n}\n#endif\n\nint stbi_bmp_test_memory (stbi_uc const *buffer, int len)\n{\n stbi s;\n start_mem(&s, buffer, len);\n return bmp_test(&s);\n}\n\n// returns 0..31 for the highest set bit\nstatic int high_bit(unsigned int z)\n{\n int n=0;\n if (z == 0) return -1;\n if (z >= 0x10000) n += 16, z >>= 16;\n if (z >= 0x00100) n += 8, z >>= 8;\n if (z >= 0x00010) n += 4, z >>= 4;\n if (z >= 0x00004) n += 2, z >>= 2;\n if (z >= 0x00002) n += 1, z >>= 1;\n return n;\n}\n\nstatic int bitcount(unsigned int a)\n{\n a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2\n a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4\n a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits\n a = (a + (a >> 8)); // max 16 per 8 bits\n a = (a + (a >> 16)); // max 32 per 8 bits\n return a & 0xff;\n}\n\nstatic int shiftsigned(int v, int shift, int bits)\n{\n int result;\n int z=0;\n\n if (shift < 0) v <<= -shift;\n else v >>= shift;\n result = v;\n\n z = bits;\n while (z < 8) {\n result += v >> z;\n z += bits;\n }\n return result;\n}\n\nstatic stbi_uc *bmp_load(stbi *s, int *x, int *y, int *comp, int req_comp)\n{\n uint8 *out;\n unsigned int mr=0,mg=0,mb=0,ma=0;\n stbi_uc pal[256][4];\n int psize=0,i,j,compress=0,width;\n int bpp, flip_vertically, pad, target, offset, hsz;\n if (get8(s) != 'B' || get8(s) != 'M') return epuc(\"not BMP\", \"Corrupt BMP\");\n get32le(s); // discard filesize\n get16le(s); // discard reserved\n get16le(s); // discard reserved\n offset = get32le(s);\n hsz = get32le(s);\n if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108) return epuc(\"unknown BMP\", \"BMP type not supported: unknown\");\n failure_reason = \"bad BMP\";\n if (hsz == 12) {\n s->img_x = get16le(s);\n s->img_y = get16le(s);\n } else {\n s->img_x = get32le(s);\n s->img_y = get32le(s);\n }\n if (get16le(s) != 1) return 0;\n bpp = get16le(s);\n if (bpp == 1) return epuc(\"monochrome\", \"BMP type not supported: 1-bit\");\n flip_vertically = ((int) s->img_y) > 0;\n s->img_y = abs((int) s->img_y);\n if (hsz == 12) {\n if (bpp < 24)\n psize = (offset - 14 - 24) / 3;\n } else {\n compress = get32le(s);\n if (compress == 1 || compress == 2) return epuc(\"BMP RLE\", \"BMP type not supported: RLE\");\n get32le(s); // discard sizeof\n get32le(s); // discard hres\n get32le(s); // discard vres\n get32le(s); // discard colorsused\n get32le(s); // discard max important\n if (hsz == 40 || hsz == 56) {\n if (hsz == 56) {\n get32le(s);\n get32le(s);\n get32le(s);\n get32le(s);\n }\n if (bpp == 16 || bpp == 32) {\n mr = mg = mb = 0;\n if (compress == 0) {\n if (bpp == 32) {\n mr = 0xff << 16;\n mg = 0xff << 8;\n mb = 0xff << 0;\n } else {\n mr = 31 << 10;\n mg = 31 << 5;\n mb = 31 << 0;\n }\n } else if (compress == 3) {\n mr = get32le(s);\n mg = get32le(s);\n mb = get32le(s);\n // not documented, but generated by photoshop and handled by mspaint\n if (mr == mg && mg == mb) {\n // ?!?!?\n return NULL;\n }\n } else\n return NULL;\n }\n } else {\n assert(hsz == 108);\n mr = get32le(s);\n mg = get32le(s);\n mb = get32le(s);\n ma = get32le(s);\n get32le(s); // discard color space\n for (i=0; i < 12; ++i)\n get32le(s); // discard color space parameters\n }\n if (bpp < 16)\n psize = (offset - 14 - hsz) >> 2;\n }\n s->img_n = ma ? 4 : 3;\n if (req_comp && req_comp >= 3) // we can directly decode 3 or 4\n target = req_comp;\n else\n target = s->img_n; // if they want monochrome, we'll post-convert\n out = (stbi_uc *) malloc(target * s->img_x * s->img_y);\n if (!out) return epuc(\"outofmem\", \"Out of memory\");\n if (bpp < 16) {\n int z=0;\n if (psize == 0 || psize > 256) { free(out); return epuc(\"invalid\", \"Corrupt BMP\"); }\n for (i=0; i < psize; ++i) {\n pal[i][2] = get8(s);\n pal[i][1] = get8(s);\n pal[i][0] = get8(s);\n if (hsz != 12) get8(s);\n pal[i][3] = 255;\n }\n skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4));\n if (bpp == 4) width = (s->img_x + 1) >> 1;\n else if (bpp == 8) width = s->img_x;\n else { free(out); return epuc(\"bad bpp\", \"Corrupt BMP\"); }\n pad = (-width)&3;\n for (j=0; j < (int) s->img_y; ++j) {\n for (i=0; i < (int) s->img_x; i += 2) {\n int v=get8(s),v2=0;\n if (bpp == 4) {\n v2 = v & 15;\n v >>= 4;\n }\n out[z++] = pal[v][0];\n out[z++] = pal[v][1];\n out[z++] = pal[v][2];\n if (target == 4) out[z++] = 255;\n if (i+1 == (int) s->img_x) break;\n v = (bpp == 8) ? get8(s) : v2;\n out[z++] = pal[v][0];\n out[z++] = pal[v][1];\n out[z++] = pal[v][2];\n if (target == 4) out[z++] = 255;\n }\n skip(s, pad);\n }\n } else {\n int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0;\n int z = 0;\n int easy=0;\n skip(s, offset - 14 - hsz);\n if (bpp == 24) width = 3 * s->img_x;\n else if (bpp == 16) width = 2*s->img_x;\n else /* bpp = 32 and pad = 0 */ width=0;\n pad = (-width) & 3;\n if (bpp == 24) {\n easy = 1;\n } else if (bpp == 32) {\n if (mb == 0xff && mg == 0xff00 && mr == 0xff000000 && ma == 0xff000000)\n easy = 2;\n }\n if (!easy) {\n if (!mr || !mg || !mb) return epuc(\"bad masks\", \"Corrupt BMP\");\n // right shift amt to put high bit in position #7\n rshift = high_bit(mr)-7; rcount = bitcount(mr);\n gshift = high_bit(mg)-7; gcount = bitcount(mr);\n bshift = high_bit(mb)-7; bcount = bitcount(mr);\n ashift = high_bit(ma)-7; acount = bitcount(mr);\n }\n for (j=0; j < (int) s->img_y; ++j) {\n if (easy) {\n for (i=0; i < (int) s->img_x; ++i) {\n int a;\n out[z+2] = get8(s);\n out[z+1] = get8(s);\n out[z+0] = get8(s);\n z += 3;\n a = (easy == 2 ? get8(s) : 255);\n if (target == 4) out[z++] = a;\n }\n } else {\n for (i=0; i < (int) s->img_x; ++i) {\n uint32 v = (bpp == 16 ? get16le(s) : get32le(s));\n int a;\n out[z++] = shiftsigned(v & mr, rshift, rcount);\n out[z++] = shiftsigned(v & mg, gshift, gcount);\n out[z++] = shiftsigned(v & mb, bshift, bcount);\n a = (ma ? shiftsigned(v & ma, ashift, acount) : 255);\n if (target == 4) out[z++] = a;\n }\n }\n skip(s, pad);\n }\n }\n if (flip_vertically) {\n stbi_uc t;\n for (j=0; j < (int) s->img_y>>1; ++j) {\n stbi_uc *p1 = out + j *s->img_x*target;\n stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;\n for (i=0; i < (int) s->img_x*target; ++i) {\n t = p1[i], p1[i] = p2[i], p2[i] = t;\n }\n }\n }\n\n if (req_comp && req_comp != target) {\n out = convert_format(out, target, req_comp, s->img_x, s->img_y);\n if (out == NULL) return out; // convert_format frees input on failure\n }\n\n *x = s->img_x;\n *y = s->img_y;\n if (comp) *comp = target;\n return out;\n}\n\n#ifndef STBI_NO_STDIO\nstbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n stbi_uc *data;\n FILE *f = fopen(filename, \"rb\");\n if (!f) return NULL;\n data = stbi_bmp_load_from_file(f, x,y,comp,req_comp);\n fclose(f);\n return data;\n}\n\nstbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n stbi s;\n start_file(&s, f);\n return bmp_load(&s, x,y,comp,req_comp);\n}\n#endif\n\nstbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi s;\n start_mem(&s, buffer, len);\n return bmp_load(&s, x,y,comp,req_comp);\n}\n\n// Targa Truevision - TGA\n// by Jonathan Dummer\n\nstatic int tga_test(stbi *s)\n{\n\tint sz;\n\tget8u(s);\t\t//\tdiscard Offset\n\tsz = get8u(s);\t//\tcolor type\n\tif( sz > 1 ) return 0;\t//\tonly RGB or indexed allowed\n\tsz = get8u(s);\t//\timage type\n\tif( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0;\t//\tonly RGB or grey allowed, +/- RLE\n\tget16(s);\t\t//\tdiscard palette start\n\tget16(s);\t\t//\tdiscard palette length\n\tget8(s);\t\t\t//\tdiscard bits per palette color entry\n\tget16(s);\t\t//\tdiscard x origin\n\tget16(s);\t\t//\tdiscard y origin\n\tif( get16(s) < 1 ) return 0;\t\t//\ttest width\n\tif( get16(s) < 1 ) return 0;\t\t//\ttest height\n\tsz = get8(s);\t//\tbits per pixel\n\tif( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) ) return 0;\t//\tonly RGB or RGBA or grey allowed\n\treturn 1;\t\t//\tseems to have passed everything\n}\n\n#ifndef STBI_NO_STDIO\nint stbi_tga_test_file (FILE *f)\n{\n stbi s;\n int r,n = ftell(f);\n start_file(&s, f);\n r = tga_test(&s);\n fseek(f,n,SEEK_SET);\n return r;\n}\n#endif\n\nint stbi_tga_test_memory (stbi_uc const *buffer, int len)\n{\n stbi s;\n start_mem(&s, buffer, len);\n return tga_test(&s);\n}\n\nstatic stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)\n{\n\t//\tread in the TGA header stuff\n\tint tga_offset = get8u(s);\n\tint tga_indexed = get8u(s);\n\tint tga_image_type = get8u(s);\n\tint tga_is_RLE = 0;\n\tint tga_palette_start = get16le(s);\n\tint tga_palette_len = get16le(s);\n\tint tga_palette_bits = get8u(s);\n\tint tga_x_origin = get16le(s);\n\tint tga_y_origin = get16le(s);\n\tint tga_width = get16le(s);\n\tint tga_height = get16le(s);\n\tint tga_bits_per_pixel = get8u(s);\n\tint tga_inverted = get8u(s);\n\t//\timage data\n\tunsigned char *tga_data;\n\tunsigned char *tga_palette = NULL;\n\tint i, j;\n\tunsigned char raw_data[4];\n\tunsigned char trans_data[] = { 0,0,0,0 };\n\tint RLE_count = 0;\n\tint RLE_repeating = 0;\n\tint read_next_pixel = 1;\n\t//\tdo a tiny bit of precessing\n\tif( tga_image_type >= 8 )\n\t{\n\t\ttga_image_type -= 8;\n\t\ttga_is_RLE = 1;\n\t}\n\t/* int tga_alpha_bits = tga_inverted & 15; */\n\ttga_inverted = 1 - ((tga_inverted >> 5) & 1);\n\n\t//\terror check\n\tif( //(tga_indexed) ||\n\t\t(tga_width < 1) || (tga_height < 1) ||\n\t\t(tga_image_type < 1) || (tga_image_type > 3) ||\n\t\t((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) &&\n\t\t(tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32))\n\t\t)\n\t{\n\t\treturn NULL;\n\t}\n\n\t//\tIf I'm paletted, then I'll use the number of bits from the palette\n\tif( tga_indexed )\n\t{\n\t\ttga_bits_per_pixel = tga_palette_bits;\n\t}\n\n\t//\ttga info\n\t*x = tga_width;\n\t*y = tga_height;\n\tif( (req_comp < 1) || (req_comp > 4) )\n\t{\n\t\t//\tjust use whatever the file was\n\t\treq_comp = tga_bits_per_pixel / 8;\n\t\t*comp = req_comp;\n\t} else\n\t{\n\t\t//\tforce a new number of components\n\t\t*comp = tga_bits_per_pixel/8;\n\t}\n\ttga_data = (unsigned char*)malloc( tga_width * tga_height * req_comp );\n\n\t//\tskip to the data's starting position (offset usually = 0)\n\tskip(s, tga_offset );\n\t//\tdo I need to load a palette?\n\tif( tga_indexed )\n\t{\n\t\t//\tany data to skip? (offset usually = 0)\n\t\tskip(s, tga_palette_start );\n\t\t//\tload the palette\n\t\ttga_palette = (unsigned char*)malloc( tga_palette_len * tga_palette_bits / 8 );\n\t\tgetn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 );\n\t}\n\t//\tload the data\n\tfor( i = 0; i < tga_width * tga_height; ++i )\n\t{\n\t\t//\tif I'm in RLE mode, do I need to get a RLE chunk?\n\t\tif( tga_is_RLE )\n\t\t{\n\t\t\tif( RLE_count == 0 )\n\t\t\t{\n\t\t\t\t//\tyep, get the next byte as a RLE command\n\t\t\t\tint RLE_cmd = get8u(s);\n\t\t\t\tRLE_count = 1 + (RLE_cmd & 127);\n\t\t\t\tRLE_repeating = RLE_cmd >> 7;\n\t\t\t\tread_next_pixel = 1;\n\t\t\t} else if( !RLE_repeating )\n\t\t\t{\n\t\t\t\tread_next_pixel = 1;\n\t\t\t}\n\t\t} else\n\t\t{\n\t\t\tread_next_pixel = 1;\n\t\t}\n\t\t//\tOK, if I need to read a pixel, do it now\n\t\tif( read_next_pixel )\n\t\t{\n\t\t\t//\tload however much data we did have\n\t\t\tif( tga_indexed )\n\t\t\t{\n\t\t\t\t//\tread in 1 byte, then perform the lookup\n\t\t\t\tint pal_idx = get8u(s);\n\t\t\t\tif( pal_idx >= tga_palette_len )\n\t\t\t\t{\n\t\t\t\t\t//\tinvalid index\n\t\t\t\t\tpal_idx = 0;\n\t\t\t\t}\n\t\t\t\tpal_idx *= tga_bits_per_pixel / 8;\n\t\t\t\tfor( j = 0; j*8 < tga_bits_per_pixel; ++j )\n\t\t\t\t{\n\t\t\t\t\traw_data[j] = tga_palette[pal_idx+j];\n\t\t\t\t}\n\t\t\t} else\n\t\t\t{\n\t\t\t\t//\tread in the data raw\n\t\t\t\tfor( j = 0; j*8 < tga_bits_per_pixel; ++j )\n\t\t\t\t{\n\t\t\t\t\traw_data[j] = get8u(s);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//\tconvert raw to the intermediate format\n\t\t\tswitch( tga_bits_per_pixel )\n\t\t\t{\n\t\t\tcase 8:\n\t\t\t\t//\tLuminous => RGBA\n\t\t\t\ttrans_data[0] = raw_data[0];\n\t\t\t\ttrans_data[1] = raw_data[0];\n\t\t\t\ttrans_data[2] = raw_data[0];\n\t\t\t\ttrans_data[3] = 255;\n\t\t\t\tbreak;\n\t\t\tcase 16:\n\t\t\t\t//\tLuminous,Alpha => RGBA\n\t\t\t\ttrans_data[0] = raw_data[0];\n\t\t\t\ttrans_data[1] = raw_data[0];\n\t\t\t\ttrans_data[2] = raw_data[0];\n\t\t\t\ttrans_data[3] = raw_data[1];\n\t\t\t\tbreak;\n\t\t\tcase 24:\n\t\t\t\t//\tBGR => RGBA\n\t\t\t\ttrans_data[0] = raw_data[2];\n\t\t\t\ttrans_data[1] = raw_data[1];\n\t\t\t\ttrans_data[2] = raw_data[0];\n\t\t\t\ttrans_data[3] = 255;\n\t\t\t\tbreak;\n\t\t\tcase 32:\n\t\t\t\t//\tBGRA => RGBA\n\t\t\t\ttrans_data[0] = raw_data[2];\n\t\t\t\ttrans_data[1] = raw_data[1];\n\t\t\t\ttrans_data[2] = raw_data[0];\n\t\t\t\ttrans_data[3] = raw_data[3];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//\tclear the reading flag for the next pixel\n\t\t\tread_next_pixel = 0;\n\t\t} // end of reading a pixel\n\t\t//\tconvert to final format\n\t\tswitch( req_comp )\n\t\t{\n\t\tcase 1:\n\t\t\t//\tRGBA => Luminance\n\t\t\ttga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\t//\tRGBA => Luminance,Alpha\n\t\t\ttga_data[i*req_comp+0] = compute_y(trans_data[0],trans_data[1],trans_data[2]);\n\t\t\ttga_data[i*req_comp+1] = trans_data[3];\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\t//\tRGBA => RGB\n\t\t\ttga_data[i*req_comp+0] = trans_data[0];\n\t\t\ttga_data[i*req_comp+1] = trans_data[1];\n\t\t\ttga_data[i*req_comp+2] = trans_data[2];\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\t//\tRGBA => RGBA\n\t\t\ttga_data[i*req_comp+0] = trans_data[0];\n\t\t\ttga_data[i*req_comp+1] = trans_data[1];\n\t\t\ttga_data[i*req_comp+2] = trans_data[2];\n\t\t\ttga_data[i*req_comp+3] = trans_data[3];\n\t\t\tbreak;\n\t\t}\n\t\t//\tin case we're in RLE mode, keep counting down\n\t\t--RLE_count;\n\t}\n\t//\tdo I need to invert the image?\n\tif( tga_inverted )\n\t{\n\t\tfor( j = 0; j*2 < tga_height; ++j )\n\t\t{\n\t\t\tint index1 = j * tga_width * req_comp;\n\t\t\tint index2 = (tga_height - 1 - j) * tga_width * req_comp;\n\t\t\tfor( i = tga_width * req_comp; i > 0; --i )\n\t\t\t{\n\t\t\t\tunsigned char temp = tga_data[index1];\n\t\t\t\ttga_data[index1] = tga_data[index2];\n\t\t\t\ttga_data[index2] = temp;\n\t\t\t\t++index1;\n\t\t\t\t++index2;\n\t\t\t}\n\t\t}\n\t}\n\t//\tclear my palette, if I had one\n\tif( tga_palette != NULL )\n\t{\n\t\tfree( tga_palette );\n\t}\n\t//\tthe things I do to get rid of an error message, and yet keep\n\t//\tMicrosoft's C compilers happy... [8^(\n\ttga_palette_start = tga_palette_len = tga_palette_bits =\n\t\t\ttga_x_origin = tga_y_origin = 0;\n\t//\tOK, done\n\treturn tga_data;\n}\n\n#ifndef STBI_NO_STDIO\nstbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp)\n{\n stbi_uc *data;\n FILE *f = fopen(filename, \"rb\");\n if (!f) return NULL;\n data = stbi_tga_load_from_file(f, x,y,comp,req_comp);\n fclose(f);\n return data;\n}\n\nstbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp)\n{\n stbi s;\n start_file(&s, f);\n return tga_load(&s, x,y,comp,req_comp);\n}\n#endif\n\nstbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)\n{\n stbi s;\n start_mem(&s"}, {"path": "includes/stb_image_aug.h", "language": "code", "loc": 308, "comment_density": 0.61, "code": "/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c\n when you control the images you're loading\n\n QUICK NOTES:\n Primarily of interest to game developers and other people who can\n avoid problematic images and only need the trivial interface\n\n JPEG baseline (no JPEG progressive, no oddball channel decimations)\n PNG non-interlaced\n BMP non-1bpp, non-RLE\n TGA (not sure what subset, if a subset)\n PSD (composited view only, no extra channels)\n HDR (radiance rgbE format)\n writes BMP,TGA (define STBI_NO_WRITE to remove code)\n decoded from memory or through stdio FILE (define STBI_NO_STDIO to remove code)\n supports installable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD)\n \n TODO:\n stbi_info_*\n \n history:\n 1.16 major bugfix - convert_format converted one too many pixels\n 1.15 initialize some fields for thread safety\n 1.14 fix threadsafe conversion bug; header-file-only version (#define STBI_HEADER_FILE_ONLY before including)\n 1.13 threadsafe\n 1.12 const qualifiers in the API\n 1.11 Support installable IDCT, colorspace conversion routines\n 1.10 Fixes for 64-bit (don't use \"unsigned long\")\n optimized upsampling by Fabian \"ryg\" Giesen\n 1.09 Fix format-conversion for PSD code (bad global variables!)\n 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz\n 1.07 attempt to fix C++ warning/errors again\n 1.06 attempt to fix C++ warning/errors again\n 1.05 fix TGA loading to return correct *comp and use good luminance calc\n 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free\n 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR\n 1.02 support for (subset of) HDR files, float interface for preferred access to them\n 1.01 fix bug: possible bug in handling right-side up bmps... not sure\n fix bug: the stbi_bmp_load() and stbi_tga_load() functions didn't work at all\n 1.00 interface to zlib that skips zlib header\n 0.99 correct handling of alpha in palette\n 0.98 TGA loader by lonesock; dynamically add loaders (untested)\n 0.97 jpeg errors on too large a file; also catch another malloc failure\n 0.96 fix detection of invalid v value - particleman@mollyrocket forum\n 0.95 during header scan, seek to markers in case of padding\n 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same\n 0.93 handle jpegtran output; verbose errors\n 0.92 read 4,8,16,24,32-bit BMP files of several formats\n 0.91 output 24-bit Windows 3.0 BMP files\n 0.90 fix a few more warnings; bump version number to approach 1.0\n 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd\n 0.60 fix compiling as c++\n 0.59 fix warnings: merge Dave Moore's -Wall fixes\n 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian\n 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less\n than 16 available\n 0.56 fix bug: zlib uncompressed mode len vs. nlen\n 0.55 fix bug: restart_interval not initialized to 0\n 0.54 allow NULL for 'int *comp'\n 0.53 fix bug in png 3->4; speedup png decoding\n 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments\n 0.51 obey req_comp requests, 1-component jpegs return as 1-component,\n on 'test' only check type, not whether we support this variant\n*/\n\n#ifndef HEADER_STB_IMAGE_AUGMENTED\n#define HEADER_STB_IMAGE_AUGMENTED\n\n//// begin header file ////////////////////////////////////////////////////\n//\n// Limitations:\n// - no progressive/interlaced support (jpeg, png)\n// - 8-bit samples only (jpeg, png)\n// - not threadsafe\n// - channel subsampling of at most 2 in each dimension (jpeg)\n// - no delayed line count (jpeg) -- IJG doesn't support either\n//\n// Basic usage (see HDR discussion below):\n// int x,y,n;\n// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);\n// // ... process data if not NULL ... \n// // ... x = width, y = height, n = # 8-bit components per pixel ...\n// // ... replace '0' with '1'..'4' to force that many components per pixel\n// stbi_image_free(data)\n//\n// Standard parameters:\n// int *x -- outputs image width in pixels\n// int *y -- outputs image height in pixels\n// int *comp -- outputs # of image components in image file\n// int req_comp -- if non-zero, # of image components requested in result\n//\n// The return value from an image loader is an 'unsigned char *' which points\n// to the pixel data. The pixel data consists of *y scanlines of *x pixels,\n// with each pixel consisting of N interleaved 8-bit components; the first\n// pixel pointed to is top-left-most in the image. There is no padding between\n// image scanlines or between pixels, regardless of format. The number of\n// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.\n// If req_comp is non-zero, *comp has the number of components that _would_\n// have been output otherwise. E.g. if you set req_comp to 4, you will always\n// get RGBA output, but you can check *comp to easily see if it's opaque.\n//\n// An output image with N components has the following components interleaved\n// in this order in each pixel:\n//\n// N=#comp components\n// 1 grey\n// 2 grey, alpha\n// 3 red, green, blue\n// 4 red, green, blue, alpha\n//\n// If image loading fails for any reason, the return value will be NULL,\n// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()\n// can be queried for an extremely brief, end-user unfriendly explanation\n// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid\n// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly\n// more user-friendly ones.\n//\n// Paletted PNG and BMP images are automatically depalettized.\n//\n//\n// ===========================================================================\n//\n// HDR image support (disable by defining STBI_NO_HDR)\n//\n// stb_image now supports loading HDR images in general, and currently\n// the Radiance .HDR file format, although the support is provided\n// generically. You can still load any file through the existing interface;\n// if you attempt to load an HDR file, it will be automatically remapped to\n// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;\n// both of these constants can be reconfigured through this interface:\n//\n// stbi_hdr_to_ldr_gamma(2.2f);\n// stbi_hdr_to_ldr_scale(1.0f);\n//\n// (note, do not use _inverse_ constants; stbi_image will invert them\n// appropriately).\n//\n// Additionally, there is a new, parallel interface for loading files as\n// (linear) floats to preserve the full dynamic range:\n//\n// float *data = stbi_loadf(filename, &x, &y, &n, 0);\n// \n// If you load LDR images through this interface, those images will\n// be promoted to floating point values, run through the inverse of\n// constants corresponding to the above:\n//\n// stbi_ldr_to_hdr_scale(1.0f);\n// stbi_ldr_to_hdr_gamma(2.2f);\n//\n// Finally, given a filename (or an open file or memory block--see header\n// file for details) containing image data, you can query for the \"most\n// appropriate\" interface to use (that is, whether the image is HDR or\n// not), using:\n//\n// stbi_is_hdr(char *filename);\n\n#ifndef STBI_NO_STDIO\n#include \n#endif\n\n#define STBI_VERSION 1\n\nenum\n{\n STBI_default = 0, // only used for req_comp\n\n STBI_grey = 1,\n STBI_grey_alpha = 2,\n STBI_rgb = 3,\n STBI_rgb_alpha = 4,\n};\n\ntypedef unsigned char stbi_uc;\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// WRITING API\n\n#if !defined(STBI_NO_WRITE) && !defined(STBI_NO_STDIO)\n// write a BMP/TGA file given tightly packed 'comp' channels (no padding, nor bmp-stride-padding)\n// (you must include the appropriate extension in the filename).\n// returns TRUE on success, FALSE if couldn't open file, error writing file\nextern int stbi_write_bmp (char const *filename, int x, int y, int comp, void *data);\nextern int stbi_write_tga (char const *filename, int x, int y, int comp, void *data);\n#endif\n\n// PRIMARY API - works on images of any type\n\n// load image by filename, open file, or memory buffer\n#ifndef STBI_NO_STDIO\nextern stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\nextern int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\nextern stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n// for stbi_load_from_file, file pointer is left pointing immediately after image\n\n#ifndef STBI_NO_HDR\n#ifndef STBI_NO_STDIO\nextern float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\nextern float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n\nextern void stbi_hdr_to_ldr_gamma(float gamma);\nextern void stbi_hdr_to_ldr_scale(float scale);\n\nextern void stbi_ldr_to_hdr_gamma(float gamma);\nextern void stbi_ldr_to_hdr_scale(float scale);\n\n#endif // STBI_NO_HDR\n\n// get a VERY brief reason for failure\n// NOT THREADSAFE\nextern char *stbi_failure_reason (void); \n\n// free the loaded image -- this is just free()\nextern void stbi_image_free (void *retval_from_stbi_load);\n\n// get image dimensions & components without fully decoding\nextern int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\nextern int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);\n#ifndef STBI_NO_STDIO\nextern int stbi_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_is_hdr (char const *filename);\nextern int stbi_is_hdr_from_file(FILE *f);\n#endif\n\n// ZLIB client - used by PNG, available for other purposes\n\nextern char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);\nextern char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);\nextern int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);\n\nextern char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);\nextern int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);\n\n// TYPE-SPECIFIC ACCESS\n\n// is it a jpeg?\nextern int stbi_jpeg_test_memory (stbi_uc const *buffer, int len);\nextern stbi_uc *stbi_jpeg_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\nextern int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n#ifndef STBI_NO_STDIO\nextern stbi_uc *stbi_jpeg_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern int stbi_jpeg_test_file (FILE *f);\nextern stbi_uc *stbi_jpeg_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n\nextern int stbi_jpeg_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_jpeg_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\n\n// is it a png?\nextern int stbi_png_test_memory (stbi_uc const *buffer, int len);\nextern stbi_uc *stbi_png_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\nextern int stbi_png_info_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp);\n\n#ifndef STBI_NO_STDIO\nextern stbi_uc *stbi_png_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern int stbi_png_info (char const *filename, int *x, int *y, int *comp);\nextern int stbi_png_test_file (FILE *f);\nextern stbi_uc *stbi_png_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\nextern int stbi_png_info_from_file (FILE *f, int *x, int *y, int *comp);\n#endif\n\n// is it a bmp?\nextern int stbi_bmp_test_memory (stbi_uc const *buffer, int len);\n\nextern stbi_uc *stbi_bmp_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_bmp_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n#ifndef STBI_NO_STDIO\nextern int stbi_bmp_test_file (FILE *f);\nextern stbi_uc *stbi_bmp_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\n\n// is it a tga?\nextern int stbi_tga_test_memory (stbi_uc const *buffer, int len);\n\nextern stbi_uc *stbi_tga_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_tga_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n#ifndef STBI_NO_STDIO\nextern int stbi_tga_test_file (FILE *f);\nextern stbi_uc *stbi_tga_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\n\n// is it a psd?\nextern int stbi_psd_test_memory (stbi_uc const *buffer, int len);\n\nextern stbi_uc *stbi_psd_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_psd_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n#ifndef STBI_NO_STDIO\nextern int stbi_psd_test_file (FILE *f);\nextern stbi_uc *stbi_psd_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\n\n// is it an hdr?\nextern int stbi_hdr_test_memory (stbi_uc const *buffer, int len);\n\nextern float * stbi_hdr_load (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_hdr_load_rgbe (char const *filename, int *x, int *y, int *comp, int req_comp);\nextern float * stbi_hdr_load_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n#ifndef STBI_NO_STDIO\nextern int stbi_hdr_test_file (FILE *f);\nextern float * stbi_hdr_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);\nextern stbi_uc *stbi_hdr_load_rgbe_file (FILE *f, int *x, int *y, int *comp, int req_comp);\n#endif\n\n// define new loaders\ntypedef struct\n{\n int (*test_memory)(stbi_uc const *buffer, int len);\n stbi_uc * (*load_from_memory)(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);\n #ifndef STBI_NO_STDIO\n int (*test_file)(FILE *f);\n stbi_uc * (*load_from_file)(FILE *f, int *x, int *y, int *comp, int req_comp);\n #endif\n} stbi_loader;\n\n// register a loader by filling out the above structure (you must defined ALL functions)\n// returns 1 if added or already added, 0 if not added (too many loaders)\n// NOT THREADSAFE\nextern int stbi_register_loader(stbi_loader *loader);\n\n// define faster low-level operations (typically SIMD support)\n#if STBI_SIMD\ntypedef void (*stbi_idct_8x8)(uint8 *out, int out_stride, short data[64], unsigned short *dequantize);\n// compute an integer IDCT on \"input\"\n// input[x] = data[x] * dequantize[x]\n// write results to 'out': 64 samples, each run of 8 spaced by 'out_stride'\n// CLAMP results to 0..255\ntypedef void (*stbi_YCbCr_to_RGB_run)(uint8 *output, uint8 const *y, uint8 const *cb, uint8 const *cr, int count, int step);\n// compute a conversion from YCbCr to RGB\n// 'count' pixels\n// write pixels to 'output'; each pixel is 'step' bytes (either 3 or 4; if 4, write '255' as 4th), order R,G,B\n// y: Y input channel\n// cb: Cb input channel; scale/biased to be 0..255\n// cr: Cr input channel; scale/biased to be 0..255\n\nextern void stbi_install_idct(stbi_idct_8x8 func);\nextern void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func);\n#endif // STBI_SIMD\n\n#ifdef __cplusplus\n}\n#endif\n\n//\n//\n//// end header file /////////////////////////////////////////////////////\n#endif // STBI_INCLUDE_STB_IMAGE_H\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.371, "dedup_hash": "27d065943d690cc5", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_assimp", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Assimp", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/postprocessing/bumpmapping/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/assimp/DefaultLogger.hpp", "language": "code", "loc": 153, "comment_density": 0.699, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n/** @file DefaultLogger.hpp\n*/\n\n#ifndef INCLUDED_AI_DEFAULTLOGGER\n#define INCLUDED_AI_DEFAULTLOGGER\n\n#include \"Logger.hpp\"\n#include \"LogStream.hpp\"\n#include \"NullLogger.hpp\"\n#include \n\nnamespace Assimp {\n// ------------------------------------------------------------------------------------\nclass IOStream;\nstruct LogStreamInfo;\n\n/** default name of logfile */\n#define ASSIMP_DEFAULT_LOG_NAME \"AssimpLog.txt\"\n\n// ------------------------------------------------------------------------------------\n/** @brief CPP-API: Primary logging facility of Assimp.\n *\n * The library stores its primary #Logger as a static member of this class.\n * #get() returns this primary logger. By default the underlying implementation is\n * just a #NullLogger which rejects all log messages. By calling #create(), logging\n * is turned on. To capture the log output multiple log streams (#LogStream) can be\n * attach to the logger. Some default streams for common streaming locations (such as\n * a file, std::cout, OutputDebugString()) are also provided.\n *\n * If you wish to customize the logging at an even deeper level supply your own\n * implementation of #Logger to #set().\n * @note The whole logging stuff causes a small extra overhead for all imports. */\nclass ASSIMP_API DefaultLogger :\n public Logger {\n\npublic:\n\n // ----------------------------------------------------------------------\n /** @brief Creates a logging instance.\n * @param name Name for log file. Only valid in combination\n * with the aiDefaultLogStream_FILE flag.\n * @param severity Log severity, VERBOSE turns on debug messages\n * @param defStreams Default log streams to be attached. Any bitwise\n * combination of the aiDefaultLogStream enumerated values.\n * If #aiDefaultLogStream_FILE is specified but an empty string is\n * passed for 'name', no log file is created at all.\n * @param io IOSystem to be used to open external files (such as the\n * log file). Pass NULL to rely on the default implementation.\n * This replaces the default #NullLogger with a #DefaultLogger instance. */\n static Logger *create(const char* name = ASSIMP_DEFAULT_LOG_NAME,\n LogSeverity severity = NORMAL,\n unsigned int defStreams = aiDefaultLogStream_DEBUGGER | aiDefaultLogStream_FILE,\n IOSystem* io = NULL);\n\n // ----------------------------------------------------------------------\n /** @brief Setup a custom #Logger implementation.\n *\n * Use this if the provided #DefaultLogger class doesn't fit into\n * your needs. If the provided message formatting is OK for you,\n * it's much easier to use #create() and to attach your own custom\n * output streams to it.\n * @param logger Pass NULL to setup a default NullLogger*/\n static void set (Logger *logger);\n\n // ----------------------------------------------------------------------\n /** @brief Getter for singleton instance\n * @return Only instance. This is never null, but it could be a\n * NullLogger. Use isNullLogger to check this.*/\n static Logger *get();\n\n // ----------------------------------------------------------------------\n /** @brief Return whether a #NullLogger is currently active\n * @return true if the current logger is a #NullLogger.\n * Use create() or set() to setup a logger that does actually do\n * something else than just rejecting all log messages. */\n static bool isNullLogger();\n\n // ----------------------------------------------------------------------\n /** @brief Kills the current singleton logger and replaces it with a\n * #NullLogger instance. */\n static void kill();\n\n // ----------------------------------------------------------------------\n /** @copydoc Logger::attachStream */\n bool attachStream(LogStream *pStream,\n unsigned int severity);\n\n // ----------------------------------------------------------------------\n /** @copydoc Logger::detachStream */\n bool detachStream(LogStream *pStream,\n unsigned int severity);\n\n\nprivate:\n\n // ----------------------------------------------------------------------\n /** @briefPrivate construction for internal use by create().\n * @param severity Logging granularity */\n explicit DefaultLogger(LogSeverity severity);\n\n // ----------------------------------------------------------------------\n /** @briefDestructor */\n ~DefaultLogger();\n\nprivate:\n\n /** @brief Logs debug infos, only been written when severity level VERBOSE is set */\n void OnDebug(const char* message);\n\n /** @brief Logs an info message */\n void OnInfo(const char* message);\n\n /** @brief Logs a warning message */\n void OnWarn(const char* message);\n\n /** @brief Logs an error message */\n void OnError(const char* message);\n\n // ----------------------------------------------------------------------\n /** @brief Writes a message to all streams */\n void WriteToStreams(const char* message, ErrorSeverity ErrorSev );\n\n // ----------------------------------------------------------------------\n /** @brief Returns the thread id.\n * @note This is an OS specific feature, if not supported, a\n * zero will be returned.\n */\n unsigned int GetThreadID();\n\nprivate:\n // Aliases for stream container\n typedef std::vector StreamArray;\n typedef std::vector::iterator StreamIt;\n typedef std::vector::const_iterator ConstStreamIt;\n\n //! only logging instance\n static Logger *m_pLogger;\n static NullLogger s_pNullLogger;\n\n //! Attached streams\n StreamArray m_StreamArray;\n\n bool noRepeatMsg;\n char lastMsg[MAX_LOG_MESSAGE_LENGTH*2];\n size_t lastLen;\n};\n// ------------------------------------------------------------------------------------\n\n} // Namespace Assimp\n\n#endif // !! INCLUDED_AI_DEFAULTLOGGER\n"}, {"path": "includes/assimp/Exporter.hpp", "language": "code", "loc": 419, "comment_density": 0.749, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2011, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\ncopyright notice, this list of conditions and the\nfollowing disclaimer.\n\n* Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the\nfollowing disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\ncontributors may be used to endorse or promote products\nderived from this software without specific prior\nwritten permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file Exporter.hpp\n* @brief Defines the CPP-API for the Assimp export interface\n*/\n#ifndef AI_EXPORT_HPP_INC\n#define AI_EXPORT_HPP_INC\n\n#ifndef ASSIMP_BUILD_NO_EXPORT\n\n#include \"cexport.h\"\n#include \n\nnamespace Assimp {\n class ExporterPimpl;\n class IOSystem;\n\n\n// ----------------------------------------------------------------------------------\n/** CPP-API: The Exporter class forms an C++ interface to the export functionality\n * of the Open Asset Import Library. Note that the export interface is available\n * only if Assimp has been built with ASSIMP_BUILD_NO_EXPORT not defined.\n *\n * The interface is modelled after the importer interface and mostly\n * symmetric. The same rules for threading etc. apply.\n *\n * In a nutshell, there are two export interfaces: #Export, which writes the\n * output file(s) either to the regular file system or to a user-supplied\n * #IOSystem, and #ExportToBlob which returns a linked list of memory\n * buffers (blob), each referring to one output file (in most cases\n * there will be only one output file of course, but this extra complexity is\n * needed since Assimp aims at supporting a wide range of file formats).\n *\n * #ExportToBlob is especially useful if you intend to work\n * with the data in-memory.\n*/\n\nclass ASSIMP_API ExportProperties;\n\nclass ASSIMP_API Exporter\n // TODO: causes good ol' base class has no dll interface warning\n//#ifdef __cplusplus\n// : public boost::noncopyable\n//#endif // __cplusplus\n{\npublic:\n\n /** Function pointer type of a Export worker function */\n typedef void (*fpExportFunc)(const char*, IOSystem*, const aiScene*, const ExportProperties*);\n\n /** Internal description of an Assimp export format option */\n struct ExportFormatEntry\n {\n /// Public description structure to be returned by aiGetExportFormatDescription()\n aiExportFormatDesc mDescription;\n\n // Worker function to do the actual exporting\n fpExportFunc mExportFunction;\n\n // Postprocessing steps to be executed PRIOR to invoking mExportFunction\n unsigned int mEnforcePP;\n\n // Constructor to fill all entries\n ExportFormatEntry( const char* pId, const char* pDesc, const char* pExtension, fpExportFunc pFunction, unsigned int pEnforcePP = 0u)\n {\n mDescription.id = pId;\n mDescription.description = pDesc;\n mDescription.fileExtension = pExtension;\n mExportFunction = pFunction;\n mEnforcePP = pEnforcePP;\n }\n\n ExportFormatEntry() :\n mExportFunction()\n , mEnforcePP()\n {\n mDescription.id = NULL;\n mDescription.description = NULL;\n mDescription.fileExtension = NULL;\n }\n };\n\n\npublic:\n\n\n Exporter();\n ~Exporter();\n\npublic:\n\n\n // -------------------------------------------------------------------\n /** Supplies a custom IO handler to the exporter to use to open and\n * access files.\n *\n * If you need #Export to use custom IO logic to access the files,\n * you need to supply a custom implementation of IOSystem and\n * IOFile to the exporter.\n *\n * #Exporter takes ownership of the object and will destroy it\n * afterwards. The previously assigned handler will be deleted.\n * Pass NULL to take again ownership of your IOSystem and reset Assimp\n * to use its default implementation, which uses plain file IO.\n *\n * @param pIOHandler The IO handler to be used in all file accesses\n * of the Importer. */\n void SetIOHandler( IOSystem* pIOHandler);\n\n // -------------------------------------------------------------------\n /** Retrieves the IO handler that is currently set.\n * You can use #IsDefaultIOHandler() to check whether the returned\n * interface is the default IO handler provided by ASSIMP. The default\n * handler is active as long the application doesn't supply its own\n * custom IO handler via #SetIOHandler().\n * @return A valid IOSystem interface, never NULL. */\n IOSystem* GetIOHandler() const;\n\n // -------------------------------------------------------------------\n /** Checks whether a default IO handler is active\n * A default handler is active as long the application doesn't\n * supply its own custom IO handler via #SetIOHandler().\n * @return true by default */\n bool IsDefaultIOHandler() const;\n\n\n\n // -------------------------------------------------------------------\n /** Exports the given scene to a chosen file format. Returns the exported\n * data as a binary blob which you can write into a file or something.\n * When you're done with the data, simply let the #Exporter instance go\n * out of scope to have it released automatically.\n * @param pScene The scene to export. Stays in possession of the caller,\n * is not changed by the function.\n * @param pFormatId ID string to specify to which format you want to\n * export to. Use\n * #GetExportFormatCount / #GetExportFormatDescription to learn which\n * export formats are available.\n * @param pPreprocessing See the documentation for #Export\n * @return the exported data or NULL in case of error.\n * @note If the Exporter instance did already hold a blob from\n * a previous call to #ExportToBlob, it will be disposed.\n * Any IO handlers set via #SetIOHandler are ignored here.\n * @note Use aiCopyScene() to get a modifiable copy of a previously\n * imported scene. */\n const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);\n inline const aiExportDataBlob* ExportToBlob( const aiScene* pScene, const std::string& pFormatId, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);\n\n\n // -------------------------------------------------------------------\n /** Convenience function to export directly to a file. Use\n * #SetIOSystem to supply a custom IOSystem to gain fine-grained control\n * about the output data flow of the export process.\n * @param pBlob A data blob obtained from a previous call to #aiExportScene. Must not be NULL.\n * @param pPath Full target file name. Target must be accessible.\n * @param pPreprocessing Accepts any choice of the #aiPostProcessSteps enumerated\n * flags, but in reality only a subset of them makes sense here. Specifying\n * 'preprocessing' flags is useful if the input scene does not conform to\n * Assimp's default conventions as specified in the @link data Data Structures Page @endlink.\n * In short, this means the geometry data should use a right-handed coordinate systems, face\n * winding should be counter-clockwise and the UV coordinate origin is assumed to be in\n * the upper left. The #aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and\n * #aiProcess_FlipWindingOrder flags are used in the import side to allow users\n * to have those defaults automatically adapted to their conventions. Specifying those flags\n * for exporting has the opposite effect, respectively. Some other of the\n * #aiPostProcessSteps enumerated values may be useful as well, but you'll need\n * to try out what their effect on the exported file is. Many formats impose\n * their own restrictions on the structure of the geometry stored therein,\n * so some preprocessing may have little or no effect at all, or may be\n * redundant as exporters would apply them anyhow. A good example\n * is triangulation - whilst you can enforce it by specifying\n * the #aiProcess_Triangulate flag, most export formats support only\n * triangulate data so they would run the step even if it wasn't requested.\n *\n * If assimp detects that the input scene was directly taken from the importer side of\n * the library (i.e. not copied using aiCopyScene and potentially modified afterwards),\n * any postprocessing steps already applied to the scene will not be applied again, unless\n * they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and\n * #aiProcess_FlipWindingOrder).\n * @return AI_SUCCESS if everything was fine.\n * @note Use aiCopyScene() to get a modifiable copy of a previously\n * imported scene.*/\n aiReturn Export( const aiScene* pScene, const char* pFormatId, const char* pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);\n inline aiReturn Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing = 0u, const ExportProperties* pProperties = NULL);\n\n\n // -------------------------------------------------------------------\n /** Returns an error description of an error that occurred in #Export\n * or #ExportToBlob\n *\n * Returns an empty string if no error occurred.\n * @return A description of the last error, an empty string if no\n * error occurred. The string is never NULL.\n *\n * @note The returned function remains valid until one of the\n * following methods is called: #Export, #ExportToBlob, #FreeBlob */\n const char* GetErrorString() const;\n\n\n // -------------------------------------------------------------------\n /** Return the blob obtained from the last call to #ExportToBlob */\n const aiExportDataBlob* GetBlob() const;\n\n\n // -------------------------------------------------------------------\n /** Orphan the blob from the last call to #ExportToBlob. This means\n * the caller takes ownership and is thus responsible for calling\n * the C API function #aiReleaseExportBlob to release it. */\n const aiExportDataBlob* GetOrphanedBlob() const;\n\n\n // -------------------------------------------------------------------\n /** Frees the current blob.\n *\n * The function does nothing if no blob has previously been\n * previously produced via #ExportToBlob. #FreeBlob is called\n * automatically by the destructor. The only reason to call\n * it manually would be to reclaim as much storage as possible\n * without giving up the #Exporter instance yet. */\n void FreeBlob( );\n\n\n // -------------------------------------------------------------------\n /** Returns the number of export file formats available in the current\n * Assimp build. Use #Exporter::GetExportFormatDescription to\n * retrieve infos of a specific export format.\n *\n * This includes built-in exporters as well as exporters registered\n * using #RegisterExporter.\n **/\n size_t GetExportFormatCount() const;\n\n\n // -------------------------------------------------------------------\n /** Returns a description of the nth export file format. Use #\n * #Exporter::GetExportFormatCount to learn how many export\n * formats are supported.\n *\n * The returned pointer is of static storage duration iff the\n * pIndex pertains to a built-in exporter (i.e. one not registered\n * via #RegistrerExporter). It is restricted to the life-time of the\n * #Exporter instance otherwise.\n *\n * @param pIndex Index of the export format to retrieve information\n * for. Valid range is 0 to #Exporter::GetExportFormatCount\n * @return A description of that specific export format.\n * NULL if pIndex is out of range. */\n const aiExportFormatDesc* GetExportFormatDescription( size_t pIndex ) const;\n\n\n // -------------------------------------------------------------------\n /** Register a custom exporter. Custom export formats are limited to\n * to the current #Exporter instance and do not affect the\n * library globally. The indexes under which the format's\n * export format description can be queried are assigned\n * monotonously.\n * @param desc Exporter description.\n * @return aiReturn_SUCCESS if the export format was successfully\n * registered. A common cause that would prevent an exporter\n * from being registered is that its format id is already\n * occupied by another format. */\n aiReturn RegisterExporter(const ExportFormatEntry& desc);\n\n\n // -------------------------------------------------------------------\n /** Remove an export format previously registered with #RegisterExporter\n * from the #Exporter instance (this can also be used to drop\n * builtin exporters because those are implicitly registered\n * using #RegisterExporter).\n * @param id Format id to be unregistered, this refers to the\n * 'id' field of #aiExportFormatDesc.\n * @note Calling this method on a format description not yet registered\n * has no effect.*/\n void UnregisterExporter(const char* id);\n\n\nprotected:\n\n // Just because we don't want you to know how we're hacking around.\n ExporterPimpl* pimpl;\n};\n\n\nclass ASSIMP_API ExportProperties\n{\npublic:\n // Data type to store the key hash\n typedef unsigned int KeyType;\n\n // typedefs for our four configuration maps.\n // We don't need more, so there is no need for a generic solution\n typedef std::map IntPropertyMap;\n typedef std::map FloatPropertyMap;\n typedef std::map StringPropertyMap;\n typedef std::map MatrixPropertyMap;\n\npublic:\n\n /** Standard constructor\n * @see ExportProperties()\n */\n\n ExportProperties();\n\n // -------------------------------------------------------------------\n /** Copy constructor.\n *\n * This copies the configuration properties of another ExportProperties.\n * @see ExportProperties(const ExportProperties& other)\n */\n ExportProperties(const ExportProperties& other);\n\n // -------------------------------------------------------------------\n /** Set an integer configuration property.\n * @param szName Name of the property. All supported properties\n * are defined in the aiConfig.g header (all constants share the\n * prefix AI_CONFIG_XXX and are simple strings).\n * @param iValue New value of the property\n * @return true if the property was set before. The new value replaces\n * the previous value in this case.\n * @note Property of different types (float, int, string ..) are kept\n * on different stacks, so calling SetPropertyInteger() for a\n * floating-point property has no effect - the loader will call\n * GetPropertyFloat() to read the property, but it won't be there.\n */\n bool SetPropertyInteger(const char* szName, int iValue);\n\n // -------------------------------------------------------------------\n /** Set a boolean configuration property. Boolean properties\n * are stored on the integer stack internally so it's possible\n * to set them via #SetPropertyBool and query them with\n * #GetPropertyBool and vice versa.\n * @see SetPropertyInteger()\n */\n bool SetPropertyBool(const char* szName, bool value) {\n return SetPropertyInteger(szName,value);\n }\n\n // -------------------------------------------------------------------\n /** Set a floating-point configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyFloat(const char* szName, float fValue);\n\n // -------------------------------------------------------------------\n /** Set a string configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyString(const char* szName, const std::string& sValue);\n\n // -------------------------------------------------------------------\n /** Set a matrix configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue);\n\n // -------------------------------------------------------------------\n /** Get a configuration property.\n * @param szName Name of the property. All supported properties\n * are defined in the aiConfig.g header (all constants share the\n * prefix AI_CONFIG_XXX).\n * @param iErrorReturn Value that is returned if the property\n * is not found.\n * @return Current value of the property\n * @note Property of different types (float, int, string ..) are kept\n * on different lists, so calling SetPropertyInteger() for a\n * floating-point property has no effect - the loader will call\n * GetPropertyFloat() to read the property, but it won't be there.\n */\n int GetPropertyInteger(const char* szName,\n int iErrorReturn = 0xffffffff) const;\n\n // -------------------------------------------------------------------\n /** Get a boolean configuration property. Boolean properties\n * are stored on the integer stack internally so it's possible\n * to set them via #SetPropertyBool and query them with\n * #GetPropertyBool and vice versa.\n * @see GetPropertyInteger()\n */\n bool GetPropertyBool(const char* szName, bool bErrorReturn = false) const {\n return GetPropertyInteger(szName,bErrorReturn)!=0;\n }\n\n // -------------------------------------------------------------------\n /** Get a floating-point configuration property\n * @see GetPropertyInteger()\n */\n float GetPropertyFloat(const char* szName,\n float fErrorReturn = 10e10f) const;\n\n // -------------------------------------------------------------------\n /** Get a string configuration property\n *\n * The return value remains valid until the property is modified.\n * @see GetPropertyInteger()\n */\n const std::string GetPropertyString(const char* szName,\n const std::string& sErrorReturn = \"\") const;\n\n // -------------------------------------------------------------------\n /** Get a matrix configuration property\n *\n * The return value remains valid until the property is modified.\n * @see GetPropertyInteger()\n */\n const aiMatrix4x4 GetPropertyMatrix(const char* szName,\n const aiMatrix4x4& sErrorReturn = aiMatrix4x4()) const;\n\n // -------------------------------------------------------------------\n /** Determine a integer configuration property has been set.\n * @see HasPropertyInteger()\n */\n bool HasPropertyInteger(const char* szName) const;\n\n /** Determine a boolean configuration property has been set.\n * @see HasPropertyBool()\n */\n bool HasPropertyBool(const char* szName) const;\n\n /** Determine a boolean configuration property has been set.\n * @see HasPropertyFloat()\n */\n bool HasPropertyFloat(const char* szName) const;\n\n /** Determine a String configuration property has been set.\n * @see HasPropertyString()\n */\n bool HasPropertyString(const char* szName) const;\n\n /** Determine a Matrix configuration property has been set.\n * @see HasPropertyMatrix()\n */\n bool HasPropertyMatrix(const char* szName) const;\n\nprotected:\n\n /** List of integer properties */\n IntPropertyMap mIntProperties;\n\n /** List of floating-point properties */\n FloatPropertyMap mFloatProperties;\n\n /** List of string properties */\n StringPropertyMap mStringProperties;\n\n /** List of Matrix properties */\n MatrixPropertyMap mMatrixProperties;\n};\n\n\n// ----------------------------------------------------------------------------------\ninline const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const std::string& pFormatId,unsigned int pPreprocessing, const ExportProperties* pProperties)\n{\n return ExportToBlob(pScene,pFormatId.c_str(),pPreprocessing, pProperties);\n}\n\n// ----------------------------------------------------------------------------------\ninline aiReturn Exporter :: Export( const aiScene* pScene, const std::string& pFormatId, const std::string& pPath, unsigned int pPreprocessing, const ExportProperties* pProperties)\n{\n return Export(pScene,pFormatId.c_str(),pPath.c_str(),pPreprocessing, pProperties);\n}\n\n} // namespace Assimp\n#endif // ASSIMP_BUILD_NO_EXPORT\n#endif // AI_EXPORT_HPP_INC\n"}, {"path": "includes/assimp/IOStream.hpp", "language": "code", "loc": 116, "comment_density": 0.707, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file IOStream.hpp\n * @brief File I/O wrappers for C++.\n */\n\n#ifndef AI_IOSTREAM_H_INC\n#define AI_IOSTREAM_H_INC\n\n#include \"types.h\"\n\n#ifndef __cplusplus\n# error This header requires C++ to be used. aiFileIO.h is the \\\n corresponding C interface.\n#endif\n\nnamespace Assimp {\n\n// ----------------------------------------------------------------------------------\n/** @brief CPP-API: Class to handle file I/O for C++\n *\n * Derive an own implementation from this interface to provide custom IO handling\n * to the Importer. If you implement this interface, be sure to also provide an\n * implementation for IOSystem that creates instances of your custom IO class.\n*/\nclass ASSIMP_API IOStream\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\nprotected:\n /** Constructor protected, use IOSystem::Open() to create an instance. */\n IOStream(void);\n\npublic:\n // -------------------------------------------------------------------\n /** @brief Destructor. Deleting the object closes the underlying file,\n * alternatively you may use IOSystem::Close() to release the file.\n */\n virtual ~IOStream();\n\n // -------------------------------------------------------------------\n /** @brief Read from the file\n *\n * See fread() for more details\n * This fails for write-only files */\n virtual size_t Read(void* pvBuffer,\n size_t pSize,\n size_t pCount) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Write to the file\n *\n * See fwrite() for more details\n * This fails for read-only files */\n virtual size_t Write(const void* pvBuffer,\n size_t pSize,\n size_t pCount) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Set the read/write cursor of the file\n *\n * Note that the offset is _negative_ for aiOrigin_END.\n * See fseek() for more details */\n virtual aiReturn Seek(size_t pOffset,\n aiOrigin pOrigin) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Get the current position of the read/write cursor\n *\n * See ftell() for more details */\n virtual size_t Tell() const = 0;\n\n // -------------------------------------------------------------------\n /** @brief Returns filesize\n * Returns the filesize. */\n virtual size_t FileSize() const = 0;\n\n // -------------------------------------------------------------------\n /** @brief Flush the contents of the file buffer (for writers)\n * See fflush() for more details.\n */\n virtual void Flush() = 0;\n}; //! class IOStream\n\n// ----------------------------------------------------------------------------------\ninline IOStream::IOStream()\n{\n // empty\n}\n\n// ----------------------------------------------------------------------------------\ninline IOStream::~IOStream()\n{\n // empty\n}\n// ----------------------------------------------------------------------------------\n} //!namespace Assimp\n\n#endif //!!AI_IOSTREAM_H_INC\n"}, {"path": "includes/assimp/IOSystem.hpp", "language": "code", "loc": 242, "comment_density": 0.657, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file IOSystem.hpp\n * @brief File system wrapper for C++. Inherit this class to supply\n * custom file handling logic to the Import library.\n*/\n\n#ifndef AI_IOSYSTEM_H_INC\n#define AI_IOSYSTEM_H_INC\n\n#ifndef __cplusplus\n# error This header requires C++ to be used. aiFileIO.h is the \\\n corresponding C interface.\n#endif\n\n#include \"types.h\"\n\n#include \n\nnamespace Assimp {\nclass IOStream;\n\n// ---------------------------------------------------------------------------\n/** @brief CPP-API: Interface to the file system.\n *\n * Derive an own implementation from this interface to supply custom file handling\n * to the importer library. If you implement this interface, you also want to\n * supply a custom implementation for IOStream.\n *\n * @see Importer::SetIOHandler() */\nclass ASSIMP_API IOSystem\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\npublic:\n\n // -------------------------------------------------------------------\n /** @brief Default constructor.\n *\n * Create an instance of your derived class and assign it to an\n * #Assimp::Importer instance by calling Importer::SetIOHandler().\n */\n IOSystem();\n\n // -------------------------------------------------------------------\n /** @brief Virtual destructor.\n *\n * It is safe to be called from within DLL Assimp, we're constructed\n * on Assimp's heap.\n */\n virtual ~IOSystem();\n\n\npublic:\n\n // -------------------------------------------------------------------\n /** @brief For backward compatibility\n * @see Exists(const char*)\n */\n AI_FORCE_INLINE bool Exists( const std::string& pFile) const;\n\n // -------------------------------------------------------------------\n /** @brief Tests for the existence of a file at the given path.\n *\n * @param pFile Path to the file\n * @return true if there is a file with this path, else false.\n */\n virtual bool Exists( const char* pFile) const = 0;\n\n // -------------------------------------------------------------------\n /** @brief Returns the system specific directory separator\n * @return System specific directory separator\n */\n virtual char getOsSeparator() const = 0;\n\n // -------------------------------------------------------------------\n /** @brief Open a new file with a given path.\n *\n * When the access to the file is finished, call Close() to release\n * all associated resources (or the virtual dtor of the IOStream).\n *\n * @param pFile Path to the file\n * @param pMode Desired file I/O mode. Required are: \"wb\", \"w\", \"wt\",\n * \"rb\", \"r\", \"rt\".\n *\n * @return New IOStream interface allowing the lib to access\n * the underlying file.\n * @note When implementing this class to provide custom IO handling,\n * you probably have to supply an own implementation of IOStream as well.\n */\n virtual IOStream* Open(const char* pFile,\n const char* pMode = \"rb\") = 0;\n\n // -------------------------------------------------------------------\n /** @brief For backward compatibility\n * @see Open(const char*, const char*)\n */\n inline IOStream* Open(const std::string& pFile,\n const std::string& pMode = std::string(\"rb\"));\n\n // -------------------------------------------------------------------\n /** @brief Closes the given file and releases all resources\n * associated with it.\n * @param pFile The file instance previously created by Open().\n */\n virtual void Close( IOStream* pFile) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Compares two paths and check whether the point to\n * identical files.\n *\n * The dummy implementation of this virtual member performs a\n * case-insensitive comparison of the given strings. The default IO\n * system implementation uses OS mechanisms to convert relative into\n * absolute paths, so the result can be trusted.\n * @param one First file\n * @param second Second file\n * @return true if the paths point to the same file. The file needn't\n * be existing, however.\n */\n virtual bool ComparePaths (const char* one,\n const char* second) const;\n\n // -------------------------------------------------------------------\n /** @brief For backward compatibility\n * @see ComparePaths(const char*, const char*)\n */\n inline bool ComparePaths (const std::string& one,\n const std::string& second) const;\n\n // -------------------------------------------------------------------\n /** @brief Pushes a new directory onto the directory stack.\n * @param path Path to push onto the stack.\n * @return True, when push was successful, false if path is empty.\n */\n virtual bool PushDirectory( const std::string &path );\n\n // -------------------------------------------------------------------\n /** @brief Returns the top directory from the stack.\n * @return The directory on the top of the stack.\n * Returns empty when no directory was pushed to the stack.\n */\n virtual const std::string &CurrentDirectory() const;\n\n // -------------------------------------------------------------------\n /** @brief Returns the number of directories stored on the stack.\n * @return The number of directories of the stack.\n */\n virtual size_t StackSize() const;\n\n // -------------------------------------------------------------------\n /** @brief Pops the top directory from the stack.\n * @return True, when a directory was on the stack. False if no\n * directory was on the stack.\n */\n virtual bool PopDirectory();\n\nprivate:\n std::vector m_pathStack;\n};\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE IOSystem::IOSystem() :\n m_pathStack()\n{\n // empty\n}\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE IOSystem::~IOSystem()\n{\n // empty\n}\n\n// ----------------------------------------------------------------------------\n// For compatibility, the interface of some functions taking a std::string was\n// changed to const char* to avoid crashes between binary incompatible STL\n// versions. This code her is inlined, so it shouldn't cause any problems.\n// ----------------------------------------------------------------------------\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE IOStream* IOSystem::Open(const std::string& pFile,\n const std::string& pMode)\n{\n // NOTE:\n // For compatibility, interface was changed to const char* to\n // avoid crashes between binary incompatible STL versions\n return Open(pFile.c_str(),pMode.c_str());\n}\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE bool IOSystem::Exists( const std::string& pFile) const\n{\n // NOTE:\n // For compatibility, interface was changed to const char* to\n // avoid crashes between binary incompatible STL versions\n return Exists(pFile.c_str());\n}\n\n// ----------------------------------------------------------------------------\ninline bool IOSystem::ComparePaths (const std::string& one,\n const std::string& second) const\n{\n // NOTE:\n // For compatibility, interface was changed to const char* to\n // avoid crashes between binary incompatible STL versions\n return ComparePaths(one.c_str(),second.c_str());\n}\n\n// ----------------------------------------------------------------------------\ninline bool IOSystem::PushDirectory( const std::string &path ) {\n if ( path.empty() ) {\n return false;\n }\n\n m_pathStack.push_back( path );\n\n return true;\n}\n\n// ----------------------------------------------------------------------------\ninline const std::string &IOSystem::CurrentDirectory() const {\n if ( m_pathStack.empty() ) {\n static const std::string Dummy(\"\");\n return Dummy;\n }\n return m_pathStack[ m_pathStack.size()-1 ];\n}\n\n// ----------------------------------------------------------------------------\ninline size_t IOSystem::StackSize() const {\n return m_pathStack.size();\n}\n\n// ----------------------------------------------------------------------------\ninline bool IOSystem::PopDirectory() {\n if ( m_pathStack.empty() ) {\n return false;\n }\n\n m_pathStack.pop_back();\n\n return true;\n}\n\n// ----------------------------------------------------------------------------\n\n} //!ns Assimp\n\n#endif //AI_IOSYSTEM_H_INC\n"}, {"path": "includes/assimp/Importer.hpp", "language": "code", "loc": 582, "comment_density": 0.828, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file Importer.hpp\n * @brief Defines the C++-API to the Open Asset Import Library.\n */\n#ifndef INCLUDED_AI_ASSIMP_HPP\n#define INCLUDED_AI_ASSIMP_HPP\n\n#ifndef __cplusplus\n# error This header requires C++ to be used. Use assimp.h for plain C.\n#endif\n\n// Public ASSIMP data structures\n#include \"types.h\"\n#include \"config.h\"\n\nnamespace Assimp {\n // =======================================================================\n // Public interface to Assimp\n class Importer;\n class Exporter; // export.hpp\n class IOStream;\n class IOSystem;\n class ProgressHandler;\n\n // =======================================================================\n // Plugin development\n //\n // Include the following headers for the declarations:\n // BaseImporter.h\n // BaseProcess.h\n class BaseImporter;\n class BaseProcess;\n class SharedPostProcessInfo;\n class BatchLoader;\n\n // =======================================================================\n // Holy stuff, only for members of the high council of the Jedi.\n class ImporterPimpl;\n class ExporterPimpl; // export.hpp\n} //! namespace Assimp\n\n#define AI_PROPERTY_WAS_NOT_EXISTING 0xffffffff\n\nstruct aiScene;\n\n// importerdesc.h\nstruct aiImporterDesc;\n\n/** @namespace Assimp Assimp's CPP-API and all internal APIs */\nnamespace Assimp {\n\n// ----------------------------------------------------------------------------------\n/** CPP-API: The Importer class forms an C++ interface to the functionality of the\n* Open Asset Import Library.\n*\n* Create an object of this class and call ReadFile() to import a file.\n* If the import succeeds, the function returns a pointer to the imported data.\n* The data remains property of the object, it is intended to be accessed\n* read-only. The imported data will be destroyed along with the Importer\n* object. If the import fails, ReadFile() returns a NULL pointer. In this\n* case you can retrieve a human-readable error description be calling\n* GetErrorString(). You can call ReadFile() multiple times with a single Importer\n* instance. Actually, constructing Importer objects involves quite many\n* allocations and may take some time, so it's better to reuse them as often as\n* possible.\n*\n* If you need the Importer to do custom file handling to access the files,\n* implement IOSystem and IOStream and supply an instance of your custom\n* IOSystem implementation by calling SetIOHandler() before calling ReadFile().\n* If you do not assign a custom IO handler, a default handler using the\n* standard C++ IO logic will be used.\n*\n* @note One Importer instance is not thread-safe. If you use multiple\n* threads for loading, each thread should maintain its own Importer instance.\n*/\nclass ASSIMP_API Importer {\npublic:\n /**\n * @brief The upper limit for hints.\n */\n static const unsigned int MaxLenHint = 200; \n\npublic:\n\n // -------------------------------------------------------------------\n /** Constructor. Creates an empty importer object.\n *\n * Call ReadFile() to start the import process. The configuration\n * property table is initially empty.\n */\n Importer();\n\n // -------------------------------------------------------------------\n /** Copy constructor.\n *\n * This copies the configuration properties of another Importer.\n * If this Importer owns a scene it won't be copied.\n * Call ReadFile() to start the import process.\n */\n Importer(const Importer& other);\n\n // -------------------------------------------------------------------\n /** Destructor. The object kept ownership of the imported data,\n * which now will be destroyed along with the object.\n */\n ~Importer();\n\n\n // -------------------------------------------------------------------\n /** Registers a new loader.\n *\n * @param pImp Importer to be added. The Importer instance takes\n * ownership of the pointer, so it will be automatically deleted\n * with the Importer instance.\n * @return AI_SUCCESS if the loader has been added. The registration\n * fails if there is already a loader for a specific file extension.\n */\n aiReturn RegisterLoader(BaseImporter* pImp);\n\n // -------------------------------------------------------------------\n /** Unregisters a loader.\n *\n * @param pImp Importer to be unregistered.\n * @return AI_SUCCESS if the loader has been removed. The function\n * fails if the loader is currently in use (this could happen\n * if the #Importer instance is used by more than one thread) or\n * if it has not yet been registered.\n */\n aiReturn UnregisterLoader(BaseImporter* pImp);\n\n // -------------------------------------------------------------------\n /** Registers a new post-process step.\n *\n * At the moment, there's a small limitation: new post processing\n * steps are added to end of the list, or in other words, executed\n * last, after all built-in steps.\n * @param pImp Post-process step to be added. The Importer instance\n * takes ownership of the pointer, so it will be automatically\n * deleted with the Importer instance.\n * @return AI_SUCCESS if the step has been added correctly.\n */\n aiReturn RegisterPPStep(BaseProcess* pImp);\n\n // -------------------------------------------------------------------\n /** Unregisters a post-process step.\n *\n * @param pImp Step to be unregistered.\n * @return AI_SUCCESS if the step has been removed. The function\n * fails if the step is currently in use (this could happen\n * if the #Importer instance is used by more than one thread) or\n * if it has not yet been registered.\n */\n aiReturn UnregisterPPStep(BaseProcess* pImp);\n\n\n // -------------------------------------------------------------------\n /** Set an integer configuration property.\n * @param szName Name of the property. All supported properties\n * are defined in the aiConfig.g header (all constants share the\n * prefix AI_CONFIG_XXX and are simple strings).\n * @param iValue New value of the property\n * @return true if the property was set before. The new value replaces\n * the previous value in this case.\n * @note Property of different types (float, int, string ..) are kept\n * on different stacks, so calling SetPropertyInteger() for a\n * floating-point property has no effect - the loader will call\n * GetPropertyFloat() to read the property, but it won't be there.\n */\n bool SetPropertyInteger(const char* szName, int iValue);\n\n // -------------------------------------------------------------------\n /** Set a boolean configuration property. Boolean properties\n * are stored on the integer stack internally so it's possible\n * to set them via #SetPropertyBool and query them with\n * #GetPropertyBool and vice versa.\n * @see SetPropertyInteger()\n */\n bool SetPropertyBool(const char* szName, bool value) {\n return SetPropertyInteger(szName,value);\n }\n\n // -------------------------------------------------------------------\n /** Set a floating-point configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyFloat(const char* szName, float fValue);\n\n // -------------------------------------------------------------------\n /** Set a string configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyString(const char* szName, const std::string& sValue);\n\n // -------------------------------------------------------------------\n /** Set a matrix configuration property.\n * @see SetPropertyInteger()\n */\n bool SetPropertyMatrix(const char* szName, const aiMatrix4x4& sValue);\n\n // -------------------------------------------------------------------\n /** Get a configuration property.\n * @param szName Name of the property. All supported properties\n * are defined in the aiConfig.g header (all constants share the\n * prefix AI_CONFIG_XXX).\n * @param iErrorReturn Value that is returned if the property\n * is not found.\n * @return Current value of the property\n * @note Property of different types (float, int, string ..) are kept\n * on different lists, so calling SetPropertyInteger() for a\n * floating-point property has no effect - the loader will call\n * GetPropertyFloat() to read the property, but it won't be there.\n */\n int GetPropertyInteger(const char* szName,\n int iErrorReturn = 0xffffffff) const;\n\n // -------------------------------------------------------------------\n /** Get a boolean configuration property. Boolean properties\n * are stored on the integer stack internally so it's possible\n * to set them via #SetPropertyBool and query them with\n * #GetPropertyBool and vice versa.\n * @see GetPropertyInteger()\n */\n bool GetPropertyBool(const char* szName, bool bErrorReturn = false) const {\n return GetPropertyInteger(szName,bErrorReturn)!=0;\n }\n\n // -------------------------------------------------------------------\n /** Get a floating-point configuration property\n * @see GetPropertyInteger()\n */\n float GetPropertyFloat(const char* szName,\n float fErrorReturn = 10e10f) const;\n\n // -------------------------------------------------------------------\n /** Get a string configuration property\n *\n * The return value remains valid until the property is modified.\n * @see GetPropertyInteger()\n */\n const std::string GetPropertyString(const char* szName,\n const std::string& sErrorReturn = \"\") const;\n\n // -------------------------------------------------------------------\n /** Get a matrix configuration property\n *\n * The return value remains valid until the property is modified.\n * @see GetPropertyInteger()\n */\n const aiMatrix4x4 GetPropertyMatrix(const char* szName,\n const aiMatrix4x4& sErrorReturn = aiMatrix4x4()) const;\n\n // -------------------------------------------------------------------\n /** Supplies a custom IO handler to the importer to use to open and\n * access files. If you need the importer to use custom IO logic to\n * access the files, you need to provide a custom implementation of\n * IOSystem and IOFile to the importer. Then create an instance of\n * your custom IOSystem implementation and supply it by this function.\n *\n * The Importer takes ownership of the object and will destroy it\n * afterwards. The previously assigned handler will be deleted.\n * Pass NULL to take again ownership of your IOSystem and reset Assimp\n * to use its default implementation.\n *\n * @param pIOHandler The IO handler to be used in all file accesses\n * of the Importer.\n */\n void SetIOHandler( IOSystem* pIOHandler);\n\n // -------------------------------------------------------------------\n /** Retrieves the IO handler that is currently set.\n * You can use #IsDefaultIOHandler() to check whether the returned\n * interface is the default IO handler provided by ASSIMP. The default\n * handler is active as long the application doesn't supply its own\n * custom IO handler via #SetIOHandler().\n * @return A valid IOSystem interface, never NULL.\n */\n IOSystem* GetIOHandler() const;\n\n // -------------------------------------------------------------------\n /** Checks whether a default IO handler is active\n * A default handler is active as long the application doesn't\n * supply its own custom IO handler via #SetIOHandler().\n * @return true by default\n */\n bool IsDefaultIOHandler() const;\n\n // -------------------------------------------------------------------\n /** Supplies a custom progress handler to the importer. This\n * interface exposes a #Update() callback, which is called\n * more or less periodically (please don't sue us if it\n * isn't as periodically as you'd like it to have ...).\n * This can be used to implement progress bars and loading\n * timeouts.\n * @param pHandler Progress callback interface. Pass NULL to\n * disable progress reporting.\n * @note Progress handlers can be used to abort the loading\n * at almost any time.*/\n void SetProgressHandler ( ProgressHandler* pHandler );\n\n // -------------------------------------------------------------------\n /** Retrieves the progress handler that is currently set.\n * You can use #IsDefaultProgressHandler() to check whether the returned\n * interface is the default handler provided by ASSIMP. The default\n * handler is active as long the application doesn't supply its own\n * custom handler via #SetProgressHandler().\n * @return A valid ProgressHandler interface, never NULL.\n */\n ProgressHandler* GetProgressHandler() const;\n\n // -------------------------------------------------------------------\n /** Checks whether a default progress handler is active\n * A default handler is active as long the application doesn't\n * supply its own custom progress handler via #SetProgressHandler().\n * @return true by default\n */\n bool IsDefaultProgressHandler() const;\n\n // -------------------------------------------------------------------\n /** @brief Check whether a given set of postprocessing flags\n * is supported.\n *\n * Some flags are mutually exclusive, others are probably\n * not available because your excluded them from your\n * Assimp builds. Calling this function is recommended if\n * you're unsure.\n *\n * @param pFlags Bitwise combination of the aiPostProcess flags.\n * @return true if this flag combination is fine.\n */\n bool ValidateFlags(unsigned int pFlags) const;\n\n // -------------------------------------------------------------------\n /** Reads the given file and returns its contents if successful.\n *\n * If the call succeeds, the contents of the file are returned as a\n * pointer to an aiScene object. The returned data is intended to be\n * read-only, the importer object keeps ownership of the data and will\n * destroy it upon destruction. If the import fails, NULL is returned.\n * A human-readable error description can be retrieved by calling\n * GetErrorString(). The previous scene will be deleted during this call.\n * @param pFile Path and filename to the file to be imported.\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags. If you wish to inspect the imported\n * scene first in order to fine-tune your post-processing setup,\n * consider to use #ApplyPostProcessing().\n * @return A pointer to the imported data, NULL if the import failed.\n * The pointer to the scene remains in possession of the Importer\n * instance. Use GetOrphanedScene() to take ownership of it.\n *\n * @note Assimp is able to determine the file format of a file\n * automatically.\n */\n const aiScene* ReadFile(\n const char* pFile,\n unsigned int pFlags);\n\n // -------------------------------------------------------------------\n /** Reads the given file from a memory buffer and returns its\n * contents if successful.\n *\n * If the call succeeds, the contents of the file are returned as a\n * pointer to an aiScene object. The returned data is intended to be\n * read-only, the importer object keeps ownership of the data and will\n * destroy it upon destruction. If the import fails, NULL is returned.\n * A human-readable error description can be retrieved by calling\n * GetErrorString(). The previous scene will be deleted during this call.\n * Calling this method doesn't affect the active IOSystem.\n * @param pBuffer Pointer to the file data\n * @param pLength Length of pBuffer, in bytes\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags. If you wish to inspect the imported\n * scene first in order to fine-tune your post-processing setup,\n * consider to use #ApplyPostProcessing().\n * @param pHint An additional hint to the library. If this is a non\n * empty string, the library looks for a loader to support\n * the file extension specified by pHint and passes the file to\n * the first matching loader. If this loader is unable to completely\n * the request, the library continues and tries to determine the\n * file format on its own, a task that may or may not be successful.\n * Check the return value, and you'll know ...\n * @return A pointer to the imported data, NULL if the import failed.\n * The pointer to the scene remains in possession of the Importer\n * instance. Use GetOrphanedScene() to take ownership of it.\n *\n * @note This is a straightforward way to decode models from memory\n * buffers, but it doesn't handle model formats that spread their\n * data across multiple files or even directories. Examples include\n * OBJ or MD3, which outsource parts of their material info into\n * external scripts. If you need full functionality, provide\n * a custom IOSystem to make Assimp find these files and use\n * the regular ReadFile() API.\n */\n const aiScene* ReadFileFromMemory(\n const void* pBuffer,\n size_t pLength,\n unsigned int pFlags,\n const char* pHint = \"\");\n\n // -------------------------------------------------------------------\n /** Apply post-processing to an already-imported scene.\n *\n * This is strictly equivalent to calling #ReadFile() with the same\n * flags. However, you can use this separate function to inspect\n * the imported scene first to fine-tune your post-processing setup.\n * @param pFlags Provide a bitwise combination of the\n * #aiPostProcessSteps flags.\n * @return A pointer to the post-processed data. This is still the\n * same as the pointer returned by #ReadFile(). However, if\n * post-processing fails, the scene could now be NULL.\n * That's quite a rare case, post processing steps are not really\n * designed to 'fail'. To be exact, the #aiProcess_ValidateDS\n * flag is currently the only post processing step which can actually\n * cause the scene to be reset to NULL.\n *\n * @note The method does nothing if no scene is currently bound\n * to the #Importer instance. */\n const aiScene* ApplyPostProcessing(unsigned int pFlags);\n\n const aiScene* ApplyCustomizedPostProcessing( BaseProcess *rootProcess, bool requestValidation );\n\n // -------------------------------------------------------------------\n /** @brief Reads the given file and returns its contents if successful.\n *\n * This function is provided for backward compatibility.\n * See the const char* version for detailed docs.\n * @see ReadFile(const char*, pFlags) */\n const aiScene* ReadFile(\n const std::string& pFile,\n unsigned int pFlags);\n\n // -------------------------------------------------------------------\n /** Frees the current scene.\n *\n * The function does nothing if no scene has previously been\n * read via ReadFile(). FreeScene() is called automatically by the\n * destructor and ReadFile() itself. */\n void FreeScene( );\n\n // -------------------------------------------------------------------\n /** Returns an error description of an error that occurred in ReadFile().\n *\n * Returns an empty string if no error occurred.\n * @return A description of the last error, an empty string if no\n * error occurred. The string is never NULL.\n *\n * @note The returned function remains valid until one of the\n * following methods is called: #ReadFile(), #FreeScene(). */\n const char* GetErrorString() const;\n\n // -------------------------------------------------------------------\n /** Returns the scene loaded by the last successful call to ReadFile()\n *\n * @return Current scene or NULL if there is currently no scene loaded */\n const aiScene* GetScene() const;\n\n // -------------------------------------------------------------------\n /** Returns the scene loaded by the last successful call to ReadFile()\n * and releases the scene from the ownership of the Importer\n * instance. The application is now responsible for deleting the\n * scene. Any further calls to GetScene() or GetOrphanedScene()\n * will return NULL - until a new scene has been loaded via ReadFile().\n *\n * @return Current scene or NULL if there is currently no scene loaded\n * @note Use this method with maximal caution, and only if you have to.\n * By design, aiScene's are exclusively maintained, allocated and\n * deallocated by Assimp and no one else. The reasoning behind this\n * is the golden rule that deallocations should always be done\n * by the module that did the original allocation because heaps\n * are not necessarily shared. GetOrphanedScene() enforces you\n * to delete the returned scene by yourself, but this will only\n * be fine if and only if you're using the same heap as assimp.\n * On Windows, it's typically fine provided everything is linked\n * against the multithreaded-dll version of the runtime library.\n * It will work as well for static linkage with Assimp.*/\n aiScene* GetOrphanedScene();\n\n\n\n\n // -------------------------------------------------------------------\n /** Returns whether a given file extension is supported by ASSIMP.\n *\n * @param szExtension Extension to be checked.\n * Must include a trailing dot '.'. Example: \".3ds\", \".md3\".\n * Cases-insensitive.\n * @return true if the extension is supported, false otherwise */\n bool IsExtensionSupported(const char* szExtension) const;\n\n // -------------------------------------------------------------------\n /** @brief Returns whether a given file extension is supported by ASSIMP.\n *\n * This function is provided for backward compatibility.\n * See the const char* version for detailed and up-to-date docs.\n * @see IsExtensionSupported(const char*) */\n inline bool IsExtensionSupported(const std::string& szExtension) const;\n\n // -------------------------------------------------------------------\n /** Get a full list of all file extensions supported by ASSIMP.\n *\n * If a file extension is contained in the list this does of course not\n * mean that ASSIMP is able to load all files with this extension ---\n * it simply means there is an importer loaded which claims to handle\n * files with this file extension.\n * @param szOut String to receive the extension list.\n * Format of the list: \"*.3ds;*.obj;*.dae\". This is useful for\n * use with the WinAPI call GetOpenFileName(Ex). */\n void GetExtensionList(aiString& szOut) const;\n\n // -------------------------------------------------------------------\n /** @brief Get a full list of all file extensions supported by ASSIMP.\n *\n * This function is provided for backward compatibility.\n * See the aiString version for detailed and up-to-date docs.\n * @see GetExtensionList(aiString&)*/\n inline void GetExtensionList(std::string& szOut) const;\n\n // -------------------------------------------------------------------\n /** Get the number of imports currently registered with Assimp. */\n size_t GetImporterCount() const;\n\n // -------------------------------------------------------------------\n /** Get meta data for the importer corresponding to a specific index..\n *\n * For the declaration of #aiImporterDesc, include .\n * @param index Index to query, must be within [0,GetImporterCount())\n * @return Importer meta data structure, NULL if the index does not\n * exist or if the importer doesn't offer meta information (\n * importers may do this at the cost of being hated by their peers).*/\n const aiImporterDesc* GetImporterInfo(size_t index) const;\n\n // -------------------------------------------------------------------\n /** Find the importer corresponding to a specific index.\n *\n * @param index Index to query, must be within [0,GetImporterCount())\n * @return Importer instance. NULL if the index does not\n * exist. */\n BaseImporter* GetImporter(size_t index) const;\n\n // -------------------------------------------------------------------\n /** Find the importer corresponding to a specific file extension.\n *\n * This is quite similar to #IsExtensionSupported except a\n * BaseImporter instance is returned.\n * @param szExtension Extension to check for. The following formats\n * are recognized (BAH being the file extension): \"BAH\" (comparison\n * is case-insensitive), \".bah\", \"*.bah\" (wild card and dot\n * characters at the beginning of the extension are skipped).\n * @return NULL if no importer is found*/\n BaseImporter* GetImporter (const char* szExtension) const;\n\n // -------------------------------------------------------------------\n /** Find the importer index corresponding to a specific file extension.\n *\n * @param szExtension Extension to check for. The following formats\n * are recognized (BAH being the file extension): \"BAH\" (comparison\n * is case-insensitive), \".bah\", \"*.bah\" (wild card and dot\n * characters at the beginning of the extension are skipped).\n * @return (size_t)-1 if no importer is found */\n size_t GetImporterIndex (const char* szExtension) const;\n\n\n\n\n // -------------------------------------------------------------------\n /** Returns the storage allocated by ASSIMP to hold the scene data\n * in memory.\n *\n * This refers to the currently loaded file, see #ReadFile().\n * @param in Data structure to be filled.\n * @note The returned memory statistics refer to the actual\n * size of the use data of the aiScene. Heap-related overhead\n * is (naturally) not included.*/\n void GetMemoryRequirements(aiMemoryInfo& in) const;\n\n // -------------------------------------------------------------------\n /** Enables \"extra verbose\" mode.\n *\n * 'Extra verbose' means the data structure is validated after *every*\n * single post processing step to make sure everyone modifies the data\n * structure in a well-defined manner. This is a debug feature and not\n * intended for use in production environments. */\n void SetExtraVerbose(bool bDo);\n\n\n // -------------------------------------------------------------------\n /** Private, do not use. */\n ImporterPimpl* Pimpl() { return pimpl; }\n const ImporterPimpl* Pimpl() const { return pimpl; }\n\nprotected:\n\n // Just because we don't want you to know how we're hacking around.\n ImporterPimpl* pimpl;\n}; //! class Importer\n\n\n// ----------------------------------------------------------------------------\n// For compatibility, the interface of some functions taking a std::string was\n// changed to const char* to avoid crashes between binary incompatible STL\n// versions. This code her is inlined, so it shouldn't cause any problems.\n// ----------------------------------------------------------------------------\n\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE const aiScene* Importer::ReadFile( const std::string& pFile,unsigned int pFlags){\n return ReadFile(pFile.c_str(),pFlags);\n}\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE void Importer::GetExtensionList(std::string& szOut) const {\n aiString s;\n GetExtensionList(s);\n szOut = s.data;\n}\n// ----------------------------------------------------------------------------\nAI_FORCE_INLINE bool Importer::IsExtensionSupported(const std::string& szExtension) const {\n return IsExtensionSupported(szExtension.c_str());\n}\n\n} // !namespace Assimp\n#endif // INCLUDED_AI_ASSIMP_HPP\n"}, {"path": "includes/assimp/LogStream.hpp", "language": "code", "loc": 83, "comment_density": 0.747, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file LogStream.hpp\n * @brief Abstract base class 'LogStream', representing an output log stream.\n */\n#ifndef INCLUDED_AI_LOGSTREAM_H\n#define INCLUDED_AI_LOGSTREAM_H\n#include \"types.h\"\nnamespace Assimp {\nclass IOSystem;\n\n// ------------------------------------------------------------------------------------\n/** @brief CPP-API: Abstract interface for log stream implementations.\n *\n * Several default implementations are provided, see #aiDefaultLogStream for more\n * details. Writing your own implementation of LogStream is just necessary if these\n * are not enough for your purpose. */\nclass ASSIMP_API LogStream\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\nprotected:\n /** @brief Default constructor */\n LogStream() {\n }\npublic:\n /** @brief Virtual destructor */\n virtual ~LogStream() {\n }\n\n // -------------------------------------------------------------------\n /** @brief Overwrite this for your own output methods\n *\n * Log messages *may* consist of multiple lines and you shouldn't\n * expect a consistent formatting. If you want custom formatting\n * (e.g. generate HTML), supply a custom instance of Logger to\n * #DefaultLogger:set(). Usually you can *expect* that a log message\n * is exactly one line and terminated with a single \\n character.\n * @param message Message to be written */\n virtual void write(const char* message) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Creates a default log stream\n * @param streams Type of the default stream\n * @param name For aiDefaultLogStream_FILE: name of the output file\n * @param io For aiDefaultLogStream_FILE: IOSystem to be used to open the output\n * file. Pass NULL for the default implementation.\n * @return New LogStream instance. */\n static LogStream* createDefaultStream(aiDefaultLogStream stream,\n const char* name = \"AssimpLog.txt\",\n IOSystem* io = NULL);\n\n}; // !class LogStream\n// ------------------------------------------------------------------------------------\n} // Namespace Assimp\n\n#endif\n"}, {"path": "includes/assimp/Logger.hpp", "language": "code", "loc": 221, "comment_density": 0.661, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file Logger.hpp\n * @brief Abstract base class 'Logger', base of the logging system.\n */\n#ifndef INCLUDED_AI_LOGGER_H\n#define INCLUDED_AI_LOGGER_H\n\n#include \"types.h\"\nnamespace Assimp {\nclass LogStream;\n\n// Maximum length of a log message. Longer messages are rejected.\n#define MAX_LOG_MESSAGE_LENGTH 1024u\n\n// ----------------------------------------------------------------------------------\n/** @brief CPP-API: Abstract interface for logger implementations.\n * Assimp provides a default implementation and uses it for almost all\n * logging stuff ('DefaultLogger'). This class defines just basic logging\n * behaviour and is not of interest for you. Instead, take a look at #DefaultLogger. */\nclass ASSIMP_API Logger\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\npublic:\n\n // ----------------------------------------------------------------------\n /** @enum LogSeverity\n * @brief Log severity to describe the granularity of logging.\n */\n enum LogSeverity\n {\n NORMAL, //!< Normal granularity of logging\n VERBOSE //!< Debug infos will be logged, too\n };\n\n // ----------------------------------------------------------------------\n /** @enum ErrorSeverity\n * @brief Description for severity of a log message.\n *\n * Every LogStream has a bitwise combination of these flags.\n * A LogStream doesn't receive any messages of a specific type\n * if it doesn't specify the corresponding ErrorSeverity flag.\n */\n enum ErrorSeverity\n {\n Debugging = 1, //!< Debug log message\n Info = 2, //!< Info log message\n Warn = 4, //!< Warn log message\n Err = 8 //!< Error log message\n };\n\npublic:\n\n /** @brief Virtual destructor */\n virtual ~Logger();\n\n // ----------------------------------------------------------------------\n /** @brief Writes a debug message\n * @param message Debug message*/\n void debug(const char* message);\n inline void debug(const std::string &message);\n\n // ----------------------------------------------------------------------\n /** @brief Writes a info message\n * @param message Info message*/\n void info(const char* message);\n inline void info(const std::string &message);\n\n // ----------------------------------------------------------------------\n /** @brief Writes a warning message\n * @param message Warn message*/\n void warn(const char* message);\n inline void warn(const std::string &message);\n\n // ----------------------------------------------------------------------\n /** @brief Writes an error message\n * @param message Error message*/\n void error(const char* message);\n inline void error(const std::string &message);\n\n // ----------------------------------------------------------------------\n /** @brief Set a new log severity.\n * @param log_severity New severity for logging*/\n void setLogSeverity(LogSeverity log_severity);\n\n // ----------------------------------------------------------------------\n /** @brief Get the current log severity*/\n LogSeverity getLogSeverity() const;\n\n // ----------------------------------------------------------------------\n /** @brief Attach a new log-stream\n *\n * The logger takes ownership of the stream and is responsible\n * for its destruction (which is done using ::delete when the logger\n * itself is destroyed). Call detachStream to detach a stream and to\n * gain ownership of it again.\n * @param pStream Log-stream to attach\n * @param severity Message filter, specified which types of log\n * messages are dispatched to the stream. Provide a bitwise\n * combination of the ErrorSeverity flags.\n * @return true if the stream has been attached, false otherwise.*/\n virtual bool attachStream(LogStream *pStream,\n unsigned int severity = Debugging | Err | Warn | Info) = 0;\n\n // ----------------------------------------------------------------------\n /** @brief Detach a still attached stream from the logger (or\n * modify the filter flags bits)\n * @param pStream Log-stream instance for detaching\n * @param severity Provide a bitwise combination of the ErrorSeverity\n * flags. This value is &~ed with the current flags of the stream,\n * if the result is 0 the stream is detached from the Logger and\n * the caller retakes the possession of the stream.\n * @return true if the stream has been detached, false otherwise.*/\n virtual bool detachStream(LogStream *pStream,\n unsigned int severity = Debugging | Err | Warn | Info) = 0;\n\nprotected:\n\n /** Default constructor */\n Logger();\n\n /** Construction with a given log severity */\n explicit Logger(LogSeverity severity);\n\n // ----------------------------------------------------------------------\n /** @brief Called as a request to write a specific debug message\n * @param message Debug message. Never longer than\n * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').\n * @note The message string is only valid until the scope of\n * the function is left.\n */\n virtual void OnDebug(const char* message)= 0;\n\n // ----------------------------------------------------------------------\n /** @brief Called as a request to write a specific info message\n * @param message Info message. Never longer than\n * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').\n * @note The message string is only valid until the scope of\n * the function is left.\n */\n virtual void OnInfo(const char* message) = 0;\n\n // ----------------------------------------------------------------------\n /** @brief Called as a request to write a specific warn message\n * @param message Warn message. Never longer than\n * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').\n * @note The message string is only valid until the scope of\n * the function is left.\n */\n virtual void OnWarn(const char* message) = 0;\n\n // ----------------------------------------------------------------------\n /** @brief Called as a request to write a specific error message\n * @param message Error message. Never longer than\n * MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').\n * @note The message string is only valid until the scope of\n * the function is left.\n */\n virtual void OnError(const char* message) = 0;\n\nprotected:\n\n //! Logger severity\n LogSeverity m_Severity;\n};\n\n// ----------------------------------------------------------------------------------\n// Default constructor\ninline Logger::Logger() {\n setLogSeverity(NORMAL);\n}\n\n// ----------------------------------------------------------------------------------\n// Virtual destructor\ninline Logger::~Logger()\n{\n}\n\n// ----------------------------------------------------------------------------------\n// Construction with given logging severity\ninline Logger::Logger(LogSeverity severity) {\n setLogSeverity(severity);\n}\n\n// ----------------------------------------------------------------------------------\n// Log severity setter\ninline void Logger::setLogSeverity(LogSeverity log_severity){\n m_Severity = log_severity;\n}\n\n// ----------------------------------------------------------------------------------\n// Log severity getter\ninline Logger::LogSeverity Logger::getLogSeverity() const {\n return m_Severity;\n}\n\n// ----------------------------------------------------------------------------------\ninline void Logger::debug(const std::string &message)\n{\n return debug(message.c_str());\n}\n\n// ----------------------------------------------------------------------------------\ninline void Logger::error(const std::string &message)\n{\n return error(message.c_str());\n}\n\n// ----------------------------------------------------------------------------------\ninline void Logger::warn(const std::string &message)\n{\n return warn(message.c_str());\n}\n\n// ----------------------------------------------------------------------------------\ninline void Logger::info(const std::string &message)\n{\n return info(message.c_str());\n}\n\n// ----------------------------------------------------------------------------------\n\n} // Namespace Assimp\n\n#endif // !! INCLUDED_AI_LOGGER_H\n"}, {"path": "includes/assimp/NullLogger.hpp", "language": "code", "loc": 77, "comment_density": 0.688, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file NullLogger.hpp\n * @brief Dummy logger\n*/\n\n#ifndef INCLUDED_AI_NULLLOGGER_H\n#define INCLUDED_AI_NULLLOGGER_H\n\n#include \"Logger.hpp\"\nnamespace Assimp {\n// ---------------------------------------------------------------------------\n/** @brief CPP-API: Empty logging implementation.\n *\n * Does nothing! Used by default if the application hasn't requested a\n * custom logger via #DefaultLogger::set() or #DefaultLogger::create(); */\nclass ASSIMP_API NullLogger\n : public Logger {\n\npublic:\n\n /** @brief Logs a debug message */\n void OnDebug(const char* message) {\n (void)message; //this avoids compiler warnings\n }\n\n /** @brief Logs an info message */\n void OnInfo(const char* message) {\n (void)message; //this avoids compiler warnings\n }\n\n /** @brief Logs a warning message */\n void OnWarn(const char* message) {\n (void)message; //this avoids compiler warnings\n }\n\n /** @brief Logs an error message */\n void OnError(const char* message) {\n (void)message; //this avoids compiler warnings\n }\n\n /** @brief Detach a still attached stream from logger */\n bool attachStream(LogStream *pStream, unsigned int severity) {\n (void)pStream; (void)severity; //this avoids compiler warnings\n return false;\n }\n\n /** @brief Detach a still attached stream from logger */\n bool detachStream(LogStream *pStream, unsigned int severity) {\n (void)pStream; (void)severity; //this avoids compiler warnings\n return false;\n }\n\nprivate:\n};\n}\n#endif // !! AI_NULLLOGGER_H_INCLUDED\n"}, {"path": "includes/assimp/ProgressHandler.hpp", "language": "code", "loc": 108, "comment_density": 0.787, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file ProgressHandler.hpp\n * @brief Abstract base class 'ProgressHandler'.\n */\n#ifndef INCLUDED_AI_PROGRESSHANDLER_H\n#define INCLUDED_AI_PROGRESSHANDLER_H\n#include \"types.h\"\nnamespace Assimp {\n\n// ------------------------------------------------------------------------------------\n/** @brief CPP-API: Abstract interface for custom progress report receivers.\n *\n * Each #Importer instance maintains its own #ProgressHandler. The default\n * implementation provided by Assimp doesn't do anything at all. */\nclass ASSIMP_API ProgressHandler\n#ifndef SWIG\n : public Intern::AllocateFromAssimpHeap\n#endif\n{\nprotected:\n /** @brief Default constructor */\n ProgressHandler () {\n }\npublic:\n /** @brief Virtual destructor */\n virtual ~ProgressHandler () {\n }\n\n // -------------------------------------------------------------------\n /** @brief Progress callback.\n * @param percentage An estimate of the current loading progress,\n * in percent. Or -1.f if such an estimate is not available.\n *\n * There are restriction on what you may do from within your\n * implementation of this method: no exceptions may be thrown and no\n * non-const #Importer methods may be called. It is\n * not generally possible to predict the number of callbacks\n * fired during a single import.\n *\n * @return Return false to abort loading at the next possible\n * occasion (loaders and Assimp are generally allowed to perform\n * all needed cleanup tasks prior to returning control to the\n * caller). If the loading is aborted, #Importer::ReadFile()\n * returns always NULL.\n * */\n virtual bool Update(float percentage = -1.f) = 0;\n\n // -------------------------------------------------------------------\n /** @brief Progress callback for file loading steps\n * @param numberOfSteps The number of total post-processing\n * steps\n * @param currentStep The index of the current post-processing\n * step that will run, or equal to numberOfSteps if all of\n * them has finished. This number is always strictly monotone\n * increasing, although not necessarily linearly.\n *\n * @note This is currently only used at the start and the end\n * of the file parsing.\n * */\n virtual void UpdateFileRead(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {\n float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;\n Update( f * 0.5f );\n }\n\n // -------------------------------------------------------------------\n /** @brief Progress callback for post-processing steps\n * @param numberOfSteps The number of total post-processing\n * steps\n * @param currentStep The index of the current post-processing\n * step that will run, or equal to numberOfSteps if all of\n * them has finished. This number is always strictly monotone\n * increasing, although not necessarily linearly.\n * */\n virtual void UpdatePostProcess(int currentStep /*= 0*/, int numberOfSteps /*= 0*/) {\n float f = numberOfSteps ? currentStep / (float)numberOfSteps : 1.0f;\n Update( f * 0.5f + 0.5f );\n }\n\n}; // !class ProgressHandler\n// ------------------------------------------------------------------------------------\n} // Namespace Assimp\n\n#endif\n"}, {"path": "includes/assimp/ai_assert.h", "language": "code", "loc": 42, "comment_density": 0.786, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n#ifndef AI_DEBUG_H_INC\n#define AI_DEBUG_H_INC\n\n#ifdef ASSIMP_BUILD_DEBUG\n# include \n# define ai_assert(expression) assert(expression)\n#else\n# define ai_assert(expression)\n#endif\n\n\n#endif\n"}, {"path": "includes/assimp/anim.h", "language": "code", "loc": 395, "comment_density": 0.448, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file anim.h\n * @brief Defines the data structures in which the imported animations\n * are returned.\n */\n#ifndef AI_ANIM_H_INC\n#define AI_ANIM_H_INC\n\n#include \"types.h\"\n#include \"quaternion.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n/** A time-value pair specifying a certain 3D vector for the given time. */\nstruct aiVectorKey\n{\n /** The time of this key */\n double mTime;\n\n /** The value of this key */\n C_STRUCT aiVector3D mValue;\n\n#ifdef __cplusplus\n\n //! Default constructor\n aiVectorKey(){}\n\n //! Construction from a given time and key value\n aiVectorKey(double time, const aiVector3D& value)\n : mTime (time)\n , mValue (value)\n {}\n\n\n typedef aiVector3D elem_type;\n\n // Comparison operators. For use with std::find();\n bool operator == (const aiVectorKey& o) const {\n return o.mValue == this->mValue;\n }\n bool operator != (const aiVectorKey& o) const {\n return o.mValue != this->mValue;\n }\n\n // Relational operators. For use with std::sort();\n bool operator < (const aiVectorKey& o) const {\n return mTime < o.mTime;\n }\n bool operator > (const aiVectorKey& o) const {\n return mTime > o.mTime;\n }\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** A time-value pair specifying a rotation for the given time.\n * Rotations are expressed with quaternions. */\nstruct aiQuatKey\n{\n /** The time of this key */\n double mTime;\n\n /** The value of this key */\n C_STRUCT aiQuaternion mValue;\n\n#ifdef __cplusplus\n aiQuatKey(){\n }\n\n /** Construction from a given time and key value */\n aiQuatKey(double time, const aiQuaternion& value)\n : mTime (time)\n , mValue (value)\n {}\n\n typedef aiQuaternion elem_type;\n\n // Comparison operators. For use with std::find();\n bool operator == (const aiQuatKey& o) const {\n return o.mValue == this->mValue;\n }\n bool operator != (const aiQuatKey& o) const {\n return o.mValue != this->mValue;\n }\n\n // Relational operators. For use with std::sort();\n bool operator < (const aiQuatKey& o) const {\n return mTime < o.mTime;\n }\n bool operator > (const aiQuatKey& o) const {\n return mTime > o.mTime;\n }\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** Binds a anim mesh to a specific point in time. */\nstruct aiMeshKey\n{\n /** The time of this key */\n double mTime;\n\n /** Index into the aiMesh::mAnimMeshes array of the\n * mesh corresponding to the #aiMeshAnim hosting this\n * key frame. The referenced anim mesh is evaluated\n * according to the rules defined in the docs for #aiAnimMesh.*/\n unsigned int mValue;\n\n#ifdef __cplusplus\n\n aiMeshKey() {\n }\n\n /** Construction from a given time and key value */\n aiMeshKey(double time, const unsigned int value)\n : mTime (time)\n , mValue (value)\n {}\n\n typedef unsigned int elem_type;\n\n // Comparison operators. For use with std::find();\n bool operator == (const aiMeshKey& o) const {\n return o.mValue == this->mValue;\n }\n bool operator != (const aiMeshKey& o) const {\n return o.mValue != this->mValue;\n }\n\n // Relational operators. For use with std::sort();\n bool operator < (const aiMeshKey& o) const {\n return mTime < o.mTime;\n }\n bool operator > (const aiMeshKey& o) const {\n return mTime > o.mTime;\n }\n\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** Defines how an animation channel behaves outside the defined time\n * range. This corresponds to aiNodeAnim::mPreState and\n * aiNodeAnim::mPostState.*/\nenum aiAnimBehaviour\n{\n /** The value from the default node transformation is taken*/\n aiAnimBehaviour_DEFAULT = 0x0,\n\n /** The nearest key value is used without interpolation */\n aiAnimBehaviour_CONSTANT = 0x1,\n\n /** The value of the nearest two keys is linearly\n * extrapolated for the current time value.*/\n aiAnimBehaviour_LINEAR = 0x2,\n\n /** The animation is repeated.\n *\n * If the animation key go from n to m and the current\n * time is t, use the value at (t-n) % (|m-n|).*/\n aiAnimBehaviour_REPEAT = 0x3,\n\n\n\n /** This value is not used, it is just here to force the\n * the compiler to map this enum to a 32 Bit integer */\n#ifndef SWIG\n _aiAnimBehaviour_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** Describes the animation of a single node. The name specifies the\n * bone/node which is affected by this animation channel. The keyframes\n * are given in three separate series of values, one each for position,\n * rotation and scaling. The transformation matrix computed from these\n * values replaces the node's original transformation matrix at a\n * specific time.\n * This means all keys are absolute and not relative to the bone default pose.\n * The order in which the transformations are applied is\n * - as usual - scaling, rotation, translation.\n *\n * @note All keys are returned in their correct, chronological order.\n * Duplicate keys don't pass the validation step. Most likely there\n * will be no negative time values, but they are not forbidden also ( so\n * implementations need to cope with them! ) */\nstruct aiNodeAnim\n{\n /** The name of the node affected by this animation. The node\n * must exist and it must be unique.*/\n C_STRUCT aiString mNodeName;\n\n /** The number of position keys */\n unsigned int mNumPositionKeys;\n\n /** The position keys of this animation channel. Positions are\n * specified as 3D vector. The array is mNumPositionKeys in size.\n *\n * If there are position keys, there will also be at least one\n * scaling and one rotation key.*/\n C_STRUCT aiVectorKey* mPositionKeys;\n\n /** The number of rotation keys */\n unsigned int mNumRotationKeys;\n\n /** The rotation keys of this animation channel. Rotations are\n * given as quaternions, which are 4D vectors. The array is\n * mNumRotationKeys in size.\n *\n * If there are rotation keys, there will also be at least one\n * scaling and one position key. */\n C_STRUCT aiQuatKey* mRotationKeys;\n\n\n /** The number of scaling keys */\n unsigned int mNumScalingKeys;\n\n /** The scaling keys of this animation channel. Scalings are\n * specified as 3D vector. The array is mNumScalingKeys in size.\n *\n * If there are scaling keys, there will also be at least one\n * position and one rotation key.*/\n C_STRUCT aiVectorKey* mScalingKeys;\n\n\n /** Defines how the animation behaves before the first\n * key is encountered.\n *\n * The default value is aiAnimBehaviour_DEFAULT (the original\n * transformation matrix of the affected node is used).*/\n C_ENUM aiAnimBehaviour mPreState;\n\n /** Defines how the animation behaves after the last\n * key was processed.\n *\n * The default value is aiAnimBehaviour_DEFAULT (the original\n * transformation matrix of the affected node is taken).*/\n C_ENUM aiAnimBehaviour mPostState;\n\n#ifdef __cplusplus\n aiNodeAnim()\n {\n mNumPositionKeys = 0; mPositionKeys = NULL;\n mNumRotationKeys = 0; mRotationKeys = NULL;\n mNumScalingKeys = 0; mScalingKeys = NULL;\n\n mPreState = mPostState = aiAnimBehaviour_DEFAULT;\n }\n\n ~aiNodeAnim()\n {\n delete [] mPositionKeys;\n delete [] mRotationKeys;\n delete [] mScalingKeys;\n }\n#endif // __cplusplus\n};\n\n// ---------------------------------------------------------------------------\n/** Describes vertex-based animations for a single mesh or a group of\n * meshes. Meshes carry the animation data for each frame in their\n * aiMesh::mAnimMeshes array. The purpose of aiMeshAnim is to\n * define keyframes linking each mesh attachment to a particular\n * point in time. */\nstruct aiMeshAnim\n{\n /** Name of the mesh to be animated. An empty string is not allowed,\n * animated meshes need to be named (not necessarily uniquely,\n * the name can basically serve as wildcard to select a group\n * of meshes with similar animation setup)*/\n C_STRUCT aiString mName;\n\n /** Size of the #mKeys array. Must be 1, at least. */\n unsigned int mNumKeys;\n\n /** Key frames of the animation. May not be NULL. */\n C_STRUCT aiMeshKey* mKeys;\n\n#ifdef __cplusplus\n\n aiMeshAnim()\n : mNumKeys()\n , mKeys()\n {}\n\n ~aiMeshAnim()\n {\n delete[] mKeys;\n }\n\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** An animation consists of keyframe data for a number of nodes. For\n * each node affected by the animation a separate series of data is given.*/\nstruct aiAnimation\n{\n /** The name of the animation. If the modeling package this data was\n * exported from does support only a single animation channel, this\n * name is usually empty (length is zero). */\n C_STRUCT aiString mName;\n\n /** Duration of the animation in ticks. */\n double mDuration;\n\n /** Ticks per second. 0 if not specified in the imported file */\n double mTicksPerSecond;\n\n /** The number of bone animation channels. Each channel affects\n * a single node. */\n unsigned int mNumChannels;\n\n /** The node animation channels. Each channel affects a single node.\n * The array is mNumChannels in size. */\n C_STRUCT aiNodeAnim** mChannels;\n\n\n /** The number of mesh animation channels. Each channel affects\n * a single mesh and defines vertex-based animation. */\n unsigned int mNumMeshChannels;\n\n /** The mesh animation channels. Each channel affects a single mesh.\n * The array is mNumMeshChannels in size. */\n C_STRUCT aiMeshAnim** mMeshChannels;\n\n#ifdef __cplusplus\n aiAnimation()\n : mDuration(-1.)\n , mTicksPerSecond()\n , mNumChannels()\n , mChannels()\n , mNumMeshChannels()\n , mMeshChannels()\n {\n }\n\n ~aiAnimation()\n {\n // DO NOT REMOVE THIS ADDITIONAL CHECK\n if (mNumChannels && mChannels) {\n for( unsigned int a = 0; a < mNumChannels; a++) {\n delete mChannels[a];\n }\n\n delete [] mChannels;\n }\n if (mNumMeshChannels && mMeshChannels) {\n for( unsigned int a = 0; a < mNumMeshChannels; a++) {\n delete mMeshChannels[a];\n }\n\n delete [] mMeshChannels;\n }\n }\n#endif // __cplusplus\n};\n\n#ifdef __cplusplus\n}\n\n\n// some C++ utilities for inter- and extrapolation\nnamespace Assimp {\n\n// ---------------------------------------------------------------------------\n/** @brief CPP-API: Utility class to simplify interpolations of various data types.\n *\n * The type of interpolation is chosen automatically depending on the\n * types of the arguments. */\ntemplate \nstruct Interpolator\n{\n // ------------------------------------------------------------------\n /** @brief Get the result of the interpolation between a,b.\n *\n * The interpolation algorithm depends on the type of the operands.\n * aiQuaternion's and aiQuatKey's SLERP, the rest does a simple\n * linear interpolation. */\n void operator () (T& out,const T& a, const T& b, float d) const {\n out = a + (b-a)*d;\n }\n}; // ! Interpolator \n\n//! @cond Never\n\ntemplate <>\nstruct Interpolator {\n void operator () (aiQuaternion& out,const aiQuaternion& a,\n const aiQuaternion& b, float d) const\n {\n aiQuaternion::Interpolate(out,a,b,d);\n }\n}; // ! Interpolator \n\ntemplate <>\nstruct Interpolator {\n void operator () (unsigned int& out,unsigned int a,\n unsigned int b, float d) const\n {\n out = d>0.5f ? b : a;\n }\n}; // ! Interpolator \n\ntemplate <>\nstruct Interpolator {\n void operator () (aiVector3D& out,const aiVectorKey& a,\n const aiVectorKey& b, float d) const\n {\n Interpolator ipl;\n ipl(out,a.mValue,b.mValue,d);\n }\n}; // ! Interpolator \n\ntemplate <>\nstruct Interpolator {\n void operator () (aiQuaternion& out, const aiQuatKey& a,\n const aiQuatKey& b, float d) const\n {\n Interpolator ipl;\n ipl(out,a.mValue,b.mValue,d);\n }\n}; // ! Interpolator \n\ntemplate <>\nstruct Interpolator {\n void operator () (unsigned int& out, const aiMeshKey& a,\n const aiMeshKey& b, float d) const\n {\n Interpolator ipl;\n ipl(out,a.mValue,b.mValue,d);\n }\n}; // ! Interpolator \n\n//! @endcond\n} // ! end namespace Assimp\n\n\n\n#endif // __cplusplus\n#endif // AI_ANIM_H_INC\n"}, {"path": "includes/assimp/camera.h", "language": "code", "loc": 187, "comment_density": 0.733, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file camera.h\n * @brief Defines the aiCamera data structure\n */\n\n#ifndef AI_CAMERA_H_INC\n#define AI_CAMERA_H_INC\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n/** Helper structure to describe a virtual camera.\n *\n * Cameras have a representation in the node graph and can be animated.\n * An important aspect is that the camera itself is also part of the\n * scenegraph. This means, any values such as the look-at vector are not\n * *absolute*, they're relative to the coordinate system defined\n * by the node which corresponds to the camera. This allows for camera\n * animations. For static cameras parameters like the 'look-at' or 'up' vectors\n * are usually specified directly in aiCamera, but beware, they could also\n * be encoded in the node transformation. The following (pseudo)code sample\n * shows how to do it:

\n * @code\n * // Get the camera matrix for a camera at a specific time\n * // if the node hierarchy for the camera does not contain\n * // at least one animated node this is a static computation\n * get-camera-matrix (node sceneRoot, camera cam) : matrix\n * {\n * node cnd = find-node-for-camera(cam)\n * matrix cmt = identity()\n *\n * // as usual - get the absolute camera transformation for this frame\n * for each node nd in hierarchy from sceneRoot to cnd\n * matrix cur\n * if (is-animated(nd))\n * cur = eval-animation(nd)\n * else cur = nd->mTransformation;\n * cmt = mult-matrices( cmt, cur )\n * end for\n *\n * // now multiply with the camera's own local transform\n * cam = mult-matrices (cam, get-camera-matrix(cmt) )\n * }\n * @endcode\n *\n * @note some file formats (such as 3DS, ASE) export a \"target point\" -\n * the point the camera is looking at (it can even be animated). Assimp\n * writes the target point as a subnode of the camera's main node,\n * called \".Target\". However this is just additional information\n * then the transformation tracks of the camera main node make the\n * camera already look in the right direction.\n *\n*/\nstruct aiCamera\n{\n /** The name of the camera.\n *\n * There must be a node in the scenegraph with the same name.\n * This node specifies the position of the camera in the scene\n * hierarchy and can be animated.\n */\n C_STRUCT aiString mName;\n\n /** Position of the camera relative to the coordinate space\n * defined by the corresponding node.\n *\n * The default value is 0|0|0.\n */\n C_STRUCT aiVector3D mPosition;\n\n\n /** 'Up' - vector of the camera coordinate system relative to\n * the coordinate space defined by the corresponding node.\n *\n * The 'right' vector of the camera coordinate system is\n * the cross product of the up and lookAt vectors.\n * The default value is 0|1|0. The vector\n * may be normalized, but it needn't.\n */\n C_STRUCT aiVector3D mUp;\n\n\n /** 'LookAt' - vector of the camera coordinate system relative to\n * the coordinate space defined by the corresponding node.\n *\n * This is the viewing direction of the user.\n * The default value is 0|0|1. The vector\n * may be normalized, but it needn't.\n */\n C_STRUCT aiVector3D mLookAt;\n\n\n /** Half horizontal field of view angle, in radians.\n *\n * The field of view angle is the angle between the center\n * line of the screen and the left or right border.\n * The default value is 1/4PI.\n */\n float mHorizontalFOV;\n\n /** Distance of the near clipping plane from the camera.\n *\n * The value may not be 0.f (for arithmetic reasons to prevent\n * a division through zero). The default value is 0.1f.\n */\n float mClipPlaneNear;\n\n /** Distance of the far clipping plane from the camera.\n *\n * The far clipping plane must, of course, be further away than the\n * near clipping plane. The default value is 1000.f. The ratio\n * between the near and the far plane should not be too\n * large (between 1000-10000 should be ok) to avoid floating-point\n * inaccuracies which could lead to z-fighting.\n */\n float mClipPlaneFar;\n\n\n /** Screen aspect ratio.\n *\n * This is the ration between the width and the height of the\n * screen. Typical values are 4/3, 1/2 or 1/1. This value is\n * 0 if the aspect ratio is not defined in the source file.\n * 0 is also the default value.\n */\n float mAspect;\n\n#ifdef __cplusplus\n\n aiCamera()\n : mUp (0.f,1.f,0.f)\n , mLookAt (0.f,0.f,1.f)\n , mHorizontalFOV (0.25f * (float)AI_MATH_PI)\n , mClipPlaneNear (0.1f)\n , mClipPlaneFar (1000.f)\n , mAspect (0.f)\n {}\n\n /** @brief Get a *right-handed* camera matrix from me\n * @param out Camera matrix to be filled\n */\n void GetCameraMatrix (aiMatrix4x4& out) const\n {\n /** todo: test ... should work, but i'm not absolutely sure */\n\n /** We don't know whether these vectors are already normalized ...*/\n aiVector3D zaxis = mLookAt; zaxis.Normalize();\n aiVector3D yaxis = mUp; yaxis.Normalize();\n aiVector3D xaxis = mUp^mLookAt; xaxis.Normalize();\n\n out.a4 = -(xaxis * mPosition);\n out.b4 = -(yaxis * mPosition);\n out.c4 = -(zaxis * mPosition);\n\n out.a1 = xaxis.x;\n out.a2 = xaxis.y;\n out.a3 = xaxis.z;\n\n out.b1 = yaxis.x;\n out.b2 = yaxis.y;\n out.b3 = yaxis.z;\n\n out.c1 = zaxis.x;\n out.c2 = zaxis.y;\n out.c3 = zaxis.z;\n\n out.d1 = out.d2 = out.d3 = 0.f;\n out.d4 = 1.f;\n }\n\n#endif\n};\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // AI_CAMERA_H_INC\n"}, {"path": "includes/assimp/cexport.h", "language": "code", "loc": 222, "comment_density": 0.793, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2011, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\ncopyright notice, this list of conditions and the\nfollowing disclaimer.\n\n* Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the\nfollowing disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\ncontributors may be used to endorse or promote products\nderived from this software without specific prior\nwritten permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file cexport.h\n* @brief Defines the C-API for the Assimp export interface\n*/\n#ifndef AI_EXPORT_H_INC\n#define AI_EXPORT_H_INC\n\n#ifndef ASSIMP_BUILD_NO_EXPORT\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct aiScene; // aiScene.h\nstruct aiFileIO; // aiFileIO.h\n\n// --------------------------------------------------------------------------------\n/** Describes an file format which Assimp can export to. Use #aiGetExportFormatCount() to\n* learn how many export formats the current Assimp build supports and #aiGetExportFormatDescription()\n* to retrieve a description of an export format option.\n*/\nstruct aiExportFormatDesc\n{\n /// a short string ID to uniquely identify the export format. Use this ID string to\n /// specify which file format you want to export to when calling #aiExportScene().\n /// Example: \"dae\" or \"obj\"\n const char* id;\n\n /// A short description of the file format to present to users. Useful if you want\n /// to allow the user to select an export format.\n const char* description;\n\n /// Recommended file extension for the exported file in lower case.\n const char* fileExtension;\n};\n\n\n// --------------------------------------------------------------------------------\n/** Returns the number of export file formats available in the current Assimp build.\n * Use aiGetExportFormatDescription() to retrieve infos of a specific export format.\n */\nASSIMP_API size_t aiGetExportFormatCount(void);\n\n\n// --------------------------------------------------------------------------------\n/** Returns a description of the nth export file format. Use #aiGetExportFormatCount()\n * to learn how many export formats are supported. The description must be released by \n * calling aiReleaseExportFormatDescription afterwards.\n * @param pIndex Index of the export format to retrieve information for. Valid range is\n * 0 to #aiGetExportFormatCount()\n * @return A description of that specific export format. NULL if pIndex is out of range.\n */\nASSIMP_API const C_STRUCT aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex);\n\n// --------------------------------------------------------------------------------\n/** Release a description of the nth export file format. Must be returned by \n* aiGetExportFormatDescription\n* @param desc Pointer to the description\n*/\nASSIMP_API void aiReleaseExportFormatDescription( const C_STRUCT aiExportFormatDesc *desc );\n\n// --------------------------------------------------------------------------------\n/** Create a modifiable copy of a scene.\n * This is useful to import files via Assimp, change their topology and\n * export them again. Since the scene returned by the various importer functions\n * is const, a modifiable copy is needed.\n * @param pIn Valid scene to be copied\n * @param pOut Receives a modifiable copy of the scene. Use aiFreeScene() to\n * delete it again.\n */\nASSIMP_API void aiCopyScene(const C_STRUCT aiScene* pIn,\n C_STRUCT aiScene** pOut);\n\n\n// --------------------------------------------------------------------------------\n/** Frees a scene copy created using aiCopyScene() */\nASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn);\n\n// --------------------------------------------------------------------------------\n/** Exports the given scene to a chosen file format and writes the result file(s) to disk.\n* @param pScene The scene to export. Stays in possession of the caller, is not changed by the function.\n* The scene is expected to conform to Assimp's Importer output format as specified\n* in the @link data Data Structures Page @endlink. In short, this means the model data\n* should use a right-handed coordinate systems, face winding should be counter-clockwise\n* and the UV coordinate origin is assumed to be in the upper left. If your input data\n* uses different conventions, have a look at the last parameter.\n* @param pFormatId ID string to specify to which format you want to export to. Use\n* aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available.\n* @param pFileName Output file to write\n* @param pPreprocessing Accepts any choice of the #aiPostProcessSteps enumerated\n* flags, but in reality only a subset of them makes sense here. Specifying\n* 'preprocessing' flags is useful if the input scene does not conform to\n* Assimp's default conventions as specified in the @link data Data Structures Page @endlink.\n* In short, this means the geometry data should use a right-handed coordinate systems, face\n* winding should be counter-clockwise and the UV coordinate origin is assumed to be in\n* the upper left. The #aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and\n* #aiProcess_FlipWindingOrder flags are used in the import side to allow users\n* to have those defaults automatically adapted to their conventions. Specifying those flags\n* for exporting has the opposite effect, respectively. Some other of the\n* #aiPostProcessSteps enumerated values may be useful as well, but you'll need\n* to try out what their effect on the exported file is. Many formats impose\n* their own restrictions on the structure of the geometry stored therein,\n* so some preprocessing may have little or no effect at all, or may be\n* redundant as exporters would apply them anyhow. A good example\n* is triangulation - whilst you can enforce it by specifying\n* the #aiProcess_Triangulate flag, most export formats support only\n* triangulate data so they would run the step anyway.\n*\n* If assimp detects that the input scene was directly taken from the importer side of\n* the library (i.e. not copied using aiCopyScene and potentially modified afterwards),\n* any postprocessing steps already applied to the scene will not be applied again, unless\n* they show non-idempotent behaviour (#aiProcess_MakeLeftHanded, #aiProcess_FlipUVs and\n* #aiProcess_FlipWindingOrder).\n* @return a status code indicating the result of the export\n* @note Use aiCopyScene() to get a modifiable copy of a previously\n* imported scene.\n*/\nASSIMP_API aiReturn aiExportScene( const C_STRUCT aiScene* pScene,\n const char* pFormatId,\n const char* pFileName,\n unsigned int pPreprocessing);\n\n\n// --------------------------------------------------------------------------------\n/** Exports the given scene to a chosen file format using custom IO logic supplied by you.\n* @param pScene The scene to export. Stays in possession of the caller, is not changed by the function.\n* @param pFormatId ID string to specify to which format you want to export to. Use\n* aiGetExportFormatCount() / aiGetExportFormatDescription() to learn which export formats are available.\n* @param pFileName Output file to write\n* @param pIO custom IO implementation to be used. Use this if you use your own storage methods.\n* If none is supplied, a default implementation using standard file IO is used. Note that\n* #aiExportSceneToBlob is provided as convenience function to export to memory buffers.\n* @param pPreprocessing Please see the documentation for #aiExportScene\n* @return a status code indicating the result of the export\n* @note Include for the definition of #aiFileIO.\n* @note Use aiCopyScene() to get a modifiable copy of a previously\n* imported scene.\n*/\nASSIMP_API aiReturn aiExportSceneEx( const C_STRUCT aiScene* pScene,\n const char* pFormatId,\n const char* pFileName,\n C_STRUCT aiFileIO* pIO,\n unsigned int pPreprocessing );\n\n\n// --------------------------------------------------------------------------------\n/** Describes a blob of exported scene data. Use #aiExportSceneToBlob() to create a blob containing an\n* exported scene. The memory referred by this structure is owned by Assimp.\n* to free its resources. Don't try to free the memory on your side - it will crash for most build configurations\n* due to conflicting heaps.\n*\n* Blobs can be nested - each blob may reference another blob, which may in turn reference another blob and so on.\n* This is used when exporters write more than one output file for a given #aiScene. See the remarks for\n* #aiExportDataBlob::name for more information.\n*/\nstruct aiExportDataBlob\n{\n /// Size of the data in bytes\n size_t size;\n\n /// The data.\n void* data;\n\n /** Name of the blob. An empty string always\n indicates the first (and primary) blob,\n which contains the actual file data.\n Any other blobs are auxiliary files produced\n by exporters (i.e. material files). Existence\n of such files depends on the file format. Most\n formats don't split assets across multiple files.\n\n If used, blob names usually contain the file\n extension that should be used when writing\n the data to disc.\n */\n C_STRUCT aiString name;\n\n /** Pointer to the next blob in the chain or NULL if there is none. */\n C_STRUCT aiExportDataBlob * next;\n\n#ifdef __cplusplus\n /// Default constructor\n aiExportDataBlob() { size = 0; data = next = NULL; }\n /// Releases the data\n ~aiExportDataBlob() { delete [] static_cast( data ); delete next; }\n\nprivate:\n // no copying\n aiExportDataBlob(const aiExportDataBlob& );\n aiExportDataBlob& operator= (const aiExportDataBlob& );\n#endif // __cplusplus\n};\n\n// --------------------------------------------------------------------------------\n/** Exports the given scene to a chosen file format. Returns the exported data as a binary blob which\n* you can write into a file or something. When you're done with the data, use #aiReleaseExportBlob()\n* to free the resources associated with the export.\n* @param pScene The scene to export. Stays in possession of the caller, is not changed by the function.\n* @param pFormatId ID string to specify to which format you want to export to. Use\n* #aiGetExportFormatCount() / #aiGetExportFormatDescription() to learn which export formats are available.\n* @param pPreprocessing Please see the documentation for #aiExportScene\n* @return the exported data or NULL in case of error\n*/\nASSIMP_API const C_STRUCT aiExportDataBlob* aiExportSceneToBlob( const C_STRUCT aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing );\n\n\n// --------------------------------------------------------------------------------\n/** Releases the memory associated with the given exported data. Use this function to free a data blob\n* returned by aiExportScene().\n* @param pData the data blob returned by #aiExportSceneToBlob\n*/\nASSIMP_API void aiReleaseExportBlob( const C_STRUCT aiExportDataBlob* pData );\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // ASSIMP_BUILD_NO_EXPORT\n#endif // AI_EXPORT_H_INC\n\n"}, {"path": "includes/assimp/cfileio.h", "language": "code", "loc": 112, "comment_density": 0.688, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file cfileio.h\n * @brief Defines generic C routines to access memory-mapped files\n */\n#ifndef AI_FILEIO_H_INC\n#define AI_FILEIO_H_INC\n\n#include \"types.h\"\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nstruct aiFileIO;\nstruct aiFile;\n\n// aiFile callbacks\ntypedef size_t (*aiFileWriteProc) (C_STRUCT aiFile*, const char*, size_t, size_t);\ntypedef size_t (*aiFileReadProc) (C_STRUCT aiFile*, char*, size_t,size_t);\ntypedef size_t (*aiFileTellProc) (C_STRUCT aiFile*);\ntypedef void (*aiFileFlushProc) (C_STRUCT aiFile*);\ntypedef aiReturn (*aiFileSeek)(C_STRUCT aiFile*, size_t, aiOrigin);\n\n// aiFileIO callbacks\ntypedef aiFile* (*aiFileOpenProc) (C_STRUCT aiFileIO*, const char*, const char*);\ntypedef void (*aiFileCloseProc) (C_STRUCT aiFileIO*, C_STRUCT aiFile*);\n\n// Represents user-defined data\ntypedef char* aiUserData;\n\n// ----------------------------------------------------------------------------------\n/** @brief C-API: File system callbacks\n *\n * Provided are functions to open and close files. Supply a custom structure to\n * the import function. If you don't, a default implementation is used. Use custom\n * file systems to enable reading from other sources, such as ZIPs\n * or memory locations. */\nstruct aiFileIO\n{\n /** Function used to open a new file\n */\n aiFileOpenProc OpenProc;\n\n /** Function used to close an existing file\n */\n aiFileCloseProc CloseProc;\n\n /** User-defined, opaque data */\n aiUserData UserData;\n};\n\n// ----------------------------------------------------------------------------------\n/** @brief C-API: File callbacks\n *\n * Actually, it's a data structure to wrap a set of fXXXX (e.g fopen)\n * replacement functions.\n *\n * The default implementation of the functions utilizes the fXXX functions from\n * the CRT. However, you can supply a custom implementation to Assimp by\n * delivering a custom aiFileIO. Use this to enable reading from other sources,\n * such as ZIP archives or memory locations. */\nstruct aiFile\n{\n /** Callback to read from a file */\n aiFileReadProc ReadProc;\n\n /** Callback to write to a file */\n aiFileWriteProc WriteProc;\n\n /** Callback to retrieve the current position of\n * the file cursor (ftell())\n */\n aiFileTellProc TellProc;\n\n /** Callback to retrieve the size of the file,\n * in bytes\n */\n aiFileTellProc FileSizeProc;\n\n /** Callback to set the current position\n * of the file cursor (fseek())\n */\n aiFileSeek SeekProc;\n\n /** Callback to flush the file contents\n */\n aiFileFlushProc FlushProc;\n\n /** User-defined, opaque data\n */\n aiUserData UserData;\n};\n\n#ifdef __cplusplus\n}\n#endif\n#endif // AI_FILEIO_H_INC\n"}, {"path": "includes/assimp/cimport.h", "language": "code", "loc": 508, "comment_density": 0.78, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file cimport.h\n * @brief Defines the C-API to the Open Asset Import Library.\n */\n#ifndef AI_ASSIMP_H_INC\n#define AI_ASSIMP_H_INC\n#include \"types.h\"\n#include \"importerdesc.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct aiScene; // aiScene.h\nstruct aiFileIO; // aiFileIO.h\ntypedef void (*aiLogStreamCallback)(const char* /* message */, char* /* user */);\n\n// --------------------------------------------------------------------------------\n/** C-API: Represents a log stream. A log stream receives all log messages and\n * streams them _somewhere_.\n * @see aiGetPredefinedLogStream\n * @see aiAttachLogStream\n * @see aiDetachLogStream */\n// --------------------------------------------------------------------------------\nstruct aiLogStream\n{\n /** callback to be called */\n aiLogStreamCallback callback;\n\n /** user data to be passed to the callback */\n char* user;\n};\n\n\n// --------------------------------------------------------------------------------\n/** C-API: Represents an opaque set of settings to be used during importing.\n * @see aiCreatePropertyStore\n * @see aiReleasePropertyStore\n * @see aiImportFileExWithProperties\n * @see aiSetPropertyInteger\n * @see aiSetPropertyFloat\n * @see aiSetPropertyString\n * @see aiSetPropertyMatrix\n */\n// --------------------------------------------------------------------------------\nstruct aiPropertyStore { char sentinel; };\n\n/** Our own C boolean type */\ntypedef int aiBool;\n\n#define AI_FALSE 0\n#define AI_TRUE 1\n\n// --------------------------------------------------------------------------------\n/** Reads the given file and returns its content.\n *\n * If the call succeeds, the imported data is returned in an aiScene structure.\n * The data is intended to be read-only, it stays property of the ASSIMP\n * library and will be stable until aiReleaseImport() is called. After you're\n * done with it, call aiReleaseImport() to free the resources associated with\n * this file. If the import fails, NULL is returned instead. Call\n * aiGetErrorString() to retrieve a human-readable error text.\n * @param pFile Path and filename of the file to be imported,\n * expected to be a null-terminated c-string. NULL is not a valid value.\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags.\n * @return Pointer to the imported data or NULL if the import failed.\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFile(\n const char* pFile,\n unsigned int pFlags);\n\n// --------------------------------------------------------------------------------\n/** Reads the given file using user-defined I/O functions and returns\n * its content.\n *\n * If the call succeeds, the imported data is returned in an aiScene structure.\n * The data is intended to be read-only, it stays property of the ASSIMP\n * library and will be stable until aiReleaseImport() is called. After you're\n * done with it, call aiReleaseImport() to free the resources associated with\n * this file. If the import fails, NULL is returned instead. Call\n * aiGetErrorString() to retrieve a human-readable error text.\n * @param pFile Path and filename of the file to be imported,\n * expected to be a null-terminated c-string. NULL is not a valid value.\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags.\n * @param pFS aiFileIO structure. Will be used to open the model file itself\n * and any other files the loader needs to open. Pass NULL to use the default\n * implementation.\n * @return Pointer to the imported data or NULL if the import failed.\n * @note Include for the definition of #aiFileIO.\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFileEx(\n const char* pFile,\n unsigned int pFlags,\n C_STRUCT aiFileIO* pFS);\n\n// --------------------------------------------------------------------------------\n/** Same as #aiImportFileEx, but adds an extra parameter containing importer settings.\n *\n * @param pFile Path and filename of the file to be imported,\n * expected to be a null-terminated c-string. NULL is not a valid value.\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags.\n * @param pFS aiFileIO structure. Will be used to open the model file itself\n * and any other files the loader needs to open. Pass NULL to use the default\n * implementation.\n * @param pProps #aiPropertyStore instance containing import settings.\n * @return Pointer to the imported data or NULL if the import failed.\n * @note Include for the definition of #aiFileIO.\n * @see aiImportFileEx\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFileExWithProperties(\n const char* pFile,\n unsigned int pFlags,\n C_STRUCT aiFileIO* pFS,\n const C_STRUCT aiPropertyStore* pProps);\n\n// --------------------------------------------------------------------------------\n/** Reads the given file from a given memory buffer,\n *\n * If the call succeeds, the contents of the file are returned as a pointer to an\n * aiScene object. The returned data is intended to be read-only, the importer keeps\n * ownership of the data and will destroy it upon destruction. If the import fails,\n * NULL is returned.\n * A human-readable error description can be retrieved by calling aiGetErrorString().\n * @param pBuffer Pointer to the file data\n * @param pLength Length of pBuffer, in bytes\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags. If you wish to inspect the imported\n * scene first in order to fine-tune your post-processing setup,\n * consider to use #aiApplyPostProcessing().\n * @param pHint An additional hint to the library. If this is a non empty string,\n * the library looks for a loader to support the file extension specified by pHint\n * and passes the file to the first matching loader. If this loader is unable to\n * completely the request, the library continues and tries to determine the file\n * format on its own, a task that may or may not be successful.\n * Check the return value, and you'll know ...\n * @return A pointer to the imported data, NULL if the import failed.\n *\n * @note This is a straightforward way to decode models from memory\n * buffers, but it doesn't handle model formats that spread their\n * data across multiple files or even directories. Examples include\n * OBJ or MD3, which outsource parts of their material info into\n * external scripts. If you need full functionality, provide\n * a custom IOSystem to make Assimp find these files and use\n * the regular aiImportFileEx()/aiImportFileExWithProperties() API.\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemory(\n const char* pBuffer,\n unsigned int pLength,\n unsigned int pFlags,\n const char* pHint);\n\n// --------------------------------------------------------------------------------\n/** Same as #aiImportFileFromMemory, but adds an extra parameter containing importer settings.\n *\n * @param pBuffer Pointer to the file data\n * @param pLength Length of pBuffer, in bytes\n * @param pFlags Optional post processing steps to be executed after\n * a successful import. Provide a bitwise combination of the\n * #aiPostProcessSteps flags. If you wish to inspect the imported\n * scene first in order to fine-tune your post-processing setup,\n * consider to use #aiApplyPostProcessing().\n * @param pHint An additional hint to the library. If this is a non empty string,\n * the library looks for a loader to support the file extension specified by pHint\n * and passes the file to the first matching loader. If this loader is unable to\n * completely the request, the library continues and tries to determine the file\n * format on its own, a task that may or may not be successful.\n * Check the return value, and you'll know ...\n * @param pProps #aiPropertyStore instance containing import settings.\n * @return A pointer to the imported data, NULL if the import failed.\n *\n * @note This is a straightforward way to decode models from memory\n * buffers, but it doesn't handle model formats that spread their\n * data across multiple files or even directories. Examples include\n * OBJ or MD3, which outsource parts of their material info into\n * external scripts. If you need full functionality, provide\n * a custom IOSystem to make Assimp find these files and use\n * the regular aiImportFileEx()/aiImportFileExWithProperties() API.\n * @see aiImportFileFromMemory\n */\nASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemoryWithProperties(\n const char* pBuffer,\n unsigned int pLength,\n unsigned int pFlags,\n const char* pHint,\n const C_STRUCT aiPropertyStore* pProps);\n\n// --------------------------------------------------------------------------------\n/** Apply post-processing to an already-imported scene.\n *\n * This is strictly equivalent to calling #aiImportFile()/#aiImportFileEx with the\n * same flags. However, you can use this separate function to inspect the imported\n * scene first to fine-tune your post-processing setup.\n * @param pScene Scene to work on.\n * @param pFlags Provide a bitwise combination of the #aiPostProcessSteps flags.\n * @return A pointer to the post-processed data. Post processing is done in-place,\n * meaning this is still the same #aiScene which you passed for pScene. However,\n * _if_ post-processing failed, the scene could now be NULL. That's quite a rare\n * case, post processing steps are not really designed to 'fail'. To be exact,\n * the #aiProcess_ValidateDataStructure flag is currently the only post processing step\n * which can actually cause the scene to be reset to NULL.\n */\nASSIMP_API const C_STRUCT aiScene* aiApplyPostProcessing(\n const C_STRUCT aiScene* pScene,\n unsigned int pFlags);\n\n// --------------------------------------------------------------------------------\n/** Get one of the predefine log streams. This is the quick'n'easy solution to\n * access Assimp's log system. Attaching a log stream can slightly reduce Assimp's\n * overall import performance.\n *\n * Usage is rather simple (this will stream the log to a file, named log.txt, and\n * the stdout stream of the process:\n * @code\n * struct aiLogStream c;\n * c = aiGetPredefinedLogStream(aiDefaultLogStream_FILE,\"log.txt\");\n * aiAttachLogStream(&c);\n * c = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);\n * aiAttachLogStream(&c);\n * @endcode\n *\n * @param pStreams One of the #aiDefaultLogStream enumerated values.\n * @param file Solely for the #aiDefaultLogStream_FILE flag: specifies the file to write to.\n * Pass NULL for all other flags.\n * @return The log stream. callback is set to NULL if something went wrong.\n */\nASSIMP_API C_STRUCT aiLogStream aiGetPredefinedLogStream(\n C_ENUM aiDefaultLogStream pStreams,\n const char* file);\n\n// --------------------------------------------------------------------------------\n/** Attach a custom log stream to the libraries' logging system.\n *\n * Attaching a log stream can slightly reduce Assimp's overall import\n * performance. Multiple log-streams can be attached.\n * @param stream Describes the new log stream.\n * @note To ensure proper destruction of the logging system, you need to manually\n * call aiDetachLogStream() on every single log stream you attach.\n * Alternatively (for the lazy folks) #aiDetachAllLogStreams is provided.\n */\nASSIMP_API void aiAttachLogStream(\n const C_STRUCT aiLogStream* stream);\n\n// --------------------------------------------------------------------------------\n/** Enable verbose logging. Verbose logging includes debug-related stuff and\n * detailed import statistics. This can have severe impact on import performance\n * and memory consumption. However, it might be useful to find out why a file\n * didn't read correctly.\n * @param d AI_TRUE or AI_FALSE, your decision.\n */\nASSIMP_API void aiEnableVerboseLogging(aiBool d);\n\n// --------------------------------------------------------------------------------\n/** Detach a custom log stream from the libraries' logging system.\n *\n * This is the counterpart of #aiAttachLogStream. If you attached a stream,\n * don't forget to detach it again.\n * @param stream The log stream to be detached.\n * @return AI_SUCCESS if the log stream has been detached successfully.\n * @see aiDetachAllLogStreams\n */\nASSIMP_API C_ENUM aiReturn aiDetachLogStream(\n const C_STRUCT aiLogStream* stream);\n\n// --------------------------------------------------------------------------------\n/** Detach all active log streams from the libraries' logging system.\n * This ensures that the logging system is terminated properly and all\n * resources allocated by it are actually freed. If you attached a stream,\n * don't forget to detach it again.\n * @see aiAttachLogStream\n * @see aiDetachLogStream\n */\nASSIMP_API void aiDetachAllLogStreams(void);\n\n// --------------------------------------------------------------------------------\n/** Releases all resources associated with the given import process.\n *\n * Call this function after you're done with the imported data.\n * @param pScene The imported data to release. NULL is a valid value.\n */\nASSIMP_API void aiReleaseImport(\n const C_STRUCT aiScene* pScene);\n\n// --------------------------------------------------------------------------------\n/** Returns the error text of the last failed import process.\n *\n * @return A textual description of the error that occurred at the last\n * import process. NULL if there was no error. There can't be an error if you\n * got a non-NULL #aiScene from #aiImportFile/#aiImportFileEx/#aiApplyPostProcessing.\n */\nASSIMP_API const char* aiGetErrorString();\n\n// --------------------------------------------------------------------------------\n/** Returns whether a given file extension is supported by ASSIMP\n *\n * @param szExtension Extension for which the function queries support for.\n * Must include a leading dot '.'. Example: \".3ds\", \".md3\"\n * @return AI_TRUE if the file extension is supported.\n */\nASSIMP_API aiBool aiIsExtensionSupported(\n const char* szExtension);\n\n// --------------------------------------------------------------------------------\n/** Get a list of all file extensions supported by ASSIMP.\n *\n * If a file extension is contained in the list this does, of course, not\n * mean that ASSIMP is able to load all files with this extension.\n * @param szOut String to receive the extension list.\n * Format of the list: \"*.3ds;*.obj;*.dae\". NULL is not a valid parameter.\n */\nASSIMP_API void aiGetExtensionList(\n C_STRUCT aiString* szOut);\n\n// --------------------------------------------------------------------------------\n/** Get the approximated storage required by an imported asset\n * @param pIn Input asset.\n * @param in Data structure to be filled.\n */\nASSIMP_API void aiGetMemoryRequirements(\n const C_STRUCT aiScene* pIn,\n C_STRUCT aiMemoryInfo* in);\n\n\n\n// --------------------------------------------------------------------------------\n/** Create an empty property store. Property stores are used to collect import\n * settings.\n * @return New property store. Property stores need to be manually destroyed using\n * the #aiReleasePropertyStore API function.\n */\nASSIMP_API C_STRUCT aiPropertyStore* aiCreatePropertyStore(void);\n\n// --------------------------------------------------------------------------------\n/** Delete a property store.\n * @param p Property store to be deleted.\n */\nASSIMP_API void aiReleasePropertyStore(C_STRUCT aiPropertyStore* p);\n\n// --------------------------------------------------------------------------------\n/** Set an integer property.\n *\n * This is the C-version of #Assimp::Importer::SetPropertyInteger(). In the C\n * interface, properties are always shared by all imports. It is not possible to\n * specify them per import.\n *\n * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.\n * @param szName Name of the configuration property to be set. All supported\n * public properties are defined in the config.h header file (AI_CONFIG_XXX).\n * @param value New value for the property\n */\nASSIMP_API void aiSetImportPropertyInteger(\n C_STRUCT aiPropertyStore* store,\n const char* szName,\n int value);\n\n// --------------------------------------------------------------------------------\n/** Set a floating-point property.\n *\n * This is the C-version of #Assimp::Importer::SetPropertyFloat(). In the C\n * interface, properties are always shared by all imports. It is not possible to\n * specify them per import.\n *\n * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.\n * @param szName Name of the configuration property to be set. All supported\n * public properties are defined in the config.h header file (AI_CONFIG_XXX).\n * @param value New value for the property\n */\nASSIMP_API void aiSetImportPropertyFloat(\n C_STRUCT aiPropertyStore* store,\n const char* szName,\n float value);\n\n// --------------------------------------------------------------------------------\n/** Set a string property.\n *\n * This is the C-version of #Assimp::Importer::SetPropertyString(). In the C\n * interface, properties are always shared by all imports. It is not possible to\n * specify them per import.\n *\n * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.\n * @param szName Name of the configuration property to be set. All supported\n * public properties are defined in the config.h header file (AI_CONFIG_XXX).\n * @param st New value for the property\n */\nASSIMP_API void aiSetImportPropertyString(\n C_STRUCT aiPropertyStore* store,\n const char* szName,\n const C_STRUCT aiString* st);\n\n// --------------------------------------------------------------------------------\n/** Set a matrix property.\n *\n * This is the C-version of #Assimp::Importer::SetPropertyMatrix(). In the C\n * interface, properties are always shared by all imports. It is not possible to\n * specify them per import.\n *\n * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store.\n * @param szName Name of the configuration property to be set. All supported\n * public properties are defined in the config.h header file (AI_CONFIG_XXX).\n * @param mat New value for the property\n */\nASSIMP_API void aiSetImportPropertyMatrix(\n C_STRUCT aiPropertyStore* store,\n const char* szName,\n const C_STRUCT aiMatrix4x4* mat);\n\n// --------------------------------------------------------------------------------\n/** Construct a quaternion from a 3x3 rotation matrix.\n * @param quat Receives the output quaternion.\n * @param mat Matrix to 'quaternionize'.\n * @see aiQuaternion(const aiMatrix3x3& pRotMatrix)\n */\nASSIMP_API void aiCreateQuaternionFromMatrix(\n C_STRUCT aiQuaternion* quat,\n const C_STRUCT aiMatrix3x3* mat);\n\n// --------------------------------------------------------------------------------\n/** Decompose a transformation matrix into its rotational, translational and\n * scaling components.\n *\n * @param mat Matrix to decompose\n * @param scaling Receives the scaling component\n * @param rotation Receives the rotational component\n * @param position Receives the translational component.\n * @see aiMatrix4x4::Decompose (aiVector3D&, aiQuaternion&, aiVector3D&) const;\n */\nASSIMP_API void aiDecomposeMatrix(\n const C_STRUCT aiMatrix4x4* mat,\n C_STRUCT aiVector3D* scaling,\n C_STRUCT aiQuaternion* rotation,\n C_STRUCT aiVector3D* position);\n\n// --------------------------------------------------------------------------------\n/** Transpose a 4x4 matrix.\n * @param mat Pointer to the matrix to be transposed\n */\nASSIMP_API void aiTransposeMatrix4(\n C_STRUCT aiMatrix4x4* mat);\n\n// --------------------------------------------------------------------------------\n/** Transpose a 3x3 matrix.\n * @param mat Pointer to the matrix to be transposed\n */\nASSIMP_API void aiTransposeMatrix3(\n C_STRUCT aiMatrix3x3* mat);\n\n// --------------------------------------------------------------------------------\n/** Transform a vector by a 3x3 matrix\n * @param vec Vector to be transformed.\n * @param mat Matrix to transform the vector with.\n */\nASSIMP_API void aiTransformVecByMatrix3(\n C_STRUCT aiVector3D* vec,\n const C_STRUCT aiMatrix3x3* mat);\n\n// --------------------------------------------------------------------------------\n/** Transform a vector by a 4x4 matrix\n * @param vec Vector to be transformed.\n * @param mat Matrix to transform the vector with.\n */\nASSIMP_API void aiTransformVecByMatrix4(\n C_STRUCT aiVector3D* vec,\n const C_STRUCT aiMatrix4x4* mat);\n\n// --------------------------------------------------------------------------------\n/** Multiply two 4x4 matrices.\n * @param dst First factor, receives result.\n * @param src Matrix to be multiplied with 'dst'.\n */\nASSIMP_API void aiMultiplyMatrix4(\n C_STRUCT aiMatrix4x4* dst,\n const C_STRUCT aiMatrix4x4* src);\n\n// --------------------------------------------------------------------------------\n/** Multiply two 3x3 matrices.\n * @param dst First factor, receives result.\n * @param src Matrix to be multiplied with 'dst'.\n */\nASSIMP_API void aiMultiplyMatrix3(\n C_STRUCT aiMatrix3x3* dst,\n const C_STRUCT aiMatrix3x3* src);\n\n// --------------------------------------------------------------------------------\n/** Get a 3x3 identity matrix.\n * @param mat Matrix to receive its personal identity\n */\nASSIMP_API void aiIdentityMatrix3(\n C_STRUCT aiMatrix3x3* mat);\n\n// --------------------------------------------------------------------------------\n/** Get a 4x4 identity matrix.\n * @param mat Matrix to receive its personal identity\n */\nASSIMP_API void aiIdentityMatrix4(\n C_STRUCT aiMatrix4x4* mat);\n\n// --------------------------------------------------------------------------------\n/** Returns the number of import file formats available in the current Assimp build.\n * Use aiGetImportFormatDescription() to retrieve infos of a specific import format.\n */\nASSIMP_API size_t aiGetImportFormatCount(void);\n\n// --------------------------------------------------------------------------------\n/** Returns a description of the nth import file format. Use #aiGetImportFormatCount()\n * to learn how many import formats are supported.\n * @param pIndex Index of the import format to retrieve information for. Valid range is\n * 0 to #aiGetImportFormatCount()\n * @return A description of that specific import format. NULL if pIndex is out of range.\n */\nASSIMP_API const C_STRUCT aiImporterDesc* aiGetImportFormatDescription( size_t pIndex);\n#ifdef __cplusplus\n}\n#endif\n\n#endif // AI_ASSIMP_H_INC\n"}, {"path": "includes/assimp/color4.h", "language": "code", "loc": 82, "comment_density": 0.585, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file color4.h\n * @brief RGBA color structure, including operators when compiling in C++\n */\n#ifndef AI_COLOR4D_H_INC\n#define AI_COLOR4D_H_INC\n\n#include \"./Compiler/pushpack1.h\"\n\n#ifdef __cplusplus\n\n// ----------------------------------------------------------------------------------\n/** Represents a color in Red-Green-Blue space including an\n* alpha component. Color values range from 0 to 1. */\n// ----------------------------------------------------------------------------------\ntemplate \nclass aiColor4t\n{\npublic:\n aiColor4t () : r(), g(), b(), a() {}\n aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a)\n : r(_r), g(_g), b(_b), a(_a) {}\n explicit aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {}\n aiColor4t (const aiColor4t& o)\n : r(o.r), g(o.g), b(o.b), a(o.a) {}\n\npublic:\n // combined operators\n const aiColor4t& operator += (const aiColor4t& o);\n const aiColor4t& operator -= (const aiColor4t& o);\n const aiColor4t& operator *= (TReal f);\n const aiColor4t& operator /= (TReal f);\n\npublic:\n // comparison\n bool operator == (const aiColor4t& other) const;\n bool operator != (const aiColor4t& other) const;\n bool operator < (const aiColor4t& other) const;\n\n // color tuple access, rgba order\n inline TReal operator[](unsigned int i) const;\n inline TReal& operator[](unsigned int i);\n\n /** check whether a color is (close to) black */\n inline bool IsBlack() const;\n\npublic:\n\n // Red, green, blue and alpha color values\n TReal r, g, b, a;\n} PACK_STRUCT; // !struct aiColor4D\n\ntypedef aiColor4t aiColor4D;\n\n#else\n\nstruct aiColor4D {\n float r, g, b, a;\n} PACK_STRUCT;\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#endif // AI_COLOR4D_H_INC\n"}, {"path": "includes/assimp/config.h", "language": "code", "loc": 795, "comment_density": 0.794, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file config.h\n * @brief Defines constants for configurable properties for the library\n *\n * Typically these properties are set via\n * #Assimp::Importer::SetPropertyFloat,\n * #Assimp::Importer::SetPropertyInteger or\n * #Assimp::Importer::SetPropertyString,\n * depending on the data type of a property. All properties have a\n * default value. See the doc for the mentioned methods for more details.\n *\n *

\n * The corresponding functions for use with the plain-c API are:\n * #aiSetImportPropertyInteger,\n * #aiSetImportPropertyFloat,\n * #aiSetImportPropertyString\n */\n#ifndef INCLUDED_AI_CONFIG_H\n#define INCLUDED_AI_CONFIG_H\n\n\n// ###########################################################################\n// LIBRARY SETTINGS\n// General, global settings\n// ###########################################################################\n\n// ---------------------------------------------------------------------------\n/** @brief Enables time measurements.\n *\n * If enabled, measures the time needed for each part of the loading\n * process (i.e. IO time, importing, postprocessing, ..) and dumps\n * these timings to the DefaultLogger. See the @link perf Performance\n * Page@endlink for more information on this topic.\n *\n * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_GLOB_MEASURE_TIME \\\n \"GLOB_MEASURE_TIME\"\n\n\n// ---------------------------------------------------------------------------\n/** @brief Global setting to disable generation of skeleton dummy meshes\n *\n * Skeleton dummy meshes are generated as a visualization aid in cases which\n * the input data contains no geometry, but only animation data.\n * Property data type: bool. Default value: false\n */\n// ---------------------------------------------------------------------------\n#define AI_CONFIG_IMPORT_NO_SKELETON_MESHES \\\n \"IMPORT_NO_SKELETON_MESHES\"\n\n\n\n# if 0 // not implemented yet\n// ---------------------------------------------------------------------------\n/** @brief Set Assimp's multithreading policy.\n *\n * This setting is ignored if Assimp was built without boost.thread\n * support (ASSIMP_BUILD_NO_THREADING, which is implied by ASSIMP_BUILD_BOOST_WORKAROUND).\n * Possible values are: -1 to let Assimp decide what to do, 0 to disable\n * multithreading entirely and any number larger than 0 to force a specific\n * number of threads. Assimp is always free to ignore this settings, which is\n * merely a hint. Usually, the default value (-1) will be fine. However, if\n * Assimp is used concurrently from multiple user threads, it might be useful\n * to limit each Importer instance to a specific number of cores.\n *\n * For more information, see the @link threading Threading page@endlink.\n * Property type: int, default value: -1.\n */\n#define AI_CONFIG_GLOB_MULTITHREADING \\\n \"GLOB_MULTITHREADING\"\n#endif\n\n// ###########################################################################\n// POST PROCESSING SETTINGS\n// Various stuff to fine-tune the behavior of a specific post processing step.\n// ###########################################################################\n\n\n// ---------------------------------------------------------------------------\n/** @brief Maximum bone count per mesh for the SplitbyBoneCount step.\n *\n * Meshes are split until the maximum number of bones is reached. The default\n * value is AI_SBBC_DEFAULT_MAX_BONES, which may be altered at\n * compile-time.\n * Property data type: integer.\n */\n// ---------------------------------------------------------------------------\n#define AI_CONFIG_PP_SBBC_MAX_BONES \\\n \"PP_SBBC_MAX_BONES\"\n\n\n// default limit for bone count\n#if (!defined AI_SBBC_DEFAULT_MAX_BONES)\n# define AI_SBBC_DEFAULT_MAX_BONES 60\n#endif\n\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies the maximum angle that may be between two vertex tangents\n * that their tangents and bi-tangents are smoothed.\n *\n * This applies to the CalcTangentSpace-Step. The angle is specified\n * in degrees. The maximum value is 175.\n * Property type: float. Default value: 45 degrees\n */\n#define AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE \\\n \"PP_CT_MAX_SMOOTHING_ANGLE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Source UV channel for tangent space computation.\n *\n * The specified channel must exist or an error will be raised.\n * Property type: integer. Default value: 0\n */\n// ---------------------------------------------------------------------------\n#define AI_CONFIG_PP_CT_TEXTURE_CHANNEL_INDEX \\\n \"PP_CT_TEXTURE_CHANNEL_INDEX\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies the maximum angle that may be between two face normals\n * at the same vertex position that their are smoothed together.\n *\n * Sometimes referred to as 'crease angle'.\n * This applies to the GenSmoothNormals-Step. The angle is specified\n * in degrees, so 180 is PI. The default value is 175 degrees (all vertex\n * normals are smoothed). The maximum value is 175, too. Property type: float.\n * Warning: setting this option may cause a severe loss of performance. The\n * performance is unaffected if the #AI_CONFIG_FAVOUR_SPEED flag is set but\n * the output quality may be reduced.\n */\n#define AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE \\\n \"PP_GSN_MAX_SMOOTHING_ANGLE\"\n\n\n// ---------------------------------------------------------------------------\n/** @brief Sets the colormap (= palette) to be used to decode embedded\n * textures in MDL (Quake or 3DGS) files.\n *\n * This must be a valid path to a file. The file is 768 (256*3) bytes\n * large and contains RGB triplets for each of the 256 palette entries.\n * The default value is colormap.lmp. If the file is not found,\n * a default palette (from Quake 1) is used.\n * Property type: string.\n */\n#define AI_CONFIG_IMPORT_MDL_COLORMAP \\\n \"IMPORT_MDL_COLORMAP\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_RemoveRedundantMaterials step to\n * keep materials matching a name in a given list.\n *\n * This is a list of 1 to n strings, ' ' serves as delimiter character.\n * Identifiers containing whitespaces must be enclosed in *single*\n * quotation marks. For example:\n * \"keep-me and_me_to anotherMaterialToBeKept \\'name with whitespace\\'\".\n * If a material matches on of these names, it will not be modified or\n * removed by the postprocessing step nor will other materials be replaced\n * by a reference to it.
\n * This option might be useful if you are using some magic material names\n * to pass additional semantics through the content pipeline. This ensures\n * they won't be optimized away, but a general optimization is still\n * performed for materials not contained in the list.\n * Property type: String. Default value: n/a\n * @note Linefeeds, tabs or carriage returns are treated as whitespace.\n * Material names are case sensitive.\n */\n#define AI_CONFIG_PP_RRM_EXCLUDE_LIST \\\n \"PP_RRM_EXCLUDE_LIST\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_PreTransformVertices step to\n * keep the scene hierarchy. Meshes are moved to worldspace, but\n * no optimization is performed (read: meshes with equal materials are not\n * joined. The total number of meshes won't change).\n *\n * This option could be of use for you if the scene hierarchy contains\n * important additional information which you intend to parse.\n * For rendering, you can still render all meshes in the scene without\n * any transformations.\n * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_PP_PTV_KEEP_HIERARCHY \\\n \"PP_PTV_KEEP_HIERARCHY\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_PreTransformVertices step to normalize\n * all vertex components into the [-1,1] range. That is, a bounding box\n * for the whole scene is computed, the maximum component is taken and all\n * meshes are scaled appropriately (uniformly of course!).\n * This might be useful if you don't know the spatial dimension of the input\n * data*/\n#define AI_CONFIG_PP_PTV_NORMALIZE \\\n \"PP_PTV_NORMALIZE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_PreTransformVertices step to use\n * a users defined matrix as the scene root node transformation before\n * transforming vertices.\n * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_PP_PTV_ADD_ROOT_TRANSFORMATION \\\n \"PP_PTV_ADD_ROOT_TRANSFORMATION\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_PreTransformVertices step to use\n * a users defined matrix as the scene root node transformation before\n * transforming vertices. This property correspond to the 'a1' component\n * of the transformation matrix.\n * Property type: aiMatrix4x4.\n */\n#define AI_CONFIG_PP_PTV_ROOT_TRANSFORMATION \\\n \"PP_PTV_ROOT_TRANSFORMATION\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_FindDegenerates step to\n * remove degenerated primitives from the import - immediately.\n *\n * The default behaviour converts degenerated triangles to lines and\n * degenerated lines to points. See the documentation to the\n * #aiProcess_FindDegenerates step for a detailed example of the various ways\n * to get rid of these lines and points if you don't want them.\n * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_PP_FD_REMOVE \\\n \"PP_FD_REMOVE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the #aiProcess_OptimizeGraph step to preserve nodes\n * matching a name in a given list.\n *\n * This is a list of 1 to n strings, ' ' serves as delimiter character.\n * Identifiers containing whitespaces must be enclosed in *single*\n * quotation marks. For example:\n * \"keep-me and_me_to anotherNodeToBeKept \\'name with whitespace\\'\".\n * If a node matches on of these names, it will not be modified or\n * removed by the postprocessing step.
\n * This option might be useful if you are using some magic node names\n * to pass additional semantics through the content pipeline. This ensures\n * they won't be optimized away, but a general optimization is still\n * performed for nodes not contained in the list.\n * Property type: String. Default value: n/a\n * @note Linefeeds, tabs or carriage returns are treated as whitespace.\n * Node names are case sensitive.\n */\n#define AI_CONFIG_PP_OG_EXCLUDE_LIST \\\n \"PP_OG_EXCLUDE_LIST\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set the maximum number of triangles in a mesh.\n *\n * This is used by the \"SplitLargeMeshes\" PostProcess-Step to determine\n * whether a mesh must be split or not.\n * @note The default value is AI_SLM_DEFAULT_MAX_TRIANGLES\n * Property type: integer.\n */\n#define AI_CONFIG_PP_SLM_TRIANGLE_LIMIT \\\n \"PP_SLM_TRIANGLE_LIMIT\"\n\n// default value for AI_CONFIG_PP_SLM_TRIANGLE_LIMIT\n#if (!defined AI_SLM_DEFAULT_MAX_TRIANGLES)\n# define AI_SLM_DEFAULT_MAX_TRIANGLES 1000000\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Set the maximum number of vertices in a mesh.\n *\n * This is used by the \"SplitLargeMeshes\" PostProcess-Step to determine\n * whether a mesh must be split or not.\n * @note The default value is AI_SLM_DEFAULT_MAX_VERTICES\n * Property type: integer.\n */\n#define AI_CONFIG_PP_SLM_VERTEX_LIMIT \\\n \"PP_SLM_VERTEX_LIMIT\"\n\n// default value for AI_CONFIG_PP_SLM_VERTEX_LIMIT\n#if (!defined AI_SLM_DEFAULT_MAX_VERTICES)\n# define AI_SLM_DEFAULT_MAX_VERTICES 1000000\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Set the maximum number of bones affecting a single vertex\n *\n * This is used by the #aiProcess_LimitBoneWeights PostProcess-Step.\n * @note The default value is AI_LBW_MAX_WEIGHTS\n * Property type: integer.*/\n#define AI_CONFIG_PP_LBW_MAX_WEIGHTS \\\n \"PP_LBW_MAX_WEIGHTS\"\n\n// default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS\n#if (!defined AI_LMW_MAX_WEIGHTS)\n# define AI_LMW_MAX_WEIGHTS 0x4\n#endif // !! AI_LMW_MAX_WEIGHTS\n\n// ---------------------------------------------------------------------------\n/** @brief Lower the deboning threshold in order to remove more bones.\n *\n * This is used by the #aiProcess_Debone PostProcess-Step.\n * @note The default value is AI_DEBONE_THRESHOLD\n * Property type: float.*/\n#define AI_CONFIG_PP_DB_THRESHOLD \\\n \"PP_DB_THRESHOLD\"\n\n// default value for AI_CONFIG_PP_LBW_MAX_WEIGHTS\n#if (!defined AI_DEBONE_THRESHOLD)\n# define AI_DEBONE_THRESHOLD 1.0f\n#endif // !! AI_DEBONE_THRESHOLD\n\n// ---------------------------------------------------------------------------\n/** @brief Require all bones qualify for deboning before removing any\n *\n * This is used by the #aiProcess_Debone PostProcess-Step.\n * @note The default value is 0\n * Property type: bool.*/\n#define AI_CONFIG_PP_DB_ALL_OR_NONE \\\n \"PP_DB_ALL_OR_NONE\"\n\n/** @brief Default value for the #AI_CONFIG_PP_ICL_PTCACHE_SIZE property\n */\n#ifndef PP_ICL_PTCACHE_SIZE\n# define PP_ICL_PTCACHE_SIZE 12\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Set the size of the post-transform vertex cache to optimize the\n * vertices for. This configures the #aiProcess_ImproveCacheLocality step.\n *\n * The size is given in vertices. Of course you can't know how the vertex\n * format will exactly look like after the import returns, but you can still\n * guess what your meshes will probably have.\n * @note The default value is #PP_ICL_PTCACHE_SIZE. That results in slight\n * performance improvements for most nVidia/AMD cards since 2002.\n * Property type: integer.\n */\n#define AI_CONFIG_PP_ICL_PTCACHE_SIZE \"PP_ICL_PTCACHE_SIZE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Enumerates components of the aiScene and aiMesh data structures\n * that can be excluded from the import using the #aiProcess_RemoveComponent step.\n *\n * See the documentation to #aiProcess_RemoveComponent for more details.\n */\nenum aiComponent\n{\n /** Normal vectors */\n#ifdef SWIG\n aiComponent_NORMALS = 0x2,\n#else\n aiComponent_NORMALS = 0x2u,\n#endif\n\n /** Tangents and bitangents go always together ... */\n#ifdef SWIG\n aiComponent_TANGENTS_AND_BITANGENTS = 0x4,\n#else\n aiComponent_TANGENTS_AND_BITANGENTS = 0x4u,\n#endif\n\n /** ALL color sets\n * Use aiComponent_COLORn(N) to specify the N'th set */\n aiComponent_COLORS = 0x8,\n\n /** ALL texture UV sets\n * aiComponent_TEXCOORDn(N) to specify the N'th set */\n aiComponent_TEXCOORDS = 0x10,\n\n /** Removes all bone weights from all meshes.\n * The scenegraph nodes corresponding to the bones are NOT removed.\n * use the #aiProcess_OptimizeGraph step to do this */\n aiComponent_BONEWEIGHTS = 0x20,\n\n /** Removes all node animations (aiScene::mAnimations).\n * The corresponding scenegraph nodes are NOT removed.\n * use the #aiProcess_OptimizeGraph step to do this */\n aiComponent_ANIMATIONS = 0x40,\n\n /** Removes all embedded textures (aiScene::mTextures) */\n aiComponent_TEXTURES = 0x80,\n\n /** Removes all light sources (aiScene::mLights).\n * The corresponding scenegraph nodes are NOT removed.\n * use the #aiProcess_OptimizeGraph step to do this */\n aiComponent_LIGHTS = 0x100,\n\n /** Removes all cameras (aiScene::mCameras).\n * The corresponding scenegraph nodes are NOT removed.\n * use the #aiProcess_OptimizeGraph step to do this */\n aiComponent_CAMERAS = 0x200,\n\n /** Removes all meshes (aiScene::mMeshes). */\n aiComponent_MESHES = 0x400,\n\n /** Removes all materials. One default material will\n * be generated, so aiScene::mNumMaterials will be 1. */\n aiComponent_MATERIALS = 0x800,\n\n\n /** This value is not used. It is just there to force the\n * compiler to map this enum to a 32 Bit integer. */\n#ifndef SWIG\n _aiComponent_Force32Bit = 0x9fffffff\n#endif\n};\n\n// Remove a specific color channel 'n'\n#define aiComponent_COLORSn(n) (1u << (n+20u))\n\n// Remove a specific UV channel 'n'\n#define aiComponent_TEXCOORDSn(n) (1u << (n+25u))\n\n// ---------------------------------------------------------------------------\n/** @brief Input parameter to the #aiProcess_RemoveComponent step:\n * Specifies the parts of the data structure to be removed.\n *\n * See the documentation to this step for further details. The property\n * is expected to be an integer, a bitwise combination of the\n * #aiComponent flags defined above in this header. The default\n * value is 0. Important: if no valid mesh is remaining after the\n * step has been executed (e.g you thought it was funny to specify ALL\n * of the flags defined above) the import FAILS. Mainly because there is\n * no data to work on anymore ...\n */\n#define AI_CONFIG_PP_RVC_FLAGS \\\n \"PP_RVC_FLAGS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Input parameter to the #aiProcess_SortByPType step:\n * Specifies which primitive types are removed by the step.\n *\n * This is a bitwise combination of the aiPrimitiveType flags.\n * Specifying all of them is illegal, of course. A typical use would\n * be to exclude all line and point meshes from the import. This\n * is an integer property, its default value is 0.\n */\n#define AI_CONFIG_PP_SBP_REMOVE \\\n \"PP_SBP_REMOVE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Input parameter to the #aiProcess_FindInvalidData step:\n * Specifies the floating-point accuracy for animation values. The step\n * checks for animation tracks where all frame values are absolutely equal\n * and removes them. This tweakable controls the epsilon for floating-point\n * comparisons - two keys are considered equal if the invariant\n * abs(n0-n1)>epsilon holds true for all vector respectively quaternion\n * components. The default value is 0.f - comparisons are exact then.\n */\n#define AI_CONFIG_PP_FID_ANIM_ACCURACY \\\n \"PP_FID_ANIM_ACCURACY\"\n\n\n// TransformUVCoords evaluates UV scalings\n#define AI_UVTRAFO_SCALING 0x1\n\n// TransformUVCoords evaluates UV rotations\n#define AI_UVTRAFO_ROTATION 0x2\n\n// TransformUVCoords evaluates UV translation\n#define AI_UVTRAFO_TRANSLATION 0x4\n\n// Everything baked together -> default value\n#define AI_UVTRAFO_ALL (AI_UVTRAFO_SCALING | AI_UVTRAFO_ROTATION | AI_UVTRAFO_TRANSLATION)\n\n// ---------------------------------------------------------------------------\n/** @brief Input parameter to the #aiProcess_TransformUVCoords step:\n * Specifies which UV transformations are evaluated.\n *\n * This is a bitwise combination of the AI_UVTRAFO_XXX flags (integer\n * property, of course). By default all transformations are enabled\n * (AI_UVTRAFO_ALL).\n */\n#define AI_CONFIG_PP_TUV_EVALUATE \\\n \"PP_TUV_EVALUATE\"\n\n// ---------------------------------------------------------------------------\n/** @brief A hint to assimp to favour speed against import quality.\n *\n * Enabling this option may result in faster loading, but it needn't.\n * It represents just a hint to loaders and post-processing steps to use\n * faster code paths, if possible.\n * This property is expected to be an integer, != 0 stands for true.\n * The default value is 0.\n */\n#define AI_CONFIG_FAVOUR_SPEED \\\n \"FAVOUR_SPEED\"\n\n\n// ###########################################################################\n// IMPORTER SETTINGS\n// Various stuff to fine-tune the behaviour of specific importer plugins.\n// ###########################################################################\n\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will merge all geometry layers present\n * in the source file or take only the first.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS \\\n \"IMPORT_FBX_READ_ALL_GEOMETRY_LAYERS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read all materials present in the\n * source file or take only the referenced materials.\n *\n * This is void unless IMPORT_FBX_READ_MATERIALS=1.\n *\n * The default value is false (0)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_ALL_MATERIALS \\\n \"IMPORT_FBX_READ_ALL_MATERIALS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read materials.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_MATERIALS \\\n \"IMPORT_FBX_READ_MATERIALS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read embedded textures.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_TEXTURES \\\n \"IMPORT_FBX_READ_TEXTURES\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read cameras.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_CAMERAS \\\n \"IMPORT_FBX_READ_CAMERAS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read light sources.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_LIGHTS \\\n \"IMPORT_FBX_READ_LIGHTS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will read animations.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_READ_ANIMATIONS \\\n \"IMPORT_FBX_READ_ANIMATIONS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will act in strict mode in which only\n * FBX 2013 is supported and any other sub formats are rejected. FBX 2013\n * is the primary target for the importer, so this format is best\n * supported and well-tested.\n *\n * The default value is false (0)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_STRICT_MODE \\\n \"IMPORT_FBX_STRICT_MODE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Set whether the fbx importer will preserve pivot points for\n * transformations (as extra nodes). If set to false, pivots and offsets\n * will be evaluated whenever possible.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_PRESERVE_PIVOTS \\\n \"IMPORT_FBX_PRESERVE_PIVOTS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies whether the importer will drop empty animation curves or\n * animation curves which match the bind pose transformation over their\n * entire defined range.\n *\n * The default value is true (1)\n * Property type: bool\n */\n#define AI_CONFIG_IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES \\\n \"IMPORT_FBX_OPTIMIZE_EMPTY_ANIMATION_CURVES\"\n\n\n\n// ---------------------------------------------------------------------------\n/** @brief Set the vertex animation keyframe to be imported\n *\n * ASSIMP does not support vertex keyframes (only bone animation is supported).\n * The library reads only one frame of models with vertex animations.\n * By default this is the first frame.\n * \\note The default value is 0. This option applies to all importers.\n * However, it is also possible to override the global setting\n * for a specific loader. You can use the AI_CONFIG_IMPORT_XXX_KEYFRAME\n * options (where XXX is a placeholder for the file format for which you\n * want to override the global setting).\n * Property type: integer.\n */\n#define AI_CONFIG_IMPORT_GLOBAL_KEYFRAME \"IMPORT_GLOBAL_KEYFRAME\"\n\n#define AI_CONFIG_IMPORT_MD3_KEYFRAME \"IMPORT_MD3_KEYFRAME\"\n#define AI_CONFIG_IMPORT_MD2_KEYFRAME \"IMPORT_MD2_KEYFRAME\"\n#define AI_CONFIG_IMPORT_MDL_KEYFRAME \"IMPORT_MDL_KEYFRAME\"\n#define AI_CONFIG_IMPORT_MDC_KEYFRAME \"IMPORT_MDC_KEYFRAME\"\n#define AI_CONFIG_IMPORT_SMD_KEYFRAME \"IMPORT_SMD_KEYFRAME\"\n#define AI_CONFIG_IMPORT_UNREAL_KEYFRAME \"IMPORT_UNREAL_KEYFRAME\"\n\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the AC loader to collect all surfaces which have the\n * \"Backface cull\" flag set in separate meshes.\n *\n * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_AC_SEPARATE_BFCULL \\\n \"IMPORT_AC_SEPARATE_BFCULL\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures whether the AC loader evaluates subdivision surfaces (\n * indicated by the presence of the 'subdiv' attribute in the file). By\n * default, Assimp performs the subdivision using the standard\n * Catmull-Clark algorithm\n *\n * * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_AC_EVAL_SUBDIVISION \\\n \"IMPORT_AC_EVAL_SUBDIVISION\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the UNREAL 3D loader to separate faces with different\n * surface flags (e.g. two-sided vs. single-sided).\n *\n * * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_UNREAL_HANDLE_FLAGS \\\n \"UNREAL_HANDLE_FLAGS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the terragen import plugin to compute uv's for\n * terrains, if not given. Furthermore a default texture is assigned.\n *\n * UV coordinates for terrains are so simple to compute that you'll usually\n * want to compute them on your own, if you need them. This option is intended\n * for model viewers which want to offer an easy way to apply textures to\n * terrains.\n * * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_IMPORT_TER_MAKE_UVS \\\n \"IMPORT_TER_MAKE_UVS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the ASE loader to always reconstruct normal vectors\n * basing on the smoothing groups loaded from the file.\n *\n * Some ASE files have carry invalid normals, other don't.\n * * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_ASE_RECONSTRUCT_NORMALS \\\n \"IMPORT_ASE_RECONSTRUCT_NORMALS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the M3D loader to detect and process multi-part\n * Quake player models.\n *\n * These models usually consist of 3 files, lower.md3, upper.md3 and\n * head.md3. If this property is set to true, Assimp will try to load and\n * combine all three files if one of them is loaded.\n * Property type: bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_MD3_HANDLE_MULTIPART \\\n \"IMPORT_MD3_HANDLE_MULTIPART\"\n\n// ---------------------------------------------------------------------------\n/** @brief Tells the MD3 loader which skin files to load.\n *\n * When loading MD3 files, Assimp checks whether a file\n * [md3_file_name]_[skin_name].skin is existing. These files are used by\n * Quake III to be able to assign different skins (e.g. red and blue team)\n * to models. 'default', 'red', 'blue' are typical skin names.\n * Property type: String. Default value: \"default\".\n */\n#define AI_CONFIG_IMPORT_MD3_SKIN_NAME \\\n \"IMPORT_MD3_SKIN_NAME\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specify the Quake 3 shader file to be used for a particular\n * MD3 file. This can also be a search path.\n *\n * By default Assimp's behaviour is as follows: If a MD3 file\n * any_path/models/any_q3_subdir/model_name/file_name.md3 is\n * loaded, the library tries to locate the corresponding shader file in\n * any_path/scripts/model_name.shader. This property overrides this\n * behaviour. It can either specify a full path to the shader to be loaded\n * or alternatively the path (relative or absolute) to the directory where\n * the shaders for all MD3s to be loaded reside. Assimp attempts to open\n * IMPORT_MD3_SHADER_SRC/model_name.shader first, IMPORT_MD3_SHADER_SRC/file_name.shader\n * is the fallback file. Note that IMPORT_MD3_SHADER_SRC should have a terminal (back)slash.\n * Property type: String. Default value: n/a.\n */\n#define AI_CONFIG_IMPORT_MD3_SHADER_SRC \\\n \"IMPORT_MD3_SHADER_SRC\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the LWO loader to load just one layer from the model.\n *\n * LWO files consist of layers and in some cases it could be useful to load\n * only one of them. This property can be either a string - which specifies\n * the name of the layer - or an integer - the index of the layer. If the\n * property is not set the whole LWO model is loaded. Loading fails if the\n * requested layer is not available. The layer index is zero-based and the\n * layer name may not be empty.
\n * Property type: Integer. Default value: all layers are loaded.\n */\n#define AI_CONFIG_IMPORT_LWO_ONE_LAYER_ONLY \\\n \"IMPORT_LWO_ONE_LAYER_ONLY\"\n\n// ---------------------------------------------------------------------------\n/** @brief Configures the MD5 loader to not load the MD5ANIM file for\n * a MD5MESH file automatically.\n *\n * The default strategy is to look for a file with the same name but the\n * MD5ANIM extension in the same directory. If it is found, it is loaded\n * and combined with the MD5MESH file. This configuration option can be\n * used to disable this behaviour.\n *\n * * Property type: bool. Default value: false.\n */\n#define AI_CONFIG_IMPORT_MD5_NO_ANIM_AUTOLOAD \\\n \"IMPORT_MD5_NO_ANIM_AUTOLOAD\"\n\n// ---------------------------------------------------------------------------\n/** @brief Defines the begin of the time range for which the LWS loader\n * evaluates animations and computes aiNodeAnim's.\n *\n * Assimp provides full conversion of LightWave's envelope system, including\n * pre and post conditions. The loader computes linearly subsampled animation\n * channels with the frame rate given in the LWS file. This property defines\n * the start time. Note: animation channels are only generated if a node\n * has at least one envelope with more tan one key assigned. This property.\n * is given in frames, '0' is the first frame. By default, if this property\n * is not set, the importer takes the animation start from the input LWS\n * file ('FirstFrame' line)
\n * Property type: Integer. Default value: taken from file.\n *\n * @see AI_CONFIG_IMPORT_LWS_ANIM_END - end of the imported time range\n */\n#define AI_CONFIG_IMPORT_LWS_ANIM_START \\\n \"IMPORT_LWS_ANIM_START\"\n#define AI_CONFIG_IMPORT_LWS_ANIM_END \\\n \"IMPORT_LWS_ANIM_END\"\n\n// ---------------------------------------------------------------------------\n/** @brief Defines the output frame rate of the IRR loader.\n *\n * IRR animations are difficult to convert for Assimp and there will\n * always be a loss of quality. This setting defines how many keys per second\n * are returned by the converter.
\n * Property type: integer. Default value: 100\n */\n#define AI_CONFIG_IMPORT_IRR_ANIM_FPS \\\n \"IMPORT_IRR_ANIM_FPS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Ogre Importer will try to find referenced materials from this file.\n *\n * Ogre meshes reference with material names, this does not tell Assimp the file\n * where it is located in. Assimp will try to find the source file in the following\n * order: .material, .material and\n * lastly the material name defined by this config property.\n *
\n * Property type: String. Default value: Scene.material.\n */\n#define AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE \\\n \"IMPORT_OGRE_MATERIAL_FILE\"\n\n// ---------------------------------------------------------------------------\n/** @brief Ogre Importer detect the texture usage from its filename.\n *\n * Ogre material texture units do not define texture type, the textures usage\n * depends on the used shader or Ogre's fixed pipeline. If this config property\n * is true Assimp will try to detect the type from the textures filename postfix:\n * _n, _nrm, _nrml, _normal, _normals and _normalmap for normal map, _s, _spec,\n * _specular and _specularmap for specular map, _l, _light, _lightmap, _occ\n * and _occlusion for light map, _disp and _displacement for displacement map.\n * The matching is case insensitive. Post fix is taken between the last\n * underscore and the last period.\n * Default behavior is to detect type from lower cased texture unit name by\n * matching against: normalmap, specularmap, lightmap and displacementmap.\n * For both cases if no match is found aiTextureType_DIFFUSE is used.\n *
\n * Property type: Bool. Default value: false.\n */\n#define AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME \\\n \"IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME\"\n\n/** @brief Specifies whether the IFC loader skips over IfcSpace elements.\n *\n * IfcSpace elements (and their geometric representations) are used to\n * represent, well, free space in a building storey.
\n * Property type: Bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS \"IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS\"\n\n /** @brief Specifies whether the Android JNI asset extraction is supported.\n *\n * Turn on this option if you want to manage assets in native\n * Android application without having to keep the internal directory and asset\n * manager pointer.\n */\n #define AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT \"AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT\"\n\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies whether the IFC loader skips over\n * shape representations of type 'Curve2D'.\n *\n * A lot of files contain both a faceted mesh representation and a outline\n * with a presentation type of 'Curve2D'. Currently Assimp doesn't convert those,\n * so turning this option off just clutters the log with errors.
\n * Property type: Bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_IFC_SKIP_CURVE_REPRESENTATIONS \"IMPORT_IFC_SKIP_CURVE_REPRESENTATIONS\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies whether the IFC loader will use its own, custom triangulation\n * algorithm to triangulate wall and floor meshes.\n *\n * If this property is set to false, walls will be either triangulated by\n * #aiProcess_Triangulate or will be passed through as huge polygons with\n * faked holes (i.e. holes that are connected with the outer boundary using\n * a dummy edge). It is highly recommended to set this property to true\n * if you want triangulated data because #aiProcess_Triangulate is known to\n * have problems with the kind of polygons that the IFC loader spits out for\n * complicated meshes.\n * Property type: Bool. Default value: true.\n */\n#define AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION \"IMPORT_IFC_CUSTOM_TRIANGULATION\"\n\n// ---------------------------------------------------------------------------\n/** @brief Specifies whether the Collada loader will ignore the provided up direction.\n *\n * If this property is set to true, the up direction provided in the file header will\n * be ignored and the file will be loaded as is.\n * Property type: Bool. Default value: false.\n */\n#define AI_CONFIG_IMPORT_COLLADA_IGNORE_UP_DIRECTION \"IMPORT_COLLADA_IGNORE_UP_DIRECTION\"\n\n// ---------- All the Export defines ------------\n\n/** @brief Specifies the xfile use double for real values of float\n *\n * Property type: Bool. Default value: false.\n */\n\n#define AI_CONFIG_EXPORT_XFILE_64BIT \"EXPORT_XFILE_64BIT\"\n\n#endif // !! AI_CONFIG_H_INC\n"}, {"path": "includes/assimp/defs.h", "language": "code", "loc": 230, "comment_density": 0.587, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file defs.h\n * @brief Assimp build configuration setup. See the notes in the comment\n * blocks to find out how to customize _your_ Assimp build.\n */\n\n#ifndef INCLUDED_AI_DEFINES_H\n#define INCLUDED_AI_DEFINES_H\n\n //////////////////////////////////////////////////////////////////////////\n /* Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific\n * file format loader. The loader is be excluded from the\n * build in this case. 'XX' stands for the most common file\n * extension of the file format. E.g.:\n * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader.\n *\n * If you're unsure about that, take a look at the implementation of the\n * import plugin you wish to disable. You'll find the right define in the\n * first lines of the corresponding unit.\n *\n * Other (mixed) configuration switches are listed here:\n * ASSIMP_BUILD_NO_COMPRESSED_X\n * - Disable support for compressed X files (zip)\n * ASSIMP_BUILD_NO_COMPRESSED_BLEND\n * - Disable support for compressed Blender files (zip)\n * ASSIMP_BUILD_NO_COMPRESSED_IFC\n * - Disable support for IFCZIP files (unzip)\n */\n //////////////////////////////////////////////////////////////////////////\n\n#ifndef ASSIMP_BUILD_NO_COMPRESSED_X\n# define ASSIMP_BUILD_NEED_Z_INFLATE\n#endif\n\n#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND\n# define ASSIMP_BUILD_NEED_Z_INFLATE\n#endif\n\n#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC\n# define ASSIMP_BUILD_NEED_Z_INFLATE\n# define ASSIMP_BUILD_NEED_UNZIP\n#endif\n\n#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER\n# define ASSIMP_BUILD_NEED_Z_INFLATE\n# define ASSIMP_BUILD_NEED_UNZIP\n#endif\n\n //////////////////////////////////////////////////////////////////////////\n /* Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific\n * post processing step. This is the current list of process names ('XX'):\n * CALCTANGENTS\n * JOINVERTICES\n * TRIANGULATE\n * GENFACENORMALS\n * GENVERTEXNORMALS\n * REMOVEVC\n * SPLITLARGEMESHES\n * PRETRANSFORMVERTICES\n * LIMITBONEWEIGHTS\n * VALIDATEDS\n * IMPROVECACHELOCALITY\n * FIXINFACINGNORMALS\n * REMOVE_REDUNDANTMATERIALS\n * OPTIMIZEGRAPH\n * SORTBYPTYPE\n * FINDINVALIDDATA\n * TRANSFORMTEXCOORDS\n * GENUVCOORDS\n * ENTITYMESHBUILDER\n * MAKELEFTHANDED\n * FLIPUVS\n * FLIPWINDINGORDER\n * OPTIMIZEMESHES\n * OPTIMIZEANIMS\n * OPTIMIZEGRAPH\n * GENENTITYMESHES\n * FIXTEXTUREPATHS */\n //////////////////////////////////////////////////////////////////////////\n\n#ifdef _MSC_VER\n# undef ASSIMP_API\n\n //////////////////////////////////////////////////////////////////////////\n /* Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library */\n //////////////////////////////////////////////////////////////////////////\n# ifdef ASSIMP_BUILD_DLL_EXPORT\n# define ASSIMP_API __declspec(dllexport)\n# define ASSIMP_API_WINONLY __declspec(dllexport)\n# pragma warning (disable : 4251)\n\n //////////////////////////////////////////////////////////////////////////\n /* Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in\n * an external DLL under Windows. Default is static linkage. */\n //////////////////////////////////////////////////////////////////////////\n# elif (defined ASSIMP_DLL)\n# define ASSIMP_API __declspec(dllimport)\n# define ASSIMP_API_WINONLY __declspec(dllimport)\n# else\n# define ASSIMP_API\n# define ASSIMP_API_WINONLY\n# endif\n\n /* Force the compiler to inline a function, if possible\n */\n# define AI_FORCE_INLINE __forceinline\n\n /* Tells the compiler that a function never returns. Used in code analysis\n * to skip dead paths (e.g. after an assertion evaluated to false). */\n# define AI_WONT_RETURN __declspec(noreturn)\n\n#elif defined(SWIG)\n\n /* Do nothing, the relevant defines are all in AssimpSwigPort.i */\n\n#else\n\n# define AI_WONT_RETURN\n\n# define ASSIMP_API __attribute__ ((visibility(\"default\")))\n# define ASSIMP_API_WINONLY\n# define AI_FORCE_INLINE inline\n#endif // (defined _MSC_VER)\n\n#ifdef __GNUC__\n# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))\n#else\n# define AI_WONT_RETURN_SUFFIX\n#endif // (defined __clang__)\n\n#ifdef __cplusplus\n /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up\n * in doxydocs.\n */\n# define C_STRUCT\n# define C_ENUM\n#else\n //////////////////////////////////////////////////////////////////////////\n /* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD\n * is defined by Doxygen's preprocessor. The corresponding\n * entries in the DOXYFILE are: */\n //////////////////////////////////////////////////////////////////////////\n#if 0\n ENABLE_PREPROCESSING = YES\n MACRO_EXPANSION = YES\n EXPAND_ONLY_PREDEF = YES\n SEARCH_INCLUDES = YES\n INCLUDE_PATH =\n INCLUDE_FILE_PATTERNS =\n PREDEFINED = ASSIMP_DOXYGEN_BUILD=1\n EXPAND_AS_DEFINED = C_STRUCT C_ENUM\n SKIP_FUNCTION_MACROS = YES\n#endif\n //////////////////////////////////////////////////////////////////////////\n /* Doxygen gets confused if we use c-struct typedefs to avoid\n * the explicit 'struct' notation. This trick here has the same\n * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need\n * to typedef all structs/enums. */\n //////////////////////////////////////////////////////////////////////////\n# if (defined ASSIMP_DOXYGEN_BUILD)\n# define C_STRUCT\n# define C_ENUM\n# else\n# define C_STRUCT struct\n# define C_ENUM enum\n# endif\n#endif\n\n#if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))\n#error Currently, Borland is unsupported. Feel free to port Assimp.\n\n// \"W8059 Packgr��e der Struktur ge�ndert\"\n\n#endif\n\n\n //////////////////////////////////////////////////////////////////////////\n /* Define ASSIMP_BUILD_SINGLETHREADED to compile assimp\n * without threading support. The library doesn't utilize\n * threads then and is itself not threadsafe. */\n //////////////////////////////////////////////////////////////////////////\n#ifndef ASSIMP_BUILD_SINGLETHREADED\n# define ASSIMP_BUILD_SINGLETHREADED\n#endif\n\n#if defined(_DEBUG) || ! defined(NDEBUG)\n# define ASSIMP_BUILD_DEBUG\n#endif\n\n //////////////////////////////////////////////////////////////////////////\n /* Useful constants */\n //////////////////////////////////////////////////////////////////////////\n\n/* This is PI. Hi PI. */\n#define AI_MATH_PI (3.141592653589793238462643383279 )\n#define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)\n#define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)\n\n/* And this is to avoid endless casts to float */\n#define AI_MATH_PI_F (3.1415926538f)\n#define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)\n#define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)\n\n/* Tiny macro to convert from radians to degrees and back */\n#define AI_DEG_TO_RAD(x) ((x)*0.0174532925f)\n#define AI_RAD_TO_DEG(x) ((x)*57.2957795f)\n\n/* Support for big-endian builds */\n#if defined(__BYTE_ORDER__)\n# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)\n# if !defined(__BIG_ENDIAN__)\n# define __BIG_ENDIAN__\n# endif\n# else /* little endian */\n# if defined (__BIG_ENDIAN__)\n# undef __BIG_ENDIAN__\n# endif\n# endif\n#endif\n#if defined(__BIG_ENDIAN__)\n# define AI_BUILD_BIG_ENDIAN\n#endif\n\n\n/* To avoid running out of memory\n * This can be adjusted for specific use cases\n * It's NOT a total limit, just a limit for individual allocations\n */\n#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))\n\n\n#endif // !! INCLUDED_AI_DEFINES_H\n"}, {"path": "includes/assimp/importerdesc.h", "language": "code", "loc": 117, "comment_density": 0.786, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file importerdesc.h\n * @brief #aiImporterFlags, aiImporterDesc implementation.\n */\n#ifndef INCLUDED_AI_IMPORTER_DESC_H\n#define INCLUDED_AI_IMPORTER_DESC_H\n\n\n/** Mixed set of flags for #aiImporterDesc, indicating some features\n * common to many importers*/\nenum aiImporterFlags\n{\n /** Indicates that there is a textual encoding of the\n * file format; and that it is supported.*/\n aiImporterFlags_SupportTextFlavour = 0x1,\n\n /** Indicates that there is a binary encoding of the\n * file format; and that it is supported.*/\n aiImporterFlags_SupportBinaryFlavour = 0x2,\n\n /** Indicates that there is a compressed encoding of the\n * file format; and that it is supported.*/\n aiImporterFlags_SupportCompressedFlavour = 0x4,\n\n /** Indicates that the importer reads only a very particular\n * subset of the file format. This happens commonly for\n * declarative or procedural formats which cannot easily\n * be mapped to #aiScene */\n aiImporterFlags_LimitedSupport = 0x8,\n\n /** Indicates that the importer is highly experimental and\n * should be used with care. This only happens for trunk\n * (i.e. SVN) versions, experimental code is not included\n * in releases. */\n aiImporterFlags_Experimental = 0x10\n};\n\n\n/** Meta information about a particular importer. Importers need to fill\n * this structure, but they can freely decide how talkative they are.\n * A common use case for loader meta info is a user interface\n * in which the user can choose between various import/export file\n * formats. Building such an UI by hand means a lot of maintenance\n * as importers/exporters are added to Assimp, so it might be useful\n * to have a common mechanism to query some rough importer\n * characteristics. */\nstruct aiImporterDesc\n{\n /** Full name of the importer (i.e. Blender3D importer)*/\n const char* mName;\n\n /** Original author (left blank if unknown or whole assimp team) */\n const char* mAuthor;\n\n /** Current maintainer, left blank if the author maintains */\n const char* mMaintainer;\n\n /** Implementation comments, i.e. unimplemented features*/\n const char* mComments;\n\n /** These flags indicate some characteristics common to many\n importers. */\n unsigned int mFlags;\n\n /** Minimum format version that can be loaded im major.minor format,\n both are set to 0 if there is either no version scheme\n or if the loader doesn't care. */\n unsigned int mMinMajor;\n unsigned int mMinMinor;\n\n /** Maximum format version that can be loaded im major.minor format,\n both are set to 0 if there is either no version scheme\n or if the loader doesn't care. Loaders that expect to be\n forward-compatible to potential future format versions should\n indicate zero, otherwise they should specify the current\n maximum version.*/\n unsigned int mMaxMajor;\n unsigned int mMaxMinor;\n\n /** List of file extensions this importer can handle.\n List entries are separated by space characters.\n All entries are lower case without a leading dot (i.e.\n \"xml dae\" would be a valid value. Note that multiple\n importers may respond to the same file extension -\n assimp calls all importers in the order in which they\n are registered and each importer gets the opportunity\n to load the file until one importer \"claims\" the file. Apart\n from file extension checks, importers typically use\n other methods to quickly reject files (i.e. magic\n words) so this does not mean that common or generic\n file extensions such as XML would be tediously slow. */\n const char* mFileExtensions;\n};\n\n/** \\brief Returns the Importer description for a given extension.\n\nWill return a NULL-pointer if no assigned importer desc. was found for the given extension\n \\param extension [in] The extension to look for\n \\return A pointer showing to the ImporterDesc, \\see aiImporterDesc.\n*/\nASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension );\n\n#endif\n"}, {"path": "includes/assimp/light.h", "language": "code", "loc": 218, "comment_density": 0.771, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file light.h\n * @brief Defines the aiLight data structure\n */\n\n#ifndef __AI_LIGHT_H_INC__\n#define __AI_LIGHT_H_INC__\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n/** Enumerates all supported types of light sources.\n */\nenum aiLightSourceType\n{\n aiLightSource_UNDEFINED = 0x0,\n\n //! A directional light source has a well-defined direction\n //! but is infinitely far away. That's quite a good\n //! approximation for sun light.\n aiLightSource_DIRECTIONAL = 0x1,\n\n //! A point light source has a well-defined position\n //! in space but no direction - it emits light in all\n //! directions. A normal bulb is a point light.\n aiLightSource_POINT = 0x2,\n\n //! A spot light source emits light in a specific\n //! angle. It has a position and a direction it is pointing to.\n //! A good example for a spot light is a light spot in\n //! sport arenas.\n aiLightSource_SPOT = 0x3,\n\n //! The generic light level of the world, including the bounces\n //! of all other light sources.\n //! Typically, there's at most one ambient light in a scene.\n //! This light type doesn't have a valid position, direction, or\n //! other properties, just a color.\n aiLightSource_AMBIENT = 0x4,\n\n //! An area light is a rectangle with predefined size that uniformly\n //! emits light from one of its sides. The position is center of the\n //! rectangle and direction is its normal vector.\n aiLightSource_AREA = 0x5,\n\n /** This value is not used. It is just there to force the\n * compiler to map this enum to a 32 Bit integer.\n */\n#ifndef SWIG\n _aiLightSource_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** Helper structure to describe a light source.\n *\n * Assimp supports multiple sorts of light sources, including\n * directional, point and spot lights. All of them are defined with just\n * a single structure and distinguished by their parameters.\n * Note - some file formats (such as 3DS, ASE) export a \"target point\" -\n * the point a spot light is looking at (it can even be animated). Assimp\n * writes the target point as a subnode of a spotlights's main node,\n * called \".Target\". However, this is just additional information\n * then, the transformation tracks of the main node make the\n * spot light already point in the right direction.\n*/\nstruct aiLight\n{\n /** The name of the light source.\n *\n * There must be a node in the scenegraph with the same name.\n * This node specifies the position of the light in the scene\n * hierarchy and can be animated.\n */\n C_STRUCT aiString mName;\n\n /** The type of the light source.\n *\n * aiLightSource_UNDEFINED is not a valid value for this member.\n */\n C_ENUM aiLightSourceType mType;\n\n /** Position of the light source in space. Relative to the\n * transformation of the node corresponding to the light.\n *\n * The position is undefined for directional lights.\n */\n C_STRUCT aiVector3D mPosition;\n\n /** Direction of the light source in space. Relative to the\n * transformation of the node corresponding to the light.\n *\n * The direction is undefined for point lights. The vector\n * may be normalized, but it needn't.\n */\n C_STRUCT aiVector3D mDirection;\n\n /** Up direction of the light source in space. Relative to the\n * transformation of the node corresponding to the light.\n *\n * The direction is undefined for point lights. The vector\n * may be normalized, but it needn't.\n */\n C_STRUCT aiVector3D mUp;\n\n /** Constant light attenuation factor.\n *\n * The intensity of the light source at a given distance 'd' from\n * the light's position is\n * @code\n * Atten = 1/( att0 + att1 * d + att2 * d*d)\n * @endcode\n * This member corresponds to the att0 variable in the equation.\n * Naturally undefined for directional lights.\n */\n float mAttenuationConstant;\n\n /** Linear light attenuation factor.\n *\n * The intensity of the light source at a given distance 'd' from\n * the light's position is\n * @code\n * Atten = 1/( att0 + att1 * d + att2 * d*d)\n * @endcode\n * This member corresponds to the att1 variable in the equation.\n * Naturally undefined for directional lights.\n */\n float mAttenuationLinear;\n\n /** Quadratic light attenuation factor.\n *\n * The intensity of the light source at a given distance 'd' from\n * the light's position is\n * @code\n * Atten = 1/( att0 + att1 * d + att2 * d*d)\n * @endcode\n * This member corresponds to the att2 variable in the equation.\n * Naturally undefined for directional lights.\n */\n float mAttenuationQuadratic;\n\n /** Diffuse color of the light source\n *\n * The diffuse light color is multiplied with the diffuse\n * material color to obtain the final color that contributes\n * to the diffuse shading term.\n */\n C_STRUCT aiColor3D mColorDiffuse;\n\n /** Specular color of the light source\n *\n * The specular light color is multiplied with the specular\n * material color to obtain the final color that contributes\n * to the specular shading term.\n */\n C_STRUCT aiColor3D mColorSpecular;\n\n /** Ambient color of the light source\n *\n * The ambient light color is multiplied with the ambient\n * material color to obtain the final color that contributes\n * to the ambient shading term. Most renderers will ignore\n * this value it, is just a remaining of the fixed-function pipeline\n * that is still supported by quite many file formats.\n */\n C_STRUCT aiColor3D mColorAmbient;\n\n /** Inner angle of a spot light's light cone.\n *\n * The spot light has maximum influence on objects inside this\n * angle. The angle is given in radians. It is 2PI for point\n * lights and undefined for directional lights.\n */\n float mAngleInnerCone;\n\n /** Outer angle of a spot light's light cone.\n *\n * The spot light does not affect objects outside this angle.\n * The angle is given in radians. It is 2PI for point lights and\n * undefined for directional lights. The outer angle must be\n * greater than or equal to the inner angle.\n * It is assumed that the application uses a smooth\n * interpolation between the inner and the outer cone of the\n * spot light.\n */\n float mAngleOuterCone;\n\n /** Size of area light source. */\n C_STRUCT aiVector2D mSize;\n\n#ifdef __cplusplus\n\n aiLight()\n : mType (aiLightSource_UNDEFINED)\n , mAttenuationConstant (0.f)\n , mAttenuationLinear (1.f)\n , mAttenuationQuadratic (0.f)\n , mAngleInnerCone ((float)AI_MATH_TWO_PI)\n , mAngleOuterCone ((float)AI_MATH_TWO_PI)\n , mSize (0.f, 0.f)\n {\n }\n\n#endif\n};\n\n#ifdef __cplusplus\n}\n#endif\n\n\n#endif // !! __AI_LIGHT_H_INC__\n"}, {"path": "includes/assimp/material.h", "language": "code", "loc": 1251, "comment_density": 0.532, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file material.h\n * @brief Defines the material system of the library\n */\n\n#ifndef AI_MATERIAL_H_INC\n#define AI_MATERIAL_H_INC\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// Name for default materials (2nd is used if meshes have UV coords)\n#define AI_DEFAULT_MATERIAL_NAME \"DefaultMaterial\"\n\n// ---------------------------------------------------------------------------\n/** @brief Defines how the Nth texture of a specific type is combined with\n * the result of all previous layers.\n *\n * Example (left: key, right: value):
\n * @code\n * DiffColor0 - gray\n * DiffTextureOp0 - aiTextureOpMultiply\n * DiffTexture0 - tex1.png\n * DiffTextureOp0 - aiTextureOpAdd\n * DiffTexture1 - tex2.png\n * @endcode\n * Written as equation, the final diffuse term for a specific pixel would be:\n * @code\n * diffFinal = DiffColor0 * sampleTex(DiffTexture0,UV0) +\n * sampleTex(DiffTexture1,UV0) * diffContrib;\n * @endcode\n * where 'diffContrib' is the intensity of the incoming light for that pixel.\n */\nenum aiTextureOp\n{\n /** T = T1 * T2 */\n aiTextureOp_Multiply = 0x0,\n\n /** T = T1 + T2 */\n aiTextureOp_Add = 0x1,\n\n /** T = T1 - T2 */\n aiTextureOp_Subtract = 0x2,\n\n /** T = T1 / T2 */\n aiTextureOp_Divide = 0x3,\n\n /** T = (T1 + T2) - (T1 * T2) */\n aiTextureOp_SmoothAdd = 0x4,\n\n /** T = T1 + (T2-0.5) */\n aiTextureOp_SignedAdd = 0x5,\n\n\n#ifndef SWIG\n _aiTextureOp_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** @brief Defines how UV coordinates outside the [0...1] range are handled.\n *\n * Commonly referred to as 'wrapping mode'.\n */\nenum aiTextureMapMode\n{\n /** A texture coordinate u|v is translated to u%1|v%1\n */\n aiTextureMapMode_Wrap = 0x0,\n\n /** Texture coordinates outside [0...1]\n * are clamped to the nearest valid value.\n */\n aiTextureMapMode_Clamp = 0x1,\n\n /** If the texture coordinates for a pixel are outside [0...1]\n * the texture is not applied to that pixel\n */\n aiTextureMapMode_Decal = 0x3,\n\n /** A texture coordinate u|v becomes u%1|v%1 if (u-(u%1))%2 is zero and\n * 1-(u%1)|1-(v%1) otherwise\n */\n aiTextureMapMode_Mirror = 0x2,\n\n#ifndef SWIG\n _aiTextureMapMode_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** @brief Defines how the mapping coords for a texture are generated.\n *\n * Real-time applications typically require full UV coordinates, so the use of\n * the aiProcess_GenUVCoords step is highly recommended. It generates proper\n * UV channels for non-UV mapped objects, as long as an accurate description\n * how the mapping should look like (e.g spherical) is given.\n * See the #AI_MATKEY_MAPPING property for more details.\n */\nenum aiTextureMapping\n{\n /** The mapping coordinates are taken from an UV channel.\n *\n * The #AI_MATKEY_UVWSRC key specifies from which UV channel\n * the texture coordinates are to be taken from (remember,\n * meshes can have more than one UV channel).\n */\n aiTextureMapping_UV = 0x0,\n\n /** Spherical mapping */\n aiTextureMapping_SPHERE = 0x1,\n\n /** Cylindrical mapping */\n aiTextureMapping_CYLINDER = 0x2,\n\n /** Cubic mapping */\n aiTextureMapping_BOX = 0x3,\n\n /** Planar mapping */\n aiTextureMapping_PLANE = 0x4,\n\n /** Undefined mapping. Have fun. */\n aiTextureMapping_OTHER = 0x5,\n\n\n#ifndef SWIG\n _aiTextureMapping_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** @brief Defines the purpose of a texture\n *\n * This is a very difficult topic. Different 3D packages support different\n * kinds of textures. For very common texture types, such as bumpmaps, the\n * rendering results depend on implementation details in the rendering\n * pipelines of these applications. Assimp loads all texture references from\n * the model file and tries to determine which of the predefined texture\n * types below is the best choice to match the original use of the texture\n * as closely as possible.
\n *\n * In content pipelines you'll usually define how textures have to be handled,\n * and the artists working on models have to conform to this specification,\n * regardless which 3D tool they're using.\n */\nenum aiTextureType\n{\n /** Dummy value.\n *\n * No texture, but the value to be used as 'texture semantic'\n * (#aiMaterialProperty::mSemantic) for all material properties\n * *not* related to textures.\n */\n aiTextureType_NONE = 0x0,\n\n\n\n /** The texture is combined with the result of the diffuse\n * lighting equation.\n */\n aiTextureType_DIFFUSE = 0x1,\n\n /** The texture is combined with the result of the specular\n * lighting equation.\n */\n aiTextureType_SPECULAR = 0x2,\n\n /** The texture is combined with the result of the ambient\n * lighting equation.\n */\n aiTextureType_AMBIENT = 0x3,\n\n /** The texture is added to the result of the lighting\n * calculation. It isn't influenced by incoming light.\n */\n aiTextureType_EMISSIVE = 0x4,\n\n /** The texture is a height map.\n *\n * By convention, higher gray-scale values stand for\n * higher elevations from the base height.\n */\n aiTextureType_HEIGHT = 0x5,\n\n /** The texture is a (tangent space) normal-map.\n *\n * Again, there are several conventions for tangent-space\n * normal maps. Assimp does (intentionally) not\n * distinguish here.\n */\n aiTextureType_NORMALS = 0x6,\n\n /** The texture defines the glossiness of the material.\n *\n * The glossiness is in fact the exponent of the specular\n * (phong) lighting equation. Usually there is a conversion\n * function defined to map the linear color values in the\n * texture to a suitable exponent. Have fun.\n */\n aiTextureType_SHININESS = 0x7,\n\n /** The texture defines per-pixel opacity.\n *\n * Usually 'white' means opaque and 'black' means\n * 'transparency'. Or quite the opposite. Have fun.\n */\n aiTextureType_OPACITY = 0x8,\n\n /** Displacement texture\n *\n * The exact purpose and format is application-dependent.\n * Higher color values stand for higher vertex displacements.\n */\n aiTextureType_DISPLACEMENT = 0x9,\n\n /** Lightmap texture (aka Ambient Occlusion)\n *\n * Both 'Lightmaps' and dedicated 'ambient occlusion maps' are\n * covered by this material property. The texture contains a\n * scaling value for the final color value of a pixel. Its\n * intensity is not affected by incoming light.\n */\n aiTextureType_LIGHTMAP = 0xA,\n\n /** Reflection texture\n *\n * Contains the color of a perfect mirror reflection.\n * Rarely used, almost never for real-time applications.\n */\n aiTextureType_REFLECTION = 0xB,\n\n /** Unknown texture\n *\n * A texture reference that does not match any of the definitions\n * above is considered to be 'unknown'. It is still imported,\n * but is excluded from any further postprocessing.\n */\n aiTextureType_UNKNOWN = 0xC,\n\n\n#ifndef SWIG\n _aiTextureType_Force32Bit = INT_MAX\n#endif\n};\n\n#define AI_TEXTURE_TYPE_MAX aiTextureType_UNKNOWN\n\n// ---------------------------------------------------------------------------\n/** @brief Defines all shading models supported by the library\n *\n * The list of shading modes has been taken from Blender.\n * See Blender documentation for more information. The API does\n * not distinguish between \"specular\" and \"diffuse\" shaders (thus the\n * specular term for diffuse shading models like Oren-Nayar remains\n * undefined).
\n * Again, this value is just a hint. Assimp tries to select the shader whose\n * most common implementation matches the original rendering results of the\n * 3D modeller which wrote a particular model as closely as possible.\n */\nenum aiShadingMode\n{\n /** Flat shading. Shading is done on per-face base,\n * diffuse only. Also known as 'faceted shading'.\n */\n aiShadingMode_Flat = 0x1,\n\n /** Simple Gouraud shading.\n */\n aiShadingMode_Gouraud = 0x2,\n\n /** Phong-Shading -\n */\n aiShadingMode_Phong = 0x3,\n\n /** Phong-Blinn-Shading\n */\n aiShadingMode_Blinn = 0x4,\n\n /** Toon-Shading per pixel\n *\n * Also known as 'comic' shader.\n */\n aiShadingMode_Toon = 0x5,\n\n /** OrenNayar-Shading per pixel\n *\n * Extension to standard Lambertian shading, taking the\n * roughness of the material into account\n */\n aiShadingMode_OrenNayar = 0x6,\n\n /** Minnaert-Shading per pixel\n *\n * Extension to standard Lambertian shading, taking the\n * \"darkness\" of the material into account\n */\n aiShadingMode_Minnaert = 0x7,\n\n /** CookTorrance-Shading per pixel\n *\n * Special shader for metallic surfaces.\n */\n aiShadingMode_CookTorrance = 0x8,\n\n /** No shading at all. Constant light influence of 1.0.\n */\n aiShadingMode_NoShading = 0x9,\n\n /** Fresnel shading\n */\n aiShadingMode_Fresnel = 0xa,\n\n\n#ifndef SWIG\n _aiShadingMode_Force32Bit = INT_MAX\n#endif\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief Defines some mixed flags for a particular texture.\n *\n * Usually you'll instruct your cg artists how textures have to look like ...\n * and how they will be processed in your application. However, if you use\n * Assimp for completely generic loading purposes you might also need to\n * process these flags in order to display as many 'unknown' 3D models as\n * possible correctly.\n *\n * This corresponds to the #AI_MATKEY_TEXFLAGS property.\n*/\nenum aiTextureFlags\n{\n /** The texture's color values have to be inverted (componentwise 1-n)\n */\n aiTextureFlags_Invert = 0x1,\n\n /** Explicit request to the application to process the alpha channel\n * of the texture.\n *\n * Mutually exclusive with #aiTextureFlags_IgnoreAlpha. These\n * flags are set if the library can say for sure that the alpha\n * channel is used/is not used. If the model format does not\n * define this, it is left to the application to decide whether\n * the texture alpha channel - if any - is evaluated or not.\n */\n aiTextureFlags_UseAlpha = 0x2,\n\n /** Explicit request to the application to ignore the alpha channel\n * of the texture.\n *\n * Mutually exclusive with #aiTextureFlags_UseAlpha.\n */\n aiTextureFlags_IgnoreAlpha = 0x4,\n\n#ifndef SWIG\n _aiTextureFlags_Force32Bit = INT_MAX\n#endif\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief Defines alpha-blend flags.\n *\n * If you're familiar with OpenGL or D3D, these flags aren't new to you.\n * They define *how* the final color value of a pixel is computed, basing\n * on the previous color at that pixel and the new color value from the\n * material.\n * The blend formula is:\n * @code\n * SourceColor * SourceBlend + DestColor * DestBlend\n * @endcode\n * where DestColor is the previous color in the framebuffer at this\n * position and SourceColor is the material color before the transparency\n * calculation.
\n * This corresponds to the #AI_MATKEY_BLEND_FUNC property.\n*/\nenum aiBlendMode\n{\n /**\n * Formula:\n * @code\n * SourceColor*SourceAlpha + DestColor*(1-SourceAlpha)\n * @endcode\n */\n aiBlendMode_Default = 0x0,\n\n /** Additive blending\n *\n * Formula:\n * @code\n * SourceColor*1 + DestColor*1\n * @endcode\n */\n aiBlendMode_Additive = 0x1,\n\n // we don't need more for the moment, but we might need them\n // in future versions ...\n\n#ifndef SWIG\n _aiBlendMode_Force32Bit = INT_MAX\n#endif\n};\n\n\n#include \"./Compiler/pushpack1.h\"\n\n// ---------------------------------------------------------------------------\n/** @brief Defines how an UV channel is transformed.\n *\n * This is just a helper structure for the #AI_MATKEY_UVTRANSFORM key.\n * See its documentation for more details.\n *\n * Typically you'll want to build a matrix of this information. However,\n * we keep separate scaling/translation/rotation values to make it\n * easier to process and optimize UV transformations internally.\n */\nstruct aiUVTransform\n{\n /** Translation on the u and v axes.\n *\n * The default value is (0|0).\n */\n C_STRUCT aiVector2D mTranslation;\n\n /** Scaling on the u and v axes.\n *\n * The default value is (1|1).\n */\n C_STRUCT aiVector2D mScaling;\n\n /** Rotation - in counter-clockwise direction.\n *\n * The rotation angle is specified in radians. The\n * rotation center is 0.5f|0.5f. The default value\n * 0.f.\n */\n float mRotation;\n\n\n#ifdef __cplusplus\n aiUVTransform()\n : mScaling (1.f,1.f)\n , mRotation (0.f)\n {\n // nothing to be done here ...\n }\n#endif\n\n} PACK_STRUCT;\n\n#include \"./Compiler/poppack1.h\"\n\n//! @cond AI_DOX_INCLUDE_INTERNAL\n// ---------------------------------------------------------------------------\n/** @brief A very primitive RTTI system for the contents of material\n * properties.\n */\nenum aiPropertyTypeInfo\n{\n /** Array of single-precision (32 Bit) floats\n *\n * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API\n * aiMaterial::Get()) to query properties stored in floating-point format.\n * The material system performs the type conversion automatically.\n */\n aiPTI_Float = 0x1,\n\n /** The material property is an aiString.\n *\n * Arrays of strings aren't possible, aiGetMaterialString() (or the\n * C++-API aiMaterial::Get()) *must* be used to query a string property.\n */\n aiPTI_String = 0x3,\n\n /** Array of (32 Bit) integers\n *\n * It is possible to use aiGetMaterialFloat[Array]() (or the C++-API\n * aiMaterial::Get()) to query properties stored in integer format.\n * The material system performs the type conversion automatically.\n */\n aiPTI_Integer = 0x4,\n\n\n /** Simple binary buffer, content undefined. Not convertible to anything.\n */\n aiPTI_Buffer = 0x5,\n\n\n /** This value is not used. It is just there to force the\n * compiler to map this enum to a 32 Bit integer.\n */\n#ifndef SWIG\n _aiPTI_Force32Bit = INT_MAX\n#endif\n};\n\n// ---------------------------------------------------------------------------\n/** @brief Data structure for a single material property\n *\n * As an user, you'll probably never need to deal with this data structure.\n * Just use the provided aiGetMaterialXXX() or aiMaterial::Get() family\n * of functions to query material properties easily. Processing them\n * manually is faster, but it is not the recommended way. It isn't worth\n * the effort.
\n * Material property names follow a simple scheme:\n * @code\n * $\n * ?\n * A public property, there must be corresponding AI_MATKEY_XXX define\n * 2nd: Public, but ignored by the #aiProcess_RemoveRedundantMaterials\n * post-processing step.\n * ~\n * A temporary property for internal use.\n * @endcode\n * @see aiMaterial\n */\nstruct aiMaterialProperty\n{\n /** Specifies the name of the property (key)\n * Keys are generally case insensitive.\n */\n C_STRUCT aiString mKey;\n\n /** Textures: Specifies their exact usage semantic.\n * For non-texture properties, this member is always 0\n * (or, better-said, #aiTextureType_NONE).\n */\n unsigned int mSemantic;\n\n /** Textures: Specifies the index of the texture.\n * For non-texture properties, this member is always 0.\n */\n unsigned int mIndex;\n\n /** Size of the buffer mData is pointing to, in bytes.\n * This value may not be 0.\n */\n unsigned int mDataLength;\n\n /** Type information for the property.\n *\n * Defines the data layout inside the data buffer. This is used\n * by the library internally to perform debug checks and to\n * utilize proper type conversions.\n * (It's probably a hacky solution, but it works.)\n */\n C_ENUM aiPropertyTypeInfo mType;\n\n /** Binary buffer to hold the property's value.\n * The size of the buffer is always mDataLength.\n */\n char* mData;\n\n#ifdef __cplusplus\n\n aiMaterialProperty()\n : mSemantic( 0 )\n , mIndex( 0 )\n , mDataLength( 0 )\n , mType( aiPTI_Float )\n , mData( NULL )\n {\n }\n\n ~aiMaterialProperty() {\n delete[] mData;\n }\n\n#endif\n};\n//! @endcond\n\n#ifdef __cplusplus\n} // We need to leave the \"C\" block here to allow template member functions\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Data structure for a material\n*\n* Material data is stored using a key-value structure. A single key-value\n* pair is called a 'material property'. C++ users should use the provided\n* member functions of aiMaterial to process material properties, C users\n* have to stick with the aiMaterialGetXXX family of unbound functions.\n* The library defines a set of standard keys (AI_MATKEY_XXX).\n*/\n#ifdef __cplusplus\nstruct ASSIMP_API aiMaterial\n#else\nstruct aiMaterial\n#endif\n{\n\n#ifdef __cplusplus\n\npublic:\n\n aiMaterial();\n ~aiMaterial();\n\n // -------------------------------------------------------------------\n /** @brief Retrieve an array of Type values with a specific key\n * from the material\n *\n * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n * @param type .. set by AI_MATKEY_XXX\n * @param idx .. set by AI_MATKEY_XXX\n * @param pOut Pointer to a buffer to receive the result.\n * @param pMax Specifies the size of the given buffer, in Type's.\n * Receives the number of values (not bytes!) read.\n * NULL is a valid value for this parameter.\n */\n template \n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, Type* pOut, unsigned int* pMax) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, int* pOut, unsigned int* pMax) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, float* pOut, unsigned int* pMax) const;\n\n // -------------------------------------------------------------------\n /** @brief Retrieve a Type value with a specific key\n * from the material\n *\n * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n * @param type Specifies the type of the texture to be retrieved (\n * e.g. diffuse, specular, height map ...)\n * @param idx Index of the texture to be retrieved.\n * @param pOut Reference to receive the output value\n */\n template \n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx,Type& pOut) const;\n\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, int& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, float& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, aiString& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, aiColor3D& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, aiColor4D& pOut) const;\n\n aiReturn Get(const char* pKey,unsigned int type,\n unsigned int idx, aiUVTransform& pOut) const;\n\n // -------------------------------------------------------------------\n /** Get the number of textures for a particular texture type.\n * @param type Texture type to check for\n * @return Number of textures for this type.\n * @note A texture can be easily queried using #GetTexture() */\n unsigned int GetTextureCount(aiTextureType type) const;\n\n // -------------------------------------------------------------------\n /** Helper function to get all parameters pertaining to a\n * particular texture slot from a material.\n *\n * This function is provided just for convenience, you could also\n * read the single material properties manually.\n * @param type Specifies the type of the texture to be retrieved (\n * e.g. diffuse, specular, height map ...)\n * @param index Index of the texture to be retrieved. The function fails\n * if there is no texture of that type with this index.\n * #GetTextureCount() can be used to determine the number of textures\n * per texture type.\n * @param path Receives the path to the texture.\n * NULL is a valid value.\n * @param mapping The texture mapping.\n * NULL is allowed as value.\n * @param uvindex Receives the UV index of the texture.\n * NULL is a valid value.\n * @param blend Receives the blend factor for the texture\n * NULL is a valid value.\n * @param op Receives the texture operation to be performed between\n * this texture and the previous texture. NULL is allowed as value.\n * @param mapmode Receives the mapping modes to be used for the texture.\n * The parameter may be NULL but if it is a valid pointer it MUST\n * point to an array of 3 aiTextureMapMode's (one for each\n * axis: UVW order (=XYZ)).\n */\n // -------------------------------------------------------------------\n aiReturn GetTexture(aiTextureType type,\n unsigned int index,\n C_STRUCT aiString* path,\n aiTextureMapping* mapping = NULL,\n unsigned int* uvindex = NULL,\n float* blend = NULL,\n aiTextureOp* op = NULL,\n aiTextureMapMode* mapmode = NULL) const;\n\n\n // Setters\n\n\n // ------------------------------------------------------------------------------\n /** @brief Add a property with a given key and type info to the material\n * structure\n *\n * @param pInput Pointer to input data\n * @param pSizeInBytes Size of input data\n * @param pKey Key/Usage of the property (AI_MATKEY_XXX)\n * @param type Set by the AI_MATKEY_XXX macro\n * @param index Set by the AI_MATKEY_XXX macro\n * @param pType Type information hint */\n aiReturn AddBinaryProperty (const void* pInput,\n unsigned int pSizeInBytes,\n const char* pKey,\n unsigned int type ,\n unsigned int index ,\n aiPropertyTypeInfo pType);\n\n // ------------------------------------------------------------------------------\n /** @brief Add a string property with a given key and type info to the\n * material structure\n *\n * @param pInput Input string\n * @param pKey Key/Usage of the property (AI_MATKEY_XXX)\n * @param type Set by the AI_MATKEY_XXX macro\n * @param index Set by the AI_MATKEY_XXX macro */\n aiReturn AddProperty (const aiString* pInput,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n // ------------------------------------------------------------------------------\n /** @brief Add a property with a given key to the material structure\n * @param pInput Pointer to the input data\n * @param pNumValues Number of values in the array\n * @param pKey Key/Usage of the property (AI_MATKEY_XXX)\n * @param type Set by the AI_MATKEY_XXX macro\n * @param index Set by the AI_MATKEY_XXX macro */\n template\n aiReturn AddProperty (const TYPE* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const aiVector3D* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const aiColor3D* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const aiColor4D* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const int* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const float* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n aiReturn AddProperty (const aiUVTransform* pInput,\n unsigned int pNumValues,\n const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n // ------------------------------------------------------------------------------\n /** @brief Remove a given key from the list.\n *\n * The function fails if the key isn't found\n * @param pKey Key to be deleted\n * @param type Set by the AI_MATKEY_XXX macro\n * @param index Set by the AI_MATKEY_XXX macro */\n aiReturn RemoveProperty (const char* pKey,\n unsigned int type = 0,\n unsigned int index = 0);\n\n // ------------------------------------------------------------------------------\n /** @brief Removes all properties from the material.\n *\n * The data array remains allocated so adding new properties is quite fast. */\n void Clear();\n\n // ------------------------------------------------------------------------------\n /** Copy the property list of a material\n * @param pcDest Destination material\n * @param pcSrc Source material\n */\n static void CopyPropertyList(aiMaterial* pcDest,\n const aiMaterial* pcSrc);\n\n\n#endif\n\n /** List of all material properties loaded. */\n C_STRUCT aiMaterialProperty** mProperties;\n\n /** Number of properties in the data base */\n unsigned int mNumProperties;\n\n /** Storage allocated */\n unsigned int mNumAllocated;\n};\n\n// Go back to extern \"C\" again\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_NAME \"?mat.name\",0,0\n#define AI_MATKEY_TWOSIDED \"$mat.twosided\",0,0\n#define AI_MATKEY_SHADING_MODEL \"$mat.shadingm\",0,0\n#define AI_MATKEY_ENABLE_WIREFRAME \"$mat.wireframe\",0,0\n#define AI_MATKEY_BLEND_FUNC \"$mat.blend\",0,0\n#define AI_MATKEY_OPACITY \"$mat.opacity\",0,0\n#define AI_MATKEY_BUMPSCALING \"$mat.bumpscaling\",0,0\n#define AI_MATKEY_SHININESS \"$mat.shininess\",0,0\n#define AI_MATKEY_REFLECTIVITY \"$mat.reflectivity\",0,0\n#define AI_MATKEY_SHININESS_STRENGTH \"$mat.shinpercent\",0,0\n#define AI_MATKEY_REFRACTI \"$mat.refracti\",0,0\n#define AI_MATKEY_COLOR_DIFFUSE \"$clr.diffuse\",0,0\n#define AI_MATKEY_COLOR_AMBIENT \"$clr.ambient\",0,0\n#define AI_MATKEY_COLOR_SPECULAR \"$clr.specular\",0,0\n#define AI_MATKEY_COLOR_EMISSIVE \"$clr.emissive\",0,0\n#define AI_MATKEY_COLOR_TRANSPARENT \"$clr.transparent\",0,0\n#define AI_MATKEY_COLOR_REFLECTIVE \"$clr.reflective\",0,0\n#define AI_MATKEY_GLOBAL_BACKGROUND_IMAGE \"?bg.global\",0,0\n\n// ---------------------------------------------------------------------------\n// Pure key names for all texture-related properties\n//! @cond MATS_DOC_FULL\n#define _AI_MATKEY_TEXTURE_BASE \"$tex.file\"\n#define _AI_MATKEY_UVWSRC_BASE \"$tex.uvwsrc\"\n#define _AI_MATKEY_TEXOP_BASE \"$tex.op\"\n#define _AI_MATKEY_MAPPING_BASE \"$tex.mapping\"\n#define _AI_MATKEY_TEXBLEND_BASE \"$tex.blend\"\n#define _AI_MATKEY_MAPPINGMODE_U_BASE \"$tex.mapmodeu\"\n#define _AI_MATKEY_MAPPINGMODE_V_BASE \"$tex.mapmodev\"\n#define _AI_MATKEY_TEXMAP_AXIS_BASE \"$tex.mapaxis\"\n#define _AI_MATKEY_UVTRANSFORM_BASE \"$tex.uvtrafo\"\n#define _AI_MATKEY_TEXFLAGS_BASE \"$tex.flags\"\n//! @endcond\n\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXTURE(type, N) _AI_MATKEY_TEXTURE_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXTURE_DIFFUSE(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXTURE_SPECULAR(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXTURE_AMBIENT(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXTURE_EMISSIVE(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXTURE_NORMALS(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXTURE_HEIGHT(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXTURE_SHININESS(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXTURE_OPACITY(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXTURE_DISPLACEMENT(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXTURE_LIGHTMAP(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXTURE_REFLECTION(N) \\\n AI_MATKEY_TEXTURE(aiTextureType_REFLECTION,N)\n\n//! @endcond\n\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_UVWSRC(type, N) _AI_MATKEY_UVWSRC_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_UVWSRC_DIFFUSE(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_UVWSRC_SPECULAR(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_UVWSRC_AMBIENT(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_UVWSRC_EMISSIVE(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_UVWSRC_NORMALS(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_UVWSRC_HEIGHT(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_UVWSRC_SHININESS(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_UVWSRC_OPACITY(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_UVWSRC_DISPLACEMENT(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_UVWSRC_LIGHTMAP(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_UVWSRC_REFLECTION(N) \\\n AI_MATKEY_UVWSRC(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXOP(type, N) _AI_MATKEY_TEXOP_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXOP_DIFFUSE(N) \\\n AI_MATKEY_TEXOP(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXOP_SPECULAR(N) \\\n AI_MATKEY_TEXOP(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXOP_AMBIENT(N) \\\n AI_MATKEY_TEXOP(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXOP_EMISSIVE(N) \\\n AI_MATKEY_TEXOP(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXOP_NORMALS(N) \\\n AI_MATKEY_TEXOP(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXOP_HEIGHT(N) \\\n AI_MATKEY_TEXOP(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXOP_SHININESS(N) \\\n AI_MATKEY_TEXOP(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXOP_OPACITY(N) \\\n AI_MATKEY_TEXOP(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXOP_DISPLACEMENT(N) \\\n AI_MATKEY_TEXOP(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXOP_LIGHTMAP(N) \\\n AI_MATKEY_TEXOP(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXOP_REFLECTION(N) \\\n AI_MATKEY_TEXOP(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_MAPPING(type, N) _AI_MATKEY_MAPPING_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_MAPPING_DIFFUSE(N) \\\n AI_MATKEY_MAPPING(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_MAPPING_SPECULAR(N) \\\n AI_MATKEY_MAPPING(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_MAPPING_AMBIENT(N) \\\n AI_MATKEY_MAPPING(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_MAPPING_EMISSIVE(N) \\\n AI_MATKEY_MAPPING(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_MAPPING_NORMALS(N) \\\n AI_MATKEY_MAPPING(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_MAPPING_HEIGHT(N) \\\n AI_MATKEY_MAPPING(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_MAPPING_SHININESS(N) \\\n AI_MATKEY_MAPPING(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_MAPPING_OPACITY(N) \\\n AI_MATKEY_MAPPING(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_MAPPING_DISPLACEMENT(N) \\\n AI_MATKEY_MAPPING(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_MAPPING_LIGHTMAP(N) \\\n AI_MATKEY_MAPPING(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_MAPPING_REFLECTION(N) \\\n AI_MATKEY_MAPPING(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXBLEND(type, N) _AI_MATKEY_TEXBLEND_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXBLEND_DIFFUSE(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXBLEND_SPECULAR(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXBLEND_AMBIENT(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXBLEND_EMISSIVE(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXBLEND_NORMALS(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXBLEND_HEIGHT(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXBLEND_SHININESS(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXBLEND_OPACITY(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXBLEND_DISPLACEMENT(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXBLEND_LIGHTMAP(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXBLEND_REFLECTION(N) \\\n AI_MATKEY_TEXBLEND(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_MAPPINGMODE_U(type, N) _AI_MATKEY_MAPPINGMODE_U_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_MAPPINGMODE_U_DIFFUSE(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_SPECULAR(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_AMBIENT(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_EMISSIVE(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_NORMALS(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_HEIGHT(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_SHININESS(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_OPACITY(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_DISPLACEMENT(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_LIGHTMAP(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_MAPPINGMODE_U_REFLECTION(N) \\\n AI_MATKEY_MAPPINGMODE_U(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_MAPPINGMODE_V(type, N) _AI_MATKEY_MAPPINGMODE_V_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_MAPPINGMODE_V_DIFFUSE(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_SPECULAR(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_AMBIENT(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_EMISSIVE(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_NORMALS(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_HEIGHT(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_SHININESS(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_OPACITY(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_DISPLACEMENT(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_LIGHTMAP(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_MAPPINGMODE_V_REFLECTION(N) \\\n AI_MATKEY_MAPPINGMODE_V(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXMAP_AXIS(type, N) _AI_MATKEY_TEXMAP_AXIS_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXMAP_AXIS_DIFFUSE(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_SPECULAR(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_AMBIENT(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_EMISSIVE(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_NORMALS(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_HEIGHT(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_SHININESS(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_OPACITY(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_DISPLACEMENT(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_LIGHTMAP(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXMAP_AXIS_REFLECTION(N) \\\n AI_MATKEY_TEXMAP_AXIS(aiTextureType_REFLECTION,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_UVTRANSFORM(type, N) _AI_MATKEY_UVTRANSFORM_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_UVTRANSFORM_DIFFUSE(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_UVTRANSFORM_SPECULAR(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_UVTRANSFORM_AMBIENT(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_UVTRANSFORM_EMISSIVE(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_UVTRANSFORM_NORMALS(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_UVTRANSFORM_HEIGHT(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_UVTRANSFORM_SHININESS(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_UVTRANSFORM_OPACITY(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_UVTRANSFORM_DISPLACEMENT(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_UVTRANSFORM_LIGHTMAP(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_UVTRANSFORM_REFLECTION(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_REFLECTION,N)\n\n#define AI_MATKEY_UVTRANSFORM_UNKNOWN(N) \\\n AI_MATKEY_UVTRANSFORM(aiTextureType_UNKNOWN,N)\n\n//! @endcond\n// ---------------------------------------------------------------------------\n#define AI_MATKEY_TEXFLAGS(type, N) _AI_MATKEY_TEXFLAGS_BASE,type,N\n\n// For backward compatibility and simplicity\n//! @cond MATS_DOC_FULL\n#define AI_MATKEY_TEXFLAGS_DIFFUSE(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_DIFFUSE,N)\n\n#define AI_MATKEY_TEXFLAGS_SPECULAR(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_SPECULAR,N)\n\n#define AI_MATKEY_TEXFLAGS_AMBIENT(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_AMBIENT,N)\n\n#define AI_MATKEY_TEXFLAGS_EMISSIVE(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_EMISSIVE,N)\n\n#define AI_MATKEY_TEXFLAGS_NORMALS(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_NORMALS,N)\n\n#define AI_MATKEY_TEXFLAGS_HEIGHT(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_HEIGHT,N)\n\n#define AI_MATKEY_TEXFLAGS_SHININESS(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_SHININESS,N)\n\n#define AI_MATKEY_TEXFLAGS_OPACITY(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_OPACITY,N)\n\n#define AI_MATKEY_TEXFLAGS_DISPLACEMENT(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_DISPLACEMENT,N)\n\n#define AI_MATKEY_TEXFLAGS_LIGHTMAP(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_LIGHTMAP,N)\n\n#define AI_MATKEY_TEXFLAGS_REFLECTION(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_REFLECTION,N)\n\n#define AI_MATKEY_TEXFLAGS_UNKNOWN(N) \\\n AI_MATKEY_TEXFLAGS(aiTextureType_UNKNOWN,N)\n\n//! @endcond\n//!\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a material property with a specific key from the material\n *\n * @param pMat Pointer to the input material. May not be NULL\n * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n * @param type Specifies the type of the texture to be retrieved (\n * e.g. diffuse, specular, height map ...)\n * @param index Index of the texture to be retrieved.\n * @param pPropOut Pointer to receive a pointer to a valid aiMaterialProperty\n * structure or NULL if the key has not been found. */\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialProperty(\n const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n const C_STRUCT aiMaterialProperty** pPropOut);\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve an array of float values with a specific key\n * from the material\n *\n * Pass one of the AI_MATKEY_XXX constants for the last three parameters (the\n * example reads the #AI_MATKEY_UVTRANSFORM property of the first diffuse texture)\n * @code\n * aiUVTransform trafo;\n * unsigned int max = sizeof(aiUVTransform);\n * if (AI_SUCCESS != aiGetMaterialFloatArray(mat, AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE,0),\n * (float*)&trafo, &max) || sizeof(aiUVTransform) != max)\n * {\n * // error handling\n * }\n * @endcode\n *\n * @param pMat Pointer to the input material. May not be NULL\n * @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n * @param pOut Pointer to a buffer to receive the result.\n * @param pMax Specifies the size of the given buffer, in float's.\n * Receives the number of values (not bytes!) read.\n * @param type (see the code sample above)\n * @param index (see the code sample above)\n * @return Specifies whether the key has been found. If not, the output\n * arrays remains unmodified and pMax is set to 0.*/\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray(\n const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n float* pOut,\n unsigned int* pMax);\n\n\n#ifdef __cplusplus\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a single float property with a specific key from the material.\n*\n* Pass one of the AI_MATKEY_XXX constants for the last three parameters (the\n* example reads the #AI_MATKEY_SHININESS_STRENGTH property of the first diffuse texture)\n* @code\n* float specStrength = 1.f; // default value, remains unmodified if we fail.\n* aiGetMaterialFloat(mat, AI_MATKEY_SHININESS_STRENGTH,\n* (float*)&specStrength);\n* @endcode\n*\n* @param pMat Pointer to the input material. May not be NULL\n* @param pKey Key to search for. One of the AI_MATKEY_XXX constants.\n* @param pOut Receives the output float.\n* @param type (see the code sample above)\n* @param index (see the code sample above)\n* @return Specifies whether the key has been found. If not, the output\n* float remains unmodified.*/\n// ---------------------------------------------------------------------------\ninline aiReturn aiGetMaterialFloat(const aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n float* pOut)\n{\n return aiGetMaterialFloatArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0);\n}\n\n#else\n\n// Use our friend, the C preprocessor\n#define aiGetMaterialFloat (pMat, type, index, pKey, pOut) \\\n aiGetMaterialFloatArray(pMat, type, index, pKey, pOut, NULL)\n\n#endif //!__cplusplus\n\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve an array of integer values with a specific key\n * from a material\n *\n * See the sample for aiGetMaterialFloatArray for more information.*/\nASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n int* pOut,\n unsigned int* pMax);\n\n\n#ifdef __cplusplus\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve an integer property with a specific key from a material\n *\n * See the sample for aiGetMaterialFloat for more information.*/\n// ---------------------------------------------------------------------------\ninline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n int* pOut)\n{\n return aiGetMaterialIntegerArray(pMat,pKey,type,index,pOut,(unsigned int*)0x0);\n}\n\n#else\n\n// use our friend, the C preprocessor\n#define aiGetMaterialInteger (pMat, type, index, pKey, pOut) \\\n aiGetMaterialIntegerArray(pMat, type, index, pKey, pOut, NULL)\n\n#endif //!__cplusplus\n\n\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a color value from the material property table\n*\n* See the sample for aiGetMaterialFloat for more information*/\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n C_STRUCT aiColor4D* pOut);\n\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a aiUVTransform value from the material property table\n*\n* See the sample for aiGetMaterialFloat for more information*/\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialUVTransform(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n C_STRUCT aiUVTransform* pOut);\n\n\n// ---------------------------------------------------------------------------\n/** @brief Retrieve a string from the material property table\n*\n* See the sample for aiGetMaterialFloat for more information.*/\n// ---------------------------------------------------------------------------\nASSIMP_API C_ENUM aiReturn aiGetMaterialString(const C_STRUCT aiMaterial* pMat,\n const char* pKey,\n unsigned int type,\n unsigned int index,\n C_STRUCT aiString* pOut);\n\n// ---------------------------------------------------------------------------\n/** Get the number of textures for a particular texture type.\n * @param[in] pMat Pointer to the input material. May not be NULL\n * @param type Texture type to check for\n * @return Number of textures for this type.\n * @note A texture can be easily queried using #aiGetMaterialTexture() */\n// ---------------------------------------------------------------------------\nASSIMP_API unsigned int aiGetMaterialTextureCount(const C_STRUCT aiMaterial* pMat,\n C_ENUM aiTextureType type);\n\n// ---------------------------------------------------------------------------\n/** @brief Helper function to get all values pertaining to a particular\n * texture slot from a material structure.\n *\n * This function is provided just for convenience. You could also read the\n * texture by parsing all of its properties manually. This function bundles\n * all of them in a huge function monster.\n *\n * @param[in] mat Pointer to the input material. May not be NULL\n * @param[in] type Specifies the texture stack to read from (e.g. diffuse,\n * specular, height map ...).\n * @param[in] index Index of the texture. The function fails if the\n * requested index is not available for this texture type.\n * #aiGetMaterialTextureCount() can be used to determine the number of\n * textures in a particular texture stack.\n * @param[out] path Receives the output path\n * This parameter must be non-null.\n * @param mapping The texture mapping mode to be used.\n * Pass NULL if you're not interested in this information.\n * @param[out] uvindex For UV-mapped textures: receives the index of the UV\n * source channel. Unmodified otherwise.\n * Pass NULL if you're not interested in this information.\n * @param[out] blend Receives the blend factor for the texture\n * Pass NULL if you're not interested in this information.\n * @param[out] op Receives the texture blend operation to be perform between\n * this texture and the previous texture.\n * Pass NULL if you're not interested in this information.\n * @param[out] mapmode Receives the mapping modes to be used for the texture.\n * Pass NULL if you're not interested in this information. Otherwise,\n * pass a pointer to an array of two aiTextureMapMode's (one for each\n * axis, UV order).\n * @param[out] flags Receives the texture flags.\n * @return AI_SUCCESS on success, otherwise something else. Have fun.*/\n// ---------------------------------------------------------------------------\n#ifdef __cplusplus\nASSIMP_API aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,\n aiTextureType type,\n unsigned int index,\n aiString* path,\n aiTextureMapping* mapping = NULL,\n unsigned int* uvindex = NULL,\n float* blend = NULL,\n aiTextureOp* op = NULL,\n aiTextureMapMode* mapmode = NULL,\n unsigned int* flags = NULL);\n#else\nC_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,\n C_ENUM aiTextureType type,\n unsigned int index,\n C_STRUCT aiString* path,\n C_ENUM aiTextureMapping* mapping /*= NULL*/,\n unsigned int* uvindex /*= NULL*/,\n float* blend /*= NULL*/,\n C_ENUM aiTextureOp* op /*= NULL*/,\n C_ENUM aiTextureMapMode* mapmode /*= NULL*/,\n unsigned int* flags /*= NULL*/);\n#endif // !#ifdef __cplusplus\n\n#ifdef __cplusplus\n}\n\n#include \"material.inl\"\n\n#endif //!__cplusplus\n#endif //!!AI_MATERIAL_H_INC\n"}, {"path": "includes/assimp/matrix3x3.h", "language": "code", "loc": 147, "comment_density": 0.619, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file matrix3x3.h\n * @brief Definition of a 3x3 matrix, including operators when compiling in C++\n */\n#ifndef AI_MATRIX3x3_H_INC\n#define AI_MATRIX3x3_H_INC\n\n#include \"./Compiler/pushpack1.h\"\n\n#ifdef __cplusplus\n\ntemplate class aiMatrix4x4t;\ntemplate class aiVector2t;\n\n// ---------------------------------------------------------------------------\n/** @brief Represents a row-major 3x3 matrix\n *\n * There's much confusion about matrix layouts (column vs. row order).\n * This is *always* a row-major matrix. Not even with the\n * #aiProcess_ConvertToLeftHanded flag, which absolutely does not affect\n * matrix order - it just affects the handedness of the coordinate system\n * defined thereby.\n */\ntemplate \nclass aiMatrix3x3t\n{\npublic:\n\n aiMatrix3x3t () :\n a1(static_cast(1.0f)), a2(), a3(),\n b1(), b2(static_cast(1.0f)), b3(),\n c1(), c2(), c3(static_cast(1.0f)) {}\n\n aiMatrix3x3t ( TReal _a1, TReal _a2, TReal _a3,\n TReal _b1, TReal _b2, TReal _b3,\n TReal _c1, TReal _c2, TReal _c3) :\n a1(_a1), a2(_a2), a3(_a3),\n b1(_b1), b2(_b2), b3(_b3),\n c1(_c1), c2(_c2), c3(_c3)\n {}\n\npublic:\n\n // matrix multiplication.\n aiMatrix3x3t& operator *= (const aiMatrix3x3t& m);\n aiMatrix3x3t operator * (const aiMatrix3x3t& m) const;\n\n // array access operators\n TReal* operator[] (unsigned int p_iIndex);\n const TReal* operator[] (unsigned int p_iIndex) const;\n\n // comparison operators\n bool operator== (const aiMatrix4x4t& m) const;\n bool operator!= (const aiMatrix4x4t& m) const;\n\n bool Equal(const aiMatrix4x4t& m, TReal epsilon = 1e-6) const;\n\n template \n operator aiMatrix3x3t () const;\n\npublic:\n\n // -------------------------------------------------------------------\n /** @brief Construction from a 4x4 matrix. The remaining parts\n * of the matrix are ignored.\n */\n explicit aiMatrix3x3t( const aiMatrix4x4t& pMatrix);\n\n // -------------------------------------------------------------------\n /** @brief Transpose the matrix\n */\n aiMatrix3x3t& Transpose();\n\n // -------------------------------------------------------------------\n /** @brief Invert the matrix.\n * If the matrix is not invertible all elements are set to qnan.\n * Beware, use (f != f) to check whether a TReal f is qnan.\n */\n aiMatrix3x3t& Inverse();\n TReal Determinant() const;\n\npublic:\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around z\n * @param a Rotation angle, in radians\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix3x3t& RotationZ(TReal a, aiMatrix3x3t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around\n * an arbitrary axis.\n *\n * @param a Rotation angle, in radians\n * @param axis Axis to rotate around\n * @param out To be filled\n */\n static aiMatrix3x3t& Rotation( TReal a,\n const aiVector3t& axis, aiMatrix3x3t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a translation matrix\n * @param v Translation vector\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix3x3t& Translation( const aiVector2t& v, aiMatrix3x3t& out);\n\n // -------------------------------------------------------------------\n /** @brief A function for creating a rotation matrix that rotates a\n * vector called \"from\" into another vector called \"to\".\n * Input : from[3], to[3] which both must be *normalized* non-zero vectors\n * Output: mtx[3][3] -- a 3x3 matrix in column-major form\n * Authors: Tomas M�ller, John Hughes\n * \"Efficiently Building a Matrix to Rotate One Vector to Another\"\n * Journal of Graphics Tools, 4(4):1-4, 1999\n */\n static aiMatrix3x3t& FromToMatrix(const aiVector3t& from,\n const aiVector3t& to, aiMatrix3x3t& out);\n\npublic:\n TReal a1, a2, a3;\n TReal b1, b2, b3;\n TReal c1, c2, c3;\n} PACK_STRUCT;\n\ntypedef aiMatrix3x3t aiMatrix3x3;\n\n#else\n\nstruct aiMatrix3x3 {\n float a1, a2, a3;\n float b1, b2, b3;\n float c1, c2, c3;\n} PACK_STRUCT;\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#endif // AI_MATRIX3x3_H_INC\n"}, {"path": "includes/assimp/matrix4x4.h", "language": "code", "loc": 201, "comment_density": 0.677, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file matrix4x4.h\n * @brief 4x4 matrix structure, including operators when compiling in C++\n */\n#ifndef AI_MATRIX4X4_H_INC\n#define AI_MATRIX4X4_H_INC\n\n#include \"vector3.h\"\n#include \"./Compiler/pushpack1.h\"\n\n#ifdef __cplusplus\n\ntemplate class aiMatrix3x3t;\ntemplate class aiQuaterniont;\n\n// ---------------------------------------------------------------------------\n/** @brief Represents a row-major 4x4 matrix, use this for homogeneous\n * coordinates.\n *\n * There's much confusion about matrix layouts (column vs. row order).\n * This is *always* a row-major matrix. Not even with the\n * #aiProcess_ConvertToLeftHanded flag, which absolutely does not affect\n * matrix order - it just affects the handedness of the coordinate system\n * defined thereby.\n */\ntemplate\nclass aiMatrix4x4t\n{\npublic:\n\n /** set to identity */\n aiMatrix4x4t ();\n\n /** construction from single values */\n aiMatrix4x4t ( TReal _a1, TReal _a2, TReal _a3, TReal _a4,\n TReal _b1, TReal _b2, TReal _b3, TReal _b4,\n TReal _c1, TReal _c2, TReal _c3, TReal _c4,\n TReal _d1, TReal _d2, TReal _d3, TReal _d4);\n\n\n /** construction from 3x3 matrix, remaining elements are set to identity */\n explicit aiMatrix4x4t( const aiMatrix3x3t& m);\n\n /** construction from position, rotation and scaling components\n * @param scaling The scaling for the x,y,z axes\n * @param rotation The rotation as a hamilton quaternion\n * @param position The position for the x,y,z axes\n */\n aiMatrix4x4t(const aiVector3t& scaling, const aiQuaterniont& rotation,\n const aiVector3t& position);\n\npublic:\n\n // array access operators\n TReal* operator[] (unsigned int p_iIndex);\n const TReal* operator[] (unsigned int p_iIndex) const;\n\n // comparison operators\n bool operator== (const aiMatrix4x4t& m) const;\n bool operator!= (const aiMatrix4x4t& m) const;\n\n bool Equal(const aiMatrix4x4t& m, TReal epsilon = 1e-6) const;\n\n // matrix multiplication.\n aiMatrix4x4t& operator *= (const aiMatrix4x4t& m);\n aiMatrix4x4t operator * (const aiMatrix4x4t& m) const;\n\n template \n operator aiMatrix4x4t () const;\n\npublic:\n\n // -------------------------------------------------------------------\n /** @brief Transpose the matrix */\n aiMatrix4x4t& Transpose();\n\n // -------------------------------------------------------------------\n /** @brief Invert the matrix.\n * If the matrix is not invertible all elements are set to qnan.\n * Beware, use (f != f) to check whether a TReal f is qnan.\n */\n aiMatrix4x4t& Inverse();\n TReal Determinant() const;\n\n\n // -------------------------------------------------------------------\n /** @brief Returns true of the matrix is the identity matrix.\n * The check is performed against a not so small epsilon.\n */\n inline bool IsIdentity() const;\n\n // -------------------------------------------------------------------\n /** @brief Decompose a trafo matrix into its original components\n * @param scaling Receives the output scaling for the x,y,z axes\n * @param rotation Receives the output rotation as a hamilton\n * quaternion\n * @param position Receives the output position for the x,y,z axes\n */\n void Decompose (aiVector3t& scaling, aiQuaterniont& rotation,\n aiVector3t& position) const;\n\n // -------------------------------------------------------------------\n /** @brief Decompose a trafo matrix with no scaling into its\n * original components\n * @param rotation Receives the output rotation as a hamilton\n * quaternion\n * @param position Receives the output position for the x,y,z axes\n */\n void DecomposeNoScaling (aiQuaterniont& rotation,\n aiVector3t& position) const;\n\n\n // -------------------------------------------------------------------\n /** @brief Creates a trafo matrix from a set of euler angles\n * @param x Rotation angle for the x-axis, in radians\n * @param y Rotation angle for the y-axis, in radians\n * @param z Rotation angle for the z-axis, in radians\n */\n aiMatrix4x4t& FromEulerAnglesXYZ(TReal x, TReal y, TReal z);\n aiMatrix4x4t& FromEulerAnglesXYZ(const aiVector3t& blubb);\n\npublic:\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around the x axis\n * @param a Rotation angle, in radians\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& RotationX(TReal a, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around the y axis\n * @param a Rotation angle, in radians\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& RotationY(TReal a, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a rotation matrix for a rotation around the z axis\n * @param a Rotation angle, in radians\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& RotationZ(TReal a, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** Returns a rotation matrix for a rotation around an arbitrary axis.\n * @param a Rotation angle, in radians\n * @param axis Rotation axis, should be a normalized vector.\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& Rotation(TReal a, const aiVector3t& axis,\n aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a translation matrix\n * @param v Translation vector\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& Translation( const aiVector3t& v, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief Returns a scaling matrix\n * @param v Scaling vector\n * @param out Receives the output matrix\n * @return Reference to the output matrix\n */\n static aiMatrix4x4t& Scaling( const aiVector3t& v, aiMatrix4x4t& out);\n\n // -------------------------------------------------------------------\n /** @brief A function for creating a rotation matrix that rotates a\n * vector called \"from\" into another vector called \"to\".\n * Input : from[3], to[3] which both must be *normalized* non-zero vectors\n * Output: mtx[3][3] -- a 3x3 matrix in column-major form\n * Authors: Tomas Mueller, John Hughes\n * \"Efficiently Building a Matrix to Rotate One Vector to Another\"\n * Journal of Graphics Tools, 4(4):1-4, 1999\n */\n static aiMatrix4x4t& FromToMatrix(const aiVector3t& from,\n const aiVector3t& to, aiMatrix4x4t& out);\n\npublic:\n TReal a1, a2, a3, a4;\n TReal b1, b2, b3, b4;\n TReal c1, c2, c3, c4;\n TReal d1, d2, d3, d4;\n} PACK_STRUCT;\n\ntypedef aiMatrix4x4t aiMatrix4x4;\n\n#else\n\nstruct aiMatrix4x4 {\n float a1, a2, a3, a4;\n float b1, b2, b3, b4;\n float c1, c2, c3, c4;\n float d1, d2, d3, d4;\n} PACK_STRUCT;\n\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#endif // AI_MATRIX4X4_H_INC\n"}, {"path": "includes/assimp/mesh.h", "language": "code", "loc": 625, "comment_density": 0.549, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file mesh.h\n * @brief Declares the data structures in which the imported geometry is\n returned by ASSIMP: aiMesh, aiFace and aiBone data structures.\n */\n#ifndef INCLUDED_AI_MESH_H\n#define INCLUDED_AI_MESH_H\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n// Limits. These values are required to match the settings Assimp was\n// compiled against. Therefore, do not redefine them unless you build the\n// library from source using the same definitions.\n// ---------------------------------------------------------------------------\n\n/** @def AI_MAX_FACE_INDICES\n * Maximum number of indices per face (polygon). */\n\n#ifndef AI_MAX_FACE_INDICES\n# define AI_MAX_FACE_INDICES 0x7fff\n#endif\n\n/** @def AI_MAX_BONE_WEIGHTS\n * Maximum number of indices per face (polygon). */\n\n#ifndef AI_MAX_BONE_WEIGHTS\n# define AI_MAX_BONE_WEIGHTS 0x7fffffff\n#endif\n\n/** @def AI_MAX_VERTICES\n * Maximum number of vertices per mesh. */\n\n#ifndef AI_MAX_VERTICES\n# define AI_MAX_VERTICES 0x7fffffff\n#endif\n\n/** @def AI_MAX_FACES\n * Maximum number of faces per mesh. */\n\n#ifndef AI_MAX_FACES\n# define AI_MAX_FACES 0x7fffffff\n#endif\n\n/** @def AI_MAX_NUMBER_OF_COLOR_SETS\n * Supported number of vertex color sets per mesh. */\n\n#ifndef AI_MAX_NUMBER_OF_COLOR_SETS\n# define AI_MAX_NUMBER_OF_COLOR_SETS 0x8\n#endif // !! AI_MAX_NUMBER_OF_COLOR_SETS\n\n/** @def AI_MAX_NUMBER_OF_TEXTURECOORDS\n * Supported number of texture coord sets (UV(W) channels) per mesh */\n\n#ifndef AI_MAX_NUMBER_OF_TEXTURECOORDS\n# define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8\n#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS\n\n// ---------------------------------------------------------------------------\n/** @brief A single face in a mesh, referring to multiple vertices.\n *\n * If mNumIndices is 3, we call the face 'triangle', for mNumIndices > 3\n * it's called 'polygon' (hey, that's just a definition!).\n *
\n * aiMesh::mPrimitiveTypes can be queried to quickly examine which types of\n * primitive are actually present in a mesh. The #aiProcess_SortByPType flag\n * executes a special post-processing algorithm which splits meshes with\n * *different* primitive types mixed up (e.g. lines and triangles) in several\n * 'clean' submeshes. Furthermore there is a configuration option (\n * #AI_CONFIG_PP_SBP_REMOVE) to force #aiProcess_SortByPType to remove\n * specific kinds of primitives from the imported scene, completely and forever.\n * In many cases you'll probably want to set this setting to\n * @code\n * aiPrimitiveType_LINE|aiPrimitiveType_POINT\n * @endcode\n * Together with the #aiProcess_Triangulate flag you can then be sure that\n * #aiFace::mNumIndices is always 3.\n * @note Take a look at the @link data Data Structures page @endlink for\n * more information on the layout and winding order of a face.\n */\nstruct aiFace\n{\n //! Number of indices defining this face.\n //! The maximum value for this member is #AI_MAX_FACE_INDICES.\n unsigned int mNumIndices;\n\n //! Pointer to the indices array. Size of the array is given in numIndices.\n unsigned int* mIndices;\n\n#ifdef __cplusplus\n\n //! Default constructor\n aiFace()\n : mNumIndices( 0 )\n , mIndices( NULL )\n {\n }\n\n //! Default destructor. Delete the index array\n ~aiFace()\n {\n delete [] mIndices;\n }\n\n //! Copy constructor. Copy the index array\n aiFace( const aiFace& o)\n : mIndices( NULL )\n {\n *this = o;\n }\n\n //! Assignment operator. Copy the index array\n aiFace& operator = ( const aiFace& o)\n {\n if (&o == this)\n return *this;\n\n delete[] mIndices;\n mNumIndices = o.mNumIndices;\n if (mNumIndices) {\n mIndices = new unsigned int[mNumIndices];\n ::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));\n }\n else {\n mIndices = NULL;\n }\n return *this;\n }\n\n //! Comparison operator. Checks whether the index array\n //! of two faces is identical\n bool operator== (const aiFace& o) const\n {\n if (mIndices == o.mIndices)return true;\n else if (mIndices && mNumIndices == o.mNumIndices)\n {\n for (unsigned int i = 0;i < this->mNumIndices;++i)\n if (mIndices[i] != o.mIndices[i])return false;\n return true;\n }\n return false;\n }\n\n //! Inverse comparison operator. Checks whether the index\n //! array of two faces is NOT identical\n bool operator != (const aiFace& o) const\n {\n return !(*this == o);\n }\n#endif // __cplusplus\n}; // struct aiFace\n\n\n// ---------------------------------------------------------------------------\n/** @brief A single influence of a bone on a vertex.\n */\nstruct aiVertexWeight\n{\n //! Index of the vertex which is influenced by the bone.\n unsigned int mVertexId;\n\n //! The strength of the influence in the range (0...1).\n //! The influence from all bones at one vertex amounts to 1.\n float mWeight;\n\n#ifdef __cplusplus\n\n //! Default constructor\n aiVertexWeight() { }\n\n //! Initialisation from a given index and vertex weight factor\n //! \\param pID ID\n //! \\param pWeight Vertex weight factor\n aiVertexWeight( unsigned int pID, float pWeight)\n : mVertexId( pID), mWeight( pWeight)\n { /* nothing to do here */ }\n\n#endif // __cplusplus\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief A single bone of a mesh.\n *\n * A bone has a name by which it can be found in the frame hierarchy and by\n * which it can be addressed by animations. In addition it has a number of\n * influences on vertices.\n */\nstruct aiBone\n{\n //! The name of the bone.\n C_STRUCT aiString mName;\n\n //! The number of vertices affected by this bone\n //! The maximum value for this member is #AI_MAX_BONE_WEIGHTS.\n unsigned int mNumWeights;\n\n //! The vertices affected by this bone\n C_STRUCT aiVertexWeight* mWeights;\n\n //! Matrix that transforms from mesh space to bone space in bind pose\n C_STRUCT aiMatrix4x4 mOffsetMatrix;\n\n#ifdef __cplusplus\n\n //! Default constructor\n aiBone()\n : mName()\n , mNumWeights( 0 )\n , mWeights( NULL )\n {\n }\n\n //! Copy constructor\n aiBone(const aiBone& other)\n : mName( other.mName )\n , mNumWeights( other.mNumWeights )\n , mOffsetMatrix( other.mOffsetMatrix )\n {\n if (other.mWeights && other.mNumWeights)\n {\n mWeights = new aiVertexWeight[mNumWeights];\n ::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));\n }\n }\n\n //! Destructor - deletes the array of vertex weights\n ~aiBone()\n {\n delete [] mWeights;\n }\n#endif // __cplusplus\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief Enumerates the types of geometric primitives supported by Assimp.\n *\n * @see aiFace Face data structure\n * @see aiProcess_SortByPType Per-primitive sorting of meshes\n * @see aiProcess_Triangulate Automatic triangulation\n * @see AI_CONFIG_PP_SBP_REMOVE Removal of specific primitive types.\n */\nenum aiPrimitiveType\n{\n /** A point primitive.\n *\n * This is just a single vertex in the virtual world,\n * #aiFace contains just one index for such a primitive.\n */\n aiPrimitiveType_POINT = 0x1,\n\n /** A line primitive.\n *\n * This is a line defined through a start and an end position.\n * #aiFace contains exactly two indices for such a primitive.\n */\n aiPrimitiveType_LINE = 0x2,\n\n /** A triangular primitive.\n *\n * A triangle consists of three indices.\n */\n aiPrimitiveType_TRIANGLE = 0x4,\n\n /** A higher-level polygon with more than 3 edges.\n *\n * A triangle is a polygon, but polygon in this context means\n * \"all polygons that are not triangles\". The \"Triangulate\"-Step\n * is provided for your convenience, it splits all polygons in\n * triangles (which are much easier to handle).\n */\n aiPrimitiveType_POLYGON = 0x8,\n\n\n /** This value is not used. It is just here to force the\n * compiler to map this enum to a 32 Bit integer.\n */\n#ifndef SWIG\n _aiPrimitiveType_Force32Bit = INT_MAX\n#endif\n}; //! enum aiPrimitiveType\n\n// Get the #aiPrimitiveType flag for a specific number of face indices\n#define AI_PRIMITIVE_TYPE_FOR_N_INDICES(n) \\\n ((n) > 3 ? aiPrimitiveType_POLYGON : (aiPrimitiveType)(1u << ((n)-1)))\n\n\n\n// ---------------------------------------------------------------------------\n/** @brief NOT CURRENTLY IN USE. An AnimMesh is an attachment to an #aiMesh stores per-vertex\n * animations for a particular frame.\n *\n * You may think of an #aiAnimMesh as a `patch` for the host mesh, which\n * replaces only certain vertex data streams at a particular time.\n * Each mesh stores n attached meshes (#aiMesh::mAnimMeshes).\n * The actual relationship between the time line and anim meshes is\n * established by #aiMeshAnim, which references singular mesh attachments\n * by their ID and binds them to a time offset.\n*/\nstruct aiAnimMesh\n{\n /** Replacement for aiMesh::mVertices. If this array is non-NULL,\n * it *must* contain mNumVertices entries. The corresponding\n * array in the host mesh must be non-NULL as well - animation\n * meshes may neither add or nor remove vertex components (if\n * a replacement array is NULL and the corresponding source\n * array is not, the source data is taken instead)*/\n C_STRUCT aiVector3D* mVertices;\n\n /** Replacement for aiMesh::mNormals. */\n C_STRUCT aiVector3D* mNormals;\n\n /** Replacement for aiMesh::mTangents. */\n C_STRUCT aiVector3D* mTangents;\n\n /** Replacement for aiMesh::mBitangents. */\n C_STRUCT aiVector3D* mBitangents;\n\n /** Replacement for aiMesh::mColors */\n C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];\n\n /** Replacement for aiMesh::mTextureCoords */\n C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];\n\n /** The number of vertices in the aiAnimMesh, and thus the length of all\n * the member arrays.\n *\n * This has always the same value as the mNumVertices property in the\n * corresponding aiMesh. It is duplicated here merely to make the length\n * of the member arrays accessible even if the aiMesh is not known, e.g.\n * from language bindings.\n */\n unsigned int mNumVertices;\n\n#ifdef __cplusplus\n\n aiAnimMesh()\n : mVertices( NULL )\n , mNormals( NULL )\n , mTangents( NULL )\n , mBitangents( NULL )\n , mNumVertices( 0 )\n {\n // fixme consider moving this to the ctor initializer list as well\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++){\n mTextureCoords[a] = NULL;\n }\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {\n mColors[a] = NULL;\n }\n }\n\n ~aiAnimMesh()\n {\n delete [] mVertices;\n delete [] mNormals;\n delete [] mTangents;\n delete [] mBitangents;\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {\n delete [] mTextureCoords[a];\n }\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {\n delete [] mColors[a];\n }\n }\n\n /** Check whether the anim mesh overrides the vertex positions\n * of its host mesh*/\n bool HasPositions() const {\n return mVertices != NULL;\n }\n\n /** Check whether the anim mesh overrides the vertex normals\n * of its host mesh*/\n bool HasNormals() const {\n return mNormals != NULL;\n }\n\n /** Check whether the anim mesh overrides the vertex tangents\n * and bitangents of its host mesh. As for aiMesh,\n * tangents and bitangents always go together. */\n bool HasTangentsAndBitangents() const {\n return mTangents != NULL;\n }\n\n /** Check whether the anim mesh overrides a particular\n * set of vertex colors on his host mesh.\n * @param pIndex 0= AI_MAX_NUMBER_OF_COLOR_SETS ? false : mColors[pIndex] != NULL;\n }\n\n /** Check whether the anim mesh overrides a particular\n * set of texture coordinates on his host mesh.\n * @param pIndex 0= AI_MAX_NUMBER_OF_TEXTURECOORDS ? false : mTextureCoords[pIndex] != NULL;\n }\n\n#endif\n};\n\n\n// ---------------------------------------------------------------------------\n/** @brief A mesh represents a geometry or model with a single material.\n*\n* It usually consists of a number of vertices and a series of primitives/faces\n* referencing the vertices. In addition there might be a series of bones, each\n* of them addressing a number of vertices with a certain weight. Vertex data\n* is presented in channels with each channel containing a single per-vertex\n* information such as a set of texture coords or a normal vector.\n* If a data pointer is non-null, the corresponding data stream is present.\n* From C++-programs you can also use the comfort functions Has*() to\n* test for the presence of various data streams.\n*\n* A Mesh uses only a single material which is referenced by a material ID.\n* @note The mPositions member is usually not optional. However, vertex positions\n* *could* be missing if the #AI_SCENE_FLAGS_INCOMPLETE flag is set in\n* @code\n* aiScene::mFlags\n* @endcode\n*/\nstruct aiMesh\n{\n /** Bitwise combination of the members of the #aiPrimitiveType enum.\n * This specifies which types of primitives are present in the mesh.\n * The \"SortByPrimitiveType\"-Step can be used to make sure the\n * output meshes consist of one primitive type each.\n */\n unsigned int mPrimitiveTypes;\n\n /** The number of vertices in this mesh.\n * This is also the size of all of the per-vertex data arrays.\n * The maximum value for this member is #AI_MAX_VERTICES.\n */\n unsigned int mNumVertices;\n\n /** The number of primitives (triangles, polygons, lines) in this mesh.\n * This is also the size of the mFaces array.\n * The maximum value for this member is #AI_MAX_FACES.\n */\n unsigned int mNumFaces;\n\n /** Vertex positions.\n * This array is always present in a mesh. The array is\n * mNumVertices in size.\n */\n C_STRUCT aiVector3D* mVertices;\n\n /** Vertex normals.\n * The array contains normalized vectors, NULL if not present.\n * The array is mNumVertices in size. Normals are undefined for\n * point and line primitives. A mesh consisting of points and\n * lines only may not have normal vectors. Meshes with mixed\n * primitive types (i.e. lines and triangles) may have normals,\n * but the normals for vertices that are only referenced by\n * point or line primitives are undefined and set to QNaN (WARN:\n * qNaN compares to inequal to *everything*, even to qNaN itself.\n * Using code like this to check whether a field is qnan is:\n * @code\n * #define IS_QNAN(f) (f != f)\n * @endcode\n * still dangerous because even 1.f == 1.f could evaluate to false! (\n * remember the subtleties of IEEE754 arithmetics). Use stuff like\n * @c fpclassify instead.\n * @note Normal vectors computed by Assimp are always unit-length.\n * However, this needn't apply for normals that have been taken\n * directly from the model file.\n */\n C_STRUCT aiVector3D* mNormals;\n\n /** Vertex tangents.\n * The tangent of a vertex points in the direction of the positive\n * X texture axis. The array contains normalized vectors, NULL if\n * not present. The array is mNumVertices in size. A mesh consisting\n * of points and lines only may not have normal vectors. Meshes with\n * mixed primitive types (i.e. lines and triangles) may have\n * normals, but the normals for vertices that are only referenced by\n * point or line primitives are undefined and set to qNaN. See\n * the #mNormals member for a detailed discussion of qNaNs.\n * @note If the mesh contains tangents, it automatically also\n * contains bitangents.\n */\n C_STRUCT aiVector3D* mTangents;\n\n /** Vertex bitangents.\n * The bitangent of a vertex points in the direction of the positive\n * Y texture axis. The array contains normalized vectors, NULL if not\n * present. The array is mNumVertices in size.\n * @note If the mesh contains tangents, it automatically also contains\n * bitangents.\n */\n C_STRUCT aiVector3D* mBitangents;\n\n /** Vertex color sets.\n * A mesh may contain 0 to #AI_MAX_NUMBER_OF_COLOR_SETS vertex\n * colors per vertex. NULL if not present. Each array is\n * mNumVertices in size if present.\n */\n C_STRUCT aiColor4D* mColors[AI_MAX_NUMBER_OF_COLOR_SETS];\n\n /** Vertex texture coords, also known as UV channels.\n * A mesh may contain 0 to AI_MAX_NUMBER_OF_TEXTURECOORDS per\n * vertex. NULL if not present. The array is mNumVertices in size.\n */\n C_STRUCT aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];\n\n /** Specifies the number of components for a given UV channel.\n * Up to three channels are supported (UVW, for accessing volume\n * or cube maps). If the value is 2 for a given channel n, the\n * component p.z of mTextureCoords[n][p] is set to 0.0f.\n * If the value is 1 for a given channel, p.y is set to 0.0f, too.\n * @note 4D coords are not supported\n */\n unsigned int mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];\n\n /** The faces the mesh is constructed from.\n * Each face refers to a number of vertices by their indices.\n * This array is always present in a mesh, its size is given\n * in mNumFaces. If the #AI_SCENE_FLAGS_NON_VERBOSE_FORMAT\n * is NOT set each face references an unique set of vertices.\n */\n C_STRUCT aiFace* mFaces;\n\n /** The number of bones this mesh contains.\n * Can be 0, in which case the mBones array is NULL.\n */\n unsigned int mNumBones;\n\n /** The bones of this mesh.\n * A bone consists of a name by which it can be found in the\n * frame hierarchy and a set of vertex weights.\n */\n C_STRUCT aiBone** mBones;\n\n /** The material used by this mesh.\n * A mesh uses only a single material. If an imported model uses\n * multiple materials, the import splits up the mesh. Use this value\n * as index into the scene's material list.\n */\n unsigned int mMaterialIndex;\n\n /** Name of the mesh. Meshes can be named, but this is not a\n * requirement and leaving this field empty is totally fine.\n * There are mainly three uses for mesh names:\n * - some formats name nodes and meshes independently.\n * - importers tend to split meshes up to meet the\n * one-material-per-mesh requirement. Assigning\n * the same (dummy) name to each of the result meshes\n * aids the caller at recovering the original mesh\n * partitioning.\n * - Vertex animations refer to meshes by their names.\n **/\n C_STRUCT aiString mName;\n\n\n /** NOT CURRENTLY IN USE. The number of attachment meshes */\n unsigned int mNumAnimMeshes;\n\n /** NOT CURRENTLY IN USE. Attachment meshes for this mesh, for vertex-based animation.\n * Attachment meshes carry replacement data for some of the\n * mesh's vertex components (usually positions, normals). */\n C_STRUCT aiAnimMesh** mAnimMeshes;\n\n\n#ifdef __cplusplus\n\n //! Default constructor. Initializes all members to 0\n aiMesh()\n : mPrimitiveTypes( 0 )\n , mNumVertices( 0 )\n , mNumFaces( 0 )\n , mVertices( NULL )\n , mNormals( NULL )\n , mTangents( NULL )\n , mBitangents( NULL )\n , mFaces( NULL )\n , mNumBones( 0 )\n , mBones( NULL )\n , mMaterialIndex( 0 )\n , mNumAnimMeshes( 0 )\n , mAnimMeshes( NULL )\n {\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++)\n {\n mNumUVComponents[a] = 0;\n mTextureCoords[a] = NULL;\n }\n\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++)\n mColors[a] = NULL;\n }\n\n //! Deletes all storage allocated for the mesh\n ~aiMesh()\n {\n delete [] mVertices;\n delete [] mNormals;\n delete [] mTangents;\n delete [] mBitangents;\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) {\n delete [] mTextureCoords[a];\n }\n for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) {\n delete [] mColors[a];\n }\n\n // DO NOT REMOVE THIS ADDITIONAL CHECK\n if (mNumBones && mBones) {\n for( unsigned int a = 0; a < mNumBones; a++) {\n delete mBones[a];\n }\n delete [] mBones;\n }\n\n if (mNumAnimMeshes && mAnimMeshes) {\n for( unsigned int a = 0; a < mNumAnimMeshes; a++) {\n delete mAnimMeshes[a];\n }\n delete [] mAnimMeshes;\n }\n\n delete [] mFaces;\n }\n\n //! Check whether the mesh contains positions. Provided no special\n //! scene flags are set, this will always be true\n bool HasPositions() const\n { return mVertices != NULL && mNumVertices > 0; }\n\n //! Check whether the mesh contains faces. If no special scene flags\n //! are set this should always return true\n bool HasFaces() const\n { return mFaces != NULL && mNumFaces > 0; }\n\n //! Check whether the mesh contains normal vectors\n bool HasNormals() const\n { return mNormals != NULL && mNumVertices > 0; }\n\n //! Check whether the mesh contains tangent and bitangent vectors\n //! It is not possible that it contains tangents and no bitangents\n //! (or the other way round). The existence of one of them\n //! implies that the second is there, too.\n bool HasTangentsAndBitangents() const\n { return mTangents != NULL && mBitangents != NULL && mNumVertices > 0; }\n\n //! Check whether the mesh contains a vertex color set\n //! \\param pIndex Index of the vertex color set\n bool HasVertexColors( unsigned int pIndex) const\n {\n if( pIndex >= AI_MAX_NUMBER_OF_COLOR_SETS)\n return false;\n else\n return mColors[pIndex] != NULL && mNumVertices > 0;\n }\n\n //! Check whether the mesh contains a texture coordinate set\n //! \\param pIndex Index of the texture coordinates set\n bool HasTextureCoords( unsigned int pIndex) const\n {\n if( pIndex >= AI_MAX_NUMBER_OF_TEXTURECOORDS)\n return false;\n else\n return mTextureCoords[pIndex] != NULL && mNumVertices > 0;\n }\n\n //! Get the number of UV channels the mesh contains\n unsigned int GetNumUVChannels() const\n {\n unsigned int n = 0;\n while (n < AI_MAX_NUMBER_OF_TEXTURECOORDS && mTextureCoords[n])++n;\n return n;\n }\n\n //! Get the number of vertex color channels the mesh contains\n unsigned int GetNumColorChannels() const\n {\n unsigned int n = 0;\n while (n < AI_MAX_NUMBER_OF_COLOR_SETS && mColors[n])++n;\n return n;\n }\n\n //! Check whether the mesh contains bones\n inline bool HasBones() const\n { return mBones != NULL && mNumBones > 0; }\n\n#endif // __cplusplus\n};\n\n\n#ifdef __cplusplus\n}\n#endif //! extern \"C\"\n#endif // __AI_MESH_H_INC\n\n"}, {"path": "includes/assimp/metadata.h", "language": "code", "loc": 199, "comment_density": 0.407, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file metadata.h\n * @brief Defines the data structures for holding node meta information.\n */\n#ifndef __AI_METADATA_H_INC__\n#define __AI_METADATA_H_INC__\n\n#include \n\n#if defined(_MSC_VER) && (_MSC_VER <= 1500)\n#include \"Compiler/pstdint.h\"\n#else\n#include \n#include \n#endif\n\n\n\n// -------------------------------------------------------------------------------\n/**\n * Enum used to distinguish data types\n */\n // -------------------------------------------------------------------------------\ntypedef enum aiMetadataType\n{\n AI_BOOL = 0,\n AI_INT = 1,\n AI_UINT64 = 2,\n AI_FLOAT = 3,\n AI_AISTRING = 4,\n AI_AIVECTOR3D = 5,\n\n#ifndef SWIG\n FORCE_32BIT = INT_MAX\n#endif\n} aiMetadataType;\n\n\n\n// -------------------------------------------------------------------------------\n/**\n * Metadata entry\n *\n * The type field uniquely identifies the underlying type of the data field\n */\n // -------------------------------------------------------------------------------\nstruct aiMetadataEntry\n{\n aiMetadataType mType;\n void* mData;\n};\n\n\n\n#ifdef __cplusplus\n\n#include \n\n\n\n// -------------------------------------------------------------------------------\n/**\n * Helper functions to get the aiType enum entry for a type\n */\n // -------------------------------------------------------------------------------\ninline aiMetadataType GetAiType( bool ) { return AI_BOOL; }\ninline aiMetadataType GetAiType( int ) { return AI_INT; }\ninline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; }\ninline aiMetadataType GetAiType( float ) { return AI_FLOAT; }\ninline aiMetadataType GetAiType( aiString ) { return AI_AISTRING; }\ninline aiMetadataType GetAiType( aiVector3D ) { return AI_AIVECTOR3D; }\n\n\n\n#endif\n\n\n\n// -------------------------------------------------------------------------------\n/**\n * Container for holding metadata.\n *\n * Metadata is a key-value store using string keys and values.\n */\n // -------------------------------------------------------------------------------\nstruct aiMetadata\n{\n /** Length of the mKeys and mValues arrays, respectively */\n unsigned int mNumProperties;\n\n /** Arrays of keys, may not be NULL. Entries in this array may not be NULL as well. */\n C_STRUCT aiString* mKeys;\n\n /** Arrays of values, may not be NULL. Entries in this array may be NULL if the\n * corresponding property key has no assigned value. */\n C_STRUCT aiMetadataEntry* mValues;\n\n#ifdef __cplusplus\n\n /** Constructor */\n aiMetadata()\n // set all members to zero by default\n : mNumProperties(0)\n , mKeys(NULL)\n , mValues(NULL)\n {}\n\n\n /** Destructor */\n ~aiMetadata()\n {\n delete[] mKeys;\n mKeys = NULL;\n if (mValues)\n {\n // Delete each metadata entry\n for (unsigned i=0; i(data);\n break;\n case AI_INT:\n delete static_cast(data);\n break;\n case AI_UINT64:\n delete static_cast(data);\n break;\n case AI_FLOAT:\n delete static_cast(data);\n break;\n case AI_AISTRING:\n delete static_cast(data);\n break;\n case AI_AIVECTOR3D:\n delete static_cast(data);\n break;\n#ifndef SWIG\n case FORCE_32BIT:\n#endif\n default:\n assert(false);\n break;\n }\n }\n\n // Delete the metadata array\n delete [] mValues;\n mValues = NULL;\n }\n }\n\n\n\n template\n inline void Set( unsigned index, const std::string& key, const T& value )\n {\n // In range assertion\n assert(index < mNumProperties);\n\n // Set metadata key\n mKeys[index] = key;\n\n // Set metadata type\n mValues[index].mType = GetAiType(value);\n // Copy the given value to the dynamic storage\n mValues[index].mData = new T(value);\n }\n\n template\n inline bool Get( unsigned index, T& value )\n {\n // In range assertion\n assert(index < mNumProperties);\n\n // Return false if the output data type does\n // not match the found value's data type\n if ( GetAiType( value ) != mValues[ index ].mType ) {\n return false;\n }\n\n // Otherwise, output the found value and\n // return true\n value = *static_cast(mValues[index].mData);\n return true;\n }\n\n template\n inline bool Get( const aiString& key, T& value )\n {\n // Search for the given key\n for (unsigned i=0; i\n inline bool Get( const std::string& key, T& value ) {\n return Get(aiString(key), value);\n }\n\n#endif // __cplusplus\n\n};\n\n#endif // __AI_METADATA_H_INC__\n\n\n"}, {"path": "includes/assimp/postprocess.h", "language": "code", "loc": 585, "comment_density": 0.88, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file postprocess.h\n * @brief Definitions for import post processing steps\n */\n#ifndef AI_POSTPROCESS_H_INC\n#define AI_POSTPROCESS_H_INC\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// -----------------------------------------------------------------------------------\n/** @enum aiPostProcessSteps\n * @brief Defines the flags for all possible post processing steps.\n *\n * @note Some steps are influenced by properties set on the Assimp::Importer itself\n *\n * @see Assimp::Importer::ReadFile()\n * @see Assimp::Importer::SetPropertyInteger()\n * @see aiImportFile\n * @see aiImportFileEx\n */\n// -----------------------------------------------------------------------------------\nenum aiPostProcessSteps\n{\n\n // -------------------------------------------------------------------------\n /**
Calculates the tangents and bitangents for the imported meshes.\n *\n * Does nothing if a mesh does not have normals. You might want this post\n * processing step to be executed if you plan to use tangent space calculations\n * such as normal mapping applied to the meshes. There's an importer property,\n * #AI_CONFIG_PP_CT_MAX_SMOOTHING_ANGLE, which allows you to specify\n * a maximum smoothing angle for the algorithm. However, usually you'll\n * want to leave it at the default value.\n */\n aiProcess_CalcTangentSpace = 0x1,\n\n // -------------------------------------------------------------------------\n /**
Identifies and joins identical vertex data sets within all\n * imported meshes.\n *\n * After this step is run, each mesh contains unique vertices,\n * so a vertex may be used by multiple faces. You usually want\n * to use this post processing step. If your application deals with\n * indexed geometry, this step is compulsory or you'll just waste rendering\n * time. If this flag is not specified, no vertices are referenced by\n * more than one face and no index buffer is required for rendering.\n */\n aiProcess_JoinIdenticalVertices = 0x2,\n\n // -------------------------------------------------------------------------\n /**
Converts all the imported data to a left-handed coordinate space.\n *\n * By default the data is returned in a right-handed coordinate space (which\n * OpenGL prefers). In this space, +X points to the right,\n * +Z points towards the viewer, and +Y points upwards. In the DirectX\n * coordinate space +X points to the right, +Y points upwards, and +Z points\n * away from the viewer.\n *\n * You'll probably want to consider this flag if you use Direct3D for\n * rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this\n * setting and bundles all conversions typically required for D3D-based\n * applications.\n */\n aiProcess_MakeLeftHanded = 0x4,\n\n // -------------------------------------------------------------------------\n /**
Triangulates all faces of all meshes.\n *\n * By default the imported mesh data might contain faces with more than 3\n * indices. For rendering you'll usually want all faces to be triangles.\n * This post processing step splits up faces with more than 3 indices into\n * triangles. Line and point primitives are *not* modified! If you want\n * 'triangles only' with no other kinds of primitives, try the following\n * solution:\n *
    \n *
  • Specify both #aiProcess_Triangulate and #aiProcess_SortByPType
  • \n *
  • Ignore all point and line meshes when you process assimp's output
  • \n *
\n */\n aiProcess_Triangulate = 0x8,\n\n // -------------------------------------------------------------------------\n /**
Removes some parts of the data structure (animations, materials,\n * light sources, cameras, textures, vertex components).\n *\n * The components to be removed are specified in a separate\n * importer property, #AI_CONFIG_PP_RVC_FLAGS. This is quite useful\n * if you don't need all parts of the output structure. Vertex colors\n * are rarely used today for example... Calling this step to remove unneeded\n * data from the pipeline as early as possible results in increased\n * performance and a more optimized output data structure.\n * This step is also useful if you want to force Assimp to recompute\n * normals or tangents. The corresponding steps don't recompute them if\n * they're already there (loaded from the source asset). By using this\n * step you can make sure they are NOT there.\n *\n * This flag is a poor one, mainly because its purpose is usually\n * misunderstood. Consider the following case: a 3D model has been exported\n * from a CAD app, and it has per-face vertex colors. Vertex positions can't be\n * shared, thus the #aiProcess_JoinIdenticalVertices step fails to\n * optimize the data because of these nasty little vertex colors.\n * Most apps don't even process them, so it's all for nothing. By using\n * this step, unneeded components are excluded as early as possible\n * thus opening more room for internal optimizations.\n */\n aiProcess_RemoveComponent = 0x10,\n\n // -------------------------------------------------------------------------\n /**
Generates normals for all faces of all meshes.\n *\n * This is ignored if normals are already there at the time this flag\n * is evaluated. Model importers try to load them from the source file, so\n * they're usually already there. Face normals are shared between all points\n * of a single face, so a single point can have multiple normals, which\n * forces the library to duplicate vertices in some cases.\n * #aiProcess_JoinIdenticalVertices is *senseless* then.\n *\n * This flag may not be specified together with #aiProcess_GenSmoothNormals.\n */\n aiProcess_GenNormals = 0x20,\n\n // -------------------------------------------------------------------------\n /**
Generates smooth normals for all vertices in the mesh.\n *\n * This is ignored if normals are already there at the time this flag\n * is evaluated. Model importers try to load them from the source file, so\n * they're usually already there.\n *\n * This flag may not be specified together with\n * #aiProcess_GenNormals. There's a importer property,\n * #AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE which allows you to specify\n * an angle maximum for the normal smoothing algorithm. Normals exceeding\n * this limit are not smoothed, resulting in a 'hard' seam between two faces.\n * Using a decent angle here (e.g. 80 degrees) results in very good visual\n * appearance.\n */\n aiProcess_GenSmoothNormals = 0x40,\n\n // -------------------------------------------------------------------------\n /**
Splits large meshes into smaller sub-meshes.\n *\n * This is quite useful for real-time rendering, where the number of triangles\n * which can be maximally processed in a single draw-call is limited\n * by the video driver/hardware. The maximum vertex buffer is usually limited\n * too. Both requirements can be met with this step: you may specify both a\n * triangle and vertex limit for a single mesh.\n *\n * The split limits can (and should!) be set through the\n * #AI_CONFIG_PP_SLM_VERTEX_LIMIT and #AI_CONFIG_PP_SLM_TRIANGLE_LIMIT\n * importer properties. The default values are #AI_SLM_DEFAULT_MAX_VERTICES and\n * #AI_SLM_DEFAULT_MAX_TRIANGLES.\n *\n * Note that splitting is generally a time-consuming task, but only if there's\n * something to split. The use of this step is recommended for most users.\n */\n aiProcess_SplitLargeMeshes = 0x80,\n\n // -------------------------------------------------------------------------\n /**
Removes the node graph and pre-transforms all vertices with\n * the local transformation matrices of their nodes.\n *\n * The output scene still contains nodes, however there is only a\n * root node with children, each one referencing only one mesh,\n * and each mesh referencing one material. For rendering, you can\n * simply render all meshes in order - you don't need to pay\n * attention to local transformations and the node hierarchy.\n * Animations are removed during this step.\n * This step is intended for applications without a scenegraph.\n * The step CAN cause some problems: if e.g. a mesh of the asset\n * contains normals and another, using the same material index, does not,\n * they will be brought together, but the first meshes's part of\n * the normal list is zeroed. However, these artifacts are rare.\n * @note The #AI_CONFIG_PP_PTV_NORMALIZE configuration property\n * can be set to normalize the scene's spatial dimension to the -1...1\n * range.\n */\n aiProcess_PreTransformVertices = 0x100,\n\n // -------------------------------------------------------------------------\n /**
Limits the number of bones simultaneously affecting a single vertex\n * to a maximum value.\n *\n * If any vertex is affected by more than the maximum number of bones, the least\n * important vertex weights are removed and the remaining vertex weights are\n * renormalized so that the weights still sum up to 1.\n * The default bone weight limit is 4 (defined as #AI_LMW_MAX_WEIGHTS in\n * config.h), but you can use the #AI_CONFIG_PP_LBW_MAX_WEIGHTS importer\n * property to supply your own limit to the post processing step.\n *\n * If you intend to perform the skinning in hardware, this post processing\n * step might be of interest to you.\n */\n aiProcess_LimitBoneWeights = 0x200,\n\n // -------------------------------------------------------------------------\n /**
Validates the imported scene data structure.\n * This makes sure that all indices are valid, all animations and\n * bones are linked correctly, all material references are correct .. etc.\n *\n * It is recommended that you capture Assimp's log output if you use this flag,\n * so you can easily find out what's wrong if a file fails the\n * validation. The validator is quite strict and will find *all*\n * inconsistencies in the data structure... It is recommended that plugin\n * developers use it to debug their loaders. There are two types of\n * validation failures:\n *
    \n *
  • Error: There's something wrong with the imported data. Further\n * postprocessing is not possible and the data is not usable at all.\n * The import fails. #Importer::GetErrorString() or #aiGetErrorString()\n * carry the error message around.
  • \n *
  • Warning: There are some minor issues (e.g. 1000000 animation\n * keyframes with the same time), but further postprocessing and use\n * of the data structure is still safe. Warning details are written\n * to the log file, #AI_SCENE_FLAGS_VALIDATION_WARNING is set\n * in #aiScene::mFlags
  • \n *
\n *\n * This post-processing step is not time-consuming. Its use is not\n * compulsory, but recommended.\n */\n aiProcess_ValidateDataStructure = 0x400,\n\n // -------------------------------------------------------------------------\n /**
Reorders triangles for better vertex cache locality.\n *\n * The step tries to improve the ACMR (average post-transform vertex cache\n * miss ratio) for all meshes. The implementation runs in O(n) and is\n * roughly based on the 'tipsify' algorithm (see this\n * paper).\n *\n * If you intend to render huge models in hardware, this step might\n * be of interest to you. The #AI_CONFIG_PP_ICL_PTCACHE_SIZE\n * importer property can be used to fine-tune the cache optimization.\n */\n aiProcess_ImproveCacheLocality = 0x800,\n\n // -------------------------------------------------------------------------\n /**
Searches for redundant/unreferenced materials and removes them.\n *\n * This is especially useful in combination with the\n * #aiProcess_PreTransformVertices and #aiProcess_OptimizeMeshes flags.\n * Both join small meshes with equal characteristics, but they can't do\n * their work if two meshes have different materials. Because several\n * material settings are lost during Assimp's import filters,\n * (and because many exporters don't check for redundant materials), huge\n * models often have materials which are defined several times with\n * exactly the same settings.\n *\n * Several material settings not contributing to the final appearance of\n * a surface are ignored in all comparisons (e.g. the material name).\n * So, if you're passing additional information through the\n * content pipeline (probably using *magic* material names), don't\n * specify this flag. Alternatively take a look at the\n * #AI_CONFIG_PP_RRM_EXCLUDE_LIST importer property.\n */\n aiProcess_RemoveRedundantMaterials = 0x1000,\n\n // -------------------------------------------------------------------------\n /**
This step tries to determine which meshes have normal vectors\n * that are facing inwards and inverts them.\n *\n * The algorithm is simple but effective:\n * the bounding box of all vertices + their normals is compared against\n * the volume of the bounding box of all vertices without their normals.\n * This works well for most objects, problems might occur with planar\n * surfaces. However, the step tries to filter such cases.\n * The step inverts all in-facing normals. Generally it is recommended\n * to enable this step, although the result is not always correct.\n */\n aiProcess_FixInfacingNormals = 0x2000,\n\n // -------------------------------------------------------------------------\n /**
This step splits meshes with more than one primitive type in\n * homogeneous sub-meshes.\n *\n * The step is executed after the triangulation step. After the step\n * returns, just one bit is set in aiMesh::mPrimitiveTypes. This is\n * especially useful for real-time rendering where point and line\n * primitives are often ignored or rendered separately.\n * You can use the #AI_CONFIG_PP_SBP_REMOVE importer property to\n * specify which primitive types you need. This can be used to easily\n * exclude lines and points, which are rarely used, from the import.\n */\n aiProcess_SortByPType = 0x8000,\n\n // -------------------------------------------------------------------------\n /**
This step searches all meshes for degenerate primitives and\n * converts them to proper lines or points.\n *\n * A face is 'degenerate' if one or more of its points are identical.\n * To have the degenerate stuff not only detected and collapsed but\n * removed, try one of the following procedures:\n *
1. (if you support lines and points for rendering but don't\n * want the degenerates)
\n *
    \n *
  • Specify the #aiProcess_FindDegenerates flag.\n *
  • \n *
  • Set the #AI_CONFIG_PP_FD_REMOVE importer property to\n * 1. This will cause the step to remove degenerate triangles from the\n * import as soon as they're detected. They won't pass any further\n * pipeline steps.\n *
  • \n *
\n *
2.(if you don't support lines and points at all)
\n *
    \n *
  • Specify the #aiProcess_FindDegenerates flag.\n *
  • \n *
  • Specify the #aiProcess_SortByPType flag. This moves line and\n * point primitives to separate meshes.\n *
  • \n *
  • Set the #AI_CONFIG_PP_SBP_REMOVE importer property to\n * @code aiPrimitiveType_POINTS | aiPrimitiveType_LINES\n * @endcode to cause SortByPType to reject point\n * and line meshes from the scene.\n *
  • \n *
\n * @note Degenerate polygons are not necessarily evil and that's why\n * they're not removed by default. There are several file formats which\n * don't support lines or points, and some exporters bypass the\n * format specification and write them as degenerate triangles instead.\n */\n aiProcess_FindDegenerates = 0x10000,\n\n // -------------------------------------------------------------------------\n /**
This step searches all meshes for invalid data, such as zeroed\n * normal vectors or invalid UV coords and removes/fixes them. This is\n * intended to get rid of some common exporter errors.\n *\n * This is especially useful for normals. If they are invalid, and\n * the step recognizes this, they will be removed and can later\n * be recomputed, i.e. by the #aiProcess_GenSmoothNormals flag.
\n * The step will also remove meshes that are infinitely small and reduce\n * animation tracks consisting of hundreds if redundant keys to a single\n * key. The AI_CONFIG_PP_FID_ANIM_ACCURACY config property decides\n * the accuracy of the check for duplicate animation tracks.\n */\n aiProcess_FindInvalidData = 0x20000,\n\n // -------------------------------------------------------------------------\n /**
This step converts non-UV mappings (such as spherical or\n * cylindrical mapping) to proper texture coordinate channels.\n *\n * Most applications will support UV mapping only, so you will\n * probably want to specify this step in every case. Note that Assimp is not\n * always able to match the original mapping implementation of the\n * 3D app which produced a model perfectly. It's always better to let the\n * modelling app compute the UV channels - 3ds max, Maya, Blender,\n * LightWave, and Modo do this for example.\n *\n * @note If this step is not requested, you'll need to process the\n * #AI_MATKEY_MAPPING material property in order to display all assets\n * properly.\n */\n aiProcess_GenUVCoords = 0x40000,\n\n // -------------------------------------------------------------------------\n /**
This step applies per-texture UV transformations and bakes\n * them into stand-alone vtexture coordinate channels.\n *\n * UV transformations are specified per-texture - see the\n * #AI_MATKEY_UVTRANSFORM material key for more information.\n * This step processes all textures with\n * transformed input UV coordinates and generates a new (pre-transformed) UV channel\n * which replaces the old channel. Most applications won't support UV\n * transformations, so you will probably want to specify this step.\n *\n * @note UV transformations are usually implemented in real-time apps by\n * transforming texture coordinates at vertex shader stage with a 3x3\n * (homogenous) transformation matrix.\n */\n aiProcess_TransformUVCoords = 0x80000,\n\n // -------------------------------------------------------------------------\n /**
This step searches for duplicate meshes and replaces them\n * with references to the first mesh.\n *\n * This step takes a while, so don't use it if speed is a concern.\n * Its main purpose is to workaround the fact that many export\n * file formats don't support instanced meshes, so exporters need to\n * duplicate meshes. This step removes the duplicates again. Please\n * note that Assimp does not currently support per-node material\n * assignment to meshes, which means that identical meshes with\n * different materials are currently *not* joined, although this is\n * planned for future versions.\n */\n aiProcess_FindInstances = 0x100000,\n\n // -------------------------------------------------------------------------\n /**
A postprocessing step to reduce the number of meshes.\n *\n * This will, in fact, reduce the number of draw calls.\n *\n * This is a very effective optimization and is recommended to be used\n * together with #aiProcess_OptimizeGraph, if possible. The flag is fully\n * compatible with both #aiProcess_SplitLargeMeshes and #aiProcess_SortByPType.\n */\n aiProcess_OptimizeMeshes = 0x200000,\n\n\n // -------------------------------------------------------------------------\n /**
A postprocessing step to optimize the scene hierarchy.\n *\n * Nodes without animations, bones, lights or cameras assigned are\n * collapsed and joined.\n *\n * Node names can be lost during this step. If you use special 'tag nodes'\n * to pass additional information through your content pipeline, use the\n * #AI_CONFIG_PP_OG_EXCLUDE_LIST importer property to specify a\n * list of node names you want to be kept. Nodes matching one of the names\n * in this list won't be touched or modified.\n *\n * Use this flag with caution. Most simple files will be collapsed to a\n * single node, so complex hierarchies are usually completely lost. This is not\n * useful for editor environments, but probably a very effective\n * optimization if you just want to get the model data, convert it to your\n * own format, and render it as fast as possible.\n *\n * This flag is designed to be used with #aiProcess_OptimizeMeshes for best\n * results.\n *\n * @note 'Crappy' scenes with thousands of extremely small meshes packed\n * in deeply nested nodes exist for almost all file formats.\n * #aiProcess_OptimizeMeshes in combination with #aiProcess_OptimizeGraph\n * usually fixes them all and makes them renderable.\n */\n aiProcess_OptimizeGraph = 0x400000,\n\n // -------------------------------------------------------------------------\n /**
This step flips all UV coordinates along the y-axis and adjusts\n * material settings and bitangents accordingly.\n *\n * Output UV coordinate system:\n * @code\n * 0y|0y ---------- 1x|0y\n * | |\n * | |\n * | |\n * 0x|1y ---------- 1x|1y\n * @endcode\n *\n * You'll probably want to consider this flag if you use Direct3D for\n * rendering. The #aiProcess_ConvertToLeftHanded flag supersedes this\n * setting and bundles all conversions typically required for D3D-based\n * applications.\n */\n aiProcess_FlipUVs = 0x800000,\n\n // -------------------------------------------------------------------------\n /**
This step adjusts the output face winding order to be CW.\n *\n * The default face winding order is counter clockwise (CCW).\n *\n * Output face order:\n * @code\n * x2\n *\n * x0\n * x1\n * @endcode\n */\n aiProcess_FlipWindingOrder = 0x1000000,\n\n // -------------------------------------------------------------------------\n /**
This step splits meshes with many bones into sub-meshes so that each\n * su-bmesh has fewer or as many bones as a given limit.\n */\n aiProcess_SplitByBoneCount = 0x2000000,\n\n // -------------------------------------------------------------------------\n /**
This step removes bones losslessly or according to some threshold.\n *\n * In some cases (i.e. formats that require it) exporters are forced to\n * assign dummy bone weights to otherwise static meshes assigned to\n * animated meshes. Full, weight-based skinning is expensive while\n * animating nodes is extremely cheap, so this step is offered to clean up\n * the data in that regard.\n *\n * Use #AI_CONFIG_PP_DB_THRESHOLD to control this.\n * Use #AI_CONFIG_PP_DB_ALL_OR_NONE if you want bones removed if and\n * only if all bones within the scene qualify for removal.\n */\n aiProcess_Debone = 0x4000000\n\n // aiProcess_GenEntityMeshes = 0x100000,\n // aiProcess_OptimizeAnimations = 0x200000\n // aiProcess_FixTexturePaths = 0x200000\n};\n\n\n// ---------------------------------------------------------------------------------------\n/** @def aiProcess_ConvertToLeftHanded\n * @brief Shortcut flag for Direct3D-based applications.\n *\n * Supersedes the #aiProcess_MakeLeftHanded and #aiProcess_FlipUVs and\n * #aiProcess_FlipWindingOrder flags.\n * The output data matches Direct3D's conventions: left-handed geometry, upper-left\n * origin for UV coordinates and finally clockwise face order, suitable for CCW culling.\n *\n * @deprecated\n */\n#define aiProcess_ConvertToLeftHanded ( \\\n aiProcess_MakeLeftHanded | \\\n aiProcess_FlipUVs | \\\n aiProcess_FlipWindingOrder | \\\n 0 )\n\n\n// ---------------------------------------------------------------------------------------\n/** @def aiProcessPreset_TargetRealtime_Fast\n * @brief Default postprocess configuration optimizing the data for real-time rendering.\n *\n * Applications would want to use this preset to load models on end-user PCs,\n * maybe for direct use in game.\n *\n * If you're using DirectX, don't forget to combine this value with\n * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations\n * in your application apply the #aiProcess_TransformUVCoords step, too.\n * @note Please take the time to read the docs for the steps enabled by this preset.\n * Some of them offer further configurable properties, while some of them might not be of\n * use for you so it might be better to not specify them.\n */\n#define aiProcessPreset_TargetRealtime_Fast ( \\\n aiProcess_CalcTangentSpace | \\\n aiProcess_GenNormals | \\\n aiProcess_JoinIdenticalVertices | \\\n aiProcess_Triangulate | \\\n aiProcess_GenUVCoords | \\\n aiProcess_SortByPType | \\\n 0 )\n\n // ---------------------------------------------------------------------------------------\n /** @def aiProcessPreset_TargetRealtime_Quality\n * @brief Default postprocess configuration optimizing the data for real-time rendering.\n *\n * Unlike #aiProcessPreset_TargetRealtime_Fast, this configuration\n * performs some extra optimizations to improve rendering speed and\n * to minimize memory usage. It could be a good choice for a level editor\n * environment where import speed is not so important.\n *\n * If you're using DirectX, don't forget to combine this value with\n * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations\n * in your application apply the #aiProcess_TransformUVCoords step, too.\n * @note Please take the time to read the docs for the steps enabled by this preset.\n * Some of them offer further configurable properties, while some of them might not be\n * of use for you so it might be better to not specify them.\n */\n#define aiProcessPreset_TargetRealtime_Quality ( \\\n aiProcess_CalcTangentSpace | \\\n aiProcess_GenSmoothNormals | \\\n aiProcess_JoinIdenticalVertices | \\\n aiProcess_ImproveCacheLocality | \\\n aiProcess_LimitBoneWeights | \\\n aiProcess_RemoveRedundantMaterials | \\\n aiProcess_SplitLargeMeshes | \\\n aiProcess_Triangulate | \\\n aiProcess_GenUVCoords | \\\n aiProcess_SortByPType | \\\n aiProcess_FindDegenerates | \\\n aiProcess_FindInvalidData | \\\n 0 )\n\n // ---------------------------------------------------------------------------------------\n /** @def aiProcessPreset_TargetRealtime_MaxQuality\n * @brief Default postprocess configuration optimizing the data for real-time rendering.\n *\n * This preset enables almost every optimization step to achieve perfectly\n * optimized data. It's your choice for level editor environments where import speed\n * is not important.\n *\n * If you're using DirectX, don't forget to combine this value with\n * the #aiProcess_ConvertToLeftHanded step. If you don't support UV transformations\n * in your application, apply the #aiProcess_TransformUVCoords step, too.\n * @note Please take the time to read the docs for the steps enabled by this preset.\n * Some of them offer further configurable properties, while some of them might not be\n * of use for you so it might be better to not specify them.\n */\n#define aiProcessPreset_TargetRealtime_MaxQuality ( \\\n aiProcessPreset_TargetRealtime_Quality | \\\n aiProcess_FindInstances | \\\n aiProcess_ValidateDataStructure | \\\n aiProcess_OptimizeMeshes | \\\n 0 )\n\n\n#ifdef __cplusplus\n} // end of extern \"C\"\n#endif\n\n#endif // AI_POSTPROCESS_H_INC\n"}, {"path": "includes/assimp/quaternion.h", "language": "code", "loc": 92, "comment_density": 0.587, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file quaternion.h\n * @brief Quaternion structure, including operators when compiling in C++\n */\n#ifndef AI_QUATERNION_H_INC\n#define AI_QUATERNION_H_INC\n\n#ifdef __cplusplus\n\ntemplate class aiVector3t;\ntemplate class aiMatrix3x3t;\n\n// ---------------------------------------------------------------------------\n/** Represents a quaternion in a 4D vector. */\ntemplate \nclass aiQuaterniont\n{\npublic:\n aiQuaterniont() : w(1.0), x(), y(), z() {}\n aiQuaterniont(TReal pw, TReal px, TReal py, TReal pz)\n : w(pw), x(px), y(py), z(pz) {}\n\n /** Construct from rotation matrix. Result is undefined if the matrix is not orthonormal. */\n explicit aiQuaterniont( const aiMatrix3x3t& pRotMatrix);\n\n /** Construct from euler angles */\n aiQuaterniont( TReal rotx, TReal roty, TReal rotz);\n\n /** Construct from an axis-angle pair */\n aiQuaterniont( aiVector3t axis, TReal angle);\n\n /** Construct from a normalized quaternion stored in a vec3 */\n explicit aiQuaterniont( aiVector3t normalized);\n\n /** Returns a matrix representation of the quaternion */\n aiMatrix3x3t GetMatrix() const;\n\npublic:\n\n bool operator== (const aiQuaterniont& o) const;\n bool operator!= (const aiQuaterniont& o) const;\n\n bool Equal(const aiQuaterniont& o, TReal epsilon = 1e-6) const;\n\npublic:\n\n /** Normalize the quaternion */\n aiQuaterniont& Normalize();\n\n /** Compute quaternion conjugate */\n aiQuaterniont& Conjugate ();\n\n /** Rotate a point by this quaternion */\n aiVector3t Rotate (const aiVector3t& in);\n\n /** Multiply two quaternions */\n aiQuaterniont operator* (const aiQuaterniont& two) const;\n\npublic:\n\n /** Performs a spherical interpolation between two quaternions and writes the result into the third.\n * @param pOut Target object to received the interpolated rotation.\n * @param pStart Start rotation of the interpolation at factor == 0.\n * @param pEnd End rotation, factor == 1.\n * @param pFactor Interpolation factor between 0 and 1. Values outside of this range yield undefined results.\n */\n static void Interpolate( aiQuaterniont& pOut, const aiQuaterniont& pStart,\n const aiQuaterniont& pEnd, TReal pFactor);\n\npublic:\n\n //! w,x,y,z components of the quaternion\n TReal w, x, y, z;\n} ;\n\ntypedef aiQuaterniont aiQuaternion;\n\n#else\n\nstruct aiQuaternion {\n float w, x, y, z;\n};\n\n#endif\n\n\n#endif // AI_QUATERNION_H_INC\n"}, {"path": "includes/assimp/scene.h", "language": "code", "loc": 349, "comment_density": 0.622, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file scene.h\n * @brief Defines the data structures in which the imported scene is returned.\n */\n#ifndef __AI_SCENE_H_INC__\n#define __AI_SCENE_H_INC__\n\n#include \"types.h\"\n#include \"texture.h\"\n#include \"mesh.h\"\n#include \"light.h\"\n#include \"camera.h\"\n#include \"material.h\"\n#include \"anim.h\"\n#include \"metadata.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n// -------------------------------------------------------------------------------\n/** A node in the imported hierarchy.\n *\n * Each node has name, a parent node (except for the root node),\n * a transformation relative to its parent and possibly several child nodes.\n * Simple file formats don't support hierarchical structures - for these formats\n * the imported scene does consist of only a single root node without children.\n */\n// -------------------------------------------------------------------------------\nstruct aiNode\n{\n /** The name of the node.\n *\n * The name might be empty (length of zero) but all nodes which\n * need to be referenced by either bones or animations are named.\n * Multiple nodes may have the same name, except for nodes which are referenced\n * by bones (see #aiBone and #aiMesh::mBones). Their names *must* be unique.\n *\n * Cameras and lights reference a specific node by name - if there\n * are multiple nodes with this name, they are assigned to each of them.\n *
\n * There are no limitations with regard to the characters contained in\n * the name string as it is usually taken directly from the source file.\n *\n * Implementations should be able to handle tokens such as whitespace, tabs,\n * line feeds, quotation marks, ampersands etc.\n *\n * Sometimes assimp introduces new nodes not present in the source file\n * into the hierarchy (usually out of necessity because sometimes the\n * source hierarchy format is simply not compatible). Their names are\n * surrounded by @verbatim <> @endverbatim e.g.\n * @verbatim @endverbatim.\n */\n C_STRUCT aiString mName;\n\n /** The transformation relative to the node's parent. */\n C_STRUCT aiMatrix4x4 mTransformation;\n\n /** Parent node. NULL if this node is the root node. */\n C_STRUCT aiNode* mParent;\n\n /** The number of child nodes of this node. */\n unsigned int mNumChildren;\n\n /** The child nodes of this node. NULL if mNumChildren is 0. */\n C_STRUCT aiNode** mChildren;\n\n /** The number of meshes of this node. */\n unsigned int mNumMeshes;\n\n /** The meshes of this node. Each entry is an index into the \n * mesh list of the #aiScene.\n */\n unsigned int* mMeshes;\n\n /** Metadata associated with this node or NULL if there is no metadata.\n * Whether any metadata is generated depends on the source file format. See the\n * @link importer_notes @endlink page for more information on every source file\n * format. Importers that don't document any metadata don't write any.\n */\n C_STRUCT aiMetadata* mMetaData;\n\n#ifdef __cplusplus\n /** Constructor */\n aiNode()\n // set all members to zero by default\n : mName(\"\")\n , mParent(NULL)\n , mNumChildren(0)\n , mChildren(NULL)\n , mNumMeshes(0)\n , mMeshes(NULL)\n , mMetaData(NULL)\n {\n }\n\n\n /** Construction from a specific name */\n explicit aiNode(const std::string& name)\n // set all members to zero by default\n : mName(name)\n , mParent(NULL)\n , mNumChildren(0)\n , mChildren(NULL)\n , mNumMeshes(0)\n , mMeshes(NULL)\n , mMetaData(NULL)\n {\n }\n\n /** Destructor */\n ~aiNode()\n {\n // delete all children recursively\n // to make sure we won't crash if the data is invalid ...\n if (mChildren && mNumChildren)\n {\n for( unsigned int a = 0; a < mNumChildren; a++)\n delete mChildren[a];\n }\n delete [] mChildren;\n delete [] mMeshes;\n delete mMetaData;\n }\n\n\n /** Searches for a node with a specific name, beginning at this\n * nodes. Normally you will call this method on the root node\n * of the scene.\n *\n * @param name Name to search for\n * @return NULL or a valid Node if the search was successful.\n */\n inline const aiNode* FindNode(const aiString& name) const\n {\n return FindNode(name.data);\n }\n\n\n inline aiNode* FindNode(const aiString& name)\n {\n return FindNode(name.data);\n }\n\n\n inline const aiNode* FindNode(const char* name) const\n {\n if (!::strcmp( mName.data,name))return this;\n for (unsigned int i = 0; i < mNumChildren;++i)\n {\n const aiNode* const p = mChildren[i]->FindNode(name);\n if (p) {\n return p;\n }\n }\n // there is definitely no sub-node with this name\n return NULL;\n }\n\n inline aiNode* FindNode(const char* name)\n {\n if (!::strcmp( mName.data,name))return this;\n for (unsigned int i = 0; i < mNumChildren;++i)\n {\n aiNode* const p = mChildren[i]->FindNode(name);\n if (p) {\n return p;\n }\n }\n // there is definitely no sub-node with this name\n return NULL;\n }\n\n#endif // __cplusplus\n};\n\n\n// -------------------------------------------------------------------------------\n/**\n * Specifies that the scene data structure that was imported is not complete.\n * This flag bypasses some internal validations and allows the import\n * of animation skeletons, material libraries or camera animation paths\n * using Assimp. Most applications won't support such data.\n */\n#define AI_SCENE_FLAGS_INCOMPLETE 0x1\n\n/**\n * This flag is set by the validation postprocess-step (aiPostProcess_ValidateDS)\n * if the validation is successful. In a validated scene you can be sure that\n * any cross references in the data structure (e.g. vertex indices) are valid.\n */\n#define AI_SCENE_FLAGS_VALIDATED 0x2\n\n/**\n * This flag is set by the validation postprocess-step (aiPostProcess_ValidateDS)\n * if the validation is successful but some issues have been found.\n * This can for example mean that a texture that does not exist is referenced\n * by a material or that the bone weights for a vertex don't sum to 1.0 ... .\n * In most cases you should still be able to use the import. This flag could\n * be useful for applications which don't capture Assimp's log output.\n */\n#define AI_SCENE_FLAGS_VALIDATION_WARNING 0x4\n\n/**\n * This flag is currently only set by the aiProcess_JoinIdenticalVertices step.\n * It indicates that the vertices of the output meshes aren't in the internal\n * verbose format anymore. In the verbose format all vertices are unique,\n * no vertex is ever referenced by more than one face.\n */\n#define AI_SCENE_FLAGS_NON_VERBOSE_FORMAT 0x8\n\n /**\n * Denotes pure height-map terrain data. Pure terrains usually consist of quads,\n * sometimes triangles, in a regular grid. The x,y coordinates of all vertex\n * positions refer to the x,y coordinates on the terrain height map, the z-axis\n * stores the elevation at a specific point.\n *\n * TER (Terragen) and HMP (3D Game Studio) are height map formats.\n * @note Assimp is probably not the best choice for loading *huge* terrains -\n * fully triangulated data takes extremely much free store and should be avoided\n * as long as possible (typically you'll do the triangulation when you actually\n * need to render it).\n */\n#define AI_SCENE_FLAGS_TERRAIN 0x10\n\n\n// -------------------------------------------------------------------------------\n/** The root structure of the imported data.\n *\n * Everything that was imported from the given file can be accessed from here.\n * Objects of this class are generally maintained and owned by Assimp, not\n * by the caller. You shouldn't want to instance it, nor should you ever try to\n * delete a given scene on your own.\n */\n// -------------------------------------------------------------------------------\nstruct aiScene\n{\n\n /** Any combination of the AI_SCENE_FLAGS_XXX flags. By default\n * this value is 0, no flags are set. Most applications will\n * want to reject all scenes with the AI_SCENE_FLAGS_INCOMPLETE\n * bit set.\n */\n unsigned int mFlags;\n\n\n /** The root node of the hierarchy.\n *\n * There will always be at least the root node if the import\n * was successful (and no special flags have been set).\n * Presence of further nodes depends on the format and content\n * of the imported file.\n */\n C_STRUCT aiNode* mRootNode;\n\n\n\n /** The number of meshes in the scene. */\n unsigned int mNumMeshes;\n\n /** The array of meshes.\n *\n * Use the indices given in the aiNode structure to access\n * this array. The array is mNumMeshes in size. If the\n * AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always\n * be at least ONE material.\n */\n C_STRUCT aiMesh** mMeshes;\n\n\n\n /** The number of materials in the scene. */\n unsigned int mNumMaterials;\n\n /** The array of materials.\n *\n * Use the index given in each aiMesh structure to access this\n * array. The array is mNumMaterials in size. If the\n * AI_SCENE_FLAGS_INCOMPLETE flag is not set there will always\n * be at least ONE material.\n */\n C_STRUCT aiMaterial** mMaterials;\n\n\n\n /** The number of animations in the scene. */\n unsigned int mNumAnimations;\n\n /** The array of animations.\n *\n * All animations imported from the given file are listed here.\n * The array is mNumAnimations in size.\n */\n C_STRUCT aiAnimation** mAnimations;\n\n\n\n /** The number of textures embedded into the file */\n unsigned int mNumTextures;\n\n /** The array of embedded textures.\n *\n * Not many file formats embed their textures into the file.\n * An example is Quake's MDL format (which is also used by\n * some GameStudio versions)\n */\n C_STRUCT aiTexture** mTextures;\n\n\n /** The number of light sources in the scene. Light sources\n * are fully optional, in most cases this attribute will be 0\n */\n unsigned int mNumLights;\n\n /** The array of light sources.\n *\n * All light sources imported from the given file are\n * listed here. The array is mNumLights in size.\n */\n C_STRUCT aiLight** mLights;\n\n\n /** The number of cameras in the scene. Cameras\n * are fully optional, in most cases this attribute will be 0\n */\n unsigned int mNumCameras;\n\n /** The array of cameras.\n *\n * All cameras imported from the given file are listed here.\n * The array is mNumCameras in size. The first camera in the\n * array (if existing) is the default camera view into\n * the scene.\n */\n C_STRUCT aiCamera** mCameras;\n\n#ifdef __cplusplus\n\n //! Default constructor - set everything to 0/NULL\n ASSIMP_API aiScene();\n\n //! Destructor\n ASSIMP_API ~aiScene();\n\n //! Check whether the scene contains meshes\n //! Unless no special scene flags are set this will always be true.\n inline bool HasMeshes() const\n { return mMeshes != NULL && mNumMeshes > 0; }\n\n //! Check whether the scene contains materials\n //! Unless no special scene flags are set this will always be true.\n inline bool HasMaterials() const\n { return mMaterials != NULL && mNumMaterials > 0; }\n\n //! Check whether the scene contains lights\n inline bool HasLights() const\n { return mLights != NULL && mNumLights > 0; }\n\n //! Check whether the scene contains textures\n inline bool HasTextures() const\n { return mTextures != NULL && mNumTextures > 0; }\n\n //! Check whether the scene contains cameras\n inline bool HasCameras() const\n { return mCameras != NULL && mNumCameras > 0; }\n\n //! Check whether the scene contains animations\n inline bool HasAnimations() const\n { return mAnimations != NULL && mNumAnimations > 0; }\n\n#endif // __cplusplus\n\n\n /** Internal data, do not touch */\n#ifdef __cplusplus\n void* mPrivate;\n#else\n char* mPrivate;\n#endif\n\n};\n\n#ifdef __cplusplus\n} //! namespace Assimp\n#endif\n\n#endif // __AI_SCENE_H_INC__\n"}, {"path": "includes/assimp/texture.h", "language": "code", "loc": 169, "comment_density": 0.657, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file texture.h\n * @brief Defines texture helper structures for the library\n *\n * Used for file formats which embed their textures into the model file.\n * Supported are both normal textures, which are stored as uncompressed\n * pixels, and \"compressed\" textures, which are stored in a file format\n * such as PNG or TGA.\n */\n\n#ifndef AI_TEXTURE_H_INC\n#define AI_TEXTURE_H_INC\n\n#include \"types.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n// --------------------------------------------------------------------------------\n/** @def AI_MAKE_EMBEDDED_TEXNAME\n * Used to build the reserved path name used by the material system to\n * reference textures that are embedded into their corresponding\n * model files. The parameter specifies the index of the texture\n * (zero-based, in the aiScene::mTextures array)\n */\n#if (!defined AI_MAKE_EMBEDDED_TEXNAME)\n# define AI_MAKE_EMBEDDED_TEXNAME(_n_) \"*\" # _n_\n#endif\n\n\n#include \"./Compiler/pushpack1.h\"\n\n// --------------------------------------------------------------------------------\n/** @brief Helper structure to represent a texel in a ARGB8888 format\n*\n* Used by aiTexture.\n*/\nstruct aiTexel\n{\n unsigned char b,g,r,a;\n\n#ifdef __cplusplus\n //! Comparison operator\n bool operator== (const aiTexel& other) const\n {\n return b == other.b && r == other.r &&\n g == other.g && a == other.a;\n }\n\n //! Inverse comparison operator\n bool operator!= (const aiTexel& other) const\n {\n return b != other.b || r != other.r ||\n g != other.g || a != other.a;\n }\n\n //! Conversion to a floating-point 4d color\n operator aiColor4D() const\n {\n return aiColor4D(r/255.f,g/255.f,b/255.f,a/255.f);\n }\n#endif // __cplusplus\n\n} PACK_STRUCT;\n\n#include \"./Compiler/poppack1.h\"\n\n// --------------------------------------------------------------------------------\n/** Helper structure to describe an embedded texture\n *\n * Normally textures are contained in external files but some file formats embed\n * them directly in the model file. There are two types of embedded textures:\n * 1. Uncompressed textures. The color data is given in an uncompressed format.\n * 2. Compressed textures stored in a file format like png or jpg. The raw file\n * bytes are given so the application must utilize an image decoder (e.g. DevIL) to\n * get access to the actual color data.\n *\n * Embedded textures are referenced from materials using strings like \"*0\", \"*1\", etc.\n * as the texture paths (a single asterisk character followed by the\n * zero-based index of the texture in the aiScene::mTextures array).\n */\nstruct aiTexture\n{\n /** Width of the texture, in pixels\n *\n * If mHeight is zero the texture is compressed in a format\n * like JPEG. In this case mWidth specifies the size of the\n * memory area pcData is pointing to, in bytes.\n */\n unsigned int mWidth;\n\n /** Height of the texture, in pixels\n *\n * If this value is zero, pcData points to an compressed texture\n * in any format (e.g. JPEG).\n */\n unsigned int mHeight;\n\n /** A hint from the loader to make it easier for applications\n * to determine the type of embedded compressed textures.\n *\n * If mHeight != 0 this member is undefined. Otherwise it\n * is set to '\\\\0\\\\0\\\\0\\\\0' if the loader has no additional\n * information about the texture file format used OR the\n * file extension of the format without a trailing dot. If there\n * are multiple file extensions for a format, the shortest\n * extension is chosen (JPEG maps to 'jpg', not to 'jpeg').\n * E.g. 'dds\\\\0', 'pcx\\\\0', 'jpg\\\\0'. All characters are lower-case.\n * The fourth character will always be '\\\\0'.\n */\n char achFormatHint[4];\n\n /** Data of the texture.\n *\n * Points to an array of mWidth * mHeight aiTexel's.\n * The format of the texture data is always ARGB8888 to\n * make the implementation for user of the library as easy\n * as possible. If mHeight = 0 this is a pointer to a memory\n * buffer of size mWidth containing the compressed texture\n * data. Good luck, have fun!\n */\n C_STRUCT aiTexel* pcData;\n\n#ifdef __cplusplus\n\n //! For compressed textures (mHeight == 0): compare the\n //! format hint against a given string.\n //! @param s Input string. 3 characters are maximally processed.\n //! Example values: \"jpg\", \"png\"\n //! @return true if the given string matches the format hint\n bool CheckFormat(const char* s) const\n {\n return (0 == ::strncmp(achFormatHint,s,3));\n }\n\n // Construction\n aiTexture ()\n : mWidth (0)\n , mHeight (0)\n , pcData (NULL)\n {\n achFormatHint[0] = achFormatHint[1] = 0;\n achFormatHint[2] = achFormatHint[3] = 0;\n }\n\n // Destruction\n ~aiTexture ()\n {\n delete[] pcData;\n }\n#endif\n};\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // AI_TEXTURE_H_INC\n"}, {"path": "includes/assimp/types.h", "language": "code", "loc": 426, "comment_density": 0.467, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file types.h\n * Basic data types and primitives, such as vectors or colors.\n */\n#ifndef AI_TYPES_H_INC\n#define AI_TYPES_H_INC\n\n// Some runtime headers\n#include \n#include \n#include \n#include \n#include \n\n// Our compile configuration\n#include \"defs.h\"\n\n// Some types moved to separate header due to size of operators\n#include \"vector3.h\"\n#include \"vector2.h\"\n#include \"color4.h\"\n#include \"matrix3x3.h\"\n#include \"matrix4x4.h\"\n#include \"quaternion.h\"\n\n#ifdef __cplusplus\n#include \n#include // for std::nothrow_t\n#include // for aiString::Set(const std::string&)\n\nnamespace Assimp {\n //! @cond never\nnamespace Intern {\n // --------------------------------------------------------------------\n /** @brief Internal helper class to utilize our internal new/delete\n * routines for allocating object of this and derived classes.\n *\n * By doing this you can safely share class objects between Assimp\n * and the application - it works even over DLL boundaries. A good\n * example is the #IOSystem where the application allocates its custom\n * #IOSystem, then calls #Importer::SetIOSystem(). When the Importer\n * destructs, Assimp calls operator delete on the stored #IOSystem.\n * If it lies on a different heap than Assimp is working with,\n * the application is determined to crash.\n */\n // --------------------------------------------------------------------\n#ifndef SWIG\n struct ASSIMP_API AllocateFromAssimpHeap {\n // http://www.gotw.ca/publications/mill15.htm\n\n // new/delete overload\n void *operator new ( size_t num_bytes) /* throw( std::bad_alloc ) */;\n void *operator new ( size_t num_bytes, const std::nothrow_t& ) throw();\n void operator delete ( void* data);\n\n // array new/delete overload\n void *operator new[] ( size_t num_bytes) /* throw( std::bad_alloc ) */;\n void *operator new[] ( size_t num_bytes, const std::nothrow_t& ) throw();\n void operator delete[] ( void* data);\n\n }; // struct AllocateFromAssimpHeap\n#endif\n} // namespace Intern\n //! @endcond\n} // namespace Assimp\n\nextern \"C\" {\n#endif\n\n/** Maximum dimension for strings, ASSIMP strings are zero terminated. */\n#ifdef __cplusplus\nconst size_t MAXLEN = 1024;\n#else\n# define MAXLEN 1024\n#endif\n\n#include \"./Compiler/pushpack1.h\"\n\n// ----------------------------------------------------------------------------------\n/** Represents a plane in a three-dimensional, euclidean space\n*/\nstruct aiPlane\n{\n#ifdef __cplusplus\n aiPlane () : a(0.f), b(0.f), c(0.f), d(0.f) {}\n aiPlane (float _a, float _b, float _c, float _d)\n : a(_a), b(_b), c(_c), d(_d) {}\n\n aiPlane (const aiPlane& o) : a(o.a), b(o.b), c(o.c), d(o.d) {}\n\n#endif // !__cplusplus\n\n //! Plane equation\n float a,b,c,d;\n} PACK_STRUCT; // !struct aiPlane\n\n// ----------------------------------------------------------------------------------\n/** Represents a ray\n*/\nstruct aiRay\n{\n#ifdef __cplusplus\n aiRay () {}\n aiRay (const aiVector3D& _pos, const aiVector3D& _dir)\n : pos(_pos), dir(_dir) {}\n\n aiRay (const aiRay& o) : pos (o.pos), dir (o.dir) {}\n\n#endif // !__cplusplus\n\n //! Position and direction of the ray\n C_STRUCT aiVector3D pos, dir;\n} PACK_STRUCT; // !struct aiRay\n\n// ----------------------------------------------------------------------------------\n/** Represents a color in Red-Green-Blue space.\n*/\nstruct aiColor3D\n{\n#ifdef __cplusplus\n aiColor3D () : r(0.0f), g(0.0f), b(0.0f) {}\n aiColor3D (float _r, float _g, float _b) : r(_r), g(_g), b(_b) {}\n explicit aiColor3D (float _r) : r(_r), g(_r), b(_r) {}\n aiColor3D (const aiColor3D& o) : r(o.r), g(o.g), b(o.b) {}\n\n /** Component-wise comparison */\n // TODO: add epsilon?\n bool operator == (const aiColor3D& other) const\n {return r == other.r && g == other.g && b == other.b;}\n\n /** Component-wise inverse comparison */\n // TODO: add epsilon?\n bool operator != (const aiColor3D& other) const\n {return r != other.r || g != other.g || b != other.b;}\n\n /** Component-wise comparison */\n // TODO: add epsilon?\n bool operator < (const aiColor3D& other) const {\n return r < other.r || (\n r == other.r && (g < other.g ||\n (g == other.g && b < other.b)\n )\n );\n }\n\n /** Component-wise addition */\n aiColor3D operator+(const aiColor3D& c) const {\n return aiColor3D(r+c.r,g+c.g,b+c.b);\n }\n\n /** Component-wise subtraction */\n aiColor3D operator-(const aiColor3D& c) const {\n return aiColor3D(r-c.r,g-c.g,b-c.b);\n }\n\n /** Component-wise multiplication */\n aiColor3D operator*(const aiColor3D& c) const {\n return aiColor3D(r*c.r,g*c.g,b*c.b);\n }\n\n /** Multiply with a scalar */\n aiColor3D operator*(float f) const {\n return aiColor3D(r*f,g*f,b*f);\n }\n\n /** Access a specific color component */\n float operator[](unsigned int i) const {\n return *(&r + i);\n }\n\n /** Access a specific color component */\n float& operator[](unsigned int i) {\n return *(&r + i);\n }\n\n /** Check whether a color is black */\n bool IsBlack() const {\n static const float epsilon = 10e-3f;\n return std::fabs( r ) < epsilon && std::fabs( g ) < epsilon && std::fabs( b ) < epsilon;\n }\n\n#endif // !__cplusplus\n\n //! Red, green and blue color values\n float r, g, b;\n} PACK_STRUCT; // !struct aiColor3D\n#include \"./Compiler/poppack1.h\"\n\n// ----------------------------------------------------------------------------------\n/** Represents an UTF-8 string, zero byte terminated.\n *\n * The character set of an aiString is explicitly defined to be UTF-8. This Unicode\n * transformation was chosen in the belief that most strings in 3d files are limited\n * to ASCII, thus the character set needed to be strictly ASCII compatible.\n *\n * Most text file loaders provide proper Unicode input file handling, special unicode\n * characters are correctly transcoded to UTF8 and are kept throughout the libraries'\n * import pipeline.\n *\n * For most applications, it will be absolutely sufficient to interpret the\n * aiString as ASCII data and work with it as one would work with a plain char*.\n * Windows users in need of proper support for i.e asian characters can use the\n * MultiByteToWideChar(), WideCharToMultiByte() WinAPI functionality to convert the\n * UTF-8 strings to their working character set (i.e. MBCS, WideChar).\n *\n * We use this representation instead of std::string to be C-compatible. The\n * (binary) length of such a string is limited to MAXLEN characters (including the\n * the terminating zero).\n*/\nstruct aiString\n{\n#ifdef __cplusplus\n /** Default constructor, the string is set to have zero length */\n aiString() :\n length(0)\n {\n data[0] = '\\0';\n\n#ifdef ASSIMP_BUILD_DEBUG\n // Debug build: overwrite the string on its full length with ESC (27)\n memset(data+1,27,MAXLEN-1);\n#endif\n }\n\n /** Copy constructor */\n aiString(const aiString& rOther) :\n length(rOther.length)\n {\n // Crop the string to the maximum length\n length = length>=MAXLEN?MAXLEN-1:length;\n memcpy( data, rOther.data, length);\n data[length] = '\\0';\n }\n\n /** Constructor from std::string */\n explicit aiString(const std::string& pString) :\n length(pString.length())\n {\n length = length>=MAXLEN?MAXLEN-1:length;\n memcpy( data, pString.c_str(), length);\n data[length] = '\\0';\n }\n\n /** Copy a std::string to the aiString */\n void Set( const std::string& pString) {\n if( pString.length() > MAXLEN - 1) {\n return;\n }\n length = pString.length();\n memcpy( data, pString.c_str(), length);\n data[length] = 0;\n }\n\n /** Copy a const char* to the aiString */\n void Set( const char* sz) {\n const size_t len = ::strlen(sz);\n if( len > MAXLEN - 1) {\n return;\n }\n length = len;\n memcpy( data, sz, len);\n data[len] = 0;\n }\n\n /** Assign a const char* to the string */\n aiString& operator = (const char* sz) {\n Set(sz);\n return *this;\n }\n\n /** Assign a cstd::string to the string */\n aiString& operator = ( const std::string& pString) {\n Set(pString);\n return *this;\n }\n\n /** Comparison operator */\n bool operator==(const aiString& other) const {\n return (length == other.length && 0 == memcmp(data,other.data,length));\n }\n\n /** Inverse comparison operator */\n bool operator!=(const aiString& other) const {\n return (length != other.length || 0 != memcmp(data,other.data,length));\n }\n\n /** Append a string to the string */\n void Append (const char* app) {\n const size_t len = ::strlen(app);\n if (!len) {\n return;\n }\n if (length + len >= MAXLEN) {\n return;\n }\n\n memcpy(&data[length],app,len+1);\n length += len;\n }\n\n /** Clear the string - reset its length to zero */\n void Clear () {\n length = 0;\n data[0] = '\\0';\n\n#ifdef ASSIMP_BUILD_DEBUG\n // Debug build: overwrite the string on its full length with ESC (27)\n memset(data+1,27,MAXLEN-1);\n#endif\n }\n\n /** Returns a pointer to the underlying zero-terminated array of characters */\n const char* C_Str() const {\n return data;\n }\n\n#endif // !__cplusplus\n\n /** Binary length of the string excluding the terminal 0. This is NOT the\n * logical length of strings containing UTF-8 multibyte sequences! It's\n * the number of bytes from the beginning of the string to its end.*/\n size_t length;\n\n /** String buffer. Size limit is MAXLEN */\n char data[MAXLEN];\n} ; // !struct aiString\n\n\n// ----------------------------------------------------------------------------------\n/** Standard return type for some library functions.\n * Rarely used, and if, mostly in the C API.\n */\ntypedef enum aiReturn\n{\n /** Indicates that a function was successful */\n aiReturn_SUCCESS = 0x0,\n\n /** Indicates that a function failed */\n aiReturn_FAILURE = -0x1,\n\n /** Indicates that not enough memory was available\n * to perform the requested operation\n */\n aiReturn_OUTOFMEMORY = -0x3,\n\n /** @cond never\n * Force 32-bit size enum\n */\n _AI_ENFORCE_ENUM_SIZE = 0x7fffffff\n\n /// @endcond\n} aiReturn; // !enum aiReturn\n\n// just for backwards compatibility, don't use these constants anymore\n#define AI_SUCCESS aiReturn_SUCCESS\n#define AI_FAILURE aiReturn_FAILURE\n#define AI_OUTOFMEMORY aiReturn_OUTOFMEMORY\n\n// ----------------------------------------------------------------------------------\n/** Seek origins (for the virtual file system API).\n * Much cooler than using SEEK_SET, SEEK_CUR or SEEK_END.\n */\nenum aiOrigin\n{\n /** Beginning of the file */\n aiOrigin_SET = 0x0,\n\n /** Current position of the file pointer */\n aiOrigin_CUR = 0x1,\n\n /** End of the file, offsets must be negative */\n aiOrigin_END = 0x2,\n\n /** @cond never\n * Force 32-bit size enum\n */\n _AI_ORIGIN_ENFORCE_ENUM_SIZE = 0x7fffffff\n\n /// @endcond\n}; // !enum aiOrigin\n\n// ----------------------------------------------------------------------------------\n/** @brief Enumerates predefined log streaming destinations.\n * Logging to these streams can be enabled with a single call to\n * #LogStream::createDefaultStream.\n */\nenum aiDefaultLogStream\n{\n /** Stream the log to a file */\n aiDefaultLogStream_FILE = 0x1,\n\n /** Stream the log to std::cout */\n aiDefaultLogStream_STDOUT = 0x2,\n\n /** Stream the log to std::cerr */\n aiDefaultLogStream_STDERR = 0x4,\n\n /** MSVC only: Stream the log the debugger\n * (this relies on OutputDebugString from the Win32 SDK)\n */\n aiDefaultLogStream_DEBUGGER = 0x8,\n\n /** @cond never\n * Force 32-bit size enum\n */\n _AI_DLS_ENFORCE_ENUM_SIZE = 0x7fffffff\n /// @endcond\n}; // !enum aiDefaultLogStream\n\n// just for backwards compatibility, don't use these constants anymore\n#define DLS_FILE aiDefaultLogStream_FILE\n#define DLS_STDOUT aiDefaultLogStream_STDOUT\n#define DLS_STDERR aiDefaultLogStream_STDERR\n#define DLS_DEBUGGER aiDefaultLogStream_DEBUGGER\n\n// ----------------------------------------------------------------------------------\n/** Stores the memory requirements for different components (e.g. meshes, materials,\n * animations) of an import. All sizes are in bytes.\n * @see Importer::GetMemoryRequirements()\n*/\nstruct aiMemoryInfo\n{\n#ifdef __cplusplus\n\n /** Default constructor */\n aiMemoryInfo()\n : textures (0)\n , materials (0)\n , meshes (0)\n , nodes (0)\n , animations (0)\n , cameras (0)\n , lights (0)\n , total (0)\n {}\n\n#endif\n\n /** Storage allocated for texture data */\n unsigned int textures;\n\n /** Storage allocated for material data */\n unsigned int materials;\n\n /** Storage allocated for mesh data */\n unsigned int meshes;\n\n /** Storage allocated for node data */\n unsigned int nodes;\n\n /** Storage allocated for animation data */\n unsigned int animations;\n\n /** Storage allocated for camera data */\n unsigned int cameras;\n\n /** Storage allocated for light data */\n unsigned int lights;\n\n /** Total storage allocated for the full import. */\n unsigned int total;\n}; // !struct aiMemoryInfo\n\n#ifdef __cplusplus\n}\n#endif //! __cplusplus\n\n// Include implementation files\n#include \"vector2.inl\"\n#include \"vector3.inl\"\n#include \"color4.inl\"\n#include \"quaternion.inl\"\n#include \"matrix3x3.inl\"\n#include \"matrix4x4.inl\"\n#endif\n"}, {"path": "includes/assimp/vector2.h", "language": "code", "loc": 85, "comment_density": 0.482, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file vector2.h\n * @brief 2D vector structure, including operators when compiling in C++\n */\n#ifndef AI_VECTOR2D_H_INC\n#define AI_VECTOR2D_H_INC\n\n#ifdef __cplusplus\n# include \n#else\n# include \n#endif\n\n#include \"./Compiler/pushpack1.h\"\n\n// ----------------------------------------------------------------------------------\n/** Represents a two-dimensional vector.\n */\n\n#ifdef __cplusplus\ntemplate \nclass aiVector2t\n{\npublic:\n\n aiVector2t () : x(), y() {}\n aiVector2t (TReal _x, TReal _y) : x(_x), y(_y) {}\n explicit aiVector2t (TReal _xyz) : x(_xyz), y(_xyz) {}\n aiVector2t (const aiVector2t& o) : x(o.x), y(o.y) {}\n\npublic:\n\n void Set( TReal pX, TReal pY);\n TReal SquareLength() const ;\n TReal Length() const ;\n aiVector2t& Normalize();\n\npublic:\n\n const aiVector2t& operator += (const aiVector2t& o);\n const aiVector2t& operator -= (const aiVector2t& o);\n const aiVector2t& operator *= (TReal f);\n const aiVector2t& operator /= (TReal f);\n\n TReal operator[](unsigned int i) const;\n TReal& operator[](unsigned int i);\n\n bool operator== (const aiVector2t& other) const;\n bool operator!= (const aiVector2t& other) const;\n\n bool Equal(const aiVector2t& other, TReal epsilon = 1e-6) const;\n\n aiVector2t& operator= (TReal f);\n const aiVector2t SymMul(const aiVector2t& o);\n\n template \n operator aiVector2t () const;\n\n TReal x, y;\n} PACK_STRUCT;\n\ntypedef aiVector2t aiVector2D;\n\n#else\n\nstruct aiVector2D {\n float x, y;\n};\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#endif // AI_VECTOR2D_H_INC\n"}, {"path": "includes/assimp/vector3.h", "language": "code", "loc": 109, "comment_density": 0.541, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n/** @file vector3.h\n * @brief 3D vector structure, including operators when compiling in C++\n */\n#ifndef AI_VECTOR3D_H_INC\n#define AI_VECTOR3D_H_INC\n\n#ifdef __cplusplus\n# include \n#else\n# include \n#endif\n\n#include \"./Compiler/pushpack1.h\"\n\n#ifdef __cplusplus\n\ntemplate class aiMatrix3x3t;\ntemplate class aiMatrix4x4t;\n\n// ---------------------------------------------------------------------------\n/** Represents a three-dimensional vector. */\ntemplate \nclass aiVector3t\n{\npublic:\n\n aiVector3t () : x(), y(), z() {}\n aiVector3t (TReal _x, TReal _y, TReal _z) : x(_x), y(_y), z(_z) {}\n explicit aiVector3t (TReal _xyz) : x(_xyz), y(_xyz), z(_xyz) {}\n aiVector3t (const aiVector3t& o) : x(o.x), y(o.y), z(o.z) {}\n\npublic:\n\n // combined operators\n const aiVector3t& operator += (const aiVector3t& o);\n const aiVector3t& operator -= (const aiVector3t& o);\n const aiVector3t& operator *= (TReal f);\n const aiVector3t& operator /= (TReal f);\n\n // transform vector by matrix\n aiVector3t& operator *= (const aiMatrix3x3t& mat);\n aiVector3t& operator *= (const aiMatrix4x4t& mat);\n\n // access a single element\n TReal operator[](unsigned int i) const;\n TReal& operator[](unsigned int i);\n\n // comparison\n bool operator== (const aiVector3t& other) const;\n bool operator!= (const aiVector3t& other) const;\n bool operator < (const aiVector3t& other) const;\n\n bool Equal(const aiVector3t& other, TReal epsilon = 1e-6) const;\n\n template \n operator aiVector3t () const;\n\npublic:\n\n /** @brief Set the components of a vector\n * @param pX X component\n * @param pY Y component\n * @param pZ Z component */\n void Set( TReal pX, TReal pY, TReal pZ);\n\n /** @brief Get the squared length of the vector\n * @return Square length */\n TReal SquareLength() const;\n\n\n /** @brief Get the length of the vector\n * @return length */\n TReal Length() const;\n\n\n /** @brief Normalize the vector */\n aiVector3t& Normalize();\n\n /** @brief Normalize the vector with extra check for zero vectors */\n aiVector3t& NormalizeSafe();\n\n /** @brief Componentwise multiplication of two vectors\n *\n * Note that vec*vec yields the dot product.\n * @param o Second factor */\n const aiVector3t SymMul(const aiVector3t& o);\n\n TReal x, y, z;\n} PACK_STRUCT;\n\n\ntypedef aiVector3t aiVector3D;\n\n#else\n\nstruct aiVector3D {\n float x, y, z;\n} PACK_STRUCT;\n\n#endif // __cplusplus\n\n#include \"./Compiler/poppack1.h\"\n\n#ifdef __cplusplus\n\n\n\n#endif // __cplusplus\n\n#endif // AI_VECTOR3D_H_INC\n"}, {"path": "includes/assimp/version.h", "language": "code", "loc": 86, "comment_density": 0.791, "code": "/*\n---------------------------------------------------------------------------\nOpen Asset Import Library (assimp)\n---------------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\n\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the following\nconditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n---------------------------------------------------------------------------\n*/\n\n/** @file version.h\n * @brief Functions to query the version of the Assimp runtime, check\n * compile flags, ...\n */\n#ifndef INCLUDED_AI_VERSION_H\n#define INCLUDED_AI_VERSION_H\n\n#include \"defs.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n// ---------------------------------------------------------------------------\n/** @brief Returns a string with legal copyright and licensing information\n * about Assimp. The string may include multiple lines.\n * @return Pointer to static string.\n */\nASSIMP_API const char* aiGetLegalString (void);\n\n// ---------------------------------------------------------------------------\n/** @brief Returns the current minor version number of Assimp.\n * @return Minor version of the Assimp runtime the application was\n * linked/built against\n */\nASSIMP_API unsigned int aiGetVersionMinor (void);\n\n// ---------------------------------------------------------------------------\n/** @brief Returns the current major version number of Assimp.\n * @return Major version of the Assimp runtime the application was\n * linked/built against\n */\nASSIMP_API unsigned int aiGetVersionMajor (void);\n\n// ---------------------------------------------------------------------------\n/** @brief Returns the repository revision of the Assimp runtime.\n * @return SVN Repository revision number of the Assimp runtime the\n * application was linked/built against.\n */\nASSIMP_API unsigned int aiGetVersionRevision (void);\n\n//! Assimp was compiled as a shared object (Windows: DLL)\n#define ASSIMP_CFLAGS_SHARED 0x1\n//! Assimp was compiled against STLport\n#define ASSIMP_CFLAGS_STLPORT 0x2\n//! Assimp was compiled as a debug build\n#define ASSIMP_CFLAGS_DEBUG 0x4\n\n//! Assimp was compiled with ASSIMP_BUILD_BOOST_WORKAROUND defined\n#define ASSIMP_CFLAGS_NOBOOST 0x8\n//! Assimp was compiled with ASSIMP_BUILD_SINGLETHREADED defined\n#define ASSIMP_CFLAGS_SINGLETHREADED 0x10\n\n// ---------------------------------------------------------------------------\n/** @brief Returns assimp's compile flags\n * @return Any bitwise combination of the ASSIMP_CFLAGS_xxx constants.\n */\nASSIMP_API unsigned int aiGetCompileFlags (void);\n\n#ifdef __cplusplus\n} // end extern \"C\"\n#endif\n\n#endif // !! #ifndef INCLUDED_AI_VERSION_H\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.669, "dedup_hash": "09606277dbd5eeb2", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_assimp_compiler", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Compiler", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/assimp/Compiler/poppack1.h", "language": "code", "loc": 18, "comment_density": 0.556, "code": "\n// ===============================================================================\n// May be included multiple times - resets structure packing to the defaults \n// for all supported compilers. Reverts the changes made by #include \n//\n// Currently this works on the following compilers:\n// MSVC 7,8,9\n// GCC\n// BORLAND (complains about 'pack state changed but not reverted', but works)\n// ===============================================================================\n\n#ifndef AI_PUSHPACK_IS_DEFINED\n#\terror pushpack1.h must be included after poppack1.h\n#endif\n\n// reset packing to the original value\n#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)\n#\tpragma pack( pop )\n#endif\n#undef PACK_STRUCT\n\n#undef AI_PUSHPACK_IS_DEFINED\n"}, {"path": "includes/assimp/Compiler/pstdint.h", "language": "code", "loc": 856, "comment_density": 0.303, "code": "/* A portable stdint.h\n ****************************************************************************\n * BSD License:\n ****************************************************************************\n *\n * Copyright (c) 2005-2016 Paul Hsieh\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n ****************************************************************************\n *\n * Version 0.1.15.4\n *\n * The ANSI C standard committee, for the C99 standard, specified the\n * inclusion of a new standard include file called stdint.h. This is\n * a very useful and long desired include file which contains several\n * very precise definitions for integer scalar types that is\n * critically important for making portable several classes of\n * applications including cryptography, hashing, variable length\n * integer libraries and so on. But for most developers its likely\n * useful just for programming sanity.\n *\n * The problem is that some compiler vendors chose to ignore the C99\n * standard and some older compilers have no opportunity to be updated.\n * Because of this situation, simply including stdint.h in your code\n * makes it unportable.\n *\n * So that's what this file is all about. Its an attempt to build a\n * single universal include file that works on as many platforms as\n * possible to deliver what stdint.h is supposed to. Even compilers\n * that already come with stdint.h can use this file instead without\n * any loss of functionality. A few things that should be noted about\n * this file:\n *\n * 1) It is not guaranteed to be portable and/or present an identical\n * interface on all platforms. The extreme variability of the\n * ANSI C standard makes this an impossibility right from the\n * very get go. Its really only meant to be useful for the vast\n * majority of platforms that possess the capability of\n * implementing usefully and precisely defined, standard sized\n * integer scalars. Systems which are not intrinsically 2s\n * complement may produce invalid constants.\n *\n * 2) There is an unavoidable use of non-reserved symbols.\n *\n * 3) Other standard include files are invoked.\n *\n * 4) This file may come in conflict with future platforms that do\n * include stdint.h. The hope is that one or the other can be\n * used with no real difference.\n *\n * 5) In the current version, if your platform can't represent\n * int32_t, int16_t and int8_t, it just dumps out with a compiler\n * error.\n *\n * 6) 64 bit integers may or may not be defined. Test for their\n * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.\n * Note that this is different from the C99 specification which\n * requires the existence of 64 bit support in the compiler. If\n * this is not defined for your platform, yet it is capable of\n * dealing with 64 bits then it is because this file has not yet\n * been extended to cover all of your system's capabilities.\n *\n * 7) (u)intptr_t may or may not be defined. Test for its presence\n * with the test: #ifdef PTRDIFF_MAX. If this is not defined\n * for your platform, then it is because this file has not yet\n * been extended to cover all of your system's capabilities, not\n * because its optional.\n *\n * 8) The following might not been defined even if your platform is\n * capable of defining it:\n *\n * WCHAR_MIN\n * WCHAR_MAX\n * (u)int64_t\n * PTRDIFF_MIN\n * PTRDIFF_MAX\n * (u)intptr_t\n *\n * 9) The following have not been defined:\n *\n * WINT_MIN\n * WINT_MAX\n *\n * 10) The criteria for defining (u)int_least(*)_t isn't clear,\n * except for systems which don't have a type that precisely\n * defined 8, 16, or 32 bit types (which this include file does\n * not support anyways). Default definitions have been given.\n *\n * 11) The criteria for defining (u)int_fast(*)_t isn't something I\n * would trust to any particular compiler vendor or the ANSI C\n * committee. It is well known that \"compatible systems\" are\n * commonly created that have very different performance\n * characteristics from the systems they are compatible with,\n * especially those whose vendors make both the compiler and the\n * system. Default definitions have been given, but its strongly\n * recommended that users never use these definitions for any\n * reason (they do *NOT* deliver any serious guarantee of\n * improved performance -- not in this file, nor any vendor's\n * stdint.h).\n *\n * 12) The following macros:\n *\n * PRINTF_INTMAX_MODIFIER\n * PRINTF_INT64_MODIFIER\n * PRINTF_INT32_MODIFIER\n * PRINTF_INT16_MODIFIER\n * PRINTF_LEAST64_MODIFIER\n * PRINTF_LEAST32_MODIFIER\n * PRINTF_LEAST16_MODIFIER\n * PRINTF_INTPTR_MODIFIER\n *\n * are strings which have been defined as the modifiers required\n * for the \"d\", \"u\" and \"x\" printf formats to correctly output\n * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,\n * (u)least32_t, (u)least16_t and (u)intptr_t types respectively.\n * PRINTF_INTPTR_MODIFIER is not defined for some systems which\n * provide their own stdint.h. PRINTF_INT64_MODIFIER is not\n * defined if INT64_MAX is not defined. These are an extension\n * beyond what C99 specifies must be in stdint.h.\n *\n * In addition, the following macros are defined:\n *\n * PRINTF_INTMAX_HEX_WIDTH\n * PRINTF_INT64_HEX_WIDTH\n * PRINTF_INT32_HEX_WIDTH\n * PRINTF_INT16_HEX_WIDTH\n * PRINTF_INT8_HEX_WIDTH\n * PRINTF_INTMAX_DEC_WIDTH\n * PRINTF_INT64_DEC_WIDTH\n * PRINTF_INT32_DEC_WIDTH\n * PRINTF_INT16_DEC_WIDTH\n * PRINTF_UINT8_DEC_WIDTH\n * PRINTF_UINTMAX_DEC_WIDTH\n * PRINTF_UINT64_DEC_WIDTH\n * PRINTF_UINT32_DEC_WIDTH\n * PRINTF_UINT16_DEC_WIDTH\n * PRINTF_UINT8_DEC_WIDTH\n *\n * Which specifies the maximum number of characters required to\n * print the number of that type in either hexadecimal or decimal.\n * These are an extension beyond what C99 specifies must be in\n * stdint.h.\n *\n * Compilers tested (all with 0 warnings at their highest respective\n * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32\n * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio\n * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3\n *\n * This file should be considered a work in progress. Suggestions for\n * improvements, especially those which increase coverage are strongly\n * encouraged.\n *\n * Acknowledgements\n *\n * The following people have made significant contributions to the\n * development and testing of this file:\n *\n * Chris Howie\n * John Steele Scott\n * Dave Thorup\n * John Dill\n * Florian Wobbe\n * Christopher Sean Morrison\n * Mikkel Fahnoe Jorgensen\n *\n */\n\n#include \n#include \n#include \n\n/*\n * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and\n * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.\n */\n\n#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)\n#include \n#define _PSTDINT_H_INCLUDED\n# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__))\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"l\"\n# endif\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n# else\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"ll\"\n# endif\n# ifndef PRINTF_INT32_MODIFIER\n# if (UINT_MAX == UINT32_MAX)\n# define PRINTF_INT32_MODIFIER \"\"\n# else\n# define PRINTF_INT32_MODIFIER \"l\"\n# endif\n# endif\n# endif\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"h\"\n# endif\n# ifndef PRINTF_INTMAX_MODIFIER\n# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER\n# endif\n# ifndef PRINTF_INT64_HEX_WIDTH\n# define PRINTF_INT64_HEX_WIDTH \"16\"\n# endif\n# ifndef PRINTF_UINT64_HEX_WIDTH\n# define PRINTF_UINT64_HEX_WIDTH \"16\"\n# endif\n# ifndef PRINTF_INT32_HEX_WIDTH\n# define PRINTF_INT32_HEX_WIDTH \"8\"\n# endif\n# ifndef PRINTF_UINT32_HEX_WIDTH\n# define PRINTF_UINT32_HEX_WIDTH \"8\"\n# endif\n# ifndef PRINTF_INT16_HEX_WIDTH\n# define PRINTF_INT16_HEX_WIDTH \"4\"\n# endif\n# ifndef PRINTF_UINT16_HEX_WIDTH\n# define PRINTF_UINT16_HEX_WIDTH \"4\"\n# endif\n# ifndef PRINTF_INT8_HEX_WIDTH\n# define PRINTF_INT8_HEX_WIDTH \"2\"\n# endif\n# ifndef PRINTF_UINT8_HEX_WIDTH\n# define PRINTF_UINT8_HEX_WIDTH \"2\"\n# endif\n# ifndef PRINTF_INT64_DEC_WIDTH\n# define PRINTF_INT64_DEC_WIDTH \"19\"\n# endif\n# ifndef PRINTF_UINT64_DEC_WIDTH\n# define PRINTF_UINT64_DEC_WIDTH \"20\"\n# endif\n# ifndef PRINTF_INT32_DEC_WIDTH\n# define PRINTF_INT32_DEC_WIDTH \"10\"\n# endif\n# ifndef PRINTF_UINT32_DEC_WIDTH\n# define PRINTF_UINT32_DEC_WIDTH \"10\"\n# endif\n# ifndef PRINTF_INT16_DEC_WIDTH\n# define PRINTF_INT16_DEC_WIDTH \"5\"\n# endif\n# ifndef PRINTF_UINT16_DEC_WIDTH\n# define PRINTF_UINT16_DEC_WIDTH \"5\"\n# endif\n# ifndef PRINTF_INT8_DEC_WIDTH\n# define PRINTF_INT8_DEC_WIDTH \"3\"\n# endif\n# ifndef PRINTF_UINT8_DEC_WIDTH\n# define PRINTF_UINT8_DEC_WIDTH \"3\"\n# endif\n# ifndef PRINTF_INTMAX_HEX_WIDTH\n# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH\n# endif\n# ifndef PRINTF_UINTMAX_HEX_WIDTH\n# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH\n# endif\n# ifndef PRINTF_INTMAX_DEC_WIDTH\n# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH\n# endif\n# ifndef PRINTF_UINTMAX_DEC_WIDTH\n# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH\n# endif\n\n/*\n * Something really weird is going on with Open Watcom. Just pull some of\n * these duplicated definitions from Open Watcom's stdint.h file for now.\n */\n\n# if defined (__WATCOMC__) && __WATCOMC__ >= 1250\n# if !defined (INT64_C)\n# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))\n# endif\n# if !defined (UINT64_C)\n# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))\n# endif\n# if !defined (INT32_C)\n# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))\n# endif\n# if !defined (UINT32_C)\n# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))\n# endif\n# if !defined (INT16_C)\n# define INT16_C(x) (x)\n# endif\n# if !defined (UINT16_C)\n# define UINT16_C(x) (x)\n# endif\n# if !defined (INT8_C)\n# define INT8_C(x) (x)\n# endif\n# if !defined (UINT8_C)\n# define UINT8_C(x) (x)\n# endif\n# if !defined (UINT64_MAX)\n# define UINT64_MAX 18446744073709551615ULL\n# endif\n# if !defined (INT64_MAX)\n# define INT64_MAX 9223372036854775807LL\n# endif\n# if !defined (UINT32_MAX)\n# define UINT32_MAX 4294967295UL\n# endif\n# if !defined (INT32_MAX)\n# define INT32_MAX 2147483647L\n# endif\n# if !defined (INTMAX_MAX)\n# define INTMAX_MAX INT64_MAX\n# endif\n# if !defined (INTMAX_MIN)\n# define INTMAX_MIN INT64_MIN\n# endif\n# endif\n#endif\n\n/*\n * I have no idea what is the truly correct thing to do on older Solaris.\n * From some online discussions, this seems to be what is being\n * recommended. For people who actually are developing on older Solaris,\n * what I would like to know is, does this define all of the relevant\n * macros of a complete stdint.h? Remember, in pstdint.h 64 bit is\n * considered optional.\n */\n\n#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED)\n#include \n#define _PSTDINT_H_INCLUDED\n#endif\n\n#ifndef _PSTDINT_H_INCLUDED\n#define _PSTDINT_H_INCLUDED\n\n#ifndef SIZE_MAX\n# define SIZE_MAX (~(size_t)0)\n#endif\n\n/*\n * Deduce the type assignments from limits.h under the assumption that\n * integer sizes in bits are powers of 2, and follow the ANSI\n * definitions.\n */\n\n#ifndef UINT8_MAX\n# define UINT8_MAX 0xff\n#endif\n#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks)\n# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)\n typedef unsigned char uint8_t;\n# define UINT8_C(v) ((uint8_t) v)\n# else\n# error \"Platform not supported\"\n# endif\n#endif\n\n#ifndef INT8_MAX\n# define INT8_MAX 0x7f\n#endif\n#ifndef INT8_MIN\n# define INT8_MIN INT8_C(0x80)\n#endif\n#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks)\n# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)\n typedef signed char int8_t;\n# define INT8_C(v) ((int8_t) v)\n# else\n# error \"Platform not supported\"\n# endif\n#endif\n\n#ifndef UINT16_MAX\n# define UINT16_MAX 0xffff\n#endif\n#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks)\n#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)\n typedef unsigned int uint16_t;\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"\"\n# endif\n# define UINT16_C(v) ((uint16_t) (v))\n#elif (USHRT_MAX == UINT16_MAX)\n typedef unsigned short uint16_t;\n# define UINT16_C(v) ((uint16_t) (v))\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"h\"\n# endif\n#else\n#error \"Platform not supported\"\n#endif\n#endif\n\n#ifndef INT16_MAX\n# define INT16_MAX 0x7fff\n#endif\n#ifndef INT16_MIN\n# define INT16_MIN INT16_C(0x8000)\n#endif\n#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks)\n#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)\n typedef signed int int16_t;\n# define INT16_C(v) ((int16_t) (v))\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"\"\n# endif\n#elif (SHRT_MAX == INT16_MAX)\n typedef signed short int16_t;\n# define INT16_C(v) ((int16_t) (v))\n# ifndef PRINTF_INT16_MODIFIER\n# define PRINTF_INT16_MODIFIER \"h\"\n# endif\n#else\n#error \"Platform not supported\"\n#endif\n#endif\n\n#ifndef UINT32_MAX\n# define UINT32_MAX (0xffffffffUL)\n#endif\n#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks)\n#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)\n typedef unsigned long uint32_t;\n# define UINT32_C(v) v ## UL\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"l\"\n# endif\n#elif (UINT_MAX == UINT32_MAX)\n typedef unsigned int uint32_t;\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n# define UINT32_C(v) v ## U\n#elif (USHRT_MAX == UINT32_MAX)\n typedef unsigned short uint32_t;\n# define UINT32_C(v) ((unsigned short) (v))\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n#else\n#error \"Platform not supported\"\n#endif\n#endif\n\n#ifndef INT32_MAX\n# define INT32_MAX (0x7fffffffL)\n#endif\n#ifndef INT32_MIN\n# define INT32_MIN INT32_C(0x80000000)\n#endif\n#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks)\n#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)\n typedef signed long int32_t;\n# define INT32_C(v) v ## L\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"l\"\n# endif\n#elif (INT_MAX == INT32_MAX)\n typedef signed int int32_t;\n# define INT32_C(v) v\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n#elif (SHRT_MAX == INT32_MAX)\n typedef signed short int32_t;\n# define INT32_C(v) ((short) (v))\n# ifndef PRINTF_INT32_MODIFIER\n# define PRINTF_INT32_MODIFIER \"\"\n# endif\n#else\n#error \"Platform not supported\"\n#endif\n#endif\n\n/*\n * The macro stdint_int64_defined is temporarily used to record\n * whether or not 64 integer support is available. It must be\n * defined for any 64 integer extensions for new platforms that are\n * added.\n */\n\n#undef stdint_int64_defined\n#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)\n# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)\n# define stdint_int64_defined\n typedef long long int64_t;\n typedef unsigned long long uint64_t;\n# define UINT64_C(v) v ## ULL\n# define INT64_C(v) v ## LL\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"ll\"\n# endif\n# endif\n#endif\n\n#if !defined (stdint_int64_defined)\n# if defined(__GNUC__) && !defined(vxWorks)\n# define stdint_int64_defined\n __extension__ typedef long long int64_t;\n __extension__ typedef unsigned long long uint64_t;\n# define UINT64_C(v) v ## ULL\n# define INT64_C(v) v ## LL\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"ll\"\n# endif\n# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)\n# define stdint_int64_defined\n typedef long long int64_t;\n typedef unsigned long long uint64_t;\n# define UINT64_C(v) v ## ULL\n# define INT64_C(v) v ## LL\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"ll\"\n# endif\n# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)\n# define stdint_int64_defined\n typedef __int64 int64_t;\n typedef unsigned __int64 uint64_t;\n# define UINT64_C(v) v ## UI64\n# define INT64_C(v) v ## I64\n# ifndef PRINTF_INT64_MODIFIER\n# define PRINTF_INT64_MODIFIER \"I64\"\n# endif\n# endif\n#endif\n\n#if !defined (LONG_LONG_MAX) && defined (INT64_C)\n# define LONG_LONG_MAX INT64_C (9223372036854775807)\n#endif\n#ifndef ULONG_LONG_MAX\n# define ULONG_LONG_MAX UINT64_C (18446744073709551615)\n#endif\n\n#if !defined (INT64_MAX) && defined (INT64_C)\n# define INT64_MAX INT64_C (9223372036854775807)\n#endif\n#if !defined (INT64_MIN) && defined (INT64_C)\n# define INT64_MIN INT64_C (-9223372036854775808)\n#endif\n#if !defined (UINT64_MAX) && defined (INT64_C)\n# define UINT64_MAX UINT64_C (18446744073709551615)\n#endif\n\n/*\n * Width of hexadecimal for number field.\n */\n\n#ifndef PRINTF_INT64_HEX_WIDTH\n# define PRINTF_INT64_HEX_WIDTH \"16\"\n#endif\n#ifndef PRINTF_INT32_HEX_WIDTH\n# define PRINTF_INT32_HEX_WIDTH \"8\"\n#endif\n#ifndef PRINTF_INT16_HEX_WIDTH\n# define PRINTF_INT16_HEX_WIDTH \"4\"\n#endif\n#ifndef PRINTF_INT8_HEX_WIDTH\n# define PRINTF_INT8_HEX_WIDTH \"2\"\n#endif\n#ifndef PRINTF_INT64_DEC_WIDTH\n# define PRINTF_INT64_DEC_WIDTH \"19\"\n#endif\n#ifndef PRINTF_INT32_DEC_WIDTH\n# define PRINTF_INT32_DEC_WIDTH \"10\"\n#endif\n#ifndef PRINTF_INT16_DEC_WIDTH\n# define PRINTF_INT16_DEC_WIDTH \"5\"\n#endif\n#ifndef PRINTF_INT8_DEC_WIDTH\n# define PRINTF_INT8_DEC_WIDTH \"3\"\n#endif\n#ifndef PRINTF_UINT64_DEC_WIDTH\n# define PRINTF_UINT64_DEC_WIDTH \"20\"\n#endif\n#ifndef PRINTF_UINT32_DEC_WIDTH\n# define PRINTF_UINT32_DEC_WIDTH \"10\"\n#endif\n#ifndef PRINTF_UINT16_DEC_WIDTH\n# define PRINTF_UINT16_DEC_WIDTH \"5\"\n#endif\n#ifndef PRINTF_UINT8_DEC_WIDTH\n# define PRINTF_UINT8_DEC_WIDTH \"3\"\n#endif\n\n/*\n * Ok, lets not worry about 128 bit integers for now. Moore's law says\n * we don't need to worry about that until about 2040 at which point\n * we'll have bigger things to worry about.\n */\n\n#ifdef stdint_int64_defined\n typedef int64_t intmax_t;\n typedef uint64_t uintmax_t;\n# define INTMAX_MAX INT64_MAX\n# define INTMAX_MIN INT64_MIN\n# define UINTMAX_MAX UINT64_MAX\n# define UINTMAX_C(v) UINT64_C(v)\n# define INTMAX_C(v) INT64_C(v)\n# ifndef PRINTF_INTMAX_MODIFIER\n# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER\n# endif\n# ifndef PRINTF_INTMAX_HEX_WIDTH\n# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH\n# endif\n# ifndef PRINTF_INTMAX_DEC_WIDTH\n# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH\n# endif\n#else\n typedef int32_t intmax_t;\n typedef uint32_t uintmax_t;\n# define INTMAX_MAX INT32_MAX\n# define UINTMAX_MAX UINT32_MAX\n# define UINTMAX_C(v) UINT32_C(v)\n# define INTMAX_C(v) INT32_C(v)\n# ifndef PRINTF_INTMAX_MODIFIER\n# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER\n# endif\n# ifndef PRINTF_INTMAX_HEX_WIDTH\n# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH\n# endif\n# ifndef PRINTF_INTMAX_DEC_WIDTH\n# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH\n# endif\n#endif\n\n/*\n * Because this file currently only supports platforms which have\n * precise powers of 2 as bit sizes for the default integers, the\n * least definitions are all trivial. Its possible that a future\n * version of this file could have different definitions.\n */\n\n#ifndef stdint_least_defined\n typedef int8_t int_least8_t;\n typedef uint8_t uint_least8_t;\n typedef int16_t int_least16_t;\n typedef uint16_t uint_least16_t;\n typedef int32_t int_least32_t;\n typedef uint32_t uint_least32_t;\n# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER\n# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER\n# define UINT_LEAST8_MAX UINT8_MAX\n# define INT_LEAST8_MAX INT8_MAX\n# define UINT_LEAST16_MAX UINT16_MAX\n# define INT_LEAST16_MAX INT16_MAX\n# define UINT_LEAST32_MAX UINT32_MAX\n# define INT_LEAST32_MAX INT32_MAX\n# define INT_LEAST8_MIN INT8_MIN\n# define INT_LEAST16_MIN INT16_MIN\n# define INT_LEAST32_MIN INT32_MIN\n# ifdef stdint_int64_defined\n typedef int64_t int_least64_t;\n typedef uint64_t uint_least64_t;\n# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER\n# define UINT_LEAST64_MAX UINT64_MAX\n# define INT_LEAST64_MAX INT64_MAX\n# define INT_LEAST64_MIN INT64_MIN\n# endif\n#endif\n#undef stdint_least_defined\n\n/*\n * The ANSI C committee pretending to know or specify anything about\n * performance is the epitome of misguided arrogance. The mandate of\n * this file is to *ONLY* ever support that absolute minimum\n * definition of the fast integer types, for compatibility purposes.\n * No extensions, and no attempt to suggest what may or may not be a\n * faster integer type will ever be made in this file. Developers are\n * warned to stay away from these types when using this or any other\n * stdint.h.\n */\n\ntypedef int_least8_t int_fast8_t;\ntypedef uint_least8_t uint_fast8_t;\ntypedef int_least16_t int_fast16_t;\ntypedef uint_least16_t uint_fast16_t;\ntypedef int_least32_t int_fast32_t;\ntypedef uint_least32_t uint_fast32_t;\n#define UINT_FAST8_MAX UINT_LEAST8_MAX\n#define INT_FAST8_MAX INT_LEAST8_MAX\n#define UINT_FAST16_MAX UINT_LEAST16_MAX\n#define INT_FAST16_MAX INT_LEAST16_MAX\n#define UINT_FAST32_MAX UINT_LEAST32_MAX\n#define INT_FAST32_MAX INT_LEAST32_MAX\n#define INT_FAST8_MIN INT_LEAST8_MIN\n#define INT_FAST16_MIN INT_LEAST16_MIN\n#define INT_FAST32_MIN INT_LEAST32_MIN\n#ifdef stdint_int64_defined\n typedef int_least64_t int_fast64_t;\n typedef uint_least64_t uint_fast64_t;\n# define UINT_FAST64_MAX UINT_LEAST64_MAX\n# define INT_FAST64_MAX INT_LEAST64_MAX\n# define INT_FAST64_MIN INT_LEAST64_MIN\n#endif\n\n#undef stdint_int64_defined\n\n/*\n * Whatever piecemeal, per compiler thing we can do about the wchar_t\n * type limits.\n */\n\n#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks)\n# include \n# ifndef WCHAR_MIN\n# define WCHAR_MIN 0\n# endif\n# ifndef WCHAR_MAX\n# define WCHAR_MAX ((wchar_t)-1)\n# endif\n#endif\n\n/*\n * Whatever piecemeal, per compiler/platform thing we can do about the\n * (u)intptr_t types and limits.\n */\n\n#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T)\n# define STDINT_H_UINTPTR_T_DEFINED\n#endif\n\n#ifndef STDINT_H_UINTPTR_T_DEFINED\n# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__)\n# define stdint_intptr_bits 64\n# elif defined (__WATCOMC__) || defined (__TURBOC__)\n# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)\n# define stdint_intptr_bits 16\n# else\n# define stdint_intptr_bits 32\n# endif\n# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__)\n# define stdint_intptr_bits 32\n# elif defined (__INTEL_COMPILER)\n/* TODO -- what did Intel do about x86-64? */\n# else\n/* #error \"This platform might not be supported yet\" */\n# endif\n\n# ifdef stdint_intptr_bits\n# define stdint_intptr_glue3_i(a,b,c) a##b##c\n# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)\n# ifndef PRINTF_INTPTR_MODIFIER\n# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)\n# endif\n# ifndef PTRDIFF_MAX\n# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)\n# endif\n# ifndef PTRDIFF_MIN\n# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)\n# endif\n# ifndef UINTPTR_MAX\n# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)\n# endif\n# ifndef INTPTR_MAX\n# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)\n# endif\n# ifndef INTPTR_MIN\n# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)\n# endif\n# ifndef INTPTR_C\n# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)\n# endif\n# ifndef UINTPTR_C\n# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)\n# endif\n typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;\n typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;\n# else\n/* TODO -- This following is likely wrong for some platforms, and does\n nothing for the definition of uintptr_t. */\n typedef ptrdiff_t intptr_t;\n# endif\n# define STDINT_H_UINTPTR_T_DEFINED\n#endif\n\n/*\n * Assumes sig_atomic_t is signed and we have a 2s complement machine.\n */\n\n#ifndef SIG_ATOMIC_MAX\n# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)\n#endif\n\n#endif\n\n#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)\n\n/*\n * Please compile with the maximum warning settings to make sure macros are\n * not defined more than once.\n */\n\n#include \n#include \n#include \n\n#define glue3_aux(x,y,z) x ## y ## z\n#define glue3(x,y,z) glue3_aux(x,y,z)\n\n#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0);\n#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0);\n\n#define DECL(us,bits) glue3(DECL,us,) (bits)\n\n#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf (\"Something wrong with UINT%d_MAX\\n\", bits)\n\n#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; }\n\nint main () {\n\tint err_n = 0;\n\tint err_first = 0;\n\tDECL(I,8)\n\tDECL(U,8)\n\tDECL(I,16)\n\tDECL(U,16)\n\tDECL(I,32)\n\tDECL(U,32)\n#ifdef INT64_MAX\n\tDECL(I,64)\n\tDECL(U,64)\n#endif\n\tintmax_t imax = INTMAX_C(0);\n\tuintmax_t umax = UINTMAX_C(0);\n\tchar str0[256], str1[256];\n\n\tsprintf (str0, \"%\" PRINTF_INT32_MODIFIER \"d\", INT32_C(2147483647));\n\tif (0 != strcmp (str0, \"2147483647\")) REPORTERROR ((\"Something wrong with PRINTF_INT32_MODIFIER : %s\\n\", str0));\n\tif (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR ((\"Something wrong with PRINTF_INT32_DEC_WIDTH : %s\\n\", PRINTF_INT32_DEC_WIDTH));\n\tsprintf (str0, \"%\" PRINTF_INT32_MODIFIER \"u\", UINT32_C(4294967295));\n\tif (0 != strcmp (str0, \"4294967295\")) REPORTERROR ((\"Something wrong with PRINTF_INT32_MODIFIER : %s\\n\", str0));\n\tif (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR ((\"Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\\n\", PRINTF_UINT32_DEC_WIDTH));\n#ifdef INT64_MAX\n\tsprintf (str1, \"%\" PRINTF_INT64_MODIFIER \"d\", INT64_C(9223372036854775807));\n\tif (0 != strcmp (str1, \"9223372036854775807\")) REPORTERROR ((\"Something wrong with PRINTF_INT32_MODIFIER : %s\\n\", str1));\n\tif (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR ((\"Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\\n\", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1)));\n\tsprintf (str1, \"%\" PRINTF_INT64_MODIFIER \"u\", UINT64_C(18446744073709550591));\n\tif (0 != strcmp (str1, \"18446744073709550591\")) REPORTERROR ((\"Something wrong with PRINTF_INT32_MODIFIER : %s\\n\", str1));\n\tif (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR ((\"Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\\n\", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1)));\n#endif\n\n\tsprintf (str0, \"%d %x\\n\", 0, ~0);\n\n\tsprintf (str1, \"%d %x\\n\", i8, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with i8 : %s\\n\", str1));\n\tsprintf (str1, \"%u %x\\n\", u8, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with u8 : %s\\n\", str1));\n\tsprintf (str1, \"%d %x\\n\", i16, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with i16 : %s\\n\", str1));\n\tsprintf (str1, \"%u %x\\n\", u16, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with u16 : %s\\n\", str1));\n\tsprintf (str1, \"%\" PRINTF_INT32_MODIFIER \"d %x\\n\", i32, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with i32 : %s\\n\", str1));\n\tsprintf (str1, \"%\" PRINTF_INT32_MODIFIER \"u %x\\n\", u32, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with u32 : %s\\n\", str1));\n#ifdef INT64_MAX\n\tsprintf (str1, \"%\" PRINTF_INT64_MODIFIER \"d %x\\n\", i64, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with i64 : %s\\n\", str1));\n#endif\n\tsprintf (str1, \"%\" PRINTF_INTMAX_MODIFIER \"d %x\\n\", imax, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with imax : %s\\n\", str1));\n\tsprintf (str1, \"%\" PRINTF_INTMAX_MODIFIER \"u %x\\n\", umax, ~0);\n\tif (0 != strcmp (str0, str1)) REPORTERROR ((\"Something wrong with umax : %s\\n\", str1));\n\n\tTESTUMAX(8);\n\tTESTUMAX(16);\n\tTESTUMAX(32);\n#ifdef INT64_MAX\n\tTESTUMAX(64);\n#endif\n\n#define STR(v) #v\n#define Q(v) printf (\"sizeof \" STR(v) \" = %u\\n\", (unsigned) sizeof (v));\n\tif (err_n) {\n\t\tprintf (\"pstdint.h is not correct. Please use sizes below to correct it:\\n\");\n\t}\n\n\tQ(int)\n\tQ(unsigned)\n\tQ(long int)\n\tQ(short int)\n\tQ(int8_t)\n\tQ(int16_t)\n\tQ(int32_t)\n#ifdef INT64_MAX\n\tQ(int64_t)\n#endif\n\n\treturn EXIT_SUCCESS;\n}\n\n#endif\n"}, {"path": "includes/assimp/Compiler/pushpack1.h", "language": "code", "loc": 37, "comment_density": 0.486, "code": "\n\n// ===============================================================================\n// May be included multiple times - sets structure packing to 1 \n// for all supported compilers. #include reverts the changes.\n//\n// Currently this works on the following compilers:\n// MSVC 7,8,9\n// GCC\n// BORLAND (complains about 'pack state changed but not reverted', but works)\n// Clang\n//\n//\n// USAGE:\n//\n// struct StructToBePacked {\n// } PACK_STRUCT;\n//\n// ===============================================================================\n\n#ifdef AI_PUSHPACK_IS_DEFINED\n#\terror poppack1.h must be included after pushpack1.h\n#endif\n\n#if defined(_MSC_VER) || defined(__BORLANDC__) ||\tdefined (__BCPLUSPLUS__)\n#\tpragma pack(push,1)\n#\tdefine PACK_STRUCT\n#elif defined( __GNUC__ )\n#\tif !defined(HOST_MINGW)\n#\t\tdefine PACK_STRUCT\t__attribute__((__packed__))\n#\telse\n#\t\tdefine PACK_STRUCT\t__attribute__((gcc_struct, __packed__))\n#\tendif\n#else\n#\terror Compiler not supported\n#endif\n\n#if defined(_MSC_VER)\n\n// C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop\n#\tpragma warning (disable : 4103) \n#endif\n\n#define AI_PUSHPACK_IS_DEFINED\n\n\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.448, "dedup_hash": "a018dd264b0fc5da", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_assimp_port_androidjni", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Androidjni", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/assimp/port/AndroidJNI/AndroidJNIIOSystem.h", "language": "code", "loc": 70, "comment_density": 0.714, "code": "/*\nOpen Asset Import Library (assimp)\n----------------------------------------------------------------------\n\nCopyright (c) 2006-2016, assimp team\nAll rights reserved.\n\nRedistribution and use of this software in source and binary forms,\nwith or without modification, are permitted provided that the\nfollowing conditions are met:\n\n* Redistributions of source code must retain the above\n copyright notice, this list of conditions and the\n following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the\n following disclaimer in the documentation and/or other\n materials provided with the distribution.\n\n* Neither the name of the assimp team, nor the names of its\n contributors may be used to endorse or promote products\n derived from this software without specific prior\n written permission of the assimp team.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n----------------------------------------------------------------------\n*/\n\n/** @file Android implementation of IOSystem using the standard C file functions.\n * Aimed to ease the access to android assets */\n\n#if __ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)\n#ifndef AI_ANDROIDJNIIOSYSTEM_H_INC\n#define AI_ANDROIDJNIIOSYSTEM_H_INC\n\n#include \"../code/DefaultIOSystem.h\"\n#include \n#include \n#include \n\nnamespace Assimp\t{\n\n// ---------------------------------------------------------------------------\n/** Android extension to DefaultIOSystem using the standard C file functions */\nclass ASSIMP_API AndroidJNIIOSystem : public DefaultIOSystem\n{\npublic:\n\n\t/** Initialize android activity data */\n\tstd::string mApkWorkspacePath;\n\tAAssetManager* mApkAssetManager;\n\n\t/** Constructor. */\n\tAndroidJNIIOSystem(ANativeActivity* activity);\n\n\t/** Destructor. */\n\t~AndroidJNIIOSystem();\n\n\t// -------------------------------------------------------------------\n\t/** Tests for the existence of a file at the given path. */\n\tbool Exists( const char* pFile) const;\n\n\t// -------------------------------------------------------------------\n\t/** Opens a file at the given path, with given mode */\n\tIOStream* Open( const char* strFile, const char* strMode);\n\n\t// ------------------------------------------------------------------------------------------------\n\t// Inits Android extractor\n\tvoid AndroidActivityInit(ANativeActivity* activity);\n\n\t// ------------------------------------------------------------------------------------------------\n\t// Extracts android asset\n\tbool AndroidExtractAsset(std::string name);\n\n};\n\n} //!ns Assimp\n\n#endif //AI_ANDROIDJNIIOSYSTEM_H_INC\n#endif //__ANDROID__ and __ANDROID_API__ > 9 and defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.714, "dedup_hash": "480014569876aa85", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_freetype", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Freetype", "api": "OpenGL Core", "glsl_version": null, "topic": "raymarching/shadows/bumpmapping/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "includes/freetype/freetype.h", "language": "code", "loc": 4579, "comment_density": 0.894, "code": "/****************************************************************************\n *\n * freetype.h\n *\n * FreeType high-level API and common types (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FREETYPE_H_\n#define FREETYPE_H_\n\n\n#ifndef FT_FREETYPE_H\n#error \"`ft2build.h' hasn't been included yet!\"\n#error \"Please always use macros to include FreeType header files.\"\n#error \"Example:\"\n#error \" #include \"\n#error \" #include FT_FREETYPE_H\"\n#endif\n\n\n#include \n#include FT_CONFIG_CONFIG_H\n#include FT_TYPES_H\n#include FT_ERRORS_H\n\n\nFT_BEGIN_HEADER\n\n\n\n /**************************************************************************\n *\n * @section:\n * header_inclusion\n *\n * @title:\n * FreeType's header inclusion scheme\n *\n * @abstract:\n * How client applications should include FreeType header files.\n *\n * @description:\n * To be as flexible as possible (and for historical reasons), FreeType\n * uses a very special inclusion scheme to load header files, for example\n *\n * ```\n * #include \n *\n * #include FT_FREETYPE_H\n * #include FT_OUTLINE_H\n * ```\n *\n * A compiler and its preprocessor only needs an include path to find the\n * file `ft2build.h`; the exact locations and names of the other FreeType\n * header files are hidden by @header_file_macros, loaded by\n * `ft2build.h`. The API documentation always gives the header macro\n * name needed for a particular function.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * user_allocation\n *\n * @title:\n * User allocation\n *\n * @abstract:\n * How client applications should allocate FreeType data structures.\n *\n * @description:\n * FreeType assumes that structures allocated by the user and passed as\n * arguments are zeroed out except for the actual data. In other words,\n * it is recommended to use `calloc` (or variants of it) instead of\n * `malloc` for allocation.\n *\n */\n\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* B A S I C T Y P E S */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @section:\n * base_interface\n *\n * @title:\n * Base Interface\n *\n * @abstract:\n * The FreeType~2 base font interface.\n *\n * @description:\n * This section describes the most important public high-level API\n * functions of FreeType~2.\n *\n * @order:\n * FT_Library\n * FT_Face\n * FT_Size\n * FT_GlyphSlot\n * FT_CharMap\n * FT_Encoding\n * FT_ENC_TAG\n *\n * FT_FaceRec\n *\n * FT_FACE_FLAG_SCALABLE\n * FT_FACE_FLAG_FIXED_SIZES\n * FT_FACE_FLAG_FIXED_WIDTH\n * FT_FACE_FLAG_HORIZONTAL\n * FT_FACE_FLAG_VERTICAL\n * FT_FACE_FLAG_COLOR\n * FT_FACE_FLAG_SFNT\n * FT_FACE_FLAG_CID_KEYED\n * FT_FACE_FLAG_TRICKY\n * FT_FACE_FLAG_KERNING\n * FT_FACE_FLAG_MULTIPLE_MASTERS\n * FT_FACE_FLAG_VARIATION\n * FT_FACE_FLAG_GLYPH_NAMES\n * FT_FACE_FLAG_EXTERNAL_STREAM\n * FT_FACE_FLAG_HINTER\n *\n * FT_HAS_HORIZONTAL\n * FT_HAS_VERTICAL\n * FT_HAS_KERNING\n * FT_HAS_FIXED_SIZES\n * FT_HAS_GLYPH_NAMES\n * FT_HAS_COLOR\n * FT_HAS_MULTIPLE_MASTERS\n *\n * FT_IS_SFNT\n * FT_IS_SCALABLE\n * FT_IS_FIXED_WIDTH\n * FT_IS_CID_KEYED\n * FT_IS_TRICKY\n * FT_IS_NAMED_INSTANCE\n * FT_IS_VARIATION\n *\n * FT_STYLE_FLAG_BOLD\n * FT_STYLE_FLAG_ITALIC\n *\n * FT_SizeRec\n * FT_Size_Metrics\n *\n * FT_GlyphSlotRec\n * FT_Glyph_Metrics\n * FT_SubGlyph\n *\n * FT_Bitmap_Size\n *\n * FT_Init_FreeType\n * FT_Done_FreeType\n *\n * FT_New_Face\n * FT_Done_Face\n * FT_Reference_Face\n * FT_New_Memory_Face\n * FT_Face_Properties\n * FT_Open_Face\n * FT_Open_Args\n * FT_Parameter\n * FT_Attach_File\n * FT_Attach_Stream\n *\n * FT_Set_Char_Size\n * FT_Set_Pixel_Sizes\n * FT_Request_Size\n * FT_Select_Size\n * FT_Size_Request_Type\n * FT_Size_RequestRec\n * FT_Size_Request\n * FT_Set_Transform\n * FT_Load_Glyph\n * FT_Get_Char_Index\n * FT_Get_First_Char\n * FT_Get_Next_Char\n * FT_Get_Name_Index\n * FT_Load_Char\n *\n * FT_OPEN_MEMORY\n * FT_OPEN_STREAM\n * FT_OPEN_PATHNAME\n * FT_OPEN_DRIVER\n * FT_OPEN_PARAMS\n *\n * FT_LOAD_DEFAULT\n * FT_LOAD_RENDER\n * FT_LOAD_MONOCHROME\n * FT_LOAD_LINEAR_DESIGN\n * FT_LOAD_NO_SCALE\n * FT_LOAD_NO_HINTING\n * FT_LOAD_NO_BITMAP\n * FT_LOAD_NO_AUTOHINT\n * FT_LOAD_COLOR\n *\n * FT_LOAD_VERTICAL_LAYOUT\n * FT_LOAD_IGNORE_TRANSFORM\n * FT_LOAD_FORCE_AUTOHINT\n * FT_LOAD_NO_RECURSE\n * FT_LOAD_PEDANTIC\n *\n * FT_LOAD_TARGET_NORMAL\n * FT_LOAD_TARGET_LIGHT\n * FT_LOAD_TARGET_MONO\n * FT_LOAD_TARGET_LCD\n * FT_LOAD_TARGET_LCD_V\n *\n * FT_LOAD_TARGET_MODE\n *\n * FT_Render_Glyph\n * FT_Render_Mode\n * FT_Get_Kerning\n * FT_Kerning_Mode\n * FT_Get_Track_Kerning\n * FT_Get_Glyph_Name\n * FT_Get_Postscript_Name\n *\n * FT_CharMapRec\n * FT_Select_Charmap\n * FT_Set_Charmap\n * FT_Get_Charmap_Index\n *\n * FT_Get_FSType_Flags\n * FT_Get_SubGlyph_Info\n *\n * FT_Face_Internal\n * FT_Size_Internal\n * FT_Slot_Internal\n *\n * FT_FACE_FLAG_XXX\n * FT_STYLE_FLAG_XXX\n * FT_OPEN_XXX\n * FT_LOAD_XXX\n * FT_LOAD_TARGET_XXX\n * FT_SUBGLYPH_FLAG_XXX\n * FT_FSTYPE_XXX\n *\n * FT_HAS_FAST_GLYPHS\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Glyph_Metrics\n *\n * @description:\n * A structure to model the metrics of a single glyph. The values are\n * expressed in 26.6 fractional pixel format; if the flag\n * @FT_LOAD_NO_SCALE has been used while loading the glyph, values are\n * expressed in font units instead.\n *\n * @fields:\n * width ::\n * The glyph's width.\n *\n * height ::\n * The glyph's height.\n *\n * horiBearingX ::\n * Left side bearing for horizontal layout.\n *\n * horiBearingY ::\n * Top side bearing for horizontal layout.\n *\n * horiAdvance ::\n * Advance width for horizontal layout.\n *\n * vertBearingX ::\n * Left side bearing for vertical layout.\n *\n * vertBearingY ::\n * Top side bearing for vertical layout. Larger positive values mean\n * further below the vertical glyph origin.\n *\n * vertAdvance ::\n * Advance height for vertical layout. Positive values mean the glyph\n * has a positive advance downward.\n *\n * @note:\n * If not disabled with @FT_LOAD_NO_HINTING, the values represent\n * dimensions of the hinted glyph (in case hinting is applicable).\n *\n * Stroking a glyph with an outside border does not increase\n * `horiAdvance` or `vertAdvance`; you have to manually adjust these\n * values to account for the added width and height.\n *\n * FreeType doesn't use the 'VORG' table data for CFF fonts because it\n * doesn't have an interface to quickly retrieve the glyph height. The\n * y~coordinate of the vertical origin can be simply computed as\n * `vertBearingY + height` after loading a glyph.\n */\n typedef struct FT_Glyph_Metrics_\n {\n FT_Pos width;\n FT_Pos height;\n\n FT_Pos horiBearingX;\n FT_Pos horiBearingY;\n FT_Pos horiAdvance;\n\n FT_Pos vertBearingX;\n FT_Pos vertBearingY;\n FT_Pos vertAdvance;\n\n } FT_Glyph_Metrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Bitmap_Size\n *\n * @description:\n * This structure models the metrics of a bitmap strike (i.e., a set of\n * glyphs for a given point size and resolution) in a bitmap font. It is\n * used for the `available_sizes` field of @FT_Face.\n *\n * @fields:\n * height ::\n * The vertical distance, in pixels, between two consecutive baselines.\n * It is always positive.\n *\n * width ::\n * The average width, in pixels, of all glyphs in the strike.\n *\n * size ::\n * The nominal size of the strike in 26.6 fractional points. This\n * field is not very useful.\n *\n * x_ppem ::\n * The horizontal ppem (nominal width) in 26.6 fractional pixels.\n *\n * y_ppem ::\n * The vertical ppem (nominal height) in 26.6 fractional pixels.\n *\n * @note:\n * Windows FNT:\n * The nominal size given in a FNT font is not reliable. If the driver\n * finds it incorrect, it sets `size` to some calculated values, and\n * `x_ppem` and `y_ppem` to the pixel width and height given in the\n * font, respectively.\n *\n * TrueType embedded bitmaps:\n * `size`, `width`, and `height` values are not contained in the bitmap\n * strike itself. They are computed from the global font parameters.\n */\n typedef struct FT_Bitmap_Size_\n {\n FT_Short height;\n FT_Short width;\n\n FT_Pos size;\n\n FT_Pos x_ppem;\n FT_Pos y_ppem;\n\n } FT_Bitmap_Size;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* O B J E C T C L A S S E S */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n /**************************************************************************\n *\n * @type:\n * FT_Library\n *\n * @description:\n * A handle to a FreeType library instance. Each 'library' is completely\n * independent from the others; it is the 'root' of a set of objects like\n * fonts, faces, sizes, etc.\n *\n * It also embeds a memory manager (see @FT_Memory), as well as a\n * scan-line converter object (see @FT_Raster).\n *\n * [Since 2.5.6] In multi-threaded applications it is easiest to use one\n * `FT_Library` object per thread. In case this is too cumbersome, a\n * single `FT_Library` object across threads is possible also, as long as\n * a mutex lock is used around @FT_New_Face and @FT_Done_Face.\n *\n * @note:\n * Library objects are normally created by @FT_Init_FreeType, and\n * destroyed with @FT_Done_FreeType. If you need reference-counting\n * (cf. @FT_Reference_Library), use @FT_New_Library and @FT_Done_Library.\n */\n typedef struct FT_LibraryRec_ *FT_Library;\n\n\n /**************************************************************************\n *\n * @section:\n * module_management\n *\n */\n\n /**************************************************************************\n *\n * @type:\n * FT_Module\n *\n * @description:\n * A handle to a given FreeType module object. A module can be a font\n * driver, a renderer, or anything else that provides services to the\n * former.\n */\n typedef struct FT_ModuleRec_* FT_Module;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Driver\n *\n * @description:\n * A handle to a given FreeType font driver object. A font driver is a\n * module capable of creating faces from font files.\n */\n typedef struct FT_DriverRec_* FT_Driver;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Renderer\n *\n * @description:\n * A handle to a given FreeType renderer. A renderer is a module in\n * charge of converting a glyph's outline image to a bitmap. It supports\n * a single glyph image format, and one or more target surface depths.\n */\n typedef struct FT_RendererRec_* FT_Renderer;\n\n\n /**************************************************************************\n *\n * @section:\n * base_interface\n *\n */\n\n /**************************************************************************\n *\n * @type:\n * FT_Face\n *\n * @description:\n * A handle to a typographic face object. A face object models a given\n * typeface, in a given style.\n *\n * @note:\n * A face object also owns a single @FT_GlyphSlot object, as well as one\n * or more @FT_Size objects.\n *\n * Use @FT_New_Face or @FT_Open_Face to create a new face object from a\n * given filepath or a custom input stream.\n *\n * Use @FT_Done_Face to destroy it (along with its slot and sizes).\n *\n * An `FT_Face` object can only be safely used from one thread at a time.\n * Similarly, creation and destruction of `FT_Face` with the same\n * @FT_Library object can only be done from one thread at a time. On the\n * other hand, functions like @FT_Load_Glyph and its siblings are\n * thread-safe and do not need the lock to be held as long as the same\n * `FT_Face` object is not used from multiple threads at the same time.\n *\n * @also:\n * See @FT_FaceRec for the publicly accessible fields of a given face\n * object.\n */\n typedef struct FT_FaceRec_* FT_Face;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Size\n *\n * @description:\n * A handle to an object that models a face scaled to a given character\n * size.\n *\n * @note:\n * An @FT_Face has one _active_ @FT_Size object that is used by functions\n * like @FT_Load_Glyph to determine the scaling transformation that in\n * turn is used to load and hint glyphs and metrics.\n *\n * You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size\n * or even @FT_Select_Size to change the content (i.e., the scaling\n * values) of the active @FT_Size.\n *\n * You can use @FT_New_Size to create additional size objects for a given\n * @FT_Face, but they won't be used by other functions until you activate\n * it through @FT_Activate_Size. Only one size can be activated at any\n * given time per face.\n *\n * @also:\n * See @FT_SizeRec for the publicly accessible fields of a given size\n * object.\n */\n typedef struct FT_SizeRec_* FT_Size;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_GlyphSlot\n *\n * @description:\n * A handle to a given 'glyph slot'. A slot is a container that can hold\n * any of the glyphs contained in its parent face.\n *\n * In other words, each time you call @FT_Load_Glyph or @FT_Load_Char,\n * the slot's content is erased by the new glyph data, i.e., the glyph's\n * metrics, its image (bitmap or outline), and other control information.\n *\n * @also:\n * See @FT_GlyphSlotRec for the publicly accessible glyph fields.\n */\n typedef struct FT_GlyphSlotRec_* FT_GlyphSlot;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_CharMap\n *\n * @description:\n * A handle to a character map (usually abbreviated to 'charmap'). A\n * charmap is used to translate character codes in a given encoding into\n * glyph indexes for its parent's face. Some font formats may provide\n * several charmaps per font.\n *\n * Each face object owns zero or more charmaps, but only one of them can\n * be 'active', providing the data used by @FT_Get_Char_Index or\n * @FT_Load_Char.\n *\n * The list of available charmaps in a face is available through the\n * `face->num_charmaps` and `face->charmaps` fields of @FT_FaceRec.\n *\n * The currently active charmap is available as `face->charmap`. You\n * should call @FT_Set_Charmap to change it.\n *\n * @note:\n * When a new face is created (either through @FT_New_Face or\n * @FT_Open_Face), the library looks for a Unicode charmap within the\n * list and automatically activates it. If there is no Unicode charmap,\n * FreeType doesn't set an 'active' charmap.\n *\n * @also:\n * See @FT_CharMapRec for the publicly accessible fields of a given\n * character map.\n */\n typedef struct FT_CharMapRec_* FT_CharMap;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ENC_TAG\n *\n * @description:\n * This macro converts four-letter tags into an unsigned long. It is\n * used to define 'encoding' identifiers (see @FT_Encoding).\n *\n * @note:\n * Since many 16-bit compilers don't like 32-bit enumerations, you should\n * redefine this macro in case of problems to something like this:\n *\n * ```\n * #define FT_ENC_TAG( value, a, b, c, d ) value\n * ```\n *\n * to get a simple enumeration without assigning special numbers.\n */\n\n#ifndef FT_ENC_TAG\n#define FT_ENC_TAG( value, a, b, c, d ) \\\n value = ( ( (FT_UInt32)(a) << 24 ) | \\\n ( (FT_UInt32)(b) << 16 ) | \\\n ( (FT_UInt32)(c) << 8 ) | \\\n (FT_UInt32)(d) )\n\n#endif /* FT_ENC_TAG */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Encoding\n *\n * @description:\n * An enumeration to specify character sets supported by charmaps. Used\n * in the @FT_Select_Charmap API function.\n *\n * @note:\n * Despite the name, this enumeration lists specific character\n * repertories (i.e., charsets), and not text encoding methods (e.g.,\n * UTF-8, UTF-16, etc.).\n *\n * Other encodings might be defined in the future.\n *\n * @values:\n * FT_ENCODING_NONE ::\n * The encoding value~0 is reserved for all formats except BDF, PCF,\n * and Windows FNT; see below for more information.\n *\n * FT_ENCODING_UNICODE ::\n * The Unicode character set. This value covers all versions of the\n * Unicode repertoire, including ASCII and Latin-1. Most fonts include\n * a Unicode charmap, but not all of them.\n *\n * For example, if you want to access Unicode value U+1F028 (and the\n * font contains it), use value 0x1F028 as the input value for\n * @FT_Get_Char_Index.\n *\n * FT_ENCODING_MS_SYMBOL ::\n * Microsoft Symbol encoding, used to encode mathematical symbols and\n * wingdings. For more information, see\n * 'https://www.microsoft.com/typography/otspec/recom.htm#non-standard-symbol-fonts',\n * 'http://www.kostis.net/charsets/symbol.htm', and\n * 'http://www.kostis.net/charsets/wingding.htm'.\n *\n * This encoding uses character codes from the PUA (Private Unicode\n * Area) in the range U+F020-U+F0FF.\n *\n * FT_ENCODING_SJIS ::\n * Shift JIS encoding for Japanese. More info at\n * 'https://en.wikipedia.org/wiki/Shift_JIS'. See note on multi-byte\n * encodings below.\n *\n * FT_ENCODING_PRC ::\n * Corresponds to encoding systems mainly for Simplified Chinese as\n * used in People's Republic of China (PRC). The encoding layout is\n * based on GB~2312 and its supersets GBK and GB~18030.\n *\n * FT_ENCODING_BIG5 ::\n * Corresponds to an encoding system for Traditional Chinese as used in\n * Taiwan and Hong Kong.\n *\n * FT_ENCODING_WANSUNG ::\n * Corresponds to the Korean encoding system known as Extended Wansung\n * (MS Windows code page 949). For more information see\n * 'https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit949.txt'.\n *\n * FT_ENCODING_JOHAB ::\n * The Korean standard character set (KS~C 5601-1992), which\n * corresponds to MS Windows code page 1361. This character set\n * includes all possible Hangul character combinations.\n *\n * FT_ENCODING_ADOBE_LATIN_1 ::\n * Corresponds to a Latin-1 encoding as defined in a Type~1 PostScript\n * font. It is limited to 256 character codes.\n *\n * FT_ENCODING_ADOBE_STANDARD ::\n * Adobe Standard encoding, as found in Type~1, CFF, and OpenType/CFF\n * fonts. It is limited to 256 character codes.\n *\n * FT_ENCODING_ADOBE_EXPERT ::\n * Adobe Expert encoding, as found in Type~1, CFF, and OpenType/CFF\n * fonts. It is limited to 256 character codes.\n *\n * FT_ENCODING_ADOBE_CUSTOM ::\n * Corresponds to a custom encoding, as found in Type~1, CFF, and\n * OpenType/CFF fonts. It is limited to 256 character codes.\n *\n * FT_ENCODING_APPLE_ROMAN ::\n * Apple roman encoding. Many TrueType and OpenType fonts contain a\n * charmap for this 8-bit encoding, since older versions of Mac OS are\n * able to use it.\n *\n * FT_ENCODING_OLD_LATIN_2 ::\n * This value is deprecated and was neither used nor reported by\n * FreeType. Don't use or test for it.\n *\n * FT_ENCODING_MS_SJIS ::\n * Same as FT_ENCODING_SJIS. Deprecated.\n *\n * FT_ENCODING_MS_GB2312 ::\n * Same as FT_ENCODING_PRC. Deprecated.\n *\n * FT_ENCODING_MS_BIG5 ::\n * Same as FT_ENCODING_BIG5. Deprecated.\n *\n * FT_ENCODING_MS_WANSUNG ::\n * Same as FT_ENCODING_WANSUNG. Deprecated.\n *\n * FT_ENCODING_MS_JOHAB ::\n * Same as FT_ENCODING_JOHAB. Deprecated.\n *\n * @note:\n * By default, FreeType enables a Unicode charmap and tags it with\n * `FT_ENCODING_UNICODE` when it is either provided or can be generated\n * from PostScript glyph name dictionaries in the font file. All other\n * encodings are considered legacy and tagged only if explicitly defined\n * in the font file. Otherwise, `FT_ENCODING_NONE` is used.\n *\n * `FT_ENCODING_NONE` is set by the BDF and PCF drivers if the charmap is\n * neither Unicode nor ISO-8859-1 (otherwise it is set to\n * `FT_ENCODING_UNICODE`). Use @FT_Get_BDF_Charset_ID to find out which\n * encoding is really present. If, for example, the `cs_registry` field\n * is 'KOI8' and the `cs_encoding` field is 'R', the font is encoded in\n * KOI8-R.\n *\n * `FT_ENCODING_NONE` is always set (with a single exception) by the\n * winfonts driver. Use @FT_Get_WinFNT_Header and examine the `charset`\n * field of the @FT_WinFNT_HeaderRec structure to find out which encoding\n * is really present. For example, @FT_WinFNT_ID_CP1251 (204) means\n * Windows code page 1251 (for Russian).\n *\n * `FT_ENCODING_NONE` is set if `platform_id` is @TT_PLATFORM_MACINTOSH\n * and `encoding_id` is not `TT_MAC_ID_ROMAN` (otherwise it is set to\n * `FT_ENCODING_APPLE_ROMAN`).\n *\n * If `platform_id` is @TT_PLATFORM_MACINTOSH, use the function\n * @FT_Get_CMap_Language_ID to query the Mac language ID that may be\n * needed to be able to distinguish Apple encoding variants. See\n *\n * https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt\n *\n * to get an idea how to do that. Basically, if the language ID is~0,\n * don't use it, otherwise subtract 1 from the language ID. Then examine\n * `encoding_id`. If, for example, `encoding_id` is `TT_MAC_ID_ROMAN`\n * and the language ID (minus~1) is `TT_MAC_LANGID_GREEK`, it is the\n * Greek encoding, not Roman. `TT_MAC_ID_ARABIC` with\n * `TT_MAC_LANGID_FARSI` means the Farsi variant the Arabic encoding.\n */\n typedef enum FT_Encoding_\n {\n FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),\n\n FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),\n FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),\n\n FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),\n FT_ENC_TAG( FT_ENCODING_PRC, 'g', 'b', ' ', ' ' ),\n FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),\n FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),\n FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),\n\n /* for backward compatibility */\n FT_ENCODING_GB2312 = FT_ENCODING_PRC,\n FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,\n FT_ENCODING_MS_GB2312 = FT_ENCODING_PRC,\n FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,\n FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,\n FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,\n\n FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),\n FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),\n FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ),\n FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ),\n\n FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ),\n\n FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' )\n\n } FT_Encoding;\n\n\n /* these constants are deprecated; use the corresponding `FT_Encoding` */\n /* values instead */\n#define ft_encoding_none FT_ENCODING_NONE\n#define ft_encoding_unicode FT_ENCODING_UNICODE\n#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL\n#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1\n#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2\n#define ft_encoding_sjis FT_ENCODING_SJIS\n#define ft_encoding_gb2312 FT_ENCODING_PRC\n#define ft_encoding_big5 FT_ENCODING_BIG5\n#define ft_encoding_wansung FT_ENCODING_WANSUNG\n#define ft_encoding_johab FT_ENCODING_JOHAB\n\n#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD\n#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT\n#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM\n#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_CharMapRec\n *\n * @description:\n * The base charmap structure.\n *\n * @fields:\n * face ::\n * A handle to the parent face object.\n *\n * encoding ::\n * An @FT_Encoding tag identifying the charmap. Use this with\n * @FT_Select_Charmap.\n *\n * platform_id ::\n * An ID number describing the platform for the following encoding ID.\n * This comes directly from the TrueType specification and gets\n * emulated for other formats.\n *\n * encoding_id ::\n * A platform-specific encoding number. This also comes from the\n * TrueType specification and gets emulated similarly.\n */\n typedef struct FT_CharMapRec_\n {\n FT_Face face;\n FT_Encoding encoding;\n FT_UShort platform_id;\n FT_UShort encoding_id;\n\n } FT_CharMapRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* B A S E O B J E C T C L A S S E S */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Face_Internal\n *\n * @description:\n * An opaque handle to an `FT_Face_InternalRec` structure that models the\n * private data of a given @FT_Face object.\n *\n * This structure might change between releases of FreeType~2 and is not\n * generally available to client applications.\n */\n typedef struct FT_Face_InternalRec_* FT_Face_Internal;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_FaceRec\n *\n * @description:\n * FreeType root face class structure. A face object models a typeface\n * in a font file.\n *\n * @fields:\n * num_faces ::\n * The number of faces in the font file. Some font formats can have\n * multiple faces in a single font file.\n *\n * face_index ::\n * This field holds two different values. Bits 0-15 are the index of\n * the face in the font file (starting with value~0). They are set\n * to~0 if there is only one face in the font file.\n *\n * [Since 2.6.1] Bits 16-30 are relevant to GX and OpenType variation\n * fonts only, holding the named instance index for the current face\n * index (starting with value~1; value~0 indicates font access without\n * a named instance). For non-variation fonts, bits 16-30 are ignored.\n * If we have the third named instance of face~4, say, `face_index` is\n * set to 0x00030004.\n *\n * Bit 31 is always zero (this is, `face_index` is always a positive\n * value).\n *\n * [Since 2.9] Changing the design coordinates with\n * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does\n * not influence the named instance index value (only\n * @FT_Set_Named_Instance does that).\n *\n * face_flags ::\n * A set of bit flags that give important information about the face;\n * see @FT_FACE_FLAG_XXX for the details.\n *\n * style_flags ::\n * The lower 16~bits contain a set of bit flags indicating the style of\n * the face; see @FT_STYLE_FLAG_XXX for the details.\n *\n * [Since 2.6.1] Bits 16-30 hold the number of named instances\n * available for the current face if we have a GX or OpenType variation\n * (sub)font. Bit 31 is always zero (this is, `style_flags` is always\n * a positive value). Note that a variation font has always at least\n * one named instance, namely the default instance.\n *\n * num_glyphs ::\n * The number of glyphs in the face. If the face is scalable and has\n * sbits (see `num_fixed_sizes`), it is set to the number of outline\n * glyphs.\n *\n * For CID-keyed fonts (not in an SFNT wrapper) this value gives the\n * highest CID used in the font.\n *\n * family_name ::\n * The face's family name. This is an ASCII string, usually in\n * English, that describes the typeface's family (like 'Times New\n * Roman', 'Bodoni', 'Garamond', etc). This is a least common\n * denominator used to list fonts. Some formats (TrueType & OpenType)\n * provide localized and Unicode versions of this string. Applications\n * should use the format-specific interface to access them. Can be\n * `NULL` (e.g., in fonts embedded in a PDF file).\n *\n * In case the font doesn't provide a specific family name entry,\n * FreeType tries to synthesize one, deriving it from other name\n * entries.\n *\n * style_name ::\n * The face's style name. This is an ASCII string, usually in English,\n * that describes the typeface's style (like 'Italic', 'Bold',\n * 'Condensed', etc). Not all font formats provide a style name, so\n * this field is optional, and can be set to `NULL`. As for\n * `family_name`, some formats provide localized and Unicode versions\n * of this string. Applications should use the format-specific\n * interface to access them.\n *\n * num_fixed_sizes ::\n * The number of bitmap strikes in the face. Even if the face is\n * scalable, there might still be bitmap strikes, which are called\n * 'sbits' in that case.\n *\n * available_sizes ::\n * An array of @FT_Bitmap_Size for all bitmap strikes in the face. It\n * is set to `NULL` if there is no bitmap strike.\n *\n * Note that FreeType tries to sanitize the strike data since they are\n * sometimes sloppy or incorrect, but this can easily fail.\n *\n * num_charmaps ::\n * The number of charmaps in the face.\n *\n * charmaps ::\n * An array of the charmaps of the face.\n *\n * generic ::\n * A field reserved for client uses. See the @FT_Generic type\n * description.\n *\n * bbox ::\n * The font bounding box. Coordinates are expressed in font units (see\n * `units_per_EM`). The box is large enough to contain any glyph from\n * the font. Thus, `bbox.yMax` can be seen as the 'maximum ascender',\n * and `bbox.yMin` as the 'minimum descender'. Only relevant for\n * scalable formats.\n *\n * Note that the bounding box might be off by (at least) one pixel for\n * hinted fonts. See @FT_Size_Metrics for further discussion.\n *\n * units_per_EM ::\n * The number of font units per EM square for this face. This is\n * typically 2048 for TrueType fonts, and 1000 for Type~1 fonts. Only\n * relevant for scalable formats.\n *\n * ascender ::\n * The typographic ascender of the face, expressed in font units. For\n * font formats not having this information, it is set to `bbox.yMax`.\n * Only relevant for scalable formats.\n *\n * descender ::\n * The typographic descender of the face, expressed in font units. For\n * font formats not having this information, it is set to `bbox.yMin`.\n * Note that this field is negative for values below the baseline.\n * Only relevant for scalable formats.\n *\n * height ::\n * This value is the vertical distance between two consecutive\n * baselines, expressed in font units. It is always positive. Only\n * relevant for scalable formats.\n *\n * If you want the global glyph height, use `ascender - descender`.\n *\n * max_advance_width ::\n * The maximum advance width, in font units, for all glyphs in this\n * face. This can be used to make word wrapping computations faster.\n * Only relevant for scalable formats.\n *\n * max_advance_height ::\n * The maximum advance height, in font units, for all glyphs in this\n * face. This is only relevant for vertical layouts, and is set to\n * `height` for fonts that do not provide vertical metrics. Only\n * relevant for scalable formats.\n *\n * underline_position ::\n * The position, in font units, of the underline line for this face.\n * It is the center of the underlining stem. Only relevant for\n * scalable formats.\n *\n * underline_thickness ::\n * The thickness, in font units, of the underline for this face. Only\n * relevant for scalable formats.\n *\n * glyph ::\n * The face's associated glyph slot(s).\n *\n * size ::\n * The current active size for this face.\n *\n * charmap ::\n * The current active charmap for this face.\n *\n * @note:\n * Fields may be changed after a call to @FT_Attach_File or\n * @FT_Attach_Stream.\n *\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `ascender`, `descender`, `height`,\n * `underline_position`, and `underline_thickness`.\n *\n * Especially for TrueType fonts see also the documentation for\n * @FT_Size_Metrics.\n */\n typedef struct FT_FaceRec_\n {\n FT_Long num_faces;\n FT_Long face_index;\n\n FT_Long face_flags;\n FT_Long style_flags;\n\n FT_Long num_glyphs;\n\n FT_String* family_name;\n FT_String* style_name;\n\n FT_Int num_fixed_sizes;\n FT_Bitmap_Size* available_sizes;\n\n FT_Int num_charmaps;\n FT_CharMap* charmaps;\n\n FT_Generic generic;\n\n /*# The following member variables (down to `underline_thickness`) */\n /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */\n /*# for bitmap fonts. */\n FT_BBox bbox;\n\n FT_UShort units_per_EM;\n FT_Short ascender;\n FT_Short descender;\n FT_Short height;\n\n FT_Short max_advance_width;\n FT_Short max_advance_height;\n\n FT_Short underline_position;\n FT_Short underline_thickness;\n\n FT_GlyphSlot glyph;\n FT_Size size;\n FT_CharMap charmap;\n\n /*@private begin */\n\n FT_Driver driver;\n FT_Memory memory;\n FT_Stream stream;\n\n FT_ListRec sizes_list;\n\n FT_Generic autohint; /* face-specific auto-hinter data */\n void* extensions; /* unused */\n\n FT_Face_Internal internal;\n\n /*@private end */\n\n } FT_FaceRec;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_FACE_FLAG_XXX\n *\n * @description:\n * A list of bit flags used in the `face_flags` field of the @FT_FaceRec\n * structure. They inform client applications of properties of the\n * corresponding face.\n *\n * @values:\n * FT_FACE_FLAG_SCALABLE ::\n * The face contains outline glyphs. Note that a face can contain\n * bitmap strikes also, i.e., a face can have both this flag and\n * @FT_FACE_FLAG_FIXED_SIZES set.\n *\n * FT_FACE_FLAG_FIXED_SIZES ::\n * The face contains bitmap strikes. See also the `num_fixed_sizes`\n * and `available_sizes` fields of @FT_FaceRec.\n *\n * FT_FACE_FLAG_FIXED_WIDTH ::\n * The face contains fixed-width characters (like Courier, Lucida,\n * MonoType, etc.).\n *\n * FT_FACE_FLAG_SFNT ::\n * The face uses the SFNT storage scheme. For now, this means TrueType\n * and OpenType.\n *\n * FT_FACE_FLAG_HORIZONTAL ::\n * The face contains horizontal glyph metrics. This should be set for\n * all common formats.\n *\n * FT_FACE_FLAG_VERTICAL ::\n * The face contains vertical glyph metrics. This is only available in\n * some formats, not all of them.\n *\n * FT_FACE_FLAG_KERNING ::\n * The face contains kerning information. If set, the kerning distance\n * can be retrieved using the function @FT_Get_Kerning. Otherwise the\n * function always return the vector (0,0). Note that FreeType doesn't\n * handle kerning data from the SFNT 'GPOS' table (as present in many\n * OpenType fonts).\n *\n * FT_FACE_FLAG_FAST_GLYPHS ::\n * THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT.\n *\n * FT_FACE_FLAG_MULTIPLE_MASTERS ::\n * The face contains multiple masters and is capable of interpolating\n * between them. Supported formats are Adobe MM, TrueType GX, and\n * OpenType variation fonts.\n *\n * See section @multiple_masters for API details.\n *\n * FT_FACE_FLAG_GLYPH_NAMES ::\n * The face contains glyph names, which can be retrieved using\n * @FT_Get_Glyph_Name. Note that some TrueType fonts contain broken\n * glyph name tables. Use the function @FT_Has_PS_Glyph_Names when\n * needed.\n *\n * FT_FACE_FLAG_EXTERNAL_STREAM ::\n * Used internally by FreeType to indicate that a face's stream was\n * provided by the client application and should not be destroyed when\n * @FT_Done_Face is called. Don't read or test this flag.\n *\n * FT_FACE_FLAG_HINTER ::\n * The font driver has a hinting machine of its own. For example, with\n * TrueType fonts, it makes sense to use data from the SFNT 'gasp'\n * table only if the native TrueType hinting engine (with the bytecode\n * interpreter) is available and active.\n *\n * FT_FACE_FLAG_CID_KEYED ::\n * The face is CID-keyed. In that case, the face is not accessed by\n * glyph indices but by CID values. For subsetted CID-keyed fonts this\n * has the consequence that not all index values are a valid argument\n * to @FT_Load_Glyph. Only the CID values for which corresponding\n * glyphs in the subsetted font exist make `FT_Load_Glyph` return\n * successfully; in all other cases you get an\n * `FT_Err_Invalid_Argument` error.\n *\n * Note that CID-keyed fonts that are in an SFNT wrapper (this is, all\n * OpenType/CFF fonts) don't have this flag set since the glyphs are\n * accessed in the normal way (using contiguous indices); the\n * 'CID-ness' isn't visible to the application.\n *\n * FT_FACE_FLAG_TRICKY ::\n * The face is 'tricky', this is, it always needs the font format's\n * native hinting engine to get a reasonable result. A typical example\n * is the old Chinese font `mingli.ttf` (but not `mingliu.ttc`) that\n * uses TrueType bytecode instructions to move and scale all of its\n * subglyphs.\n *\n * It is not possible to auto-hint such fonts using\n * @FT_LOAD_FORCE_AUTOHINT; it will also ignore @FT_LOAD_NO_HINTING.\n * You have to set both @FT_LOAD_NO_HINTING and @FT_LOAD_NO_AUTOHINT to\n * really disable hinting; however, you probably never want this except\n * for demonstration purposes.\n *\n * Currently, there are about a dozen TrueType fonts in the list of\n * tricky fonts; they are hard-coded in file `ttobjs.c`.\n *\n * FT_FACE_FLAG_COLOR ::\n * [Since 2.5.1] The face has color glyph tables. See @FT_LOAD_COLOR\n * for more information.\n *\n * FT_FACE_FLAG_VARIATION ::\n * [Since 2.9] Set if the current face (or named instance) has been\n * altered with @FT_Set_MM_Design_Coordinates,\n * @FT_Set_Var_Design_Coordinates, or @FT_Set_Var_Blend_Coordinates.\n * This flag is unset by a call to @FT_Set_Named_Instance.\n */\n#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )\n#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )\n#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )\n#define FT_FACE_FLAG_SFNT ( 1L << 3 )\n#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 )\n#define FT_FACE_FLAG_VERTICAL ( 1L << 5 )\n#define FT_FACE_FLAG_KERNING ( 1L << 6 )\n#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 )\n#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )\n#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )\n#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )\n#define FT_FACE_FLAG_HINTER ( 1L << 11 )\n#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 )\n#define FT_FACE_FLAG_TRICKY ( 1L << 13 )\n#define FT_FACE_FLAG_COLOR ( 1L << 14 )\n#define FT_FACE_FLAG_VARIATION ( 1L << 15 )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_HORIZONTAL\n *\n * @description:\n * A macro that returns true whenever a face object contains horizontal\n * metrics (this is true for all font formats though).\n *\n * @also:\n * @FT_HAS_VERTICAL can be used to check for vertical metrics.\n *\n */\n#define FT_HAS_HORIZONTAL( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_HORIZONTAL ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_VERTICAL\n *\n * @description:\n * A macro that returns true whenever a face object contains real\n * vertical metrics (and not only synthesized ones).\n *\n */\n#define FT_HAS_VERTICAL( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_VERTICAL ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_KERNING\n *\n * @description:\n * A macro that returns true whenever a face object contains kerning data\n * that can be accessed with @FT_Get_Kerning.\n *\n */\n#define FT_HAS_KERNING( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_KERNING ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_SCALABLE\n *\n * @description:\n * A macro that returns true whenever a face object contains a scalable\n * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, and\n * PFR font formats).\n *\n */\n#define FT_IS_SCALABLE( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_SCALABLE ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_SFNT\n *\n * @description:\n * A macro that returns true whenever a face object contains a font whose\n * format is based on the SFNT storage scheme. This usually means:\n * TrueType fonts, OpenType fonts, as well as SFNT-based embedded bitmap\n * fonts.\n *\n * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and\n * @FT_TRUETYPE_TABLES_H are available.\n *\n */\n#define FT_IS_SFNT( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_SFNT ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_FIXED_WIDTH\n *\n * @description:\n * A macro that returns true whenever a face object contains a font face\n * that contains fixed-width (or 'monospace', 'fixed-pitch', etc.)\n * glyphs.\n *\n */\n#define FT_IS_FIXED_WIDTH( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_FIXED_SIZES\n *\n * @description:\n * A macro that returns true whenever a face object contains some\n * embedded bitmaps. See the `available_sizes` field of the @FT_FaceRec\n * structure.\n *\n */\n#define FT_HAS_FIXED_SIZES( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_FAST_GLYPHS\n *\n * @description:\n * Deprecated.\n *\n */\n#define FT_HAS_FAST_GLYPHS( face ) 0\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_GLYPH_NAMES\n *\n * @description:\n * A macro that returns true whenever a face object contains some glyph\n * names that can be accessed through @FT_Get_Glyph_Name.\n *\n */\n#define FT_HAS_GLYPH_NAMES( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_MULTIPLE_MASTERS\n *\n * @description:\n * A macro that returns true whenever a face object contains some\n * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H\n * are then available to choose the exact design you want.\n *\n */\n#define FT_HAS_MULTIPLE_MASTERS( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_NAMED_INSTANCE\n *\n * @description:\n * A macro that returns true whenever a face object is a named instance\n * of a GX or OpenType variation font.\n *\n * [Since 2.9] Changing the design coordinates with\n * @FT_Set_Var_Design_Coordinates or @FT_Set_Var_Blend_Coordinates does\n * not influence the return value of this macro (only\n * @FT_Set_Named_Instance does that).\n *\n * @since:\n * 2.7\n *\n */\n#define FT_IS_NAMED_INSTANCE( face ) \\\n ( !!( (face)->face_index & 0x7FFF0000L ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_VARIATION\n *\n * @description:\n * A macro that returns true whenever a face object has been altered by\n * @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, or\n * @FT_Set_Var_Blend_Coordinates.\n *\n * @since:\n * 2.9\n *\n */\n#define FT_IS_VARIATION( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_VARIATION ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_CID_KEYED\n *\n * @description:\n * A macro that returns true whenever a face object contains a CID-keyed\n * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more details.\n *\n * If this macro is true, all functions defined in @FT_CID_H are\n * available.\n *\n */\n#define FT_IS_CID_KEYED( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_CID_KEYED ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IS_TRICKY\n *\n * @description:\n * A macro that returns true whenever a face represents a 'tricky' font.\n * See the discussion of @FT_FACE_FLAG_TRICKY for more details.\n *\n */\n#define FT_IS_TRICKY( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_TRICKY ) )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_HAS_COLOR\n *\n * @description:\n * A macro that returns true whenever a face object contains tables for\n * color glyphs.\n *\n * @since:\n * 2.5.1\n *\n */\n#define FT_HAS_COLOR( face ) \\\n ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_STYLE_FLAG_XXX\n *\n * @description:\n * A list of bit flags to indicate the style of a given face. These are\n * used in the `style_flags` field of @FT_FaceRec.\n *\n * @values:\n * FT_STYLE_FLAG_ITALIC ::\n * The face style is italic or oblique.\n *\n * FT_STYLE_FLAG_BOLD ::\n * The face is bold.\n *\n * @note:\n * The style information as provided by FreeType is very basic. More\n * details are beyond the scope and should be done on a higher level (for\n * example, by analyzing various fields of the 'OS/2' table in SFNT based\n * fonts).\n */\n#define FT_STYLE_FLAG_ITALIC ( 1 << 0 )\n#define FT_STYLE_FLAG_BOLD ( 1 << 1 )\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Size_Internal\n *\n * @description:\n * An opaque handle to an `FT_Size_InternalRec` structure, used to model\n * private data of a given @FT_Size object.\n */\n typedef struct FT_Size_InternalRec_* FT_Size_Internal;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Size_Metrics\n *\n * @description:\n * The size metrics structure gives the metrics of a size object.\n *\n * @fields:\n * x_ppem ::\n * The width of the scaled EM square in pixels, hence the term 'ppem'\n * (pixels per EM). It is also referred to as 'nominal width'.\n *\n * y_ppem ::\n * The height of the scaled EM square in pixels, hence the term 'ppem'\n * (pixels per EM). It is also referred to as 'nominal height'.\n *\n * x_scale ::\n * A 16.16 fractional scaling value to convert horizontal metrics from\n * font units to 26.6 fractional pixels. Only relevant for scalable\n * font formats.\n *\n * y_scale ::\n * A 16.16 fractional scaling value to convert vertical metrics from\n * font units to 26.6 fractional pixels. Only relevant for scalable\n * font formats.\n *\n * ascender ::\n * The ascender in 26.6 fractional pixels, rounded up to an integer\n * value. See @FT_FaceRec for the details.\n *\n * descender ::\n * The descender in 26.6 fractional pixels, rounded down to an integer\n * value. See @FT_FaceRec for the details.\n *\n * height ::\n * The height in 26.6 fractional pixels, rounded to an integer value.\n * See @FT_FaceRec for the details.\n *\n * max_advance ::\n * The maximum advance width in 26.6 fractional pixels, rounded to an\n * integer value. See @FT_FaceRec for the details.\n *\n * @note:\n * The scaling values, if relevant, are determined first during a size\n * changing operation. The remaining fields are then set by the driver.\n * For scalable formats, they are usually set to scaled values of the\n * corresponding fields in @FT_FaceRec. Some values like ascender or\n * descender are rounded for historical reasons; more precise values (for\n * outline fonts) can be derived by scaling the corresponding @FT_FaceRec\n * values manually, with code similar to the following.\n *\n * ```\n * scaled_ascender = FT_MulFix( face->ascender,\n * size_metrics->y_scale );\n * ```\n *\n * Note that due to glyph hinting and the selected rendering mode these\n * values are usually not exact; consequently, they must be treated as\n * unreliable with an error margin of at least one pixel!\n *\n * Indeed, the only way to get the exact metrics is to render _all_\n * glyphs. As this would be a definite performance hit, it is up to\n * client applications to perform such computations.\n *\n * The `FT_Size_Metrics` structure is valid for bitmap fonts also.\n *\n *\n * **TrueType fonts with native bytecode hinting**\n *\n * All applications that handle TrueType fonts with native hinting must\n * be aware that TTFs expect different rounding of vertical font\n * dimensions. The application has to cater for this, especially if it\n * wants to rely on a TTF's vertical data (for example, to properly align\n * box characters vertically).\n *\n * Only the application knows _in advance_ that it is going to use native\n * hinting for TTFs! FreeType, on the other hand, selects the hinting\n * mode not at the time of creating an @FT_Size object but much later,\n * namely while calling @FT_Load_Glyph.\n *\n * Here is some pseudo code that illustrates a possible solution.\n *\n * ```\n * font_format = FT_Get_Font_Format( face );\n *\n * if ( !strcmp( font_format, \"TrueType\" ) &&\n * do_native_bytecode_hinting )\n * {\n * ascender = ROUND( FT_MulFix( face->ascender,\n * size_metrics->y_scale ) );\n * descender = ROUND( FT_MulFix( face->descender,\n * size_metrics->y_scale ) );\n * }\n * else\n * {\n * ascender = size_metrics->ascender;\n * descender = size_metrics->descender;\n * }\n *\n * height = size_metrics->height;\n * max_advance = size_metrics->max_advance;\n * ```\n */\n typedef struct FT_Size_Metrics_\n {\n FT_UShort x_ppem; /* horizontal pixels per EM */\n FT_UShort y_ppem; /* vertical pixels per EM */\n\n FT_Fixed x_scale; /* scaling values used to convert font */\n FT_Fixed y_scale; /* units to 26.6 fractional pixels */\n\n FT_Pos ascender; /* ascender in 26.6 frac. pixels */\n FT_Pos descender; /* descender in 26.6 frac. pixels */\n FT_Pos height; /* text height in 26.6 frac. pixels */\n FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */\n\n } FT_Size_Metrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_SizeRec\n *\n * @description:\n * FreeType root size class structure. A size object models a face\n * object at a given size.\n *\n * @fields:\n * face ::\n * Handle to the parent face object.\n *\n * generic ::\n * A typeless pointer, unused by the FreeType library or any of its\n * drivers. It can be used by client applications to link their own\n * data to each size object.\n *\n * metrics ::\n * Metrics for this size object. This field is read-only.\n */\n typedef struct FT_SizeRec_\n {\n FT_Face face; /* parent face object */\n FT_Generic generic; /* generic pointer for client uses */\n FT_Size_Metrics metrics; /* size metrics */\n FT_Size_Internal internal;\n\n } FT_SizeRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_SubGlyph\n *\n * @description:\n * The subglyph structure is an internal object used to describe\n * subglyphs (for example, in the case of composites).\n *\n * @note:\n * The subglyph implementation is not part of the high-level API, hence\n * the forward structure declaration.\n *\n * You can however retrieve subglyph information with\n * @FT_Get_SubGlyph_Info.\n */\n typedef struct FT_SubGlyphRec_* FT_SubGlyph;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Slot_Internal\n *\n * @description:\n * An opaque handle to an `FT_Slot_InternalRec` structure, used to model\n * private data of a given @FT_GlyphSlot object.\n */\n typedef struct FT_Slot_InternalRec_* FT_Slot_Internal;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_GlyphSlotRec\n *\n * @description:\n * FreeType root glyph slot class structure. A glyph slot is a container\n * where individual glyphs can be loaded, be they in outline or bitmap\n * format.\n *\n * @fields:\n * library ::\n * A handle to the FreeType library instance this slot belongs to.\n *\n * face ::\n * A handle to the parent face object.\n *\n * next ::\n * In some cases (like some font tools), several glyph slots per face\n * object can be a good thing. As this is rare, the glyph slots are\n * listed through a direct, single-linked list using its `next` field.\n *\n * glyph_index ::\n * [Since 2.10] The glyph index passed as an argument to @FT_Load_Glyph\n * while initializing the glyph slot.\n *\n * generic ::\n * A typeless pointer unused by the FreeType library or any of its\n * drivers. It can be used by client applications to link their own\n * data to each glyph slot object.\n *\n * metrics ::\n * The metrics of the last loaded glyph in the slot. The returned\n * values depend on the last load flags (see the @FT_Load_Glyph API\n * function) and can be expressed either in 26.6 fractional pixels or\n * font units.\n *\n * Note that even when the glyph image is transformed, the metrics are\n * not.\n *\n * linearHoriAdvance ::\n * The advance width of the unhinted glyph. Its value is expressed in\n * 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when\n * loading the glyph. This field can be important to perform correct\n * WYSIWYG layout. Only relevant for outline glyphs.\n *\n * linearVertAdvance ::\n * The advance height of the unhinted glyph. Its value is expressed in\n * 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when\n * loading the glyph. This field can be important to perform correct\n * WYSIWYG layout. Only relevant for outline glyphs.\n *\n * advance ::\n * This shorthand is, depending on @FT_LOAD_IGNORE_TRANSFORM, the\n * transformed (hinted) advance width for the glyph, in 26.6 fractional\n * pixel format. As specified with @FT_LOAD_VERTICAL_LAYOUT, it uses\n * either the `horiAdvance` or the `vertAdvance` value of `metrics`\n * field.\n *\n * format ::\n * This field indicates the format of the image contained in the glyph\n * slot. Typically @FT_GLYPH_FORMAT_BITMAP, @FT_GLYPH_FORMAT_OUTLINE,\n * or @FT_GLYPH_FORMAT_COMPOSITE, but other values are possible.\n *\n * bitmap ::\n * This field is used as a bitmap descriptor. Note that the address\n * and content of the bitmap buffer can change between calls of\n * @FT_Load_Glyph and a few other functions.\n *\n * bitmap_left ::\n * The bitmap's left bearing expressed in integer pixels.\n *\n * bitmap_top ::\n * The bitmap's top bearing expressed in integer pixels. This is the\n * distance from the baseline to the top-most glyph scanline, upwards\n * y~coordinates being **positive**.\n *\n * outline ::\n * The outline descriptor for the current glyph image if its format is\n * @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is loaded, `outline` can be\n * transformed, distorted, emboldened, etc. However, it must not be\n * freed.\n *\n * [Since 2.10.1] If @FT_LOAD_NO_SCALE is set, outline coordinates of\n * OpenType variation fonts for a selected instance are internally\n * handled as 26.6 fractional font units but returned as (rounded)\n * integers, as expected. To get unrounded font units, don't use\n * @FT_LOAD_NO_SCALE but load the glyph with @FT_LOAD_NO_HINTING and\n * scale it, using the font's `units_per_EM` value as the ppem.\n *\n * num_subglyphs ::\n * The number of subglyphs in a composite glyph. This field is only\n * valid for the composite glyph format that should normally only be\n * loaded with the @FT_LOAD_NO_RECURSE flag.\n *\n * subglyphs ::\n * An array of subglyph descriptors for composite glyphs. There are\n * `num_subglyphs` elements in there. Currently internal to FreeType.\n *\n * control_data ::\n * Certain font drivers can also return the control data for a given\n * glyph image (e.g. TrueType bytecode, Type~1 charstrings, etc.).\n * This field is a pointer to such data; it is currently internal to\n * FreeType.\n *\n * control_len ::\n * This is the length in bytes of the control data. Currently internal\n * to FreeType.\n *\n * other ::\n * Reserved.\n *\n * lsb_delta ::\n * The difference between hinted and unhinted left side bearing while\n * auto-hinting is active. Zero otherwise.\n *\n * rsb_delta ::\n * The difference between hinted and unhinted right side bearing while\n * auto-hinting is active. Zero otherwise.\n *\n * @note:\n * If @FT_Load_Glyph is called with default flags (see @FT_LOAD_DEFAULT)\n * the glyph image is loaded in the glyph slot in its native format\n * (e.g., an outline glyph for TrueType and Type~1 formats). [Since 2.9]\n * The prospective bitmap metrics are calculated according to\n * @FT_LOAD_TARGET_XXX and other flags even for the outline glyph, even\n * if @FT_LOAD_RENDER is not set.\n *\n * This image can later be converted into a bitmap by calling\n * @FT_Render_Glyph. This function searches the current renderer for the\n * native image's format, then invokes it.\n *\n * The renderer is in charge of transforming the native image through the\n * slot's face transformation fields, then converting it into a bitmap\n * that is returned in `slot->bitmap`.\n *\n * Note that `slot->bitmap_left` and `slot->bitmap_top` are also used to\n * specify the position of the bitmap relative to the current pen\n * position (e.g., coordinates (0,0) on the baseline). Of course,\n * `slot->format` is also changed to @FT_GLYPH_FORMAT_BITMAP.\n *\n * Here is a small pseudo code fragment that shows how to use `lsb_delta`\n * and `rsb_delta` to do fractional positioning of glyphs:\n *\n * ```\n * FT_GlyphSlot slot = face->glyph;\n * FT_Pos origin_x = 0;\n *\n *\n * for all glyphs do\n * \n *\n * FT_Outline_Translate( slot->outline, origin_x & 63, 0 );\n *\n * \n *\n * \n *\n * origin_x += slot->advance.x;\n * origin_x += slot->lsb_delta - slot->rsb_delta;\n * endfor\n * ```\n *\n * Here is another small pseudo code fragment that shows how to use\n * `lsb_delta` and `rsb_delta` to improve integer positioning of glyphs:\n *\n * ```\n * FT_GlyphSlot slot = face->glyph;\n * FT_Pos origin_x = 0;\n * FT_Pos prev_rsb_delta = 0;\n *\n *\n * for all glyphs do\n * \n *\n * \n *\n * if ( prev_rsb_delta - slot->lsb_delta > 32 )\n * origin_x -= 64;\n * else if ( prev_rsb_delta - slot->lsb_delta < -31 )\n * origin_x += 64;\n *\n * prev_rsb_delta = slot->rsb_delta;\n *\n * \n *\n * origin_x += slot->advance.x;\n * endfor\n * ```\n *\n * If you use strong auto-hinting, you **must** apply these delta values!\n * Otherwise you will experience far too large inter-glyph spacing at\n * small rendering sizes in most cases. Note that it doesn't harm to use\n * the above code for other hinting modes also, since the delta values\n * are zero then.\n */\n typedef struct FT_GlyphSlotRec_\n {\n FT_Library library;\n FT_Face face;\n FT_GlyphSlot next;\n FT_UInt glyph_index; /* new in 2.10; was reserved previously */\n FT_Generic generic;\n\n FT_Glyph_Metrics metrics;\n FT_Fixed linearHoriAdvance;\n FT_Fixed linearVertAdvance;\n FT_Vector advance;\n\n FT_Glyph_Format format;\n\n FT_Bitmap bitmap;\n FT_Int bitmap_left;\n FT_Int bitmap_top;\n\n FT_Outline outline;\n\n FT_UInt num_subglyphs;\n FT_SubGlyph subglyphs;\n\n void* control_data;\n long control_len;\n\n FT_Pos lsb_delta;\n FT_Pos rsb_delta;\n\n void* other;\n\n FT_Slot_Internal internal;\n\n } FT_GlyphSlotRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* F U N C T I O N S */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Init_FreeType\n *\n * @description:\n * Initialize a new FreeType library object. The set of modules that are\n * registered by this function is determined at build time.\n *\n * @output:\n * alibrary ::\n * A handle to a new library object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * In case you want to provide your own memory allocating routines, use\n * @FT_New_Library instead, followed by a call to @FT_Add_Default_Modules\n * (or a series of calls to @FT_Add_Module) and\n * @FT_Set_Default_Properties.\n *\n * See the documentation of @FT_Library and @FT_Face for multi-threading\n * issues.\n *\n * If you need reference-counting (cf. @FT_Reference_Library), use\n * @FT_New_Library and @FT_Done_Library.\n *\n * If compilation option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES` is\n * set, this function reads the `FREETYPE_PROPERTIES` environment\n * variable to control driver properties. See section @properties for\n * more.\n */\n FT_EXPORT( FT_Error )\n FT_Init_FreeType( FT_Library *alibrary );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_FreeType\n *\n * @description:\n * Destroy a given FreeType library object and all of its children,\n * including resources, drivers, faces, sizes, etc.\n *\n * @input:\n * library ::\n * A handle to the target library object.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Done_FreeType( FT_Library library );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_OPEN_XXX\n *\n * @description:\n * A list of bit field constants used within the `flags` field of the\n * @FT_Open_Args structure.\n *\n * @values:\n * FT_OPEN_MEMORY ::\n * This is a memory-based stream.\n *\n * FT_OPEN_STREAM ::\n * Copy the stream from the `stream` field.\n *\n * FT_OPEN_PATHNAME ::\n * Create a new input stream from a C~path name.\n *\n * FT_OPEN_DRIVER ::\n * Use the `driver` field.\n *\n * FT_OPEN_PARAMS ::\n * Use the `num_params` and `params` fields.\n *\n * @note:\n * The `FT_OPEN_MEMORY`, `FT_OPEN_STREAM`, and `FT_OPEN_PATHNAME` flags\n * are mutually exclusive.\n */\n#define FT_OPEN_MEMORY 0x1\n#define FT_OPEN_STREAM 0x2\n#define FT_OPEN_PATHNAME 0x4\n#define FT_OPEN_DRIVER 0x8\n#define FT_OPEN_PARAMS 0x10\n\n\n /* these constants are deprecated; use the corresponding `FT_OPEN_XXX` */\n /* values instead */\n#define ft_open_memory FT_OPEN_MEMORY\n#define ft_open_stream FT_OPEN_STREAM\n#define ft_open_pathname FT_OPEN_PATHNAME\n#define ft_open_driver FT_OPEN_DRIVER\n#define ft_open_params FT_OPEN_PARAMS\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Parameter\n *\n * @description:\n * A simple structure to pass more or less generic parameters to\n * @FT_Open_Face and @FT_Face_Properties.\n *\n * @fields:\n * tag ::\n * A four-byte identification tag.\n *\n * data ::\n * A pointer to the parameter data.\n *\n * @note:\n * The ID and function of parameters are driver-specific. See section\n * @parameter_tags for more information.\n */\n typedef struct FT_Parameter_\n {\n FT_ULong tag;\n FT_Pointer data;\n\n } FT_Parameter;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Open_Args\n *\n * @description:\n * A structure to indicate how to open a new font file or stream. A\n * pointer to such a structure can be used as a parameter for the\n * functions @FT_Open_Face and @FT_Attach_Stream.\n *\n * @fields:\n * flags ::\n * A set of bit flags indicating how to use the structure.\n *\n * memory_base ::\n * The first byte of the file in memory.\n *\n * memory_size ::\n * The size in bytes of the file in memory.\n *\n * pathname ::\n * A pointer to an 8-bit file pathname. The pointer is not owned by\n * FreeType.\n *\n * stream ::\n * A handle to a source stream object.\n *\n * driver ::\n * This field is exclusively used by @FT_Open_Face; it simply specifies\n * the font driver to use for opening the face. If set to `NULL`,\n * FreeType tries to load the face with each one of the drivers in its\n * list.\n *\n * num_params ::\n * The number of extra parameters.\n *\n * params ::\n * Extra parameters passed to the font driver when opening a new face.\n *\n * @note:\n * The stream type is determined by the contents of `flags` that are\n * tested in the following order by @FT_Open_Face:\n *\n * If the @FT_OPEN_MEMORY bit is set, assume that this is a memory file\n * of `memory_size` bytes, located at `memory_address`. The data are not\n * copied, and the client is responsible for releasing and destroying\n * them _after_ the corresponding call to @FT_Done_Face.\n *\n * Otherwise, if the @FT_OPEN_STREAM bit is set, assume that a custom\n * input stream `stream` is used.\n *\n * Otherwise, if the @FT_OPEN_PATHNAME bit is set, assume that this is a\n * normal file and use `pathname` to open it.\n *\n * If the @FT_OPEN_DRIVER bit is set, @FT_Open_Face only tries to open\n * the file with the driver whose handler is in `driver`.\n *\n * If the @FT_OPEN_PARAMS bit is set, the parameters given by\n * `num_params` and `params` is used. They are ignored otherwise.\n *\n * Ideally, both the `pathname` and `params` fields should be tagged as\n * 'const'; this is missing for API backward compatibility. In other\n * words, applications should treat them as read-only.\n */\n typedef struct FT_Open_Args_\n {\n FT_UInt flags;\n const FT_Byte* memory_base;\n FT_Long memory_size;\n FT_String* pathname;\n FT_Stream stream;\n FT_Module driver;\n FT_Int num_params;\n FT_Parameter* params;\n\n } FT_Open_Args;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Face\n *\n * @description:\n * Call @FT_Open_Face to open a font by its pathname.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * pathname ::\n * A path to the font file.\n *\n * face_index ::\n * See @FT_Open_Face for a detailed description of this parameter.\n *\n * @output:\n * aface ::\n * A handle to a new face object. If `face_index` is greater than or\n * equal to zero, it must be non-`NULL`.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Use @FT_Done_Face to destroy the created @FT_Face object (along with\n * its slot and sizes).\n */\n FT_EXPORT( FT_Error )\n FT_New_Face( FT_Library library,\n const char* filepathname,\n FT_Long face_index,\n FT_Face *aface );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Memory_Face\n *\n * @description:\n * Call @FT_Open_Face to open a font that has been loaded into memory.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * file_base ::\n * A pointer to the beginning of the font data.\n *\n * file_size ::\n * The size of the memory chunk used by the font data.\n *\n * face_index ::\n * See @FT_Open_Face for a detailed description of this parameter.\n *\n * @output:\n * aface ::\n * A handle to a new face object. If `face_index` is greater than or\n * equal to zero, it must be non-`NULL`.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You must not deallocate the memory before calling @FT_Done_Face.\n */\n FT_EXPORT( FT_Error )\n FT_New_Memory_Face( FT_Library library,\n const FT_Byte* file_base,\n FT_Long file_size,\n FT_Long face_index,\n FT_Face *aface );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Open_Face\n *\n * @description:\n * Create a face object from a given resource described by @FT_Open_Args.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * args ::\n * A pointer to an `FT_Open_Args` structure that must be filled by the\n * caller.\n *\n * face_index ::\n * This field holds two different values. Bits 0-15 are the index of\n * the face in the font file (starting with value~0). Set it to~0 if\n * there is only one face in the font file.\n *\n * [Since 2.6.1] Bits 16-30 are relevant to GX and OpenType variation\n * fonts only, specifying the named instance index for the current face\n * index (starting with value~1; value~0 makes FreeType ignore named\n * instances). For non-variation fonts, bits 16-30 are ignored.\n * Assuming that you want to access the third named instance in face~4,\n * `face_index` should be set to 0x00030004. If you want to access\n * face~4 without variation handling, simply set `face_index` to\n * value~4.\n *\n * `FT_Open_Face` and its siblings can be used to quickly check whether\n * the font format of a given font resource is supported by FreeType.\n * In general, if the `face_index` argument is negative, the function's\n * return value is~0 if the font format is recognized, or non-zero\n * otherwise. The function allocates a more or less empty face handle\n * in `*aface` (if `aface` isn't `NULL`); the only two useful fields in\n * this special case are `face->num_faces` and `face->style_flags`.\n * For any negative value of `face_index`, `face->num_faces` gives the\n * number of faces within the font file. For the negative value\n * '-(N+1)' (with 'N' a non-negative 16-bit value), bits 16-30 in\n * `face->style_flags` give the number of named instances in face 'N'\n * if we have a variation font (or zero otherwise). After examination,\n * the returned @FT_Face structure should be deallocated with a call to\n * @FT_Done_Face.\n *\n * @output:\n * aface ::\n * A handle to a new face object. If `face_index` is greater than or\n * equal to zero, it must be non-`NULL`.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Unlike FreeType 1.x, this function automatically creates a glyph slot\n * for the face object that can be accessed directly through\n * `face->glyph`.\n *\n * Each new face object created with this function also owns a default\n * @FT_Size object, accessible as `face->size`.\n *\n * One @FT_Library instance can have multiple face objects, this is,\n * @FT_Open_Face and its siblings can be called multiple times using the\n * same `library` argument.\n *\n * See the discussion of reference counters in the description of\n * @FT_Reference_Face.\n *\n * @example:\n * To loop over all faces, use code similar to the following snippet\n * (omitting the error handling).\n *\n * ```\n * ...\n * FT_Face face;\n * FT_Long i, num_faces;\n *\n *\n * error = FT_Open_Face( library, args, -1, &face );\n * if ( error ) { ... }\n *\n * num_faces = face->num_faces;\n * FT_Done_Face( face );\n *\n * for ( i = 0; i < num_faces; i++ )\n * {\n * ...\n * error = FT_Open_Face( library, args, i, &face );\n * ...\n * FT_Done_Face( face );\n * ...\n * }\n * ```\n *\n * To loop over all valid values for `face_index`, use something similar\n * to the following snippet, again without error handling. The code\n * accesses all faces immediately (thus only a single call of\n * `FT_Open_Face` within the do-loop), with and without named instances.\n *\n * ```\n * ...\n * FT_Face face;\n *\n * FT_Long num_faces = 0;\n * FT_Long num_instances = 0;\n *\n * FT_Long face_idx = 0;\n * FT_Long instance_idx = 0;\n *\n *\n * do\n * {\n * FT_Long id = ( instance_idx << 16 ) + face_idx;\n *\n *\n * error = FT_Open_Face( library, args, id, &face );\n * if ( error ) { ... }\n *\n * num_faces = face->num_faces;\n * num_instances = face->style_flags >> 16;\n *\n * ...\n *\n * FT_Done_Face( face );\n *\n * if ( instance_idx < num_instances )\n * instance_idx++;\n * else\n * {\n * face_idx++;\n * instance_idx = 0;\n * }\n *\n * } while ( face_idx < num_faces )\n * ```\n */\n FT_EXPORT( FT_Error )\n FT_Open_Face( FT_Library library,\n const FT_Open_Args* args,\n FT_Long face_index,\n FT_Face *aface );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Attach_File\n *\n * @description:\n * Call @FT_Attach_Stream to attach a file.\n *\n * @inout:\n * face ::\n * The target face object.\n *\n * @input:\n * filepathname ::\n * The pathname.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Attach_File( FT_Face face,\n const char* filepathname );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Attach_Stream\n *\n * @description:\n * 'Attach' data to a face object. Normally, this is used to read\n * additional information for the face object. For example, you can\n * attach an AFM file that comes with a Type~1 font to get the kerning\n * values and other metrics.\n *\n * @inout:\n * face ::\n * The target face object.\n *\n * @input:\n * parameters ::\n * A pointer to @FT_Open_Args that must be filled by the caller.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The meaning of the 'attach' (i.e., what really happens when the new\n * file is read) is not fixed by FreeType itself. It really depends on\n * the font format (and thus the font driver).\n *\n * Client applications are expected to know what they are doing when\n * invoking this function. Most drivers simply do not implement file or\n * stream attachments.\n */\n FT_EXPORT( FT_Error )\n FT_Attach_Stream( FT_Face face,\n FT_Open_Args* parameters );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Reference_Face\n *\n * @description:\n * A counter gets initialized to~1 at the time an @FT_Face structure is\n * created. This function increments the counter. @FT_Done_Face then\n * only destroys a face if the counter is~1, otherwise it simply\n * decrements the counter.\n *\n * This function helps in managing life-cycles of structures that\n * reference @FT_Face objects.\n *\n * @input:\n * face ::\n * A handle to a target face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.4.2\n */\n FT_EXPORT( FT_Error )\n FT_Reference_Face( FT_Face face );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Face\n *\n * @description:\n * Discard a given face object, as well as all of its child slots and\n * sizes.\n *\n * @input:\n * face ::\n * A handle to a target face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * See the discussion of reference counters in the description of\n * @FT_Reference_Face.\n */\n FT_EXPORT( FT_Error )\n FT_Done_Face( FT_Face face );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Select_Size\n *\n * @description:\n * Select a bitmap strike. To be more precise, this function sets the\n * scaling factors of the active @FT_Size object in a face so that\n * bitmaps from this particular strike are taken by @FT_Load_Glyph and\n * friends.\n *\n * @inout:\n * face ::\n * A handle to a target face object.\n *\n * @input:\n * strike_index ::\n * The index of the bitmap strike in the `available_sizes` field of\n * @FT_FaceRec structure.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * For bitmaps embedded in outline fonts it is common that only a subset\n * of the available glyphs at a given ppem value is available. FreeType\n * silently uses outlines if there is no bitmap for a given glyph index.\n *\n * For GX and OpenType variation fonts, a bitmap strike makes sense only\n * if the default instance is active (this is, no glyph variation takes\n * place); otherwise, FreeType simply ignores bitmap strikes. The same\n * is true for all named instances that are different from the default\n * instance.\n *\n * Don't use this function if you are using the FreeType cache API.\n */\n FT_EXPORT( FT_Error )\n FT_Select_Size( FT_Face face,\n FT_Int strike_index );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Size_Request_Type\n *\n * @description:\n * An enumeration type that lists the supported size request types, i.e.,\n * what input size (in font units) maps to the requested output size (in\n * pixels, as computed from the arguments of @FT_Size_Request).\n *\n * @values:\n * FT_SIZE_REQUEST_TYPE_NOMINAL ::\n * The nominal size. The `units_per_EM` field of @FT_FaceRec is used\n * to determine both scaling values.\n *\n * This is the standard scaling found in most applications. In\n * particular, use this size request type for TrueType fonts if they\n * provide optical scaling or something similar. Note, however, that\n * `units_per_EM` is a rather abstract value which bears no relation to\n * the actual size of the glyphs in a font.\n *\n * FT_SIZE_REQUEST_TYPE_REAL_DIM ::\n * The real dimension. The sum of the `ascender` and (minus of) the\n * `descender` fields of @FT_FaceRec is used to determine both scaling\n * values.\n *\n * FT_SIZE_REQUEST_TYPE_BBOX ::\n * The font bounding box. The width and height of the `bbox` field of\n * @FT_FaceRec are used to determine the horizontal and vertical\n * scaling value, respectively.\n *\n * FT_SIZE_REQUEST_TYPE_CELL ::\n * The `max_advance_width` field of @FT_FaceRec is used to determine\n * the horizontal scaling value; the vertical scaling value is\n * determined the same way as @FT_SIZE_REQUEST_TYPE_REAL_DIM does.\n * Finally, both scaling values are set to the smaller one. This type\n * is useful if you want to specify the font size for, say, a window of\n * a given dimension and 80x24 cells.\n *\n * FT_SIZE_REQUEST_TYPE_SCALES ::\n * Specify the scaling values directly.\n *\n * @note:\n * The above descriptions only apply to scalable formats. For bitmap\n * formats, the behaviour is up to the driver.\n *\n * See the note section of @FT_Size_Metrics if you wonder how size\n * requesting relates to scaling values.\n */\n typedef enum FT_Size_Request_Type_\n {\n FT_SIZE_REQUEST_TYPE_NOMINAL,\n FT_SIZE_REQUEST_TYPE_REAL_DIM,\n FT_SIZE_REQUEST_TYPE_BBOX,\n FT_SIZE_REQUEST_TYPE_CELL,\n FT_SIZE_REQUEST_TYPE_SCALES,\n\n FT_SIZE_REQUEST_TYPE_MAX\n\n } FT_Size_Request_Type;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Size_RequestRec\n *\n * @description:\n * A structure to model a size request.\n *\n * @fields:\n * type ::\n * See @FT_Size_Request_Type.\n *\n * width ::\n * The desired width, given as a 26.6 fractional point value (with 72pt\n * = 1in).\n *\n * height ::\n * The desired height, given as a 26.6 fractional point value (with\n * 72pt = 1in).\n *\n * horiResolution ::\n * The horizontal resolution (dpi, i.e., pixels per inch). If set to\n * zero, `width` is treated as a 26.6 fractional **pixel** value, which\n * gets internally rounded to an integer.\n *\n * vertResolution ::\n * The vertical resolution (dpi, i.e., pixels per inch). If set to\n * zero, `height` is treated as a 26.6 fractional **pixel** value,\n * which gets internally rounded to an integer.\n *\n * @note:\n * If `width` is zero, the horizontal scaling value is set equal to the\n * vertical scaling value, and vice versa.\n *\n * If `type` is `FT_SIZE_REQUEST_TYPE_SCALES`, `width` and `height` are\n * interpreted directly as 16.16 fractional scaling values, without any\n * further modification, and both `horiResolution` and `vertResolution`\n * are ignored.\n */\n typedef struct FT_Size_RequestRec_\n {\n FT_Size_Request_Type type;\n FT_Long width;\n FT_Long height;\n FT_UInt horiResolution;\n FT_UInt vertResolution;\n\n } FT_Size_RequestRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Size_Request\n *\n * @description:\n * A handle to a size request structure.\n */\n typedef struct FT_Size_RequestRec_ *FT_Size_Request;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Request_Size\n *\n * @description:\n * Resize the scale of the active @FT_Size object in a face.\n *\n * @inout:\n * face ::\n * A handle to a target face object.\n *\n * @input:\n * req ::\n * A pointer to a @FT_Size_RequestRec.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Although drivers may select the bitmap strike matching the request,\n * you should not rely on this if you intend to select a particular\n * bitmap strike. Use @FT_Select_Size instead in that case.\n *\n * The relation between the requested size and the resulting glyph size\n * is dependent entirely on how the size is defined in the source face.\n * The font designer chooses the final size of each glyph relative to\n * this size. For more information refer to\n * 'https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'.\n *\n * Contrary to @FT_Set_Char_Size, this function doesn't have special code\n * to normalize zero-valued widths, heights, or resolutions (which lead\n * to errors in most cases).\n *\n * Don't use this function if you are using the FreeType cache API.\n */\n FT_EXPORT( FT_Error )\n FT_Request_Size( FT_Face face,\n FT_Size_Request req );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Char_Size\n *\n * @description:\n * Call @FT_Request_Size to request the nominal size (in points).\n *\n * @inout:\n * face ::\n * A handle to a target face object.\n *\n * @input:\n * char_width ::\n * The nominal width, in 26.6 fractional points.\n *\n * char_height ::\n * The nominal height, in 26.6 fractional points.\n *\n * horz_resolution ::\n * The horizontal resolution in dpi.\n *\n * vert_resolution ::\n * The vertical resolution in dpi.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * While this function allows fractional points as input values, the\n * resulting ppem value for the given resolution is always rounded to the\n * nearest integer.\n *\n * If either the character width or height is zero, it is set equal to\n * the other value.\n *\n * If either the horizontal or vertical resolution is zero, it is set\n * equal to the other value.\n *\n * A character width or height smaller than 1pt is set to 1pt; if both\n * resolution values are zero, they are set to 72dpi.\n *\n * Don't use this function if you are using the FreeType cache API.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Char_Size( FT_Face face,\n FT_F26Dot6 char_width,\n FT_F26Dot6 char_height,\n FT_UInt horz_resolution,\n FT_UInt vert_resolution );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Pixel_Sizes\n *\n * @description:\n * Call @FT_Request_Size to request the nominal size (in pixels).\n *\n * @inout:\n * face ::\n * A handle to the target face object.\n *\n * @input:\n * pixel_width ::\n * The nominal width, in pixels.\n *\n * pixel_height ::\n * The nominal height, in pixels.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should not rely on the resulting glyphs matching or being\n * constrained to this pixel size. Refer to @FT_Request_Size to\n * understand how requested sizes relate to actual sizes.\n *\n * Don't use this function if you are using the FreeType cache API.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Pixel_Sizes( FT_Face face,\n FT_UInt pixel_width,\n FT_UInt pixel_height );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Load_Glyph\n *\n * @description:\n * Load a glyph into the glyph slot of a face object.\n *\n * @inout:\n * face ::\n * A handle to the target face object where the glyph is loaded.\n *\n * @input:\n * glyph_index ::\n * The index of the glyph in the font file. For CID-keyed fonts\n * (either in PS or in CFF format) this argument specifies the CID\n * value.\n *\n * load_flags ::\n * A flag indicating what to load for this glyph. The @FT_LOAD_XXX\n * constants can be used to control the glyph loading process (e.g.,\n * whether the outline should be scaled, whether to load bitmaps or\n * not, whether to hint the outline, etc).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The loaded glyph may be transformed. See @FT_Set_Transform for the\n * details.\n *\n * For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument` is returned\n * for invalid CID values (this is, for CID values that don't have a\n * corresponding glyph in the font). See the discussion of the\n * @FT_FACE_FLAG_CID_KEYED flag for more details.\n *\n * If you receive `FT_Err_Glyph_Too_Big`, try getting the glyph outline\n * at EM size, then scale it manually and fill it as a graphics\n * operation.\n */\n FT_EXPORT( FT_Error )\n FT_Load_Glyph( FT_Face face,\n FT_UInt glyph_index,\n FT_Int32 load_flags );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Load_Char\n *\n * @description:\n * Load a glyph into the glyph slot of a face object, accessed by its\n * character code.\n *\n * @inout:\n * face ::\n * A handle to a target face object where the glyph is loaded.\n *\n * @input:\n * char_code ::\n * The glyph's character code, according to the current charmap used in\n * the face.\n *\n * load_flags ::\n * A flag indicating what to load for this glyph. The @FT_LOAD_XXX\n * constants can be used to control the glyph loading process (e.g.,\n * whether the outline should be scaled, whether to load bitmaps or\n * not, whether to hint the outline, etc).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph.\n *\n * Many fonts contain glyphs that can't be loaded by this function since\n * its glyph indices are not listed in any of the font's charmaps.\n *\n * If no active cmap is set up (i.e., `face->charmap` is zero), the call\n * to @FT_Get_Char_Index is omitted, and the function behaves identically\n * to @FT_Load_Glyph.\n */\n FT_EXPORT( FT_Error )\n FT_Load_Char( FT_Face face,\n FT_ULong char_code,\n FT_Int32 load_flags );\n\n\n /**********************"}, {"path": "includes/freetype/ftadvanc.h", "language": "code", "loc": 167, "comment_density": 0.862, "code": "/****************************************************************************\n *\n * ftadvanc.h\n *\n * Quick computation of advance widths (specification only).\n *\n * Copyright (C) 2008-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTADVANC_H_\n#define FTADVANC_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * quick_advance\n *\n * @title:\n * Quick retrieval of advance values\n *\n * @abstract:\n * Retrieve horizontal and vertical advance values without processing\n * glyph outlines, if possible.\n *\n * @description:\n * This section contains functions to quickly extract advance values\n * without handling glyph outlines, if possible.\n *\n * @order:\n * FT_Get_Advance\n * FT_Get_Advances\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_ADVANCE_FLAG_FAST_ONLY\n *\n * @description:\n * A bit-flag to be OR-ed with the `flags` parameter of the\n * @FT_Get_Advance and @FT_Get_Advances functions.\n *\n * If set, it indicates that you want these functions to fail if the\n * corresponding hinting mode or font driver doesn't allow for very quick\n * advance computation.\n *\n * Typically, glyphs that are either unscaled, unhinted, bitmapped, or\n * light-hinted can have their advance width computed very quickly.\n *\n * Normal and bytecode hinted modes that require loading, scaling, and\n * hinting of the glyph outline, are extremely slow by comparison.\n */\n#define FT_ADVANCE_FLAG_FAST_ONLY 0x20000000L\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Advance\n *\n * @description:\n * Retrieve the advance value of a given glyph outline in an @FT_Face.\n *\n * @input:\n * face ::\n * The source @FT_Face handle.\n *\n * gindex ::\n * The glyph index.\n *\n * load_flags ::\n * A set of bit flags similar to those used when calling\n * @FT_Load_Glyph, used to determine what kind of advances you need.\n * @output:\n * padvance ::\n * The advance value. If scaling is performed (based on the value of\n * `load_flags`), the advance value is in 16.16 format. Otherwise, it\n * is in font units.\n *\n * If @FT_LOAD_VERTICAL_LAYOUT is set, this is the vertical advance\n * corresponding to a vertical layout. Otherwise, it is the horizontal\n * advance in a horizontal layout.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if\n * the corresponding font backend doesn't have a quick way to retrieve\n * the advances.\n *\n * A scaled advance is returned in 16.16 format but isn't transformed by\n * the affine transformation specified by @FT_Set_Transform.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Advance( FT_Face face,\n FT_UInt gindex,\n FT_Int32 load_flags,\n FT_Fixed *padvance );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Advances\n *\n * @description:\n * Retrieve the advance values of several glyph outlines in an @FT_Face.\n *\n * @input:\n * face ::\n * The source @FT_Face handle.\n *\n * start ::\n * The first glyph index.\n *\n * count ::\n * The number of advance values you want to retrieve.\n *\n * load_flags ::\n * A set of bit flags similar to those used when calling\n * @FT_Load_Glyph.\n *\n * @output:\n * padvance ::\n * The advance values. This array, to be provided by the caller, must\n * contain at least `count` elements.\n *\n * If scaling is performed (based on the value of `load_flags`), the\n * advance values are in 16.16 format. Otherwise, they are in font\n * units.\n *\n * If @FT_LOAD_VERTICAL_LAYOUT is set, these are the vertical advances\n * corresponding to a vertical layout. Otherwise, they are the\n * horizontal advances in a horizontal layout.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * This function may fail if you use @FT_ADVANCE_FLAG_FAST_ONLY and if\n * the corresponding font backend doesn't have a quick way to retrieve\n * the advances.\n *\n * Scaled advances are returned in 16.16 format but aren't transformed by\n * the affine transformation specified by @FT_Set_Transform.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Advances( FT_Face face,\n FT_UInt start,\n FT_UInt count,\n FT_Int32 load_flags,\n FT_Fixed *padvances );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTADVANC_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftbbox.h", "language": "code", "loc": 81, "comment_density": 0.827, "code": "/****************************************************************************\n *\n * ftbbox.h\n *\n * FreeType exact bbox computation (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This component has a _single_ role: to compute exact outline bounding\n * boxes.\n *\n * It is separated from the rest of the engine for various technical\n * reasons. It may well be integrated in 'ftoutln' later.\n *\n */\n\n\n#ifndef FTBBOX_H_\n#define FTBBOX_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * outline_processing\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Get_BBox\n *\n * @description:\n * Compute the exact bounding box of an outline. This is slower than\n * computing the control box. However, it uses an advanced algorithm\n * that returns _very_ quickly when the two boxes coincide. Otherwise,\n * the outline Bezier arcs are traversed to extract their extrema.\n *\n * @input:\n * outline ::\n * A pointer to the source outline.\n *\n * @output:\n * abbox ::\n * The outline's exact bounding box.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If the font is tricky and the glyph has been loaded with\n * @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get\n * reasonable values for the BBox it is necessary to load the glyph at a\n * large ppem value (so that the hinting instructions can properly shift\n * and scale the subglyphs), then extracting the BBox, which can be\n * eventually converted back to font units.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Get_BBox( FT_Outline* outline,\n FT_BBox *abbox );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTBBOX_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftbdf.h", "language": "code", "loc": 187, "comment_density": 0.807, "code": "/****************************************************************************\n *\n * ftbdf.h\n *\n * FreeType API for accessing BDF-specific strings (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTBDF_H_\n#define FTBDF_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * bdf_fonts\n *\n * @title:\n * BDF and PCF Files\n *\n * @abstract:\n * BDF and PCF specific API.\n *\n * @description:\n * This section contains the declaration of functions specific to BDF and\n * PCF fonts.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * BDF_PropertyType\n *\n * @description:\n * A list of BDF property types.\n *\n * @values:\n * BDF_PROPERTY_TYPE_NONE ::\n * Value~0 is used to indicate a missing property.\n *\n * BDF_PROPERTY_TYPE_ATOM ::\n * Property is a string atom.\n *\n * BDF_PROPERTY_TYPE_INTEGER ::\n * Property is a 32-bit signed integer.\n *\n * BDF_PROPERTY_TYPE_CARDINAL ::\n * Property is a 32-bit unsigned integer.\n */\n typedef enum BDF_PropertyType_\n {\n BDF_PROPERTY_TYPE_NONE = 0,\n BDF_PROPERTY_TYPE_ATOM = 1,\n BDF_PROPERTY_TYPE_INTEGER = 2,\n BDF_PROPERTY_TYPE_CARDINAL = 3\n\n } BDF_PropertyType;\n\n\n /**************************************************************************\n *\n * @type:\n * BDF_Property\n *\n * @description:\n * A handle to a @BDF_PropertyRec structure to model a given BDF/PCF\n * property.\n */\n typedef struct BDF_PropertyRec_* BDF_Property;\n\n\n /**************************************************************************\n *\n * @struct:\n * BDF_PropertyRec\n *\n * @description:\n * This structure models a given BDF/PCF property.\n *\n * @fields:\n * type ::\n * The property type.\n *\n * u.atom ::\n * The atom string, if type is @BDF_PROPERTY_TYPE_ATOM. May be\n * `NULL`, indicating an empty string.\n *\n * u.integer ::\n * A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.\n *\n * u.cardinal ::\n * An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.\n */\n typedef struct BDF_PropertyRec_\n {\n BDF_PropertyType type;\n union {\n const char* atom;\n FT_Int32 integer;\n FT_UInt32 cardinal;\n\n } u;\n\n } BDF_PropertyRec;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_BDF_Charset_ID\n *\n * @description:\n * Retrieve a BDF font character set identity, according to the BDF\n * specification.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * @output:\n * acharset_encoding ::\n * Charset encoding, as a C~string, owned by the face.\n *\n * acharset_registry ::\n * Charset registry, as a C~string, owned by the face.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with BDF faces, returning an error otherwise.\n */\n FT_EXPORT( FT_Error )\n FT_Get_BDF_Charset_ID( FT_Face face,\n const char* *acharset_encoding,\n const char* *acharset_registry );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_BDF_Property\n *\n * @description:\n * Retrieve a BDF property from a BDF or PCF font file.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * name ::\n * The property name.\n *\n * @output:\n * aproperty ::\n * The property.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function works with BDF _and_ PCF fonts. It returns an error\n * otherwise. It also returns an error if the property is not in the\n * font.\n *\n * A 'property' is a either key-value pair within the STARTPROPERTIES\n * ... ENDPROPERTIES block of a BDF font or a key-value pair from the\n * `info->props` array within a `FontRec` structure of a PCF font.\n *\n * Integer properties are always stored as 'signed' within PCF fonts;\n * consequently, @BDF_PROPERTY_TYPE_CARDINAL is a possible return value\n * for BDF fonts only.\n *\n * In case of error, `aproperty->type` is always set to\n * @BDF_PROPERTY_TYPE_NONE.\n */\n FT_EXPORT( FT_Error )\n FT_Get_BDF_Property( FT_Face face,\n const char* prop_name,\n BDF_PropertyRec *aproperty );\n\n /* */\n\nFT_END_HEADER\n\n#endif /* FTBDF_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftbitmap.h", "language": "code", "loc": 298, "comment_density": 0.859, "code": "/****************************************************************************\n *\n * ftbitmap.h\n *\n * FreeType utility functions for bitmaps (specification).\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTBITMAP_H_\n#define FTBITMAP_H_\n\n\n#include \n#include FT_FREETYPE_H\n#include FT_COLOR_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * bitmap_handling\n *\n * @title:\n * Bitmap Handling\n *\n * @abstract:\n * Handling FT_Bitmap objects.\n *\n * @description:\n * This section contains functions for handling @FT_Bitmap objects,\n * automatically adjusting the target's bitmap buffer size as needed.\n *\n * Note that none of the functions changes the bitmap's 'flow' (as\n * indicated by the sign of the `pitch` field in @FT_Bitmap).\n *\n * To set the flow, assign an appropriate positive or negative value to\n * the `pitch` field of the target @FT_Bitmap object after calling\n * @FT_Bitmap_Init but before calling any of the other functions\n * described here.\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Init\n *\n * @description:\n * Initialize a pointer to an @FT_Bitmap structure.\n *\n * @inout:\n * abitmap ::\n * A pointer to the bitmap structure.\n *\n * @note:\n * A deprecated name for the same function is `FT_Bitmap_New`.\n */\n FT_EXPORT( void )\n FT_Bitmap_Init( FT_Bitmap *abitmap );\n\n\n /* deprecated */\n FT_EXPORT( void )\n FT_Bitmap_New( FT_Bitmap *abitmap );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Copy\n *\n * @description:\n * Copy a bitmap into another one.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * source ::\n * A handle to the source bitmap.\n *\n * @output:\n * target ::\n * A handle to the target bitmap.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * `source->buffer` and `target->buffer` must neither be equal nor\n * overlap.\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Copy( FT_Library library,\n const FT_Bitmap *source,\n FT_Bitmap *target );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Embolden\n *\n * @description:\n * Embolden a bitmap. The new bitmap will be about `xStrength` pixels\n * wider and `yStrength` pixels higher. The left and bottom borders are\n * kept unchanged.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * xStrength ::\n * How strong the glyph is emboldened horizontally. Expressed in 26.6\n * pixel format.\n *\n * yStrength ::\n * How strong the glyph is emboldened vertically. Expressed in 26.6\n * pixel format.\n *\n * @inout:\n * bitmap ::\n * A handle to the target bitmap.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The current implementation restricts `xStrength` to be less than or\n * equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.\n *\n * If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, you\n * should call @FT_GlyphSlot_Own_Bitmap on the slot first.\n *\n * Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format are\n * converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp).\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Embolden( FT_Library library,\n FT_Bitmap* bitmap,\n FT_Pos xStrength,\n FT_Pos yStrength );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Convert\n *\n * @description:\n * Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp to\n * a bitmap object with depth 8bpp, making the number of used bytes per\n * line (a.k.a. the 'pitch') a multiple of `alignment`.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * source ::\n * The source bitmap.\n *\n * alignment ::\n * The pitch of the bitmap is a multiple of this argument. Common\n * values are 1, 2, or 4.\n *\n * @output:\n * target ::\n * The target bitmap.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * It is possible to call @FT_Bitmap_Convert multiple times without\n * calling @FT_Bitmap_Done (the memory is simply reallocated).\n *\n * Use @FT_Bitmap_Done to finally remove the bitmap object.\n *\n * The `library` argument is taken to have access to FreeType's memory\n * handling functions.\n *\n * `source->buffer` and `target->buffer` must neither be equal nor\n * overlap.\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Convert( FT_Library library,\n const FT_Bitmap *source,\n FT_Bitmap *target,\n FT_Int alignment );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Blend\n *\n * @description:\n * Blend a bitmap onto another bitmap, using a given color.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * source ::\n * The source bitmap, which can have any @FT_Pixel_Mode format.\n *\n * source_offset ::\n * The offset vector to the upper left corner of the source bitmap in\n * 26.6 pixel format. It should represent an integer offset; the\n * function will set the lowest six bits to zero to enforce that.\n *\n * color ::\n * The color used to draw `source` onto `target`.\n *\n * @inout:\n * target ::\n * A handle to an `FT_Bitmap` object. It should be either initialized\n * as empty with a call to @FT_Bitmap_Init, or it should be of type\n * @FT_PIXEL_MODE_BGRA.\n *\n * atarget_offset ::\n * The offset vector to the upper left corner of the target bitmap in\n * 26.6 pixel format. It should represent an integer offset; the\n * function will set the lowest six bits to zero to enforce that.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function doesn't perform clipping.\n *\n * The bitmap in `target` gets allocated or reallocated as needed; the\n * vector `atarget_offset` is updated accordingly.\n *\n * In case of allocation or reallocation, the bitmap's pitch is set to\n * `4 * width`. Both `source` and `target` must have the same bitmap\n * flow (as indicated by the sign of the `pitch` field).\n *\n * `source->buffer` and `target->buffer` must neither be equal nor\n * overlap.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Blend( FT_Library library,\n const FT_Bitmap* source,\n const FT_Vector source_offset,\n FT_Bitmap* target,\n FT_Vector *atarget_offset,\n FT_Color color );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_GlyphSlot_Own_Bitmap\n *\n * @description:\n * Make sure that a glyph slot owns `slot->bitmap`.\n *\n * @input:\n * slot ::\n * The glyph slot.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function is to be used in combination with @FT_Bitmap_Embolden.\n */\n FT_EXPORT( FT_Error )\n FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Bitmap_Done\n *\n * @description:\n * Destroy a bitmap object initialized with @FT_Bitmap_Init.\n *\n * @input:\n * library ::\n * A handle to a library object.\n *\n * bitmap ::\n * The bitmap object to be freed.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The `library` argument is taken to have access to FreeType's memory\n * handling functions.\n */\n FT_EXPORT( FT_Error )\n FT_Bitmap_Done( FT_Library library,\n FT_Bitmap *bitmap );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTBITMAP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftbzip2.h", "language": "code", "loc": 87, "comment_density": 0.839, "code": "/****************************************************************************\n *\n * ftbzip2.h\n *\n * Bzip2-compressed stream support.\n *\n * Copyright (C) 2010-2020 by\n * Joel Klinghed.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTBZIP2_H_\n#define FTBZIP2_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * bzip2\n *\n * @title:\n * BZIP2 Streams\n *\n * @abstract:\n * Using bzip2-compressed font files.\n *\n * @description:\n * This section contains the declaration of Bzip2-specific functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stream_OpenBzip2\n *\n * @description:\n * Open a new stream to parse bzip2-compressed font files. This is\n * mainly used to support the compressed `*.pcf.bz2` fonts that come with\n * XFree86.\n *\n * @input:\n * stream ::\n * The target embedding stream.\n *\n * source ::\n * The source stream.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source stream must be opened _before_ calling this function.\n *\n * Calling the internal function `FT_Stream_Close` on the new stream will\n * **not** call `FT_Stream_Close` on the source stream. None of the\n * stream objects will be released to the heap.\n *\n * The stream implementation is very basic and resets the decompression\n * process each time seeking backwards is needed within the stream.\n *\n * In certain builds of the library, bzip2 compression recognition is\n * automatically handled when calling @FT_New_Face or @FT_Open_Face.\n * This means that if no font driver is capable of handling the raw\n * compressed file, the library will try to open a bzip2 compressed\n * stream from it and re-open the face with it.\n *\n * This function may return `FT_Err_Unimplemented_Feature` if your build\n * of FreeType was not compiled with bzip2 support.\n */\n FT_EXPORT( FT_Error )\n FT_Stream_OpenBzip2( FT_Stream stream,\n FT_Stream source );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTBZIP2_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftcache.h", "language": "code", "loc": 1002, "comment_density": 0.881, "code": "/****************************************************************************\n *\n * ftcache.h\n *\n * FreeType Cache subsystem (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTCACHE_H_\n#define FTCACHE_H_\n\n\n#include \n#include FT_GLYPH_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * cache_subsystem\n *\n * @title:\n * Cache Sub-System\n *\n * @abstract:\n * How to cache face, size, and glyph data with FreeType~2.\n *\n * @description:\n * This section describes the FreeType~2 cache sub-system, which is used\n * to limit the number of concurrently opened @FT_Face and @FT_Size\n * objects, as well as caching information like character maps and glyph\n * images while limiting their maximum memory usage.\n *\n * Note that all types and functions begin with the `FTC_` prefix.\n *\n * The cache is highly portable and thus doesn't know anything about the\n * fonts installed on your system, or how to access them. This implies\n * the following scheme:\n *\n * First, available or installed font faces are uniquely identified by\n * @FTC_FaceID values, provided to the cache by the client. Note that\n * the cache only stores and compares these values, and doesn't try to\n * interpret them in any way.\n *\n * Second, the cache calls, only when needed, a client-provided function\n * to convert an @FTC_FaceID into a new @FT_Face object. The latter is\n * then completely managed by the cache, including its termination\n * through @FT_Done_Face. To monitor termination of face objects, the\n * finalizer callback in the `generic` field of the @FT_Face object can\n * be used, which might also be used to store the @FTC_FaceID of the\n * face.\n *\n * Clients are free to map face IDs to anything else. The most simple\n * usage is to associate them to a (pathname,face_index) pair that is\n * used to call @FT_New_Face. However, more complex schemes are also\n * possible.\n *\n * Note that for the cache to work correctly, the face ID values must be\n * **persistent**, which means that the contents they point to should not\n * change at runtime, or that their value should not become invalid.\n *\n * If this is unavoidable (e.g., when a font is uninstalled at runtime),\n * you should call @FTC_Manager_RemoveFaceID as soon as possible, to let\n * the cache get rid of any references to the old @FTC_FaceID it may keep\n * internally. Failure to do so will lead to incorrect behaviour or even\n * crashes.\n *\n * To use the cache, start with calling @FTC_Manager_New to create a new\n * @FTC_Manager object, which models a single cache instance. You can\n * then look up @FT_Face and @FT_Size objects with\n * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively.\n *\n * If you want to use the charmap caching, call @FTC_CMapCache_New, then\n * later use @FTC_CMapCache_Lookup to perform the equivalent of\n * @FT_Get_Char_Index, only much faster.\n *\n * If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then\n * later use @FTC_ImageCache_Lookup to retrieve the corresponding\n * @FT_Glyph objects from the cache.\n *\n * If you need lots of small bitmaps, it is much more memory efficient to\n * call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This\n * returns @FTC_SBitRec structures, which are used to store small bitmaps\n * directly. (A small bitmap is one whose metrics and dimensions all fit\n * into 8-bit integers).\n *\n * We hope to also provide a kerning cache in the near future.\n *\n *\n * @order:\n * FTC_Manager\n * FTC_FaceID\n * FTC_Face_Requester\n *\n * FTC_Manager_New\n * FTC_Manager_Reset\n * FTC_Manager_Done\n * FTC_Manager_LookupFace\n * FTC_Manager_LookupSize\n * FTC_Manager_RemoveFaceID\n *\n * FTC_Node\n * FTC_Node_Unref\n *\n * FTC_ImageCache\n * FTC_ImageCache_New\n * FTC_ImageCache_Lookup\n *\n * FTC_SBit\n * FTC_SBitCache\n * FTC_SBitCache_New\n * FTC_SBitCache_Lookup\n *\n * FTC_CMapCache\n * FTC_CMapCache_New\n * FTC_CMapCache_Lookup\n *\n *************************************************************************/\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** BASIC TYPE DEFINITIONS *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_FaceID\n *\n * @description:\n * An opaque pointer type that is used to identity face objects. The\n * contents of such objects is application-dependent.\n *\n * These pointers are typically used to point to a user-defined structure\n * containing a font file path, and face index.\n *\n * @note:\n * Never use `NULL` as a valid @FTC_FaceID.\n *\n * Face IDs are passed by the client to the cache manager that calls,\n * when needed, the @FTC_Face_Requester to translate them into new\n * @FT_Face objects.\n *\n * If the content of a given face ID changes at runtime, or if the value\n * becomes invalid (e.g., when uninstalling a font), you should\n * immediately call @FTC_Manager_RemoveFaceID before any other cache\n * function.\n *\n * Failure to do so will result in incorrect behaviour or even memory\n * leaks and crashes.\n */\n typedef FT_Pointer FTC_FaceID;\n\n\n /**************************************************************************\n *\n * @functype:\n * FTC_Face_Requester\n *\n * @description:\n * A callback function provided by client applications. It is used by\n * the cache manager to translate a given @FTC_FaceID into a new valid\n * @FT_Face object, on demand.\n *\n * @input:\n * face_id ::\n * The face ID to resolve.\n *\n * library ::\n * A handle to a FreeType library object.\n *\n * req_data ::\n * Application-provided request data (see note below).\n *\n * @output:\n * aface ::\n * A new @FT_Face handle.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The third parameter `req_data` is the same as the one passed by the\n * client when @FTC_Manager_New is called.\n *\n * The face requester should not perform funny things on the returned\n * face object, like creating a new @FT_Size for it, or setting a\n * transformation through @FT_Set_Transform!\n */\n typedef FT_Error\n (*FTC_Face_Requester)( FTC_FaceID face_id,\n FT_Library library,\n FT_Pointer req_data,\n FT_Face* aface );\n\n /* */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** CACHE MANAGER OBJECT *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_Manager\n *\n * @description:\n * This object corresponds to one instance of the cache-subsystem. It is\n * used to cache one or more @FT_Face objects, along with corresponding\n * @FT_Size objects.\n *\n * The manager intentionally limits the total number of opened @FT_Face\n * and @FT_Size objects to control memory usage. See the `max_faces` and\n * `max_sizes` parameters of @FTC_Manager_New.\n *\n * The manager is also used to cache 'nodes' of various types while\n * limiting their total memory usage.\n *\n * All limitations are enforced by keeping lists of managed objects in\n * most-recently-used order, and flushing old nodes to make room for new\n * ones.\n */\n typedef struct FTC_ManagerRec_* FTC_Manager;\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_Node\n *\n * @description:\n * An opaque handle to a cache node object. Each cache node is\n * reference-counted. A node with a count of~0 might be flushed out of a\n * full cache whenever a lookup request is performed.\n *\n * If you look up nodes, you have the ability to 'acquire' them, i.e., to\n * increment their reference count. This will prevent the node from\n * being flushed out of the cache until you explicitly 'release' it (see\n * @FTC_Node_Unref).\n *\n * See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup.\n */\n typedef struct FTC_NodeRec_* FTC_Node;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_New\n *\n * @description:\n * Create a new cache manager.\n *\n * @input:\n * library ::\n * The parent FreeType library handle to use.\n *\n * max_faces ::\n * Maximum number of opened @FT_Face objects managed by this cache\n * instance. Use~0 for defaults.\n *\n * max_sizes ::\n * Maximum number of opened @FT_Size objects managed by this cache\n * instance. Use~0 for defaults.\n *\n * max_bytes ::\n * Maximum number of bytes to use for cached data nodes. Use~0 for\n * defaults. Note that this value does not account for managed\n * @FT_Face and @FT_Size objects.\n *\n * requester ::\n * An application-provided callback used to translate face IDs into\n * real @FT_Face objects.\n *\n * req_data ::\n * A generic pointer that is passed to the requester each time it is\n * called (see @FTC_Face_Requester).\n *\n * @output:\n * amanager ::\n * A handle to a new manager object. 0~in case of failure.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FTC_Manager_New( FT_Library library,\n FT_UInt max_faces,\n FT_UInt max_sizes,\n FT_ULong max_bytes,\n FTC_Face_Requester requester,\n FT_Pointer req_data,\n FTC_Manager *amanager );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_Reset\n *\n * @description:\n * Empty a given cache manager. This simply gets rid of all the\n * currently cached @FT_Face and @FT_Size objects within the manager.\n *\n * @inout:\n * manager ::\n * A handle to the manager.\n */\n FT_EXPORT( void )\n FTC_Manager_Reset( FTC_Manager manager );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_Done\n *\n * @description:\n * Destroy a given manager after emptying it.\n *\n * @input:\n * manager ::\n * A handle to the target cache manager object.\n */\n FT_EXPORT( void )\n FTC_Manager_Done( FTC_Manager manager );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_LookupFace\n *\n * @description:\n * Retrieve the @FT_Face object that corresponds to a given face ID\n * through a cache manager.\n *\n * @input:\n * manager ::\n * A handle to the cache manager.\n *\n * face_id ::\n * The ID of the face object.\n *\n * @output:\n * aface ::\n * A handle to the face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The returned @FT_Face object is always owned by the manager. You\n * should never try to discard it yourself.\n *\n * The @FT_Face object doesn't necessarily have a current size object\n * (i.e., face->size can be~0). If you need a specific 'font size', use\n * @FTC_Manager_LookupSize instead.\n *\n * Never change the face's transformation matrix (i.e., never call the\n * @FT_Set_Transform function) on a returned face! If you need to\n * transform glyphs, do it yourself after glyph loading.\n *\n * When you perform a lookup, out-of-memory errors are detected _within_\n * the lookup and force incremental flushes of the cache until enough\n * memory is released for the lookup to succeed.\n *\n * If a lookup fails with `FT_Err_Out_Of_Memory` the cache has already\n * been completely flushed, and still no memory was available for the\n * operation.\n */\n FT_EXPORT( FT_Error )\n FTC_Manager_LookupFace( FTC_Manager manager,\n FTC_FaceID face_id,\n FT_Face *aface );\n\n\n /**************************************************************************\n *\n * @struct:\n * FTC_ScalerRec\n *\n * @description:\n * A structure used to describe a given character size in either pixels\n * or points to the cache manager. See @FTC_Manager_LookupSize.\n *\n * @fields:\n * face_id ::\n * The source face ID.\n *\n * width ::\n * The character width.\n *\n * height ::\n * The character height.\n *\n * pixel ::\n * A Boolean. If 1, the `width` and `height` fields are interpreted as\n * integer pixel character sizes. Otherwise, they are expressed as\n * 1/64th of points.\n *\n * x_res ::\n * Only used when `pixel` is value~0 to indicate the horizontal\n * resolution in dpi.\n *\n * y_res ::\n * Only used when `pixel` is value~0 to indicate the vertical\n * resolution in dpi.\n *\n * @note:\n * This type is mainly used to retrieve @FT_Size objects through the\n * cache manager.\n */\n typedef struct FTC_ScalerRec_\n {\n FTC_FaceID face_id;\n FT_UInt width;\n FT_UInt height;\n FT_Int pixel;\n FT_UInt x_res;\n FT_UInt y_res;\n\n } FTC_ScalerRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FTC_Scaler\n *\n * @description:\n * A handle to an @FTC_ScalerRec structure.\n */\n typedef struct FTC_ScalerRec_* FTC_Scaler;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_LookupSize\n *\n * @description:\n * Retrieve the @FT_Size object that corresponds to a given\n * @FTC_ScalerRec pointer through a cache manager.\n *\n * @input:\n * manager ::\n * A handle to the cache manager.\n *\n * scaler ::\n * A scaler handle.\n *\n * @output:\n * asize ::\n * A handle to the size object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The returned @FT_Size object is always owned by the manager. You\n * should never try to discard it by yourself.\n *\n * You can access the parent @FT_Face object simply as `size->face` if\n * you need it. Note that this object is also owned by the manager.\n *\n * @note:\n * When you perform a lookup, out-of-memory errors are detected _within_\n * the lookup and force incremental flushes of the cache until enough\n * memory is released for the lookup to succeed.\n *\n * If a lookup fails with `FT_Err_Out_Of_Memory` the cache has already\n * been completely flushed, and still no memory is available for the\n * operation.\n */\n FT_EXPORT( FT_Error )\n FTC_Manager_LookupSize( FTC_Manager manager,\n FTC_Scaler scaler,\n FT_Size *asize );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Node_Unref\n *\n * @description:\n * Decrement a cache node's internal reference count. When the count\n * reaches 0, it is not destroyed but becomes eligible for subsequent\n * cache flushes.\n *\n * @input:\n * node ::\n * The cache node handle.\n *\n * manager ::\n * The cache manager handle.\n */\n FT_EXPORT( void )\n FTC_Node_Unref( FTC_Node node,\n FTC_Manager manager );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_Manager_RemoveFaceID\n *\n * @description:\n * A special function used to indicate to the cache manager that a given\n * @FTC_FaceID is no longer valid, either because its content changed, or\n * because it was deallocated or uninstalled.\n *\n * @input:\n * manager ::\n * The cache manager handle.\n *\n * face_id ::\n * The @FTC_FaceID to be removed.\n *\n * @note:\n * This function flushes all nodes from the cache corresponding to this\n * `face_id`, with the exception of nodes with a non-null reference\n * count.\n *\n * Such nodes are however modified internally so as to never appear in\n * later lookups with the same `face_id` value, and to be immediately\n * destroyed when released by all their users.\n *\n */\n FT_EXPORT( void )\n FTC_Manager_RemoveFaceID( FTC_Manager manager,\n FTC_FaceID face_id );\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_CMapCache\n *\n * @description:\n * An opaque handle used to model a charmap cache. This cache is to hold\n * character codes -> glyph indices mappings.\n *\n */\n typedef struct FTC_CMapCacheRec_* FTC_CMapCache;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_CMapCache_New\n *\n * @description:\n * Create a new charmap cache.\n *\n * @input:\n * manager ::\n * A handle to the cache manager.\n *\n * @output:\n * acache ::\n * A new cache handle. `NULL` in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Like all other caches, this one will be destroyed with the cache\n * manager.\n *\n */\n FT_EXPORT( FT_Error )\n FTC_CMapCache_New( FTC_Manager manager,\n FTC_CMapCache *acache );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_CMapCache_Lookup\n *\n * @description:\n * Translate a character code into a glyph index, using the charmap\n * cache.\n *\n * @input:\n * cache ::\n * A charmap cache handle.\n *\n * face_id ::\n * The source face ID.\n *\n * cmap_index ::\n * The index of the charmap in the source face. Any negative value\n * means to use the cache @FT_Face's default charmap.\n *\n * char_code ::\n * The character code (in the corresponding charmap).\n *\n * @return:\n * Glyph index. 0~means 'no glyph'.\n *\n */\n FT_EXPORT( FT_UInt )\n FTC_CMapCache_Lookup( FTC_CMapCache cache,\n FTC_FaceID face_id,\n FT_Int cmap_index,\n FT_UInt32 char_code );\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** IMAGE CACHE OBJECT *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * FTC_ImageTypeRec\n *\n * @description:\n * A structure used to model the type of images in a glyph cache.\n *\n * @fields:\n * face_id ::\n * The face ID.\n *\n * width ::\n * The width in pixels.\n *\n * height ::\n * The height in pixels.\n *\n * flags ::\n * The load flags, as in @FT_Load_Glyph.\n *\n */\n typedef struct FTC_ImageTypeRec_\n {\n FTC_FaceID face_id;\n FT_UInt width;\n FT_UInt height;\n FT_Int32 flags;\n\n } FTC_ImageTypeRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_ImageType\n *\n * @description:\n * A handle to an @FTC_ImageTypeRec structure.\n *\n */\n typedef struct FTC_ImageTypeRec_* FTC_ImageType;\n\n\n /* */\n\n\n#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \\\n ( (d1)->face_id == (d2)->face_id && \\\n (d1)->width == (d2)->width && \\\n (d1)->flags == (d2)->flags )\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_ImageCache\n *\n * @description:\n * A handle to a glyph image cache object. They are designed to hold\n * many distinct glyph images while not exceeding a certain memory\n * threshold.\n */\n typedef struct FTC_ImageCacheRec_* FTC_ImageCache;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_ImageCache_New\n *\n * @description:\n * Create a new glyph image cache.\n *\n * @input:\n * manager ::\n * The parent manager for the image cache.\n *\n * @output:\n * acache ::\n * A handle to the new glyph image cache object.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FTC_ImageCache_New( FTC_Manager manager,\n FTC_ImageCache *acache );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_ImageCache_Lookup\n *\n * @description:\n * Retrieve a given glyph image from a glyph image cache.\n *\n * @input:\n * cache ::\n * A handle to the source glyph image cache.\n *\n * type ::\n * A pointer to a glyph image type descriptor.\n *\n * gindex ::\n * The glyph index to retrieve.\n *\n * @output:\n * aglyph ::\n * The corresponding @FT_Glyph object. 0~in case of failure.\n *\n * anode ::\n * Used to return the address of the corresponding cache node after\n * incrementing its reference count (see note below).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The returned glyph is owned and managed by the glyph image cache.\n * Never try to transform or discard it manually! You can however create\n * a copy with @FT_Glyph_Copy and modify the new one.\n *\n * If `anode` is _not_ `NULL`, it receives the address of the cache node\n * containing the glyph image, after increasing its reference count.\n * This ensures that the node (as well as the @FT_Glyph) will always be\n * kept in the cache until you call @FTC_Node_Unref to 'release' it.\n *\n * If `anode` is `NULL`, the cache node is left unchanged, which means\n * that the @FT_Glyph could be flushed out of the cache on the next call\n * to one of the caching sub-system APIs. Don't assume that it is\n * persistent!\n */\n FT_EXPORT( FT_Error )\n FTC_ImageCache_Lookup( FTC_ImageCache cache,\n FTC_ImageType type,\n FT_UInt gindex,\n FT_Glyph *aglyph,\n FTC_Node *anode );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_ImageCache_LookupScaler\n *\n * @description:\n * A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec to\n * specify the face ID and its size.\n *\n * @input:\n * cache ::\n * A handle to the source glyph image cache.\n *\n * scaler ::\n * A pointer to a scaler descriptor.\n *\n * load_flags ::\n * The corresponding load flags.\n *\n * gindex ::\n * The glyph index to retrieve.\n *\n * @output:\n * aglyph ::\n * The corresponding @FT_Glyph object. 0~in case of failure.\n *\n * anode ::\n * Used to return the address of the corresponding cache node after\n * incrementing its reference count (see note below).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The returned glyph is owned and managed by the glyph image cache.\n * Never try to transform or discard it manually! You can however create\n * a copy with @FT_Glyph_Copy and modify the new one.\n *\n * If `anode` is _not_ `NULL`, it receives the address of the cache node\n * containing the glyph image, after increasing its reference count.\n * This ensures that the node (as well as the @FT_Glyph) will always be\n * kept in the cache until you call @FTC_Node_Unref to 'release' it.\n *\n * If `anode` is `NULL`, the cache node is left unchanged, which means\n * that the @FT_Glyph could be flushed out of the cache on the next call\n * to one of the caching sub-system APIs. Don't assume that it is\n * persistent!\n *\n * Calls to @FT_Set_Char_Size and friends have no effect on cached\n * glyphs; you should always use the FreeType cache API instead.\n */\n FT_EXPORT( FT_Error )\n FTC_ImageCache_LookupScaler( FTC_ImageCache cache,\n FTC_Scaler scaler,\n FT_ULong load_flags,\n FT_UInt gindex,\n FT_Glyph *aglyph,\n FTC_Node *anode );\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_SBit\n *\n * @description:\n * A handle to a small bitmap descriptor. See the @FTC_SBitRec structure\n * for details.\n */\n typedef struct FTC_SBitRec_* FTC_SBit;\n\n\n /**************************************************************************\n *\n * @struct:\n * FTC_SBitRec\n *\n * @description:\n * A very compact structure used to describe a small glyph bitmap.\n *\n * @fields:\n * width ::\n * The bitmap width in pixels.\n *\n * height ::\n * The bitmap height in pixels.\n *\n * left ::\n * The horizontal distance from the pen position to the left bitmap\n * border (a.k.a. 'left side bearing', or 'lsb').\n *\n * top ::\n * The vertical distance from the pen position (on the baseline) to the\n * upper bitmap border (a.k.a. 'top side bearing'). The distance is\n * positive for upwards y~coordinates.\n *\n * format ::\n * The format of the glyph bitmap (monochrome or gray).\n *\n * max_grays ::\n * Maximum gray level value (in the range 1 to~255).\n *\n * pitch ::\n * The number of bytes per bitmap line. May be positive or negative.\n *\n * xadvance ::\n * The horizontal advance width in pixels.\n *\n * yadvance ::\n * The vertical advance height in pixels.\n *\n * buffer ::\n * A pointer to the bitmap pixels.\n */\n typedef struct FTC_SBitRec_\n {\n FT_Byte width;\n FT_Byte height;\n FT_Char left;\n FT_Char top;\n\n FT_Byte format;\n FT_Byte max_grays;\n FT_Short pitch;\n FT_Char xadvance;\n FT_Char yadvance;\n\n FT_Byte* buffer;\n\n } FTC_SBitRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FTC_SBitCache\n *\n * @description:\n * A handle to a small bitmap cache. These are special cache objects\n * used to store small glyph bitmaps (and anti-aliased pixmaps) in a much\n * more efficient way than the traditional glyph image cache implemented\n * by @FTC_ImageCache.\n */\n typedef struct FTC_SBitCacheRec_* FTC_SBitCache;\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_SBitCache_New\n *\n * @description:\n * Create a new cache to store small glyph bitmaps.\n *\n * @input:\n * manager ::\n * A handle to the source cache manager.\n *\n * @output:\n * acache ::\n * A handle to the new sbit cache. `NULL` in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FTC_SBitCache_New( FTC_Manager manager,\n FTC_SBitCache *acache );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_SBitCache_Lookup\n *\n * @description:\n * Look up a given small glyph bitmap in a given sbit cache and 'lock' it\n * to prevent its flushing from the cache until needed.\n *\n * @input:\n * cache ::\n * A handle to the source sbit cache.\n *\n * type ::\n * A pointer to the glyph image type descriptor.\n *\n * gindex ::\n * The glyph index.\n *\n * @output:\n * sbit ::\n * A handle to a small bitmap descriptor.\n *\n * anode ::\n * Used to return the address of the corresponding cache node after\n * incrementing its reference count (see note below).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The small bitmap descriptor and its bit buffer are owned by the cache\n * and should never be freed by the application. They might as well\n * disappear from memory on the next cache lookup, so don't treat them as\n * persistent data.\n *\n * The descriptor's `buffer` field is set to~0 to indicate a missing\n * glyph bitmap.\n *\n * If `anode` is _not_ `NULL`, it receives the address of the cache node\n * containing the bitmap, after increasing its reference count. This\n * ensures that the node (as well as the image) will always be kept in\n * the cache until you call @FTC_Node_Unref to 'release' it.\n *\n * If `anode` is `NULL`, the cache node is left unchanged, which means\n * that the bitmap could be flushed out of the cache on the next call to\n * one of the caching sub-system APIs. Don't assume that it is\n * persistent!\n */\n FT_EXPORT( FT_Error )\n FTC_SBitCache_Lookup( FTC_SBitCache cache,\n FTC_ImageType type,\n FT_UInt gindex,\n FTC_SBit *sbit,\n FTC_Node *anode );\n\n\n /**************************************************************************\n *\n * @function:\n * FTC_SBitCache_LookupScaler\n *\n * @description:\n * A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec to\n * specify the face ID and its size.\n *\n * @input:\n * cache ::\n * A handle to the source sbit cache.\n *\n * scaler ::\n * A pointer to the scaler descriptor.\n *\n * load_flags ::\n * The corresponding load flags.\n *\n * gindex ::\n * The glyph index.\n *\n * @output:\n * sbit ::\n * A handle to a small bitmap descriptor.\n *\n * anode ::\n * Used to return the address of the corresponding cache node after\n * incrementing its reference count (see note below).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The small bitmap descriptor and its bit buffer are owned by the cache\n * and should never be freed by the application. They might as well\n * disappear from memory on the next cache lookup, so don't treat them as\n * persistent data.\n *\n * The descriptor's `buffer` field is set to~0 to indicate a missing\n * glyph bitmap.\n *\n * If `anode` is _not_ `NULL`, it receives the address of the cache node\n * containing the bitmap, after increasing its reference count. This\n * ensures that the node (as well as the image) will always be kept in\n * the cache until you call @FTC_Node_Unref to 'release' it.\n *\n * If `anode` is `NULL`, the cache node is left unchanged, which means\n * that the bitmap could be flushed out of the cache on the next call to\n * one of the caching sub-system APIs. Don't assume that it is\n * persistent!\n */\n FT_EXPORT( FT_Error )\n FTC_SBitCache_LookupScaler( FTC_SBitCache cache,\n FTC_Scaler scaler,\n FT_ULong load_flags,\n FT_UInt gindex,\n FTC_SBit *sbit,\n FTC_Node *anode );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTCACHE_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftchapters.h", "language": "code", "loc": 129, "comment_density": 1.0, "code": "/****************************************************************************\n *\n * This file defines the structure of the FreeType reference.\n * It is used by the python script that generates the HTML files.\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * general_remarks\n *\n * @title:\n * General Remarks\n *\n * @sections:\n * header_inclusion\n * user_allocation\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * core_api\n *\n * @title:\n * Core API\n *\n * @sections:\n * version\n * basic_types\n * base_interface\n * glyph_variants\n * color_management\n * layer_management\n * glyph_management\n * mac_specific\n * sizes_management\n * header_file_macros\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * format_specific\n *\n * @title:\n * Format-Specific API\n *\n * @sections:\n * multiple_masters\n * truetype_tables\n * type1_tables\n * sfnt_names\n * bdf_fonts\n * cid_fonts\n * pfr_fonts\n * winfnt_fonts\n * font_formats\n * gasp_table\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * module_specific\n *\n * @title:\n * Controlling FreeType Modules\n *\n * @sections:\n * auto_hinter\n * cff_driver\n * t1_cid_driver\n * tt_driver\n * pcf_driver\n * properties\n * parameter_tags\n * lcd_rendering\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * cache_subsystem\n *\n * @title:\n * Cache Sub-System\n *\n * @sections:\n * cache_subsystem\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * support_api\n *\n * @title:\n * Support API\n *\n * @sections:\n * computations\n * list_processing\n * outline_processing\n * quick_advance\n * bitmap_handling\n * raster\n * glyph_stroker\n * system_interface\n * module_management\n * gzip\n * lzw\n * bzip2\n *\n */\n\n\n /**************************************************************************\n *\n * @chapter:\n * error_codes\n *\n * @title:\n * Error Codes\n *\n * @sections:\n * error_enumerations\n * error_code_values\n *\n */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftcid.h", "language": "code", "loc": 148, "comment_density": 0.845, "code": "/****************************************************************************\n *\n * ftcid.h\n *\n * FreeType API for accessing CID font information (specification).\n *\n * Copyright (C) 2007-2020 by\n * Dereg Clegg and Michael Toftdal.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTCID_H_\n#define FTCID_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * cid_fonts\n *\n * @title:\n * CID Fonts\n *\n * @abstract:\n * CID-keyed font-specific API.\n *\n * @description:\n * This section contains the declaration of CID-keyed font-specific\n * functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CID_Registry_Ordering_Supplement\n *\n * @description:\n * Retrieve the Registry/Ordering/Supplement triple (also known as the\n * \"R/O/S\") from a CID-keyed font.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * @output:\n * registry ::\n * The registry, as a C~string, owned by the face.\n *\n * ordering ::\n * The ordering, as a C~string, owned by the face.\n *\n * supplement ::\n * The supplement.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with CID faces, returning an error\n * otherwise.\n *\n * @since:\n * 2.3.6\n */\n FT_EXPORT( FT_Error )\n FT_Get_CID_Registry_Ordering_Supplement( FT_Face face,\n const char* *registry,\n const char* *ordering,\n FT_Int *supplement );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CID_Is_Internally_CID_Keyed\n *\n * @description:\n * Retrieve the type of the input face, CID keyed or not. In contrast\n * to the @FT_IS_CID_KEYED macro this function returns successfully also\n * for CID-keyed fonts in an SFNT wrapper.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * @output:\n * is_cid ::\n * The type of the face as an @FT_Bool.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with CID faces and OpenType fonts, returning\n * an error otherwise.\n *\n * @since:\n * 2.3.9\n */\n FT_EXPORT( FT_Error )\n FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face,\n FT_Bool *is_cid );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CID_From_Glyph_Index\n *\n * @description:\n * Retrieve the CID of the input glyph index.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * glyph_index ::\n * The input glyph index.\n *\n * @output:\n * cid ::\n * The CID as an @FT_UInt.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with CID faces and OpenType fonts, returning\n * an error otherwise.\n *\n * @since:\n * 2.3.9\n */\n FT_EXPORT( FT_Error )\n FT_Get_CID_From_Glyph_Index( FT_Face face,\n FT_UInt glyph_index,\n FT_UInt *cid );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTCID_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftcolor.h", "language": "code", "loc": 285, "comment_density": 0.87, "code": "/****************************************************************************\n *\n * ftcolor.h\n *\n * FreeType's glyph color management (specification).\n *\n * Copyright (C) 2018-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTCOLOR_H_\n#define FTCOLOR_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * color_management\n *\n * @title:\n * Glyph Color Management\n *\n * @abstract:\n * Retrieving and manipulating OpenType's 'CPAL' table data.\n *\n * @description:\n * The functions described here allow access and manipulation of color\n * palette entries in OpenType's 'CPAL' tables.\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Color\n *\n * @description:\n * This structure models a BGRA color value of a 'CPAL' palette entry.\n *\n * The used color space is sRGB; the colors are not pre-multiplied, and\n * alpha values must be explicitly set.\n *\n * @fields:\n * blue ::\n * Blue value.\n *\n * green ::\n * Green value.\n *\n * red ::\n * Red value.\n *\n * alpha ::\n * Alpha value, giving the red, green, and blue color's opacity.\n *\n * @since:\n * 2.10\n */\n typedef struct FT_Color_\n {\n FT_Byte blue;\n FT_Byte green;\n FT_Byte red;\n FT_Byte alpha;\n\n } FT_Color;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PALETTE_XXX\n *\n * @description:\n * A list of bit field constants used in the `palette_flags` array of the\n * @FT_Palette_Data structure to indicate for which background a palette\n * with a given index is usable.\n *\n * @values:\n * FT_PALETTE_FOR_LIGHT_BACKGROUND ::\n * The palette is appropriate to use when displaying the font on a\n * light background such as white.\n *\n * FT_PALETTE_FOR_DARK_BACKGROUND ::\n * The palette is appropriate to use when displaying the font on a dark\n * background such as black.\n *\n * @since:\n * 2.10\n */\n#define FT_PALETTE_FOR_LIGHT_BACKGROUND 0x01\n#define FT_PALETTE_FOR_DARK_BACKGROUND 0x02\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Palette_Data\n *\n * @description:\n * This structure holds the data of the 'CPAL' table.\n *\n * @fields:\n * num_palettes ::\n * The number of palettes.\n *\n * palette_name_ids ::\n * An optional read-only array of palette name IDs with `num_palettes`\n * elements, corresponding to entries like 'dark' or 'light' in the\n * font's 'name' table.\n *\n * An empty name ID in the 'CPAL' table gets represented as value\n * 0xFFFF.\n *\n * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.\n *\n * palette_flags ::\n * An optional read-only array of palette flags with `num_palettes`\n * elements. Possible values are an ORed combination of\n * @FT_PALETTE_FOR_LIGHT_BACKGROUND and\n * @FT_PALETTE_FOR_DARK_BACKGROUND.\n *\n * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.\n *\n * num_palette_entries ::\n * The number of entries in a single palette. All palettes have the\n * same size.\n *\n * palette_entry_name_ids ::\n * An optional read-only array of palette entry name IDs with\n * `num_palette_entries`. In each palette, entries with the same index\n * have the same function. For example, index~0 might correspond to\n * string 'outline' in the font's 'name' table to indicate that this\n * palette entry is used for outlines, index~1 might correspond to\n * 'fill' to indicate the filling color palette entry, etc.\n *\n * An empty entry name ID in the 'CPAL' table gets represented as value\n * 0xFFFF.\n *\n * `NULL` if the font's 'CPAL' table doesn't contain appropriate data.\n *\n * @note:\n * Use function @FT_Get_Sfnt_Name to map name IDs and entry name IDs to\n * name strings.\n *\n * Use function @FT_Palette_Select to get the colors associated with a\n * palette entry.\n *\n * @since:\n * 2.10\n */\n typedef struct FT_Palette_Data_ {\n FT_UShort num_palettes;\n const FT_UShort* palette_name_ids;\n const FT_UShort* palette_flags;\n\n FT_UShort num_palette_entries;\n const FT_UShort* palette_entry_name_ids;\n\n } FT_Palette_Data;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Palette_Data_Get\n *\n * @description:\n * Retrieve the face's color palette data.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * @output:\n * apalette ::\n * A pointer to an @FT_Palette_Data structure.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * All arrays in the returned @FT_Palette_Data structure are read-only.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Palette_Data_Get( FT_Face face,\n FT_Palette_Data *apalette );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Palette_Select\n *\n * @description:\n * This function has two purposes.\n *\n * (1) It activates a palette for rendering color glyphs, and\n *\n * (2) it retrieves all (unmodified) color entries of this palette. This\n * function returns a read-write array, which means that a calling\n * application can modify the palette entries on demand.\n *\n * A corollary of (2) is that calling the function, then modifying some\n * values, then calling the function again with the same arguments resets\n * all color entries to the original 'CPAL' values; all user modifications\n * are lost.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * palette_index ::\n * The palette index.\n *\n * @output:\n * apalette ::\n * An array of color entries for a palette with index `palette_index`,\n * having `num_palette_entries` elements (as found in the\n * `FT_Palette_Data` structure). If `apalette` is set to `NULL`, no\n * array gets returned (and no color entries can be modified).\n *\n * In case the font doesn't support color palettes, `NULL` is returned.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The array pointed to by `apalette_entries` is owned and managed by\n * FreeType.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Palette_Select( FT_Face face,\n FT_UShort palette_index,\n FT_Color* *apalette );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Palette_Set_Foreground_Color\n *\n * @description:\n * 'COLR' uses palette index 0xFFFF to indicate a 'text foreground\n * color'. This function sets this value.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * foreground_color ::\n * An `FT_Color` structure to define the text foreground color.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If this function isn't called, the text foreground color is set to\n * white opaque (BGRA value 0xFFFFFFFF) if\n * @FT_PALETTE_FOR_DARK_BACKGROUND is present for the current palette,\n * and black opaque (BGRA value 0x000000FF) otherwise, including the case\n * that no palette types are available in the 'CPAL' table.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_COLOR_LAYERS` is not defined in `ftoption.h`.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Palette_Set_Foreground_Color( FT_Face face,\n FT_Color foreground_color );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTCOLOR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftdriver.h", "language": "code", "loc": 1171, "comment_density": 0.972, "code": "/****************************************************************************\n *\n * ftdriver.h\n *\n * FreeType API for controlling driver modules (specification only).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTDRIVER_H_\n#define FTDRIVER_H_\n\n#include \n#include FT_FREETYPE_H\n#include FT_PARAMETER_TAGS_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * auto_hinter\n *\n * @title:\n * The auto-hinter\n *\n * @abstract:\n * Controlling the auto-hinting module.\n *\n * @description:\n * While FreeType's auto-hinter doesn't expose API functions by itself,\n * it is possible to control its behaviour with @FT_Property_Set and\n * @FT_Property_Get. The following lists the available properties\n * together with the necessary macros and structures.\n *\n * Note that the auto-hinter's module name is 'autofitter' for historical\n * reasons.\n *\n * Available properties are @increase-x-height, @no-stem-darkening\n * (experimental), @darkening-parameters (experimental), @warping\n * (experimental), @glyph-to-script-map (experimental), @fallback-script\n * (experimental), and @default-script (experimental), as documented in\n * the @properties section.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * cff_driver\n *\n * @title:\n * The CFF driver\n *\n * @abstract:\n * Controlling the CFF driver module.\n *\n * @description:\n * While FreeType's CFF driver doesn't expose API functions by itself, it\n * is possible to control its behaviour with @FT_Property_Set and\n * @FT_Property_Get.\n *\n * The CFF driver's module name is 'cff'.\n *\n * Available properties are @hinting-engine, @no-stem-darkening,\n * @darkening-parameters, and @random-seed, as documented in the\n * @properties section.\n *\n *\n * **Hinting and antialiasing principles of the new engine**\n *\n * The rasterizer is positioning horizontal features (e.g., ascender\n * height & x-height, or crossbars) on the pixel grid and minimizing the\n * amount of antialiasing applied to them, while placing vertical\n * features (vertical stems) on the pixel grid without hinting, thus\n * representing the stem position and weight accurately. Sometimes the\n * vertical stems may be only partially black. In this context,\n * 'antialiasing' means that stems are not positioned exactly on pixel\n * borders, causing a fuzzy appearance.\n *\n * There are two principles behind this approach.\n *\n * 1) No hinting in the horizontal direction: Unlike 'superhinted'\n * TrueType, which changes glyph widths to accommodate regular\n * inter-glyph spacing, Adobe's approach is 'faithful to the design' in\n * representing both the glyph width and the inter-glyph spacing designed\n * for the font. This makes the screen display as close as it can be to\n * the result one would get with infinite resolution, while preserving\n * what is considered the key characteristics of each glyph. Note that\n * the distances between unhinted and grid-fitted positions at small\n * sizes are comparable to kerning values and thus would be noticeable\n * (and distracting) while reading if hinting were applied.\n *\n * One of the reasons to not hint horizontally is antialiasing for LCD\n * screens: The pixel geometry of modern displays supplies three vertical\n * subpixels as the eye moves horizontally across each visible pixel. On\n * devices where we can be certain this characteristic is present a\n * rasterizer can take advantage of the subpixels to add increments of\n * weight. In Western writing systems this turns out to be the more\n * critical direction anyway; the weights and spacing of vertical stems\n * (see above) are central to Armenian, Cyrillic, Greek, and Latin type\n * designs. Even when the rasterizer uses greyscale antialiasing instead\n * of color (a necessary compromise when one doesn't know the screen\n * characteristics), the unhinted vertical features preserve the design's\n * weight and spacing much better than aliased type would.\n *\n * 2) Alignment in the vertical direction: Weights and spacing along the\n * y~axis are less critical; what is much more important is the visual\n * alignment of related features (like cap-height and x-height). The\n * sense of alignment for these is enhanced by the sharpness of grid-fit\n * edges, while the cruder vertical resolution (full pixels instead of\n * 1/3 pixels) is less of a problem.\n *\n * On the technical side, horizontal alignment zones for ascender,\n * x-height, and other important height values (traditionally called\n * 'blue zones') as defined in the font are positioned independently,\n * each being rounded to the nearest pixel edge, taking care of overshoot\n * suppression at small sizes, stem darkening, and scaling.\n *\n * Hstems (this is, hint values defined in the font to help align\n * horizontal features) that fall within a blue zone are said to be\n * 'captured' and are aligned to that zone. Uncaptured stems are moved\n * in one of four ways, top edge up or down, bottom edge up or down.\n * Unless there are conflicting hstems, the smallest movement is taken to\n * minimize distortion.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * pcf_driver\n *\n * @title:\n * The PCF driver\n *\n * @abstract:\n * Controlling the PCF driver module.\n *\n * @description:\n * While FreeType's PCF driver doesn't expose API functions by itself, it\n * is possible to control its behaviour with @FT_Property_Set and\n * @FT_Property_Get. Right now, there is a single property\n * @no-long-family-names available if FreeType is compiled with\n * PCF_CONFIG_OPTION_LONG_FAMILY_NAMES.\n *\n * The PCF driver's module name is 'pcf'.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * t1_cid_driver\n *\n * @title:\n * The Type 1 and CID drivers\n *\n * @abstract:\n * Controlling the Type~1 and CID driver modules.\n *\n * @description:\n * It is possible to control the behaviour of FreeType's Type~1 and\n * Type~1 CID drivers with @FT_Property_Set and @FT_Property_Get.\n *\n * Behind the scenes, both drivers use the Adobe CFF engine for hinting;\n * however, the used properties must be specified separately.\n *\n * The Type~1 driver's module name is 'type1'; the CID driver's module\n * name is 't1cid'.\n *\n * Available properties are @hinting-engine, @no-stem-darkening,\n * @darkening-parameters, and @random-seed, as documented in the\n * @properties section.\n *\n * Please see the @cff_driver section for more details on the new hinting\n * engine.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * tt_driver\n *\n * @title:\n * The TrueType driver\n *\n * @abstract:\n * Controlling the TrueType driver module.\n *\n * @description:\n * While FreeType's TrueType driver doesn't expose API functions by\n * itself, it is possible to control its behaviour with @FT_Property_Set\n * and @FT_Property_Get. The following lists the available properties\n * together with the necessary macros and structures.\n *\n * The TrueType driver's module name is 'truetype'.\n *\n * A single property @interpreter-version is available, as documented in\n * the @properties section.\n *\n * We start with a list of definitions, kindly provided by Greg\n * Hitchcock.\n *\n * _Bi-Level Rendering_\n *\n * Monochromatic rendering, exclusively used in the early days of\n * TrueType by both Apple and Microsoft. Microsoft's GDI interface\n * supported hinting of the right-side bearing point, such that the\n * advance width could be non-linear. Most often this was done to\n * achieve some level of glyph symmetry. To enable reasonable\n * performance (e.g., not having to run hinting on all glyphs just to get\n * the widths) there was a bit in the head table indicating if the side\n * bearing was hinted, and additional tables, 'hdmx' and 'LTSH', to cache\n * hinting widths across multiple sizes and device aspect ratios.\n *\n * _Font Smoothing_\n *\n * Microsoft's GDI implementation of anti-aliasing. Not traditional\n * anti-aliasing as the outlines were hinted before the sampling. The\n * widths matched the bi-level rendering.\n *\n * _ClearType Rendering_\n *\n * Technique that uses physical subpixels to improve rendering on LCD\n * (and other) displays. Because of the higher resolution, many methods\n * of improving symmetry in glyphs through hinting the right-side bearing\n * were no longer necessary. This lead to what GDI calls 'natural\n * widths' ClearType, see\n * http://rastertragedy.com/RTRCh4.htm#Sec21. Since hinting\n * has extra resolution, most non-linearity went away, but it is still\n * possible for hints to change the advance widths in this mode.\n *\n * _ClearType Compatible Widths_\n *\n * One of the earliest challenges with ClearType was allowing the\n * implementation in GDI to be selected without requiring all UI and\n * documents to reflow. To address this, a compatible method of\n * rendering ClearType was added where the font hints are executed once\n * to determine the width in bi-level rendering, and then re-run in\n * ClearType, with the difference in widths being absorbed in the font\n * hints for ClearType (mostly in the white space of hints); see\n * http://rastertragedy.com/RTRCh4.htm#Sec20. Somewhat by\n * definition, compatible width ClearType allows for non-linear widths,\n * but only when the bi-level version has non-linear widths.\n *\n * _ClearType Subpixel Positioning_\n *\n * One of the nice benefits of ClearType is the ability to more crisply\n * display fractional widths; unfortunately, the GDI model of integer\n * bitmaps did not support this. However, the WPF and Direct Write\n * frameworks do support fractional widths. DWrite calls this 'natural\n * mode', not to be confused with GDI's 'natural widths'. Subpixel\n * positioning, in the current implementation of Direct Write,\n * unfortunately does not support hinted advance widths, see\n * http://rastertragedy.com/RTRCh4.htm#Sec22. Note that the\n * TrueType interpreter fully allows the advance width to be adjusted in\n * this mode, just the DWrite client will ignore those changes.\n *\n * _ClearType Backward Compatibility_\n *\n * This is a set of exceptions made in the TrueType interpreter to\n * minimize hinting techniques that were problematic with the extra\n * resolution of ClearType; see\n * http://rastertragedy.com/RTRCh4.htm#Sec1 and\n * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx.\n * This technique is not to be confused with ClearType compatible widths.\n * ClearType backward compatibility has no direct impact on changing\n * advance widths, but there might be an indirect impact on disabling\n * some deltas. This could be worked around in backward compatibility\n * mode.\n *\n * _Native ClearType Mode_\n *\n * (Not to be confused with 'natural widths'.) This mode removes all the\n * exceptions in the TrueType interpreter when running with ClearType.\n * Any issues on widths would still apply, though.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * properties\n *\n * @title:\n * Driver properties\n *\n * @abstract:\n * Controlling driver modules.\n *\n * @description:\n * Driver modules can be controlled by setting and unsetting properties,\n * using the functions @FT_Property_Set and @FT_Property_Get. This\n * section documents the available properties, together with auxiliary\n * macros and structures.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_HINTING_XXX\n *\n * @description:\n * A list of constants used for the @hinting-engine property to select\n * the hinting engine for CFF, Type~1, and CID fonts.\n *\n * @values:\n * FT_HINTING_FREETYPE ::\n * Use the old FreeType hinting engine.\n *\n * FT_HINTING_ADOBE ::\n * Use the hinting engine contributed by Adobe.\n *\n * @since:\n * 2.9\n *\n */\n#define FT_HINTING_FREETYPE 0\n#define FT_HINTING_ADOBE 1\n\n /* these constants (introduced in 2.4.12) are deprecated */\n#define FT_CFF_HINTING_FREETYPE FT_HINTING_FREETYPE\n#define FT_CFF_HINTING_ADOBE FT_HINTING_ADOBE\n\n\n /**************************************************************************\n *\n * @property:\n * hinting-engine\n *\n * @description:\n * Thanks to Adobe, which contributed a new hinting (and parsing) engine,\n * an application can select between 'freetype' and 'adobe' if compiled\n * with `CFF_CONFIG_OPTION_OLD_ENGINE`. If this configuration macro\n * isn't defined, 'hinting-engine' does nothing.\n *\n * The same holds for the Type~1 and CID modules if compiled with\n * `T1_CONFIG_OPTION_OLD_ENGINE`.\n *\n * For the 'cff' module, the default engine is 'freetype' if\n * `CFF_CONFIG_OPTION_OLD_ENGINE` is defined, and 'adobe' otherwise.\n *\n * For both the 'type1' and 't1cid' modules, the default engine is\n * 'freetype' if `T1_CONFIG_OPTION_OLD_ENGINE` is defined, and 'adobe'\n * otherwise.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values 'adobe' or 'freetype').\n *\n * @example:\n * The following example code demonstrates how to select Adobe's hinting\n * engine for the 'cff' module (omitting the error handling).\n *\n * ```\n * FT_Library library;\n * FT_UInt hinting_engine = FT_HINTING_ADOBE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"cff\",\n * \"hinting-engine\", &hinting_engine );\n * ```\n *\n * @since:\n * 2.4.12 (for 'cff' module)\n *\n * 2.9 (for 'type1' and 't1cid' modules)\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * no-stem-darkening\n *\n * @description:\n * All glyphs that pass through the auto-hinter will be emboldened unless\n * this property is set to TRUE. The same is true for the CFF, Type~1,\n * and CID font modules if the 'Adobe' engine is selected (which is the\n * default).\n *\n * Stem darkening emboldens glyphs at smaller sizes to make them more\n * readable on common low-DPI screens when using linear alpha blending\n * and gamma correction, see @FT_Render_Glyph. When not using linear\n * alpha blending and gamma correction, glyphs will appear heavy and\n * fuzzy!\n *\n * Gamma correction essentially lightens fonts since shades of grey are\n * shifted to higher pixel values (=~higher brightness) to match the\n * original intention to the reality of our screens. The side-effect is\n * that glyphs 'thin out'. Mac OS~X and Adobe's proprietary font\n * rendering library implement a counter-measure: stem darkening at\n * smaller sizes where shades of gray dominate. By emboldening a glyph\n * slightly in relation to its pixel size, individual pixels get higher\n * coverage of filled-in outlines and are therefore 'blacker'. This\n * counteracts the 'thinning out' of glyphs, making text remain readable\n * at smaller sizes.\n *\n * By default, the Adobe engines for CFF, Type~1, and CID fonts darken\n * stems at smaller sizes, regardless of hinting, to enhance contrast.\n * Setting this property, stem darkening gets switched off.\n *\n * For the auto-hinter, stem-darkening is experimental currently and thus\n * switched off by default (this is, `no-stem-darkening` is set to TRUE\n * by default). Total consistency with the CFF driver is not achieved\n * right now because the emboldening method differs and glyphs must be\n * scaled down on the Y-axis to keep outline points inside their\n * precomputed blue zones. The smaller the size (especially 9ppem and\n * down), the higher the loss of emboldening versus the CFF driver.\n *\n * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values 1 and 0 for 'on' and 'off', respectively). It\n * can also be set per face using @FT_Face_Properties with\n * @FT_PARAM_TAG_STEM_DARKENING.\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_Bool no_stem_darkening = TRUE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"cff\",\n * \"no-stem-darkening\", &no_stem_darkening );\n * ```\n *\n * @since:\n * 2.4.12 (for 'cff' module)\n *\n * 2.6.2 (for 'autofitter' module)\n *\n * 2.9 (for 'type1' and 't1cid' modules)\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * darkening-parameters\n *\n * @description:\n * By default, the Adobe hinting engine, as used by the CFF, Type~1, and\n * CID font drivers, darkens stems as follows (if the `no-stem-darkening`\n * property isn't set):\n *\n * ```\n * stem width <= 0.5px: darkening amount = 0.4px\n * stem width = 1px: darkening amount = 0.275px\n * stem width = 1.667px: darkening amount = 0.275px\n * stem width >= 2.333px: darkening amount = 0px\n * ```\n *\n * and piecewise linear in-between. At configuration time, these four\n * control points can be set with the macro\n * `CFF_CONFIG_OPTION_DARKENING_PARAMETERS`; the CFF, Type~1, and CID\n * drivers share these values. At runtime, the control points can be\n * changed using the `darkening-parameters` property (see the example\n * below that demonstrates this for the Type~1 driver).\n *\n * The x~values give the stem width, and the y~values the darkening\n * amount. The unit is 1000th of pixels. All coordinate values must be\n * positive; the x~values must be monotonically increasing; the y~values\n * must be monotonically decreasing and smaller than or equal to 500\n * (corresponding to half a pixel); the slope of each linear piece must\n * be shallower than -1 (e.g., -.4).\n *\n * The auto-hinter provides this property, too, as an experimental\n * feature. See @no-stem-darkening for more.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable, using eight comma-separated integers without spaces. Here\n * the above example, using `\\` to break the line for readability.\n *\n * ```\n * FREETYPE_PROPERTIES=\\\n * type1:darkening-parameters=500,300,1000,200,1500,100,2000,0\n * ```\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_Int darken_params[8] = { 500, 300, // x1, y1\n * 1000, 200, // x2, y2\n * 1500, 100, // x3, y3\n * 2000, 0 }; // x4, y4\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"type1\",\n * \"darkening-parameters\", darken_params );\n * ```\n *\n * @since:\n * 2.5.1 (for 'cff' module)\n *\n * 2.6.2 (for 'autofitter' module)\n *\n * 2.9 (for 'type1' and 't1cid' modules)\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * random-seed\n *\n * @description:\n * By default, the seed value for the CFF 'random' operator and the\n * similar '0 28 callothersubr pop' command for the Type~1 and CID\n * drivers is set to a random value. However, mainly for debugging\n * purposes, it is often necessary to use a known value as a seed so that\n * the pseudo-random number sequences generated by 'random' are\n * repeatable.\n *\n * The `random-seed` property does that. Its argument is a signed 32bit\n * integer; if the value is zero or negative, the seed given by the\n * `intitialRandomSeed` private DICT operator in a CFF file gets used (or\n * a default value if there is no such operator). If the value is\n * positive, use it instead of `initialRandomSeed`, which is consequently\n * ignored.\n *\n * @note:\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable. It can also be set per face using @FT_Face_Properties with\n * @FT_PARAM_TAG_RANDOM_SEED.\n *\n * @since:\n * 2.8 (for 'cff' module)\n *\n * 2.9 (for 'type1' and 't1cid' modules)\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * no-long-family-names\n *\n * @description:\n * If `PCF_CONFIG_OPTION_LONG_FAMILY_NAMES` is active while compiling\n * FreeType, the PCF driver constructs long family names.\n *\n * There are many PCF fonts just called 'Fixed' which look completely\n * different, and which have nothing to do with each other. When\n * selecting 'Fixed' in KDE or Gnome one gets results that appear rather\n * random, the style changes often if one changes the size and one cannot\n * select some fonts at all. The improve this situation, the PCF module\n * prepends the foundry name (plus a space) to the family name. It also\n * checks whether there are 'wide' characters; all put together, family\n * names like 'Sony Fixed' or 'Misc Fixed Wide' are constructed.\n *\n * If `no-long-family-names` is set, this feature gets switched off.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values 1 and 0 for 'on' and 'off', respectively).\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_Bool no_long_family_names = TRUE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"pcf\",\n * \"no-long-family-names\",\n * &no_long_family_names );\n * ```\n *\n * @since:\n * 2.8\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_INTERPRETER_VERSION_XXX\n *\n * @description:\n * A list of constants used for the @interpreter-version property to\n * select the hinting engine for Truetype fonts.\n *\n * The numeric value in the constant names represents the version number\n * as returned by the 'GETINFO' bytecode instruction.\n *\n * @values:\n * TT_INTERPRETER_VERSION_35 ::\n * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in\n * Windows~98; only grayscale and B/W rasterizing is supported.\n *\n * TT_INTERPRETER_VERSION_38 ::\n * Version~38 corresponds to MS rasterizer v.1.9; it is roughly\n * equivalent to the hinting provided by DirectWrite ClearType (as can\n * be found, for example, in the Internet Explorer~9 running on\n * Windows~7). It is used in FreeType to select the 'Infinality'\n * subpixel hinting code. The code may be removed in a future version.\n *\n * TT_INTERPRETER_VERSION_40 ::\n * Version~40 corresponds to MS rasterizer v.2.1; it is roughly\n * equivalent to the hinting provided by DirectWrite ClearType (as can\n * be found, for example, in Microsoft's Edge Browser on Windows~10).\n * It is used in FreeType to select the 'minimal' subpixel hinting\n * code, a stripped-down and higher performance version of the\n * 'Infinality' code.\n *\n * @note:\n * This property controls the behaviour of the bytecode interpreter and\n * thus how outlines get hinted. It does **not** control how glyph get\n * rasterized! In particular, it does not control subpixel color\n * filtering.\n *\n * If FreeType has not been compiled with the configuration option\n * `TT_CONFIG_OPTION_SUBPIXEL_HINTING`, selecting version~38 or~40 causes\n * an `FT_Err_Unimplemented_Feature` error.\n *\n * Depending on the graphics framework, Microsoft uses different bytecode\n * and rendering engines. As a consequence, the version numbers returned\n * by a call to the 'GETINFO' bytecode instruction are more convoluted\n * than desired.\n *\n * Here are two tables that try to shed some light on the possible values\n * for the MS rasterizer engine, together with the additional features\n * introduced by it.\n *\n * ```\n * GETINFO framework version feature\n * -------------------------------------------------------------------\n * 3 GDI (Win 3.1), v1.0 16-bit, first version\n * TrueImage\n * 33 GDI (Win NT 3.1), v1.5 32-bit\n * HP Laserjet\n * 34 GDI (Win 95) v1.6 font smoothing,\n * new SCANTYPE opcode\n * 35 GDI (Win 98/2000) v1.7 (UN)SCALED_COMPONENT_OFFSET\n * bits in composite glyphs\n * 36 MGDI (Win CE 2) v1.6+ classic ClearType\n * 37 GDI (XP and later), v1.8 ClearType\n * GDI+ old (before Vista)\n * 38 GDI+ old (Vista, Win 7), v1.9 subpixel ClearType,\n * WPF Y-direction ClearType,\n * additional error checking\n * 39 DWrite (before Win 8) v2.0 subpixel ClearType flags\n * in GETINFO opcode,\n * bug fixes\n * 40 GDI+ (after Win 7), v2.1 Y-direction ClearType flag\n * DWrite (Win 8) in GETINFO opcode,\n * Gray ClearType\n * ```\n *\n * The 'version' field gives a rough orientation only, since some\n * applications provided certain features much earlier (as an example,\n * Microsoft Reader used subpixel and Y-direction ClearType already in\n * Windows 2000). Similarly, updates to a given framework might include\n * improved hinting support.\n *\n * ```\n * version sampling rendering comment\n * x y x y\n * --------------------------------------------------------------\n * v1.0 normal normal B/W B/W bi-level\n * v1.6 high high gray gray grayscale\n * v1.8 high normal color-filter B/W (GDI) ClearType\n * v1.9 high high color-filter gray Color ClearType\n * v2.1 high normal gray B/W Gray ClearType\n * v2.1 high high gray gray Gray ClearType\n * ```\n *\n * Color and Gray ClearType are the two available variants of\n * 'Y-direction ClearType', meaning grayscale rasterization along the\n * Y-direction; the name used in the TrueType specification for this\n * feature is 'symmetric smoothing'. 'Classic ClearType' is the original\n * algorithm used before introducing a modified version in Win~XP.\n * Another name for v1.6's grayscale rendering is 'font smoothing', and\n * 'Color ClearType' is sometimes also called 'DWrite ClearType'. To\n * differentiate between today's Color ClearType and the earlier\n * ClearType variant with B/W rendering along the vertical axis, the\n * latter is sometimes called 'GDI ClearType'.\n *\n * 'Normal' and 'high' sampling describe the (virtual) resolution to\n * access the rasterized outline after the hinting process. 'Normal'\n * means 1 sample per grid line (i.e., B/W). In the current Microsoft\n * implementation, 'high' means an extra virtual resolution of 16x16 (or\n * 16x1) grid lines per pixel for bytecode instructions like 'MIRP'.\n * After hinting, these 16 grid lines are mapped to 6x5 (or 6x1) grid\n * lines for color filtering if Color ClearType is activated.\n *\n * Note that 'Gray ClearType' is essentially the same as v1.6's grayscale\n * rendering. However, the GETINFO instruction handles it differently:\n * v1.6 returns bit~12 (hinting for grayscale), while v2.1 returns\n * bits~13 (hinting for ClearType), 18 (symmetrical smoothing), and~19\n * (Gray ClearType). Also, this mode respects bits 2 and~3 for the\n * version~1 gasp table exclusively (like Color ClearType), while v1.6\n * only respects the values of version~0 (bits 0 and~1).\n *\n * Keep in mind that the features of the above interpreter versions might\n * not map exactly to FreeType features or behavior because it is a\n * fundamentally different library with different internals.\n *\n */\n#define TT_INTERPRETER_VERSION_35 35\n#define TT_INTERPRETER_VERSION_38 38\n#define TT_INTERPRETER_VERSION_40 40\n\n\n /**************************************************************************\n *\n * @property:\n * interpreter-version\n *\n * @description:\n * Currently, three versions are available, two representing the bytecode\n * interpreter with subpixel hinting support (old 'Infinality' code and\n * new stripped-down and higher performance 'minimal' code) and one\n * without, respectively. The default is subpixel support if\n * `TT_CONFIG_OPTION_SUBPIXEL_HINTING` is defined, and no subpixel\n * support otherwise (since it isn't available then).\n *\n * If subpixel hinting is on, many TrueType bytecode instructions behave\n * differently compared to B/W or grayscale rendering (except if 'native\n * ClearType' is selected by the font). Microsoft's main idea is to\n * render at a much increased horizontal resolution, then sampling down\n * the created output to subpixel precision. However, many older fonts\n * are not suited to this and must be specially taken care of by applying\n * (hardcoded) tweaks in Microsoft's interpreter.\n *\n * Details on subpixel hinting and some of the necessary tweaks can be\n * found in Greg Hitchcock's whitepaper at\n * 'https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'.\n * Note that FreeType currently doesn't really 'subpixel hint' (6x1, 6x2,\n * or 6x5 supersampling) like discussed in the paper. Depending on the\n * chosen interpreter, it simply ignores instructions on vertical stems\n * to arrive at very similar results.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values '35', '38', or '40').\n *\n * @example:\n * The following example code demonstrates how to deactivate subpixel\n * hinting (omitting the error handling).\n *\n * ```\n * FT_Library library;\n * FT_Face face;\n * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_35;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"truetype\",\n * \"interpreter-version\",\n * &interpreter_version );\n * ```\n *\n * @since:\n * 2.5\n */\n\n\n /**************************************************************************\n *\n * @property:\n * glyph-to-script-map\n *\n * @description:\n * **Experimental only**\n *\n * The auto-hinter provides various script modules to hint glyphs.\n * Examples of supported scripts are Latin or CJK. Before a glyph is\n * auto-hinted, the Unicode character map of the font gets examined, and\n * the script is then determined based on Unicode character ranges, see\n * below.\n *\n * OpenType fonts, however, often provide much more glyphs than character\n * codes (small caps, superscripts, ligatures, swashes, etc.), to be\n * controlled by so-called 'features'. Handling OpenType features can be\n * quite complicated and thus needs a separate library on top of\n * FreeType.\n *\n * The mapping between glyph indices and scripts (in the auto-hinter\n * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an array\n * with `num_glyphs` elements, as found in the font's @FT_Face structure.\n * The `glyph-to-script-map` property returns a pointer to this array,\n * which can be modified as needed. Note that the modification should\n * happen before the first glyph gets processed by the auto-hinter so\n * that the global analysis of the font shapes actually uses the modified\n * mapping.\n *\n * @example:\n * The following example code demonstrates how to access it (omitting the\n * error handling).\n *\n * ```\n * FT_Library library;\n * FT_Face face;\n * FT_Prop_GlyphToScriptMap prop;\n *\n *\n * FT_Init_FreeType( &library );\n * FT_New_Face( library, \"foo.ttf\", 0, &face );\n *\n * prop.face = face;\n *\n * FT_Property_Get( library, \"autofitter\",\n * \"glyph-to-script-map\", &prop );\n *\n * // adjust `prop.map' as needed right here\n *\n * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT );\n * ```\n *\n * @since:\n * 2.4.11\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_AUTOHINTER_SCRIPT_XXX\n *\n * @description:\n * **Experimental only**\n *\n * A list of constants used for the @glyph-to-script-map property to\n * specify the script submodule the auto-hinter should use for hinting a\n * particular glyph.\n *\n * @values:\n * FT_AUTOHINTER_SCRIPT_NONE ::\n * Don't auto-hint this glyph.\n *\n * FT_AUTOHINTER_SCRIPT_LATIN ::\n * Apply the latin auto-hinter. For the auto-hinter, 'latin' is a very\n * broad term, including Cyrillic and Greek also since characters from\n * those scripts share the same design constraints.\n *\n * By default, characters from the following Unicode ranges are\n * assigned to this submodule.\n *\n * ```\n * U+0020 - U+007F // Basic Latin (no control characters)\n * U+00A0 - U+00FF // Latin-1 Supplement (no control characters)\n * U+0100 - U+017F // Latin Extended-A\n * U+0180 - U+024F // Latin Extended-B\n * U+0250 - U+02AF // IPA Extensions\n * U+02B0 - U+02FF // Spacing Modifier Letters\n * U+0300 - U+036F // Combining Diacritical Marks\n * U+0370 - U+03FF // Greek and Coptic\n * U+0400 - U+04FF // Cyrillic\n * U+0500 - U+052F // Cyrillic Supplement\n * U+1D00 - U+1D7F // Phonetic Extensions\n * U+1D80 - U+1DBF // Phonetic Extensions Supplement\n * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement\n * U+1E00 - U+1EFF // Latin Extended Additional\n * U+1F00 - U+1FFF // Greek Extended\n * U+2000 - U+206F // General Punctuation\n * U+2070 - U+209F // Superscripts and Subscripts\n * U+20A0 - U+20CF // Currency Symbols\n * U+2150 - U+218F // Number Forms\n * U+2460 - U+24FF // Enclosed Alphanumerics\n * U+2C60 - U+2C7F // Latin Extended-C\n * U+2DE0 - U+2DFF // Cyrillic Extended-A\n * U+2E00 - U+2E7F // Supplemental Punctuation\n * U+A640 - U+A69F // Cyrillic Extended-B\n * U+A720 - U+A7FF // Latin Extended-D\n * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures)\n * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols\n * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement\n * ```\n *\n * FT_AUTOHINTER_SCRIPT_CJK ::\n * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old\n * Vietnamese, and some other scripts.\n *\n * By default, characters from the following Unicode ranges are\n * assigned to this submodule.\n *\n * ```\n * U+1100 - U+11FF // Hangul Jamo\n * U+2E80 - U+2EFF // CJK Radicals Supplement\n * U+2F00 - U+2FDF // Kangxi Radicals\n * U+2FF0 - U+2FFF // Ideographic Description Characters\n * U+3000 - U+303F // CJK Symbols and Punctuation\n * U+3040 - U+309F // Hiragana\n * U+30A0 - U+30FF // Katakana\n * U+3100 - U+312F // Bopomofo\n * U+3130 - U+318F // Hangul Compatibility Jamo\n * U+3190 - U+319F // Kanbun\n * U+31A0 - U+31BF // Bopomofo Extended\n * U+31C0 - U+31EF // CJK Strokes\n * U+31F0 - U+31FF // Katakana Phonetic Extensions\n * U+3200 - U+32FF // Enclosed CJK Letters and Months\n * U+3300 - U+33FF // CJK Compatibility\n * U+3400 - U+4DBF // CJK Unified Ideographs Extension A\n * U+4DC0 - U+4DFF // Yijing Hexagram Symbols\n * U+4E00 - U+9FFF // CJK Unified Ideographs\n * U+A960 - U+A97F // Hangul Jamo Extended-A\n * U+AC00 - U+D7AF // Hangul Syllables\n * U+D7B0 - U+D7FF // Hangul Jamo Extended-B\n * U+F900 - U+FAFF // CJK Compatibility Ideographs\n * U+FE10 - U+FE1F // Vertical forms\n * U+FE30 - U+FE4F // CJK Compatibility Forms\n * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms\n * U+1B000 - U+1B0FF // Kana Supplement\n * U+1D300 - U+1D35F // Tai Xuan Hing Symbols\n * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement\n * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B\n * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C\n * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D\n * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement\n * ```\n *\n * FT_AUTOHINTER_SCRIPT_INDIC ::\n * Apply the indic auto-hinter, covering all major scripts from the\n * Indian sub-continent and some other related scripts like Thai, Lao,\n * or Tibetan.\n *\n * By default, characters from the following Unicode ranges are\n * assigned to this submodule.\n *\n * ```\n * U+0900 - U+0DFF // Indic Range\n * U+0F00 - U+0FFF // Tibetan\n * U+1900 - U+194F // Limbu\n * U+1B80 - U+1BBF // Sundanese\n * U+A800 - U+A82F // Syloti Nagri\n * U+ABC0 - U+ABFF // Meetei Mayek\n * U+11800 - U+118DF // Sharada\n * ```\n *\n * Note that currently Indic support is rudimentary only, missing blue\n * zone support.\n *\n * @since:\n * 2.4.11\n *\n */\n#define FT_AUTOHINTER_SCRIPT_NONE 0\n#define FT_AUTOHINTER_SCRIPT_LATIN 1\n#define FT_AUTOHINTER_SCRIPT_CJK 2\n#define FT_AUTOHINTER_SCRIPT_INDIC 3\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Prop_GlyphToScriptMap\n *\n * @description:\n * **Experimental only**\n *\n * The data exchange structure for the @glyph-to-script-map property.\n *\n * @since:\n * 2.4.11\n *\n */\n typedef struct FT_Prop_GlyphToScriptMap_\n {\n FT_Face face;\n FT_UShort* map;\n\n } FT_Prop_GlyphToScriptMap;\n\n\n /**************************************************************************\n *\n * @property:\n * fallback-script\n *\n * @description:\n * **Experimental only**\n *\n * If no auto-hinter script module can be assigned to a glyph, a fallback\n * script gets assigned to it (see also the @glyph-to-script-map\n * property). By default, this is @FT_AUTOHINTER_SCRIPT_CJK. Using the\n * `fallback-script` property, this fallback value can be changed.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * It's important to use the right timing for changing this value: The\n * creation of the glyph-to-script map that eventually uses the fallback\n * script value gets triggered either by setting or reading a\n * face-specific property like @glyph-to-script-map, or by auto-hinting\n * any glyph from that face. In particular, if you have already created\n * an @FT_Face structure but not loaded any glyph (using the\n * auto-hinter), a change of the fallback script will affect this face.\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"autofitter\",\n * \"fallback-script\", &fallback_script );\n * ```\n *\n * @since:\n * 2.4.11\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * default-script\n *\n * @description:\n * **Experimental only**\n *\n * If FreeType gets compiled with `FT_CONFIG_OPTION_USE_HARFBUZZ` to make\n * the HarfBuzz library access OpenType features for getting better glyph\n * coverages, this property sets the (auto-fitter) script to be used for\n * the default (OpenType) script data of a font's GSUB table. Features\n * for the default script are intended for all scripts not explicitly\n * handled in GSUB; an example is a 'dlig' feature, containing the\n * combination of the characters 'T', 'E', and 'L' to form a 'TEL'\n * ligature.\n *\n * By default, this is @FT_AUTOHINTER_SCRIPT_LATIN. Using the\n * `default-script` property, this default value can be changed.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * It's important to use the right timing for changing this value: The\n * creation of the glyph-to-script map that eventually uses the default\n * script value gets triggered either by setting or reading a\n * face-specific property like @glyph-to-script-map, or by auto-hinting\n * any glyph from that face. In particular, if you have already created\n * an @FT_Face structure but not loaded any glyph (using the\n * auto-hinter), a change of the default script will affect this face.\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_UInt default_script = FT_AUTOHINTER_SCRIPT_NONE;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"autofitter\",\n * \"default-script\", &default_script );\n * ```\n *\n * @since:\n * 2.5.3\n *\n */\n\n\n /**************************************************************************\n *\n * @property:\n * increase-x-height\n *\n * @description:\n * For ppem values in the range 6~<= ppem <= `increase-x-height`, round\n * up the font's x~height much more often than normally. If the value is\n * set to~0, which is the default, this feature is switched off. Use\n * this property to improve the legibility of small font sizes if\n * necessary.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * Set this value right after calling @FT_Set_Char_Size, but before\n * loading any glyph (using the auto-hinter).\n *\n * @example:\n * ```\n * FT_Library library;\n * FT_Face face;\n * FT_Prop_IncreaseXHeight prop;\n *\n *\n * FT_Init_FreeType( &library );\n * FT_New_Face( library, \"foo.ttf\", 0, &face );\n * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 );\n *\n * prop.face = face;\n * prop.limit = 14;\n *\n * FT_Property_Set( library, \"autofitter\",\n * \"increase-x-height\", &prop );\n * ```\n *\n * @since:\n * 2.4.11\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Prop_IncreaseXHeight\n *\n * @description:\n * The data exchange structure for the @increase-x-height property.\n *\n */\n typedef struct FT_Prop_IncreaseXHeight_\n {\n FT_Face face;\n FT_UInt limit;\n\n } FT_Prop_IncreaseXHeight;\n\n\n /**************************************************************************\n *\n * @property:\n * warping\n *\n * @description:\n * **Experimental only**\n *\n * If FreeType gets compiled with option `AF_CONFIG_OPTION_USE_WARPER` to\n * activate the warp hinting code in the auto-hinter, this property\n * switches warping on and off.\n *\n * Warping only works in 'normal' auto-hinting mode replacing it. The\n * idea of the code is to slightly scale and shift a glyph along the\n * non-hinted dimension (which is usually the horizontal axis) so that as\n * much of its segments are aligned (more or less) to the grid. To find\n * out a glyph's optimal scaling and shifting value, various parameter\n * combinations are tried and scored.\n *\n * By default, warping is off.\n *\n * @note:\n * This property can be used with @FT_Property_Get also.\n *\n * This property can be set via the `FREETYPE_PROPERTIES` environment\n * variable (using values 1 and 0 for 'on' and 'off', respectively).\n *\n * The warping code can also change advance widths. Have a look at the\n * `lsb_delta` and `rsb_delta` fields in the @FT_GlyphSlotRec structure\n * for details on improving inter-glyph distances while rendering.\n *\n * Since warping is a global property of the auto-hinter it is best to\n * change its value before rendering any face. Otherwise, you should\n * reload all faces that get auto-hinted in 'normal' hinting mode.\n *\n * @example:\n * This example shows how to switch on warping (omitting the error\n * handling).\n *\n * ```\n * FT_Library library;\n * FT_Bool warping = 1;\n *\n *\n * FT_Init_FreeType( &library );\n *\n * FT_Property_Set( library, \"autofitter\", \"warping\", &warping );\n * ```\n *\n * @since:\n * 2.6\n *\n */\n\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* FTDRIVER_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/fterrdef.h", "language": "code", "loc": 249, "comment_density": 0.253, "code": "/****************************************************************************\n *\n * fterrdef.h\n *\n * FreeType error codes (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * error_code_values\n *\n * @title:\n * Error Code Values\n *\n * @abstract:\n * All possible error codes returned by FreeType functions.\n *\n * @description:\n * The list below is taken verbatim from the file `fterrdef.h` (loaded\n * automatically by including `FT_FREETYPE_H`). The first argument of the\n * `FT_ERROR_DEF_` macro is the error label; by default, the prefix\n * `FT_Err_` gets added so that you get error names like\n * `FT_Err_Cannot_Open_Resource`. The second argument is the error code,\n * and the last argument an error string, which is not used by FreeType.\n *\n * Within your application you should **only** use error names and\n * **never** its numeric values! The latter might (and actually do)\n * change in forthcoming FreeType versions.\n *\n * Macro `FT_NOERRORDEF_` defines `FT_Err_Ok`, which is always zero. See\n * the 'Error Enumerations' subsection how to automatically generate a\n * list of error strings.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Err_XXX\n *\n */\n\n /* generic errors */\n\n FT_NOERRORDEF_( Ok, 0x00,\n \"no error\" )\n\n FT_ERRORDEF_( Cannot_Open_Resource, 0x01,\n \"cannot open resource\" )\n FT_ERRORDEF_( Unknown_File_Format, 0x02,\n \"unknown file format\" )\n FT_ERRORDEF_( Invalid_File_Format, 0x03,\n \"broken file\" )\n FT_ERRORDEF_( Invalid_Version, 0x04,\n \"invalid FreeType version\" )\n FT_ERRORDEF_( Lower_Module_Version, 0x05,\n \"module version is too low\" )\n FT_ERRORDEF_( Invalid_Argument, 0x06,\n \"invalid argument\" )\n FT_ERRORDEF_( Unimplemented_Feature, 0x07,\n \"unimplemented feature\" )\n FT_ERRORDEF_( Invalid_Table, 0x08,\n \"broken table\" )\n FT_ERRORDEF_( Invalid_Offset, 0x09,\n \"broken offset within table\" )\n FT_ERRORDEF_( Array_Too_Large, 0x0A,\n \"array allocation size too large\" )\n FT_ERRORDEF_( Missing_Module, 0x0B,\n \"missing module\" )\n FT_ERRORDEF_( Missing_Property, 0x0C,\n \"missing property\" )\n\n /* glyph/character errors */\n\n FT_ERRORDEF_( Invalid_Glyph_Index, 0x10,\n \"invalid glyph index\" )\n FT_ERRORDEF_( Invalid_Character_Code, 0x11,\n \"invalid character code\" )\n FT_ERRORDEF_( Invalid_Glyph_Format, 0x12,\n \"unsupported glyph image format\" )\n FT_ERRORDEF_( Cannot_Render_Glyph, 0x13,\n \"cannot render this glyph format\" )\n FT_ERRORDEF_( Invalid_Outline, 0x14,\n \"invalid outline\" )\n FT_ERRORDEF_( Invalid_Composite, 0x15,\n \"invalid composite glyph\" )\n FT_ERRORDEF_( Too_Many_Hints, 0x16,\n \"too many hints\" )\n FT_ERRORDEF_( Invalid_Pixel_Size, 0x17,\n \"invalid pixel size\" )\n\n /* handle errors */\n\n FT_ERRORDEF_( Invalid_Handle, 0x20,\n \"invalid object handle\" )\n FT_ERRORDEF_( Invalid_Library_Handle, 0x21,\n \"invalid library handle\" )\n FT_ERRORDEF_( Invalid_Driver_Handle, 0x22,\n \"invalid module handle\" )\n FT_ERRORDEF_( Invalid_Face_Handle, 0x23,\n \"invalid face handle\" )\n FT_ERRORDEF_( Invalid_Size_Handle, 0x24,\n \"invalid size handle\" )\n FT_ERRORDEF_( Invalid_Slot_Handle, 0x25,\n \"invalid glyph slot handle\" )\n FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26,\n \"invalid charmap handle\" )\n FT_ERRORDEF_( Invalid_Cache_Handle, 0x27,\n \"invalid cache manager handle\" )\n FT_ERRORDEF_( Invalid_Stream_Handle, 0x28,\n \"invalid stream handle\" )\n\n /* driver errors */\n\n FT_ERRORDEF_( Too_Many_Drivers, 0x30,\n \"too many modules\" )\n FT_ERRORDEF_( Too_Many_Extensions, 0x31,\n \"too many extensions\" )\n\n /* memory errors */\n\n FT_ERRORDEF_( Out_Of_Memory, 0x40,\n \"out of memory\" )\n FT_ERRORDEF_( Unlisted_Object, 0x41,\n \"unlisted object\" )\n\n /* stream errors */\n\n FT_ERRORDEF_( Cannot_Open_Stream, 0x51,\n \"cannot open stream\" )\n FT_ERRORDEF_( Invalid_Stream_Seek, 0x52,\n \"invalid stream seek\" )\n FT_ERRORDEF_( Invalid_Stream_Skip, 0x53,\n \"invalid stream skip\" )\n FT_ERRORDEF_( Invalid_Stream_Read, 0x54,\n \"invalid stream read\" )\n FT_ERRORDEF_( Invalid_Stream_Operation, 0x55,\n \"invalid stream operation\" )\n FT_ERRORDEF_( Invalid_Frame_Operation, 0x56,\n \"invalid frame operation\" )\n FT_ERRORDEF_( Nested_Frame_Access, 0x57,\n \"nested frame access\" )\n FT_ERRORDEF_( Invalid_Frame_Read, 0x58,\n \"invalid frame read\" )\n\n /* raster errors */\n\n FT_ERRORDEF_( Raster_Uninitialized, 0x60,\n \"raster uninitialized\" )\n FT_ERRORDEF_( Raster_Corrupted, 0x61,\n \"raster corrupted\" )\n FT_ERRORDEF_( Raster_Overflow, 0x62,\n \"raster overflow\" )\n FT_ERRORDEF_( Raster_Negative_Height, 0x63,\n \"negative height while rastering\" )\n\n /* cache errors */\n\n FT_ERRORDEF_( Too_Many_Caches, 0x70,\n \"too many registered caches\" )\n\n /* TrueType and SFNT errors */\n\n FT_ERRORDEF_( Invalid_Opcode, 0x80,\n \"invalid opcode\" )\n FT_ERRORDEF_( Too_Few_Arguments, 0x81,\n \"too few arguments\" )\n FT_ERRORDEF_( Stack_Overflow, 0x82,\n \"stack overflow\" )\n FT_ERRORDEF_( Code_Overflow, 0x83,\n \"code overflow\" )\n FT_ERRORDEF_( Bad_Argument, 0x84,\n \"bad argument\" )\n FT_ERRORDEF_( Divide_By_Zero, 0x85,\n \"division by zero\" )\n FT_ERRORDEF_( Invalid_Reference, 0x86,\n \"invalid reference\" )\n FT_ERRORDEF_( Debug_OpCode, 0x87,\n \"found debug opcode\" )\n FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88,\n \"found ENDF opcode in execution stream\" )\n FT_ERRORDEF_( Nested_DEFS, 0x89,\n \"nested DEFS\" )\n FT_ERRORDEF_( Invalid_CodeRange, 0x8A,\n \"invalid code range\" )\n FT_ERRORDEF_( Execution_Too_Long, 0x8B,\n \"execution context too long\" )\n FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C,\n \"too many function definitions\" )\n FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D,\n \"too many instruction definitions\" )\n FT_ERRORDEF_( Table_Missing, 0x8E,\n \"SFNT font table missing\" )\n FT_ERRORDEF_( Horiz_Header_Missing, 0x8F,\n \"horizontal header (hhea) table missing\" )\n FT_ERRORDEF_( Locations_Missing, 0x90,\n \"locations (loca) table missing\" )\n FT_ERRORDEF_( Name_Table_Missing, 0x91,\n \"name table missing\" )\n FT_ERRORDEF_( CMap_Table_Missing, 0x92,\n \"character map (cmap) table missing\" )\n FT_ERRORDEF_( Hmtx_Table_Missing, 0x93,\n \"horizontal metrics (hmtx) table missing\" )\n FT_ERRORDEF_( Post_Table_Missing, 0x94,\n \"PostScript (post) table missing\" )\n FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95,\n \"invalid horizontal metrics\" )\n FT_ERRORDEF_( Invalid_CharMap_Format, 0x96,\n \"invalid character map (cmap) format\" )\n FT_ERRORDEF_( Invalid_PPem, 0x97,\n \"invalid ppem value\" )\n FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98,\n \"invalid vertical metrics\" )\n FT_ERRORDEF_( Could_Not_Find_Context, 0x99,\n \"could not find context\" )\n FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A,\n \"invalid PostScript (post) table format\" )\n FT_ERRORDEF_( Invalid_Post_Table, 0x9B,\n \"invalid PostScript (post) table\" )\n FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C,\n \"found FDEF or IDEF opcode in glyf bytecode\" )\n FT_ERRORDEF_( Missing_Bitmap, 0x9D,\n \"missing bitmap in strike\" )\n\n /* CFF, CID, and Type 1 errors */\n\n FT_ERRORDEF_( Syntax_Error, 0xA0,\n \"opcode syntax error\" )\n FT_ERRORDEF_( Stack_Underflow, 0xA1,\n \"argument stack underflow\" )\n FT_ERRORDEF_( Ignore, 0xA2,\n \"ignore\" )\n FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3,\n \"no Unicode glyph name found\" )\n FT_ERRORDEF_( Glyph_Too_Big, 0xA4,\n \"glyph too big for hinting\" )\n\n /* BDF errors */\n\n FT_ERRORDEF_( Missing_Startfont_Field, 0xB0,\n \"`STARTFONT' field missing\" )\n FT_ERRORDEF_( Missing_Font_Field, 0xB1,\n \"`FONT' field missing\" )\n FT_ERRORDEF_( Missing_Size_Field, 0xB2,\n \"`SIZE' field missing\" )\n FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3,\n \"`FONTBOUNDINGBOX' field missing\" )\n FT_ERRORDEF_( Missing_Chars_Field, 0xB4,\n \"`CHARS' field missing\" )\n FT_ERRORDEF_( Missing_Startchar_Field, 0xB5,\n \"`STARTCHAR' field missing\" )\n FT_ERRORDEF_( Missing_Encoding_Field, 0xB6,\n \"`ENCODING' field missing\" )\n FT_ERRORDEF_( Missing_Bbx_Field, 0xB7,\n \"`BBX' field missing\" )\n FT_ERRORDEF_( Bbx_Too_Big, 0xB8,\n \"`BBX' too big\" )\n FT_ERRORDEF_( Corrupted_Font_Header, 0xB9,\n \"Font header corrupted or missing fields\" )\n FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA,\n \"Font glyphs corrupted or missing fields\" )\n\n /* */\n\n\n/* END */\n"}, {"path": "includes/freetype/fterrors.h", "language": "code", "loc": 237, "comment_density": 0.764, "code": "/****************************************************************************\n *\n * fterrors.h\n *\n * FreeType error code handling (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * error_enumerations\n *\n * @title:\n * Error Enumerations\n *\n * @abstract:\n * How to handle errors and error strings.\n *\n * @description:\n * The header file `fterrors.h` (which is automatically included by\n * `freetype.h` defines the handling of FreeType's enumeration\n * constants. It can also be used to generate error message strings\n * with a small macro trick explained below.\n *\n * **Error Formats**\n *\n * The configuration macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` can be\n * defined in `ftoption.h` in order to make the higher byte indicate the\n * module where the error has happened (this is not compatible with\n * standard builds of FreeType~2, however). See the file `ftmoderr.h`\n * for more details.\n *\n * **Error Message Strings**\n *\n * Error definitions are set up with special macros that allow client\n * applications to build a table of error message strings. The strings\n * are not included in a normal build of FreeType~2 to save space (most\n * client applications do not use them).\n *\n * To do so, you have to define the following macros before including\n * this file.\n *\n * ```\n * FT_ERROR_START_LIST\n * ```\n *\n * This macro is called before anything else to define the start of the\n * error list. It is followed by several `FT_ERROR_DEF` calls.\n *\n * ```\n * FT_ERROR_DEF( e, v, s )\n * ```\n *\n * This macro is called to define one single error. 'e' is the error\n * code identifier (e.g., `Invalid_Argument`), 'v' is the error's\n * numerical value, and 's' is the corresponding error string.\n *\n * ```\n * FT_ERROR_END_LIST\n * ```\n *\n * This macro ends the list.\n *\n * Additionally, you have to undefine `FTERRORS_H_` before #including\n * this file.\n *\n * Here is a simple example.\n *\n * ```\n * #undef FTERRORS_H_\n * #define FT_ERRORDEF( e, v, s ) { e, s },\n * #define FT_ERROR_START_LIST {\n * #define FT_ERROR_END_LIST { 0, NULL } };\n *\n * const struct\n * {\n * int err_code;\n * const char* err_msg;\n * } ft_errors[] =\n *\n * #include FT_ERRORS_H\n * ```\n *\n * An alternative to using an array is a switch statement.\n *\n * ```\n * #undef FTERRORS_H_\n * #define FT_ERROR_START_LIST switch ( error_code ) {\n * #define FT_ERRORDEF( e, v, s ) case v: return s;\n * #define FT_ERROR_END_LIST }\n * ```\n *\n * If you use `FT_CONFIG_OPTION_USE_MODULE_ERRORS`, `error_code` should\n * be replaced with `FT_ERROR_BASE(error_code)` in the last example.\n */\n\n /* */\n\n /* In previous FreeType versions we used `__FTERRORS_H__`. However, */\n /* using two successive underscores in a non-system symbol name */\n /* violates the C (and C++) standard, so it was changed to the */\n /* current form. In spite of this, we have to make */\n /* */\n /* ``` */\n /* #undefine __FTERRORS_H__ */\n /* ``` */\n /* */\n /* work for backward compatibility. */\n /* */\n#if !( defined( FTERRORS_H_ ) && defined ( __FTERRORS_H__ ) )\n#define FTERRORS_H_\n#define __FTERRORS_H__\n\n\n /* include module base error codes */\n#include FT_MODULE_ERRORS_H\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** SETUP MACROS *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n\n#undef FT_NEED_EXTERN_C\n\n\n /* FT_ERR_PREFIX is used as a prefix for error identifiers. */\n /* By default, we use `FT_Err_`. */\n /* */\n#ifndef FT_ERR_PREFIX\n#define FT_ERR_PREFIX FT_Err_\n#endif\n\n\n /* FT_ERR_BASE is used as the base for module-specific errors. */\n /* */\n#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS\n\n#ifndef FT_ERR_BASE\n#define FT_ERR_BASE FT_Mod_Err_Base\n#endif\n\n#else\n\n#undef FT_ERR_BASE\n#define FT_ERR_BASE 0\n\n#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */\n\n\n /* If FT_ERRORDEF is not defined, we need to define a simple */\n /* enumeration type. */\n /* */\n#ifndef FT_ERRORDEF\n\n#define FT_INCLUDE_ERR_PROTOS\n\n#define FT_ERRORDEF( e, v, s ) e = v,\n#define FT_ERROR_START_LIST enum {\n#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };\n\n#ifdef __cplusplus\n#define FT_NEED_EXTERN_C\n extern \"C\" {\n#endif\n\n#endif /* !FT_ERRORDEF */\n\n\n /* this macro is used to define an error */\n#define FT_ERRORDEF_( e, v, s ) \\\n FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )\n\n /* this is only used for _Err_Ok, which must be 0! */\n#define FT_NOERRORDEF_( e, v, s ) \\\n FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )\n\n\n#ifdef FT_ERROR_START_LIST\n FT_ERROR_START_LIST\n#endif\n\n\n /* now include the error codes */\n#include FT_ERROR_DEFINITIONS_H\n\n\n#ifdef FT_ERROR_END_LIST\n FT_ERROR_END_LIST\n#endif\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** SIMPLE CLEANUP *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n#ifdef FT_NEED_EXTERN_C\n }\n#endif\n\n#undef FT_ERROR_START_LIST\n#undef FT_ERROR_END_LIST\n\n#undef FT_ERRORDEF\n#undef FT_ERRORDEF_\n#undef FT_NOERRORDEF_\n\n#undef FT_NEED_EXTERN_C\n#undef FT_ERR_BASE\n\n /* FT_ERR_PREFIX is needed internally */\n#ifndef FT2_BUILD_LIBRARY\n#undef FT_ERR_PREFIX\n#endif\n\n /* FT_INCLUDE_ERR_PROTOS: Control if function prototypes should be */\n /* included with `#include FT_ERRORS_H'. This is */\n /* only true where `FT_ERRORDEF` is undefined. */\n /* FT_ERR_PROTOS_DEFINED: Actual multiple-inclusion protection of */\n /* `fterrors.h`. */\n#ifdef FT_INCLUDE_ERR_PROTOS\n#undef FT_INCLUDE_ERR_PROTOS\n\n#ifndef FT_ERR_PROTOS_DEFINED\n#define FT_ERR_PROTOS_DEFINED\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @function:\n * FT_Error_String\n *\n * @description:\n * Retrieve the description of a valid FreeType error code.\n *\n * @input:\n * error_code ::\n * A valid FreeType error code.\n *\n * @return:\n * A C~string or `NULL`, if any error occurred.\n *\n * @note:\n * FreeType has to be compiled with `FT_CONFIG_OPTION_ERROR_STRINGS` or\n * `FT_DEBUG_LEVEL_ERROR` to get meaningful descriptions.\n * 'error_string' will be `NULL` otherwise.\n *\n * Module identification will be ignored:\n *\n * ```c\n * strcmp( FT_Error_String( FT_Err_Unknown_File_Format ),\n * FT_Error_String( BDF_Err_Unknown_File_Format ) ) == 0;\n * ```\n */\n FT_EXPORT( const char* )\n FT_Error_String( FT_Error error_code );\n\nFT_END_HEADER\n\n\n#endif /* FT_ERR_PROTOS_DEFINED */\n\n#endif /* FT_INCLUDE_ERR_PROTOS */\n\n#endif /* !(FTERRORS_H_ && __FTERRORS_H__) */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftfntfmt.h", "language": "code", "loc": 75, "comment_density": 0.8, "code": "/****************************************************************************\n *\n * ftfntfmt.h\n *\n * Support functions for font formats.\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTFNTFMT_H_\n#define FTFNTFMT_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * font_formats\n *\n * @title:\n * Font Formats\n *\n * @abstract:\n * Getting the font format.\n *\n * @description:\n * The single function in this section can be used to get the font format.\n * Note that this information is not needed normally; however, there are\n * special cases (like in PDF devices) where it is important to\n * differentiate, in spite of FreeType's uniform API.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Font_Format\n *\n * @description:\n * Return a string describing the format of a given face. Possible values\n * are 'TrueType', 'Type~1', 'BDF', 'PCF', 'Type~42', 'CID~Type~1', 'CFF',\n * 'PFR', and 'Windows~FNT'.\n *\n * The return value is suitable to be used as an X11 FONT_PROPERTY.\n *\n * @input:\n * face ::\n * Input face handle.\n *\n * @return:\n * Font format string. `NULL` in case of error.\n *\n * @note:\n * A deprecated name for the same function is `FT_Get_X11_Font_Format`.\n */\n FT_EXPORT( const char* )\n FT_Get_Font_Format( FT_Face face );\n\n\n /* deprecated */\n FT_EXPORT( const char* )\n FT_Get_X11_Font_Format( FT_Face face );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTFNTFMT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftgasp.h", "language": "code", "loc": 127, "comment_density": 0.85, "code": "/****************************************************************************\n *\n * ftgasp.h\n *\n * Access of TrueType's 'gasp' table (specification).\n *\n * Copyright (C) 2007-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTGASP_H_\n#define FTGASP_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * gasp_table\n *\n * @title:\n * Gasp Table\n *\n * @abstract:\n * Retrieving TrueType 'gasp' table entries.\n *\n * @description:\n * The function @FT_Get_Gasp can be used to query a TrueType or OpenType\n * font for specific entries in its 'gasp' table, if any. This is mainly\n * useful when implementing native TrueType hinting with the bytecode\n * interpreter to duplicate the Windows text rendering results.\n */\n\n /**************************************************************************\n *\n * @enum:\n * FT_GASP_XXX\n *\n * @description:\n * A list of values and/or bit-flags returned by the @FT_Get_Gasp\n * function.\n *\n * @values:\n * FT_GASP_NO_TABLE ::\n * This special value means that there is no GASP table in this face.\n * It is up to the client to decide what to do.\n *\n * FT_GASP_DO_GRIDFIT ::\n * Grid-fitting and hinting should be performed at the specified ppem.\n * This **really** means TrueType bytecode interpretation. If this bit\n * is not set, no hinting gets applied.\n *\n * FT_GASP_DO_GRAY ::\n * Anti-aliased rendering should be performed at the specified ppem.\n * If not set, do monochrome rendering.\n *\n * FT_GASP_SYMMETRIC_SMOOTHING ::\n * If set, smoothing along multiple axes must be used with ClearType.\n *\n * FT_GASP_SYMMETRIC_GRIDFIT ::\n * Grid-fitting must be used with ClearType's symmetric smoothing.\n *\n * @note:\n * The bit-flags `FT_GASP_DO_GRIDFIT` and `FT_GASP_DO_GRAY` are to be\n * used for standard font rasterization only. Independently of that,\n * `FT_GASP_SYMMETRIC_SMOOTHING` and `FT_GASP_SYMMETRIC_GRIDFIT` are to\n * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT` and\n * `FT_GASP_DO_GRAY` are consequently ignored).\n *\n * 'ClearType' is Microsoft's implementation of LCD rendering, partly\n * protected by patents.\n *\n * @since:\n * 2.3.0\n */\n#define FT_GASP_NO_TABLE -1\n#define FT_GASP_DO_GRIDFIT 0x01\n#define FT_GASP_DO_GRAY 0x02\n#define FT_GASP_SYMMETRIC_GRIDFIT 0x04\n#define FT_GASP_SYMMETRIC_SMOOTHING 0x08\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Gasp\n *\n * @description:\n * For a TrueType or OpenType font file, return the rasterizer behaviour\n * flags from the font's 'gasp' table corresponding to a given character\n * pixel size.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * ppem ::\n * The vertical character pixel size.\n *\n * @return:\n * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no\n * 'gasp' table in the face.\n *\n * @note:\n * If you want to use the MM functionality of OpenType variation fonts\n * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this\n * function **after** setting an instance since the return values can\n * change.\n *\n * @since:\n * 2.3.0\n */\n FT_EXPORT( FT_Int )\n FT_Get_Gasp( FT_Face face,\n FT_UInt ppem );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGASP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftglyph.h", "language": "code", "loc": 602, "comment_density": 0.872, "code": "/****************************************************************************\n *\n * ftglyph.h\n *\n * FreeType convenience functions to handle glyphs (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file contains the definition of several convenience functions that\n * can be used by client applications to easily retrieve glyph bitmaps and\n * outlines from a given face.\n *\n * These functions should be optional if you are writing a font server or\n * text layout engine on top of FreeType. However, they are pretty handy\n * for many other simple uses of the library.\n *\n */\n\n\n#ifndef FTGLYPH_H_\n#define FTGLYPH_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * glyph_management\n *\n * @title:\n * Glyph Management\n *\n * @abstract:\n * Generic interface to manage individual glyph data.\n *\n * @description:\n * This section contains definitions used to manage glyph data through\n * generic @FT_Glyph objects. Each of them can contain a bitmap,\n * a vector outline, or even images in other formats. These objects are\n * detached from @FT_Face, contrary to @FT_GlyphSlot.\n *\n */\n\n\n /* forward declaration to a private type */\n typedef struct FT_Glyph_Class_ FT_Glyph_Class;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Glyph\n *\n * @description:\n * Handle to an object used to model generic glyph images. It is a\n * pointer to the @FT_GlyphRec structure and can contain a glyph bitmap\n * or pointer.\n *\n * @note:\n * Glyph objects are not owned by the library. You must thus release\n * them manually (through @FT_Done_Glyph) _before_ calling\n * @FT_Done_FreeType.\n */\n typedef struct FT_GlyphRec_* FT_Glyph;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_GlyphRec\n *\n * @description:\n * The root glyph structure contains a given glyph image plus its advance\n * width in 16.16 fixed-point format.\n *\n * @fields:\n * library ::\n * A handle to the FreeType library object.\n *\n * clazz ::\n * A pointer to the glyph's class. Private.\n *\n * format ::\n * The format of the glyph's image.\n *\n * advance ::\n * A 16.16 vector that gives the glyph's advance width.\n */\n typedef struct FT_GlyphRec_\n {\n FT_Library library;\n const FT_Glyph_Class* clazz;\n FT_Glyph_Format format;\n FT_Vector advance;\n\n } FT_GlyphRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_BitmapGlyph\n *\n * @description:\n * A handle to an object used to model a bitmap glyph image. This is a\n * sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.\n */\n typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_BitmapGlyphRec\n *\n * @description:\n * A structure used for bitmap glyph images. This really is a\n * 'sub-class' of @FT_GlyphRec.\n *\n * @fields:\n * root ::\n * The root @FT_Glyph fields.\n *\n * left ::\n * The left-side bearing, i.e., the horizontal distance from the\n * current pen position to the left border of the glyph bitmap.\n *\n * top ::\n * The top-side bearing, i.e., the vertical distance from the current\n * pen position to the top border of the glyph bitmap. This distance\n * is positive for upwards~y!\n *\n * bitmap ::\n * A descriptor for the bitmap.\n *\n * @note:\n * You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have\n * `glyph->format == FT_GLYPH_FORMAT_BITMAP`. This lets you access the\n * bitmap's contents easily.\n *\n * The corresponding pixel buffer is always owned by @FT_BitmapGlyph and\n * is thus created and destroyed with it.\n */\n typedef struct FT_BitmapGlyphRec_\n {\n FT_GlyphRec root;\n FT_Int left;\n FT_Int top;\n FT_Bitmap bitmap;\n\n } FT_BitmapGlyphRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_OutlineGlyph\n *\n * @description:\n * A handle to an object used to model an outline glyph image. This is a\n * sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec.\n */\n typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_OutlineGlyphRec\n *\n * @description:\n * A structure used for outline (vectorial) glyph images. This really is\n * a 'sub-class' of @FT_GlyphRec.\n *\n * @fields:\n * root ::\n * The root @FT_Glyph fields.\n *\n * outline ::\n * A descriptor for the outline.\n *\n * @note:\n * You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have\n * `glyph->format == FT_GLYPH_FORMAT_OUTLINE`. This lets you access the\n * outline's content easily.\n *\n * As the outline is extracted from a glyph slot, its coordinates are\n * expressed normally in 26.6 pixels, unless the flag @FT_LOAD_NO_SCALE\n * was used in @FT_Load_Glyph or @FT_Load_Char.\n *\n * The outline's tables are always owned by the object and are destroyed\n * with it.\n */\n typedef struct FT_OutlineGlyphRec_\n {\n FT_GlyphRec root;\n FT_Outline outline;\n\n } FT_OutlineGlyphRec;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Glyph\n *\n * @description:\n * A function used to create a new empty glyph image. Note that the\n * created @FT_Glyph object must be released with @FT_Done_Glyph.\n *\n * @input:\n * library ::\n * A handle to the FreeType library object.\n *\n * format ::\n * The format of the glyph's image.\n *\n * @output:\n * aglyph ::\n * A handle to the glyph object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_New_Glyph( FT_Library library,\n FT_Glyph_Format format,\n FT_Glyph *aglyph );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Glyph\n *\n * @description:\n * A function used to extract a glyph image from a slot. Note that the\n * created @FT_Glyph object must be released with @FT_Done_Glyph.\n *\n * @input:\n * slot ::\n * A handle to the source glyph slot.\n *\n * @output:\n * aglyph ::\n * A handle to the glyph object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Because `*aglyph->advance.x` and `*aglyph->advance.y` are 16.16\n * fixed-point numbers, `slot->advance.x` and `slot->advance.y` (which\n * are in 26.6 fixed-point format) must be in the range ]-32768;32768[.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Glyph( FT_GlyphSlot slot,\n FT_Glyph *aglyph );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_Copy\n *\n * @description:\n * A function used to copy a glyph image. Note that the created\n * @FT_Glyph object must be released with @FT_Done_Glyph.\n *\n * @input:\n * source ::\n * A handle to the source glyph object.\n *\n * @output:\n * target ::\n * A handle to the target glyph object. 0~in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_Copy( FT_Glyph source,\n FT_Glyph *target );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_Transform\n *\n * @description:\n * Transform a glyph image if its format is scalable.\n *\n * @inout:\n * glyph ::\n * A handle to the target glyph object.\n *\n * @input:\n * matrix ::\n * A pointer to a 2x2 matrix to apply.\n *\n * delta ::\n * A pointer to a 2d vector to apply. Coordinates are expressed in\n * 1/64th of a pixel.\n *\n * @return:\n * FreeType error code (if not 0, the glyph format is not scalable).\n *\n * @note:\n * The 2x2 transformation matrix is also applied to the glyph's advance\n * vector.\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_Transform( FT_Glyph glyph,\n FT_Matrix* matrix,\n FT_Vector* delta );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Glyph_BBox_Mode\n *\n * @description:\n * The mode how the values of @FT_Glyph_Get_CBox are returned.\n *\n * @values:\n * FT_GLYPH_BBOX_UNSCALED ::\n * Return unscaled font units.\n *\n * FT_GLYPH_BBOX_SUBPIXELS ::\n * Return unfitted 26.6 coordinates.\n *\n * FT_GLYPH_BBOX_GRIDFIT ::\n * Return grid-fitted 26.6 coordinates.\n *\n * FT_GLYPH_BBOX_TRUNCATE ::\n * Return coordinates in integer pixels.\n *\n * FT_GLYPH_BBOX_PIXELS ::\n * Return grid-fitted pixel coordinates.\n */\n typedef enum FT_Glyph_BBox_Mode_\n {\n FT_GLYPH_BBOX_UNSCALED = 0,\n FT_GLYPH_BBOX_SUBPIXELS = 0,\n FT_GLYPH_BBOX_GRIDFIT = 1,\n FT_GLYPH_BBOX_TRUNCATE = 2,\n FT_GLYPH_BBOX_PIXELS = 3\n\n } FT_Glyph_BBox_Mode;\n\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_Glyph_BBox_Mode` values instead */\n#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED\n#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS\n#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT\n#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE\n#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_Get_CBox\n *\n * @description:\n * Return a glyph's 'control box'. The control box encloses all the\n * outline's points, including Bezier control points. Though it\n * coincides with the exact bounding box for most glyphs, it can be\n * slightly larger in some situations (like when rotating an outline that\n * contains Bezier outside arcs).\n *\n * Computing the control box is very fast, while getting the bounding box\n * can take much more time as it needs to walk over all segments and arcs\n * in the outline. To get the latter, you can use the 'ftbbox'\n * component, which is dedicated to this single task.\n *\n * @input:\n * glyph ::\n * A handle to the source glyph object.\n *\n * mode ::\n * The mode that indicates how to interpret the returned bounding box\n * values.\n *\n * @output:\n * acbox ::\n * The glyph coordinate bounding box. Coordinates are expressed in\n * 1/64th of pixels if it is grid-fitted.\n *\n * @note:\n * Coordinates are relative to the glyph origin, using the y~upwards\n * convention.\n *\n * If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode` must\n * be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font units in 26.6\n * pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS is another name for\n * this constant.\n *\n * If the font is tricky and the glyph has been loaded with\n * @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get\n * reasonable values for the CBox it is necessary to load the glyph at a\n * large ppem value (so that the hinting instructions can properly shift\n * and scale the subglyphs), then extracting the CBox, which can be\n * eventually converted back to font units.\n *\n * Note that the maximum coordinates are exclusive, which means that one\n * can compute the width and height of the glyph image (be it in integer\n * or 26.6 pixels) as:\n *\n * ```\n * width = bbox.xMax - bbox.xMin;\n * height = bbox.yMax - bbox.yMin;\n * ```\n *\n * Note also that for 26.6 coordinates, if `bbox_mode` is set to\n * @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted,\n * which corresponds to:\n *\n * ```\n * bbox.xMin = FLOOR(bbox.xMin);\n * bbox.yMin = FLOOR(bbox.yMin);\n * bbox.xMax = CEILING(bbox.xMax);\n * bbox.yMax = CEILING(bbox.yMax);\n * ```\n *\n * To get the bbox in pixel coordinates, set `bbox_mode` to\n * @FT_GLYPH_BBOX_TRUNCATE.\n *\n * To get the bbox in grid-fitted pixel coordinates, set `bbox_mode` to\n * @FT_GLYPH_BBOX_PIXELS.\n */\n FT_EXPORT( void )\n FT_Glyph_Get_CBox( FT_Glyph glyph,\n FT_UInt bbox_mode,\n FT_BBox *acbox );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_To_Bitmap\n *\n * @description:\n * Convert a given glyph object to a bitmap glyph object.\n *\n * @inout:\n * the_glyph ::\n * A pointer to a handle to the target glyph.\n *\n * @input:\n * render_mode ::\n * An enumeration that describes how the data is rendered.\n *\n * origin ::\n * A pointer to a vector used to translate the glyph image before\n * rendering. Can be~0 (if no translation). The origin is expressed\n * in 26.6 pixels.\n *\n * destroy ::\n * A boolean that indicates that the original glyph image should be\n * destroyed by this function. It is never destroyed in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function does nothing if the glyph format isn't scalable.\n *\n * The glyph image is translated with the `origin` vector before\n * rendering.\n *\n * The first parameter is a pointer to an @FT_Glyph handle, that will be\n * _replaced_ by this function (with newly allocated data). Typically,\n * you would use (omitting error handling):\n *\n * ```\n * FT_Glyph glyph;\n * FT_BitmapGlyph glyph_bitmap;\n *\n *\n * // load glyph\n * error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAULT );\n *\n * // extract glyph image\n * error = FT_Get_Glyph( face->glyph, &glyph );\n *\n * // convert to a bitmap (default render mode + destroying old)\n * if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )\n * {\n * error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,\n * 0, 1 );\n * if ( error ) // `glyph' unchanged\n * ...\n * }\n *\n * // access bitmap content by typecasting\n * glyph_bitmap = (FT_BitmapGlyph)glyph;\n *\n * // do funny stuff with it, like blitting/drawing\n * ...\n *\n * // discard glyph image (bitmap or not)\n * FT_Done_Glyph( glyph );\n * ```\n *\n * Here is another example, again without error handling:\n *\n * ```\n * FT_Glyph glyphs[MAX_GLYPHS]\n *\n *\n * ...\n *\n * for ( idx = 0; i < MAX_GLYPHS; i++ )\n * error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) ||\n * FT_Get_Glyph ( face->glyph, &glyphs[idx] );\n *\n * ...\n *\n * for ( idx = 0; i < MAX_GLYPHS; i++ )\n * {\n * FT_Glyph bitmap = glyphs[idx];\n *\n *\n * ...\n *\n * // after this call, `bitmap' no longer points into\n * // the `glyphs' array (and the old value isn't destroyed)\n * FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 );\n *\n * ...\n *\n * FT_Done_Glyph( bitmap );\n * }\n *\n * ...\n *\n * for ( idx = 0; i < MAX_GLYPHS; i++ )\n * FT_Done_Glyph( glyphs[idx] );\n * ```\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,\n FT_Render_Mode render_mode,\n FT_Vector* origin,\n FT_Bool destroy );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Glyph\n *\n * @description:\n * Destroy a given glyph.\n *\n * @input:\n * glyph ::\n * A handle to the target glyph object.\n */\n FT_EXPORT( void )\n FT_Done_Glyph( FT_Glyph glyph );\n\n /* */\n\n\n /* other helpful functions */\n\n /**************************************************************************\n *\n * @section:\n * computations\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Matrix_Multiply\n *\n * @description:\n * Perform the matrix operation `b = a*b`.\n *\n * @input:\n * a ::\n * A pointer to matrix `a`.\n *\n * @inout:\n * b ::\n * A pointer to matrix `b`.\n *\n * @note:\n * The result is undefined if either `a` or `b` is zero.\n *\n * Since the function uses wrap-around arithmetic, results become\n * meaningless if the arguments are very large.\n */\n FT_EXPORT( void )\n FT_Matrix_Multiply( const FT_Matrix* a,\n FT_Matrix* b );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Matrix_Invert\n *\n * @description:\n * Invert a 2x2 matrix. Return an error if it can't be inverted.\n *\n * @inout:\n * matrix ::\n * A pointer to the target matrix. Remains untouched in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Matrix_Invert( FT_Matrix* matrix );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGLYPH_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftgxval.h", "language": "code", "loc": 319, "comment_density": 0.799, "code": "/****************************************************************************\n *\n * ftgxval.h\n *\n * FreeType API for validating TrueTypeGX/AAT tables (specification).\n *\n * Copyright (C) 2004-2020 by\n * Masatake YAMATO, Redhat K.K,\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n/****************************************************************************\n *\n * gxvalid is derived from both gxlayout module and otvalid module.\n * Development of gxlayout is supported by the Information-technology\n * Promotion Agency(IPA), Japan.\n *\n */\n\n\n#ifndef FTGXVAL_H_\n#define FTGXVAL_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * gx_validation\n *\n * @title:\n * TrueTypeGX/AAT Validation\n *\n * @abstract:\n * An API to validate TrueTypeGX/AAT tables.\n *\n * @description:\n * This section contains the declaration of functions to validate some\n * TrueTypeGX tables (feat, mort, morx, bsln, just, kern, opbd, trak,\n * prop, lcar).\n *\n * @order:\n * FT_TrueTypeGX_Validate\n * FT_TrueTypeGX_Free\n *\n * FT_ClassicKern_Validate\n * FT_ClassicKern_Free\n *\n * FT_VALIDATE_GX_LENGTH\n * FT_VALIDATE_GXXXX\n * FT_VALIDATE_CKERNXXX\n *\n */\n\n /**************************************************************************\n *\n *\n * Warning: Use `FT_VALIDATE_XXX` to validate a table.\n * Following definitions are for gxvalid developers.\n *\n *\n */\n\n#define FT_VALIDATE_feat_INDEX 0\n#define FT_VALIDATE_mort_INDEX 1\n#define FT_VALIDATE_morx_INDEX 2\n#define FT_VALIDATE_bsln_INDEX 3\n#define FT_VALIDATE_just_INDEX 4\n#define FT_VALIDATE_kern_INDEX 5\n#define FT_VALIDATE_opbd_INDEX 6\n#define FT_VALIDATE_trak_INDEX 7\n#define FT_VALIDATE_prop_INDEX 8\n#define FT_VALIDATE_lcar_INDEX 9\n#define FT_VALIDATE_GX_LAST_INDEX FT_VALIDATE_lcar_INDEX\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_VALIDATE_GX_LENGTH\n *\n * @description:\n * The number of tables checked in this module. Use it as a parameter\n * for the `table-length` argument of function @FT_TrueTypeGX_Validate.\n */\n#define FT_VALIDATE_GX_LENGTH ( FT_VALIDATE_GX_LAST_INDEX + 1 )\n\n /* */\n\n /* Up to 0x1000 is used by otvalid.\n Ox2xxx is reserved for feature OT extension. */\n#define FT_VALIDATE_GX_START 0x4000\n#define FT_VALIDATE_GX_BITFIELD( tag ) \\\n ( FT_VALIDATE_GX_START << FT_VALIDATE_##tag##_INDEX )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_VALIDATE_GXXXX\n *\n * @description:\n * A list of bit-field constants used with @FT_TrueTypeGX_Validate to\n * indicate which TrueTypeGX/AAT Type tables should be validated.\n *\n * @values:\n * FT_VALIDATE_feat ::\n * Validate 'feat' table.\n *\n * FT_VALIDATE_mort ::\n * Validate 'mort' table.\n *\n * FT_VALIDATE_morx ::\n * Validate 'morx' table.\n *\n * FT_VALIDATE_bsln ::\n * Validate 'bsln' table.\n *\n * FT_VALIDATE_just ::\n * Validate 'just' table.\n *\n * FT_VALIDATE_kern ::\n * Validate 'kern' table.\n *\n * FT_VALIDATE_opbd ::\n * Validate 'opbd' table.\n *\n * FT_VALIDATE_trak ::\n * Validate 'trak' table.\n *\n * FT_VALIDATE_prop ::\n * Validate 'prop' table.\n *\n * FT_VALIDATE_lcar ::\n * Validate 'lcar' table.\n *\n * FT_VALIDATE_GX ::\n * Validate all TrueTypeGX tables (feat, mort, morx, bsln, just, kern,\n * opbd, trak, prop and lcar).\n *\n */\n\n#define FT_VALIDATE_feat FT_VALIDATE_GX_BITFIELD( feat )\n#define FT_VALIDATE_mort FT_VALIDATE_GX_BITFIELD( mort )\n#define FT_VALIDATE_morx FT_VALIDATE_GX_BITFIELD( morx )\n#define FT_VALIDATE_bsln FT_VALIDATE_GX_BITFIELD( bsln )\n#define FT_VALIDATE_just FT_VALIDATE_GX_BITFIELD( just )\n#define FT_VALIDATE_kern FT_VALIDATE_GX_BITFIELD( kern )\n#define FT_VALIDATE_opbd FT_VALIDATE_GX_BITFIELD( opbd )\n#define FT_VALIDATE_trak FT_VALIDATE_GX_BITFIELD( trak )\n#define FT_VALIDATE_prop FT_VALIDATE_GX_BITFIELD( prop )\n#define FT_VALIDATE_lcar FT_VALIDATE_GX_BITFIELD( lcar )\n\n#define FT_VALIDATE_GX ( FT_VALIDATE_feat | \\\n FT_VALIDATE_mort | \\\n FT_VALIDATE_morx | \\\n FT_VALIDATE_bsln | \\\n FT_VALIDATE_just | \\\n FT_VALIDATE_kern | \\\n FT_VALIDATE_opbd | \\\n FT_VALIDATE_trak | \\\n FT_VALIDATE_prop | \\\n FT_VALIDATE_lcar )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_TrueTypeGX_Validate\n *\n * @description:\n * Validate various TrueTypeGX tables to assure that all offsets and\n * indices are valid. The idea is that a higher-level library that\n * actually does the text layout can access those tables without error\n * checking (which can be quite time consuming).\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * validation_flags ::\n * A bit field that specifies the tables to be validated. See\n * @FT_VALIDATE_GXXXX for possible values.\n *\n * table_length ::\n * The size of the `tables` array. Normally, @FT_VALIDATE_GX_LENGTH\n * should be passed.\n *\n * @output:\n * tables ::\n * The array where all validated sfnt tables are stored. The array\n * itself must be allocated by a client.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with TrueTypeGX fonts, returning an error\n * otherwise.\n *\n * After use, the application should deallocate the buffers pointed to by\n * each `tables` element, by calling @FT_TrueTypeGX_Free. A `NULL` value\n * indicates that the table either doesn't exist in the font, the\n * application hasn't asked for validation, or the validator doesn't have\n * the ability to validate the sfnt table.\n */\n FT_EXPORT( FT_Error )\n FT_TrueTypeGX_Validate( FT_Face face,\n FT_UInt validation_flags,\n FT_Bytes tables[FT_VALIDATE_GX_LENGTH],\n FT_UInt table_length );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_TrueTypeGX_Free\n *\n * @description:\n * Free the buffer allocated by TrueTypeGX validator.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * table ::\n * The pointer to the buffer allocated by @FT_TrueTypeGX_Validate.\n *\n * @note:\n * This function must be used to free the buffer allocated by\n * @FT_TrueTypeGX_Validate only.\n */\n FT_EXPORT( void )\n FT_TrueTypeGX_Free( FT_Face face,\n FT_Bytes table );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_VALIDATE_CKERNXXX\n *\n * @description:\n * A list of bit-field constants used with @FT_ClassicKern_Validate to\n * indicate the classic kern dialect or dialects. If the selected type\n * doesn't fit, @FT_ClassicKern_Validate regards the table as invalid.\n *\n * @values:\n * FT_VALIDATE_MS ::\n * Handle the 'kern' table as a classic Microsoft kern table.\n *\n * FT_VALIDATE_APPLE ::\n * Handle the 'kern' table as a classic Apple kern table.\n *\n * FT_VALIDATE_CKERN ::\n * Handle the 'kern' as either classic Apple or Microsoft kern table.\n */\n#define FT_VALIDATE_MS ( FT_VALIDATE_GX_START << 0 )\n#define FT_VALIDATE_APPLE ( FT_VALIDATE_GX_START << 1 )\n\n#define FT_VALIDATE_CKERN ( FT_VALIDATE_MS | FT_VALIDATE_APPLE )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_ClassicKern_Validate\n *\n * @description:\n * Validate classic (16-bit format) kern table to assure that the\n * offsets and indices are valid. The idea is that a higher-level\n * library that actually does the text layout can access those tables\n * without error checking (which can be quite time consuming).\n *\n * The 'kern' table validator in @FT_TrueTypeGX_Validate deals with both\n * the new 32-bit format and the classic 16-bit format, while\n * FT_ClassicKern_Validate only supports the classic 16-bit format.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * validation_flags ::\n * A bit field that specifies the dialect to be validated. See\n * @FT_VALIDATE_CKERNXXX for possible values.\n *\n * @output:\n * ckern_table ::\n * A pointer to the kern table.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * After use, the application should deallocate the buffers pointed to by\n * `ckern_table`, by calling @FT_ClassicKern_Free. A `NULL` value\n * indicates that the table doesn't exist in the font.\n */\n FT_EXPORT( FT_Error )\n FT_ClassicKern_Validate( FT_Face face,\n FT_UInt validation_flags,\n FT_Bytes *ckern_table );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_ClassicKern_Free\n *\n * @description:\n * Free the buffer allocated by classic Kern validator.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * table ::\n * The pointer to the buffer that is allocated by\n * @FT_ClassicKern_Validate.\n *\n * @note:\n * This function must be used to free the buffer allocated by\n * @FT_ClassicKern_Validate only.\n */\n FT_EXPORT( void )\n FT_ClassicKern_Free( FT_Face face,\n FT_Bytes table );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGXVAL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftgzip.h", "language": "code", "loc": 134, "comment_density": 0.851, "code": "/****************************************************************************\n *\n * ftgzip.h\n *\n * Gzip-compressed stream support.\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTGZIP_H_\n#define FTGZIP_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * gzip\n *\n * @title:\n * GZIP Streams\n *\n * @abstract:\n * Using gzip-compressed font files.\n *\n * @description:\n * This section contains the declaration of Gzip-specific functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stream_OpenGzip\n *\n * @description:\n * Open a new stream to parse gzip-compressed font files. This is mainly\n * used to support the compressed `*.pcf.gz` fonts that come with\n * XFree86.\n *\n * @input:\n * stream ::\n * The target embedding stream.\n *\n * source ::\n * The source stream.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source stream must be opened _before_ calling this function.\n *\n * Calling the internal function `FT_Stream_Close` on the new stream will\n * **not** call `FT_Stream_Close` on the source stream. None of the\n * stream objects will be released to the heap.\n *\n * The stream implementation is very basic and resets the decompression\n * process each time seeking backwards is needed within the stream.\n *\n * In certain builds of the library, gzip compression recognition is\n * automatically handled when calling @FT_New_Face or @FT_Open_Face.\n * This means that if no font driver is capable of handling the raw\n * compressed file, the library will try to open a gzipped stream from it\n * and re-open the face with it.\n *\n * This function may return `FT_Err_Unimplemented_Feature` if your build\n * of FreeType was not compiled with zlib support.\n */\n FT_EXPORT( FT_Error )\n FT_Stream_OpenGzip( FT_Stream stream,\n FT_Stream source );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Gzip_Uncompress\n *\n * @description:\n * Decompress a zipped input buffer into an output buffer. This function\n * is modeled after zlib's `uncompress` function.\n *\n * @input:\n * memory ::\n * A FreeType memory handle.\n *\n * input ::\n * The input buffer.\n *\n * input_len ::\n * The length of the input buffer.\n *\n * @output:\n * output ::\n * The output buffer.\n *\n * @inout:\n * output_len ::\n * Before calling the function, this is the total size of the output\n * buffer, which must be large enough to hold the entire uncompressed\n * data (so the size of the uncompressed data must be known in\n * advance). After calling the function, `output_len` is the size of\n * the used data in `output`.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function may return `FT_Err_Unimplemented_Feature` if your build\n * of FreeType was not compiled with zlib support.\n *\n * @since:\n * 2.5.1\n */\n FT_EXPORT( FT_Error )\n FT_Gzip_Uncompress( FT_Memory memory,\n FT_Byte* output,\n FT_ULong* output_len,\n const FT_Byte* input,\n FT_ULong input_len );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGZIP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftimage.h", "language": "code", "loc": 1113, "comment_density": 0.827, "code": "/****************************************************************************\n *\n * ftimage.h\n *\n * FreeType glyph image formats and default raster interface\n * (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n /**************************************************************************\n *\n * Note: A 'raster' is simply a scan-line converter, used to render\n * FT_Outlines into FT_Bitmaps.\n *\n */\n\n\n#ifndef FTIMAGE_H_\n#define FTIMAGE_H_\n\n\n /* STANDALONE_ is from ftgrays.c */\n#ifndef STANDALONE_\n#include \n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * basic_types\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Pos\n *\n * @description:\n * The type FT_Pos is used to store vectorial coordinates. Depending on\n * the context, these can represent distances in integer font units, or\n * 16.16, or 26.6 fixed-point pixel coordinates.\n */\n typedef signed long FT_Pos;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Vector\n *\n * @description:\n * A simple structure used to store a 2D vector; coordinates are of the\n * FT_Pos type.\n *\n * @fields:\n * x ::\n * The horizontal coordinate.\n * y ::\n * The vertical coordinate.\n */\n typedef struct FT_Vector_\n {\n FT_Pos x;\n FT_Pos y;\n\n } FT_Vector;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_BBox\n *\n * @description:\n * A structure used to hold an outline's bounding box, i.e., the\n * coordinates of its extrema in the horizontal and vertical directions.\n *\n * @fields:\n * xMin ::\n * The horizontal minimum (left-most).\n *\n * yMin ::\n * The vertical minimum (bottom-most).\n *\n * xMax ::\n * The horizontal maximum (right-most).\n *\n * yMax ::\n * The vertical maximum (top-most).\n *\n * @note:\n * The bounding box is specified with the coordinates of the lower left\n * and the upper right corner. In PostScript, those values are often\n * called (llx,lly) and (urx,ury), respectively.\n *\n * If `yMin` is negative, this value gives the glyph's descender.\n * Otherwise, the glyph doesn't descend below the baseline. Similarly,\n * if `ymax` is positive, this value gives the glyph's ascender.\n *\n * `xMin` gives the horizontal distance from the glyph's origin to the\n * left edge of the glyph's bounding box. If `xMin` is negative, the\n * glyph extends to the left of the origin.\n */\n typedef struct FT_BBox_\n {\n FT_Pos xMin, yMin;\n FT_Pos xMax, yMax;\n\n } FT_BBox;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Pixel_Mode\n *\n * @description:\n * An enumeration type used to describe the format of pixels in a given\n * bitmap. Note that additional formats may be added in the future.\n *\n * @values:\n * FT_PIXEL_MODE_NONE ::\n * Value~0 is reserved.\n *\n * FT_PIXEL_MODE_MONO ::\n * A monochrome bitmap, using 1~bit per pixel. Note that pixels are\n * stored in most-significant order (MSB), which means that the\n * left-most pixel in a byte has value 128.\n *\n * FT_PIXEL_MODE_GRAY ::\n * An 8-bit bitmap, generally used to represent anti-aliased glyph\n * images. Each pixel is stored in one byte. Note that the number of\n * 'gray' levels is stored in the `num_grays` field of the @FT_Bitmap\n * structure (it generally is 256).\n *\n * FT_PIXEL_MODE_GRAY2 ::\n * A 2-bit per pixel bitmap, used to represent embedded anti-aliased\n * bitmaps in font files according to the OpenType specification. We\n * haven't found a single font using this format, however.\n *\n * FT_PIXEL_MODE_GRAY4 ::\n * A 4-bit per pixel bitmap, representing embedded anti-aliased bitmaps\n * in font files according to the OpenType specification. We haven't\n * found a single font using this format, however.\n *\n * FT_PIXEL_MODE_LCD ::\n * An 8-bit bitmap, representing RGB or BGR decimated glyph images used\n * for display on LCD displays; the bitmap is three times wider than\n * the original glyph image. See also @FT_RENDER_MODE_LCD.\n *\n * FT_PIXEL_MODE_LCD_V ::\n * An 8-bit bitmap, representing RGB or BGR decimated glyph images used\n * for display on rotated LCD displays; the bitmap is three times\n * taller than the original glyph image. See also\n * @FT_RENDER_MODE_LCD_V.\n *\n * FT_PIXEL_MODE_BGRA ::\n * [Since 2.5] An image with four 8-bit channels per pixel,\n * representing a color image (such as emoticons) with alpha channel.\n * For each pixel, the format is BGRA, which means, the blue channel\n * comes first in memory. The color channels are pre-multiplied and in\n * the sRGB colorspace. For example, full red at half-translucent\n * opacity will be represented as '00,00,80,80', not '00,00,FF,80'.\n * See also @FT_LOAD_COLOR.\n */\n typedef enum FT_Pixel_Mode_\n {\n FT_PIXEL_MODE_NONE = 0,\n FT_PIXEL_MODE_MONO,\n FT_PIXEL_MODE_GRAY,\n FT_PIXEL_MODE_GRAY2,\n FT_PIXEL_MODE_GRAY4,\n FT_PIXEL_MODE_LCD,\n FT_PIXEL_MODE_LCD_V,\n FT_PIXEL_MODE_BGRA,\n\n FT_PIXEL_MODE_MAX /* do not remove */\n\n } FT_Pixel_Mode;\n\n\n /* these constants are deprecated; use the corresponding `FT_Pixel_Mode` */\n /* values instead. */\n#define ft_pixel_mode_none FT_PIXEL_MODE_NONE\n#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO\n#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY\n#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2\n#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Bitmap\n *\n * @description:\n * A structure used to describe a bitmap or pixmap to the raster. Note\n * that we now manage pixmaps of various depths through the `pixel_mode`\n * field.\n *\n * @fields:\n * rows ::\n * The number of bitmap rows.\n *\n * width ::\n * The number of pixels in bitmap row.\n *\n * pitch ::\n * The pitch's absolute value is the number of bytes taken by one\n * bitmap row, including padding. However, the pitch is positive when\n * the bitmap has a 'down' flow, and negative when it has an 'up' flow.\n * In all cases, the pitch is an offset to add to a bitmap pointer in\n * order to go down one row.\n *\n * Note that 'padding' means the alignment of a bitmap to a byte\n * border, and FreeType functions normally align to the smallest\n * possible integer value.\n *\n * For the B/W rasterizer, `pitch` is always an even number.\n *\n * To change the pitch of a bitmap (say, to make it a multiple of 4),\n * use @FT_Bitmap_Convert. Alternatively, you might use callback\n * functions to directly render to the application's surface; see the\n * file `example2.cpp` in the tutorial for a demonstration.\n *\n * buffer ::\n * A typeless pointer to the bitmap buffer. This value should be\n * aligned on 32-bit boundaries in most cases.\n *\n * num_grays ::\n * This field is only used with @FT_PIXEL_MODE_GRAY; it gives the\n * number of gray levels used in the bitmap.\n *\n * pixel_mode ::\n * The pixel mode, i.e., how pixel bits are stored. See @FT_Pixel_Mode\n * for possible values.\n *\n * palette_mode ::\n * This field is intended for paletted pixel modes; it indicates how\n * the palette is stored. Not used currently.\n *\n * palette ::\n * A typeless pointer to the bitmap palette; this field is intended for\n * paletted pixel modes. Not used currently.\n */\n typedef struct FT_Bitmap_\n {\n unsigned int rows;\n unsigned int width;\n int pitch;\n unsigned char* buffer;\n unsigned short num_grays;\n unsigned char pixel_mode;\n unsigned char palette_mode;\n void* palette;\n\n } FT_Bitmap;\n\n\n /**************************************************************************\n *\n * @section:\n * outline_processing\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Outline\n *\n * @description:\n * This structure is used to describe an outline to the scan-line\n * converter.\n *\n * @fields:\n * n_contours ::\n * The number of contours in the outline.\n *\n * n_points ::\n * The number of points in the outline.\n *\n * points ::\n * A pointer to an array of `n_points` @FT_Vector elements, giving the\n * outline's point coordinates.\n *\n * tags ::\n * A pointer to an array of `n_points` chars, giving each outline\n * point's type.\n *\n * If bit~0 is unset, the point is 'off' the curve, i.e., a Bezier\n * control point, while it is 'on' if set.\n *\n * Bit~1 is meaningful for 'off' points only. If set, it indicates a\n * third-order Bezier arc control point; and a second-order control\n * point if unset.\n *\n * If bit~2 is set, bits 5-7 contain the drop-out mode (as defined in\n * the OpenType specification; the value is the same as the argument to\n * the 'SCANMODE' instruction).\n *\n * Bits 3 and~4 are reserved for internal purposes.\n *\n * contours ::\n * An array of `n_contours` shorts, giving the end point of each\n * contour within the outline. For example, the first contour is\n * defined by the points '0' to `contours[0]`, the second one is\n * defined by the points `contours[0]+1` to `contours[1]`, etc.\n *\n * flags ::\n * A set of bit flags used to characterize the outline and give hints\n * to the scan-converter and hinter on how to convert/grid-fit it. See\n * @FT_OUTLINE_XXX.\n *\n * @note:\n * The B/W rasterizer only checks bit~2 in the `tags` array for the first\n * point of each contour. The drop-out mode as given with\n * @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and\n * @FT_OUTLINE_INCLUDE_STUBS in `flags` is then overridden.\n */\n typedef struct FT_Outline_\n {\n short n_contours; /* number of contours in glyph */\n short n_points; /* number of points in the glyph */\n\n FT_Vector* points; /* the outline's points */\n char* tags; /* the points flags */\n short* contours; /* the contour end points */\n\n int flags; /* outline masks */\n\n } FT_Outline;\n\n /* */\n\n /* Following limits must be consistent with */\n /* FT_Outline.{n_contours,n_points} */\n#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX\n#define FT_OUTLINE_POINTS_MAX SHRT_MAX\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_OUTLINE_XXX\n *\n * @description:\n * A list of bit-field constants used for the flags in an outline's\n * `flags` field.\n *\n * @values:\n * FT_OUTLINE_NONE ::\n * Value~0 is reserved.\n *\n * FT_OUTLINE_OWNER ::\n * If set, this flag indicates that the outline's field arrays (i.e.,\n * `points`, `flags`, and `contours`) are 'owned' by the outline\n * object, and should thus be freed when it is destroyed.\n *\n * FT_OUTLINE_EVEN_ODD_FILL ::\n * By default, outlines are filled using the non-zero winding rule. If\n * set to 1, the outline will be filled using the even-odd fill rule\n * (only works with the smooth rasterizer).\n *\n * FT_OUTLINE_REVERSE_FILL ::\n * By default, outside contours of an outline are oriented in\n * clock-wise direction, as defined in the TrueType specification.\n * This flag is set if the outline uses the opposite direction\n * (typically for Type~1 fonts). This flag is ignored by the scan\n * converter.\n *\n * FT_OUTLINE_IGNORE_DROPOUTS ::\n * By default, the scan converter will try to detect drop-outs in an\n * outline and correct the glyph bitmap to ensure consistent shape\n * continuity. If set, this flag hints the scan-line converter to\n * ignore such cases. See below for more information.\n *\n * FT_OUTLINE_SMART_DROPOUTS ::\n * Select smart dropout control. If unset, use simple dropout control.\n * Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more\n * information.\n *\n * FT_OUTLINE_INCLUDE_STUBS ::\n * If set, turn pixels on for 'stubs', otherwise exclude them. Ignored\n * if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for more\n * information.\n *\n * FT_OUTLINE_HIGH_PRECISION ::\n * This flag indicates that the scan-line converter should try to\n * convert this outline to bitmaps with the highest possible quality.\n * It is typically set for small character sizes. Note that this is\n * only a hint that might be completely ignored by a given\n * scan-converter.\n *\n * FT_OUTLINE_SINGLE_PASS ::\n * This flag is set to force a given scan-converter to only use a\n * single pass over the outline to render a bitmap glyph image.\n * Normally, it is set for very large character sizes. It is only a\n * hint that might be completely ignored by a given scan-converter.\n *\n * @note:\n * The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and\n * @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth rasterizer.\n *\n * There exists a second mechanism to pass the drop-out mode to the B/W\n * rasterizer; see the `tags` field in @FT_Outline.\n *\n * Please refer to the description of the 'SCANTYPE' instruction in the\n * OpenType specification (in file `ttinst1.doc`) how simple drop-outs,\n * smart drop-outs, and stubs are defined.\n */\n#define FT_OUTLINE_NONE 0x0\n#define FT_OUTLINE_OWNER 0x1\n#define FT_OUTLINE_EVEN_ODD_FILL 0x2\n#define FT_OUTLINE_REVERSE_FILL 0x4\n#define FT_OUTLINE_IGNORE_DROPOUTS 0x8\n#define FT_OUTLINE_SMART_DROPOUTS 0x10\n#define FT_OUTLINE_INCLUDE_STUBS 0x20\n\n#define FT_OUTLINE_HIGH_PRECISION 0x100\n#define FT_OUTLINE_SINGLE_PASS 0x200\n\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_OUTLINE_XXX` values instead */\n#define ft_outline_none FT_OUTLINE_NONE\n#define ft_outline_owner FT_OUTLINE_OWNER\n#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL\n#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL\n#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS\n#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION\n#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS\n\n /* */\n\n#define FT_CURVE_TAG( flag ) ( flag & 0x03 )\n\n /* see the `tags` field in `FT_Outline` for a description of the values */\n#define FT_CURVE_TAG_ON 0x01\n#define FT_CURVE_TAG_CONIC 0x00\n#define FT_CURVE_TAG_CUBIC 0x02\n\n#define FT_CURVE_TAG_HAS_SCANMODE 0x04\n\n#define FT_CURVE_TAG_TOUCH_X 0x08 /* reserved for TrueType hinter */\n#define FT_CURVE_TAG_TOUCH_Y 0x10 /* reserved for TrueType hinter */\n\n#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \\\n FT_CURVE_TAG_TOUCH_Y )\n /* values 0x20, 0x40, and 0x80 are reserved */\n\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_CURVE_TAG_XXX` values instead */\n#define FT_Curve_Tag_On FT_CURVE_TAG_ON\n#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC\n#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC\n#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X\n#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Outline_MoveToFunc\n *\n * @description:\n * A function pointer type used to describe the signature of a 'move to'\n * function during outline walking/decomposition.\n *\n * A 'move to' is emitted to start a new contour in an outline.\n *\n * @input:\n * to ::\n * A pointer to the target point of the 'move to'.\n *\n * user ::\n * A typeless pointer, which is passed from the caller of the\n * decomposition function.\n *\n * @return:\n * Error code. 0~means success.\n */\n typedef int\n (*FT_Outline_MoveToFunc)( const FT_Vector* to,\n void* user );\n\n#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Outline_LineToFunc\n *\n * @description:\n * A function pointer type used to describe the signature of a 'line to'\n * function during outline walking/decomposition.\n *\n * A 'line to' is emitted to indicate a segment in the outline.\n *\n * @input:\n * to ::\n * A pointer to the target point of the 'line to'.\n *\n * user ::\n * A typeless pointer, which is passed from the caller of the\n * decomposition function.\n *\n * @return:\n * Error code. 0~means success.\n */\n typedef int\n (*FT_Outline_LineToFunc)( const FT_Vector* to,\n void* user );\n\n#define FT_Outline_LineTo_Func FT_Outline_LineToFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Outline_ConicToFunc\n *\n * @description:\n * A function pointer type used to describe the signature of a 'conic to'\n * function during outline walking or decomposition.\n *\n * A 'conic to' is emitted to indicate a second-order Bezier arc in the\n * outline.\n *\n * @input:\n * control ::\n * An intermediate control point between the last position and the new\n * target in `to`.\n *\n * to ::\n * A pointer to the target end point of the conic arc.\n *\n * user ::\n * A typeless pointer, which is passed from the caller of the\n * decomposition function.\n *\n * @return:\n * Error code. 0~means success.\n */\n typedef int\n (*FT_Outline_ConicToFunc)( const FT_Vector* control,\n const FT_Vector* to,\n void* user );\n\n#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Outline_CubicToFunc\n *\n * @description:\n * A function pointer type used to describe the signature of a 'cubic to'\n * function during outline walking or decomposition.\n *\n * A 'cubic to' is emitted to indicate a third-order Bezier arc.\n *\n * @input:\n * control1 ::\n * A pointer to the first Bezier control point.\n *\n * control2 ::\n * A pointer to the second Bezier control point.\n *\n * to ::\n * A pointer to the target end point.\n *\n * user ::\n * A typeless pointer, which is passed from the caller of the\n * decomposition function.\n *\n * @return:\n * Error code. 0~means success.\n */\n typedef int\n (*FT_Outline_CubicToFunc)( const FT_Vector* control1,\n const FT_Vector* control2,\n const FT_Vector* to,\n void* user );\n\n#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Outline_Funcs\n *\n * @description:\n * A structure to hold various function pointers used during outline\n * decomposition in order to emit segments, conic, and cubic Beziers.\n *\n * @fields:\n * move_to ::\n * The 'move to' emitter.\n *\n * line_to ::\n * The segment emitter.\n *\n * conic_to ::\n * The second-order Bezier arc emitter.\n *\n * cubic_to ::\n * The third-order Bezier arc emitter.\n *\n * shift ::\n * The shift that is applied to coordinates before they are sent to the\n * emitter.\n *\n * delta ::\n * The delta that is applied to coordinates before they are sent to the\n * emitter, but after the shift.\n *\n * @note:\n * The point coordinates sent to the emitters are the transformed version\n * of the original coordinates (this is important for high accuracy\n * during scan-conversion). The transformation is simple:\n *\n * ```\n * x' = (x << shift) - delta\n * y' = (y << shift) - delta\n * ```\n *\n * Set the values of `shift` and `delta` to~0 to get the original point\n * coordinates.\n */\n typedef struct FT_Outline_Funcs_\n {\n FT_Outline_MoveToFunc move_to;\n FT_Outline_LineToFunc line_to;\n FT_Outline_ConicToFunc conic_to;\n FT_Outline_CubicToFunc cubic_to;\n\n int shift;\n FT_Pos delta;\n\n } FT_Outline_Funcs;\n\n\n /**************************************************************************\n *\n * @section:\n * basic_types\n *\n */\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IMAGE_TAG\n *\n * @description:\n * This macro converts four-letter tags to an unsigned long type.\n *\n * @note:\n * Since many 16-bit compilers don't like 32-bit enumerations, you should\n * redefine this macro in case of problems to something like this:\n *\n * ```\n * #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value\n * ```\n *\n * to get a simple enumeration without assigning special numbers.\n */\n#ifndef FT_IMAGE_TAG\n#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \\\n value = ( ( (unsigned long)_x1 << 24 ) | \\\n ( (unsigned long)_x2 << 16 ) | \\\n ( (unsigned long)_x3 << 8 ) | \\\n (unsigned long)_x4 )\n#endif /* FT_IMAGE_TAG */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Glyph_Format\n *\n * @description:\n * An enumeration type used to describe the format of a given glyph\n * image. Note that this version of FreeType only supports two image\n * formats, even though future font drivers will be able to register\n * their own format.\n *\n * @values:\n * FT_GLYPH_FORMAT_NONE ::\n * The value~0 is reserved.\n *\n * FT_GLYPH_FORMAT_COMPOSITE ::\n * The glyph image is a composite of several other images. This format\n * is _only_ used with @FT_LOAD_NO_RECURSE, and is used to report\n * compound glyphs (like accented characters).\n *\n * FT_GLYPH_FORMAT_BITMAP ::\n * The glyph image is a bitmap, and can be described as an @FT_Bitmap.\n * You generally need to access the `bitmap` field of the\n * @FT_GlyphSlotRec structure to read it.\n *\n * FT_GLYPH_FORMAT_OUTLINE ::\n * The glyph image is a vectorial outline made of line segments and\n * Bezier arcs; it can be described as an @FT_Outline; you generally\n * want to access the `outline` field of the @FT_GlyphSlotRec structure\n * to read it.\n *\n * FT_GLYPH_FORMAT_PLOTTER ::\n * The glyph image is a vectorial path with no inside and outside\n * contours. Some Type~1 fonts, like those in the Hershey family,\n * contain glyphs in this format. These are described as @FT_Outline,\n * but FreeType isn't currently capable of rendering them correctly.\n */\n typedef enum FT_Glyph_Format_\n {\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ),\n\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),\n FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )\n\n } FT_Glyph_Format;\n\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_Glyph_Format` values instead. */\n#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE\n#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE\n#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP\n#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE\n#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** R A S T E R D E F I N I T I O N S *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * A raster is a scan converter, in charge of rendering an outline into a\n * bitmap. This section contains the public API for rasters.\n *\n * Note that in FreeType 2, all rasters are now encapsulated within\n * specific modules called 'renderers'. See `ftrender.h` for more details\n * on renderers.\n *\n */\n\n\n /**************************************************************************\n *\n * @section:\n * raster\n *\n * @title:\n * Scanline Converter\n *\n * @abstract:\n * How vectorial outlines are converted into bitmaps and pixmaps.\n *\n * @description:\n * This section contains technical definitions.\n *\n * @order:\n * FT_Raster\n * FT_Span\n * FT_SpanFunc\n *\n * FT_Raster_Params\n * FT_RASTER_FLAG_XXX\n *\n * FT_Raster_NewFunc\n * FT_Raster_DoneFunc\n * FT_Raster_ResetFunc\n * FT_Raster_SetModeFunc\n * FT_Raster_RenderFunc\n * FT_Raster_Funcs\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Raster\n *\n * @description:\n * An opaque handle (pointer) to a raster object. Each object can be\n * used independently to convert an outline into a bitmap or pixmap.\n */\n typedef struct FT_RasterRec_* FT_Raster;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Span\n *\n * @description:\n * A structure used to model a single span of gray pixels when rendering\n * an anti-aliased bitmap.\n *\n * @fields:\n * x ::\n * The span's horizontal start position.\n *\n * len ::\n * The span's length in pixels.\n *\n * coverage ::\n * The span color/coverage, ranging from 0 (background) to 255\n * (foreground).\n *\n * @note:\n * This structure is used by the span drawing callback type named\n * @FT_SpanFunc that takes the y~coordinate of the span as a parameter.\n *\n * The coverage value is always between 0 and 255. If you want less gray\n * values, the callback function has to reduce them.\n */\n typedef struct FT_Span_\n {\n short x;\n unsigned short len;\n unsigned char coverage;\n\n } FT_Span;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_SpanFunc\n *\n * @description:\n * A function used as a call-back by the anti-aliased renderer in order\n * to let client applications draw themselves the gray pixel spans on\n * each scan line.\n *\n * @input:\n * y ::\n * The scanline's upward y~coordinate.\n *\n * count ::\n * The number of spans to draw on this scanline.\n *\n * spans ::\n * A table of `count` spans to draw on the scanline.\n *\n * user ::\n * User-supplied data that is passed to the callback.\n *\n * @note:\n * This callback allows client applications to directly render the gray\n * spans of the anti-aliased bitmap to any kind of surfaces.\n *\n * This can be used to write anti-aliased outlines directly to a given\n * background bitmap, and even perform translucency.\n */\n typedef void\n (*FT_SpanFunc)( int y,\n int count,\n const FT_Span* spans,\n void* user );\n\n#define FT_Raster_Span_Func FT_SpanFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_BitTest_Func\n *\n * @description:\n * Deprecated, unimplemented.\n */\n typedef int\n (*FT_Raster_BitTest_Func)( int y,\n int x,\n void* user );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_BitSet_Func\n *\n * @description:\n * Deprecated, unimplemented.\n */\n typedef void\n (*FT_Raster_BitSet_Func)( int y,\n int x,\n void* user );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_RASTER_FLAG_XXX\n *\n * @description:\n * A list of bit flag constants as used in the `flags` field of a\n * @FT_Raster_Params structure.\n *\n * @values:\n * FT_RASTER_FLAG_DEFAULT ::\n * This value is 0.\n *\n * FT_RASTER_FLAG_AA ::\n * This flag is set to indicate that an anti-aliased glyph image should\n * be generated. Otherwise, it will be monochrome (1-bit).\n *\n * FT_RASTER_FLAG_DIRECT ::\n * This flag is set to indicate direct rendering. In this mode, client\n * applications must provide their own span callback. This lets them\n * directly draw or compose over an existing bitmap. If this bit is\n * _not_ set, the target pixmap's buffer _must_ be zeroed before\n * rendering and the output will be clipped to its size.\n *\n * Direct rendering is only possible with anti-aliased glyphs.\n *\n * FT_RASTER_FLAG_CLIP ::\n * This flag is only used in direct rendering mode. If set, the output\n * will be clipped to a box specified in the `clip_box` field of the\n * @FT_Raster_Params structure. Otherwise, the `clip_box` is\n * effectively set to the bounding box and all spans are generated.\n */\n#define FT_RASTER_FLAG_DEFAULT 0x0\n#define FT_RASTER_FLAG_AA 0x1\n#define FT_RASTER_FLAG_DIRECT 0x2\n#define FT_RASTER_FLAG_CLIP 0x4\n\n /* these constants are deprecated; use the corresponding */\n /* `FT_RASTER_FLAG_XXX` values instead */\n#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT\n#define ft_raster_flag_aa FT_RASTER_FLAG_AA\n#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT\n#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Raster_Params\n *\n * @description:\n * A structure to hold the parameters used by a raster's render function,\n * passed as an argument to @FT_Outline_Render.\n *\n * @fields:\n * target ::\n * The target bitmap.\n *\n * source ::\n * A pointer to the source glyph image (e.g., an @FT_Outline).\n *\n * flags ::\n * The rendering flags.\n *\n * gray_spans ::\n * The gray span drawing callback.\n *\n * black_spans ::\n * Unused.\n *\n * bit_test ::\n * Unused.\n *\n * bit_set ::\n * Unused.\n *\n * user ::\n * User-supplied data that is passed to each drawing callback.\n *\n * clip_box ::\n * An optional clipping box. It is only used in direct rendering mode.\n * Note that coordinates here should be expressed in _integer_ pixels\n * (and not in 26.6 fixed-point units).\n *\n * @note:\n * An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA bit\n * flag is set in the `flags` field, otherwise a monochrome bitmap is\n * generated.\n *\n * If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags`, the raster\n * will call the `gray_spans` callback to draw gray pixel spans. This\n * allows direct composition over a preexisting bitmap through\n * user-provided callbacks to perform the span drawing and composition.\n * Not supported by the monochrome rasterizer.\n */\n typedef struct FT_Raster_Params_\n {\n const FT_Bitmap* target;\n const void* source;\n int flags;\n FT_SpanFunc gray_spans;\n FT_SpanFunc black_spans; /* unused */\n FT_Raster_BitTest_Func bit_test; /* unused */\n FT_Raster_BitSet_Func bit_set; /* unused */\n void* user;\n FT_BBox clip_box;\n\n } FT_Raster_Params;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_NewFunc\n *\n * @description:\n * A function used to create a new raster object.\n *\n * @input:\n * memory ::\n * A handle to the memory allocator.\n *\n * @output:\n * raster ::\n * A handle to the new raster object.\n *\n * @return:\n * Error code. 0~means success.\n *\n * @note:\n * The `memory` parameter is a typeless pointer in order to avoid\n * un-wanted dependencies on the rest of the FreeType code. In practice,\n * it is an @FT_Memory object, i.e., a handle to the standard FreeType\n * memory allocator. However, this field can be completely ignored by a\n * given raster implementation.\n */\n typedef int\n (*FT_Raster_NewFunc)( void* memory,\n FT_Raster* raster );\n\n#define FT_Raster_New_Func FT_Raster_NewFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_DoneFunc\n *\n * @description:\n * A function used to destroy a given raster object.\n *\n * @input:\n * raster ::\n * A handle to the raster object.\n */\n typedef void\n (*FT_Raster_DoneFunc)( FT_Raster raster );\n\n#define FT_Raster_Done_Func FT_Raster_DoneFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_ResetFunc\n *\n * @description:\n * FreeType used to provide an area of memory called the 'render pool'\n * available to all registered rasterizers. This was not thread safe,\n * however, and now FreeType never allocates this pool.\n *\n * This function is called after a new raster object is created.\n *\n * @input:\n * raster ::\n * A handle to the new raster object.\n *\n * pool_base ::\n * Previously, the address in memory of the render pool. Set this to\n * `NULL`.\n *\n * pool_size ::\n * Previously, the size in bytes of the render pool. Set this to 0.\n *\n * @note:\n * Rasterizers should rely on dynamic or stack allocation if they want to\n * (a handle to the memory allocator is passed to the rasterizer\n * constructor).\n */\n typedef void\n (*FT_Raster_ResetFunc)( FT_Raster raster,\n unsigned char* pool_base,\n unsigned long pool_size );\n\n#define FT_Raster_Reset_Func FT_Raster_ResetFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_SetModeFunc\n *\n * @description:\n * This function is a generic facility to change modes or attributes in a\n * given raster. This can be used for debugging purposes, or simply to\n * allow implementation-specific 'features' in a given raster module.\n *\n * @input:\n * raster ::\n * A handle to the new raster object.\n *\n * mode ::\n * A 4-byte tag used to name the mode or property.\n *\n * args ::\n * A pointer to the new mode/property to use.\n */\n typedef int\n (*FT_Raster_SetModeFunc)( FT_Raster raster,\n unsigned long mode,\n void* args );\n\n#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Raster_RenderFunc\n *\n * @description:\n * Invoke a given raster to scan-convert a given glyph image into a\n * target bitmap.\n *\n * @input:\n * raster ::\n * A handle to the raster object.\n *\n * params ::\n * A pointer to an @FT_Raster_Params structure used to store the\n * rendering parameters.\n *\n * @return:\n * Error code. 0~means success.\n *\n * @note:\n * The exact format of the source image depends on the raster's glyph\n * format defined in its @FT_Raster_Funcs structure. It can be an\n * @FT_Outline or anything else in order to support a large array of\n * glyph formats.\n *\n * Note also that the render function can fail and return a\n * `FT_Err_Unimplemented_Feature` error code if the raster used does not\n * support direct composition.\n */\n typedef int\n (*FT_Raster_RenderFunc)( FT_Raster raster,\n const FT_Raster_Params* params );\n\n#define FT_Raster_Render_Func FT_Raster_RenderFunc\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Raster_Funcs\n *\n * @description:\n * A structure used to describe a given raster class to the library.\n *\n * @fields:\n * glyph_format ::\n * The supported glyph format for this raster.\n *\n * raster_new ::\n * The raster constructor.\n *\n * raster_reset ::\n * Used to reset the render pool within the raster.\n *\n * raster_render ::\n * A function to render a glyph into a given bitmap.\n *\n * raster_done ::\n * The raster destructor.\n */\n typedef struct FT_Raster_Funcs_\n {\n FT_Glyph_Format glyph_format;\n\n FT_Raster_NewFunc raster_new;\n FT_Raster_ResetFunc raster_reset;\n FT_Raster_SetModeFunc raster_set_mode;\n FT_Raster_RenderFunc raster_render;\n FT_Raster_DoneFunc raster_done;\n\n } FT_Raster_Funcs;\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTIMAGE_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftincrem.h", "language": "code", "loc": 309, "comment_density": 0.854, "code": "/****************************************************************************\n *\n * ftincrem.h\n *\n * FreeType incremental loading (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTINCREM_H_\n#define FTINCREM_H_\n\n#include \n#include FT_FREETYPE_H\n#include FT_PARAMETER_TAGS_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * incremental\n *\n * @title:\n * Incremental Loading\n *\n * @abstract:\n * Custom Glyph Loading.\n *\n * @description:\n * This section contains various functions used to perform so-called\n * 'incremental' glyph loading. This is a mode where all glyphs loaded\n * from a given @FT_Face are provided by the client application.\n *\n * Apart from that, all other tables are loaded normally from the font\n * file. This mode is useful when FreeType is used within another\n * engine, e.g., a PostScript Imaging Processor.\n *\n * To enable this mode, you must use @FT_Open_Face, passing an\n * @FT_Parameter with the @FT_PARAM_TAG_INCREMENTAL tag and an\n * @FT_Incremental_Interface value. See the comments for\n * @FT_Incremental_InterfaceRec for an example.\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental\n *\n * @description:\n * An opaque type describing a user-provided object used to implement\n * 'incremental' glyph loading within FreeType. This is used to support\n * embedded fonts in certain environments (e.g., PostScript\n * interpreters), where the glyph data isn't in the font file, or must be\n * overridden by different values.\n *\n * @note:\n * It is up to client applications to create and implement\n * @FT_Incremental objects, as long as they provide implementations for\n * the methods @FT_Incremental_GetGlyphDataFunc,\n * @FT_Incremental_FreeGlyphDataFunc and\n * @FT_Incremental_GetGlyphMetricsFunc.\n *\n * See the description of @FT_Incremental_InterfaceRec to understand how\n * to use incremental objects with FreeType.\n *\n */\n typedef struct FT_IncrementalRec_* FT_Incremental;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Incremental_MetricsRec\n *\n * @description:\n * A small structure used to contain the basic glyph metrics returned by\n * the @FT_Incremental_GetGlyphMetricsFunc method.\n *\n * @fields:\n * bearing_x ::\n * Left bearing, in font units.\n *\n * bearing_y ::\n * Top bearing, in font units.\n *\n * advance ::\n * Horizontal component of glyph advance, in font units.\n *\n * advance_v ::\n * Vertical component of glyph advance, in font units.\n *\n * @note:\n * These correspond to horizontal or vertical metrics depending on the\n * value of the `vertical` argument to the function\n * @FT_Incremental_GetGlyphMetricsFunc.\n *\n */\n typedef struct FT_Incremental_MetricsRec_\n {\n FT_Long bearing_x;\n FT_Long bearing_y;\n FT_Long advance;\n FT_Long advance_v; /* since 2.3.12 */\n\n } FT_Incremental_MetricsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Incremental_Metrics\n *\n * @description:\n * A handle to an @FT_Incremental_MetricsRec structure.\n *\n */\n typedef struct FT_Incremental_MetricsRec_* FT_Incremental_Metrics;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental_GetGlyphDataFunc\n *\n * @description:\n * A function called by FreeType to access a given glyph's data bytes\n * during @FT_Load_Glyph or @FT_Load_Char if incremental loading is\n * enabled.\n *\n * Note that the format of the glyph's data bytes depends on the font\n * file format. For TrueType, it must correspond to the raw bytes within\n * the 'glyf' table. For PostScript formats, it must correspond to the\n * **unencrypted** charstring bytes, without any `lenIV` header. It is\n * undefined for any other format.\n *\n * @input:\n * incremental ::\n * Handle to an opaque @FT_Incremental handle provided by the client\n * application.\n *\n * glyph_index ::\n * Index of relevant glyph.\n *\n * @output:\n * adata ::\n * A structure describing the returned glyph data bytes (which will be\n * accessed as a read-only byte block).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If this function returns successfully the method\n * @FT_Incremental_FreeGlyphDataFunc will be called later to release the\n * data bytes.\n *\n * Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for\n * compound glyphs.\n *\n */\n typedef FT_Error\n (*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental,\n FT_UInt glyph_index,\n FT_Data* adata );\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental_FreeGlyphDataFunc\n *\n * @description:\n * A function used to release the glyph data bytes returned by a\n * successful call to @FT_Incremental_GetGlyphDataFunc.\n *\n * @input:\n * incremental ::\n * A handle to an opaque @FT_Incremental handle provided by the client\n * application.\n *\n * data ::\n * A structure describing the glyph data bytes (which will be accessed\n * as a read-only byte block).\n *\n */\n typedef void\n (*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental,\n FT_Data* data );\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental_GetGlyphMetricsFunc\n *\n * @description:\n * A function used to retrieve the basic metrics of a given glyph index\n * before accessing its data. This is necessary because, in certain\n * formats like TrueType, the metrics are stored in a different place\n * from the glyph images proper.\n *\n * @input:\n * incremental ::\n * A handle to an opaque @FT_Incremental handle provided by the client\n * application.\n *\n * glyph_index ::\n * Index of relevant glyph.\n *\n * vertical ::\n * If true, return vertical metrics.\n *\n * ametrics ::\n * This parameter is used for both input and output. The original\n * glyph metrics, if any, in font units. If metrics are not available\n * all the values must be set to zero.\n *\n * @output:\n * ametrics ::\n * The replacement glyph metrics in font units.\n *\n */\n typedef FT_Error\n (*FT_Incremental_GetGlyphMetricsFunc)\n ( FT_Incremental incremental,\n FT_UInt glyph_index,\n FT_Bool vertical,\n FT_Incremental_MetricsRec *ametrics );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Incremental_FuncsRec\n *\n * @description:\n * A table of functions for accessing fonts that load data incrementally.\n * Used in @FT_Incremental_InterfaceRec.\n *\n * @fields:\n * get_glyph_data ::\n * The function to get glyph data. Must not be null.\n *\n * free_glyph_data ::\n * The function to release glyph data. Must not be null.\n *\n * get_glyph_metrics ::\n * The function to get glyph metrics. May be null if the font does not\n * provide overriding glyph metrics.\n *\n */\n typedef struct FT_Incremental_FuncsRec_\n {\n FT_Incremental_GetGlyphDataFunc get_glyph_data;\n FT_Incremental_FreeGlyphDataFunc free_glyph_data;\n FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics;\n\n } FT_Incremental_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Incremental_InterfaceRec\n *\n * @description:\n * A structure to be used with @FT_Open_Face to indicate that the user\n * wants to support incremental glyph loading. You should use it with\n * @FT_PARAM_TAG_INCREMENTAL as in the following example:\n *\n * ```\n * FT_Incremental_InterfaceRec inc_int;\n * FT_Parameter parameter;\n * FT_Open_Args open_args;\n *\n *\n * // set up incremental descriptor\n * inc_int.funcs = my_funcs;\n * inc_int.object = my_object;\n *\n * // set up optional parameter\n * parameter.tag = FT_PARAM_TAG_INCREMENTAL;\n * parameter.data = &inc_int;\n *\n * // set up FT_Open_Args structure\n * open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;\n * open_args.pathname = my_font_pathname;\n * open_args.num_params = 1;\n * open_args.params = ¶meter; // we use one optional argument\n *\n * // open the font\n * error = FT_Open_Face( library, &open_args, index, &face );\n * ...\n * ```\n *\n */\n typedef struct FT_Incremental_InterfaceRec_\n {\n const FT_Incremental_FuncsRec* funcs;\n FT_Incremental object;\n\n } FT_Incremental_InterfaceRec;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Incremental_Interface\n *\n * @description:\n * A pointer to an @FT_Incremental_InterfaceRec structure.\n *\n */\n typedef FT_Incremental_InterfaceRec* FT_Incremental_Interface;\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTINCREM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftlcdfil.h", "language": "code", "loc": 302, "comment_density": 0.897, "code": "/****************************************************************************\n *\n * ftlcdfil.h\n *\n * FreeType API for color filtering of subpixel bitmap glyphs\n * (specification).\n *\n * Copyright (C) 2006-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTLCDFIL_H_\n#define FTLCDFIL_H_\n\n#include \n#include FT_FREETYPE_H\n#include FT_PARAMETER_TAGS_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * lcd_rendering\n *\n * @title:\n * Subpixel Rendering\n *\n * @abstract:\n * API to control subpixel rendering.\n *\n * @description:\n * FreeType provides two alternative subpixel rendering technologies. \n * Should you define `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` in your\n * `ftoption.h` file, this enables patented ClearType-style rendering. \n * Otherwise, Harmony LCD rendering is enabled. These technologies are\n * controlled differently and API described below, although always\n * available, performs its function when appropriate method is enabled\n * and does nothing otherwise.\n *\n * ClearType-style LCD rendering exploits the color-striped structure of\n * LCD pixels, increasing the available resolution in the direction of\n * the stripe (usually horizontal RGB) by a factor of~3. Using the\n * subpixels coverages unfiltered can create severe color fringes\n * especially when rendering thin features. Indeed, to produce\n * black-on-white text, the nearby color subpixels must be dimmed\n * equally.\n *\n * A good 5-tap FIR filter should be applied to subpixel coverages\n * regardless of pixel boundaries and should have these properties:\n *\n * 1. It should be symmetrical, like {~a, b, c, b, a~}, to avoid\n * any shifts in appearance.\n *\n * 2. It should be color-balanced, meaning a~+ b~=~c, to reduce color\n * fringes by distributing the computed coverage for one subpixel to\n * all subpixels equally.\n *\n * 3. It should be normalized, meaning 2a~+ 2b~+ c~=~1.0 to maintain\n * overall brightness.\n *\n * Boxy 3-tap filter {0, 1/3, 1/3, 1/3, 0} is sharper but is less\n * forgiving of non-ideal gamma curves of a screen (and viewing angles),\n * beveled filters are fuzzier but more tolerant.\n *\n * Use the @FT_Library_SetLcdFilter or @FT_Library_SetLcdFilterWeights\n * API to specify a low-pass filter, which is then applied to\n * subpixel-rendered bitmaps generated through @FT_Render_Glyph.\n *\n * Harmony LCD rendering is suitable to panels with any regular subpixel\n * structure, not just monitors with 3 color striped subpixels, as long\n * as the color subpixels have fixed positions relative to the pixel\n * center. In this case, each color channel is then rendered separately\n * after shifting the outline opposite to the subpixel shift so that the\n * coverage maps are aligned. This method is immune to color fringes\n * because the shifts do not change integral coverage.\n *\n * The subpixel geometry must be specified by xy-coordinates for each\n * subpixel. By convention they may come in the RGB order: {{-1/3, 0},\n * {0, 0}, {1/3, 0}} for standard RGB striped panel or {{-1/6, 1/4},\n * {-1/6, -1/4}, {1/3, 0}} for a certain PenTile panel.\n *\n * Use the @FT_Library_SetLcdGeometry API to specify subpixel positions.\n * If one follows the RGB order convention, the same order applies to the\n * resulting @FT_PIXEL_MODE_LCD and @FT_PIXEL_MODE_LCD_V bitmaps. Note,\n * however, that the coordinate frame for the latter must be rotated\n * clockwise. Harmony with default LCD geometry is equivalent to\n * ClearType with light filter.\n *\n * As a result of ClearType filtering or Harmony rendering, the\n * dimensions of LCD bitmaps can be either wider or taller than the\n * dimensions of the corresponding outline with regard to the pixel grid.\n * For example, for @FT_RENDER_MODE_LCD, the filter adds 2~subpixels to\n * the left, and 2~subpixels to the right. The bitmap offset values are\n * adjusted accordingly, so clients shouldn't need to modify their layout\n * and glyph positioning code when enabling the filter.\n *\n * The ClearType and Harmony rendering is applicable to glyph bitmaps\n * rendered through @FT_Render_Glyph, @FT_Load_Glyph, @FT_Load_Char, and\n * @FT_Glyph_To_Bitmap, when @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V\n * is specified. This API does not control @FT_Outline_Render and\n * @FT_Outline_Get_Bitmap.\n *\n * The described algorithms can completely remove color artefacts when\n * combined with gamma-corrected alpha blending in linear space. Each of\n * the 3~alpha values (subpixels) must by independently used to blend one\n * color channel. That is, red alpha blends the red channel of the text\n * color with the red channel of the background pixel.\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_LcdFilter\n *\n * @description:\n * A list of values to identify various types of LCD filters.\n *\n * @values:\n * FT_LCD_FILTER_NONE ::\n * Do not perform filtering. When used with subpixel rendering, this\n * results in sometimes severe color fringes.\n *\n * FT_LCD_FILTER_DEFAULT ::\n * This is a beveled, normalized, and color-balanced five-tap filter\n * with weights of [0x08 0x4D 0x56 0x4D 0x08] in 1/256th units.\n *\n * FT_LCD_FILTER_LIGHT ::\n * this is a boxy, normalized, and color-balanced three-tap filter with\n * weights of [0x00 0x55 0x56 0x55 0x00] in 1/256th units.\n *\n * FT_LCD_FILTER_LEGACY ::\n * FT_LCD_FILTER_LEGACY1 ::\n * This filter corresponds to the original libXft color filter. It\n * provides high contrast output but can exhibit really bad color\n * fringes if glyphs are not extremely well hinted to the pixel grid.\n * This filter is only provided for comparison purposes, and might be\n * disabled or stay unsupported in the future. The second value is\n * provided for compatibility with FontConfig, which historically used\n * different enumeration, sometimes incorrectly forwarded to FreeType.\n *\n * @since:\n * 2.3.0 (`FT_LCD_FILTER_LEGACY1` since 2.6.2)\n */\n typedef enum FT_LcdFilter_\n {\n FT_LCD_FILTER_NONE = 0,\n FT_LCD_FILTER_DEFAULT = 1,\n FT_LCD_FILTER_LIGHT = 2,\n FT_LCD_FILTER_LEGACY1 = 3,\n FT_LCD_FILTER_LEGACY = 16,\n\n FT_LCD_FILTER_MAX /* do not remove */\n\n } FT_LcdFilter;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Library_SetLcdFilter\n *\n * @description:\n * This function is used to apply color filtering to LCD decimated\n * bitmaps, like the ones used when calling @FT_Render_Glyph with\n * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.\n *\n * @input:\n * library ::\n * A handle to the target library instance.\n *\n * filter ::\n * The filter type.\n *\n * You can use @FT_LCD_FILTER_NONE here to disable this feature, or\n * @FT_LCD_FILTER_DEFAULT to use a default filter that should work well\n * on most LCD screens.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This feature is always disabled by default. Clients must make an\n * explicit call to this function with a `filter` value other than\n * @FT_LCD_FILTER_NONE in order to enable it.\n *\n * Due to **PATENTS** covering subpixel rendering, this function doesn't\n * do anything except returning `FT_Err_Unimplemented_Feature` if the\n * configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is not\n * defined in your build of the library, which should correspond to all\n * default builds of FreeType.\n *\n * @since:\n * 2.3.0\n */\n FT_EXPORT( FT_Error )\n FT_Library_SetLcdFilter( FT_Library library,\n FT_LcdFilter filter );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Library_SetLcdFilterWeights\n *\n * @description:\n * This function can be used to enable LCD filter with custom weights,\n * instead of using presets in @FT_Library_SetLcdFilter.\n *\n * @input:\n * library ::\n * A handle to the target library instance.\n *\n * weights ::\n * A pointer to an array; the function copies the first five bytes and\n * uses them to specify the filter weights in 1/256th units.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Due to **PATENTS** covering subpixel rendering, this function doesn't\n * do anything except returning `FT_Err_Unimplemented_Feature` if the\n * configuration macro `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is not\n * defined in your build of the library, which should correspond to all\n * default builds of FreeType.\n *\n * LCD filter weights can also be set per face using @FT_Face_Properties\n * with @FT_PARAM_TAG_LCD_FILTER_WEIGHTS.\n *\n * @since:\n * 2.4.0\n */\n FT_EXPORT( FT_Error )\n FT_Library_SetLcdFilterWeights( FT_Library library,\n unsigned char *weights );\n\n\n /**************************************************************************\n *\n * @type:\n * FT_LcdFiveTapFilter\n *\n * @description:\n * A typedef for passing the five LCD filter weights to\n * @FT_Face_Properties within an @FT_Parameter structure.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_LCD_FILTER_FIVE_TAPS 5\n\n typedef FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS];\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Library_SetLcdGeometry\n *\n * @description:\n * This function can be used to modify default positions of color\n * subpixels, which controls Harmony LCD rendering.\n *\n * @input:\n * library ::\n * A handle to the target library instance.\n *\n * sub ::\n * A pointer to an array of 3 vectors in 26.6 fractional pixel format;\n * the function modifies the default values, see the note below.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Subpixel geometry examples:\n *\n * - {{-21, 0}, {0, 0}, {21, 0}} is the default, corresponding to 3 color\n * stripes shifted by a third of a pixel. This could be an RGB panel.\n *\n * - {{21, 0}, {0, 0}, {-21, 0}} looks the same as the default but can\n * specify a BGR panel instead, while keeping the bitmap in the same\n * RGB888 format.\n *\n * - {{0, 21}, {0, 0}, {0, -21}} is the vertical RGB, but the bitmap\n * stays RGB888 as a result.\n *\n * - {{-11, 16}, {-11, -16}, {22, 0}} is a certain PenTile arrangement.\n *\n * This function does nothing and returns `FT_Err_Unimplemented_Feature`\n * in the context of ClearType-style subpixel rendering when\n * `FT_CONFIG_OPTION_SUBPIXEL_RENDERING` is defined in your build of the\n * library.\n *\n * @since:\n * 2.10.0\n */\n FT_EXPORT( FT_Error )\n FT_Library_SetLcdGeometry( FT_Library library,\n FT_Vector sub[3] );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTLCDFIL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftlist.h", "language": "code", "loc": 262, "comment_density": 0.84, "code": "/****************************************************************************\n *\n * ftlist.h\n *\n * Generic list support for FreeType (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file implements functions relative to list processing. Its data\n * structures are defined in `freetype.h`.\n *\n */\n\n\n#ifndef FTLIST_H_\n#define FTLIST_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * list_processing\n *\n * @title:\n * List Processing\n *\n * @abstract:\n * Simple management of lists.\n *\n * @description:\n * This section contains various definitions related to list processing\n * using doubly-linked nodes.\n *\n * @order:\n * FT_List\n * FT_ListNode\n * FT_ListRec\n * FT_ListNodeRec\n *\n * FT_List_Add\n * FT_List_Insert\n * FT_List_Find\n * FT_List_Remove\n * FT_List_Up\n * FT_List_Iterate\n * FT_List_Iterator\n * FT_List_Finalize\n * FT_List_Destructor\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Find\n *\n * @description:\n * Find the list node for a given listed object.\n *\n * @input:\n * list ::\n * A pointer to the parent list.\n * data ::\n * The address of the listed object.\n *\n * @return:\n * List node. `NULL` if it wasn't found.\n */\n FT_EXPORT( FT_ListNode )\n FT_List_Find( FT_List list,\n void* data );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Add\n *\n * @description:\n * Append an element to the end of a list.\n *\n * @inout:\n * list ::\n * A pointer to the parent list.\n * node ::\n * The node to append.\n */\n FT_EXPORT( void )\n FT_List_Add( FT_List list,\n FT_ListNode node );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Insert\n *\n * @description:\n * Insert an element at the head of a list.\n *\n * @inout:\n * list ::\n * A pointer to parent list.\n * node ::\n * The node to insert.\n */\n FT_EXPORT( void )\n FT_List_Insert( FT_List list,\n FT_ListNode node );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Remove\n *\n * @description:\n * Remove a node from a list. This function doesn't check whether the\n * node is in the list!\n *\n * @input:\n * node ::\n * The node to remove.\n *\n * @inout:\n * list ::\n * A pointer to the parent list.\n */\n FT_EXPORT( void )\n FT_List_Remove( FT_List list,\n FT_ListNode node );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Up\n *\n * @description:\n * Move a node to the head/top of a list. Used to maintain LRU lists.\n *\n * @inout:\n * list ::\n * A pointer to the parent list.\n * node ::\n * The node to move.\n */\n FT_EXPORT( void )\n FT_List_Up( FT_List list,\n FT_ListNode node );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_List_Iterator\n *\n * @description:\n * An FT_List iterator function that is called during a list parse by\n * @FT_List_Iterate.\n *\n * @input:\n * node ::\n * The current iteration list node.\n *\n * user ::\n * A typeless pointer passed to @FT_List_Iterate. Can be used to point\n * to the iteration's state.\n */\n typedef FT_Error\n (*FT_List_Iterator)( FT_ListNode node,\n void* user );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Iterate\n *\n * @description:\n * Parse a list and calls a given iterator function on each element.\n * Note that parsing is stopped as soon as one of the iterator calls\n * returns a non-zero value.\n *\n * @input:\n * list ::\n * A handle to the list.\n * iterator ::\n * An iterator function, called on each node of the list.\n * user ::\n * A user-supplied field that is passed as the second argument to the\n * iterator.\n *\n * @return:\n * The result (a FreeType error code) of the last iterator call.\n */\n FT_EXPORT( FT_Error )\n FT_List_Iterate( FT_List list,\n FT_List_Iterator iterator,\n void* user );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_List_Destructor\n *\n * @description:\n * An @FT_List iterator function that is called during a list\n * finalization by @FT_List_Finalize to destroy all elements in a given\n * list.\n *\n * @input:\n * system ::\n * The current system object.\n *\n * data ::\n * The current object to destroy.\n *\n * user ::\n * A typeless pointer passed to @FT_List_Iterate. It can be used to\n * point to the iteration's state.\n */\n typedef void\n (*FT_List_Destructor)( FT_Memory memory,\n void* data,\n void* user );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_List_Finalize\n *\n * @description:\n * Destroy all elements in the list as well as the list itself.\n *\n * @input:\n * list ::\n * A handle to the list.\n *\n * destroy ::\n * A list destructor that will be applied to each element of the list.\n * Set this to `NULL` if not needed.\n *\n * memory ::\n * The current memory object that handles deallocation.\n *\n * user ::\n * A user-supplied field that is passed as the last argument to the\n * destructor.\n *\n * @note:\n * This function expects that all nodes added by @FT_List_Add or\n * @FT_List_Insert have been dynamically allocated.\n */\n FT_EXPORT( void )\n FT_List_Finalize( FT_List list,\n FT_List_Destructor destroy,\n FT_Memory memory,\n void* user );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTLIST_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftlzw.h", "language": "code", "loc": 86, "comment_density": 0.837, "code": "/****************************************************************************\n *\n * ftlzw.h\n *\n * LZW-compressed stream support.\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTLZW_H_\n#define FTLZW_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * lzw\n *\n * @title:\n * LZW Streams\n *\n * @abstract:\n * Using LZW-compressed font files.\n *\n * @description:\n * This section contains the declaration of LZW-specific functions.\n *\n */\n\n /**************************************************************************\n *\n * @function:\n * FT_Stream_OpenLZW\n *\n * @description:\n * Open a new stream to parse LZW-compressed font files. This is mainly\n * used to support the compressed `*.pcf.Z` fonts that come with XFree86.\n *\n * @input:\n * stream ::\n * The target embedding stream.\n *\n * source ::\n * The source stream.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source stream must be opened _before_ calling this function.\n *\n * Calling the internal function `FT_Stream_Close` on the new stream will\n * **not** call `FT_Stream_Close` on the source stream. None of the\n * stream objects will be released to the heap.\n *\n * The stream implementation is very basic and resets the decompression\n * process each time seeking backwards is needed within the stream\n *\n * In certain builds of the library, LZW compression recognition is\n * automatically handled when calling @FT_New_Face or @FT_Open_Face.\n * This means that if no font driver is capable of handling the raw\n * compressed file, the library will try to open a LZW stream from it and\n * re-open the face with it.\n *\n * This function may return `FT_Err_Unimplemented_Feature` if your build\n * of FreeType was not compiled with LZW support.\n */\n FT_EXPORT( FT_Error )\n FT_Stream_OpenLZW( FT_Stream stream,\n FT_Stream source );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTLZW_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftmac.h", "language": "code", "loc": 259, "comment_density": 0.815, "code": "/****************************************************************************\n *\n * ftmac.h\n *\n * Additional Mac-specific API.\n *\n * Copyright (C) 1996-2020 by\n * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n/****************************************************************************\n *\n * NOTE: Include this file after `FT_FREETYPE_H` and after any\n * Mac-specific headers (because this header uses Mac types such as\n * 'Handle', 'FSSpec', 'FSRef', etc.)\n *\n */\n\n\n#ifndef FTMAC_H_\n#define FTMAC_H_\n\n\n#include \n\n\nFT_BEGIN_HEADER\n\n\n /* gcc-3.1 and later can warn about functions tagged as deprecated */\n#ifndef FT_DEPRECATED_ATTRIBUTE\n#if defined( __GNUC__ ) && \\\n ( ( __GNUC__ >= 4 ) || \\\n ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) )\n#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated ))\n#else\n#define FT_DEPRECATED_ATTRIBUTE\n#endif\n#endif\n\n\n /**************************************************************************\n *\n * @section:\n * mac_specific\n *\n * @title:\n * Mac Specific Interface\n *\n * @abstract:\n * Only available on the Macintosh.\n *\n * @description:\n * The following definitions are only available if FreeType is compiled\n * on a Macintosh.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Face_From_FOND\n *\n * @description:\n * Create a new face object from a FOND resource.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * fond ::\n * A FOND resource.\n *\n * face_index ::\n * Only supported for the -1 'sanity check' special case.\n *\n * @output:\n * aface ::\n * A handle to a new face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @example:\n * This function can be used to create @FT_Face objects from fonts that\n * are installed in the system as follows.\n *\n * ```\n * fond = GetResource( 'FOND', fontName );\n * error = FT_New_Face_From_FOND( library, fond, 0, &face );\n * ```\n */\n FT_EXPORT( FT_Error )\n FT_New_Face_From_FOND( FT_Library library,\n Handle fond,\n FT_Long face_index,\n FT_Face *aface )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_GetFile_From_Mac_Name\n *\n * @description:\n * Return an FSSpec for the disk file containing the named font.\n *\n * @input:\n * fontName ::\n * Mac OS name of the font (e.g., Times New Roman Bold).\n *\n * @output:\n * pathSpec ::\n * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec.\n *\n * face_index ::\n * Index of the face. For passing to @FT_New_Face_From_FSSpec.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_GetFile_From_Mac_Name( const char* fontName,\n FSSpec* pathSpec,\n FT_Long* face_index )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_GetFile_From_Mac_ATS_Name\n *\n * @description:\n * Return an FSSpec for the disk file containing the named font.\n *\n * @input:\n * fontName ::\n * Mac OS name of the font in ATS framework.\n *\n * @output:\n * pathSpec ::\n * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec.\n *\n * face_index ::\n * Index of the face. For passing to @FT_New_Face_From_FSSpec.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_GetFile_From_Mac_ATS_Name( const char* fontName,\n FSSpec* pathSpec,\n FT_Long* face_index )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_GetFilePath_From_Mac_ATS_Name\n *\n * @description:\n * Return a pathname of the disk file and face index for given font name\n * that is handled by ATS framework.\n *\n * @input:\n * fontName ::\n * Mac OS name of the font in ATS framework.\n *\n * @output:\n * path ::\n * Buffer to store pathname of the file. For passing to @FT_New_Face.\n * The client must allocate this buffer before calling this function.\n *\n * maxPathSize ::\n * Lengths of the buffer `path` that client allocated.\n *\n * face_index ::\n * Index of the face. For passing to @FT_New_Face.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_GetFilePath_From_Mac_ATS_Name( const char* fontName,\n UInt8* path,\n UInt32 maxPathSize,\n FT_Long* face_index )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Face_From_FSSpec\n *\n * @description:\n * Create a new face object from a given resource and typeface index\n * using an FSSpec to the font file.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * spec ::\n * FSSpec to the font file.\n *\n * face_index ::\n * The index of the face within the resource. The first face has\n * index~0.\n * @output:\n * aface ::\n * A handle to a new face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * @FT_New_Face_From_FSSpec is identical to @FT_New_Face except it\n * accepts an FSSpec instead of a path.\n */\n FT_EXPORT( FT_Error )\n FT_New_Face_From_FSSpec( FT_Library library,\n const FSSpec *spec,\n FT_Long face_index,\n FT_Face *aface )\n FT_DEPRECATED_ATTRIBUTE;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Face_From_FSRef\n *\n * @description:\n * Create a new face object from a given resource and typeface index\n * using an FSRef to the font file.\n *\n * @inout:\n * library ::\n * A handle to the library resource.\n *\n * @input:\n * spec ::\n * FSRef to the font file.\n *\n * face_index ::\n * The index of the face within the resource. The first face has\n * index~0.\n * @output:\n * aface ::\n * A handle to a new face object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * @FT_New_Face_From_FSRef is identical to @FT_New_Face except it accepts\n * an FSRef instead of a path.\n */\n FT_EXPORT( FT_Error )\n FT_New_Face_From_FSRef( FT_Library library,\n const FSRef *ref,\n FT_Long face_index,\n FT_Face *aface )\n FT_DEPRECATED_ATTRIBUTE;\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* FTMAC_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftmm.h", "language": "code", "loc": 692, "comment_density": 0.866, "code": "/****************************************************************************\n *\n * ftmm.h\n *\n * FreeType Multiple Master font interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTMM_H_\n#define FTMM_H_\n\n\n#include \n#include FT_TYPE1_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * multiple_masters\n *\n * @title:\n * Multiple Masters\n *\n * @abstract:\n * How to manage Multiple Masters fonts.\n *\n * @description:\n * The following types and functions are used to manage Multiple Master\n * fonts, i.e., the selection of specific design instances by setting\n * design axis coordinates.\n *\n * Besides Adobe MM fonts, the interface supports Apple's TrueType GX and\n * OpenType variation fonts. Some of the routines only work with Adobe\n * MM fonts, others will work with all three types. They are similar\n * enough that a consistent interface makes sense.\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_MM_Axis\n *\n * @description:\n * A structure to model a given axis in design space for Multiple Masters\n * fonts.\n *\n * This structure can't be used for TrueType GX or OpenType variation\n * fonts.\n *\n * @fields:\n * name ::\n * The axis's name.\n *\n * minimum ::\n * The axis's minimum design coordinate.\n *\n * maximum ::\n * The axis's maximum design coordinate.\n */\n typedef struct FT_MM_Axis_\n {\n FT_String* name;\n FT_Long minimum;\n FT_Long maximum;\n\n } FT_MM_Axis;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Multi_Master\n *\n * @description:\n * A structure to model the axes and space of a Multiple Masters font.\n *\n * This structure can't be used for TrueType GX or OpenType variation\n * fonts.\n *\n * @fields:\n * num_axis ::\n * Number of axes. Cannot exceed~4.\n *\n * num_designs ::\n * Number of designs; should be normally 2^num_axis even though the\n * Type~1 specification strangely allows for intermediate designs to be\n * present. This number cannot exceed~16.\n *\n * axis ::\n * A table of axis descriptors.\n */\n typedef struct FT_Multi_Master_\n {\n FT_UInt num_axis;\n FT_UInt num_designs;\n FT_MM_Axis axis[T1_MAX_MM_AXIS];\n\n } FT_Multi_Master;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Var_Axis\n *\n * @description:\n * A structure to model a given axis in design space for Multiple\n * Masters, TrueType GX, and OpenType variation fonts.\n *\n * @fields:\n * name ::\n * The axis's name. Not always meaningful for TrueType GX or OpenType\n * variation fonts.\n *\n * minimum ::\n * The axis's minimum design coordinate.\n *\n * def ::\n * The axis's default design coordinate. FreeType computes meaningful\n * default values for Adobe MM fonts.\n *\n * maximum ::\n * The axis's maximum design coordinate.\n *\n * tag ::\n * The axis's tag (the equivalent to 'name' for TrueType GX and\n * OpenType variation fonts). FreeType provides default values for\n * Adobe MM fonts if possible.\n *\n * strid ::\n * The axis name entry in the font's 'name' table. This is another\n * (and often better) version of the 'name' field for TrueType GX or\n * OpenType variation fonts. Not meaningful for Adobe MM fonts.\n *\n * @note:\n * The fields `minimum`, `def`, and `maximum` are 16.16 fractional values\n * for TrueType GX and OpenType variation fonts. For Adobe MM fonts, the\n * values are integers.\n */\n typedef struct FT_Var_Axis_\n {\n FT_String* name;\n\n FT_Fixed minimum;\n FT_Fixed def;\n FT_Fixed maximum;\n\n FT_ULong tag;\n FT_UInt strid;\n\n } FT_Var_Axis;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Var_Named_Style\n *\n * @description:\n * A structure to model a named instance in a TrueType GX or OpenType\n * variation font.\n *\n * This structure can't be used for Adobe MM fonts.\n *\n * @fields:\n * coords ::\n * The design coordinates for this instance. This is an array with one\n * entry for each axis.\n *\n * strid ::\n * The entry in 'name' table identifying this instance.\n *\n * psid ::\n * The entry in 'name' table identifying a PostScript name for this\n * instance. Value 0xFFFF indicates a missing entry.\n */\n typedef struct FT_Var_Named_Style_\n {\n FT_Fixed* coords;\n FT_UInt strid;\n FT_UInt psid; /* since 2.7.1 */\n\n } FT_Var_Named_Style;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_MM_Var\n *\n * @description:\n * A structure to model the axes and space of an Adobe MM, TrueType GX,\n * or OpenType variation font.\n *\n * Some fields are specific to one format and not to the others.\n *\n * @fields:\n * num_axis ::\n * The number of axes. The maximum value is~4 for Adobe MM fonts; no\n * limit in TrueType GX or OpenType variation fonts.\n *\n * num_designs ::\n * The number of designs; should be normally 2^num_axis for Adobe MM\n * fonts. Not meaningful for TrueType GX or OpenType variation fonts\n * (where every glyph could have a different number of designs).\n *\n * num_namedstyles ::\n * The number of named styles; a 'named style' is a tuple of design\n * coordinates that has a string ID (in the 'name' table) associated\n * with it. The font can tell the user that, for example,\n * [Weight=1.5,Width=1.1] is 'Bold'. Another name for 'named style' is\n * 'named instance'.\n *\n * For Adobe Multiple Masters fonts, this value is always zero because\n * the format does not support named styles.\n *\n * axis ::\n * An axis descriptor table. TrueType GX and OpenType variation fonts\n * contain slightly more data than Adobe MM fonts. Memory management\n * of this pointer is done internally by FreeType.\n *\n * namedstyle ::\n * A named style (instance) table. Only meaningful for TrueType GX and\n * OpenType variation fonts. Memory management of this pointer is done\n * internally by FreeType.\n */\n typedef struct FT_MM_Var_\n {\n FT_UInt num_axis;\n FT_UInt num_designs;\n FT_UInt num_namedstyles;\n FT_Var_Axis* axis;\n FT_Var_Named_Style* namedstyle;\n\n } FT_MM_Var;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Multi_Master\n *\n * @description:\n * Retrieve a variation descriptor of a given Adobe MM font.\n *\n * This function can't be used with TrueType GX or OpenType variation\n * fonts.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * @output:\n * amaster ::\n * The Multiple Masters descriptor.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Multi_Master( FT_Face face,\n FT_Multi_Master *amaster );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_MM_Var\n *\n * @description:\n * Retrieve a variation descriptor for a given font.\n *\n * This function works with all supported variation formats.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * @output:\n * amaster ::\n * The variation descriptor. Allocates a data structure, which the\n * user must deallocate with a call to @FT_Done_MM_Var after use.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Get_MM_Var( FT_Face face,\n FT_MM_Var* *amaster );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_MM_Var\n *\n * @description:\n * Free the memory allocated by @FT_Get_MM_Var.\n *\n * @input:\n * library ::\n * A handle of the face's parent library object that was used in the\n * call to @FT_Get_MM_Var to create `amaster`.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Done_MM_Var( FT_Library library,\n FT_MM_Var *amaster );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_MM_Design_Coordinates\n *\n * @description:\n * For Adobe MM fonts, choose an interpolated font design through design\n * coordinates.\n *\n * This function can't be used with TrueType GX or OpenType variation\n * fonts.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * @input:\n * num_coords ::\n * The number of available design coordinates. If it is larger than\n * the number of axes, ignore the excess values. If it is smaller than\n * the number of axes, use default values for the remaining axes.\n *\n * coords ::\n * An array of design coordinates.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * [Since 2.8.1] To reset all axes to the default values, call the\n * function with `num_coords` set to zero and `coords` set to `NULL`.\n *\n * [Since 2.9] If `num_coords` is larger than zero, this function sets\n * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field\n * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero,\n * this bit flag gets unset.\n */\n FT_EXPORT( FT_Error )\n FT_Set_MM_Design_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Long* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Var_Design_Coordinates\n *\n * @description:\n * Choose an interpolated font design through design coordinates.\n *\n * This function works with all supported variation formats.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * @input:\n * num_coords ::\n * The number of available design coordinates. If it is larger than\n * the number of axes, ignore the excess values. If it is smaller than\n * the number of axes, use default values for the remaining axes.\n *\n * coords ::\n * An array of design coordinates.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * [Since 2.8.1] To reset all axes to the default values, call the\n * function with `num_coords` set to zero and `coords` set to `NULL`.\n * [Since 2.9] 'Default values' means the currently selected named\n * instance (or the base font if no named instance is selected).\n *\n * [Since 2.9] If `num_coords` is larger than zero, this function sets\n * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field\n * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero,\n * this bit flag gets unset.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Var_Design_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Var_Design_Coordinates\n *\n * @description:\n * Get the design coordinates of the currently selected interpolated\n * font.\n *\n * This function works with all supported variation formats.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * num_coords ::\n * The number of design coordinates to retrieve. If it is larger than\n * the number of axes, set the excess values to~0.\n *\n * @output:\n * coords ::\n * The design coordinates array.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.7.1\n */\n FT_EXPORT( FT_Error )\n FT_Get_Var_Design_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_MM_Blend_Coordinates\n *\n * @description:\n * Choose an interpolated font design through normalized blend\n * coordinates.\n *\n * This function works with all supported variation formats.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * @input:\n * num_coords ::\n * The number of available design coordinates. If it is larger than\n * the number of axes, ignore the excess values. If it is smaller than\n * the number of axes, use default values for the remaining axes.\n *\n * coords ::\n * The design coordinates array (each element must be between 0 and 1.0\n * for Adobe MM fonts, and between -1.0 and 1.0 for TrueType GX and\n * OpenType variation fonts).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * [Since 2.8.1] To reset all axes to the default values, call the\n * function with `num_coords` set to zero and `coords` set to `NULL`.\n * [Since 2.9] 'Default values' means the currently selected named\n * instance (or the base font if no named instance is selected).\n *\n * [Since 2.9] If `num_coords` is larger than zero, this function sets\n * the @FT_FACE_FLAG_VARIATION bit in @FT_Face's `face_flags` field\n * (i.e., @FT_IS_VARIATION will return true). If `num_coords` is zero,\n * this bit flag gets unset.\n */\n FT_EXPORT( FT_Error )\n FT_Set_MM_Blend_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_MM_Blend_Coordinates\n *\n * @description:\n * Get the normalized blend coordinates of the currently selected\n * interpolated font.\n *\n * This function works with all supported variation formats.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * num_coords ::\n * The number of normalized blend coordinates to retrieve. If it is\n * larger than the number of axes, set the excess values to~0.5 for\n * Adobe MM fonts, and to~0 for TrueType GX and OpenType variation\n * fonts.\n *\n * @output:\n * coords ::\n * The normalized blend coordinates array.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.7.1\n */\n FT_EXPORT( FT_Error )\n FT_Get_MM_Blend_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Var_Blend_Coordinates\n *\n * @description:\n * This is another name of @FT_Set_MM_Blend_Coordinates.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Var_Blend_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Var_Blend_Coordinates\n *\n * @description:\n * This is another name of @FT_Get_MM_Blend_Coordinates.\n *\n * @since:\n * 2.7.1\n */\n FT_EXPORT( FT_Error )\n FT_Get_Var_Blend_Coordinates( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_MM_WeightVector\n *\n * @description:\n * For Adobe MM fonts, choose an interpolated font design by directly\n * setting the weight vector.\n *\n * This function can't be used with TrueType GX or OpenType variation\n * fonts.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * @input:\n * len ::\n * The length of the weight vector array. If it is larger than the\n * number of designs, the extra values are ignored. If it is less than\n * the number of designs, the remaining values are set to zero.\n *\n * weightvector ::\n * An array representing the weight vector.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Adobe Multiple Master fonts limit the number of designs, and thus the\n * length of the weight vector to~16.\n *\n * If `len` is zero and `weightvector` is `NULL`, the weight vector array\n * is reset to the default values.\n *\n * The Adobe documentation also states that the values in the\n * WeightVector array must total 1.0 +/-~0.001. In practice this does\n * not seem to be enforced, so is not enforced here, either.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Set_MM_WeightVector( FT_Face face,\n FT_UInt len,\n FT_Fixed* weightvector );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_MM_WeightVector\n *\n * @description:\n * For Adobe MM fonts, retrieve the current weight vector of the font.\n *\n * This function can't be used with TrueType GX or OpenType variation\n * fonts.\n *\n * @inout:\n * face ::\n * A handle to the source face.\n *\n * len ::\n * A pointer to the size of the array to be filled. If the size of the\n * array is less than the number of designs, `FT_Err_Invalid_Argument`\n * is returned, and `len` is set to the required size (the number of\n * designs). If the size of the array is greater than the number of\n * designs, the remaining entries are set to~0. On successful\n * completion, `len` is set to the number of designs (i.e., the number\n * of values written to the array).\n *\n * @output:\n * weightvector ::\n * An array to be filled.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * Adobe Multiple Master fonts limit the number of designs, and thus the\n * length of the WeightVector to~16.\n *\n * @since:\n * 2.10\n */\n FT_EXPORT( FT_Error )\n FT_Get_MM_WeightVector( FT_Face face,\n FT_UInt* len,\n FT_Fixed* weightvector );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_VAR_AXIS_FLAG_XXX\n *\n * @description:\n * A list of bit flags used in the return value of\n * @FT_Get_Var_Axis_Flags.\n *\n * @values:\n * FT_VAR_AXIS_FLAG_HIDDEN ::\n * The variation axis should not be exposed to user interfaces.\n *\n * @since:\n * 2.8.1\n */\n#define FT_VAR_AXIS_FLAG_HIDDEN 1\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Var_Axis_Flags\n *\n * @description:\n * Get the 'flags' field of an OpenType Variation Axis Record.\n *\n * Not meaningful for Adobe MM fonts (`*flags` is always zero).\n *\n * @input:\n * master ::\n * The variation descriptor.\n *\n * axis_index ::\n * The index of the requested variation axis.\n *\n * @output:\n * flags ::\n * The 'flags' field. See @FT_VAR_AXIS_FLAG_XXX for possible values.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.8.1\n */\n FT_EXPORT( FT_Error )\n FT_Get_Var_Axis_Flags( FT_MM_Var* master,\n FT_UInt axis_index,\n FT_UInt* flags );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Named_Instance\n *\n * @description:\n * Set or change the current named instance.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * instance_index ::\n * The index of the requested instance, starting with value 1. If set\n * to value 0, FreeType switches to font access without a named\n * instance.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The function uses the value of `instance_index` to set bits 16-30 of\n * the face's `face_index` field. It also resets any variation applied\n * to the font, and the @FT_FACE_FLAG_VARIATION bit of the face's\n * `face_flags` field gets reset to zero (i.e., @FT_IS_VARIATION will\n * return false).\n *\n * For Adobe MM fonts (which don't have named instances) this function\n * simply resets the current face to the default instance.\n *\n * @since:\n * 2.9\n */\n FT_EXPORT( FT_Error )\n FT_Set_Named_Instance( FT_Face face,\n FT_UInt instance_index );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTMM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftmodapi.h", "language": "code", "loc": 717, "comment_density": 0.883, "code": "/****************************************************************************\n *\n * ftmodapi.h\n *\n * FreeType modules public interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTMODAPI_H_\n#define FTMODAPI_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * module_management\n *\n * @title:\n * Module Management\n *\n * @abstract:\n * How to add, upgrade, remove, and control modules from FreeType.\n *\n * @description:\n * The definitions below are used to manage modules within FreeType.\n * Modules can be added, upgraded, and removed at runtime. Additionally,\n * some module properties can be controlled also.\n *\n * Here is a list of possible values of the `module_name` field in the\n * @FT_Module_Class structure.\n *\n * ```\n * autofitter\n * bdf\n * cff\n * gxvalid\n * otvalid\n * pcf\n * pfr\n * psaux\n * pshinter\n * psnames\n * raster1\n * sfnt\n * smooth, smooth-lcd, smooth-lcdv\n * truetype\n * type1\n * type42\n * t1cid\n * winfonts\n * ```\n *\n * Note that the FreeType Cache sub-system is not a FreeType module.\n *\n * @order:\n * FT_Module\n * FT_Module_Constructor\n * FT_Module_Destructor\n * FT_Module_Requester\n * FT_Module_Class\n *\n * FT_Add_Module\n * FT_Get_Module\n * FT_Remove_Module\n * FT_Add_Default_Modules\n *\n * FT_Property_Set\n * FT_Property_Get\n * FT_Set_Default_Properties\n *\n * FT_New_Library\n * FT_Done_Library\n * FT_Reference_Library\n *\n * FT_Renderer\n * FT_Renderer_Class\n *\n * FT_Get_Renderer\n * FT_Set_Renderer\n *\n * FT_Set_Debug_Hook\n *\n */\n\n\n /* module bit flags */\n#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */\n#define FT_MODULE_RENDERER 2 /* this module is a renderer */\n#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */\n#define FT_MODULE_STYLER 8 /* this module is a styler */\n\n#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */\n /* scalable fonts */\n#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */\n /* support vector outlines */\n#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */\n /* own hinter */\n#define FT_MODULE_DRIVER_HINTS_LIGHTLY 0x800 /* the driver's hinter */\n /* produces LIGHT hints */\n\n\n /* deprecated values */\n#define ft_module_font_driver FT_MODULE_FONT_DRIVER\n#define ft_module_renderer FT_MODULE_RENDERER\n#define ft_module_hinter FT_MODULE_HINTER\n#define ft_module_styler FT_MODULE_STYLER\n\n#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE\n#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES\n#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER\n#define ft_module_driver_hints_lightly FT_MODULE_DRIVER_HINTS_LIGHTLY\n\n\n typedef FT_Pointer FT_Module_Interface;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Module_Constructor\n *\n * @description:\n * A function used to initialize (not create) a new module object.\n *\n * @input:\n * module ::\n * The module to initialize.\n */\n typedef FT_Error\n (*FT_Module_Constructor)( FT_Module module );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Module_Destructor\n *\n * @description:\n * A function used to finalize (not destroy) a given module object.\n *\n * @input:\n * module ::\n * The module to finalize.\n */\n typedef void\n (*FT_Module_Destructor)( FT_Module module );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Module_Requester\n *\n * @description:\n * A function used to query a given module for a specific interface.\n *\n * @input:\n * module ::\n * The module to be searched.\n *\n * name ::\n * The name of the interface in the module.\n */\n typedef FT_Module_Interface\n (*FT_Module_Requester)( FT_Module module,\n const char* name );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Module_Class\n *\n * @description:\n * The module class descriptor. While being a public structure necessary\n * for FreeType's module bookkeeping, most of the fields are essentially\n * internal, not to be used directly by an application.\n *\n * @fields:\n * module_flags ::\n * Bit flags describing the module.\n *\n * module_size ::\n * The size of one module object/instance in bytes.\n *\n * module_name ::\n * The name of the module.\n *\n * module_version ::\n * The version, as a 16.16 fixed number (major.minor).\n *\n * module_requires ::\n * The version of FreeType this module requires, as a 16.16 fixed\n * number (major.minor). Starts at version 2.0, i.e., 0x20000.\n *\n * module_interface ::\n * A typeless pointer to a structure (which varies between different\n * modules) that holds the module's interface functions. This is\n * essentially what `get_interface` returns.\n *\n * module_init ::\n * The initializing function.\n *\n * module_done ::\n * The finalizing function.\n *\n * get_interface ::\n * The interface requesting function.\n */\n typedef struct FT_Module_Class_\n {\n FT_ULong module_flags;\n FT_Long module_size;\n const FT_String* module_name;\n FT_Fixed module_version;\n FT_Fixed module_requires;\n\n const void* module_interface;\n\n FT_Module_Constructor module_init;\n FT_Module_Destructor module_done;\n FT_Module_Requester get_interface;\n\n } FT_Module_Class;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Add_Module\n *\n * @description:\n * Add a new module to a given library instance.\n *\n * @inout:\n * library ::\n * A handle to the library object.\n *\n * @input:\n * clazz ::\n * A pointer to class descriptor for the module.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * An error will be returned if a module already exists by that name, or\n * if the module requires a version of FreeType that is too great.\n */\n FT_EXPORT( FT_Error )\n FT_Add_Module( FT_Library library,\n const FT_Module_Class* clazz );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Module\n *\n * @description:\n * Find a module by its name.\n *\n * @input:\n * library ::\n * A handle to the library object.\n *\n * module_name ::\n * The module's name (as an ASCII string).\n *\n * @return:\n * A module handle. 0~if none was found.\n *\n * @note:\n * FreeType's internal modules aren't documented very well, and you\n * should look up the source code for details.\n */\n FT_EXPORT( FT_Module )\n FT_Get_Module( FT_Library library,\n const char* module_name );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Remove_Module\n *\n * @description:\n * Remove a given module from a library instance.\n *\n * @inout:\n * library ::\n * A handle to a library object.\n *\n * @input:\n * module ::\n * A handle to a module object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The module object is destroyed by the function in case of success.\n */\n FT_EXPORT( FT_Error )\n FT_Remove_Module( FT_Library library,\n FT_Module module );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Property_Set\n *\n * @description:\n * Set a property for a given module.\n *\n * @input:\n * library ::\n * A handle to the library the module is part of.\n *\n * module_name ::\n * The module name.\n *\n * property_name ::\n * The property name. Properties are described in section\n * @properties.\n *\n * Note that only a few modules have properties.\n *\n * value ::\n * A generic pointer to a variable or structure that gives the new\n * value of the property. The exact definition of `value` is\n * dependent on the property; see section @properties.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If `module_name` isn't a valid module name, or `property_name`\n * doesn't specify a valid property, or if `value` doesn't represent a\n * valid value for the given property, an error is returned.\n *\n * The following example sets property 'bar' (a simple integer) in\n * module 'foo' to value~1.\n *\n * ```\n * FT_UInt bar;\n *\n *\n * bar = 1;\n * FT_Property_Set( library, \"foo\", \"bar\", &bar );\n * ```\n *\n * Note that the FreeType Cache sub-system doesn't recognize module\n * property changes. To avoid glyph lookup confusion within the cache\n * you should call @FTC_Manager_Reset to completely flush the cache if a\n * module property gets changed after @FTC_Manager_New has been called.\n *\n * It is not possible to set properties of the FreeType Cache sub-system\n * itself with FT_Property_Set; use @FTC_Property_Set instead.\n *\n * @since:\n * 2.4.11\n *\n */\n FT_EXPORT( FT_Error )\n FT_Property_Set( FT_Library library,\n const FT_String* module_name,\n const FT_String* property_name,\n const void* value );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Property_Get\n *\n * @description:\n * Get a module's property value.\n *\n * @input:\n * library ::\n * A handle to the library the module is part of.\n *\n * module_name ::\n * The module name.\n *\n * property_name ::\n * The property name. Properties are described in section\n * @properties.\n *\n * @inout:\n * value ::\n * A generic pointer to a variable or structure that gives the value\n * of the property. The exact definition of `value` is dependent on\n * the property; see section @properties.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If `module_name` isn't a valid module name, or `property_name`\n * doesn't specify a valid property, or if `value` doesn't represent a\n * valid value for the given property, an error is returned.\n *\n * The following example gets property 'baz' (a range) in module 'foo'.\n *\n * ```\n * typedef range_\n * {\n * FT_Int32 min;\n * FT_Int32 max;\n *\n * } range;\n *\n * range baz;\n *\n *\n * FT_Property_Get( library, \"foo\", \"baz\", &baz );\n * ```\n *\n * It is not possible to retrieve properties of the FreeType Cache\n * sub-system with FT_Property_Get; use @FTC_Property_Get instead.\n *\n * @since:\n * 2.4.11\n *\n */\n FT_EXPORT( FT_Error )\n FT_Property_Get( FT_Library library,\n const FT_String* module_name,\n const FT_String* property_name,\n void* value );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Default_Properties\n *\n * @description:\n * If compilation option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES` is\n * set, this function reads the `FREETYPE_PROPERTIES` environment\n * variable to control driver properties. See section @properties for\n * more.\n *\n * If the compilation option is not set, this function does nothing.\n *\n * `FREETYPE_PROPERTIES` has the following syntax form (broken here into\n * multiple lines for better readability).\n *\n * ```\n * \n * ':'\n * '=' \n * \n * ':'\n * '=' \n * ...\n * ```\n *\n * Example:\n *\n * ```\n * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \\\n * cff:no-stem-darkening=1 \\\n * autofitter:warping=1\n * ```\n *\n * @inout:\n * library ::\n * A handle to a new library object.\n *\n * @since:\n * 2.8\n */\n FT_EXPORT( void )\n FT_Set_Default_Properties( FT_Library library );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Reference_Library\n *\n * @description:\n * A counter gets initialized to~1 at the time an @FT_Library structure\n * is created. This function increments the counter. @FT_Done_Library\n * then only destroys a library if the counter is~1, otherwise it simply\n * decrements the counter.\n *\n * This function helps in managing life-cycles of structures that\n * reference @FT_Library objects.\n *\n * @input:\n * library ::\n * A handle to a target library object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @since:\n * 2.4.2\n */\n FT_EXPORT( FT_Error )\n FT_Reference_Library( FT_Library library );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Library\n *\n * @description:\n * This function is used to create a new FreeType library instance from a\n * given memory object. It is thus possible to use libraries with\n * distinct memory allocators within the same program. Note, however,\n * that the used @FT_Memory structure is expected to remain valid for the\n * life of the @FT_Library object.\n *\n * Normally, you would call this function (followed by a call to\n * @FT_Add_Default_Modules or a series of calls to @FT_Add_Module, and a\n * call to @FT_Set_Default_Properties) instead of @FT_Init_FreeType to\n * initialize the FreeType library.\n *\n * Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a library\n * instance.\n *\n * @input:\n * memory ::\n * A handle to the original memory object.\n *\n * @output:\n * alibrary ::\n * A pointer to handle of a new library object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * See the discussion of reference counters in the description of\n * @FT_Reference_Library.\n */\n FT_EXPORT( FT_Error )\n FT_New_Library( FT_Memory memory,\n FT_Library *alibrary );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Library\n *\n * @description:\n * Discard a given library object. This closes all drivers and discards\n * all resource objects.\n *\n * @input:\n * library ::\n * A handle to the target library.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * See the discussion of reference counters in the description of\n * @FT_Reference_Library.\n */\n FT_EXPORT( FT_Error )\n FT_Done_Library( FT_Library library );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_DebugHook_Func\n *\n * @description:\n * A drop-in replacement (or rather a wrapper) for the bytecode or\n * charstring interpreter's main loop function.\n *\n * Its job is essentially\n *\n * - to activate debug mode to enforce single-stepping,\n *\n * - to call the main loop function to interpret the next opcode, and\n *\n * - to show the changed context to the user.\n *\n * An example for such a main loop function is `TT_RunIns` (declared in\n * FreeType's internal header file `src/truetype/ttinterp.h`).\n *\n * Have a look at the source code of the `ttdebug` FreeType demo program\n * for an example of a drop-in replacement.\n *\n * @inout:\n * arg ::\n * A typeless pointer, to be cast to the main loop function's data\n * structure (which depends on the font module). For TrueType fonts\n * it is bytecode interpreter's execution context, `TT_ExecContext`,\n * which is declared in FreeType's internal header file `tttypes.h`.\n */\n typedef FT_Error\n (*FT_DebugHook_Func)( void* arg );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_DEBUG_HOOK_XXX\n *\n * @description:\n * A list of named debug hook indices.\n *\n * @values:\n * FT_DEBUG_HOOK_TRUETYPE::\n * This hook index identifies the TrueType bytecode debugger.\n */\n#define FT_DEBUG_HOOK_TRUETYPE 0\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Debug_Hook\n *\n * @description:\n * Set a debug hook function for debugging the interpreter of a font\n * format.\n *\n * While this is a public API function, an application needs access to\n * FreeType's internal header files to do something useful.\n *\n * Have a look at the source code of the `ttdebug` FreeType demo program\n * for an example of its usage.\n *\n * @inout:\n * library ::\n * A handle to the library object.\n *\n * @input:\n * hook_index ::\n * The index of the debug hook. You should use defined enumeration\n * macros like @FT_DEBUG_HOOK_TRUETYPE.\n *\n * debug_hook ::\n * The function used to debug the interpreter.\n *\n * @note:\n * Currently, four debug hook slots are available, but only one (for the\n * TrueType interpreter) is defined.\n */\n FT_EXPORT( void )\n FT_Set_Debug_Hook( FT_Library library,\n FT_UInt hook_index,\n FT_DebugHook_Func debug_hook );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Add_Default_Modules\n *\n * @description:\n * Add the set of default drivers to a given library object. This is\n * only useful when you create a library object with @FT_New_Library\n * (usually to plug a custom memory manager).\n *\n * @inout:\n * library ::\n * A handle to a new library object.\n */\n FT_EXPORT( void )\n FT_Add_Default_Modules( FT_Library library );\n\n\n\n /**************************************************************************\n *\n * @section:\n * truetype_engine\n *\n * @title:\n * The TrueType Engine\n *\n * @abstract:\n * TrueType bytecode support.\n *\n * @description:\n * This section contains a function used to query the level of TrueType\n * bytecode support compiled in this version of the library.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_TrueTypeEngineType\n *\n * @description:\n * A list of values describing which kind of TrueType bytecode engine is\n * implemented in a given FT_Library instance. It is used by the\n * @FT_Get_TrueType_Engine_Type function.\n *\n * @values:\n * FT_TRUETYPE_ENGINE_TYPE_NONE ::\n * The library doesn't implement any kind of bytecode interpreter.\n *\n * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::\n * Deprecated and removed.\n *\n * FT_TRUETYPE_ENGINE_TYPE_PATENTED ::\n * The library implements a bytecode interpreter that covers the full\n * instruction set of the TrueType virtual machine (this was governed\n * by patents until May 2010, hence the name).\n *\n * @since:\n * 2.2\n *\n */\n typedef enum FT_TrueTypeEngineType_\n {\n FT_TRUETYPE_ENGINE_TYPE_NONE = 0,\n FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,\n FT_TRUETYPE_ENGINE_TYPE_PATENTED\n\n } FT_TrueTypeEngineType;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_TrueType_Engine_Type\n *\n * @description:\n * Return an @FT_TrueTypeEngineType value to indicate which level of the\n * TrueType virtual machine a given library instance supports.\n *\n * @input:\n * library ::\n * A library instance.\n *\n * @return:\n * A value indicating which level is supported.\n *\n * @since:\n * 2.2\n *\n */\n FT_EXPORT( FT_TrueTypeEngineType )\n FT_Get_TrueType_Engine_Type( FT_Library library );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTMODAPI_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftmoderr.h", "language": "code", "loc": 173, "comment_density": 0.705, "code": "/****************************************************************************\n *\n * ftmoderr.h\n *\n * FreeType module error offsets (specification).\n *\n * Copyright (C) 2001-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file is used to define the FreeType module error codes.\n *\n * If the macro `FT_CONFIG_OPTION_USE_MODULE_ERRORS` in `ftoption.h` is\n * set, the lower byte of an error value identifies the error code as\n * usual. In addition, the higher byte identifies the module. For\n * example, the error `FT_Err_Invalid_File_Format` has value 0x0003, the\n * error `TT_Err_Invalid_File_Format` has value 0x1303, the error\n * `T1_Err_Invalid_File_Format` has value 0x1403, etc.\n *\n * Note that `FT_Err_Ok`, `TT_Err_Ok`, etc. are always equal to zero,\n * including the high byte.\n *\n * If `FT_CONFIG_OPTION_USE_MODULE_ERRORS` isn't set, the higher byte of an\n * error value is set to zero.\n *\n * To hide the various `XXX_Err_` prefixes in the source code, FreeType\n * provides some macros in `fttypes.h`.\n *\n * FT_ERR( err )\n *\n * Add current error module prefix (as defined with the `FT_ERR_PREFIX`\n * macro) to `err`. For example, in the BDF module the line\n *\n * ```\n * error = FT_ERR( Invalid_Outline );\n * ```\n *\n * expands to\n *\n * ```\n * error = BDF_Err_Invalid_Outline;\n * ```\n *\n * For simplicity, you can always use `FT_Err_Ok` directly instead of\n * `FT_ERR( Ok )`.\n *\n * FT_ERR_EQ( errcode, err )\n * FT_ERR_NEQ( errcode, err )\n *\n * Compare error code `errcode` with the error `err` for equality and\n * inequality, respectively. Example:\n *\n * ```\n * if ( FT_ERR_EQ( error, Invalid_Outline ) )\n * ...\n * ```\n *\n * Using this macro you don't have to think about error prefixes. Of\n * course, if module errors are not active, the above example is the\n * same as\n *\n * ```\n * if ( error == FT_Err_Invalid_Outline )\n * ...\n * ```\n *\n * FT_ERROR_BASE( errcode )\n * FT_ERROR_MODULE( errcode )\n *\n * Get base error and module error code, respectively.\n *\n * It can also be used to create a module error message table easily with\n * something like\n *\n * ```\n * #undef FTMODERR_H_\n * #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s },\n * #define FT_MODERR_START_LIST {\n * #define FT_MODERR_END_LIST { 0, 0 } };\n *\n * const struct\n * {\n * int mod_err_offset;\n * const char* mod_err_msg\n * } ft_mod_errors[] =\n *\n * #include FT_MODULE_ERRORS_H\n * ```\n *\n */\n\n\n#ifndef FTMODERR_H_\n#define FTMODERR_H_\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** SETUP MACROS *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n\n#undef FT_NEED_EXTERN_C\n\n#ifndef FT_MODERRDEF\n\n#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS\n#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,\n#else\n#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,\n#endif\n\n#define FT_MODERR_START_LIST enum {\n#define FT_MODERR_END_LIST FT_Mod_Err_Max };\n\n#ifdef __cplusplus\n#define FT_NEED_EXTERN_C\n extern \"C\" {\n#endif\n\n#endif /* !FT_MODERRDEF */\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** LIST MODULE ERROR BASES *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n\n#ifdef FT_MODERR_START_LIST\n FT_MODERR_START_LIST\n#endif\n\n\n FT_MODERRDEF( Base, 0x000, \"base module\" )\n FT_MODERRDEF( Autofit, 0x100, \"autofitter module\" )\n FT_MODERRDEF( BDF, 0x200, \"BDF module\" )\n FT_MODERRDEF( Bzip2, 0x300, \"Bzip2 module\" )\n FT_MODERRDEF( Cache, 0x400, \"cache module\" )\n FT_MODERRDEF( CFF, 0x500, \"CFF module\" )\n FT_MODERRDEF( CID, 0x600, \"CID module\" )\n FT_MODERRDEF( Gzip, 0x700, \"Gzip module\" )\n FT_MODERRDEF( LZW, 0x800, \"LZW module\" )\n FT_MODERRDEF( OTvalid, 0x900, \"OpenType validation module\" )\n FT_MODERRDEF( PCF, 0xA00, \"PCF module\" )\n FT_MODERRDEF( PFR, 0xB00, \"PFR module\" )\n FT_MODERRDEF( PSaux, 0xC00, \"PS auxiliary module\" )\n FT_MODERRDEF( PShinter, 0xD00, \"PS hinter module\" )\n FT_MODERRDEF( PSnames, 0xE00, \"PS names module\" )\n FT_MODERRDEF( Raster, 0xF00, \"raster module\" )\n FT_MODERRDEF( SFNT, 0x1000, \"SFNT module\" )\n FT_MODERRDEF( Smooth, 0x1100, \"smooth raster module\" )\n FT_MODERRDEF( TrueType, 0x1200, \"TrueType module\" )\n FT_MODERRDEF( Type1, 0x1300, \"Type 1 module\" )\n FT_MODERRDEF( Type42, 0x1400, \"Type 42 module\" )\n FT_MODERRDEF( Winfonts, 0x1500, \"Windows FON/FNT module\" )\n FT_MODERRDEF( GXvalid, 0x1600, \"GX validation module\" )\n\n\n#ifdef FT_MODERR_END_LIST\n FT_MODERR_END_LIST\n#endif\n\n\n /*******************************************************************/\n /*******************************************************************/\n /***** *****/\n /***** CLEANUP *****/\n /***** *****/\n /*******************************************************************/\n /*******************************************************************/\n\n\n#ifdef FT_NEED_EXTERN_C\n }\n#endif\n\n#undef FT_MODERR_START_LIST\n#undef FT_MODERR_END_LIST\n#undef FT_MODERRDEF\n#undef FT_NEED_EXTERN_C\n\n\n#endif /* FTMODERR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftotval.h", "language": "code", "loc": 183, "comment_density": 0.814, "code": "/****************************************************************************\n *\n * ftotval.h\n *\n * FreeType API for validating OpenType tables (specification).\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n/****************************************************************************\n *\n *\n * Warning: This module might be moved to a different library in the\n * future to avoid a tight dependency between FreeType and the\n * OpenType specification.\n *\n *\n */\n\n\n#ifndef FTOTVAL_H_\n#define FTOTVAL_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * ot_validation\n *\n * @title:\n * OpenType Validation\n *\n * @abstract:\n * An API to validate OpenType tables.\n *\n * @description:\n * This section contains the declaration of functions to validate some\n * OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).\n *\n * @order:\n * FT_OpenType_Validate\n * FT_OpenType_Free\n *\n * FT_VALIDATE_OTXXX\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_VALIDATE_OTXXX\n *\n * @description:\n * A list of bit-field constants used with @FT_OpenType_Validate to\n * indicate which OpenType tables should be validated.\n *\n * @values:\n * FT_VALIDATE_BASE ::\n * Validate BASE table.\n *\n * FT_VALIDATE_GDEF ::\n * Validate GDEF table.\n *\n * FT_VALIDATE_GPOS ::\n * Validate GPOS table.\n *\n * FT_VALIDATE_GSUB ::\n * Validate GSUB table.\n *\n * FT_VALIDATE_JSTF ::\n * Validate JSTF table.\n *\n * FT_VALIDATE_MATH ::\n * Validate MATH table.\n *\n * FT_VALIDATE_OT ::\n * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF, MATH).\n *\n */\n#define FT_VALIDATE_BASE 0x0100\n#define FT_VALIDATE_GDEF 0x0200\n#define FT_VALIDATE_GPOS 0x0400\n#define FT_VALIDATE_GSUB 0x0800\n#define FT_VALIDATE_JSTF 0x1000\n#define FT_VALIDATE_MATH 0x2000\n\n#define FT_VALIDATE_OT ( FT_VALIDATE_BASE | \\\n FT_VALIDATE_GDEF | \\\n FT_VALIDATE_GPOS | \\\n FT_VALIDATE_GSUB | \\\n FT_VALIDATE_JSTF | \\\n FT_VALIDATE_MATH )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_OpenType_Validate\n *\n * @description:\n * Validate various OpenType tables to assure that all offsets and\n * indices are valid. The idea is that a higher-level library that\n * actually does the text layout can access those tables without error\n * checking (which can be quite time consuming).\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * validation_flags ::\n * A bit field that specifies the tables to be validated. See\n * @FT_VALIDATE_OTXXX for possible values.\n *\n * @output:\n * BASE_table ::\n * A pointer to the BASE table.\n *\n * GDEF_table ::\n * A pointer to the GDEF table.\n *\n * GPOS_table ::\n * A pointer to the GPOS table.\n *\n * GSUB_table ::\n * A pointer to the GSUB table.\n *\n * JSTF_table ::\n * A pointer to the JSTF table.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with OpenType fonts, returning an error\n * otherwise.\n *\n * After use, the application should deallocate the five tables with\n * @FT_OpenType_Free. A `NULL` value indicates that the table either\n * doesn't exist in the font, or the application hasn't asked for\n * validation.\n */\n FT_EXPORT( FT_Error )\n FT_OpenType_Validate( FT_Face face,\n FT_UInt validation_flags,\n FT_Bytes *BASE_table,\n FT_Bytes *GDEF_table,\n FT_Bytes *GPOS_table,\n FT_Bytes *GSUB_table,\n FT_Bytes *JSTF_table );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_OpenType_Free\n *\n * @description:\n * Free the buffer allocated by OpenType validator.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * table ::\n * The pointer to the buffer that is allocated by\n * @FT_OpenType_Validate.\n *\n * @note:\n * This function must be used to free the buffer allocated by\n * @FT_OpenType_Validate only.\n */\n FT_EXPORT( void )\n FT_OpenType_Free( FT_Face face,\n FT_Bytes table );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTOTVAL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftoutln.h", "language": "code", "loc": 544, "comment_density": 0.881, "code": "/****************************************************************************\n *\n * ftoutln.h\n *\n * Support for the FT_Outline type used to store glyph shapes of\n * most scalable font formats (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTOUTLN_H_\n#define FTOUTLN_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * outline_processing\n *\n * @title:\n * Outline Processing\n *\n * @abstract:\n * Functions to create, transform, and render vectorial glyph images.\n *\n * @description:\n * This section contains routines used to create and destroy scalable\n * glyph images known as 'outlines'. These can also be measured,\n * transformed, and converted into bitmaps and pixmaps.\n *\n * @order:\n * FT_Outline\n * FT_Outline_New\n * FT_Outline_Done\n * FT_Outline_Copy\n * FT_Outline_Translate\n * FT_Outline_Transform\n * FT_Outline_Embolden\n * FT_Outline_EmboldenXY\n * FT_Outline_Reverse\n * FT_Outline_Check\n *\n * FT_Outline_Get_CBox\n * FT_Outline_Get_BBox\n *\n * FT_Outline_Get_Bitmap\n * FT_Outline_Render\n * FT_Outline_Decompose\n * FT_Outline_Funcs\n * FT_Outline_MoveToFunc\n * FT_Outline_LineToFunc\n * FT_Outline_ConicToFunc\n * FT_Outline_CubicToFunc\n *\n * FT_Orientation\n * FT_Outline_Get_Orientation\n *\n * FT_OUTLINE_XXX\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Decompose\n *\n * @description:\n * Walk over an outline's structure to decompose it into individual\n * segments and Bezier arcs. This function also emits 'move to'\n * operations to indicate the start of new contours in the outline.\n *\n * @input:\n * outline ::\n * A pointer to the source target.\n *\n * func_interface ::\n * A table of 'emitters', i.e., function pointers called during\n * decomposition to indicate path operations.\n *\n * @inout:\n * user ::\n * A typeless pointer that is passed to each emitter during the\n * decomposition. It can be used to store the state during the\n * decomposition.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * A contour that contains a single point only is represented by a 'move\n * to' operation followed by 'line to' to the same point. In most cases,\n * it is best to filter this out before using the outline for stroking\n * purposes (otherwise it would result in a visible dot when round caps\n * are used).\n *\n * Similarly, the function returns success for an empty outline also\n * (doing nothing, this is, not calling any emitter); if necessary, you\n * should filter this out, too.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Decompose( FT_Outline* outline,\n const FT_Outline_Funcs* func_interface,\n void* user );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_New\n *\n * @description:\n * Create a new outline of a given size.\n *\n * @input:\n * library ::\n * A handle to the library object from where the outline is allocated.\n * Note however that the new outline will **not** necessarily be\n * **freed**, when destroying the library, by @FT_Done_FreeType.\n *\n * numPoints ::\n * The maximum number of points within the outline. Must be smaller\n * than or equal to 0xFFFF (65535).\n *\n * numContours ::\n * The maximum number of contours within the outline. This value must\n * be in the range 0 to `numPoints`.\n *\n * @output:\n * anoutline ::\n * A handle to the new outline.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The reason why this function takes a `library` parameter is simply to\n * use the library's memory allocator.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_New( FT_Library library,\n FT_UInt numPoints,\n FT_Int numContours,\n FT_Outline *anoutline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Done\n *\n * @description:\n * Destroy an outline created with @FT_Outline_New.\n *\n * @input:\n * library ::\n * A handle of the library object used to allocate the outline.\n *\n * outline ::\n * A pointer to the outline object to be discarded.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If the outline's 'owner' field is not set, only the outline descriptor\n * will be released.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Done( FT_Library library,\n FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Check\n *\n * @description:\n * Check the contents of an outline descriptor.\n *\n * @input:\n * outline ::\n * A handle to a source outline.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * An empty outline, or an outline with a single point only is also\n * valid.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Check( FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Get_CBox\n *\n * @description:\n * Return an outline's 'control box'. The control box encloses all the\n * outline's points, including Bezier control points. Though it\n * coincides with the exact bounding box for most glyphs, it can be\n * slightly larger in some situations (like when rotating an outline that\n * contains Bezier outside arcs).\n *\n * Computing the control box is very fast, while getting the bounding box\n * can take much more time as it needs to walk over all segments and arcs\n * in the outline. To get the latter, you can use the 'ftbbox'\n * component, which is dedicated to this single task.\n *\n * @input:\n * outline ::\n * A pointer to the source outline descriptor.\n *\n * @output:\n * acbox ::\n * The outline's control box.\n *\n * @note:\n * See @FT_Glyph_Get_CBox for a discussion of tricky fonts.\n */\n FT_EXPORT( void )\n FT_Outline_Get_CBox( const FT_Outline* outline,\n FT_BBox *acbox );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Translate\n *\n * @description:\n * Apply a simple translation to the points of an outline.\n *\n * @inout:\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * @input:\n * xOffset ::\n * The horizontal offset.\n *\n * yOffset ::\n * The vertical offset.\n */\n FT_EXPORT( void )\n FT_Outline_Translate( const FT_Outline* outline,\n FT_Pos xOffset,\n FT_Pos yOffset );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Copy\n *\n * @description:\n * Copy an outline into another one. Both objects must have the same\n * sizes (number of points & number of contours) when this function is\n * called.\n *\n * @input:\n * source ::\n * A handle to the source outline.\n *\n * @output:\n * target ::\n * A handle to the target outline.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Copy( const FT_Outline* source,\n FT_Outline *target );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Transform\n *\n * @description:\n * Apply a simple 2x2 matrix to all of an outline's points. Useful for\n * applying rotations, slanting, flipping, etc.\n *\n * @inout:\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * @input:\n * matrix ::\n * A pointer to the transformation matrix.\n *\n * @note:\n * You can use @FT_Outline_Translate if you need to translate the\n * outline's points.\n */\n FT_EXPORT( void )\n FT_Outline_Transform( const FT_Outline* outline,\n const FT_Matrix* matrix );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Embolden\n *\n * @description:\n * Embolden an outline. The new outline will be at most 4~times\n * `strength` pixels wider and higher. You may think of the left and\n * bottom borders as unchanged.\n *\n * Negative `strength` values to reduce the outline thickness are\n * possible also.\n *\n * @inout:\n * outline ::\n * A handle to the target outline.\n *\n * @input:\n * strength ::\n * How strong the glyph is emboldened. Expressed in 26.6 pixel format.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The used algorithm to increase or decrease the thickness of the glyph\n * doesn't change the number of points; this means that certain\n * situations like acute angles or intersections are sometimes handled\n * incorrectly.\n *\n * If you need 'better' metrics values you should call\n * @FT_Outline_Get_CBox or @FT_Outline_Get_BBox.\n *\n * To get meaningful results, font scaling values must be set with\n * functions like @FT_Set_Char_Size before calling FT_Render_Glyph.\n *\n * @example:\n * ```\n * FT_Load_Glyph( face, index, FT_LOAD_DEFAULT );\n *\n * if ( face->glyph->format == FT_GLYPH_FORMAT_OUTLINE )\n * FT_Outline_Embolden( &face->glyph->outline, strength );\n * ```\n *\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Embolden( FT_Outline* outline,\n FT_Pos strength );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_EmboldenXY\n *\n * @description:\n * Embolden an outline. The new outline will be `xstrength` pixels wider\n * and `ystrength` pixels higher. Otherwise, it is similar to\n * @FT_Outline_Embolden, which uses the same strength in both directions.\n *\n * @since:\n * 2.4.10\n */\n FT_EXPORT( FT_Error )\n FT_Outline_EmboldenXY( FT_Outline* outline,\n FT_Pos xstrength,\n FT_Pos ystrength );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Reverse\n *\n * @description:\n * Reverse the drawing direction of an outline. This is used to ensure\n * consistent fill conventions for mirrored glyphs.\n *\n * @inout:\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * @note:\n * This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in the\n * outline's `flags` field.\n *\n * It shouldn't be used by a normal client application, unless it knows\n * what it is doing.\n */\n FT_EXPORT( void )\n FT_Outline_Reverse( FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Get_Bitmap\n *\n * @description:\n * Render an outline within a bitmap. The outline's image is simply\n * OR-ed to the target bitmap.\n *\n * @input:\n * library ::\n * A handle to a FreeType library object.\n *\n * outline ::\n * A pointer to the source outline descriptor.\n *\n * @inout:\n * abitmap ::\n * A pointer to the target bitmap descriptor.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function does **not create** the bitmap, it only renders an\n * outline image within the one you pass to it! Consequently, the\n * various fields in `abitmap` should be set accordingly.\n *\n * It will use the raster corresponding to the default glyph format.\n *\n * The value of the `num_grays` field in `abitmap` is ignored. If you\n * select the gray-level rasterizer, and you want less than 256 gray\n * levels, you have to use @FT_Outline_Render directly.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Get_Bitmap( FT_Library library,\n FT_Outline* outline,\n const FT_Bitmap *abitmap );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Render\n *\n * @description:\n * Render an outline within a bitmap using the current scan-convert.\n *\n * @input:\n * library ::\n * A handle to a FreeType library object.\n *\n * outline ::\n * A pointer to the source outline descriptor.\n *\n * @inout:\n * params ::\n * A pointer to an @FT_Raster_Params structure used to describe the\n * rendering operation.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This advanced function uses @FT_Raster_Params as an argument,\n * allowing FreeType rasterizer to be used for direct composition,\n * translucency, etc. You should know how to set up @FT_Raster_Params\n * for this function to work.\n *\n * The field `params.source` will be set to `outline` before the scan\n * converter is called, which means that the value you give to it is\n * actually ignored.\n *\n * The gray-level rasterizer always uses 256 gray levels. If you want\n * less gray levels, you have to provide your own span callback. See the\n * @FT_RASTER_FLAG_DIRECT value of the `flags` field in the\n * @FT_Raster_Params structure for more details.\n */\n FT_EXPORT( FT_Error )\n FT_Outline_Render( FT_Library library,\n FT_Outline* outline,\n FT_Raster_Params* params );\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Orientation\n *\n * @description:\n * A list of values used to describe an outline's contour orientation.\n *\n * The TrueType and PostScript specifications use different conventions\n * to determine whether outline contours should be filled or unfilled.\n *\n * @values:\n * FT_ORIENTATION_TRUETYPE ::\n * According to the TrueType specification, clockwise contours must be\n * filled, and counter-clockwise ones must be unfilled.\n *\n * FT_ORIENTATION_POSTSCRIPT ::\n * According to the PostScript specification, counter-clockwise\n * contours must be filled, and clockwise ones must be unfilled.\n *\n * FT_ORIENTATION_FILL_RIGHT ::\n * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to\n * remember that in TrueType, everything that is to the right of the\n * drawing direction of a contour must be filled.\n *\n * FT_ORIENTATION_FILL_LEFT ::\n * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to\n * remember that in PostScript, everything that is to the left of the\n * drawing direction of a contour must be filled.\n *\n * FT_ORIENTATION_NONE ::\n * The orientation cannot be determined. That is, different parts of\n * the glyph have different orientation.\n *\n */\n typedef enum FT_Orientation_\n {\n FT_ORIENTATION_TRUETYPE = 0,\n FT_ORIENTATION_POSTSCRIPT = 1,\n FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,\n FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT,\n FT_ORIENTATION_NONE\n\n } FT_Orientation;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_Get_Orientation\n *\n * @description:\n * This function analyzes a glyph outline and tries to compute its fill\n * orientation (see @FT_Orientation). This is done by integrating the\n * total area covered by the outline. The positive integral corresponds\n * to the clockwise orientation and @FT_ORIENTATION_POSTSCRIPT is\n * returned. The negative integral corresponds to the counter-clockwise\n * orientation and @FT_ORIENTATION_TRUETYPE is returned.\n *\n * Note that this will return @FT_ORIENTATION_TRUETYPE for empty\n * outlines.\n *\n * @input:\n * outline ::\n * A handle to the source outline.\n *\n * @return:\n * The orientation.\n *\n */\n FT_EXPORT( FT_Orientation )\n FT_Outline_Get_Orientation( FT_Outline* outline );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTOUTLN_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftparams.h", "language": "code", "loc": 170, "comment_density": 0.829, "code": "/****************************************************************************\n *\n * ftparams.h\n *\n * FreeType API for possible FT_Parameter tags (specification only).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTPARAMS_H_\n#define FTPARAMS_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * parameter_tags\n *\n * @title:\n * Parameter Tags\n *\n * @abstract:\n * Macros for driver property and font loading parameter tags.\n *\n * @description:\n * This section contains macros for the @FT_Parameter structure that are\n * used with various functions to activate some special functionality or\n * different behaviour of various components of FreeType.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY\n *\n * @description:\n * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic\n * family names in the 'name' table (introduced in OpenType version 1.4).\n * Use this for backward compatibility with legacy systems that have a\n * four-faces-per-family restriction.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \\\n FT_MAKE_TAG( 'i', 'g', 'p', 'f' )\n\n\n /* this constant is deprecated */\n#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \\\n FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY\n *\n * @description:\n * A tag for @FT_Parameter to make @FT_Open_Face ignore typographic\n * subfamily names in the 'name' table (introduced in OpenType version\n * 1.4). Use this for backward compatibility with legacy systems that\n * have a four-faces-per-family restriction.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \\\n FT_MAKE_TAG( 'i', 'g', 'p', 's' )\n\n\n /* this constant is deprecated */\n#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \\\n FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_INCREMENTAL\n *\n * @description:\n * An @FT_Parameter tag to be used with @FT_Open_Face to indicate\n * incremental glyph loading.\n *\n */\n#define FT_PARAM_TAG_INCREMENTAL \\\n FT_MAKE_TAG( 'i', 'n', 'c', 'r' )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_LCD_FILTER_WEIGHTS\n *\n * @description:\n * An @FT_Parameter tag to be used with @FT_Face_Properties. The\n * corresponding argument specifies the five LCD filter weights for a\n * given face (if using @FT_LOAD_TARGET_LCD, for example), overriding the\n * global default values or the values set up with\n * @FT_Library_SetLcdFilterWeights.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_LCD_FILTER_WEIGHTS \\\n FT_MAKE_TAG( 'l', 'c', 'd', 'f' )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_RANDOM_SEED\n *\n * @description:\n * An @FT_Parameter tag to be used with @FT_Face_Properties. The\n * corresponding 32bit signed integer argument overrides the font\n * driver's random seed value with a face-specific one; see @random-seed.\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_RANDOM_SEED \\\n FT_MAKE_TAG( 's', 'e', 'e', 'd' )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_STEM_DARKENING\n *\n * @description:\n * An @FT_Parameter tag to be used with @FT_Face_Properties. The\n * corresponding Boolean argument specifies whether to apply stem\n * darkening, overriding the global default values or the values set up\n * with @FT_Property_Set (see @no-stem-darkening).\n *\n * This is a passive setting that only takes effect if the font driver or\n * autohinter honors it, which the CFF, Type~1, and CID drivers always\n * do, but the autohinter only in 'light' hinting mode (as of version\n * 2.9).\n *\n * @since:\n * 2.8\n *\n */\n#define FT_PARAM_TAG_STEM_DARKENING \\\n FT_MAKE_TAG( 'd', 'a', 'r', 'k' )\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_PARAM_TAG_UNPATENTED_HINTING\n *\n * @description:\n * Deprecated, no effect.\n *\n * Previously: A constant used as the tag of an @FT_Parameter structure\n * to indicate that unpatented methods only should be used by the\n * TrueType bytecode interpreter for a typeface opened by @FT_Open_Face.\n *\n */\n#define FT_PARAM_TAG_UNPATENTED_HINTING \\\n FT_MAKE_TAG( 'u', 'n', 'p', 'a' )\n\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* FTPARAMS_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftpfr.h", "language": "code", "loc": 160, "comment_density": 0.838, "code": "/****************************************************************************\n *\n * ftpfr.h\n *\n * FreeType API for accessing PFR-specific data (specification only).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTPFR_H_\n#define FTPFR_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * pfr_fonts\n *\n * @title:\n * PFR Fonts\n *\n * @abstract:\n * PFR/TrueDoc-specific API.\n *\n * @description:\n * This section contains the declaration of PFR-specific functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PFR_Metrics\n *\n * @description:\n * Return the outline and metrics resolutions of a given PFR face.\n *\n * @input:\n * face ::\n * Handle to the input face. It can be a non-PFR face.\n *\n * @output:\n * aoutline_resolution ::\n * Outline resolution. This is equivalent to `face->units_per_EM` for\n * non-PFR fonts. Optional (parameter can be `NULL`).\n *\n * ametrics_resolution ::\n * Metrics resolution. This is equivalent to `outline_resolution` for\n * non-PFR fonts. Optional (parameter can be `NULL`).\n *\n * ametrics_x_scale ::\n * A 16.16 fixed-point number used to scale distance expressed in\n * metrics units to device subpixels. This is equivalent to\n * `face->size->x_scale`, but for metrics only. Optional (parameter\n * can be `NULL`).\n *\n * ametrics_y_scale ::\n * Same as `ametrics_x_scale` but for the vertical direction.\n * optional (parameter can be `NULL`).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If the input face is not a PFR, this function will return an error.\n * However, in all cases, it will return valid values.\n */\n FT_EXPORT( FT_Error )\n FT_Get_PFR_Metrics( FT_Face face,\n FT_UInt *aoutline_resolution,\n FT_UInt *ametrics_resolution,\n FT_Fixed *ametrics_x_scale,\n FT_Fixed *ametrics_y_scale );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PFR_Kerning\n *\n * @description:\n * Return the kerning pair corresponding to two glyphs in a PFR face.\n * The distance is expressed in metrics units, unlike the result of\n * @FT_Get_Kerning.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * left ::\n * Index of the left glyph.\n *\n * right ::\n * Index of the right glyph.\n *\n * @output:\n * avector ::\n * A kerning vector.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function always return distances in original PFR metrics units.\n * This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED mode,\n * which always returns distances converted to outline units.\n *\n * You can use the value of the `x_scale` and `y_scale` parameters\n * returned by @FT_Get_PFR_Metrics to scale these to device subpixels.\n */\n FT_EXPORT( FT_Error )\n FT_Get_PFR_Kerning( FT_Face face,\n FT_UInt left,\n FT_UInt right,\n FT_Vector *avector );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PFR_Advance\n *\n * @description:\n * Return a given glyph advance, expressed in original metrics units,\n * from a PFR font.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * gindex ::\n * The glyph index.\n *\n * @output:\n * aadvance ::\n * The glyph advance in metrics units.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You can use the `x_scale` or `y_scale` results of @FT_Get_PFR_Metrics\n * to convert the advance to device subpixels (i.e., 1/64th of pixels).\n */\n FT_EXPORT( FT_Error )\n FT_Get_PFR_Advance( FT_Face face,\n FT_UInt gindex,\n FT_Pos *aadvance );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTPFR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftrender.h", "language": "code", "loc": 202, "comment_density": 0.594, "code": "/****************************************************************************\n *\n * ftrender.h\n *\n * FreeType renderer modules public interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTRENDER_H_\n#define FTRENDER_H_\n\n\n#include \n#include FT_MODULE_H\n#include FT_GLYPH_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * module_management\n *\n */\n\n\n /* create a new glyph object */\n typedef FT_Error\n (*FT_Glyph_InitFunc)( FT_Glyph glyph,\n FT_GlyphSlot slot );\n\n /* destroys a given glyph object */\n typedef void\n (*FT_Glyph_DoneFunc)( FT_Glyph glyph );\n\n typedef void\n (*FT_Glyph_TransformFunc)( FT_Glyph glyph,\n const FT_Matrix* matrix,\n const FT_Vector* delta );\n\n typedef void\n (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph,\n FT_BBox* abbox );\n\n typedef FT_Error\n (*FT_Glyph_CopyFunc)( FT_Glyph source,\n FT_Glyph target );\n\n typedef FT_Error\n (*FT_Glyph_PrepareFunc)( FT_Glyph glyph,\n FT_GlyphSlot slot );\n\n/* deprecated */\n#define FT_Glyph_Init_Func FT_Glyph_InitFunc\n#define FT_Glyph_Done_Func FT_Glyph_DoneFunc\n#define FT_Glyph_Transform_Func FT_Glyph_TransformFunc\n#define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc\n#define FT_Glyph_Copy_Func FT_Glyph_CopyFunc\n#define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc\n\n\n struct FT_Glyph_Class_\n {\n FT_Long glyph_size;\n FT_Glyph_Format glyph_format;\n\n FT_Glyph_InitFunc glyph_init;\n FT_Glyph_DoneFunc glyph_done;\n FT_Glyph_CopyFunc glyph_copy;\n FT_Glyph_TransformFunc glyph_transform;\n FT_Glyph_GetBBoxFunc glyph_bbox;\n FT_Glyph_PrepareFunc glyph_prepare;\n };\n\n\n typedef FT_Error\n (*FT_Renderer_RenderFunc)( FT_Renderer renderer,\n FT_GlyphSlot slot,\n FT_Render_Mode mode,\n const FT_Vector* origin );\n\n typedef FT_Error\n (*FT_Renderer_TransformFunc)( FT_Renderer renderer,\n FT_GlyphSlot slot,\n const FT_Matrix* matrix,\n const FT_Vector* delta );\n\n\n typedef void\n (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer,\n FT_GlyphSlot slot,\n FT_BBox* cbox );\n\n\n typedef FT_Error\n (*FT_Renderer_SetModeFunc)( FT_Renderer renderer,\n FT_ULong mode_tag,\n FT_Pointer mode_ptr );\n\n/* deprecated identifiers */\n#define FTRenderer_render FT_Renderer_RenderFunc\n#define FTRenderer_transform FT_Renderer_TransformFunc\n#define FTRenderer_getCBox FT_Renderer_GetCBoxFunc\n#define FTRenderer_setMode FT_Renderer_SetModeFunc\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Renderer_Class\n *\n * @description:\n * The renderer module class descriptor.\n *\n * @fields:\n * root ::\n * The root @FT_Module_Class fields.\n *\n * glyph_format ::\n * The glyph image format this renderer handles.\n *\n * render_glyph ::\n * A method used to render the image that is in a given glyph slot into\n * a bitmap.\n *\n * transform_glyph ::\n * A method used to transform the image that is in a given glyph slot.\n *\n * get_glyph_cbox ::\n * A method used to access the glyph's cbox.\n *\n * set_mode ::\n * A method used to pass additional parameters.\n *\n * raster_class ::\n * For @FT_GLYPH_FORMAT_OUTLINE renderers only. This is a pointer to\n * its raster's class.\n */\n typedef struct FT_Renderer_Class_\n {\n FT_Module_Class root;\n\n FT_Glyph_Format glyph_format;\n\n FT_Renderer_RenderFunc render_glyph;\n FT_Renderer_TransformFunc transform_glyph;\n FT_Renderer_GetCBoxFunc get_glyph_cbox;\n FT_Renderer_SetModeFunc set_mode;\n\n FT_Raster_Funcs* raster_class;\n\n } FT_Renderer_Class;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Renderer\n *\n * @description:\n * Retrieve the current renderer for a given glyph format.\n *\n * @input:\n * library ::\n * A handle to the library object.\n *\n * format ::\n * The glyph format.\n *\n * @return:\n * A renderer handle. 0~if none found.\n *\n * @note:\n * An error will be returned if a module already exists by that name, or\n * if the module requires a version of FreeType that is too great.\n *\n * To add a new renderer, simply use @FT_Add_Module. To retrieve a\n * renderer by its name, use @FT_Get_Module.\n */\n FT_EXPORT( FT_Renderer )\n FT_Get_Renderer( FT_Library library,\n FT_Glyph_Format format );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Set_Renderer\n *\n * @description:\n * Set the current renderer to use, and set additional mode.\n *\n * @inout:\n * library ::\n * A handle to the library object.\n *\n * @input:\n * renderer ::\n * A handle to the renderer object.\n *\n * num_params ::\n * The number of additional parameters.\n *\n * parameters ::\n * Additional parameters.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * In case of success, the renderer will be used to convert glyph images\n * in the renderer's known format into bitmaps.\n *\n * This doesn't change the current renderer for other formats.\n *\n * Currently, no FreeType renderer module uses `parameters`; you should\n * thus always pass `NULL` as the value.\n */\n FT_EXPORT( FT_Error )\n FT_Set_Renderer( FT_Library library,\n FT_Renderer renderer,\n FT_UInt num_params,\n FT_Parameter* parameters );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTRENDER_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftsizes.h", "language": "code", "loc": 137, "comment_density": 0.869, "code": "/****************************************************************************\n *\n * ftsizes.h\n *\n * FreeType size objects management (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * Typical application would normally not need to use these functions.\n * However, they have been placed in a public API for the rare cases where\n * they are needed.\n *\n */\n\n\n#ifndef FTSIZES_H_\n#define FTSIZES_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * sizes_management\n *\n * @title:\n * Size Management\n *\n * @abstract:\n * Managing multiple sizes per face.\n *\n * @description:\n * When creating a new face object (e.g., with @FT_New_Face), an @FT_Size\n * object is automatically created and used to store all pixel-size\n * dependent information, available in the `face->size` field.\n *\n * It is however possible to create more sizes for a given face, mostly\n * in order to manage several character pixel sizes of the same font\n * family and style. See @FT_New_Size and @FT_Done_Size.\n *\n * Note that @FT_Set_Pixel_Sizes and @FT_Set_Char_Size only modify the\n * contents of the current 'active' size; you thus need to use\n * @FT_Activate_Size to change it.\n *\n * 99% of applications won't need the functions provided here, especially\n * if they use the caching sub-system, so be cautious when using these.\n *\n */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Size\n *\n * @description:\n * Create a new size object from a given face object.\n *\n * @input:\n * face ::\n * A handle to a parent face object.\n *\n * @output:\n * asize ::\n * A handle to a new size object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You need to call @FT_Activate_Size in order to select the new size for\n * upcoming calls to @FT_Set_Pixel_Sizes, @FT_Set_Char_Size,\n * @FT_Load_Glyph, @FT_Load_Char, etc.\n */\n FT_EXPORT( FT_Error )\n FT_New_Size( FT_Face face,\n FT_Size* size );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Size\n *\n * @description:\n * Discard a given size object. Note that @FT_Done_Face automatically\n * discards all size objects allocated with @FT_New_Size.\n *\n * @input:\n * size ::\n * A handle to a target size object.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Done_Size( FT_Size size );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Activate_Size\n *\n * @description:\n * Even though it is possible to create several size objects for a given\n * face (see @FT_New_Size for details), functions like @FT_Load_Glyph or\n * @FT_Load_Char only use the one that has been activated last to\n * determine the 'current character pixel size'.\n *\n * This function can be used to 'activate' a previously created size\n * object.\n *\n * @input:\n * size ::\n * A handle to a target size object.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If `face` is the size's parent face object, this function changes the\n * value of `face->size` to the input size handle.\n */\n FT_EXPORT( FT_Error )\n FT_Activate_Size( FT_Size size );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTSIZES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftsnames.h", "language": "code", "loc": 244, "comment_density": 0.869, "code": "/****************************************************************************\n *\n * ftsnames.h\n *\n * Simple interface to access SFNT 'name' tables (which are used\n * to hold font names, copyright info, notices, etc.) (specification).\n *\n * This is _not_ used to retrieve glyph names!\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTSNAMES_H_\n#define FTSNAMES_H_\n\n\n#include \n#include FT_FREETYPE_H\n#include FT_PARAMETER_TAGS_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * sfnt_names\n *\n * @title:\n * SFNT Names\n *\n * @abstract:\n * Access the names embedded in TrueType and OpenType files.\n *\n * @description:\n * The TrueType and OpenType specifications allow the inclusion of a\n * special names table ('name') in font files. This table contains\n * textual (and internationalized) information regarding the font, like\n * family name, copyright, version, etc.\n *\n * The definitions below are used to access them if available.\n *\n * Note that this has nothing to do with glyph names!\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_SfntName\n *\n * @description:\n * A structure used to model an SFNT 'name' table entry.\n *\n * @fields:\n * platform_id ::\n * The platform ID for `string`. See @TT_PLATFORM_XXX for possible\n * values.\n *\n * encoding_id ::\n * The encoding ID for `string`. See @TT_APPLE_ID_XXX, @TT_MAC_ID_XXX,\n * @TT_ISO_ID_XXX, @TT_MS_ID_XXX, and @TT_ADOBE_ID_XXX for possible\n * values.\n *\n * language_id ::\n * The language ID for `string`. See @TT_MAC_LANGID_XXX and\n * @TT_MS_LANGID_XXX for possible values.\n *\n * Registered OpenType values for `language_id` are always smaller than\n * 0x8000; values equal or larger than 0x8000 usually indicate a\n * language tag string (introduced in OpenType version 1.6). Use\n * function @FT_Get_Sfnt_LangTag with `language_id` as its argument to\n * retrieve the associated language tag.\n *\n * name_id ::\n * An identifier for `string`. See @TT_NAME_ID_XXX for possible\n * values.\n *\n * string ::\n * The 'name' string. Note that its format differs depending on the\n * (platform,encoding) pair, being either a string of bytes (without a\n * terminating `NULL` byte) or containing UTF-16BE entities.\n *\n * string_len ::\n * The length of `string` in bytes.\n *\n * @note:\n * Please refer to the TrueType or OpenType specification for more\n * details.\n */\n typedef struct FT_SfntName_\n {\n FT_UShort platform_id;\n FT_UShort encoding_id;\n FT_UShort language_id;\n FT_UShort name_id;\n\n FT_Byte* string; /* this string is *not* null-terminated! */\n FT_UInt string_len; /* in bytes */\n\n } FT_SfntName;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Sfnt_Name_Count\n *\n * @description:\n * Retrieve the number of name strings in the SFNT 'name' table.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * @return:\n * The number of strings in the 'name' table.\n *\n * @note:\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.\n */\n FT_EXPORT( FT_UInt )\n FT_Get_Sfnt_Name_Count( FT_Face face );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Sfnt_Name\n *\n * @description:\n * Retrieve a string of the SFNT 'name' table for a given index.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * idx ::\n * The index of the 'name' string.\n *\n * @output:\n * aname ::\n * The indexed @FT_SfntName structure.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The `string` array returned in the `aname` structure is not\n * null-terminated. Note that you don't have to deallocate `string` by\n * yourself; FreeType takes care of it if you call @FT_Done_Face.\n *\n * Use @FT_Get_Sfnt_Name_Count to get the total number of available\n * 'name' table entries, then do a loop until you get the right platform,\n * encoding, and name ID.\n *\n * 'name' table format~1 entries can use language tags also, see\n * @FT_Get_Sfnt_LangTag.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.\n */\n FT_EXPORT( FT_Error )\n FT_Get_Sfnt_Name( FT_Face face,\n FT_UInt idx,\n FT_SfntName *aname );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_SfntLangTag\n *\n * @description:\n * A structure to model a language tag entry from an SFNT 'name' table.\n *\n * @fields:\n * string ::\n * The language tag string, encoded in UTF-16BE (without trailing\n * `NULL` bytes).\n *\n * string_len ::\n * The length of `string` in **bytes**.\n *\n * @note:\n * Please refer to the TrueType or OpenType specification for more\n * details.\n *\n * @since:\n * 2.8\n */\n typedef struct FT_SfntLangTag_\n {\n FT_Byte* string; /* this string is *not* null-terminated! */\n FT_UInt string_len; /* in bytes */\n\n } FT_SfntLangTag;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Sfnt_LangTag\n *\n * @description:\n * Retrieve the language tag associated with a language ID of an SFNT\n * 'name' table entry.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * langID ::\n * The language ID, as returned by @FT_Get_Sfnt_Name. This is always a\n * value larger than 0x8000.\n *\n * @output:\n * alangTag ::\n * The language tag associated with the 'name' table entry's language\n * ID.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The `string` array returned in the `alangTag` structure is not\n * null-terminated. Note that you don't have to deallocate `string` by\n * yourself; FreeType takes care of it if you call @FT_Done_Face.\n *\n * Only 'name' table format~1 supports language tags. For format~0\n * tables, this function always returns FT_Err_Invalid_Table. For\n * invalid format~1 language ID values, FT_Err_Invalid_Argument is\n * returned.\n *\n * This function always returns an error if the config macro\n * `TT_CONFIG_OPTION_SFNT_NAMES` is not defined in `ftoption.h`.\n *\n * @since:\n * 2.8\n */\n FT_EXPORT( FT_Error )\n FT_Get_Sfnt_LangTag( FT_Face face,\n FT_UInt langID,\n FT_SfntLangTag *alangTag );\n\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTSNAMES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftstroke.h", "language": "code", "loc": 713, "comment_density": 0.872, "code": "/****************************************************************************\n *\n * ftstroke.h\n *\n * FreeType path stroker (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTSTROKE_H_\n#define FTSTROKE_H_\n\n#include \n#include FT_OUTLINE_H\n#include FT_GLYPH_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * glyph_stroker\n *\n * @title:\n * Glyph Stroker\n *\n * @abstract:\n * Generating bordered and stroked glyphs.\n *\n * @description:\n * This component generates stroked outlines of a given vectorial glyph.\n * It also allows you to retrieve the 'outside' and/or the 'inside'\n * borders of the stroke.\n *\n * This can be useful to generate 'bordered' glyph, i.e., glyphs\n * displayed with a coloured (and anti-aliased) border around their\n * shape.\n *\n * @order:\n * FT_Stroker\n *\n * FT_Stroker_LineJoin\n * FT_Stroker_LineCap\n * FT_StrokerBorder\n *\n * FT_Outline_GetInsideBorder\n * FT_Outline_GetOutsideBorder\n *\n * FT_Glyph_Stroke\n * FT_Glyph_StrokeBorder\n *\n * FT_Stroker_New\n * FT_Stroker_Set\n * FT_Stroker_Rewind\n * FT_Stroker_ParseOutline\n * FT_Stroker_Done\n *\n * FT_Stroker_BeginSubPath\n * FT_Stroker_EndSubPath\n *\n * FT_Stroker_LineTo\n * FT_Stroker_ConicTo\n * FT_Stroker_CubicTo\n *\n * FT_Stroker_GetBorderCounts\n * FT_Stroker_ExportBorder\n * FT_Stroker_GetCounts\n * FT_Stroker_Export\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Stroker\n *\n * @description:\n * Opaque handle to a path stroker object.\n */\n typedef struct FT_StrokerRec_* FT_Stroker;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Stroker_LineJoin\n *\n * @description:\n * These values determine how two joining lines are rendered in a\n * stroker.\n *\n * @values:\n * FT_STROKER_LINEJOIN_ROUND ::\n * Used to render rounded line joins. Circular arcs are used to join\n * two lines smoothly.\n *\n * FT_STROKER_LINEJOIN_BEVEL ::\n * Used to render beveled line joins. The outer corner of the joined\n * lines is filled by enclosing the triangular region of the corner\n * with a straight line between the outer corners of each stroke.\n *\n * FT_STROKER_LINEJOIN_MITER_FIXED ::\n * Used to render mitered line joins, with fixed bevels if the miter\n * limit is exceeded. The outer edges of the strokes for the two\n * segments are extended until they meet at an angle. A bevel join\n * (see above) is used if the segments meet at too sharp an angle and\n * the outer edges meet beyond a distance corresponding to the meter\n * limit. This prevents long spikes being created.\n * `FT_STROKER_LINEJOIN_MITER_FIXED` generates a miter line join as\n * used in PostScript and PDF.\n *\n * FT_STROKER_LINEJOIN_MITER_VARIABLE ::\n * FT_STROKER_LINEJOIN_MITER ::\n * Used to render mitered line joins, with variable bevels if the miter\n * limit is exceeded. The intersection of the strokes is clipped\n * perpendicularly to the bisector, at a distance corresponding to\n * the miter limit. This prevents long spikes being created.\n * `FT_STROKER_LINEJOIN_MITER_VARIABLE` generates a mitered line join\n * as used in XPS. `FT_STROKER_LINEJOIN_MITER` is an alias for\n * `FT_STROKER_LINEJOIN_MITER_VARIABLE`, retained for backward\n * compatibility.\n */\n typedef enum FT_Stroker_LineJoin_\n {\n FT_STROKER_LINEJOIN_ROUND = 0,\n FT_STROKER_LINEJOIN_BEVEL = 1,\n FT_STROKER_LINEJOIN_MITER_VARIABLE = 2,\n FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE,\n FT_STROKER_LINEJOIN_MITER_FIXED = 3\n\n } FT_Stroker_LineJoin;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Stroker_LineCap\n *\n * @description:\n * These values determine how the end of opened sub-paths are rendered in\n * a stroke.\n *\n * @values:\n * FT_STROKER_LINECAP_BUTT ::\n * The end of lines is rendered as a full stop on the last point\n * itself.\n *\n * FT_STROKER_LINECAP_ROUND ::\n * The end of lines is rendered as a half-circle around the last point.\n *\n * FT_STROKER_LINECAP_SQUARE ::\n * The end of lines is rendered as a square around the last point.\n */\n typedef enum FT_Stroker_LineCap_\n {\n FT_STROKER_LINECAP_BUTT = 0,\n FT_STROKER_LINECAP_ROUND,\n FT_STROKER_LINECAP_SQUARE\n\n } FT_Stroker_LineCap;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_StrokerBorder\n *\n * @description:\n * These values are used to select a given stroke border in\n * @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.\n *\n * @values:\n * FT_STROKER_BORDER_LEFT ::\n * Select the left border, relative to the drawing direction.\n *\n * FT_STROKER_BORDER_RIGHT ::\n * Select the right border, relative to the drawing direction.\n *\n * @note:\n * Applications are generally interested in the 'inside' and 'outside'\n * borders. However, there is no direct mapping between these and the\n * 'left' and 'right' ones, since this really depends on the glyph's\n * drawing orientation, which varies between font formats.\n *\n * You can however use @FT_Outline_GetInsideBorder and\n * @FT_Outline_GetOutsideBorder to get these.\n */\n typedef enum FT_StrokerBorder_\n {\n FT_STROKER_BORDER_LEFT = 0,\n FT_STROKER_BORDER_RIGHT\n\n } FT_StrokerBorder;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_GetInsideBorder\n *\n * @description:\n * Retrieve the @FT_StrokerBorder value corresponding to the 'inside'\n * borders of a given outline.\n *\n * @input:\n * outline ::\n * The source outline handle.\n *\n * @return:\n * The border index. @FT_STROKER_BORDER_RIGHT for empty or invalid\n * outlines.\n */\n FT_EXPORT( FT_StrokerBorder )\n FT_Outline_GetInsideBorder( FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Outline_GetOutsideBorder\n *\n * @description:\n * Retrieve the @FT_StrokerBorder value corresponding to the 'outside'\n * borders of a given outline.\n *\n * @input:\n * outline ::\n * The source outline handle.\n *\n * @return:\n * The border index. @FT_STROKER_BORDER_LEFT for empty or invalid\n * outlines.\n */\n FT_EXPORT( FT_StrokerBorder )\n FT_Outline_GetOutsideBorder( FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_New\n *\n * @description:\n * Create a new stroker object.\n *\n * @input:\n * library ::\n * FreeType library handle.\n *\n * @output:\n * astroker ::\n * A new stroker object handle. `NULL` in case of error.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_New( FT_Library library,\n FT_Stroker *astroker );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_Set\n *\n * @description:\n * Reset a stroker object's attributes.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * radius ::\n * The border radius.\n *\n * line_cap ::\n * The line cap style.\n *\n * line_join ::\n * The line join style.\n *\n * miter_limit ::\n * The maximum reciprocal sine of half-angle at the miter join,\n * expressed as 16.16 fixed point value.\n *\n * @note:\n * The `radius` is expressed in the same units as the outline\n * coordinates.\n *\n * The `miter_limit` multiplied by the `radius` gives the maximum size\n * of a miter spike, at which it is clipped for\n * @FT_STROKER_LINEJOIN_MITER_VARIABLE or replaced with a bevel join for\n * @FT_STROKER_LINEJOIN_MITER_FIXED.\n *\n * This function calls @FT_Stroker_Rewind automatically.\n */\n FT_EXPORT( void )\n FT_Stroker_Set( FT_Stroker stroker,\n FT_Fixed radius,\n FT_Stroker_LineCap line_cap,\n FT_Stroker_LineJoin line_join,\n FT_Fixed miter_limit );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_Rewind\n *\n * @description:\n * Reset a stroker object without changing its attributes. You should\n * call this function before beginning a new series of calls to\n * @FT_Stroker_BeginSubPath or @FT_Stroker_EndSubPath.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n */\n FT_EXPORT( void )\n FT_Stroker_Rewind( FT_Stroker stroker );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_ParseOutline\n *\n * @description:\n * A convenience function used to parse a whole outline with the stroker.\n * The resulting outline(s) can be retrieved later by functions like\n * @FT_Stroker_GetCounts and @FT_Stroker_Export.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * outline ::\n * The source outline.\n *\n * opened ::\n * A boolean. If~1, the outline is treated as an open path instead of\n * a closed one.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If `opened` is~0 (the default), the outline is treated as a closed\n * path, and the stroker generates two distinct 'border' outlines.\n *\n * If `opened` is~1, the outline is processed as an open path, and the\n * stroker generates a single 'stroke' outline.\n *\n * This function calls @FT_Stroker_Rewind automatically.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_ParseOutline( FT_Stroker stroker,\n FT_Outline* outline,\n FT_Bool opened );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_BeginSubPath\n *\n * @description:\n * Start a new sub-path in the stroker.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * to ::\n * A pointer to the start vector.\n *\n * open ::\n * A boolean. If~1, the sub-path is treated as an open one.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function is useful when you need to stroke a path that is not\n * stored as an @FT_Outline object.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_BeginSubPath( FT_Stroker stroker,\n FT_Vector* to,\n FT_Bool open );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_EndSubPath\n *\n * @description:\n * Close the current sub-path in the stroker.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should call this function after @FT_Stroker_BeginSubPath. If the\n * subpath was not 'opened', this function 'draws' a single line segment\n * to the start position when needed.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_EndSubPath( FT_Stroker stroker );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_LineTo\n *\n * @description:\n * 'Draw' a single line segment in the stroker's current sub-path, from\n * the last position.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * to ::\n * A pointer to the destination point.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should call this function between @FT_Stroker_BeginSubPath and\n * @FT_Stroker_EndSubPath.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_LineTo( FT_Stroker stroker,\n FT_Vector* to );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_ConicTo\n *\n * @description:\n * 'Draw' a single quadratic Bezier in the stroker's current sub-path,\n * from the last position.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * control ::\n * A pointer to a Bezier control point.\n *\n * to ::\n * A pointer to the destination point.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should call this function between @FT_Stroker_BeginSubPath and\n * @FT_Stroker_EndSubPath.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_ConicTo( FT_Stroker stroker,\n FT_Vector* control,\n FT_Vector* to );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_CubicTo\n *\n * @description:\n * 'Draw' a single cubic Bezier in the stroker's current sub-path, from\n * the last position.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * control1 ::\n * A pointer to the first Bezier control point.\n *\n * control2 ::\n * A pointer to second Bezier control point.\n *\n * to ::\n * A pointer to the destination point.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * You should call this function between @FT_Stroker_BeginSubPath and\n * @FT_Stroker_EndSubPath.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_CubicTo( FT_Stroker stroker,\n FT_Vector* control1,\n FT_Vector* control2,\n FT_Vector* to );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_GetBorderCounts\n *\n * @description:\n * Call this function once you have finished parsing your paths with the\n * stroker. It returns the number of points and contours necessary to\n * export one of the 'border' or 'stroke' outlines generated by the\n * stroker.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * border ::\n * The border index.\n *\n * @output:\n * anum_points ::\n * The number of points.\n *\n * anum_contours ::\n * The number of contours.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * When an outline, or a sub-path, is 'closed', the stroker generates two\n * independent 'border' outlines, named 'left' and 'right'.\n *\n * When the outline, or a sub-path, is 'opened', the stroker merges the\n * 'border' outlines with caps. The 'left' border receives all points,\n * while the 'right' border becomes empty.\n *\n * Use the function @FT_Stroker_GetCounts instead if you want to retrieve\n * the counts associated to both borders.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_GetBorderCounts( FT_Stroker stroker,\n FT_StrokerBorder border,\n FT_UInt *anum_points,\n FT_UInt *anum_contours );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_ExportBorder\n *\n * @description:\n * Call this function after @FT_Stroker_GetBorderCounts to export the\n * corresponding border to your own @FT_Outline structure.\n *\n * Note that this function appends the border points and contours to your\n * outline, but does not try to resize its arrays.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * border ::\n * The border index.\n *\n * outline ::\n * The target outline handle.\n *\n * @note:\n * Always call this function after @FT_Stroker_GetBorderCounts to get\n * sure that there is enough room in your @FT_Outline object to receive\n * all new data.\n *\n * When an outline, or a sub-path, is 'closed', the stroker generates two\n * independent 'border' outlines, named 'left' and 'right'.\n *\n * When the outline, or a sub-path, is 'opened', the stroker merges the\n * 'border' outlines with caps. The 'left' border receives all points,\n * while the 'right' border becomes empty.\n *\n * Use the function @FT_Stroker_Export instead if you want to retrieve\n * all borders at once.\n */\n FT_EXPORT( void )\n FT_Stroker_ExportBorder( FT_Stroker stroker,\n FT_StrokerBorder border,\n FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_GetCounts\n *\n * @description:\n * Call this function once you have finished parsing your paths with the\n * stroker. It returns the number of points and contours necessary to\n * export all points/borders from the stroked outline/path.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * @output:\n * anum_points ::\n * The number of points.\n *\n * anum_contours ::\n * The number of contours.\n *\n * @return:\n * FreeType error code. 0~means success.\n */\n FT_EXPORT( FT_Error )\n FT_Stroker_GetCounts( FT_Stroker stroker,\n FT_UInt *anum_points,\n FT_UInt *anum_contours );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_Export\n *\n * @description:\n * Call this function after @FT_Stroker_GetBorderCounts to export all\n * borders to your own @FT_Outline structure.\n *\n * Note that this function appends the border points and contours to your\n * outline, but does not try to resize its arrays.\n *\n * @input:\n * stroker ::\n * The target stroker handle.\n *\n * outline ::\n * The target outline handle.\n */\n FT_EXPORT( void )\n FT_Stroker_Export( FT_Stroker stroker,\n FT_Outline* outline );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Stroker_Done\n *\n * @description:\n * Destroy a stroker object.\n *\n * @input:\n * stroker ::\n * A stroker handle. Can be `NULL`.\n */\n FT_EXPORT( void )\n FT_Stroker_Done( FT_Stroker stroker );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_Stroke\n *\n * @description:\n * Stroke a given outline glyph object with a given stroker.\n *\n * @inout:\n * pglyph ::\n * Source glyph handle on input, new glyph handle on output.\n *\n * @input:\n * stroker ::\n * A stroker handle.\n *\n * destroy ::\n * A Boolean. If~1, the source glyph object is destroyed on success.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source glyph is untouched in case of error.\n *\n * Adding stroke may yield a significantly wider and taller glyph\n * depending on how large of a radius was used to stroke the glyph. You\n * may need to manually adjust horizontal and vertical advance amounts to\n * account for this added size.\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_Stroke( FT_Glyph *pglyph,\n FT_Stroker stroker,\n FT_Bool destroy );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Glyph_StrokeBorder\n *\n * @description:\n * Stroke a given outline glyph object with a given stroker, but only\n * return either its inside or outside border.\n *\n * @inout:\n * pglyph ::\n * Source glyph handle on input, new glyph handle on output.\n *\n * @input:\n * stroker ::\n * A stroker handle.\n *\n * inside ::\n * A Boolean. If~1, return the inside border, otherwise the outside\n * border.\n *\n * destroy ::\n * A Boolean. If~1, the source glyph object is destroyed on success.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The source glyph is untouched in case of error.\n *\n * Adding stroke may yield a significantly wider and taller glyph\n * depending on how large of a radius was used to stroke the glyph. You\n * may need to manually adjust horizontal and vertical advance amounts to\n * account for this added size.\n */\n FT_EXPORT( FT_Error )\n FT_Glyph_StrokeBorder( FT_Glyph *pglyph,\n FT_Stroker stroker,\n FT_Bool inside,\n FT_Bool destroy );\n\n /* */\n\nFT_END_HEADER\n\n#endif /* FTSTROKE_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/ftsynth.h", "language": "code", "loc": 65, "comment_density": 0.769, "code": "/****************************************************************************\n *\n * ftsynth.h\n *\n * FreeType synthesizing code for emboldening and slanting\n * (specification).\n *\n * Copyright (C) 2000-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /********* *********/\n /********* WARNING, THIS IS ALPHA CODE! THIS API *********/\n /********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/\n /********* FREETYPE DEVELOPMENT TEAM *********/\n /********* *********/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /* Main reason for not lifting the functions in this module to a */\n /* 'standard' API is that the used parameters for emboldening and */\n /* slanting are not configurable. Consider the functions as a */\n /* code resource that should be copied into the application and */\n /* adapted to the particular needs. */\n\n\n#ifndef FTSYNTH_H_\n#define FTSYNTH_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /* Embolden a glyph by a 'reasonable' value (which is highly a matter of */\n /* taste). This function is actually a convenience function, providing */\n /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */\n /* */\n /* For emboldened outlines the height, width, and advance metrics are */\n /* increased by the strength of the emboldening -- this even affects */\n /* mono-width fonts! */\n /* */\n /* You can also call @FT_Outline_Get_CBox to get precise values. */\n FT_EXPORT( void )\n FT_GlyphSlot_Embolden( FT_GlyphSlot slot );\n\n /* Slant an outline glyph to the right by about 12 degrees. */\n FT_EXPORT( void )\n FT_GlyphSlot_Oblique( FT_GlyphSlot slot );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTSYNTH_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftsystem.h", "language": "code", "loc": 311, "comment_density": 0.839, "code": "/****************************************************************************\n *\n * ftsystem.h\n *\n * FreeType low-level system interface definition (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTSYSTEM_H_\n#define FTSYSTEM_H_\n\n\n#include \n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * system_interface\n *\n * @title:\n * System Interface\n *\n * @abstract:\n * How FreeType manages memory and i/o.\n *\n * @description:\n * This section contains various definitions related to memory management\n * and i/o access. You need to understand this information if you want to\n * use a custom memory manager or you own i/o streams.\n *\n */\n\n\n /**************************************************************************\n *\n * M E M O R Y M A N A G E M E N T\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Memory\n *\n * @description:\n * A handle to a given memory manager object, defined with an\n * @FT_MemoryRec structure.\n *\n */\n typedef struct FT_MemoryRec_* FT_Memory;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Alloc_Func\n *\n * @description:\n * A function used to allocate `size` bytes from `memory`.\n *\n * @input:\n * memory ::\n * A handle to the source memory manager.\n *\n * size ::\n * The size in bytes to allocate.\n *\n * @return:\n * Address of new memory block. 0~in case of failure.\n *\n */\n typedef void*\n (*FT_Alloc_Func)( FT_Memory memory,\n long size );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Free_Func\n *\n * @description:\n * A function used to release a given block of memory.\n *\n * @input:\n * memory ::\n * A handle to the source memory manager.\n *\n * block ::\n * The address of the target memory block.\n *\n */\n typedef void\n (*FT_Free_Func)( FT_Memory memory,\n void* block );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Realloc_Func\n *\n * @description:\n * A function used to re-allocate a given block of memory.\n *\n * @input:\n * memory ::\n * A handle to the source memory manager.\n *\n * cur_size ::\n * The block's current size in bytes.\n *\n * new_size ::\n * The block's requested new size.\n *\n * block ::\n * The block's current address.\n *\n * @return:\n * New block address. 0~in case of memory shortage.\n *\n * @note:\n * In case of error, the old block must still be available.\n *\n */\n typedef void*\n (*FT_Realloc_Func)( FT_Memory memory,\n long cur_size,\n long new_size,\n void* block );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_MemoryRec\n *\n * @description:\n * A structure used to describe a given memory manager to FreeType~2.\n *\n * @fields:\n * user ::\n * A generic typeless pointer for user data.\n *\n * alloc ::\n * A pointer type to an allocation function.\n *\n * free ::\n * A pointer type to an memory freeing function.\n *\n * realloc ::\n * A pointer type to a reallocation function.\n *\n */\n struct FT_MemoryRec_\n {\n void* user;\n FT_Alloc_Func alloc;\n FT_Free_Func free;\n FT_Realloc_Func realloc;\n };\n\n\n /**************************************************************************\n *\n * I / O M A N A G E M E N T\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Stream\n *\n * @description:\n * A handle to an input stream.\n *\n * @also:\n * See @FT_StreamRec for the publicly accessible fields of a given stream\n * object.\n *\n */\n typedef struct FT_StreamRec_* FT_Stream;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_StreamDesc\n *\n * @description:\n * A union type used to store either a long or a pointer. This is used\n * to store a file descriptor or a `FILE*` in an input stream.\n *\n */\n typedef union FT_StreamDesc_\n {\n long value;\n void* pointer;\n\n } FT_StreamDesc;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Stream_IoFunc\n *\n * @description:\n * A function used to seek and read data from a given input stream.\n *\n * @input:\n * stream ::\n * A handle to the source stream.\n *\n * offset ::\n * The offset of read in stream (always from start).\n *\n * buffer ::\n * The address of the read buffer.\n *\n * count ::\n * The number of bytes to read from the stream.\n *\n * @return:\n * The number of bytes effectively read by the stream.\n *\n * @note:\n * This function might be called to perform a seek or skip operation with\n * a `count` of~0. A non-zero return value then indicates an error.\n *\n */\n typedef unsigned long\n (*FT_Stream_IoFunc)( FT_Stream stream,\n unsigned long offset,\n unsigned char* buffer,\n unsigned long count );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Stream_CloseFunc\n *\n * @description:\n * A function used to close a given input stream.\n *\n * @input:\n * stream ::\n * A handle to the target stream.\n *\n */\n typedef void\n (*FT_Stream_CloseFunc)( FT_Stream stream );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_StreamRec\n *\n * @description:\n * A structure used to describe an input stream.\n *\n * @input:\n * base ::\n * For memory-based streams, this is the address of the first stream\n * byte in memory. This field should always be set to `NULL` for\n * disk-based streams.\n *\n * size ::\n * The stream size in bytes.\n *\n * In case of compressed streams where the size is unknown before\n * actually doing the decompression, the value is set to 0x7FFFFFFF.\n * (Note that this size value can occur for normal streams also; it is\n * thus just a hint.)\n *\n * pos ::\n * The current position within the stream.\n *\n * descriptor ::\n * This field is a union that can hold an integer or a pointer. It is\n * used by stream implementations to store file descriptors or `FILE*`\n * pointers.\n *\n * pathname ::\n * This field is completely ignored by FreeType. However, it is often\n * useful during debugging to use it to store the stream's filename\n * (where available).\n *\n * read ::\n * The stream's input function.\n *\n * close ::\n * The stream's close function.\n *\n * memory ::\n * The memory manager to use to preload frames. This is set internally\n * by FreeType and shouldn't be touched by stream implementations.\n *\n * cursor ::\n * This field is set and used internally by FreeType when parsing\n * frames. In particular, the `FT_GET_XXX` macros use this instead of\n * the `pos` field.\n *\n * limit ::\n * This field is set and used internally by FreeType when parsing\n * frames.\n *\n */\n typedef struct FT_StreamRec_\n {\n unsigned char* base;\n unsigned long size;\n unsigned long pos;\n\n FT_StreamDesc descriptor;\n FT_StreamDesc pathname;\n FT_Stream_IoFunc read;\n FT_Stream_CloseFunc close;\n\n FT_Memory memory;\n unsigned char* cursor;\n unsigned char* limit;\n\n } FT_StreamRec;\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTSYSTEM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/fttrigon.h", "language": "code", "loc": 306, "comment_density": 0.859, "code": "/****************************************************************************\n *\n * fttrigon.h\n *\n * FreeType trigonometric functions (specification).\n *\n * Copyright (C) 2001-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTTRIGON_H_\n#define FTTRIGON_H_\n\n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * computations\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Angle\n *\n * @description:\n * This type is used to model angle values in FreeType. Note that the\n * angle is a 16.16 fixed-point value expressed in degrees.\n *\n */\n typedef FT_Fixed FT_Angle;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ANGLE_PI\n *\n * @description:\n * The angle pi expressed in @FT_Angle units.\n *\n */\n#define FT_ANGLE_PI ( 180L << 16 )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ANGLE_2PI\n *\n * @description:\n * The angle 2*pi expressed in @FT_Angle units.\n *\n */\n#define FT_ANGLE_2PI ( FT_ANGLE_PI * 2 )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ANGLE_PI2\n *\n * @description:\n * The angle pi/2 expressed in @FT_Angle units.\n *\n */\n#define FT_ANGLE_PI2 ( FT_ANGLE_PI / 2 )\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ANGLE_PI4\n *\n * @description:\n * The angle pi/4 expressed in @FT_Angle units.\n *\n */\n#define FT_ANGLE_PI4 ( FT_ANGLE_PI / 4 )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Sin\n *\n * @description:\n * Return the sinus of a given angle in fixed-point format.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n * @return:\n * The sinus value.\n *\n * @note:\n * If you need both the sinus and cosinus for a given angle, use the\n * function @FT_Vector_Unit.\n *\n */\n FT_EXPORT( FT_Fixed )\n FT_Sin( FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Cos\n *\n * @description:\n * Return the cosinus of a given angle in fixed-point format.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n * @return:\n * The cosinus value.\n *\n * @note:\n * If you need both the sinus and cosinus for a given angle, use the\n * function @FT_Vector_Unit.\n *\n */\n FT_EXPORT( FT_Fixed )\n FT_Cos( FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Tan\n *\n * @description:\n * Return the tangent of a given angle in fixed-point format.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n * @return:\n * The tangent value.\n *\n */\n FT_EXPORT( FT_Fixed )\n FT_Tan( FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Atan2\n *\n * @description:\n * Return the arc-tangent corresponding to a given vector (x,y) in the 2d\n * plane.\n *\n * @input:\n * x ::\n * The horizontal vector coordinate.\n *\n * y ::\n * The vertical vector coordinate.\n *\n * @return:\n * The arc-tangent value (i.e. angle).\n *\n */\n FT_EXPORT( FT_Angle )\n FT_Atan2( FT_Fixed x,\n FT_Fixed y );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Angle_Diff\n *\n * @description:\n * Return the difference between two angles. The result is always\n * constrained to the ]-PI..PI] interval.\n *\n * @input:\n * angle1 ::\n * First angle.\n *\n * angle2 ::\n * Second angle.\n *\n * @return:\n * Constrained value of `angle2-angle1`.\n *\n */\n FT_EXPORT( FT_Angle )\n FT_Angle_Diff( FT_Angle angle1,\n FT_Angle angle2 );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_Unit\n *\n * @description:\n * Return the unit vector corresponding to a given angle. After the\n * call, the value of `vec.x` will be `cos(angle)`, and the value of\n * `vec.y` will be `sin(angle)`.\n *\n * This function is useful to retrieve both the sinus and cosinus of a\n * given angle quickly.\n *\n * @output:\n * vec ::\n * The address of target vector.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n */\n FT_EXPORT( void )\n FT_Vector_Unit( FT_Vector* vec,\n FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_Rotate\n *\n * @description:\n * Rotate a vector by a given angle.\n *\n * @inout:\n * vec ::\n * The address of target vector.\n *\n * @input:\n * angle ::\n * The input angle.\n *\n */\n FT_EXPORT( void )\n FT_Vector_Rotate( FT_Vector* vec,\n FT_Angle angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_Length\n *\n * @description:\n * Return the length of a given vector.\n *\n * @input:\n * vec ::\n * The address of target vector.\n *\n * @return:\n * The vector length, expressed in the same units that the original\n * vector coordinates.\n *\n */\n FT_EXPORT( FT_Fixed )\n FT_Vector_Length( FT_Vector* vec );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_Polarize\n *\n * @description:\n * Compute both the length and angle of a given vector.\n *\n * @input:\n * vec ::\n * The address of source vector.\n *\n * @output:\n * length ::\n * The vector length.\n *\n * angle ::\n * The vector angle.\n *\n */\n FT_EXPORT( void )\n FT_Vector_Polarize( FT_Vector* vec,\n FT_Fixed *length,\n FT_Angle *angle );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Vector_From_Polar\n *\n * @description:\n * Compute vector coordinates from a length and angle.\n *\n * @output:\n * vec ::\n * The address of source vector.\n *\n * @input:\n * length ::\n * The vector length.\n *\n * angle ::\n * The vector angle.\n *\n */\n FT_EXPORT( void )\n FT_Vector_From_Polar( FT_Vector* vec,\n FT_Fixed length,\n FT_Angle angle );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTTRIGON_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/fttypes.h", "language": "code", "loc": 521, "comment_density": 0.848, "code": "/****************************************************************************\n *\n * fttypes.h\n *\n * FreeType simple types definitions (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTTYPES_H_\n#define FTTYPES_H_\n\n\n#include \n#include FT_CONFIG_CONFIG_H\n#include FT_SYSTEM_H\n#include FT_IMAGE_H\n\n#include \n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * basic_types\n *\n * @title:\n * Basic Data Types\n *\n * @abstract:\n * The basic data types defined by the library.\n *\n * @description:\n * This section contains the basic data types defined by FreeType~2,\n * ranging from simple scalar types to bitmap descriptors. More\n * font-specific structures are defined in a different section.\n *\n * @order:\n * FT_Byte\n * FT_Bytes\n * FT_Char\n * FT_Int\n * FT_UInt\n * FT_Int16\n * FT_UInt16\n * FT_Int32\n * FT_UInt32\n * FT_Int64\n * FT_UInt64\n * FT_Short\n * FT_UShort\n * FT_Long\n * FT_ULong\n * FT_Bool\n * FT_Offset\n * FT_PtrDist\n * FT_String\n * FT_Tag\n * FT_Error\n * FT_Fixed\n * FT_Pointer\n * FT_Pos\n * FT_Vector\n * FT_BBox\n * FT_Matrix\n * FT_FWord\n * FT_UFWord\n * FT_F2Dot14\n * FT_UnitVector\n * FT_F26Dot6\n * FT_Data\n *\n * FT_MAKE_TAG\n *\n * FT_Generic\n * FT_Generic_Finalizer\n *\n * FT_Bitmap\n * FT_Pixel_Mode\n * FT_Palette_Mode\n * FT_Glyph_Format\n * FT_IMAGE_TAG\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Bool\n *\n * @description:\n * A typedef of unsigned char, used for simple booleans. As usual,\n * values 1 and~0 represent true and false, respectively.\n */\n typedef unsigned char FT_Bool;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_FWord\n *\n * @description:\n * A signed 16-bit integer used to store a distance in original font\n * units.\n */\n typedef signed short FT_FWord; /* distance in FUnits */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UFWord\n *\n * @description:\n * An unsigned 16-bit integer used to store a distance in original font\n * units.\n */\n typedef unsigned short FT_UFWord; /* unsigned distance */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Char\n *\n * @description:\n * A simple typedef for the _signed_ char type.\n */\n typedef signed char FT_Char;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Byte\n *\n * @description:\n * A simple typedef for the _unsigned_ char type.\n */\n typedef unsigned char FT_Byte;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Bytes\n *\n * @description:\n * A typedef for constant memory areas.\n */\n typedef const FT_Byte* FT_Bytes;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Tag\n *\n * @description:\n * A typedef for 32-bit tags (as used in the SFNT format).\n */\n typedef FT_UInt32 FT_Tag;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_String\n *\n * @description:\n * A simple typedef for the char type, usually used for strings.\n */\n typedef char FT_String;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Short\n *\n * @description:\n * A typedef for signed short.\n */\n typedef signed short FT_Short;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UShort\n *\n * @description:\n * A typedef for unsigned short.\n */\n typedef unsigned short FT_UShort;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Int\n *\n * @description:\n * A typedef for the int type.\n */\n typedef signed int FT_Int;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UInt\n *\n * @description:\n * A typedef for the unsigned int type.\n */\n typedef unsigned int FT_UInt;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Long\n *\n * @description:\n * A typedef for signed long.\n */\n typedef signed long FT_Long;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_ULong\n *\n * @description:\n * A typedef for unsigned long.\n */\n typedef unsigned long FT_ULong;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_F2Dot14\n *\n * @description:\n * A signed 2.14 fixed-point type used for unit vectors.\n */\n typedef signed short FT_F2Dot14;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_F26Dot6\n *\n * @description:\n * A signed 26.6 fixed-point type used for vectorial pixel coordinates.\n */\n typedef signed long FT_F26Dot6;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Fixed\n *\n * @description:\n * This type is used to store 16.16 fixed-point values, like scaling\n * values or matrix coefficients.\n */\n typedef signed long FT_Fixed;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Error\n *\n * @description:\n * The FreeType error code type. A value of~0 is always interpreted as a\n * successful operation.\n */\n typedef int FT_Error;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Pointer\n *\n * @description:\n * A simple typedef for a typeless pointer.\n */\n typedef void* FT_Pointer;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Offset\n *\n * @description:\n * This is equivalent to the ANSI~C `size_t` type, i.e., the largest\n * _unsigned_ integer type used to express a file size or position, or a\n * memory block size.\n */\n typedef size_t FT_Offset;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_PtrDist\n *\n * @description:\n * This is equivalent to the ANSI~C `ptrdiff_t` type, i.e., the largest\n * _signed_ integer type used to express the distance between two\n * pointers.\n */\n typedef ft_ptrdiff_t FT_PtrDist;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_UnitVector\n *\n * @description:\n * A simple structure used to store a 2D vector unit vector. Uses\n * FT_F2Dot14 types.\n *\n * @fields:\n * x ::\n * Horizontal coordinate.\n *\n * y ::\n * Vertical coordinate.\n */\n typedef struct FT_UnitVector_\n {\n FT_F2Dot14 x;\n FT_F2Dot14 y;\n\n } FT_UnitVector;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Matrix\n *\n * @description:\n * A simple structure used to store a 2x2 matrix. Coefficients are in\n * 16.16 fixed-point format. The computation performed is:\n *\n * ```\n * x' = x*xx + y*xy\n * y' = x*yx + y*yy\n * ```\n *\n * @fields:\n * xx ::\n * Matrix coefficient.\n *\n * xy ::\n * Matrix coefficient.\n *\n * yx ::\n * Matrix coefficient.\n *\n * yy ::\n * Matrix coefficient.\n */\n typedef struct FT_Matrix_\n {\n FT_Fixed xx, xy;\n FT_Fixed yx, yy;\n\n } FT_Matrix;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Data\n *\n * @description:\n * Read-only binary data represented as a pointer and a length.\n *\n * @fields:\n * pointer ::\n * The data.\n *\n * length ::\n * The length of the data in bytes.\n */\n typedef struct FT_Data_\n {\n const FT_Byte* pointer;\n FT_Int length;\n\n } FT_Data;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_Generic_Finalizer\n *\n * @description:\n * Describe a function used to destroy the 'client' data of any FreeType\n * object. See the description of the @FT_Generic type for details of\n * usage.\n *\n * @input:\n * The address of the FreeType object that is under finalization. Its\n * client data is accessed through its `generic` field.\n */\n typedef void (*FT_Generic_Finalizer)( void* object );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Generic\n *\n * @description:\n * Client applications often need to associate their own data to a\n * variety of FreeType core objects. For example, a text layout API\n * might want to associate a glyph cache to a given size object.\n *\n * Some FreeType object contains a `generic` field, of type `FT_Generic`,\n * which usage is left to client applications and font servers.\n *\n * It can be used to store a pointer to client-specific data, as well as\n * the address of a 'finalizer' function, which will be called by\n * FreeType when the object is destroyed (for example, the previous\n * client example would put the address of the glyph cache destructor in\n * the `finalizer` field).\n *\n * @fields:\n * data ::\n * A typeless pointer to any client-specified data. This field is\n * completely ignored by the FreeType library.\n *\n * finalizer ::\n * A pointer to a 'generic finalizer' function, which will be called\n * when the object is destroyed. If this field is set to `NULL`, no\n * code will be called.\n */\n typedef struct FT_Generic_\n {\n void* data;\n FT_Generic_Finalizer finalizer;\n\n } FT_Generic;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MAKE_TAG\n *\n * @description:\n * This macro converts four-letter tags that are used to label TrueType\n * tables into an unsigned long, to be used within FreeType.\n *\n * @note:\n * The produced values **must** be 32-bit integers. Don't redefine this\n * macro.\n */\n#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \\\n (FT_Tag) \\\n ( ( (FT_ULong)_x1 << 24 ) | \\\n ( (FT_ULong)_x2 << 16 ) | \\\n ( (FT_ULong)_x3 << 8 ) | \\\n (FT_ULong)_x4 )\n\n\n /*************************************************************************/\n /*************************************************************************/\n /* */\n /* L I S T M A N A G E M E N T */\n /* */\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @section:\n * list_processing\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_ListNode\n *\n * @description:\n * Many elements and objects in FreeType are listed through an @FT_List\n * record (see @FT_ListRec). As its name suggests, an FT_ListNode is a\n * handle to a single list element.\n */\n typedef struct FT_ListNodeRec_* FT_ListNode;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_List\n *\n * @description:\n * A handle to a list record (see @FT_ListRec).\n */\n typedef struct FT_ListRec_* FT_List;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_ListNodeRec\n *\n * @description:\n * A structure used to hold a single list element.\n *\n * @fields:\n * prev ::\n * The previous element in the list. `NULL` if first.\n *\n * next ::\n * The next element in the list. `NULL` if last.\n *\n * data ::\n * A typeless pointer to the listed object.\n */\n typedef struct FT_ListNodeRec_\n {\n FT_ListNode prev;\n FT_ListNode next;\n void* data;\n\n } FT_ListNodeRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_ListRec\n *\n * @description:\n * A structure used to hold a simple doubly-linked list. These are used\n * in many parts of FreeType.\n *\n * @fields:\n * head ::\n * The head (first element) of doubly-linked list.\n *\n * tail ::\n * The tail (last element) of doubly-linked list.\n */\n typedef struct FT_ListRec_\n {\n FT_ListNode head;\n FT_ListNode tail;\n\n } FT_ListRec;\n\n /* */\n\n\n#define FT_IS_EMPTY( list ) ( (list).head == 0 )\n#define FT_BOOL( x ) ( (FT_Bool)( (x) != 0 ) )\n\n /* concatenate C tokens */\n#define FT_ERR_XCAT( x, y ) x ## y\n#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )\n\n /* see `ftmoderr.h` for descriptions of the following macros */\n\n#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )\n\n#define FT_ERROR_BASE( x ) ( (x) & 0xFF )\n#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )\n\n#define FT_ERR_EQ( x, e ) \\\n ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) )\n#define FT_ERR_NEQ( x, e ) \\\n ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) )\n\n\nFT_END_HEADER\n\n#endif /* FTTYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ftwinfnt.h", "language": "code", "loc": 251, "comment_density": 0.709, "code": "/****************************************************************************\n *\n * ftwinfnt.h\n *\n * FreeType API for accessing Windows fnt-specific data.\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTWINFNT_H_\n#define FTWINFNT_H_\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * winfnt_fonts\n *\n * @title:\n * Window FNT Files\n *\n * @abstract:\n * Windows FNT-specific API.\n *\n * @description:\n * This section contains the declaration of Windows FNT-specific\n * functions.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_WinFNT_ID_XXX\n *\n * @description:\n * A list of valid values for the `charset` byte in @FT_WinFNT_HeaderRec. \n * Exact mapping tables for the various 'cpXXXX' encodings (except for\n * 'cp1361') can be found at 'ftp://ftp.unicode.org/Public/' in the\n * `MAPPINGS/VENDORS/MICSFT/WINDOWS` subdirectory. 'cp1361' is roughly a\n * superset of `MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT`.\n *\n * @values:\n * FT_WinFNT_ID_DEFAULT ::\n * This is used for font enumeration and font creation as a 'don't\n * care' value. Valid font files don't contain this value. When\n * querying for information about the character set of the font that is\n * currently selected into a specified device context, this return\n * value (of the related Windows API) simply denotes failure.\n *\n * FT_WinFNT_ID_SYMBOL ::\n * There is no known mapping table available.\n *\n * FT_WinFNT_ID_MAC ::\n * Mac Roman encoding.\n *\n * FT_WinFNT_ID_OEM ::\n * From Michael Poettgen :\n *\n * The 'Windows Font Mapping' article says that `FT_WinFNT_ID_OEM` is\n * used for the charset of vector fonts, like `modern.fon`,\n * `roman.fon`, and `script.fon` on Windows.\n *\n * The 'CreateFont' documentation says: The `FT_WinFNT_ID_OEM` value\n * specifies a character set that is operating-system dependent.\n *\n * The 'IFIMETRICS' documentation from the 'Windows Driver Development\n * Kit' says: This font supports an OEM-specific character set. The\n * OEM character set is system dependent.\n *\n * In general OEM, as opposed to ANSI (i.e., 'cp1252'), denotes the\n * second default codepage that most international versions of Windows\n * have. It is one of the OEM codepages from\n *\n * https://docs.microsoft.com/en-us/windows/desktop/intl/code-page-identifiers\n * ,\n *\n * and is used for the 'DOS boxes', to support legacy applications. A\n * German Windows version for example usually uses ANSI codepage 1252\n * and OEM codepage 850.\n *\n * FT_WinFNT_ID_CP874 ::\n * A superset of Thai TIS 620 and ISO 8859-11.\n *\n * FT_WinFNT_ID_CP932 ::\n * A superset of Japanese Shift-JIS (with minor deviations).\n *\n * FT_WinFNT_ID_CP936 ::\n * A superset of simplified Chinese GB 2312-1980 (with different\n * ordering and minor deviations).\n *\n * FT_WinFNT_ID_CP949 ::\n * A superset of Korean Hangul KS~C 5601-1987 (with different ordering\n * and minor deviations).\n *\n * FT_WinFNT_ID_CP950 ::\n * A superset of traditional Chinese Big~5 ETen (with different\n * ordering and minor deviations).\n *\n * FT_WinFNT_ID_CP1250 ::\n * A superset of East European ISO 8859-2 (with slightly different\n * ordering).\n *\n * FT_WinFNT_ID_CP1251 ::\n * A superset of Russian ISO 8859-5 (with different ordering).\n *\n * FT_WinFNT_ID_CP1252 ::\n * ANSI encoding. A superset of ISO 8859-1.\n *\n * FT_WinFNT_ID_CP1253 ::\n * A superset of Greek ISO 8859-7 (with minor modifications).\n *\n * FT_WinFNT_ID_CP1254 ::\n * A superset of Turkish ISO 8859-9.\n *\n * FT_WinFNT_ID_CP1255 ::\n * A superset of Hebrew ISO 8859-8 (with some modifications).\n *\n * FT_WinFNT_ID_CP1256 ::\n * A superset of Arabic ISO 8859-6 (with different ordering).\n *\n * FT_WinFNT_ID_CP1257 ::\n * A superset of Baltic ISO 8859-13 (with some deviations).\n *\n * FT_WinFNT_ID_CP1258 ::\n * For Vietnamese. This encoding doesn't cover all necessary\n * characters.\n *\n * FT_WinFNT_ID_CP1361 ::\n * Korean (Johab).\n */\n\n#define FT_WinFNT_ID_CP1252 0\n#define FT_WinFNT_ID_DEFAULT 1\n#define FT_WinFNT_ID_SYMBOL 2\n#define FT_WinFNT_ID_MAC 77\n#define FT_WinFNT_ID_CP932 128\n#define FT_WinFNT_ID_CP949 129\n#define FT_WinFNT_ID_CP1361 130\n#define FT_WinFNT_ID_CP936 134\n#define FT_WinFNT_ID_CP950 136\n#define FT_WinFNT_ID_CP1253 161\n#define FT_WinFNT_ID_CP1254 162\n#define FT_WinFNT_ID_CP1258 163\n#define FT_WinFNT_ID_CP1255 177\n#define FT_WinFNT_ID_CP1256 178\n#define FT_WinFNT_ID_CP1257 186\n#define FT_WinFNT_ID_CP1251 204\n#define FT_WinFNT_ID_CP874 222\n#define FT_WinFNT_ID_CP1250 238\n#define FT_WinFNT_ID_OEM 255\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_WinFNT_HeaderRec\n *\n * @description:\n * Windows FNT Header info.\n */\n typedef struct FT_WinFNT_HeaderRec_\n {\n FT_UShort version;\n FT_ULong file_size;\n FT_Byte copyright[60];\n FT_UShort file_type;\n FT_UShort nominal_point_size;\n FT_UShort vertical_resolution;\n FT_UShort horizontal_resolution;\n FT_UShort ascent;\n FT_UShort internal_leading;\n FT_UShort external_leading;\n FT_Byte italic;\n FT_Byte underline;\n FT_Byte strike_out;\n FT_UShort weight;\n FT_Byte charset;\n FT_UShort pixel_width;\n FT_UShort pixel_height;\n FT_Byte pitch_and_family;\n FT_UShort avg_width;\n FT_UShort max_width;\n FT_Byte first_char;\n FT_Byte last_char;\n FT_Byte default_char;\n FT_Byte break_char;\n FT_UShort bytes_per_row;\n FT_ULong device_offset;\n FT_ULong face_name_offset;\n FT_ULong bits_pointer;\n FT_ULong bits_offset;\n FT_Byte reserved;\n FT_ULong flags;\n FT_UShort A_space;\n FT_UShort B_space;\n FT_UShort C_space;\n FT_UShort color_table_offset;\n FT_ULong reserved1[4];\n\n } FT_WinFNT_HeaderRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_WinFNT_Header\n *\n * @description:\n * A handle to an @FT_WinFNT_HeaderRec structure.\n */\n typedef struct FT_WinFNT_HeaderRec_* FT_WinFNT_Header;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_WinFNT_Header\n *\n * @description:\n * Retrieve a Windows FNT font info header.\n *\n * @input:\n * face ::\n * A handle to the input face.\n *\n * @output:\n * aheader ::\n * The WinFNT header.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * This function only works with Windows FNT faces, returning an error\n * otherwise.\n */\n FT_EXPORT( FT_Error )\n FT_Get_WinFNT_Header( FT_Face face,\n FT_WinFNT_HeaderRec *aheader );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTWINFNT_H_ */\n\n\n/* END */\n\n\n/* Local Variables: */\n/* coding: utf-8 */\n/* End: */\n"}, {"path": "includes/freetype/t1tables.h", "language": "code", "loc": 667, "comment_density": 0.735, "code": "/****************************************************************************\n *\n * t1tables.h\n *\n * Basic Type 1/Type 2 tables definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef T1TABLES_H_\n#define T1TABLES_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * type1_tables\n *\n * @title:\n * Type 1 Tables\n *\n * @abstract:\n * Type~1-specific font tables.\n *\n * @description:\n * This section contains the definition of Type~1-specific tables,\n * including structures related to other PostScript font formats.\n *\n * @order:\n * PS_FontInfoRec\n * PS_FontInfo\n * PS_PrivateRec\n * PS_Private\n *\n * CID_FaceDictRec\n * CID_FaceDict\n * CID_FaceInfoRec\n * CID_FaceInfo\n *\n * FT_Has_PS_Glyph_Names\n * FT_Get_PS_Font_Info\n * FT_Get_PS_Font_Private\n * FT_Get_PS_Font_Value\n *\n * T1_Blend_Flags\n * T1_EncodingType\n * PS_Dict_Keys\n *\n */\n\n\n /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */\n /* structures in order to support Multiple Master fonts. */\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_FontInfoRec\n *\n * @description:\n * A structure used to model a Type~1 or Type~2 FontInfo dictionary.\n * Note that for Multiple Master fonts, each instance has its own\n * FontInfo dictionary.\n */\n typedef struct PS_FontInfoRec_\n {\n FT_String* version;\n FT_String* notice;\n FT_String* full_name;\n FT_String* family_name;\n FT_String* weight;\n FT_Long italic_angle;\n FT_Bool is_fixed_pitch;\n FT_Short underline_position;\n FT_UShort underline_thickness;\n\n } PS_FontInfoRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_FontInfo\n *\n * @description:\n * A handle to a @PS_FontInfoRec structure.\n */\n typedef struct PS_FontInfoRec_* PS_FontInfo;\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_FontInfo\n *\n * @description:\n * This type is equivalent to @PS_FontInfoRec. It is deprecated but kept\n * to maintain source compatibility between various versions of FreeType.\n */\n typedef PS_FontInfoRec T1_FontInfo;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_PrivateRec\n *\n * @description:\n * A structure used to model a Type~1 or Type~2 private dictionary. Note\n * that for Multiple Master fonts, each instance has its own Private\n * dictionary.\n */\n typedef struct PS_PrivateRec_\n {\n FT_Int unique_id;\n FT_Int lenIV;\n\n FT_Byte num_blue_values;\n FT_Byte num_other_blues;\n FT_Byte num_family_blues;\n FT_Byte num_family_other_blues;\n\n FT_Short blue_values[14];\n FT_Short other_blues[10];\n\n FT_Short family_blues [14];\n FT_Short family_other_blues[10];\n\n FT_Fixed blue_scale;\n FT_Int blue_shift;\n FT_Int blue_fuzz;\n\n FT_UShort standard_width[1];\n FT_UShort standard_height[1];\n\n FT_Byte num_snap_widths;\n FT_Byte num_snap_heights;\n FT_Bool force_bold;\n FT_Bool round_stem_up;\n\n FT_Short snap_widths [13]; /* including std width */\n FT_Short snap_heights[13]; /* including std height */\n\n FT_Fixed expansion_factor;\n\n FT_Long language_group;\n FT_Long password;\n\n FT_Short min_feature[2];\n\n } PS_PrivateRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_Private\n *\n * @description:\n * A handle to a @PS_PrivateRec structure.\n */\n typedef struct PS_PrivateRec_* PS_Private;\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_Private\n *\n * @description:\n * This type is equivalent to @PS_PrivateRec. It is deprecated but kept\n * to maintain source compatibility between various versions of FreeType.\n */\n typedef PS_PrivateRec T1_Private;\n\n\n /**************************************************************************\n *\n * @enum:\n * T1_Blend_Flags\n *\n * @description:\n * A set of flags used to indicate which fields are present in a given\n * blend dictionary (font info or private). Used to support Multiple\n * Masters fonts.\n *\n * @values:\n * T1_BLEND_UNDERLINE_POSITION ::\n * T1_BLEND_UNDERLINE_THICKNESS ::\n * T1_BLEND_ITALIC_ANGLE ::\n * T1_BLEND_BLUE_VALUES ::\n * T1_BLEND_OTHER_BLUES ::\n * T1_BLEND_STANDARD_WIDTH ::\n * T1_BLEND_STANDARD_HEIGHT ::\n * T1_BLEND_STEM_SNAP_WIDTHS ::\n * T1_BLEND_STEM_SNAP_HEIGHTS ::\n * T1_BLEND_BLUE_SCALE ::\n * T1_BLEND_BLUE_SHIFT ::\n * T1_BLEND_FAMILY_BLUES ::\n * T1_BLEND_FAMILY_OTHER_BLUES ::\n * T1_BLEND_FORCE_BOLD ::\n */\n typedef enum T1_Blend_Flags_\n {\n /* required fields in a FontInfo blend dictionary */\n T1_BLEND_UNDERLINE_POSITION = 0,\n T1_BLEND_UNDERLINE_THICKNESS,\n T1_BLEND_ITALIC_ANGLE,\n\n /* required fields in a Private blend dictionary */\n T1_BLEND_BLUE_VALUES,\n T1_BLEND_OTHER_BLUES,\n T1_BLEND_STANDARD_WIDTH,\n T1_BLEND_STANDARD_HEIGHT,\n T1_BLEND_STEM_SNAP_WIDTHS,\n T1_BLEND_STEM_SNAP_HEIGHTS,\n T1_BLEND_BLUE_SCALE,\n T1_BLEND_BLUE_SHIFT,\n T1_BLEND_FAMILY_BLUES,\n T1_BLEND_FAMILY_OTHER_BLUES,\n T1_BLEND_FORCE_BOLD,\n\n T1_BLEND_MAX /* do not remove */\n\n } T1_Blend_Flags;\n\n\n /* these constants are deprecated; use the corresponding */\n /* `T1_Blend_Flags` values instead */\n#define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION\n#define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS\n#define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE\n#define t1_blend_blue_values T1_BLEND_BLUE_VALUES\n#define t1_blend_other_blues T1_BLEND_OTHER_BLUES\n#define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH\n#define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT\n#define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS\n#define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS\n#define t1_blend_blue_scale T1_BLEND_BLUE_SCALE\n#define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT\n#define t1_blend_family_blues T1_BLEND_FAMILY_BLUES\n#define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES\n#define t1_blend_force_bold T1_BLEND_FORCE_BOLD\n#define t1_blend_max T1_BLEND_MAX\n\n /* */\n\n\n /* maximum number of Multiple Masters designs, as defined in the spec */\n#define T1_MAX_MM_DESIGNS 16\n\n /* maximum number of Multiple Masters axes, as defined in the spec */\n#define T1_MAX_MM_AXIS 4\n\n /* maximum number of elements in a design map */\n#define T1_MAX_MM_MAP_POINTS 20\n\n\n /* this structure is used to store the BlendDesignMap entry for an axis */\n typedef struct PS_DesignMap_\n {\n FT_Byte num_points;\n FT_Long* design_points;\n FT_Fixed* blend_points;\n\n } PS_DesignMapRec, *PS_DesignMap;\n\n /* backward compatible definition */\n typedef PS_DesignMapRec T1_DesignMap;\n\n\n typedef struct PS_BlendRec_\n {\n FT_UInt num_designs;\n FT_UInt num_axis;\n\n FT_String* axis_names[T1_MAX_MM_AXIS];\n FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];\n PS_DesignMapRec design_map[T1_MAX_MM_AXIS];\n\n FT_Fixed* weight_vector;\n FT_Fixed* default_weight_vector;\n\n PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1];\n PS_Private privates [T1_MAX_MM_DESIGNS + 1];\n\n FT_ULong blend_bitflags;\n\n FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1];\n\n /* since 2.3.0 */\n\n /* undocumented, optional: the default design instance; */\n /* corresponds to default_weight_vector -- */\n /* num_default_design_vector == 0 means it is not present */\n /* in the font and associated metrics files */\n FT_UInt default_design_vector[T1_MAX_MM_DESIGNS];\n FT_UInt num_default_design_vector;\n\n } PS_BlendRec, *PS_Blend;\n\n\n /* backward compatible definition */\n typedef PS_BlendRec T1_Blend;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FaceDictRec\n *\n * @description:\n * A structure used to represent data in a CID top-level dictionary. In\n * most cases, they are part of the font's '/FDArray' array. Within a\n * CID font file, such (internal) subfont dictionaries are enclosed by\n * '%ADOBeginFontDict' and '%ADOEndFontDict' comments.\n *\n * Note that `CID_FaceDictRec` misses a field for the '/FontName'\n * keyword, specifying the subfont's name (the top-level font name is\n * given by the '/CIDFontName' keyword). This is an oversight, but it\n * doesn't limit the 'cid' font module's functionality because FreeType\n * neither needs this entry nor gives access to CID subfonts.\n */\n typedef struct CID_FaceDictRec_\n {\n PS_PrivateRec private_dict;\n\n FT_UInt len_buildchar;\n FT_Fixed forcebold_threshold;\n FT_Pos stroke_width;\n FT_Fixed expansion_factor; /* this is a duplicate of */\n /* `private_dict->expansion_factor' */\n FT_Byte paint_type;\n FT_Byte font_type;\n FT_Matrix font_matrix;\n FT_Vector font_offset;\n\n FT_UInt num_subrs;\n FT_ULong subrmap_offset;\n FT_Int sd_bytes;\n\n } CID_FaceDictRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FaceDict\n *\n * @description:\n * A handle to a @CID_FaceDictRec structure.\n */\n typedef struct CID_FaceDictRec_* CID_FaceDict;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FontDict\n *\n * @description:\n * This type is equivalent to @CID_FaceDictRec. It is deprecated but\n * kept to maintain source compatibility between various versions of\n * FreeType.\n */\n typedef CID_FaceDictRec CID_FontDict;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FaceInfoRec\n *\n * @description:\n * A structure used to represent CID Face information.\n */\n typedef struct CID_FaceInfoRec_\n {\n FT_String* cid_font_name;\n FT_Fixed cid_version;\n FT_Int cid_font_type;\n\n FT_String* registry;\n FT_String* ordering;\n FT_Int supplement;\n\n PS_FontInfoRec font_info;\n FT_BBox font_bbox;\n FT_ULong uid_base;\n\n FT_Int num_xuid;\n FT_ULong xuid[16];\n\n FT_ULong cidmap_offset;\n FT_Int fd_bytes;\n FT_Int gd_bytes;\n FT_ULong cid_count;\n\n FT_Int num_dicts;\n CID_FaceDict font_dicts;\n\n FT_ULong data_offset;\n\n } CID_FaceInfoRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_FaceInfo\n *\n * @description:\n * A handle to a @CID_FaceInfoRec structure.\n */\n typedef struct CID_FaceInfoRec_* CID_FaceInfo;\n\n\n /**************************************************************************\n *\n * @struct:\n * CID_Info\n *\n * @description:\n * This type is equivalent to @CID_FaceInfoRec. It is deprecated but kept\n * to maintain source compatibility between various versions of FreeType.\n */\n typedef CID_FaceInfoRec CID_Info;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Has_PS_Glyph_Names\n *\n * @description:\n * Return true if a given face provides reliable PostScript glyph names.\n * This is similar to using the @FT_HAS_GLYPH_NAMES macro, except that\n * certain fonts (mostly TrueType) contain incorrect glyph name tables.\n *\n * When this function returns true, the caller is sure that the glyph\n * names returned by @FT_Get_Glyph_Name are reliable.\n *\n * @input:\n * face ::\n * face handle\n *\n * @return:\n * Boolean. True if glyph names are reliable.\n *\n */\n FT_EXPORT( FT_Int )\n FT_Has_PS_Glyph_Names( FT_Face face );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PS_Font_Info\n *\n * @description:\n * Retrieve the @PS_FontInfoRec structure corresponding to a given\n * PostScript font.\n *\n * @input:\n * face ::\n * PostScript face handle.\n *\n * @output:\n * afont_info ::\n * Output font info structure pointer.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * String pointers within the @PS_FontInfoRec structure are owned by the\n * face and don't need to be freed by the caller. Missing entries in\n * the font's FontInfo dictionary are represented by `NULL` pointers.\n *\n * If the font's format is not PostScript-based, this function will\n * return the `FT_Err_Invalid_Argument` error code.\n *\n */\n FT_EXPORT( FT_Error )\n FT_Get_PS_Font_Info( FT_Face face,\n PS_FontInfo afont_info );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PS_Font_Private\n *\n * @description:\n * Retrieve the @PS_PrivateRec structure corresponding to a given\n * PostScript font.\n *\n * @input:\n * face ::\n * PostScript face handle.\n *\n * @output:\n * afont_private ::\n * Output private dictionary structure pointer.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * The string pointers within the @PS_PrivateRec structure are owned by\n * the face and don't need to be freed by the caller.\n *\n * If the font's format is not PostScript-based, this function returns\n * the `FT_Err_Invalid_Argument` error code.\n *\n */\n FT_EXPORT( FT_Error )\n FT_Get_PS_Font_Private( FT_Face face,\n PS_Private afont_private );\n\n\n /**************************************************************************\n *\n * @enum:\n * T1_EncodingType\n *\n * @description:\n * An enumeration describing the 'Encoding' entry in a Type 1 dictionary.\n *\n * @values:\n * T1_ENCODING_TYPE_NONE ::\n * T1_ENCODING_TYPE_ARRAY ::\n * T1_ENCODING_TYPE_STANDARD ::\n * T1_ENCODING_TYPE_ISOLATIN1 ::\n * T1_ENCODING_TYPE_EXPERT ::\n *\n * @since:\n * 2.4.8\n */\n typedef enum T1_EncodingType_\n {\n T1_ENCODING_TYPE_NONE = 0,\n T1_ENCODING_TYPE_ARRAY,\n T1_ENCODING_TYPE_STANDARD,\n T1_ENCODING_TYPE_ISOLATIN1,\n T1_ENCODING_TYPE_EXPERT\n\n } T1_EncodingType;\n\n\n /**************************************************************************\n *\n * @enum:\n * PS_Dict_Keys\n *\n * @description:\n * An enumeration used in calls to @FT_Get_PS_Font_Value to identify the\n * Type~1 dictionary entry to retrieve.\n *\n * @values:\n * PS_DICT_FONT_TYPE ::\n * PS_DICT_FONT_MATRIX ::\n * PS_DICT_FONT_BBOX ::\n * PS_DICT_PAINT_TYPE ::\n * PS_DICT_FONT_NAME ::\n * PS_DICT_UNIQUE_ID ::\n * PS_DICT_NUM_CHAR_STRINGS ::\n * PS_DICT_CHAR_STRING_KEY ::\n * PS_DICT_CHAR_STRING ::\n * PS_DICT_ENCODING_TYPE ::\n * PS_DICT_ENCODING_ENTRY ::\n * PS_DICT_NUM_SUBRS ::\n * PS_DICT_SUBR ::\n * PS_DICT_STD_HW ::\n * PS_DICT_STD_VW ::\n * PS_DICT_NUM_BLUE_VALUES ::\n * PS_DICT_BLUE_VALUE ::\n * PS_DICT_BLUE_FUZZ ::\n * PS_DICT_NUM_OTHER_BLUES ::\n * PS_DICT_OTHER_BLUE ::\n * PS_DICT_NUM_FAMILY_BLUES ::\n * PS_DICT_FAMILY_BLUE ::\n * PS_DICT_NUM_FAMILY_OTHER_BLUES ::\n * PS_DICT_FAMILY_OTHER_BLUE ::\n * PS_DICT_BLUE_SCALE ::\n * PS_DICT_BLUE_SHIFT ::\n * PS_DICT_NUM_STEM_SNAP_H ::\n * PS_DICT_STEM_SNAP_H ::\n * PS_DICT_NUM_STEM_SNAP_V ::\n * PS_DICT_STEM_SNAP_V ::\n * PS_DICT_FORCE_BOLD ::\n * PS_DICT_RND_STEM_UP ::\n * PS_DICT_MIN_FEATURE ::\n * PS_DICT_LEN_IV ::\n * PS_DICT_PASSWORD ::\n * PS_DICT_LANGUAGE_GROUP ::\n * PS_DICT_VERSION ::\n * PS_DICT_NOTICE ::\n * PS_DICT_FULL_NAME ::\n * PS_DICT_FAMILY_NAME ::\n * PS_DICT_WEIGHT ::\n * PS_DICT_IS_FIXED_PITCH ::\n * PS_DICT_UNDERLINE_POSITION ::\n * PS_DICT_UNDERLINE_THICKNESS ::\n * PS_DICT_FS_TYPE ::\n * PS_DICT_ITALIC_ANGLE ::\n *\n * @since:\n * 2.4.8\n */\n typedef enum PS_Dict_Keys_\n {\n /* conventionally in the font dictionary */\n PS_DICT_FONT_TYPE, /* FT_Byte */\n PS_DICT_FONT_MATRIX, /* FT_Fixed */\n PS_DICT_FONT_BBOX, /* FT_Fixed */\n PS_DICT_PAINT_TYPE, /* FT_Byte */\n PS_DICT_FONT_NAME, /* FT_String* */\n PS_DICT_UNIQUE_ID, /* FT_Int */\n PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */\n PS_DICT_CHAR_STRING_KEY, /* FT_String* */\n PS_DICT_CHAR_STRING, /* FT_String* */\n PS_DICT_ENCODING_TYPE, /* T1_EncodingType */\n PS_DICT_ENCODING_ENTRY, /* FT_String* */\n\n /* conventionally in the font Private dictionary */\n PS_DICT_NUM_SUBRS, /* FT_Int */\n PS_DICT_SUBR, /* FT_String* */\n PS_DICT_STD_HW, /* FT_UShort */\n PS_DICT_STD_VW, /* FT_UShort */\n PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */\n PS_DICT_BLUE_VALUE, /* FT_Short */\n PS_DICT_BLUE_FUZZ, /* FT_Int */\n PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */\n PS_DICT_OTHER_BLUE, /* FT_Short */\n PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */\n PS_DICT_FAMILY_BLUE, /* FT_Short */\n PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */\n PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */\n PS_DICT_BLUE_SCALE, /* FT_Fixed */\n PS_DICT_BLUE_SHIFT, /* FT_Int */\n PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */\n PS_DICT_STEM_SNAP_H, /* FT_Short */\n PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */\n PS_DICT_STEM_SNAP_V, /* FT_Short */\n PS_DICT_FORCE_BOLD, /* FT_Bool */\n PS_DICT_RND_STEM_UP, /* FT_Bool */\n PS_DICT_MIN_FEATURE, /* FT_Short */\n PS_DICT_LEN_IV, /* FT_Int */\n PS_DICT_PASSWORD, /* FT_Long */\n PS_DICT_LANGUAGE_GROUP, /* FT_Long */\n\n /* conventionally in the font FontInfo dictionary */\n PS_DICT_VERSION, /* FT_String* */\n PS_DICT_NOTICE, /* FT_String* */\n PS_DICT_FULL_NAME, /* FT_String* */\n PS_DICT_FAMILY_NAME, /* FT_String* */\n PS_DICT_WEIGHT, /* FT_String* */\n PS_DICT_IS_FIXED_PITCH, /* FT_Bool */\n PS_DICT_UNDERLINE_POSITION, /* FT_Short */\n PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */\n PS_DICT_FS_TYPE, /* FT_UShort */\n PS_DICT_ITALIC_ANGLE, /* FT_Long */\n\n PS_DICT_MAX = PS_DICT_ITALIC_ANGLE\n\n } PS_Dict_Keys;\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_PS_Font_Value\n *\n * @description:\n * Retrieve the value for the supplied key from a PostScript font.\n *\n * @input:\n * face ::\n * PostScript face handle.\n *\n * key ::\n * An enumeration value representing the dictionary key to retrieve.\n *\n * idx ::\n * For array values, this specifies the index to be returned.\n *\n * value ::\n * A pointer to memory into which to write the value.\n *\n * valen_len ::\n * The size, in bytes, of the memory supplied for the value.\n *\n * @output:\n * value ::\n * The value matching the above key, if it exists.\n *\n * @return:\n * The amount of memory (in bytes) required to hold the requested value\n * (if it exists, -1 otherwise).\n *\n * @note:\n * The values returned are not pointers into the internal structures of\n * the face, but are 'fresh' copies, so that the memory containing them\n * belongs to the calling application. This also enforces the\n * 'read-only' nature of these values, i.e., this function cannot be\n * used to manipulate the face.\n *\n * `value` is a void pointer because the values returned can be of\n * various types.\n *\n * If either `value` is `NULL` or `value_len` is too small, just the\n * required memory size for the requested entry is returned.\n *\n * The `idx` parameter is used, not only to retrieve elements of, for\n * example, the FontMatrix or FontBBox, but also to retrieve name keys\n * from the CharStrings dictionary, and the charstrings themselves. It\n * is ignored for atomic values.\n *\n * `PS_DICT_BLUE_SCALE` returns a value that is scaled up by 1000. To\n * get the value as in the font stream, you need to divide by 65536000.0\n * (to remove the FT_Fixed scale, and the x1000 scale).\n *\n * IMPORTANT: Only key/value pairs read by the FreeType interpreter can\n * be retrieved. So, for example, PostScript procedures such as NP, ND,\n * and RD are not available. Arbitrary keys are, obviously, not be\n * available either.\n *\n * If the font's format is not PostScript-based, this function returns\n * the `FT_Err_Invalid_Argument` error code.\n *\n * @since:\n * 2.4.8\n *\n */\n FT_EXPORT( FT_Long )\n FT_Get_PS_Font_Value( FT_Face face,\n PS_Dict_Keys key,\n FT_UInt idx,\n void *value,\n FT_Long value_len );\n\n /* */\n\nFT_END_HEADER\n\n#endif /* T1TABLES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/ttnameid.h", "language": "code", "loc": 1168, "comment_density": 0.543, "code": "/****************************************************************************\n *\n * ttnameid.h\n *\n * TrueType name ID definitions (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef TTNAMEID_H_\n#define TTNAMEID_H_\n\n\n#include \n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @section:\n * truetype_tables\n */\n\n\n /**************************************************************************\n *\n * Possible values for the 'platform' identifier code in the name records\n * of an SFNT 'name' table.\n *\n */\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_PLATFORM_XXX\n *\n * @description:\n * A list of valid values for the `platform_id` identifier code in\n * @FT_CharMapRec and @FT_SfntName structures.\n *\n * @values:\n * TT_PLATFORM_APPLE_UNICODE ::\n * Used by Apple to indicate a Unicode character map and/or name entry.\n * See @TT_APPLE_ID_XXX for corresponding `encoding_id` values. Note\n * that name entries in this format are coded as big-endian UCS-2\n * character codes _only_.\n *\n * TT_PLATFORM_MACINTOSH ::\n * Used by Apple to indicate a MacOS-specific charmap and/or name\n * entry. See @TT_MAC_ID_XXX for corresponding `encoding_id` values.\n * Note that most TrueType fonts contain an Apple roman charmap to be\n * usable on MacOS systems (even if they contain a Microsoft charmap as\n * well).\n *\n * TT_PLATFORM_ISO ::\n * This value was used to specify ISO/IEC 10646 charmaps. It is\n * however now deprecated. See @TT_ISO_ID_XXX for a list of\n * corresponding `encoding_id` values.\n *\n * TT_PLATFORM_MICROSOFT ::\n * Used by Microsoft to indicate Windows-specific charmaps. See\n * @TT_MS_ID_XXX for a list of corresponding `encoding_id` values.\n * Note that most fonts contain a Unicode charmap using\n * (`TT_PLATFORM_MICROSOFT`, @TT_MS_ID_UNICODE_CS).\n *\n * TT_PLATFORM_CUSTOM ::\n * Used to indicate application-specific charmaps.\n *\n * TT_PLATFORM_ADOBE ::\n * This value isn't part of any font format specification, but is used\n * by FreeType to report Adobe-specific charmaps in an @FT_CharMapRec\n * structure. See @TT_ADOBE_ID_XXX.\n */\n\n#define TT_PLATFORM_APPLE_UNICODE 0\n#define TT_PLATFORM_MACINTOSH 1\n#define TT_PLATFORM_ISO 2 /* deprecated */\n#define TT_PLATFORM_MICROSOFT 3\n#define TT_PLATFORM_CUSTOM 4\n#define TT_PLATFORM_ADOBE 7 /* artificial */\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_APPLE_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for\n * @TT_PLATFORM_APPLE_UNICODE charmaps and name entries.\n *\n * @values:\n * TT_APPLE_ID_DEFAULT ::\n * Unicode version 1.0.\n *\n * TT_APPLE_ID_UNICODE_1_1 ::\n * Unicode 1.1; specifies Hangul characters starting at U+34xx.\n *\n * TT_APPLE_ID_ISO_10646 ::\n * Deprecated (identical to preceding).\n *\n * TT_APPLE_ID_UNICODE_2_0 ::\n * Unicode 2.0 and beyond (UTF-16 BMP only).\n *\n * TT_APPLE_ID_UNICODE_32 ::\n * Unicode 3.1 and beyond, using UTF-32.\n *\n * TT_APPLE_ID_VARIANT_SELECTOR ::\n * From Adobe, not Apple. Not a normal cmap. Specifies variations on\n * a real cmap.\n *\n * TT_APPLE_ID_FULL_UNICODE ::\n * Used for fallback fonts that provide complete Unicode coverage with\n * a type~13 cmap.\n */\n\n#define TT_APPLE_ID_DEFAULT 0 /* Unicode 1.0 */\n#define TT_APPLE_ID_UNICODE_1_1 1 /* specify Hangul at U+34xx */\n#define TT_APPLE_ID_ISO_10646 2 /* deprecated */\n#define TT_APPLE_ID_UNICODE_2_0 3 /* or later */\n#define TT_APPLE_ID_UNICODE_32 4 /* 2.0 or later, full repertoire */\n#define TT_APPLE_ID_VARIANT_SELECTOR 5 /* variation selector data */\n#define TT_APPLE_ID_FULL_UNICODE 6 /* used with type 13 cmaps */\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_MAC_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for\n * @TT_PLATFORM_MACINTOSH charmaps and name entries.\n */\n\n#define TT_MAC_ID_ROMAN 0\n#define TT_MAC_ID_JAPANESE 1\n#define TT_MAC_ID_TRADITIONAL_CHINESE 2\n#define TT_MAC_ID_KOREAN 3\n#define TT_MAC_ID_ARABIC 4\n#define TT_MAC_ID_HEBREW 5\n#define TT_MAC_ID_GREEK 6\n#define TT_MAC_ID_RUSSIAN 7\n#define TT_MAC_ID_RSYMBOL 8\n#define TT_MAC_ID_DEVANAGARI 9\n#define TT_MAC_ID_GURMUKHI 10\n#define TT_MAC_ID_GUJARATI 11\n#define TT_MAC_ID_ORIYA 12\n#define TT_MAC_ID_BENGALI 13\n#define TT_MAC_ID_TAMIL 14\n#define TT_MAC_ID_TELUGU 15\n#define TT_MAC_ID_KANNADA 16\n#define TT_MAC_ID_MALAYALAM 17\n#define TT_MAC_ID_SINHALESE 18\n#define TT_MAC_ID_BURMESE 19\n#define TT_MAC_ID_KHMER 20\n#define TT_MAC_ID_THAI 21\n#define TT_MAC_ID_LAOTIAN 22\n#define TT_MAC_ID_GEORGIAN 23\n#define TT_MAC_ID_ARMENIAN 24\n#define TT_MAC_ID_MALDIVIAN 25\n#define TT_MAC_ID_SIMPLIFIED_CHINESE 25\n#define TT_MAC_ID_TIBETAN 26\n#define TT_MAC_ID_MONGOLIAN 27\n#define TT_MAC_ID_GEEZ 28\n#define TT_MAC_ID_SLAVIC 29\n#define TT_MAC_ID_VIETNAMESE 30\n#define TT_MAC_ID_SINDHI 31\n#define TT_MAC_ID_UNINTERP 32\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_ISO_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for @TT_PLATFORM_ISO\n * charmaps and name entries.\n *\n * Their use is now deprecated.\n *\n * @values:\n * TT_ISO_ID_7BIT_ASCII ::\n * ASCII.\n * TT_ISO_ID_10646 ::\n * ISO/10646.\n * TT_ISO_ID_8859_1 ::\n * Also known as Latin-1.\n */\n\n#define TT_ISO_ID_7BIT_ASCII 0\n#define TT_ISO_ID_10646 1\n#define TT_ISO_ID_8859_1 2\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_MS_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for\n * @TT_PLATFORM_MICROSOFT charmaps and name entries.\n *\n * @values:\n * TT_MS_ID_SYMBOL_CS ::\n * Microsoft symbol encoding. See @FT_ENCODING_MS_SYMBOL.\n *\n * TT_MS_ID_UNICODE_CS ::\n * Microsoft WGL4 charmap, matching Unicode. See @FT_ENCODING_UNICODE.\n *\n * TT_MS_ID_SJIS ::\n * Shift JIS Japanese encoding. See @FT_ENCODING_SJIS.\n *\n * TT_MS_ID_PRC ::\n * Chinese encodings as used in the People's Republic of China (PRC).\n * This means the encodings GB~2312 and its supersets GBK and GB~18030.\n * See @FT_ENCODING_PRC.\n *\n * TT_MS_ID_BIG_5 ::\n * Traditional Chinese as used in Taiwan and Hong Kong. See\n * @FT_ENCODING_BIG5.\n *\n * TT_MS_ID_WANSUNG ::\n * Korean Extended Wansung encoding. See @FT_ENCODING_WANSUNG.\n *\n * TT_MS_ID_JOHAB ::\n * Korean Johab encoding. See @FT_ENCODING_JOHAB.\n *\n * TT_MS_ID_UCS_4 ::\n * UCS-4 or UTF-32 charmaps. This has been added to the OpenType\n * specification version 1.4 (mid-2001).\n */\n\n#define TT_MS_ID_SYMBOL_CS 0\n#define TT_MS_ID_UNICODE_CS 1\n#define TT_MS_ID_SJIS 2\n#define TT_MS_ID_PRC 3\n#define TT_MS_ID_BIG_5 4\n#define TT_MS_ID_WANSUNG 5\n#define TT_MS_ID_JOHAB 6\n#define TT_MS_ID_UCS_4 10\n\n /* this value is deprecated */\n#define TT_MS_ID_GB2312 TT_MS_ID_PRC\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_ADOBE_ID_XXX\n *\n * @description:\n * A list of valid values for the `encoding_id` for @TT_PLATFORM_ADOBE\n * charmaps. This is a FreeType-specific extension!\n *\n * @values:\n * TT_ADOBE_ID_STANDARD ::\n * Adobe standard encoding.\n * TT_ADOBE_ID_EXPERT ::\n * Adobe expert encoding.\n * TT_ADOBE_ID_CUSTOM ::\n * Adobe custom encoding.\n * TT_ADOBE_ID_LATIN_1 ::\n * Adobe Latin~1 encoding.\n */\n\n#define TT_ADOBE_ID_STANDARD 0\n#define TT_ADOBE_ID_EXPERT 1\n#define TT_ADOBE_ID_CUSTOM 2\n#define TT_ADOBE_ID_LATIN_1 3\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_MAC_LANGID_XXX\n *\n * @description:\n * Possible values of the language identifier field in the name records\n * of the SFNT 'name' table if the 'platform' identifier code is\n * @TT_PLATFORM_MACINTOSH. These values are also used as return values\n * for function @FT_Get_CMap_Language_ID.\n *\n * The canonical source for Apple's IDs is\n *\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html\n */\n\n#define TT_MAC_LANGID_ENGLISH 0\n#define TT_MAC_LANGID_FRENCH 1\n#define TT_MAC_LANGID_GERMAN 2\n#define TT_MAC_LANGID_ITALIAN 3\n#define TT_MAC_LANGID_DUTCH 4\n#define TT_MAC_LANGID_SWEDISH 5\n#define TT_MAC_LANGID_SPANISH 6\n#define TT_MAC_LANGID_DANISH 7\n#define TT_MAC_LANGID_PORTUGUESE 8\n#define TT_MAC_LANGID_NORWEGIAN 9\n#define TT_MAC_LANGID_HEBREW 10\n#define TT_MAC_LANGID_JAPANESE 11\n#define TT_MAC_LANGID_ARABIC 12\n#define TT_MAC_LANGID_FINNISH 13\n#define TT_MAC_LANGID_GREEK 14\n#define TT_MAC_LANGID_ICELANDIC 15\n#define TT_MAC_LANGID_MALTESE 16\n#define TT_MAC_LANGID_TURKISH 17\n#define TT_MAC_LANGID_CROATIAN 18\n#define TT_MAC_LANGID_CHINESE_TRADITIONAL 19\n#define TT_MAC_LANGID_URDU 20\n#define TT_MAC_LANGID_HINDI 21\n#define TT_MAC_LANGID_THAI 22\n#define TT_MAC_LANGID_KOREAN 23\n#define TT_MAC_LANGID_LITHUANIAN 24\n#define TT_MAC_LANGID_POLISH 25\n#define TT_MAC_LANGID_HUNGARIAN 26\n#define TT_MAC_LANGID_ESTONIAN 27\n#define TT_MAC_LANGID_LETTISH 28\n#define TT_MAC_LANGID_SAAMISK 29\n#define TT_MAC_LANGID_FAEROESE 30\n#define TT_MAC_LANGID_FARSI 31\n#define TT_MAC_LANGID_RUSSIAN 32\n#define TT_MAC_LANGID_CHINESE_SIMPLIFIED 33\n#define TT_MAC_LANGID_FLEMISH 34\n#define TT_MAC_LANGID_IRISH 35\n#define TT_MAC_LANGID_ALBANIAN 36\n#define TT_MAC_LANGID_ROMANIAN 37\n#define TT_MAC_LANGID_CZECH 38\n#define TT_MAC_LANGID_SLOVAK 39\n#define TT_MAC_LANGID_SLOVENIAN 40\n#define TT_MAC_LANGID_YIDDISH 41\n#define TT_MAC_LANGID_SERBIAN 42\n#define TT_MAC_LANGID_MACEDONIAN 43\n#define TT_MAC_LANGID_BULGARIAN 44\n#define TT_MAC_LANGID_UKRAINIAN 45\n#define TT_MAC_LANGID_BYELORUSSIAN 46\n#define TT_MAC_LANGID_UZBEK 47\n#define TT_MAC_LANGID_KAZAKH 48\n#define TT_MAC_LANGID_AZERBAIJANI 49\n#define TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT 49\n#define TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT 50\n#define TT_MAC_LANGID_ARMENIAN 51\n#define TT_MAC_LANGID_GEORGIAN 52\n#define TT_MAC_LANGID_MOLDAVIAN 53\n#define TT_MAC_LANGID_KIRGHIZ 54\n#define TT_MAC_LANGID_TAJIKI 55\n#define TT_MAC_LANGID_TURKMEN 56\n#define TT_MAC_LANGID_MONGOLIAN 57\n#define TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT 57\n#define TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT 58\n#define TT_MAC_LANGID_PASHTO 59\n#define TT_MAC_LANGID_KURDISH 60\n#define TT_MAC_LANGID_KASHMIRI 61\n#define TT_MAC_LANGID_SINDHI 62\n#define TT_MAC_LANGID_TIBETAN 63\n#define TT_MAC_LANGID_NEPALI 64\n#define TT_MAC_LANGID_SANSKRIT 65\n#define TT_MAC_LANGID_MARATHI 66\n#define TT_MAC_LANGID_BENGALI 67\n#define TT_MAC_LANGID_ASSAMESE 68\n#define TT_MAC_LANGID_GUJARATI 69\n#define TT_MAC_LANGID_PUNJABI 70\n#define TT_MAC_LANGID_ORIYA 71\n#define TT_MAC_LANGID_MALAYALAM 72\n#define TT_MAC_LANGID_KANNADA 73\n#define TT_MAC_LANGID_TAMIL 74\n#define TT_MAC_LANGID_TELUGU 75\n#define TT_MAC_LANGID_SINHALESE 76\n#define TT_MAC_LANGID_BURMESE 77\n#define TT_MAC_LANGID_KHMER 78\n#define TT_MAC_LANGID_LAO 79\n#define TT_MAC_LANGID_VIETNAMESE 80\n#define TT_MAC_LANGID_INDONESIAN 81\n#define TT_MAC_LANGID_TAGALOG 82\n#define TT_MAC_LANGID_MALAY_ROMAN_SCRIPT 83\n#define TT_MAC_LANGID_MALAY_ARABIC_SCRIPT 84\n#define TT_MAC_LANGID_AMHARIC 85\n#define TT_MAC_LANGID_TIGRINYA 86\n#define TT_MAC_LANGID_GALLA 87\n#define TT_MAC_LANGID_SOMALI 88\n#define TT_MAC_LANGID_SWAHILI 89\n#define TT_MAC_LANGID_RUANDA 90\n#define TT_MAC_LANGID_RUNDI 91\n#define TT_MAC_LANGID_CHEWA 92\n#define TT_MAC_LANGID_MALAGASY 93\n#define TT_MAC_LANGID_ESPERANTO 94\n#define TT_MAC_LANGID_WELSH 128\n#define TT_MAC_LANGID_BASQUE 129\n#define TT_MAC_LANGID_CATALAN 130\n#define TT_MAC_LANGID_LATIN 131\n#define TT_MAC_LANGID_QUECHUA 132\n#define TT_MAC_LANGID_GUARANI 133\n#define TT_MAC_LANGID_AYMARA 134\n#define TT_MAC_LANGID_TATAR 135\n#define TT_MAC_LANGID_UIGHUR 136\n#define TT_MAC_LANGID_DZONGKHA 137\n#define TT_MAC_LANGID_JAVANESE 138\n#define TT_MAC_LANGID_SUNDANESE 139\n\n /* The following codes are new as of 2000-03-10 */\n#define TT_MAC_LANGID_GALICIAN 140\n#define TT_MAC_LANGID_AFRIKAANS 141\n#define TT_MAC_LANGID_BRETON 142\n#define TT_MAC_LANGID_INUKTITUT 143\n#define TT_MAC_LANGID_SCOTTISH_GAELIC 144\n#define TT_MAC_LANGID_MANX_GAELIC 145\n#define TT_MAC_LANGID_IRISH_GAELIC 146\n#define TT_MAC_LANGID_TONGAN 147\n#define TT_MAC_LANGID_GREEK_POLYTONIC 148\n#define TT_MAC_LANGID_GREELANDIC 149\n#define TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT 150\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_MS_LANGID_XXX\n *\n * @description:\n * Possible values of the language identifier field in the name records\n * of the SFNT 'name' table if the 'platform' identifier code is\n * @TT_PLATFORM_MICROSOFT. These values are also used as return values\n * for function @FT_Get_CMap_Language_ID.\n *\n * The canonical source for Microsoft's IDs is\n *\n * https://docs.microsoft.com/en-us/windows/desktop/Intl/language-identifier-constants-and-strings ,\n *\n * however, we only provide macros for language identifiers present in\n * the OpenType specification: Microsoft has abandoned the concept of\n * LCIDs (language code identifiers), and format~1 of the 'name' table\n * provides a better mechanism for languages not covered here.\n *\n * More legacy values not listed in the reference can be found in the\n * @FT_TRUETYPE_IDS_H header file.\n */\n\n#define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401\n#define TT_MS_LANGID_ARABIC_IRAQ 0x0801\n#define TT_MS_LANGID_ARABIC_EGYPT 0x0C01\n#define TT_MS_LANGID_ARABIC_LIBYA 0x1001\n#define TT_MS_LANGID_ARABIC_ALGERIA 0x1401\n#define TT_MS_LANGID_ARABIC_MOROCCO 0x1801\n#define TT_MS_LANGID_ARABIC_TUNISIA 0x1C01\n#define TT_MS_LANGID_ARABIC_OMAN 0x2001\n#define TT_MS_LANGID_ARABIC_YEMEN 0x2401\n#define TT_MS_LANGID_ARABIC_SYRIA 0x2801\n#define TT_MS_LANGID_ARABIC_JORDAN 0x2C01\n#define TT_MS_LANGID_ARABIC_LEBANON 0x3001\n#define TT_MS_LANGID_ARABIC_KUWAIT 0x3401\n#define TT_MS_LANGID_ARABIC_UAE 0x3801\n#define TT_MS_LANGID_ARABIC_BAHRAIN 0x3C01\n#define TT_MS_LANGID_ARABIC_QATAR 0x4001\n#define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402\n#define TT_MS_LANGID_CATALAN_CATALAN 0x0403\n#define TT_MS_LANGID_CHINESE_TAIWAN 0x0404\n#define TT_MS_LANGID_CHINESE_PRC 0x0804\n#define TT_MS_LANGID_CHINESE_HONG_KONG 0x0C04\n#define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004\n#define TT_MS_LANGID_CHINESE_MACAO 0x1404\n#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405\n#define TT_MS_LANGID_DANISH_DENMARK 0x0406\n#define TT_MS_LANGID_GERMAN_GERMANY 0x0407\n#define TT_MS_LANGID_GERMAN_SWITZERLAND 0x0807\n#define TT_MS_LANGID_GERMAN_AUSTRIA 0x0C07\n#define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007\n#define TT_MS_LANGID_GERMAN_LIECHTENSTEIN 0x1407\n#define TT_MS_LANGID_GREEK_GREECE 0x0408\n#define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409\n#define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809\n#define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0C09\n#define TT_MS_LANGID_ENGLISH_CANADA 0x1009\n#define TT_MS_LANGID_ENGLISH_NEW_ZEALAND 0x1409\n#define TT_MS_LANGID_ENGLISH_IRELAND 0x1809\n#define TT_MS_LANGID_ENGLISH_SOUTH_AFRICA 0x1C09\n#define TT_MS_LANGID_ENGLISH_JAMAICA 0x2009\n#define TT_MS_LANGID_ENGLISH_CARIBBEAN 0x2409\n#define TT_MS_LANGID_ENGLISH_BELIZE 0x2809\n#define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2C09\n#define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009\n#define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409\n#define TT_MS_LANGID_ENGLISH_INDIA 0x4009\n#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409\n#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809\n#define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040A\n#define TT_MS_LANGID_SPANISH_MEXICO 0x080A\n#define TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT 0x0C0A\n#define TT_MS_LANGID_SPANISH_GUATEMALA 0x100A\n#define TT_MS_LANGID_SPANISH_COSTA_RICA 0x140A\n#define TT_MS_LANGID_SPANISH_PANAMA 0x180A\n#define TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC 0x1C0A\n#define TT_MS_LANGID_SPANISH_VENEZUELA 0x200A\n#define TT_MS_LANGID_SPANISH_COLOMBIA 0x240A\n#define TT_MS_LANGID_SPANISH_PERU 0x280A\n#define TT_MS_LANGID_SPANISH_ARGENTINA 0x2C0A\n#define TT_MS_LANGID_SPANISH_ECUADOR 0x300A\n#define TT_MS_LANGID_SPANISH_CHILE 0x340A\n#define TT_MS_LANGID_SPANISH_URUGUAY 0x380A\n#define TT_MS_LANGID_SPANISH_PARAGUAY 0x3C0A\n#define TT_MS_LANGID_SPANISH_BOLIVIA 0x400A\n#define TT_MS_LANGID_SPANISH_EL_SALVADOR 0x440A\n#define TT_MS_LANGID_SPANISH_HONDURAS 0x480A\n#define TT_MS_LANGID_SPANISH_NICARAGUA 0x4C0A\n#define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500A\n#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540A\n#define TT_MS_LANGID_FINNISH_FINLAND 0x040B\n#define TT_MS_LANGID_FRENCH_FRANCE 0x040C\n#define TT_MS_LANGID_FRENCH_BELGIUM 0x080C\n#define TT_MS_LANGID_FRENCH_CANADA 0x0C0C\n#define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100C\n#define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140C\n#define TT_MS_LANGID_FRENCH_MONACO 0x180C\n#define TT_MS_LANGID_HEBREW_ISRAEL 0x040D\n#define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040E\n#define TT_MS_LANGID_ICELANDIC_ICELAND 0x040F\n#define TT_MS_LANGID_ITALIAN_ITALY 0x0410\n#define TT_MS_LANGID_ITALIAN_SWITZERLAND 0x0810\n#define TT_MS_LANGID_JAPANESE_JAPAN 0x0411\n#define TT_MS_LANGID_KOREAN_KOREA 0x0412\n#define TT_MS_LANGID_DUTCH_NETHERLANDS 0x0413\n#define TT_MS_LANGID_DUTCH_BELGIUM 0x0813\n#define TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL 0x0414\n#define TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK 0x0814\n#define TT_MS_LANGID_POLISH_POLAND 0x0415\n#define TT_MS_LANGID_PORTUGUESE_BRAZIL 0x0416\n#define TT_MS_LANGID_PORTUGUESE_PORTUGAL 0x0816\n#define TT_MS_LANGID_ROMANSH_SWITZERLAND 0x0417\n#define TT_MS_LANGID_ROMANIAN_ROMANIA 0x0418\n#define TT_MS_LANGID_RUSSIAN_RUSSIA 0x0419\n#define TT_MS_LANGID_CROATIAN_CROATIA 0x041A\n#define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081A\n#define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0C1A\n#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101A\n#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141A\n#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181A\n#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x1C1A\n#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZ_CYRILLIC 0x201A\n#define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041B\n#define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041C\n#define TT_MS_LANGID_SWEDISH_SWEDEN 0x041D\n#define TT_MS_LANGID_SWEDISH_FINLAND 0x081D\n#define TT_MS_LANGID_THAI_THAILAND 0x041E\n#define TT_MS_LANGID_TURKISH_TURKEY 0x041F\n#define TT_MS_LANGID_URDU_PAKISTAN 0x0420\n#define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421\n#define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422\n#define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423\n#define TT_MS_LANGID_SLOVENIAN_SLOVENIA 0x0424\n#define TT_MS_LANGID_ESTONIAN_ESTONIA 0x0425\n#define TT_MS_LANGID_LATVIAN_LATVIA 0x0426\n#define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427\n#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428\n#define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042A\n#define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042B\n#define TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN 0x042C\n#define TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC 0x082C\n#define TT_MS_LANGID_BASQUE_BASQUE 0x042D\n#define TT_MS_LANGID_UPPER_SORBIAN_GERMANY 0x042E\n#define TT_MS_LANGID_LOWER_SORBIAN_GERMANY 0x082E\n#define TT_MS_LANGID_MACEDONIAN_MACEDONIA 0x042F\n#define TT_MS_LANGID_SETSWANA_SOUTH_AFRICA 0x0432\n#define TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA 0x0434\n#define TT_MS_LANGID_ISIZULU_SOUTH_AFRICA 0x0435\n#define TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA 0x0436\n#define TT_MS_LANGID_GEORGIAN_GEORGIA 0x0437\n#define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438\n#define TT_MS_LANGID_HINDI_INDIA 0x0439\n#define TT_MS_LANGID_MALTESE_MALTA 0x043A\n#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043B\n#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083B\n#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3B\n#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103B\n#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143B\n#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183B\n#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3B\n#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203B\n#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243B\n#define TT_MS_LANGID_IRISH_IRELAND 0x083C\n#define TT_MS_LANGID_MALAY_MALAYSIA 0x043E\n#define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083E\n#define TT_MS_LANGID_KAZAKH_KAZAKHSTAN 0x043F\n#define TT_MS_LANGID_KYRGYZ_KYRGYZSTAN /* Cyrillic*/ 0x0440\n#define TT_MS_LANGID_KISWAHILI_KENYA 0x0441\n#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442\n#define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443\n#define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843\n#define TT_MS_LANGID_TATAR_RUSSIA 0x0444\n#define TT_MS_LANGID_BENGALI_INDIA 0x0445\n#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845\n#define TT_MS_LANGID_PUNJABI_INDIA 0x0446\n#define TT_MS_LANGID_GUJARATI_INDIA 0x0447\n#define TT_MS_LANGID_ODIA_INDIA 0x0448\n#define TT_MS_LANGID_TAMIL_INDIA 0x0449\n#define TT_MS_LANGID_TELUGU_INDIA 0x044A\n#define TT_MS_LANGID_KANNADA_INDIA 0x044B\n#define TT_MS_LANGID_MALAYALAM_INDIA 0x044C\n#define TT_MS_LANGID_ASSAMESE_INDIA 0x044D\n#define TT_MS_LANGID_MARATHI_INDIA 0x044E\n#define TT_MS_LANGID_SANSKRIT_INDIA 0x044F\n#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450\n#define TT_MS_LANGID_MONGOLIAN_PRC 0x0850\n#define TT_MS_LANGID_TIBETAN_PRC 0x0451\n#define TT_MS_LANGID_WELSH_UNITED_KINGDOM 0x0452\n#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453\n#define TT_MS_LANGID_LAO_LAOS 0x0454\n#define TT_MS_LANGID_GALICIAN_GALICIAN 0x0456\n#define TT_MS_LANGID_KONKANI_INDIA 0x0457\n#define TT_MS_LANGID_SYRIAC_SYRIA 0x045A\n#define TT_MS_LANGID_SINHALA_SRI_LANKA 0x045B\n#define TT_MS_LANGID_INUKTITUT_CANADA 0x045D\n#define TT_MS_LANGID_INUKTITUT_CANADA_LATIN 0x085D\n#define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045E\n#define TT_MS_LANGID_TAMAZIGHT_ALGERIA 0x085F\n#define TT_MS_LANGID_NEPALI_NEPAL 0x0461\n#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462\n#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463\n#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464\n#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465\n#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468\n#define TT_MS_LANGID_YORUBA_NIGERIA 0x046A\n#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046B\n#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086B\n#define TT_MS_LANGID_QUECHUA_PERU 0x0C6B\n#define TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA 0x046C\n#define TT_MS_LANGID_BASHKIR_RUSSIA 0x046D\n#define TT_MS_LANGID_LUXEMBOURGISH_LUXEMBOURG 0x046E\n#define TT_MS_LANGID_GREENLANDIC_GREENLAND 0x046F\n#define TT_MS_LANGID_IGBO_NIGERIA 0x0470\n#define TT_MS_LANGID_YI_PRC 0x0478\n#define TT_MS_LANGID_MAPUDUNGUN_CHILE 0x047A\n#define TT_MS_LANGID_MOHAWK_MOHAWK 0x047C\n#define TT_MS_LANGID_BRETON_FRANCE 0x047E\n#define TT_MS_LANGID_UIGHUR_PRC 0x0480\n#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481\n#define TT_MS_LANGID_OCCITAN_FRANCE 0x0482\n#define TT_MS_LANGID_CORSICAN_FRANCE 0x0483\n#define TT_MS_LANGID_ALSATIAN_FRANCE 0x0484\n#define TT_MS_LANGID_YAKUT_RUSSIA 0x0485\n#define TT_MS_LANGID_KICHE_GUATEMALA 0x0486\n#define TT_MS_LANGID_KINYARWANDA_RWANDA 0x0487\n#define TT_MS_LANGID_WOLOF_SENEGAL 0x0488\n#define TT_MS_LANGID_DARI_AFGHANISTAN 0x048C\n\n /* */\n\n\n /* legacy macro definitions not present in OpenType 1.8.1 */\n#define TT_MS_LANGID_ARABIC_GENERAL 0x0001\n#define TT_MS_LANGID_CATALAN_SPAIN \\\n TT_MS_LANGID_CATALAN_CATALAN\n#define TT_MS_LANGID_CHINESE_GENERAL 0x0004\n#define TT_MS_LANGID_CHINESE_MACAU \\\n TT_MS_LANGID_CHINESE_MACAO\n#define TT_MS_LANGID_GERMAN_LIECHTENSTEI \\\n TT_MS_LANGID_GERMAN_LIECHTENSTEIN\n#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009\n#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809\n#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3C09\n#define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT \\\n TT_MS_LANGID_SPANISH_SPAIN_MODERN_SORT\n#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40AU\n#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1C0C\n#define TT_MS_LANGID_FRENCH_REUNION 0x200C\n#define TT_MS_LANGID_FRENCH_CONGO 0x240C\n /* which was formerly: */\n#define TT_MS_LANGID_FRENCH_ZAIRE \\\n TT_MS_LANGID_FRENCH_CONGO\n#define TT_MS_LANGID_FRENCH_SENEGAL 0x280C\n#define TT_MS_LANGID_FRENCH_CAMEROON 0x2C0C\n#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300C\n#define TT_MS_LANGID_FRENCH_MALI 0x340C\n#define TT_MS_LANGID_FRENCH_MOROCCO 0x380C\n#define TT_MS_LANGID_FRENCH_HAITI 0x3C0C\n#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40CU\n#define TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA \\\n TT_MS_LANGID_KOREAN_KOREA\n#define TT_MS_LANGID_KOREAN_JOHAB_KOREA 0x0812\n#define TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND \\\n TT_MS_LANGID_ROMANSH_SWITZERLAND\n#define TT_MS_LANGID_MOLDAVIAN_MOLDAVIA 0x0818\n#define TT_MS_LANGID_RUSSIAN_MOLDAVIA 0x0819\n#define TT_MS_LANGID_URDU_INDIA 0x0820\n#define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827\n#define TT_MS_LANGID_SLOVENE_SLOVENIA \\\n TT_MS_LANGID_SLOVENIAN_SLOVENIA\n#define TT_MS_LANGID_FARSI_IRAN 0x0429\n#define TT_MS_LANGID_BASQUE_SPAIN \\\n TT_MS_LANGID_BASQUE_BASQUE\n#define TT_MS_LANGID_SORBIAN_GERMANY \\\n TT_MS_LANGID_UPPER_SORBIAN_GERMANY\n#define TT_MS_LANGID_SUTU_SOUTH_AFRICA 0x0430\n#define TT_MS_LANGID_TSONGA_SOUTH_AFRICA 0x0431\n#define TT_MS_LANGID_TSWANA_SOUTH_AFRICA \\\n TT_MS_LANGID_SETSWANA_SOUTH_AFRICA\n#define TT_MS_LANGID_VENDA_SOUTH_AFRICA 0x0433\n#define TT_MS_LANGID_XHOSA_SOUTH_AFRICA \\\n TT_MS_LANGID_ISIXHOSA_SOUTH_AFRICA\n#define TT_MS_LANGID_ZULU_SOUTH_AFRICA \\\n TT_MS_LANGID_ISIZULU_SOUTH_AFRICA\n#define TT_MS_LANGID_SAAMI_LAPONIA 0x043B\n /* the next two values are incorrectly inverted */\n#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043C\n#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083C\n#define TT_MS_LANGID_YIDDISH_GERMANY 0x043D\n#define TT_MS_LANGID_KAZAK_KAZAKSTAN \\\n TT_MS_LANGID_KAZAKH_KAZAKHSTAN\n#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \\\n TT_MS_LANGID_KYRGYZ_KYRGYZSTAN\n#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN \\\n TT_MS_LANGID_KYRGYZ_KYRGYZSTAN\n#define TT_MS_LANGID_SWAHILI_KENYA \\\n TT_MS_LANGID_KISWAHILI_KENYA\n#define TT_MS_LANGID_TATAR_TATARSTAN \\\n TT_MS_LANGID_TATAR_RUSSIA\n#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846\n#define TT_MS_LANGID_ORIYA_INDIA \\\n TT_MS_LANGID_ODIA_INDIA\n#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN \\\n TT_MS_LANGID_MONGOLIAN_PRC\n#define TT_MS_LANGID_TIBETAN_CHINA \\\n TT_MS_LANGID_TIBETAN_PRC\n#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851\n#define TT_MS_LANGID_TIBETAN_BHUTAN \\\n TT_MS_LANGID_DZONGHKA_BHUTAN\n#define TT_MS_LANGID_WELSH_WALES \\\n TT_MS_LANGID_WELSH_UNITED_KINGDOM\n#define TT_MS_LANGID_BURMESE_MYANMAR 0x0455\n#define TT_MS_LANGID_GALICIAN_SPAIN \\\n TT_MS_LANGID_GALICIAN_GALICIAN\n#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458\n#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459\n#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859\n#define TT_MS_LANGID_SINHALESE_SRI_LANKA \\\n TT_MS_LANGID_SINHALA_SRI_LANKA\n#define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045C\n#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045F\n#define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN \\\n TT_MS_LANGID_TAMAZIGHT_ALGERIA\n#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460\n#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860\n#define TT_MS_LANGID_KASHMIRI_INDIA \\\n TT_MS_LANGID_KASHMIRI_SASIA\n#define TT_MS_LANGID_NEPALI_INDIA 0x0861\n#define TT_MS_LANGID_DIVEHI_MALDIVES \\\n TT_MS_LANGID_DHIVEHI_MALDIVES\n#define TT_MS_LANGID_EDO_NIGERIA 0x0466\n#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467\n#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469\n#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA \\\n TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA\n#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \\\n TT_MS_LANGID_SESOTHO_SA_LEBOA_SOUTH_AFRICA\n#define TT_MS_LANGID_KANURI_NIGERIA 0x0471\n#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472\n#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473\n#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873\n#define TT_MS_LANGID_TIGRIGNA_ERYTREA \\\n TT_MS_LANGID_TIGRIGNA_ERYTHREA\n#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474\n#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475\n#define TT_MS_LANGID_LATIN 0x0476\n#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477\n#define TT_MS_LANGID_YI_CHINA \\\n TT_MS_LANGID_YI_PRC\n#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479\n#define TT_MS_LANGID_UIGHUR_CHINA \\\n TT_MS_LANGID_UIGHUR_PRC\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_NAME_ID_XXX\n *\n * @description:\n * Possible values of the 'name' identifier field in the name records of\n * an SFNT 'name' table. These values are platform independent.\n */\n\n#define TT_NAME_ID_COPYRIGHT 0\n#define TT_NAME_ID_FONT_FAMILY 1\n#define TT_NAME_ID_FONT_SUBFAMILY 2\n#define TT_NAME_ID_UNIQUE_ID 3\n#define TT_NAME_ID_FULL_NAME 4\n#define TT_NAME_ID_VERSION_STRING 5\n#define TT_NAME_ID_PS_NAME 6\n#define TT_NAME_ID_TRADEMARK 7\n\n /* the following values are from the OpenType spec */\n#define TT_NAME_ID_MANUFACTURER 8\n#define TT_NAME_ID_DESIGNER 9\n#define TT_NAME_ID_DESCRIPTION 10\n#define TT_NAME_ID_VENDOR_URL 11\n#define TT_NAME_ID_DESIGNER_URL 12\n#define TT_NAME_ID_LICENSE 13\n#define TT_NAME_ID_LICENSE_URL 14\n /* number 15 is reserved */\n#define TT_NAME_ID_TYPOGRAPHIC_FAMILY 16\n#define TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY 17\n#define TT_NAME_ID_MAC_FULL_NAME 18\n\n /* The following code is new as of 2000-01-21 */\n#define TT_NAME_ID_SAMPLE_TEXT 19\n\n /* This is new in OpenType 1.3 */\n#define TT_NAME_ID_CID_FINDFONT_NAME 20\n\n /* This is new in OpenType 1.5 */\n#define TT_NAME_ID_WWS_FAMILY 21\n#define TT_NAME_ID_WWS_SUBFAMILY 22\n\n /* This is new in OpenType 1.7 */\n#define TT_NAME_ID_LIGHT_BACKGROUND 23\n#define TT_NAME_ID_DARK_BACKGROUND 24\n\n /* This is new in OpenType 1.8 */\n#define TT_NAME_ID_VARIATIONS_PREFIX 25\n\n /* these two values are deprecated */\n#define TT_NAME_ID_PREFERRED_FAMILY TT_NAME_ID_TYPOGRAPHIC_FAMILY\n#define TT_NAME_ID_PREFERRED_SUBFAMILY TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY\n\n\n /**************************************************************************\n *\n * @enum:\n * TT_UCR_XXX\n *\n * @description:\n * Possible bit mask values for the `ulUnicodeRangeX` fields in an SFNT\n * 'OS/2' table.\n */\n\n /* ulUnicodeRange1 */\n /* --------------- */\n\n /* Bit 0 Basic Latin */\n#define TT_UCR_BASIC_LATIN (1L << 0) /* U+0020-U+007E */\n /* Bit 1 C1 Controls and Latin-1 Supplement */\n#define TT_UCR_LATIN1_SUPPLEMENT (1L << 1) /* U+0080-U+00FF */\n /* Bit 2 Latin Extended-A */\n#define TT_UCR_LATIN_EXTENDED_A (1L << 2) /* U+0100-U+017F */\n /* Bit 3 Latin Extended-B */\n#define TT_UCR_LATIN_EXTENDED_B (1L << 3) /* U+0180-U+024F */\n /* Bit 4 IPA Extensions */\n /* Phonetic Extensions */\n /* Phonetic Extensions Supplement */\n#define TT_UCR_IPA_EXTENSIONS (1L << 4) /* U+0250-U+02AF */\n /* U+1D00-U+1D7F */\n /* U+1D80-U+1DBF */\n /* Bit 5 Spacing Modifier Letters */\n /* Modifier Tone Letters */\n#define TT_UCR_SPACING_MODIFIER (1L << 5) /* U+02B0-U+02FF */\n /* U+A700-U+A71F */\n /* Bit 6 Combining Diacritical Marks */\n /* Combining Diacritical Marks Supplement */\n#define TT_UCR_COMBINING_DIACRITICAL_MARKS (1L << 6) /* U+0300-U+036F */\n /* U+1DC0-U+1DFF */\n /* Bit 7 Greek and Coptic */\n#define TT_UCR_GREEK (1L << 7) /* U+0370-U+03FF */\n /* Bit 8 Coptic */\n#define TT_UCR_COPTIC (1L << 8) /* U+2C80-U+2CFF */\n /* Bit 9 Cyrillic */\n /* Cyrillic Supplement */\n /* Cyrillic Extended-A */\n /* Cyrillic Extended-B */\n#define TT_UCR_CYRILLIC (1L << 9) /* U+0400-U+04FF */\n /* U+0500-U+052F */\n /* U+2DE0-U+2DFF */\n /* U+A640-U+A69F */\n /* Bit 10 Armenian */\n#define TT_UCR_ARMENIAN (1L << 10) /* U+0530-U+058F */\n /* Bit 11 Hebrew */\n#define TT_UCR_HEBREW (1L << 11) /* U+0590-U+05FF */\n /* Bit 12 Vai */\n#define TT_UCR_VAI (1L << 12) /* U+A500-U+A63F */\n /* Bit 13 Arabic */\n /* Arabic Supplement */\n#define TT_UCR_ARABIC (1L << 13) /* U+0600-U+06FF */\n /* U+0750-U+077F */\n /* Bit 14 NKo */\n#define TT_UCR_NKO (1L << 14) /* U+07C0-U+07FF */\n /* Bit 15 Devanagari */\n#define TT_UCR_DEVANAGARI (1L << 15) /* U+0900-U+097F */\n /* Bit 16 Bengali */\n#define TT_UCR_BENGALI (1L << 16) /* U+0980-U+09FF */\n /* Bit 17 Gurmukhi */\n#define TT_UCR_GURMUKHI (1L << 17) /* U+0A00-U+0A7F */\n /* Bit 18 Gujarati */\n#define TT_UCR_GUJARATI (1L << 18) /* U+0A80-U+0AFF */\n /* Bit 19 Oriya */\n#define TT_UCR_ORIYA (1L << 19) /* U+0B00-U+0B7F */\n /* Bit 20 Tamil */\n#define TT_UCR_TAMIL (1L << 20) /* U+0B80-U+0BFF */\n /* Bit 21 Telugu */\n#define TT_UCR_TELUGU (1L << 21) /* U+0C00-U+0C7F */\n /* Bit 22 Kannada */\n#define TT_UCR_KANNADA (1L << 22) /* U+0C80-U+0CFF */\n /* Bit 23 Malayalam */\n#define TT_UCR_MALAYALAM (1L << 23) /* U+0D00-U+0D7F */\n /* Bit 24 Thai */\n#define TT_UCR_THAI (1L << 24) /* U+0E00-U+0E7F */\n /* Bit 25 Lao */\n#define TT_UCR_LAO (1L << 25) /* U+0E80-U+0EFF */\n /* Bit 26 Georgian */\n /* Georgian Supplement */\n#define TT_UCR_GEORGIAN (1L << 26) /* U+10A0-U+10FF */\n /* U+2D00-U+2D2F */\n /* Bit 27 Balinese */\n#define TT_UCR_BALINESE (1L << 27) /* U+1B00-U+1B7F */\n /* Bit 28 Hangul Jamo */\n#define TT_UCR_HANGUL_JAMO (1L << 28) /* U+1100-U+11FF */\n /* Bit 29 Latin Extended Additional */\n /* Latin Extended-C */\n /* Latin Extended-D */\n#define TT_UCR_LATIN_EXTENDED_ADDITIONAL (1L << 29) /* U+1E00-U+1EFF */\n /* U+2C60-U+2C7F */\n /* U+A720-U+A7FF */\n /* Bit 30 Greek Extended */\n#define TT_UCR_GREEK_EXTENDED (1L << 30) /* U+1F00-U+1FFF */\n /* Bit 31 General Punctuation */\n /* Supplemental Punctuation */\n#define TT_UCR_GENERAL_PUNCTUATION (1L << 31) /* U+2000-U+206F */\n /* U+2E00-U+2E7F */\n\n /* ulUnicodeRange2 */\n /* --------------- */\n\n /* Bit 32 Superscripts And Subscripts */\n#define TT_UCR_SUPERSCRIPTS_SUBSCRIPTS (1L << 0) /* U+2070-U+209F */\n /* Bit 33 Currency Symbols */\n#define TT_UCR_CURRENCY_SYMBOLS (1L << 1) /* U+20A0-U+20CF */\n /* Bit 34 Combining Diacritical Marks For Symbols */\n#define TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB \\\n (1L << 2) /* U+20D0-U+20FF */\n /* Bit 35 Letterlike Symbols */\n#define TT_UCR_LETTERLIKE_SYMBOLS (1L << 3) /* U+2100-U+214F */\n /* Bit 36 Number Forms */\n#define TT_UCR_NUMBER_FORMS (1L << 4) /* U+2150-U+218F */\n /* Bit 37 Arrows */\n /* Supplemental Arrows-A */\n /* Supplemental Arrows-B */\n /* Miscellaneous Symbols and Arrows */\n#define TT_UCR_ARROWS (1L << 5) /* U+2190-U+21FF */\n /* U+27F0-U+27FF */\n /* U+2900-U+297F */\n /* U+2B00-U+2BFF */\n /* Bit 38 Mathematical Operators */\n /* Supplemental Mathematical Operators */\n /* Miscellaneous Mathematical Symbols-A */\n /* Miscellaneous Mathematical Symbols-B */\n#define TT_UCR_MATHEMATICAL_OPERATORS (1L << 6) /* U+2200-U+22FF */\n /* U+2A00-U+2AFF */\n /* U+27C0-U+27EF */\n /* U+2980-U+29FF */\n /* Bit 39 Miscellaneous Technical */\n#define TT_UCR_MISCELLANEOUS_TECHNICAL (1L << 7) /* U+2300-U+23FF */\n /* Bit 40 Control Pictures */\n#define TT_UCR_CONTROL_PICTURES (1L << 8) /* U+2400-U+243F */\n /* Bit 41 Optical Character Recognition */\n#define TT_UCR_OCR (1L << 9) /* U+2440-U+245F */\n /* Bit 42 Enclosed Alphanumerics */\n#define TT_UCR_ENCLOSED_ALPHANUMERICS (1L << 10) /* U+2460-U+24FF */\n /* Bit 43 Box Drawing */\n#define TT_UCR_BOX_DRAWING (1L << 11) /* U+2500-U+257F */\n /* Bit 44 Block Elements */\n#define TT_UCR_BLOCK_ELEMENTS (1L << 12) /* U+2580-U+259F */\n /* Bit 45 Geometric Shapes */\n#define TT_UCR_GEOMETRIC_SHAPES (1L << 13) /* U+25A0-U+25FF */\n /* Bit 46 Miscellaneous Symbols */\n#define TT_UCR_MISCELLANEOUS_SYMBOLS (1L << 14) /* U+2600-U+26FF */\n /* Bit 47 Dingbats */\n#define TT_UCR_DINGBATS (1L << 15) /* U+2700-U+27BF */\n /* Bit 48 CJK Symbols and Punctuation */\n#define TT_UCR_CJK_SYMBOLS (1L << 16) /* U+3000-U+303F */\n /* Bit 49 Hiragana */\n#define TT_UCR_HIRAGANA (1L << 17) /* U+3040-U+309F */\n /* Bit 50 Katakana */\n /* Katakana Phonetic Extensions */\n#define TT_UCR_KATAKANA (1L << 18) /* U+30A0-U+30FF */\n /* U+31F0-U+31FF */\n /* Bit 51 Bopomofo */\n /* Bopomofo Extended */\n#define TT_UCR_BOPOMOFO (1L << 19) /* U+3100-U+312F */\n /* U+31A0-U+31BF */\n /* Bit 52 Hangul Compatibility Jamo */\n#define TT_UCR_HANGUL_COMPATIBILITY_JAMO (1L << 20) /* U+3130-U+318F */\n /* Bit 53 Phags-Pa */\n#define TT_UCR_CJK_MISC (1L << 21) /* U+A840-U+A87F */\n#define TT_UCR_KANBUN TT_UCR_CJK_MISC /* deprecated */\n#define TT_UCR_PHAGSPA\n /* Bit 54 Enclosed CJK Letters and Months */\n#define TT_UCR_ENCLOSED_CJK_LETTERS_MONTHS (1L << 22) /* U+3200-U+32FF */\n /* Bit 55 CJK Compatibility */\n#define TT_UCR_CJK_COMPATIBILITY (1L << 23) /* U+3300-U+33FF */\n /* Bit 56 Hangul Syllables */\n#define TT_UCR_HANGUL (1L << 24) /* U+AC00-U+D7A3 */\n /* Bit 57 High Surrogates */\n /* High Private Use Surrogates */\n /* Low Surrogates */\n\n /* According to OpenType specs v.1.3+, */\n /* setting bit 57 implies that there is */\n /* at least one codepoint beyond the */\n /* Basic Multilingual Plane that is */\n /* supported by this font. So it really */\n /* means >= U+10000. */\n#define TT_UCR_SURROGATES (1L << 25) /* U+D800-U+DB7F */\n /* U+DB80-U+DBFF */\n /* U+DC00-U+DFFF */\n#define TT_UCR_NON_PLANE_0 TT_UCR_SURROGATES\n /* Bit 58 Phoenician */\n#define TT_UCR_PHOENICIAN (1L << 26) /*U+10900-U+1091F*/\n /* Bit 59 CJK Unified Ideographs */\n /* CJK Radicals Supplement */\n /* Kangxi Radicals */\n /* Ideographic Description Characters */\n /* CJK Unified Ideographs Extension A */\n /* CJK Unified Ideographs Extension B */\n /* Kanbun */\n#define TT_UCR_CJK_UNIFIED_IDEOGRAPHS (1L << 27) /* U+4E00-U+9FFF */\n /* U+2E80-U+2EFF */\n /* U+2F00-U+2FDF */\n /* U+2FF0-U+2FFF */\n /* U+3400-U+4DB5 */\n /*U+20000-U+2A6DF*/\n /* U+3190-U+319F */\n /* Bit 60 Private Use */\n#define TT_UCR_PRIVATE_USE (1L << 28) /* U+E000-U+F8FF */\n /* Bit 61 CJK Strokes */\n /* CJK Compatibility Ideographs */\n /* CJK Compatibility Ideographs Supplement */\n#define TT_UCR_CJK_COMPATIBILITY_IDEOGRAPHS (1L << 29) /* U+31C0-U+31EF */\n /* U+F900-U+FAFF */\n /*U+2F800-U+2FA1F*/\n /* Bit 62 Alphabetic Presentation Forms */\n#define TT_UCR_ALPHABETIC_PRESENTATION_FORMS (1L << 30) /* U+FB00-U+FB4F */\n /* Bit 63 Arabic Presentation Forms-A */\n#define TT_UCR_ARABIC_PRESENTATION_FORMS_A (1L << 31) /* U+FB50-U+FDFF */\n\n /* ulUnicodeRange3 */\n /* --------------- */\n\n /* Bit 64 Combining Half Marks */\n#define TT_UCR_COMBINING_HALF_MARKS (1L << 0) /* U+FE20-U+FE2F */\n /* Bit 65 Vertical forms */\n /* CJK Compatibility Forms */\n#define TT_UCR_CJK_COMPATIBILITY_FORMS (1L << 1) /* U+FE10-U+FE1F */\n /* U+FE30-U+FE4F */\n /* Bit 66 Small Form Variants */\n#define TT_UCR_SMALL_FORM_VARIANTS (1L << 2) /* U+FE50-U+FE6F */\n /* Bit 67 Arabic Presentation Forms-B */\n#define TT_UCR_ARABIC_PRESENTATION_FORMS_B (1L << 3) /* U+FE70-U+FEFE */\n /* Bit 68 Halfwidth and Fullwidth Forms */\n#define TT_UCR_HALFWIDTH_FULLWIDTH_FORMS (1L << 4) /* U+FF00-U+FFEF */\n /* Bit 69 Specials */\n#define TT_UCR_SPECIALS (1L << 5) /* U+FFF0-U+FFFD */\n /* Bit 70 Tibetan */\n#define TT_UCR_TIBETAN (1L << 6) /* U+0F00-U+0FFF */\n /* Bit 71 Syriac */\n#define TT_UCR_SYRIAC (1L << 7) /* U+0700-U+074F */\n /* Bit 72 Thaana */\n#define TT_UCR_THAANA (1L << 8) /* U+0780-U+07BF */\n /* Bit 73 Sinhala */\n#define TT_UCR_SINHALA (1L << 9) /* U+0D80-U+0DFF */\n /* Bit 74 Myanmar */\n#define TT_UCR_MYANMAR (1L << 10) /* U+1000-U+109F */\n /* Bit 75 Ethiopic */\n /* Ethiopic Supplement */\n /* Ethiopic Extended */\n#define TT_UCR_ETHIOPIC (1L << 11) /* U+1200-U+137F */\n /* U+1380-U+139F */\n /* U+2D80-U+2DDF */\n /* Bit 76 Cherokee */\n#define TT_UCR_CHEROKEE (1L << 12) /* U+13A0-U+13FF */\n /* Bit 77 Unified Canadian Aboriginal Syllabics */\n#define TT_UCR_CANADIAN_ABORIGINAL_SYLLABICS (1L << 13) /* U+1400-U+167F */\n /* Bit 78 Ogham */\n#define TT_UCR_OGHAM (1L << 14) /* U+1680-U+169F */\n /* Bit 79 Runic */\n#define TT_UCR_RUNIC (1L << 15) /* U+16A0-U+16FF */\n /* Bit 80 Khmer */\n /* Khmer Symbols */\n#define TT_UCR_KHMER (1L << 16) /* U+1780-U+17FF */\n /* U+19E0-U+19FF */\n /* Bit 81 Mongolian */\n#define TT_UCR_MONGOLIAN (1L << 17) /* U+1800-U+18AF */\n /* Bit 82 Braille Patterns */\n#define TT_UCR_BRAILLE (1L << 18) /* U+2800-U+28FF */\n /* Bit 83 Yi Syllables */\n /* Yi Radicals */\n#define TT_UCR_YI (1L << 19) /* U+A000-U+A48F */\n /* U+A490-U+A4CF */\n /* Bit 84 Tagalog */\n /* Hanunoo */\n /* Buhid */\n /* Tagbanwa */\n#define TT_UCR_PHILIPPINE (1L << 20) /* U+1700-U+171F */\n /* U+1720-U+173F */\n /* U+1740-U+175F */\n /* U+1760-U+177F */\n /* Bit 85 Old Italic */\n#define TT_UCR_OLD_ITALIC (1L << 21) /*U+10300-U+1032F*/\n /* Bit 86 Gothic */\n#define TT_UCR_GOTHIC (1L << 22) /*U+10330-U+1034F*/\n /* Bit 87 Deseret */\n#define TT_UCR_DESERET (1L << 23) /*U+10400-U+1044F*/\n /* Bit 88 Byzantine Musical Symbols */\n /* Musical Symbols */\n /* Ancient Greek Musical Notation */\n#define TT_UCR_MUSICAL_SYMBOLS (1L << 24) /*U+1D000-U+1D0FF*/\n /*U+1D100-U+1D1FF*/\n /*U+1D200-U+1D24F*/\n /* Bit 89 Mathematical Alphanumeric Symbols */\n#define TT_UCR_MATH_ALPHANUMERIC_SYMBOLS (1L << 25) /*U+1D400-U+1D7FF*/\n /* Bit 90 Private Use (plane 15) */\n /* Private Use (plane 16) */\n#define TT_UCR_PRIVATE_USE_SUPPLEMENTARY (1L << 26) /*U+F0000-U+FFFFD*/\n /*U+100000-U+10FFFD*/\n /* Bit 91 Variation Selectors */\n /* Variation Selectors Supplement */\n#define TT_UCR_VARIATION_SELECTORS (1L << 27) /* U+FE00-U+FE0F */\n /*U+E0100-U+E01EF*/\n /* Bit 92 Tags */\n#define TT_UCR_TAGS (1L << 28) /*U+E0000-U+E007F*/\n /* Bit 93 Limbu */\n#define TT_UCR_LIMBU (1L << 29) /* U+1900-U+194F */\n /* Bit 94 Tai Le */\n#define TT_UCR_TAI_LE (1L << 30) /* U+1950-U+197F */\n /* Bit 95 New Tai Lue */\n#define TT_UCR_NEW_TAI_LUE (1L << 31) /* U+1980-U+19DF */\n\n /* ulUnicodeRange4 */\n /* --------------- */\n\n /* Bit 96 Buginese */\n#define TT_UCR_BUGINESE (1L << 0) /* U+1A00-U+1A1F */\n /* Bit 97 Glagolitic */\n#define TT_UCR_GLAGOLITIC (1L << 1) /* U+2C00-U+2C5F */\n /* Bit 98 Tifinagh */\n#define TT_UCR_TIFINAGH (1L << 2) /* U+2D30-U+2D7F */\n /* Bit 99 Yijing Hexagram Symbols */\n#define TT_UCR_YIJING (1L << 3) /* U+4DC0-U+4DFF */\n /* Bit 100 Syloti Nagri */\n#define TT_UCR_SYLOTI_NAGRI (1L << 4) /* U+A800-U+A82F */\n /* Bit 101 Linear B Syllabary */\n /* Linear B Ideograms */\n /* Aegean Numbers */\n#define TT_UCR_LINEAR_B (1L << 5) /*U+10000-U+1007F*/\n /*U+10080-U+100FF*/\n /*U+10100-U+1013F*/\n /* Bit 102 Ancient Greek Numbers */\n#define TT_UCR_ANCIENT_GREEK_NUMBERS (1L << 6) /*U+10140-U+1018F*/\n /* Bit 103 Ugaritic */\n#define TT_UCR_UGARITIC (1L << 7) /*U+10380-U+1039F*/\n /* Bit 104 Old Persian */\n#define TT_UCR_OLD_PERSIAN (1L << 8) /*U+103A0-U+103DF*/\n /* Bit 105 Shavian */\n#define TT_UCR_SHAVIAN (1L << 9) /*U+10450-U+1047F*/\n /* Bit 106 Osmanya */\n#define TT_UCR_OSMANYA (1L << 10) /*U+10480-U+104AF*/\n /* Bit 107 Cypriot Syllabary */\n#define TT_UCR_CYPRIOT_SYLLABARY (1L << 11) /*U+10800-U+1083F*/\n /* Bit 108 Kharoshthi */\n#define TT_UCR_KHAROSHTHI (1L << 12) /*U+10A00-U+10A5F*/\n /* Bit 109 Tai Xuan Jing Symbols */\n#define TT_UCR_TAI_XUAN_JING (1L << 13) /*U+1D300-U+1D35F*/\n /* Bit 110 Cuneiform */\n /* Cuneiform Numbers and Punctuation */\n#define TT_UCR_CUNEIFORM (1L << 14) /*U+12000-U+123FF*/\n /*U+12400-U+1247F*/\n /* Bit 111 Counting Rod Numerals */\n#define TT_UCR_COUNTING_ROD_NUMERALS (1L << 15) /*U+1D360-U+1D37F*/\n /* Bit 112 Sundanese */\n#define TT_UCR_SUNDANESE (1L << 16) /* U+1B80-U+1BBF */\n /* Bit 113 Lepcha */\n#define TT_UCR_LEPCHA (1L << 17) /* U+1C00-U+1C4F */\n /* Bit 114 Ol Chiki */\n#define TT_UCR_OL_CHIKI (1L << 18) /* U+1C50-U+1C7F */\n /* Bit 115 Saurashtra */\n#define TT_UCR_SAURASHTRA (1L << 19) /* U+A880-U+A8DF */\n /* Bit 116 Kayah Li */\n#define TT_UCR_KAYAH_LI (1L << 20) /* U+A900-U+A92F */\n /* Bit 117 Rejang */\n#define TT_UCR_REJANG (1L << 21) /* U+A930-U+A95F */\n /* Bit 118 Cham */\n#define TT_UCR_CHAM (1L << 22) /* U+AA00-U+AA5F */\n /* Bit 119 Ancient Symbols */\n#define TT_UCR_ANCIENT_SYMBOLS (1L << 23) /*U+10190-U+101CF*/\n /* Bit 120 Phaistos Disc */\n#define TT_UCR_PHAISTOS_DISC (1L << 24) /*U+101D0-U+101FF*/\n /* Bit 121 Carian */\n /* Lycian */\n /* Lydian */\n#define TT_UCR_OLD_ANATOLIAN (1L << 25) /*U+102A0-U+102DF*/\n /*U+10280-U+1029F*/\n /*U+10920-U+1093F*/\n /* Bit 122 Domino Tiles */\n /* Mahjong Tiles */\n#define TT_UCR_GAME_TILES (1L << 26) /*U+1F030-U+1F09F*/\n /*U+1F000-U+1F02F*/\n /* Bit 123-127 Reserved for process-internal usage */\n\n /* */\n\n /* for backward compatibility with older FreeType versions */\n#define TT_UCR_ARABIC_PRESENTATION_A \\\n TT_UCR_ARABIC_PRESENTATION_FORMS_A\n#define TT_UCR_ARABIC_PRESENTATION_B \\\n TT_UCR_ARABIC_PRESENTATION_FORMS_B\n\n#define TT_UCR_COMBINING_DIACRITICS \\\n TT_UCR_COMBINING_DIACRITICAL_MARKS\n#define TT_UCR_COMBINING_DIACRITICS_SYMB \\\n TT_UCR_COMBINING_DIACRITICAL_MARKS_SYMB\n\n\nFT_END_HEADER\n\n#endif /* TTNAMEID_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/tttables.h", "language": "code", "loc": 776, "comment_density": 0.771, "code": "/****************************************************************************\n *\n * tttables.h\n *\n * Basic SFNT/TrueType tables definitions and interface\n * (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef TTTABLES_H_\n#define TTTABLES_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @section:\n * truetype_tables\n *\n * @title:\n * TrueType Tables\n *\n * @abstract:\n * TrueType-specific table types and functions.\n *\n * @description:\n * This section contains definitions of some basic tables specific to\n * TrueType and OpenType as well as some routines used to access and\n * process them.\n *\n * @order:\n * TT_Header\n * TT_HoriHeader\n * TT_VertHeader\n * TT_OS2\n * TT_Postscript\n * TT_PCLT\n * TT_MaxProfile\n *\n * FT_Sfnt_Tag\n * FT_Get_Sfnt_Table\n * FT_Load_Sfnt_Table\n * FT_Sfnt_Table_Info\n *\n * FT_Get_CMap_Language_ID\n * FT_Get_CMap_Format\n *\n * FT_PARAM_TAG_UNPATENTED_HINTING\n *\n */\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Header\n *\n * @description:\n * A structure to model a TrueType font header table. All fields follow\n * the OpenType specification. The 64-bit timestamps are stored in\n * two-element arrays `Created` and `Modified`, first the upper then\n * the lower 32~bits.\n */\n typedef struct TT_Header_\n {\n FT_Fixed Table_Version;\n FT_Fixed Font_Revision;\n\n FT_Long CheckSum_Adjust;\n FT_Long Magic_Number;\n\n FT_UShort Flags;\n FT_UShort Units_Per_EM;\n\n FT_ULong Created [2];\n FT_ULong Modified[2];\n\n FT_Short xMin;\n FT_Short yMin;\n FT_Short xMax;\n FT_Short yMax;\n\n FT_UShort Mac_Style;\n FT_UShort Lowest_Rec_PPEM;\n\n FT_Short Font_Direction;\n FT_Short Index_To_Loc_Format;\n FT_Short Glyph_Data_Format;\n\n } TT_Header;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_HoriHeader\n *\n * @description:\n * A structure to model a TrueType horizontal header, the 'hhea' table,\n * as well as the corresponding horizontal metrics table, 'hmtx'.\n *\n * @fields:\n * Version ::\n * The table version.\n *\n * Ascender ::\n * The font's ascender, i.e., the distance from the baseline to the\n * top-most of all glyph points found in the font.\n *\n * This value is invalid in many fonts, as it is usually set by the\n * font designer, and often reflects only a portion of the glyphs found\n * in the font (maybe ASCII).\n *\n * You should use the `sTypoAscender` field of the 'OS/2' table instead\n * if you want the correct one.\n *\n * Descender ::\n * The font's descender, i.e., the distance from the baseline to the\n * bottom-most of all glyph points found in the font. It is negative.\n *\n * This value is invalid in many fonts, as it is usually set by the\n * font designer, and often reflects only a portion of the glyphs found\n * in the font (maybe ASCII).\n *\n * You should use the `sTypoDescender` field of the 'OS/2' table\n * instead if you want the correct one.\n *\n * Line_Gap ::\n * The font's line gap, i.e., the distance to add to the ascender and\n * descender to get the BTB, i.e., the baseline-to-baseline distance\n * for the font.\n *\n * advance_Width_Max ::\n * This field is the maximum of all advance widths found in the font.\n * It can be used to compute the maximum width of an arbitrary string\n * of text.\n *\n * min_Left_Side_Bearing ::\n * The minimum left side bearing of all glyphs within the font.\n *\n * min_Right_Side_Bearing ::\n * The minimum right side bearing of all glyphs within the font.\n *\n * xMax_Extent ::\n * The maximum horizontal extent (i.e., the 'width' of a glyph's\n * bounding box) for all glyphs in the font.\n *\n * caret_Slope_Rise ::\n * The rise coefficient of the cursor's slope of the cursor\n * (slope=rise/run).\n *\n * caret_Slope_Run ::\n * The run coefficient of the cursor's slope.\n *\n * caret_Offset ::\n * The cursor's offset for slanted fonts.\n *\n * Reserved ::\n * 8~reserved bytes.\n *\n * metric_Data_Format ::\n * Always~0.\n *\n * number_Of_HMetrics ::\n * Number of HMetrics entries in the 'hmtx' table -- this value can be\n * smaller than the total number of glyphs in the font.\n *\n * long_metrics ::\n * A pointer into the 'hmtx' table.\n *\n * short_metrics ::\n * A pointer into the 'hmtx' table.\n *\n * @note:\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `caret_Slope_Rise`,\n * `caret_Slope_Run`, and `caret_Offset`.\n */\n typedef struct TT_HoriHeader_\n {\n FT_Fixed Version;\n FT_Short Ascender;\n FT_Short Descender;\n FT_Short Line_Gap;\n\n FT_UShort advance_Width_Max; /* advance width maximum */\n\n FT_Short min_Left_Side_Bearing; /* minimum left-sb */\n FT_Short min_Right_Side_Bearing; /* minimum right-sb */\n FT_Short xMax_Extent; /* xmax extents */\n FT_Short caret_Slope_Rise;\n FT_Short caret_Slope_Run;\n FT_Short caret_Offset;\n\n FT_Short Reserved[4];\n\n FT_Short metric_Data_Format;\n FT_UShort number_Of_HMetrics;\n\n /* The following fields are not defined by the OpenType specification */\n /* but they are used to connect the metrics header to the relevant */\n /* 'hmtx' table. */\n\n void* long_metrics;\n void* short_metrics;\n\n } TT_HoriHeader;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_VertHeader\n *\n * @description:\n * A structure used to model a TrueType vertical header, the 'vhea'\n * table, as well as the corresponding vertical metrics table, 'vmtx'.\n *\n * @fields:\n * Version ::\n * The table version.\n *\n * Ascender ::\n * The font's ascender, i.e., the distance from the baseline to the\n * top-most of all glyph points found in the font.\n *\n * This value is invalid in many fonts, as it is usually set by the\n * font designer, and often reflects only a portion of the glyphs found\n * in the font (maybe ASCII).\n *\n * You should use the `sTypoAscender` field of the 'OS/2' table instead\n * if you want the correct one.\n *\n * Descender ::\n * The font's descender, i.e., the distance from the baseline to the\n * bottom-most of all glyph points found in the font. It is negative.\n *\n * This value is invalid in many fonts, as it is usually set by the\n * font designer, and often reflects only a portion of the glyphs found\n * in the font (maybe ASCII).\n *\n * You should use the `sTypoDescender` field of the 'OS/2' table\n * instead if you want the correct one.\n *\n * Line_Gap ::\n * The font's line gap, i.e., the distance to add to the ascender and\n * descender to get the BTB, i.e., the baseline-to-baseline distance\n * for the font.\n *\n * advance_Height_Max ::\n * This field is the maximum of all advance heights found in the font.\n * It can be used to compute the maximum height of an arbitrary string\n * of text.\n *\n * min_Top_Side_Bearing ::\n * The minimum top side bearing of all glyphs within the font.\n *\n * min_Bottom_Side_Bearing ::\n * The minimum bottom side bearing of all glyphs within the font.\n *\n * yMax_Extent ::\n * The maximum vertical extent (i.e., the 'height' of a glyph's\n * bounding box) for all glyphs in the font.\n *\n * caret_Slope_Rise ::\n * The rise coefficient of the cursor's slope of the cursor\n * (slope=rise/run).\n *\n * caret_Slope_Run ::\n * The run coefficient of the cursor's slope.\n *\n * caret_Offset ::\n * The cursor's offset for slanted fonts.\n *\n * Reserved ::\n * 8~reserved bytes.\n *\n * metric_Data_Format ::\n * Always~0.\n *\n * number_Of_VMetrics ::\n * Number of VMetrics entries in the 'vmtx' table -- this value can be\n * smaller than the total number of glyphs in the font.\n *\n * long_metrics ::\n * A pointer into the 'vmtx' table.\n *\n * short_metrics ::\n * A pointer into the 'vmtx' table.\n *\n * @note:\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `Ascender`, `Descender`,\n * `Line_Gap`, `caret_Slope_Rise`, `caret_Slope_Run`, and `caret_Offset`.\n */\n typedef struct TT_VertHeader_\n {\n FT_Fixed Version;\n FT_Short Ascender;\n FT_Short Descender;\n FT_Short Line_Gap;\n\n FT_UShort advance_Height_Max; /* advance height maximum */\n\n FT_Short min_Top_Side_Bearing; /* minimum top-sb */\n FT_Short min_Bottom_Side_Bearing; /* minimum bottom-sb */\n FT_Short yMax_Extent; /* ymax extents */\n FT_Short caret_Slope_Rise;\n FT_Short caret_Slope_Run;\n FT_Short caret_Offset;\n\n FT_Short Reserved[4];\n\n FT_Short metric_Data_Format;\n FT_UShort number_Of_VMetrics;\n\n /* The following fields are not defined by the OpenType specification */\n /* but they are used to connect the metrics header to the relevant */\n /* 'vmtx' table. */\n\n void* long_metrics;\n void* short_metrics;\n\n } TT_VertHeader;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_OS2\n *\n * @description:\n * A structure to model a TrueType 'OS/2' table. All fields comply to\n * the OpenType specification.\n *\n * Note that we now support old Mac fonts that do not include an 'OS/2'\n * table. In this case, the `version` field is always set to 0xFFFF.\n *\n * @note:\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `sCapHeight`, `sTypoAscender`,\n * `sTypoDescender`, `sTypoLineGap`, `sxHeight`, `usWinAscent`,\n * `usWinDescent`, `yStrikeoutPosition`, `yStrikeoutSize`,\n * `ySubscriptXOffset`, `ySubScriptXSize`, `ySubscriptYOffset`,\n * `ySubscriptYSize`, `ySuperscriptXOffset`, `ySuperscriptXSize`,\n * `ySuperscriptYOffset`, and `ySuperscriptYSize`.\n *\n * Possible values for bits in the `ulUnicodeRangeX` fields are given by\n * the @TT_UCR_XXX macros.\n */\n\n typedef struct TT_OS2_\n {\n FT_UShort version; /* 0x0001 - more or 0xFFFF */\n FT_Short xAvgCharWidth;\n FT_UShort usWeightClass;\n FT_UShort usWidthClass;\n FT_UShort fsType;\n FT_Short ySubscriptXSize;\n FT_Short ySubscriptYSize;\n FT_Short ySubscriptXOffset;\n FT_Short ySubscriptYOffset;\n FT_Short ySuperscriptXSize;\n FT_Short ySuperscriptYSize;\n FT_Short ySuperscriptXOffset;\n FT_Short ySuperscriptYOffset;\n FT_Short yStrikeoutSize;\n FT_Short yStrikeoutPosition;\n FT_Short sFamilyClass;\n\n FT_Byte panose[10];\n\n FT_ULong ulUnicodeRange1; /* Bits 0-31 */\n FT_ULong ulUnicodeRange2; /* Bits 32-63 */\n FT_ULong ulUnicodeRange3; /* Bits 64-95 */\n FT_ULong ulUnicodeRange4; /* Bits 96-127 */\n\n FT_Char achVendID[4];\n\n FT_UShort fsSelection;\n FT_UShort usFirstCharIndex;\n FT_UShort usLastCharIndex;\n FT_Short sTypoAscender;\n FT_Short sTypoDescender;\n FT_Short sTypoLineGap;\n FT_UShort usWinAscent;\n FT_UShort usWinDescent;\n\n /* only version 1 and higher: */\n\n FT_ULong ulCodePageRange1; /* Bits 0-31 */\n FT_ULong ulCodePageRange2; /* Bits 32-63 */\n\n /* only version 2 and higher: */\n\n FT_Short sxHeight;\n FT_Short sCapHeight;\n FT_UShort usDefaultChar;\n FT_UShort usBreakChar;\n FT_UShort usMaxContext;\n\n /* only version 5 and higher: */\n\n FT_UShort usLowerOpticalPointSize; /* in twips (1/20th points) */\n FT_UShort usUpperOpticalPointSize; /* in twips (1/20th points) */\n\n } TT_OS2;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Postscript\n *\n * @description:\n * A structure to model a TrueType 'post' table. All fields comply to\n * the OpenType specification. This structure does not reference a\n * font's PostScript glyph names; use @FT_Get_Glyph_Name to retrieve\n * them.\n *\n * @note:\n * For an OpenType variation font, the values of the following fields can\n * change after a call to @FT_Set_Var_Design_Coordinates (and friends) if\n * the font contains an 'MVAR' table: `underlinePosition` and\n * `underlineThickness`.\n */\n typedef struct TT_Postscript_\n {\n FT_Fixed FormatType;\n FT_Fixed italicAngle;\n FT_Short underlinePosition;\n FT_Short underlineThickness;\n FT_ULong isFixedPitch;\n FT_ULong minMemType42;\n FT_ULong maxMemType42;\n FT_ULong minMemType1;\n FT_ULong maxMemType1;\n\n /* Glyph names follow in the 'post' table, but we don't */\n /* load them by default. */\n\n } TT_Postscript;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_PCLT\n *\n * @description:\n * A structure to model a TrueType 'PCLT' table. All fields comply to\n * the OpenType specification.\n */\n typedef struct TT_PCLT_\n {\n FT_Fixed Version;\n FT_ULong FontNumber;\n FT_UShort Pitch;\n FT_UShort xHeight;\n FT_UShort Style;\n FT_UShort TypeFamily;\n FT_UShort CapHeight;\n FT_UShort SymbolSet;\n FT_Char TypeFace[16];\n FT_Char CharacterComplement[8];\n FT_Char FileName[6];\n FT_Char StrokeWeight;\n FT_Char WidthType;\n FT_Byte SerifStyle;\n FT_Byte Reserved;\n\n } TT_PCLT;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_MaxProfile\n *\n * @description:\n * The maximum profile ('maxp') table contains many max values, which can\n * be used to pre-allocate arrays for speeding up glyph loading and\n * hinting.\n *\n * @fields:\n * version ::\n * The version number.\n *\n * numGlyphs ::\n * The number of glyphs in this TrueType font.\n *\n * maxPoints ::\n * The maximum number of points in a non-composite TrueType glyph. See\n * also `maxCompositePoints`.\n *\n * maxContours ::\n * The maximum number of contours in a non-composite TrueType glyph.\n * See also `maxCompositeContours`.\n *\n * maxCompositePoints ::\n * The maximum number of points in a composite TrueType glyph. See\n * also `maxPoints`.\n *\n * maxCompositeContours ::\n * The maximum number of contours in a composite TrueType glyph. See\n * also `maxContours`.\n *\n * maxZones ::\n * The maximum number of zones used for glyph hinting.\n *\n * maxTwilightPoints ::\n * The maximum number of points in the twilight zone used for glyph\n * hinting.\n *\n * maxStorage ::\n * The maximum number of elements in the storage area used for glyph\n * hinting.\n *\n * maxFunctionDefs ::\n * The maximum number of function definitions in the TrueType bytecode\n * for this font.\n *\n * maxInstructionDefs ::\n * The maximum number of instruction definitions in the TrueType\n * bytecode for this font.\n *\n * maxStackElements ::\n * The maximum number of stack elements used during bytecode\n * interpretation.\n *\n * maxSizeOfInstructions ::\n * The maximum number of TrueType opcodes used for glyph hinting.\n *\n * maxComponentElements ::\n * The maximum number of simple (i.e., non-composite) glyphs in a\n * composite glyph.\n *\n * maxComponentDepth ::\n * The maximum nesting depth of composite glyphs.\n *\n * @note:\n * This structure is only used during font loading.\n */\n typedef struct TT_MaxProfile_\n {\n FT_Fixed version;\n FT_UShort numGlyphs;\n FT_UShort maxPoints;\n FT_UShort maxContours;\n FT_UShort maxCompositePoints;\n FT_UShort maxCompositeContours;\n FT_UShort maxZones;\n FT_UShort maxTwilightPoints;\n FT_UShort maxStorage;\n FT_UShort maxFunctionDefs;\n FT_UShort maxInstructionDefs;\n FT_UShort maxStackElements;\n FT_UShort maxSizeOfInstructions;\n FT_UShort maxComponentElements;\n FT_UShort maxComponentDepth;\n\n } TT_MaxProfile;\n\n\n /**************************************************************************\n *\n * @enum:\n * FT_Sfnt_Tag\n *\n * @description:\n * An enumeration to specify indices of SFNT tables loaded and parsed by\n * FreeType during initialization of an SFNT font. Used in the\n * @FT_Get_Sfnt_Table API function.\n *\n * @values:\n * FT_SFNT_HEAD ::\n * To access the font's @TT_Header structure.\n *\n * FT_SFNT_MAXP ::\n * To access the font's @TT_MaxProfile structure.\n *\n * FT_SFNT_OS2 ::\n * To access the font's @TT_OS2 structure.\n *\n * FT_SFNT_HHEA ::\n * To access the font's @TT_HoriHeader structure.\n *\n * FT_SFNT_VHEA ::\n * To access the font's @TT_VertHeader structure.\n *\n * FT_SFNT_POST ::\n * To access the font's @TT_Postscript structure.\n *\n * FT_SFNT_PCLT ::\n * To access the font's @TT_PCLT structure.\n */\n typedef enum FT_Sfnt_Tag_\n {\n FT_SFNT_HEAD,\n FT_SFNT_MAXP,\n FT_SFNT_OS2,\n FT_SFNT_HHEA,\n FT_SFNT_VHEA,\n FT_SFNT_POST,\n FT_SFNT_PCLT,\n\n FT_SFNT_MAX\n\n } FT_Sfnt_Tag;\n\n /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag` */\n /* values instead */\n#define ft_sfnt_head FT_SFNT_HEAD\n#define ft_sfnt_maxp FT_SFNT_MAXP\n#define ft_sfnt_os2 FT_SFNT_OS2\n#define ft_sfnt_hhea FT_SFNT_HHEA\n#define ft_sfnt_vhea FT_SFNT_VHEA\n#define ft_sfnt_post FT_SFNT_POST\n#define ft_sfnt_pclt FT_SFNT_PCLT\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Sfnt_Table\n *\n * @description:\n * Return a pointer to a given SFNT table stored within a face.\n *\n * @input:\n * face ::\n * A handle to the source.\n *\n * tag ::\n * The index of the SFNT table.\n *\n * @return:\n * A type-less pointer to the table. This will be `NULL` in case of\n * error, or if the corresponding table was not found **OR** loaded from\n * the file.\n *\n * Use a typecast according to `tag` to access the structure elements.\n *\n * @note:\n * The table is owned by the face object and disappears with it.\n *\n * This function is only useful to access SFNT tables that are loaded by\n * the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for a\n * list.\n *\n * @example:\n * Here is an example demonstrating access to the 'vhea' table.\n *\n * ```\n * TT_VertHeader* vert_header;\n *\n *\n * vert_header =\n * (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA );\n * ```\n */\n FT_EXPORT( void* )\n FT_Get_Sfnt_Table( FT_Face face,\n FT_Sfnt_Tag tag );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Load_Sfnt_Table\n *\n * @description:\n * Load any SFNT font table into client memory.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * tag ::\n * The four-byte tag of the table to load. Use value~0 if you want to\n * access the whole font file. Otherwise, you can use one of the\n * definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new\n * one with @FT_MAKE_TAG.\n *\n * offset ::\n * The starting offset in the table (or file if tag~==~0).\n *\n * @output:\n * buffer ::\n * The target buffer address. The client must ensure that the memory\n * array is big enough to hold the data.\n *\n * @inout:\n * length ::\n * If the `length` parameter is `NULL`, try to load the whole table.\n * Return an error code if it fails.\n *\n * Else, if `*length` is~0, exit immediately while returning the\n * table's (or file) full size in it.\n *\n * Else the number of bytes to read from the table or file, from the\n * starting offset.\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * If you need to determine the table's length you should first call this\n * function with `*length` set to~0, as in the following example:\n *\n * ```\n * FT_ULong length = 0;\n *\n *\n * error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );\n * if ( error ) { ... table does not exist ... }\n *\n * buffer = malloc( length );\n * if ( buffer == NULL ) { ... not enough memory ... }\n *\n * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length );\n * if ( error ) { ... could not load table ... }\n * ```\n *\n * Note that structures like @TT_Header or @TT_OS2 can't be used with\n * this function; they are limited to @FT_Get_Sfnt_Table. Reason is that\n * those structures depend on the processor architecture, with varying\n * size (e.g. 32bit vs. 64bit) or order (big endian vs. little endian).\n *\n */\n FT_EXPORT( FT_Error )\n FT_Load_Sfnt_Table( FT_Face face,\n FT_ULong tag,\n FT_Long offset,\n FT_Byte* buffer,\n FT_ULong* length );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Sfnt_Table_Info\n *\n * @description:\n * Return information on an SFNT table.\n *\n * @input:\n * face ::\n * A handle to the source face.\n *\n * table_index ::\n * The index of an SFNT table. The function returns\n * FT_Err_Table_Missing for an invalid value.\n *\n * @inout:\n * tag ::\n * The name tag of the SFNT table. If the value is `NULL`,\n * `table_index` is ignored, and `length` returns the number of SFNT\n * tables in the font.\n *\n * @output:\n * length ::\n * The length of the SFNT table (or the number of SFNT tables,\n * depending on `tag`).\n *\n * @return:\n * FreeType error code. 0~means success.\n *\n * @note:\n * While parsing fonts, FreeType handles SFNT tables with length zero as\n * missing.\n *\n */\n FT_EXPORT( FT_Error )\n FT_Sfnt_Table_Info( FT_Face face,\n FT_UInt table_index,\n FT_ULong *tag,\n FT_ULong *length );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CMap_Language_ID\n *\n * @description:\n * Return cmap language ID as specified in the OpenType standard.\n * Definitions of language ID values are in file @FT_TRUETYPE_IDS_H.\n *\n * @input:\n * charmap ::\n * The target charmap.\n *\n * @return:\n * The language ID of `charmap`. If `charmap` doesn't belong to an SFNT\n * face, just return~0 as the default value.\n *\n * For a format~14 cmap (to access Unicode IVS), the return value is\n * 0xFFFFFFFF.\n */\n FT_EXPORT( FT_ULong )\n FT_Get_CMap_Language_ID( FT_CharMap charmap );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_CMap_Format\n *\n * @description:\n * Return the format of an SFNT 'cmap' table.\n *\n * @input:\n * charmap ::\n * The target charmap.\n *\n * @return:\n * The format of `charmap`. If `charmap` doesn't belong to an SFNT face,\n * return -1.\n */\n FT_EXPORT( FT_Long )\n FT_Get_CMap_Format( FT_CharMap charmap );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* TTTABLES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/tttags.h", "language": "code", "loc": 108, "comment_density": 0.185, "code": "/****************************************************************************\n *\n * tttags.h\n *\n * Tags for TrueType and OpenType tables (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef TTAGS_H_\n#define TTAGS_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n#ifdef FREETYPE_H\n#error \"freetype.h of FreeType 1 has been loaded!\"\n#error \"Please fix the directory search order for header files\"\n#error \"so that freetype.h of FreeType 2 is found first.\"\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' )\n#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' )\n#define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' )\n#define TTAG_BDF FT_MAKE_TAG( 'B', 'D', 'F', ' ' )\n#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' )\n#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' )\n#define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' )\n#define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' )\n#define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' )\n#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' )\n#define TTAG_CFF2 FT_MAKE_TAG( 'C', 'F', 'F', '2' )\n#define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' )\n#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' )\n#define TTAG_COLR FT_MAKE_TAG( 'C', 'O', 'L', 'R' )\n#define TTAG_CPAL FT_MAKE_TAG( 'C', 'P', 'A', 'L' )\n#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' )\n#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' )\n#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' )\n#define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' )\n#define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' )\n#define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' )\n#define TTAG_feat FT_MAKE_TAG( 'f', 'e', 'a', 't' )\n#define TTAG_FOND FT_MAKE_TAG( 'F', 'O', 'N', 'D' )\n#define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' )\n#define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' )\n#define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' )\n#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' )\n#define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' )\n#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' )\n#define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' )\n#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' )\n#define TTAG_HVAR FT_MAKE_TAG( 'H', 'V', 'A', 'R' )\n#define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' )\n#define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' )\n#define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' )\n#define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' )\n#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' )\n#define TTAG_just FT_MAKE_TAG( 'j', 'u', 's', 't' )\n#define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' )\n#define TTAG_lcar FT_MAKE_TAG( 'l', 'c', 'a', 'r' )\n#define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' )\n#define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' )\n#define TTAG_LWFN FT_MAKE_TAG( 'L', 'W', 'F', 'N' )\n#define TTAG_MATH FT_MAKE_TAG( 'M', 'A', 'T', 'H' )\n#define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' )\n#define TTAG_META FT_MAKE_TAG( 'M', 'E', 'T', 'A' )\n#define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' )\n#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' )\n#define TTAG_mort FT_MAKE_TAG( 'm', 'o', 'r', 't' )\n#define TTAG_morx FT_MAKE_TAG( 'm', 'o', 'r', 'x' )\n#define TTAG_MVAR FT_MAKE_TAG( 'M', 'V', 'A', 'R' )\n#define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' )\n#define TTAG_opbd FT_MAKE_TAG( 'o', 'p', 'b', 'd' )\n#define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' )\n#define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' )\n#define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' )\n#define TTAG_POST FT_MAKE_TAG( 'P', 'O', 'S', 'T' )\n#define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' )\n#define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' )\n#define TTAG_prop FT_MAKE_TAG( 'p', 'r', 'o', 'p' )\n#define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' )\n#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' )\n#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' )\n#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' )\n#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' )\n#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' )\n#define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' )\n#define TTAG_TYP1 FT_MAKE_TAG( 'T', 'Y', 'P', '1' )\n#define TTAG_typ1 FT_MAKE_TAG( 't', 'y', 'p', '1' )\n#define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' )\n#define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' )\n#define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' )\n#define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' )\n#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' )\n#define TTAG_wOF2 FT_MAKE_TAG( 'w', 'O', 'F', '2' )\n\n/* used by \"Keyboard.dfont\" on legacy Mac OS X */\n#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' )\n\n/* used by \"LastResort.dfont\" on legacy Mac OS X */\n#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' )\n\n\nFT_END_HEADER\n\n#endif /* TTAGS_H_ */\n\n\n/* END */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.8, "dedup_hash": "41e3b20185205a1c", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_freetype_config", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Config", "api": "OpenGL Core", "glsl_version": null, "topic": "shadows", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "includes/freetype/config/ftconfig.h", "language": "code", "loc": 452, "comment_density": 0.569, "code": "/****************************************************************************\n *\n * ftconfig.h\n *\n * ANSI-specific configuration file (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This header file contains a number of macro definitions that are used by\n * the rest of the engine. Most of the macros here are automatically\n * determined at compile time, and you should not need to change it to port\n * FreeType, except to compile the library with a non-ANSI compiler.\n *\n * Note however that if some specific modifications are needed, we advise\n * you to place a modified copy in your build directory.\n *\n * The build directory is usually `builds/`, and contains\n * system-specific files that are always included first when building the\n * library.\n *\n * This ANSI version should stay in `include/config/`.\n *\n */\n\n#ifndef FTCONFIG_H_\n#define FTCONFIG_H_\n\n#include \n#include FT_CONFIG_OPTIONS_H\n#include FT_CONFIG_STANDARD_LIBRARY_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * PLATFORM-SPECIFIC CONFIGURATION MACROS\n *\n * These macros can be toggled to suit a specific system. The current ones\n * are defaults used to compile FreeType in an ANSI C environment (16bit\n * compilers are also supported). Copy this file to your own\n * `builds/` directory, and edit it to port the engine.\n *\n */\n\n\n /* There are systems (like the Texas Instruments 'C54x) where a `char` */\n /* has 16~bits. ANSI~C says that `sizeof(char)` is always~1. Since an */\n /* `int` has 16~bits also for this system, `sizeof(int)` gives~1 which */\n /* is probably unexpected. */\n /* */\n /* `CHAR_BIT` (defined in `limits.h`) gives the number of bits in a */\n /* `char` type. */\n\n#ifndef FT_CHAR_BIT\n#define FT_CHAR_BIT CHAR_BIT\n#endif\n\n\n /* The size of an `int` type. */\n#if FT_UINT_MAX == 0xFFFFUL\n#define FT_SIZEOF_INT ( 16 / FT_CHAR_BIT )\n#elif FT_UINT_MAX == 0xFFFFFFFFUL\n#define FT_SIZEOF_INT ( 32 / FT_CHAR_BIT )\n#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL\n#define FT_SIZEOF_INT ( 64 / FT_CHAR_BIT )\n#else\n#error \"Unsupported size of `int' type!\"\n#endif\n\n /* The size of a `long` type. A five-byte `long` (as used e.g. on the */\n /* DM642) is recognized but avoided. */\n#if FT_ULONG_MAX == 0xFFFFFFFFUL\n#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )\n#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL\n#define FT_SIZEOF_LONG ( 32 / FT_CHAR_BIT )\n#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL\n#define FT_SIZEOF_LONG ( 64 / FT_CHAR_BIT )\n#else\n#error \"Unsupported size of `long' type!\"\n#endif\n\n\n /* `FT_UNUSED` indicates that a given parameter is not used -- */\n /* this is only used to get rid of unpleasant compiler warnings. */\n#ifndef FT_UNUSED\n#define FT_UNUSED( arg ) ( (arg) = (arg) )\n#endif\n\n\n /**************************************************************************\n *\n * AUTOMATIC CONFIGURATION MACROS\n *\n * These macros are computed from the ones defined above. Don't touch\n * their definition, unless you know precisely what you are doing. No\n * porter should need to mess with them.\n *\n */\n\n\n /**************************************************************************\n *\n * Mac support\n *\n * This is the only necessary change, so it is defined here instead\n * providing a new configuration file.\n */\n#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )\n /* No Carbon frameworks for 64bit 10.4.x. */\n /* `AvailabilityMacros.h` is available since Mac OS X 10.2, */\n /* so guess the system version by maximum errno before inclusion. */\n#include \n#ifdef ECANCELED /* defined since 10.2 */\n#include \"AvailabilityMacros.h\"\n#endif\n#if defined( __LP64__ ) && \\\n ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )\n#undef FT_MACINTOSH\n#endif\n\n#elif defined( __SC__ ) || defined( __MRC__ )\n /* Classic MacOS compilers */\n#include \"ConditionalMacros.h\"\n#if TARGET_OS_MAC\n#define FT_MACINTOSH 1\n#endif\n\n#endif\n\n\n /* Fix compiler warning with sgi compiler. */\n#if defined( __sgi ) && !defined( __GNUC__ )\n#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )\n#pragma set woff 3505\n#endif\n#endif\n\n\n /**************************************************************************\n *\n * @section:\n * basic_types\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Int16\n *\n * @description:\n * A typedef for a 16bit signed integer type.\n */\n typedef signed short FT_Int16;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UInt16\n *\n * @description:\n * A typedef for a 16bit unsigned integer type.\n */\n typedef unsigned short FT_UInt16;\n\n /* */\n\n\n /* this #if 0 ... #endif clause is for documentation purposes */\n#if 0\n\n /**************************************************************************\n *\n * @type:\n * FT_Int32\n *\n * @description:\n * A typedef for a 32bit signed integer type. The size depends on the\n * configuration.\n */\n typedef signed XXX FT_Int32;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UInt32\n *\n * A typedef for a 32bit unsigned integer type. The size depends on the\n * configuration.\n */\n typedef unsigned XXX FT_UInt32;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_Int64\n *\n * A typedef for a 64bit signed integer type. The size depends on the\n * configuration. Only defined if there is real 64bit support;\n * otherwise, it gets emulated with a structure (if necessary).\n */\n typedef signed XXX FT_Int64;\n\n\n /**************************************************************************\n *\n * @type:\n * FT_UInt64\n *\n * A typedef for a 64bit unsigned integer type. The size depends on the\n * configuration. Only defined if there is real 64bit support;\n * otherwise, it gets emulated with a structure (if necessary).\n */\n typedef unsigned XXX FT_UInt64;\n\n /* */\n\n#endif\n\n#if FT_SIZEOF_INT == ( 32 / FT_CHAR_BIT )\n\n typedef signed int FT_Int32;\n typedef unsigned int FT_UInt32;\n\n#elif FT_SIZEOF_LONG == ( 32 / FT_CHAR_BIT )\n\n typedef signed long FT_Int32;\n typedef unsigned long FT_UInt32;\n\n#else\n#error \"no 32bit type found -- please check your configuration files\"\n#endif\n\n\n /* look up an integer type that is at least 32~bits */\n#if FT_SIZEOF_INT >= ( 32 / FT_CHAR_BIT )\n\n typedef int FT_Fast;\n typedef unsigned int FT_UFast;\n\n#elif FT_SIZEOF_LONG >= ( 32 / FT_CHAR_BIT )\n\n typedef long FT_Fast;\n typedef unsigned long FT_UFast;\n\n#endif\n\n\n /* determine whether we have a 64-bit `int` type for platforms without */\n /* Autoconf */\n#if FT_SIZEOF_LONG == ( 64 / FT_CHAR_BIT )\n\n /* `FT_LONG64` must be defined if a 64-bit type is available */\n#define FT_LONG64\n#define FT_INT64 long\n#define FT_UINT64 unsigned long\n\n /**************************************************************************\n *\n * A 64-bit data type may create compilation problems if you compile in\n * strict ANSI mode. To avoid them, we disable other 64-bit data types if\n * `__STDC__` is defined. You can however ignore this rule by defining the\n * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.\n */\n#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )\n\n#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L\n\n#define FT_LONG64\n#define FT_INT64 long long int\n#define FT_UINT64 unsigned long long int\n\n#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */\n\n /* this compiler provides the `__int64` type */\n#define FT_LONG64\n#define FT_INT64 __int64\n#define FT_UINT64 unsigned __int64\n\n#elif defined( __BORLANDC__ ) /* Borland C++ */\n\n /* XXXX: We should probably check the value of `__BORLANDC__` in order */\n /* to test the compiler version. */\n\n /* this compiler provides the `__int64` type */\n#define FT_LONG64\n#define FT_INT64 __int64\n#define FT_UINT64 unsigned __int64\n\n#elif defined( __WATCOMC__ ) /* Watcom C++ */\n\n /* Watcom doesn't provide 64-bit data types */\n\n#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */\n\n#define FT_LONG64\n#define FT_INT64 long long int\n#define FT_UINT64 unsigned long long int\n\n#elif defined( __GNUC__ )\n\n /* GCC provides the `long long` type */\n#define FT_LONG64\n#define FT_INT64 long long int\n#define FT_UINT64 unsigned long long int\n\n#endif /* __STDC_VERSION__ >= 199901L */\n\n#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */\n\n#ifdef FT_LONG64\n typedef FT_INT64 FT_Int64;\n typedef FT_UINT64 FT_UInt64;\n#endif\n\n\n#ifdef _WIN64\n /* only 64bit Windows uses the LLP64 data model, i.e., */\n /* 32bit integers, 64bit pointers */\n#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)\n#else\n#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)\n#endif\n\n\n /**************************************************************************\n *\n * miscellaneous\n *\n */\n\n\n#define FT_BEGIN_STMNT do {\n#define FT_END_STMNT } while ( 0 )\n#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT\n\n\n /* `typeof` condition taken from gnulib's `intprops.h` header file */\n#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \\\n ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \\\n defined( __IBM__TYPEOF__ ) ) || \\\n ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )\n#define FT_TYPEOF( type ) ( __typeof__ ( type ) )\n#else\n#define FT_TYPEOF( type ) /* empty */\n#endif\n\n\n /* Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define, */\n /* respectively, a function that gets used only within the scope of a */\n /* module. Normally, both the header and source code files for such a */\n /* function are within a single module directory. */\n /* */\n /* Intra-module arrays should be tagged with `FT_LOCAL_ARRAY` and */\n /* `FT_LOCAL_ARRAY_DEF`. */\n /* */\n#ifdef FT_MAKE_OPTION_SINGLE_OBJECT\n\n#define FT_LOCAL( x ) static x\n#define FT_LOCAL_DEF( x ) static x\n\n#else\n\n#ifdef __cplusplus\n#define FT_LOCAL( x ) extern \"C\" x\n#define FT_LOCAL_DEF( x ) extern \"C\" x\n#else\n#define FT_LOCAL( x ) extern x\n#define FT_LOCAL_DEF( x ) x\n#endif\n\n#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */\n\n#define FT_LOCAL_ARRAY( x ) extern const x\n#define FT_LOCAL_ARRAY_DEF( x ) const x\n\n\n /* Use `FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, */\n /* functions that are used in more than a single module. In the */\n /* current setup this implies that the declaration is in a header file */\n /* in the `include/freetype/internal` directory, and the function body */\n /* is in a file in `src/base`. */\n /* */\n#ifndef FT_BASE\n\n#ifdef __cplusplus\n#define FT_BASE( x ) extern \"C\" x\n#else\n#define FT_BASE( x ) extern x\n#endif\n\n#endif /* !FT_BASE */\n\n\n#ifndef FT_BASE_DEF\n\n#ifdef __cplusplus\n#define FT_BASE_DEF( x ) x\n#else\n#define FT_BASE_DEF( x ) x\n#endif\n\n#endif /* !FT_BASE_DEF */\n\n\n /* When compiling FreeType as a DLL or DSO with hidden visibility */\n /* some systems/compilers need a special attribute in front OR after */\n /* the return type of function declarations. */\n /* */\n /* Two macros are used within the FreeType source code to define */\n /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`. */\n /* */\n /* - `FT_EXPORT( return_type )` */\n /* */\n /* is used in a function declaration, as in */\n /* */\n /* ``` */\n /* FT_EXPORT( FT_Error ) */\n /* FT_Init_FreeType( FT_Library* alibrary ); */\n /* ``` */\n /* */\n /* - `FT_EXPORT_DEF( return_type )` */\n /* */\n /* is used in a function definition, as in */\n /* */\n /* ``` */\n /* FT_EXPORT_DEF( FT_Error ) */\n /* FT_Init_FreeType( FT_Library* alibrary ) */\n /* { */\n /* ... some code ... */\n /* return FT_Err_Ok; */\n /* } */\n /* ``` */\n /* */\n /* You can provide your own implementation of `FT_EXPORT` and */\n /* `FT_EXPORT_DEF` here if you want. */\n /* */\n /* To export a variable, use `FT_EXPORT_VAR`. */\n /* */\n#ifndef FT_EXPORT\n\n#ifdef FT2_BUILD_LIBRARY\n\n#if defined( _WIN32 ) && defined( DLL_EXPORT )\n#define FT_EXPORT( x ) __declspec( dllexport ) x\n#elif defined( __GNUC__ ) && __GNUC__ >= 4\n#define FT_EXPORT( x ) __attribute__(( visibility( \"default\" ) )) x\n#elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550\n#define FT_EXPORT( x ) __global x\n#elif defined( __cplusplus )\n#define FT_EXPORT( x ) extern \"C\" x\n#else\n#define FT_EXPORT( x ) extern x\n#endif\n\n#else\n\n#if defined( _WIN32 ) && defined( DLL_IMPORT )\n#define FT_EXPORT( x ) __declspec( dllimport ) x\n#elif defined( __cplusplus )\n#define FT_EXPORT( x ) extern \"C\" x\n#else\n#define FT_EXPORT( x ) extern x\n#endif\n\n#endif\n\n#endif /* !FT_EXPORT */\n\n\n#ifndef FT_EXPORT_DEF\n\n#ifdef __cplusplus\n#define FT_EXPORT_DEF( x ) extern \"C\" x\n#else\n#define FT_EXPORT_DEF( x ) extern x\n#endif\n\n#endif /* !FT_EXPORT_DEF */\n\n\n#ifndef FT_EXPORT_VAR\n\n#ifdef __cplusplus\n#define FT_EXPORT_VAR( x ) extern \"C\" x\n#else\n#define FT_EXPORT_VAR( x ) extern x\n#endif\n\n#endif /* !FT_EXPORT_VAR */\n\n\n /* The following macros are needed to compile the library with a */\n /* C++ compiler and with 16bit compilers. */\n /* */\n\n /* This is special. Within C++, you must specify `extern \"C\"` for */\n /* functions which are used via function pointers, and you also */\n /* must do that for structures which contain function pointers to */\n /* assure C linkage -- it's not possible to have (local) anonymous */\n /* functions which are accessed by (global) function pointers. */\n /* */\n /* */\n /* FT_CALLBACK_DEF is used to _define_ a callback function, */\n /* located in the same source code file as the structure that uses */\n /* it. */\n /* */\n /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */\n /* and define a callback function, respectively, in a similar way */\n /* as FT_BASE and FT_BASE_DEF work. */\n /* */\n /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */\n /* contains pointers to callback functions. */\n /* */\n /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */\n /* that contains pointers to callback functions. */\n /* */\n /* */\n /* Some 16bit compilers have to redefine these macros to insert */\n /* the infamous `_cdecl` or `__fastcall` declarations. */\n /* */\n#ifndef FT_CALLBACK_DEF\n#ifdef __cplusplus\n#define FT_CALLBACK_DEF( x ) extern \"C\" x\n#else\n#define FT_CALLBACK_DEF( x ) static x\n#endif\n#endif /* FT_CALLBACK_DEF */\n\n#ifndef FT_BASE_CALLBACK\n#ifdef __cplusplus\n#define FT_BASE_CALLBACK( x ) extern \"C\" x\n#define FT_BASE_CALLBACK_DEF( x ) extern \"C\" x\n#else\n#define FT_BASE_CALLBACK( x ) extern x\n#define FT_BASE_CALLBACK_DEF( x ) x\n#endif\n#endif /* FT_BASE_CALLBACK */\n\n#ifndef FT_CALLBACK_TABLE\n#ifdef __cplusplus\n#define FT_CALLBACK_TABLE extern \"C\"\n#define FT_CALLBACK_TABLE_DEF extern \"C\"\n#else\n#define FT_CALLBACK_TABLE extern\n#define FT_CALLBACK_TABLE_DEF /* nothing */\n#endif\n#endif /* FT_CALLBACK_TABLE */\n\n\nFT_END_HEADER\n\n\n#endif /* FTCONFIG_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/config/ftheader.h", "language": "code", "loc": 693, "comment_density": 0.877, "code": "/****************************************************************************\n *\n * ftheader.h\n *\n * Build macros of the FreeType 2 library.\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n#ifndef FTHEADER_H_\n#define FTHEADER_H_\n\n\n /*@***********************************************************************/\n /* */\n /* */\n /* FT_BEGIN_HEADER */\n /* */\n /* */\n /* This macro is used in association with @FT_END_HEADER in header */\n /* files to ensure that the declarations within are properly */\n /* encapsulated in an `extern \"C\" { .. }` block when included from a */\n /* C++ compiler. */\n /* */\n#ifdef __cplusplus\n#define FT_BEGIN_HEADER extern \"C\" {\n#else\n#define FT_BEGIN_HEADER /* nothing */\n#endif\n\n\n /*@***********************************************************************/\n /* */\n /* */\n /* FT_END_HEADER */\n /* */\n /* */\n /* This macro is used in association with @FT_BEGIN_HEADER in header */\n /* files to ensure that the declarations within are properly */\n /* encapsulated in an `extern \"C\" { .. }` block when included from a */\n /* C++ compiler. */\n /* */\n#ifdef __cplusplus\n#define FT_END_HEADER }\n#else\n#define FT_END_HEADER /* nothing */\n#endif\n\n\n /**************************************************************************\n *\n * Aliases for the FreeType 2 public and configuration files.\n *\n */\n\n /**************************************************************************\n *\n * @section:\n * header_file_macros\n *\n * @title:\n * Header File Macros\n *\n * @abstract:\n * Macro definitions used to `#include` specific header files.\n *\n * @description:\n * The following macros are defined to the name of specific FreeType~2\n * header files. They can be used directly in `#include` statements as\n * in:\n *\n * ```\n * #include FT_FREETYPE_H\n * #include FT_MULTIPLE_MASTERS_H\n * #include FT_GLYPH_H\n * ```\n *\n * There are several reasons why we are now using macros to name public\n * header files. The first one is that such macros are not limited to\n * the infamous 8.3~naming rule required by DOS (and\n * `FT_MULTIPLE_MASTERS_H` is a lot more meaningful than `ftmm.h`).\n *\n * The second reason is that it allows for more flexibility in the way\n * FreeType~2 is installed on a given system.\n *\n */\n\n\n /* configuration files */\n\n /**************************************************************************\n *\n * @macro:\n * FT_CONFIG_CONFIG_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * FreeType~2 configuration data.\n *\n */\n#ifndef FT_CONFIG_CONFIG_H\n#define FT_CONFIG_CONFIG_H \n#endif\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CONFIG_STANDARD_LIBRARY_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * FreeType~2 interface to the standard C library functions.\n *\n */\n#ifndef FT_CONFIG_STANDARD_LIBRARY_H\n#define FT_CONFIG_STANDARD_LIBRARY_H \n#endif\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CONFIG_OPTIONS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * FreeType~2 project-specific configuration options.\n *\n */\n#ifndef FT_CONFIG_OPTIONS_H\n#define FT_CONFIG_OPTIONS_H \n#endif\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CONFIG_MODULES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * list of FreeType~2 modules that are statically linked to new library\n * instances in @FT_Init_FreeType.\n *\n */\n#ifndef FT_CONFIG_MODULES_H\n#define FT_CONFIG_MODULES_H \n#endif\n\n /* */\n\n /* public headers */\n\n /**************************************************************************\n *\n * @macro:\n * FT_FREETYPE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * base FreeType~2 API.\n *\n */\n#define FT_FREETYPE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ERRORS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * list of FreeType~2 error codes (and messages).\n *\n * It is included by @FT_FREETYPE_H.\n *\n */\n#define FT_ERRORS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MODULE_ERRORS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * list of FreeType~2 module error offsets (and messages).\n *\n */\n#define FT_MODULE_ERRORS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SYSTEM_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 interface to low-level operations (i.e., memory management\n * and stream i/o).\n *\n * It is included by @FT_FREETYPE_H.\n *\n */\n#define FT_SYSTEM_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_IMAGE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing type\n * definitions related to glyph images (i.e., bitmaps, outlines,\n * scan-converter parameters).\n *\n * It is included by @FT_FREETYPE_H.\n *\n */\n#define FT_IMAGE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TYPES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * basic data types defined by FreeType~2.\n *\n * It is included by @FT_FREETYPE_H.\n *\n */\n#define FT_TYPES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_LIST_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * list management API of FreeType~2.\n *\n * (Most applications will never need to include this file.)\n *\n */\n#define FT_LIST_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_OUTLINE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * scalable outline management API of FreeType~2.\n *\n */\n#define FT_OUTLINE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SIZES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API which manages multiple @FT_Size objects per face.\n *\n */\n#define FT_SIZES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MODULE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * module management API of FreeType~2.\n *\n */\n#define FT_MODULE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_RENDER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * renderer module management API of FreeType~2.\n *\n */\n#define FT_RENDER_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DRIVER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the driver modules.\n *\n */\n#define FT_DRIVER_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_AUTOHINTER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the auto-hinting module.\n *\n * Deprecated since version~2.9; use @FT_DRIVER_H instead.\n *\n */\n#define FT_AUTOHINTER_H FT_DRIVER_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CFF_DRIVER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the CFF driver module.\n *\n * Deprecated since version~2.9; use @FT_DRIVER_H instead.\n *\n */\n#define FT_CFF_DRIVER_H FT_DRIVER_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRUETYPE_DRIVER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the TrueType driver module.\n *\n * Deprecated since version~2.9; use @FT_DRIVER_H instead.\n *\n */\n#define FT_TRUETYPE_DRIVER_H FT_DRIVER_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_PCF_DRIVER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing\n * structures and macros related to the PCF driver module.\n *\n * Deprecated since version~2.9; use @FT_DRIVER_H instead.\n *\n */\n#define FT_PCF_DRIVER_H FT_DRIVER_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TYPE1_TABLES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * types and API specific to the Type~1 format.\n *\n */\n#define FT_TYPE1_TABLES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRUETYPE_IDS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * enumeration values which identify name strings, languages, encodings,\n * etc. This file really contains a _large_ set of constant macro\n * definitions, taken from the TrueType and OpenType specifications.\n *\n */\n#define FT_TRUETYPE_IDS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRUETYPE_TABLES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * types and API specific to the TrueType (as well as OpenType) format.\n *\n */\n#define FT_TRUETYPE_TABLES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRUETYPE_TAGS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of TrueType four-byte 'tags' which identify blocks in\n * SFNT-based font formats (i.e., TrueType and OpenType).\n *\n */\n#define FT_TRUETYPE_TAGS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_BDF_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which accesses BDF-specific strings from a face.\n *\n */\n#define FT_BDF_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CID_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which access CID font information from a face.\n *\n */\n#define FT_CID_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_GZIP_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which supports gzip-compressed files.\n *\n */\n#define FT_GZIP_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_LZW_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which supports LZW-compressed files.\n *\n */\n#define FT_LZW_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_BZIP2_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which supports bzip2-compressed files.\n *\n */\n#define FT_BZIP2_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_WINFONTS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * definitions of an API which supports Windows FNT files.\n *\n */\n#define FT_WINFONTS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_GLYPH_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API of the optional glyph management component.\n *\n */\n#define FT_GLYPH_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_BITMAP_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API of the optional bitmap conversion component.\n *\n */\n#define FT_BITMAP_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_BBOX_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API of the optional exact bounding box computation routines.\n *\n */\n#define FT_BBOX_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_CACHE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * API of the optional FreeType~2 cache sub-system.\n *\n */\n#define FT_CACHE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MAC_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * Macintosh-specific FreeType~2 API. The latter is used to access fonts\n * embedded in resource forks.\n *\n * This header file must be explicitly included by client applications\n * compiled on the Mac (note that the base API still works though).\n *\n */\n#define FT_MAC_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_MULTIPLE_MASTERS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * optional multiple-masters management API of FreeType~2.\n *\n */\n#define FT_MULTIPLE_MASTERS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SFNT_NAMES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * optional FreeType~2 API which accesses embedded 'name' strings in\n * SFNT-based font formats (i.e., TrueType and OpenType).\n *\n */\n#define FT_SFNT_NAMES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_OPENTYPE_VALIDATE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * optional FreeType~2 API which validates OpenType tables ('BASE',\n * 'GDEF', 'GPOS', 'GSUB', 'JSTF').\n *\n */\n#define FT_OPENTYPE_VALIDATE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_GX_VALIDATE_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * optional FreeType~2 API which validates TrueTypeGX/AAT tables ('feat',\n * 'mort', 'morx', 'bsln', 'just', 'kern', 'opbd', 'trak', 'prop').\n *\n */\n#define FT_GX_VALIDATE_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_PFR_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which accesses PFR-specific data.\n *\n */\n#define FT_PFR_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_STROKER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which provides functions to stroke outline paths.\n */\n#define FT_STROKER_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SYNTHESIS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which performs artificial obliquing and emboldening.\n */\n#define FT_SYNTHESIS_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_FONT_FORMATS_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which provides functions specific to font formats.\n */\n#define FT_FONT_FORMATS_H \n\n /* deprecated */\n#define FT_XFREE86_H FT_FONT_FORMATS_H\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_TRIGONOMETRY_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which performs trigonometric computations (e.g.,\n * cosines and arc tangents).\n */\n#define FT_TRIGONOMETRY_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_LCD_FILTER_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which performs color filtering for subpixel rendering.\n */\n#define FT_LCD_FILTER_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_INCREMENTAL_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which performs incremental glyph loading.\n */\n#define FT_INCREMENTAL_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_GASP_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which returns entries from the TrueType GASP table.\n */\n#define FT_GASP_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_ADVANCES_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which returns individual and ranged glyph advances.\n */\n#define FT_ADVANCES_H \n\n\n /**************************************************************************\n *\n * @macro:\n * FT_COLOR_H\n *\n * @description:\n * A macro used in `#include` statements to name the file containing the\n * FreeType~2 API which handles the OpenType 'CPAL' table.\n */\n#define FT_COLOR_H \n\n\n /* */\n\n /* These header files don't need to be included by the user. */\n#define FT_ERROR_DEFINITIONS_H \n#define FT_PARAMETER_TAGS_H \n\n /* Deprecated macros. */\n#define FT_UNPATENTED_HINTING_H \n#define FT_TRUETYPE_UNPATENTED_H \n\n /* `FT_CACHE_H` is the only header file needed for the cache subsystem. */\n#define FT_CACHE_IMAGE_H FT_CACHE_H\n#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H\n#define FT_CACHE_CHARMAP_H FT_CACHE_H\n\n /* The internals of the cache sub-system are no longer exposed. We */\n /* default to `FT_CACHE_H` at the moment just in case, but we know */\n /* of no rogue client that uses them. */\n /* */\n#define FT_CACHE_MANAGER_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H\n#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H\n\n\n /*\n * Include internal headers definitions from `` only when\n * building the library.\n */\n#ifdef FT2_BUILD_LIBRARY\n#define FT_INTERNAL_INTERNAL_H \n#include FT_INTERNAL_INTERNAL_H\n#endif /* FT2_BUILD_LIBRARY */\n\n\n#endif /* FTHEADER_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/config/ftmodule.h", "language": "code", "loc": 30, "comment_density": 0.4, "code": "/*\n * This file registers the FreeType modules compiled into the library.\n *\n * If you use GNU make, this file IS NOT USED! Instead, it is created in\n * the objects directory (normally `/objs/`) based on information\n * from `/modules.cfg`.\n *\n * Please read `docs/INSTALL.ANY` and `docs/CUSTOMIZE` how to compile\n * FreeType without GNU make.\n *\n */\n\nFT_USE_MODULE( FT_Module_Class, autofit_module_class )\nFT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )\nFT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )\nFT_USE_MODULE( FT_Module_Class, psaux_module_class )\nFT_USE_MODULE( FT_Module_Class, psnames_module_class )\nFT_USE_MODULE( FT_Module_Class, pshinter_module_class )\nFT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )\nFT_USE_MODULE( FT_Module_Class, sfnt_module_class )\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )\nFT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )\nFT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )\n\n/* EOF */\n"}, {"path": "includes/freetype/config/ftoption.h", "language": "code", "loc": 865, "comment_density": 0.892, "code": "/****************************************************************************\n *\n * ftoption.h\n *\n * User-selectable configuration macros (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTOPTION_H_\n#define FTOPTION_H_\n\n\n#include \n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * USER-SELECTABLE CONFIGURATION MACROS\n *\n * This file contains the default configuration macro definitions for a\n * standard build of the FreeType library. There are three ways to use\n * this file to build project-specific versions of the library:\n *\n * - You can modify this file by hand, but this is not recommended in\n * cases where you would like to build several versions of the library\n * from a single source directory.\n *\n * - You can put a copy of this file in your build directory, more\n * precisely in `$BUILD/freetype/config/ftoption.h`, where `$BUILD` is\n * the name of a directory that is included _before_ the FreeType include\n * path during compilation.\n *\n * The default FreeType Makefiles and Jamfiles use the build directory\n * `builds/` by default, but you can easily change that for your\n * own projects.\n *\n * - Copy the file to `$BUILD/ft2build.h` and modify it\n * slightly to pre-define the macro `FT_CONFIG_OPTIONS_H` used to locate\n * this file during the build. For example,\n *\n * ```\n * #define FT_CONFIG_OPTIONS_H \n * #include \n * ```\n *\n * will use `$BUILD/myftoptions.h` instead of this file for macro\n * definitions.\n *\n * Note also that you can similarly pre-define the macro\n * `FT_CONFIG_MODULES_H` used to locate the file listing of the modules\n * that are statically linked to the library at compile time. By\n * default, this file is ``.\n *\n * We highly recommend using the third method whenever possible.\n *\n */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /*#************************************************************************\n *\n * If you enable this configuration option, FreeType recognizes an\n * environment variable called `FREETYPE_PROPERTIES`, which can be used to\n * control the various font drivers and modules. The controllable\n * properties are listed in the section @properties.\n *\n * You have to undefine this configuration option on platforms that lack\n * the concept of environment variables (and thus don't have the `getenv`\n * function), for example Windows CE.\n *\n * `FREETYPE_PROPERTIES` has the following syntax form (broken here into\n * multiple lines for better readability).\n *\n * ```\n * \n * ':'\n * '=' \n * \n * ':'\n * '=' \n * ...\n * ```\n *\n * Example:\n *\n * ```\n * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \\\n * cff:no-stem-darkening=1 \\\n * autofitter:warping=1\n * ```\n *\n */\n#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES\n\n\n /**************************************************************************\n *\n * Uncomment the line below if you want to activate LCD rendering\n * technology similar to ClearType in this build of the library. This\n * technology triples the resolution in the direction color subpixels. To\n * mitigate color fringes inherent to this technology, you also need to\n * explicitly set up LCD filtering.\n *\n * Note that this feature is covered by several Microsoft patents and\n * should not be activated in any default build of the library. When this\n * macro is not defined, FreeType offers alternative LCD rendering\n * technology that produces excellent output without LCD filtering.\n */\n/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\n\n\n /**************************************************************************\n *\n * Many compilers provide a non-ANSI 64-bit data type that can be used by\n * FreeType to speed up some computations. However, this will create some\n * problems when compiling the library in strict ANSI mode.\n *\n * For this reason, the use of 64-bit integers is normally disabled when\n * the `__STDC__` macro is defined. You can however disable this by\n * defining the macro `FT_CONFIG_OPTION_FORCE_INT64` here.\n *\n * For most compilers, this will only create compilation warnings when\n * building the library.\n *\n * ObNote: The compiler-specific 64-bit integers are detected in the\n * file `ftconfig.h` either statically or through the `configure`\n * script on supported platforms.\n */\n#undef FT_CONFIG_OPTION_FORCE_INT64\n\n\n /**************************************************************************\n *\n * If this macro is defined, do not try to use an assembler version of\n * performance-critical functions (e.g., @FT_MulFix). You should only do\n * that to verify that the assembler function works properly, or to execute\n * benchmark tests of the various implementations.\n */\n/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */\n\n\n /**************************************************************************\n *\n * If this macro is defined, try to use an inlined assembler version of the\n * @FT_MulFix function, which is a 'hotspot' when loading and hinting\n * glyphs, and which should be executed as fast as possible.\n *\n * Note that if your compiler or CPU is not supported, this will default to\n * the standard and portable implementation found in `ftcalc.c`.\n */\n#define FT_CONFIG_OPTION_INLINE_MULFIX\n\n\n /**************************************************************************\n *\n * LZW-compressed file support.\n *\n * FreeType now handles font files that have been compressed with the\n * `compress` program. This is mostly used to parse many of the PCF\n * files that come with various X11 distributions. The implementation\n * uses NetBSD's `zopen` to partially uncompress the file on the fly (see\n * `src/lzw/ftgzip.c`).\n *\n * Define this macro if you want to enable this 'feature'.\n */\n#define FT_CONFIG_OPTION_USE_LZW\n\n\n /**************************************************************************\n *\n * Gzip-compressed file support.\n *\n * FreeType now handles font files that have been compressed with the\n * `gzip` program. This is mostly used to parse many of the PCF files\n * that come with XFree86. The implementation uses 'zlib' to partially\n * uncompress the file on the fly (see `src/gzip/ftgzip.c`).\n *\n * Define this macro if you want to enable this 'feature'. See also the\n * macro `FT_CONFIG_OPTION_SYSTEM_ZLIB` below.\n */\n#define FT_CONFIG_OPTION_USE_ZLIB\n\n\n /**************************************************************************\n *\n * ZLib library selection\n *\n * This macro is only used when `FT_CONFIG_OPTION_USE_ZLIB` is defined.\n * It allows FreeType's 'ftgzip' component to link to the system's\n * installation of the ZLib library. This is useful on systems like\n * Unix or VMS where it generally is already available.\n *\n * If you let it undefined, the component will use its own copy of the\n * zlib sources instead. These have been modified to be included\n * directly within the component and **not** export external function\n * names. This allows you to link any program with FreeType _and_ ZLib\n * without linking conflicts.\n *\n * Do not `#undef` this macro here since the build system might define\n * it for certain configurations only.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */\n\n\n /**************************************************************************\n *\n * Bzip2-compressed file support.\n *\n * FreeType now handles font files that have been compressed with the\n * `bzip2` program. This is mostly used to parse many of the PCF files\n * that come with XFree86. The implementation uses `libbz2` to partially\n * uncompress the file on the fly (see `src/bzip2/ftbzip2.c`). Contrary\n * to gzip, bzip2 currently is not included and need to use the system\n * available bzip2 implementation.\n *\n * Define this macro if you want to enable this 'feature'.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_USE_BZIP2 */\n\n\n /**************************************************************************\n *\n * Define to disable the use of file stream functions and types, `FILE`,\n * `fopen`, etc. Enables the use of smaller system libraries on embedded\n * systems that have multiple system libraries, some with or without file\n * stream support, in the cases where file stream support is not necessary\n * such as memory loading of font files.\n */\n/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */\n\n\n /**************************************************************************\n *\n * PNG bitmap support.\n *\n * FreeType now handles loading color bitmap glyphs in the PNG format.\n * This requires help from the external libpng library. Uncompressed\n * color bitmaps do not need any external libraries and will be supported\n * regardless of this configuration.\n *\n * Define this macro if you want to enable this 'feature'.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_USE_PNG */\n\n\n /**************************************************************************\n *\n * HarfBuzz support.\n *\n * FreeType uses the HarfBuzz library to improve auto-hinting of OpenType\n * fonts. If available, many glyphs not directly addressable by a font's\n * character map will be hinted also.\n *\n * Define this macro if you want to enable this 'feature'.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_USE_HARFBUZZ */\n\n\n /**************************************************************************\n *\n * Brotli support.\n *\n * FreeType uses the Brotli library to provide support for decompressing\n * WOFF2 streams.\n *\n * Define this macro if you want to enable this 'feature'.\n *\n * If you use a build system like cmake or the `configure` script,\n * options set by those programs have precedence, overwriting the value\n * here with the configured one.\n */\n/* #define FT_CONFIG_OPTION_USE_BROTLI */\n\n\n /**************************************************************************\n *\n * Glyph Postscript Names handling\n *\n * By default, FreeType 2 is compiled with the 'psnames' module. This\n * module is in charge of converting a glyph name string into a Unicode\n * value, or return a Macintosh standard glyph name for the use with the\n * TrueType 'post' table.\n *\n * Undefine this macro if you do not want 'psnames' compiled in your\n * build of FreeType. This has the following effects:\n *\n * - The TrueType driver will provide its own set of glyph names, if you\n * build it to support postscript names in the TrueType 'post' table,\n * but will not synthesize a missing Unicode charmap.\n *\n * - The Type~1 driver will not be able to synthesize a Unicode charmap\n * out of the glyphs found in the fonts.\n *\n * You would normally undefine this configuration macro when building a\n * version of FreeType that doesn't contain a Type~1 or CFF driver.\n */\n#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES\n\n\n /**************************************************************************\n *\n * Postscript Names to Unicode Values support\n *\n * By default, FreeType~2 is built with the 'psnames' module compiled in.\n * Among other things, the module is used to convert a glyph name into a\n * Unicode value. This is especially useful in order to synthesize on\n * the fly a Unicode charmap from the CFF/Type~1 driver through a big\n * table named the 'Adobe Glyph List' (AGL).\n *\n * Undefine this macro if you do not want the Adobe Glyph List compiled\n * in your 'psnames' module. The Type~1 driver will not be able to\n * synthesize a Unicode charmap out of the glyphs found in the fonts.\n */\n#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n\n\n /**************************************************************************\n *\n * Support for Mac fonts\n *\n * Define this macro if you want support for outline fonts in Mac format\n * (mac dfont, mac resource, macbinary containing a mac resource) on\n * non-Mac platforms.\n *\n * Note that the 'FOND' resource isn't checked.\n */\n#define FT_CONFIG_OPTION_MAC_FONTS\n\n\n /**************************************************************************\n *\n * Guessing methods to access embedded resource forks\n *\n * Enable extra Mac fonts support on non-Mac platforms (e.g., GNU/Linux).\n *\n * Resource forks which include fonts data are stored sometimes in\n * locations which users or developers don't expected. In some cases,\n * resource forks start with some offset from the head of a file. In\n * other cases, the actual resource fork is stored in file different from\n * what the user specifies. If this option is activated, FreeType tries\n * to guess whether such offsets or different file names must be used.\n *\n * Note that normal, direct access of resource forks is controlled via\n * the `FT_CONFIG_OPTION_MAC_FONTS` option.\n */\n#ifdef FT_CONFIG_OPTION_MAC_FONTS\n#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\n#endif\n\n\n /**************************************************************************\n *\n * Allow the use of `FT_Incremental_Interface` to load typefaces that\n * contain no glyph data, but supply it via a callback function. This is\n * required by clients supporting document formats which supply font data\n * incrementally as the document is parsed, such as the Ghostscript\n * interpreter for the PostScript language.\n */\n#define FT_CONFIG_OPTION_INCREMENTAL\n\n\n /**************************************************************************\n *\n * The size in bytes of the render pool used by the scan-line converter to\n * do all of its work.\n */\n#define FT_RENDER_POOL_SIZE 16384L\n\n\n /**************************************************************************\n *\n * FT_MAX_MODULES\n *\n * The maximum number of modules that can be registered in a single\n * FreeType library object. 32~is the default.\n */\n#define FT_MAX_MODULES 32\n\n\n /**************************************************************************\n *\n * Debug level\n *\n * FreeType can be compiled in debug or trace mode. In debug mode,\n * errors are reported through the 'ftdebug' component. In trace mode,\n * additional messages are sent to the standard output during execution.\n *\n * Define `FT_DEBUG_LEVEL_ERROR` to build the library in debug mode.\n * Define `FT_DEBUG_LEVEL_TRACE` to build it in trace mode.\n *\n * Don't define any of these macros to compile in 'release' mode!\n *\n * Do not `#undef` these macros here since the build system might define\n * them for certain configurations only.\n */\n/* #define FT_DEBUG_LEVEL_ERROR */\n/* #define FT_DEBUG_LEVEL_TRACE */\n\n\n /**************************************************************************\n *\n * Autofitter debugging\n *\n * If `FT_DEBUG_AUTOFIT` is defined, FreeType provides some means to\n * control the autofitter behaviour for debugging purposes with global\n * boolean variables (consequently, you should **never** enable this\n * while compiling in 'release' mode):\n *\n * ```\n * _af_debug_disable_horz_hints\n * _af_debug_disable_vert_hints\n * _af_debug_disable_blue_hints\n * ```\n *\n * Additionally, the following functions provide dumps of various\n * internal autofit structures to stdout (using `printf`):\n *\n * ```\n * af_glyph_hints_dump_points\n * af_glyph_hints_dump_segments\n * af_glyph_hints_dump_edges\n * af_glyph_hints_get_num_segments\n * af_glyph_hints_get_segment_offset\n * ```\n *\n * As an argument, they use another global variable:\n *\n * ```\n * _af_debug_hints\n * ```\n *\n * Please have a look at the `ftgrid` demo program to see how those\n * variables and macros should be used.\n *\n * Do not `#undef` these macros here since the build system might define\n * them for certain configurations only.\n */\n/* #define FT_DEBUG_AUTOFIT */\n\n\n /**************************************************************************\n *\n * Memory Debugging\n *\n * FreeType now comes with an integrated memory debugger that is capable\n * of detecting simple errors like memory leaks or double deletes. To\n * compile it within your build of the library, you should define\n * `FT_DEBUG_MEMORY` here.\n *\n * Note that the memory debugger is only activated at runtime when when\n * the _environment_ variable `FT2_DEBUG_MEMORY` is defined also!\n *\n * Do not `#undef` this macro here since the build system might define it\n * for certain configurations only.\n */\n/* #define FT_DEBUG_MEMORY */\n\n\n /**************************************************************************\n *\n * Module errors\n *\n * If this macro is set (which is _not_ the default), the higher byte of\n * an error code gives the module in which the error has occurred, while\n * the lower byte is the real error code.\n *\n * Setting this macro makes sense for debugging purposes only, since it\n * would break source compatibility of certain programs that use\n * FreeType~2.\n *\n * More details can be found in the files `ftmoderr.h` and `fterrors.h`.\n */\n#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS\n\n\n /**************************************************************************\n *\n * Error Strings\n *\n * If this macro is set, `FT_Error_String` will return meaningful\n * descriptions. This is not enabled by default to reduce the overall\n * size of FreeType.\n *\n * More details can be found in the file `fterrors.h`.\n */\n/* #define FT_CONFIG_OPTION_ERROR_STRINGS */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** S F N T D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_EMBEDDED_BITMAPS` if you want to support\n * embedded bitmaps in all formats using the 'sfnt' module (namely\n * TrueType~& OpenType).\n */\n#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_COLOR_LAYERS` if you want to support coloured\n * outlines (from the 'COLR'/'CPAL' tables) in all formats using the 'sfnt'\n * module (namely TrueType~& OpenType).\n */\n#define TT_CONFIG_OPTION_COLOR_LAYERS\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_POSTSCRIPT_NAMES` if you want to be able to\n * load and enumerate the glyph Postscript names in a TrueType or OpenType\n * file.\n *\n * Note that when you do not compile the 'psnames' module by undefining the\n * above `FT_CONFIG_OPTION_POSTSCRIPT_NAMES`, the 'sfnt' module will\n * contain additional code used to read the PS Names table from a font.\n *\n * (By default, the module uses 'psnames' to extract glyph names.)\n */\n#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_SFNT_NAMES` if your applications need to access\n * the internal name table in a SFNT-based format like TrueType or\n * OpenType. The name table contains various strings used to describe the\n * font, like family name, copyright, version, etc. It does not contain\n * any glyph name though.\n *\n * Accessing SFNT names is done through the functions declared in\n * `ftsnames.h`.\n */\n#define TT_CONFIG_OPTION_SFNT_NAMES\n\n\n /**************************************************************************\n *\n * TrueType CMap support\n *\n * Here you can fine-tune which TrueType CMap table format shall be\n * supported.\n */\n#define TT_CONFIG_CMAP_FORMAT_0\n#define TT_CONFIG_CMAP_FORMAT_2\n#define TT_CONFIG_CMAP_FORMAT_4\n#define TT_CONFIG_CMAP_FORMAT_6\n#define TT_CONFIG_CMAP_FORMAT_8\n#define TT_CONFIG_CMAP_FORMAT_10\n#define TT_CONFIG_CMAP_FORMAT_12\n#define TT_CONFIG_CMAP_FORMAT_13\n#define TT_CONFIG_CMAP_FORMAT_14\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` if you want to compile a\n * bytecode interpreter in the TrueType driver.\n *\n * By undefining this, you will only compile the code necessary to load\n * TrueType glyphs without hinting.\n *\n * Do not `#undef` this macro here, since the build system might define it\n * for certain configurations only.\n */\n#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_SUBPIXEL_HINTING` if you want to compile\n * subpixel hinting support into the TrueType driver. This modifies the\n * TrueType hinting mechanism when anything but `FT_RENDER_MODE_MONO` is\n * requested.\n *\n * In particular, it modifies the bytecode interpreter to interpret (or\n * not) instructions in a certain way so that all TrueType fonts look like\n * they do in a Windows ClearType (DirectWrite) environment. See [1] for a\n * technical overview on what this means. See `ttinterp.h` for more\n * details on the LEAN option.\n *\n * There are three possible values.\n *\n * Value 1:\n * This value is associated with the 'Infinality' moniker, contributed by\n * an individual nicknamed Infinality with the goal of making TrueType\n * fonts render better than on Windows. A high amount of configurability\n * and flexibility, down to rules for single glyphs in fonts, but also\n * very slow. Its experimental and slow nature and the original\n * developer losing interest meant that this option was never enabled in\n * default builds.\n *\n * The corresponding interpreter version is v38.\n *\n * Value 2:\n * The new default mode for the TrueType driver. The Infinality code\n * base was stripped to the bare minimum and all configurability removed\n * in the name of speed and simplicity. The configurability was mainly\n * aimed at legacy fonts like 'Arial', 'Times New Roman', or 'Courier'.\n * Legacy fonts are fonts that modify vertical stems to achieve clean\n * black-and-white bitmaps. The new mode focuses on applying a minimal\n * set of rules to all fonts indiscriminately so that modern and web\n * fonts render well while legacy fonts render okay.\n *\n * The corresponding interpreter version is v40.\n *\n * Value 3:\n * Compile both, making both v38 and v40 available (the latter is the\n * default).\n *\n * By undefining these, you get rendering behavior like on Windows without\n * ClearType, i.e., Windows XP without ClearType enabled and Win9x\n * (interpreter version v35). Or not, depending on how much hinting blood\n * and testing tears the font designer put into a given font. If you\n * define one or both subpixel hinting options, you can switch between\n * between v35 and the ones you define (using `FT_Property_Set`).\n *\n * This option requires `TT_CONFIG_OPTION_BYTECODE_INTERPRETER` to be\n * defined.\n *\n * [1]\n * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx\n */\n/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */\n#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2\n/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED` to compile the\n * TrueType glyph loader to use Apple's definition of how to handle\n * component offsets in composite glyphs.\n *\n * Apple and MS disagree on the default behavior of component offsets in\n * composites. Apple says that they should be scaled by the scaling\n * factors in the transformation matrix (roughly, it's more complex) while\n * MS says they should not. OpenType defines two bits in the composite\n * flags array which can be used to disambiguate, but old fonts will not\n * have them.\n *\n * https://www.microsoft.com/typography/otspec/glyf.htm\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html\n */\n#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_GX_VAR_SUPPORT` if you want to include support\n * for Apple's distortable font technology ('fvar', 'gvar', 'cvar', and\n * 'avar' tables). Tagged 'Font Variations', this is now part of OpenType\n * also. This has many similarities to Type~1 Multiple Masters support.\n */\n#define TT_CONFIG_OPTION_GX_VAR_SUPPORT\n\n\n /**************************************************************************\n *\n * Define `TT_CONFIG_OPTION_BDF` if you want to include support for an\n * embedded 'BDF~' table within SFNT-based bitmap formats.\n */\n#define TT_CONFIG_OPTION_BDF\n\n\n /**************************************************************************\n *\n * Option `TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES` controls the maximum\n * number of bytecode instructions executed for a single run of the\n * bytecode interpreter, needed to prevent infinite loops. You don't want\n * to change this except for very special situations (e.g., making a\n * library fuzzer spend less time to handle broken fonts).\n *\n * It is not expected that this value is ever modified by a configuring\n * script; instead, it gets surrounded with `#ifndef ... #endif` so that\n * the value can be set as a preprocessor option on the compiler's command\n * line.\n */\n#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES\n#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L\n#endif\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * `T1_MAX_DICT_DEPTH` is the maximum depth of nest dictionaries and arrays\n * in the Type~1 stream (see `t1load.c`). A minimum of~4 is required.\n */\n#define T1_MAX_DICT_DEPTH 5\n\n\n /**************************************************************************\n *\n * `T1_MAX_SUBRS_CALLS` details the maximum number of nested sub-routine\n * calls during glyph loading.\n */\n#define T1_MAX_SUBRS_CALLS 16\n\n\n /**************************************************************************\n *\n * `T1_MAX_CHARSTRING_OPERANDS` is the charstring stack's capacity. A\n * minimum of~16 is required.\n *\n * The Chinese font 'MingTiEG-Medium' (covering the CNS 11643 character\n * set) needs 256.\n */\n#define T1_MAX_CHARSTRINGS_OPERANDS 256\n\n\n /**************************************************************************\n *\n * Define this configuration macro if you want to prevent the compilation\n * of the 't1afm' module, which is in charge of reading Type~1 AFM files\n * into an existing face. Note that if set, the Type~1 driver will be\n * unable to produce kerning distances.\n */\n#undef T1_CONFIG_OPTION_NO_AFM\n\n\n /**************************************************************************\n *\n * Define this configuration macro if you want to prevent the compilation\n * of the Multiple Masters font support in the Type~1 driver.\n */\n#undef T1_CONFIG_OPTION_NO_MM_SUPPORT\n\n\n /**************************************************************************\n *\n * `T1_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe Type~1\n * engine gets compiled into FreeType. If defined, it is possible to\n * switch between the two engines using the `hinting-engine` property of\n * the 'type1' driver module.\n */\n/* #define T1_CONFIG_OPTION_OLD_ENGINE */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** C F F D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * Using `CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}` it is\n * possible to set up the default values of the four control points that\n * define the stem darkening behaviour of the (new) CFF engine. For more\n * details please read the documentation of the `darkening-parameters`\n * property (file `ftdriver.h`), which allows the control at run-time.\n *\n * Do **not** undefine these macros!\n */\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400\n\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275\n\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275\n\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333\n#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0\n\n\n /**************************************************************************\n *\n * `CFF_CONFIG_OPTION_OLD_ENGINE` controls whether the pre-Adobe CFF engine\n * gets compiled into FreeType. If defined, it is possible to switch\n * between the two engines using the `hinting-engine` property of the 'cff'\n * driver module.\n */\n/* #define CFF_CONFIG_OPTION_OLD_ENGINE */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** P C F D R I V E R C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * There are many PCF fonts just called 'Fixed' which look completely\n * different, and which have nothing to do with each other. When selecting\n * 'Fixed' in KDE or Gnome one gets results that appear rather random, the\n * style changes often if one changes the size and one cannot select some\n * fonts at all. This option makes the 'pcf' module prepend the foundry\n * name (plus a space) to the family name.\n *\n * We also check whether we have 'wide' characters; all put together, we\n * get family names like 'Sony Fixed' or 'Misc Fixed Wide'.\n *\n * If this option is activated, it can be controlled with the\n * `no-long-family-names` property of the 'pcf' driver module.\n */\n/* #define PCF_CONFIG_OPTION_LONG_FAMILY_NAMES */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * Compile 'autofit' module with CJK (Chinese, Japanese, Korean) script\n * support.\n */\n#define AF_CONFIG_OPTION_CJK\n\n\n /**************************************************************************\n *\n * Compile 'autofit' module with fallback Indic script support, covering\n * some scripts that the 'latin' submodule of the 'autofit' module doesn't\n * (yet) handle. Currently, this needs option `AF_CONFIG_OPTION_CJK`.\n */\n#ifdef AF_CONFIG_OPTION_CJK\n#define AF_CONFIG_OPTION_INDIC\n#endif\n\n\n /**************************************************************************\n *\n * Compile 'autofit' module with warp hinting. The idea of the warping\n * code is to slightly scale and shift a glyph within a single dimension so\n * that as much of its segments are aligned (more or less) on the grid. To\n * find out the optimal scaling and shifting value, various parameter\n * combinations are tried and scored.\n *\n * You can switch warping on and off with the `warping` property of the\n * auto-hinter (see file `ftdriver.h` for more information; by default it\n * is switched off).\n *\n * This experimental option is not active if the rendering mode is\n * `FT_RENDER_MODE_LIGHT`.\n */\n#define AF_CONFIG_OPTION_USE_WARPER\n\n\n /**************************************************************************\n *\n * Use TrueType-like size metrics for 'light' auto-hinting.\n *\n * It is strongly recommended to avoid this option, which exists only to\n * help some legacy applications retain its appearance and behaviour with\n * respect to auto-hinted TrueType fonts.\n *\n * The very reason this option exists at all are GNU/Linux distributions\n * like Fedora that did not un-patch the following change (which was\n * present in FreeType between versions 2.4.6 and 2.7.1, inclusive).\n *\n * ```\n * 2011-07-16 Steven Chu \n *\n * [truetype] Fix metrics on size request for scalable fonts.\n * ```\n *\n * This problematic commit is now reverted (more or less).\n */\n/* #define AF_CONFIG_OPTION_TT_SIZE_METRICS */\n\n /* */\n\n\n /*\n * This macro is obsolete. Support has been removed in FreeType version\n * 2.5.\n */\n/* #define FT_CONFIG_OPTION_OLD_INTERNALS */\n\n\n /*\n * The next three macros are defined if native TrueType hinting is\n * requested by the definitions above. Don't change this.\n */\n#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER\n#define TT_USE_BYTECODE_INTERPRETER\n\n#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING\n#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 1\n#define TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY\n#endif\n\n#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2\n#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL\n#endif\n#endif\n#endif\n\n\n /*\n * Check CFF darkening parameters. The checks are the same as in function\n * `cff_property_set` in file `cffdrivr.c`.\n */\n#if CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 < 0 || \\\n \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 < 0 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 < 0 || \\\n \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 > \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 > \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 > \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 || \\\n \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 > 500 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 > 500 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 > 500 || \\\n CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 > 500\n#error \"Invalid CFF darkening parameters!\"\n#endif\n\nFT_END_HEADER\n\n\n#endif /* FTOPTION_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/config/ftstdlib.h", "language": "code", "loc": 127, "comment_density": 0.638, "code": "/****************************************************************************\n *\n * ftstdlib.h\n *\n * ANSI-specific library and header configuration file (specification\n * only).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file is used to group all `#includes` to the ANSI~C library that\n * FreeType normally requires. It also defines macros to rename the\n * standard functions within the FreeType source code.\n *\n * Load a file which defines `FTSTDLIB_H_` before this one to override it.\n *\n */\n\n\n#ifndef FTSTDLIB_H_\n#define FTSTDLIB_H_\n\n\n#include \n\n#define ft_ptrdiff_t ptrdiff_t\n\n\n /**************************************************************************\n *\n * integer limits\n *\n * `UINT_MAX` and `ULONG_MAX` are used to automatically compute the size of\n * `int` and `long` in bytes at compile-time. So far, this works for all\n * platforms the library has been tested on.\n *\n * Note that on the extremely rare platforms that do not provide integer\n * types that are _exactly_ 16 and 32~bits wide (e.g., some old Crays where\n * `int` is 36~bits), we do not make any guarantee about the correct\n * behaviour of FreeType~2 with all fonts.\n *\n * In these cases, `ftconfig.h` will refuse to compile anyway with a\n * message like 'couldn't find 32-bit type' or something similar.\n *\n */\n\n\n#include \n\n#define FT_CHAR_BIT CHAR_BIT\n#define FT_USHORT_MAX USHRT_MAX\n#define FT_INT_MAX INT_MAX\n#define FT_INT_MIN INT_MIN\n#define FT_UINT_MAX UINT_MAX\n#define FT_LONG_MIN LONG_MIN\n#define FT_LONG_MAX LONG_MAX\n#define FT_ULONG_MAX ULONG_MAX\n\n\n /**************************************************************************\n *\n * character and string processing\n *\n */\n\n\n#include \n\n#define ft_memchr memchr\n#define ft_memcmp memcmp\n#define ft_memcpy memcpy\n#define ft_memmove memmove\n#define ft_memset memset\n#define ft_strcat strcat\n#define ft_strcmp strcmp\n#define ft_strcpy strcpy\n#define ft_strlen strlen\n#define ft_strncmp strncmp\n#define ft_strncpy strncpy\n#define ft_strrchr strrchr\n#define ft_strstr strstr\n\n\n /**************************************************************************\n *\n * file handling\n *\n */\n\n\n#include \n\n#define FT_FILE FILE\n#define ft_fclose fclose\n#define ft_fopen fopen\n#define ft_fread fread\n#define ft_fseek fseek\n#define ft_ftell ftell\n#define ft_sprintf sprintf\n\n\n /**************************************************************************\n *\n * sorting\n *\n */\n\n\n#include \n\n#define ft_qsort qsort\n\n\n /**************************************************************************\n *\n * memory allocation\n *\n */\n\n\n#define ft_scalloc calloc\n#define ft_sfree free\n#define ft_smalloc malloc\n#define ft_srealloc realloc\n\n\n /**************************************************************************\n *\n * miscellaneous\n *\n */\n\n\n#define ft_strtol strtol\n#define ft_getenv getenv\n\n\n /**************************************************************************\n *\n * execution control\n *\n */\n\n\n#include \n\n#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */\n /* `jmp_buf` is defined as a macro */\n /* on certain platforms */\n\n#define ft_longjmp longjmp\n#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */\n\n\n /* The following is only used for debugging purposes, i.e., if */\n /* `FT_DEBUG_LEVEL_ERROR` or `FT_DEBUG_LEVEL_TRACE` are defined. */\n\n#include \n\n\n#endif /* FTSTDLIB_H_ */\n\n\n/* END */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.675, "dedup_hash": "52640847ed7a1ac7", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_freetype_internal", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Internal", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/freetype/internal/autohint.h", "language": "code", "loc": 202, "comment_density": 0.777, "code": "/****************************************************************************\n *\n * autohint.h\n *\n * High-level 'autohint' module-specific interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * The auto-hinter is used to load and automatically hint glyphs if a\n * format-specific hinter isn't available.\n *\n */\n\n\n#ifndef AUTOHINT_H_\n#define AUTOHINT_H_\n\n\n /**************************************************************************\n *\n * A small technical note regarding automatic hinting in order to clarify\n * this module interface.\n *\n * An automatic hinter might compute two kinds of data for a given face:\n *\n * - global hints: Usually some metrics that describe global properties\n * of the face. It is computed by scanning more or less\n * aggressively the glyphs in the face, and thus can be\n * very slow to compute (even if the size of global hints\n * is really small).\n *\n * - glyph hints: These describe some important features of the glyph\n * outline, as well as how to align them. They are\n * generally much faster to compute than global hints.\n *\n * The current FreeType auto-hinter does a pretty good job while performing\n * fast computations for both global and glyph hints. However, we might be\n * interested in introducing more complex and powerful algorithms in the\n * future, like the one described in the John D. Hobby paper, which\n * unfortunately requires a lot more horsepower.\n *\n * Because a sufficiently sophisticated font management system would\n * typically implement an LRU cache of opened face objects to reduce memory\n * usage, it is a good idea to be able to avoid recomputing global hints\n * every time the same face is re-opened.\n *\n * We thus provide the ability to cache global hints outside of the face\n * object, in order to speed up font re-opening time. Of course, this\n * feature is purely optional, so most client programs won't even notice\n * it.\n *\n * I initially thought that it would be a good idea to cache the glyph\n * hints too. However, my general idea now is that if you really need to\n * cache these too, you are simply in need of a new font format, where all\n * this information could be stored within the font file and decoded on the\n * fly.\n *\n */\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n typedef struct FT_AutoHinterRec_ *FT_AutoHinter;\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_AutoHinter_GlobalGetFunc\n *\n * @description:\n * Retrieve the global hints computed for a given face object. The\n * resulting data is dissociated from the face and will survive a call to\n * FT_Done_Face(). It must be discarded through the API\n * FT_AutoHinter_GlobalDoneFunc().\n *\n * @input:\n * hinter ::\n * A handle to the source auto-hinter.\n *\n * face ::\n * A handle to the source face object.\n *\n * @output:\n * global_hints ::\n * A typeless pointer to the global hints.\n *\n * global_len ::\n * The size in bytes of the global hints.\n */\n typedef void\n (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter,\n FT_Face face,\n void** global_hints,\n long* global_len );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_AutoHinter_GlobalDoneFunc\n *\n * @description:\n * Discard the global hints retrieved through\n * FT_AutoHinter_GlobalGetFunc(). This is the only way these hints are\n * freed from memory.\n *\n * @input:\n * hinter ::\n * A handle to the auto-hinter module.\n *\n * global ::\n * A pointer to retrieved global hints to discard.\n */\n typedef void\n (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter,\n void* global );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_AutoHinter_GlobalResetFunc\n *\n * @description:\n * This function is used to recompute the global metrics in a given font.\n * This is useful when global font data changes (e.g. Multiple Masters\n * fonts where blend coordinates change).\n *\n * @input:\n * hinter ::\n * A handle to the source auto-hinter.\n *\n * face ::\n * A handle to the face.\n */\n typedef void\n (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter,\n FT_Face face );\n\n\n /**************************************************************************\n *\n * @functype:\n * FT_AutoHinter_GlyphLoadFunc\n *\n * @description:\n * This function is used to load, scale, and automatically hint a glyph\n * from a given face.\n *\n * @input:\n * face ::\n * A handle to the face.\n *\n * glyph_index ::\n * The glyph index.\n *\n * load_flags ::\n * The load flags.\n *\n * @note:\n * This function is capable of loading composite glyphs by hinting each\n * sub-glyph independently (which improves quality).\n *\n * It will call the font driver with @FT_Load_Glyph, with\n * @FT_LOAD_NO_SCALE set.\n */\n typedef FT_Error\n (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter,\n FT_GlyphSlot slot,\n FT_Size size,\n FT_UInt glyph_index,\n FT_Int32 load_flags );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_AutoHinter_InterfaceRec\n *\n * @description:\n * The auto-hinter module's interface.\n */\n typedef struct FT_AutoHinter_InterfaceRec_\n {\n FT_AutoHinter_GlobalResetFunc reset_face;\n FT_AutoHinter_GlobalGetFunc get_global_hints;\n FT_AutoHinter_GlobalDoneFunc done_global_hints;\n FT_AutoHinter_GlyphLoadFunc load_glyph;\n\n } FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;\n\n\n#define FT_DEFINE_AUTOHINTER_INTERFACE( \\\n class_, \\\n reset_face_, \\\n get_global_hints_, \\\n done_global_hints_, \\\n load_glyph_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_AutoHinter_InterfaceRec class_ = \\\n { \\\n reset_face_, \\\n get_global_hints_, \\\n done_global_hints_, \\\n load_glyph_ \\\n };\n\n\nFT_END_HEADER\n\n#endif /* AUTOHINT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/cffotypes.h", "language": "code", "loc": 81, "comment_density": 0.605, "code": "/****************************************************************************\n *\n * cffotypes.h\n *\n * Basic OpenType/CFF object type definitions (specification).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef CFFOTYPES_H_\n#define CFFOTYPES_H_\n\n#include \n#include FT_INTERNAL_OBJECTS_H\n#include FT_INTERNAL_CFF_TYPES_H\n#include FT_INTERNAL_TRUETYPE_TYPES_H\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\n\n\nFT_BEGIN_HEADER\n\n\n typedef TT_Face CFF_Face;\n\n\n /**************************************************************************\n *\n * @type:\n * CFF_Size\n *\n * @description:\n * A handle to an OpenType size object.\n */\n typedef struct CFF_SizeRec_\n {\n FT_SizeRec root;\n FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */\n\n } CFF_SizeRec, *CFF_Size;\n\n\n /**************************************************************************\n *\n * @type:\n * CFF_GlyphSlot\n *\n * @description:\n * A handle to an OpenType glyph slot object.\n */\n typedef struct CFF_GlyphSlotRec_\n {\n FT_GlyphSlotRec root;\n\n FT_Bool hint;\n FT_Bool scaled;\n\n FT_Fixed x_scale;\n FT_Fixed y_scale;\n\n } CFF_GlyphSlotRec, *CFF_GlyphSlot;\n\n\n /**************************************************************************\n *\n * @type:\n * CFF_Internal\n *\n * @description:\n * The interface to the 'internal' field of `FT_Size`.\n */\n typedef struct CFF_InternalRec_\n {\n PSH_Globals topfont;\n PSH_Globals subfonts[CFF_MAX_CID_FONTS];\n\n } CFF_InternalRec, *CFF_Internal;\n\n\n /**************************************************************************\n *\n * Subglyph transformation record.\n */\n typedef struct CFF_Transform_\n {\n FT_Fixed xx, xy; /* transformation matrix coefficients */\n FT_Fixed yx, yy;\n FT_F26Dot6 ox, oy; /* offsets */\n\n } CFF_Transform;\n\n\nFT_END_HEADER\n\n\n#endif /* CFFOTYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/cfftypes.h", "language": "code", "loc": 322, "comment_density": 0.407, "code": "/****************************************************************************\n *\n * cfftypes.h\n *\n * Basic OpenType/CFF type definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef CFFTYPES_H_\n#define CFFTYPES_H_\n\n\n#include \n#include FT_FREETYPE_H\n#include FT_TYPE1_TABLES_H\n#include FT_INTERNAL_SERVICE_H\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\n#include FT_INTERNAL_TYPE1_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @struct:\n * CFF_IndexRec\n *\n * @description:\n * A structure used to model a CFF Index table.\n *\n * @fields:\n * stream ::\n * The source input stream.\n *\n * start ::\n * The position of the first index byte in the input stream.\n *\n * count ::\n * The number of elements in the index.\n *\n * off_size ::\n * The size in bytes of object offsets in index.\n *\n * data_offset ::\n * The position of first data byte in the index's bytes.\n *\n * data_size ::\n * The size of the data table in this index.\n *\n * offsets ::\n * A table of element offsets in the index. Must be loaded explicitly.\n *\n * bytes ::\n * If the index is loaded in memory, its bytes.\n */\n typedef struct CFF_IndexRec_\n {\n FT_Stream stream;\n FT_ULong start;\n FT_UInt hdr_size;\n FT_UInt count;\n FT_Byte off_size;\n FT_ULong data_offset;\n FT_ULong data_size;\n\n FT_ULong* offsets;\n FT_Byte* bytes;\n\n } CFF_IndexRec, *CFF_Index;\n\n\n typedef struct CFF_EncodingRec_\n {\n FT_UInt format;\n FT_ULong offset;\n\n FT_UInt count;\n FT_UShort sids [256]; /* avoid dynamic allocations */\n FT_UShort codes[256];\n\n } CFF_EncodingRec, *CFF_Encoding;\n\n\n typedef struct CFF_CharsetRec_\n {\n\n FT_UInt format;\n FT_ULong offset;\n\n FT_UShort* sids;\n FT_UShort* cids; /* the inverse mapping of `sids'; only needed */\n /* for CID-keyed fonts */\n FT_UInt max_cid;\n FT_UInt num_glyphs;\n\n } CFF_CharsetRec, *CFF_Charset;\n\n\n /* cf. similar fields in file `ttgxvar.h' from the `truetype' module */\n\n typedef struct CFF_VarData_\n {\n#if 0\n FT_UInt itemCount; /* not used; always zero */\n FT_UInt shortDeltaCount; /* not used; always zero */\n#endif\n\n FT_UInt regionIdxCount; /* number of region indexes */\n FT_UInt* regionIndices; /* array of `regionIdxCount' indices; */\n /* these index `varRegionList' */\n } CFF_VarData;\n\n\n /* contribution of one axis to a region */\n typedef struct CFF_AxisCoords_\n {\n FT_Fixed startCoord;\n FT_Fixed peakCoord; /* zero peak means no effect (factor = 1) */\n FT_Fixed endCoord;\n\n } CFF_AxisCoords;\n\n\n typedef struct CFF_VarRegion_\n {\n CFF_AxisCoords* axisList; /* array of axisCount records */\n\n } CFF_VarRegion;\n\n\n typedef struct CFF_VStoreRec_\n {\n FT_UInt dataCount;\n CFF_VarData* varData; /* array of dataCount records */\n /* vsindex indexes this array */\n FT_UShort axisCount;\n FT_UInt regionCount; /* total number of regions defined */\n CFF_VarRegion* varRegionList;\n\n } CFF_VStoreRec, *CFF_VStore;\n\n\n /* forward reference */\n typedef struct CFF_FontRec_* CFF_Font;\n\n\n /* This object manages one cached blend vector. */\n /* */\n /* There is a BlendRec for Private DICT parsing in each subfont */\n /* and a BlendRec for charstrings in CF2_Font instance data. */\n /* A cached BV may be used across DICTs or Charstrings if inputs */\n /* have not changed. */\n /* */\n /* `usedBV' is reset at the start of each parse or charstring. */\n /* vsindex cannot be changed after a BV is used. */\n /* */\n /* Note: NDV is long (32/64 bit), while BV is 16.16 (FT_Int32). */\n typedef struct CFF_BlendRec_\n {\n FT_Bool builtBV; /* blendV has been built */\n FT_Bool usedBV; /* blendV has been used */\n CFF_Font font; /* top level font struct */\n FT_UInt lastVsindex; /* last vsindex used */\n FT_UInt lenNDV; /* normDV length (aka numAxes) */\n FT_Fixed* lastNDV; /* last NDV used */\n FT_UInt lenBV; /* BlendV length (aka numMasters) */\n FT_Int32* BV; /* current blendV (per DICT/glyph) */\n\n } CFF_BlendRec, *CFF_Blend;\n\n\n typedef struct CFF_FontRecDictRec_\n {\n FT_UInt version;\n FT_UInt notice;\n FT_UInt copyright;\n FT_UInt full_name;\n FT_UInt family_name;\n FT_UInt weight;\n FT_Bool is_fixed_pitch;\n FT_Fixed italic_angle;\n FT_Fixed underline_position;\n FT_Fixed underline_thickness;\n FT_Int paint_type;\n FT_Int charstring_type;\n FT_Matrix font_matrix;\n FT_Bool has_font_matrix;\n FT_ULong units_per_em; /* temporarily used as scaling value also */\n FT_Vector font_offset;\n FT_ULong unique_id;\n FT_BBox font_bbox;\n FT_Pos stroke_width;\n FT_ULong charset_offset;\n FT_ULong encoding_offset;\n FT_ULong charstrings_offset;\n FT_ULong private_offset;\n FT_ULong private_size;\n FT_Long synthetic_base;\n FT_UInt embedded_postscript;\n\n /* these should only be used for the top-level font dictionary */\n FT_UInt cid_registry;\n FT_UInt cid_ordering;\n FT_Long cid_supplement;\n\n FT_Long cid_font_version;\n FT_Long cid_font_revision;\n FT_Long cid_font_type;\n FT_ULong cid_count;\n FT_ULong cid_uid_base;\n FT_ULong cid_fd_array_offset;\n FT_ULong cid_fd_select_offset;\n FT_UInt cid_font_name;\n\n /* the next fields come from the data of the deprecated */\n /* `MultipleMaster' operator; they are needed to parse the (also */\n /* deprecated) `blend' operator in Type 2 charstrings */\n FT_UShort num_designs;\n FT_UShort num_axes;\n\n /* fields for CFF2 */\n FT_ULong vstore_offset;\n FT_UInt maxstack;\n\n } CFF_FontRecDictRec, *CFF_FontRecDict;\n\n\n /* forward reference */\n typedef struct CFF_SubFontRec_* CFF_SubFont;\n\n\n typedef struct CFF_PrivateRec_\n {\n FT_Byte num_blue_values;\n FT_Byte num_other_blues;\n FT_Byte num_family_blues;\n FT_Byte num_family_other_blues;\n\n FT_Pos blue_values[14];\n FT_Pos other_blues[10];\n FT_Pos family_blues[14];\n FT_Pos family_other_blues[10];\n\n FT_Fixed blue_scale;\n FT_Pos blue_shift;\n FT_Pos blue_fuzz;\n FT_Pos standard_width;\n FT_Pos standard_height;\n\n FT_Byte num_snap_widths;\n FT_Byte num_snap_heights;\n FT_Pos snap_widths[13];\n FT_Pos snap_heights[13];\n FT_Bool force_bold;\n FT_Fixed force_bold_threshold;\n FT_Int lenIV;\n FT_Int language_group;\n FT_Fixed expansion_factor;\n FT_Long initial_random_seed;\n FT_ULong local_subrs_offset;\n FT_Pos default_width;\n FT_Pos nominal_width;\n\n /* fields for CFF2 */\n FT_UInt vsindex;\n CFF_SubFont subfont;\n\n } CFF_PrivateRec, *CFF_Private;\n\n\n typedef struct CFF_FDSelectRec_\n {\n FT_Byte format;\n FT_UInt range_count;\n\n /* that's the table, taken from the file `as is' */\n FT_Byte* data;\n FT_UInt data_size;\n\n /* small cache for format 3 only */\n FT_UInt cache_first;\n FT_UInt cache_count;\n FT_Byte cache_fd;\n\n } CFF_FDSelectRec, *CFF_FDSelect;\n\n\n /* A SubFont packs a font dict and a private dict together. They are */\n /* needed to support CID-keyed CFF fonts. */\n typedef struct CFF_SubFontRec_\n {\n CFF_FontRecDictRec font_dict;\n CFF_PrivateRec private_dict;\n\n /* fields for CFF2 */\n CFF_BlendRec blend; /* current blend vector */\n FT_UInt lenNDV; /* current length NDV or zero */\n FT_Fixed* NDV; /* ptr to current NDV or NULL */\n\n /* `blend_stack' is a writable buffer to hold blend results. */\n /* This buffer is to the side of the normal cff parser stack; */\n /* `cff_parse_blend' and `cff_blend_doBlend' push blend results here. */\n /* The normal stack then points to these values instead of the DICT */\n /* because all other operators in Private DICT clear the stack. */\n /* `blend_stack' could be cleared at each operator other than blend. */\n /* Blended values are stored as 5-byte fixed point values. */\n\n FT_Byte* blend_stack; /* base of stack allocation */\n FT_Byte* blend_top; /* first empty slot */\n FT_UInt blend_used; /* number of bytes in use */\n FT_UInt blend_alloc; /* number of bytes allocated */\n\n CFF_IndexRec local_subrs_index;\n FT_Byte** local_subrs; /* array of pointers */\n /* into Local Subrs INDEX data */\n\n FT_UInt32 random;\n\n } CFF_SubFontRec;\n\n\n#define CFF_MAX_CID_FONTS 256\n\n\n typedef struct CFF_FontRec_\n {\n FT_Library library;\n FT_Stream stream;\n FT_Memory memory; /* TODO: take this from stream->memory? */\n FT_ULong base_offset; /* offset to start of CFF */\n FT_UInt num_faces;\n FT_UInt num_glyphs;\n\n FT_Byte version_major;\n FT_Byte version_minor;\n FT_Byte header_size;\n\n FT_UInt top_dict_length; /* cff2 only */\n\n FT_Bool cff2;\n\n CFF_IndexRec name_index;\n CFF_IndexRec top_dict_index;\n CFF_IndexRec global_subrs_index;\n\n CFF_EncodingRec encoding;\n CFF_CharsetRec charset;\n\n CFF_IndexRec charstrings_index;\n CFF_IndexRec font_dict_index;\n CFF_IndexRec private_index;\n CFF_IndexRec local_subrs_index;\n\n FT_String* font_name;\n\n /* array of pointers into Global Subrs INDEX data */\n FT_Byte** global_subrs;\n\n /* array of pointers into String INDEX data stored at string_pool */\n FT_UInt num_strings;\n FT_Byte** strings;\n FT_Byte* string_pool;\n FT_ULong string_pool_size;\n\n CFF_SubFontRec top_font;\n FT_UInt num_subfonts;\n CFF_SubFont subfonts[CFF_MAX_CID_FONTS];\n\n CFF_FDSelectRec fd_select;\n\n /* interface to PostScript hinter */\n PSHinter_Service pshinter;\n\n /* interface to Postscript Names service */\n FT_Service_PsCMaps psnames;\n\n /* interface to CFFLoad service */\n const void* cffload;\n\n /* since version 2.3.0 */\n PS_FontInfoRec* font_info; /* font info dictionary */\n\n /* since version 2.3.6 */\n FT_String* registry;\n FT_String* ordering;\n\n /* since version 2.4.12 */\n FT_Generic cf2_instance;\n\n /* since version 2.7.1 */\n CFF_VStoreRec vstore; /* parsed vstore structure */\n\n /* since version 2.9 */\n PS_FontExtraRec* font_extra;\n\n } CFF_FontRec;\n\n\nFT_END_HEADER\n\n#endif /* CFFTYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftcalc.h", "language": "code", "loc": 391, "comment_density": 0.45, "code": "/****************************************************************************\n *\n * ftcalc.h\n *\n * Arithmetic computations (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTCALC_H_\n#define FTCALC_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * FT_MulDiv() and FT_MulFix() are declared in freetype.h.\n *\n */\n\n#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER\n /* Provide assembler fragments for performance-critical functions. */\n /* These must be defined `static __inline__' with GCC. */\n\n#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_arm\n\n /* documentation is in freetype.h */\n\n static __inline FT_Int32\n FT_MulFix_arm( FT_Int32 a,\n FT_Int32 b )\n {\n FT_Int32 t, t2;\n\n\n __asm\n {\n smull t2, t, b, a /* (lo=t2,hi=t) = a*b */\n mov a, t, asr #31 /* a = (hi >> 31) */\n add a, a, #0x8000 /* a += 0x8000 */\n adds t2, t2, a /* t2 += a */\n adc t, t, #0 /* t += carry */\n mov a, t2, lsr #16 /* a = t2 >> 16 */\n orr a, a, t, lsl #16 /* a |= t << 16 */\n }\n return a;\n }\n\n#endif /* __CC_ARM || __ARMCC__ */\n\n\n#ifdef __GNUC__\n\n#if defined( __arm__ ) && \\\n ( !defined( __thumb__ ) || defined( __thumb2__ ) ) && \\\n !( defined( __CC_ARM ) || defined( __ARMCC__ ) )\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_arm\n\n /* documentation is in freetype.h */\n\n static __inline__ FT_Int32\n FT_MulFix_arm( FT_Int32 a,\n FT_Int32 b )\n {\n FT_Int32 t, t2;\n\n\n __asm__ __volatile__ (\n \"smull %1, %2, %4, %3\\n\\t\" /* (lo=%1,hi=%2) = a*b */\n \"mov %0, %2, asr #31\\n\\t\" /* %0 = (hi >> 31) */\n#if defined( __clang__ ) && defined( __thumb2__ )\n \"add.w %0, %0, #0x8000\\n\\t\" /* %0 += 0x8000 */\n#else\n \"add %0, %0, #0x8000\\n\\t\" /* %0 += 0x8000 */\n#endif\n \"adds %1, %1, %0\\n\\t\" /* %1 += %0 */\n \"adc %2, %2, #0\\n\\t\" /* %2 += carry */\n \"mov %0, %1, lsr #16\\n\\t\" /* %0 = %1 >> 16 */\n \"orr %0, %0, %2, lsl #16\\n\\t\" /* %0 |= %2 << 16 */\n : \"=r\"(a), \"=&r\"(t2), \"=&r\"(t)\n : \"r\"(a), \"r\"(b)\n : \"cc\" );\n return a;\n }\n\n#endif /* __arm__ && */\n /* ( __thumb2__ || !__thumb__ ) && */\n /* !( __CC_ARM || __ARMCC__ ) */\n\n\n#if defined( __i386__ )\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_i386\n\n /* documentation is in freetype.h */\n\n static __inline__ FT_Int32\n FT_MulFix_i386( FT_Int32 a,\n FT_Int32 b )\n {\n FT_Int32 result;\n\n\n __asm__ __volatile__ (\n \"imul %%edx\\n\"\n \"movl %%edx, %%ecx\\n\"\n \"sarl $31, %%ecx\\n\"\n \"addl $0x8000, %%ecx\\n\"\n \"addl %%ecx, %%eax\\n\"\n \"adcl $0, %%edx\\n\"\n \"shrl $16, %%eax\\n\"\n \"shll $16, %%edx\\n\"\n \"addl %%edx, %%eax\\n\"\n : \"=a\"(result), \"=d\"(b)\n : \"a\"(a), \"d\"(b)\n : \"%ecx\", \"cc\" );\n return result;\n }\n\n#endif /* i386 */\n\n#endif /* __GNUC__ */\n\n\n#ifdef _MSC_VER /* Visual C++ */\n\n#ifdef _M_IX86\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_i386\n\n /* documentation is in freetype.h */\n\n static __inline FT_Int32\n FT_MulFix_i386( FT_Int32 a,\n FT_Int32 b )\n {\n FT_Int32 result;\n\n __asm\n {\n mov eax, a\n mov edx, b\n imul edx\n mov ecx, edx\n sar ecx, 31\n add ecx, 8000h\n add eax, ecx\n adc edx, 0\n shr eax, 16\n shl edx, 16\n add eax, edx\n mov result, eax\n }\n return result;\n }\n\n#endif /* _M_IX86 */\n\n#endif /* _MSC_VER */\n\n\n#if defined( __GNUC__ ) && defined( __x86_64__ )\n\n#define FT_MULFIX_ASSEMBLER FT_MulFix_x86_64\n\n static __inline__ FT_Int32\n FT_MulFix_x86_64( FT_Int32 a,\n FT_Int32 b )\n {\n /* Temporarily disable the warning that C90 doesn't support */\n /* `long long'. */\n#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 )\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wlong-long\"\n#endif\n\n#if 1\n /* Technically not an assembly fragment, but GCC does a really good */\n /* job at inlining it and generating good machine code for it. */\n long long ret, tmp;\n\n\n ret = (long long)a * b;\n tmp = ret >> 63;\n ret += 0x8000 + tmp;\n\n return (FT_Int32)( ret >> 16 );\n#else\n\n /* For some reason, GCC 4.6 on Ubuntu 12.04 generates invalid machine */\n /* code from the lines below. The main issue is that `wide_a' is not */\n /* properly initialized by sign-extending `a'. Instead, the generated */\n /* machine code assumes that the register that contains `a' on input */\n /* can be used directly as a 64-bit value, which is wrong most of the */\n /* time. */\n long long wide_a = (long long)a;\n long long wide_b = (long long)b;\n long long result;\n\n\n __asm__ __volatile__ (\n \"imul %2, %1\\n\"\n \"mov %1, %0\\n\"\n \"sar $63, %0\\n\"\n \"lea 0x8000(%1, %0), %0\\n\"\n \"sar $16, %0\\n\"\n : \"=&r\"(result), \"=&r\"(wide_a)\n : \"r\"(wide_b)\n : \"cc\" );\n\n return (FT_Int32)result;\n#endif\n\n#if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 )\n#pragma GCC diagnostic pop\n#endif\n }\n\n#endif /* __GNUC__ && __x86_64__ */\n\n#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */\n\n\n#ifdef FT_CONFIG_OPTION_INLINE_MULFIX\n#ifdef FT_MULFIX_ASSEMBLER\n#define FT_MulFix( a, b ) FT_MULFIX_ASSEMBLER( (FT_Int32)(a), (FT_Int32)(b) )\n#endif\n#endif\n\n\n /**************************************************************************\n *\n * @function:\n * FT_MulDiv_No_Round\n *\n * @description:\n * A very simple function used to perform the computation '(a*b)/c'\n * (without rounding) with maximum accuracy (it uses a 64-bit\n * intermediate integer whenever necessary).\n *\n * This function isn't necessarily as fast as some processor-specific\n * operations, but is at least completely portable.\n *\n * @input:\n * a ::\n * The first multiplier.\n * b ::\n * The second multiplier.\n * c ::\n * The divisor.\n *\n * @return:\n * The result of '(a*b)/c'. This function never traps when trying to\n * divide by zero; it simply returns 'MaxInt' or 'MinInt' depending on\n * the signs of 'a' and 'b'.\n */\n FT_BASE( FT_Long )\n FT_MulDiv_No_Round( FT_Long a,\n FT_Long b,\n FT_Long c );\n\n\n /*\n * A variant of FT_Matrix_Multiply which scales its result afterwards. The\n * idea is that both `a' and `b' are scaled by factors of 10 so that the\n * values are as precise as possible to get a correct result during the\n * 64bit multiplication. Let `sa' and `sb' be the scaling factors of `a'\n * and `b', respectively, then the scaling factor of the result is `sa*sb'.\n */\n FT_BASE( void )\n FT_Matrix_Multiply_Scaled( const FT_Matrix* a,\n FT_Matrix *b,\n FT_Long scaling );\n\n\n /*\n * Check a matrix. If the transformation would lead to extreme shear or\n * extreme scaling, for example, return 0. If everything is OK, return 1.\n *\n * Based on geometric considerations we use the following inequality to\n * identify a degenerate matrix.\n *\n * 50 * abs(xx*yy - xy*yx) < xx^2 + xy^2 + yx^2 + yy^2\n *\n * Value 50 is heuristic.\n */\n FT_BASE( FT_Bool )\n FT_Matrix_Check( const FT_Matrix* matrix );\n\n\n /*\n * A variant of FT_Vector_Transform. See comments for\n * FT_Matrix_Multiply_Scaled.\n */\n FT_BASE( void )\n FT_Vector_Transform_Scaled( FT_Vector* vector,\n const FT_Matrix* matrix,\n FT_Long scaling );\n\n\n /*\n * This function normalizes a vector and returns its original length. The\n * normalized vector is a 16.16 fixed-point unit vector with length close\n * to 0x10000. The accuracy of the returned length is limited to 16 bits\n * also. The function utilizes quick inverse square root approximation\n * without divisions and square roots relying on Newton's iterations\n * instead.\n */\n FT_BASE( FT_UInt32 )\n FT_Vector_NormLen( FT_Vector* vector );\n\n\n /*\n * Return -1, 0, or +1, depending on the orientation of a given corner. We\n * use the Cartesian coordinate system, with positive vertical values going\n * upwards. The function returns +1 if the corner turns to the left, -1 to\n * the right, and 0 for undecidable cases.\n */\n FT_BASE( FT_Int )\n ft_corner_orientation( FT_Pos in_x,\n FT_Pos in_y,\n FT_Pos out_x,\n FT_Pos out_y );\n\n\n /*\n * Return TRUE if a corner is flat or nearly flat. This is equivalent to\n * saying that the corner point is close to its neighbors, or inside an\n * ellipse defined by the neighbor focal points to be more precise.\n */\n FT_BASE( FT_Int )\n ft_corner_is_flat( FT_Pos in_x,\n FT_Pos in_y,\n FT_Pos out_x,\n FT_Pos out_y );\n\n\n /*\n * Return the most significant bit index.\n */\n\n#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER\n\n#if defined( __GNUC__ ) && \\\n ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4 ) )\n\n#if FT_SIZEOF_INT == 4\n\n#define FT_MSB( x ) ( 31 - __builtin_clz( x ) )\n\n#elif FT_SIZEOF_LONG == 4\n\n#define FT_MSB( x ) ( 31 - __builtin_clzl( x ) )\n\n#endif /* __GNUC__ */\n\n\n#elif defined( _MSC_VER ) && ( _MSC_VER >= 1400 )\n\n#if FT_SIZEOF_INT == 4\n\n#include \n#pragma intrinsic( _BitScanReverse )\n\n static __inline FT_Int32\n FT_MSB_i386( FT_UInt32 x )\n {\n unsigned long where;\n\n\n _BitScanReverse( &where, x );\n\n return (FT_Int32)where;\n }\n\n#define FT_MSB( x ) ( FT_MSB_i386( x ) )\n\n#endif\n\n#endif /* _MSC_VER */\n\n\n#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */\n\n#ifndef FT_MSB\n\n FT_BASE( FT_Int )\n FT_MSB( FT_UInt32 z );\n\n#endif\n\n\n /*\n * Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses\n * two fixed-point arguments instead.\n */\n FT_BASE( FT_Fixed )\n FT_Hypot( FT_Fixed x,\n FT_Fixed y );\n\n\n#if 0\n\n /**************************************************************************\n *\n * @function:\n * FT_SqrtFixed\n *\n * @description:\n * Computes the square root of a 16.16 fixed-point value.\n *\n * @input:\n * x ::\n * The value to compute the root for.\n *\n * @return:\n * The result of 'sqrt(x)'.\n *\n * @note:\n * This function is not very fast.\n */\n FT_BASE( FT_Int32 )\n FT_SqrtFixed( FT_Int32 x );\n\n#endif /* 0 */\n\n\n#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 ) /* << 6 */\n#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) * 16384 ) /* << 14 */\n#define INT_TO_FIXED( x ) ( (FT_Long)(x) * 65536 ) /* << 16 */\n#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 ) /* << 2 */\n#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 )\n\n#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \\\n : ( -( ( 32 - (x) ) & -64 ) ) )\n\n /*\n * The following macros have two purposes.\n *\n * - Tag places where overflow is expected and harmless.\n *\n * - Avoid run-time sanitizer errors.\n *\n * Use with care!\n */\n#define ADD_INT( a, b ) \\\n (FT_Int)( (FT_UInt)(a) + (FT_UInt)(b) )\n#define SUB_INT( a, b ) \\\n (FT_Int)( (FT_UInt)(a) - (FT_UInt)(b) )\n#define MUL_INT( a, b ) \\\n (FT_Int)( (FT_UInt)(a) * (FT_UInt)(b) )\n#define NEG_INT( a ) \\\n (FT_Int)( (FT_UInt)0 - (FT_UInt)(a) )\n\n#define ADD_LONG( a, b ) \\\n (FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) )\n#define SUB_LONG( a, b ) \\\n (FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) )\n#define MUL_LONG( a, b ) \\\n (FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) )\n#define NEG_LONG( a ) \\\n (FT_Long)( (FT_ULong)0 - (FT_ULong)(a) )\n\n#define ADD_INT32( a, b ) \\\n (FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) )\n#define SUB_INT32( a, b ) \\\n (FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) )\n#define MUL_INT32( a, b ) \\\n (FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) )\n#define NEG_INT32( a ) \\\n (FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) )\n\n#ifdef FT_LONG64\n\n#define ADD_INT64( a, b ) \\\n (FT_Int64)( (FT_UInt64)(a) + (FT_UInt64)(b) )\n#define SUB_INT64( a, b ) \\\n (FT_Int64)( (FT_UInt64)(a) - (FT_UInt64)(b) )\n#define MUL_INT64( a, b ) \\\n (FT_Int64)( (FT_UInt64)(a) * (FT_UInt64)(b) )\n#define NEG_INT64( a ) \\\n (FT_Int64)( (FT_UInt64)0 - (FT_UInt64)(a) )\n\n#endif /* FT_LONG64 */\n\n\nFT_END_HEADER\n\n#endif /* FTCALC_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftdebug.h", "language": "code", "loc": 216, "comment_density": 0.653, "code": "/****************************************************************************\n *\n * ftdebug.h\n *\n * Debugging and logging component (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n *\n * IMPORTANT: A description of FreeType's debugging support can be\n * found in 'docs/DEBUG.TXT'. Read it if you need to use or\n * understand this code.\n *\n */\n\n\n#ifndef FTDEBUG_H_\n#define FTDEBUG_H_\n\n\n#include \n#include FT_CONFIG_CONFIG_H\n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */\n /* is already defined; this simplifies the following #ifdefs */\n /* */\n#ifdef FT_DEBUG_LEVEL_TRACE\n#undef FT_DEBUG_LEVEL_ERROR\n#define FT_DEBUG_LEVEL_ERROR\n#endif\n\n\n /**************************************************************************\n *\n * Define the trace enums as well as the trace levels array when they are\n * needed.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_TRACE\n\n#define FT_TRACE_DEF( x ) trace_ ## x ,\n\n /* defining the enumeration */\n typedef enum FT_Trace_\n {\n#include FT_INTERNAL_TRACE_H\n trace_count\n\n } FT_Trace;\n\n\n /* a pointer to the array of trace levels, */\n /* provided by `src/base/ftdebug.c' */\n extern int* ft_trace_levels;\n\n#undef FT_TRACE_DEF\n\n#endif /* FT_DEBUG_LEVEL_TRACE */\n\n\n /**************************************************************************\n *\n * Define the FT_TRACE macro\n *\n * IMPORTANT!\n *\n * Each component must define the macro FT_COMPONENT to a valid FT_Trace\n * value before using any TRACE macro.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_TRACE\n\n /* we need two macros here to make cpp expand `FT_COMPONENT' */\n#define FT_TRACE_COMP( x ) FT_TRACE_COMP_( x )\n#define FT_TRACE_COMP_( x ) trace_ ## x\n\n#define FT_TRACE( level, varformat ) \\\n do \\\n { \\\n if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] >= level ) \\\n FT_Message varformat; \\\n } while ( 0 )\n\n#else /* !FT_DEBUG_LEVEL_TRACE */\n\n#define FT_TRACE( level, varformat ) do { } while ( 0 ) /* nothing */\n\n#endif /* !FT_DEBUG_LEVEL_TRACE */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Trace_Get_Count\n *\n * @description:\n * Return the number of available trace components.\n *\n * @return:\n * The number of trace components. 0 if FreeType 2 is not built with\n * FT_DEBUG_LEVEL_TRACE definition.\n *\n * @note:\n * This function may be useful if you want to access elements of the\n * internal trace levels array by an index.\n */\n FT_BASE( FT_Int )\n FT_Trace_Get_Count( void );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Trace_Get_Name\n *\n * @description:\n * Return the name of a trace component.\n *\n * @input:\n * The index of the trace component.\n *\n * @return:\n * The name of the trace component. This is a statically allocated\n * C~string, so do not free it after use. `NULL` if FreeType is not\n * built with FT_DEBUG_LEVEL_TRACE definition.\n *\n * @note:\n * Use @FT_Trace_Get_Count to get the number of available trace\n * components.\n */\n FT_BASE( const char* )\n FT_Trace_Get_Name( FT_Int idx );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Trace_Disable\n *\n * @description:\n * Switch off tracing temporarily. It can be activated again with\n * @FT_Trace_Enable.\n */\n FT_BASE( void )\n FT_Trace_Disable( void );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Trace_Enable\n *\n * @description:\n * Activate tracing. Use it after tracing has been switched off with\n * @FT_Trace_Disable.\n */\n FT_BASE( void )\n FT_Trace_Enable( void );\n\n\n /**************************************************************************\n *\n * You need two opening and closing parentheses!\n *\n * Example: FT_TRACE0(( \"Value is %i\", foo ))\n *\n * Output of the FT_TRACEX macros is sent to stderr.\n *\n */\n\n#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )\n#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )\n#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat )\n#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat )\n#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat )\n#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat )\n#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )\n#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )\n\n\n /**************************************************************************\n *\n * Define the FT_ERROR macro.\n *\n * Output of this macro is sent to stderr.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_ERROR\n\n#define FT_ERROR( varformat ) FT_Message varformat\n\n#else /* !FT_DEBUG_LEVEL_ERROR */\n\n#define FT_ERROR( varformat ) do { } while ( 0 ) /* nothing */\n\n#endif /* !FT_DEBUG_LEVEL_ERROR */\n\n\n /**************************************************************************\n *\n * Define the FT_ASSERT and FT_THROW macros. The call to `FT_Throw` makes\n * it possible to easily set a breakpoint at this function.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_ERROR\n\n#define FT_ASSERT( condition ) \\\n do \\\n { \\\n if ( !( condition ) ) \\\n FT_Panic( \"assertion failed on line %d of file %s\\n\", \\\n __LINE__, __FILE__ ); \\\n } while ( 0 )\n\n#define FT_THROW( e ) \\\n ( FT_Throw( FT_ERR_CAT( FT_ERR_PREFIX, e ), \\\n __LINE__, \\\n __FILE__ ) | \\\n FT_ERR_CAT( FT_ERR_PREFIX, e ) )\n\n#else /* !FT_DEBUG_LEVEL_ERROR */\n\n#define FT_ASSERT( condition ) do { } while ( 0 )\n\n#define FT_THROW( e ) FT_ERR_CAT( FT_ERR_PREFIX, e )\n\n#endif /* !FT_DEBUG_LEVEL_ERROR */\n\n\n /**************************************************************************\n *\n * Define `FT_Message` and `FT_Panic` when needed.\n *\n */\n\n#ifdef FT_DEBUG_LEVEL_ERROR\n\n#include \"stdio.h\" /* for vfprintf() */\n\n /* print a message */\n FT_BASE( void )\n FT_Message( const char* fmt,\n ... );\n\n /* print a message and exit */\n FT_BASE( void )\n FT_Panic( const char* fmt,\n ... );\n\n /* report file name and line number of an error */\n FT_BASE( int )\n FT_Throw( FT_Error error,\n int line,\n const char* file );\n\n#endif /* FT_DEBUG_LEVEL_ERROR */\n\n\n FT_BASE( void )\n ft_debug_init( void );\n\nFT_END_HEADER\n\n#endif /* FTDEBUG_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftdrv.h", "language": "code", "loc": 245, "comment_density": 0.469, "code": "/****************************************************************************\n *\n * ftdrv.h\n *\n * FreeType internal font driver interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTDRV_H_\n#define FTDRV_H_\n\n\n#include \n#include FT_MODULE_H\n\n\nFT_BEGIN_HEADER\n\n\n typedef FT_Error\n (*FT_Face_InitFunc)( FT_Stream stream,\n FT_Face face,\n FT_Int typeface_index,\n FT_Int num_params,\n FT_Parameter* parameters );\n\n typedef void\n (*FT_Face_DoneFunc)( FT_Face face );\n\n\n typedef FT_Error\n (*FT_Size_InitFunc)( FT_Size size );\n\n typedef void\n (*FT_Size_DoneFunc)( FT_Size size );\n\n\n typedef FT_Error\n (*FT_Slot_InitFunc)( FT_GlyphSlot slot );\n\n typedef void\n (*FT_Slot_DoneFunc)( FT_GlyphSlot slot );\n\n\n typedef FT_Error\n (*FT_Size_RequestFunc)( FT_Size size,\n FT_Size_Request req );\n\n typedef FT_Error\n (*FT_Size_SelectFunc)( FT_Size size,\n FT_ULong size_index );\n\n typedef FT_Error\n (*FT_Slot_LoadFunc)( FT_GlyphSlot slot,\n FT_Size size,\n FT_UInt glyph_index,\n FT_Int32 load_flags );\n\n\n typedef FT_Error\n (*FT_Face_GetKerningFunc)( FT_Face face,\n FT_UInt left_glyph,\n FT_UInt right_glyph,\n FT_Vector* kerning );\n\n\n typedef FT_Error\n (*FT_Face_AttachFunc)( FT_Face face,\n FT_Stream stream );\n\n\n typedef FT_Error\n (*FT_Face_GetAdvancesFunc)( FT_Face face,\n FT_UInt first,\n FT_UInt count,\n FT_Int32 flags,\n FT_Fixed* advances );\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Driver_ClassRec\n *\n * @description:\n * The font driver class. This structure mostly contains pointers to\n * driver methods.\n *\n * @fields:\n * root ::\n * The parent module.\n *\n * face_object_size ::\n * The size of a face object in bytes.\n *\n * size_object_size ::\n * The size of a size object in bytes.\n *\n * slot_object_size ::\n * The size of a glyph object in bytes.\n *\n * init_face ::\n * The format-specific face constructor.\n *\n * done_face ::\n * The format-specific face destructor.\n *\n * init_size ::\n * The format-specific size constructor.\n *\n * done_size ::\n * The format-specific size destructor.\n *\n * init_slot ::\n * The format-specific slot constructor.\n *\n * done_slot ::\n * The format-specific slot destructor.\n *\n *\n * load_glyph ::\n * A function handle to load a glyph to a slot. This field is\n * mandatory!\n *\n * get_kerning ::\n * A function handle to return the unscaled kerning for a given pair of\n * glyphs. Can be set to 0 if the format doesn't support kerning.\n *\n * attach_file ::\n * This function handle is used to read additional data for a face from\n * another file/stream. For example, this can be used to add data from\n * AFM or PFM files on a Type 1 face, or a CIDMap on a CID-keyed face.\n *\n * get_advances ::\n * A function handle used to return advance widths of 'count' glyphs\n * (in font units), starting at 'first'. The 'vertical' flag must be\n * set to get vertical advance heights. The 'advances' buffer is\n * caller-allocated. The idea of this function is to be able to\n * perform device-independent text layout without loading a single\n * glyph image.\n *\n * request_size ::\n * A handle to a function used to request the new character size. Can\n * be set to 0 if the scaling done in the base layer suffices.\n *\n * select_size ::\n * A handle to a function used to select a new fixed size. It is used\n * only if @FT_FACE_FLAG_FIXED_SIZES is set. Can be set to 0 if the\n * scaling done in the base layer suffices.\n * @note:\n * Most function pointers, with the exception of `load_glyph`, can be set\n * to 0 to indicate a default behaviour.\n */\n typedef struct FT_Driver_ClassRec_\n {\n FT_Module_Class root;\n\n FT_Long face_object_size;\n FT_Long size_object_size;\n FT_Long slot_object_size;\n\n FT_Face_InitFunc init_face;\n FT_Face_DoneFunc done_face;\n\n FT_Size_InitFunc init_size;\n FT_Size_DoneFunc done_size;\n\n FT_Slot_InitFunc init_slot;\n FT_Slot_DoneFunc done_slot;\n\n FT_Slot_LoadFunc load_glyph;\n\n FT_Face_GetKerningFunc get_kerning;\n FT_Face_AttachFunc attach_file;\n FT_Face_GetAdvancesFunc get_advances;\n\n /* since version 2.2 */\n FT_Size_RequestFunc request_size;\n FT_Size_SelectFunc select_size;\n\n } FT_Driver_ClassRec, *FT_Driver_Class;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DECLARE_DRIVER\n *\n * @description:\n * Used to create a forward declaration of an FT_Driver_ClassRec struct\n * instance.\n *\n * @macro:\n * FT_DEFINE_DRIVER\n *\n * @description:\n * Used to initialize an instance of FT_Driver_ClassRec struct.\n *\n * `ftinit.c` (ft_create_default_module_classes) already contains a\n * mechanism to call these functions for the default modules described in\n * `ftmodule.h`.\n *\n * The struct will be allocated in the global scope (or the scope where\n * the macro is used).\n */\n#define FT_DECLARE_DRIVER( class_ ) \\\n FT_CALLBACK_TABLE \\\n const FT_Driver_ClassRec class_;\n\n#define FT_DEFINE_DRIVER( \\\n class_, \\\n flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_, \\\n face_object_size_, \\\n size_object_size_, \\\n slot_object_size_, \\\n init_face_, \\\n done_face_, \\\n init_size_, \\\n done_size_, \\\n init_slot_, \\\n done_slot_, \\\n load_glyph_, \\\n get_kerning_, \\\n attach_file_, \\\n get_advances_, \\\n request_size_, \\\n select_size_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_Driver_ClassRec class_ = \\\n { \\\n FT_DEFINE_ROOT_MODULE( flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_ ) \\\n \\\n face_object_size_, \\\n size_object_size_, \\\n slot_object_size_, \\\n \\\n init_face_, \\\n done_face_, \\\n \\\n init_size_, \\\n done_size_, \\\n \\\n init_slot_, \\\n done_slot_, \\\n \\\n load_glyph_, \\\n \\\n get_kerning_, \\\n attach_file_, \\\n get_advances_, \\\n \\\n request_size_, \\\n select_size_ \\\n };\n\n\nFT_END_HEADER\n\n#endif /* FTDRV_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftgloadr.h", "language": "code", "loc": 111, "comment_density": 0.405, "code": "/****************************************************************************\n *\n * ftgloadr.h\n *\n * The FreeType glyph loader (specification).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTGLOADR_H_\n#define FTGLOADR_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_GlyphLoader\n *\n * @description:\n * The glyph loader is an internal object used to load several glyphs\n * together (for example, in the case of composites).\n */\n typedef struct FT_SubGlyphRec_\n {\n FT_Int index;\n FT_UShort flags;\n FT_Int arg1;\n FT_Int arg2;\n FT_Matrix transform;\n\n } FT_SubGlyphRec;\n\n\n typedef struct FT_GlyphLoadRec_\n {\n FT_Outline outline; /* outline */\n FT_Vector* extra_points; /* extra points table */\n FT_Vector* extra_points2; /* second extra points table */\n FT_UInt num_subglyphs; /* number of subglyphs */\n FT_SubGlyph subglyphs; /* subglyphs */\n\n } FT_GlyphLoadRec, *FT_GlyphLoad;\n\n\n typedef struct FT_GlyphLoaderRec_\n {\n FT_Memory memory;\n FT_UInt max_points;\n FT_UInt max_contours;\n FT_UInt max_subglyphs;\n FT_Bool use_extra;\n\n FT_GlyphLoadRec base;\n FT_GlyphLoadRec current;\n\n void* other; /* for possible future extension? */\n\n } FT_GlyphLoaderRec, *FT_GlyphLoader;\n\n\n /* create new empty glyph loader */\n FT_BASE( FT_Error )\n FT_GlyphLoader_New( FT_Memory memory,\n FT_GlyphLoader *aloader );\n\n /* add an extra points table to a glyph loader */\n FT_BASE( FT_Error )\n FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader );\n\n /* destroy a glyph loader */\n FT_BASE( void )\n FT_GlyphLoader_Done( FT_GlyphLoader loader );\n\n /* reset a glyph loader (frees everything int it) */\n FT_BASE( void )\n FT_GlyphLoader_Reset( FT_GlyphLoader loader );\n\n /* rewind a glyph loader */\n FT_BASE( void )\n FT_GlyphLoader_Rewind( FT_GlyphLoader loader );\n\n /* check that there is enough space to add `n_points' and `n_contours' */\n /* to the glyph loader */\n FT_BASE( FT_Error )\n FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,\n FT_UInt n_points,\n FT_UInt n_contours );\n\n\n#define FT_GLYPHLOADER_CHECK_P( _loader, _count ) \\\n ( (_count) == 0 || \\\n ( (FT_UInt)(_loader)->base.outline.n_points + \\\n (FT_UInt)(_loader)->current.outline.n_points + \\\n (FT_UInt)(_count) ) <= (_loader)->max_points )\n\n#define FT_GLYPHLOADER_CHECK_C( _loader, _count ) \\\n ( (_count) == 0 || \\\n ( (FT_UInt)(_loader)->base.outline.n_contours + \\\n (FT_UInt)(_loader)->current.outline.n_contours + \\\n (FT_UInt)(_count) ) <= (_loader)->max_contours )\n\n#define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points, _contours ) \\\n ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points ) && \\\n FT_GLYPHLOADER_CHECK_C( _loader, _contours ) ) \\\n ? 0 \\\n : FT_GlyphLoader_CheckPoints( (_loader), \\\n (FT_UInt)(_points), \\\n (FT_UInt)(_contours) ) )\n\n\n /* check that there is enough space to add `n_subs' sub-glyphs to */\n /* a glyph loader */\n FT_BASE( FT_Error )\n FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,\n FT_UInt n_subs );\n\n /* prepare a glyph loader, i.e. empty the current glyph */\n FT_BASE( void )\n FT_GlyphLoader_Prepare( FT_GlyphLoader loader );\n\n /* add the current glyph to the base glyph */\n FT_BASE( void )\n FT_GlyphLoader_Add( FT_GlyphLoader loader );\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTGLOADR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/fthash.h", "language": "code", "loc": 97, "comment_density": 0.402, "code": "/****************************************************************************\n *\n * fthash.h\n *\n * Hashing functions (specification).\n *\n */\n\n/*\n * Copyright 2000 Computing Research Labs, New Mexico State University\n * Copyright 2001-2015\n * Francesco Zappa Nardelli\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY\n * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT\n * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n /**************************************************************************\n *\n * This file is based on code from bdf.c,v 1.22 2000/03/16 20:08:50\n *\n * taken from Mark Leisher's xmbdfed package\n *\n */\n\n\n#ifndef FTHASH_H_\n#define FTHASH_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n typedef union FT_Hashkey_\n {\n FT_Int num;\n const char* str;\n\n } FT_Hashkey;\n\n\n typedef struct FT_HashnodeRec_\n {\n FT_Hashkey key;\n size_t data;\n\n } FT_HashnodeRec;\n\n typedef struct FT_HashnodeRec_ *FT_Hashnode;\n\n\n typedef FT_ULong\n (*FT_Hash_LookupFunc)( FT_Hashkey* key );\n\n typedef FT_Bool\n (*FT_Hash_CompareFunc)( FT_Hashkey* a,\n FT_Hashkey* b );\n\n\n typedef struct FT_HashRec_\n {\n FT_UInt limit;\n FT_UInt size;\n FT_UInt used;\n\n FT_Hash_LookupFunc lookup;\n FT_Hash_CompareFunc compare;\n\n FT_Hashnode* table;\n\n } FT_HashRec;\n\n typedef struct FT_HashRec_ *FT_Hash;\n\n\n FT_Error\n ft_hash_str_init( FT_Hash hash,\n FT_Memory memory );\n\n FT_Error\n ft_hash_num_init( FT_Hash hash,\n FT_Memory memory );\n\n void\n ft_hash_str_free( FT_Hash hash,\n FT_Memory memory );\n\n#define ft_hash_num_free ft_hash_str_free\n\n FT_Error\n ft_hash_str_insert( const char* key,\n size_t data,\n FT_Hash hash,\n FT_Memory memory );\n\n FT_Error\n ft_hash_num_insert( FT_Int num,\n size_t data,\n FT_Hash hash,\n FT_Memory memory );\n\n size_t*\n ft_hash_str_lookup( const char* key,\n FT_Hash hash );\n\n size_t*\n ft_hash_num_lookup( FT_Int num,\n FT_Hash hash );\n\n\nFT_END_HEADER\n\n\n#endif /* FTHASH_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftmemory.h", "language": "code", "loc": 295, "comment_density": 0.244, "code": "/****************************************************************************\n *\n * ftmemory.h\n *\n * The FreeType memory management macros (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTMEMORY_H_\n#define FTMEMORY_H_\n\n\n#include \n#include FT_CONFIG_CONFIG_H\n#include FT_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_SET_ERROR\n *\n * @description:\n * This macro is used to set an implicit 'error' variable to a given\n * expression's value (usually a function call), and convert it to a\n * boolean which is set whenever the value is != 0.\n */\n#undef FT_SET_ERROR\n#define FT_SET_ERROR( expression ) \\\n ( ( error = (expression) ) != 0 )\n\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** M E M O R Y ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /* The calculation `NULL + n' is undefined in C. Even if the resulting */\n /* pointer doesn't get dereferenced, this causes warnings with */\n /* sanitizers. */\n /* */\n /* We thus provide a macro that should be used if `base' can be NULL. */\n#define FT_OFFSET( base, count ) ( (base) ? (base) + (count) : NULL )\n\n\n /*\n * C++ refuses to handle statements like p = (void*)anything, with `p' a\n * typed pointer. Since we don't have a `typeof' operator in standard C++,\n * we have to use a template to emulate it.\n */\n\n#ifdef __cplusplus\n\nextern \"C++\"\n{\n template inline T*\n cplusplus_typeof( T*,\n void *v )\n {\n return static_cast ( v );\n }\n}\n\n#define FT_ASSIGNP( p, val ) (p) = cplusplus_typeof( (p), (val) )\n\n#else\n\n#define FT_ASSIGNP( p, val ) (p) = (val)\n\n#endif\n\n\n\n#ifdef FT_DEBUG_MEMORY\n\n FT_BASE( const char* ) _ft_debug_file;\n FT_BASE( long ) _ft_debug_lineno;\n\n#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \\\n _ft_debug_lineno = __LINE__, \\\n (exp) )\n\n#define FT_ASSIGNP_INNER( p, exp ) ( _ft_debug_file = __FILE__, \\\n _ft_debug_lineno = __LINE__, \\\n FT_ASSIGNP( p, exp ) )\n\n#else /* !FT_DEBUG_MEMORY */\n\n#define FT_DEBUG_INNER( exp ) (exp)\n#define FT_ASSIGNP_INNER( p, exp ) FT_ASSIGNP( p, exp )\n\n#endif /* !FT_DEBUG_MEMORY */\n\n\n /*\n * The allocation functions return a pointer, and the error code is written\n * to through the `p_error' parameter.\n */\n\n /* The `q' variants of the functions below (`q' for `quick') don't fill */\n /* the allocated or reallocated memory with zero bytes. */\n\n FT_BASE( FT_Pointer )\n ft_mem_alloc( FT_Memory memory,\n FT_Long size,\n FT_Error *p_error );\n\n FT_BASE( FT_Pointer )\n ft_mem_qalloc( FT_Memory memory,\n FT_Long size,\n FT_Error *p_error );\n\n FT_BASE( FT_Pointer )\n ft_mem_realloc( FT_Memory memory,\n FT_Long item_size,\n FT_Long cur_count,\n FT_Long new_count,\n void* block,\n FT_Error *p_error );\n\n FT_BASE( FT_Pointer )\n ft_mem_qrealloc( FT_Memory memory,\n FT_Long item_size,\n FT_Long cur_count,\n FT_Long new_count,\n void* block,\n FT_Error *p_error );\n\n FT_BASE( void )\n ft_mem_free( FT_Memory memory,\n const void* P );\n\n\n /* The `Q' variants of the macros below (`Q' for `quick') don't fill */\n /* the allocated or reallocated memory with zero bytes. */\n\n#define FT_MEM_ALLOC( ptr, size ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \\\n (FT_Long)(size), \\\n &error ) )\n\n#define FT_MEM_FREE( ptr ) \\\n FT_BEGIN_STMNT \\\n FT_DEBUG_INNER( ft_mem_free( memory, (ptr) ) ); \\\n (ptr) = NULL; \\\n FT_END_STMNT\n\n#define FT_MEM_NEW( ptr ) \\\n FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )\n\n#define FT_MEM_REALLOC( ptr, cursz, newsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n 1, \\\n (FT_Long)(cursz), \\\n (FT_Long)(newsz), \\\n (ptr), \\\n &error ) )\n\n#define FT_MEM_QALLOC( ptr, size ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \\\n (FT_Long)(size), \\\n &error ) )\n\n#define FT_MEM_QNEW( ptr ) \\\n FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )\n\n#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n 1, \\\n (FT_Long)(cursz), \\\n (FT_Long)(newsz), \\\n (ptr), \\\n &error ) )\n\n#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n (FT_Long)(item_size), \\\n 0, \\\n (FT_Long)(count), \\\n NULL, \\\n &error ) )\n\n#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n (FT_Long)(itmsz), \\\n (FT_Long)(oldcnt), \\\n (FT_Long)(newcnt), \\\n (ptr), \\\n &error ) )\n\n#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n (FT_Long)(item_size), \\\n 0, \\\n (FT_Long)(count), \\\n NULL, \\\n &error ) )\n\n#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n (FT_Long)(itmsz), \\\n (FT_Long)(oldcnt), \\\n (FT_Long)(newcnt), \\\n (ptr), \\\n &error ) )\n\n\n#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )\n\n\n#define FT_MEM_SET( dest, byte, count ) \\\n ft_memset( dest, byte, (FT_Offset)(count) )\n\n#define FT_MEM_COPY( dest, source, count ) \\\n ft_memcpy( dest, source, (FT_Offset)(count) )\n\n#define FT_MEM_MOVE( dest, source, count ) \\\n ft_memmove( dest, source, (FT_Offset)(count) )\n\n\n#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )\n\n#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )\n\n\n#define FT_ARRAY_ZERO( dest, count ) \\\n FT_MEM_ZERO( dest, \\\n (FT_Offset)(count) * sizeof ( *(dest) ) )\n\n#define FT_ARRAY_COPY( dest, source, count ) \\\n FT_MEM_COPY( dest, \\\n source, \\\n (FT_Offset)(count) * sizeof ( *(dest) ) )\n\n#define FT_ARRAY_MOVE( dest, source, count ) \\\n FT_MEM_MOVE( dest, \\\n source, \\\n (FT_Offset)(count) * sizeof ( *(dest) ) )\n\n\n /*\n * Return the maximum number of addressable elements in an array. We limit\n * ourselves to INT_MAX, rather than UINT_MAX, to avoid any problems.\n */\n#define FT_ARRAY_MAX( ptr ) ( FT_INT_MAX / sizeof ( *(ptr) ) )\n\n#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX( ptr ) )\n\n\n /**************************************************************************\n *\n * The following functions macros expect that their pointer argument is\n * _typed_ in order to automatically compute array element sizes.\n */\n\n#define FT_MEM_NEW_ARRAY( ptr, count ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n sizeof ( *(ptr) ), \\\n 0, \\\n (FT_Long)(count), \\\n NULL, \\\n &error ) )\n\n#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \\\n sizeof ( *(ptr) ), \\\n (FT_Long)(cursz), \\\n (FT_Long)(newsz), \\\n (ptr), \\\n &error ) )\n\n#define FT_MEM_QNEW_ARRAY( ptr, count ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n sizeof ( *(ptr) ), \\\n 0, \\\n (FT_Long)(count), \\\n NULL, \\\n &error ) )\n\n#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \\\n FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \\\n sizeof ( *(ptr) ), \\\n (FT_Long)(cursz), \\\n (FT_Long)(newsz), \\\n (ptr), \\\n &error ) )\n\n#define FT_ALLOC( ptr, size ) \\\n FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )\n\n#define FT_REALLOC( ptr, cursz, newsz ) \\\n FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )\n\n#define FT_ALLOC_MULT( ptr, count, item_size ) \\\n FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )\n\n#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \\\n FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt, \\\n newcnt, itmsz ) )\n\n#define FT_QALLOC( ptr, size ) \\\n FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )\n\n#define FT_QREALLOC( ptr, cursz, newsz ) \\\n FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )\n\n#define FT_QALLOC_MULT( ptr, count, item_size ) \\\n FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )\n\n#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \\\n FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt, \\\n newcnt, itmsz ) )\n\n#define FT_FREE( ptr ) FT_MEM_FREE( ptr )\n\n#define FT_NEW( ptr ) FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )\n\n#define FT_NEW_ARRAY( ptr, count ) \\\n FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )\n\n#define FT_RENEW_ARRAY( ptr, curcnt, newcnt ) \\\n FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )\n\n#define FT_QNEW( ptr ) \\\n FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )\n\n#define FT_QNEW_ARRAY( ptr, count ) \\\n FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )\n\n#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt ) \\\n FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )\n\n\n FT_BASE( FT_Pointer )\n ft_mem_strdup( FT_Memory memory,\n const char* str,\n FT_Error *p_error );\n\n FT_BASE( FT_Pointer )\n ft_mem_dup( FT_Memory memory,\n const void* address,\n FT_ULong size,\n FT_Error *p_error );\n\n\n#define FT_MEM_STRDUP( dst, str ) \\\n (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )\n\n#define FT_STRDUP( dst, str ) \\\n FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )\n\n#define FT_MEM_DUP( dst, address, size ) \\\n (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )\n\n#define FT_DUP( dst, address, size ) \\\n FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )\n\n\n /* Return >= 1 if a truncation occurs. */\n /* Return 0 if the source string fits the buffer. */\n /* This is *not* the same as strlcpy(). */\n FT_BASE( FT_Int )\n ft_mem_strcpyn( char* dst,\n const char* src,\n FT_ULong size );\n\n#define FT_STRCPYN( dst, src, size ) \\\n ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* FTMEMORY_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftobjs.h", "language": "code", "loc": 1042, "comment_density": 0.525, "code": "/****************************************************************************\n *\n * ftobjs.h\n *\n * The FreeType private base classes (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file contains the definition of all internal FreeType classes.\n *\n */\n\n\n#ifndef FTOBJS_H_\n#define FTOBJS_H_\n\n#include \n#include FT_RENDER_H\n#include FT_SIZES_H\n#include FT_LCD_FILTER_H\n#include FT_INTERNAL_MEMORY_H\n#include FT_INTERNAL_GLYPH_LOADER_H\n#include FT_INTERNAL_DRIVER_H\n#include FT_INTERNAL_AUTOHINT_H\n#include FT_INTERNAL_SERVICE_H\n#include FT_INTERNAL_CALC_H\n\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\n#include FT_INCREMENTAL_H\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * Some generic definitions.\n */\n#ifndef TRUE\n#define TRUE 1\n#endif\n\n#ifndef FALSE\n#define FALSE 0\n#endif\n\n#ifndef NULL\n#define NULL (void*)0\n#endif\n\n\n /**************************************************************************\n *\n * The min and max functions missing in C. As usual, be careful not to\n * write things like FT_MIN( a++, b++ ) to avoid side effects.\n */\n#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )\n#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )\n\n#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )\n\n /*\n * Approximate sqrt(x*x+y*y) using the `alpha max plus beta min' algorithm.\n * We use alpha = 1, beta = 3/8, giving us results with a largest error\n * less than 7% compared to the exact value.\n */\n#define FT_HYPOT( x, y ) \\\n ( x = FT_ABS( x ), \\\n y = FT_ABS( y ), \\\n x > y ? x + ( 3 * y >> 3 ) \\\n : y + ( 3 * x >> 3 ) )\n\n /* we use FT_TYPEOF to suppress signedness compilation warnings */\n#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n) - 1 ) )\n#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n) / 2, n )\n#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n) - 1, n )\n\n#define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )\n#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )\n#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )\n\n /* specialized versions (for signed values) */\n /* that don't produce run-time errors due to integer overflow */\n#define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \\\n n )\n#define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \\\n n )\n#define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) )\n#define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) )\n\n#define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \\\n n )\n#define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \\\n n )\n#define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) )\n#define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) )\n\n\n /*\n * character classification functions -- since these are used to parse font\n * files, we must not use those in which are locale-dependent\n */\n#define ft_isdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U )\n\n#define ft_isxdigit( x ) ( ( (unsigned)(x) - '0' ) < 10U || \\\n ( (unsigned)(x) - 'a' ) < 6U || \\\n ( (unsigned)(x) - 'A' ) < 6U )\n\n /* the next two macros assume ASCII representation */\n#define ft_isupper( x ) ( ( (unsigned)(x) - 'A' ) < 26U )\n#define ft_islower( x ) ( ( (unsigned)(x) - 'a' ) < 26U )\n\n#define ft_isalpha( x ) ( ft_isupper( x ) || ft_islower( x ) )\n#define ft_isalnum( x ) ( ft_isdigit( x ) || ft_isalpha( x ) )\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** C H A R M A P S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n /* handle to internal charmap object */\n typedef struct FT_CMapRec_* FT_CMap;\n\n /* handle to charmap class structure */\n typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;\n\n /* internal charmap object structure */\n typedef struct FT_CMapRec_\n {\n FT_CharMapRec charmap;\n FT_CMap_Class clazz;\n\n } FT_CMapRec;\n\n /* typecast any pointer to a charmap handle */\n#define FT_CMAP( x ) ( (FT_CMap)( x ) )\n\n /* obvious macros */\n#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id\n#define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id\n#define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding\n#define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face\n\n\n /* class method definitions */\n typedef FT_Error\n (*FT_CMap_InitFunc)( FT_CMap cmap,\n FT_Pointer init_data );\n\n typedef void\n (*FT_CMap_DoneFunc)( FT_CMap cmap );\n\n typedef FT_UInt\n (*FT_CMap_CharIndexFunc)( FT_CMap cmap,\n FT_UInt32 char_code );\n\n typedef FT_UInt\n (*FT_CMap_CharNextFunc)( FT_CMap cmap,\n FT_UInt32 *achar_code );\n\n typedef FT_UInt\n (*FT_CMap_CharVarIndexFunc)( FT_CMap cmap,\n FT_CMap unicode_cmap,\n FT_UInt32 char_code,\n FT_UInt32 variant_selector );\n\n typedef FT_Int\n (*FT_CMap_CharVarIsDefaultFunc)( FT_CMap cmap,\n FT_UInt32 char_code,\n FT_UInt32 variant_selector );\n\n typedef FT_UInt32 *\n (*FT_CMap_VariantListFunc)( FT_CMap cmap,\n FT_Memory mem );\n\n typedef FT_UInt32 *\n (*FT_CMap_CharVariantListFunc)( FT_CMap cmap,\n FT_Memory mem,\n FT_UInt32 char_code );\n\n typedef FT_UInt32 *\n (*FT_CMap_VariantCharListFunc)( FT_CMap cmap,\n FT_Memory mem,\n FT_UInt32 variant_selector );\n\n\n typedef struct FT_CMap_ClassRec_\n {\n FT_ULong size;\n\n FT_CMap_InitFunc init;\n FT_CMap_DoneFunc done;\n FT_CMap_CharIndexFunc char_index;\n FT_CMap_CharNextFunc char_next;\n\n /* Subsequent entries are special ones for format 14 -- the variant */\n /* selector subtable which behaves like no other */\n\n FT_CMap_CharVarIndexFunc char_var_index;\n FT_CMap_CharVarIsDefaultFunc char_var_default;\n FT_CMap_VariantListFunc variant_list;\n FT_CMap_CharVariantListFunc charvariant_list;\n FT_CMap_VariantCharListFunc variantchar_list;\n\n } FT_CMap_ClassRec;\n\n\n#define FT_DECLARE_CMAP_CLASS( class_ ) \\\n FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;\n\n#define FT_DEFINE_CMAP_CLASS( \\\n class_, \\\n size_, \\\n init_, \\\n done_, \\\n char_index_, \\\n char_next_, \\\n char_var_index_, \\\n char_var_default_, \\\n variant_list_, \\\n charvariant_list_, \\\n variantchar_list_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_CMap_ClassRec class_ = \\\n { \\\n size_, \\\n init_, \\\n done_, \\\n char_index_, \\\n char_next_, \\\n char_var_index_, \\\n char_var_default_, \\\n variant_list_, \\\n charvariant_list_, \\\n variantchar_list_ \\\n };\n\n\n /* create a new charmap and add it to charmap->face */\n FT_BASE( FT_Error )\n FT_CMap_New( FT_CMap_Class clazz,\n FT_Pointer init_data,\n FT_CharMap charmap,\n FT_CMap *acmap );\n\n /* destroy a charmap and remove it from face's list */\n FT_BASE( void )\n FT_CMap_Done( FT_CMap cmap );\n\n\n /* add LCD padding to CBox */\n FT_BASE( void )\n ft_lcd_padding( FT_BBox* cbox,\n FT_GlyphSlot slot,\n FT_Render_Mode mode );\n\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\n\n typedef void (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap* bitmap,\n FT_Byte* weights );\n\n\n /* This is the default LCD filter, an in-place, 5-tap FIR filter. */\n FT_BASE( void )\n ft_lcd_filter_fir( FT_Bitmap* bitmap,\n FT_LcdFiveTapFilter weights );\n\n#endif /* FT_CONFIG_OPTION_SUBPIXEL_RENDERING */\n\n /**************************************************************************\n *\n * @struct:\n * FT_Face_InternalRec\n *\n * @description:\n * This structure contains the internal fields of each FT_Face object.\n * These fields may change between different releases of FreeType.\n *\n * @fields:\n * max_points ::\n * The maximum number of points used to store the vectorial outline of\n * any glyph in this face. If this value cannot be known in advance,\n * or if the face isn't scalable, this should be set to 0. Only\n * relevant for scalable formats.\n *\n * max_contours ::\n * The maximum number of contours used to store the vectorial outline\n * of any glyph in this face. If this value cannot be known in\n * advance, or if the face isn't scalable, this should be set to 0.\n * Only relevant for scalable formats.\n *\n * transform_matrix ::\n * A 2x2 matrix of 16.16 coefficients used to transform glyph outlines\n * after they are loaded from the font. Only used by the convenience\n * functions.\n *\n * transform_delta ::\n * A translation vector used to transform glyph outlines after they are\n * loaded from the font. Only used by the convenience functions.\n *\n * transform_flags ::\n * Some flags used to classify the transform. Only used by the\n * convenience functions.\n *\n * services ::\n * A cache for frequently used services. It should be only accessed\n * with the macro `FT_FACE_LOOKUP_SERVICE`.\n *\n * incremental_interface ::\n * If non-null, the interface through which glyph data and metrics are\n * loaded incrementally for faces that do not provide all of this data\n * when first opened. This field exists only if\n * @FT_CONFIG_OPTION_INCREMENTAL is defined.\n *\n * no_stem_darkening ::\n * Overrides the module-level default, see @stem-darkening[cff], for\n * example. FALSE and TRUE toggle stem darkening on and off,\n * respectively, value~-1 means to use the module/driver default.\n *\n * random_seed ::\n * If positive, override the seed value for the CFF 'random' operator.\n * Value~0 means to use the font's value. Value~-1 means to use the\n * CFF driver's default.\n *\n * lcd_weights ::\n * lcd_filter_func ::\n * These fields specify the LCD filtering weights and callback function\n * for ClearType-style subpixel rendering.\n *\n * refcount ::\n * A counter initialized to~1 at the time an @FT_Face structure is\n * created. @FT_Reference_Face increments this counter, and\n * @FT_Done_Face only destroys a face if the counter is~1, otherwise it\n * simply decrements it.\n */\n typedef struct FT_Face_InternalRec_\n {\n FT_Matrix transform_matrix;\n FT_Vector transform_delta;\n FT_Int transform_flags;\n\n FT_ServiceCacheRec services;\n\n#ifdef FT_CONFIG_OPTION_INCREMENTAL\n FT_Incremental_InterfaceRec* incremental_interface;\n#endif\n\n FT_Char no_stem_darkening;\n FT_Int32 random_seed;\n\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\n FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */\n FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */\n#endif\n\n FT_Int refcount;\n\n } FT_Face_InternalRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Slot_InternalRec\n *\n * @description:\n * This structure contains the internal fields of each FT_GlyphSlot\n * object. These fields may change between different releases of\n * FreeType.\n *\n * @fields:\n * loader ::\n * The glyph loader object used to load outlines into the glyph slot.\n *\n * flags ::\n * Possible values are zero or FT_GLYPH_OWN_BITMAP. The latter\n * indicates that the FT_GlyphSlot structure owns the bitmap buffer.\n *\n * glyph_transformed ::\n * Boolean. Set to TRUE when the loaded glyph must be transformed\n * through a specific font transformation. This is _not_ the same as\n * the face transform set through FT_Set_Transform().\n *\n * glyph_matrix ::\n * The 2x2 matrix corresponding to the glyph transformation, if\n * necessary.\n *\n * glyph_delta ::\n * The 2d translation vector corresponding to the glyph transformation,\n * if necessary.\n *\n * glyph_hints ::\n * Format-specific glyph hints management.\n *\n * load_flags ::\n * The load flags passed as an argument to @FT_Load_Glyph while\n * initializing the glyph slot.\n */\n\n#define FT_GLYPH_OWN_BITMAP 0x1U\n\n typedef struct FT_Slot_InternalRec_\n {\n FT_GlyphLoader loader;\n FT_UInt flags;\n FT_Bool glyph_transformed;\n FT_Matrix glyph_matrix;\n FT_Vector glyph_delta;\n void* glyph_hints;\n\n FT_Int32 load_flags;\n\n } FT_GlyphSlot_InternalRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_Size_InternalRec\n *\n * @description:\n * This structure contains the internal fields of each FT_Size object.\n *\n * @fields:\n * module_data ::\n * Data specific to a driver module.\n *\n * autohint_mode ::\n * The used auto-hinting mode.\n *\n * autohint_metrics ::\n * Metrics used by the auto-hinter.\n *\n */\n\n typedef struct FT_Size_InternalRec_\n {\n void* module_data;\n\n FT_Render_Mode autohint_mode;\n FT_Size_Metrics autohint_metrics;\n\n } FT_Size_InternalRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** M O D U L E S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_ModuleRec\n *\n * @description:\n * A module object instance.\n *\n * @fields:\n * clazz ::\n * A pointer to the module's class.\n *\n * library ::\n * A handle to the parent library object.\n *\n * memory ::\n * A handle to the memory manager.\n */\n typedef struct FT_ModuleRec_\n {\n FT_Module_Class* clazz;\n FT_Library library;\n FT_Memory memory;\n\n } FT_ModuleRec;\n\n\n /* typecast an object to an FT_Module */\n#define FT_MODULE( x ) ( (FT_Module)(x) )\n\n#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz\n#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library\n#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory\n\n\n#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_FONT_DRIVER )\n\n#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_RENDERER )\n\n#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_HINTER )\n\n#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_STYLER )\n\n#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_DRIVER_SCALABLE )\n\n#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_DRIVER_NO_OUTLINES )\n\n#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_DRIVER_HAS_HINTER )\n\n#define FT_DRIVER_HINTS_LIGHTLY( x ) ( FT_MODULE_CLASS( x )->module_flags & \\\n FT_MODULE_DRIVER_HINTS_LIGHTLY )\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Get_Module_Interface\n *\n * @description:\n * Finds a module and returns its specific interface as a typeless\n * pointer.\n *\n * @input:\n * library ::\n * A handle to the library object.\n *\n * module_name ::\n * The module's name (as an ASCII string).\n *\n * @return:\n * A module-specific interface if available, 0 otherwise.\n *\n * @note:\n * You should better be familiar with FreeType internals to know which\n * module to look for, and what its interface is :-)\n */\n FT_BASE( const void* )\n FT_Get_Module_Interface( FT_Library library,\n const char* mod_name );\n\n FT_BASE( FT_Pointer )\n ft_module_get_service( FT_Module module,\n const char* service_id,\n FT_Bool global );\n\n#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES\n FT_BASE( FT_Error )\n ft_property_string_set( FT_Library library,\n const FT_String* module_name,\n const FT_String* property_name,\n FT_String* value );\n#endif\n\n /* */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n /* a few macros used to perform easy typecasts with minimal brain damage */\n\n#define FT_FACE( x ) ( (FT_Face)(x) )\n#define FT_SIZE( x ) ( (FT_Size)(x) )\n#define FT_SLOT( x ) ( (FT_GlyphSlot)(x) )\n\n#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver\n#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library\n#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory\n#define FT_FACE_STREAM( x ) FT_FACE( x )->stream\n\n#define FT_SIZE_FACE( x ) FT_SIZE( x )->face\n#define FT_SLOT_FACE( x ) FT_SLOT( x )->face\n\n#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph\n#define FT_FACE_SIZE( x ) FT_FACE( x )->size\n\n\n /**************************************************************************\n *\n * @function:\n * FT_New_GlyphSlot\n *\n * @description:\n * It is sometimes useful to have more than one glyph slot for a given\n * face object. This function is used to create additional slots. All\n * of them are automatically discarded when the face is destroyed.\n *\n * @input:\n * face ::\n * A handle to a parent face object.\n *\n * @output:\n * aslot ::\n * A handle to a new glyph slot object.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n FT_BASE( FT_Error )\n FT_New_GlyphSlot( FT_Face face,\n FT_GlyphSlot *aslot );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_GlyphSlot\n *\n * @description:\n * Destroys a given glyph slot. Remember however that all slots are\n * automatically destroyed with its parent. Using this function is not\n * always mandatory.\n *\n * @input:\n * slot ::\n * A handle to a target glyph slot.\n */\n FT_BASE( void )\n FT_Done_GlyphSlot( FT_GlyphSlot slot );\n\n /* */\n\n#define FT_REQUEST_WIDTH( req ) \\\n ( (req)->horiResolution \\\n ? ( (req)->width * (FT_Pos)(req)->horiResolution + 36 ) / 72 \\\n : (req)->width )\n\n#define FT_REQUEST_HEIGHT( req ) \\\n ( (req)->vertResolution \\\n ? ( (req)->height * (FT_Pos)(req)->vertResolution + 36 ) / 72 \\\n : (req)->height )\n\n\n /* Set the metrics according to a bitmap strike. */\n FT_BASE( void )\n FT_Select_Metrics( FT_Face face,\n FT_ULong strike_index );\n\n\n /* Set the metrics according to a size request. */\n FT_BASE( void )\n FT_Request_Metrics( FT_Face face,\n FT_Size_Request req );\n\n\n /* Match a size request against `available_sizes'. */\n FT_BASE( FT_Error )\n FT_Match_Size( FT_Face face,\n FT_Size_Request req,\n FT_Bool ignore_width,\n FT_ULong* size_index );\n\n\n /* Use the horizontal metrics to synthesize the vertical metrics. */\n /* If `advance' is zero, it is also synthesized. */\n FT_BASE( void )\n ft_synthesize_vertical_metrics( FT_Glyph_Metrics* metrics,\n FT_Pos advance );\n\n\n /* Free the bitmap of a given glyphslot when needed (i.e., only when it */\n /* was allocated with ft_glyphslot_alloc_bitmap). */\n FT_BASE( void )\n ft_glyphslot_free_bitmap( FT_GlyphSlot slot );\n\n\n /* Preset bitmap metrics of an outline glyphslot prior to rendering */\n /* and check whether the truncated bbox is too large for rendering. */\n FT_BASE( FT_Bool )\n ft_glyphslot_preset_bitmap( FT_GlyphSlot slot,\n FT_Render_Mode mode,\n const FT_Vector* origin );\n\n /* Allocate a new bitmap buffer in a glyph slot. */\n FT_BASE( FT_Error )\n ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,\n FT_ULong size );\n\n\n /* Set the bitmap buffer in a glyph slot to a given pointer. The buffer */\n /* will not be freed by a later call to ft_glyphslot_free_bitmap. */\n FT_BASE( void )\n ft_glyphslot_set_bitmap( FT_GlyphSlot slot,\n FT_Byte* buffer );\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** R E N D E R E R S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n#define FT_RENDERER( x ) ( (FT_Renderer)(x) )\n#define FT_GLYPH( x ) ( (FT_Glyph)(x) )\n#define FT_BITMAP_GLYPH( x ) ( (FT_BitmapGlyph)(x) )\n#define FT_OUTLINE_GLYPH( x ) ( (FT_OutlineGlyph)(x) )\n\n\n typedef struct FT_RendererRec_\n {\n FT_ModuleRec root;\n FT_Renderer_Class* clazz;\n FT_Glyph_Format glyph_format;\n FT_Glyph_Class glyph_class;\n\n FT_Raster raster;\n FT_Raster_Render_Func raster_render;\n FT_Renderer_RenderFunc render;\n\n } FT_RendererRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** F O N T D R I V E R S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /* typecast a module into a driver easily */\n#define FT_DRIVER( x ) ( (FT_Driver)(x) )\n\n /* typecast a module as a driver, and get its driver class */\n#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_DriverRec\n *\n * @description:\n * The root font driver class. A font driver is responsible for managing\n * and loading font files of a given format.\n *\n * @fields:\n * root ::\n * Contains the fields of the root module class.\n *\n * clazz ::\n * A pointer to the font driver's class. Note that this is NOT\n * root.clazz. 'class' wasn't used as it is a reserved word in C++.\n *\n * faces_list ::\n * The list of faces currently opened by this driver.\n *\n * glyph_loader ::\n * Unused. Used to be glyph loader for all faces managed by this\n * driver.\n */\n typedef struct FT_DriverRec_\n {\n FT_ModuleRec root;\n FT_Driver_Class clazz;\n FT_ListRec faces_list;\n FT_GlyphLoader glyph_loader;\n\n } FT_DriverRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** L I B R A R I E S ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * FT_LibraryRec\n *\n * @description:\n * The FreeType library class. This is the root of all FreeType data.\n * Use FT_New_Library() to create a library object, and FT_Done_Library()\n * to discard it and all child objects.\n *\n * @fields:\n * memory ::\n * The library's memory object. Manages memory allocation.\n *\n * version_major ::\n * The major version number of the library.\n *\n * version_minor ::\n * The minor version number of the library.\n *\n * version_patch ::\n * The current patch level of the library.\n *\n * num_modules ::\n * The number of modules currently registered within this library.\n * This is set to 0 for new libraries. New modules are added through\n * the FT_Add_Module() API function.\n *\n * modules ::\n * A table used to store handles to the currently registered\n * modules. Note that each font driver contains a list of its opened\n * faces.\n *\n * renderers ::\n * The list of renderers currently registered within the library.\n *\n * cur_renderer ::\n * The current outline renderer. This is a shortcut used to avoid\n * parsing the list on each call to FT_Outline_Render(). It is a\n * handle to the current renderer for the FT_GLYPH_FORMAT_OUTLINE\n * format.\n *\n * auto_hinter ::\n * The auto-hinter module interface.\n *\n * debug_hooks ::\n * An array of four function pointers that allow debuggers to hook into\n * a font format's interpreter. Currently, only the TrueType bytecode\n * debugger uses this.\n *\n * lcd_weights ::\n * The LCD filter weights for ClearType-style subpixel rendering.\n *\n * lcd_filter_func ::\n * The LCD filtering callback function for ClearType-style subpixel\n * rendering.\n *\n * lcd_geometry ::\n * This array specifies LCD subpixel geometry and controls Harmony LCD\n * rendering technique, alternative to ClearType.\n *\n * pic_container ::\n * Contains global structs and tables, instead of defining them\n * globally.\n *\n * refcount ::\n * A counter initialized to~1 at the time an @FT_Library structure is\n * created. @FT_Reference_Library increments this counter, and\n * @FT_Done_Library only destroys a library if the counter is~1,\n * otherwise it simply decrements it.\n */\n typedef struct FT_LibraryRec_\n {\n FT_Memory memory; /* library's memory manager */\n\n FT_Int version_major;\n FT_Int version_minor;\n FT_Int version_patch;\n\n FT_UInt num_modules;\n FT_Module modules[FT_MAX_MODULES]; /* module objects */\n\n FT_ListRec renderers; /* list of renderers */\n FT_Renderer cur_renderer; /* current outline renderer */\n FT_Module auto_hinter;\n\n FT_DebugHook_Func debug_hooks[4];\n\n#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING\n FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */\n FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */\n#else\n FT_Vector lcd_geometry[3]; /* RGB subpixel positions */\n#endif\n\n FT_Int refcount;\n\n } FT_LibraryRec;\n\n\n FT_BASE( FT_Renderer )\n FT_Lookup_Renderer( FT_Library library,\n FT_Glyph_Format format,\n FT_ListNode* node );\n\n FT_BASE( FT_Error )\n FT_Render_Glyph_Internal( FT_Library library,\n FT_GlyphSlot slot,\n FT_Render_Mode render_mode );\n\n typedef const char*\n (*FT_Face_GetPostscriptNameFunc)( FT_Face face );\n\n typedef FT_Error\n (*FT_Face_GetGlyphNameFunc)( FT_Face face,\n FT_UInt glyph_index,\n FT_Pointer buffer,\n FT_UInt buffer_max );\n\n typedef FT_UInt\n (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face,\n const FT_String* glyph_name );\n\n\n#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM\n\n /**************************************************************************\n *\n * @function:\n * FT_New_Memory\n *\n * @description:\n * Creates a new memory object.\n *\n * @return:\n * A pointer to the new memory object. 0 in case of error.\n */\n FT_BASE( FT_Memory )\n FT_New_Memory( void );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Done_Memory\n *\n * @description:\n * Discards memory manager.\n *\n * @input:\n * memory ::\n * A handle to the memory manager.\n */\n FT_BASE( void )\n FT_Done_Memory( FT_Memory memory );\n\n#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */\n\n\n /* Define default raster's interface. The default raster is located in */\n /* `src/base/ftraster.c'. */\n /* */\n /* Client applications can register new rasters through the */\n /* FT_Set_Raster() API. */\n\n#ifndef FT_NO_DEFAULT_RASTER\n FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;\n#endif\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DEFINE_OUTLINE_FUNCS\n *\n * @description:\n * Used to initialize an instance of FT_Outline_Funcs struct. The struct\n * will be allocated in the global scope (or the scope where the macro is\n * used).\n */\n#define FT_DEFINE_OUTLINE_FUNCS( \\\n class_, \\\n move_to_, \\\n line_to_, \\\n conic_to_, \\\n cubic_to_, \\\n shift_, \\\n delta_ ) \\\n static const FT_Outline_Funcs class_ = \\\n { \\\n move_to_, \\\n line_to_, \\\n conic_to_, \\\n cubic_to_, \\\n shift_, \\\n delta_ \\\n };\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DEFINE_RASTER_FUNCS\n *\n * @description:\n * Used to initialize an instance of FT_Raster_Funcs struct. The struct\n * will be allocated in the global scope (or the scope where the macro is\n * used).\n */\n#define FT_DEFINE_RASTER_FUNCS( \\\n class_, \\\n glyph_format_, \\\n raster_new_, \\\n raster_reset_, \\\n raster_set_mode_, \\\n raster_render_, \\\n raster_done_ ) \\\n const FT_Raster_Funcs class_ = \\\n { \\\n glyph_format_, \\\n raster_new_, \\\n raster_reset_, \\\n raster_set_mode_, \\\n raster_render_, \\\n raster_done_ \\\n };\n\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DEFINE_GLYPH\n *\n * @description:\n * The struct will be allocated in the global scope (or the scope where\n * the macro is used).\n */\n#define FT_DEFINE_GLYPH( \\\n class_, \\\n size_, \\\n format_, \\\n init_, \\\n done_, \\\n copy_, \\\n transform_, \\\n bbox_, \\\n prepare_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_Glyph_Class class_ = \\\n { \\\n size_, \\\n format_, \\\n init_, \\\n done_, \\\n copy_, \\\n transform_, \\\n bbox_, \\\n prepare_ \\\n };\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DECLARE_RENDERER\n *\n * @description:\n * Used to create a forward declaration of a FT_Renderer_Class struct\n * instance.\n *\n * @macro:\n * FT_DEFINE_RENDERER\n *\n * @description:\n * Used to initialize an instance of FT_Renderer_Class struct.\n *\n * The struct will be allocated in the global scope (or the scope where\n * the macro is used).\n */\n#define FT_DECLARE_RENDERER( class_ ) \\\n FT_EXPORT_VAR( const FT_Renderer_Class ) class_;\n\n#define FT_DEFINE_RENDERER( \\\n class_, \\\n flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_, \\\n glyph_format_, \\\n render_glyph_, \\\n transform_glyph_, \\\n get_glyph_cbox_, \\\n set_mode_, \\\n raster_class_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_Renderer_Class class_ = \\\n { \\\n FT_DEFINE_ROOT_MODULE( flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_ ) \\\n glyph_format_, \\\n \\\n render_glyph_, \\\n transform_glyph_, \\\n get_glyph_cbox_, \\\n set_mode_, \\\n \\\n raster_class_ \\\n };\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DECLARE_MODULE\n *\n * @description:\n * Used to create a forward declaration of a FT_Module_Class struct\n * instance.\n *\n * @macro:\n * FT_DEFINE_MODULE\n *\n * @description:\n * Used to initialize an instance of an FT_Module_Class struct.\n *\n * The struct will be allocated in the global scope (or the scope where\n * the macro is used).\n *\n * @macro:\n * FT_DEFINE_ROOT_MODULE\n *\n * @description:\n * Used to initialize an instance of an FT_Module_Class struct inside\n * another struct that contains it or in a function that initializes that\n * containing struct.\n */\n#define FT_DECLARE_MODULE( class_ ) \\\n FT_CALLBACK_TABLE \\\n const FT_Module_Class class_;\n\n#define FT_DEFINE_ROOT_MODULE( \\\n flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_ ) \\\n { \\\n flags_, \\\n size_, \\\n \\\n name_, \\\n version_, \\\n requires_, \\\n \\\n interface_, \\\n \\\n init_, \\\n done_, \\\n get_interface_, \\\n },\n\n#define FT_DEFINE_MODULE( \\\n class_, \\\n flags_, \\\n size_, \\\n name_, \\\n version_, \\\n requires_, \\\n interface_, \\\n init_, \\\n done_, \\\n get_interface_ ) \\\n FT_CALLBACK_TABLE_DEF \\\n const FT_Module_Class class_ = \\\n { \\\n flags_, \\\n size_, \\\n \\\n name_, \\\n version_, \\\n requires_, \\\n \\\n interface_, \\\n \\\n init_, \\\n done_, \\\n get_interface_, \\\n };\n\n\nFT_END_HEADER\n\n#endif /* FTOBJS_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftpsprop.h", "language": "code", "loc": 33, "comment_density": 0.606, "code": "/****************************************************************************\n *\n * ftpsprop.h\n *\n * Get and set properties of PostScript drivers (specification).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTPSPROP_H_\n#define FTPSPROP_H_\n\n\n#include \n#include FT_FREETYPE_H\n\n\nFT_BEGIN_HEADER\n\n\n FT_BASE_CALLBACK( FT_Error )\n ps_property_set( FT_Module module, /* PS_Driver */\n const char* property_name,\n const void* value,\n FT_Bool value_is_string );\n\n FT_BASE_CALLBACK( FT_Error )\n ps_property_get( FT_Module module, /* PS_Driver */\n const char* property_name,\n void* value );\n\n\nFT_END_HEADER\n\n\n#endif /* FTPSPROP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftrfork.h", "language": "code", "loc": 215, "comment_density": 0.707, "code": "/****************************************************************************\n *\n * ftrfork.h\n *\n * Embedded resource forks accessor (specification).\n *\n * Copyright (C) 2004-2020 by\n * Masatake YAMATO and Redhat K.K.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n/****************************************************************************\n * Development of the code in this file is support of\n * Information-technology Promotion Agency, Japan.\n */\n\n\n#ifndef FTRFORK_H_\n#define FTRFORK_H_\n\n\n#include \n#include FT_INTERNAL_OBJECTS_H\n\n\nFT_BEGIN_HEADER\n\n\n /* Number of guessing rules supported in `FT_Raccess_Guess'. */\n /* Don't forget to increment the number if you add a new guessing rule. */\n#define FT_RACCESS_N_RULES 9\n\n\n /* A structure to describe a reference in a resource by its resource ID */\n /* and internal offset. The `POST' resource expects to be concatenated */\n /* by the order of resource IDs instead of its appearance in the file. */\n\n typedef struct FT_RFork_Ref_\n {\n FT_Short res_id;\n FT_Long offset;\n\n } FT_RFork_Ref;\n\n\n#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK\n typedef FT_Error\n (*ft_raccess_guess_func)( FT_Library library,\n FT_Stream stream,\n char *base_file_name,\n char **result_file_name,\n FT_Long *result_offset );\n\n typedef enum FT_RFork_Rule_ {\n FT_RFork_Rule_invalid = -2,\n FT_RFork_Rule_uknown, /* -1 */\n FT_RFork_Rule_apple_double,\n FT_RFork_Rule_apple_single,\n FT_RFork_Rule_darwin_ufs_export,\n FT_RFork_Rule_darwin_newvfs,\n FT_RFork_Rule_darwin_hfsplus,\n FT_RFork_Rule_vfat,\n FT_RFork_Rule_linux_cap,\n FT_RFork_Rule_linux_double,\n FT_RFork_Rule_linux_netatalk\n } FT_RFork_Rule;\n\n /* For fast translation between rule index and rule type,\n * the macros FT_RFORK_xxx should be kept consistent with the\n * raccess_guess_funcs table\n */\n typedef struct ft_raccess_guess_rec_ {\n ft_raccess_guess_func func;\n FT_RFork_Rule type;\n } ft_raccess_guess_rec;\n\n\n#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \\\n static const type name[] = {\n#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \\\n { raccess_guess_ ## func_suffix, \\\n FT_RFork_Rule_ ## type_suffix },\n /* this array is a storage, thus a final `;' is needed */\n#define CONST_FT_RFORK_RULE_ARRAY_END };\n\n#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Raccess_Guess\n *\n * @description:\n * Guess a file name and offset where the actual resource fork is stored.\n * The macro FT_RACCESS_N_RULES holds the number of guessing rules; the\n * guessed result for the Nth rule is represented as a triplet: a new\n * file name (new_names[N]), a file offset (offsets[N]), and an error\n * code (errors[N]).\n *\n * @input:\n * library ::\n * A FreeType library instance.\n *\n * stream ::\n * A file stream containing the resource fork.\n *\n * base_name ::\n * The (base) file name of the resource fork used for some guessing\n * rules.\n *\n * @output:\n * new_names ::\n * An array of guessed file names in which the resource forks may\n * exist. If 'new_names[N]' is `NULL`, the guessed file name is equal\n * to `base_name`.\n *\n * offsets ::\n * An array of guessed file offsets. 'offsets[N]' holds the file\n * offset of the possible start of the resource fork in file\n * 'new_names[N]'.\n *\n * errors ::\n * An array of FreeType error codes. 'errors[N]' is the error code of\n * Nth guessing rule function. If 'errors[N]' is not FT_Err_Ok,\n * 'new_names[N]' and 'offsets[N]' are meaningless.\n */\n FT_BASE( void )\n FT_Raccess_Guess( FT_Library library,\n FT_Stream stream,\n char* base_name,\n char** new_names,\n FT_Long* offsets,\n FT_Error* errors );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Raccess_Get_HeaderInfo\n *\n * @description:\n * Get the information from the header of resource fork. The information\n * includes the file offset where the resource map starts, and the file\n * offset where the resource data starts. `FT_Raccess_Get_DataOffsets`\n * requires these two data.\n *\n * @input:\n * library ::\n * A FreeType library instance.\n *\n * stream ::\n * A file stream containing the resource fork.\n *\n * rfork_offset ::\n * The file offset where the resource fork starts.\n *\n * @output:\n * map_offset ::\n * The file offset where the resource map starts.\n *\n * rdata_pos ::\n * The file offset where the resource data starts.\n *\n * @return:\n * FreeType error code. FT_Err_Ok means success.\n */\n FT_BASE( FT_Error )\n FT_Raccess_Get_HeaderInfo( FT_Library library,\n FT_Stream stream,\n FT_Long rfork_offset,\n FT_Long *map_offset,\n FT_Long *rdata_pos );\n\n\n /**************************************************************************\n *\n * @function:\n * FT_Raccess_Get_DataOffsets\n *\n * @description:\n * Get the data offsets for a tag in a resource fork. Offsets are stored\n * in an array because, in some cases, resources in a resource fork have\n * the same tag.\n *\n * @input:\n * library ::\n * A FreeType library instance.\n *\n * stream ::\n * A file stream containing the resource fork.\n *\n * map_offset ::\n * The file offset where the resource map starts.\n *\n * rdata_pos ::\n * The file offset where the resource data starts.\n *\n * tag ::\n * The resource tag.\n *\n * sort_by_res_id ::\n * A Boolean to sort the fragmented resource by their ids. The\n * fragmented resources for 'POST' resource should be sorted to restore\n * Type1 font properly. For 'sfnt' resources, sorting may induce a\n * different order of the faces in comparison to that by QuickDraw API.\n *\n * @output:\n * offsets ::\n * The stream offsets for the resource data specified by 'tag'. This\n * array is allocated by the function, so you have to call @ft_mem_free\n * after use.\n *\n * count ::\n * The length of offsets array.\n *\n * @return:\n * FreeType error code. FT_Err_Ok means success.\n *\n * @note:\n * Normally you should use `FT_Raccess_Get_HeaderInfo` to get the value\n * for `map_offset` and `rdata_pos`.\n */\n FT_BASE( FT_Error )\n FT_Raccess_Get_DataOffsets( FT_Library library,\n FT_Stream stream,\n FT_Long map_offset,\n FT_Long rdata_pos,\n FT_Long tag,\n FT_Bool sort_by_res_id,\n FT_Long **offsets,\n FT_Long *count );\n\n\nFT_END_HEADER\n\n#endif /* FTRFORK_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftserv.h", "language": "code", "loc": 464, "comment_density": 0.384, "code": "/****************************************************************************\n *\n * ftserv.h\n *\n * The FreeType services (specification only).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n /**************************************************************************\n *\n * Each module can export one or more 'services'. Each service is\n * identified by a constant string and modeled by a pointer; the latter\n * generally corresponds to a structure containing function pointers.\n *\n * Note that a service's data cannot be a mere function pointer because in\n * C it is possible that function pointers might be implemented differently\n * than data pointers (e.g. 48 bits instead of 32).\n *\n */\n\n\n#ifndef FTSERV_H_\n#define FTSERV_H_\n\n\nFT_BEGIN_HEADER\n\n /**************************************************************************\n *\n * @macro:\n * FT_FACE_FIND_SERVICE\n *\n * @description:\n * This macro is used to look up a service from a face's driver module.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * id ::\n * A string describing the service as defined in the service's header\n * files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to\n * 'multi-masters'). It is automatically prefixed with\n * `FT_SERVICE_ID_`.\n *\n * @output:\n * ptr ::\n * A variable that receives the service pointer. Will be `NULL` if not\n * found.\n */\n#ifdef __cplusplus\n\n#define FT_FACE_FIND_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \\\n FT_Pointer _tmp_ = NULL; \\\n FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \\\n \\\n \\\n if ( module->clazz->get_interface ) \\\n _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \\\n *_pptr_ = _tmp_; \\\n FT_END_STMNT\n\n#else /* !C++ */\n\n#define FT_FACE_FIND_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \\\n FT_Pointer _tmp_ = NULL; \\\n \\\n if ( module->clazz->get_interface ) \\\n _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \\\n ptr = _tmp_; \\\n FT_END_STMNT\n\n#endif /* !C++ */\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_FACE_FIND_GLOBAL_SERVICE\n *\n * @description:\n * This macro is used to look up a service from all modules.\n *\n * @input:\n * face ::\n * The source face handle.\n *\n * id ::\n * A string describing the service as defined in the service's header\n * files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to\n * 'multi-masters'). It is automatically prefixed with\n * `FT_SERVICE_ID_`.\n *\n * @output:\n * ptr ::\n * A variable that receives the service pointer. Will be `NULL` if not\n * found.\n */\n#ifdef __cplusplus\n\n#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \\\n FT_Pointer _tmp_; \\\n FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \\\n \\\n \\\n _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id, 1 ); \\\n *_pptr_ = _tmp_; \\\n FT_END_STMNT\n\n#else /* !C++ */\n\n#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \\\n FT_Pointer _tmp_; \\\n \\\n \\\n _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id, 1 ); \\\n ptr = _tmp_; \\\n FT_END_STMNT\n\n#endif /* !C++ */\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** S E R V I C E D E S C R I P T O R S *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n /*\n * The following structure is used to _describe_ a given service to the\n * library. This is useful to build simple static service lists.\n */\n typedef struct FT_ServiceDescRec_\n {\n const char* serv_id; /* service name */\n const void* serv_data; /* service pointer/data */\n\n } FT_ServiceDescRec;\n\n typedef const FT_ServiceDescRec* FT_ServiceDesc;\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_DEFINE_SERVICEDESCREC1\n * FT_DEFINE_SERVICEDESCREC2\n * FT_DEFINE_SERVICEDESCREC3\n * FT_DEFINE_SERVICEDESCREC4\n * FT_DEFINE_SERVICEDESCREC5\n * FT_DEFINE_SERVICEDESCREC6\n * FT_DEFINE_SERVICEDESCREC7\n * FT_DEFINE_SERVICEDESCREC8\n * FT_DEFINE_SERVICEDESCREC9\n * FT_DEFINE_SERVICEDESCREC10\n *\n * @description:\n * Used to initialize an array of FT_ServiceDescRec structures.\n *\n * The array will be allocated in the global scope (or the scope where\n * the macro is used).\n */\n#define FT_DEFINE_SERVICEDESCREC1( class_, \\\n serv_id_1, serv_data_1 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC2( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC3( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC4( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC5( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC6( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC7( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6, \\\n serv_id_7, serv_data_7 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { serv_id_7, serv_data_7 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC8( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6, \\\n serv_id_7, serv_data_7, \\\n serv_id_8, serv_data_8 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { serv_id_7, serv_data_7 }, \\\n { serv_id_8, serv_data_8 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC9( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6, \\\n serv_id_7, serv_data_7, \\\n serv_id_8, serv_data_8, \\\n serv_id_9, serv_data_9 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { serv_id_7, serv_data_7 }, \\\n { serv_id_8, serv_data_8 }, \\\n { serv_id_9, serv_data_9 }, \\\n { NULL, NULL } \\\n };\n\n#define FT_DEFINE_SERVICEDESCREC10( class_, \\\n serv_id_1, serv_data_1, \\\n serv_id_2, serv_data_2, \\\n serv_id_3, serv_data_3, \\\n serv_id_4, serv_data_4, \\\n serv_id_5, serv_data_5, \\\n serv_id_6, serv_data_6, \\\n serv_id_7, serv_data_7, \\\n serv_id_8, serv_data_8, \\\n serv_id_9, serv_data_9, \\\n serv_id_10, serv_data_10 ) \\\n static const FT_ServiceDescRec class_[] = \\\n { \\\n { serv_id_1, serv_data_1 }, \\\n { serv_id_2, serv_data_2 }, \\\n { serv_id_3, serv_data_3 }, \\\n { serv_id_4, serv_data_4 }, \\\n { serv_id_5, serv_data_5 }, \\\n { serv_id_6, serv_data_6 }, \\\n { serv_id_7, serv_data_7 }, \\\n { serv_id_8, serv_data_8 }, \\\n { serv_id_9, serv_data_9 }, \\\n { serv_id_10, serv_data_10 }, \\\n { NULL, NULL } \\\n };\n\n\n /*\n * Parse a list of FT_ServiceDescRec descriptors and look for a specific\n * service by ID. Note that the last element in the array must be { NULL,\n * NULL }, and that the function should return NULL if the service isn't\n * available.\n *\n * This function can be used by modules to implement their `get_service'\n * method.\n */\n FT_BASE( FT_Pointer )\n ft_service_list_lookup( FT_ServiceDesc service_descriptors,\n const char* service_id );\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** S E R V I C E S C A C H E *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n /*\n * This structure is used to store a cache for several frequently used\n * services. It is the type of `face->internal->services'. You should\n * only use FT_FACE_LOOKUP_SERVICE to access it.\n *\n * All fields should have the type FT_Pointer to relax compilation\n * dependencies. We assume the developer isn't completely stupid.\n *\n * Each field must be named `service_XXXX' where `XXX' corresponds to the\n * correct FT_SERVICE_ID_XXXX macro. See the definition of\n * FT_FACE_LOOKUP_SERVICE below how this is implemented.\n *\n */\n typedef struct FT_ServiceCacheRec_\n {\n FT_Pointer service_POSTSCRIPT_FONT_NAME;\n FT_Pointer service_MULTI_MASTERS;\n FT_Pointer service_METRICS_VARIATIONS;\n FT_Pointer service_GLYPH_DICT;\n FT_Pointer service_PFR_METRICS;\n FT_Pointer service_WINFNT;\n\n } FT_ServiceCacheRec, *FT_ServiceCache;\n\n\n /*\n * A magic number used within the services cache.\n */\n\n /* ensure that value `1' has the same width as a pointer */\n#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~(FT_PtrDist)1)\n\n\n /**************************************************************************\n *\n * @macro:\n * FT_FACE_LOOKUP_SERVICE\n *\n * @description:\n * This macro is used to look up a service from a face's driver module\n * using its cache.\n *\n * @input:\n * face ::\n * The source face handle containing the cache.\n *\n * field ::\n * The field name in the cache.\n *\n * id ::\n * The service ID.\n *\n * @output:\n * ptr ::\n * A variable receiving the service data. `NULL` if not available.\n */\n#ifdef __cplusplus\n\n#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Pointer svc; \\\n FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \\\n \\\n \\\n svc = FT_FACE( face )->internal->services. service_ ## id; \\\n if ( svc == FT_SERVICE_UNAVAILABLE ) \\\n svc = NULL; \\\n else if ( svc == NULL ) \\\n { \\\n FT_FACE_FIND_SERVICE( face, svc, id ); \\\n \\\n FT_FACE( face )->internal->services. service_ ## id = \\\n (FT_Pointer)( svc != NULL ? svc \\\n : FT_SERVICE_UNAVAILABLE ); \\\n } \\\n *Pptr = svc; \\\n FT_END_STMNT\n\n#else /* !C++ */\n\n#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \\\n FT_BEGIN_STMNT \\\n FT_Pointer svc; \\\n \\\n \\\n svc = FT_FACE( face )->internal->services. service_ ## id; \\\n if ( svc == FT_SERVICE_UNAVAILABLE ) \\\n svc = NULL; \\\n else if ( svc == NULL ) \\\n { \\\n FT_FACE_FIND_SERVICE( face, svc, id ); \\\n \\\n FT_FACE( face )->internal->services. service_ ## id = \\\n (FT_Pointer)( svc != NULL ? svc \\\n : FT_SERVICE_UNAVAILABLE ); \\\n } \\\n ptr = svc; \\\n FT_END_STMNT\n\n#endif /* !C++ */\n\n /*\n * A macro used to define new service structure types.\n */\n\n#define FT_DEFINE_SERVICE( name ) \\\n typedef struct FT_Service_ ## name ## Rec_ \\\n FT_Service_ ## name ## Rec ; \\\n typedef struct FT_Service_ ## name ## Rec_ \\\n const * FT_Service_ ## name ; \\\n struct FT_Service_ ## name ## Rec_\n\n /* */\n\n /*\n * The header files containing the services.\n */\n\n#define FT_SERVICE_BDF_H \n#define FT_SERVICE_CFF_TABLE_LOAD_H \n#define FT_SERVICE_CID_H \n#define FT_SERVICE_FONT_FORMAT_H \n#define FT_SERVICE_GLYPH_DICT_H \n#define FT_SERVICE_GX_VALIDATE_H \n#define FT_SERVICE_KERNING_H \n#define FT_SERVICE_METRICS_VARIATIONS_H \n#define FT_SERVICE_MULTIPLE_MASTERS_H \n#define FT_SERVICE_OPENTYPE_VALIDATE_H \n#define FT_SERVICE_PFR_H \n#define FT_SERVICE_POSTSCRIPT_CMAPS_H \n#define FT_SERVICE_POSTSCRIPT_INFO_H \n#define FT_SERVICE_POSTSCRIPT_NAME_H \n#define FT_SERVICE_PROPERTIES_H \n#define FT_SERVICE_SFNT_H \n#define FT_SERVICE_TRUETYPE_ENGINE_H \n#define FT_SERVICE_TRUETYPE_GLYF_H \n#define FT_SERVICE_TT_CMAP_H \n#define FT_SERVICE_WINFNT_H \n\n /* */\n\nFT_END_HEADER\n\n#endif /* FTSERV_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftstream.h", "language": "code", "loc": 438, "comment_density": 0.283, "code": "/****************************************************************************\n *\n * ftstream.h\n *\n * Stream handling (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTSTREAM_H_\n#define FTSTREAM_H_\n\n\n#include \n#include FT_SYSTEM_H\n#include FT_INTERNAL_OBJECTS_H\n\n\nFT_BEGIN_HEADER\n\n\n /* format of an 8-bit frame_op value: */\n /* */\n /* bit 76543210 */\n /* xxxxxxes */\n /* */\n /* s is set to 1 if the value is signed. */\n /* e is set to 1 if the value is little-endian. */\n /* xxx is a command. */\n\n#define FT_FRAME_OP_SHIFT 2\n#define FT_FRAME_OP_SIGNED 1\n#define FT_FRAME_OP_LITTLE 2\n#define FT_FRAME_OP_COMMAND( x ) ( x >> FT_FRAME_OP_SHIFT )\n\n#define FT_MAKE_FRAME_OP( command, little, sign ) \\\n ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )\n\n#define FT_FRAME_OP_END 0\n#define FT_FRAME_OP_START 1 /* start a new frame */\n#define FT_FRAME_OP_BYTE 2 /* read 1-byte value */\n#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */\n#define FT_FRAME_OP_LONG 4 /* read 4-byte value */\n#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */\n#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */\n\n\n typedef enum FT_Frame_Op_\n {\n ft_frame_end = 0,\n ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),\n\n ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ),\n ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ),\n\n ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),\n ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),\n ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),\n ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),\n\n ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),\n ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),\n ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),\n ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),\n\n ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),\n ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),\n ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),\n ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),\n\n ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),\n ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )\n\n } FT_Frame_Op;\n\n\n typedef struct FT_Frame_Field_\n {\n FT_Byte value;\n FT_Byte size;\n FT_UShort offset;\n\n } FT_Frame_Field;\n\n\n /* Construct an FT_Frame_Field out of a structure type and a field name. */\n /* The structure type must be set in the FT_STRUCTURE macro before */\n /* calling the FT_FRAME_START() macro. */\n /* */\n#define FT_FIELD_SIZE( f ) \\\n (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )\n\n#define FT_FIELD_SIZE_DELTA( f ) \\\n (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )\n\n#define FT_FIELD_OFFSET( f ) \\\n (FT_UShort)( offsetof( FT_STRUCTURE, f ) )\n\n#define FT_FRAME_FIELD( frame_op, field ) \\\n { \\\n frame_op, \\\n FT_FIELD_SIZE( field ), \\\n FT_FIELD_OFFSET( field ) \\\n }\n\n#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 }\n\n#define FT_FRAME_START( size ) { ft_frame_start, 0, size }\n#define FT_FRAME_END { ft_frame_end, 0, 0 }\n\n#define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f )\n#define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f )\n#define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f )\n#define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f )\n#define FT_FRAME_OFF3( f ) FT_FRAME_FIELD( ft_frame_off3_be, f )\n#define FT_FRAME_UOFF3( f ) FT_FRAME_FIELD( ft_frame_uoff3_be, f )\n#define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f )\n#define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f )\n\n#define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f )\n#define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f )\n#define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f )\n#define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f )\n#define FT_FRAME_OFF3_LE( f ) FT_FRAME_FIELD( ft_frame_off3_le, f )\n#define FT_FRAME_UOFF3_LE( f ) FT_FRAME_FIELD( ft_frame_uoff3_le, f )\n\n#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 }\n#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }\n#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }\n\n#define FT_FRAME_BYTES( field, count ) \\\n { \\\n ft_frame_bytes, \\\n count, \\\n FT_FIELD_OFFSET( field ) \\\n }\n\n#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 }\n\n\n /**************************************************************************\n *\n * Integer extraction macros -- the 'buffer' parameter must ALWAYS be of\n * type 'char*' or equivalent (1-byte elements).\n */\n\n#define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] )\n\n#define FT_INT16( x ) ( (FT_Int16)(x) )\n#define FT_UINT16( x ) ( (FT_UInt16)(x) )\n#define FT_INT32( x ) ( (FT_Int32)(x) )\n#define FT_UINT32( x ) ( (FT_UInt32)(x) )\n\n\n#define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )\n#define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )\n\n\n /*\n * function acts on increases does range for emits\n * pointer checking frames error\n * -------------------------------------------------------------------\n * FT_PEEK_XXX buffer pointer no no no no\n * FT_NEXT_XXX buffer pointer yes no no no\n * FT_GET_XXX stream->cursor yes yes yes no\n * FT_READ_XXX stream->pos yes yes no yes\n */\n\n\n /*\n * `FT_PEEK_XXX' are generic macros to get data from a buffer position. No\n * safety checks are performed.\n */\n#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8 ) | \\\n FT_BYTE_U16( p, 1, 0 ) )\n\n#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \\\n FT_BYTE_U16( p, 1, 0 ) )\n\n#define FT_PEEK_LONG( p ) FT_INT32( FT_BYTE_U32( p, 0, 24 ) | \\\n FT_BYTE_U32( p, 1, 16 ) | \\\n FT_BYTE_U32( p, 2, 8 ) | \\\n FT_BYTE_U32( p, 3, 0 ) )\n\n#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \\\n FT_BYTE_U32( p, 1, 16 ) | \\\n FT_BYTE_U32( p, 2, 8 ) | \\\n FT_BYTE_U32( p, 3, 0 ) )\n\n#define FT_PEEK_OFF3( p ) FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 2, 0 ) )\n\n#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 2, 0 ) )\n\n#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_BYTE_U16( p, 1, 8 ) | \\\n FT_BYTE_U16( p, 0, 0 ) )\n\n#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \\\n FT_BYTE_U16( p, 0, 0 ) )\n\n#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_BYTE_U32( p, 3, 24 ) | \\\n FT_BYTE_U32( p, 2, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 0, 0 ) )\n\n#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \\\n FT_BYTE_U32( p, 2, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 0, 0 ) )\n\n#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 0, 0 ) )\n\n#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \\\n FT_BYTE_U32( p, 1, 8 ) | \\\n FT_BYTE_U32( p, 0, 0 ) )\n\n /*\n * `FT_NEXT_XXX' are generic macros to get data from a buffer position\n * which is then increased appropriately. No safety checks are performed.\n */\n#define FT_NEXT_CHAR( buffer ) \\\n ( (signed char)*buffer++ )\n\n#define FT_NEXT_BYTE( buffer ) \\\n ( (unsigned char)*buffer++ )\n\n#define FT_NEXT_SHORT( buffer ) \\\n ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )\n\n#define FT_NEXT_USHORT( buffer ) \\\n ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )\n\n#define FT_NEXT_OFF3( buffer ) \\\n ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )\n\n#define FT_NEXT_UOFF3( buffer ) \\\n ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )\n\n#define FT_NEXT_LONG( buffer ) \\\n ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )\n\n#define FT_NEXT_ULONG( buffer ) \\\n ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )\n\n\n#define FT_NEXT_SHORT_LE( buffer ) \\\n ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )\n\n#define FT_NEXT_USHORT_LE( buffer ) \\\n ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )\n\n#define FT_NEXT_OFF3_LE( buffer ) \\\n ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )\n\n#define FT_NEXT_UOFF3_LE( buffer ) \\\n ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )\n\n#define FT_NEXT_LONG_LE( buffer ) \\\n ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )\n\n#define FT_NEXT_ULONG_LE( buffer ) \\\n ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )\n\n\n /**************************************************************************\n *\n * The `FT_GET_XXX` macros use an implicit 'stream' variable.\n *\n * Note that a call to `FT_STREAM_SEEK` or `FT_STREAM_POS` has **no**\n * effect on `FT_GET_XXX`! They operate on `stream->pos`, while\n * `FT_GET_XXX` use `stream->cursor`.\n */\n#if 0\n#define FT_GET_MACRO( type ) FT_NEXT_ ## type ( stream->cursor )\n\n#define FT_GET_CHAR() FT_GET_MACRO( CHAR )\n#define FT_GET_BYTE() FT_GET_MACRO( BYTE )\n#define FT_GET_SHORT() FT_GET_MACRO( SHORT )\n#define FT_GET_USHORT() FT_GET_MACRO( USHORT )\n#define FT_GET_OFF3() FT_GET_MACRO( OFF3 )\n#define FT_GET_UOFF3() FT_GET_MACRO( UOFF3 )\n#define FT_GET_LONG() FT_GET_MACRO( LONG )\n#define FT_GET_ULONG() FT_GET_MACRO( ULONG )\n#define FT_GET_TAG4() FT_GET_MACRO( ULONG )\n\n#define FT_GET_SHORT_LE() FT_GET_MACRO( SHORT_LE )\n#define FT_GET_USHORT_LE() FT_GET_MACRO( USHORT_LE )\n#define FT_GET_LONG_LE() FT_GET_MACRO( LONG_LE )\n#define FT_GET_ULONG_LE() FT_GET_MACRO( ULONG_LE )\n\n#else\n#define FT_GET_MACRO( func, type ) ( (type)func( stream ) )\n\n#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char )\n#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )\n#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_Short )\n#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort )\n#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long )\n#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong )\n#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetULong, FT_Long )\n#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )\n#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong )\n\n#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short )\n#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort )\n#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long )\n#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong )\n#endif\n\n\n#define FT_READ_MACRO( func, type, var ) \\\n ( var = (type)func( stream, &error ), \\\n error != FT_Err_Ok )\n\n /*\n * The `FT_READ_XXX' macros use implicit `stream' and `error' variables.\n *\n * `FT_READ_XXX' can be controlled with `FT_STREAM_SEEK' and\n * `FT_STREAM_POS'. They use the full machinery to check whether a read is\n * valid.\n */\n#define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )\n#define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )\n#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var )\n#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var )\n#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var )\n#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var )\n#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var )\n#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var )\n\n#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var )\n#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var )\n#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var )\n#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var )\n\n\n#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM\n\n /* initialize a stream for reading a regular system stream */\n FT_BASE( FT_Error )\n FT_Stream_Open( FT_Stream stream,\n const char* filepathname );\n\n#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */\n\n\n /* create a new (input) stream from an FT_Open_Args structure */\n FT_BASE( FT_Error )\n FT_Stream_New( FT_Library library,\n const FT_Open_Args* args,\n FT_Stream *astream );\n\n /* free a stream */\n FT_BASE( void )\n FT_Stream_Free( FT_Stream stream,\n FT_Int external );\n\n /* initialize a stream for reading in-memory data */\n FT_BASE( void )\n FT_Stream_OpenMemory( FT_Stream stream,\n const FT_Byte* base,\n FT_ULong size );\n\n /* close a stream (does not destroy the stream structure) */\n FT_BASE( void )\n FT_Stream_Close( FT_Stream stream );\n\n\n /* seek within a stream. position is relative to start of stream */\n FT_BASE( FT_Error )\n FT_Stream_Seek( FT_Stream stream,\n FT_ULong pos );\n\n /* skip bytes in a stream */\n FT_BASE( FT_Error )\n FT_Stream_Skip( FT_Stream stream,\n FT_Long distance );\n\n /* return current stream position */\n FT_BASE( FT_ULong )\n FT_Stream_Pos( FT_Stream stream );\n\n /* read bytes from a stream into a user-allocated buffer, returns an */\n /* error if not all bytes could be read. */\n FT_BASE( FT_Error )\n FT_Stream_Read( FT_Stream stream,\n FT_Byte* buffer,\n FT_ULong count );\n\n /* read bytes from a stream at a given position */\n FT_BASE( FT_Error )\n FT_Stream_ReadAt( FT_Stream stream,\n FT_ULong pos,\n FT_Byte* buffer,\n FT_ULong count );\n\n /* try to read bytes at the end of a stream; return number of bytes */\n /* really available */\n FT_BASE( FT_ULong )\n FT_Stream_TryRead( FT_Stream stream,\n FT_Byte* buffer,\n FT_ULong count );\n\n /* Enter a frame of `count' consecutive bytes in a stream. Returns an */\n /* error if the frame could not be read/accessed. The caller can use */\n /* the `FT_Stream_GetXXX' functions to retrieve frame data without */\n /* error checks. */\n /* */\n /* You must _always_ call `FT_Stream_ExitFrame' once you have entered */\n /* a stream frame! */\n /* */\n /* Nested frames are not permitted. */\n /* */\n FT_BASE( FT_Error )\n FT_Stream_EnterFrame( FT_Stream stream,\n FT_ULong count );\n\n /* exit a stream frame */\n FT_BASE( void )\n FT_Stream_ExitFrame( FT_Stream stream );\n\n\n /* Extract a stream frame. If the stream is disk-based, a heap block */\n /* is allocated and the frame bytes are read into it. If the stream */\n /* is memory-based, this function simply sets a pointer to the data. */\n /* */\n /* Useful to optimize access to memory-based streams transparently. */\n /* */\n /* `FT_Stream_GetXXX' functions can't be used. */\n /* */\n /* An extracted frame must be `freed' with a call to the function */\n /* `FT_Stream_ReleaseFrame'. */\n /* */\n FT_BASE( FT_Error )\n FT_Stream_ExtractFrame( FT_Stream stream,\n FT_ULong count,\n FT_Byte** pbytes );\n\n /* release an extract frame (see `FT_Stream_ExtractFrame') */\n FT_BASE( void )\n FT_Stream_ReleaseFrame( FT_Stream stream,\n FT_Byte** pbytes );\n\n\n /* read a byte from an entered frame */\n FT_BASE( FT_Char )\n FT_Stream_GetChar( FT_Stream stream );\n\n /* read a 16-bit big-endian unsigned integer from an entered frame */\n FT_BASE( FT_UShort )\n FT_Stream_GetUShort( FT_Stream stream );\n\n /* read a 24-bit big-endian unsigned integer from an entered frame */\n FT_BASE( FT_ULong )\n FT_Stream_GetUOffset( FT_Stream stream );\n\n /* read a 32-bit big-endian unsigned integer from an entered frame */\n FT_BASE( FT_ULong )\n FT_Stream_GetULong( FT_Stream stream );\n\n /* read a 16-bit little-endian unsigned integer from an entered frame */\n FT_BASE( FT_UShort )\n FT_Stream_GetUShortLE( FT_Stream stream );\n\n /* read a 32-bit little-endian unsigned integer from an entered frame */\n FT_BASE( FT_ULong )\n FT_Stream_GetULongLE( FT_Stream stream );\n\n\n /* read a byte from a stream */\n FT_BASE( FT_Char )\n FT_Stream_ReadChar( FT_Stream stream,\n FT_Error* error );\n\n /* read a 16-bit big-endian unsigned integer from a stream */\n FT_BASE( FT_UShort )\n FT_Stream_ReadUShort( FT_Stream stream,\n FT_Error* error );\n\n /* read a 24-bit big-endian unsigned integer from a stream */\n FT_BASE( FT_ULong )\n FT_Stream_ReadUOffset( FT_Stream stream,\n FT_Error* error );\n\n /* read a 32-bit big-endian integer from a stream */\n FT_BASE( FT_ULong )\n FT_Stream_ReadULong( FT_Stream stream,\n FT_Error* error );\n\n /* read a 16-bit little-endian unsigned integer from a stream */\n FT_BASE( FT_UShort )\n FT_Stream_ReadUShortLE( FT_Stream stream,\n FT_Error* error );\n\n /* read a 32-bit little-endian unsigned integer from a stream */\n FT_BASE( FT_ULong )\n FT_Stream_ReadULongLE( FT_Stream stream,\n FT_Error* error );\n\n /* Read a structure from a stream. The structure must be described */\n /* by an array of FT_Frame_Field records. */\n FT_BASE( FT_Error )\n FT_Stream_ReadFields( FT_Stream stream,\n const FT_Frame_Field* fields,\n void* structure );\n\n\n#define FT_STREAM_POS() \\\n FT_Stream_Pos( stream )\n\n#define FT_STREAM_SEEK( position ) \\\n FT_SET_ERROR( FT_Stream_Seek( stream, \\\n (FT_ULong)(position) ) )\n\n#define FT_STREAM_SKIP( distance ) \\\n FT_SET_ERROR( FT_Stream_Skip( stream, \\\n (FT_Long)(distance) ) )\n\n#define FT_STREAM_READ( buffer, count ) \\\n FT_SET_ERROR( FT_Stream_Read( stream, \\\n (FT_Byte*)(buffer), \\\n (FT_ULong)(count) ) )\n\n#define FT_STREAM_READ_AT( position, buffer, count ) \\\n FT_SET_ERROR( FT_Stream_ReadAt( stream, \\\n (FT_ULong)(position), \\\n (FT_Byte*)(buffer), \\\n (FT_ULong)(count) ) )\n\n#define FT_STREAM_READ_FIELDS( fields, object ) \\\n FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )\n\n\n#define FT_FRAME_ENTER( size ) \\\n FT_SET_ERROR( \\\n FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, \\\n (FT_ULong)(size) ) ) )\n\n#define FT_FRAME_EXIT() \\\n FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )\n\n#define FT_FRAME_EXTRACT( size, bytes ) \\\n FT_SET_ERROR( \\\n FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, \\\n (FT_ULong)(size), \\\n (FT_Byte**)&(bytes) ) ) )\n\n#define FT_FRAME_RELEASE( bytes ) \\\n FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, \\\n (FT_Byte**)&(bytes) ) )\n\n\nFT_END_HEADER\n\n#endif /* FTSTREAM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/fttrace.h", "language": "code", "loc": 135, "comment_density": 0.548, "code": "/****************************************************************************\n *\n * fttrace.h\n *\n * Tracing handling (specification only).\n *\n * Copyright (C) 2002-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /* definitions of trace levels for FreeType 2 */\n\n /* the first level must always be `trace_any' */\nFT_TRACE_DEF( any )\n\n /* base components */\nFT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */\nFT_TRACE_DEF( gloader ) /* glyph loader (ftgloadr.c) */\nFT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */\nFT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */\nFT_TRACE_DEF( init ) /* initialization (ftinit.c) */\nFT_TRACE_DEF( io ) /* i/o interface (ftsystem.c) */\nFT_TRACE_DEF( list ) /* list management (ftlist.c) */\nFT_TRACE_DEF( objs ) /* base objects (ftobjs.c) */\nFT_TRACE_DEF( outline ) /* outline management (ftoutln.c) */\nFT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */\n\nFT_TRACE_DEF( bitmap ) /* bitmap manipulation (ftbitmap.c) */\nFT_TRACE_DEF( checksum ) /* bitmap checksum (ftobjs.c) */\nFT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */\nFT_TRACE_DEF( psprops ) /* PS driver properties (ftpsprop.c) */\nFT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */\nFT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */\nFT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */\nFT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */\n\n /* Cache sub-system */\nFT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */\n\n /* SFNT driver components */\nFT_TRACE_DEF( sfdriver ) /* SFNT font driver (sfdriver.c) */\nFT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */\nFT_TRACE_DEF( sfwoff ) /* WOFF format handler (sfwoff.c) */\nFT_TRACE_DEF( sfwoff2 ) /* WOFF2 format handler (sfwoff2.c) */\nFT_TRACE_DEF( ttbdf ) /* TrueType embedded BDF (ttbdf.c) */\nFT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */\nFT_TRACE_DEF( ttcolr ) /* glyph layer table (ttcolr.c) */\nFT_TRACE_DEF( ttcpal ) /* color palette table (ttcpal.c) */\nFT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */\nFT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */\nFT_TRACE_DEF( ttmtx ) /* metrics-related tables (ttmtx.c) */\nFT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */\nFT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */\n\n /* TrueType driver components */\nFT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */\nFT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */\nFT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */\nFT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */\nFT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */\nFT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */\n\n /* Type 1 driver components */\nFT_TRACE_DEF( t1afm )\nFT_TRACE_DEF( t1driver )\nFT_TRACE_DEF( t1gload )\nFT_TRACE_DEF( t1load )\nFT_TRACE_DEF( t1objs )\nFT_TRACE_DEF( t1parse )\n\n /* PostScript helper module `psaux' */\nFT_TRACE_DEF( cffdecode )\nFT_TRACE_DEF( psconv )\nFT_TRACE_DEF( psobjs )\nFT_TRACE_DEF( t1decode )\n\n /* PostScript hinting module `pshinter' */\nFT_TRACE_DEF( pshalgo )\nFT_TRACE_DEF( pshrec )\n\n /* Type 2 driver components */\nFT_TRACE_DEF( cffdriver )\nFT_TRACE_DEF( cffgload )\nFT_TRACE_DEF( cffload )\nFT_TRACE_DEF( cffobjs )\nFT_TRACE_DEF( cffparse )\n\nFT_TRACE_DEF( cf2blues )\nFT_TRACE_DEF( cf2hints )\nFT_TRACE_DEF( cf2interp )\n\n /* Type 42 driver component */\nFT_TRACE_DEF( t42 )\n\n /* CID driver components */\nFT_TRACE_DEF( ciddriver )\nFT_TRACE_DEF( cidgload )\nFT_TRACE_DEF( cidload )\nFT_TRACE_DEF( cidobjs )\nFT_TRACE_DEF( cidparse )\n\n /* Windows font component */\nFT_TRACE_DEF( winfnt )\n\n /* PCF font components */\nFT_TRACE_DEF( pcfdriver )\nFT_TRACE_DEF( pcfread )\n\n /* BDF font components */\nFT_TRACE_DEF( bdfdriver )\nFT_TRACE_DEF( bdflib )\n\n /* PFR font component */\nFT_TRACE_DEF( pfr )\n\n /* OpenType validation components */\nFT_TRACE_DEF( otvcommon )\nFT_TRACE_DEF( otvbase )\nFT_TRACE_DEF( otvgdef )\nFT_TRACE_DEF( otvgpos )\nFT_TRACE_DEF( otvgsub )\nFT_TRACE_DEF( otvjstf )\nFT_TRACE_DEF( otvmath )\nFT_TRACE_DEF( otvmodule )\n\n /* TrueTypeGX/AAT validation components */\nFT_TRACE_DEF( gxvbsln )\nFT_TRACE_DEF( gxvcommon )\nFT_TRACE_DEF( gxvfeat )\nFT_TRACE_DEF( gxvjust )\nFT_TRACE_DEF( gxvkern )\nFT_TRACE_DEF( gxvmodule )\nFT_TRACE_DEF( gxvmort )\nFT_TRACE_DEF( gxvmorx )\nFT_TRACE_DEF( gxvlcar )\nFT_TRACE_DEF( gxvopbd )\nFT_TRACE_DEF( gxvprop )\nFT_TRACE_DEF( gxvtrak )\n\n /* autofit components */\nFT_TRACE_DEF( afcjk )\nFT_TRACE_DEF( afglobal )\nFT_TRACE_DEF( afhints )\nFT_TRACE_DEF( afmodule )\nFT_TRACE_DEF( aflatin )\nFT_TRACE_DEF( aflatin2 )\nFT_TRACE_DEF( afshaper )\nFT_TRACE_DEF( afwarp )\n\n/* END */\n"}, {"path": "includes/freetype/internal/ftvalid.h", "language": "code", "loc": 125, "comment_density": 0.648, "code": "/****************************************************************************\n *\n * ftvalid.h\n *\n * FreeType validation support (specification).\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef FTVALID_H_\n#define FTVALID_H_\n\n#include \n#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */\n\n\nFT_BEGIN_HEADER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /**** ****/\n /**** ****/\n /**** V A L I D A T I O N ****/\n /**** ****/\n /**** ****/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n /* handle to a validation object */\n typedef struct FT_ValidatorRec_ volatile* FT_Validator;\n\n\n /**************************************************************************\n *\n * There are three distinct validation levels defined here:\n *\n * FT_VALIDATE_DEFAULT ::\n * A table that passes this validation level can be used reliably by\n * FreeType. It generally means that all offsets have been checked to\n * prevent out-of-bound reads, that array counts are correct, etc.\n *\n * FT_VALIDATE_TIGHT ::\n * A table that passes this validation level can be used reliably and\n * doesn't contain invalid data. For example, a charmap table that\n * returns invalid glyph indices will not pass, even though it can be\n * used with FreeType in default mode (the library will simply return an\n * error later when trying to load the glyph).\n *\n * It also checks that fields which must be a multiple of 2, 4, or 8,\n * don't have incorrect values, etc.\n *\n * FT_VALIDATE_PARANOID ::\n * Only for font debugging. Checks that a table follows the\n * specification by 100%. Very few fonts will be able to pass this level\n * anyway but it can be useful for certain tools like font\n * editors/converters.\n */\n typedef enum FT_ValidationLevel_\n {\n FT_VALIDATE_DEFAULT = 0,\n FT_VALIDATE_TIGHT,\n FT_VALIDATE_PARANOID\n\n } FT_ValidationLevel;\n\n\n#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */\n /* We disable the warning `structure was padded due to */\n /* __declspec(align())' in order to compile cleanly with */\n /* the maximum level of warnings. */\n#pragma warning( push )\n#pragma warning( disable : 4324 )\n#endif /* _MSC_VER */\n\n /* validator structure */\n typedef struct FT_ValidatorRec_\n {\n ft_jmp_buf jump_buffer; /* used for exception handling */\n\n const FT_Byte* base; /* address of table in memory */\n const FT_Byte* limit; /* `base' + sizeof(table) in memory */\n FT_ValidationLevel level; /* validation level */\n FT_Error error; /* error returned. 0 means success */\n\n } FT_ValidatorRec;\n\n#if defined( _MSC_VER )\n#pragma warning( pop )\n#endif\n\n#define FT_VALIDATOR( x ) ( (FT_Validator)( x ) )\n\n\n FT_BASE( void )\n ft_validator_init( FT_Validator valid,\n const FT_Byte* base,\n const FT_Byte* limit,\n FT_ValidationLevel level );\n\n /* Do not use this. It's broken and will cause your validator to crash */\n /* if you run it on an invalid font. */\n FT_BASE( FT_Int )\n ft_validator_run( FT_Validator valid );\n\n /* Sets the error field in a validator, then calls `longjmp' to return */\n /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */\n /* error checks within the validation routines. */\n /* */\n FT_BASE( void )\n ft_validator_error( FT_Validator valid,\n FT_Error error );\n\n\n /* Calls ft_validate_error. Assumes that the `valid' local variable */\n /* holds a pointer to the current validator object. */\n /* */\n#define FT_INVALID( _error ) FT_INVALID_( _error )\n#define FT_INVALID_( _error ) \\\n ft_validator_error( valid, FT_THROW( _error ) )\n\n /* called when a broken table is detected */\n#define FT_INVALID_TOO_SHORT \\\n FT_INVALID( Invalid_Table )\n\n /* called when an invalid offset is detected */\n#define FT_INVALID_OFFSET \\\n FT_INVALID( Invalid_Offset )\n\n /* called when an invalid format/value is detected */\n#define FT_INVALID_FORMAT \\\n FT_INVALID( Invalid_Table )\n\n /* called when an invalid glyph index is detected */\n#define FT_INVALID_GLYPH_ID \\\n FT_INVALID( Invalid_Glyph_Index )\n\n /* called when an invalid field value is detected */\n#define FT_INVALID_DATA \\\n FT_INVALID( Invalid_Table )\n\n\nFT_END_HEADER\n\n#endif /* FTVALID_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/internal.h", "language": "code", "loc": 53, "comment_density": 0.566, "code": "/****************************************************************************\n *\n * internal.h\n *\n * Internal header files (specification only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n /**************************************************************************\n *\n * This file is automatically included by `ft2build.h`. Do not include it\n * manually!\n *\n */\n\n\n#define FT_INTERNAL_OBJECTS_H \n#define FT_INTERNAL_STREAM_H \n#define FT_INTERNAL_MEMORY_H \n#define FT_INTERNAL_DEBUG_H \n#define FT_INTERNAL_CALC_H \n#define FT_INTERNAL_HASH_H \n#define FT_INTERNAL_DRIVER_H \n#define FT_INTERNAL_TRACE_H \n#define FT_INTERNAL_GLYPH_LOADER_H \n#define FT_INTERNAL_SFNT_H \n#define FT_INTERNAL_SERVICE_H \n#define FT_INTERNAL_RFORK_H \n#define FT_INTERNAL_VALIDATE_H \n\n#define FT_INTERNAL_TRUETYPE_TYPES_H \n#define FT_INTERNAL_TYPE1_TYPES_H \n#define FT_INTERNAL_WOFF_TYPES_H \n\n#define FT_INTERNAL_POSTSCRIPT_AUX_H \n#define FT_INTERNAL_POSTSCRIPT_HINTS_H \n#define FT_INTERNAL_POSTSCRIPT_PROPS_H \n\n#define FT_INTERNAL_AUTOHINT_H \n\n#define FT_INTERNAL_CFF_TYPES_H \n#define FT_INTERNAL_CFF_OBJECTS_TYPES_H \n\n\n#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */\n\n /* We disable the warning `conditional expression is constant' here */\n /* in order to compile cleanly with the maximum level of warnings. */\n /* In particular, the warning complains about stuff like `while(0)' */\n /* which is very useful in macro definitions. There is no benefit */\n /* in having it enabled. */\n#pragma warning( disable : 4127 )\n\n#endif /* _MSC_VER */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/psaux.h", "language": "code", "loc": 1143, "comment_density": 0.434, "code": "/****************************************************************************\n *\n * psaux.h\n *\n * Auxiliary functions and data structures related to PostScript fonts\n * (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef PSAUX_H_\n#define PSAUX_H_\n\n\n#include \n#include FT_INTERNAL_OBJECTS_H\n#include FT_INTERNAL_TYPE1_TYPES_H\n#include FT_INTERNAL_HASH_H\n#include FT_INTERNAL_TRUETYPE_TYPES_H\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\n#include FT_INTERNAL_CFF_TYPES_H\n#include FT_INTERNAL_CFF_OBJECTS_TYPES_H\n\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * PostScript modules driver class.\n */\n typedef struct PS_DriverRec_\n {\n FT_DriverRec root;\n\n FT_UInt hinting_engine;\n FT_Bool no_stem_darkening;\n FT_Int darken_params[8];\n FT_Int32 random_seed;\n\n } PS_DriverRec, *PS_Driver;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1_TABLE *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct PS_TableRec_* PS_Table;\n typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_Table_FuncsRec\n *\n * @description:\n * A set of function pointers to manage PS_Table objects.\n *\n * @fields:\n * table_init ::\n * Used to initialize a table.\n *\n * table_done ::\n * Finalizes resp. destroy a given table.\n *\n * table_add ::\n * Adds a new object to a table.\n *\n * table_release ::\n * Releases table data, then finalizes it.\n */\n typedef struct PS_Table_FuncsRec_\n {\n FT_Error\n (*init)( PS_Table table,\n FT_Int count,\n FT_Memory memory );\n\n void\n (*done)( PS_Table table );\n\n FT_Error\n (*add)( PS_Table table,\n FT_Int idx,\n const void* object,\n FT_UInt length );\n\n void\n (*release)( PS_Table table );\n\n } PS_Table_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_TableRec\n *\n * @description:\n * A PS_Table is a simple object used to store an array of objects in a\n * single memory block.\n *\n * @fields:\n * block ::\n * The address in memory of the growheap's block. This can change\n * between two object adds, due to reallocation.\n *\n * cursor ::\n * The current top of the grow heap within its block.\n *\n * capacity ::\n * The current size of the heap block. Increments by 1kByte chunks.\n *\n * init ::\n * Set to 0xDEADBEEF if 'elements' and 'lengths' have been allocated.\n *\n * max_elems ::\n * The maximum number of elements in table.\n *\n * num_elems ::\n * The current number of elements in table.\n *\n * elements ::\n * A table of element addresses within the block.\n *\n * lengths ::\n * A table of element sizes within the block.\n *\n * memory ::\n * The object used for memory operations (alloc/realloc).\n *\n * funcs ::\n * A table of method pointers for this object.\n */\n typedef struct PS_TableRec_\n {\n FT_Byte* block; /* current memory block */\n FT_Offset cursor; /* current cursor in memory block */\n FT_Offset capacity; /* current size of memory block */\n FT_ULong init;\n\n FT_Int max_elems;\n FT_Int num_elems;\n FT_Byte** elements; /* addresses of table elements */\n FT_UInt* lengths; /* lengths of table elements */\n\n FT_Memory memory;\n PS_Table_FuncsRec funcs;\n\n } PS_TableRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1 FIELDS & TOKENS *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct PS_ParserRec_* PS_Parser;\n\n typedef struct T1_TokenRec_* T1_Token;\n\n typedef struct T1_FieldRec_* T1_Field;\n\n\n /* simple enumeration type used to identify token types */\n typedef enum T1_TokenType_\n {\n T1_TOKEN_TYPE_NONE = 0,\n T1_TOKEN_TYPE_ANY,\n T1_TOKEN_TYPE_STRING,\n T1_TOKEN_TYPE_ARRAY,\n T1_TOKEN_TYPE_KEY, /* aka `name' */\n\n /* do not remove */\n T1_TOKEN_TYPE_MAX\n\n } T1_TokenType;\n\n\n /* a simple structure used to identify tokens */\n typedef struct T1_TokenRec_\n {\n FT_Byte* start; /* first character of token in input stream */\n FT_Byte* limit; /* first character after the token */\n T1_TokenType type; /* type of token */\n\n } T1_TokenRec;\n\n\n /* enumeration type used to identify object fields */\n typedef enum T1_FieldType_\n {\n T1_FIELD_TYPE_NONE = 0,\n T1_FIELD_TYPE_BOOL,\n T1_FIELD_TYPE_INTEGER,\n T1_FIELD_TYPE_FIXED,\n T1_FIELD_TYPE_FIXED_1000,\n T1_FIELD_TYPE_STRING,\n T1_FIELD_TYPE_KEY,\n T1_FIELD_TYPE_BBOX,\n T1_FIELD_TYPE_MM_BBOX,\n T1_FIELD_TYPE_INTEGER_ARRAY,\n T1_FIELD_TYPE_FIXED_ARRAY,\n T1_FIELD_TYPE_CALLBACK,\n\n /* do not remove */\n T1_FIELD_TYPE_MAX\n\n } T1_FieldType;\n\n\n typedef enum T1_FieldLocation_\n {\n T1_FIELD_LOCATION_CID_INFO,\n T1_FIELD_LOCATION_FONT_DICT,\n T1_FIELD_LOCATION_FONT_EXTRA,\n T1_FIELD_LOCATION_FONT_INFO,\n T1_FIELD_LOCATION_PRIVATE,\n T1_FIELD_LOCATION_BBOX,\n T1_FIELD_LOCATION_LOADER,\n T1_FIELD_LOCATION_FACE,\n T1_FIELD_LOCATION_BLEND,\n\n /* do not remove */\n T1_FIELD_LOCATION_MAX\n\n } T1_FieldLocation;\n\n\n typedef void\n (*T1_Field_ParseFunc)( FT_Face face,\n FT_Pointer parser );\n\n\n /* structure type used to model object fields */\n typedef struct T1_FieldRec_\n {\n const char* ident; /* field identifier */\n T1_FieldLocation location;\n T1_FieldType type; /* type of field */\n T1_Field_ParseFunc reader;\n FT_UInt offset; /* offset of field in object */\n FT_Byte size; /* size of field in bytes */\n FT_UInt array_max; /* maximum number of elements for */\n /* array */\n FT_UInt count_offset; /* offset of element count for */\n /* arrays; must not be zero if in */\n /* use -- in other words, a */\n /* `num_FOO' element must not */\n /* start the used structure if we */\n /* parse a `FOO' array */\n FT_UInt dict; /* where we expect it */\n } T1_FieldRec;\n\n#define T1_FIELD_DICT_FONTDICT ( 1 << 0 ) /* also FontInfo and FDArray */\n#define T1_FIELD_DICT_PRIVATE ( 1 << 1 )\n\n\n\n#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \\\n { \\\n _ident, T1CODE, _type, \\\n 0, \\\n FT_FIELD_OFFSET( _fname ), \\\n FT_FIELD_SIZE( _fname ), \\\n 0, 0, \\\n _dict \\\n },\n\n#define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \\\n { \\\n _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \\\n (T1_Field_ParseFunc)_reader, \\\n 0, 0, \\\n 0, 0, \\\n _dict \\\n },\n\n#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \\\n { \\\n _ident, T1CODE, _type, \\\n 0, \\\n FT_FIELD_OFFSET( _fname ), \\\n FT_FIELD_SIZE_DELTA( _fname ), \\\n _max, \\\n FT_FIELD_OFFSET( num_ ## _fname ), \\\n _dict \\\n },\n\n#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \\\n { \\\n _ident, T1CODE, _type, \\\n 0, \\\n FT_FIELD_OFFSET( _fname ), \\\n FT_FIELD_SIZE_DELTA( _fname ), \\\n _max, 0, \\\n _dict \\\n },\n\n\n#define T1_FIELD_BOOL( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname, _dict )\n\n#define T1_FIELD_NUM( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname, _dict )\n\n#define T1_FIELD_FIXED( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname, _dict )\n\n#define T1_FIELD_FIXED_1000( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname, \\\n _dict )\n\n#define T1_FIELD_STRING( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname, _dict )\n\n#define T1_FIELD_KEY( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname, _dict )\n\n#define T1_FIELD_BBOX( _ident, _fname, _dict ) \\\n T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname, _dict )\n\n\n#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax, _dict ) \\\n T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \\\n _fname, _fmax, _dict )\n\n#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax, _dict ) \\\n T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \\\n _fname, _fmax, _dict )\n\n#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax, _dict ) \\\n T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \\\n _fname, _fmax, _dict )\n\n#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax, _dict ) \\\n T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \\\n _fname, _fmax, _dict )\n\n#define T1_FIELD_CALLBACK( _ident, _name, _dict ) \\\n T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1 PARSER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs;\n\n typedef struct PS_Parser_FuncsRec_\n {\n void\n (*init)( PS_Parser parser,\n FT_Byte* base,\n FT_Byte* limit,\n FT_Memory memory );\n\n void\n (*done)( PS_Parser parser );\n\n void\n (*skip_spaces)( PS_Parser parser );\n void\n (*skip_PS_token)( PS_Parser parser );\n\n FT_Long\n (*to_int)( PS_Parser parser );\n FT_Fixed\n (*to_fixed)( PS_Parser parser,\n FT_Int power_ten );\n\n FT_Error\n (*to_bytes)( PS_Parser parser,\n FT_Byte* bytes,\n FT_Offset max_bytes,\n FT_ULong* pnum_bytes,\n FT_Bool delimiters );\n\n FT_Int\n (*to_coord_array)( PS_Parser parser,\n FT_Int max_coords,\n FT_Short* coords );\n FT_Int\n (*to_fixed_array)( PS_Parser parser,\n FT_Int max_values,\n FT_Fixed* values,\n FT_Int power_ten );\n\n void\n (*to_token)( PS_Parser parser,\n T1_Token token );\n void\n (*to_token_array)( PS_Parser parser,\n T1_Token tokens,\n FT_UInt max_tokens,\n FT_Int* pnum_tokens );\n\n FT_Error\n (*load_field)( PS_Parser parser,\n const T1_Field field,\n void** objects,\n FT_UInt max_objects,\n FT_ULong* pflags );\n\n FT_Error\n (*load_field_table)( PS_Parser parser,\n const T1_Field field,\n void** objects,\n FT_UInt max_objects,\n FT_ULong* pflags );\n\n } PS_Parser_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_ParserRec\n *\n * @description:\n * A PS_Parser is an object used to parse a Type 1 font very quickly.\n *\n * @fields:\n * cursor ::\n * The current position in the text.\n *\n * base ::\n * Start of the processed text.\n *\n * limit ::\n * End of the processed text.\n *\n * error ::\n * The last error returned.\n *\n * memory ::\n * The object used for memory operations (alloc/realloc).\n *\n * funcs ::\n * A table of functions for the parser.\n */\n typedef struct PS_ParserRec_\n {\n FT_Byte* cursor;\n FT_Byte* base;\n FT_Byte* limit;\n FT_Error error;\n FT_Memory memory;\n\n PS_Parser_FuncsRec funcs;\n\n } PS_ParserRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PS BUILDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct PS_Builder_ PS_Builder;\n typedef const struct PS_Builder_FuncsRec_* PS_Builder_Funcs;\n\n typedef struct PS_Builder_FuncsRec_\n {\n void\n (*init)( PS_Builder* ps_builder,\n void* builder,\n FT_Bool is_t1 );\n\n void\n (*done)( PS_Builder* builder );\n\n } PS_Builder_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * PS_Builder\n *\n * @description:\n * A structure used during glyph loading to store its outline.\n *\n * @fields:\n * memory ::\n * The current memory object.\n *\n * face ::\n * The current face object.\n *\n * glyph ::\n * The current glyph slot.\n *\n * loader ::\n * XXX\n *\n * base ::\n * The base glyph outline.\n *\n * current ::\n * The current glyph outline.\n *\n * pos_x ::\n * The horizontal translation (if composite glyph).\n *\n * pos_y ::\n * The vertical translation (if composite glyph).\n *\n * left_bearing ::\n * The left side bearing point.\n *\n * advance ::\n * The horizontal advance vector.\n *\n * bbox ::\n * Unused.\n *\n * path_begun ::\n * A flag which indicates that a new path has begun.\n *\n * load_points ::\n * If this flag is not set, no points are loaded.\n *\n * no_recurse ::\n * Set but not used.\n *\n * metrics_only ::\n * A boolean indicating that we only want to compute the metrics of a\n * given glyph, not load all of its points.\n *\n * is_t1 ::\n * Set if current font type is Type 1.\n *\n * funcs ::\n * An array of function pointers for the builder.\n */\n struct PS_Builder_\n {\n FT_Memory memory;\n FT_Face face;\n CFF_GlyphSlot glyph;\n FT_GlyphLoader loader;\n FT_Outline* base;\n FT_Outline* current;\n\n FT_Pos* pos_x;\n FT_Pos* pos_y;\n\n FT_Vector* left_bearing;\n FT_Vector* advance;\n\n FT_BBox* bbox; /* bounding box */\n FT_Bool path_begun;\n FT_Bool load_points;\n FT_Bool no_recurse;\n\n FT_Bool metrics_only;\n FT_Bool is_t1;\n\n PS_Builder_FuncsRec funcs;\n\n };\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PS DECODER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n#define PS_MAX_OPERANDS 48\n#define PS_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */\n /* only 10 are allowed but there exist */\n /* fonts like `HiraKakuProN-W3.ttf' */\n /* (Hiragino Kaku Gothic ProN W3; */\n /* 8.2d6e1; 2014-12-19) that exceed */\n /* this limit */\n\n /* execution context charstring zone */\n\n typedef struct PS_Decoder_Zone_\n {\n FT_Byte* base;\n FT_Byte* limit;\n FT_Byte* cursor;\n\n } PS_Decoder_Zone;\n\n\n typedef FT_Error\n (*CFF_Decoder_Get_Glyph_Callback)( TT_Face face,\n FT_UInt glyph_index,\n FT_Byte** pointer,\n FT_ULong* length );\n\n typedef void\n (*CFF_Decoder_Free_Glyph_Callback)( TT_Face face,\n FT_Byte** pointer,\n FT_ULong length );\n\n\n typedef struct PS_Decoder_\n {\n PS_Builder builder;\n\n FT_Fixed stack[PS_MAX_OPERANDS + 1];\n FT_Fixed* top;\n\n PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1];\n PS_Decoder_Zone* zone;\n\n FT_Int flex_state;\n FT_Int num_flex_vectors;\n FT_Vector flex_vectors[7];\n\n CFF_Font cff;\n CFF_SubFont current_subfont; /* for current glyph_index */\n FT_Generic* cf2_instance;\n\n FT_Pos* glyph_width;\n FT_Bool width_only;\n FT_Int num_hints;\n\n FT_UInt num_locals;\n FT_UInt num_globals;\n\n FT_Int locals_bias;\n FT_Int globals_bias;\n\n FT_Byte** locals;\n FT_Byte** globals;\n\n FT_Byte** glyph_names; /* for pure CFF fonts only */\n FT_UInt num_glyphs; /* number of glyphs in font */\n\n FT_Render_Mode hint_mode;\n\n FT_Bool seac;\n\n CFF_Decoder_Get_Glyph_Callback get_glyph_callback;\n CFF_Decoder_Free_Glyph_Callback free_glyph_callback;\n\n /* Type 1 stuff */\n FT_Service_PsCMaps psnames; /* for seac */\n\n FT_Int lenIV; /* internal for sub routine calls */\n FT_UInt* locals_len; /* array of subrs length (optional) */\n FT_Hash locals_hash; /* used if `num_subrs' was massaged */\n\n FT_Matrix font_matrix;\n FT_Vector font_offset;\n\n PS_Blend blend; /* for multiple master support */\n\n FT_Long* buildchar;\n FT_UInt len_buildchar;\n\n } PS_Decoder;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1 BUILDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct T1_BuilderRec_* T1_Builder;\n\n\n typedef FT_Error\n (*T1_Builder_Check_Points_Func)( T1_Builder builder,\n FT_Int count );\n\n typedef void\n (*T1_Builder_Add_Point_Func)( T1_Builder builder,\n FT_Pos x,\n FT_Pos y,\n FT_Byte flag );\n\n typedef FT_Error\n (*T1_Builder_Add_Point1_Func)( T1_Builder builder,\n FT_Pos x,\n FT_Pos y );\n\n typedef FT_Error\n (*T1_Builder_Add_Contour_Func)( T1_Builder builder );\n\n typedef FT_Error\n (*T1_Builder_Start_Point_Func)( T1_Builder builder,\n FT_Pos x,\n FT_Pos y );\n\n typedef void\n (*T1_Builder_Close_Contour_Func)( T1_Builder builder );\n\n\n typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs;\n\n typedef struct T1_Builder_FuncsRec_\n {\n void\n (*init)( T1_Builder builder,\n FT_Face face,\n FT_Size size,\n FT_GlyphSlot slot,\n FT_Bool hinting );\n\n void\n (*done)( T1_Builder builder );\n\n T1_Builder_Check_Points_Func check_points;\n T1_Builder_Add_Point_Func add_point;\n T1_Builder_Add_Point1_Func add_point1;\n T1_Builder_Add_Contour_Func add_contour;\n T1_Builder_Start_Point_Func start_point;\n T1_Builder_Close_Contour_Func close_contour;\n\n } T1_Builder_FuncsRec;\n\n\n /* an enumeration type to handle charstring parsing states */\n typedef enum T1_ParseState_\n {\n T1_Parse_Start,\n T1_Parse_Have_Width,\n T1_Parse_Have_Moveto,\n T1_Parse_Have_Path\n\n } T1_ParseState;\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_BuilderRec\n *\n * @description:\n * A structure used during glyph loading to store its outline.\n *\n * @fields:\n * memory ::\n * The current memory object.\n *\n * face ::\n * The current face object.\n *\n * glyph ::\n * The current glyph slot.\n *\n * loader ::\n * XXX\n *\n * base ::\n * The base glyph outline.\n *\n * current ::\n * The current glyph outline.\n *\n * max_points ::\n * maximum points in builder outline\n *\n * max_contours ::\n * Maximum number of contours in builder outline.\n *\n * pos_x ::\n * The horizontal translation (if composite glyph).\n *\n * pos_y ::\n * The vertical translation (if composite glyph).\n *\n * left_bearing ::\n * The left side bearing point.\n *\n * advance ::\n * The horizontal advance vector.\n *\n * bbox ::\n * Unused.\n *\n * parse_state ::\n * An enumeration which controls the charstring parsing state.\n *\n * load_points ::\n * If this flag is not set, no points are loaded.\n *\n * no_recurse ::\n * Set but not used.\n *\n * metrics_only ::\n * A boolean indicating that we only want to compute the metrics of a\n * given glyph, not load all of its points.\n *\n * funcs ::\n * An array of function pointers for the builder.\n */\n typedef struct T1_BuilderRec_\n {\n FT_Memory memory;\n FT_Face face;\n FT_GlyphSlot glyph;\n FT_GlyphLoader loader;\n FT_Outline* base;\n FT_Outline* current;\n\n FT_Pos pos_x;\n FT_Pos pos_y;\n\n FT_Vector left_bearing;\n FT_Vector advance;\n\n FT_BBox bbox; /* bounding box */\n T1_ParseState parse_state;\n FT_Bool load_points;\n FT_Bool no_recurse;\n\n FT_Bool metrics_only;\n\n void* hints_funcs; /* hinter-specific */\n void* hints_globals; /* hinter-specific */\n\n T1_Builder_FuncsRec funcs;\n\n } T1_BuilderRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** T1 DECODER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n#if 0\n\n /**************************************************************************\n *\n * T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine\n * calls during glyph loading.\n */\n#define T1_MAX_SUBRS_CALLS 8\n\n\n /**************************************************************************\n *\n * T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A\n * minimum of 16 is required.\n */\n#define T1_MAX_CHARSTRINGS_OPERANDS 32\n\n#endif /* 0 */\n\n\n typedef struct T1_Decoder_ZoneRec_\n {\n FT_Byte* cursor;\n FT_Byte* base;\n FT_Byte* limit;\n\n } T1_Decoder_ZoneRec, *T1_Decoder_Zone;\n\n\n typedef struct T1_DecoderRec_* T1_Decoder;\n typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs;\n\n\n typedef FT_Error\n (*T1_Decoder_Callback)( T1_Decoder decoder,\n FT_UInt glyph_index );\n\n\n typedef struct T1_Decoder_FuncsRec_\n {\n FT_Error\n (*init)( T1_Decoder decoder,\n FT_Face face,\n FT_Size size,\n FT_GlyphSlot slot,\n FT_Byte** glyph_names,\n PS_Blend blend,\n FT_Bool hinting,\n FT_Render_Mode hint_mode,\n T1_Decoder_Callback callback );\n\n void\n (*done)( T1_Decoder decoder );\n\n#ifdef T1_CONFIG_OPTION_OLD_ENGINE\n FT_Error\n (*parse_charstrings_old)( T1_Decoder decoder,\n FT_Byte* base,\n FT_UInt len );\n#else\n FT_Error\n (*parse_metrics)( T1_Decoder decoder,\n FT_Byte* base,\n FT_UInt len );\n#endif\n\n FT_Error\n (*parse_charstrings)( PS_Decoder* decoder,\n FT_Byte* charstring_base,\n FT_ULong charstring_len );\n\n\n } T1_Decoder_FuncsRec;\n\n\n typedef struct T1_DecoderRec_\n {\n T1_BuilderRec builder;\n\n FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];\n FT_Long* top;\n\n T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];\n T1_Decoder_Zone zone;\n\n FT_Service_PsCMaps psnames; /* for seac */\n FT_UInt num_glyphs;\n FT_Byte** glyph_names;\n\n FT_Int lenIV; /* internal for sub routine calls */\n FT_Int num_subrs;\n FT_Byte** subrs;\n FT_UInt* subrs_len; /* array of subrs length (optional) */\n FT_Hash subrs_hash; /* used if `num_subrs' was massaged */\n\n FT_Matrix font_matrix;\n FT_Vector font_offset;\n\n FT_Int flex_state;\n FT_Int num_flex_vectors;\n FT_Vector flex_vectors[7];\n\n PS_Blend blend; /* for multiple master support */\n\n FT_Render_Mode hint_mode;\n\n T1_Decoder_Callback parse_callback;\n T1_Decoder_FuncsRec funcs;\n\n FT_Long* buildchar;\n FT_UInt len_buildchar;\n\n FT_Bool seac;\n\n FT_Generic cf2_instance;\n\n } T1_DecoderRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** CFF BUILDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct CFF_Builder_ CFF_Builder;\n\n\n typedef FT_Error\n (*CFF_Builder_Check_Points_Func)( CFF_Builder* builder,\n FT_Int count );\n\n typedef void\n (*CFF_Builder_Add_Point_Func)( CFF_Builder* builder,\n FT_Pos x,\n FT_Pos y,\n FT_Byte flag );\n typedef FT_Error\n (*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder,\n FT_Pos x,\n FT_Pos y );\n typedef FT_Error\n (*CFF_Builder_Start_Point_Func)( CFF_Builder* builder,\n FT_Pos x,\n FT_Pos y );\n typedef void\n (*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder );\n\n typedef FT_Error\n (*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder );\n\n typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs;\n\n typedef struct CFF_Builder_FuncsRec_\n {\n void\n (*init)( CFF_Builder* builder,\n TT_Face face,\n CFF_Size size,\n CFF_GlyphSlot glyph,\n FT_Bool hinting );\n\n void\n (*done)( CFF_Builder* builder );\n\n CFF_Builder_Check_Points_Func check_points;\n CFF_Builder_Add_Point_Func add_point;\n CFF_Builder_Add_Point1_Func add_point1;\n CFF_Builder_Add_Contour_Func add_contour;\n CFF_Builder_Start_Point_Func start_point;\n CFF_Builder_Close_Contour_Func close_contour;\n\n } CFF_Builder_FuncsRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * CFF_Builder\n *\n * @description:\n * A structure used during glyph loading to store its outline.\n *\n * @fields:\n * memory ::\n * The current memory object.\n *\n * face ::\n * The current face object.\n *\n * glyph ::\n * The current glyph slot.\n *\n * loader ::\n * The current glyph loader.\n *\n * base ::\n * The base glyph outline.\n *\n * current ::\n * The current glyph outline.\n *\n * pos_x ::\n * The horizontal translation (if composite glyph).\n *\n * pos_y ::\n * The vertical translation (if composite glyph).\n *\n * left_bearing ::\n * The left side bearing point.\n *\n * advance ::\n * The horizontal advance vector.\n *\n * bbox ::\n * Unused.\n *\n * path_begun ::\n * A flag which indicates that a new path has begun.\n *\n * load_points ::\n * If this flag is not set, no points are loaded.\n *\n * no_recurse ::\n * Set but not used.\n *\n * metrics_only ::\n * A boolean indicating that we only want to compute the metrics of a\n * given glyph, not load all of its points.\n *\n * hints_funcs ::\n * Auxiliary pointer for hinting.\n *\n * hints_globals ::\n * Auxiliary pointer for hinting.\n *\n * funcs ::\n * A table of method pointers for this object.\n */\n struct CFF_Builder_\n {\n FT_Memory memory;\n TT_Face face;\n CFF_GlyphSlot glyph;\n FT_GlyphLoader loader;\n FT_Outline* base;\n FT_Outline* current;\n\n FT_Pos pos_x;\n FT_Pos pos_y;\n\n FT_Vector left_bearing;\n FT_Vector advance;\n\n FT_BBox bbox; /* bounding box */\n\n FT_Bool path_begun;\n FT_Bool load_points;\n FT_Bool no_recurse;\n\n FT_Bool metrics_only;\n\n void* hints_funcs; /* hinter-specific */\n void* hints_globals; /* hinter-specific */\n\n CFF_Builder_FuncsRec funcs;\n };\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** CFF DECODER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n\n#define CFF_MAX_OPERANDS 48\n#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */\n /* only 10 are allowed but there exist */\n /* fonts like `HiraKakuProN-W3.ttf' */\n /* (Hiragino Kaku Gothic ProN W3; */\n /* 8.2d6e1; 2014-12-19) that exceed */\n /* this limit */\n#define CFF_MAX_TRANS_ELEMENTS 32\n\n /* execution context charstring zone */\n\n typedef struct CFF_Decoder_Zone_\n {\n FT_Byte* base;\n FT_Byte* limit;\n FT_Byte* cursor;\n\n } CFF_Decoder_Zone;\n\n\n typedef struct CFF_Decoder_\n {\n CFF_Builder builder;\n CFF_Font cff;\n\n FT_Fixed stack[CFF_MAX_OPERANDS + 1];\n FT_Fixed* top;\n\n CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];\n CFF_Decoder_Zone* zone;\n\n FT_Int flex_state;\n FT_Int num_flex_vectors;\n FT_Vector flex_vectors[7];\n\n FT_Pos glyph_width;\n FT_Pos nominal_width;\n\n FT_Bool read_width;\n FT_Bool width_only;\n FT_Int num_hints;\n FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];\n\n FT_UInt num_locals;\n FT_UInt num_globals;\n\n FT_Int locals_bias;\n FT_Int globals_bias;\n\n FT_Byte** locals;\n FT_Byte** globals;\n\n FT_Byte** glyph_names; /* for pure CFF fonts only */\n FT_UInt num_glyphs; /* number of glyphs in font */\n\n FT_Render_Mode hint_mode;\n\n FT_Bool seac;\n\n CFF_SubFont current_subfont; /* for current glyph_index */\n\n CFF_Decoder_Get_Glyph_Callback get_glyph_callback;\n CFF_Decoder_Free_Glyph_Callback free_glyph_callback;\n\n } CFF_Decoder;\n\n\n typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs;\n\n typedef struct CFF_Decoder_FuncsRec_\n {\n void\n (*init)( CFF_Decoder* decoder,\n TT_Face face,\n CFF_Size size,\n CFF_GlyphSlot slot,\n FT_Bool hinting,\n FT_Render_Mode hint_mode,\n CFF_Decoder_Get_Glyph_Callback get_callback,\n CFF_Decoder_Free_Glyph_Callback free_callback );\n\n FT_Error\n (*prepare)( CFF_Decoder* decoder,\n CFF_Size size,\n FT_UInt glyph_index );\n\n#ifdef CFF_CONFIG_OPTION_OLD_ENGINE\n FT_Error\n (*parse_charstrings_old)( CFF_Decoder* decoder,\n FT_Byte* charstring_base,\n FT_ULong charstring_len,\n FT_Bool in_dict );\n#endif\n\n FT_Error\n (*parse_charstrings)( PS_Decoder* decoder,\n FT_Byte* charstring_base,\n FT_ULong charstring_len );\n\n } CFF_Decoder_FuncsRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** AFM PARSER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct AFM_ParserRec_* AFM_Parser;\n\n typedef struct AFM_Parser_FuncsRec_\n {\n FT_Error\n (*init)( AFM_Parser parser,\n FT_Memory memory,\n FT_Byte* base,\n FT_Byte* limit );\n\n void\n (*done)( AFM_Parser parser );\n\n FT_Error\n (*parse)( AFM_Parser parser );\n\n } AFM_Parser_FuncsRec;\n\n\n typedef struct AFM_StreamRec_* AFM_Stream;\n\n\n /**************************************************************************\n *\n * @struct:\n * AFM_ParserRec\n *\n * @description:\n * An AFM_Parser is a parser for the AFM files.\n *\n * @fields:\n * memory ::\n * The object used for memory operations (alloc and realloc).\n *\n * stream ::\n * This is an opaque object.\n *\n * FontInfo ::\n * The result will be stored here.\n *\n * get_index ::\n * A user provided function to get a glyph index by its name.\n */\n typedef struct AFM_ParserRec_\n {\n FT_Memory memory;\n AFM_Stream stream;\n\n AFM_FontInfo FontInfo;\n\n FT_Int\n (*get_index)( const char* name,\n FT_Offset len,\n void* user_data );\n\n void* user_data;\n\n } AFM_ParserRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** TYPE1 CHARMAPS *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes;\n\n typedef struct T1_CMap_ClassesRec_\n {\n FT_CMap_Class standard;\n FT_CMap_Class expert;\n FT_CMap_Class custom;\n FT_CMap_Class unicode;\n\n } T1_CMap_ClassesRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PSAux Module Interface *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct PSAux_ServiceRec_\n {\n /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */\n const PS_Table_FuncsRec* ps_table_funcs;\n const PS_Parser_FuncsRec* ps_parser_funcs;\n const T1_Builder_FuncsRec* t1_builder_funcs;\n const T1_Decoder_FuncsRec* t1_decoder_funcs;\n\n void\n (*t1_decrypt)( FT_Byte* buffer,\n FT_Offset length,\n FT_UShort seed );\n\n FT_UInt32\n (*cff_random)( FT_UInt32 r );\n\n void\n (*ps_decoder_init)( PS_Decoder* ps_decoder,\n void* decoder,\n FT_Bool is_t1 );\n\n void\n (*t1_make_subfont)( FT_Face face,\n PS_Private priv,\n CFF_SubFont subfont );\n\n T1_CMap_Classes t1_cmap_classes;\n\n /* fields after this comment line were added after version 2.1.10 */\n const AFM_Parser_FuncsRec* afm_parser_funcs;\n\n const CFF_Decoder_FuncsRec* cff_decoder_funcs;\n\n } PSAux_ServiceRec, *PSAux_Service;\n\n /* backward compatible type definition */\n typedef PSAux_ServiceRec PSAux_Interface;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** Some convenience functions *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n#define IS_PS_NEWLINE( ch ) \\\n ( (ch) == '\\r' || \\\n (ch) == '\\n' )\n\n#define IS_PS_SPACE( ch ) \\\n ( (ch) == ' ' || \\\n IS_PS_NEWLINE( ch ) || \\\n (ch) == '\\t' || \\\n (ch) == '\\f' || \\\n (ch) == '\\0' )\n\n#define IS_PS_SPECIAL( ch ) \\\n ( (ch) == '/' || \\\n (ch) == '(' || (ch) == ')' || \\\n (ch) == '<' || (ch) == '>' || \\\n (ch) == '[' || (ch) == ']' || \\\n (ch) == '{' || (ch) == '}' || \\\n (ch) == '%' )\n\n#define IS_PS_DELIM( ch ) \\\n ( IS_PS_SPACE( ch ) || \\\n IS_PS_SPECIAL( ch ) )\n\n#define IS_PS_DIGIT( ch ) \\\n ( (ch) >= '0' && (ch) <= '9' )\n\n#define IS_PS_XDIGIT( ch ) \\\n ( IS_PS_DIGIT( ch ) || \\\n ( (ch) >= 'A' && (ch) <= 'F' ) || \\\n ( (ch) >= 'a' && (ch) <= 'f' ) )\n\n#define IS_PS_BASE85( ch ) \\\n ( (ch) >= '!' && (ch) <= 'u' )\n\n#define IS_PS_TOKEN( cur, limit, token ) \\\n ( (char)(cur)[0] == (token)[0] && \\\n ( (cur) + sizeof ( (token) ) == (limit) || \\\n ( (cur) + sizeof( (token) ) < (limit) && \\\n IS_PS_DELIM( (cur)[sizeof ( (token) ) - 1] ) ) ) && \\\n ft_strncmp( (char*)(cur), (token), sizeof ( (token) ) - 1 ) == 0 )\n\n\nFT_END_HEADER\n\n#endif /* PSAUX_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/pshints.h", "language": "code", "loc": 632, "comment_density": 0.821, "code": "/****************************************************************************\n *\n * pshints.h\n *\n * Interface to Postscript-specific (Type 1 and Type 2) hints\n * recorders (specification only). These are used to support native\n * T1/T2 hints in the 'type1', 'cid', and 'cff' font drivers.\n *\n * Copyright (C) 2001-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef PSHINTS_H_\n#define PSHINTS_H_\n\n\n#include \n#include FT_FREETYPE_H\n#include FT_TYPE1_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** INTERNAL REPRESENTATION OF GLOBALS *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct PSH_GlobalsRec_* PSH_Globals;\n\n typedef FT_Error\n (*PSH_Globals_NewFunc)( FT_Memory memory,\n T1_Private* private_dict,\n PSH_Globals* aglobals );\n\n typedef void\n (*PSH_Globals_SetScaleFunc)( PSH_Globals globals,\n FT_Fixed x_scale,\n FT_Fixed y_scale,\n FT_Fixed x_delta,\n FT_Fixed y_delta );\n\n typedef void\n (*PSH_Globals_DestroyFunc)( PSH_Globals globals );\n\n\n typedef struct PSH_Globals_FuncsRec_\n {\n PSH_Globals_NewFunc create;\n PSH_Globals_SetScaleFunc set_scale;\n PSH_Globals_DestroyFunc destroy;\n\n } PSH_Globals_FuncsRec, *PSH_Globals_Funcs;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PUBLIC TYPE 1 HINTS RECORDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n /**************************************************************************\n *\n * @type:\n * T1_Hints\n *\n * @description:\n * This is a handle to an opaque structure used to record glyph hints\n * from a Type 1 character glyph character string.\n *\n * The methods used to operate on this object are defined by the\n * @T1_Hints_FuncsRec structure. Recording glyph hints is normally\n * achieved through the following scheme:\n *\n * - Open a new hint recording session by calling the 'open' method.\n * This rewinds the recorder and prepare it for new input.\n *\n * - For each hint found in the glyph charstring, call the corresponding\n * method ('stem', 'stem3', or 'reset'). Note that these functions do\n * not return an error code.\n *\n * - Close the recording session by calling the 'close' method. It\n * returns an error code if the hints were invalid or something strange\n * happened (e.g., memory shortage).\n *\n * The hints accumulated in the object can later be used by the\n * PostScript hinter.\n *\n */\n typedef struct T1_HintsRec_* T1_Hints;\n\n\n /**************************************************************************\n *\n * @type:\n * T1_Hints_Funcs\n *\n * @description:\n * A pointer to the @T1_Hints_FuncsRec structure that defines the API of\n * a given @T1_Hints object.\n *\n */\n typedef const struct T1_Hints_FuncsRec_* T1_Hints_Funcs;\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_OpenFunc\n *\n * @description:\n * A method of the @T1_Hints class used to prepare it for a new Type 1\n * hints recording session.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * @note:\n * You should always call the @T1_Hints_CloseFunc method in order to\n * close an opened recording session.\n *\n */\n typedef void\n (*T1_Hints_OpenFunc)( T1_Hints hints );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_SetStemFunc\n *\n * @description:\n * A method of the @T1_Hints class used to record a new horizontal or\n * vertical stem. This corresponds to the Type 1 'hstem' and 'vstem'\n * operators.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * dimension ::\n * 0 for horizontal stems (hstem), 1 for vertical ones (vstem).\n *\n * coords ::\n * Array of 2 coordinates in 16.16 format, used as (position,length)\n * stem descriptor.\n *\n * @note:\n * Use vertical coordinates (y) for horizontal stems (dim=0). Use\n * horizontal coordinates (x) for vertical stems (dim=1).\n *\n * 'coords[0]' is the absolute stem position (lowest coordinate);\n * 'coords[1]' is the length.\n *\n * The length can be negative, in which case it must be either -20 or\n * -21. It is interpreted as a 'ghost' stem, according to the Type 1\n * specification.\n *\n * If the length is -21 (corresponding to a bottom ghost stem), then the\n * real stem position is 'coords[0]+coords[1]'.\n *\n */\n typedef void\n (*T1_Hints_SetStemFunc)( T1_Hints hints,\n FT_UInt dimension,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_SetStem3Func\n *\n * @description:\n * A method of the @T1_Hints class used to record three\n * counter-controlled horizontal or vertical stems at once.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * dimension ::\n * 0 for horizontal stems, 1 for vertical ones.\n *\n * coords ::\n * An array of 6 values in 16.16 format, holding 3 (position,length)\n * pairs for the counter-controlled stems.\n *\n * @note:\n * Use vertical coordinates (y) for horizontal stems (dim=0). Use\n * horizontal coordinates (x) for vertical stems (dim=1).\n *\n * The lengths cannot be negative (ghost stems are never\n * counter-controlled).\n *\n */\n typedef void\n (*T1_Hints_SetStem3Func)( T1_Hints hints,\n FT_UInt dimension,\n FT_Fixed* coords );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_ResetFunc\n *\n * @description:\n * A method of the @T1_Hints class used to reset the stems hints in a\n * recording session.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * end_point ::\n * The index of the last point in the input glyph in which the\n * previously defined hints apply.\n *\n */\n typedef void\n (*T1_Hints_ResetFunc)( T1_Hints hints,\n FT_UInt end_point );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_CloseFunc\n *\n * @description:\n * A method of the @T1_Hints class used to close a hint recording\n * session.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * end_point ::\n * The index of the last point in the input glyph.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The error code is set to indicate that an error occurred during the\n * recording session.\n *\n */\n typedef FT_Error\n (*T1_Hints_CloseFunc)( T1_Hints hints,\n FT_UInt end_point );\n\n\n /**************************************************************************\n *\n * @functype:\n * T1_Hints_ApplyFunc\n *\n * @description:\n * A method of the @T1_Hints class used to apply hints to the\n * corresponding glyph outline. Must be called once all hints have been\n * recorded.\n *\n * @input:\n * hints ::\n * A handle to the Type 1 hints recorder.\n *\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * globals ::\n * The hinter globals for this font.\n *\n * hint_mode ::\n * Hinting information.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * On input, all points within the outline are in font coordinates. On\n * output, they are in 1/64th of pixels.\n *\n * The scaling transformation is taken from the 'globals' object which\n * must correspond to the same font as the glyph.\n *\n */\n typedef FT_Error\n (*T1_Hints_ApplyFunc)( T1_Hints hints,\n FT_Outline* outline,\n PSH_Globals globals,\n FT_Render_Mode hint_mode );\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_Hints_FuncsRec\n *\n * @description:\n * The structure used to provide the API to @T1_Hints objects.\n *\n * @fields:\n * hints ::\n * A handle to the T1 Hints recorder.\n *\n * open ::\n * The function to open a recording session.\n *\n * close ::\n * The function to close a recording session.\n *\n * stem ::\n * The function to set a simple stem.\n *\n * stem3 ::\n * The function to set counter-controlled stems.\n *\n * reset ::\n * The function to reset stem hints.\n *\n * apply ::\n * The function to apply the hints to the corresponding glyph outline.\n *\n */\n typedef struct T1_Hints_FuncsRec_\n {\n T1_Hints hints;\n T1_Hints_OpenFunc open;\n T1_Hints_CloseFunc close;\n T1_Hints_SetStemFunc stem;\n T1_Hints_SetStem3Func stem3;\n T1_Hints_ResetFunc reset;\n T1_Hints_ApplyFunc apply;\n\n } T1_Hints_FuncsRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /***** *****/\n /***** PUBLIC TYPE 2 HINTS RECORDER *****/\n /***** *****/\n /*************************************************************************/\n /*************************************************************************/\n\n /**************************************************************************\n *\n * @type:\n * T2_Hints\n *\n * @description:\n * This is a handle to an opaque structure used to record glyph hints\n * from a Type 2 character glyph character string.\n *\n * The methods used to operate on this object are defined by the\n * @T2_Hints_FuncsRec structure. Recording glyph hints is normally\n * achieved through the following scheme:\n *\n * - Open a new hint recording session by calling the 'open' method.\n * This rewinds the recorder and prepare it for new input.\n *\n * - For each hint found in the glyph charstring, call the corresponding\n * method ('stems', 'hintmask', 'counters'). Note that these functions\n * do not return an error code.\n *\n * - Close the recording session by calling the 'close' method. It\n * returns an error code if the hints were invalid or something strange\n * happened (e.g., memory shortage).\n *\n * The hints accumulated in the object can later be used by the\n * Postscript hinter.\n *\n */\n typedef struct T2_HintsRec_* T2_Hints;\n\n\n /**************************************************************************\n *\n * @type:\n * T2_Hints_Funcs\n *\n * @description:\n * A pointer to the @T2_Hints_FuncsRec structure that defines the API of\n * a given @T2_Hints object.\n *\n */\n typedef const struct T2_Hints_FuncsRec_* T2_Hints_Funcs;\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_OpenFunc\n *\n * @description:\n * A method of the @T2_Hints class used to prepare it for a new Type 2\n * hints recording session.\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * @note:\n * You should always call the @T2_Hints_CloseFunc method in order to\n * close an opened recording session.\n *\n */\n typedef void\n (*T2_Hints_OpenFunc)( T2_Hints hints );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_StemsFunc\n *\n * @description:\n * A method of the @T2_Hints class used to set the table of stems in\n * either the vertical or horizontal dimension. Equivalent to the\n * 'hstem', 'vstem', 'hstemhm', and 'vstemhm' Type 2 operators.\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * dimension ::\n * 0 for horizontal stems (hstem), 1 for vertical ones (vstem).\n *\n * count ::\n * The number of stems.\n *\n * coords ::\n * An array of 'count' (position,length) pairs in 16.16 format.\n *\n * @note:\n * Use vertical coordinates (y) for horizontal stems (dim=0). Use\n * horizontal coordinates (x) for vertical stems (dim=1).\n *\n * There are '2*count' elements in the 'coords' array. Each even element\n * is an absolute position in font units, each odd element is a length in\n * font units.\n *\n * A length can be negative, in which case it must be either -20 or -21.\n * It is interpreted as a 'ghost' stem, according to the Type 1\n * specification.\n *\n */\n typedef void\n (*T2_Hints_StemsFunc)( T2_Hints hints,\n FT_UInt dimension,\n FT_Int count,\n FT_Fixed* coordinates );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_MaskFunc\n *\n * @description:\n * A method of the @T2_Hints class used to set a given hintmask (this\n * corresponds to the 'hintmask' Type 2 operator).\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * end_point ::\n * The glyph index of the last point to which the previously defined or\n * activated hints apply.\n *\n * bit_count ::\n * The number of bits in the hint mask.\n *\n * bytes ::\n * An array of bytes modelling the hint mask.\n *\n * @note:\n * If the hintmask starts the charstring (before any glyph point\n * definition), the value of `end_point` should be 0.\n *\n * `bit_count` is the number of meaningful bits in the 'bytes' array; it\n * must be equal to the total number of hints defined so far (i.e.,\n * horizontal+verticals).\n *\n * The 'bytes' array can come directly from the Type 2 charstring and\n * respects the same format.\n *\n */\n typedef void\n (*T2_Hints_MaskFunc)( T2_Hints hints,\n FT_UInt end_point,\n FT_UInt bit_count,\n const FT_Byte* bytes );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_CounterFunc\n *\n * @description:\n * A method of the @T2_Hints class used to set a given counter mask (this\n * corresponds to the 'hintmask' Type 2 operator).\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * end_point ::\n * A glyph index of the last point to which the previously defined or\n * active hints apply.\n *\n * bit_count ::\n * The number of bits in the hint mask.\n *\n * bytes ::\n * An array of bytes modelling the hint mask.\n *\n * @note:\n * If the hintmask starts the charstring (before any glyph point\n * definition), the value of `end_point` should be 0.\n *\n * `bit_count` is the number of meaningful bits in the 'bytes' array; it\n * must be equal to the total number of hints defined so far (i.e.,\n * horizontal+verticals).\n *\n * The 'bytes' array can come directly from the Type 2 charstring and\n * respects the same format.\n *\n */\n typedef void\n (*T2_Hints_CounterFunc)( T2_Hints hints,\n FT_UInt bit_count,\n const FT_Byte* bytes );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_CloseFunc\n *\n * @description:\n * A method of the @T2_Hints class used to close a hint recording\n * session.\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * end_point ::\n * The index of the last point in the input glyph.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The error code is set to indicate that an error occurred during the\n * recording session.\n *\n */\n typedef FT_Error\n (*T2_Hints_CloseFunc)( T2_Hints hints,\n FT_UInt end_point );\n\n\n /**************************************************************************\n *\n * @functype:\n * T2_Hints_ApplyFunc\n *\n * @description:\n * A method of the @T2_Hints class used to apply hints to the\n * corresponding glyph outline. Must be called after the 'close' method.\n *\n * @input:\n * hints ::\n * A handle to the Type 2 hints recorder.\n *\n * outline ::\n * A pointer to the target outline descriptor.\n *\n * globals ::\n * The hinter globals for this font.\n *\n * hint_mode ::\n * Hinting information.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * On input, all points within the outline are in font coordinates. On\n * output, they are in 1/64th of pixels.\n *\n * The scaling transformation is taken from the 'globals' object which\n * must correspond to the same font than the glyph.\n *\n */\n typedef FT_Error\n (*T2_Hints_ApplyFunc)( T2_Hints hints,\n FT_Outline* outline,\n PSH_Globals globals,\n FT_Render_Mode hint_mode );\n\n\n /**************************************************************************\n *\n * @struct:\n * T2_Hints_FuncsRec\n *\n * @description:\n * The structure used to provide the API to @T2_Hints objects.\n *\n * @fields:\n * hints ::\n * A handle to the T2 hints recorder object.\n *\n * open ::\n * The function to open a recording session.\n *\n * close ::\n * The function to close a recording session.\n *\n * stems ::\n * The function to set the dimension's stems table.\n *\n * hintmask ::\n * The function to set hint masks.\n *\n * counter ::\n * The function to set counter masks.\n *\n * apply ::\n * The function to apply the hints on the corresponding glyph outline.\n *\n */\n typedef struct T2_Hints_FuncsRec_\n {\n T2_Hints hints;\n T2_Hints_OpenFunc open;\n T2_Hints_CloseFunc close;\n T2_Hints_StemsFunc stems;\n T2_Hints_MaskFunc hintmask;\n T2_Hints_CounterFunc counter;\n T2_Hints_ApplyFunc apply;\n\n } T2_Hints_FuncsRec;\n\n\n /* */\n\n\n typedef struct PSHinter_Interface_\n {\n PSH_Globals_Funcs (*get_globals_funcs)( FT_Module module );\n T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module );\n T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module );\n\n } PSHinter_Interface;\n\n typedef PSHinter_Interface* PSHinter_Service;\n\n\n#define FT_DEFINE_PSHINTER_INTERFACE( \\\n class_, \\\n get_globals_funcs_, \\\n get_t1_funcs_, \\\n get_t2_funcs_ ) \\\n static const PSHinter_Interface class_ = \\\n { \\\n get_globals_funcs_, \\\n get_t1_funcs_, \\\n get_t2_funcs_ \\\n };\n\n\nFT_END_HEADER\n\n#endif /* PSHINTS_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/sfnt.h", "language": "code", "loc": 800, "comment_density": 0.72, "code": "/****************************************************************************\n *\n * sfnt.h\n *\n * High-level 'sfnt' driver interface (specification).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SFNT_H_\n#define SFNT_H_\n\n\n#include \n#include FT_INTERNAL_DRIVER_H\n#include FT_INTERNAL_TRUETYPE_TYPES_H\n#include FT_INTERNAL_WOFF_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Init_Face_Func\n *\n * @description:\n * First part of the SFNT face object initialization. This finds the\n * face in a SFNT file or collection, and load its format tag in\n * face->format_tag.\n *\n * @input:\n * stream ::\n * The input stream.\n *\n * face ::\n * A handle to the target face object.\n *\n * face_index ::\n * The index of the TrueType font, if we are opening a collection, in\n * bits 0-15. The numbered instance index~+~1 of a GX (sub)font, if\n * applicable, in bits 16-30.\n *\n * num_params ::\n * The number of additional parameters.\n *\n * params ::\n * Optional additional parameters.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The stream cursor must be at the font file's origin.\n *\n * This function recognizes fonts embedded in a 'TrueType collection'.\n *\n * Once the format tag has been validated by the font driver, it should\n * then call the TT_Load_Face_Func() callback to read the rest of the\n * SFNT tables in the object.\n */\n typedef FT_Error\n (*TT_Init_Face_Func)( FT_Stream stream,\n TT_Face face,\n FT_Int face_index,\n FT_Int num_params,\n FT_Parameter* params );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Face_Func\n *\n * @description:\n * Second part of the SFNT face object initialization. This loads the\n * common SFNT tables (head, OS/2, maxp, metrics, etc.) in the face\n * object.\n *\n * @input:\n * stream ::\n * The input stream.\n *\n * face ::\n * A handle to the target face object.\n *\n * face_index ::\n * The index of the TrueType font, if we are opening a collection, in\n * bits 0-15. The numbered instance index~+~1 of a GX (sub)font, if\n * applicable, in bits 16-30.\n *\n * num_params ::\n * The number of additional parameters.\n *\n * params ::\n * Optional additional parameters.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * This function must be called after TT_Init_Face_Func().\n */\n typedef FT_Error\n (*TT_Load_Face_Func)( FT_Stream stream,\n TT_Face face,\n FT_Int face_index,\n FT_Int num_params,\n FT_Parameter* params );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Done_Face_Func\n *\n * @description:\n * A callback used to delete the common SFNT data from a face.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * @note:\n * This function does NOT destroy the face object.\n */\n typedef void\n (*TT_Done_Face_Func)( TT_Face face );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Any_Func\n *\n * @description:\n * Load any font table into client memory.\n *\n * @input:\n * face ::\n * The face object to look for.\n *\n * tag ::\n * The tag of table to load. Use the value 0 if you want to access the\n * whole font file, else set this parameter to a valid TrueType table\n * tag that you can forge with the MAKE_TT_TAG macro.\n *\n * offset ::\n * The starting offset in the table (or the file if tag == 0).\n *\n * length ::\n * The address of the decision variable:\n *\n * If `length == NULL`: Loads the whole table. Returns an error if\n * 'offset' == 0!\n *\n * If `*length == 0`: Exits immediately; returning the length of the\n * given table or of the font file, depending on the value of 'tag'.\n *\n * If `*length != 0`: Loads the next 'length' bytes of table or font,\n * starting at offset 'offset' (in table or font too).\n *\n * @output:\n * buffer ::\n * The address of target buffer.\n *\n * @return:\n * TrueType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Load_Any_Func)( TT_Face face,\n FT_ULong tag,\n FT_Long offset,\n FT_Byte *buffer,\n FT_ULong* length );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Find_SBit_Image_Func\n *\n * @description:\n * Check whether an embedded bitmap (an 'sbit') exists for a given glyph,\n * at a given strike.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * glyph_index ::\n * The glyph index.\n *\n * strike_index ::\n * The current strike index.\n *\n * @output:\n * arange ::\n * The SBit range containing the glyph index.\n *\n * astrike ::\n * The SBit strike containing the glyph index.\n *\n * aglyph_offset ::\n * The offset of the glyph data in 'EBDT' table.\n *\n * @return:\n * FreeType error code. 0 means success. Returns\n * SFNT_Err_Invalid_Argument if no sbit exists for the requested glyph.\n */\n typedef FT_Error\n (*TT_Find_SBit_Image_Func)( TT_Face face,\n FT_UInt glyph_index,\n FT_ULong strike_index,\n TT_SBit_Range *arange,\n TT_SBit_Strike *astrike,\n FT_ULong *aglyph_offset );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_SBit_Metrics_Func\n *\n * @description:\n * Get the big metrics for a given embedded bitmap.\n *\n * @input:\n * stream ::\n * The input stream.\n *\n * range ::\n * The SBit range containing the glyph.\n *\n * @output:\n * big_metrics ::\n * A big SBit metrics structure for the glyph.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The stream cursor must be positioned at the glyph's offset within the\n * 'EBDT' table before the call.\n *\n * If the image format uses variable metrics, the stream cursor is\n * positioned just after the metrics header in the 'EBDT' table on\n * function exit.\n */\n typedef FT_Error\n (*TT_Load_SBit_Metrics_Func)( FT_Stream stream,\n TT_SBit_Range range,\n TT_SBit_Metrics metrics );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_SBit_Image_Func\n *\n * @description:\n * Load a given glyph sbit image from the font resource. This also\n * returns its metrics.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * strike_index ::\n * The strike index.\n *\n * glyph_index ::\n * The current glyph index.\n *\n * load_flags ::\n * The current load flags.\n *\n * stream ::\n * The input stream.\n *\n * @output:\n * amap ::\n * The target pixmap.\n *\n * ametrics ::\n * A big sbit metrics structure for the glyph image.\n *\n * @return:\n * FreeType error code. 0 means success. Returns an error if no glyph\n * sbit exists for the index.\n *\n * @note:\n * The `map.buffer` field is always freed before the glyph is loaded.\n */\n typedef FT_Error\n (*TT_Load_SBit_Image_Func)( TT_Face face,\n FT_ULong strike_index,\n FT_UInt glyph_index,\n FT_UInt load_flags,\n FT_Stream stream,\n FT_Bitmap *amap,\n TT_SBit_MetricsRec *ametrics );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Set_SBit_Strike_Func\n *\n * @description:\n * Select an sbit strike for a given size request.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * req ::\n * The size request.\n *\n * @output:\n * astrike_index ::\n * The index of the sbit strike.\n *\n * @return:\n * FreeType error code. 0 means success. Returns an error if no sbit\n * strike exists for the selected ppem values.\n */\n typedef FT_Error\n (*TT_Set_SBit_Strike_Func)( TT_Face face,\n FT_Size_Request req,\n FT_ULong* astrike_index );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Strike_Metrics_Func\n *\n * @description:\n * Load the metrics of a given strike.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * strike_index ::\n * The strike index.\n *\n * @output:\n * metrics ::\n * the metrics of the strike.\n *\n * @return:\n * FreeType error code. 0 means success. Returns an error if no such\n * sbit strike exists.\n */\n typedef FT_Error\n (*TT_Load_Strike_Metrics_Func)( TT_Face face,\n FT_ULong strike_index,\n FT_Size_Metrics* metrics );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_PS_Name_Func\n *\n * @description:\n * Get the PostScript glyph name of a glyph.\n *\n * @input:\n * idx ::\n * The glyph index.\n *\n * PSname ::\n * The address of a string pointer. Will be `NULL` in case of error,\n * otherwise it is a pointer to the glyph name.\n *\n * You must not modify the returned string!\n *\n * @output:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Get_PS_Name_Func)( TT_Face face,\n FT_UInt idx,\n FT_String** PSname );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Metrics_Func\n *\n * @description:\n * Load a metrics table, which is a table with a horizontal and a\n * vertical version.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * stream ::\n * The input stream.\n *\n * vertical ::\n * A boolean flag. If set, load the vertical one.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Load_Metrics_Func)( TT_Face face,\n FT_Stream stream,\n FT_Bool vertical );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_Metrics_Func\n *\n * @description:\n * Load the horizontal or vertical header in a face object.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * vertical ::\n * A boolean flag. If set, load vertical metrics.\n *\n * gindex ::\n * The glyph index.\n *\n * @output:\n * abearing ::\n * The horizontal (or vertical) bearing. Set to zero in case of error.\n *\n * aadvance ::\n * The horizontal (or vertical) advance. Set to zero in case of error.\n */\n typedef void\n (*TT_Get_Metrics_Func)( TT_Face face,\n FT_Bool vertical,\n FT_UInt gindex,\n FT_Short* abearing,\n FT_UShort* aadvance );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Set_Palette_Func\n *\n * @description:\n * Load the colors into `face->palette` for a given palette index.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * idx ::\n * The palette index.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Set_Palette_Func)( TT_Face face,\n FT_UInt idx );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_Colr_Layer_Func\n *\n * @description:\n * Iteratively get the color layer data of a given glyph index.\n *\n * @input:\n * face ::\n * The target face object.\n *\n * base_glyph ::\n * The glyph index the colored glyph layers are associated with.\n *\n * @inout:\n * iterator ::\n * An @FT_LayerIterator object. For the first call you should set\n * `iterator->p` to `NULL`. For all following calls, simply use the\n * same object again.\n *\n * @output:\n * aglyph_index ::\n * The glyph index of the current layer.\n *\n * acolor_index ::\n * The color index into the font face's color palette of the current\n * layer. The value 0xFFFF is special; it doesn't reference a palette\n * entry but indicates that the text foreground color should be used\n * instead (to be set up by the application outside of FreeType).\n *\n * @return:\n * Value~1 if everything is OK. If there are no more layers (or if there\n * are no layers at all), value~0 gets returned. In case of an error,\n * value~0 is returned also.\n */\n typedef FT_Bool\n (*TT_Get_Colr_Layer_Func)( TT_Face face,\n FT_UInt base_glyph,\n FT_UInt *aglyph_index,\n FT_UInt *acolor_index,\n FT_LayerIterator* iterator );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Blend_Colr_Func\n *\n * @description:\n * Blend the bitmap in `new_glyph` into `base_glyph` using the color\n * specified by `color_index`. If `color_index` is 0xFFFF, use\n * `face->foreground_color` if `face->have_foreground_color` is set.\n * Otherwise check `face->palette_data.palette_flags`: If present and\n * @FT_PALETTE_FOR_DARK_BACKGROUND is set, use BGRA value 0xFFFFFFFF\n * (white opaque). Otherwise use BGRA value 0x000000FF (black opaque).\n *\n * @input:\n * face ::\n * The target face object.\n *\n * color_index ::\n * Color index from the COLR table.\n *\n * base_glyph ::\n * Slot for bitmap to be merged into. The underlying bitmap may get\n * reallocated.\n *\n * new_glyph ::\n * Slot to be incooperated into `base_glyph`.\n *\n * @return:\n * FreeType error code. 0 means success. Returns an error if\n * color_index is invalid or reallocation fails.\n */\n typedef FT_Error\n (*TT_Blend_Colr_Func)( TT_Face face,\n FT_UInt color_index,\n FT_GlyphSlot base_glyph,\n FT_GlyphSlot new_glyph );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_Name_Func\n *\n * @description:\n * From the 'name' table, return a given ENGLISH name record in ASCII.\n *\n * @input:\n * face ::\n * A handle to the source face object.\n *\n * nameid ::\n * The name id of the name record to return.\n *\n * @inout:\n * name ::\n * The address of an allocated string pointer. `NULL` if no name is\n * present.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Get_Name_Func)( TT_Face face,\n FT_UShort nameid,\n FT_String** name );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Get_Name_ID_Func\n *\n * @description:\n * Search whether an ENGLISH version for a given name ID is in the 'name'\n * table.\n *\n * @input:\n * face ::\n * A handle to the source face object.\n *\n * nameid ::\n * The name id of the name record to return.\n *\n * @output:\n * win ::\n * If non-negative, an index into the 'name' table with the\n * corresponding (3,1) or (3,0) Windows entry.\n *\n * apple ::\n * If non-negative, an index into the 'name' table with the\n * corresponding (1,0) Apple entry.\n *\n * @return:\n * 1 if there is either a win or apple entry (or both), 0 otheriwse.\n */\n typedef FT_Bool\n (*TT_Get_Name_ID_Func)( TT_Face face,\n FT_UShort nameid,\n FT_Int *win,\n FT_Int *apple );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Load_Table_Func\n *\n * @description:\n * Load a given TrueType table.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * stream ::\n * The input stream.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The function uses `face->goto_table` to seek the stream to the start\n * of the table, except while loading the font directory.\n */\n typedef FT_Error\n (*TT_Load_Table_Func)( TT_Face face,\n FT_Stream stream );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Free_Table_Func\n *\n * @description:\n * Free a given TrueType table.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n */\n typedef void\n (*TT_Free_Table_Func)( TT_Face face );\n\n\n /*\n * @functype:\n * TT_Face_GetKerningFunc\n *\n * @description:\n * Return the horizontal kerning value between two glyphs.\n *\n * @input:\n * face ::\n * A handle to the source face object.\n *\n * left_glyph ::\n * The left glyph index.\n *\n * right_glyph ::\n * The right glyph index.\n *\n * @return:\n * The kerning value in font units.\n */\n typedef FT_Int\n (*TT_Face_GetKerningFunc)( TT_Face face,\n FT_UInt left_glyph,\n FT_UInt right_glyph );\n\n\n /**************************************************************************\n *\n * @struct:\n * SFNT_Interface\n *\n * @description:\n * This structure holds pointers to the functions used to load and free\n * the basic tables that are required in a 'sfnt' font file.\n *\n * @fields:\n * Check the various xxx_Func() descriptions for details.\n */\n typedef struct SFNT_Interface_\n {\n TT_Loader_GotoTableFunc goto_table;\n\n TT_Init_Face_Func init_face;\n TT_Load_Face_Func load_face;\n TT_Done_Face_Func done_face;\n FT_Module_Requester get_interface;\n\n TT_Load_Any_Func load_any;\n\n /* these functions are called by `load_face' but they can also */\n /* be called from external modules, if there is a need to do so */\n TT_Load_Table_Func load_head;\n TT_Load_Metrics_Func load_hhea;\n TT_Load_Table_Func load_cmap;\n TT_Load_Table_Func load_maxp;\n TT_Load_Table_Func load_os2;\n TT_Load_Table_Func load_post;\n\n TT_Load_Table_Func load_name;\n TT_Free_Table_Func free_name;\n\n /* this field was called `load_kerning' up to version 2.1.10 */\n TT_Load_Table_Func load_kern;\n\n TT_Load_Table_Func load_gasp;\n TT_Load_Table_Func load_pclt;\n\n /* see `ttload.h'; this field was called `load_bitmap_header' up to */\n /* version 2.1.10 */\n TT_Load_Table_Func load_bhed;\n\n TT_Load_SBit_Image_Func load_sbit_image;\n\n /* see `ttpost.h' */\n TT_Get_PS_Name_Func get_psname;\n TT_Free_Table_Func free_psnames;\n\n /* starting here, the structure differs from version 2.1.7 */\n\n /* this field was introduced in version 2.1.8, named `get_psname' */\n TT_Face_GetKerningFunc get_kerning;\n\n /* new elements introduced after version 2.1.10 */\n\n /* load the font directory, i.e., the offset table and */\n /* the table directory */\n TT_Load_Table_Func load_font_dir;\n TT_Load_Metrics_Func load_hmtx;\n\n TT_Load_Table_Func load_eblc;\n TT_Free_Table_Func free_eblc;\n\n TT_Set_SBit_Strike_Func set_sbit_strike;\n TT_Load_Strike_Metrics_Func load_strike_metrics;\n\n TT_Load_Table_Func load_cpal;\n TT_Load_Table_Func load_colr;\n TT_Free_Table_Func free_cpal;\n TT_Free_Table_Func free_colr;\n TT_Set_Palette_Func set_palette;\n TT_Get_Colr_Layer_Func get_colr_layer;\n TT_Blend_Colr_Func colr_blend;\n\n TT_Get_Metrics_Func get_metrics;\n\n TT_Get_Name_Func get_name;\n TT_Get_Name_ID_Func get_name_id;\n\n } SFNT_Interface;\n\n\n /* transitional */\n typedef SFNT_Interface* SFNT_Service;\n\n\n#define FT_DEFINE_SFNT_INTERFACE( \\\n class_, \\\n goto_table_, \\\n init_face_, \\\n load_face_, \\\n done_face_, \\\n get_interface_, \\\n load_any_, \\\n load_head_, \\\n load_hhea_, \\\n load_cmap_, \\\n load_maxp_, \\\n load_os2_, \\\n load_post_, \\\n load_name_, \\\n free_name_, \\\n load_kern_, \\\n load_gasp_, \\\n load_pclt_, \\\n load_bhed_, \\\n load_sbit_image_, \\\n get_psname_, \\\n free_psnames_, \\\n get_kerning_, \\\n load_font_dir_, \\\n load_hmtx_, \\\n load_eblc_, \\\n free_eblc_, \\\n set_sbit_strike_, \\\n load_strike_metrics_, \\\n load_cpal_, \\\n load_colr_, \\\n free_cpal_, \\\n free_colr_, \\\n set_palette_, \\\n get_colr_layer_, \\\n colr_blend_, \\\n get_metrics_, \\\n get_name_, \\\n get_name_id_ ) \\\n static const SFNT_Interface class_ = \\\n { \\\n goto_table_, \\\n init_face_, \\\n load_face_, \\\n done_face_, \\\n get_interface_, \\\n load_any_, \\\n load_head_, \\\n load_hhea_, \\\n load_cmap_, \\\n load_maxp_, \\\n load_os2_, \\\n load_post_, \\\n load_name_, \\\n free_name_, \\\n load_kern_, \\\n load_gasp_, \\\n load_pclt_, \\\n load_bhed_, \\\n load_sbit_image_, \\\n get_psname_, \\\n free_psnames_, \\\n get_kerning_, \\\n load_font_dir_, \\\n load_hmtx_, \\\n load_eblc_, \\\n free_eblc_, \\\n set_sbit_strike_, \\\n load_strike_metrics_, \\\n load_cpal_, \\\n load_colr_, \\\n free_cpal_, \\\n free_colr_, \\\n set_palette_, \\\n get_colr_layer_, \\\n colr_blend_, \\\n get_metrics_, \\\n get_name_, \\\n get_name_id_ \\\n };\n\n\nFT_END_HEADER\n\n#endif /* SFNT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/t1types.h", "language": "code", "loc": 204, "comment_density": 0.49, "code": "/****************************************************************************\n *\n * t1types.h\n *\n * Basic Type1/Type2 type definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef T1TYPES_H_\n#define T1TYPES_H_\n\n\n#include \n#include FT_TYPE1_TABLES_H\n#include FT_INTERNAL_POSTSCRIPT_HINTS_H\n#include FT_INTERNAL_SERVICE_H\n#include FT_INTERNAL_HASH_H\n#include FT_SERVICE_POSTSCRIPT_CMAPS_H\n\n\nFT_BEGIN_HEADER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * T1_EncodingRec\n *\n * @description:\n * A structure modeling a custom encoding.\n *\n * @fields:\n * num_chars ::\n * The number of character codes in the encoding. Usually 256.\n *\n * code_first ::\n * The lowest valid character code in the encoding.\n *\n * code_last ::\n * The highest valid character code in the encoding + 1. When equal to\n * code_first there are no valid character codes.\n *\n * char_index ::\n * An array of corresponding glyph indices.\n *\n * char_name ::\n * An array of corresponding glyph names.\n */\n typedef struct T1_EncodingRecRec_\n {\n FT_Int num_chars;\n FT_Int code_first;\n FT_Int code_last;\n\n FT_UShort* char_index;\n const FT_String** char_name;\n\n } T1_EncodingRec, *T1_Encoding;\n\n\n /* used to hold extra data of PS_FontInfoRec that\n * cannot be stored in the publicly defined structure.\n *\n * Note these can't be blended with multiple-masters.\n */\n typedef struct PS_FontExtraRec_\n {\n FT_UShort fs_type;\n\n } PS_FontExtraRec;\n\n\n typedef struct T1_FontRec_\n {\n PS_FontInfoRec font_info; /* font info dictionary */\n PS_FontExtraRec font_extra; /* font info extra fields */\n PS_PrivateRec private_dict; /* private dictionary */\n FT_String* font_name; /* top-level dictionary */\n\n T1_EncodingType encoding_type;\n T1_EncodingRec encoding;\n\n FT_Byte* subrs_block;\n FT_Byte* charstrings_block;\n FT_Byte* glyph_names_block;\n\n FT_Int num_subrs;\n FT_Byte** subrs;\n FT_UInt* subrs_len;\n FT_Hash subrs_hash;\n\n FT_Int num_glyphs;\n FT_String** glyph_names; /* array of glyph names */\n FT_Byte** charstrings; /* array of glyph charstrings */\n FT_UInt* charstrings_len;\n\n FT_Byte paint_type;\n FT_Byte font_type;\n FT_Matrix font_matrix;\n FT_Vector font_offset;\n FT_BBox font_bbox;\n FT_Long font_id;\n\n FT_Fixed stroke_width;\n\n } T1_FontRec, *T1_Font;\n\n\n typedef struct CID_SubrsRec_\n {\n FT_Int num_subrs;\n FT_Byte** code;\n\n } CID_SubrsRec, *CID_Subrs;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** AFM FONT INFORMATION STRUCTURES ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n typedef struct AFM_TrackKernRec_\n {\n FT_Int degree;\n FT_Fixed min_ptsize;\n FT_Fixed min_kern;\n FT_Fixed max_ptsize;\n FT_Fixed max_kern;\n\n } AFM_TrackKernRec, *AFM_TrackKern;\n\n typedef struct AFM_KernPairRec_\n {\n FT_UInt index1;\n FT_UInt index2;\n FT_Int x;\n FT_Int y;\n\n } AFM_KernPairRec, *AFM_KernPair;\n\n typedef struct AFM_FontInfoRec_\n {\n FT_Bool IsCIDFont;\n FT_BBox FontBBox;\n FT_Fixed Ascender;\n FT_Fixed Descender;\n AFM_TrackKern TrackKerns; /* free if non-NULL */\n FT_UInt NumTrackKern;\n AFM_KernPair KernPairs; /* free if non-NULL */\n FT_UInt NumKernPair;\n\n } AFM_FontInfoRec, *AFM_FontInfo;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** ORIGINAL T1_FACE CLASS DEFINITION ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n typedef struct T1_FaceRec_* T1_Face;\n typedef struct CID_FaceRec_* CID_Face;\n\n\n typedef struct T1_FaceRec_\n {\n FT_FaceRec root;\n T1_FontRec type1;\n const void* psnames;\n const void* psaux;\n const void* afm_data;\n FT_CharMapRec charmaprecs[2];\n FT_CharMap charmaps[2];\n\n /* support for Multiple Masters fonts */\n PS_Blend blend;\n\n /* undocumented, optional: indices of subroutines that express */\n /* the NormalizeDesignVector and the ConvertDesignVector procedure, */\n /* respectively, as Type 2 charstrings; -1 if keywords not present */\n FT_Int ndv_idx;\n FT_Int cdv_idx;\n\n /* undocumented, optional: has the same meaning as len_buildchar */\n /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */\n FT_UInt len_buildchar;\n FT_Long* buildchar;\n\n /* since version 2.1 - interface to PostScript hinter */\n const void* pshinter;\n\n } T1_FaceRec;\n\n\n typedef struct CID_FaceRec_\n {\n FT_FaceRec root;\n void* psnames;\n void* psaux;\n CID_FaceInfoRec cid;\n PS_FontExtraRec font_extra;\n#if 0\n void* afm_data;\n#endif\n CID_Subrs subrs;\n\n /* since version 2.1 - interface to PostScript hinter */\n void* pshinter;\n\n /* since version 2.1.8, but was originally positioned after `afm_data' */\n FT_Byte* binary_data; /* used if hex data has been converted */\n FT_Stream cid_stream;\n\n } CID_FaceRec;\n\n\nFT_END_HEADER\n\n#endif /* T1TYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/tttypes.h", "language": "code", "loc": 1569, "comment_density": 0.788, "code": "/****************************************************************************\n *\n * tttypes.h\n *\n * Basic SFNT/TrueType type definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef TTTYPES_H_\n#define TTTYPES_H_\n\n\n#include \n#include FT_TRUETYPE_TABLES_H\n#include FT_INTERNAL_OBJECTS_H\n#include FT_COLOR_H\n\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\n#include FT_MULTIPLE_MASTERS_H\n#endif\n\n\nFT_BEGIN_HEADER\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * TTC_HeaderRec\n *\n * @description:\n * TrueType collection header. This table contains the offsets of the\n * font headers of each distinct TrueType face in the file.\n *\n * @fields:\n * tag ::\n * Must be 'ttc~' to indicate a TrueType collection.\n *\n * version ::\n * The version number.\n *\n * count ::\n * The number of faces in the collection. The specification says this\n * should be an unsigned long, but we use a signed long since we need\n * the value -1 for specific purposes.\n *\n * offsets ::\n * The offsets of the font headers, one per face.\n */\n typedef struct TTC_HeaderRec_\n {\n FT_ULong tag;\n FT_Fixed version;\n FT_Long count;\n FT_ULong* offsets;\n\n } TTC_HeaderRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * SFNT_HeaderRec\n *\n * @description:\n * SFNT file format header.\n *\n * @fields:\n * format_tag ::\n * The font format tag.\n *\n * num_tables ::\n * The number of tables in file.\n *\n * search_range ::\n * Must be '16 * (max power of 2 <= num_tables)'.\n *\n * entry_selector ::\n * Must be log2 of 'search_range / 16'.\n *\n * range_shift ::\n * Must be 'num_tables * 16 - search_range'.\n */\n typedef struct SFNT_HeaderRec_\n {\n FT_ULong format_tag;\n FT_UShort num_tables;\n FT_UShort search_range;\n FT_UShort entry_selector;\n FT_UShort range_shift;\n\n FT_ULong offset; /* not in file */\n\n } SFNT_HeaderRec, *SFNT_Header;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_TableRec\n *\n * @description:\n * This structure describes a given table of a TrueType font.\n *\n * @fields:\n * Tag ::\n * A four-bytes tag describing the table.\n *\n * CheckSum ::\n * The table checksum. This value can be ignored.\n *\n * Offset ::\n * The offset of the table from the start of the TrueType font in its\n * resource.\n *\n * Length ::\n * The table length (in bytes).\n */\n typedef struct TT_TableRec_\n {\n FT_ULong Tag; /* table type */\n FT_ULong CheckSum; /* table checksum */\n FT_ULong Offset; /* table file offset */\n FT_ULong Length; /* table length */\n\n } TT_TableRec, *TT_Table;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_LongMetricsRec\n *\n * @description:\n * A structure modeling the long metrics of the 'hmtx' and 'vmtx'\n * TrueType tables. The values are expressed in font units.\n *\n * @fields:\n * advance ::\n * The advance width or height for the glyph.\n *\n * bearing ::\n * The left-side or top-side bearing for the glyph.\n */\n typedef struct TT_LongMetricsRec_\n {\n FT_UShort advance;\n FT_Short bearing;\n\n } TT_LongMetricsRec, *TT_LongMetrics;\n\n\n /**************************************************************************\n *\n * @type:\n * TT_ShortMetrics\n *\n * @description:\n * A simple type to model the short metrics of the 'hmtx' and 'vmtx'\n * tables.\n */\n typedef FT_Short TT_ShortMetrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_NameRec\n *\n * @description:\n * A structure modeling TrueType name records. Name records are used to\n * store important strings like family name, style name, copyright,\n * etc. in _localized_ versions (i.e., language, encoding, etc).\n *\n * @fields:\n * platformID ::\n * The ID of the name's encoding platform.\n *\n * encodingID ::\n * The platform-specific ID for the name's encoding.\n *\n * languageID ::\n * The platform-specific ID for the name's language.\n *\n * nameID ::\n * The ID specifying what kind of name this is.\n *\n * stringLength ::\n * The length of the string in bytes.\n *\n * stringOffset ::\n * The offset to the string in the 'name' table.\n *\n * string ::\n * A pointer to the string's bytes. Note that these are usually UTF-16\n * encoded characters.\n */\n typedef struct TT_NameRec_\n {\n FT_UShort platformID;\n FT_UShort encodingID;\n FT_UShort languageID;\n FT_UShort nameID;\n FT_UShort stringLength;\n FT_ULong stringOffset;\n\n /* this last field is not defined in the spec */\n /* but used by the FreeType engine */\n\n FT_Byte* string;\n\n } TT_NameRec, *TT_Name;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_LangTagRec\n *\n * @description:\n * A structure modeling language tag records in SFNT 'name' tables,\n * introduced in OpenType version 1.6.\n *\n * @fields:\n * stringLength ::\n * The length of the string in bytes.\n *\n * stringOffset ::\n * The offset to the string in the 'name' table.\n *\n * string ::\n * A pointer to the string's bytes. Note that these are UTF-16BE\n * encoded characters.\n */\n typedef struct TT_LangTagRec_\n {\n FT_UShort stringLength;\n FT_ULong stringOffset;\n\n /* this last field is not defined in the spec */\n /* but used by the FreeType engine */\n\n FT_Byte* string;\n\n } TT_LangTagRec, *TT_LangTag;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_NameTableRec\n *\n * @description:\n * A structure modeling the TrueType name table.\n *\n * @fields:\n * format ::\n * The format of the name table.\n *\n * numNameRecords ::\n * The number of names in table.\n *\n * storageOffset ::\n * The offset of the name table in the 'name' TrueType table.\n *\n * names ::\n * An array of name records.\n *\n * numLangTagRecords ::\n * The number of language tags in table.\n *\n * langTags ::\n * An array of language tag records.\n *\n * stream ::\n * The file's input stream.\n */\n typedef struct TT_NameTableRec_\n {\n FT_UShort format;\n FT_UInt numNameRecords;\n FT_UInt storageOffset;\n TT_NameRec* names;\n FT_UInt numLangTagRecords;\n TT_LangTagRec* langTags;\n FT_Stream stream;\n\n } TT_NameTableRec, *TT_NameTable;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_GaspRangeRec\n *\n * @description:\n * A tiny structure used to model a gasp range according to the TrueType\n * specification.\n *\n * @fields:\n * maxPPEM ::\n * The maximum ppem value to which `gaspFlag` applies.\n *\n * gaspFlag ::\n * A flag describing the grid-fitting and anti-aliasing modes to be\n * used.\n */\n typedef struct TT_GaspRangeRec_\n {\n FT_UShort maxPPEM;\n FT_UShort gaspFlag;\n\n } TT_GaspRangeRec, *TT_GaspRange;\n\n\n#define TT_GASP_GRIDFIT 0x01\n#define TT_GASP_DOGRAY 0x02\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_GaspRec\n *\n * @description:\n * A structure modeling the TrueType 'gasp' table used to specify\n * grid-fitting and anti-aliasing behaviour.\n *\n * @fields:\n * version ::\n * The version number.\n *\n * numRanges ::\n * The number of gasp ranges in table.\n *\n * gaspRanges ::\n * An array of gasp ranges.\n */\n typedef struct TT_Gasp_\n {\n FT_UShort version;\n FT_UShort numRanges;\n TT_GaspRange gaspRanges;\n\n } TT_GaspRec;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** EMBEDDED BITMAPS SUPPORT ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_MetricsRec\n *\n * @description:\n * A structure used to hold the big metrics of a given glyph bitmap in a\n * TrueType or OpenType font. These are usually found in the 'EBDT'\n * (Microsoft) or 'bloc' (Apple) table.\n *\n * @fields:\n * height ::\n * The glyph height in pixels.\n *\n * width ::\n * The glyph width in pixels.\n *\n * horiBearingX ::\n * The horizontal left bearing.\n *\n * horiBearingY ::\n * The horizontal top bearing.\n *\n * horiAdvance ::\n * The horizontal advance.\n *\n * vertBearingX ::\n * The vertical left bearing.\n *\n * vertBearingY ::\n * The vertical top bearing.\n *\n * vertAdvance ::\n * The vertical advance.\n */\n typedef struct TT_SBit_MetricsRec_\n {\n FT_UShort height;\n FT_UShort width;\n\n FT_Short horiBearingX;\n FT_Short horiBearingY;\n FT_UShort horiAdvance;\n\n FT_Short vertBearingX;\n FT_Short vertBearingY;\n FT_UShort vertAdvance;\n\n } TT_SBit_MetricsRec, *TT_SBit_Metrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_SmallMetricsRec\n *\n * @description:\n * A structure used to hold the small metrics of a given glyph bitmap in\n * a TrueType or OpenType font. These are usually found in the 'EBDT'\n * (Microsoft) or the 'bdat' (Apple) table.\n *\n * @fields:\n * height ::\n * The glyph height in pixels.\n *\n * width ::\n * The glyph width in pixels.\n *\n * bearingX ::\n * The left-side bearing.\n *\n * bearingY ::\n * The top-side bearing.\n *\n * advance ::\n * The advance width or height.\n */\n typedef struct TT_SBit_Small_Metrics_\n {\n FT_Byte height;\n FT_Byte width;\n\n FT_Char bearingX;\n FT_Char bearingY;\n FT_Byte advance;\n\n } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_LineMetricsRec\n *\n * @description:\n * A structure used to describe the text line metrics of a given bitmap\n * strike, for either a horizontal or vertical layout.\n *\n * @fields:\n * ascender ::\n * The ascender in pixels.\n *\n * descender ::\n * The descender in pixels.\n *\n * max_width ::\n * The maximum glyph width in pixels.\n *\n * caret_slope_enumerator ::\n * Rise of the caret slope, typically set to 1 for non-italic fonts.\n *\n * caret_slope_denominator ::\n * Rise of the caret slope, typically set to 0 for non-italic fonts.\n *\n * caret_offset ::\n * Offset in pixels to move the caret for proper positioning.\n *\n * min_origin_SB ::\n * Minimum of horiBearingX (resp. vertBearingY).\n * min_advance_SB ::\n * Minimum of\n *\n * horizontal advance - ( horiBearingX + width )\n *\n * resp.\n *\n * vertical advance - ( vertBearingY + height )\n *\n * max_before_BL ::\n * Maximum of horiBearingY (resp. vertBearingY).\n *\n * min_after_BL ::\n * Minimum of\n *\n * horiBearingY - height\n *\n * resp.\n *\n * vertBearingX - width\n *\n * pads ::\n * Unused (to make the size of the record a multiple of 32 bits.\n */\n typedef struct TT_SBit_LineMetricsRec_\n {\n FT_Char ascender;\n FT_Char descender;\n FT_Byte max_width;\n FT_Char caret_slope_numerator;\n FT_Char caret_slope_denominator;\n FT_Char caret_offset;\n FT_Char min_origin_SB;\n FT_Char min_advance_SB;\n FT_Char max_before_BL;\n FT_Char min_after_BL;\n FT_Char pads[2];\n\n } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_RangeRec\n *\n * @description:\n * A TrueType/OpenType subIndexTable as defined in the 'EBLC' (Microsoft)\n * or 'bloc' (Apple) tables.\n *\n * @fields:\n * first_glyph ::\n * The first glyph index in the range.\n *\n * last_glyph ::\n * The last glyph index in the range.\n *\n * index_format ::\n * The format of index table. Valid values are 1 to 5.\n *\n * image_format ::\n * The format of 'EBDT' image data.\n *\n * image_offset ::\n * The offset to image data in 'EBDT'.\n *\n * image_size ::\n * For index formats 2 and 5. This is the size in bytes of each glyph\n * bitmap.\n *\n * big_metrics ::\n * For index formats 2 and 5. This is the big metrics for each glyph\n * bitmap.\n *\n * num_glyphs ::\n * For index formats 4 and 5. This is the number of glyphs in the code\n * array.\n *\n * glyph_offsets ::\n * For index formats 1 and 3.\n *\n * glyph_codes ::\n * For index formats 4 and 5.\n *\n * table_offset ::\n * The offset of the index table in the 'EBLC' table. Only used during\n * strike loading.\n */\n typedef struct TT_SBit_RangeRec_\n {\n FT_UShort first_glyph;\n FT_UShort last_glyph;\n\n FT_UShort index_format;\n FT_UShort image_format;\n FT_ULong image_offset;\n\n FT_ULong image_size;\n TT_SBit_MetricsRec metrics;\n FT_ULong num_glyphs;\n\n FT_ULong* glyph_offsets;\n FT_UShort* glyph_codes;\n\n FT_ULong table_offset;\n\n } TT_SBit_RangeRec, *TT_SBit_Range;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_StrikeRec\n *\n * @description:\n * A structure used describe a given bitmap strike in the 'EBLC'\n * (Microsoft) or 'bloc' (Apple) tables.\n *\n * @fields:\n * num_index_ranges ::\n * The number of index ranges.\n *\n * index_ranges ::\n * An array of glyph index ranges.\n *\n * color_ref ::\n * Unused. `color_ref` is put in for future enhancements, but these\n * fields are already in use by other platforms (e.g. Newton). For\n * details, please see\n *\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bloc.html\n *\n * hori ::\n * The line metrics for horizontal layouts.\n *\n * vert ::\n * The line metrics for vertical layouts.\n *\n * start_glyph ::\n * The lowest glyph index for this strike.\n *\n * end_glyph ::\n * The highest glyph index for this strike.\n *\n * x_ppem ::\n * The number of horizontal pixels per EM.\n *\n * y_ppem ::\n * The number of vertical pixels per EM.\n *\n * bit_depth ::\n * The bit depth. Valid values are 1, 2, 4, and 8.\n *\n * flags ::\n * Is this a vertical or horizontal strike? For details, please see\n *\n * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bloc.html\n */\n typedef struct TT_SBit_StrikeRec_\n {\n FT_Int num_ranges;\n TT_SBit_Range sbit_ranges;\n FT_ULong ranges_offset;\n\n FT_ULong color_ref;\n\n TT_SBit_LineMetricsRec hori;\n TT_SBit_LineMetricsRec vert;\n\n FT_UShort start_glyph;\n FT_UShort end_glyph;\n\n FT_Byte x_ppem;\n FT_Byte y_ppem;\n\n FT_Byte bit_depth;\n FT_Char flags;\n\n } TT_SBit_StrikeRec, *TT_SBit_Strike;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_ComponentRec\n *\n * @description:\n * A simple structure to describe a compound sbit element.\n *\n * @fields:\n * glyph_code ::\n * The element's glyph index.\n *\n * x_offset ::\n * The element's left bearing.\n *\n * y_offset ::\n * The element's top bearing.\n */\n typedef struct TT_SBit_ComponentRec_\n {\n FT_UShort glyph_code;\n FT_Char x_offset;\n FT_Char y_offset;\n\n } TT_SBit_ComponentRec, *TT_SBit_Component;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_SBit_ScaleRec\n *\n * @description:\n * A structure used describe a given bitmap scaling table, as defined in\n * the 'EBSC' table.\n *\n * @fields:\n * hori ::\n * The horizontal line metrics.\n *\n * vert ::\n * The vertical line metrics.\n *\n * x_ppem ::\n * The number of horizontal pixels per EM.\n *\n * y_ppem ::\n * The number of vertical pixels per EM.\n *\n * x_ppem_substitute ::\n * Substitution x_ppem value.\n *\n * y_ppem_substitute ::\n * Substitution y_ppem value.\n */\n typedef struct TT_SBit_ScaleRec_\n {\n TT_SBit_LineMetricsRec hori;\n TT_SBit_LineMetricsRec vert;\n\n FT_Byte x_ppem;\n FT_Byte y_ppem;\n\n FT_Byte x_ppem_substitute;\n FT_Byte y_ppem_substitute;\n\n } TT_SBit_ScaleRec, *TT_SBit_Scale;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Post_20Rec\n *\n * @description:\n * Postscript names sub-table, format 2.0. Stores the PS name of each\n * glyph in the font face.\n *\n * @fields:\n * num_glyphs ::\n * The number of named glyphs in the table.\n *\n * num_names ::\n * The number of PS names stored in the table.\n *\n * glyph_indices ::\n * The indices of the glyphs in the names arrays.\n *\n * glyph_names ::\n * The PS names not in Mac Encoding.\n */\n typedef struct TT_Post_20Rec_\n {\n FT_UShort num_glyphs;\n FT_UShort num_names;\n FT_UShort* glyph_indices;\n FT_Char** glyph_names;\n\n } TT_Post_20Rec, *TT_Post_20;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Post_25Rec\n *\n * @description:\n * Postscript names sub-table, format 2.5. Stores the PS name of each\n * glyph in the font face.\n *\n * @fields:\n * num_glyphs ::\n * The number of glyphs in the table.\n *\n * offsets ::\n * An array of signed offsets in a normal Mac Postscript name encoding.\n */\n typedef struct TT_Post_25_\n {\n FT_UShort num_glyphs;\n FT_Char* offsets;\n\n } TT_Post_25Rec, *TT_Post_25;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_Post_NamesRec\n *\n * @description:\n * Postscript names table, either format 2.0 or 2.5.\n *\n * @fields:\n * loaded ::\n * A flag to indicate whether the PS names are loaded.\n *\n * format_20 ::\n * The sub-table used for format 2.0.\n *\n * format_25 ::\n * The sub-table used for format 2.5.\n */\n typedef struct TT_Post_NamesRec_\n {\n FT_Bool loaded;\n\n union\n {\n TT_Post_20Rec format_20;\n TT_Post_25Rec format_25;\n\n } names;\n\n } TT_Post_NamesRec, *TT_Post_Names;\n\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** GX VARIATION TABLE SUPPORT ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\n typedef struct GX_BlendRec_ *GX_Blend;\n#endif\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** EMBEDDED BDF PROPERTIES TABLE SUPPORT ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n /*\n * These types are used to support a `BDF ' table that isn't part of the\n * official TrueType specification. It is mainly used in SFNT-based bitmap\n * fonts that were generated from a set of BDF fonts.\n *\n * The format of the table is as follows.\n *\n * USHORT version `BDF ' table version number, should be 0x0001. USHORT\n * strikeCount Number of strikes (bitmap sizes) in this table. ULONG\n * stringTable Offset (from start of BDF table) to string\n * table.\n *\n * This is followed by an array of `strikeCount' descriptors, having the\n * following format.\n *\n * USHORT ppem Vertical pixels per EM for this strike. USHORT numItems\n * Number of items for this strike (properties and\n * atoms). Maximum is 255.\n *\n * This array in turn is followed by `strikeCount' value sets. Each `value\n * set' is an array of `numItems' items with the following format.\n *\n * ULONG item_name Offset in string table to item name.\n * USHORT item_type The item type. Possible values are\n * 0 => string (e.g., COMMENT)\n * 1 => atom (e.g., FONT or even SIZE)\n * 2 => int32\n * 3 => uint32\n * 0x10 => A flag to indicate a properties. This\n * is ORed with the above values.\n * ULONG item_value For strings => Offset into string table without\n * the corresponding double quotes.\n * For atoms => Offset into string table.\n * For integers => Direct value.\n *\n * All strings in the string table consist of bytes and are\n * zero-terminated.\n *\n */\n\n#ifdef TT_CONFIG_OPTION_BDF\n\n typedef struct TT_BDFRec_\n {\n FT_Byte* table;\n FT_Byte* table_end;\n FT_Byte* strings;\n FT_ULong strings_size;\n FT_UInt num_strikes;\n FT_Bool loaded;\n\n } TT_BDFRec, *TT_BDF;\n\n#endif /* TT_CONFIG_OPTION_BDF */\n\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n /*** ***/\n /*** ***/\n /*** ORIGINAL TT_FACE CLASS DEFINITION ***/\n /*** ***/\n /*** ***/\n /*************************************************************************/\n /*************************************************************************/\n /*************************************************************************/\n\n\n /**************************************************************************\n *\n * This structure/class is defined here because it is common to the\n * following formats: TTF, OpenType-TT, and OpenType-CFF.\n *\n * Note, however, that the classes TT_Size and TT_GlyphSlot are not shared\n * between font drivers, and are thus defined in `ttobjs.h`.\n *\n */\n\n\n /**************************************************************************\n *\n * @type:\n * TT_Face\n *\n * @description:\n * A handle to a TrueType face/font object. A TT_Face encapsulates the\n * resolution and scaling independent parts of a TrueType font resource.\n *\n * @note:\n * The TT_Face structure is also used as a 'parent class' for the\n * OpenType-CFF class (T2_Face).\n */\n typedef struct TT_FaceRec_* TT_Face;\n\n\n /* a function type used for the truetype bytecode interpreter hooks */\n typedef FT_Error\n (*TT_Interpreter)( void* exec_context );\n\n /* forward declaration */\n typedef struct TT_LoaderRec_* TT_Loader;\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Loader_GotoTableFunc\n *\n * @description:\n * Seeks a stream to the start of a given TrueType table.\n *\n * @input:\n * face ::\n * A handle to the target face object.\n *\n * tag ::\n * A 4-byte tag used to name the table.\n *\n * stream ::\n * The input stream.\n *\n * @output:\n * length ::\n * The length of the table in bytes. Set to 0 if not needed.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * The stream cursor must be at the font file's origin.\n */\n typedef FT_Error\n (*TT_Loader_GotoTableFunc)( TT_Face face,\n FT_ULong tag,\n FT_Stream stream,\n FT_ULong* length );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Loader_StartGlyphFunc\n *\n * @description:\n * Seeks a stream to the start of a given glyph element, and opens a\n * frame for it.\n *\n * @input:\n * loader ::\n * The current TrueType glyph loader object.\n *\n * glyph index :: The index of the glyph to access.\n *\n * offset ::\n * The offset of the glyph according to the 'locations' table.\n *\n * byte_count ::\n * The size of the frame in bytes.\n *\n * @return:\n * FreeType error code. 0 means success.\n *\n * @note:\n * This function is normally equivalent to FT_STREAM_SEEK(offset)\n * followed by FT_FRAME_ENTER(byte_count) with the loader's stream, but\n * alternative formats (e.g. compressed ones) might use something\n * different.\n */\n typedef FT_Error\n (*TT_Loader_StartGlyphFunc)( TT_Loader loader,\n FT_UInt glyph_index,\n FT_ULong offset,\n FT_UInt byte_count );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Loader_ReadGlyphFunc\n *\n * @description:\n * Reads one glyph element (its header, a simple glyph, or a composite)\n * from the loader's current stream frame.\n *\n * @input:\n * loader ::\n * The current TrueType glyph loader object.\n *\n * @return:\n * FreeType error code. 0 means success.\n */\n typedef FT_Error\n (*TT_Loader_ReadGlyphFunc)( TT_Loader loader );\n\n\n /**************************************************************************\n *\n * @functype:\n * TT_Loader_EndGlyphFunc\n *\n * @description:\n * Closes the current loader stream frame for the glyph.\n *\n * @input:\n * loader ::\n * The current TrueType glyph loader object.\n */\n typedef void\n (*TT_Loader_EndGlyphFunc)( TT_Loader loader );\n\n\n typedef enum TT_SbitTableType_\n {\n TT_SBIT_TABLE_TYPE_NONE = 0,\n TT_SBIT_TABLE_TYPE_EBLC, /* `EBLC' (Microsoft), */\n /* `bloc' (Apple) */\n TT_SBIT_TABLE_TYPE_CBLC, /* `CBLC' (Google) */\n TT_SBIT_TABLE_TYPE_SBIX, /* `sbix' (Apple) */\n\n /* do not remove */\n TT_SBIT_TABLE_TYPE_MAX\n\n } TT_SbitTableType;\n\n\n /* OpenType 1.8 brings new tables for variation font support; */\n /* to make the old MM and GX fonts still work we need to check */\n /* the presence (and validity) of the functionality provided */\n /* by those tables. The following flag macros are for the */\n /* field `variation_support'. */\n /* */\n /* Note that `fvar' gets checked immediately at font loading, */\n /* while the other features are only loaded if MM support is */\n /* actually requested. */\n\n /* FVAR */\n#define TT_FACE_FLAG_VAR_FVAR ( 1 << 0 )\n\n /* HVAR */\n#define TT_FACE_FLAG_VAR_HADVANCE ( 1 << 1 )\n#define TT_FACE_FLAG_VAR_LSB ( 1 << 2 )\n#define TT_FACE_FLAG_VAR_RSB ( 1 << 3 )\n\n /* VVAR */\n#define TT_FACE_FLAG_VAR_VADVANCE ( 1 << 4 )\n#define TT_FACE_FLAG_VAR_TSB ( 1 << 5 )\n#define TT_FACE_FLAG_VAR_BSB ( 1 << 6 )\n#define TT_FACE_FLAG_VAR_VORG ( 1 << 7 )\n\n /* MVAR */\n#define TT_FACE_FLAG_VAR_MVAR ( 1 << 8 )\n\n\n /**************************************************************************\n *\n * TrueType Face Type\n *\n * @struct:\n * TT_Face\n *\n * @description:\n * The TrueType face class. These objects model the resolution and\n * point-size independent data found in a TrueType font file.\n *\n * @fields:\n * root ::\n * The base FT_Face structure, managed by the base layer.\n *\n * ttc_header ::\n * The TrueType collection header, used when the file is a 'ttc' rather\n * than a 'ttf'. For ordinary font files, the field `ttc_header.count`\n * is set to 0.\n *\n * format_tag ::\n * The font format tag.\n *\n * num_tables ::\n * The number of TrueType tables in this font file.\n *\n * dir_tables ::\n * The directory of TrueType tables for this font file.\n *\n * header ::\n * The font's font header ('head' table). Read on font opening.\n *\n * horizontal ::\n * The font's horizontal header ('hhea' table). This field also\n * contains the associated horizontal metrics table ('hmtx').\n *\n * max_profile ::\n * The font's maximum profile table. Read on font opening. Note that\n * some maximum values cannot be taken directly from this table. We\n * thus define additional fields below to hold the computed maxima.\n *\n * vertical_info ::\n * A boolean which is set when the font file contains vertical metrics.\n * If not, the value of the 'vertical' field is undefined.\n *\n * vertical ::\n * The font's vertical header ('vhea' table). This field also contains\n * the associated vertical metrics table ('vmtx'), if found.\n * IMPORTANT: The contents of this field is undefined if the\n * `vertical_info` field is unset.\n *\n * num_names ::\n * The number of name records within this TrueType font.\n *\n * name_table ::\n * The table of name records ('name').\n *\n * os2 ::\n * The font's OS/2 table ('OS/2').\n *\n * postscript ::\n * The font's PostScript table ('post' table). The PostScript glyph\n * names are not loaded by the driver on face opening. See the\n * 'ttpost' module for more details.\n *\n * cmap_table ::\n * Address of the face's 'cmap' SFNT table in memory (it's an extracted\n * frame).\n *\n * cmap_size ::\n * The size in bytes of the `cmap_table` described above.\n *\n * goto_table ::\n * A function called by each TrueType table loader to position a\n * stream's cursor to the start of a given table according to its tag.\n * It defaults to TT_Goto_Face but can be different for strange formats\n * (e.g. Type 42).\n *\n * access_glyph_frame ::\n * A function used to access the frame of a given glyph within the\n * face's font file.\n *\n * forget_glyph_frame ::\n * A function used to forget the frame of a given glyph when all data\n * has been loaded.\n *\n * read_glyph_header ::\n * A function used to read a glyph header. It must be called between\n * an 'access' and 'forget'.\n *\n * read_simple_glyph ::\n * A function used to read a simple glyph. It must be called after the\n * header was read, and before the 'forget'.\n *\n * read_composite_glyph ::\n * A function used to read a composite glyph. It must be called after\n * the header was read, and before the 'forget'.\n *\n * sfnt ::\n * A pointer to the SFNT service.\n *\n * psnames ::\n * A pointer to the PostScript names service.\n *\n * mm ::\n * A pointer to the Multiple Masters service.\n *\n * var ::\n * A pointer to the Metrics Variations service.\n *\n * hdmx ::\n * The face's horizontal device metrics ('hdmx' table). This table is\n * optional in TrueType/OpenType fonts.\n *\n * gasp ::\n * The grid-fitting and scaling properties table ('gasp'). This table\n * is optional in TrueType/OpenType fonts.\n *\n * pclt ::\n * The 'pclt' SFNT table.\n *\n * num_sbit_scales ::\n * The number of sbit scales for this font.\n *\n * sbit_scales ::\n * Array of sbit scales embedded in this font. This table is optional\n * in a TrueType/OpenType font.\n *\n * postscript_names ::\n * A table used to store the Postscript names of the glyphs for this\n * font. See the file `ttconfig.h` for comments on the\n * TT_CONFIG_OPTION_POSTSCRIPT_NAMES option.\n *\n * palette_data ::\n * Some fields from the 'CPAL' table that are directly indexed.\n *\n * palette_index ::\n * The current palette index, as set by @FT_Palette_Select.\n *\n * palette ::\n * An array containing the current palette's colors.\n *\n * have_foreground_color ::\n * There was a call to @FT_Palette_Set_Foreground_Color.\n *\n * foreground_color ::\n * The current foreground color corresponding to 'CPAL' color index\n * 0xFFFF. Only valid if `have_foreground_color` is set.\n *\n * font_program_size ::\n * Size in bytecodes of the face's font program. 0 if none defined.\n * Ignored for Type 2 fonts.\n *\n * font_program ::\n * The face's font program (bytecode stream) executed at load time,\n * also used during glyph rendering. Comes from the 'fpgm' table.\n * Ignored for Type 2 font fonts.\n *\n * cvt_program_size ::\n * The size in bytecodes of the face's cvt program. Ignored for Type 2\n * fonts.\n *\n * cvt_program ::\n * The face's cvt program (bytecode stream) executed each time an\n * instance/size is changed/reset. Comes from the 'prep' table.\n * Ignored for Type 2 fonts.\n *\n * cvt_size ::\n * Size of the control value table (in entries). Ignored for Type 2\n * fonts.\n *\n * cvt ::\n * The face's original control value table. Coordinates are expressed\n * in unscaled font units (in 26.6 format). Comes from the 'cvt~'\n * table. Ignored for Type 2 fonts.\n *\n * If varied by the `CVAR' table, non-integer values are possible.\n *\n * interpreter ::\n * A pointer to the TrueType bytecode interpreters field is also used\n * to hook the debugger in 'ttdebug'.\n *\n * extra ::\n * Reserved for third-party font drivers.\n *\n * postscript_name ::\n * The PS name of the font. Used by the postscript name service.\n *\n * glyf_len ::\n * The length of the 'glyf' table. Needed for malformed 'loca' tables.\n *\n * glyf_offset ::\n * The file offset of the 'glyf' table.\n *\n * is_cff2 ::\n * Set if the font format is CFF2.\n *\n * doblend ::\n * A boolean which is set if the font should be blended (this is for GX\n * var).\n *\n * blend ::\n * Contains the data needed to control GX variation tables (rather like\n * Multiple Master data).\n *\n * variation_support ::\n * Flags that indicate which OpenType functionality related to font\n * variation support is present, valid, and usable. For example,\n * TT_FACE_FLAG_VAR_FVAR is only set if we have at least one design\n * axis.\n *\n * var_postscript_prefix ::\n * The PostScript name prefix needed for constructing a variation font\n * instance's PS name .\n *\n * var_postscript_prefix_len ::\n * The length of the `var_postscript_prefix` string.\n *\n * horz_metrics_size ::\n * The size of the 'hmtx' table.\n *\n * vert_metrics_size ::\n * The size of the 'vmtx' table.\n *\n * num_locations ::\n * The number of glyph locations in this TrueType file. This should be\n * identical to the number of glyphs. Ignored for Type 2 fonts.\n *\n * glyph_locations ::\n * An array of longs. These are offsets to glyph data within the\n * 'glyf' table. Ignored for Type 2 font faces.\n *\n * hdmx_table ::\n * A pointer to the 'hdmx' table.\n *\n * hdmx_table_size ::\n * The size of the 'hdmx' table.\n *\n * hdmx_record_count ::\n * The number of hdmx records.\n *\n * hdmx_record_size ::\n * The size of a single hdmx record.\n *\n * hdmx_record_sizes ::\n * An array holding the ppem sizes available in the 'hdmx' table.\n *\n * sbit_table ::\n * A pointer to the font's embedded bitmap location table.\n *\n * sbit_table_size ::\n * The size of `sbit_table`.\n *\n * sbit_table_type ::\n * The sbit table type (CBLC, sbix, etc.).\n *\n * sbit_num_strikes ::\n * The number of sbit strikes exposed by FreeType's API, omitting\n * invalid strikes.\n *\n * sbit_strike_map ::\n * A mapping between the strike indices exposed by the API and the\n * indices used in the font's sbit table.\n *\n * cpal ::\n * A pointer to data related to the 'CPAL' table. `NULL` if the table\n * is not available.\n *\n * colr ::\n * A pointer to data related to the 'COLR' table. `NULL` if the table\n * is not available.\n *\n * kern_table ::\n * A pointer to the 'kern' table.\n *\n * kern_table_size ::\n * The size of the 'kern' table.\n *\n * num_kern_tables ::\n * The number of supported kern subtables (up to 32; FreeType\n * recognizes only horizontal ones with format 0).\n *\n * kern_avail_bits ::\n * The availability status of kern subtables; if bit n is set, table n\n * is available.\n *\n * kern_order_bits ::\n * The sortedness status of kern subtables; if bit n is set, table n is\n * sorted.\n *\n * bdf ::\n * Data related to an SFNT font's 'bdf' table; see `tttypes.h`.\n *\n * horz_metrics_offset ::\n * The file offset of the 'hmtx' table.\n *\n * vert_metrics_offset ::\n * The file offset of the 'vmtx' table.\n *\n * sph_found_func_flags ::\n * Flags identifying special bytecode functions (used by the v38\n * implementation of the bytecode interpreter).\n *\n * sph_compatibility_mode ::\n * This flag is set if we are in ClearType backward compatibility mode\n * (used by the v38 implementation of the bytecode interpreter).\n *\n * ebdt_start ::\n * The file offset of the sbit data table (CBDT, bdat, etc.).\n *\n * ebdt_size ::\n * The size of the sbit data table.\n */\n typedef struct TT_FaceRec_\n {\n FT_FaceRec root;\n\n TTC_HeaderRec ttc_header;\n\n FT_ULong format_tag;\n FT_UShort num_tables;\n TT_Table dir_tables;\n\n TT_Header header; /* TrueType header table */\n TT_HoriHeader horizontal; /* TrueType horizontal header */\n\n TT_MaxProfile max_profile;\n\n FT_Bool vertical_info;\n TT_VertHeader vertical; /* TT Vertical header, if present */\n\n FT_UShort num_names; /* number of name records */\n TT_NameTableRec name_table; /* name table */\n\n TT_OS2 os2; /* TrueType OS/2 table */\n TT_Postscript postscript; /* TrueType Postscript table */\n\n FT_Byte* cmap_table; /* extracted `cmap' table */\n FT_ULong cmap_size;\n\n TT_Loader_GotoTableFunc goto_table;\n\n TT_Loader_StartGlyphFunc access_glyph_frame;\n TT_Loader_EndGlyphFunc forget_glyph_frame;\n TT_Loader_ReadGlyphFunc read_glyph_header;\n TT_Loader_ReadGlyphFunc read_simple_glyph;\n TT_Loader_ReadGlyphFunc read_composite_glyph;\n\n /* a typeless pointer to the SFNT_Interface table used to load */\n /* the basic TrueType tables in the face object */\n void* sfnt;\n\n /* a typeless pointer to the FT_Service_PsCMapsRec table used to */\n /* handle glyph names <-> unicode & Mac values */\n void* psnames;\n\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\n /* a typeless pointer to the FT_Service_MultiMasters table used to */\n /* handle variation fonts */\n void* mm;\n\n /* a typeless pointer to the FT_Service_MetricsVariationsRec table */\n /* used to handle the HVAR, VVAR, and MVAR OpenType tables */\n void* var;\n#endif\n\n /* a typeless pointer to the PostScript Aux service */\n void* psaux;\n\n\n /************************************************************************\n *\n * Optional TrueType/OpenType tables\n *\n */\n\n /* grid-fitting and scaling table */\n TT_GaspRec gasp; /* the `gasp' table */\n\n /* PCL 5 table */\n TT_PCLT pclt;\n\n /* embedded bitmaps support */\n FT_ULong num_sbit_scales;\n TT_SBit_Scale sbit_scales;\n\n /* postscript names table */\n TT_Post_NamesRec postscript_names;\n\n /* glyph colors */\n FT_Palette_Data palette_data; /* since 2.10 */\n FT_UShort palette_index;\n FT_Color* palette;\n FT_Bool have_foreground_color;\n FT_Color foreground_color;\n\n\n /************************************************************************\n *\n * TrueType-specific fields (ignored by the CFF driver)\n *\n */\n\n /* the font program, if any */\n FT_ULong font_program_size;\n FT_Byte* font_program;\n\n /* the cvt program, if any */\n FT_ULong cvt_program_size;\n FT_Byte* cvt_program;\n\n /* the original, unscaled, control value table */\n FT_ULong cvt_size;\n FT_Int32* cvt;\n\n /* A pointer to the bytecode interpreter to use. This is also */\n /* used to hook the debugger for the `ttdebug' utility. */\n TT_Interpreter interpreter;\n\n\n /************************************************************************\n *\n * Other tables or fields. This is used by derivative formats like\n * OpenType.\n *\n */\n\n FT_Generic extra;\n\n const char* postscript_name;\n\n FT_ULong glyf_len;\n FT_ULong glyf_offset; /* since 2.7.1 */\n\n FT_Bool is_cff2; /* since 2.7.1 */\n\n#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT\n FT_Bool doblend;\n GX_Blend blend;\n\n FT_UInt32 variation_support; /* since 2.7.1 */\n\n const char* var_postscript_prefix; /* since 2.7.2 */\n FT_UInt var_postscript_prefix_len; /* since 2.7.2 */\n\n#endif\n\n /* since version 2.2 */\n\n FT_ULong horz_metrics_size;\n FT_ULong vert_metrics_size;\n\n FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */\n FT_Byte* glyph_locations;\n\n FT_Byte* hdmx_table;\n FT_ULong hdmx_table_size;\n FT_UInt hdmx_record_count;\n FT_ULong hdmx_record_size;\n FT_Byte* hdmx_record_sizes;\n\n FT_Byte* sbit_table;\n FT_ULong sbit_table_size;\n TT_SbitTableType sbit_table_type;\n FT_UInt sbit_num_strikes;\n FT_UInt* sbit_strike_map;\n\n FT_Byte* kern_table;\n FT_ULong kern_table_size;\n FT_UInt num_kern_tables;\n FT_UInt32 kern_avail_bits;\n FT_UInt32 kern_order_bits;\n\n#ifdef TT_CONFIG_OPTION_BDF\n TT_BDFRec bdf;\n#endif /* TT_CONFIG_OPTION_BDF */\n\n /* since 2.3.0 */\n FT_ULong horz_metrics_offset;\n FT_ULong vert_metrics_offset;\n\n#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY\n /* since 2.4.12 */\n FT_ULong sph_found_func_flags; /* special functions found */\n /* for this face */\n FT_Bool sph_compatibility_mode;\n#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */\n\n#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS\n /* since 2.7 */\n FT_ULong ebdt_start; /* either `CBDT', `EBDT', or `bdat' */\n FT_ULong ebdt_size;\n#endif\n\n /* since 2.10 */\n void* cpal;\n void* colr;\n\n } TT_FaceRec;\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_GlyphZoneRec\n *\n * @description:\n * A glyph zone is used to load, scale and hint glyph outline\n * coordinates.\n *\n * @fields:\n * memory ::\n * A handle to the memory manager.\n *\n * max_points ::\n * The maximum size in points of the zone.\n *\n * max_contours ::\n * Max size in links contours of the zone.\n *\n * n_points ::\n * The current number of points in the zone.\n *\n * n_contours ::\n * The current number of contours in the zone.\n *\n * org ::\n * The original glyph coordinates (font units/scaled).\n *\n * cur ::\n * The current glyph coordinates (scaled/hinted).\n *\n * tags ::\n * The point control tags.\n *\n * contours ::\n * The contours end points.\n *\n * first_point ::\n * Offset of the current subglyph's first point.\n */\n typedef struct TT_GlyphZoneRec_\n {\n FT_Memory memory;\n FT_UShort max_points;\n FT_Short max_contours;\n FT_UShort n_points; /* number of points in zone */\n FT_Short n_contours; /* number of contours */\n\n FT_Vector* org; /* original point coordinates */\n FT_Vector* cur; /* current point coordinates */\n FT_Vector* orus; /* original (unscaled) point coordinates */\n\n FT_Byte* tags; /* current touch flags */\n FT_UShort* contours; /* contour end points */\n\n FT_UShort first_point; /* offset of first (#0) point */\n\n } TT_GlyphZoneRec, *TT_GlyphZone;\n\n\n /* handle to execution context */\n typedef struct TT_ExecContextRec_* TT_ExecContext;\n\n\n /**************************************************************************\n *\n * @type:\n * TT_Size\n *\n * @description:\n * A handle to a TrueType size object.\n */\n typedef struct TT_SizeRec_* TT_Size;\n\n\n /* glyph loader structure */\n typedef struct TT_LoaderRec_\n {\n TT_Face face;\n TT_Size size;\n FT_GlyphSlot glyph;\n FT_GlyphLoader gloader;\n\n FT_ULong load_flags;\n FT_UInt glyph_index;\n\n FT_Stream stream;\n FT_Int byte_len;\n\n FT_Short n_contours;\n FT_BBox bbox;\n FT_Int left_bearing;\n FT_Int advance;\n FT_Int linear;\n FT_Bool linear_def;\n FT_Vector pp1;\n FT_Vector pp2;\n\n /* the zone where we load our glyphs */\n TT_GlyphZoneRec base;\n TT_GlyphZoneRec zone;\n\n TT_ExecContext exec;\n FT_Byte* instructions;\n FT_ULong ins_pos;\n\n /* for possible extensibility in other formats */\n void* other;\n\n /* since version 2.1.8 */\n FT_Int top_bearing;\n FT_Int vadvance;\n FT_Vector pp3;\n FT_Vector pp4;\n\n /* since version 2.2.1 */\n FT_Byte* cursor;\n FT_Byte* limit;\n\n /* since version 2.6.2 */\n FT_ListRec composites;\n\n } TT_LoaderRec;\n\n\nFT_END_HEADER\n\n#endif /* TTTYPES_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/wofftypes.h", "language": "code", "loc": 274, "comment_density": 0.741, "code": "/****************************************************************************\n *\n * wofftypes.h\n *\n * Basic WOFF/WOFF2 type definitions and interface (specification\n * only).\n *\n * Copyright (C) 1996-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef WOFFTYPES_H_\n#define WOFFTYPES_H_\n\n\n#include \n#include FT_TRUETYPE_TABLES_H\n#include FT_INTERNAL_OBJECTS_H\n\n\nFT_BEGIN_HEADER\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF_HeaderRec\n *\n * @description:\n * WOFF file format header.\n *\n * @fields:\n * See\n *\n * https://www.w3.org/TR/WOFF/#WOFFHeader\n */\n typedef struct WOFF_HeaderRec_\n {\n FT_ULong signature;\n FT_ULong flavor;\n FT_ULong length;\n FT_UShort num_tables;\n FT_UShort reserved;\n FT_ULong totalSfntSize;\n FT_UShort majorVersion;\n FT_UShort minorVersion;\n FT_ULong metaOffset;\n FT_ULong metaLength;\n FT_ULong metaOrigLength;\n FT_ULong privOffset;\n FT_ULong privLength;\n\n } WOFF_HeaderRec, *WOFF_Header;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF_TableRec\n *\n * @description:\n * This structure describes a given table of a WOFF font.\n *\n * @fields:\n * Tag ::\n * A four-bytes tag describing the table.\n *\n * Offset ::\n * The offset of the table from the start of the WOFF font in its\n * resource.\n *\n * CompLength ::\n * Compressed table length (in bytes).\n *\n * OrigLength ::\n * Uncompressed table length (in bytes).\n *\n * CheckSum ::\n * The table checksum. This value can be ignored.\n *\n * OrigOffset ::\n * The uncompressed table file offset. This value gets computed while\n * constructing the (uncompressed) SFNT header. It is not contained in\n * the WOFF file.\n */\n typedef struct WOFF_TableRec_\n {\n FT_ULong Tag; /* table ID */\n FT_ULong Offset; /* table file offset */\n FT_ULong CompLength; /* compressed table length */\n FT_ULong OrigLength; /* uncompressed table length */\n FT_ULong CheckSum; /* uncompressed checksum */\n\n FT_ULong OrigOffset; /* uncompressed table file offset */\n /* (not in the WOFF file) */\n } WOFF_TableRec, *WOFF_Table;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_TtcFontRec\n *\n * @description:\n * Metadata for a TTC font entry in WOFF2.\n *\n * @fields:\n * flavor ::\n * TTC font flavor.\n *\n * num_tables ::\n * Number of tables in TTC, indicating number of elements in\n * `table_indices`.\n *\n * table_indices ::\n * Array of table indices for each TTC font.\n */\n typedef struct WOFF2_TtcFontRec_\n {\n FT_ULong flavor;\n FT_UShort num_tables;\n FT_UShort* table_indices;\n\n } WOFF2_TtcFontRec, *WOFF2_TtcFont;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_HeaderRec\n *\n * @description:\n * WOFF2 file format header.\n *\n * @fields:\n * See\n *\n * https://www.w3.org/TR/WOFF2/#woff20Header\n *\n * @note:\n * We don't care about the fields `reserved`, `majorVersion` and\n * `minorVersion`, so they are not included. The `totalSfntSize` field\n * does not necessarily represent the actual size of the uncompressed\n * SFNT font stream, so that is used as a reference value instead.\n */\n typedef struct WOFF2_HeaderRec_\n {\n FT_ULong signature;\n FT_ULong flavor;\n FT_ULong length;\n FT_UShort num_tables;\n FT_ULong totalSfntSize;\n FT_ULong totalCompressedSize;\n FT_ULong metaOffset;\n FT_ULong metaLength;\n FT_ULong metaOrigLength;\n FT_ULong privOffset;\n FT_ULong privLength;\n\n FT_ULong uncompressed_size; /* uncompressed brotli stream size */\n FT_ULong compressed_offset; /* compressed stream offset */\n FT_ULong header_version; /* version of original TTC Header */\n FT_UShort num_fonts; /* number of fonts in TTC */\n FT_ULong actual_sfnt_size; /* actual size of sfnt stream */\n\n WOFF2_TtcFont ttc_fonts; /* metadata for fonts in a TTC */\n\n } WOFF2_HeaderRec, *WOFF2_Header;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_TableRec\n *\n * @description:\n * This structure describes a given table of a WOFF2 font.\n *\n * @fields:\n * See\n *\n * https://www.w3.org/TR/WOFF2/#table_dir_format\n */\n typedef struct WOFF2_TableRec_\n {\n FT_Byte FlagByte; /* table type and flags */\n FT_ULong Tag; /* table file offset */\n FT_ULong dst_length; /* uncompressed table length */\n FT_ULong TransformLength; /* transformed length */\n\n FT_ULong flags; /* calculated flags */\n FT_ULong src_offset; /* compressed table offset */\n FT_ULong src_length; /* compressed table length */\n FT_ULong dst_offset; /* uncompressed table offset */\n\n } WOFF2_TableRec, *WOFF2_Table;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_InfoRec\n *\n * @description:\n * Metadata for WOFF2 font that may be required for reconstruction of\n * sfnt tables.\n *\n * @fields:\n * header_checksum ::\n * Checksum of SFNT offset table.\n *\n * num_glyphs ::\n * Number of glyphs in the font.\n *\n * num_hmetrics ::\n * `numberOfHMetrics` field in the 'hhea' table.\n *\n * x_mins ::\n * `xMin` values of glyph bounding box.\n *\n * glyf_table ::\n * A pointer to the `glyf' table record.\n *\n * loca_table ::\n * A pointer to the `loca' table record.\n *\n * head_table ::\n * A pointer to the `head' table record.\n */\n typedef struct WOFF2_InfoRec_\n {\n FT_ULong header_checksum;\n FT_UShort num_glyphs;\n FT_UShort num_hmetrics;\n FT_Short* x_mins;\n\n WOFF2_Table glyf_table;\n WOFF2_Table loca_table;\n WOFF2_Table head_table;\n\n } WOFF2_InfoRec, *WOFF2_Info;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_SubstreamRec\n *\n * @description:\n * This structure stores information about a substream in the transformed\n * 'glyf' table in a WOFF2 stream.\n *\n * @fields:\n * start ::\n * Beginning of the substream relative to uncompressed table stream.\n *\n * offset ::\n * Offset of the substream relative to uncompressed table stream.\n *\n * size ::\n * Size of the substream.\n */\n typedef struct WOFF2_SubstreamRec_\n {\n FT_ULong start;\n FT_ULong offset;\n FT_ULong size;\n\n } WOFF2_SubstreamRec, *WOFF2_Substream;\n\n\n /**************************************************************************\n *\n * @struct:\n * WOFF2_PointRec\n *\n * @description:\n * This structure stores information about a point in the transformed\n * 'glyf' table in a WOFF2 stream.\n *\n * @fields:\n * x ::\n * x-coordinate of point.\n *\n * y ::\n * y-coordinate of point.\n *\n * on_curve ::\n * Set if point is on-curve.\n */\n typedef struct WOFF2_PointRec_\n {\n FT_Int x;\n FT_Int y;\n FT_Bool on_curve;\n\n } WOFF2_PointRec, *WOFF2_Point;\n\n\nFT_END_HEADER\n\n#endif /* WOFFTYPES_H_ */\n\n\n/* END */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.551, "dedup_hash": "aaed5779475365f8", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_freetype_internal_services", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Services", "api": "OpenGL Core", "glsl_version": null, "topic": "shadows", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "includes/freetype/internal/services/svbdf.h", "language": "code", "loc": 46, "comment_density": 0.413, "code": "/****************************************************************************\n *\n * svbdf.h\n *\n * The FreeType BDF services (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVBDF_H_\n#define SVBDF_H_\n\n#include FT_BDF_H\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_BDF \"bdf\"\n\n typedef FT_Error\n (*FT_BDF_GetCharsetIdFunc)( FT_Face face,\n const char* *acharset_encoding,\n const char* *acharset_registry );\n\n typedef FT_Error\n (*FT_BDF_GetPropertyFunc)( FT_Face face,\n const char* prop_name,\n BDF_PropertyRec *aproperty );\n\n\n FT_DEFINE_SERVICE( BDF )\n {\n FT_BDF_GetCharsetIdFunc get_charset_id;\n FT_BDF_GetPropertyFunc get_property;\n };\n\n\n#define FT_DEFINE_SERVICE_BDFRec( class_, \\\n get_charset_id_, \\\n get_property_ ) \\\n static const FT_Service_BDFRec class_ = \\\n { \\\n get_charset_id_, get_property_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVBDF_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svcfftl.h", "language": "code", "loc": 67, "comment_density": 0.254, "code": "/****************************************************************************\n *\n * svcfftl.h\n *\n * The FreeType CFF tables loader service (specification).\n *\n * Copyright (C) 2017-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVCFFTL_H_\n#define SVCFFTL_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_INTERNAL_CFF_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_CFF_LOAD \"cff-load\"\n\n\n typedef FT_UShort\n (*FT_Get_Standard_Encoding_Func)( FT_UInt charcode );\n\n typedef FT_Error\n (*FT_Load_Private_Dict_Func)( CFF_Font font,\n CFF_SubFont subfont,\n FT_UInt lenNDV,\n FT_Fixed* NDV );\n\n typedef FT_Byte\n (*FT_FD_Select_Get_Func)( CFF_FDSelect fdselect,\n FT_UInt glyph_index );\n\n typedef FT_Bool\n (*FT_Blend_Check_Vector_Func)( CFF_Blend blend,\n FT_UInt vsindex,\n FT_UInt lenNDV,\n FT_Fixed* NDV );\n\n typedef FT_Error\n (*FT_Blend_Build_Vector_Func)( CFF_Blend blend,\n FT_UInt vsindex,\n FT_UInt lenNDV,\n FT_Fixed* NDV );\n\n\n FT_DEFINE_SERVICE( CFFLoad )\n {\n FT_Get_Standard_Encoding_Func get_standard_encoding;\n FT_Load_Private_Dict_Func load_private_dict;\n FT_FD_Select_Get_Func fd_select_get;\n FT_Blend_Check_Vector_Func blend_check_vector;\n FT_Blend_Build_Vector_Func blend_build_vector;\n };\n\n\n#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \\\n get_standard_encoding_, \\\n load_private_dict_, \\\n fd_select_get_, \\\n blend_check_vector_, \\\n blend_build_vector_ ) \\\n static const FT_Service_CFFLoadRec class_ = \\\n { \\\n get_standard_encoding_, \\\n load_private_dict_, \\\n fd_select_get_, \\\n blend_check_vector_, \\\n blend_build_vector_ \\\n };\n\n\nFT_END_HEADER\n\n\n#endif\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svcid.h", "language": "code", "loc": 51, "comment_density": 0.373, "code": "/****************************************************************************\n *\n * svcid.h\n *\n * The FreeType CID font services (specification).\n *\n * Copyright (C) 2007-2020 by\n * Derek Clegg and Michael Toftdal.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVCID_H_\n#define SVCID_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_CID \"CID\"\n\n typedef FT_Error\n (*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face face,\n const char* *registry,\n const char* *ordering,\n FT_Int *supplement );\n typedef FT_Error\n (*FT_CID_GetIsInternallyCIDKeyedFunc)( FT_Face face,\n FT_Bool *is_cid );\n typedef FT_Error\n (*FT_CID_GetCIDFromGlyphIndexFunc)( FT_Face face,\n FT_UInt glyph_index,\n FT_UInt *cid );\n\n FT_DEFINE_SERVICE( CID )\n {\n FT_CID_GetRegistryOrderingSupplementFunc get_ros;\n FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid;\n FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index;\n };\n\n\n#define FT_DEFINE_SERVICE_CIDREC( class_, \\\n get_ros_, \\\n get_is_cid_, \\\n get_cid_from_glyph_index_ ) \\\n static const FT_Service_CIDRec class_ = \\\n { \\\n get_ros_, get_is_cid_, get_cid_from_glyph_index_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVCID_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svfntfmt.h", "language": "code", "loc": 39, "comment_density": 0.615, "code": "/****************************************************************************\n *\n * svfntfmt.h\n *\n * The FreeType font format service (specification only).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVFNTFMT_H_\n#define SVFNTFMT_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * A trivial service used to return the name of a face's font driver,\n * according to the XFree86 nomenclature. Note that the service data is a\n * simple constant string pointer.\n */\n\n#define FT_SERVICE_ID_FONT_FORMAT \"font-format\"\n\n#define FT_FONT_FORMAT_TRUETYPE \"TrueType\"\n#define FT_FONT_FORMAT_TYPE_1 \"Type 1\"\n#define FT_FONT_FORMAT_BDF \"BDF\"\n#define FT_FONT_FORMAT_PCF \"PCF\"\n#define FT_FONT_FORMAT_TYPE_42 \"Type 42\"\n#define FT_FONT_FORMAT_CID \"CID Type 1\"\n#define FT_FONT_FORMAT_CFF \"CFF\"\n#define FT_FONT_FORMAT_PFR \"PFR\"\n#define FT_FONT_FORMAT_WINFNT \"Windows FNT\"\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVFNTFMT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svgldict.h", "language": "code", "loc": 50, "comment_density": 0.5, "code": "/****************************************************************************\n *\n * svgldict.h\n *\n * The FreeType glyph dictionary services (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVGLDICT_H_\n#define SVGLDICT_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * A service used to retrieve glyph names, as well as to find the index of\n * a given glyph name in a font.\n *\n */\n\n#define FT_SERVICE_ID_GLYPH_DICT \"glyph-dict\"\n\n\n typedef FT_Error\n (*FT_GlyphDict_GetNameFunc)( FT_Face face,\n FT_UInt glyph_index,\n FT_Pointer buffer,\n FT_UInt buffer_max );\n\n typedef FT_UInt\n (*FT_GlyphDict_NameIndexFunc)( FT_Face face,\n const FT_String* glyph_name );\n\n\n FT_DEFINE_SERVICE( GlyphDict )\n {\n FT_GlyphDict_GetNameFunc get_name;\n FT_GlyphDict_NameIndexFunc name_index; /* optional */\n };\n\n\n#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \\\n get_name_, \\\n name_index_ ) \\\n static const FT_Service_GlyphDictRec class_ = \\\n { \\\n get_name_, name_index_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVGLDICT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svgxval.h", "language": "code", "loc": 52, "comment_density": 0.519, "code": "/****************************************************************************\n *\n * svgxval.h\n *\n * FreeType API for validating TrueTypeGX/AAT tables (specification).\n *\n * Copyright (C) 2004-2020 by\n * Masatake YAMATO, Red Hat K.K.,\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n/****************************************************************************\n *\n * gxvalid is derived from both gxlayout module and otvalid module.\n * Development of gxlayout is supported by the Information-technology\n * Promotion Agency(IPA), Japan.\n *\n */\n\n\n#ifndef SVGXVAL_H_\n#define SVGXVAL_H_\n\n#include FT_GX_VALIDATE_H\n#include FT_INTERNAL_VALIDATE_H\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_GX_VALIDATE \"truetypegx-validate\"\n#define FT_SERVICE_ID_CLASSICKERN_VALIDATE \"classickern-validate\"\n\n typedef FT_Error\n (*gxv_validate_func)( FT_Face face,\n FT_UInt gx_flags,\n FT_Bytes tables[FT_VALIDATE_GX_LENGTH],\n FT_UInt table_length );\n\n\n typedef FT_Error\n (*ckern_validate_func)( FT_Face face,\n FT_UInt ckern_flags,\n FT_Bytes *ckern_table );\n\n\n FT_DEFINE_SERVICE( GXvalidate )\n {\n gxv_validate_func validate;\n };\n\n FT_DEFINE_SERVICE( CKERNvalidate )\n {\n ckern_validate_func validate;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVGXVAL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svkern.h", "language": "code", "loc": 35, "comment_density": 0.543, "code": "/****************************************************************************\n *\n * svkern.h\n *\n * The FreeType Kerning service (specification).\n *\n * Copyright (C) 2006-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVKERN_H_\n#define SVKERN_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_TRUETYPE_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n#define FT_SERVICE_ID_KERNING \"kerning\"\n\n\n typedef FT_Error\n (*FT_Kerning_TrackGetFunc)( FT_Face face,\n FT_Fixed point_size,\n FT_Int degree,\n FT_Fixed* akerning );\n\n FT_DEFINE_SERVICE( Kerning )\n {\n FT_Kerning_TrackGetFunc get_track;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVKERN_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svmetric.h", "language": "code", "loc": 93, "comment_density": 0.28, "code": "/****************************************************************************\n *\n * svmetric.h\n *\n * The FreeType services for metrics variations (specification).\n *\n * Copyright (C) 2016-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVMETRIC_H_\n#define SVMETRIC_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * A service to manage the `HVAR, `MVAR', and `VVAR' OpenType tables.\n *\n */\n\n#define FT_SERVICE_ID_METRICS_VARIATIONS \"metrics-variations\"\n\n\n /* HVAR */\n\n typedef FT_Error\n (*FT_HAdvance_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_LSB_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_RSB_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n /* VVAR */\n\n typedef FT_Error\n (*FT_VAdvance_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_TSB_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_BSB_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n typedef FT_Error\n (*FT_VOrg_Adjust_Func)( FT_Face face,\n FT_UInt gindex,\n FT_Int *avalue );\n\n /* MVAR */\n\n typedef void\n (*FT_Metrics_Adjust_Func)( FT_Face face );\n\n\n FT_DEFINE_SERVICE( MetricsVariations )\n {\n FT_HAdvance_Adjust_Func hadvance_adjust;\n FT_LSB_Adjust_Func lsb_adjust;\n FT_RSB_Adjust_Func rsb_adjust;\n\n FT_VAdvance_Adjust_Func vadvance_adjust;\n FT_TSB_Adjust_Func tsb_adjust;\n FT_BSB_Adjust_Func bsb_adjust;\n FT_VOrg_Adjust_Func vorg_adjust;\n\n FT_Metrics_Adjust_Func metrics_adjust;\n };\n\n\n#define FT_DEFINE_SERVICE_METRICSVARIATIONSREC( class_, \\\n hadvance_adjust_, \\\n lsb_adjust_, \\\n rsb_adjust_, \\\n vadvance_adjust_, \\\n tsb_adjust_, \\\n bsb_adjust_, \\\n vorg_adjust_, \\\n metrics_adjust_ ) \\\n static const FT_Service_MetricsVariationsRec class_ = \\\n { \\\n hadvance_adjust_, \\\n lsb_adjust_, \\\n rsb_adjust_, \\\n vadvance_adjust_, \\\n tsb_adjust_, \\\n bsb_adjust_, \\\n vorg_adjust_, \\\n metrics_adjust_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* SVMETRIC_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svmm.h", "language": "code", "loc": 124, "comment_density": 0.242, "code": "/****************************************************************************\n *\n * svmm.h\n *\n * The FreeType Multiple Masters and GX var services (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVMM_H_\n#define SVMM_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * A service used to manage multiple-masters data in a given face.\n *\n * See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).\n *\n */\n\n#define FT_SERVICE_ID_MULTI_MASTERS \"multi-masters\"\n\n\n typedef FT_Error\n (*FT_Get_MM_Func)( FT_Face face,\n FT_Multi_Master* master );\n\n typedef FT_Error\n (*FT_Get_MM_Var_Func)( FT_Face face,\n FT_MM_Var* *master );\n\n typedef FT_Error\n (*FT_Set_MM_Design_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Long* coords );\n\n /* use return value -1 to indicate that the new coordinates */\n /* are equal to the current ones; no changes are thus needed */\n typedef FT_Error\n (*FT_Set_Var_Design_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n /* use return value -1 to indicate that the new coordinates */\n /* are equal to the current ones; no changes are thus needed */\n typedef FT_Error\n (*FT_Set_MM_Blend_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Long* coords );\n\n typedef FT_Error\n (*FT_Get_Var_Design_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Fixed* coords );\n\n typedef FT_Error\n (*FT_Set_Instance_Func)( FT_Face face,\n FT_UInt instance_index );\n\n typedef FT_Error\n (*FT_Get_MM_Blend_Func)( FT_Face face,\n FT_UInt num_coords,\n FT_Long* coords );\n\n typedef FT_Error\n (*FT_Get_Var_Blend_Func)( FT_Face face,\n FT_UInt *num_coords,\n FT_Fixed* *coords,\n FT_Fixed* *normalizedcoords,\n FT_MM_Var* *mm_var );\n\n typedef void\n (*FT_Done_Blend_Func)( FT_Face );\n\n typedef FT_Error\n (*FT_Set_MM_WeightVector_Func)( FT_Face face,\n FT_UInt len,\n FT_Fixed* weight_vector );\n\n typedef FT_Error\n (*FT_Get_MM_WeightVector_Func)( FT_Face face,\n FT_UInt* len,\n FT_Fixed* weight_vector );\n\n\n FT_DEFINE_SERVICE( MultiMasters )\n {\n FT_Get_MM_Func get_mm;\n FT_Set_MM_Design_Func set_mm_design;\n FT_Set_MM_Blend_Func set_mm_blend;\n FT_Get_MM_Blend_Func get_mm_blend;\n FT_Get_MM_Var_Func get_mm_var;\n FT_Set_Var_Design_Func set_var_design;\n FT_Get_Var_Design_Func get_var_design;\n FT_Set_Instance_Func set_instance;\n FT_Set_MM_WeightVector_Func set_mm_weightvector;\n FT_Get_MM_WeightVector_Func get_mm_weightvector;\n\n /* for internal use; only needed for code sharing between modules */\n FT_Get_Var_Blend_Func get_var_blend;\n FT_Done_Blend_Func done_blend;\n };\n\n\n#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \\\n get_mm_, \\\n set_mm_design_, \\\n set_mm_blend_, \\\n get_mm_blend_, \\\n get_mm_var_, \\\n set_var_design_, \\\n get_var_design_, \\\n set_instance_, \\\n set_weightvector_, \\\n get_weightvector_, \\\n get_var_blend_, \\\n done_blend_ ) \\\n static const FT_Service_MultiMastersRec class_ = \\\n { \\\n get_mm_, \\\n set_mm_design_, \\\n set_mm_blend_, \\\n get_mm_blend_, \\\n get_mm_var_, \\\n set_var_design_, \\\n get_var_design_, \\\n set_instance_, \\\n set_weightvector_, \\\n get_weightvector_, \\\n get_var_blend_, \\\n done_blend_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* SVMM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svotval.h", "language": "code", "loc": 38, "comment_density": 0.5, "code": "/****************************************************************************\n *\n * svotval.h\n *\n * The FreeType OpenType validation service (specification).\n *\n * Copyright (C) 2004-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVOTVAL_H_\n#define SVOTVAL_H_\n\n#include FT_OPENTYPE_VALIDATE_H\n#include FT_INTERNAL_VALIDATE_H\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_OPENTYPE_VALIDATE \"opentype-validate\"\n\n\n typedef FT_Error\n (*otv_validate_func)( FT_Face volatile face,\n FT_UInt ot_flags,\n FT_Bytes *base,\n FT_Bytes *gdef,\n FT_Bytes *gpos,\n FT_Bytes *gsub,\n FT_Bytes *jstf );\n\n\n FT_DEFINE_SERVICE( OTvalidate )\n {\n otv_validate_func validate;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVOTVAL_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svpfr.h", "language": "code", "loc": 47, "comment_density": 0.404, "code": "/****************************************************************************\n *\n * svpfr.h\n *\n * Internal PFR service functions (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPFR_H_\n#define SVPFR_H_\n\n#include FT_PFR_H\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_PFR_METRICS \"pfr-metrics\"\n\n\n typedef FT_Error\n (*FT_PFR_GetMetricsFunc)( FT_Face face,\n FT_UInt *aoutline,\n FT_UInt *ametrics,\n FT_Fixed *ax_scale,\n FT_Fixed *ay_scale );\n\n typedef FT_Error\n (*FT_PFR_GetKerningFunc)( FT_Face face,\n FT_UInt left,\n FT_UInt right,\n FT_Vector *avector );\n\n typedef FT_Error\n (*FT_PFR_GetAdvanceFunc)( FT_Face face,\n FT_UInt gindex,\n FT_Pos *aadvance );\n\n\n FT_DEFINE_SERVICE( PfrMetrics )\n {\n FT_PFR_GetMetricsFunc get_metrics;\n FT_PFR_GetKerningFunc get_kerning;\n FT_PFR_GetAdvanceFunc get_advance;\n\n };\n\n /* */\n\nFT_END_HEADER\n\n#endif /* SVPFR_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svpostnm.h", "language": "code", "loc": 45, "comment_density": 0.622, "code": "/****************************************************************************\n *\n * svpostnm.h\n *\n * The FreeType PostScript name services (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPOSTNM_H_\n#define SVPOSTNM_H_\n\n#include FT_INTERNAL_SERVICE_H\n\n\nFT_BEGIN_HEADER\n\n /*\n * A trivial service used to retrieve the PostScript name of a given font\n * when available. The `get_name' field should never be `NULL`.\n *\n * The corresponding function can return `NULL` to indicate that the\n * PostScript name is not available.\n *\n * The name is owned by the face and will be destroyed with it.\n */\n\n#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME \"postscript-font-name\"\n\n\n typedef const char*\n (*FT_PsName_GetFunc)( FT_Face face );\n\n\n FT_DEFINE_SERVICE( PsFontName )\n {\n FT_PsName_GetFunc get_ps_font_name;\n };\n\n\n#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \\\n static const FT_Service_PsFontNameRec class_ = \\\n { \\\n get_ps_font_name_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVPOSTNM_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svprop.h", "language": "code", "loc": 46, "comment_density": 0.413, "code": "/****************************************************************************\n *\n * svprop.h\n *\n * The FreeType property service (specification).\n *\n * Copyright (C) 2012-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPROP_H_\n#define SVPROP_H_\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_PROPERTIES \"properties\"\n\n\n typedef FT_Error\n (*FT_Properties_SetFunc)( FT_Module module,\n const char* property_name,\n const void* value,\n FT_Bool value_is_string );\n\n typedef FT_Error\n (*FT_Properties_GetFunc)( FT_Module module,\n const char* property_name,\n void* value );\n\n\n FT_DEFINE_SERVICE( Properties )\n {\n FT_Properties_SetFunc set_property;\n FT_Properties_GetFunc get_property;\n };\n\n\n#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \\\n set_property_, \\\n get_property_ ) \\\n static const FT_Service_PropertiesRec class_ = \\\n { \\\n set_property_, \\\n get_property_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVPROP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svpscmap.h", "language": "code", "loc": 108, "comment_density": 0.37, "code": "/****************************************************************************\n *\n * svpscmap.h\n *\n * The FreeType PostScript charmap service (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPSCMAP_H_\n#define SVPSCMAP_H_\n\n#include FT_INTERNAL_OBJECTS_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_POSTSCRIPT_CMAPS \"postscript-cmaps\"\n\n\n /*\n * Adobe glyph name to unicode value.\n */\n typedef FT_UInt32\n (*PS_Unicode_ValueFunc)( const char* glyph_name );\n\n /*\n * Macintosh name id to glyph name. `NULL` if invalid index.\n */\n typedef const char*\n (*PS_Macintosh_NameFunc)( FT_UInt name_index );\n\n /*\n * Adobe standard string ID to glyph name. `NULL` if invalid index.\n */\n typedef const char*\n (*PS_Adobe_Std_StringsFunc)( FT_UInt string_index );\n\n\n /*\n * Simple unicode -> glyph index charmap built from font glyph names table.\n */\n typedef struct PS_UniMap_\n {\n FT_UInt32 unicode; /* bit 31 set: is glyph variant */\n FT_UInt glyph_index;\n\n } PS_UniMap;\n\n\n typedef struct PS_UnicodesRec_* PS_Unicodes;\n\n typedef struct PS_UnicodesRec_\n {\n FT_CMapRec cmap;\n FT_UInt num_maps;\n PS_UniMap* maps;\n\n } PS_UnicodesRec;\n\n\n /*\n * A function which returns a glyph name for a given index. Returns\n * `NULL` if invalid index.\n */\n typedef const char*\n (*PS_GetGlyphNameFunc)( FT_Pointer data,\n FT_UInt string_index );\n\n /*\n * A function used to release the glyph name returned by\n * PS_GetGlyphNameFunc, when needed\n */\n typedef void\n (*PS_FreeGlyphNameFunc)( FT_Pointer data,\n const char* name );\n\n typedef FT_Error\n (*PS_Unicodes_InitFunc)( FT_Memory memory,\n PS_Unicodes unicodes,\n FT_UInt num_glyphs,\n PS_GetGlyphNameFunc get_glyph_name,\n PS_FreeGlyphNameFunc free_glyph_name,\n FT_Pointer glyph_data );\n\n typedef FT_UInt\n (*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes,\n FT_UInt32 unicode );\n\n typedef FT_UInt32\n (*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes,\n FT_UInt32 *unicode );\n\n\n FT_DEFINE_SERVICE( PsCMaps )\n {\n PS_Unicode_ValueFunc unicode_value;\n\n PS_Unicodes_InitFunc unicodes_init;\n PS_Unicodes_CharIndexFunc unicodes_char_index;\n PS_Unicodes_CharNextFunc unicodes_char_next;\n\n PS_Macintosh_NameFunc macintosh_name;\n PS_Adobe_Std_StringsFunc adobe_std_strings;\n const unsigned short* adobe_std_encoding;\n const unsigned short* adobe_expert_encoding;\n };\n\n\n#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \\\n unicode_value_, \\\n unicodes_init_, \\\n unicodes_char_index_, \\\n unicodes_char_next_, \\\n macintosh_name_, \\\n adobe_std_strings_, \\\n adobe_std_encoding_, \\\n adobe_expert_encoding_ ) \\\n static const FT_Service_PsCMapsRec class_ = \\\n { \\\n unicode_value_, unicodes_init_, \\\n unicodes_char_index_, unicodes_char_next_, macintosh_name_, \\\n adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVPSCMAP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svpsinfo.h", "language": "code", "loc": 62, "comment_density": 0.306, "code": "/****************************************************************************\n *\n * svpsinfo.h\n *\n * The FreeType PostScript info service (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVPSINFO_H_\n#define SVPSINFO_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_INTERNAL_TYPE1_TYPES_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_POSTSCRIPT_INFO \"postscript-info\"\n\n\n typedef FT_Error\n (*PS_GetFontInfoFunc)( FT_Face face,\n PS_FontInfoRec* afont_info );\n\n typedef FT_Error\n (*PS_GetFontExtraFunc)( FT_Face face,\n PS_FontExtraRec* afont_extra );\n\n typedef FT_Int\n (*PS_HasGlyphNamesFunc)( FT_Face face );\n\n typedef FT_Error\n (*PS_GetFontPrivateFunc)( FT_Face face,\n PS_PrivateRec* afont_private );\n\n typedef FT_Long\n (*PS_GetFontValueFunc)( FT_Face face,\n PS_Dict_Keys key,\n FT_UInt idx,\n void *value,\n FT_Long value_len );\n\n\n FT_DEFINE_SERVICE( PsInfo )\n {\n PS_GetFontInfoFunc ps_get_font_info;\n PS_GetFontExtraFunc ps_get_font_extra;\n PS_HasGlyphNamesFunc ps_has_glyph_names;\n PS_GetFontPrivateFunc ps_get_font_private;\n PS_GetFontValueFunc ps_get_font_value;\n };\n\n\n#define FT_DEFINE_SERVICE_PSINFOREC( class_, \\\n get_font_info_, \\\n ps_get_font_extra_, \\\n has_glyph_names_, \\\n get_font_private_, \\\n get_font_value_ ) \\\n static const FT_Service_PsInfoRec class_ = \\\n { \\\n get_font_info_, ps_get_font_extra_, has_glyph_names_, \\\n get_font_private_, get_font_value_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVPSINFO_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svsfnt.h", "language": "code", "loc": 64, "comment_density": 0.484, "code": "/****************************************************************************\n *\n * svsfnt.h\n *\n * The FreeType SFNT table loading service (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVSFNT_H_\n#define SVSFNT_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_TRUETYPE_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * SFNT table loading service.\n */\n\n#define FT_SERVICE_ID_SFNT_TABLE \"sfnt-table\"\n\n\n /*\n * Used to implement FT_Load_Sfnt_Table().\n */\n typedef FT_Error\n (*FT_SFNT_TableLoadFunc)( FT_Face face,\n FT_ULong tag,\n FT_Long offset,\n FT_Byte* buffer,\n FT_ULong* length );\n\n /*\n * Used to implement FT_Get_Sfnt_Table().\n */\n typedef void*\n (*FT_SFNT_TableGetFunc)( FT_Face face,\n FT_Sfnt_Tag tag );\n\n\n /*\n * Used to implement FT_Sfnt_Table_Info().\n */\n typedef FT_Error\n (*FT_SFNT_TableInfoFunc)( FT_Face face,\n FT_UInt idx,\n FT_ULong *tag,\n FT_ULong *offset,\n FT_ULong *length );\n\n\n FT_DEFINE_SERVICE( SFNT_Table )\n {\n FT_SFNT_TableLoadFunc load_table;\n FT_SFNT_TableGetFunc get_table;\n FT_SFNT_TableInfoFunc table_info;\n };\n\n\n#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \\\n static const FT_Service_SFNT_TableRec class_ = \\\n { \\\n load_, get_, info_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVSFNT_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svttcmap.h", "language": "code", "loc": 68, "comment_density": 0.647, "code": "/****************************************************************************\n *\n * svttcmap.h\n *\n * The FreeType TrueType/sfnt cmap extra information service.\n *\n * Copyright (C) 2003-2020 by\n * Masatake YAMATO, Redhat K.K.,\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n/* Development of this service is support of\n Information-technology Promotion Agency, Japan. */\n\n#ifndef SVTTCMAP_H_\n#define SVTTCMAP_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_TRUETYPE_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_TT_CMAP \"tt-cmaps\"\n\n\n /**************************************************************************\n *\n * @struct:\n * TT_CMapInfo\n *\n * @description:\n * A structure used to store TrueType/sfnt specific cmap information\n * which is not covered by the generic @FT_CharMap structure. This\n * structure can be accessed with the @FT_Get_TT_CMap_Info function.\n *\n * @fields:\n * language ::\n * The language ID used in Mac fonts. Definitions of values are in\n * `ttnameid.h`.\n *\n * format ::\n * The cmap format. OpenType 1.6 defines the formats 0 (byte encoding\n * table), 2~(high-byte mapping through table), 4~(segment mapping to\n * delta values), 6~(trimmed table mapping), 8~(mixed 16-bit and 32-bit\n * coverage), 10~(trimmed array), 12~(segmented coverage), 13~(last\n * resort font), and 14 (Unicode Variation Sequences).\n */\n typedef struct TT_CMapInfo_\n {\n FT_ULong language;\n FT_Long format;\n\n } TT_CMapInfo;\n\n\n typedef FT_Error\n (*TT_CMap_Info_GetFunc)( FT_CharMap charmap,\n TT_CMapInfo *cmap_info );\n\n\n FT_DEFINE_SERVICE( TTCMaps )\n {\n TT_CMap_Info_GetFunc get_cmap_info;\n };\n\n\n#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \\\n static const FT_Service_TTCMapsRec class_ = \\\n { \\\n get_cmap_info_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* SVTTCMAP_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svtteng.h", "language": "code", "loc": 36, "comment_density": 0.694, "code": "/****************************************************************************\n *\n * svtteng.h\n *\n * The FreeType TrueType engine query service (specification).\n *\n * Copyright (C) 2006-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVTTENG_H_\n#define SVTTENG_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_MODULE_H\n\n\nFT_BEGIN_HEADER\n\n\n /*\n * SFNT table loading service.\n */\n\n#define FT_SERVICE_ID_TRUETYPE_ENGINE \"truetype-engine\"\n\n /*\n * Used to implement FT_Get_TrueType_Engine_Type\n */\n\n FT_DEFINE_SERVICE( TrueTypeEngine )\n {\n FT_TrueTypeEngineType engine_type;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVTTENG_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svttglyf.h", "language": "code", "loc": 39, "comment_density": 0.487, "code": "/****************************************************************************\n *\n * svttglyf.h\n *\n * The FreeType TrueType glyph service.\n *\n * Copyright (C) 2007-2020 by\n * David Turner.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n#ifndef SVTTGLYF_H_\n#define SVTTGLYF_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_TRUETYPE_TABLES_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_TT_GLYF \"tt-glyf\"\n\n\n typedef FT_ULong\n (*TT_Glyf_GetLocationFunc)( FT_Face face,\n FT_UInt gindex,\n FT_ULong *psize );\n\n FT_DEFINE_SERVICE( TTGlyf )\n {\n TT_Glyf_GetLocationFunc get_location;\n };\n\n\n#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \\\n static const FT_Service_TTGlyfRec class_ = \\\n { \\\n get_location_ \\\n };\n\n /* */\n\n\nFT_END_HEADER\n\n#endif /* SVTTGLYF_H_ */\n\n\n/* END */\n"}, {"path": "includes/freetype/internal/services/svwinfnt.h", "language": "code", "loc": 33, "comment_density": 0.576, "code": "/****************************************************************************\n *\n * svwinfnt.h\n *\n * The FreeType Windows FNT/FONT service (specification).\n *\n * Copyright (C) 2003-2020 by\n * David Turner, Robert Wilhelm, and Werner Lemberg.\n *\n * This file is part of the FreeType project, and may only be used,\n * modified, and distributed under the terms of the FreeType project\n * license, LICENSE.TXT. By continuing to use, modify, or distribute\n * this file you indicate that you have read the license and\n * understand and accept it fully.\n *\n */\n\n\n#ifndef SVWINFNT_H_\n#define SVWINFNT_H_\n\n#include FT_INTERNAL_SERVICE_H\n#include FT_WINFONTS_H\n\n\nFT_BEGIN_HEADER\n\n\n#define FT_SERVICE_ID_WINFNT \"winfonts\"\n\n typedef FT_Error\n (*FT_WinFnt_GetHeaderFunc)( FT_Face face,\n FT_WinFNT_HeaderRec *aheader );\n\n\n FT_DEFINE_SERVICE( WinFnt )\n {\n FT_WinFnt_GetHeaderFunc get_header;\n };\n\n /* */\n\n\nFT_END_HEADER\n\n\n#endif /* SVWINFNT_H_ */\n\n\n/* END */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.462, "dedup_hash": "1e65b5b4a99da384", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_gl", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Gl", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/GL/glew.h", "language": "code", "loc": 14144, "comment_density": 0.075, "code": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits \n** Copyright (C) 2002-2008, Marcelo E. Magallon \n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n** this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n** this list of conditions and the following disclaimer in the documentation \n** and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n** derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n * Mesa 3-D graphics library\n * Version: 7.0\n *\n * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __glew_h__\n#define __glew_h__\n#define __GLEW_H__\n\n#if defined(__gl_h_) || defined(__GL_H__) || defined(__X_GL_H)\n#error gl.h included before glew.h\n#endif\n#if defined(__REGAL_H__)\n#error Regal.h included before glew.h\n#endif\n#if defined(__glext_h_) || defined(__GLEXT_H_)\n#error glext.h included before glew.h\n#endif\n#if defined(__gl_ATI_h_)\n#error glATI.h included before glew.h\n#endif\n\n#define __gl_h_\n#define __GL_H__\n#define __REGAL_H__\n#define __X_GL_H\n#define __glext_h_\n#define __GLEXT_H_\n#define __gl_ATI_h_\n\n#if defined(_WIN32)\n\n/*\n * GLEW does not include to avoid name space pollution.\n * GL needs GLAPI and GLAPIENTRY, GLU needs APIENTRY, CALLBACK, and wchar_t\n * defined properly.\n */\n/* */\n#ifndef APIENTRY\n#define GLEW_APIENTRY_DEFINED\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n# define APIENTRY __stdcall\n# elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__)\n# define APIENTRY __stdcall\n# else\n# define APIENTRY\n# endif\n#endif\n#ifndef GLAPI\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n# define GLAPI extern\n# endif\n#endif\n/* */\n#ifndef CALLBACK\n#define GLEW_CALLBACK_DEFINED\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n# define CALLBACK __attribute__ ((__stdcall__))\n# elif (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)\n# define CALLBACK __stdcall\n# else\n# define CALLBACK\n# endif\n#endif\n/* and */\n#ifndef WINGDIAPI\n#define GLEW_WINGDIAPI_DEFINED\n#define WINGDIAPI __declspec(dllimport)\n#endif\n/* */\n#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(_WCHAR_T_DEFINED)\ntypedef unsigned short wchar_t;\n# define _WCHAR_T_DEFINED\n#endif\n/* */\n#if !defined(_W64)\n# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && defined(_MSC_VER) && _MSC_VER >= 1300\n# define _W64 __w64\n# else\n# define _W64\n# endif\n#endif\n#if !defined(_PTRDIFF_T_DEFINED) && !defined(_PTRDIFF_T_) && !defined(__MINGW64__)\n# ifdef _WIN64\ntypedef __int64 ptrdiff_t;\n# else\ntypedef _W64 int ptrdiff_t;\n# endif\n# define _PTRDIFF_T_DEFINED\n# define _PTRDIFF_T_\n#endif\n\n#ifndef GLAPI\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n# define GLAPI extern\n# else\n# define GLAPI WINGDIAPI\n# endif\n#endif\n\n#ifndef GLAPIENTRY\n#define GLAPIENTRY APIENTRY\n#endif\n\n#ifndef GLEWAPIENTRY\n#define GLEWAPIENTRY APIENTRY\n#endif\n\n/*\n * GLEW_STATIC is defined for static library.\n * GLEW_BUILD is defined for building the DLL library.\n */\n\n#ifdef GLEW_STATIC\n# define GLEWAPI extern\n#else\n# ifdef GLEW_BUILD\n# define GLEWAPI extern __declspec(dllexport)\n# else\n# define GLEWAPI extern __declspec(dllimport)\n# endif\n#endif\n\n#else /* _UNIX */\n\n/*\n * Needed for ptrdiff_t in turn needed by VBO. This is defined by ISO\n * C. On my system, this amounts to _3 lines_ of included code, all of\n * them pretty much harmless. If you know of a way of detecting 32 vs\n * 64 _targets_ at compile time you are free to replace this with\n * something that's portable. For now, _this_ is the portable solution.\n * (mem, 2004-01-04)\n */\n\n#include \n\n/* SGI MIPSPro doesn't like stdint.h in C++ mode */\n/* ID: 3376260 Solaris 9 has inttypes.h, but not stdint.h */\n\n#if (defined(__sgi) || defined(__sun)) && !defined(__GNUC__)\n#include \n#else\n#include \n#endif\n\n#define GLEW_APIENTRY_DEFINED\n#define APIENTRY\n\n/*\n * GLEW_STATIC is defined for static library.\n */\n\n#ifdef GLEW_STATIC\n# define GLEWAPI extern\n#else\n# if defined(__GNUC__) && __GNUC__>=4\n# define GLEWAPI extern __attribute__ ((visibility(\"default\")))\n# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)\n# define GLEWAPI extern __global\n# else\n# define GLEWAPI extern\n# endif\n#endif\n\n/* */\n#ifndef GLAPI\n#define GLAPI extern\n#endif\n\n#ifndef GLAPIENTRY\n#define GLAPIENTRY\n#endif\n\n#ifndef GLEWAPIENTRY\n#define GLEWAPIENTRY\n#endif\n\n#endif /* _WIN32 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* ----------------------------- GL_VERSION_1_1 ---------------------------- */\n\n#ifndef GL_VERSION_1_1\n#define GL_VERSION_1_1 1\n\ntypedef unsigned int GLenum;\ntypedef unsigned int GLbitfield;\ntypedef unsigned int GLuint;\ntypedef int GLint;\ntypedef int GLsizei;\ntypedef unsigned char GLboolean;\ntypedef signed char GLbyte;\ntypedef short GLshort;\ntypedef unsigned char GLubyte;\ntypedef unsigned short GLushort;\ntypedef unsigned long GLulong;\ntypedef float GLfloat;\ntypedef float GLclampf;\ntypedef double GLdouble;\ntypedef double GLclampd;\ntypedef void GLvoid;\n#if defined(_MSC_VER) && _MSC_VER < 1400\ntypedef __int64 GLint64EXT;\ntypedef unsigned __int64 GLuint64EXT;\n#elif defined(_MSC_VER) || defined(__BORLANDC__)\ntypedef signed long long GLint64EXT;\ntypedef unsigned long long GLuint64EXT;\n#else\n# if defined(__MINGW32__) || defined(__CYGWIN__)\n#include \n# endif\ntypedef int64_t GLint64EXT;\ntypedef uint64_t GLuint64EXT;\n#endif\ntypedef GLint64EXT GLint64;\ntypedef GLuint64EXT GLuint64;\ntypedef struct __GLsync *GLsync;\n\ntypedef char GLchar;\n\n#define GL_ZERO 0\n#define GL_FALSE 0\n#define GL_LOGIC_OP 0x0BF1\n#define GL_NONE 0\n#define GL_TEXTURE_COMPONENTS 0x1003\n#define GL_NO_ERROR 0\n#define GL_POINTS 0x0000\n#define GL_CURRENT_BIT 0x00000001\n#define GL_TRUE 1\n#define GL_ONE 1\n#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001\n#define GL_LINES 0x0001\n#define GL_LINE_LOOP 0x0002\n#define GL_POINT_BIT 0x00000002\n#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002\n#define GL_LINE_STRIP 0x0003\n#define GL_LINE_BIT 0x00000004\n#define GL_TRIANGLES 0x0004\n#define GL_TRIANGLE_STRIP 0x0005\n#define GL_TRIANGLE_FAN 0x0006\n#define GL_QUADS 0x0007\n#define GL_QUAD_STRIP 0x0008\n#define GL_POLYGON_BIT 0x00000008\n#define GL_POLYGON 0x0009\n#define GL_POLYGON_STIPPLE_BIT 0x00000010\n#define GL_PIXEL_MODE_BIT 0x00000020\n#define GL_LIGHTING_BIT 0x00000040\n#define GL_FOG_BIT 0x00000080\n#define GL_DEPTH_BUFFER_BIT 0x00000100\n#define GL_ACCUM 0x0100\n#define GL_LOAD 0x0101\n#define GL_RETURN 0x0102\n#define GL_MULT 0x0103\n#define GL_ADD 0x0104\n#define GL_NEVER 0x0200\n#define GL_ACCUM_BUFFER_BIT 0x00000200\n#define GL_LESS 0x0201\n#define GL_EQUAL 0x0202\n#define GL_LEQUAL 0x0203\n#define GL_GREATER 0x0204\n#define GL_NOTEQUAL 0x0205\n#define GL_GEQUAL 0x0206\n#define GL_ALWAYS 0x0207\n#define GL_SRC_COLOR 0x0300\n#define GL_ONE_MINUS_SRC_COLOR 0x0301\n#define GL_SRC_ALPHA 0x0302\n#define GL_ONE_MINUS_SRC_ALPHA 0x0303\n#define GL_DST_ALPHA 0x0304\n#define GL_ONE_MINUS_DST_ALPHA 0x0305\n#define GL_DST_COLOR 0x0306\n#define GL_ONE_MINUS_DST_COLOR 0x0307\n#define GL_SRC_ALPHA_SATURATE 0x0308\n#define GL_STENCIL_BUFFER_BIT 0x00000400\n#define GL_FRONT_LEFT 0x0400\n#define GL_FRONT_RIGHT 0x0401\n#define GL_BACK_LEFT 0x0402\n#define GL_BACK_RIGHT 0x0403\n#define GL_FRONT 0x0404\n#define GL_BACK 0x0405\n#define GL_LEFT 0x0406\n#define GL_RIGHT 0x0407\n#define GL_FRONT_AND_BACK 0x0408\n#define GL_AUX0 0x0409\n#define GL_AUX1 0x040A\n#define GL_AUX2 0x040B\n#define GL_AUX3 0x040C\n#define GL_INVALID_ENUM 0x0500\n#define GL_INVALID_VALUE 0x0501\n#define GL_INVALID_OPERATION 0x0502\n#define GL_STACK_OVERFLOW 0x0503\n#define GL_STACK_UNDERFLOW 0x0504\n#define GL_OUT_OF_MEMORY 0x0505\n#define GL_2D 0x0600\n#define GL_3D 0x0601\n#define GL_3D_COLOR 0x0602\n#define GL_3D_COLOR_TEXTURE 0x0603\n#define GL_4D_COLOR_TEXTURE 0x0604\n#define GL_PASS_THROUGH_TOKEN 0x0700\n#define GL_POINT_TOKEN 0x0701\n#define GL_LINE_TOKEN 0x0702\n#define GL_POLYGON_TOKEN 0x0703\n#define GL_BITMAP_TOKEN 0x0704\n#define GL_DRAW_PIXEL_TOKEN 0x0705\n#define GL_COPY_PIXEL_TOKEN 0x0706\n#define GL_LINE_RESET_TOKEN 0x0707\n#define GL_EXP 0x0800\n#define GL_VIEWPORT_BIT 0x00000800\n#define GL_EXP2 0x0801\n#define GL_CW 0x0900\n#define GL_CCW 0x0901\n#define GL_COEFF 0x0A00\n#define GL_ORDER 0x0A01\n#define GL_DOMAIN 0x0A02\n#define GL_CURRENT_COLOR 0x0B00\n#define GL_CURRENT_INDEX 0x0B01\n#define GL_CURRENT_NORMAL 0x0B02\n#define GL_CURRENT_TEXTURE_COORDS 0x0B03\n#define GL_CURRENT_RASTER_COLOR 0x0B04\n#define GL_CURRENT_RASTER_INDEX 0x0B05\n#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06\n#define GL_CURRENT_RASTER_POSITION 0x0B07\n#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08\n#define GL_CURRENT_RASTER_DISTANCE 0x0B09\n#define GL_POINT_SMOOTH 0x0B10\n#define GL_POINT_SIZE 0x0B11\n#define GL_POINT_SIZE_RANGE 0x0B12\n#define GL_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_LINE_SMOOTH 0x0B20\n#define GL_LINE_WIDTH 0x0B21\n#define GL_LINE_WIDTH_RANGE 0x0B22\n#define GL_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_LINE_STIPPLE 0x0B24\n#define GL_LINE_STIPPLE_PATTERN 0x0B25\n#define GL_LINE_STIPPLE_REPEAT 0x0B26\n#define GL_LIST_MODE 0x0B30\n#define GL_MAX_LIST_NESTING 0x0B31\n#define GL_LIST_BASE 0x0B32\n#define GL_LIST_INDEX 0x0B33\n#define GL_POLYGON_MODE 0x0B40\n#define GL_POLYGON_SMOOTH 0x0B41\n#define GL_POLYGON_STIPPLE 0x0B42\n#define GL_EDGE_FLAG 0x0B43\n#define GL_CULL_FACE 0x0B44\n#define GL_CULL_FACE_MODE 0x0B45\n#define GL_FRONT_FACE 0x0B46\n#define GL_LIGHTING 0x0B50\n#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51\n#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52\n#define GL_LIGHT_MODEL_AMBIENT 0x0B53\n#define GL_SHADE_MODEL 0x0B54\n#define GL_COLOR_MATERIAL_FACE 0x0B55\n#define GL_COLOR_MATERIAL_PARAMETER 0x0B56\n#define GL_COLOR_MATERIAL 0x0B57\n#define GL_FOG 0x0B60\n#define GL_FOG_INDEX 0x0B61\n#define GL_FOG_DENSITY 0x0B62\n#define GL_FOG_START 0x0B63\n#define GL_FOG_END 0x0B64\n#define GL_FOG_MODE 0x0B65\n#define GL_FOG_COLOR 0x0B66\n#define GL_DEPTH_RANGE 0x0B70\n#define GL_DEPTH_TEST 0x0B71\n#define GL_DEPTH_WRITEMASK 0x0B72\n#define GL_DEPTH_CLEAR_VALUE 0x0B73\n#define GL_DEPTH_FUNC 0x0B74\n#define GL_ACCUM_CLEAR_VALUE 0x0B80\n#define GL_STENCIL_TEST 0x0B90\n#define GL_STENCIL_CLEAR_VALUE 0x0B91\n#define GL_STENCIL_FUNC 0x0B92\n#define GL_STENCIL_VALUE_MASK 0x0B93\n#define GL_STENCIL_FAIL 0x0B94\n#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95\n#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96\n#define GL_STENCIL_REF 0x0B97\n#define GL_STENCIL_WRITEMASK 0x0B98\n#define GL_MATRIX_MODE 0x0BA0\n#define GL_NORMALIZE 0x0BA1\n#define GL_VIEWPORT 0x0BA2\n#define GL_MODELVIEW_STACK_DEPTH 0x0BA3\n#define GL_PROJECTION_STACK_DEPTH 0x0BA4\n#define GL_TEXTURE_STACK_DEPTH 0x0BA5\n#define GL_MODELVIEW_MATRIX 0x0BA6\n#define GL_PROJECTION_MATRIX 0x0BA7\n#define GL_TEXTURE_MATRIX 0x0BA8\n#define GL_ATTRIB_STACK_DEPTH 0x0BB0\n#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1\n#define GL_ALPHA_TEST 0x0BC0\n#define GL_ALPHA_TEST_FUNC 0x0BC1\n#define GL_ALPHA_TEST_REF 0x0BC2\n#define GL_DITHER 0x0BD0\n#define GL_BLEND_DST 0x0BE0\n#define GL_BLEND_SRC 0x0BE1\n#define GL_BLEND 0x0BE2\n#define GL_LOGIC_OP_MODE 0x0BF0\n#define GL_INDEX_LOGIC_OP 0x0BF1\n#define GL_COLOR_LOGIC_OP 0x0BF2\n#define GL_AUX_BUFFERS 0x0C00\n#define GL_DRAW_BUFFER 0x0C01\n#define GL_READ_BUFFER 0x0C02\n#define GL_SCISSOR_BOX 0x0C10\n#define GL_SCISSOR_TEST 0x0C11\n#define GL_INDEX_CLEAR_VALUE 0x0C20\n#define GL_INDEX_WRITEMASK 0x0C21\n#define GL_COLOR_CLEAR_VALUE 0x0C22\n#define GL_COLOR_WRITEMASK 0x0C23\n#define GL_INDEX_MODE 0x0C30\n#define GL_RGBA_MODE 0x0C31\n#define GL_DOUBLEBUFFER 0x0C32\n#define GL_STEREO 0x0C33\n#define GL_RENDER_MODE 0x0C40\n#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50\n#define GL_POINT_SMOOTH_HINT 0x0C51\n#define GL_LINE_SMOOTH_HINT 0x0C52\n#define GL_POLYGON_SMOOTH_HINT 0x0C53\n#define GL_FOG_HINT 0x0C54\n#define GL_TEXTURE_GEN_S 0x0C60\n#define GL_TEXTURE_GEN_T 0x0C61\n#define GL_TEXTURE_GEN_R 0x0C62\n#define GL_TEXTURE_GEN_Q 0x0C63\n#define GL_PIXEL_MAP_I_TO_I 0x0C70\n#define GL_PIXEL_MAP_S_TO_S 0x0C71\n#define GL_PIXEL_MAP_I_TO_R 0x0C72\n#define GL_PIXEL_MAP_I_TO_G 0x0C73\n#define GL_PIXEL_MAP_I_TO_B 0x0C74\n#define GL_PIXEL_MAP_I_TO_A 0x0C75\n#define GL_PIXEL_MAP_R_TO_R 0x0C76\n#define GL_PIXEL_MAP_G_TO_G 0x0C77\n#define GL_PIXEL_MAP_B_TO_B 0x0C78\n#define GL_PIXEL_MAP_A_TO_A 0x0C79\n#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0\n#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1\n#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2\n#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3\n#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4\n#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5\n#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6\n#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7\n#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8\n#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9\n#define GL_UNPACK_SWAP_BYTES 0x0CF0\n#define GL_UNPACK_LSB_FIRST 0x0CF1\n#define GL_UNPACK_ROW_LENGTH 0x0CF2\n#define GL_UNPACK_SKIP_ROWS 0x0CF3\n#define GL_UNPACK_SKIP_PIXELS 0x0CF4\n#define GL_UNPACK_ALIGNMENT 0x0CF5\n#define GL_PACK_SWAP_BYTES 0x0D00\n#define GL_PACK_LSB_FIRST 0x0D01\n#define GL_PACK_ROW_LENGTH 0x0D02\n#define GL_PACK_SKIP_ROWS 0x0D03\n#define GL_PACK_SKIP_PIXELS 0x0D04\n#define GL_PACK_ALIGNMENT 0x0D05\n#define GL_MAP_COLOR 0x0D10\n#define GL_MAP_STENCIL 0x0D11\n#define GL_INDEX_SHIFT 0x0D12\n#define GL_INDEX_OFFSET 0x0D13\n#define GL_RED_SCALE 0x0D14\n#define GL_RED_BIAS 0x0D15\n#define GL_ZOOM_X 0x0D16\n#define GL_ZOOM_Y 0x0D17\n#define GL_GREEN_SCALE 0x0D18\n#define GL_GREEN_BIAS 0x0D19\n#define GL_BLUE_SCALE 0x0D1A\n#define GL_BLUE_BIAS 0x0D1B\n#define GL_ALPHA_SCALE 0x0D1C\n#define GL_ALPHA_BIAS 0x0D1D\n#define GL_DEPTH_SCALE 0x0D1E\n#define GL_DEPTH_BIAS 0x0D1F\n#define GL_MAX_EVAL_ORDER 0x0D30\n#define GL_MAX_LIGHTS 0x0D31\n#define GL_MAX_CLIP_PLANES 0x0D32\n#define GL_MAX_TEXTURE_SIZE 0x0D33\n#define GL_MAX_PIXEL_MAP_TABLE 0x0D34\n#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35\n#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36\n#define GL_MAX_NAME_STACK_DEPTH 0x0D37\n#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38\n#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39\n#define GL_MAX_VIEWPORT_DIMS 0x0D3A\n#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B\n#define GL_SUBPIXEL_BITS 0x0D50\n#define GL_INDEX_BITS 0x0D51\n#define GL_RED_BITS 0x0D52\n#define GL_GREEN_BITS 0x0D53\n#define GL_BLUE_BITS 0x0D54\n#define GL_ALPHA_BITS 0x0D55\n#define GL_DEPTH_BITS 0x0D56\n#define GL_STENCIL_BITS 0x0D57\n#define GL_ACCUM_RED_BITS 0x0D58\n#define GL_ACCUM_GREEN_BITS 0x0D59\n#define GL_ACCUM_BLUE_BITS 0x0D5A\n#define GL_ACCUM_ALPHA_BITS 0x0D5B\n#define GL_NAME_STACK_DEPTH 0x0D70\n#define GL_AUTO_NORMAL 0x0D80\n#define GL_MAP1_COLOR_4 0x0D90\n#define GL_MAP1_INDEX 0x0D91\n#define GL_MAP1_NORMAL 0x0D92\n#define GL_MAP1_TEXTURE_COORD_1 0x0D93\n#define GL_MAP1_TEXTURE_COORD_2 0x0D94\n#define GL_MAP1_TEXTURE_COORD_3 0x0D95\n#define GL_MAP1_TEXTURE_COORD_4 0x0D96\n#define GL_MAP1_VERTEX_3 0x0D97\n#define GL_MAP1_VERTEX_4 0x0D98\n#define GL_MAP2_COLOR_4 0x0DB0\n#define GL_MAP2_INDEX 0x0DB1\n#define GL_MAP2_NORMAL 0x0DB2\n#define GL_MAP2_TEXTURE_COORD_1 0x0DB3\n#define GL_MAP2_TEXTURE_COORD_2 0x0DB4\n#define GL_MAP2_TEXTURE_COORD_3 0x0DB5\n#define GL_MAP2_TEXTURE_COORD_4 0x0DB6\n#define GL_MAP2_VERTEX_3 0x0DB7\n#define GL_MAP2_VERTEX_4 0x0DB8\n#define GL_MAP1_GRID_DOMAIN 0x0DD0\n#define GL_MAP1_GRID_SEGMENTS 0x0DD1\n#define GL_MAP2_GRID_DOMAIN 0x0DD2\n#define GL_MAP2_GRID_SEGMENTS 0x0DD3\n#define GL_TEXTURE_1D 0x0DE0\n#define GL_TEXTURE_2D 0x0DE1\n#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0\n#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1\n#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2\n#define GL_SELECTION_BUFFER_POINTER 0x0DF3\n#define GL_SELECTION_BUFFER_SIZE 0x0DF4\n#define GL_TEXTURE_WIDTH 0x1000\n#define GL_TRANSFORM_BIT 0x00001000\n#define GL_TEXTURE_HEIGHT 0x1001\n#define GL_TEXTURE_INTERNAL_FORMAT 0x1003\n#define GL_TEXTURE_BORDER_COLOR 0x1004\n#define GL_TEXTURE_BORDER 0x1005\n#define GL_DONT_CARE 0x1100\n#define GL_FASTEST 0x1101\n#define GL_NICEST 0x1102\n#define GL_AMBIENT 0x1200\n#define GL_DIFFUSE 0x1201\n#define GL_SPECULAR 0x1202\n#define GL_POSITION 0x1203\n#define GL_SPOT_DIRECTION 0x1204\n#define GL_SPOT_EXPONENT 0x1205\n#define GL_SPOT_CUTOFF 0x1206\n#define GL_CONSTANT_ATTENUATION 0x1207\n#define GL_LINEAR_ATTENUATION 0x1208\n#define GL_QUADRATIC_ATTENUATION 0x1209\n#define GL_COMPILE 0x1300\n#define GL_COMPILE_AND_EXECUTE 0x1301\n#define GL_BYTE 0x1400\n#define GL_UNSIGNED_BYTE 0x1401\n#define GL_SHORT 0x1402\n#define GL_UNSIGNED_SHORT 0x1403\n#define GL_INT 0x1404\n#define GL_UNSIGNED_INT 0x1405\n#define GL_FLOAT 0x1406\n#define GL_2_BYTES 0x1407\n#define GL_3_BYTES 0x1408\n#define GL_4_BYTES 0x1409\n#define GL_DOUBLE 0x140A\n#define GL_CLEAR 0x1500\n#define GL_AND 0x1501\n#define GL_AND_REVERSE 0x1502\n#define GL_COPY 0x1503\n#define GL_AND_INVERTED 0x1504\n#define GL_NOOP 0x1505\n#define GL_XOR 0x1506\n#define GL_OR 0x1507\n#define GL_NOR 0x1508\n#define GL_EQUIV 0x1509\n#define GL_INVERT 0x150A\n#define GL_OR_REVERSE 0x150B\n#define GL_COPY_INVERTED 0x150C\n#define GL_OR_INVERTED 0x150D\n#define GL_NAND 0x150E\n#define GL_SET 0x150F\n#define GL_EMISSION 0x1600\n#define GL_SHININESS 0x1601\n#define GL_AMBIENT_AND_DIFFUSE 0x1602\n#define GL_COLOR_INDEXES 0x1603\n#define GL_MODELVIEW 0x1700\n#define GL_PROJECTION 0x1701\n#define GL_TEXTURE 0x1702\n#define GL_COLOR 0x1800\n#define GL_DEPTH 0x1801\n#define GL_STENCIL 0x1802\n#define GL_COLOR_INDEX 0x1900\n#define GL_STENCIL_INDEX 0x1901\n#define GL_DEPTH_COMPONENT 0x1902\n#define GL_RED 0x1903\n#define GL_GREEN 0x1904\n#define GL_BLUE 0x1905\n#define GL_ALPHA 0x1906\n#define GL_RGB 0x1907\n#define GL_RGBA 0x1908\n#define GL_LUMINANCE 0x1909\n#define GL_LUMINANCE_ALPHA 0x190A\n#define GL_BITMAP 0x1A00\n#define GL_POINT 0x1B00\n#define GL_LINE 0x1B01\n#define GL_FILL 0x1B02\n#define GL_RENDER 0x1C00\n#define GL_FEEDBACK 0x1C01\n#define GL_SELECT 0x1C02\n#define GL_FLAT 0x1D00\n#define GL_SMOOTH 0x1D01\n#define GL_KEEP 0x1E00\n#define GL_REPLACE 0x1E01\n#define GL_INCR 0x1E02\n#define GL_DECR 0x1E03\n#define GL_VENDOR 0x1F00\n#define GL_RENDERER 0x1F01\n#define GL_VERSION 0x1F02\n#define GL_EXTENSIONS 0x1F03\n#define GL_S 0x2000\n#define GL_ENABLE_BIT 0x00002000\n#define GL_T 0x2001\n#define GL_R 0x2002\n#define GL_Q 0x2003\n#define GL_MODULATE 0x2100\n#define GL_DECAL 0x2101\n#define GL_TEXTURE_ENV_MODE 0x2200\n#define GL_TEXTURE_ENV_COLOR 0x2201\n#define GL_TEXTURE_ENV 0x2300\n#define GL_EYE_LINEAR 0x2400\n#define GL_OBJECT_LINEAR 0x2401\n#define GL_SPHERE_MAP 0x2402\n#define GL_TEXTURE_GEN_MODE 0x2500\n#define GL_OBJECT_PLANE 0x2501\n#define GL_EYE_PLANE 0x2502\n#define GL_NEAREST 0x2600\n#define GL_LINEAR 0x2601\n#define GL_NEAREST_MIPMAP_NEAREST 0x2700\n#define GL_LINEAR_MIPMAP_NEAREST 0x2701\n#define GL_NEAREST_MIPMAP_LINEAR 0x2702\n#define GL_LINEAR_MIPMAP_LINEAR 0x2703\n#define GL_TEXTURE_MAG_FILTER 0x2800\n#define GL_TEXTURE_MIN_FILTER 0x2801\n#define GL_TEXTURE_WRAP_S 0x2802\n#define GL_TEXTURE_WRAP_T 0x2803\n#define GL_CLAMP 0x2900\n#define GL_REPEAT 0x2901\n#define GL_POLYGON_OFFSET_UNITS 0x2A00\n#define GL_POLYGON_OFFSET_POINT 0x2A01\n#define GL_POLYGON_OFFSET_LINE 0x2A02\n#define GL_R3_G3_B2 0x2A10\n#define GL_V2F 0x2A20\n#define GL_V3F 0x2A21\n#define GL_C4UB_V2F 0x2A22\n#define GL_C4UB_V3F 0x2A23\n#define GL_C3F_V3F 0x2A24\n#define GL_N3F_V3F 0x2A25\n#define GL_C4F_N3F_V3F 0x2A26\n#define GL_T2F_V3F 0x2A27\n#define GL_T4F_V4F 0x2A28\n#define GL_T2F_C4UB_V3F 0x2A29\n#define GL_T2F_C3F_V3F 0x2A2A\n#define GL_T2F_N3F_V3F 0x2A2B\n#define GL_T2F_C4F_N3F_V3F 0x2A2C\n#define GL_T4F_C4F_N3F_V4F 0x2A2D\n#define GL_CLIP_PLANE0 0x3000\n#define GL_CLIP_PLANE1 0x3001\n#define GL_CLIP_PLANE2 0x3002\n#define GL_CLIP_PLANE3 0x3003\n#define GL_CLIP_PLANE4 0x3004\n#define GL_CLIP_PLANE5 0x3005\n#define GL_LIGHT0 0x4000\n#define GL_COLOR_BUFFER_BIT 0x00004000\n#define GL_LIGHT1 0x4001\n#define GL_LIGHT2 0x4002\n#define GL_LIGHT3 0x4003\n#define GL_LIGHT4 0x4004\n#define GL_LIGHT5 0x4005\n#define GL_LIGHT6 0x4006\n#define GL_LIGHT7 0x4007\n#define GL_HINT_BIT 0x00008000\n#define GL_POLYGON_OFFSET_FILL 0x8037\n#define GL_POLYGON_OFFSET_FACTOR 0x8038\n#define GL_ALPHA4 0x803B\n#define GL_ALPHA8 0x803C\n#define GL_ALPHA12 0x803D\n#define GL_ALPHA16 0x803E\n#define GL_LUMINANCE4 0x803F\n#define GL_LUMINANCE8 0x8040\n#define GL_LUMINANCE12 0x8041\n#define GL_LUMINANCE16 0x8042\n#define GL_LUMINANCE4_ALPHA4 0x8043\n#define GL_LUMINANCE6_ALPHA2 0x8044\n#define GL_LUMINANCE8_ALPHA8 0x8045\n#define GL_LUMINANCE12_ALPHA4 0x8046\n#define GL_LUMINANCE12_ALPHA12 0x8047\n#define GL_LUMINANCE16_ALPHA16 0x8048\n#define GL_INTENSITY 0x8049\n#define GL_INTENSITY4 0x804A\n#define GL_INTENSITY8 0x804B\n#define GL_INTENSITY12 0x804C\n#define GL_INTENSITY16 0x804D\n#define GL_RGB4 0x804F\n#define GL_RGB5 0x8050\n#define GL_RGB8 0x8051\n#define GL_RGB10 0x8052\n#define GL_RGB12 0x8053\n#define GL_RGB16 0x8054\n#define GL_RGBA2 0x8055\n#define GL_RGBA4 0x8056\n#define GL_RGB5_A1 0x8057\n#define GL_RGBA8 0x8058\n#define GL_RGB10_A2 0x8059\n#define GL_RGBA12 0x805A\n#define GL_RGBA16 0x805B\n#define GL_TEXTURE_RED_SIZE 0x805C\n#define GL_TEXTURE_GREEN_SIZE 0x805D\n#define GL_TEXTURE_BLUE_SIZE 0x805E\n#define GL_TEXTURE_ALPHA_SIZE 0x805F\n#define GL_TEXTURE_LUMINANCE_SIZE 0x8060\n#define GL_TEXTURE_INTENSITY_SIZE 0x8061\n#define GL_PROXY_TEXTURE_1D 0x8063\n#define GL_PROXY_TEXTURE_2D 0x8064\n#define GL_TEXTURE_PRIORITY 0x8066\n#define GL_TEXTURE_RESIDENT 0x8067\n#define GL_TEXTURE_BINDING_1D 0x8068\n#define GL_TEXTURE_BINDING_2D 0x8069\n#define GL_VERTEX_ARRAY 0x8074\n#define GL_NORMAL_ARRAY 0x8075\n#define GL_COLOR_ARRAY 0x8076\n#define GL_INDEX_ARRAY 0x8077\n#define GL_TEXTURE_COORD_ARRAY 0x8078\n#define GL_EDGE_FLAG_ARRAY 0x8079\n#define GL_VERTEX_ARRAY_SIZE 0x807A\n#define GL_VERTEX_ARRAY_TYPE 0x807B\n#define GL_VERTEX_ARRAY_STRIDE 0x807C\n#define GL_NORMAL_ARRAY_TYPE 0x807E\n#define GL_NORMAL_ARRAY_STRIDE 0x807F\n#define GL_COLOR_ARRAY_SIZE 0x8081\n#define GL_COLOR_ARRAY_TYPE 0x8082\n#define GL_COLOR_ARRAY_STRIDE 0x8083\n#define GL_INDEX_ARRAY_TYPE 0x8085\n#define GL_INDEX_ARRAY_STRIDE 0x8086\n#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088\n#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089\n#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A\n#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C\n#define GL_VERTEX_ARRAY_POINTER 0x808E\n#define GL_NORMAL_ARRAY_POINTER 0x808F\n#define GL_COLOR_ARRAY_POINTER 0x8090\n#define GL_INDEX_ARRAY_POINTER 0x8091\n#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092\n#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093\n#define GL_COLOR_INDEX1_EXT 0x80E2\n#define GL_COLOR_INDEX2_EXT 0x80E3\n#define GL_COLOR_INDEX4_EXT 0x80E4\n#define GL_COLOR_INDEX8_EXT 0x80E5\n#define GL_COLOR_INDEX12_EXT 0x80E6\n#define GL_COLOR_INDEX16_EXT 0x80E7\n#define GL_EVAL_BIT 0x00010000\n#define GL_LIST_BIT 0x00020000\n#define GL_TEXTURE_BIT 0x00040000\n#define GL_SCISSOR_BIT 0x00080000\n#define GL_ALL_ATTRIB_BITS 0x000fffff\n#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff\n\nGLAPI void GLAPIENTRY glAccum (GLenum op, GLfloat value);\nGLAPI void GLAPIENTRY glAlphaFunc (GLenum func, GLclampf ref);\nGLAPI GLboolean GLAPIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences);\nGLAPI void GLAPIENTRY glArrayElement (GLint i);\nGLAPI void GLAPIENTRY glBegin (GLenum mode);\nGLAPI void GLAPIENTRY glBindTexture (GLenum target, GLuint texture);\nGLAPI void GLAPIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);\nGLAPI void GLAPIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);\nGLAPI void GLAPIENTRY glCallList (GLuint list);\nGLAPI void GLAPIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists);\nGLAPI void GLAPIENTRY glClear (GLbitfield mask);\nGLAPI void GLAPIENTRY glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI void GLAPIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\nGLAPI void GLAPIENTRY glClearDepth (GLclampd depth);\nGLAPI void GLAPIENTRY glClearIndex (GLfloat c);\nGLAPI void GLAPIENTRY glClearStencil (GLint s);\nGLAPI void GLAPIENTRY glClipPlane (GLenum plane, const GLdouble *equation);\nGLAPI void GLAPIENTRY glColor3b (GLbyte red, GLbyte green, GLbyte blue);\nGLAPI void GLAPIENTRY glColor3bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glColor3d (GLdouble red, GLdouble green, GLdouble blue);\nGLAPI void GLAPIENTRY glColor3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glColor3f (GLfloat red, GLfloat green, GLfloat blue);\nGLAPI void GLAPIENTRY glColor3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glColor3i (GLint red, GLint green, GLint blue);\nGLAPI void GLAPIENTRY glColor3iv (const GLint *v);\nGLAPI void GLAPIENTRY glColor3s (GLshort red, GLshort green, GLshort blue);\nGLAPI void GLAPIENTRY glColor3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glColor3ub (GLubyte red, GLubyte green, GLubyte blue);\nGLAPI void GLAPIENTRY glColor3ubv (const GLubyte *v);\nGLAPI void GLAPIENTRY glColor3ui (GLuint red, GLuint green, GLuint blue);\nGLAPI void GLAPIENTRY glColor3uiv (const GLuint *v);\nGLAPI void GLAPIENTRY glColor3us (GLushort red, GLushort green, GLushort blue);\nGLAPI void GLAPIENTRY glColor3usv (const GLushort *v);\nGLAPI void GLAPIENTRY glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);\nGLAPI void GLAPIENTRY glColor4bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);\nGLAPI void GLAPIENTRY glColor4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI void GLAPIENTRY glColor4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glColor4i (GLint red, GLint green, GLint blue, GLint alpha);\nGLAPI void GLAPIENTRY glColor4iv (const GLint *v);\nGLAPI void GLAPIENTRY glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha);\nGLAPI void GLAPIENTRY glColor4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);\nGLAPI void GLAPIENTRY glColor4ubv (const GLubyte *v);\nGLAPI void GLAPIENTRY glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha);\nGLAPI void GLAPIENTRY glColor4uiv (const GLuint *v);\nGLAPI void GLAPIENTRY glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha);\nGLAPI void GLAPIENTRY glColor4usv (const GLushort *v);\nGLAPI void GLAPIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\nGLAPI void GLAPIENTRY glColorMaterial (GLenum face, GLenum mode);\nGLAPI void GLAPIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);\nGLAPI void GLAPIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);\nGLAPI void GLAPIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);\nGLAPI void GLAPIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);\nGLAPI void GLAPIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI void GLAPIENTRY glCullFace (GLenum mode);\nGLAPI void GLAPIENTRY glDeleteLists (GLuint list, GLsizei range);\nGLAPI void GLAPIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);\nGLAPI void GLAPIENTRY glDepthFunc (GLenum func);\nGLAPI void GLAPIENTRY glDepthMask (GLboolean flag);\nGLAPI void GLAPIENTRY glDepthRange (GLclampd zNear, GLclampd zFar);\nGLAPI void GLAPIENTRY glDisable (GLenum cap);\nGLAPI void GLAPIENTRY glDisableClientState (GLenum array);\nGLAPI void GLAPIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);\nGLAPI void GLAPIENTRY glDrawBuffer (GLenum mode);\nGLAPI void GLAPIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);\nGLAPI void GLAPIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glEdgeFlag (GLboolean flag);\nGLAPI void GLAPIENTRY glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glEdgeFlagv (const GLboolean *flag);\nGLAPI void GLAPIENTRY glEnable (GLenum cap);\nGLAPI void GLAPIENTRY glEnableClientState (GLenum array);\nGLAPI void GLAPIENTRY glEnd (void);\nGLAPI void GLAPIENTRY glEndList (void);\nGLAPI void GLAPIENTRY glEvalCoord1d (GLdouble u);\nGLAPI void GLAPIENTRY glEvalCoord1dv (const GLdouble *u);\nGLAPI void GLAPIENTRY glEvalCoord1f (GLfloat u);\nGLAPI void GLAPIENTRY glEvalCoord1fv (const GLfloat *u);\nGLAPI void GLAPIENTRY glEvalCoord2d (GLdouble u, GLdouble v);\nGLAPI void GLAPIENTRY glEvalCoord2dv (const GLdouble *u);\nGLAPI void GLAPIENTRY glEvalCoord2f (GLfloat u, GLfloat v);\nGLAPI void GLAPIENTRY glEvalCoord2fv (const GLfloat *u);\nGLAPI void GLAPIENTRY glEvalMesh1 (GLenum mode, GLint i1, GLint i2);\nGLAPI void GLAPIENTRY glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);\nGLAPI void GLAPIENTRY glEvalPoint1 (GLint i);\nGLAPI void GLAPIENTRY glEvalPoint2 (GLint i, GLint j);\nGLAPI void GLAPIENTRY glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer);\nGLAPI void GLAPIENTRY glFinish (void);\nGLAPI void GLAPIENTRY glFlush (void);\nGLAPI void GLAPIENTRY glFogf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glFogfv (GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glFogi (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glFogiv (GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glFrontFace (GLenum mode);\nGLAPI void GLAPIENTRY glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\nGLAPI GLuint GLAPIENTRY glGenLists (GLsizei range);\nGLAPI void GLAPIENTRY glGenTextures (GLsizei n, GLuint *textures);\nGLAPI void GLAPIENTRY glGetBooleanv (GLenum pname, GLboolean *params);\nGLAPI void GLAPIENTRY glGetClipPlane (GLenum plane, GLdouble *equation);\nGLAPI void GLAPIENTRY glGetDoublev (GLenum pname, GLdouble *params);\nGLAPI GLenum GLAPIENTRY glGetError (void);\nGLAPI void GLAPIENTRY glGetFloatv (GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetIntegerv (GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v);\nGLAPI void GLAPIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v);\nGLAPI void GLAPIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v);\nGLAPI void GLAPIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetPixelMapfv (GLenum map, GLfloat *values);\nGLAPI void GLAPIENTRY glGetPixelMapuiv (GLenum map, GLuint *values);\nGLAPI void GLAPIENTRY glGetPixelMapusv (GLenum map, GLushort *values);\nGLAPI void GLAPIENTRY glGetPointerv (GLenum pname, GLvoid* *params);\nGLAPI void GLAPIENTRY glGetPolygonStipple (GLubyte *mask);\nGLAPI const GLubyte * GLAPIENTRY glGetString (GLenum name);\nGLAPI void GLAPIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params);\nGLAPI void GLAPIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);\nGLAPI void GLAPIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);\nGLAPI void GLAPIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);\nGLAPI void GLAPIENTRY glHint (GLenum target, GLenum mode);\nGLAPI void GLAPIENTRY glIndexMask (GLuint mask);\nGLAPI void GLAPIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glIndexd (GLdouble c);\nGLAPI void GLAPIENTRY glIndexdv (const GLdouble *c);\nGLAPI void GLAPIENTRY glIndexf (GLfloat c);\nGLAPI void GLAPIENTRY glIndexfv (const GLfloat *c);\nGLAPI void GLAPIENTRY glIndexi (GLint c);\nGLAPI void GLAPIENTRY glIndexiv (const GLint *c);\nGLAPI void GLAPIENTRY glIndexs (GLshort c);\nGLAPI void GLAPIENTRY glIndexsv (const GLshort *c);\nGLAPI void GLAPIENTRY glIndexub (GLubyte c);\nGLAPI void GLAPIENTRY glIndexubv (const GLubyte *c);\nGLAPI void GLAPIENTRY glInitNames (void);\nGLAPI void GLAPIENTRY glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer);\nGLAPI GLboolean GLAPIENTRY glIsEnabled (GLenum cap);\nGLAPI GLboolean GLAPIENTRY glIsList (GLuint list);\nGLAPI GLboolean GLAPIENTRY glIsTexture (GLuint texture);\nGLAPI void GLAPIENTRY glLightModelf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glLightModelfv (GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glLightModeli (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glLightModeliv (GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glLighti (GLenum light, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glLightiv (GLenum light, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glLineStipple (GLint factor, GLushort pattern);\nGLAPI void GLAPIENTRY glLineWidth (GLfloat width);\nGLAPI void GLAPIENTRY glListBase (GLuint base);\nGLAPI void GLAPIENTRY glLoadIdentity (void);\nGLAPI void GLAPIENTRY glLoadMatrixd (const GLdouble *m);\nGLAPI void GLAPIENTRY glLoadMatrixf (const GLfloat *m);\nGLAPI void GLAPIENTRY glLoadName (GLuint name);\nGLAPI void GLAPIENTRY glLogicOp (GLenum opcode);\nGLAPI void GLAPIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);\nGLAPI void GLAPIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);\nGLAPI void GLAPIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);\nGLAPI void GLAPIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);\nGLAPI void GLAPIENTRY glMapGrid1d (GLint un, GLdouble u1, GLdouble u2);\nGLAPI void GLAPIENTRY glMapGrid1f (GLint un, GLfloat u1, GLfloat u2);\nGLAPI void GLAPIENTRY glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);\nGLAPI void GLAPIENTRY glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);\nGLAPI void GLAPIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glMateriali (GLenum face, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glMatrixMode (GLenum mode);\nGLAPI void GLAPIENTRY glMultMatrixd (const GLdouble *m);\nGLAPI void GLAPIENTRY glMultMatrixf (const GLfloat *m);\nGLAPI void GLAPIENTRY glNewList (GLuint list, GLenum mode);\nGLAPI void GLAPIENTRY glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz);\nGLAPI void GLAPIENTRY glNormal3bv (const GLbyte *v);\nGLAPI void GLAPIENTRY glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz);\nGLAPI void GLAPIENTRY glNormal3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);\nGLAPI void GLAPIENTRY glNormal3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glNormal3i (GLint nx, GLint ny, GLint nz);\nGLAPI void GLAPIENTRY glNormal3iv (const GLint *v);\nGLAPI void GLAPIENTRY glNormal3s (GLshort nx, GLshort ny, GLshort nz);\nGLAPI void GLAPIENTRY glNormal3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);\nGLAPI void GLAPIENTRY glPassThrough (GLfloat token);\nGLAPI void GLAPIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values);\nGLAPI void GLAPIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values);\nGLAPI void GLAPIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values);\nGLAPI void GLAPIENTRY glPixelStoref (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glPixelStorei (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glPixelTransferf (GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glPixelTransferi (GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glPixelZoom (GLfloat xfactor, GLfloat yfactor);\nGLAPI void GLAPIENTRY glPointSize (GLfloat size);\nGLAPI void GLAPIENTRY glPolygonMode (GLenum face, GLenum mode);\nGLAPI void GLAPIENTRY glPolygonOffset (GLfloat factor, GLfloat units);\nGLAPI void GLAPIENTRY glPolygonStipple (const GLubyte *mask);\nGLAPI void GLAPIENTRY glPopAttrib (void);\nGLAPI void GLAPIENTRY glPopClientAttrib (void);\nGLAPI void GLAPIENTRY glPopMatrix (void);\nGLAPI void GLAPIENTRY glPopName (void);\nGLAPI void GLAPIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities);\nGLAPI void GLAPIENTRY glPushAttrib (GLbitfield mask);\nGLAPI void GLAPIENTRY glPushClientAttrib (GLbitfield mask);\nGLAPI void GLAPIENTRY glPushMatrix (void);\nGLAPI void GLAPIENTRY glPushName (GLuint name);\nGLAPI void GLAPIENTRY glRasterPos2d (GLdouble x, GLdouble y);\nGLAPI void GLAPIENTRY glRasterPos2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos2f (GLfloat x, GLfloat y);\nGLAPI void GLAPIENTRY glRasterPos2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos2i (GLint x, GLint y);\nGLAPI void GLAPIENTRY glRasterPos2iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos2s (GLshort x, GLshort y);\nGLAPI void GLAPIENTRY glRasterPos2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glRasterPos3d (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glRasterPos3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos3f (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glRasterPos3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos3i (GLint x, GLint y, GLint z);\nGLAPI void GLAPIENTRY glRasterPos3iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos3s (GLshort x, GLshort y, GLshort z);\nGLAPI void GLAPIENTRY glRasterPos3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nGLAPI void GLAPIENTRY glRasterPos4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nGLAPI void GLAPIENTRY glRasterPos4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glRasterPos4i (GLint x, GLint y, GLint z, GLint w);\nGLAPI void GLAPIENTRY glRasterPos4iv (const GLint *v);\nGLAPI void GLAPIENTRY glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w);\nGLAPI void GLAPIENTRY glRasterPos4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glReadBuffer (GLenum mode);\nGLAPI void GLAPIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);\nGLAPI void GLAPIENTRY glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);\nGLAPI void GLAPIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2);\nGLAPI void GLAPIENTRY glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);\nGLAPI void GLAPIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2);\nGLAPI void GLAPIENTRY glRecti (GLint x1, GLint y1, GLint x2, GLint y2);\nGLAPI void GLAPIENTRY glRectiv (const GLint *v1, const GLint *v2);\nGLAPI void GLAPIENTRY glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2);\nGLAPI void GLAPIENTRY glRectsv (const GLshort *v1, const GLshort *v2);\nGLAPI GLint GLAPIENTRY glRenderMode (GLenum mode);\nGLAPI void GLAPIENTRY glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glScaled (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI void GLAPIENTRY glSelectBuffer (GLsizei size, GLuint *buffer);\nGLAPI void GLAPIENTRY glShadeModel (GLenum mode);\nGLAPI void GLAPIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);\nGLAPI void GLAPIENTRY glStencilMask (GLuint mask);\nGLAPI void GLAPIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);\nGLAPI void GLAPIENTRY glTexCoord1d (GLdouble s);\nGLAPI void GLAPIENTRY glTexCoord1dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord1f (GLfloat s);\nGLAPI void GLAPIENTRY glTexCoord1fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord1i (GLint s);\nGLAPI void GLAPIENTRY glTexCoord1iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord1s (GLshort s);\nGLAPI void GLAPIENTRY glTexCoord1sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord2d (GLdouble s, GLdouble t);\nGLAPI void GLAPIENTRY glTexCoord2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord2f (GLfloat s, GLfloat t);\nGLAPI void GLAPIENTRY glTexCoord2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord2i (GLint s, GLint t);\nGLAPI void GLAPIENTRY glTexCoord2iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord2s (GLshort s, GLshort t);\nGLAPI void GLAPIENTRY glTexCoord2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord3d (GLdouble s, GLdouble t, GLdouble r);\nGLAPI void GLAPIENTRY glTexCoord3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord3f (GLfloat s, GLfloat t, GLfloat r);\nGLAPI void GLAPIENTRY glTexCoord3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord3i (GLint s, GLint t, GLint r);\nGLAPI void GLAPIENTRY glTexCoord3iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord3s (GLshort s, GLshort t, GLshort r);\nGLAPI void GLAPIENTRY glTexCoord3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q);\nGLAPI void GLAPIENTRY glTexCoord4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q);\nGLAPI void GLAPIENTRY glTexCoord4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glTexCoord4i (GLint s, GLint t, GLint r, GLint q);\nGLAPI void GLAPIENTRY glTexCoord4iv (const GLint *v);\nGLAPI void GLAPIENTRY glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q);\nGLAPI void GLAPIENTRY glTexCoord4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexGend (GLenum coord, GLenum pname, GLdouble param);\nGLAPI void GLAPIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params);\nGLAPI void GLAPIENTRY glTexGenf (GLenum coord, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexGeni (GLenum coord, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);\nGLAPI void GLAPIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);\nGLAPI void GLAPIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);\nGLAPI void GLAPIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);\nGLAPI void GLAPIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);\nGLAPI void GLAPIENTRY glTranslated (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glVertex2d (GLdouble x, GLdouble y);\nGLAPI void GLAPIENTRY glVertex2dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex2f (GLfloat x, GLfloat y);\nGLAPI void GLAPIENTRY glVertex2fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex2i (GLint x, GLint y);\nGLAPI void GLAPIENTRY glVertex2iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex2s (GLshort x, GLshort y);\nGLAPI void GLAPIENTRY glVertex2sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertex3d (GLdouble x, GLdouble y, GLdouble z);\nGLAPI void GLAPIENTRY glVertex3dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex3f (GLfloat x, GLfloat y, GLfloat z);\nGLAPI void GLAPIENTRY glVertex3fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex3i (GLint x, GLint y, GLint z);\nGLAPI void GLAPIENTRY glVertex3iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex3s (GLshort x, GLshort y, GLshort z);\nGLAPI void GLAPIENTRY glVertex3sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nGLAPI void GLAPIENTRY glVertex4dv (const GLdouble *v);\nGLAPI void GLAPIENTRY glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nGLAPI void GLAPIENTRY glVertex4fv (const GLfloat *v);\nGLAPI void GLAPIENTRY glVertex4i (GLint x, GLint y, GLint z, GLint w);\nGLAPI void GLAPIENTRY glVertex4iv (const GLint *v);\nGLAPI void GLAPIENTRY glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w);\nGLAPI void GLAPIENTRY glVertex4sv (const GLshort *v);\nGLAPI void GLAPIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\nGLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);\n\n#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1)\n\n#endif /* GL_VERSION_1_1 */\n\n/* ---------------------------------- GLU ---------------------------------- */\n\n#ifndef GLEW_NO_GLU\n/* this is where we can safely include GLU */\n# if defined(__APPLE__) && defined(__MACH__)\n# include \n# else\n# include \n# endif\n#endif\n\n/* ----------------------------- GL_VERSION_1_2 ---------------------------- */\n\n#ifndef GL_VERSION_1_2\n#define GL_VERSION_1_2 1\n\n#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12\n#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22\n#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_UNSIGNED_BYTE_3_3_2 0x8032\n#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033\n#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034\n#define GL_UNSIGNED_INT_8_8_8_8 0x8035\n#define GL_UNSIGNED_INT_10_10_10_2 0x8036\n#define GL_RESCALE_NORMAL 0x803A\n#define GL_TEXTURE_BINDING_3D 0x806A\n#define GL_PACK_SKIP_IMAGES 0x806B\n#define GL_PACK_IMAGE_HEIGHT 0x806C\n#define GL_UNPACK_SKIP_IMAGES 0x806D\n#define GL_UNPACK_IMAGE_HEIGHT 0x806E\n#define GL_TEXTURE_3D 0x806F\n#define GL_PROXY_TEXTURE_3D 0x8070\n#define GL_TEXTURE_DEPTH 0x8071\n#define GL_TEXTURE_WRAP_R 0x8072\n#define GL_MAX_3D_TEXTURE_SIZE 0x8073\n#define GL_BGR 0x80E0\n#define GL_BGRA 0x80E1\n#define GL_MAX_ELEMENTS_VERTICES 0x80E8\n#define GL_MAX_ELEMENTS_INDICES 0x80E9\n#define GL_CLAMP_TO_EDGE 0x812F\n#define GL_TEXTURE_MIN_LOD 0x813A\n#define GL_TEXTURE_MAX_LOD 0x813B\n#define GL_TEXTURE_BASE_LEVEL 0x813C\n#define GL_TEXTURE_MAX_LEVEL 0x813D\n#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8\n#define GL_SINGLE_COLOR 0x81F9\n#define GL_SEPARATE_SPECULAR_COLOR 0x81FA\n#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362\n#define GL_UNSIGNED_SHORT_5_6_5 0x8363\n#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364\n#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365\n#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366\n#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367\n#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368\n#define GL_ALIASED_POINT_SIZE_RANGE 0x846D\n#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E\n\ntypedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);\ntypedef void (GLAPIENTRY * PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);\ntypedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);\ntypedef void (GLAPIENTRY * PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);\n\n#define glCopyTexSubImage3D GLEW_GET_FUN(__glewCopyTexSubImage3D)\n#define glDrawRangeElements GLEW_GET_FUN(__glewDrawRangeElements)\n#define glTexImage3D GLEW_GET_FUN(__glewTexImage3D)\n#define glTexSubImage3D GLEW_GET_FUN(__glewTexSubImage3D)\n\n#define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2)\n\n#endif /* GL_VERSION_1_2 */\n\n/* ---------------------------- GL_VERSION_1_2_1 --------------------------- */\n\n#ifndef GL_VERSION_1_2_1\n#define GL_VERSION_1_2_1 1\n\n#define GLEW_VERSION_1_2_1 GLEW_GET_VAR(__GLEW_VERSION_1_2_1)\n\n#endif /* GL_VERSION_1_2_1 */\n\n/* ----------------------------- GL_VERSION_1_3 ---------------------------- */\n\n#ifndef GL_VERSION_1_3\n#define GL_VERSION_1_3 1\n\n#define GL_MULTISAMPLE 0x809D\n#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E\n#define GL_SAMPLE_ALPHA_TO_ONE 0x809F\n#define GL_SAMPLE_COVERAGE 0x80A0\n#define GL_SAMPLE_BUFFERS 0x80A8\n#define GL_SAMPLES 0x80A9\n#define GL_SAMPLE_COVERAGE_VALUE 0x80AA\n#define GL_SAMPLE_COVERAGE_INVERT 0x80AB\n#define GL_CLAMP_TO_BORDER 0x812D\n#define GL_TEXTURE0 0x84C0\n#define GL_TEXTURE1 0x84C1\n#define GL_TEXTURE2 0x84C2\n#define GL_TEXTURE3 0x84C3\n#define GL_TEXTURE4 0x84C4\n#define GL_TEXTURE5 0x84C5\n#define GL_TEXTURE6 0x84C6\n#define GL_TEXTURE7 0x84C7\n#define GL_TEXTURE8 0x84C8\n#define GL_TEXTURE9 0x84C9\n#define GL_TEXTURE10 0x84CA\n#define GL_TEXTURE11 0x84CB\n#define GL_TEXTURE12 0x84CC\n#define GL_TEXTURE13 0x84CD\n#define GL_TEXTURE14 0x84CE\n#define GL_TEXTURE15 0x84CF\n#define GL_TEXTURE16 0x84D0\n#define GL_TEXTURE17 0x84D1\n#define GL_TEXTURE18 0x84D2\n#define GL_TEXTURE19 0x84D3\n#define GL_TEXTURE20 0x84D4\n#define GL_TEXTURE21 0x84D5\n#define GL_TEXTURE22 0x84D6\n#define GL_TEXTURE23 0x84D7\n#define GL_TEXTURE24 0x84D8\n#define GL_TEXTURE25 0x84D9\n#define GL_TEXTURE26 0x84DA\n#define GL_TEXTURE27 0x84DB\n#define GL_TEXTURE28 0x84DC\n#define GL_TEXTURE29 0x84DD\n#define GL_TEXTURE30 0x84DE\n#define GL_TEXTURE31 0x84DF\n#define GL_ACTIVE_TEXTURE 0x84E0\n#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1\n#define GL_MAX_TEXTURE_UNITS 0x84E2\n#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3\n#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4\n#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5\n#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6\n#define GL_SUBTRACT 0x84E7\n#define GL_COMPRESSED_ALPHA 0x84E9\n#define GL_COMPRESSED_LUMINANCE 0x84EA\n#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB\n#define GL_COMPRESSED_INTENSITY 0x84EC\n#define GL_COMPRESSED_RGB 0x84ED\n#define GL_COMPRESSED_RGBA 0x84EE\n#define GL_TEXTURE_COMPRESSION_HINT 0x84EF\n#define GL_NORMAL_MAP 0x8511\n#define GL_REFLECTION_MAP 0x8512\n#define GL_TEXTURE_CUBE_MAP 0x8513\n#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A\n#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C\n#define GL_COMBINE 0x8570\n#define GL_COMBINE_RGB 0x8571\n#define GL_COMBINE_ALPHA 0x8572\n#define GL_RGB_SCALE 0x8573\n#define GL_ADD_SIGNED 0x8574\n#define GL_INTERPOLATE 0x8575\n#define GL_CONSTANT 0x8576\n#define GL_PRIMARY_COLOR 0x8577\n#define GL_PREVIOUS 0x8578\n#define GL_SOURCE0_RGB 0x8580\n#define GL_SOURCE1_RGB 0x8581\n#define GL_SOURCE2_RGB 0x8582\n#define GL_SOURCE0_ALPHA 0x8588\n#define GL_SOURCE1_ALPHA 0x8589\n#define GL_SOURCE2_ALPHA 0x858A\n#define GL_OPERAND0_RGB 0x8590\n#define GL_OPERAND1_RGB 0x8591\n#define GL_OPERAND2_RGB 0x8592\n#define GL_OPERAND0_ALPHA 0x8598\n#define GL_OPERAND1_ALPHA 0x8599\n#define GL_OPERAND2_ALPHA 0x859A\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0\n#define GL_TEXTURE_COMPRESSED 0x86A1\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2\n#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3\n#define GL_DOT3_RGB 0x86AE\n#define GL_DOT3_RGBA 0x86AF\n#define GL_MULTISAMPLE_BIT 0x20000000\n\ntypedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture);\ntypedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);\ntypedef void (GLAPIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLvoid *img);\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);\ntypedef void (GLAPIENTRY * PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat m[16]);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);\ntypedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);\n\n#define glActiveTexture GLEW_GET_FUN(__glewActiveTexture)\n#define glClientActiveTexture GLEW_GET_FUN(__glewClientActiveTexture)\n#define glCompressedTexImage1D GLEW_GET_FUN(__glewCompressedTexImage1D)\n#define glCompressedTexImage2D GLEW_GET_FUN(__glewCompressedTexImage2D)\n#define glCompressedTexImage3D GLEW_GET_FUN(__glewCompressedTexImage3D)\n#define glCompressedTexSubImage1D GLEW_GET_FUN(__glewCompressedTexSubImage1D)\n#define glCompressedTexSubImage2D GLEW_GET_FUN(__glewCompressedTexSubImage2D)\n#define glCompressedTexSubImage3D GLEW_GET_FUN(__glewCompressedTexSubImage3D)\n#define glGetCompressedTexImage GLEW_GET_FUN(__glewGetCompressedTexImage)\n#define glLoadTransposeMatrixd GLEW_GET_FUN(__glewLoadTransposeMatrixd)\n#define glLoadTransposeMatrixf GLEW_GET_FUN(__glewLoadTransposeMatrixf)\n#define glMultTransposeMatrixd GLEW_GET_FUN(__glewMultTransposeMatrixd)\n#define glMultTransposeMatrixf GLEW_GET_FUN(__glewMultTransposeMatrixf)\n#define glMultiTexCoord1d GLEW_GET_FUN(__glewMultiTexCoord1d)\n#define glMultiTexCoord1dv GLEW_GET_FUN(__glewMultiTexCoord1dv)\n#define glMultiTexCoord1f GLEW_GET_FUN(__glewMultiTexCoord1f)\n#define glMultiTexCoord1fv GLEW_GET_FUN(__glewMultiTexCoord1fv)\n#define glMultiTexCoord1i GLEW_GET_FUN(__glewMultiTexCoord1i)\n#define glMultiTexCoord1iv GLEW_GET_FUN(__glewMultiTexCoord1iv)\n#define glMultiTexCoord1s GLEW_GET_FUN(__glewMultiTexCoord1s)\n#define glMultiTexCoord1sv GLEW_GET_FUN(__glewMultiTexCoord1sv)\n#define glMultiTexCoord2d GLEW_GET_FUN(__glewMultiTexCoord2d)\n#define glMultiTexCoord2dv GLEW_GET_FUN(__glewMultiTexCoord2dv)\n#define glMultiTexCoord2f GLEW_GET_FUN(__glewMultiTexCoord2f)\n#define glMultiTexCoord2fv GLEW_GET_FUN(__glewMultiTexCoord2fv)\n#define glMultiTexCoord2i GLEW_GET_FUN(__glewMultiTexCoord2i)\n#define glMultiTexCoord2iv GLEW_GET_FUN(__glewMultiTexCoord2iv)\n#define glMultiTexCoord2s GLEW_GET_FUN(__glewMultiTexCoord2s)\n#define glMultiTexCoord2sv GLEW_GET_FUN(__glewMultiTexCoord2sv)\n#define glMultiTexCoord3d GLEW_GET_FUN(__glewMultiTexCoord3d)\n#define glMultiTexCoord3dv GLEW_GET_FUN(__glewMultiTexCoord3dv)\n#define glMultiTexCoord3f GLEW_GET_FUN(__glewMultiTexCoord3f)\n#define glMultiTexCoord3fv GLEW_GET_FUN(__glewMultiTexCoord3fv)\n#define glMultiTexCoord3i GLEW_GET_FUN(__glewMultiTexCoord3i)\n#define glMultiTexCoord3iv GLEW_GET_FUN(__glewMultiTexCoord3iv)\n#define glMultiTexCoord3s GLEW_GET_FUN(__glewMultiTexCoord3s)\n#define glMultiTexCoord3sv GLEW_GET_FUN(__glewMultiTexCoord3sv)\n#define glMultiTexCoord4d GLEW_GET_FUN(__glewMultiTexCoord4d)\n#define glMultiTexCoord4dv GLEW_GET_FUN(__glewMultiTexCoord4dv)\n#define glMultiTexCoord4f GLEW_GET_FUN(__glewMultiTexCoord4f)\n#define glMultiTexCoord4fv GLEW_GET_FUN(__glewMultiTexCoord4fv)\n#define glMultiTexCoord4i GLEW_GET_FUN(__glewMultiTexCoord4i)\n#define glMultiTexCoord4iv GLEW_GET_FUN(__glewMultiTexCoord4iv)\n#define glMultiTexCoord4s GLEW_GET_FUN(__glewMultiTexCoord4s)\n#define glMultiTexCoord4sv GLEW_GET_FUN(__glewMultiTexCoord4sv)\n#define glSampleCoverage GLEW_GET_FUN(__glewSampleCoverage)\n\n#define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3)\n\n#endif /* GL_VERSION_1_3 */\n\n/* ----------------------------- GL_VERSION_1_4 ---------------------------- */\n\n#ifndef GL_VERSION_1_4\n#define GL_VERSION_1_4 1\n\n#define GL_BLEND_DST_RGB 0x80C8\n#define GL_BLEND_SRC_RGB 0x80C9\n#define GL_BLEND_DST_ALPHA 0x80CA\n#define GL_BLEND_SRC_ALPHA 0x80CB\n#define GL_POINT_SIZE_MIN 0x8126\n#define GL_POINT_SIZE_MAX 0x8127\n#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128\n#define GL_POINT_DISTANCE_ATTENUATION 0x8129\n#define GL_GENERATE_MIPMAP 0x8191\n#define GL_GENERATE_MIPMAP_HINT 0x8192\n#define GL_DEPTH_COMPONENT16 0x81A5\n#define GL_DEPTH_COMPONENT24 0x81A6\n#define GL_DEPTH_COMPONENT32 0x81A7\n#define GL_MIRRORED_REPEAT 0x8370\n#define GL_FOG_COORDINATE_SOURCE 0x8450\n#define GL_FOG_COORDINATE 0x8451\n#define GL_FRAGMENT_DEPTH 0x8452\n#define GL_CURRENT_FOG_COORDINATE 0x8453\n#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454\n#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455\n#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456\n#define GL_FOG_COORDINATE_ARRAY 0x8457\n#define GL_COLOR_SUM 0x8458\n#define GL_CURRENT_SECONDARY_COLOR 0x8459\n#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A\n#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C\n#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D\n#define GL_SECONDARY_COLOR_ARRAY 0x845E\n#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD\n#define GL_TEXTURE_FILTER_CONTROL 0x8500\n#define GL_TEXTURE_LOD_BIAS 0x8501\n#define GL_INCR_WRAP 0x8507\n#define GL_DECR_WRAP 0x8508\n#define GL_TEXTURE_DEPTH_SIZE 0x884A\n#define GL_DEPTH_TEXTURE_MODE 0x884B\n#define GL_TEXTURE_COMPARE_MODE 0x884C\n#define GL_TEXTURE_COMPARE_FUNC 0x884D\n#define GL_COMPARE_R_TO_TEXTURE 0x884E\n\ntypedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode);\ntypedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDPROC) (GLdouble coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDDVPROC) (const GLdouble *coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord);\ntypedef void (GLAPIENTRY * PFNGLFOGCOORDFVPROC) (const GLfloat *coord);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);\ntypedef void (GLAPIENTRY * PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei drawcount);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);\ntypedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);\ntypedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2DVPROC) (const GLdouble *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2FVPROC) (const GLfloat *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2IVPROC) (const GLint *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS2SVPROC) (const GLshort *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3DVPROC) (const GLdouble *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3FVPROC) (const GLfloat *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3IVPROC) (const GLint *p);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLWINDOWPOS3SVPROC) (const GLshort *p);\n\n#define glBlendColor GLEW_GET_FUN(__glewBlendColor)\n#define glBlendEquation GLEW_GET_FUN(__glewBlendEquation)\n#define glBlendFuncSeparate GLEW_GET_FUN(__glewBlendFuncSeparate)\n#define glFogCoordPointer GLEW_GET_FUN(__glewFogCoordPointer)\n#define glFogCoordd GLEW_GET_FUN(__glewFogCoordd)\n#define glFogCoorddv GLEW_GET_FUN(__glewFogCoorddv)\n#define glFogCoordf GLEW_GET_FUN(__glewFogCoordf)\n#define glFogCoordfv GLEW_GET_FUN(__glewFogCoordfv)\n#define glMultiDrawArrays GLEW_GET_FUN(__glewMultiDrawArrays)\n#define glMultiDrawElements GLEW_GET_FUN(__glewMultiDrawElements)\n#define glPointParameterf GLEW_GET_FUN(__glewPointParameterf)\n#define glPointParameterfv GLEW_GET_FUN(__glewPointParameterfv)\n#define glPointParameteri GLEW_GET_FUN(__glewPointParameteri)\n#define glPointParameteriv GLEW_GET_FUN(__glewPointParameteriv)\n#define glSecondaryColor3b GLEW_GET_FUN(__glewSecondaryColor3b)\n#define glSecondaryColor3bv GLEW_GET_FUN(__glewSecondaryColor3bv)\n#define glSecondaryColor3d GLEW_GET_FUN(__glewSecondaryColor3d)\n#define glSecondaryColor3dv GLEW_GET_FUN(__glewSecondaryColor3dv)\n#define glSecondaryColor3f GLEW_GET_FUN(__glewSecondaryColor3f)\n#define glSecondaryColor3fv GLEW_GET_FUN(__glewSecondaryColor3fv)\n#define glSecondaryColor3i GLEW_GET_FUN(__glewSecondaryColor3i)\n#define glSecondaryColor3iv GLEW_GET_FUN(__glewSecondaryColor3iv)\n#define glSecondaryColor3s GLEW_GET_FUN(__glewSecondaryColor3s)\n#define glSecondaryColor3sv GLEW_GET_FUN(__glewSecondaryColor3sv)\n#define glSecondaryColor3ub GLEW_GET_FUN(__glewSecondaryColor3ub)\n#define glSecondaryColor3ubv GLEW_GET_FUN(__glewSecondaryColor3ubv)\n#define glSecondaryColor3ui GLEW_GET_FUN(__glewSecondaryColor3ui)\n#define glSecondaryColor3uiv GLEW_GET_FUN(__glewSecondaryColor3uiv)\n#define glSecondaryColor3us GLEW_GET_FUN(__glewSecondaryColor3us)\n#define glSecondaryColor3usv GLEW_GET_FUN(__glewSecondaryColor3usv)\n#define glSecondaryColorPointer GLEW_GET_FUN(__glewSecondaryColorPointer)\n#define glWindowPos2d GLEW_GET_FUN(__glewWindowPos2d)\n#define glWindowPos2dv GLEW_GET_FUN(__glewWindowPos2dv)\n#define glWindowPos2f GLEW_GET_FUN(__glewWindowPos2f)\n#define glWindowPos2fv GLEW_GET_FUN(__glewWindowPos2fv)\n#define glWindowPos2i GLEW_GET_FUN(__glewWindowPos2i)\n#define glWindowPos2iv GLEW_GET_FUN(__glewWindowPos2iv)\n#define glWindowPos2s GLEW_GET_FUN(__glewWindowPos2s)\n#define glWindowPos2sv GLEW_GET_FUN(__glewWindowPos2sv)\n#define glWindowPos3d GLEW_GET_FUN(__glewWindowPos3d)\n#define glWindowPos3dv GLEW_GET_FUN(__glewWindowPos3dv)\n#define glWindowPos3f GLEW_GET_FUN(__glewWindowPos3f)\n#define glWindowPos3fv GLEW_GET_FUN(__glewWindowPos3fv)\n#define glWindowPos3i GLEW_GET_FUN(__glewWindowPos3i)\n#define glWindowPos3iv GLEW_GET_FUN(__glewWindowPos3iv)\n#define glWindowPos3s GLEW_GET_FUN(__glewWindowPos3s)\n#define glWindowPos3sv GLEW_GET_FUN(__glewWindowPos3sv)\n\n#define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4)\n\n#endif /* GL_VERSION_1_4 */\n\n/* ----------------------------- GL_VERSION_1_5 ---------------------------- */\n\n#ifndef GL_VERSION_1_5\n#define GL_VERSION_1_5 1\n\n#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE\n#define GL_FOG_COORD GL_FOG_COORDINATE\n#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY\n#define GL_SRC0_RGB GL_SOURCE0_RGB\n#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER\n#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE\n#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA\n#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE\n#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE\n#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA\n#define GL_SRC1_RGB GL_SOURCE1_RGB\n#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING\n#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA\n#define GL_SRC2_RGB GL_SOURCE2_RGB\n#define GL_BUFFER_SIZE 0x8764\n#define GL_BUFFER_USAGE 0x8765\n#define GL_QUERY_COUNTER_BITS 0x8864\n#define GL_CURRENT_QUERY 0x8865\n#define GL_QUERY_RESULT 0x8866\n#define GL_QUERY_RESULT_AVAILABLE 0x8867\n#define GL_ARRAY_BUFFER 0x8892\n#define GL_ELEMENT_ARRAY_BUFFER 0x8893\n#define GL_ARRAY_BUFFER_BINDING 0x8894\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895\n#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896\n#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897\n#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898\n#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F\n#define GL_READ_ONLY 0x88B8\n#define GL_WRITE_ONLY 0x88B9\n#define GL_READ_WRITE 0x88BA\n#define GL_BUFFER_ACCESS 0x88BB\n#define GL_BUFFER_MAPPED 0x88BC\n#define GL_BUFFER_MAP_POINTER 0x88BD\n#define GL_STREAM_DRAW 0x88E0\n#define GL_STREAM_READ 0x88E1\n#define GL_STREAM_COPY 0x88E2\n#define GL_STATIC_DRAW 0x88E4\n#define GL_STATIC_READ 0x88E5\n#define GL_STATIC_COPY 0x88E6\n#define GL_DYNAMIC_DRAW 0x88E8\n#define GL_DYNAMIC_READ 0x88E9\n#define GL_DYNAMIC_COPY 0x88EA\n#define GL_SAMPLES_PASSED 0x8914\n\ntypedef ptrdiff_t GLintptr;\ntypedef ptrdiff_t GLsizeiptr;\n\ntypedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);\ntypedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);\ntypedef void (GLAPIENTRY * PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);\ntypedef void (GLAPIENTRY * PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint* buffers);\ntypedef void (GLAPIENTRY * PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target);\ntypedef void (GLAPIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint* buffers);\ntypedef void (GLAPIENTRY * PFNGLGENQUERIESPROC) (GLsizei n, GLuint* ids);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid** params);\ntypedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid* data);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint* params);\ntypedef void (GLAPIENTRY * PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint* params);\ntypedef GLboolean (GLAPIENTRY * PFNGLISBUFFERPROC) (GLuint buffer);\ntypedef GLboolean (GLAPIENTRY * PFNGLISQUERYPROC) (GLuint id);\ntypedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);\ntypedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target);\n\n#define glBeginQuery GLEW_GET_FUN(__glewBeginQuery)\n#define glBindBuffer GLEW_GET_FUN(__glewBindBuffer)\n#define glBufferData GLEW_GET_FUN(__glewBufferData)\n#define glBufferSubData GLEW_GET_FUN(__glewBufferSubData)\n#define glDeleteBuffers GLEW_GET_FUN(__glewDeleteBuffers)\n#define glDeleteQueries GLEW_GET_FUN(__glewDeleteQueries)\n#define glEndQuery GLEW_GET_FUN(__glewEndQuery)\n#define glGenBuffers GLEW_GET_FUN(__glewGenBuffers)\n#define glGenQueries GLEW_GET_FUN(__glewGenQueries)\n#define glGetBufferParameteriv GLEW_GET_FUN(__glewGetBufferParameteriv)\n#define glGetBufferPointerv GLEW_GET_FUN(__glewGetBufferPointerv)\n#define glGetBufferSubData GLEW_GET_FUN(__glewGetBufferSubData)\n#define glGetQueryObjectiv GLEW_GET_FUN(__glewGetQueryObjectiv)\n#define glGetQueryObjectuiv GLEW_GET_FUN(__glewGetQueryObjectuiv)\n#define glGetQueryiv GLEW_GET_FUN(__glewGetQueryiv)\n#define glIsBuffer GLEW_GET_FUN(__glewIsBuffer)\n#define glIsQuery GLEW_GET_FUN(__glewIsQuery)\n#define glMapBuffer GLEW_GET_FUN(__glewMapBuffer)\n#define glUnmapBuffer GLEW_GET_FUN(__glewUnmapBuffer)\n\n#define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5)\n\n#endif /* GL_VERSION_1_5 */\n\n/* ----------------------------- GL_VERSION_2_0 ---------------------------- */\n\n#ifndef GL_VERSION_2_0\n#define GL_VERSION_2_0 1\n\n#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625\n#define GL_CURRENT_VERTEX_ATTRIB 0x8626\n#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642\n#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645\n#define GL_STENCIL_BACK_FUNC 0x8800\n#define GL_STENCIL_BACK_FAIL 0x8801\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803\n#define GL_MAX_DRAW_BUFFERS 0x8824\n#define GL_DRAW_BUFFER0 0x8825\n#define GL_DRAW_BUFFER1 0x8826\n#define GL_DRAW_BUFFER2 0x8827\n#define GL_DRAW_BUFFER3 0x8828\n#define GL_DRAW_BUFFER4 0x8829\n#define GL_DRAW_BUFFER5 0x882A\n#define GL_DRAW_BUFFER6 0x882B\n#define GL_DRAW_BUFFER7 0x882C\n#define GL_DRAW_BUFFER8 0x882D\n#define GL_DRAW_BUFFER9 0x882E\n#define GL_DRAW_BUFFER10 0x882F\n#define GL_DRAW_BUFFER11 0x8830\n#define GL_DRAW_BUFFER12 0x8831\n#define GL_DRAW_BUFFER13 0x8832\n#define GL_DRAW_BUFFER14 0x8833\n#define GL_DRAW_BUFFER15 0x8834\n#define GL_BLEND_EQUATION_ALPHA 0x883D\n#define GL_POINT_SPRITE 0x8861\n#define GL_COORD_REPLACE 0x8862\n#define GL_MAX_VERTEX_ATTRIBS 0x8869\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A\n#define GL_MAX_TEXTURE_COORDS 0x8871\n#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872\n#define GL_FRAGMENT_SHADER 0x8B30\n#define GL_VERTEX_SHADER 0x8B31\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A\n#define GL_MAX_VARYING_FLOATS 0x8B4B\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D\n#define GL_SHADER_TYPE 0x8B4F\n#define GL_FLOAT_VEC2 0x8B50\n#define GL_FLOAT_VEC3 0x8B51\n#define GL_FLOAT_VEC4 0x8B52\n#define GL_INT_VEC2 0x8B53\n#define GL_INT_VEC3 0x8B54\n#define GL_INT_VEC4 0x8B55\n#define GL_BOOL 0x8B56\n#define GL_BOOL_VEC2 0x8B57\n#define GL_BOOL_VEC3 0x8B58\n#define GL_BOOL_VEC4 0x8B59\n#define GL_FLOAT_MAT2 0x8B5A\n#define GL_FLOAT_MAT3 0x8B5B\n#define GL_FLOAT_MAT4 0x8B5C\n#define GL_SAMPLER_1D 0x8B5D\n#define GL_SAMPLER_2D 0x8B5E\n#define GL_SAMPLER_3D 0x8B5F\n#define GL_SAMPLER_CUBE 0x8B60\n#define GL_SAMPLER_1D_SHADOW 0x8B61\n#define GL_SAMPLER_2D_SHADOW 0x8B62\n#define GL_DELETE_STATUS 0x8B80\n#define GL_COMPILE_STATUS 0x8B81\n#define GL_LINK_STATUS 0x8B82\n#define GL_VALIDATE_STATUS 0x8B83\n#define GL_INFO_LOG_LENGTH 0x8B84\n#define GL_ATTACHED_SHADERS 0x8B85\n#define GL_ACTIVE_UNIFORMS 0x8B86\n#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87\n#define GL_SHADER_SOURCE_LENGTH 0x8B88\n#define GL_ACTIVE_ATTRIBUTES 0x8B89\n#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B\n#define GL_SHADING_LANGUAGE_VERSION 0x8B8C\n#define GL_CURRENT_PROGRAM 0x8B8D\n#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0\n#define GL_LOWER_LEFT 0x8CA1\n#define GL_UPPER_LEFT 0x8CA2\n#define GL_STENCIL_BACK_REF 0x8CA3\n#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4\n#define GL_STENCIL_BACK_WRITEMASK 0x8CA5\n\ntypedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum, GLenum);\ntypedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader);\ntypedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void);\ntypedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type);\ntypedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);\ntypedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum* bufs);\ntypedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders);\ntypedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);\ntypedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint* param);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLuint obj, GLsizei maxLength, GLsizei* length, GLchar* source);\ntypedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint* param);\ntypedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar* name);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat* params);\ntypedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint* params);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint, GLenum, GLvoid**);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBDVPROC) (GLuint, GLenum, GLdouble*);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint, GLenum, GLfloat*);\ntypedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBIVPROC) (GLuint, GLenum, GLint*);\ntypedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program);\ntypedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader);\ntypedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar** strings, const GLint* lengths);\ntypedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);\ntypedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum, GLuint);\ntypedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);\ntypedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);\ntypedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort* v);\ntypedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer);\n\n#define glAttachShader GLEW_GET_FUN(__glewAttachShader)\n#define glBindAttribLocation GLEW_GET_FUN(__glewBindAttribLocation)\n#define glBlendEquationSeparate GLEW_GET_FUN(__glewBlendEquationSeparate)\n#define glCompileShader GLEW_GET_FUN(__glewCompileShader)\n#define glCreateProgram GLEW_GET_FUN(__glewCreateProgram)\n#define glCreateShader GLEW_GET_FUN(__glewCreateShader)\n#define glDeleteProgram GLEW_GET_FUN(__glewDeleteProgram)\n#define glDeleteShader GLEW_GET_FUN(__glewDeleteShader)\n#define glDetachShader GLEW_GET_FUN(__glewDetachShader)\n#define glDisableVertexAttribArray GLEW_GET_FUN(__glewDisableVertexAttribArray)\n#define glDrawBuffers GLEW_GET_FUN(__glewDrawBuffers)\n#define glEnableVertexAttribArray GLEW_GET_FUN(__glewEnableVertexAttribArray)\n#define glGetActiveAttrib GLEW_GET_FUN(__glewGetActiveAttrib)\n#define glGetActiveUniform GLEW_GET_FUN(__glewGetActiveUniform)\n#define glGetAttachedShaders GLEW_GET_FUN(__glewGetAttachedShaders)\n#define glGetAttribLocation GLEW_GET_FUN(__glewGetAttribLocation)\n#define glGetProgramInfoLog GLEW_GET_FUN(__glewGetProgramInfoLog)\n#define glGetProgramiv GLEW_GET_FUN(__glewGetProgramiv)\n#define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog)\n#define glGetShaderSource GLEW_GET_FUN(__glewGetShaderSource)\n#define glGetShaderiv GLEW_GET_FUN(__glewGetShaderiv)\n#define glGetUniformLocation GLEW_GET_FUN(__glewGetUniformLocation)\n#define glGetUniformfv GLEW_GET_FUN(__glewGetUniformfv)\n#define glGetUniformiv GLEW_GET_FUN(__glewGetUniformiv)\n#define glGetVertexAttribPointerv GLEW_GET_FUN(__glewGetVertexAttribPointerv)\n#define glGetVertexAttribdv GLEW_GET_FUN(__glewGetVertexAttribdv)\n#define glGetVertexAttribfv GLEW_GET_FUN(__glewGetVertexAttribfv)\n#define glGetVertexAttribiv GLEW_GET_FUN(__glewGetVertexAttribiv)\n#define glIsProgram GLEW_GET_FUN(__glewIsProgram)\n#define glIsShader GLEW_GET_FUN(__glewIsShader)\n#define glLinkProgram GLEW_GET_FUN(__glewLinkProgram)\n#define glShaderSource GLEW_GET_FUN(__glewShaderSource)\n#define glStencilFuncSeparate GLEW_GET_FUN(__glewStencilFuncSeparate)\n#define glStencilMaskSeparate GLEW_GET_FUN(__glewStencilMaskSeparate)\n#define glStencilOpSeparate GLEW_GET_FUN(__glewStencilOpSeparate)\n#define glUniform1f GLEW_GET_FUN(__glewUniform1f)\n#define glUniform1fv GLEW_GET_FUN(__glewUniform1fv)\n#define glUniform1i GLEW_GET_FUN(__glewUniform1i)\n#define glUniform1iv GLEW_GET_FUN(__glewUniform1iv)\n#define glUniform2f GLEW_GET_FUN(__glewUniform2f)\n#define glUniform2fv GLEW_GET_FUN(__glewUniform2fv)\n#define glUniform2i GLEW_GET_FUN(__glewUniform2i)\n#define glUniform2iv GLEW_GET_FUN(__glewUniform2iv)\n#define glUniform3f GLEW_GET_FUN(__glewUniform3f)\n#define glUniform3fv GLEW_GET_FUN(__glewUniform3fv)\n#define glUniform3i GLEW_GET_FUN(__glewUniform3i)\n#define glUniform3iv GLEW_GET_FUN(__glewUniform3iv)\n#define glUniform4f GLEW_GET_FUN(__glewUniform4f)\n#define glUniform4fv GLEW_GET_FUN(__glewUniform4fv)\n#define glUniform4i GLEW_GET_FUN(__glewUniform4i)\n#define glUniform4iv GLEW_GET_FUN(__glewUniform4iv)\n#define glUniformMatrix2fv GLEW_GET_FUN(__glewUniformMatrix2fv)\n#define glUniformMatrix3fv GLEW_GET_FUN(__glewUniformMatrix3fv)\n#define glUniformMatrix4fv GLEW_GET_FUN(__glewUniformMatrix4fv)\n#define glUseProgram GLEW_GET_FUN(__glewUseProgram)\n#define glValidateProgram GLEW_GET_FUN(__glewValidateProgram)\n#define glVertexAttrib1d GLEW_GET_FUN(__glewVertexAttrib1d)\n#define glVertexAttrib1dv GLEW_GET_FUN(__glewVertexAttrib1dv)\n#define glVertexAttrib1f GLEW_GET_FUN(__glewVertexAttrib1f)\n#define glVertexAttrib1fv GLEW_GET_FUN(__glewVertexAttrib1fv)\n#define glVertexAttrib1s GLEW_GET_FUN(__glewVertexAttrib1s)\n#define glVertexAttrib1sv GLEW_GET_FUN(__glewVertexAttrib1sv)\n#define glVertexAttrib2d GLEW_GET_FUN(__glewVertexAttrib2d)\n#define glVertexAttrib2dv GLEW_GET_FUN(__glewVertexAttrib2dv)\n#define glVertexAttrib2f GLEW_GET_FUN(__glewVertexAttrib2f)\n#define glVertexAttrib2fv GLEW_GET_FUN(__glewVertexAttrib2fv)\n#define glVertexAttrib2s GLEW_GET_FUN(__glewVertexAttrib2s)\n#define glVertexAttrib2sv GLEW_GET_FUN(__glewVertexAttrib2sv)\n#define glVertexAttrib3d GLEW_GET_FUN(__glewVertexAttrib3d)\n#define glVertexAttrib3dv GLEW_GET_FUN(__glewVertexAttrib3dv)\n#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f)\n#define glVertexAttrib3fv GLEW_GET_FUN(__glewVertexAttrib3fv)\n#define glVertexAttrib3s GLEW_GET_FUN(__glewVertexAttrib3s)\n#define glVertexAttrib3sv GLEW_GET_FUN(__glewVertexAttrib3sv)\n#define glVertexAttrib4Nbv GLEW_GET_FUN(__glewVertexAttrib4Nbv)\n#define glVertexAttrib4Niv GLEW_GET_FUN(__glewVertexAttrib4Niv)\n#define glVertexAttrib4Nsv GLEW_GET_FUN(__glewVertexAttrib4Nsv)\n#define glVertexAttrib4Nub GLEW_GET_FUN(__glewVertexAttrib4Nub)\n#define glVertexAttrib4Nubv GLEW_GET_FUN(__glewVertexAttrib4Nubv)\n#define glVertexAttrib4Nuiv GLEW_GET_FUN(__glewVertexAttrib4Nuiv)\n#define glVertexAttrib4Nusv GLEW_GET_FUN(__glewVertexAttrib4Nusv)\n#define glVertexAttrib4bv GLEW_GET_FUN(__glewVertexAttrib4bv)\n#define glVertexAttrib4d GLEW_GET_FUN(__glewVertexAttrib4d)\n#define glVertexAttrib4dv GLEW_GET_FUN(__glewVertexAttrib4dv)\n#define glVertexAttrib4f GLEW_GET_FUN(__glewVertexAttrib4f)\n#define glVertexAttrib4fv GLEW_GET_FUN(__glewVertexAttrib4fv)\n#define glVertexAttrib4iv GLEW_GET_FUN(__glewVertexAttrib4iv)\n#define glVertexAttrib4s GLEW_GET_FUN(__glewVertexAttrib4s)\n#define glVertexAttrib4sv GLEW_GET_FUN(__glewVertexAttrib4sv)\n#define glVertexAttrib4ubv GLEW_GET_FUN(__glewVertexAttrib4ubv)\n#define glVertexAttrib4uiv GLEW_GET_FUN(__glewVertexAttrib4uiv)\n#define glVertexAttrib4usv GLEW_GET_FUN(__glewVertexAttrib4usv)\n#define glVertexAttribPointer GLEW_GET_FUN(__glewVertexAttribPointer)\n\n#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)\n\n#endif /* GL_VERSION_2_0 */\n\n/* ----------------------------- GL_VERSION_2_1 ---------------------------- */\n\n#ifndef GL_VERSION_2_1\n#define GL_VERSION_2_1 1\n\n#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F\n#define GL_PIXEL_PACK_BUFFER 0x88EB\n#define GL_PIXEL_UNPACK_BUFFER 0x88EC\n#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED\n#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF\n#define GL_FLOAT_MAT2x3 0x8B65\n#define GL_FLOAT_MAT2x4 0x8B66\n#define GL_FLOAT_MAT3x2 0x8B67\n#define GL_FLOAT_MAT3x4 0x8B68\n#define GL_FLOAT_MAT4x2 0x8B69\n#define GL_FLOAT_MAT4x3 0x8B6A\n#define GL_SRGB 0x8C40\n#define GL_SRGB8 0x8C41\n#define GL_SRGB_ALPHA 0x8C42\n#define GL_SRGB8_ALPHA"}, {"path": "includes/GL/glxew.h", "language": "code", "loc": 1201, "comment_density": 0.177, "code": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits \n** Copyright (C) 2002-2008, Marcelo E. Magallon \n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n** this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n** this list of conditions and the following disclaimer in the documentation \n** and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n** derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n * Mesa 3-D graphics library\n * Version: 7.0\n *\n * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\n * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __glxew_h__\n#define __glxew_h__\n#define __GLXEW_H__\n\n#ifdef __glxext_h_\n#error glxext.h included before glxew.h\n#endif\n\n#if defined(GLX_H) || defined(__GLX_glx_h__) || defined(__glx_h__)\n#error glx.h included before glxew.h\n#endif\n\n#define __glxext_h_\n\n#define GLX_H\n#define __GLX_glx_h__\n#define __glx_h__\n\n#include \n#include \n#include \n#include \n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* ---------------------------- GLX_VERSION_1_0 --------------------------- */\n\n#ifndef GLX_VERSION_1_0\n#define GLX_VERSION_1_0 1\n\n#define GLX_USE_GL 1\n#define GLX_BUFFER_SIZE 2\n#define GLX_LEVEL 3\n#define GLX_RGBA 4\n#define GLX_DOUBLEBUFFER 5\n#define GLX_STEREO 6\n#define GLX_AUX_BUFFERS 7\n#define GLX_RED_SIZE 8\n#define GLX_GREEN_SIZE 9\n#define GLX_BLUE_SIZE 10\n#define GLX_ALPHA_SIZE 11\n#define GLX_DEPTH_SIZE 12\n#define GLX_STENCIL_SIZE 13\n#define GLX_ACCUM_RED_SIZE 14\n#define GLX_ACCUM_GREEN_SIZE 15\n#define GLX_ACCUM_BLUE_SIZE 16\n#define GLX_ACCUM_ALPHA_SIZE 17\n#define GLX_BAD_SCREEN 1\n#define GLX_BAD_ATTRIBUTE 2\n#define GLX_NO_EXTENSION 3\n#define GLX_BAD_VISUAL 4\n#define GLX_BAD_CONTEXT 5\n#define GLX_BAD_VALUE 6\n#define GLX_BAD_ENUM 7\n\ntypedef XID GLXDrawable;\ntypedef XID GLXPixmap;\n#ifdef __sun\ntypedef struct __glXContextRec *GLXContext;\n#else\ntypedef struct __GLXcontextRec *GLXContext;\n#endif\n\ntypedef unsigned int GLXVideoDeviceNV; \n\nextern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase);\nextern Bool glXQueryVersion (Display *dpy, int *major, int *minor);\nextern int glXGetConfig (Display *dpy, XVisualInfo *vis, int attrib, int *value);\nextern XVisualInfo* glXChooseVisual (Display *dpy, int screen, int *attribList);\nextern GLXPixmap glXCreateGLXPixmap (Display *dpy, XVisualInfo *vis, Pixmap pixmap);\nextern void glXDestroyGLXPixmap (Display *dpy, GLXPixmap pix);\nextern GLXContext glXCreateContext (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);\nextern void glXDestroyContext (Display *dpy, GLXContext ctx);\nextern Bool glXIsDirect (Display *dpy, GLXContext ctx);\nextern void glXCopyContext (Display *dpy, GLXContext src, GLXContext dst, GLulong mask);\nextern Bool glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx);\nextern GLXContext glXGetCurrentContext (void);\nextern GLXDrawable glXGetCurrentDrawable (void);\nextern void glXWaitGL (void);\nextern void glXWaitX (void);\nextern void glXSwapBuffers (Display *dpy, GLXDrawable drawable);\nextern void glXUseXFont (Font font, int first, int count, int listBase);\n\n#define GLXEW_VERSION_1_0 GLXEW_GET_VAR(__GLXEW_VERSION_1_0)\n\n#endif /* GLX_VERSION_1_0 */\n\n/* ---------------------------- GLX_VERSION_1_1 --------------------------- */\n\n#ifndef GLX_VERSION_1_1\n#define GLX_VERSION_1_1\n\n#define GLX_VENDOR 0x1\n#define GLX_VERSION 0x2\n#define GLX_EXTENSIONS 0x3\n\nextern const char* glXQueryExtensionsString (Display *dpy, int screen);\nextern const char* glXGetClientString (Display *dpy, int name);\nextern const char* glXQueryServerString (Display *dpy, int screen, int name);\n\n#define GLXEW_VERSION_1_1 GLXEW_GET_VAR(__GLXEW_VERSION_1_1)\n\n#endif /* GLX_VERSION_1_1 */\n\n/* ---------------------------- GLX_VERSION_1_2 ---------------------------- */\n\n#ifndef GLX_VERSION_1_2\n#define GLX_VERSION_1_2 1\n\ntypedef Display* ( * PFNGLXGETCURRENTDISPLAYPROC) (void);\n\n#define glXGetCurrentDisplay GLXEW_GET_FUN(__glewXGetCurrentDisplay)\n\n#define GLXEW_VERSION_1_2 GLXEW_GET_VAR(__GLXEW_VERSION_1_2)\n\n#endif /* GLX_VERSION_1_2 */\n\n/* ---------------------------- GLX_VERSION_1_3 ---------------------------- */\n\n#ifndef GLX_VERSION_1_3\n#define GLX_VERSION_1_3 1\n\n#define GLX_RGBA_BIT 0x00000001\n#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001\n#define GLX_WINDOW_BIT 0x00000001\n#define GLX_COLOR_INDEX_BIT 0x00000002\n#define GLX_PIXMAP_BIT 0x00000002\n#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002\n#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004\n#define GLX_PBUFFER_BIT 0x00000004\n#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008\n#define GLX_AUX_BUFFERS_BIT 0x00000010\n#define GLX_CONFIG_CAVEAT 0x20\n#define GLX_DEPTH_BUFFER_BIT 0x00000020\n#define GLX_X_VISUAL_TYPE 0x22\n#define GLX_TRANSPARENT_TYPE 0x23\n#define GLX_TRANSPARENT_INDEX_VALUE 0x24\n#define GLX_TRANSPARENT_RED_VALUE 0x25\n#define GLX_TRANSPARENT_GREEN_VALUE 0x26\n#define GLX_TRANSPARENT_BLUE_VALUE 0x27\n#define GLX_TRANSPARENT_ALPHA_VALUE 0x28\n#define GLX_STENCIL_BUFFER_BIT 0x00000040\n#define GLX_ACCUM_BUFFER_BIT 0x00000080\n#define GLX_NONE 0x8000\n#define GLX_SLOW_CONFIG 0x8001\n#define GLX_TRUE_COLOR 0x8002\n#define GLX_DIRECT_COLOR 0x8003\n#define GLX_PSEUDO_COLOR 0x8004\n#define GLX_STATIC_COLOR 0x8005\n#define GLX_GRAY_SCALE 0x8006\n#define GLX_STATIC_GRAY 0x8007\n#define GLX_TRANSPARENT_RGB 0x8008\n#define GLX_TRANSPARENT_INDEX 0x8009\n#define GLX_VISUAL_ID 0x800B\n#define GLX_SCREEN 0x800C\n#define GLX_NON_CONFORMANT_CONFIG 0x800D\n#define GLX_DRAWABLE_TYPE 0x8010\n#define GLX_RENDER_TYPE 0x8011\n#define GLX_X_RENDERABLE 0x8012\n#define GLX_FBCONFIG_ID 0x8013\n#define GLX_RGBA_TYPE 0x8014\n#define GLX_COLOR_INDEX_TYPE 0x8015\n#define GLX_MAX_PBUFFER_WIDTH 0x8016\n#define GLX_MAX_PBUFFER_HEIGHT 0x8017\n#define GLX_MAX_PBUFFER_PIXELS 0x8018\n#define GLX_PRESERVED_CONTENTS 0x801B\n#define GLX_LARGEST_PBUFFER 0x801C\n#define GLX_WIDTH 0x801D\n#define GLX_HEIGHT 0x801E\n#define GLX_EVENT_MASK 0x801F\n#define GLX_DAMAGED 0x8020\n#define GLX_SAVED 0x8021\n#define GLX_WINDOW 0x8022\n#define GLX_PBUFFER 0x8023\n#define GLX_PBUFFER_HEIGHT 0x8040\n#define GLX_PBUFFER_WIDTH 0x8041\n#define GLX_PBUFFER_CLOBBER_MASK 0x08000000\n#define GLX_DONT_CARE 0xFFFFFFFF\n\ntypedef XID GLXFBConfigID;\ntypedef XID GLXPbuffer;\ntypedef XID GLXWindow;\ntypedef struct __GLXFBConfigRec *GLXFBConfig;\n\ntypedef struct {\n int event_type; \n int draw_type; \n unsigned long serial; \n Bool send_event; \n Display *display; \n GLXDrawable drawable; \n unsigned int buffer_mask; \n unsigned int aux_buffer; \n int x, y; \n int width, height; \n int count; \n} GLXPbufferClobberEvent;\ntypedef union __GLXEvent {\n GLXPbufferClobberEvent glxpbufferclobber; \n long pad[24]; \n} GLXEvent;\n\ntypedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);\ntypedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);\ntypedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);\ntypedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);\ntypedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);\ntypedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);\ntypedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);\ntypedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);\ntypedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);\ntypedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);\ntypedef GLXFBConfig* ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);\ntypedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);\ntypedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);\ntypedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx);\ntypedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);\ntypedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);\ntypedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);\n\n#define glXChooseFBConfig GLXEW_GET_FUN(__glewXChooseFBConfig)\n#define glXCreateNewContext GLXEW_GET_FUN(__glewXCreateNewContext)\n#define glXCreatePbuffer GLXEW_GET_FUN(__glewXCreatePbuffer)\n#define glXCreatePixmap GLXEW_GET_FUN(__glewXCreatePixmap)\n#define glXCreateWindow GLXEW_GET_FUN(__glewXCreateWindow)\n#define glXDestroyPbuffer GLXEW_GET_FUN(__glewXDestroyPbuffer)\n#define glXDestroyPixmap GLXEW_GET_FUN(__glewXDestroyPixmap)\n#define glXDestroyWindow GLXEW_GET_FUN(__glewXDestroyWindow)\n#define glXGetCurrentReadDrawable GLXEW_GET_FUN(__glewXGetCurrentReadDrawable)\n#define glXGetFBConfigAttrib GLXEW_GET_FUN(__glewXGetFBConfigAttrib)\n#define glXGetFBConfigs GLXEW_GET_FUN(__glewXGetFBConfigs)\n#define glXGetSelectedEvent GLXEW_GET_FUN(__glewXGetSelectedEvent)\n#define glXGetVisualFromFBConfig GLXEW_GET_FUN(__glewXGetVisualFromFBConfig)\n#define glXMakeContextCurrent GLXEW_GET_FUN(__glewXMakeContextCurrent)\n#define glXQueryContext GLXEW_GET_FUN(__glewXQueryContext)\n#define glXQueryDrawable GLXEW_GET_FUN(__glewXQueryDrawable)\n#define glXSelectEvent GLXEW_GET_FUN(__glewXSelectEvent)\n\n#define GLXEW_VERSION_1_3 GLXEW_GET_VAR(__GLXEW_VERSION_1_3)\n\n#endif /* GLX_VERSION_1_3 */\n\n/* ---------------------------- GLX_VERSION_1_4 ---------------------------- */\n\n#ifndef GLX_VERSION_1_4\n#define GLX_VERSION_1_4 1\n\n#define GLX_SAMPLE_BUFFERS 100000\n#define GLX_SAMPLES 100001\n\nextern void ( * glXGetProcAddress (const GLubyte *procName)) (void);\n\n#define GLXEW_VERSION_1_4 GLXEW_GET_VAR(__GLXEW_VERSION_1_4)\n\n#endif /* GLX_VERSION_1_4 */\n\n/* -------------------------- GLX_3DFX_multisample ------------------------- */\n\n#ifndef GLX_3DFX_multisample\n#define GLX_3DFX_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_3DFX 0x8050\n#define GLX_SAMPLES_3DFX 0x8051\n\n#define GLXEW_3DFX_multisample GLXEW_GET_VAR(__GLXEW_3DFX_multisample)\n\n#endif /* GLX_3DFX_multisample */\n\n/* ------------------------ GLX_AMD_gpu_association ------------------------ */\n\n#ifndef GLX_AMD_gpu_association\n#define GLX_AMD_gpu_association 1\n\n#define GLX_GPU_VENDOR_AMD 0x1F00\n#define GLX_GPU_RENDERER_STRING_AMD 0x1F01\n#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define GLX_GPU_RAM_AMD 0x21A3\n#define GLX_GPU_CLOCK_AMD 0x21A4\n#define GLX_GPU_NUM_PIPES_AMD 0x21A5\n#define GLX_GPU_NUM_SIMD_AMD 0x21A6\n#define GLX_GPU_NUM_RB_AMD 0x21A7\n#define GLX_GPU_NUM_SPI_AMD 0x21A8\n\n#define GLXEW_AMD_gpu_association GLXEW_GET_VAR(__GLXEW_AMD_gpu_association)\n\n#endif /* GLX_AMD_gpu_association */\n\n/* ------------------------- GLX_ARB_create_context ------------------------ */\n\n#ifndef GLX_ARB_create_context\n#define GLX_ARB_create_context 1\n\n#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001\n#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002\n#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define GLX_CONTEXT_FLAGS_ARB 0x2094\n\ntypedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display* dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);\n\n#define glXCreateContextAttribsARB GLXEW_GET_FUN(__glewXCreateContextAttribsARB)\n\n#define GLXEW_ARB_create_context GLXEW_GET_VAR(__GLXEW_ARB_create_context)\n\n#endif /* GLX_ARB_create_context */\n\n/* --------------------- GLX_ARB_create_context_profile -------------------- */\n\n#ifndef GLX_ARB_create_context_profile\n#define GLX_ARB_create_context_profile 1\n\n#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126\n\n#define GLXEW_ARB_create_context_profile GLXEW_GET_VAR(__GLXEW_ARB_create_context_profile)\n\n#endif /* GLX_ARB_create_context_profile */\n\n/* ------------------- GLX_ARB_create_context_robustness ------------------- */\n\n#ifndef GLX_ARB_create_context_robustness\n#define GLX_ARB_create_context_robustness 1\n\n#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261\n\n#define GLXEW_ARB_create_context_robustness GLXEW_GET_VAR(__GLXEW_ARB_create_context_robustness)\n\n#endif /* GLX_ARB_create_context_robustness */\n\n/* ------------------------- GLX_ARB_fbconfig_float ------------------------ */\n\n#ifndef GLX_ARB_fbconfig_float\n#define GLX_ARB_fbconfig_float 1\n\n#define GLX_RGBA_FLOAT_BIT 0x00000004\n#define GLX_RGBA_FLOAT_TYPE 0x20B9\n\n#define GLXEW_ARB_fbconfig_float GLXEW_GET_VAR(__GLXEW_ARB_fbconfig_float)\n\n#endif /* GLX_ARB_fbconfig_float */\n\n/* ------------------------ GLX_ARB_framebuffer_sRGB ----------------------- */\n\n#ifndef GLX_ARB_framebuffer_sRGB\n#define GLX_ARB_framebuffer_sRGB 1\n\n#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2\n\n#define GLXEW_ARB_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_ARB_framebuffer_sRGB)\n\n#endif /* GLX_ARB_framebuffer_sRGB */\n\n/* ------------------------ GLX_ARB_get_proc_address ----------------------- */\n\n#ifndef GLX_ARB_get_proc_address\n#define GLX_ARB_get_proc_address 1\n\nextern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void);\n\n#define GLXEW_ARB_get_proc_address GLXEW_GET_VAR(__GLXEW_ARB_get_proc_address)\n\n#endif /* GLX_ARB_get_proc_address */\n\n/* -------------------------- GLX_ARB_multisample -------------------------- */\n\n#ifndef GLX_ARB_multisample\n#define GLX_ARB_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_ARB 100000\n#define GLX_SAMPLES_ARB 100001\n\n#define GLXEW_ARB_multisample GLXEW_GET_VAR(__GLXEW_ARB_multisample)\n\n#endif /* GLX_ARB_multisample */\n\n/* ---------------- GLX_ARB_robustness_application_isolation --------------- */\n\n#ifndef GLX_ARB_robustness_application_isolation\n#define GLX_ARB_robustness_application_isolation 1\n\n#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n\n#define GLXEW_ARB_robustness_application_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_application_isolation)\n\n#endif /* GLX_ARB_robustness_application_isolation */\n\n/* ---------------- GLX_ARB_robustness_share_group_isolation --------------- */\n\n#ifndef GLX_ARB_robustness_share_group_isolation\n#define GLX_ARB_robustness_share_group_isolation 1\n\n#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008\n\n#define GLXEW_ARB_robustness_share_group_isolation GLXEW_GET_VAR(__GLXEW_ARB_robustness_share_group_isolation)\n\n#endif /* GLX_ARB_robustness_share_group_isolation */\n\n/* ---------------------- GLX_ARB_vertex_buffer_object --------------------- */\n\n#ifndef GLX_ARB_vertex_buffer_object\n#define GLX_ARB_vertex_buffer_object 1\n\n#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095\n\n#define GLXEW_ARB_vertex_buffer_object GLXEW_GET_VAR(__GLXEW_ARB_vertex_buffer_object)\n\n#endif /* GLX_ARB_vertex_buffer_object */\n\n/* ----------------------- GLX_ATI_pixel_format_float ---------------------- */\n\n#ifndef GLX_ATI_pixel_format_float\n#define GLX_ATI_pixel_format_float 1\n\n#define GLX_RGBA_FLOAT_ATI_BIT 0x00000100\n\n#define GLXEW_ATI_pixel_format_float GLXEW_GET_VAR(__GLXEW_ATI_pixel_format_float)\n\n#endif /* GLX_ATI_pixel_format_float */\n\n/* ------------------------- GLX_ATI_render_texture ------------------------ */\n\n#ifndef GLX_ATI_render_texture\n#define GLX_ATI_render_texture 1\n\n#define GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800\n#define GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801\n#define GLX_TEXTURE_FORMAT_ATI 0x9802\n#define GLX_TEXTURE_TARGET_ATI 0x9803\n#define GLX_MIPMAP_TEXTURE_ATI 0x9804\n#define GLX_TEXTURE_RGB_ATI 0x9805\n#define GLX_TEXTURE_RGBA_ATI 0x9806\n#define GLX_NO_TEXTURE_ATI 0x9807\n#define GLX_TEXTURE_CUBE_MAP_ATI 0x9808\n#define GLX_TEXTURE_1D_ATI 0x9809\n#define GLX_TEXTURE_2D_ATI 0x980A\n#define GLX_MIPMAP_LEVEL_ATI 0x980B\n#define GLX_CUBE_MAP_FACE_ATI 0x980C\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810\n#define GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811\n#define GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812\n#define GLX_FRONT_LEFT_ATI 0x9813\n#define GLX_FRONT_RIGHT_ATI 0x9814\n#define GLX_BACK_LEFT_ATI 0x9815\n#define GLX_BACK_RIGHT_ATI 0x9816\n#define GLX_AUX0_ATI 0x9817\n#define GLX_AUX1_ATI 0x9818\n#define GLX_AUX2_ATI 0x9819\n#define GLX_AUX3_ATI 0x981A\n#define GLX_AUX4_ATI 0x981B\n#define GLX_AUX5_ATI 0x981C\n#define GLX_AUX6_ATI 0x981D\n#define GLX_AUX7_ATI 0x981E\n#define GLX_AUX8_ATI 0x981F\n#define GLX_AUX9_ATI 0x9820\n#define GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821\n#define GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822\n\ntypedef void ( * PFNGLXBINDTEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);\ntypedef void ( * PFNGLXDRAWABLEATTRIBATIPROC) (Display *dpy, GLXDrawable draw, const int *attrib_list);\ntypedef void ( * PFNGLXRELEASETEXIMAGEATIPROC) (Display *dpy, GLXPbuffer pbuf, int buffer);\n\n#define glXBindTexImageATI GLXEW_GET_FUN(__glewXBindTexImageATI)\n#define glXDrawableAttribATI GLXEW_GET_FUN(__glewXDrawableAttribATI)\n#define glXReleaseTexImageATI GLXEW_GET_FUN(__glewXReleaseTexImageATI)\n\n#define GLXEW_ATI_render_texture GLXEW_GET_VAR(__GLXEW_ATI_render_texture)\n\n#endif /* GLX_ATI_render_texture */\n\n/* ------------------- GLX_EXT_create_context_es2_profile ------------------ */\n\n#ifndef GLX_EXT_create_context_es2_profile\n#define GLX_EXT_create_context_es2_profile 1\n\n#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n\n#define GLXEW_EXT_create_context_es2_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es2_profile)\n\n#endif /* GLX_EXT_create_context_es2_profile */\n\n/* ------------------- GLX_EXT_create_context_es_profile ------------------- */\n\n#ifndef GLX_EXT_create_context_es_profile\n#define GLX_EXT_create_context_es_profile 1\n\n#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n\n#define GLXEW_EXT_create_context_es_profile GLXEW_GET_VAR(__GLXEW_EXT_create_context_es_profile)\n\n#endif /* GLX_EXT_create_context_es_profile */\n\n/* --------------------- GLX_EXT_fbconfig_packed_float --------------------- */\n\n#ifndef GLX_EXT_fbconfig_packed_float\n#define GLX_EXT_fbconfig_packed_float 1\n\n#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008\n#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1\n\n#define GLXEW_EXT_fbconfig_packed_float GLXEW_GET_VAR(__GLXEW_EXT_fbconfig_packed_float)\n\n#endif /* GLX_EXT_fbconfig_packed_float */\n\n/* ------------------------ GLX_EXT_framebuffer_sRGB ----------------------- */\n\n#ifndef GLX_EXT_framebuffer_sRGB\n#define GLX_EXT_framebuffer_sRGB 1\n\n#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2\n\n#define GLXEW_EXT_framebuffer_sRGB GLXEW_GET_VAR(__GLXEW_EXT_framebuffer_sRGB)\n\n#endif /* GLX_EXT_framebuffer_sRGB */\n\n/* ------------------------- GLX_EXT_import_context ------------------------ */\n\n#ifndef GLX_EXT_import_context\n#define GLX_EXT_import_context 1\n\n#define GLX_SHARE_CONTEXT_EXT 0x800A\n#define GLX_VISUAL_ID_EXT 0x800B\n#define GLX_SCREEN_EXT 0x800C\n\ntypedef XID GLXContextID;\n\ntypedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display* dpy, GLXContext context);\ntypedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);\ntypedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display* dpy, GLXContextID contextID);\ntypedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display* dpy, GLXContext context, int attribute,int *value);\n\n#define glXFreeContextEXT GLXEW_GET_FUN(__glewXFreeContextEXT)\n#define glXGetContextIDEXT GLXEW_GET_FUN(__glewXGetContextIDEXT)\n#define glXImportContextEXT GLXEW_GET_FUN(__glewXImportContextEXT)\n#define glXQueryContextInfoEXT GLXEW_GET_FUN(__glewXQueryContextInfoEXT)\n\n#define GLXEW_EXT_import_context GLXEW_GET_VAR(__GLXEW_EXT_import_context)\n\n#endif /* GLX_EXT_import_context */\n\n/* -------------------------- GLX_EXT_scene_marker ------------------------- */\n\n#ifndef GLX_EXT_scene_marker\n#define GLX_EXT_scene_marker 1\n\n#define GLXEW_EXT_scene_marker GLXEW_GET_VAR(__GLXEW_EXT_scene_marker)\n\n#endif /* GLX_EXT_scene_marker */\n\n/* -------------------------- GLX_EXT_swap_control ------------------------- */\n\n#ifndef GLX_EXT_swap_control\n#define GLX_EXT_swap_control 1\n\n#define GLX_SWAP_INTERVAL_EXT 0x20F1\n#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2\n\ntypedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display* dpy, GLXDrawable drawable, int interval);\n\n#define glXSwapIntervalEXT GLXEW_GET_FUN(__glewXSwapIntervalEXT)\n\n#define GLXEW_EXT_swap_control GLXEW_GET_VAR(__GLXEW_EXT_swap_control)\n\n#endif /* GLX_EXT_swap_control */\n\n/* ----------------------- GLX_EXT_swap_control_tear ----------------------- */\n\n#ifndef GLX_EXT_swap_control_tear\n#define GLX_EXT_swap_control_tear 1\n\n#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3\n\n#define GLXEW_EXT_swap_control_tear GLXEW_GET_VAR(__GLXEW_EXT_swap_control_tear)\n\n#endif /* GLX_EXT_swap_control_tear */\n\n/* ---------------------- GLX_EXT_texture_from_pixmap ---------------------- */\n\n#ifndef GLX_EXT_texture_from_pixmap\n#define GLX_EXT_texture_from_pixmap 1\n\n#define GLX_TEXTURE_1D_BIT_EXT 0x00000001\n#define GLX_TEXTURE_2D_BIT_EXT 0x00000002\n#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004\n#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0\n#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1\n#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2\n#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3\n#define GLX_Y_INVERTED_EXT 0x20D4\n#define GLX_TEXTURE_FORMAT_EXT 0x20D5\n#define GLX_TEXTURE_TARGET_EXT 0x20D6\n#define GLX_MIPMAP_TEXTURE_EXT 0x20D7\n#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8\n#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9\n#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA\n#define GLX_TEXTURE_1D_EXT 0x20DB\n#define GLX_TEXTURE_2D_EXT 0x20DC\n#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD\n#define GLX_FRONT_LEFT_EXT 0x20DE\n#define GLX_FRONT_RIGHT_EXT 0x20DF\n#define GLX_BACK_LEFT_EXT 0x20E0\n#define GLX_BACK_RIGHT_EXT 0x20E1\n#define GLX_AUX0_EXT 0x20E2\n#define GLX_AUX1_EXT 0x20E3\n#define GLX_AUX2_EXT 0x20E4\n#define GLX_AUX3_EXT 0x20E5\n#define GLX_AUX4_EXT 0x20E6\n#define GLX_AUX5_EXT 0x20E7\n#define GLX_AUX6_EXT 0x20E8\n#define GLX_AUX7_EXT 0x20E9\n#define GLX_AUX8_EXT 0x20EA\n#define GLX_AUX9_EXT 0x20EB\n\ntypedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer, const int *attrib_list);\ntypedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display* display, GLXDrawable drawable, int buffer);\n\n#define glXBindTexImageEXT GLXEW_GET_FUN(__glewXBindTexImageEXT)\n#define glXReleaseTexImageEXT GLXEW_GET_FUN(__glewXReleaseTexImageEXT)\n\n#define GLXEW_EXT_texture_from_pixmap GLXEW_GET_VAR(__GLXEW_EXT_texture_from_pixmap)\n\n#endif /* GLX_EXT_texture_from_pixmap */\n\n/* -------------------------- GLX_EXT_visual_info -------------------------- */\n\n#ifndef GLX_EXT_visual_info\n#define GLX_EXT_visual_info 1\n\n#define GLX_X_VISUAL_TYPE_EXT 0x22\n#define GLX_TRANSPARENT_TYPE_EXT 0x23\n#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24\n#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25\n#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26\n#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27\n#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28\n#define GLX_NONE_EXT 0x8000\n#define GLX_TRUE_COLOR_EXT 0x8002\n#define GLX_DIRECT_COLOR_EXT 0x8003\n#define GLX_PSEUDO_COLOR_EXT 0x8004\n#define GLX_STATIC_COLOR_EXT 0x8005\n#define GLX_GRAY_SCALE_EXT 0x8006\n#define GLX_STATIC_GRAY_EXT 0x8007\n#define GLX_TRANSPARENT_RGB_EXT 0x8008\n#define GLX_TRANSPARENT_INDEX_EXT 0x8009\n\n#define GLXEW_EXT_visual_info GLXEW_GET_VAR(__GLXEW_EXT_visual_info)\n\n#endif /* GLX_EXT_visual_info */\n\n/* ------------------------- GLX_EXT_visual_rating ------------------------- */\n\n#ifndef GLX_EXT_visual_rating\n#define GLX_EXT_visual_rating 1\n\n#define GLX_VISUAL_CAVEAT_EXT 0x20\n#define GLX_SLOW_VISUAL_EXT 0x8001\n#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D\n\n#define GLXEW_EXT_visual_rating GLXEW_GET_VAR(__GLXEW_EXT_visual_rating)\n\n#endif /* GLX_EXT_visual_rating */\n\n/* -------------------------- GLX_INTEL_swap_event ------------------------- */\n\n#ifndef GLX_INTEL_swap_event\n#define GLX_INTEL_swap_event 1\n\n#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180\n#define GLX_COPY_COMPLETE_INTEL 0x8181\n#define GLX_FLIP_COMPLETE_INTEL 0x8182\n#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000\n\n#define GLXEW_INTEL_swap_event GLXEW_GET_VAR(__GLXEW_INTEL_swap_event)\n\n#endif /* GLX_INTEL_swap_event */\n\n/* -------------------------- GLX_MESA_agp_offset -------------------------- */\n\n#ifndef GLX_MESA_agp_offset\n#define GLX_MESA_agp_offset 1\n\ntypedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void* pointer);\n\n#define glXGetAGPOffsetMESA GLXEW_GET_FUN(__glewXGetAGPOffsetMESA)\n\n#define GLXEW_MESA_agp_offset GLXEW_GET_VAR(__GLXEW_MESA_agp_offset)\n\n#endif /* GLX_MESA_agp_offset */\n\n/* ------------------------ GLX_MESA_copy_sub_buffer ----------------------- */\n\n#ifndef GLX_MESA_copy_sub_buffer\n#define GLX_MESA_copy_sub_buffer 1\n\ntypedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display* dpy, GLXDrawable drawable, int x, int y, int width, int height);\n\n#define glXCopySubBufferMESA GLXEW_GET_FUN(__glewXCopySubBufferMESA)\n\n#define GLXEW_MESA_copy_sub_buffer GLXEW_GET_VAR(__GLXEW_MESA_copy_sub_buffer)\n\n#endif /* GLX_MESA_copy_sub_buffer */\n\n/* ------------------------ GLX_MESA_pixmap_colormap ----------------------- */\n\n#ifndef GLX_MESA_pixmap_colormap\n#define GLX_MESA_pixmap_colormap 1\n\ntypedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display* dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);\n\n#define glXCreateGLXPixmapMESA GLXEW_GET_FUN(__glewXCreateGLXPixmapMESA)\n\n#define GLXEW_MESA_pixmap_colormap GLXEW_GET_VAR(__GLXEW_MESA_pixmap_colormap)\n\n#endif /* GLX_MESA_pixmap_colormap */\n\n/* ------------------------ GLX_MESA_release_buffers ----------------------- */\n\n#ifndef GLX_MESA_release_buffers\n#define GLX_MESA_release_buffers 1\n\ntypedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display* dpy, GLXDrawable d);\n\n#define glXReleaseBuffersMESA GLXEW_GET_FUN(__glewXReleaseBuffersMESA)\n\n#define GLXEW_MESA_release_buffers GLXEW_GET_VAR(__GLXEW_MESA_release_buffers)\n\n#endif /* GLX_MESA_release_buffers */\n\n/* ------------------------- GLX_MESA_set_3dfx_mode ------------------------ */\n\n#ifndef GLX_MESA_set_3dfx_mode\n#define GLX_MESA_set_3dfx_mode 1\n\n#define GLX_3DFX_WINDOW_MODE_MESA 0x1\n#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2\n\ntypedef GLboolean ( * PFNGLXSET3DFXMODEMESAPROC) (GLint mode);\n\n#define glXSet3DfxModeMESA GLXEW_GET_FUN(__glewXSet3DfxModeMESA)\n\n#define GLXEW_MESA_set_3dfx_mode GLXEW_GET_VAR(__GLXEW_MESA_set_3dfx_mode)\n\n#endif /* GLX_MESA_set_3dfx_mode */\n\n/* ------------------------- GLX_MESA_swap_control ------------------------- */\n\n#ifndef GLX_MESA_swap_control\n#define GLX_MESA_swap_control 1\n\ntypedef int ( * PFNGLXGETSWAPINTERVALMESAPROC) (void);\ntypedef int ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval);\n\n#define glXGetSwapIntervalMESA GLXEW_GET_FUN(__glewXGetSwapIntervalMESA)\n#define glXSwapIntervalMESA GLXEW_GET_FUN(__glewXSwapIntervalMESA)\n\n#define GLXEW_MESA_swap_control GLXEW_GET_VAR(__GLXEW_MESA_swap_control)\n\n#endif /* GLX_MESA_swap_control */\n\n/* --------------------------- GLX_NV_copy_image --------------------------- */\n\n#ifndef GLX_NV_copy_image\n#define GLX_NV_copy_image 1\n\ntypedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n\n#define glXCopyImageSubDataNV GLXEW_GET_FUN(__glewXCopyImageSubDataNV)\n\n#define GLXEW_NV_copy_image GLXEW_GET_VAR(__GLXEW_NV_copy_image)\n\n#endif /* GLX_NV_copy_image */\n\n/* -------------------------- GLX_NV_float_buffer -------------------------- */\n\n#ifndef GLX_NV_float_buffer\n#define GLX_NV_float_buffer 1\n\n#define GLX_FLOAT_COMPONENTS_NV 0x20B0\n\n#define GLXEW_NV_float_buffer GLXEW_GET_VAR(__GLXEW_NV_float_buffer)\n\n#endif /* GLX_NV_float_buffer */\n\n/* ---------------------- GLX_NV_multisample_coverage ---------------------- */\n\n#ifndef GLX_NV_multisample_coverage\n#define GLX_NV_multisample_coverage 1\n\n#define GLX_COLOR_SAMPLES_NV 0x20B3\n#define GLX_COVERAGE_SAMPLES_NV 100001\n\n#define GLXEW_NV_multisample_coverage GLXEW_GET_VAR(__GLXEW_NV_multisample_coverage)\n\n#endif /* GLX_NV_multisample_coverage */\n\n/* -------------------------- GLX_NV_present_video ------------------------- */\n\n#ifndef GLX_NV_present_video\n#define GLX_NV_present_video 1\n\n#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0\n\ntypedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display* dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);\ntypedef unsigned int* ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);\n\n#define glXBindVideoDeviceNV GLXEW_GET_FUN(__glewXBindVideoDeviceNV)\n#define glXEnumerateVideoDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoDevicesNV)\n\n#define GLXEW_NV_present_video GLXEW_GET_VAR(__GLXEW_NV_present_video)\n\n#endif /* GLX_NV_present_video */\n\n/* --------------------------- GLX_NV_swap_group --------------------------- */\n\n#ifndef GLX_NV_swap_group\n#define GLX_NV_swap_group 1\n\ntypedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display* dpy, GLuint group, GLuint barrier);\ntypedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint group);\ntypedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display* dpy, int screen, GLuint *count);\ntypedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display* dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);\ntypedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display* dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);\ntypedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display* dpy, int screen);\n\n#define glXBindSwapBarrierNV GLXEW_GET_FUN(__glewXBindSwapBarrierNV)\n#define glXJoinSwapGroupNV GLXEW_GET_FUN(__glewXJoinSwapGroupNV)\n#define glXQueryFrameCountNV GLXEW_GET_FUN(__glewXQueryFrameCountNV)\n#define glXQueryMaxSwapGroupsNV GLXEW_GET_FUN(__glewXQueryMaxSwapGroupsNV)\n#define glXQuerySwapGroupNV GLXEW_GET_FUN(__glewXQuerySwapGroupNV)\n#define glXResetFrameCountNV GLXEW_GET_FUN(__glewXResetFrameCountNV)\n\n#define GLXEW_NV_swap_group GLXEW_GET_VAR(__GLXEW_NV_swap_group)\n\n#endif /* GLX_NV_swap_group */\n\n/* ----------------------- GLX_NV_vertex_array_range ----------------------- */\n\n#ifndef GLX_NV_vertex_array_range\n#define GLX_NV_vertex_array_range 1\n\ntypedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);\ntypedef void ( * PFNGLXFREEMEMORYNVPROC) (void *pointer);\n\n#define glXAllocateMemoryNV GLXEW_GET_FUN(__glewXAllocateMemoryNV)\n#define glXFreeMemoryNV GLXEW_GET_FUN(__glewXFreeMemoryNV)\n\n#define GLXEW_NV_vertex_array_range GLXEW_GET_VAR(__GLXEW_NV_vertex_array_range)\n\n#endif /* GLX_NV_vertex_array_range */\n\n/* -------------------------- GLX_NV_video_capture ------------------------- */\n\n#ifndef GLX_NV_video_capture\n#define GLX_NV_video_capture 1\n\n#define GLX_DEVICE_ID_NV 0x20CD\n#define GLX_UNIQUE_ID_NV 0x20CE\n#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\ntypedef XID GLXVideoCaptureDeviceNV;\n\ntypedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display* dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);\ntypedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display* dpy, int screen, int *nelements);\ntypedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);\ntypedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);\ntypedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display* dpy, GLXVideoCaptureDeviceNV device);\n\n#define glXBindVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXBindVideoCaptureDeviceNV)\n#define glXEnumerateVideoCaptureDevicesNV GLXEW_GET_FUN(__glewXEnumerateVideoCaptureDevicesNV)\n#define glXLockVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXLockVideoCaptureDeviceNV)\n#define glXQueryVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXQueryVideoCaptureDeviceNV)\n#define glXReleaseVideoCaptureDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoCaptureDeviceNV)\n\n#define GLXEW_NV_video_capture GLXEW_GET_VAR(__GLXEW_NV_video_capture)\n\n#endif /* GLX_NV_video_capture */\n\n/* ---------------------------- GLX_NV_video_out --------------------------- */\n\n#ifndef GLX_NV_video_out\n#define GLX_NV_video_out 1\n\n#define GLX_VIDEO_OUT_COLOR_NV 0x20C3\n#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4\n#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5\n#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define GLX_VIDEO_OUT_FRAME_NV 0x20C8\n#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9\n#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA\n#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB\n#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC\n\ntypedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display* dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);\ntypedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display* dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);\ntypedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\ntypedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display* dpy, int screen, GLXVideoDeviceNV VideoDevice);\ntypedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display* dpy, GLXPbuffer pbuf);\ntypedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display* dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);\n\n#define glXBindVideoImageNV GLXEW_GET_FUN(__glewXBindVideoImageNV)\n#define glXGetVideoDeviceNV GLXEW_GET_FUN(__glewXGetVideoDeviceNV)\n#define glXGetVideoInfoNV GLXEW_GET_FUN(__glewXGetVideoInfoNV)\n#define glXReleaseVideoDeviceNV GLXEW_GET_FUN(__glewXReleaseVideoDeviceNV)\n#define glXReleaseVideoImageNV GLXEW_GET_FUN(__glewXReleaseVideoImageNV)\n#define glXSendPbufferToVideoNV GLXEW_GET_FUN(__glewXSendPbufferToVideoNV)\n\n#define GLXEW_NV_video_out GLXEW_GET_VAR(__GLXEW_NV_video_out)\n\n#endif /* GLX_NV_video_out */\n\n/* -------------------------- GLX_OML_swap_method -------------------------- */\n\n#ifndef GLX_OML_swap_method\n#define GLX_OML_swap_method 1\n\n#define GLX_SWAP_METHOD_OML 0x8060\n#define GLX_SWAP_EXCHANGE_OML 0x8061\n#define GLX_SWAP_COPY_OML 0x8062\n#define GLX_SWAP_UNDEFINED_OML 0x8063\n\n#define GLXEW_OML_swap_method GLXEW_GET_VAR(__GLXEW_OML_swap_method)\n\n#endif /* GLX_OML_swap_method */\n\n/* -------------------------- GLX_OML_sync_control ------------------------- */\n\n#ifndef GLX_OML_sync_control\n#define GLX_OML_sync_control 1\n\ntypedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display* dpy, GLXDrawable drawable, int32_t* numerator, int32_t* denominator);\ntypedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, int64_t* sbc);\ntypedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);\ntypedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t* ust, int64_t* msc, int64_t* sbc);\ntypedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display* dpy, GLXDrawable drawable, int64_t target_sbc, int64_t* ust, int64_t* msc, int64_t* sbc);\n\n#define glXGetMscRateOML GLXEW_GET_FUN(__glewXGetMscRateOML)\n#define glXGetSyncValuesOML GLXEW_GET_FUN(__glewXGetSyncValuesOML)\n#define glXSwapBuffersMscOML GLXEW_GET_FUN(__glewXSwapBuffersMscOML)\n#define glXWaitForMscOML GLXEW_GET_FUN(__glewXWaitForMscOML)\n#define glXWaitForSbcOML GLXEW_GET_FUN(__glewXWaitForSbcOML)\n\n#define GLXEW_OML_sync_control GLXEW_GET_VAR(__GLXEW_OML_sync_control)\n\n#endif /* GLX_OML_sync_control */\n\n/* ------------------------ GLX_SGIS_blended_overlay ----------------------- */\n\n#ifndef GLX_SGIS_blended_overlay\n#define GLX_SGIS_blended_overlay 1\n\n#define GLX_BLENDED_RGBA_SGIS 0x8025\n\n#define GLXEW_SGIS_blended_overlay GLXEW_GET_VAR(__GLXEW_SGIS_blended_overlay)\n\n#endif /* GLX_SGIS_blended_overlay */\n\n/* -------------------------- GLX_SGIS_color_range ------------------------- */\n\n#ifndef GLX_SGIS_color_range\n#define GLX_SGIS_color_range 1\n\n#define GLX_MIN_RED_SGIS 0\n#define GLX_MAX_GREEN_SGIS 0\n#define GLX_MIN_BLUE_SGIS 0\n#define GLX_MAX_ALPHA_SGIS 0\n#define GLX_MIN_GREEN_SGIS 0\n#define GLX_MIN_ALPHA_SGIS 0\n#define GLX_MAX_RED_SGIS 0\n#define GLX_EXTENDED_RANGE_SGIS 0\n#define GLX_MAX_BLUE_SGIS 0\n\n#define GLXEW_SGIS_color_range GLXEW_GET_VAR(__GLXEW_SGIS_color_range)\n\n#endif /* GLX_SGIS_color_range */\n\n/* -------------------------- GLX_SGIS_multisample ------------------------- */\n\n#ifndef GLX_SGIS_multisample\n#define GLX_SGIS_multisample 1\n\n#define GLX_SAMPLE_BUFFERS_SGIS 100000\n#define GLX_SAMPLES_SGIS 100001\n\n#define GLXEW_SGIS_multisample GLXEW_GET_VAR(__GLXEW_SGIS_multisample)\n\n#endif /* GLX_SGIS_multisample */\n\n/* ---------------------- GLX_SGIS_shared_multisample ---------------------- */\n\n#ifndef GLX_SGIS_shared_multisample\n#define GLX_SGIS_shared_multisample 1\n\n#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026\n#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027\n\n#define GLXEW_SGIS_shared_multisample GLXEW_GET_VAR(__GLXEW_SGIS_shared_multisample)\n\n#endif /* GLX_SGIS_shared_multisample */\n\n/* --------------------------- GLX_SGIX_fbconfig --------------------------- */\n\n#ifndef GLX_SGIX_fbconfig\n#define GLX_SGIX_fbconfig 1\n\n#define GLX_WINDOW_BIT_SGIX 0x00000001\n#define GLX_RGBA_BIT_SGIX 0x00000001\n#define GLX_PIXMAP_BIT_SGIX 0x00000002\n#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002\n#define GLX_SCREEN_EXT 0x800C\n#define GLX_DRAWABLE_TYPE_SGIX 0x8010\n#define GLX_RENDER_TYPE_SGIX 0x8011\n#define GLX_X_RENDERABLE_SGIX 0x8012\n#define GLX_FBCONFIG_ID_SGIX 0x8013\n#define GLX_RGBA_TYPE_SGIX 0x8014\n#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015\n\ntypedef XID GLXFBConfigIDSGIX;\ntypedef struct __GLXFBConfigRec *GLXFBConfigSGIX;\n\ntypedef GLXFBConfigSGIX* ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);\ntypedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);\ntypedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display* dpy, GLXFBConfig config, Pixmap pixmap);\ntypedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display* dpy, GLXFBConfigSGIX config, int attribute, int *value);\ntypedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display* dpy, XVisualInfo *vis);\ntypedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfig config);\n\n#define glXChooseFBConfigSGIX GLXEW_GET_FUN(__glewXChooseFBConfigSGIX)\n#define glXCreateContextWithConfigSGIX GLXEW_GET_FUN(__glewXCreateContextWithConfigSGIX)\n#define glXCreateGLXPixmapWithConfigSGIX GLXEW_GET_FUN(__glewXCreateGLXPixmapWithConfigSGIX)\n#define glXGetFBConfigAttribSGIX GLXEW_GET_FUN(__glewXGetFBConfigAttribSGIX)\n#define glXGetFBConfigFromVisualSGIX GLXEW_GET_FUN(__glewXGetFBConfigFromVisualSGIX)\n#define glXGetVisualFromFBConfigSGIX GLXEW_GET_FUN(__glewXGetVisualFromFBConfigSGIX)\n\n#define GLXEW_SGIX_fbconfig GLXEW_GET_VAR(__GLXEW_SGIX_fbconfig)\n\n#endif /* GLX_SGIX_fbconfig */\n\n/* --------------------------- GLX_SGIX_hyperpipe -------------------------- */\n\n#ifndef GLX_SGIX_hyperpipe\n#define GLX_SGIX_hyperpipe 1\n\n#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001\n#define GLX_PIPE_RECT_SGIX 0x00000001\n#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002\n#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002\n#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003\n#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004\n#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80\n#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91\n#define GLX_BAD_HYPERPIPE_SGIX 92\n#define GLX_HYPERPIPE_ID_SGIX 0x8030\n\ntypedef struct {\n char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n int networkId; \n} GLXHyperpipeNetworkSGIX;\ntypedef struct {\n char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n int XOrigin; \n int YOrigin; \n int maxHeight; \n int maxWidth; \n} GLXPipeRectLimits;\ntypedef struct {\n char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n int channel; \n unsigned int participationType; \n int timeSlice; \n} GLXHyperpipeConfigSGIX;\ntypedef struct {\n char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; \n int srcXOrigin; \n int srcYOrigin; \n int srcWidth; \n int srcHeight; \n int destXOrigin; \n int destYOrigin; \n int destWidth; \n int destHeight; \n} GLXPipeRect;\n\ntypedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);\ntypedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);\ntypedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);\ntypedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);\ntypedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);\ntypedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);\ntypedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);\ntypedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);\n\n#define glXBindHyperpipeSGIX GLXEW_GET_FUN(__glewXBindHyperpipeSGIX)\n#define glXDestroyHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXDestroyHyperpipeConfigSGIX)\n#define glXHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXHyperpipeAttribSGIX)\n#define glXHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXHyperpipeConfigSGIX)\n#define glXQueryHyperpipeAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeAttribSGIX)\n#define glXQueryHyperpipeBestAttribSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeBestAttribSGIX)\n#define glXQueryHyperpipeConfigSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeConfigSGIX)\n#define glXQueryHyperpipeNetworkSGIX GLXEW_GET_FUN(__glewXQueryHyperpipeNetworkSGIX)\n\n#define GLXEW_SGIX_hyperpipe GLXEW_GET_VAR(__GLXEW_SGIX_hyperpipe)\n\n#endif /* GLX_SGIX_hyperpipe */\n\n/* ---------------------------- GLX_SGIX_pbuffer --------------------------- */\n\n#ifndef GLX_SGIX_pbuffer\n#define GLX_SGIX_pbuffer 1\n\n#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001\n#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002\n#define GLX_PBUFFER_BIT_SGIX 0x00000004\n#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004\n#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008\n#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010\n#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020\n#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040\n#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080\n#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100\n#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016\n#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017\n#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018\n#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019\n#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A\n#define GLX_PRESERVED_CONTENTS_SGIX 0x801B\n#define GLX_LARGEST_PBUFFER_SGIX 0x801C\n#define GLX_WIDTH_SGIX 0x801D\n#define GLX_HEIGHT_SGIX 0x801E\n#define GLX_EVENT_MASK_SGIX 0x801F\n#define GLX_DAMAGED_SGIX 0x8020\n#define GLX_SAVED_SGIX 0x8021\n#define GLX_WINDOW_SGIX 0x8022\n#define GLX_PBUFFER_SGIX 0x8023\n#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000\n\ntypedef XID GLXPbufferSGIX;\ntypedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX;\n\ntypedef GLXPbuffer ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display* dpy, GLXFBConfig config, unsigned int width, unsigned int height, int *attrib_list);\ntypedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf);\ntypedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long *mask);\ntypedef void ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display* dpy, GLXPbuffer pbuf, int attribute, unsigned int *value);\ntypedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display* dpy, GLXDrawable drawable, unsigned long mask);\n\n#define glXCreateGLXPbufferSGIX GLXEW_GET_FUN(__glewXCreateGLXPbufferSGIX)\n#define glXDestroyGLXPbufferSGIX GLXEW_GET_FUN(__glewXDestroyGLXPbufferSGIX)\n#define glXGetSelectedEventSGIX GLXEW_GET_FUN(__glewXGetSelectedEventSGIX)\n#define glXQueryGLXPbufferSGIX GLXEW_GET_FUN(__glewXQueryGLXPbufferSGIX)\n#define glXSelectEventSGIX GLXEW_GET_FUN(__glewXSelectEventSGIX)\n\n#define GLXEW_SGIX_pbuffer GLXEW_GET_VAR(__GLXEW_SGIX_pbuffer)\n\n#endif /* GLX_SGIX_pbuffer */\n\n/* ------------------------- GLX_SGIX_swap_barrier ------------------------- */\n\n#ifndef GLX_SGIX_swap_barrier\n#define GLX_SGIX_swap_barrier 1\n\ntypedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);\ntypedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);\n\n#define glXBindSwapBarrierSGIX GLXEW_GET_FUN(__glewXBindSwapBarrierSGIX)\n#define glXQueryMaxSwapBarriersSGIX GLXEW_GET_FUN(__glewXQueryMaxSwapBarriersSGIX)\n\n#define GLXEW_SGIX_swap_barrier GLXEW_GET_VAR(__GLXEW_SGIX_swap_barrier)\n\n#endif /* GLX_SGIX_swap_barrier */\n\n/* -------------------------- GLX_SGIX_swap_group -------------------------- */\n\n#ifndef GLX_SGIX_swap_group\n#define GLX_SGIX_swap_group 1\n\ntypedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);\n\n#define glXJoinSwapGroupSGIX GLXEW_GET_FUN(__glewXJoinSwapGroupSGIX)\n\n#define GLXEW_SGIX_swap_group GLXEW_GET_VAR(__GLXEW_SGIX_swap_group)\n\n#endif /* GLX_SGIX_swap_group */\n\n/* ------------------------- GLX_SGIX_video_resize ------------------------- */\n\n#ifndef GLX_SGIX_video_resize\n#define GLX_SGIX_video_resize 1\n\n#define GLX_SYNC_FRAME_SGIX 0x00000000\n#define GLX_SYNC_SWAP_SGIX 0x00000001\n\ntypedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display* display, int screen, int channel, Window window);\ntypedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int x, int y, int w, int h);\ntypedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display* display, int screen, int channel, GLenum synctype);\ntypedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display* display, int screen, int channel, int *x, int *y, int *w, int *h);\ntypedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display* display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);\n\n#define glXBindChannelToWindowSGIX GLXEW_GET_FUN(__glewXBindChannelToWindowSGIX)\n#define glXChannelRectSGIX GLXEW_GET_FUN(__glewXChannelRectSGIX)\n#define glXChannelRectSyncSGIX GLXEW_GET_FUN(__glewXChannelRectSyncSGIX)\n#define glXQueryChannelDeltasSGIX GLXEW_GET_FUN(__glewXQueryChannelDeltasSGIX)\n#define glXQueryChannelRectSGIX GLXEW_GET_FUN(__glewXQueryChannelRectSGIX)\n\n#define GLXEW_SGIX_video_resize GLXEW_GET_VAR(__GLXEW_SGIX_video_resize)\n\n#endif /* GLX_SGIX_video_resize */\n\n/* ---------------------- GLX_SGIX_visual_select_group --------------------- */\n\n#ifndef GLX_SGIX_visual_select_group\n#define GLX_SGIX_visual_select_group 1\n\n#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028\n\n#define GLXEW_SGIX_visual_select_group GLXEW_GET_VAR(__GLXEW_SGIX_visual_select_group)\n\n#endif /* GLX_SGIX_visual_select_group */\n\n/* ---------------------------- GLX_SGI_cushion ---------------------------- */\n\n#ifndef GLX_SGI_cushion\n#define GLX_SGI_cushion 1\n\ntypedef void ( * PFNGLXCUSHIONSGIPROC) (Display* dpy, Window window, float cushion);\n\n#define glXCushionSGI GLXEW_GET_FUN(__glewXCushionSGI)\n\n#define GLXEW_SGI_cushion GLXEW_GET_VAR(__GLXEW_SGI_cushion)\n\n#endif /* GLX_SGI_cushion */\n\n/* ----------------------- GLX_SGI_make_current_read ----------------------- */\n\n#ifndef GLX_SGI_make_current_read\n#define GLX_SGI_make_current_read 1\n\ntypedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);\ntypedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);\n\n#define glXGetCurrentReadDrawableSGI GLXEW_GET_FUN(__glewXGetCurrentReadDrawableSGI)\n#define glXMakeCurrentReadSGI GLXEW_GET_FUN(__glewXMakeCurrentReadSGI)\n\n#define GLXEW_SGI_make_current_read GLXEW_GET_VAR(__GLXEW_SGI_make_current_read)\n\n#endif /* GLX_SGI_make_current_read */\n\n/* -------------------------- GLX_SGI_swap_control ------------------------- */\n\n#ifndef GLX_SGI_swap_control\n#define GLX_SGI_swap_control 1\n\ntypedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);\n\n#define glXSwapIntervalSGI GLXEW_GET_FUN(__glewXSwapIntervalSGI)\n\n#define GLXEW_SGI_swap_control GLXEW_GET_VAR(__GLXEW_SGI_swap_control)\n\n#endif /* GLX_SGI_swap_control */\n\n/* --------------------------- GLX_SGI_video_sync -------------------------- */\n\n#ifndef GLX_SGI_video_sync\n#define GLX_SGI_video_sync 1\n\ntypedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int* count);\ntypedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int* count);\n\n#define glXGetVideoSyncSGI GLXEW_GET_FUN(__glewXGetVideoSyncSGI)\n#define glXWaitVideoSyncSGI GLXEW_GET_FUN(__glewXWaitVideoSyncSGI)\n\n#define GLXEW_SGI_video_sync GLXEW_GET_VAR(__GLXEW_SGI_video_sync)\n\n#endif /* GLX_SGI_video_sync */\n\n/* --------------------- GLX_SUN_get_transparent_index --------------------- */\n\n#ifndef GLX_SUN_get_transparent_index\n#define GLX_SUN_get_transparent_index 1\n\ntypedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display* dpy, Window overlay, Window underlay, unsigned long *pTransparentIndex);\n\n#define glXGetTransparentIndexSUN GLXEW_GET_FUN(__glewXGetTransparentIndexSUN)\n\n#define GLXEW_SUN_get_transparent_index GLXEW_GET_VAR(__GLXEW_SUN_get_transparent_index)\n\n#endif /* GLX_SUN_get_transparent_index */\n\n/* -------------------------- GLX_SUN_video_resize ------------------------- */\n\n#ifndef GLX_SUN_video_resize\n#define GLX_SUN_video_resize 1\n\n#define GLX_VIDEO_RESIZE_SUN 0x8171\n#define GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD\n\ntypedef int ( * PFNGLXGETVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float* factor);\ntypedef int ( * PFNGLXVIDEORESIZESUNPROC) (Display* display, GLXDrawable window, float factor);\n\n#define glXGetVideoResizeSUN GLXEW_GET_FUN(__glewXGetVideoResizeSUN)\n#define glXVideoResizeSUN GLXEW_GET_FUN(__glewXVideoResizeSUN)\n\n#define GLXEW_SUN_video_resize GLXEW_GET_VAR(__GLXEW_SUN_video_resize)\n\n#endif /* GLX_SUN_video_resize */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define GLXEW_FUN_EXPORT\n#define GLXEW_VAR_EXPORT\n#else\n#define GLXEW_FUN_EXPORT GLEW_FUN_EXPORT\n#define GLXEW_VAR_EXPORT GLEW_VAR_EXPORT\n#endif /* GLEW_MX */\n\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTDISPLAYPROC __glewXGetCurrentDisplay;\n\nGLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGPROC __glewXChooseFBConfig;\nGLXEW_FUN_EXPORT PFNGLXCREATENEWCONTEXTPROC __glewXCreateNewContext;\nGLXEW_FUN_EXPORT PFNGLXCREATEPBUFFERPROC __glewXCreatePbuffer;\nGLXEW_FUN_EXPORT PFNGLXCREATEPIXMAPPROC __glewXCreatePixmap;\nGLXEW_FUN_EXPORT PFNGLXCREATEWINDOWPROC __glewXCreateWindow;\nGLXEW_FUN_EXPORT PFNGLXDESTROYPBUFFERPROC __glewXDestroyPbuffer;\nGLXEW_FUN_EXPORT PFNGLXDESTROYPIXMAPPROC __glewXDestroyPixmap;\nGLXEW_FUN_EXPORT PFNGLXDESTROYWINDOWPROC __glewXDestroyWindow;\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLEPROC __glewXGetCurrentReadDrawable;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBPROC __glewXGetFBConfigAttrib;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGSPROC __glewXGetFBConfigs;\nGLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTPROC __glewXGetSelectedEvent;\nGLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGPROC __glewXGetVisualFromFBConfig;\nGLXEW_FUN_EXPORT PFNGLXMAKECONTEXTCURRENTPROC __glewXMakeContextCurrent;\nGLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTPROC __glewXQueryContext;\nGLXEW_FUN_EXPORT PFNGLXQUERYDRAWABLEPROC __glewXQueryDrawable;\nGLXEW_FUN_EXPORT PFNGLXSELECTEVENTPROC __glewXSelectEvent;\n\nGLXEW_FUN_EXPORT PFNGLXCREATECONTEXTATTRIBSARBPROC __glewXCreateContextAttribsARB;\n\nGLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEATIPROC __glewXBindTexImageATI;\nGLXEW_FUN_EXPORT PFNGLXDRAWABLEATTRIBATIPROC __glewXDrawableAttribATI;\nGLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEATIPROC __glewXReleaseTexImageATI;\n\nGLXEW_FUN_EXPORT PFNGLXFREECONTEXTEXTPROC __glewXFreeContextEXT;\nGLXEW_FUN_EXPORT PFNGLXGETCONTEXTIDEXTPROC __glewXGetContextIDEXT;\nGLXEW_FUN_EXPORT PFNGLXIMPORTCONTEXTEXTPROC __glewXImportContextEXT;\nGLXEW_FUN_EXPORT PFNGLXQUERYCONTEXTINFOEXTPROC __glewXQueryContextInfoEXT;\n\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALEXTPROC __glewXSwapIntervalEXT;\n\nGLXEW_FUN_EXPORT PFNGLXBINDTEXIMAGEEXTPROC __glewXBindTexImageEXT;\nGLXEW_FUN_EXPORT PFNGLXRELEASETEXIMAGEEXTPROC __glewXReleaseTexImageEXT;\n\nGLXEW_FUN_EXPORT PFNGLXGETAGPOFFSETMESAPROC __glewXGetAGPOffsetMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCOPYSUBBUFFERMESAPROC __glewXCopySubBufferMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPMESAPROC __glewXCreateGLXPixmapMESA;\n\nGLXEW_FUN_EXPORT PFNGLXRELEASEBUFFERSMESAPROC __glewXReleaseBuffersMESA;\n\nGLXEW_FUN_EXPORT PFNGLXSET3DFXMODEMESAPROC __glewXSet3DfxModeMESA;\n\nGLXEW_FUN_EXPORT PFNGLXGETSWAPINTERVALMESAPROC __glewXGetSwapIntervalMESA;\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALMESAPROC __glewXSwapIntervalMESA;\n\nGLXEW_FUN_EXPORT PFNGLXCOPYIMAGESUBDATANVPROC __glewXCopyImageSubDataNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEODEVICENVPROC __glewXBindVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEODEVICESNVPROC __glewXEnumerateVideoDevicesNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERNVPROC __glewXBindSwapBarrierNV;\nGLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPNVPROC __glewXJoinSwapGroupNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYFRAMECOUNTNVPROC __glewXQueryFrameCountNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPGROUPSNVPROC __glewXQueryMaxSwapGroupsNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYSWAPGROUPNVPROC __glewXQuerySwapGroupNV;\nGLXEW_FUN_EXPORT PFNGLXRESETFRAMECOUNTNVPROC __glewXResetFrameCountNV;\n\nGLXEW_FUN_EXPORT PFNGLXALLOCATEMEMORYNVPROC __glewXAllocateMemoryNV;\nGLXEW_FUN_EXPORT PFNGLXFREEMEMORYNVPROC __glewXFreeMemoryNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEOCAPTUREDEVICENVPROC __glewXBindVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC __glewXEnumerateVideoCaptureDevicesNV;\nGLXEW_FUN_EXPORT PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC __glewXLockVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC __glewXQueryVideoCaptureDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC __glewXReleaseVideoCaptureDeviceNV;\n\nGLXEW_FUN_EXPORT PFNGLXBINDVIDEOIMAGENVPROC __glewXBindVideoImageNV;\nGLXEW_FUN_EXPORT PFNGLXGETVIDEODEVICENVPROC __glewXGetVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXGETVIDEOINFONVPROC __glewXGetVideoInfoNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEODEVICENVPROC __glewXReleaseVideoDeviceNV;\nGLXEW_FUN_EXPORT PFNGLXRELEASEVIDEOIMAGENVPROC __glewXReleaseVideoImageNV;\nGLXEW_FUN_EXPORT PFNGLXSENDPBUFFERTOVIDEONVPROC __glewXSendPbufferToVideoNV;\n\nGLXEW_FUN_EXPORT PFNGLXGETMSCRATEOMLPROC __glewXGetMscRateOML;\nGLXEW_FUN_EXPORT PFNGLXGETSYNCVALUESOMLPROC __glewXGetSyncValuesOML;\nGLXEW_FUN_EXPORT PFNGLXSWAPBUFFERSMSCOMLPROC __glewXSwapBuffersMscOML;\nGLXEW_FUN_EXPORT PFNGLXWAITFORMSCOMLPROC __glewXWaitForMscOML;\nGLXEW_FUN_EXPORT PFNGLXWAITFORSBCOMLPROC __glewXWaitForSbcOML;\n\nGLXEW_FUN_EXPORT PFNGLXCHOOSEFBCONFIGSGIXPROC __glewXChooseFBConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC __glewXCreateContextWithConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC __glewXCreateGLXPixmapWithConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGATTRIBSGIXPROC __glewXGetFBConfigAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETFBCONFIGFROMVISUALSGIXPROC __glewXGetFBConfigFromVisualSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETVISUALFROMFBCONFIGSGIXPROC __glewXGetVisualFromFBConfigSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDHYPERPIPESGIXPROC __glewXBindHyperpipeSGIX;\nGLXEW_FUN_EXPORT PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC __glewXDestroyHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXHYPERPIPEATTRIBSGIXPROC __glewXHyperpipeAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXHYPERPIPECONFIGSGIXPROC __glewXHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC __glewXQueryHyperpipeAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC __glewXQueryHyperpipeBestAttribSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPECONFIGSGIXPROC __glewXQueryHyperpipeConfigSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYHYPERPIPENETWORKSGIXPROC __glewXQueryHyperpipeNetworkSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXCREATEGLXPBUFFERSGIXPROC __glewXCreateGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXDESTROYGLXPBUFFERSGIXPROC __glewXDestroyGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXGETSELECTEDEVENTSGIXPROC __glewXGetSelectedEventSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYGLXPBUFFERSGIXPROC __glewXQueryGLXPbufferSGIX;\nGLXEW_FUN_EXPORT PFNGLXSELECTEVENTSGIXPROC __glewXSelectEventSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDSWAPBARRIERSGIXPROC __glewXBindSwapBarrierSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC __glewXQueryMaxSwapBarriersSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXJOINSWAPGROUPSGIXPROC __glewXJoinSwapGroupSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXBINDCHANNELTOWINDOWSGIXPROC __glewXBindChannelToWindowSGIX;\nGLXEW_FUN_EXPORT PFNGLXCHANNELRECTSGIXPROC __glewXChannelRectSGIX;\nGLXEW_FUN_EXPORT PFNGLXCHANNELRECTSYNCSGIXPROC __glewXChannelRectSyncSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYCHANNELDELTASSGIXPROC __glewXQueryChannelDeltasSGIX;\nGLXEW_FUN_EXPORT PFNGLXQUERYCHANNELRECTSGIXPROC __glewXQueryChannelRectSGIX;\n\nGLXEW_FUN_EXPORT PFNGLXCUSHIONSGIPROC __glewXCushionSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETCURRENTREADDRAWABLESGIPROC __glewXGetCurrentReadDrawableSGI;\nGLXEW_FUN_EXPORT PFNGLXMAKECURRENTREADSGIPROC __glewXMakeCurrentReadSGI;\n\nGLXEW_FUN_EXPORT PFNGLXSWAPINTERVALSGIPROC __glewXSwapIntervalSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETVIDEOSYNCSGIPROC __glewXGetVideoSyncSGI;\nGLXEW_FUN_EXPORT PFNGLXWAITVIDEOSYNCSGIPROC __glewXWaitVideoSyncSGI;\n\nGLXEW_FUN_EXPORT PFNGLXGETTRANSPARENTINDEXSUNPROC __glewXGetTransparentIndexSUN;\n\nGLXEW_FUN_EXPORT PFNGLXGETVIDEORESIZESUNPROC __glewXGetVideoResizeSUN;\nGLXEW_FUN_EXPORT PFNGLXVIDEORESIZESUNPROC __glewXVideoResizeSUN;\n\n#if defined(GLEW_MX)\nstruct GLXEWContextStruct\n{\n#endif /* GLEW_MX */\n\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_3;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_4;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_3DFX_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_AMD_gpu_association;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_create_context_robustness;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_fbconfig_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_framebuffer_sRGB;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_get_proc_address;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_application_isolation;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_robustness_share_group_isolation;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ARB_vertex_buffer_object;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_pixel_format_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_ATI_render_texture;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es2_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_create_context_es_profile;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_fbconfig_packed_float;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_framebuffer_sRGB;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_import_context;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_scene_marker;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_swap_control_tear;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_texture_from_pixmap;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_info;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_EXT_visual_rating;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_INTEL_swap_event;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_agp_offset;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_copy_sub_buffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_pixmap_colormap;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_release_buffers;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_set_3dfx_mode;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_MESA_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_copy_image;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_float_buffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_multisample_coverage;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_present_video;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_swap_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_vertex_array_range;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_capture;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_NV_video_out;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_OML_swap_method;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_OML_sync_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_blended_overlay;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_color_range;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIS_shared_multisample;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_fbconfig;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_hyperpipe;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_pbuffer;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_barrier;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_swap_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_video_resize;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGIX_visual_select_group;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_cushion;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_make_current_read;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_swap_control;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SGI_video_sync;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_get_transparent_index;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_SUN_video_resize;\n\n#ifdef GLEW_MX\n}; /* GLXEWContextStruct */\n#endif /* GLEW_MX */\n\n/* ------------------------------------------------------------------------ */\n\n#ifdef GLEW_MX\n\ntypedef struct GLXEWContextStruct GLXEWContext;\nGLEWAPI GLenum GLEWAPIENTRY glxewContextInit (GLXEWContext *ctx);\nGLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx, const char *name);\n\n#define glxewInit() glxewContextInit(glxewGetContext())\n#define glxewIsSupported(x) glxewContextIsSupported(glxewGetContext(), x)\n\n#define GLXEW_GET_VAR(x) (*(const GLboolean*)&(glxewGetContext()->x))\n#define GLXEW_GET_FUN(x) x\n\n#else /* GLEW_MX */\n\n#define GLXEW_GET_VAR(x) (*(const GLboolean*)&x)\n#define GLXEW_GET_FUN(x) x\n\nGLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);\n\n#endif /* GLEW_MX */\n\nGLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* __glxew_h__ */\n"}, {"path": "includes/GL/wglew.h", "language": "code", "loc": 1039, "comment_density": 0.159, "code": "/*\n** The OpenGL Extension Wrangler Library\n** Copyright (C) 2002-2008, Milan Ikits \n** Copyright (C) 2002-2008, Marcelo E. Magallon \n** Copyright (C) 2002, Lev Povalahev\n** All rights reserved.\n** \n** Redistribution and use in source and binary forms, with or without \n** modification, are permitted provided that the following conditions are met:\n** \n** * Redistributions of source code must retain the above copyright notice, \n** this list of conditions and the following disclaimer.\n** * Redistributions in binary form must reproduce the above copyright notice, \n** this list of conditions and the following disclaimer in the documentation \n** and/or other materials provided with the distribution.\n** * The name of the author may be used to endorse or promote products \n** derived from this software without specific prior written permission.\n**\n** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \n** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n** THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n/*\n** Copyright (c) 2007 The Khronos Group Inc.\n** \n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n** \n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n** \n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n#ifndef __wglew_h__\n#define __wglew_h__\n#define __WGLEW_H__\n\n#ifdef __wglext_h_\n#error wglext.h included before wglew.h\n#endif\n\n#define __wglext_h_\n\n#if !defined(WINAPI)\n# ifndef WIN32_LEAN_AND_MEAN\n# define WIN32_LEAN_AND_MEAN 1\n# endif\n#include \n# undef WIN32_LEAN_AND_MEAN\n#endif\n\n/*\n * GLEW_STATIC needs to be set when using the static version.\n * GLEW_BUILD is set when building the DLL version.\n */\n#ifdef GLEW_STATIC\n# define GLEWAPI extern\n#else\n# ifdef GLEW_BUILD\n# define GLEWAPI extern __declspec(dllexport)\n# else\n# define GLEWAPI extern __declspec(dllimport)\n# endif\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* -------------------------- WGL_3DFX_multisample ------------------------- */\n\n#ifndef WGL_3DFX_multisample\n#define WGL_3DFX_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_3DFX 0x2060\n#define WGL_SAMPLES_3DFX 0x2061\n\n#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample)\n\n#endif /* WGL_3DFX_multisample */\n\n/* ------------------------- WGL_3DL_stereo_control ------------------------ */\n\n#ifndef WGL_3DL_stereo_control\n#define WGL_3DL_stereo_control 1\n\n#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055\n#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056\n#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057\n#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058\n\ntypedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);\n\n#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL)\n\n#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control)\n\n#endif /* WGL_3DL_stereo_control */\n\n/* ------------------------ WGL_AMD_gpu_association ------------------------ */\n\n#ifndef WGL_AMD_gpu_association\n#define WGL_AMD_gpu_association 1\n\n#define WGL_GPU_VENDOR_AMD 0x1F00\n#define WGL_GPU_RENDERER_STRING_AMD 0x1F01\n#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02\n#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2\n#define WGL_GPU_RAM_AMD 0x21A3\n#define WGL_GPU_CLOCK_AMD 0x21A4\n#define WGL_GPU_NUM_PIPES_AMD 0x21A5\n#define WGL_GPU_NUM_SIMD_AMD 0x21A6\n#define WGL_GPU_NUM_RB_AMD 0x21A7\n#define WGL_GPU_NUM_SPI_AMD 0x21A8\n\ntypedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);\ntypedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);\ntypedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList);\ntypedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);\ntypedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);\ntypedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);\ntypedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids);\ntypedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data);\ntypedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);\n\n#define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD)\n#define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD)\n#define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD)\n#define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD)\n#define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD)\n#define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD)\n#define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD)\n#define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD)\n#define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD)\n\n#define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association)\n\n#endif /* WGL_AMD_gpu_association */\n\n/* ------------------------- WGL_ARB_buffer_region ------------------------- */\n\n#ifndef WGL_ARB_buffer_region\n#define WGL_ARB_buffer_region 1\n\n#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001\n#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002\n#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004\n#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008\n\ntypedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);\ntypedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);\ntypedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);\ntypedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);\n\n#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB)\n#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB)\n#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB)\n#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB)\n\n#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region)\n\n#endif /* WGL_ARB_buffer_region */\n\n/* ------------------------- WGL_ARB_create_context ------------------------ */\n\n#ifndef WGL_ARB_create_context\n#define WGL_ARB_create_context 1\n\n#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001\n#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002\n#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091\n#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092\n#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093\n#define WGL_CONTEXT_FLAGS_ARB 0x2094\n#define ERROR_INVALID_VERSION_ARB 0x2095\n#define ERROR_INVALID_PROFILE_ARB 0x2096\n\ntypedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList);\n\n#define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB)\n\n#define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context)\n\n#endif /* WGL_ARB_create_context */\n\n/* --------------------- WGL_ARB_create_context_profile -------------------- */\n\n#ifndef WGL_ARB_create_context_profile\n#define WGL_ARB_create_context_profile 1\n\n#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001\n#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002\n#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126\n\n#define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile)\n\n#endif /* WGL_ARB_create_context_profile */\n\n/* ------------------- WGL_ARB_create_context_robustness ------------------- */\n\n#ifndef WGL_ARB_create_context_robustness\n#define WGL_ARB_create_context_robustness 1\n\n#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004\n#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252\n#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256\n#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261\n\n#define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness)\n\n#endif /* WGL_ARB_create_context_robustness */\n\n/* ----------------------- WGL_ARB_extensions_string ----------------------- */\n\n#ifndef WGL_ARB_extensions_string\n#define WGL_ARB_extensions_string 1\n\ntypedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);\n\n#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB)\n\n#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string)\n\n#endif /* WGL_ARB_extensions_string */\n\n/* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */\n\n#ifndef WGL_ARB_framebuffer_sRGB\n#define WGL_ARB_framebuffer_sRGB 1\n\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9\n\n#define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB)\n\n#endif /* WGL_ARB_framebuffer_sRGB */\n\n/* ----------------------- WGL_ARB_make_current_read ----------------------- */\n\n#ifndef WGL_ARB_make_current_read\n#define WGL_ARB_make_current_read 1\n\n#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043\n#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054\n\ntypedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\n#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB)\n#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB)\n\n#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read)\n\n#endif /* WGL_ARB_make_current_read */\n\n/* -------------------------- WGL_ARB_multisample -------------------------- */\n\n#ifndef WGL_ARB_multisample\n#define WGL_ARB_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_ARB 0x2041\n#define WGL_SAMPLES_ARB 0x2042\n\n#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample)\n\n#endif /* WGL_ARB_multisample */\n\n/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */\n\n#ifndef WGL_ARB_pbuffer\n#define WGL_ARB_pbuffer 1\n\n#define WGL_DRAW_TO_PBUFFER_ARB 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030\n#define WGL_PBUFFER_LARGEST_ARB 0x2033\n#define WGL_PBUFFER_WIDTH_ARB 0x2034\n#define WGL_PBUFFER_HEIGHT_ARB 0x2035\n#define WGL_PBUFFER_LOST_ARB 0x2036\n\nDECLARE_HANDLE(HPBUFFERARB);\n\ntypedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);\ntypedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);\ntypedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);\ntypedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);\ntypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);\n\n#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)\n#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)\n#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)\n#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)\n#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)\n\n#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)\n\n#endif /* WGL_ARB_pbuffer */\n\n/* -------------------------- WGL_ARB_pixel_format ------------------------- */\n\n#ifndef WGL_ARB_pixel_format\n#define WGL_ARB_pixel_format 1\n\n#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000\n#define WGL_DRAW_TO_WINDOW_ARB 0x2001\n#define WGL_DRAW_TO_BITMAP_ARB 0x2002\n#define WGL_ACCELERATION_ARB 0x2003\n#define WGL_NEED_PALETTE_ARB 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006\n#define WGL_SWAP_METHOD_ARB 0x2007\n#define WGL_NUMBER_OVERLAYS_ARB 0x2008\n#define WGL_NUMBER_UNDERLAYS_ARB 0x2009\n#define WGL_TRANSPARENT_ARB 0x200A\n#define WGL_SHARE_DEPTH_ARB 0x200C\n#define WGL_SHARE_STENCIL_ARB 0x200D\n#define WGL_SHARE_ACCUM_ARB 0x200E\n#define WGL_SUPPORT_GDI_ARB 0x200F\n#define WGL_SUPPORT_OPENGL_ARB 0x2010\n#define WGL_DOUBLE_BUFFER_ARB 0x2011\n#define WGL_STEREO_ARB 0x2012\n#define WGL_PIXEL_TYPE_ARB 0x2013\n#define WGL_COLOR_BITS_ARB 0x2014\n#define WGL_RED_BITS_ARB 0x2015\n#define WGL_RED_SHIFT_ARB 0x2016\n#define WGL_GREEN_BITS_ARB 0x2017\n#define WGL_GREEN_SHIFT_ARB 0x2018\n#define WGL_BLUE_BITS_ARB 0x2019\n#define WGL_BLUE_SHIFT_ARB 0x201A\n#define WGL_ALPHA_BITS_ARB 0x201B\n#define WGL_ALPHA_SHIFT_ARB 0x201C\n#define WGL_ACCUM_BITS_ARB 0x201D\n#define WGL_ACCUM_RED_BITS_ARB 0x201E\n#define WGL_ACCUM_GREEN_BITS_ARB 0x201F\n#define WGL_ACCUM_BLUE_BITS_ARB 0x2020\n#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021\n#define WGL_DEPTH_BITS_ARB 0x2022\n#define WGL_STENCIL_BITS_ARB 0x2023\n#define WGL_AUX_BUFFERS_ARB 0x2024\n#define WGL_NO_ACCELERATION_ARB 0x2025\n#define WGL_GENERIC_ACCELERATION_ARB 0x2026\n#define WGL_FULL_ACCELERATION_ARB 0x2027\n#define WGL_SWAP_EXCHANGE_ARB 0x2028\n#define WGL_SWAP_COPY_ARB 0x2029\n#define WGL_SWAP_UNDEFINED_ARB 0x202A\n#define WGL_TYPE_RGBA_ARB 0x202B\n#define WGL_TYPE_COLORINDEX_ARB 0x202C\n#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037\n#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038\n#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039\n#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A\n#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B\n\ntypedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues);\n\n#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB)\n#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB)\n#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB)\n\n#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format)\n\n#endif /* WGL_ARB_pixel_format */\n\n/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */\n\n#ifndef WGL_ARB_pixel_format_float\n#define WGL_ARB_pixel_format_float 1\n\n#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0\n\n#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float)\n\n#endif /* WGL_ARB_pixel_format_float */\n\n/* ------------------------- WGL_ARB_render_texture ------------------------ */\n\n#ifndef WGL_ARB_render_texture\n#define WGL_ARB_render_texture 1\n\n#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070\n#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071\n#define WGL_TEXTURE_FORMAT_ARB 0x2072\n#define WGL_TEXTURE_TARGET_ARB 0x2073\n#define WGL_MIPMAP_TEXTURE_ARB 0x2074\n#define WGL_TEXTURE_RGB_ARB 0x2075\n#define WGL_TEXTURE_RGBA_ARB 0x2076\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078\n#define WGL_TEXTURE_1D_ARB 0x2079\n#define WGL_TEXTURE_2D_ARB 0x207A\n#define WGL_MIPMAP_LEVEL_ARB 0x207B\n#define WGL_CUBE_MAP_FACE_ARB 0x207C\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080\n#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081\n#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082\n#define WGL_FRONT_LEFT_ARB 0x2083\n#define WGL_FRONT_RIGHT_ARB 0x2084\n#define WGL_BACK_LEFT_ARB 0x2085\n#define WGL_BACK_RIGHT_ARB 0x2086\n#define WGL_AUX0_ARB 0x2087\n#define WGL_AUX1_ARB 0x2088\n#define WGL_AUX2_ARB 0x2089\n#define WGL_AUX3_ARB 0x208A\n#define WGL_AUX4_ARB 0x208B\n#define WGL_AUX5_ARB 0x208C\n#define WGL_AUX6_ARB 0x208D\n#define WGL_AUX7_ARB 0x208E\n#define WGL_AUX8_ARB 0x208F\n#define WGL_AUX9_ARB 0x2090\n\ntypedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\ntypedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);\ntypedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList);\n\n#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB)\n#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB)\n#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB)\n\n#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture)\n\n#endif /* WGL_ARB_render_texture */\n\n/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */\n\n#ifndef WGL_ATI_pixel_format_float\n#define WGL_ATI_pixel_format_float 1\n\n#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0\n#define GL_RGBA_FLOAT_MODE_ATI 0x8820\n#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835\n\n#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float)\n\n#endif /* WGL_ATI_pixel_format_float */\n\n/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */\n\n#ifndef WGL_ATI_render_texture_rectangle\n#define WGL_ATI_render_texture_rectangle 1\n\n#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5\n\n#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle)\n\n#endif /* WGL_ATI_render_texture_rectangle */\n\n/* ------------------- WGL_EXT_create_context_es2_profile ------------------ */\n\n#ifndef WGL_EXT_create_context_es2_profile\n#define WGL_EXT_create_context_es2_profile 1\n\n#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004\n\n#define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile)\n\n#endif /* WGL_EXT_create_context_es2_profile */\n\n/* ------------------- WGL_EXT_create_context_es_profile ------------------- */\n\n#ifndef WGL_EXT_create_context_es_profile\n#define WGL_EXT_create_context_es_profile 1\n\n#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004\n\n#define WGLEW_EXT_create_context_es_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es_profile)\n\n#endif /* WGL_EXT_create_context_es_profile */\n\n/* -------------------------- WGL_EXT_depth_float -------------------------- */\n\n#ifndef WGL_EXT_depth_float\n#define WGL_EXT_depth_float 1\n\n#define WGL_DEPTH_FLOAT_EXT 0x2040\n\n#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float)\n\n#endif /* WGL_EXT_depth_float */\n\n/* ---------------------- WGL_EXT_display_color_table ---------------------- */\n\n#ifndef WGL_EXT_display_color_table\n#define WGL_EXT_display_color_table 1\n\ntypedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);\ntypedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length);\n\n#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT)\n#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT)\n#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT)\n#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT)\n\n#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table)\n\n#endif /* WGL_EXT_display_color_table */\n\n/* ----------------------- WGL_EXT_extensions_string ----------------------- */\n\n#ifndef WGL_EXT_extensions_string\n#define WGL_EXT_extensions_string 1\n\ntypedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);\n\n#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT)\n\n#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string)\n\n#endif /* WGL_EXT_extensions_string */\n\n/* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */\n\n#ifndef WGL_EXT_framebuffer_sRGB\n#define WGL_EXT_framebuffer_sRGB 1\n\n#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9\n\n#define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB)\n\n#endif /* WGL_EXT_framebuffer_sRGB */\n\n/* ----------------------- WGL_EXT_make_current_read ----------------------- */\n\n#ifndef WGL_EXT_make_current_read\n#define WGL_EXT_make_current_read 1\n\n#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043\n\ntypedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);\n\n#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT)\n#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT)\n\n#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read)\n\n#endif /* WGL_EXT_make_current_read */\n\n/* -------------------------- WGL_EXT_multisample -------------------------- */\n\n#ifndef WGL_EXT_multisample\n#define WGL_EXT_multisample 1\n\n#define WGL_SAMPLE_BUFFERS_EXT 0x2041\n#define WGL_SAMPLES_EXT 0x2042\n\n#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample)\n\n#endif /* WGL_EXT_multisample */\n\n/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */\n\n#ifndef WGL_EXT_pbuffer\n#define WGL_EXT_pbuffer 1\n\n#define WGL_DRAW_TO_PBUFFER_EXT 0x202D\n#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E\n#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F\n#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030\n#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031\n#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032\n#define WGL_PBUFFER_LARGEST_EXT 0x2033\n#define WGL_PBUFFER_WIDTH_EXT 0x2034\n#define WGL_PBUFFER_HEIGHT_EXT 0x2035\n\nDECLARE_HANDLE(HPBUFFEREXT);\n\ntypedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);\ntypedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);\ntypedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);\ntypedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue);\ntypedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);\n\n#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT)\n#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT)\n#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT)\n#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT)\n#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT)\n\n#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer)\n\n#endif /* WGL_EXT_pbuffer */\n\n/* -------------------------- WGL_EXT_pixel_format ------------------------- */\n\n#ifndef WGL_EXT_pixel_format\n#define WGL_EXT_pixel_format 1\n\n#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000\n#define WGL_DRAW_TO_WINDOW_EXT 0x2001\n#define WGL_DRAW_TO_BITMAP_EXT 0x2002\n#define WGL_ACCELERATION_EXT 0x2003\n#define WGL_NEED_PALETTE_EXT 0x2004\n#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005\n#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006\n#define WGL_SWAP_METHOD_EXT 0x2007\n#define WGL_NUMBER_OVERLAYS_EXT 0x2008\n#define WGL_NUMBER_UNDERLAYS_EXT 0x2009\n#define WGL_TRANSPARENT_EXT 0x200A\n#define WGL_TRANSPARENT_VALUE_EXT 0x200B\n#define WGL_SHARE_DEPTH_EXT 0x200C\n#define WGL_SHARE_STENCIL_EXT 0x200D\n#define WGL_SHARE_ACCUM_EXT 0x200E\n#define WGL_SUPPORT_GDI_EXT 0x200F\n#define WGL_SUPPORT_OPENGL_EXT 0x2010\n#define WGL_DOUBLE_BUFFER_EXT 0x2011\n#define WGL_STEREO_EXT 0x2012\n#define WGL_PIXEL_TYPE_EXT 0x2013\n#define WGL_COLOR_BITS_EXT 0x2014\n#define WGL_RED_BITS_EXT 0x2015\n#define WGL_RED_SHIFT_EXT 0x2016\n#define WGL_GREEN_BITS_EXT 0x2017\n#define WGL_GREEN_SHIFT_EXT 0x2018\n#define WGL_BLUE_BITS_EXT 0x2019\n#define WGL_BLUE_SHIFT_EXT 0x201A\n#define WGL_ALPHA_BITS_EXT 0x201B\n#define WGL_ALPHA_SHIFT_EXT 0x201C\n#define WGL_ACCUM_BITS_EXT 0x201D\n#define WGL_ACCUM_RED_BITS_EXT 0x201E\n#define WGL_ACCUM_GREEN_BITS_EXT 0x201F\n#define WGL_ACCUM_BLUE_BITS_EXT 0x2020\n#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021\n#define WGL_DEPTH_BITS_EXT 0x2022\n#define WGL_STENCIL_BITS_EXT 0x2023\n#define WGL_AUX_BUFFERS_EXT 0x2024\n#define WGL_NO_ACCELERATION_EXT 0x2025\n#define WGL_GENERIC_ACCELERATION_EXT 0x2026\n#define WGL_FULL_ACCELERATION_EXT 0x2027\n#define WGL_SWAP_EXCHANGE_EXT 0x2028\n#define WGL_SWAP_COPY_EXT 0x2029\n#define WGL_SWAP_UNDEFINED_EXT 0x202A\n#define WGL_TYPE_RGBA_EXT 0x202B\n#define WGL_TYPE_COLORINDEX_EXT 0x202C\n\ntypedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues);\ntypedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);\n\n#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT)\n#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT)\n#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT)\n\n#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format)\n\n#endif /* WGL_EXT_pixel_format */\n\n/* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */\n\n#ifndef WGL_EXT_pixel_format_packed_float\n#define WGL_EXT_pixel_format_packed_float 1\n\n#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8\n\n#define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float)\n\n#endif /* WGL_EXT_pixel_format_packed_float */\n\n/* -------------------------- WGL_EXT_swap_control ------------------------- */\n\n#ifndef WGL_EXT_swap_control\n#define WGL_EXT_swap_control 1\n\ntypedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);\n\n#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT)\n#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT)\n\n#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control)\n\n#endif /* WGL_EXT_swap_control */\n\n/* ----------------------- WGL_EXT_swap_control_tear ----------------------- */\n\n#ifndef WGL_EXT_swap_control_tear\n#define WGL_EXT_swap_control_tear 1\n\n#define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear)\n\n#endif /* WGL_EXT_swap_control_tear */\n\n/* --------------------- WGL_I3D_digital_video_control --------------------- */\n\n#ifndef WGL_I3D_digital_video_control\n#define WGL_I3D_digital_video_control 1\n\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050\n#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051\n#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052\n#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053\n\ntypedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);\n\n#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D)\n#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D)\n\n#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control)\n\n#endif /* WGL_I3D_digital_video_control */\n\n/* ----------------------------- WGL_I3D_gamma ----------------------------- */\n\n#ifndef WGL_I3D_gamma\n#define WGL_I3D_gamma 1\n\n#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E\n#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F\n\ntypedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue);\ntypedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue);\ntypedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);\n\n#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D)\n#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D)\n#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D)\n#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D)\n\n#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma)\n\n#endif /* WGL_I3D_gamma */\n\n/* ---------------------------- WGL_I3D_genlock ---------------------------- */\n\n#ifndef WGL_I3D_genlock\n#define WGL_I3D_genlock 1\n\n#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044\n#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045\n#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046\n#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047\n#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048\n#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049\n#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A\n#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B\n#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C\n\ntypedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);\ntypedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);\ntypedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge);\ntypedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource);\ntypedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag);\ntypedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay);\n\n#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D)\n#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D)\n#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D)\n#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D)\n#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D)\n#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D)\n#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D)\n#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D)\n#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D)\n#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D)\n#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D)\n#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D)\n\n#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock)\n\n#endif /* WGL_I3D_genlock */\n\n/* -------------------------- WGL_I3D_image_buffer ------------------------- */\n\n#ifndef WGL_I3D_image_buffer\n#define WGL_I3D_image_buffer 1\n\n#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001\n#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002\n\ntypedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count);\ntypedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);\ntypedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);\ntypedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count);\n\n#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D)\n#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D)\n#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D)\n#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D)\n\n#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer)\n\n#endif /* WGL_I3D_image_buffer */\n\n/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */\n\n#ifndef WGL_I3D_swap_frame_lock\n#define WGL_I3D_swap_frame_lock 1\n\ntypedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID);\ntypedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag);\n\n#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D)\n#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D)\n#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D)\n#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D)\n\n#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock)\n\n#endif /* WGL_I3D_swap_frame_lock */\n\n/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */\n\n#ifndef WGL_I3D_swap_frame_usage\n#define WGL_I3D_swap_frame_usage 1\n\ntypedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);\ntypedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);\n\n#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D)\n#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D)\n#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D)\n#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D)\n\n#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage)\n\n#endif /* WGL_I3D_swap_frame_usage */\n\n/* --------------------------- WGL_NV_DX_interop --------------------------- */\n\n#ifndef WGL_NV_DX_interop\n#define WGL_NV_DX_interop 1\n\n#define WGL_ACCESS_READ_ONLY_NV 0x0000\n#define WGL_ACCESS_READ_WRITE_NV 0x0001\n#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002\n\ntypedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);\ntypedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);\ntypedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);\ntypedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice);\ntypedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access);\ntypedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle);\ntypedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);\ntypedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);\n\n#define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV)\n#define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV)\n#define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV)\n#define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV)\n#define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV)\n#define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV)\n#define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV)\n#define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV)\n\n#define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop)\n\n#endif /* WGL_NV_DX_interop */\n\n/* --------------------------- WGL_NV_DX_interop2 -------------------------- */\n\n#ifndef WGL_NV_DX_interop2\n#define WGL_NV_DX_interop2 1\n\n#define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2)\n\n#endif /* WGL_NV_DX_interop2 */\n\n/* --------------------------- WGL_NV_copy_image --------------------------- */\n\n#ifndef WGL_NV_copy_image\n#define WGL_NV_copy_image 1\n\ntypedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);\n\n#define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV)\n\n#define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image)\n\n#endif /* WGL_NV_copy_image */\n\n/* -------------------------- WGL_NV_float_buffer -------------------------- */\n\n#ifndef WGL_NV_float_buffer\n#define WGL_NV_float_buffer 1\n\n#define WGL_FLOAT_COMPONENTS_NV 0x20B0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4\n#define WGL_TEXTURE_FLOAT_R_NV 0x20B5\n#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6\n#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7\n#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8\n\n#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer)\n\n#endif /* WGL_NV_float_buffer */\n\n/* -------------------------- WGL_NV_gpu_affinity -------------------------- */\n\n#ifndef WGL_NV_gpu_affinity\n#define WGL_NV_gpu_affinity 1\n\n#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0\n#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1\n\nDECLARE_HANDLE(HGPUNV);\ntypedef struct _GPU_DEVICE {\n DWORD cb; \n CHAR DeviceName[32]; \n CHAR DeviceString[128]; \n DWORD Flags; \n RECT rcVirtualScreen; \n} GPU_DEVICE, *PGPU_DEVICE;\n\ntypedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);\ntypedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);\ntypedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);\n\n#define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV)\n#define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV)\n#define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV)\n#define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV)\n#define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV)\n\n#define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity)\n\n#endif /* WGL_NV_gpu_affinity */\n\n/* ---------------------- WGL_NV_multisample_coverage ---------------------- */\n\n#ifndef WGL_NV_multisample_coverage\n#define WGL_NV_multisample_coverage 1\n\n#define WGL_COVERAGE_SAMPLES_NV 0x2042\n#define WGL_COLOR_SAMPLES_NV 0x20B9\n\n#define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage)\n\n#endif /* WGL_NV_multisample_coverage */\n\n/* -------------------------- WGL_NV_present_video ------------------------- */\n\n#ifndef WGL_NV_present_video\n#define WGL_NV_present_video 1\n\n#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0\n\nDECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList);\ntypedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList);\ntypedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue);\n\n#define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV)\n#define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV)\n#define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV)\n\n#define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video)\n\n#endif /* WGL_NV_present_video */\n\n/* ---------------------- WGL_NV_render_depth_texture ---------------------- */\n\n#ifndef WGL_NV_render_depth_texture\n#define WGL_NV_render_depth_texture 1\n\n#define WGL_NO_TEXTURE_ARB 0x2077\n#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4\n#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5\n#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6\n#define WGL_DEPTH_COMPONENT_NV 0x20A7\n\n#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture)\n\n#endif /* WGL_NV_render_depth_texture */\n\n/* -------------------- WGL_NV_render_texture_rectangle -------------------- */\n\n#ifndef WGL_NV_render_texture_rectangle\n#define WGL_NV_render_texture_rectangle 1\n\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0\n#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1\n#define WGL_TEXTURE_RECTANGLE_NV 0x20A2\n\n#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle)\n\n#endif /* WGL_NV_render_texture_rectangle */\n\n/* --------------------------- WGL_NV_swap_group --------------------------- */\n\n#ifndef WGL_NV_swap_group\n#define WGL_NV_swap_group 1\n\ntypedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);\ntypedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);\ntypedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count);\ntypedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers);\ntypedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier);\ntypedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);\n\n#define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV)\n#define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV)\n#define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV)\n#define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV)\n#define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV)\n#define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV)\n\n#define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group)\n\n#endif /* WGL_NV_swap_group */\n\n/* ----------------------- WGL_NV_vertex_array_range ----------------------- */\n\n#ifndef WGL_NV_vertex_array_range\n#define WGL_NV_vertex_array_range 1\n\ntypedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);\ntypedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);\n\n#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV)\n#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV)\n\n#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range)\n\n#endif /* WGL_NV_vertex_array_range */\n\n/* -------------------------- WGL_NV_video_capture ------------------------- */\n\n#ifndef WGL_NV_video_capture\n#define WGL_NV_video_capture 1\n\n#define WGL_UNIQUE_ID_NV 0x20CE\n#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF\n\nDECLARE_HANDLE(HVIDEOINPUTDEVICENV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);\ntypedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList);\ntypedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\ntypedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);\n\n#define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV)\n#define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV)\n#define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV)\n#define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV)\n#define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV)\n\n#define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture)\n\n#endif /* WGL_NV_video_capture */\n\n/* -------------------------- WGL_NV_video_output -------------------------- */\n\n#ifndef WGL_NV_video_output\n#define WGL_NV_video_output 1\n\n#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0\n#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1\n#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2\n#define WGL_VIDEO_OUT_COLOR_NV 0x20C3\n#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4\n#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5\n#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6\n#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7\n#define WGL_VIDEO_OUT_FRAME 0x20C8\n#define WGL_VIDEO_OUT_FIELD_1 0x20C9\n#define WGL_VIDEO_OUT_FIELD_2 0x20CA\n#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB\n#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC\n\nDECLARE_HANDLE(HPVIDEODEV);\n\ntypedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);\ntypedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice);\ntypedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);\ntypedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);\ntypedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock);\n\n#define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV)\n#define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV)\n#define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV)\n#define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV)\n#define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV)\n#define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV)\n\n#define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output)\n\n#endif /* WGL_NV_video_output */\n\n/* -------------------------- WGL_OML_sync_control ------------------------- */\n\n#ifndef WGL_OML_sync_control\n#define WGL_OML_sync_control 1\n\ntypedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator);\ntypedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc);\ntypedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);\ntypedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);\ntypedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc);\ntypedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc);\n\n#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML)\n#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML)\n#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML)\n#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML)\n#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML)\n#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML)\n\n#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control)\n\n#endif /* WGL_OML_sync_control */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define WGLEW_FUN_EXPORT\n#define WGLEW_VAR_EXPORT\n#else\n#define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT\n#define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT\n#endif /* GLEW_MX */\n\n#ifdef GLEW_MX\nstruct WGLEWContextStruct\n{\n#endif /* GLEW_MX */\n\nWGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL;\n\nWGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD;\nWGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD;\nWGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD;\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD;\nWGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD;\nWGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD;\nWGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB;\nWGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB;\n\nWGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB;\n\nWGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB;\n\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB;\nWGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB;\nWGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB;\nWGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB;\nWGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB;\nWGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB;\n\nWGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB;\n\nWGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB;\nWGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB;\nWGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB;\n\nWGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT;\nWGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT;\nWGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT;\nWGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT;\nWGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT;\n\nWGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT;\nWGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT;\nWGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT;\n\nWGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D;\nWGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D;\n\nWGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D;\nWGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D;\nWGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D;\nWGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D;\nWGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D;\nWGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D;\n\nWGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D;\nWGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D;\nWGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D;\nWGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D;\n\nWGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D;\nWGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D;\nWGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D;\n\nWGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV;\nWGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV;\nWGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV;\nWGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV;\nWGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV;\nWGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV;\n\nWGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV;\n\nWGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV;\nWGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV;\nWGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV;\nWGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV;\nWGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV;\n\nWGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV;\nWGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV;\nWGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV;\n\nWGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV;\nWGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV;\nWGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV;\nWGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV;\n\nWGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML;\nWGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML;\nWGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML;\nWGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML;\nWGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML;\nWGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es_profile;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output;\nWGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control;\n\n#ifdef GLEW_MX\n}; /* WGLEWContextStruct */\n#endif /* GLEW_MX */\n\n/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n\ntypedef struct WGLEWContextStruct WGLEWContext;\nGLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx);\nGLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name);\n\n#define wglewInit() wglewContextInit(wglewGetContext())\n#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x)\n\n#define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x))\n#define WGLEW_GET_FUN(x) wglewGetContext()->x\n\n#else /* GLEW_MX */\n\n#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x)\n#define WGLEW_GET_FUN(x) x\n\nGLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);\n\n#endif /* GLEW_MX */\n\nGLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name);\n\n#ifdef __cplusplus\n}\n#endif\n\n#undef GLEWAPI\n\n#endif /* __wglew_h__ */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.137, "dedup_hash": "157141cd0f51f5d3", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glad", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Glad", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glad/glad.h", "language": "code", "loc": 5226, "comment_density": 0.004, "code": "/*\n\n OpenGL loader generated by glad 0.1.13a0 on Sun Apr 2 14:54:18 2017.\n\n Language/Generator: C/C++\n Specification: gl\n APIs: gl=4.5\n Profile: compatibility\n Extensions:\n GL_KHR_debug\n Loader: True\n Local files: False\n Omit khrplatform: False\n\n Commandline:\n --profile=\"compatibility\" --api=\"gl=4.5\" --generator=\"c\" --spec=\"gl\" --extensions=\"GL_KHR_debug\"\n Online:\n http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.5&extensions=GL_KHR_debug\n*/\n\n\n#ifndef __glad_h_\n#define __glad_h_\n\n#ifdef __gl_h_\n#error OpenGL header already included, remove this include, glad already provides it\n#endif\n#define __gl_h_\n\n#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN 1\n#endif\n#include \n#endif\n\n#ifndef APIENTRY\n#define APIENTRY\n#endif\n#ifndef APIENTRYP\n#define APIENTRYP APIENTRY *\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct gladGLversionStruct {\n int major;\n int minor;\n};\n\ntypedef void* (* GLADloadproc)(const char *name);\n\n#ifndef GLAPI\n# if defined(GLAD_GLAPI_EXPORT)\n# if defined(WIN32) || defined(__CYGWIN__)\n# if defined(GLAD_GLAPI_EXPORT_BUILD)\n# if defined(__GNUC__)\n# define GLAPI __attribute__ ((dllexport)) extern\n# else\n# define GLAPI __declspec(dllexport) extern\n# endif\n# else\n# if defined(__GNUC__)\n# define GLAPI __attribute__ ((dllimport)) extern\n# else\n# define GLAPI __declspec(dllimport) extern\n# endif\n# endif\n# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD)\n# define GLAPI __attribute__ ((visibility (\"default\"))) extern\n# else\n# define GLAPI extern\n# endif\n# else\n# define GLAPI extern\n# endif\n#endif\n\nGLAPI struct gladGLversionStruct GLVersion;\n\nGLAPI int gladLoadGL(void);\n\nGLAPI int gladLoadGLLoader(GLADloadproc);\n\n#include \n#include \n#ifndef GLEXT_64_TYPES_DEFINED\n/* This code block is duplicated in glxext.h, so must be protected */\n#define GLEXT_64_TYPES_DEFINED\n/* Define int32_t, int64_t, and uint64_t types for UST/MSC */\n/* (as used in the GL_EXT_timer_query extension). */\n#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n#include \n#elif defined(__sun__) || defined(__digital__)\n#include \n#if defined(__STDC__)\n#if defined(__arch64__) || defined(_LP64)\ntypedef long int int64_t;\ntypedef unsigned long int uint64_t;\n#else\ntypedef long long int int64_t;\ntypedef unsigned long long int uint64_t;\n#endif /* __arch64__ */\n#endif /* __STDC__ */\n#elif defined( __VMS ) || defined(__sgi)\n#include \n#elif defined(__SCO__) || defined(__USLC__)\n#include \n#elif defined(__UNIXOS2__) || defined(__SOL64__)\ntypedef long int int32_t;\ntypedef long long int int64_t;\ntypedef unsigned long long int uint64_t;\n#elif defined(_WIN32) && defined(__GNUC__)\n#include \n#elif defined(_WIN32)\ntypedef __int32 int32_t;\ntypedef __int64 int64_t;\ntypedef unsigned __int64 uint64_t;\n#else\n/* Fallback if nothing above works */\n#include \n#endif\n#endif\ntypedef unsigned int GLenum;\ntypedef unsigned char GLboolean;\ntypedef unsigned int GLbitfield;\ntypedef void GLvoid;\ntypedef signed char GLbyte;\ntypedef short GLshort;\ntypedef int GLint;\ntypedef int GLclampx;\ntypedef unsigned char GLubyte;\ntypedef unsigned short GLushort;\ntypedef unsigned int GLuint;\ntypedef int GLsizei;\ntypedef float GLfloat;\ntypedef float GLclampf;\ntypedef double GLdouble;\ntypedef double GLclampd;\ntypedef void *GLeglImageOES;\ntypedef char GLchar;\ntypedef char GLcharARB;\n#ifdef __APPLE__\ntypedef void *GLhandleARB;\n#else\ntypedef unsigned int GLhandleARB;\n#endif\ntypedef unsigned short GLhalfARB;\ntypedef unsigned short GLhalf;\ntypedef GLint GLfixed;\n#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)\ntypedef long GLintptr;\n#else\ntypedef ptrdiff_t GLintptr;\n#endif\n#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)\ntypedef long GLsizeiptr;\n#else\ntypedef ptrdiff_t GLsizeiptr;\n#endif\ntypedef int64_t GLint64;\ntypedef uint64_t GLuint64;\n#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)\ntypedef long GLintptrARB;\n#else\ntypedef ptrdiff_t GLintptrARB;\n#endif\n#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)\ntypedef long GLsizeiptrARB;\n#else\ntypedef ptrdiff_t GLsizeiptrARB;\n#endif\ntypedef int64_t GLint64EXT;\ntypedef uint64_t GLuint64EXT;\ntypedef struct __GLsync *GLsync;\nstruct _cl_context;\nstruct _cl_event;\ntypedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);\ntypedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);\ntypedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);\ntypedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);\ntypedef unsigned short GLhalfNV;\ntypedef GLintptr GLvdpauSurfaceNV;\n#define GL_DEPTH_BUFFER_BIT 0x00000100\n#define GL_STENCIL_BUFFER_BIT 0x00000400\n#define GL_COLOR_BUFFER_BIT 0x00004000\n#define GL_FALSE 0\n#define GL_TRUE 1\n#define GL_POINTS 0x0000\n#define GL_LINES 0x0001\n#define GL_LINE_LOOP 0x0002\n#define GL_LINE_STRIP 0x0003\n#define GL_TRIANGLES 0x0004\n#define GL_TRIANGLE_STRIP 0x0005\n#define GL_TRIANGLE_FAN 0x0006\n#define GL_QUADS 0x0007\n#define GL_NEVER 0x0200\n#define GL_LESS 0x0201\n#define GL_EQUAL 0x0202\n#define GL_LEQUAL 0x0203\n#define GL_GREATER 0x0204\n#define GL_NOTEQUAL 0x0205\n#define GL_GEQUAL 0x0206\n#define GL_ALWAYS 0x0207\n#define GL_ZERO 0\n#define GL_ONE 1\n#define GL_SRC_COLOR 0x0300\n#define GL_ONE_MINUS_SRC_COLOR 0x0301\n#define GL_SRC_ALPHA 0x0302\n#define GL_ONE_MINUS_SRC_ALPHA 0x0303\n#define GL_DST_ALPHA 0x0304\n#define GL_ONE_MINUS_DST_ALPHA 0x0305\n#define GL_DST_COLOR 0x0306\n#define GL_ONE_MINUS_DST_COLOR 0x0307\n#define GL_SRC_ALPHA_SATURATE 0x0308\n#define GL_NONE 0\n#define GL_FRONT_LEFT 0x0400\n#define GL_FRONT_RIGHT 0x0401\n#define GL_BACK_LEFT 0x0402\n#define GL_BACK_RIGHT 0x0403\n#define GL_FRONT 0x0404\n#define GL_BACK 0x0405\n#define GL_LEFT 0x0406\n#define GL_RIGHT 0x0407\n#define GL_FRONT_AND_BACK 0x0408\n#define GL_NO_ERROR 0\n#define GL_INVALID_ENUM 0x0500\n#define GL_INVALID_VALUE 0x0501\n#define GL_INVALID_OPERATION 0x0502\n#define GL_OUT_OF_MEMORY 0x0505\n#define GL_CW 0x0900\n#define GL_CCW 0x0901\n#define GL_POINT_SIZE 0x0B11\n#define GL_POINT_SIZE_RANGE 0x0B12\n#define GL_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_LINE_SMOOTH 0x0B20\n#define GL_LINE_WIDTH 0x0B21\n#define GL_LINE_WIDTH_RANGE 0x0B22\n#define GL_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_POLYGON_MODE 0x0B40\n#define GL_POLYGON_SMOOTH 0x0B41\n#define GL_CULL_FACE 0x0B44\n#define GL_CULL_FACE_MODE 0x0B45\n#define GL_FRONT_FACE 0x0B46\n#define GL_DEPTH_RANGE 0x0B70\n#define GL_DEPTH_TEST 0x0B71\n#define GL_DEPTH_WRITEMASK 0x0B72\n#define GL_DEPTH_CLEAR_VALUE 0x0B73\n#define GL_DEPTH_FUNC 0x0B74\n#define GL_STENCIL_TEST 0x0B90\n#define GL_STENCIL_CLEAR_VALUE 0x0B91\n#define GL_STENCIL_FUNC 0x0B92\n#define GL_STENCIL_VALUE_MASK 0x0B93\n#define GL_STENCIL_FAIL 0x0B94\n#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95\n#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96\n#define GL_STENCIL_REF 0x0B97\n#define GL_STENCIL_WRITEMASK 0x0B98\n#define GL_VIEWPORT 0x0BA2\n#define GL_DITHER 0x0BD0\n#define GL_BLEND_DST 0x0BE0\n#define GL_BLEND_SRC 0x0BE1\n#define GL_BLEND 0x0BE2\n#define GL_LOGIC_OP_MODE 0x0BF0\n#define GL_COLOR_LOGIC_OP 0x0BF2\n#define GL_DRAW_BUFFER 0x0C01\n#define GL_READ_BUFFER 0x0C02\n#define GL_SCISSOR_BOX 0x0C10\n#define GL_SCISSOR_TEST 0x0C11\n#define GL_COLOR_CLEAR_VALUE 0x0C22\n#define GL_COLOR_WRITEMASK 0x0C23\n#define GL_DOUBLEBUFFER 0x0C32\n#define GL_STEREO 0x0C33\n#define GL_LINE_SMOOTH_HINT 0x0C52\n#define GL_POLYGON_SMOOTH_HINT 0x0C53\n#define GL_UNPACK_SWAP_BYTES 0x0CF0\n#define GL_UNPACK_LSB_FIRST 0x0CF1\n#define GL_UNPACK_ROW_LENGTH 0x0CF2\n#define GL_UNPACK_SKIP_ROWS 0x0CF3\n#define GL_UNPACK_SKIP_PIXELS 0x0CF4\n#define GL_UNPACK_ALIGNMENT 0x0CF5\n#define GL_PACK_SWAP_BYTES 0x0D00\n#define GL_PACK_LSB_FIRST 0x0D01\n#define GL_PACK_ROW_LENGTH 0x0D02\n#define GL_PACK_SKIP_ROWS 0x0D03\n#define GL_PACK_SKIP_PIXELS 0x0D04\n#define GL_PACK_ALIGNMENT 0x0D05\n#define GL_MAX_TEXTURE_SIZE 0x0D33\n#define GL_MAX_VIEWPORT_DIMS 0x0D3A\n#define GL_SUBPIXEL_BITS 0x0D50\n#define GL_TEXTURE_1D 0x0DE0\n#define GL_TEXTURE_2D 0x0DE1\n#define GL_POLYGON_OFFSET_UNITS 0x2A00\n#define GL_POLYGON_OFFSET_POINT 0x2A01\n#define GL_POLYGON_OFFSET_LINE 0x2A02\n#define GL_POLYGON_OFFSET_FILL 0x8037\n#define GL_POLYGON_OFFSET_FACTOR 0x8038\n#define GL_TEXTURE_BINDING_1D 0x8068\n#define GL_TEXTURE_BINDING_2D 0x8069\n#define GL_TEXTURE_WIDTH 0x1000\n#define GL_TEXTURE_HEIGHT 0x1001\n#define GL_TEXTURE_INTERNAL_FORMAT 0x1003\n#define GL_TEXTURE_BORDER_COLOR 0x1004\n#define GL_TEXTURE_RED_SIZE 0x805C\n#define GL_TEXTURE_GREEN_SIZE 0x805D\n#define GL_TEXTURE_BLUE_SIZE 0x805E\n#define GL_TEXTURE_ALPHA_SIZE 0x805F\n#define GL_DONT_CARE 0x1100\n#define GL_FASTEST 0x1101\n#define GL_NICEST 0x1102\n#define GL_BYTE 0x1400\n#define GL_UNSIGNED_BYTE 0x1401\n#define GL_SHORT 0x1402\n#define GL_UNSIGNED_SHORT 0x1403\n#define GL_INT 0x1404\n#define GL_UNSIGNED_INT 0x1405\n#define GL_FLOAT 0x1406\n#define GL_DOUBLE 0x140A\n#define GL_STACK_OVERFLOW 0x0503\n#define GL_STACK_UNDERFLOW 0x0504\n#define GL_CLEAR 0x1500\n#define GL_AND 0x1501\n#define GL_AND_REVERSE 0x1502\n#define GL_COPY 0x1503\n#define GL_AND_INVERTED 0x1504\n#define GL_NOOP 0x1505\n#define GL_XOR 0x1506\n#define GL_OR 0x1507\n#define GL_NOR 0x1508\n#define GL_EQUIV 0x1509\n#define GL_INVERT 0x150A\n#define GL_OR_REVERSE 0x150B\n#define GL_COPY_INVERTED 0x150C\n#define GL_OR_INVERTED 0x150D\n#define GL_NAND 0x150E\n#define GL_SET 0x150F\n#define GL_TEXTURE 0x1702\n#define GL_COLOR 0x1800\n#define GL_DEPTH 0x1801\n#define GL_STENCIL 0x1802\n#define GL_STENCIL_INDEX 0x1901\n#define GL_DEPTH_COMPONENT 0x1902\n#define GL_RED 0x1903\n#define GL_GREEN 0x1904\n#define GL_BLUE 0x1905\n#define GL_ALPHA 0x1906\n#define GL_RGB 0x1907\n#define GL_RGBA 0x1908\n#define GL_POINT 0x1B00\n#define GL_LINE 0x1B01\n#define GL_FILL 0x1B02\n#define GL_KEEP 0x1E00\n#define GL_REPLACE 0x1E01\n#define GL_INCR 0x1E02\n#define GL_DECR 0x1E03\n#define GL_VENDOR 0x1F00\n#define GL_RENDERER 0x1F01\n#define GL_VERSION 0x1F02\n#define GL_EXTENSIONS 0x1F03\n#define GL_NEAREST 0x2600\n#define GL_LINEAR 0x2601\n#define GL_NEAREST_MIPMAP_NEAREST 0x2700\n#define GL_LINEAR_MIPMAP_NEAREST 0x2701\n#define GL_NEAREST_MIPMAP_LINEAR 0x2702\n#define GL_LINEAR_MIPMAP_LINEAR 0x2703\n#define GL_TEXTURE_MAG_FILTER 0x2800\n#define GL_TEXTURE_MIN_FILTER 0x2801\n#define GL_TEXTURE_WRAP_S 0x2802\n#define GL_TEXTURE_WRAP_T 0x2803\n#define GL_PROXY_TEXTURE_1D 0x8063\n#define GL_PROXY_TEXTURE_2D 0x8064\n#define GL_REPEAT 0x2901\n#define GL_R3_G3_B2 0x2A10\n#define GL_RGB4 0x804F\n#define GL_RGB5 0x8050\n#define GL_RGB8 0x8051\n#define GL_RGB10 0x8052\n#define GL_RGB12 0x8053\n#define GL_RGB16 0x8054\n#define GL_RGBA2 0x8055\n#define GL_RGBA4 0x8056\n#define GL_RGB5_A1 0x8057\n#define GL_RGBA8 0x8058\n#define GL_RGB10_A2 0x8059\n#define GL_RGBA12 0x805A\n#define GL_RGBA16 0x805B\n#define GL_CURRENT_BIT 0x00000001\n#define GL_POINT_BIT 0x00000002\n#define GL_LINE_BIT 0x00000004\n#define GL_POLYGON_BIT 0x00000008\n#define GL_POLYGON_STIPPLE_BIT 0x00000010\n#define GL_PIXEL_MODE_BIT 0x00000020\n#define GL_LIGHTING_BIT 0x00000040\n#define GL_FOG_BIT 0x00000080\n#define GL_ACCUM_BUFFER_BIT 0x00000200\n#define GL_VIEWPORT_BIT 0x00000800\n#define GL_TRANSFORM_BIT 0x00001000\n#define GL_ENABLE_BIT 0x00002000\n#define GL_HINT_BIT 0x00008000\n#define GL_EVAL_BIT 0x00010000\n#define GL_LIST_BIT 0x00020000\n#define GL_TEXTURE_BIT 0x00040000\n#define GL_SCISSOR_BIT 0x00080000\n#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF\n#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001\n#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002\n#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF\n#define GL_QUAD_STRIP 0x0008\n#define GL_POLYGON 0x0009\n#define GL_ACCUM 0x0100\n#define GL_LOAD 0x0101\n#define GL_RETURN 0x0102\n#define GL_MULT 0x0103\n#define GL_ADD 0x0104\n#define GL_AUX0 0x0409\n#define GL_AUX1 0x040A\n#define GL_AUX2 0x040B\n#define GL_AUX3 0x040C\n#define GL_2D 0x0600\n#define GL_3D 0x0601\n#define GL_3D_COLOR 0x0602\n#define GL_3D_COLOR_TEXTURE 0x0603\n#define GL_4D_COLOR_TEXTURE 0x0604\n#define GL_PASS_THROUGH_TOKEN 0x0700\n#define GL_POINT_TOKEN 0x0701\n#define GL_LINE_TOKEN 0x0702\n#define GL_POLYGON_TOKEN 0x0703\n#define GL_BITMAP_TOKEN 0x0704\n#define GL_DRAW_PIXEL_TOKEN 0x0705\n#define GL_COPY_PIXEL_TOKEN 0x0706\n#define GL_LINE_RESET_TOKEN 0x0707\n#define GL_EXP 0x0800\n#define GL_EXP2 0x0801\n#define GL_COEFF 0x0A00\n#define GL_ORDER 0x0A01\n#define GL_DOMAIN 0x0A02\n#define GL_PIXEL_MAP_I_TO_I 0x0C70\n#define GL_PIXEL_MAP_S_TO_S 0x0C71\n#define GL_PIXEL_MAP_I_TO_R 0x0C72\n#define GL_PIXEL_MAP_I_TO_G 0x0C73\n#define GL_PIXEL_MAP_I_TO_B 0x0C74\n#define GL_PIXEL_MAP_I_TO_A 0x0C75\n#define GL_PIXEL_MAP_R_TO_R 0x0C76\n#define GL_PIXEL_MAP_G_TO_G 0x0C77\n#define GL_PIXEL_MAP_B_TO_B 0x0C78\n#define GL_PIXEL_MAP_A_TO_A 0x0C79\n#define GL_VERTEX_ARRAY_POINTER 0x808E\n#define GL_NORMAL_ARRAY_POINTER 0x808F\n#define GL_COLOR_ARRAY_POINTER 0x8090\n#define GL_INDEX_ARRAY_POINTER 0x8091\n#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092\n#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093\n#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0\n#define GL_SELECTION_BUFFER_POINTER 0x0DF3\n#define GL_CURRENT_COLOR 0x0B00\n#define GL_CURRENT_INDEX 0x0B01\n#define GL_CURRENT_NORMAL 0x0B02\n#define GL_CURRENT_TEXTURE_COORDS 0x0B03\n#define GL_CURRENT_RASTER_COLOR 0x0B04\n#define GL_CURRENT_RASTER_INDEX 0x0B05\n#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06\n#define GL_CURRENT_RASTER_POSITION 0x0B07\n#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08\n#define GL_CURRENT_RASTER_DISTANCE 0x0B09\n#define GL_POINT_SMOOTH 0x0B10\n#define GL_LINE_STIPPLE 0x0B24\n#define GL_LINE_STIPPLE_PATTERN 0x0B25\n#define GL_LINE_STIPPLE_REPEAT 0x0B26\n#define GL_LIST_MODE 0x0B30\n#define GL_MAX_LIST_NESTING 0x0B31\n#define GL_LIST_BASE 0x0B32\n#define GL_LIST_INDEX 0x0B33\n#define GL_POLYGON_STIPPLE 0x0B42\n#define GL_EDGE_FLAG 0x0B43\n#define GL_LIGHTING 0x0B50\n#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51\n#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52\n#define GL_LIGHT_MODEL_AMBIENT 0x0B53\n#define GL_SHADE_MODEL 0x0B54\n#define GL_COLOR_MATERIAL_FACE 0x0B55\n#define GL_COLOR_MATERIAL_PARAMETER 0x0B56\n#define GL_COLOR_MATERIAL 0x0B57\n#define GL_FOG 0x0B60\n#define GL_FOG_INDEX 0x0B61\n#define GL_FOG_DENSITY 0x0B62\n#define GL_FOG_START 0x0B63\n#define GL_FOG_END 0x0B64\n#define GL_FOG_MODE 0x0B65\n#define GL_FOG_COLOR 0x0B66\n#define GL_ACCUM_CLEAR_VALUE 0x0B80\n#define GL_MATRIX_MODE 0x0BA0\n#define GL_NORMALIZE 0x0BA1\n#define GL_MODELVIEW_STACK_DEPTH 0x0BA3\n#define GL_PROJECTION_STACK_DEPTH 0x0BA4\n#define GL_TEXTURE_STACK_DEPTH 0x0BA5\n#define GL_MODELVIEW_MATRIX 0x0BA6\n#define GL_PROJECTION_MATRIX 0x0BA7\n#define GL_TEXTURE_MATRIX 0x0BA8\n#define GL_ATTRIB_STACK_DEPTH 0x0BB0\n#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1\n#define GL_ALPHA_TEST 0x0BC0\n#define GL_ALPHA_TEST_FUNC 0x0BC1\n#define GL_ALPHA_TEST_REF 0x0BC2\n#define GL_INDEX_LOGIC_OP 0x0BF1\n#define GL_LOGIC_OP 0x0BF1\n#define GL_AUX_BUFFERS 0x0C00\n#define GL_INDEX_CLEAR_VALUE 0x0C20\n#define GL_INDEX_WRITEMASK 0x0C21\n#define GL_INDEX_MODE 0x0C30\n#define GL_RGBA_MODE 0x0C31\n#define GL_RENDER_MODE 0x0C40\n#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50\n#define GL_POINT_SMOOTH_HINT 0x0C51\n#define GL_FOG_HINT 0x0C54\n#define GL_TEXTURE_GEN_S 0x0C60\n#define GL_TEXTURE_GEN_T 0x0C61\n#define GL_TEXTURE_GEN_R 0x0C62\n#define GL_TEXTURE_GEN_Q 0x0C63\n#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0\n#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1\n#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2\n#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3\n#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4\n#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5\n#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6\n#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7\n#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8\n#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9\n#define GL_MAP_COLOR 0x0D10\n#define GL_MAP_STENCIL 0x0D11\n#define GL_INDEX_SHIFT 0x0D12\n#define GL_INDEX_OFFSET 0x0D13\n#define GL_RED_SCALE 0x0D14\n#define GL_RED_BIAS 0x0D15\n#define GL_ZOOM_X 0x0D16\n#define GL_ZOOM_Y 0x0D17\n#define GL_GREEN_SCALE 0x0D18\n#define GL_GREEN_BIAS 0x0D19\n#define GL_BLUE_SCALE 0x0D1A\n#define GL_BLUE_BIAS 0x0D1B\n#define GL_ALPHA_SCALE 0x0D1C\n#define GL_ALPHA_BIAS 0x0D1D\n#define GL_DEPTH_SCALE 0x0D1E\n#define GL_DEPTH_BIAS 0x0D1F\n#define GL_MAX_EVAL_ORDER 0x0D30\n#define GL_MAX_LIGHTS 0x0D31\n#define GL_MAX_CLIP_PLANES 0x0D32\n#define GL_MAX_PIXEL_MAP_TABLE 0x0D34\n#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35\n#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36\n#define GL_MAX_NAME_STACK_DEPTH 0x0D37\n#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38\n#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39\n#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B\n#define GL_INDEX_BITS 0x0D51\n#define GL_RED_BITS 0x0D52\n#define GL_GREEN_BITS 0x0D53\n#define GL_BLUE_BITS 0x0D54\n#define GL_ALPHA_BITS 0x0D55\n#define GL_DEPTH_BITS 0x0D56\n#define GL_STENCIL_BITS 0x0D57\n#define GL_ACCUM_RED_BITS 0x0D58\n#define GL_ACCUM_GREEN_BITS 0x0D59\n#define GL_ACCUM_BLUE_BITS 0x0D5A\n#define GL_ACCUM_ALPHA_BITS 0x0D5B\n#define GL_NAME_STACK_DEPTH 0x0D70\n#define GL_AUTO_NORMAL 0x0D80\n#define GL_MAP1_COLOR_4 0x0D90\n#define GL_MAP1_INDEX 0x0D91\n#define GL_MAP1_NORMAL 0x0D92\n#define GL_MAP1_TEXTURE_COORD_1 0x0D93\n#define GL_MAP1_TEXTURE_COORD_2 0x0D94\n#define GL_MAP1_TEXTURE_COORD_3 0x0D95\n#define GL_MAP1_TEXTURE_COORD_4 0x0D96\n#define GL_MAP1_VERTEX_3 0x0D97\n#define GL_MAP1_VERTEX_4 0x0D98\n#define GL_MAP2_COLOR_4 0x0DB0\n#define GL_MAP2_INDEX 0x0DB1\n#define GL_MAP2_NORMAL 0x0DB2\n#define GL_MAP2_TEXTURE_COORD_1 0x0DB3\n#define GL_MAP2_TEXTURE_COORD_2 0x0DB4\n#define GL_MAP2_TEXTURE_COORD_3 0x0DB5\n#define GL_MAP2_TEXTURE_COORD_4 0x0DB6\n#define GL_MAP2_VERTEX_3 0x0DB7\n#define GL_MAP2_VERTEX_4 0x0DB8\n#define GL_MAP1_GRID_DOMAIN 0x0DD0\n#define GL_MAP1_GRID_SEGMENTS 0x0DD1\n#define GL_MAP2_GRID_DOMAIN 0x0DD2\n#define GL_MAP2_GRID_SEGMENTS 0x0DD3\n#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1\n#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2\n#define GL_SELECTION_BUFFER_SIZE 0x0DF4\n#define GL_VERTEX_ARRAY 0x8074\n#define GL_NORMAL_ARRAY 0x8075\n#define GL_COLOR_ARRAY 0x8076\n#define GL_INDEX_ARRAY 0x8077\n#define GL_TEXTURE_COORD_ARRAY 0x8078\n#define GL_EDGE_FLAG_ARRAY 0x8079\n#define GL_VERTEX_ARRAY_SIZE 0x807A\n#define GL_VERTEX_ARRAY_TYPE 0x807B\n#define GL_VERTEX_ARRAY_STRIDE 0x807C\n#define GL_NORMAL_ARRAY_TYPE 0x807E\n#define GL_NORMAL_ARRAY_STRIDE 0x807F\n#define GL_COLOR_ARRAY_SIZE 0x8081\n#define GL_COLOR_ARRAY_TYPE 0x8082\n#define GL_COLOR_ARRAY_STRIDE 0x8083\n#define GL_INDEX_ARRAY_TYPE 0x8085\n#define GL_INDEX_ARRAY_STRIDE 0x8086\n#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088\n#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089\n#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A\n#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C\n#define GL_TEXTURE_COMPONENTS 0x1003\n#define GL_TEXTURE_BORDER 0x1005\n#define GL_TEXTURE_LUMINANCE_SIZE 0x8060\n#define GL_TEXTURE_INTENSITY_SIZE 0x8061\n#define GL_TEXTURE_PRIORITY 0x8066\n#define GL_TEXTURE_RESIDENT 0x8067\n#define GL_AMBIENT 0x1200\n#define GL_DIFFUSE 0x1201\n#define GL_SPECULAR 0x1202\n#define GL_POSITION 0x1203\n#define GL_SPOT_DIRECTION 0x1204\n#define GL_SPOT_EXPONENT 0x1205\n#define GL_SPOT_CUTOFF 0x1206\n#define GL_CONSTANT_ATTENUATION 0x1207\n#define GL_LINEAR_ATTENUATION 0x1208\n#define GL_QUADRATIC_ATTENUATION 0x1209\n#define GL_COMPILE 0x1300\n#define GL_COMPILE_AND_EXECUTE 0x1301\n#define GL_2_BYTES 0x1407\n#define GL_3_BYTES 0x1408\n#define GL_4_BYTES 0x1409\n#define GL_EMISSION 0x1600\n#define GL_SHININESS 0x1601\n#define GL_AMBIENT_AND_DIFFUSE 0x1602\n#define GL_COLOR_INDEXES 0x1603\n#define GL_MODELVIEW 0x1700\n#define GL_PROJECTION 0x1701\n#define GL_COLOR_INDEX 0x1900\n#define GL_LUMINANCE 0x1909\n#define GL_LUMINANCE_ALPHA 0x190A\n#define GL_BITMAP 0x1A00\n#define GL_RENDER 0x1C00\n#define GL_FEEDBACK 0x1C01\n#define GL_SELECT 0x1C02\n#define GL_FLAT 0x1D00\n#define GL_SMOOTH 0x1D01\n#define GL_S 0x2000\n#define GL_T 0x2001\n#define GL_R 0x2002\n#define GL_Q 0x2003\n#define GL_MODULATE 0x2100\n#define GL_DECAL 0x2101\n#define GL_TEXTURE_ENV_MODE 0x2200\n#define GL_TEXTURE_ENV_COLOR 0x2201\n#define GL_TEXTURE_ENV 0x2300\n#define GL_EYE_LINEAR 0x2400\n#define GL_OBJECT_LINEAR 0x2401\n#define GL_SPHERE_MAP 0x2402\n#define GL_TEXTURE_GEN_MODE 0x2500\n#define GL_OBJECT_PLANE 0x2501\n#define GL_EYE_PLANE 0x2502\n#define GL_CLAMP 0x2900\n#define GL_ALPHA4 0x803B\n#define GL_ALPHA8 0x803C\n#define GL_ALPHA12 0x803D\n#define GL_ALPHA16 0x803E\n#define GL_LUMINANCE4 0x803F\n#define GL_LUMINANCE8 0x8040\n#define GL_LUMINANCE12 0x8041\n#define GL_LUMINANCE16 0x8042\n#define GL_LUMINANCE4_ALPHA4 0x8043\n#define GL_LUMINANCE6_ALPHA2 0x8044\n#define GL_LUMINANCE8_ALPHA8 0x8045\n#define GL_LUMINANCE12_ALPHA4 0x8046\n#define GL_LUMINANCE12_ALPHA12 0x8047\n#define GL_LUMINANCE16_ALPHA16 0x8048\n#define GL_INTENSITY 0x8049\n#define GL_INTENSITY4 0x804A\n#define GL_INTENSITY8 0x804B\n#define GL_INTENSITY12 0x804C\n#define GL_INTENSITY16 0x804D\n#define GL_V2F 0x2A20\n#define GL_V3F 0x2A21\n#define GL_C4UB_V2F 0x2A22\n#define GL_C4UB_V3F 0x2A23\n#define GL_C3F_V3F 0x2A24\n#define GL_N3F_V3F 0x2A25\n#define GL_C4F_N3F_V3F 0x2A26\n#define GL_T2F_V3F 0x2A27\n#define GL_T4F_V4F 0x2A28\n#define GL_T2F_C4UB_V3F 0x2A29\n#define GL_T2F_C3F_V3F 0x2A2A\n#define GL_T2F_N3F_V3F 0x2A2B\n#define GL_T2F_C4F_N3F_V3F 0x2A2C\n#define GL_T4F_C4F_N3F_V4F 0x2A2D\n#define GL_CLIP_PLANE0 0x3000\n#define GL_CLIP_PLANE1 0x3001\n#define GL_CLIP_PLANE2 0x3002\n#define GL_CLIP_PLANE3 0x3003\n#define GL_CLIP_PLANE4 0x3004\n#define GL_CLIP_PLANE5 0x3005\n#define GL_LIGHT0 0x4000\n#define GL_LIGHT1 0x4001\n#define GL_LIGHT2 0x4002\n#define GL_LIGHT3 0x4003\n#define GL_LIGHT4 0x4004\n#define GL_LIGHT5 0x4005\n#define GL_LIGHT6 0x4006\n#define GL_LIGHT7 0x4007\n#define GL_UNSIGNED_BYTE_3_3_2 0x8032\n#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033\n#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034\n#define GL_UNSIGNED_INT_8_8_8_8 0x8035\n#define GL_UNSIGNED_INT_10_10_10_2 0x8036\n#define GL_TEXTURE_BINDING_3D 0x806A\n#define GL_PACK_SKIP_IMAGES 0x806B\n#define GL_PACK_IMAGE_HEIGHT 0x806C\n#define GL_UNPACK_SKIP_IMAGES 0x806D\n#define GL_UNPACK_IMAGE_HEIGHT 0x806E\n#define GL_TEXTURE_3D 0x806F\n#define GL_PROXY_TEXTURE_3D 0x8070\n#define GL_TEXTURE_DEPTH 0x8071\n#define GL_TEXTURE_WRAP_R 0x8072\n#define GL_MAX_3D_TEXTURE_SIZE 0x8073\n#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362\n#define GL_UNSIGNED_SHORT_5_6_5 0x8363\n#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364\n#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365\n#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366\n#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367\n#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368\n#define GL_BGR 0x80E0\n#define GL_BGRA 0x80E1\n#define GL_MAX_ELEMENTS_VERTICES 0x80E8\n#define GL_MAX_ELEMENTS_INDICES 0x80E9\n#define GL_CLAMP_TO_EDGE 0x812F\n#define GL_TEXTURE_MIN_LOD 0x813A\n#define GL_TEXTURE_MAX_LOD 0x813B\n#define GL_TEXTURE_BASE_LEVEL 0x813C\n#define GL_TEXTURE_MAX_LEVEL 0x813D\n#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12\n#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13\n#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22\n#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23\n#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E\n#define GL_RESCALE_NORMAL 0x803A\n#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8\n#define GL_SINGLE_COLOR 0x81F9\n#define GL_SEPARATE_SPECULAR_COLOR 0x81FA\n#define GL_ALIASED_POINT_SIZE_RANGE 0x846D\n#define GL_TEXTURE0 0x84C0\n#define GL_TEXTURE1 0x84C1\n#define GL_TEXTURE2 0x84C2\n#define GL_TEXTURE3 0x84C3\n#define GL_TEXTURE4 0x84C4\n#define GL_TEXTURE5 0x84C5\n#define GL_TEXTURE6 0x84C6\n#define GL_TEXTURE7 0x84C7\n#define GL_TEXTURE8 0x84C8\n#define GL_TEXTURE9 0x84C9\n#define GL_TEXTURE10 0x84CA\n#define GL_TEXTURE11 0x84CB\n#define GL_TEXTURE12 0x84CC\n#define GL_TEXTURE13 0x84CD\n#define GL_TEXTURE14 0x84CE\n#define GL_TEXTURE15 0x84CF\n#define GL_TEXTURE16 0x84D0\n#define GL_TEXTURE17 0x84D1\n#define GL_TEXTURE18 0x84D2\n#define GL_TEXTURE19 0x84D3\n#define GL_TEXTURE20 0x84D4\n#define GL_TEXTURE21 0x84D5\n#define GL_TEXTURE22 0x84D6\n#define GL_TEXTURE23 0x84D7\n#define GL_TEXTURE24 0x84D8\n#define GL_TEXTURE25 0x84D9\n#define GL_TEXTURE26 0x84DA\n#define GL_TEXTURE27 0x84DB\n#define GL_TEXTURE28 0x84DC\n#define GL_TEXTURE29 0x84DD\n#define GL_TEXTURE30 0x84DE\n#define GL_TEXTURE31 0x84DF\n#define GL_ACTIVE_TEXTURE 0x84E0\n#define GL_MULTISAMPLE 0x809D\n#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E\n#define GL_SAMPLE_ALPHA_TO_ONE 0x809F\n#define GL_SAMPLE_COVERAGE 0x80A0\n#define GL_SAMPLE_BUFFERS 0x80A8\n#define GL_SAMPLES 0x80A9\n#define GL_SAMPLE_COVERAGE_VALUE 0x80AA\n#define GL_SAMPLE_COVERAGE_INVERT 0x80AB\n#define GL_TEXTURE_CUBE_MAP 0x8513\n#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518\n#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519\n#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A\n#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B\n#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C\n#define GL_COMPRESSED_RGB 0x84ED\n#define GL_COMPRESSED_RGBA 0x84EE\n#define GL_TEXTURE_COMPRESSION_HINT 0x84EF\n#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0\n#define GL_TEXTURE_COMPRESSED 0x86A1\n#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2\n#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3\n#define GL_CLAMP_TO_BORDER 0x812D\n#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1\n#define GL_MAX_TEXTURE_UNITS 0x84E2\n#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3\n#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4\n#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5\n#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6\n#define GL_MULTISAMPLE_BIT 0x20000000\n#define GL_NORMAL_MAP 0x8511\n#define GL_REFLECTION_MAP 0x8512\n#define GL_COMPRESSED_ALPHA 0x84E9\n#define GL_COMPRESSED_LUMINANCE 0x84EA\n#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB\n#define GL_COMPRESSED_INTENSITY 0x84EC\n#define GL_COMBINE 0x8570\n#define GL_COMBINE_RGB 0x8571\n#define GL_COMBINE_ALPHA 0x8572\n#define GL_SOURCE0_RGB 0x8580\n#define GL_SOURCE1_RGB 0x8581\n#define GL_SOURCE2_RGB 0x8582\n#define GL_SOURCE0_ALPHA 0x8588\n#define GL_SOURCE1_ALPHA 0x8589\n#define GL_SOURCE2_ALPHA 0x858A\n#define GL_OPERAND0_RGB 0x8590\n#define GL_OPERAND1_RGB 0x8591\n#define GL_OPERAND2_RGB 0x8592\n#define GL_OPERAND0_ALPHA 0x8598\n#define GL_OPERAND1_ALPHA 0x8599\n#define GL_OPERAND2_ALPHA 0x859A\n#define GL_RGB_SCALE 0x8573\n#define GL_ADD_SIGNED 0x8574\n#define GL_INTERPOLATE 0x8575\n#define GL_SUBTRACT 0x84E7\n#define GL_CONSTANT 0x8576\n#define GL_PRIMARY_COLOR 0x8577\n#define GL_PREVIOUS 0x8578\n#define GL_DOT3_RGB 0x86AE\n#define GL_DOT3_RGBA 0x86AF\n#define GL_BLEND_DST_RGB 0x80C8\n#define GL_BLEND_SRC_RGB 0x80C9\n#define GL_BLEND_DST_ALPHA 0x80CA\n#define GL_BLEND_SRC_ALPHA 0x80CB\n#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128\n#define GL_DEPTH_COMPONENT16 0x81A5\n#define GL_DEPTH_COMPONENT24 0x81A6\n#define GL_DEPTH_COMPONENT32 0x81A7\n#define GL_MIRRORED_REPEAT 0x8370\n#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD\n#define GL_TEXTURE_LOD_BIAS 0x8501\n#define GL_INCR_WRAP 0x8507\n#define GL_DECR_WRAP 0x8508\n#define GL_TEXTURE_DEPTH_SIZE 0x884A\n#define GL_TEXTURE_COMPARE_MODE 0x884C\n#define GL_TEXTURE_COMPARE_FUNC 0x884D\n#define GL_POINT_SIZE_MIN 0x8126\n#define GL_POINT_SIZE_MAX 0x8127\n#define GL_POINT_DISTANCE_ATTENUATION 0x8129\n#define GL_GENERATE_MIPMAP 0x8191\n#define GL_GENERATE_MIPMAP_HINT 0x8192\n#define GL_FOG_COORDINATE_SOURCE 0x8450\n#define GL_FOG_COORDINATE 0x8451\n#define GL_FRAGMENT_DEPTH 0x8452\n#define GL_CURRENT_FOG_COORDINATE 0x8453\n#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454\n#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455\n#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456\n#define GL_FOG_COORDINATE_ARRAY 0x8457\n#define GL_COLOR_SUM 0x8458\n#define GL_CURRENT_SECONDARY_COLOR 0x8459\n#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A\n#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B\n#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C\n#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D\n#define GL_SECONDARY_COLOR_ARRAY 0x845E\n#define GL_TEXTURE_FILTER_CONTROL 0x8500\n#define GL_DEPTH_TEXTURE_MODE 0x884B\n#define GL_COMPARE_R_TO_TEXTURE 0x884E\n#define GL_FUNC_ADD 0x8006\n#define GL_FUNC_SUBTRACT 0x800A\n#define GL_FUNC_REVERSE_SUBTRACT 0x800B\n#define GL_MIN 0x8007\n#define GL_MAX 0x8008\n#define GL_CONSTANT_COLOR 0x8001\n#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002\n#define GL_CONSTANT_ALPHA 0x8003\n#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004\n#define GL_BUFFER_SIZE 0x8764\n#define GL_BUFFER_USAGE 0x8765\n#define GL_QUERY_COUNTER_BITS 0x8864\n#define GL_CURRENT_QUERY 0x8865\n#define GL_QUERY_RESULT 0x8866\n#define GL_QUERY_RESULT_AVAILABLE 0x8867\n#define GL_ARRAY_BUFFER 0x8892\n#define GL_ELEMENT_ARRAY_BUFFER 0x8893\n#define GL_ARRAY_BUFFER_BINDING 0x8894\n#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895\n#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F\n#define GL_READ_ONLY 0x88B8\n#define GL_WRITE_ONLY 0x88B9\n#define GL_READ_WRITE 0x88BA\n#define GL_BUFFER_ACCESS 0x88BB\n#define GL_BUFFER_MAPPED 0x88BC\n#define GL_BUFFER_MAP_POINTER 0x88BD\n#define GL_STREAM_DRAW 0x88E0\n#define GL_STREAM_READ 0x88E1\n#define GL_STREAM_COPY 0x88E2\n#define GL_STATIC_DRAW 0x88E4\n#define GL_STATIC_READ 0x88E5\n#define GL_STATIC_COPY 0x88E6\n#define GL_DYNAMIC_DRAW 0x88E8\n#define GL_DYNAMIC_READ 0x88E9\n#define GL_DYNAMIC_COPY 0x88EA\n#define GL_SAMPLES_PASSED 0x8914\n#define GL_SRC1_ALPHA 0x8589\n#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896\n#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897\n#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898\n#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899\n#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A\n#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B\n#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C\n#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D\n#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E\n#define GL_FOG_COORD_SRC 0x8450\n#define GL_FOG_COORD 0x8451\n#define GL_CURRENT_FOG_COORD 0x8453\n#define GL_FOG_COORD_ARRAY_TYPE 0x8454\n#define GL_FOG_COORD_ARRAY_STRIDE 0x8455\n#define GL_FOG_COORD_ARRAY_POINTER 0x8456\n#define GL_FOG_COORD_ARRAY 0x8457\n#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D\n#define GL_SRC0_RGB 0x8580\n#define GL_SRC1_RGB 0x8581\n#define GL_SRC2_RGB 0x8582\n#define GL_SRC0_ALPHA 0x8588\n#define GL_SRC2_ALPHA 0x858A\n#define GL_BLEND_EQUATION_RGB 0x8009\n#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622\n#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623\n#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624\n#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625\n#define GL_CURRENT_VERTEX_ATTRIB 0x8626\n#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642\n#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645\n#define GL_STENCIL_BACK_FUNC 0x8800\n#define GL_STENCIL_BACK_FAIL 0x8801\n#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802\n#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803\n#define GL_MAX_DRAW_BUFFERS 0x8824\n#define GL_DRAW_BUFFER0 0x8825\n#define GL_DRAW_BUFFER1 0x8826\n#define GL_DRAW_BUFFER2 0x8827\n#define GL_DRAW_BUFFER3 0x8828\n#define GL_DRAW_BUFFER4 0x8829\n#define GL_DRAW_BUFFER5 0x882A\n#define GL_DRAW_BUFFER6 0x882B\n#define GL_DRAW_BUFFER7 0x882C\n#define GL_DRAW_BUFFER8 0x882D\n#define GL_DRAW_BUFFER9 0x882E\n#define GL_DRAW_BUFFER10 0x882F\n#define GL_DRAW_BUFFER11 0x8830\n#define GL_DRAW_BUFFER12 0x8831\n#define GL_DRAW_BUFFER13 0x8832\n#define GL_DRAW_BUFFER14 0x8833\n#define GL_DRAW_BUFFER15 0x8834\n#define GL_BLEND_EQUATION_ALPHA 0x883D\n#define GL_MAX_VERTEX_ATTRIBS 0x8869\n#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A\n#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872\n#define GL_FRAGMENT_SHADER 0x8B30\n#define GL_VERTEX_SHADER 0x8B31\n#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49\n#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A\n#define GL_MAX_VARYING_FLOATS 0x8B4B\n#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C\n#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D\n#define GL_SHADER_TYPE 0x8B4F\n#define GL_FLOAT_VEC2 0x8B50\n#define GL_FLOAT_VEC3 0x8B51\n#define GL_FLOAT_VEC4 0x8B52\n#define GL_INT_VEC2 0x8B53\n#define GL_INT_VEC3 0x8B54\n#define GL_INT_VEC4 0x8B55\n#define GL_BOOL 0x8B56\n#define GL_BOOL_VEC2 0x8B57\n#define GL_BOOL_VEC3 0x8B58\n#define GL_BOOL_VEC4 0x8B59\n#define GL_FLOAT_MAT2 0x8B5A\n#define GL_FLOAT_MAT3 0x8B5B\n#define GL_FLOAT_MAT4 0x8B5C\n#define GL_SAMPLER_1D 0x8B5D\n#define GL_SAMPLER_2D 0x8B5E\n#define GL_SAMPLER_3D 0x8B5F\n#define GL_SAMPLER_CUBE 0x8B60\n#define GL_SAMPLER_1D_SHADOW 0x8B61\n#define GL_SAMPLER_2D_SHADOW 0x8B62\n#define GL_DELETE_STATUS 0x8B80\n#define GL_COMPILE_STATUS 0x8B81\n#define GL_LINK_STATUS 0x8B82\n#define GL_VALIDATE_STATUS 0x8B83\n#define GL_INFO_LOG_LENGTH 0x8B84\n#define GL_ATTACHED_SHADERS 0x8B85\n#define GL_ACTIVE_UNIFORMS 0x8B86\n#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87\n#define GL_SHADER_SOURCE_LENGTH 0x8B88\n#define GL_ACTIVE_ATTRIBUTES 0x8B89\n#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A\n#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B\n#define GL_SHADING_LANGUAGE_VERSION 0x8B8C\n#define GL_CURRENT_PROGRAM 0x8B8D\n#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0\n#define GL_LOWER_LEFT 0x8CA1\n#define GL_UPPER_LEFT 0x8CA2\n#define GL_STENCIL_BACK_REF 0x8CA3\n#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4\n#define GL_STENCIL_BACK_WRITEMASK 0x8CA5\n#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643\n#define GL_POINT_SPRITE 0x8861\n#define GL_COORD_REPLACE 0x8862\n#define GL_MAX_TEXTURE_COORDS 0x8871\n#define GL_PIXEL_PACK_BUFFER 0x88EB\n#define GL_PIXEL_UNPACK_BUFFER 0x88EC\n#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED\n#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF\n#define GL_FLOAT_MAT2x3 0x8B65\n#define GL_FLOAT_MAT2x4 0x8B66\n#define GL_FLOAT_MAT3x2 0x8B67\n#define GL_FLOAT_MAT3x4 0x8B68\n#define GL_FLOAT_MAT4x2 0x8B69\n#define GL_FLOAT_MAT4x3 0x8B6A\n#define GL_SRGB 0x8C40\n#define GL_SRGB8 0x8C41\n#define GL_SRGB_ALPHA 0x8C42\n#define GL_SRGB8_ALPHA8 0x8C43\n#define GL_COMPRESSED_SRGB 0x8C48\n#define GL_COMPRESSED_SRGB_ALPHA 0x8C49\n#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F\n#define GL_SLUMINANCE_ALPHA 0x8C44\n#define GL_SLUMINANCE8_ALPHA8 0x8C45\n#define GL_SLUMINANCE 0x8C46\n#define GL_SLUMINANCE8 0x8C47\n#define GL_COMPRESSED_SLUMINANCE 0x8C4A\n#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B\n#define GL_COMPARE_REF_TO_TEXTURE 0x884E\n#define GL_CLIP_DISTANCE0 0x3000\n#define GL_CLIP_DISTANCE1 0x3001\n#define GL_CLIP_DISTANCE2 0x3002\n#define GL_CLIP_DISTANCE3 0x3003\n#define GL_CLIP_DISTANCE4 0x3004\n#define GL_CLIP_DISTANCE5 0x3005\n#define GL_CLIP_DISTANCE6 0x3006\n#define GL_CLIP_DISTANCE7 0x3007\n#define GL_MAX_CLIP_DISTANCES 0x0D32\n#define GL_MAJOR_VERSION 0x821B\n#define GL_MINOR_VERSION 0x821C\n#define GL_NUM_EXTENSIONS 0x821D\n#define GL_CONTEXT_FLAGS 0x821E\n#define GL_COMPRESSED_RED 0x8225\n#define GL_COMPRESSED_RG 0x8226\n#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001\n#define GL_RGBA32F 0x8814\n#define GL_RGB32F 0x8815\n#define GL_RGBA16F 0x881A\n#define GL_RGB16F 0x881B\n#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD\n#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF\n#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904\n#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905\n#define GL_CLAMP_READ_COLOR 0x891C\n#define GL_FIXED_ONLY 0x891D\n#define GL_MAX_VARYING_COMPONENTS 0x8B4B\n#define GL_TEXTURE_1D_ARRAY 0x8C18\n#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19\n#define GL_TEXTURE_2D_ARRAY 0x8C1A\n#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B\n#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C\n#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D\n#define GL_R11F_G11F_B10F 0x8C3A\n#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B\n#define GL_RGB9_E5 0x8C3D\n#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E\n#define GL_TEXTURE_SHARED_SIZE 0x8C3F\n#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76\n#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80\n#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83\n#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84\n#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85\n#define GL_PRIMITIVES_GENERATED 0x8C87\n#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88\n#define GL_RASTERIZER_DISCARD 0x8C89\n#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A\n#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B\n#define GL_INTERLEAVED_ATTRIBS 0x8C8C\n#define GL_SEPARATE_ATTRIBS 0x8C8D\n#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E\n#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F\n#define GL_RGBA32UI 0x8D70\n#define GL_RGB32UI 0x8D71\n#define GL_RGBA16UI 0x8D76\n#define GL_RGB16UI 0x8D77\n#define GL_RGBA8UI 0x8D7C\n#define GL_RGB8UI 0x8D7D\n#define GL_RGBA32I 0x8D82\n#define GL_RGB32I 0x8D83\n#define GL_RGBA16I 0x8D88\n#define GL_RGB16I 0x8D89\n#define GL_RGBA8I 0x8D8E\n#define GL_RGB8I 0x8D8F\n#define GL_RED_INTEGER 0x8D94\n#define GL_GREEN_INTEGER 0x8D95\n#define GL_BLUE_INTEGER 0x8D96\n#define GL_RGB_INTEGER 0x8D98\n#define GL_RGBA_INTEGER 0x8D99\n#define GL_BGR_INTEGER 0x8D9A\n#define GL_BGRA_INTEGER 0x8D9B\n#define GL_SAMPLER_1D_ARRAY 0x8DC0\n#define GL_SAMPLER_2D_ARRAY 0x8DC1\n#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3\n#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4\n#define GL_SAMPLER_CUBE_SHADOW 0x8DC5\n#define GL_UNSIGNED_INT_VEC2 0x8DC6\n#define GL_UNSIGNED_INT_VEC3 0x8DC7\n#define GL_UNSIGNED_INT_VEC4 0x8DC8\n#define GL_INT_SAMPLER_1D 0x8DC9\n#define GL_INT_SAMPLER_2D 0x8DCA\n#define GL_INT_SAMPLER_3D 0x8DCB\n#define GL_INT_SAMPLER_CUBE 0x8DCC\n#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE\n#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF\n#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1\n#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2\n#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3\n#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4\n#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6\n#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7\n#define GL_QUERY_WAIT 0x8E13\n#define GL_QUERY_NO_WAIT 0x8E14\n#define GL_QUERY_BY_REGION_WAIT 0x8E15\n#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16\n#define GL_BUFFER_ACCESS_FLAGS 0x911F\n#define GL_BUFFER_MAP_LENGTH 0x9120\n#define GL_BUFFER_MAP_OFFSET 0x9121\n#define GL_DEPTH_COMPONENT32F 0x8CAC\n#define GL_DEPTH32F_STENCIL8 0x8CAD\n#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD\n#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506\n#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210\n#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211\n#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212\n#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213\n#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214\n#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215\n#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216\n#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217\n#define GL_FRAMEBUFFER_DEFAULT 0x8218\n#define GL_FRAMEBUFFER_UNDEFINED 0x8219\n#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A\n#define GL_MAX_RENDERBUFFER_SIZE 0x84E8\n#define GL_DEPTH_STENCIL 0x84F9\n#define GL_UNSIGNED_INT_24_8 0x84FA\n#define GL_DEPTH24_STENCIL8 0x88F0\n#define GL_TEXTURE_STENCIL_SIZE 0x88F1\n#define GL_TEXTURE_RED_TYPE 0x8C10\n#define GL_TEXTURE_GREEN_TYPE 0x8C11\n#define GL_TEXTURE_BLUE_TYPE 0x8C12\n#define GL_TEXTURE_ALPHA_TYPE 0x8C13\n#define GL_TEXTURE_DEPTH_TYPE 0x8C16\n#define GL_UNSIGNED_NORMALIZED 0x8C17\n#define GL_FRAMEBUFFER_BINDING 0x8CA6\n#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6\n#define GL_RENDERBUFFER_BINDING 0x8CA7\n#define GL_READ_FRAMEBUFFER 0x8CA8\n#define GL_DRAW_FRAMEBUFFER 0x8CA9\n#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA\n#define GL_RENDERBUFFER_SAMPLES 0x8CAB\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0\n#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3\n#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4\n#define GL_FRAMEBUFFER_COMPLETE 0x8CD5\n#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6\n#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7\n#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB\n#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC\n#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD\n#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF\n#define GL_COLOR_ATTACHMENT0 0x8CE0\n#define GL_COLOR_ATTACHMENT1 0x8CE1\n#define GL_COLOR_ATTACHMENT2 0x8CE2\n#define GL_COLOR_ATTACHMENT3 0x8CE3\n#define GL_COLOR_ATTACHMENT4 0x8CE4\n#define GL_COLOR_ATTACHMENT5 0x8CE5\n#define GL_COLOR_ATTACHMENT6 0x8CE6\n#define GL_COLOR_ATTACHMENT7 0x8CE7\n#define GL_COLOR_ATTACHMENT8 0x8CE8\n#define GL_COLOR_ATTACHMENT9 0x8CE9\n#define GL_COLOR_ATTACHMENT10 0x8CEA\n#define GL_COLOR_ATTACHMENT11 0x8CEB\n#define GL_COLOR_ATTACHMENT12 0x8CEC\n#define GL_COLOR_ATTACHMENT13 0x8CED\n#define GL_COLOR_ATTACHMENT14 0x8CEE\n#define GL_COLOR_ATTACHMENT15 0x8CEF\n#define GL_COLOR_ATTACHMENT16 0x8CF0\n#define GL_COLOR_ATTACHMENT17 0x8CF1\n#define GL_COLOR_ATTACHMENT18 0x8CF2\n#define GL_COLOR_ATTACHMENT19 0x8CF3\n#define GL_COLOR_ATTACHMENT20 0x8CF4\n#define GL_COLOR_ATTACHMENT21 0x8CF5\n#define GL_COLOR_ATTACHMENT22 0x8CF6\n#define GL_COLOR_ATTACHMENT23 0x8CF7\n#define GL_COLOR_ATTACHMENT24 0x8CF8\n#define GL_COLOR_ATTACHMENT25 0x8CF9\n#define GL_COLOR_ATTACHMENT26 0x8CFA\n#define GL_COLOR_ATTACHMENT27 0x8CFB\n#define GL_COLOR_ATTACHMENT28 0x8CFC\n#define GL_COLOR_ATTACHMENT29 0x8CFD\n#define GL_COLOR_ATTACHMENT30 0x8CFE\n#define GL_COLOR_ATTACHMENT31 0x8CFF\n#define GL_DEPTH_ATTACHMENT 0x8D00\n#define GL_STENCIL_ATTACHMENT 0x8D20\n#define GL_FRAMEBUFFER 0x8D40\n#define GL_RENDERBUFFER 0x8D41\n#define GL_RENDERBUFFER_WIDTH 0x8D42\n#define GL_RENDERBUFFER_HEIGHT 0x8D43\n#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44\n#define GL_STENCIL_INDEX1 0x8D46\n#define GL_STENCIL_INDEX4 0x8D47\n#define GL_STENCIL_INDEX8 0x8D48\n#define GL_STENCIL_INDEX16 0x8D49\n#define GL_RENDERBUFFER_RED_SIZE 0x8D50\n#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51\n#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52\n#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53\n#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54\n#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55\n#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56\n#define GL_MAX_SAMPLES 0x8D57\n#define GL_INDEX 0x8222\n#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14\n#define GL_TEXTURE_INTENSITY_TYPE 0x8C15\n#define GL_FRAMEBUFFER_SRGB 0x8DB9\n#define GL_HALF_FLOAT 0x140B\n#define GL_MAP_READ_BIT 0x0001\n#define GL_MAP_WRITE_BIT 0x0002\n#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004\n#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008\n#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010\n#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020\n#define GL_COMPRESSED_RED_RGTC1 0x8DBB\n#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC\n#define GL_COMPRESSED_RG_RGTC2 0x8DBD\n#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE\n#define GL_RG 0x8227\n#define GL_RG_INTEGER 0x8228\n#define GL_R8 0x8229\n#define GL_R16 0x822A\n#define GL_RG8 0x822B\n#define GL_RG16 0x822C\n#define GL_R16F 0x822D\n#define GL_R32F 0x822E\n#define GL_RG16F 0x822F\n#define GL_RG32F 0x8230\n#define GL_R8I 0x8231\n#define GL_R8UI 0x8232\n#define GL_R16I 0x8233\n#define GL_R16UI 0x8234\n#define GL_R32I 0x8235\n#define GL_R32UI 0x8236\n#define GL_RG8I 0x8237\n#define GL_RG8UI 0x8238\n#define GL_RG16I 0x8239\n#define GL_RG16UI 0x823A\n#define GL_RG32I 0x823B\n#define GL_RG32UI 0x823C\n#define GL_VERTEX_ARRAY_BINDING 0x85B5\n#define GL_CLAMP_VERTEX_COLOR 0x891A\n#define GL_CLAMP_FRAGMENT_COLOR 0x891B\n#define GL_ALPHA_INTEGER 0x8D97\n#define GL_SAMPLER_2D_RECT 0x8B63\n#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64\n#define GL_SAMPLER_BUFFER 0x8DC2\n#define GL_INT_SAMPLER_2D_RECT 0x8DCD\n#define GL_INT_SAMPLER_BUFFER 0x8DD0\n#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5\n#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8\n#define GL_TEXTURE_BUFFER 0x8C2A\n#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B\n#define GL_TEXTURE_BINDING_BUFFER 0x8C2C\n#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D\n#define GL_TEXTURE_RECTANGLE 0x84F5\n#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6\n#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7\n#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8\n#define GL_R8_SNORM 0x8F94\n#define GL_RG8_SNORM 0x8F95\n#define GL_RGB8_SNORM 0x8F96\n#define GL_RGBA8_SNORM 0x8F97\n#define GL_R16_SNORM 0x8F98\n#define GL_RG16_SNORM 0x8F99\n#define GL_RGB16_SNORM 0x8F9A\n#define GL_RGBA16_SNORM 0x8F9B\n#define GL_SIGNED_NORMALIZED 0x8F9C\n#define GL_PRIMITIVE_RESTART 0x8F9D\n#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E\n#define GL_COPY_READ_BUFFER 0x8F36\n#define GL_COPY_WRITE_BUFFER 0x8F37\n#define GL_UNIFORM_BUFFER 0x8A11\n#define GL_UNIFORM_BUFFER_BINDING 0x8A28\n#define GL_UNIFORM_BUFFER_START 0x8A29\n#define GL_UNIFORM_BUFFER_SIZE 0x8A2A\n#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B\n#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C\n#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D\n#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E\n#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F\n#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30\n#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31\n#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32\n#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33\n#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34\n#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35\n#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36\n#define GL_UNIFORM_TYPE 0x8A37\n#define GL_UNIFORM_SIZE 0x8A38\n#define GL_UNIFORM_NAME_LENGTH 0x8A39\n#define GL_UNIFORM_BLOCK_INDEX 0x8A3A\n#define GL_UNIFORM_OFFSET 0x8A3B\n#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C\n#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D\n#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E\n#define GL_UNIFORM_BLOCK_BINDING 0x8A3F\n#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40\n#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42\n#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46\n#define GL_INVALID_INDEX 0xFFFFFFFF\n#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001\n#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002\n#define GL_LINES_ADJACENCY 0x000A\n#define GL_LINE_STRIP_ADJACENCY 0x000B\n#define GL_TRIANGLES_ADJACENCY 0x000C\n#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D\n#define GL_PROGRAM_POINT_SIZE 0x8642\n#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29\n#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7\n#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8\n#define GL_GEOMETRY_SHADER 0x8DD9\n#define GL_GEOMETRY_VERTICES_OUT 0x8916\n#define GL_GEOMETRY_INPUT_TYPE 0x8917\n#define GL_GEOMETRY_OUTPUT_TYPE 0x8918\n#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF\n#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0\n#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1\n#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122\n#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123\n#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124\n#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125\n#define GL_CONTEXT_PROFILE_MASK 0x9126\n#define GL_DEPTH_CLAMP 0x864F\n#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C\n#define GL_FIRST_VERTEX_CONVENTION 0x8E4D\n#define GL_LAST_VERTEX_CONVENTION 0x8E4E\n#define GL_PROVOKING_VERTEX 0x8E4F\n#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F\n#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111\n#define GL_OBJECT_TYPE 0x9112\n#define GL_SYNC_CONDITION 0x9113\n#define GL_SYNC_STATUS 0x9114\n#define GL_SYNC_FLAGS 0x9115\n#define GL_SYNC_FENCE 0x9116\n#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117\n#define GL_UNSIGNALED 0x9118\n#define GL_SIGNALED 0x9119\n#define GL_ALREADY_SIGNALED 0x911A\n#define GL_TIMEOUT_EXPIRED 0x911B\n#define GL_CONDITION_SATISFIED 0x911C\n#define GL_WAIT_FAILED 0x911D\n#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF\n#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001\n#define GL_SAMPLE_POSITION 0x8E50\n#define GL_SAMPLE_MASK 0x8E51\n#define GL_SAMPLE_MASK_VALUE 0x8E52\n#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59\n#define GL_TEXTURE_2D_MULTISAMPLE 0x9100\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101\n#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102\n#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104\n#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105\n#define GL_TEXTURE_SAMPLES 0x9106\n#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107\n#define GL_SAMPLER_2D_MULTISAMPLE 0x9108\n#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A\n#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B\n#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C\n#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D\n#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E\n#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F\n#define GL_MAX_INTEGER_SAMPLES 0x9110\n#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE\n#define GL_SRC1_COLOR 0x88F9\n#define GL_ONE_MINUS_SRC1_COLOR 0x88FA\n#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB\n#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC\n#define GL_ANY_SAMPLES_PASSED 0x8C2F\n#define GL_SAMPLER_BINDING 0x8919\n#define GL_RGB10_A2UI 0x906F\n#define GL_TEXTURE_SWIZZLE_R 0x8E42\n#define GL_TEXTURE_SWIZZLE_G 0x8E43\n#define GL_TEXTURE_SWIZZLE_B 0x8E44\n#define GL_TEXTURE_SWIZZLE_A 0x8E45\n#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46\n#define GL_TIME_ELAPSED 0x88BF\n#define GL_TIMESTAMP 0x8E28\n#define GL_INT_2_10_10_10_REV 0x8D9F\n#define GL_SAMPLE_SHADING 0x8C36\n#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37\n#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E\n#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F\n#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009\n#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A\n#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B\n#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C\n#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D\n#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E\n#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F\n#define GL_DRAW_INDIRECT_BUFFER 0x8F3F\n#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43\n#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F\n#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A\n#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B\n#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C\n#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D\n#define GL_MAX_VERTEX_STREAMS 0x8E71\n#define GL_DOUBLE_VEC2 0x8FFC\n#define GL_DOUBLE_VEC3 0x8FFD\n#define GL_DOUBLE_VEC4 0x8FFE\n#define GL_DOUBLE_MAT2 0x8F46\n#define GL_DOUBLE_MAT3 0x8F47\n#define GL_DOUBLE_MAT4 0x8F48\n#define GL_DOUBLE_MAT2x3 0x8F49\n#define GL_DOUBLE_MAT2x4 0x8F4A\n#define GL_DOUBLE_MAT3x2 0x8F4B\n#define GL_DOUBLE_MAT3x4 0x8F4C\n#define GL_DOUBLE_MAT4x2 0x8F4D\n#define GL_DOUBLE_MAT4x3 0x8F4E\n#define GL_ACTIVE_SUBROUTINES 0x8DE5\n#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47\n#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48\n#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49\n#define GL_MAX_SUBROUTINES 0x8DE7\n#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8\n#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A\n#define GL_COMPATIBLE_SUBROUTINES 0x8E4B\n#define GL_PATCHES 0x000E\n#define GL_PATCH_VERTICES 0x8E72\n#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73\n#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74\n#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75\n#define GL_TESS_GEN_MODE 0x8E76\n#define GL_TESS_GEN_SPACING 0x8E77\n#define GL_TESS_GEN_VERTEX_ORDER 0x8E78\n#define GL_TESS_GEN_POINT_MODE 0x8E79\n#define GL_ISOLINES 0x8E7A\n#define GL_FRACTIONAL_ODD 0x8E7B\n#define GL_FRACTIONAL_EVEN 0x8E7C\n#define GL_MAX_PATCH_VERTICES 0x8E7D\n#define GL_MAX_TESS_GEN_LEVEL 0x8E7E\n#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F\n#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80\n#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81\n#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82\n#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83\n#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84\n#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85\n#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86\n#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89\n#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A\n#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C\n#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D\n#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E\n#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1\n#define GL_TESS_EVALUATION_SHADER 0x8E87\n#define GL_TESS_CONTROL_SHADER 0x8E88\n#define GL_TRANSFORM_FEEDBACK 0x8E22\n#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23\n#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24\n#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25\n#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70\n#define GL_FIXED 0x140C\n#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A\n#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B\n#define GL_LOW_FLOAT 0x8DF0\n#define GL_MEDIUM_FLOAT 0x8DF1\n#define GL_HIGH_FLOAT 0x8DF2\n#define GL_LOW_INT 0x8DF3\n#define GL_MEDIUM_INT 0x8DF4\n#define GL_HIGH_INT 0x8DF5\n#define GL_SHADER_COMPILER 0x8DFA\n#define GL_SHADER_BINARY_FORMATS 0x8DF8\n#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9\n#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB\n#define GL_MAX_VARYING_VECTORS 0x8DFC\n#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD\n#define GL_RGB565 0x8D62\n#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257\n#define GL_PROGRAM_BINARY_LENGTH 0x8741\n#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE\n#define GL_PROGRAM_BINARY_FORMATS 0x87FF\n#define GL_VERTEX_SHADER_BIT 0x00000001\n#define GL_FRAGMENT_SHADER_BIT 0x00000002\n#define GL_GEOMETRY_SHADER_BIT 0x00000004\n#define GL_TESS_CONTROL_SHADER_BIT 0x00000008\n#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010\n#define GL_ALL_SHADER_BITS 0xFFFFFFFF\n#define GL_PROGRAM_SEPARABLE 0x8258\n#define GL_ACTIVE_PROGRAM 0x8259\n#define GL_PROGRAM_PIPELINE_BINDING 0x825A\n#define GL_MAX_VIEWPORTS 0x825B\n#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C\n#define GL_VIEWPORT_BOUNDS_RANGE 0x825D\n#define GL_LAYER_PROVOKING_VERTEX 0x825E\n#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F\n#define GL_UNDEFINED_VERTEX 0x8260\n#define GL_COPY_READ_BUFFER_BINDING 0x8F36\n#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37\n#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24\n#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23\n#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127\n#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128\n#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129\n#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A\n#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B\n#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C\n#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D\n#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E\n#define GL_NUM_SAMPLE_COUNTS 0x9380\n#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC\n#define GL_ATOMIC_COUNTER_BUFFER 0x92C0\n#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1\n#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2\n#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3\n#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5\n#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB\n#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0\n#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1\n#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2\n#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3\n#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4\n#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5\n#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6\n#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8\n#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC\n#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9\n#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA\n#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB\n#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001\n#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002\n#define GL_UNIFORM_BARRIER_BIT 0x00000004\n#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008\n#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020\n#define GL_COMMAND_BARRIER_BIT 0x00000040\n#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080\n#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100\n#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200\n#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400\n#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800\n#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000\n#define GL_ALL_BARRIER_BITS 0xFFFFFFFF\n#define GL_MAX_IMAGE_UNITS 0x8F38\n#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39\n#define GL_IMAGE_BINDING_NAME 0x8F3A\n#define GL_IMAGE_BINDING_LEVEL 0x8F3B\n#define GL_IMAGE_BINDING_LAYERED 0x8F3C\n#define GL_IMAGE_BINDING_LAYER 0x8F3D\n#define GL_IMAGE_BINDING_ACCESS 0x8F3E\n#define GL_IMAGE_1D 0x904C\n#define GL_IMAGE_2D 0x904D\n#define GL_IMAGE_3D 0x904E\n#define GL_IMAGE_2D_RECT 0x904F\n#define GL_IMAGE_CUBE 0x9050\n#define GL_IMAGE_BUFFER 0x9051\n#define GL_IMAGE_1D_ARRAY 0x9052\n#define GL_IMAGE_2D_ARRAY 0x9053\n#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054\n#define GL_IMAGE_2D_MULTISAMPLE 0x9055\n#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056\n#define GL_INT_IMAGE_1D 0x9057\n#define GL_INT_IMAGE_2D 0x9058\n#define GL_INT_IMAGE_3D 0x9059\n#define GL_INT_IMAGE_2D_RECT 0x905A\n#define GL_INT_IMAGE_CUBE 0x905B\n#define GL_INT_IMAGE_BUFFER 0x905C\n#define GL_INT_IMAGE_1D_ARRAY 0x905D\n#define GL_INT_IMAGE_2D_ARRAY 0x905E\n#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F\n#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060\n#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061\n#define GL_UNSIGNED_INT_IMAGE_1D 0x9062\n#define GL_UNSIGNED_INT_IMAGE_2D 0x9063\n#define GL_UNSIGNED_INT_IMAGE_3D 0x9064\n#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065\n#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066\n#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067\n#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068\n#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069\n#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B\n#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C\n#define GL_MAX_IMAGE_SAMPLES 0x906D\n#define GL_IMAGE_BINDING_FORMAT 0x906E\n#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8\n#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9\n#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA\n#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB\n#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC\n#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD\n#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE\n#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF\n#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C\n#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D\n#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E\n#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F\n#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F\n#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9\n#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E\n#define GL_COMPRESSED_RGB8_ETC2 0x9274\n#define GL_COMPRESSED_SRGB8_ETC2 0x9275\n#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276\n#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277\n#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278\n#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279\n#define GL_COMPRESSED_R11_EAC 0x9270\n#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271\n#define GL_COMPRESSED_RG11_EAC 0x9272\n#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273\n#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69\n#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A\n#define GL_MAX_ELEMENT_INDEX 0x8D6B\n#define GL_COMPUTE_SHADER 0x91B9\n#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB\n#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC\n#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD\n#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262\n#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263\n#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264\n#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265\n#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266\n#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB\n#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE\n#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF\n#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267\n#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC\n#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED\n#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE\n#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF\n#define GL_COMPUTE_SHADER_BIT 0x00000020\n#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242\n#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243\n#define GL_DEBUG_CALLBACK_FUNCTION 0x8244\n#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245\n#define GL_DEBUG_SOURCE_API 0x8246\n#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247\n#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248\n#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249\n#define GL_DEBUG_SOURCE_APPLICATION 0x824A\n#define GL_DEBUG_SOURCE_OTHER 0x824B\n#define GL_DEBUG_TYPE_ERROR 0x824C\n#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D\n#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E\n#define GL_DEBUG_TYPE_PORTABILITY 0x824F\n#define GL_DEBUG_TYPE_PERFORMANCE 0x8250\n#define GL_DEBUG_TYPE_OTHER 0x8251\n#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143\n#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144\n#define GL_DEBUG_LOGGED_MESSAGES 0x9145\n#define GL_DEBUG_SEVERITY_HIGH 0x9146\n#define GL_DEBUG_SEVERITY_MEDIUM 0x9147\n#define GL_DEBUG_SEVERITY_LOW 0x9148\n#define GL_DEBUG_TYPE_MARKER 0x8268\n#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269\n#define GL_DEBUG_TYPE_POP_GROUP 0x826A\n#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B\n#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C\n#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D\n#define GL_BUFFER 0x82E0\n#define GL_SHADER 0x82E1\n#define GL_PROGRAM 0x82E2\n#define GL_QUERY 0x82E3\n#define GL_PROGRAM_PIPELINE 0x82E4\n#define GL_SAMPLER 0x82E6\n#define GL_MAX_LABEL_LENGTH 0x82E8\n#define GL_DEBUG_OUTPUT 0x92E0\n#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002\n#define GL_MAX_UNIFORM_LOCATIONS 0x826E\n#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310\n#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311\n#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312\n#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313\n#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314\n#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315\n#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316\n#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317\n#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318\n#define GL_INTERNALFORMAT_SUPPORTED 0x826F\n#define GL_INTERNALFORMAT_PREFERRED 0x8270\n#define GL_INTERNALFORMAT_RED_SIZE 0x8271\n#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272\n#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273\n#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274\n#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275\n#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276\n#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277\n#define GL_INTERNALFORMAT_RED_TYPE 0x8278\n#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279\n#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A\n#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B\n#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C\n#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D\n#define GL_MAX_WIDTH 0x827E\n#define GL_MAX_HEIGHT 0x827F\n#define GL_MAX_DEPTH 0x8280\n#define GL_MAX_LAYERS 0x8281\n#define GL_MAX_COMBINED_DIMENSIONS 0x8282\n#define GL_COLOR_COMPONENTS 0x8283\n#define GL_DEPTH_COMPONENTS 0x8284\n#define GL_STENCIL_COMPONENTS 0x8285\n#define GL_COLOR_RENDERABLE 0x8286\n#define GL_DEPTH_RENDERABLE 0x8287\n#define GL_STENCIL_RENDERABLE 0x8288\n#define GL_FRAMEBUFFER_RENDERABLE 0x8289\n#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A\n#define GL_FRAMEBUFFER_BLEND 0x828B\n#define GL_READ_PIXELS 0x828C\n#define GL_READ_PIXELS_FORMAT 0x828D\n#define GL_READ_PIXELS_TYPE 0x828E\n#define GL_TEXTURE_IMAGE_FORMAT 0x828F\n#define GL_TEXTURE_IMAGE_TYPE 0x8290\n#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291\n#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292\n#define GL_MIPMAP 0x8293\n#define GL_MANUAL_GENERATE_MIPMAP 0x8294\n#define GL_AUTO_GENERATE_MIPMAP 0x8295\n#define GL_COLOR_ENCODING 0x8296\n#define GL_SRGB_READ 0x8297\n#define GL_SRGB_WRITE 0x8298\n#define GL_FILTER 0x829A\n#define GL_VERTEX_TEXTURE 0x829B\n#define GL_TESS_CONTROL_TEXTURE 0x829C\n#define GL_TESS_EVALUATION_TEXTURE 0x829D\n#define GL_GEOMETRY_TEXTURE 0x829E\n#define GL_FRAGMENT_TEXTURE 0x829F\n#define GL_COMPUTE_TEXTURE 0x82A0\n#define GL_TEXTURE_SHADOW 0x82A1\n#define GL_TEXTURE_GATHER 0x82A2\n#define GL_TEXTURE_GATHER_SHADOW 0x82A3\n#define GL_SHADER_IMAGE_LOAD 0x82A4\n#define GL_SHADER_IMAGE_STORE 0x82A5\n#define GL_SHADER_IMAGE_ATOMIC 0x82A6\n#define GL_IMAGE_TEXEL_SIZE 0x82A7\n#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8\n#define GL_IMAGE_PIXEL_FORMAT 0x82A9\n#define GL_IMAGE_PIXEL_TYPE 0x82AA\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD\n#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE\n#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF\n#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1\n#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2\n#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3\n#define GL_CLEAR_BUFFER 0x82B4\n#define GL_TEXTURE_VIEW 0x82B5\n#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6\n#define GL_FULL_SUPPORT 0x82B7\n#define GL_CAVEAT_SUPPORT 0x82B8\n#define GL_IMAGE_CLASS_4_X_32 0x82B9\n#define GL_IMAGE_CLASS_2_X_32 0x82BA\n#define GL_IMAGE_CLASS_1_X_32 0x82BB\n#define GL_IMAGE_CLASS_4_X_16 0x82BC\n#define GL_IMAGE_CLASS_2_X_16 0x82BD\n#define GL_IMAGE_CLASS_1_X_16 0x82BE\n#define GL_IMAGE_CLASS_4_X_8 0x82BF\n#define GL_IMAGE_CLASS_2_X_8 0x82C0\n#define GL_IMAGE_CLASS_1_X_8 0x82C1\n#define GL_IMAGE_CLASS_11_11_10 0x82C2\n#define GL_IMAGE_CLASS_10_10_10_2 0x82C3\n#define GL_VIEW_CLASS_128_BITS 0x82C4\n#define GL_VIEW_CLASS_96_BITS 0x82C5\n#define GL_VIEW_CLASS_64_BITS 0x82C6\n#define GL_VIEW_CLASS_48_BITS 0x82C7\n#define GL_VIEW_CLASS_32_BITS 0x82C8\n#define GL_VIEW_CLASS_24_BITS 0x82C9\n#define GL_VIEW_CLASS_16_BITS 0x82CA\n#define GL_VIEW_CLASS_8_BITS 0x82CB\n#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC\n#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD\n#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE\n#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF\n#define GL_VIEW_CLASS_RGTC1_RED 0x82D0\n#define GL_VIEW_CLASS_RGTC2_RG 0x82D1\n#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2\n#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3\n#define GL_UNIFORM 0x92E1\n#define GL_UNIFORM_BLOCK 0x92E2\n#define GL_PROGRAM_INPUT 0x92E3\n#define GL_PROGRAM_OUTPUT 0x92E4\n#define GL_BUFFER_VARIABLE 0x92E5\n#define GL_SHADER_STORAGE_BLOCK 0x92E6\n#define GL_VERTEX_SUBROUTINE 0x92E8\n#define GL_TESS_CONTROL_SUBROUTINE 0x92E9\n#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA\n#define GL_GEOMETRY_SUBROUTINE 0x92EB\n#define GL_FRAGMENT_SUBROUTINE 0x92EC\n#define GL_COMPUTE_SUBROUTINE 0x92ED\n#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE\n#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF\n#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0\n#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1\n#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2\n#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3\n#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4\n#define GL_ACTIVE_RESOURCES 0x92F5\n#define GL_MAX_NAME_LENGTH 0x92F6\n#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7\n#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8\n#define GL_NAME_LENGTH 0x92F9\n#define GL_TYPE 0x92FA\n#define GL_ARRAY_SIZE 0x92FB\n#define GL_OFFSET 0x92FC\n#define GL_BLOCK_INDEX 0x92FD\n#define GL_ARRAY_STRIDE 0x92FE\n#define GL_MATRIX_STRIDE 0x92FF\n#define GL_IS_ROW_MAJOR 0x9300\n#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301\n#define GL_BUFFER_BINDING 0x9302\n#define GL_BUFFER_DATA_SIZE 0x9303\n#define GL_NUM_ACTIVE_VARIABLES 0x9304\n#define GL_ACTIVE_VARIABLES 0x9305\n#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306\n#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307\n#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308\n#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309\n#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A\n#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B\n#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C\n#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D\n#define GL_LOCATION 0x930E\n#define GL_LOCATION_INDEX 0x930F\n#define GL_IS_PER_PATCH 0x92E7\n#define GL_SHADER_STORAGE_BUFFER 0x90D2\n#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3\n#define GL_SHADER_STORAGE_BUFFER_START 0x90D4\n#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5\n#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6\n#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7\n#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8\n#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9\n#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA\n#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB\n#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC\n#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD\n#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE\n#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF\n#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000\n#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39\n#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA\n#define GL_TEXTURE_BUFFER_OFFSET 0x919D\n#define GL_TEXTURE_BUFFER_SIZE 0x919E\n#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F\n#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB\n#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC\n#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD\n#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE\n#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF\n#define GL_VERTEX_ATTRIB_BINDING 0x82D4\n#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5\n#define GL_VERTEX_BINDING_DIVISOR 0x82D6\n#define GL_VERTEX_BINDING_OFFSET 0x82D7\n#define GL_VERTEX_BINDING_STRIDE 0x82D8\n#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9\n#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA\n#define GL_VERTEX_BINDING_BUFFER 0x8F4F\n#define GL_DISPLAY_LIST 0x82E7\n#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5\n#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221\n#define GL_TEXTURE_BUFFER_BINDING 0x8C2A\n#define GL_MAP_PERSISTENT_BIT 0x0040\n#define GL_MAP_COHERENT_BIT 0x0080\n#define GL_DYNAMIC_STORAGE_BIT 0x0100\n#define GL_CLIENT_STORAGE_BIT 0x0200\n#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000\n#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F\n#define GL_BUFFER_STORAGE_FLAGS 0x8220\n#define GL_CLEAR_TEXTURE 0x9365\n#define GL_LOCATION_COMPONENT 0x934A\n#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B\n#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C\n#define GL_QUERY_BUFFER 0x9192\n#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000\n#define GL_QUERY_BUFFER_BINDING 0x9193\n#define GL_QUERY_RESULT_NO_WAIT 0x9194\n#define GL_MIRROR_CLAMP_TO_EDGE 0x8743\n#define GL_CONTEXT_LOST 0x0507\n#define GL_NEGATIVE_ONE_TO_ONE 0x935E\n#define GL_ZERO_TO_ONE 0x935F\n#define GL_CLIP_ORIGIN 0x935C\n#define GL_CLIP_DEPTH_MODE 0x935D\n#define GL_QUERY_WAIT_INVERTED 0x8E17\n#define GL_QUERY_NO_WAIT_INVERTED 0x8E18\n#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19\n#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A\n#define GL_MAX_CULL_DISTANCES 0x82F9\n#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA\n#define GL_TEXTURE_TARGET 0x1006\n#define GL_QUERY_TARGET 0x82EA\n#define GL_GUILTY_CONTEXT_RESET 0x8253\n#define GL_INNOCENT_CONTEXT_RESET 0x8254\n#define GL_UNKNOWN_CONTEXT_RESET 0x8255\n#define GL_RESET_NOTIFICATION_STRATEGY 0x8256\n#define GL_LOSE_CONTEXT_ON_RESET 0x8252\n#define GL_NO_RESET_NOTIFICATION 0x8261\n#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004\n#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB\n#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC\n#ifndef GL_VERSION_1_0\n#define GL_VERSION_1_0 1\nGLAPI int GLAD_GL_VERSION_1_0;\ntypedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode);\nGLAPI PFNGLCULLFACEPROC glad_glCullFace;\n#define glCullFace glad_glCullFace\ntypedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode);\nGLAPI PFNGLFRONTFACEPROC glad_glFrontFace;\n#define glFrontFace glad_glFrontFace\ntypedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode);\nGLAPI PFNGLHINTPROC glad_glHint;\n#define glHint glad_glHint\ntypedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width);\nGLAPI PFNGLLINEWIDTHPROC glad_glLineWidth;\n#define glLineWidth glad_glLineWidth\ntypedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size);\nGLAPI PFNGLPOINTSIZEPROC glad_glPointSize;\n#define glPointSize glad_glPointSize\ntypedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode);\nGLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode;\n#define glPolygonMode glad_glPolygonMode\ntypedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI PFNGLSCISSORPROC glad_glScissor;\n#define glScissor glad_glScissor\ntypedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param);\nGLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf;\n#define glTexParameterf glad_glTexParameterf\ntypedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params);\nGLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;\n#define glTexParameterfv glad_glTexParameterfv\ntypedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param);\nGLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri;\n#define glTexParameteri glad_glTexParameteri\ntypedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params);\nGLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;\n#define glTexParameteriv glad_glTexParameteriv\ntypedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);\nGLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D;\n#define glTexImage1D glad_glTexImage1D\ntypedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);\nGLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D;\n#define glTexImage2D glad_glTexImage2D\ntypedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf);\nGLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer;\n#define glDrawBuffer glad_glDrawBuffer\ntypedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask);\nGLAPI PFNGLCLEARPROC glad_glClear;\n#define glClear glad_glClear\ntypedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI PFNGLCLEARCOLORPROC glad_glClearColor;\n#define glClearColor glad_glClearColor\ntypedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s);\nGLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil;\n#define glClearStencil glad_glClearStencil\ntypedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth);\nGLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth;\n#define glClearDepth glad_glClearDepth\ntypedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask);\nGLAPI PFNGLSTENCILMASKPROC glad_glStencilMask;\n#define glStencilMask glad_glStencilMask\ntypedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);\nGLAPI PFNGLCOLORMASKPROC glad_glColorMask;\n#define glColorMask glad_glColorMask\ntypedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag);\nGLAPI PFNGLDEPTHMASKPROC glad_glDepthMask;\n#define glDepthMask glad_glDepthMask\ntypedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap);\nGLAPI PFNGLDISABLEPROC glad_glDisable;\n#define glDisable glad_glDisable\ntypedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap);\nGLAPI PFNGLENABLEPROC glad_glEnable;\n#define glEnable glad_glEnable\ntypedef void (APIENTRYP PFNGLFINISHPROC)();\nGLAPI PFNGLFINISHPROC glad_glFinish;\n#define glFinish glad_glFinish\ntypedef void (APIENTRYP PFNGLFLUSHPROC)();\nGLAPI PFNGLFLUSHPROC glad_glFlush;\n#define glFlush glad_glFlush\ntypedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor);\nGLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc;\n#define glBlendFunc glad_glBlendFunc\ntypedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode);\nGLAPI PFNGLLOGICOPPROC glad_glLogicOp;\n#define glLogicOp glad_glLogicOp\ntypedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask);\nGLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc;\n#define glStencilFunc glad_glStencilFunc\ntypedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass);\nGLAPI PFNGLSTENCILOPPROC glad_glStencilOp;\n#define glStencilOp glad_glStencilOp\ntypedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func);\nGLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc;\n#define glDepthFunc glad_glDepthFunc\ntypedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param);\nGLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref;\n#define glPixelStoref glad_glPixelStoref\ntypedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param);\nGLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei;\n#define glPixelStorei glad_glPixelStorei\ntypedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src);\nGLAPI PFNGLREADBUFFERPROC glad_glReadBuffer;\n#define glReadBuffer glad_glReadBuffer\ntypedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);\nGLAPI PFNGLREADPIXELSPROC glad_glReadPixels;\n#define glReadPixels glad_glReadPixels\ntypedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data);\nGLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv;\n#define glGetBooleanv glad_glGetBooleanv\ntypedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data);\nGLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev;\n#define glGetDoublev glad_glGetDoublev\ntypedef GLenum (APIENTRYP PFNGLGETERRORPROC)();\nGLAPI PFNGLGETERRORPROC glad_glGetError;\n#define glGetError glad_glGetError\ntypedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data);\nGLAPI PFNGLGETFLOATVPROC glad_glGetFloatv;\n#define glGetFloatv glad_glGetFloatv\ntypedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data);\nGLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv;\n#define glGetIntegerv glad_glGetIntegerv\ntypedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name);\nGLAPI PFNGLGETSTRINGPROC glad_glGetString;\n#define glGetString glad_glGetString\ntypedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels);\nGLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage;\n#define glGetTexImage glad_glGetTexImage\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params);\nGLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;\n#define glGetTexParameterfv glad_glGetTexParameterfv\ntypedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params);\nGLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;\n#define glGetTexParameteriv glad_glGetTexParameteriv\ntypedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params);\nGLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv;\n#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv\ntypedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params);\nGLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;\n#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv\ntypedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap);\nGLAPI PFNGLISENABLEDPROC glad_glIsEnabled;\n#define glIsEnabled glad_glIsEnabled\ntypedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble near, GLdouble far);\nGLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange;\n#define glDepthRange glad_glDepthRange\ntypedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);\nGLAPI PFNGLVIEWPORTPROC glad_glViewport;\n#define glViewport glad_glViewport\ntypedef void (APIENTRYP PFNGLNEWLISTPROC)(GLuint list, GLenum mode);\nGLAPI PFNGLNEWLISTPROC glad_glNewList;\n#define glNewList glad_glNewList\ntypedef void (APIENTRYP PFNGLENDLISTPROC)();\nGLAPI PFNGLENDLISTPROC glad_glEndList;\n#define glEndList glad_glEndList\ntypedef void (APIENTRYP PFNGLCALLLISTPROC)(GLuint list);\nGLAPI PFNGLCALLLISTPROC glad_glCallList;\n#define glCallList glad_glCallList\ntypedef void (APIENTRYP PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void *lists);\nGLAPI PFNGLCALLLISTSPROC glad_glCallLists;\n#define glCallLists glad_glCallLists\ntypedef void (APIENTRYP PFNGLDELETELISTSPROC)(GLuint list, GLsizei range);\nGLAPI PFNGLDELETELISTSPROC glad_glDeleteLists;\n#define glDeleteLists glad_glDeleteLists\ntypedef GLuint (APIENTRYP PFNGLGENLISTSPROC)(GLsizei range);\nGLAPI PFNGLGENLISTSPROC glad_glGenLists;\n#define glGenLists glad_glGenLists\ntypedef void (APIENTRYP PFNGLLISTBASEPROC)(GLuint base);\nGLAPI PFNGLLISTBASEPROC glad_glListBase;\n#define glListBase glad_glListBase\ntypedef void (APIENTRYP PFNGLBEGINPROC)(GLenum mode);\nGLAPI PFNGLBEGINPROC glad_glBegin;\n#define glBegin glad_glBegin\ntypedef void (APIENTRYP PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);\nGLAPI PFNGLBITMAPPROC glad_glBitmap;\n#define glBitmap glad_glBitmap\ntypedef void (APIENTRYP PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue);\nGLAPI PFNGLCOLOR3BPROC glad_glColor3b;\n#define glColor3b glad_glColor3b\ntypedef void (APIENTRYP PFNGLCOLOR3BVPROC)(const GLbyte *v);\nGLAPI PFNGLCOLOR3BVPROC glad_glColor3bv;\n#define glColor3bv glad_glColor3bv\ntypedef void (APIENTRYP PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue);\nGLAPI PFNGLCOLOR3DPROC glad_glColor3d;\n#define glColor3d glad_glColor3d\ntypedef void (APIENTRYP PFNGLCOLOR3DVPROC)(const GLdouble *v);\nGLAPI PFNGLCOLOR3DVPROC glad_glColor3dv;\n#define glColor3dv glad_glColor3dv\ntypedef void (APIENTRYP PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue);\nGLAPI PFNGLCOLOR3FPROC glad_glColor3f;\n#define glColor3f glad_glColor3f\ntypedef void (APIENTRYP PFNGLCOLOR3FVPROC)(const GLfloat *v);\nGLAPI PFNGLCOLOR3FVPROC glad_glColor3fv;\n#define glColor3fv glad_glColor3fv\ntypedef void (APIENTRYP PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue);\nGLAPI PFNGLCOLOR3IPROC glad_glColor3i;\n#define glColor3i glad_glColor3i\ntypedef void (APIENTRYP PFNGLCOLOR3IVPROC)(const GLint *v);\nGLAPI PFNGLCOLOR3IVPROC glad_glColor3iv;\n#define glColor3iv glad_glColor3iv\ntypedef void (APIENTRYP PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue);\nGLAPI PFNGLCOLOR3SPROC glad_glColor3s;\n#define glColor3s glad_glColor3s\ntypedef void (APIENTRYP PFNGLCOLOR3SVPROC)(const GLshort *v);\nGLAPI PFNGLCOLOR3SVPROC glad_glColor3sv;\n#define glColor3sv glad_glColor3sv\ntypedef void (APIENTRYP PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue);\nGLAPI PFNGLCOLOR3UBPROC glad_glColor3ub;\n#define glColor3ub glad_glColor3ub\ntypedef void (APIENTRYP PFNGLCOLOR3UBVPROC)(const GLubyte *v);\nGLAPI PFNGLCOLOR3UBVPROC glad_glColor3ubv;\n#define glColor3ubv glad_glColor3ubv\ntypedef void (APIENTRYP PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue);\nGLAPI PFNGLCOLOR3UIPROC glad_glColor3ui;\n#define glColor3ui glad_glColor3ui\ntypedef void (APIENTRYP PFNGLCOLOR3UIVPROC)(const GLuint *v);\nGLAPI PFNGLCOLOR3UIVPROC glad_glColor3uiv;\n#define glColor3uiv glad_glColor3uiv\ntypedef void (APIENTRYP PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue);\nGLAPI PFNGLCOLOR3USPROC glad_glColor3us;\n#define glColor3us glad_glColor3us\ntypedef void (APIENTRYP PFNGLCOLOR3USVPROC)(const GLushort *v);\nGLAPI PFNGLCOLOR3USVPROC glad_glColor3usv;\n#define glColor3usv glad_glColor3usv\ntypedef void (APIENTRYP PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);\nGLAPI PFNGLCOLOR4BPROC glad_glColor4b;\n#define glColor4b glad_glColor4b\ntypedef void (APIENTRYP PFNGLCOLOR4BVPROC)(const GLbyte *v);\nGLAPI PFNGLCOLOR4BVPROC glad_glColor4bv;\n#define glColor4bv glad_glColor4bv\ntypedef void (APIENTRYP PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);\nGLAPI PFNGLCOLOR4DPROC glad_glColor4d;\n#define glColor4d glad_glColor4d\ntypedef void (APIENTRYP PFNGLCOLOR4DVPROC)(const GLdouble *v);\nGLAPI PFNGLCOLOR4DVPROC glad_glColor4dv;\n#define glColor4dv glad_glColor4dv\ntypedef void (APIENTRYP PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);\nGLAPI PFNGLCOLOR4FPROC glad_glColor4f;\n#define glColor4f glad_glColor4f\ntypedef void (APIENTRYP PFNGLCOLOR4FVPROC)(const GLfloat *v);\nGLAPI PFNGLCOLOR4FVPROC glad_glColor4fv;\n#define glColor4fv glad_glColor4fv\ntypedef void (APIENTRYP PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha);\nGLAPI PFNGLCOLOR4IPROC glad_glColor4i;\n#define glColor4i glad_glColor4i\ntypedef void (APIENTRYP PFNGLCOLOR4IVPROC)(const GLint *v);\nGLAPI PFNGLCOLOR4IVPROC glad_glColor4iv;\n#define glColor4iv glad_glColor4iv\ntypedef void (APIENTRYP PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha);\nGLAPI PFNGLCOLOR4SPROC glad_glColor4s;\n#define glColor4s glad_glColor4s\ntypedef void (APIENTRYP PFNGLCOLOR4SVPROC)(const GLshort *v);\nGLAPI PFNGLCOLOR4SVPROC glad_glColor4sv;\n#define glColor4sv glad_glColor4sv\ntypedef void (APIENTRYP PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);\nGLAPI PFNGLCOLOR4UBPROC glad_glColor4ub;\n#define glColor4ub glad_glColor4ub\ntypedef void (APIENTRYP PFNGLCOLOR4UBVPROC)(const GLubyte *v);\nGLAPI PFNGLCOLOR4UBVPROC glad_glColor4ubv;\n#define glColor4ubv glad_glColor4ubv\ntypedef void (APIENTRYP PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha);\nGLAPI PFNGLCOLOR4UIPROC glad_glColor4ui;\n#define glColor4ui glad_glColor4ui\ntypedef void (APIENTRYP PFNGLCOLOR4UIVPROC)(const GLuint *v);\nGLAPI PFNGLCOLOR4UIVPROC glad_glColor4uiv;\n#define glColor4uiv glad_glColor4uiv\ntypedef void (APIENTRYP PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha);\nGLAPI PFNGLCOLOR4USPROC glad_glColor4us;\n#define glColor4us glad_glColor4us\ntypedef void (APIENTRYP PFNGLCOLOR4USVPROC)(const GLushort *v);\nGLAPI PFNGLCOLOR4USVPROC glad_glColor4usv;\n#define glColor4usv glad_glColor4usv\ntypedef void (APIENTRYP PFNGLEDGEFLAGPROC)(GLboolean flag);\nGLAPI PFNGLEDGEFLAGPROC glad_glEdgeFlag;\n#define glEdgeFlag glad_glEdgeFlag\ntypedef void (APIENTRYP PFNGLEDGEFLAGVPROC)(const GLboolean *flag);\nGLAPI PFNGLEDGEFLAGVPROC glad_glEdgeFlagv;\n#define glEdgeFlagv glad_glEdgeFlagv\ntypedef void (APIENTRYP PFNGLENDPROC)();\nGLAPI PFNGLENDPROC glad_glEnd;\n#define glEnd glad_glEnd\ntypedef void (APIENTRYP PFNGLINDEXDPROC)(GLdouble c);\nGLAPI PFNGLINDEXDPROC glad_glIndexd;\n#define glIndexd glad_glIndexd\ntypedef void (APIENTRYP PFNGLINDEXDVPROC)(const GLdouble *c);\nGLAPI PFNGLINDEXDVPROC glad_glIndexdv;\n#define glIndexdv glad_glIndexdv\ntypedef void (APIENTRYP PFNGLINDEXFPROC)(GLfloat c);\nGLAPI PFNGLINDEXFPROC glad_glIndexf;\n#define glIndexf glad_glIndexf\ntypedef void (APIENTRYP PFNGLINDEXFVPROC)(const GLfloat *c);\nGLAPI PFNGLINDEXFVPROC glad_glIndexfv;\n#define glIndexfv glad_glIndexfv\ntypedef void (APIENTRYP PFNGLINDEXIPROC)(GLint c);\nGLAPI PFNGLINDEXIPROC glad_glIndexi;\n#define glIndexi glad_glIndexi\ntypedef void (APIENTRYP PFNGLINDEXIVPROC)(const GLint *c);\nGLAPI PFNGLINDEXIVPROC glad_glIndexiv;\n#define glIndexiv glad_glIndexiv\ntypedef void (APIENTRYP PFNGLINDEXSPROC)(GLshort c);\nGLAPI PFNGLINDEXSPROC glad_glIndexs;\n#define glIndexs glad_glIndexs\ntypedef void (APIENTRYP PFNGLINDEXSVPROC)(const GLshort *c);\nGLAPI PFNGLINDEXSVPROC glad_glIndexsv;\n#define glIndexsv glad_glIndexsv\ntypedef void (APIENTRYP PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz);\nGLAPI PFNGLNORMAL3BPROC glad_glNormal3b;\n#define glNormal3b glad_glNormal3b\ntypedef void (APIENTRYP PFNGLNORMAL3BVPROC)(const GLbyte *v);\nGLAPI PFNGLNORMAL3BVPROC glad_glNormal3bv;\n#define glNormal3bv glad_glNormal3bv\ntypedef void (APIENTRYP PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz);\nGLAPI PFNGLNORMAL3DPROC glad_glNormal3d;\n#define glNormal3d glad_glNormal3d\ntypedef void (APIENTRYP PFNGLNORMAL3DVPROC)(const GLdouble *v);\nGLAPI PFNGLNORMAL3DVPROC glad_glNormal3dv;\n#define glNormal3dv glad_glNormal3dv\ntypedef void (APIENTRYP PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz);\nGLAPI PFNGLNORMAL3FPROC glad_glNormal3f;\n#define glNormal3f glad_glNormal3f\ntypedef void (APIENTRYP PFNGLNORMAL3FVPROC)(const GLfloat *v);\nGLAPI PFNGLNORMAL3FVPROC glad_glNormal3fv;\n#define glNormal3fv glad_glNormal3fv\ntypedef void (APIENTRYP PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz);\nGLAPI PFNGLNORMAL3IPROC glad_glNormal3i;\n#define glNormal3i glad_glNormal3i\ntypedef void (APIENTRYP PFNGLNORMAL3IVPROC)(const GLint *v);\nGLAPI PFNGLNORMAL3IVPROC glad_glNormal3iv;\n#define glNormal3iv glad_glNormal3iv\ntypedef void (APIENTRYP PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz);\nGLAPI PFNGLNORMAL3SPROC glad_glNormal3s;\n#define glNormal3s glad_glNormal3s\ntypedef void (APIENTRYP PFNGLNORMAL3SVPROC)(const GLshort *v);\nGLAPI PFNGLNORMAL3SVPROC glad_glNormal3sv;\n#define glNormal3sv glad_glNormal3sv\ntypedef void (APIENTRYP PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y);\nGLAPI PFNGLRASTERPOS2DPROC glad_glRasterPos2d;\n#define glRasterPos2d glad_glRasterPos2d\ntypedef void (APIENTRYP PFNGLRASTERPOS2DVPROC)(const GLdouble *v);\nGLAPI PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv;\n#define glRasterPos2dv glad_glRasterPos2dv\ntypedef void (APIENTRYP PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y);\nGLAPI PFNGLRASTERPOS2FPROC glad_glRasterPos2f;\n#define glRasterPos2f glad_glRasterPos2f\ntypedef void (APIENTRYP PFNGLRASTERPOS2FVPROC)(const GLfloat *v);\nGLAPI PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv;\n#define glRasterPos2fv glad_glRasterPos2fv\ntypedef void (APIENTRYP PFNGLRASTERPOS2IPROC)(GLint x, GLint y);\nGLAPI PFNGLRASTERPOS2IPROC glad_glRasterPos2i;\n#define glRasterPos2i glad_glRasterPos2i\ntypedef void (APIENTRYP PFNGLRASTERPOS2IVPROC)(const GLint *v);\nGLAPI PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv;\n#define glRasterPos2iv glad_glRasterPos2iv\ntypedef void (APIENTRYP PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y);\nGLAPI PFNGLRASTERPOS2SPROC glad_glRasterPos2s;\n#define glRasterPos2s glad_glRasterPos2s\ntypedef void (APIENTRYP PFNGLRASTERPOS2SVPROC)(const GLshort *v);\nGLAPI PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv;\n#define glRasterPos2sv glad_glRasterPos2sv\ntypedef void (APIENTRYP PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z);\nGLAPI PFNGLRASTERPOS3DPROC glad_glRasterPos3d;\n#define glRasterPos3d glad_glRasterPos3d\ntypedef void (APIENTRYP PFNGLRASTERPOS3DVPROC)(const GLdouble *v);\nGLAPI PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv;\n#define glRasterPos3dv glad_glRasterPos3dv\ntypedef void (APIENTRYP PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z);\nGLAPI PFNGLRASTERPOS3FPROC glad_glRasterPos3f;\n#define glRasterPos3f glad_glRasterPos3f\ntypedef void (APIENTRYP PFNGLRASTERPOS3FVPROC)(const GLfloat *v);\nGLAPI PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv;\n#define glRasterPos3fv glad_glRasterPos3fv\ntypedef void (APIENTRYP PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z);\nGLAPI PFNGLRASTERPOS3IPROC glad_glRasterPos3i;\n#define glRasterPos3i glad_glRasterPos3i\ntypedef void (APIENTRYP PFNGLRASTERPOS3IVPROC)(const GLint *v);\nGLAPI PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv;\n#define glRasterPos3iv glad_glRasterPos3iv\ntypedef void (APIENTRYP PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z);\nGLAPI PFNGLRASTERPOS3SPROC glad_glRasterPos3s;\n#define glRasterPos3s glad_glRasterPos3s\ntypedef void (APIENTRYP PFNGLRASTERPOS3SVPROC)(const GLshort *v);\nGLAPI PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv;\n#define glRasterPos3sv glad_glRasterPos3sv\ntypedef void (APIENTRYP PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);\nGLAPI PFNGLRASTERPOS4DPROC glad_glRasterPos4d;\n#define glRasterPos4d glad_glRasterPos4d\ntypedef void (APIENTRYP PFNGLRASTERPOS4DVPROC)(const GLdouble *v);\nGLAPI PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv;\n#define glRasterPos4dv glad_glRasterPos4dv\ntypedef void (APIENTRYP PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);\nGLAPI PFNGLRASTERPOS4FPROC glad_glRasterPos4f;\n#define glRasterPos4f glad_glRasterPos4f\ntypedef void (APIENTRYP PFNGLRASTERPOS4FVPROC)(const GLfloat *v);\nGLAPI PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv;\n#define glRasterPos4fv glad_glRasterPos4fv\ntypedef void (APIENTRYP PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w);\nGLAPI PFNGLRASTERPOS4IPROC glad_glRasterPos4i;\n#define glRasterPos4i glad_glRasterPos4i\ntypedef void (APIENTRYP PFNGLRASTERPOS4IVPROC)(const GLint *v);\nGLAPI PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv;\n#define glRasterPos4iv glad_glRasterPos4iv\ntypedef void (APIENTRYP PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w);\nGLAPI PFNGLRASTERPOS4SPROC glad_glRasterPos4s;\n#define glRasterPos4s glad_glRasterPos4s\ntypedef void (APIENTRYP PFNGLRASTERPOS4SVPROC)(const GLshort *v);\nGLAPI PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv;\n#define glRasterPos4sv glad_glRasterPos4sv\ntypedef void (APIENTRYP PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);\nGLAPI PFNGLRECTDPROC glad_glRectd;\n#define glRectd glad_glRectd\ntypedef void (APIENTRYP PFNGLRECTDVPROC)(const GLdouble *v1, const GLdouble *v2);\nGLAPI PFNGLRECTDVPROC glad_glRectdv;\n#define glRectdv glad_glRectdv\ntypedef void (APIENTRYP PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);\nGLAPI PFNGLRECTFPROC glad_glRectf;\n#define glRectf glad_glRectf\ntypedef void (APIENTRYP PFNGLRECTFVPROC)(const GLfloat *v1, const GLfloat *v2);\nGLAPI PFNGLRECTFVPROC glad_glRectfv;\n#define glRectfv glad_glRectfv\ntypedef void (APIENTRYP PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2);\nGLAPI PFNGLRECTIPROC glad_glRecti;\n#define glRecti glad_glRecti\ntypedef void (APIENTRYP PFNGLRECTIVPROC)(const GLint *v1, const GLint *v2);\nGLAPI PFNGLRECTIVPROC glad_glRectiv;\n#define glRectiv glad_glRectiv\ntypedef void (APIENTRYP PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);\nGLAPI PFNGLRECTSPROC glad_glRects;\n#define glRects glad_glRects\ntypedef void (APIENTRYP PFNGLRECTSVPROC)(const GLshort *v1, const GLshort *v2);\nGLAPI PFNGLRECTSVPROC glad_glRectsv;\n#define glRectsv glad_glRectsv\ntypedef void (APIENTRYP PFNGLTEXCOORD1DPROC)(GLdouble s);\nGLAPI PFNGLTEXCOORD1DPROC glad_glTexCoord1d;\n#define glTexCoord1d glad_glTexCoord1d\ntypedef void (APIENTRYP PFNGLTEXCOORD1DVPROC)(const GLdouble *v);\nGLAPI PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv;\n#define glTexCoord1dv glad_glTexCoord1dv\ntypedef void (APIENTRYP PFNGLTEXCOORD1FPROC)(GLfloat s);\nGLAPI PFNGLTEXCOORD1FPROC glad_glTexCoord1f;\n#define glTexCoord1f glad_glTexCoord1f\ntypedef void (APIENTRYP PFNGLTEXCOORD1FVPROC)(const GLfloat *v);\nGLAPI PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv;\n#define glTexCoord1fv glad_glTexCoord1fv\ntypedef void (APIENTRYP PFNGLTEXCOORD1IPROC)(GLint s);\nGLAPI PFNGLTEXCOORD1IPROC glad_glTexCoord1i;\n#define glTexCoord1i glad_glTexCoord1i\ntypedef void (APIENTRYP PFNGLTEXCOORD1IVPROC)(const GLint *v);\nGLAPI PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv;\n#define glTexCoord1iv glad_glTexCoord1iv\ntypedef void (APIENTRYP PFNGLTEXCOORD1SPROC)(GLshort s);\nGLAPI PFNGLTEXCOORD1SPROC glad_glTexCoord1s;\n#define glTexCoord1s glad_glTexCoord1s\ntypedef void (APIENTRYP PFNGLTEXCOORD1SVPROC)(const GLshort *v);\nGLAPI PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv;\n#define glTexCoord1sv glad_glTexCoord1sv\ntypedef void (APIENTRYP PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t);\nGLAPI PFNGLTEXCOORD2DPROC glad_glTexCoord2d;\n#define glTexCoord2d glad_glTexCoord2d\ntypedef void (APIENTRYP PFNGLTEXCOORD2DVPROC)(const GLdouble *v);\nGLAPI PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv;\n#define glTexCoord2dv glad_glTexCoord2dv\ntypedef void (APIENTRYP PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t);\nGLAPI PFNGLTEXCOORD2FPROC glad_glTexCoord2f;\n#define glTexCoord2f glad_glTexCoord2f\ntypedef void (APIENTRYP PFNGLTEXCOORD2FVPROC)(const GLfloat *v);\nGLAPI PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv;\n#define glTexCoord2fv glad_glTexCoord2fv\ntypedef void (APIENTRYP PFNGLTEXCOORD2IPROC)(GLint s, GLint t);\nGLAPI PFNGLTEXCOORD2IPROC glad_glTexCoord2i;\n#define glTexCoord2i glad_glTexCoord2i\ntypedef void (APIENTRYP PFNGLTEXCOORD2IVPROC)(const GLint *v);\nGLAPI PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv;\n#define glTexCoord2iv glad_glTexCoord2iv\ntypedef void (APIENTRYP PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t);\nGLAPI PFNGLTEXCOORD2SPROC glad_glTexCoord2s;\n#define glTexCoord2s glad_glTexCoord2s\ntypedef void (APIENTRYP PFNGLTEXCOORD2SVPROC)(const GLshort *v);\nGLAPI PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv;\n#define glTexCoord2sv glad_glTexCoord2sv\ntypedef void (APIENTRYP PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r);\nGLAPI PFNGLTEXCOORD3DPROC glad_glTexCoord3d;\n#define glTexCoord3d glad_glTexCoord3d\ntypedef void (APIENTRYP PFNGLTEXCOORD3DVPROC)(const GLdouble *v);\nGLAPI PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv;\n#define glTexCoord3dv glad_glTexCoord3dv\ntypedef void (APIENTRYP PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r);\nGLAPI PFNGLTEXCOORD3FPROC gla"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.004, "dedup_hash": "a060d7059f16cc6e", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glfw", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Glfw", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/GLFW/glfw3.h", "language": "code", "loc": 2157, "comment_density": 0.817, "code": "/*************************************************************************\n * GLFW 3.0 - www.glfw.org\n * A library for OpenGL, window and input\n *------------------------------------------------------------------------\n * Copyright (c) 2002-2006 Marcus Geelnard\n * Copyright (c) 2006-2010 Camilla Berglund \n *\n * This software is provided 'as-is', without any express or implied\n * warranty. In no event will the authors be held liable for any damages\n * arising from the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, subject to the following restrictions:\n *\n * 1. The origin of this software must not be misrepresented; you must not\n * claim that you wrote the original software. If you use this software\n * in a product, an acknowledgment in the product documentation would\n * be appreciated but is not required.\n *\n * 2. Altered source versions must be plainly marked as such, and must not\n * be misrepresented as being the original software.\n *\n * 3. This notice may not be removed or altered from any source\n * distribution.\n *\n *************************************************************************/\n\n#ifndef _glfw3_h_\n#define _glfw3_h_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/*************************************************************************\n * Doxygen documentation\n *************************************************************************/\n\n/*! @defgroup clipboard Clipboard support\n */\n/*! @defgroup context Context handling\n */\n/*! @defgroup error Error handling\n */\n/*! @defgroup init Initialization and version information\n */\n/*! @defgroup input Input handling\n */\n/*! @defgroup monitor Monitor handling\n *\n * This is the reference documentation for monitor related functions and types.\n * For more information, see the @ref monitor.\n */\n/*! @defgroup time Time input\n */\n/*! @defgroup window Window handling\n *\n * This is the reference documentation for window related functions and types,\n * including creation, deletion and event polling. For more information, see\n * the @ref window.\n */\n\n\n/*************************************************************************\n * Global definitions\n *************************************************************************/\n\n/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */\n\n/* Please report any problems that you find with your compiler, which may\n * be solved in this section! There are several compilers that I have not\n * been able to test this file with yet.\n *\n * First: If we are we on Windows, we want a single define for it (_WIN32)\n * (Note: For Cygwin the compiler flag -mwin32 should be used, but to\n * make sure that things run smoothly for Cygwin users, we add __CYGWIN__\n * to the list of \"valid Win32 identifiers\", which removes the need for\n * -mwin32)\n */\n#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__))\n #define _WIN32\n#endif /* _WIN32 */\n\n/* In order for extension support to be portable, we need to define an\n * OpenGL function call method. We use the keyword APIENTRY, which is\n * defined for Win32. (Note: Windows also needs this for )\n */\n#ifndef APIENTRY\n #ifdef _WIN32\n #define APIENTRY __stdcall\n #else\n #define APIENTRY\n #endif\n#endif /* APIENTRY */\n\n/* The following three defines are here solely to make some Windows-based\n * files happy. Theoretically we could include , but\n * it has the major drawback of severely polluting our namespace.\n */\n\n/* Under Windows, we need WINGDIAPI defined */\n#if !defined(WINGDIAPI) && defined(_WIN32)\n #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__POCC__)\n /* Microsoft Visual C++, Borland C++ Builder and Pelles C */\n #define WINGDIAPI __declspec(dllimport)\n #elif defined(__LCC__)\n /* LCC-Win32 */\n #define WINGDIAPI __stdcall\n #else\n /* Others (e.g. MinGW, Cygwin) */\n #define WINGDIAPI extern\n #endif\n #define GLFW_WINGDIAPI_DEFINED\n#endif /* WINGDIAPI */\n\n/* Some files also need CALLBACK defined */\n#if !defined(CALLBACK) && defined(_WIN32)\n #if defined(_MSC_VER)\n /* Microsoft Visual C++ */\n #if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)\n #define CALLBACK __stdcall\n #else\n #define CALLBACK\n #endif\n #else\n /* Other Windows compilers */\n #define CALLBACK __stdcall\n #endif\n #define GLFW_CALLBACK_DEFINED\n#endif /* CALLBACK */\n\n/* Most GL/glu.h variants on Windows need wchar_t\n * OpenGL/gl.h blocks the definition of ptrdiff_t by glext.h on OS X */\n#if !defined(GLFW_INCLUDE_NONE)\n #include \n#endif\n\n/* Include the chosen client API headers.\n */\n#if defined(__APPLE_CC__)\n #if defined(GLFW_INCLUDE_GLCOREARB)\n #include \n #elif !defined(GLFW_INCLUDE_NONE)\n #define GL_GLEXT_LEGACY\n #include \n #endif\n #if defined(GLFW_INCLUDE_GLU)\n #include \n #endif\n#else\n #if defined(GLFW_INCLUDE_GLCOREARB)\n #include \n #elif defined(GLFW_INCLUDE_ES1)\n #include \n #elif defined(GLFW_INCLUDE_ES2)\n #include \n #elif defined(GLFW_INCLUDE_ES3)\n #include \n #elif !defined(GLFW_INCLUDE_NONE)\n #include \n #endif\n #if defined(GLFW_INCLUDE_GLU)\n #include \n #endif\n#endif\n\n#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)\n /* GLFW_DLL is defined by users of GLFW when compiling programs that will link\n * to the DLL version of the GLFW library. _GLFW_BUILD_DLL is defined by the\n * GLFW configuration header when compiling the DLL version of the library.\n */\n #error \"You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined\"\n#endif\n\n#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)\n\n /* We are building a Win32 DLL */\n #define GLFWAPI __declspec(dllexport)\n\n#elif defined(_WIN32) && defined(GLFW_DLL)\n\n /* We are calling a Win32 DLL */\n #if defined(__LCC__)\n #define GLFWAPI extern\n #else\n #define GLFWAPI __declspec(dllimport)\n #endif\n\n#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)\n\n #define GLFWAPI __attribute__((visibility(\"default\")))\n\n#else\n\n /* We are either building/calling a static lib or we are non-win32 */\n #define GLFWAPI\n\n#endif\n\n/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */\n\n\n/*************************************************************************\n * GLFW API tokens\n *************************************************************************/\n\n/*! @name GLFW version macros\n * @{ */\n/*! @brief The major version number of the GLFW library.\n *\n * This is incremented when the API is changed in non-compatible ways.\n * @ingroup init\n */\n#define GLFW_VERSION_MAJOR 3\n/*! @brief The minor version number of the GLFW library.\n *\n * This is incremented when features are added to the API but it remains\n * backward-compatible.\n * @ingroup init\n */\n#define GLFW_VERSION_MINOR 0\n/*! @brief The revision number of the GLFW library.\n *\n * This is incremented when a bug fix release is made that does not contain any\n * API changes.\n * @ingroup init\n */\n#define GLFW_VERSION_REVISION 4\n/*! @} */\n\n/*! @name Key and button actions\n * @{ */\n/*! @brief The key or button was released.\n * @ingroup input\n */\n#define GLFW_RELEASE 0\n/*! @brief The key or button was pressed.\n * @ingroup input\n */\n#define GLFW_PRESS 1\n/*! @brief The key was held down until it repeated.\n * @ingroup input\n */\n#define GLFW_REPEAT 2\n/*! @} */\n\n/*! @defgroup keys Keyboard keys\n *\n * These key codes are inspired by the *USB HID Usage Tables v1.12* (p. 53-60),\n * but re-arranged to map to 7-bit ASCII for printable keys (function keys are\n * put in the 256+ range).\n *\n * The naming of the key codes follow these rules:\n * - The US keyboard layout is used\n * - Names of printable alpha-numeric characters are used (e.g. \"A\", \"R\",\n * \"3\", etc.)\n * - For non-alphanumeric characters, Unicode:ish names are used (e.g.\n * \"COMMA\", \"LEFT_SQUARE_BRACKET\", etc.). Note that some names do not\n * correspond to the Unicode standard (usually for brevity)\n * - Keys that lack a clear US mapping are named \"WORLD_x\"\n * - For non-printable keys, custom names are used (e.g. \"F4\",\n * \"BACKSPACE\", etc.)\n *\n * @ingroup input\n * @{\n */\n\n/* The unknown key */\n#define GLFW_KEY_UNKNOWN -1\n\n/* Printable keys */\n#define GLFW_KEY_SPACE 32\n#define GLFW_KEY_APOSTROPHE 39 /* ' */\n#define GLFW_KEY_COMMA 44 /* , */\n#define GLFW_KEY_MINUS 45 /* - */\n#define GLFW_KEY_PERIOD 46 /* . */\n#define GLFW_KEY_SLASH 47 /* / */\n#define GLFW_KEY_0 48\n#define GLFW_KEY_1 49\n#define GLFW_KEY_2 50\n#define GLFW_KEY_3 51\n#define GLFW_KEY_4 52\n#define GLFW_KEY_5 53\n#define GLFW_KEY_6 54\n#define GLFW_KEY_7 55\n#define GLFW_KEY_8 56\n#define GLFW_KEY_9 57\n#define GLFW_KEY_SEMICOLON 59 /* ; */\n#define GLFW_KEY_EQUAL 61 /* = */\n#define GLFW_KEY_A 65\n#define GLFW_KEY_B 66\n#define GLFW_KEY_C 67\n#define GLFW_KEY_D 68\n#define GLFW_KEY_E 69\n#define GLFW_KEY_F 70\n#define GLFW_KEY_G 71\n#define GLFW_KEY_H 72\n#define GLFW_KEY_I 73\n#define GLFW_KEY_J 74\n#define GLFW_KEY_K 75\n#define GLFW_KEY_L 76\n#define GLFW_KEY_M 77\n#define GLFW_KEY_N 78\n#define GLFW_KEY_O 79\n#define GLFW_KEY_P 80\n#define GLFW_KEY_Q 81\n#define GLFW_KEY_R 82\n#define GLFW_KEY_S 83\n#define GLFW_KEY_T 84\n#define GLFW_KEY_U 85\n#define GLFW_KEY_V 86\n#define GLFW_KEY_W 87\n#define GLFW_KEY_X 88\n#define GLFW_KEY_Y 89\n#define GLFW_KEY_Z 90\n#define GLFW_KEY_LEFT_BRACKET 91 /* [ */\n#define GLFW_KEY_BACKSLASH 92 /* \\ */\n#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */\n#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */\n#define GLFW_KEY_WORLD_1 161 /* non-US #1 */\n#define GLFW_KEY_WORLD_2 162 /* non-US #2 */\n\n/* Function keys */\n#define GLFW_KEY_ESCAPE 256\n#define GLFW_KEY_ENTER 257\n#define GLFW_KEY_TAB 258\n#define GLFW_KEY_BACKSPACE 259\n#define GLFW_KEY_INSERT 260\n#define GLFW_KEY_DELETE 261\n#define GLFW_KEY_RIGHT 262\n#define GLFW_KEY_LEFT 263\n#define GLFW_KEY_DOWN 264\n#define GLFW_KEY_UP 265\n#define GLFW_KEY_PAGE_UP 266\n#define GLFW_KEY_PAGE_DOWN 267\n#define GLFW_KEY_HOME 268\n#define GLFW_KEY_END 269\n#define GLFW_KEY_CAPS_LOCK 280\n#define GLFW_KEY_SCROLL_LOCK 281\n#define GLFW_KEY_NUM_LOCK 282\n#define GLFW_KEY_PRINT_SCREEN 283\n#define GLFW_KEY_PAUSE 284\n#define GLFW_KEY_F1 290\n#define GLFW_KEY_F2 291\n#define GLFW_KEY_F3 292\n#define GLFW_KEY_F4 293\n#define GLFW_KEY_F5 294\n#define GLFW_KEY_F6 295\n#define GLFW_KEY_F7 296\n#define GLFW_KEY_F8 297\n#define GLFW_KEY_F9 298\n#define GLFW_KEY_F10 299\n#define GLFW_KEY_F11 300\n#define GLFW_KEY_F12 301\n#define GLFW_KEY_F13 302\n#define GLFW_KEY_F14 303\n#define GLFW_KEY_F15 304\n#define GLFW_KEY_F16 305\n#define GLFW_KEY_F17 306\n#define GLFW_KEY_F18 307\n#define GLFW_KEY_F19 308\n#define GLFW_KEY_F20 309\n#define GLFW_KEY_F21 310\n#define GLFW_KEY_F22 311\n#define GLFW_KEY_F23 312\n#define GLFW_KEY_F24 313\n#define GLFW_KEY_F25 314\n#define GLFW_KEY_KP_0 320\n#define GLFW_KEY_KP_1 321\n#define GLFW_KEY_KP_2 322\n#define GLFW_KEY_KP_3 323\n#define GLFW_KEY_KP_4 324\n#define GLFW_KEY_KP_5 325\n#define GLFW_KEY_KP_6 326\n#define GLFW_KEY_KP_7 327\n#define GLFW_KEY_KP_8 328\n#define GLFW_KEY_KP_9 329\n#define GLFW_KEY_KP_DECIMAL 330\n#define GLFW_KEY_KP_DIVIDE 331\n#define GLFW_KEY_KP_MULTIPLY 332\n#define GLFW_KEY_KP_SUBTRACT 333\n#define GLFW_KEY_KP_ADD 334\n#define GLFW_KEY_KP_ENTER 335\n#define GLFW_KEY_KP_EQUAL 336\n#define GLFW_KEY_LEFT_SHIFT 340\n#define GLFW_KEY_LEFT_CONTROL 341\n#define GLFW_KEY_LEFT_ALT 342\n#define GLFW_KEY_LEFT_SUPER 343\n#define GLFW_KEY_RIGHT_SHIFT 344\n#define GLFW_KEY_RIGHT_CONTROL 345\n#define GLFW_KEY_RIGHT_ALT 346\n#define GLFW_KEY_RIGHT_SUPER 347\n#define GLFW_KEY_MENU 348\n#define GLFW_KEY_LAST GLFW_KEY_MENU\n\n/*! @} */\n\n/*! @defgroup mods Modifier key flags\n * @ingroup input\n * @{ */\n\n/*! @brief If this bit is set one or more Shift keys were held down.\n */\n#define GLFW_MOD_SHIFT 0x0001\n/*! @brief If this bit is set one or more Control keys were held down.\n */\n#define GLFW_MOD_CONTROL 0x0002\n/*! @brief If this bit is set one or more Alt keys were held down.\n */\n#define GLFW_MOD_ALT 0x0004\n/*! @brief If this bit is set one or more Super keys were held down.\n */\n#define GLFW_MOD_SUPER 0x0008\n\n/*! @} */\n\n/*! @defgroup buttons Mouse buttons\n * @ingroup input\n * @{ */\n#define GLFW_MOUSE_BUTTON_1 0\n#define GLFW_MOUSE_BUTTON_2 1\n#define GLFW_MOUSE_BUTTON_3 2\n#define GLFW_MOUSE_BUTTON_4 3\n#define GLFW_MOUSE_BUTTON_5 4\n#define GLFW_MOUSE_BUTTON_6 5\n#define GLFW_MOUSE_BUTTON_7 6\n#define GLFW_MOUSE_BUTTON_8 7\n#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8\n#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1\n#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2\n#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3\n/*! @} */\n\n/*! @defgroup joysticks Joysticks\n * @ingroup input\n * @{ */\n#define GLFW_JOYSTICK_1 0\n#define GLFW_JOYSTICK_2 1\n#define GLFW_JOYSTICK_3 2\n#define GLFW_JOYSTICK_4 3\n#define GLFW_JOYSTICK_5 4\n#define GLFW_JOYSTICK_6 5\n#define GLFW_JOYSTICK_7 6\n#define GLFW_JOYSTICK_8 7\n#define GLFW_JOYSTICK_9 8\n#define GLFW_JOYSTICK_10 9\n#define GLFW_JOYSTICK_11 10\n#define GLFW_JOYSTICK_12 11\n#define GLFW_JOYSTICK_13 12\n#define GLFW_JOYSTICK_14 13\n#define GLFW_JOYSTICK_15 14\n#define GLFW_JOYSTICK_16 15\n#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16\n/*! @} */\n\n/*! @defgroup errors Error codes\n * @ingroup error\n * @{ */\n/*! @brief GLFW has not been initialized.\n */\n#define GLFW_NOT_INITIALIZED 0x00010001\n/*! @brief No context is current for this thread.\n */\n#define GLFW_NO_CURRENT_CONTEXT 0x00010002\n/*! @brief One of the enum parameters for the function was given an invalid\n * enum.\n */\n#define GLFW_INVALID_ENUM 0x00010003\n/*! @brief One of the parameters for the function was given an invalid value.\n */\n#define GLFW_INVALID_VALUE 0x00010004\n/*! @brief A memory allocation failed.\n */\n#define GLFW_OUT_OF_MEMORY 0x00010005\n/*! @brief GLFW could not find support for the requested client API on the\n * system.\n */\n#define GLFW_API_UNAVAILABLE 0x00010006\n/*! @brief The requested client API version is not available.\n */\n#define GLFW_VERSION_UNAVAILABLE 0x00010007\n/*! @brief A platform-specific error occurred that does not match any of the\n * more specific categories.\n */\n#define GLFW_PLATFORM_ERROR 0x00010008\n/*! @brief The clipboard did not contain data in the requested format.\n */\n#define GLFW_FORMAT_UNAVAILABLE 0x00010009\n/*! @} */\n\n#define GLFW_FOCUSED 0x00020001\n#define GLFW_ICONIFIED 0x00020002\n#define GLFW_RESIZABLE 0x00020003\n#define GLFW_VISIBLE 0x00020004\n#define GLFW_DECORATED 0x00020005\n\n#define GLFW_RED_BITS 0x00021001\n#define GLFW_GREEN_BITS 0x00021002\n#define GLFW_BLUE_BITS 0x00021003\n#define GLFW_ALPHA_BITS 0x00021004\n#define GLFW_DEPTH_BITS 0x00021005\n#define GLFW_STENCIL_BITS 0x00021006\n#define GLFW_ACCUM_RED_BITS 0x00021007\n#define GLFW_ACCUM_GREEN_BITS 0x00021008\n#define GLFW_ACCUM_BLUE_BITS 0x00021009\n#define GLFW_ACCUM_ALPHA_BITS 0x0002100A\n#define GLFW_AUX_BUFFERS 0x0002100B\n#define GLFW_STEREO 0x0002100C\n#define GLFW_SAMPLES 0x0002100D\n#define GLFW_SRGB_CAPABLE 0x0002100E\n#define GLFW_REFRESH_RATE 0x0002100F\n\n#define GLFW_CLIENT_API 0x00022001\n#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002\n#define GLFW_CONTEXT_VERSION_MINOR 0x00022003\n#define GLFW_CONTEXT_REVISION 0x00022004\n#define GLFW_CONTEXT_ROBUSTNESS 0x00022005\n#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006\n#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007\n#define GLFW_OPENGL_PROFILE 0x00022008\n\n#define GLFW_OPENGL_API 0x00030001\n#define GLFW_OPENGL_ES_API 0x00030002\n\n#define GLFW_NO_ROBUSTNESS 0\n#define GLFW_NO_RESET_NOTIFICATION 0x00031001\n#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002\n\n#define GLFW_OPENGL_ANY_PROFILE 0\n#define GLFW_OPENGL_CORE_PROFILE 0x00032001\n#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002\n\n#define GLFW_CURSOR 0x00033001\n#define GLFW_STICKY_KEYS 0x00033002\n#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003\n\n#define GLFW_CURSOR_NORMAL 0x00034001\n#define GLFW_CURSOR_HIDDEN 0x00034002\n#define GLFW_CURSOR_DISABLED 0x00034003\n\n#define GLFW_CONNECTED 0x00040001\n#define GLFW_DISCONNECTED 0x00040002\n\n\n/*************************************************************************\n * GLFW API types\n *************************************************************************/\n\n/*! @brief Client API function pointer type.\n *\n * Generic function pointer used for returning client API function pointers\n * without forcing a cast from a regular pointer.\n *\n * @ingroup context\n */\ntypedef void (*GLFWglproc)(void);\n\n/*! @brief Opaque monitor object.\n *\n * Opaque monitor object.\n *\n * @ingroup monitor\n */\ntypedef struct GLFWmonitor GLFWmonitor;\n\n/*! @brief Opaque window object.\n *\n * Opaque window object.\n *\n * @ingroup window\n */\ntypedef struct GLFWwindow GLFWwindow;\n\n/*! @brief The function signature for error callbacks.\n *\n * This is the function signature for error callback functions.\n *\n * @param[in] error An [error code](@ref errors).\n * @param[in] description A UTF-8 encoded string describing the error.\n *\n * @sa glfwSetErrorCallback\n *\n * @ingroup error\n */\ntypedef void (* GLFWerrorfun)(int,const char*);\n\n/*! @brief The function signature for window position callbacks.\n *\n * This is the function signature for window position callback functions.\n *\n * @param[in] window The window that the user moved.\n * @param[in] xpos The new x-coordinate, in screen coordinates, of the\n * upper-left corner of the client area of the window.\n * @param[in] ypos The new y-coordinate, in screen coordinates, of the\n * upper-left corner of the client area of the window.\n *\n * @sa glfwSetWindowPosCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);\n\n/*! @brief The function signature for window resize callbacks.\n *\n * This is the function signature for window size callback functions.\n *\n * @param[in] window The window that the user resized.\n * @param[in] width The new width, in screen coordinates, of the window.\n * @param[in] height The new height, in screen coordinates, of the window.\n *\n * @sa glfwSetWindowSizeCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);\n\n/*! @brief The function signature for window close callbacks.\n *\n * This is the function signature for window close callback functions.\n *\n * @param[in] window The window that the user attempted to close.\n *\n * @sa glfwSetWindowCloseCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowclosefun)(GLFWwindow*);\n\n/*! @brief The function signature for window content refresh callbacks.\n *\n * This is the function signature for window refresh callback functions.\n *\n * @param[in] window The window whose content needs to be refreshed.\n *\n * @sa glfwSetWindowRefreshCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowrefreshfun)(GLFWwindow*);\n\n/*! @brief The function signature for window focus/defocus callbacks.\n *\n * This is the function signature for window focus callback functions.\n *\n * @param[in] window The window that was focused or defocused.\n * @param[in] focused `GL_TRUE` if the window was focused, or `GL_FALSE` if\n * it was defocused.\n *\n * @sa glfwSetWindowFocusCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);\n\n/*! @brief The function signature for window iconify/restore callbacks.\n *\n * This is the function signature for window iconify/restore callback\n * functions.\n *\n * @param[in] window The window that was iconified or restored.\n * @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE`\n * if it was restored.\n *\n * @sa glfwSetWindowIconifyCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);\n\n/*! @brief The function signature for framebuffer resize callbacks.\n *\n * This is the function signature for framebuffer resize callback\n * functions.\n *\n * @param[in] window The window whose framebuffer was resized.\n * @param[in] width The new width, in pixels, of the framebuffer.\n * @param[in] height The new height, in pixels, of the framebuffer.\n *\n * @sa glfwSetFramebufferSizeCallback\n *\n * @ingroup window\n */\ntypedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);\n\n/*! @brief The function signature for mouse button callbacks.\n *\n * This is the function signature for mouse button callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] button The [mouse button](@ref buttons) that was pressed or\n * released.\n * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.\n * @param[in] mods Bit field describing which [modifier keys](@ref mods) were\n * held down.\n *\n * @sa glfwSetMouseButtonCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);\n\n/*! @brief The function signature for cursor position callbacks.\n *\n * This is the function signature for cursor position callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor.\n * @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor.\n *\n * @sa glfwSetCursorPosCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);\n\n/*! @brief The function signature for cursor enter/leave callbacks.\n *\n * This is the function signature for cursor enter/leave callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] entered `GL_TRUE` if the cursor entered the window's client\n * area, or `GL_FALSE` if it left it.\n *\n * @sa glfwSetCursorEnterCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWcursorenterfun)(GLFWwindow*,int);\n\n/*! @brief The function signature for scroll callbacks.\n *\n * This is the function signature for scroll callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] xoffset The scroll offset along the x-axis.\n * @param[in] yoffset The scroll offset along the y-axis.\n *\n * @sa glfwSetScrollCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWscrollfun)(GLFWwindow*,double,double);\n\n/*! @brief The function signature for keyboard key callbacks.\n *\n * This is the function signature for keyboard key callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] key The [keyboard key](@ref keys) that was pressed or released.\n * @param[in] scancode The system-specific scancode of the key.\n * @param[in] action @ref GLFW_PRESS, @ref GLFW_RELEASE or @ref GLFW_REPEAT.\n * @param[in] mods Bit field describing which [modifier keys](@ref mods) were\n * held down.\n *\n * @sa glfwSetKeyCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);\n\n/*! @brief The function signature for Unicode character callbacks.\n *\n * This is the function signature for Unicode character callback functions.\n *\n * @param[in] window The window that received the event.\n * @param[in] codepoint The Unicode code point of the character.\n *\n * @sa glfwSetCharCallback\n *\n * @ingroup input\n */\ntypedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);\n\n/*! @brief The function signature for monitor configuration callbacks.\n *\n * This is the function signature for monitor configuration callback functions.\n *\n * @param[in] monitor The monitor that was connected or disconnected.\n * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.\n *\n * @sa glfwSetMonitorCallback\n *\n * @ingroup monitor\n */\ntypedef void (* GLFWmonitorfun)(GLFWmonitor*,int);\n\n/*! @brief Video mode type.\n *\n * This describes a single video mode.\n *\n * @ingroup monitor\n */\ntypedef struct GLFWvidmode\n{\n /*! The width, in screen coordinates, of the video mode.\n */\n int width;\n /*! The height, in screen coordinates, of the video mode.\n */\n int height;\n /*! The bit depth of the red channel of the video mode.\n */\n int redBits;\n /*! The bit depth of the green channel of the video mode.\n */\n int greenBits;\n /*! The bit depth of the blue channel of the video mode.\n */\n int blueBits;\n /*! The refresh rate, in Hz, of the video mode.\n */\n int refreshRate;\n} GLFWvidmode;\n\n/*! @brief Gamma ramp.\n *\n * This describes the gamma ramp for a monitor.\n *\n * @sa glfwGetGammaRamp glfwSetGammaRamp\n *\n * @ingroup monitor\n */\ntypedef struct GLFWgammaramp\n{\n /*! An array of value describing the response of the red channel.\n */\n unsigned short* red;\n /*! An array of value describing the response of the green channel.\n */\n unsigned short* green;\n /*! An array of value describing the response of the blue channel.\n */\n unsigned short* blue;\n /*! The number of elements in each array.\n */\n unsigned int size;\n} GLFWgammaramp;\n\n\n/*************************************************************************\n * GLFW API functions\n *************************************************************************/\n\n/*! @brief Initializes the GLFW library.\n *\n * This function initializes the GLFW library. Before most GLFW functions can\n * be used, GLFW must be initialized, and before a program terminates GLFW\n * should be terminated in order to free any resources allocated during or\n * after initialization.\n *\n * If this function fails, it calls @ref glfwTerminate before returning. If it\n * succeeds, you should call @ref glfwTerminate before the program exits.\n *\n * Additional calls to this function after successful initialization but before\n * termination will succeed but will do nothing.\n *\n * @return `GL_TRUE` if successful, or `GL_FALSE` if an error occurred.\n *\n * @par New in GLFW 3\n * This function no longer registers @ref glfwTerminate with `atexit`.\n *\n * @note This function may only be called from the main thread.\n *\n * @note **OS X:** This function will change the current directory of the\n * application to the `Contents/Resources` subdirectory of the application's\n * bundle, if present.\n *\n * @sa glfwTerminate\n *\n * @ingroup init\n */\nGLFWAPI int glfwInit(void);\n\n/*! @brief Terminates the GLFW library.\n *\n * This function destroys all remaining windows, frees any allocated resources\n * and sets the library to an uninitialized state. Once this is called, you\n * must again call @ref glfwInit successfully before you will be able to use\n * most GLFW functions.\n *\n * If GLFW has been successfully initialized, this function should be called\n * before the program exits. If initialization fails, there is no need to call\n * this function, as it is called by @ref glfwInit before it returns failure.\n *\n * @remarks This function may be called before @ref glfwInit.\n *\n * @note This function may only be called from the main thread.\n *\n * @warning No window's context may be current on another thread when this\n * function is called.\n *\n * @sa glfwInit\n *\n * @ingroup init\n */\nGLFWAPI void glfwTerminate(void);\n\n/*! @brief Retrieves the version of the GLFW library.\n *\n * This function retrieves the major, minor and revision numbers of the GLFW\n * library. It is intended for when you are using GLFW as a shared library and\n * want to ensure that you are using the minimum required version.\n *\n * @param[out] major Where to store the major version number, or `NULL`.\n * @param[out] minor Where to store the minor version number, or `NULL`.\n * @param[out] rev Where to store the revision number, or `NULL`.\n *\n * @remarks This function may be called before @ref glfwInit.\n *\n * @remarks This function may be called from any thread.\n *\n * @sa glfwGetVersionString\n *\n * @ingroup init\n */\nGLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);\n\n/*! @brief Returns a string describing the compile-time configuration.\n *\n * This function returns a static string generated at compile-time according to\n * which configuration macros were defined. This is intended for use when\n * submitting bug reports, to allow developers to see which code paths are\n * enabled in a binary.\n *\n * The format of the string is as follows:\n * - The version of GLFW\n * - The name of the window system API\n * - The name of the context creation API\n * - Any additional options or APIs\n *\n * For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL\n * back ends, the version string may look something like this:\n *\n * 3.0.0 Win32 WGL MinGW\n *\n * @return The GLFW version string.\n *\n * @remarks This function may be called before @ref glfwInit.\n *\n * @remarks This function may be called from any thread.\n *\n * @sa glfwGetVersion\n *\n * @ingroup init\n */\nGLFWAPI const char* glfwGetVersionString(void);\n\n/*! @brief Sets the error callback.\n *\n * This function sets the error callback, which is called with an error code\n * and a human-readable description each time a GLFW error occurs.\n *\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @remarks This function may be called before @ref glfwInit.\n *\n * @note The error callback is called by the thread where the error was\n * generated. If you are using GLFW from multiple threads, your error callback\n * needs to be written accordingly.\n *\n * @note Because the description string provided to the callback may have been\n * generated specifically for that error, it is not guaranteed to be valid\n * after the callback has returned. If you wish to use it after that, you need\n * to make your own copy of it before returning.\n *\n * @ingroup error\n */\nGLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);\n\n/*! @brief Returns the currently connected monitors.\n *\n * This function returns an array of handles for all currently connected\n * monitors.\n *\n * @param[out] count Where to store the size of the returned array. This is\n * set to zero if an error occurred.\n * @return An array of monitor handles, or `NULL` if an error occurred.\n *\n * @note The returned array is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned array is valid only until the monitor configuration\n * changes. See @ref glfwSetMonitorCallback to receive notifications of\n * configuration changes.\n *\n * @sa glfwGetPrimaryMonitor\n *\n * @ingroup monitor\n */\nGLFWAPI GLFWmonitor** glfwGetMonitors(int* count);\n\n/*! @brief Returns the primary monitor.\n *\n * This function returns the primary monitor. This is usually the monitor\n * where elements like the Windows task bar or the OS X menu bar is located.\n *\n * @return The primary monitor, or `NULL` if an error occurred.\n *\n * @sa glfwGetMonitors\n *\n * @ingroup monitor\n */\nGLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);\n\n/*! @brief Returns the position of the monitor's viewport on the virtual screen.\n *\n * This function returns the position, in screen coordinates, of the upper-left\n * corner of the specified monitor.\n *\n * @param[in] monitor The monitor to query.\n * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.\n * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.\n *\n * @ingroup monitor\n */\nGLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);\n\n/*! @brief Returns the physical size of the monitor.\n *\n * This function returns the size, in millimetres, of the display area of the\n * specified monitor.\n *\n * @param[in] monitor The monitor to query.\n * @param[out] width Where to store the width, in mm, of the monitor's display\n * area, or `NULL`.\n * @param[out] height Where to store the height, in mm, of the monitor's\n * display area, or `NULL`.\n *\n * @note Some operating systems do not provide accurate information, either\n * because the monitor's EDID data is incorrect, or because the driver does not\n * report it accurately.\n *\n * @ingroup monitor\n */\nGLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height);\n\n/*! @brief Returns the name of the specified monitor.\n *\n * This function returns a human-readable name, encoded as UTF-8, of the\n * specified monitor.\n *\n * @param[in] monitor The monitor to query.\n * @return The UTF-8 encoded name of the monitor, or `NULL` if an error\n * occurred.\n *\n * @note The returned string is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @ingroup monitor\n */\nGLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);\n\n/*! @brief Sets the monitor configuration callback.\n *\n * This function sets the monitor configuration callback, or removes the\n * currently set callback. This is called when a monitor is connected to or\n * disconnected from the system.\n *\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @bug **X11:** This callback is not yet called on monitor configuration\n * changes.\n *\n * @ingroup monitor\n */\nGLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);\n\n/*! @brief Returns the available video modes for the specified monitor.\n *\n * This function returns an array of all video modes supported by the specified\n * monitor. The returned array is sorted in ascending order, first by color\n * bit depth (the sum of all channel depths) and then by resolution area (the\n * product of width and height).\n *\n * @param[in] monitor The monitor to query.\n * @param[out] count Where to store the number of video modes in the returned\n * array. This is set to zero if an error occurred.\n * @return An array of video modes, or `NULL` if an error occurred.\n *\n * @note The returned array is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned array is valid only until this function is called again\n * for the specified monitor.\n *\n * @sa glfwGetVideoMode\n *\n * @ingroup monitor\n */\nGLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);\n\n/*! @brief Returns the current mode of the specified monitor.\n *\n * This function returns the current video mode of the specified monitor. If\n * you are using a full screen window, the return value will therefore depend\n * on whether it is focused.\n *\n * @param[in] monitor The monitor to query.\n * @return The current mode of the monitor, or `NULL` if an error occurred.\n *\n * @note The returned struct is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @sa glfwGetVideoModes\n *\n * @ingroup monitor\n */\nGLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);\n\n/*! @brief Generates a gamma ramp and sets it for the specified monitor.\n *\n * This function generates a 256-element gamma ramp from the specified exponent\n * and then calls @ref glfwSetGammaRamp with it.\n *\n * @param[in] monitor The monitor whose gamma ramp to set.\n * @param[in] gamma The desired exponent.\n *\n * @ingroup monitor\n */\nGLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);\n\n/*! @brief Retrieves the current gamma ramp for the specified monitor.\n *\n * This function retrieves the current gamma ramp of the specified monitor.\n *\n * @param[in] monitor The monitor to query.\n * @return The current gamma ramp, or `NULL` if an error occurred.\n *\n * @note The value arrays of the returned ramp are allocated and freed by GLFW.\n * You should not free them yourself.\n *\n * @ingroup monitor\n */\nGLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);\n\n/*! @brief Sets the current gamma ramp for the specified monitor.\n *\n * This function sets the current gamma ramp for the specified monitor.\n *\n * @param[in] monitor The monitor whose gamma ramp to set.\n * @param[in] ramp The gamma ramp to use.\n *\n * @note Gamma ramp sizes other than 256 are not supported by all hardware.\n *\n * @ingroup monitor\n */\nGLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);\n\n/*! @brief Resets all window hints to their default values.\n *\n * This function resets all window hints to their\n * [default values](@ref window_hints_values).\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwWindowHint\n *\n * @ingroup window\n */\nGLFWAPI void glfwDefaultWindowHints(void);\n\n/*! @brief Sets the specified window hint to the desired value.\n *\n * This function sets hints for the next call to @ref glfwCreateWindow. The\n * hints, once set, retain their values until changed by a call to @ref\n * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is\n * terminated with @ref glfwTerminate.\n *\n * @param[in] target The [window hint](@ref window_hints) to set.\n * @param[in] hint The new value of the window hint.\n *\n * @par New in GLFW 3\n * Hints are no longer reset to their default values on window creation. To\n * set default hint values, use @ref glfwDefaultWindowHints.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwDefaultWindowHints\n *\n * @ingroup window\n */\nGLFWAPI void glfwWindowHint(int target, int hint);\n\n/*! @brief Creates a window and its associated context.\n *\n * This function creates a window and its associated context. Most of the\n * options controlling how the window and its context should be created are\n * specified through @ref glfwWindowHint.\n *\n * Successful creation does not change which context is current. Before you\n * can use the newly created context, you need to make it current using @ref\n * glfwMakeContextCurrent.\n *\n * Note that the created window and context may differ from what you requested,\n * as not all parameters and hints are\n * [hard constraints](@ref window_hints_hard). This includes the size of the\n * window, especially for full screen windows. To retrieve the actual\n * attributes of the created window and context, use queries like @ref\n * glfwGetWindowAttrib and @ref glfwGetWindowSize.\n *\n * To create a full screen window, you need to specify the monitor to use. If\n * no monitor is specified, windowed mode will be used. Unless you have a way\n * for the user to choose a specific monitor, it is recommended that you pick\n * the primary monitor. For more information on how to retrieve monitors, see\n * @ref monitor_monitors.\n *\n * To create the window at a specific position, make it initially invisible\n * using the `GLFW_VISIBLE` window hint, set its position and then show it.\n *\n * If a full screen window is active, the screensaver is prohibited from\n * starting.\n *\n * @param[in] width The desired width, in screen coordinates, of the window.\n * This must be greater than zero.\n * @param[in] height The desired height, in screen coordinates, of the window.\n * This must be greater than zero.\n * @param[in] title The initial, UTF-8 encoded window title.\n * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use\n * windowed mode.\n * @param[in] share The window whose context to share resources with, or `NULL`\n * to not share resources.\n * @return The handle of the created window, or `NULL` if an error occurred.\n *\n * @remarks **Windows:** Window creation will fail if the Microsoft GDI\n * software OpenGL implementation is the only one available.\n *\n * @remarks **Windows:** If the executable has an icon resource named\n * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is\n * present, the `IDI_WINLOGO` icon will be used instead.\n *\n * @remarks **OS X:** The GLFW window has no icon, as it is not a document\n * window, but the dock icon will be the same as the application bundle's icon.\n * Also, the first time a window is opened the menu bar is populated with\n * common commands like Hide, Quit and About. The (minimal) about dialog uses\n * information from the application's bundle. For more information on bundles,\n * see the Bundle Programming Guide provided by Apple.\n *\n * @remarks **X11:** There is no mechanism for setting the window icon yet.\n *\n * @remarks The swap interval is not set during window creation, but is left at\n * the default value for that platform. For more information, see @ref\n * glfwSwapInterval.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwDestroyWindow\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);\n\n/*! @brief Destroys the specified window and its context.\n *\n * This function destroys the specified window and its context. On calling\n * this function, no further callbacks will be called for that window.\n *\n * @param[in] window The window to destroy.\n *\n * @note This function may only be called from the main thread.\n *\n * @note This function may not be called from a callback.\n *\n * @note If the window's context is current on the main thread, it is\n * detached before being destroyed.\n *\n * @warning The window's context must not be current on any other thread.\n *\n * @sa glfwCreateWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwDestroyWindow(GLFWwindow* window);\n\n/*! @brief Checks the close flag of the specified window.\n *\n * This function returns the value of the close flag of the specified window.\n *\n * @param[in] window The window to query.\n * @return The value of the close flag.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @ingroup window\n */\nGLFWAPI int glfwWindowShouldClose(GLFWwindow* window);\n\n/*! @brief Sets the close flag of the specified window.\n *\n * This function sets the value of the close flag of the specified window.\n * This can be used to override the user's attempt to close the window, or\n * to signal that it should be closed.\n *\n * @param[in] window The window whose flag to change.\n * @param[in] value The new value.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);\n\n/*! @brief Sets the title of the specified window.\n *\n * This function sets the window title, encoded as UTF-8, of the specified\n * window.\n *\n * @param[in] window The window whose title to change.\n * @param[in] title The UTF-8 encoded window title.\n *\n * @note This function may only be called from the main thread.\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);\n\n/*! @brief Retrieves the position of the client area of the specified window.\n *\n * This function retrieves the position, in screen coordinates, of the\n * upper-left corner of the client area of the specified window.\n *\n * @param[in] window The window to query.\n * @param[out] xpos Where to store the x-coordinate of the upper-left corner of\n * the client area, or `NULL`.\n * @param[out] ypos Where to store the y-coordinate of the upper-left corner of\n * the client area, or `NULL`.\n *\n * @sa glfwSetWindowPos\n *\n * @ingroup window\n */\nGLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);\n\n/*! @brief Sets the position of the client area of the specified window.\n *\n * This function sets the position, in screen coordinates, of the upper-left\n * corner of the client area of the window.\n *\n * If the specified window is a full screen window, this function does nothing.\n *\n * If you wish to set an initial window position you should create a hidden\n * window (using @ref glfwWindowHint and `GLFW_VISIBLE`), set its position and\n * then show it.\n *\n * @param[in] window The window to query.\n * @param[in] xpos The x-coordinate of the upper-left corner of the client area.\n * @param[in] ypos The y-coordinate of the upper-left corner of the client area.\n *\n * @note It is very rarely a good idea to move an already visible window, as it\n * will confuse and annoy the user.\n *\n * @note This function may only be called from the main thread.\n *\n * @note The window manager may put limits on what positions are allowed.\n *\n * @sa glfwGetWindowPos\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);\n\n/*! @brief Retrieves the size of the client area of the specified window.\n *\n * This function retrieves the size, in screen coordinates, of the client area\n * of the specified window. If you wish to retrieve the size of the\n * framebuffer in pixels, see @ref glfwGetFramebufferSize.\n *\n * @param[in] window The window whose size to retrieve.\n * @param[out] width Where to store the width, in screen coordinates, of the\n * client area, or `NULL`.\n * @param[out] height Where to store the height, in screen coordinates, of the\n * client area, or `NULL`.\n *\n * @sa glfwSetWindowSize\n *\n * @ingroup window\n */\nGLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);\n\n/*! @brief Sets the size of the client area of the specified window.\n *\n * This function sets the size, in screen coordinates, of the client area of\n * the specified window.\n *\n * For full screen windows, this function selects and switches to the resolution\n * closest to the specified size, without affecting the window's context. As\n * the context is unaffected, the bit depths of the framebuffer remain\n * unchanged.\n *\n * @param[in] window The window to resize.\n * @param[in] width The desired width of the specified window.\n * @param[in] height The desired height of the specified window.\n *\n * @note This function may only be called from the main thread.\n *\n * @note The window manager may put limits on what window sizes are allowed.\n *\n * @sa glfwGetWindowSize\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);\n\n/*! @brief Retrieves the size of the framebuffer of the specified window.\n *\n * This function retrieves the size, in pixels, of the framebuffer of the\n * specified window. If you wish to retrieve the size of the window in screen\n * coordinates, see @ref glfwGetWindowSize.\n *\n * @param[in] window The window whose framebuffer to query.\n * @param[out] width Where to store the width, in pixels, of the framebuffer,\n * or `NULL`.\n * @param[out] height Where to store the height, in pixels, of the framebuffer,\n * or `NULL`.\n *\n * @sa glfwSetFramebufferSizeCallback\n *\n * @ingroup window\n */\nGLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);\n\n/*! @brief Iconifies the specified window.\n *\n * This function iconifies/minimizes the specified window, if it was previously\n * restored. If it is a full screen window, the original monitor resolution is\n * restored until the window is restored. If the window is already iconified,\n * this function does nothing.\n *\n * @param[in] window The window to iconify.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwRestoreWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwIconifyWindow(GLFWwindow* window);\n\n/*! @brief Restores the specified window.\n *\n * This function restores the specified window, if it was previously\n * iconified/minimized. If it is a full screen window, the resolution chosen\n * for the window is restored on the selected monitor. If the window is\n * already restored, this function does nothing.\n *\n * @param[in] window The window to restore.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwIconifyWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwRestoreWindow(GLFWwindow* window);\n\n/*! @brief Makes the specified window visible.\n *\n * This function makes the specified window visible, if it was previously\n * hidden. If the window is already visible or is in full screen mode, this\n * function does nothing.\n *\n * @param[in] window The window to make visible.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwHideWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwShowWindow(GLFWwindow* window);\n\n/*! @brief Hides the specified window.\n *\n * This function hides the specified window, if it was previously visible. If\n * the window is already hidden or is in full screen mode, this function does\n * nothing.\n *\n * @param[in] window The window to hide.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwShowWindow\n *\n * @ingroup window\n */\nGLFWAPI void glfwHideWindow(GLFWwindow* window);\n\n/*! @brief Returns the monitor that the window uses for full screen mode.\n *\n * This function returns the handle of the monitor that the specified window is\n * in full screen on.\n *\n * @param[in] window The window to query.\n * @return The monitor, or `NULL` if the window is in windowed mode.\n *\n * @ingroup window\n */\nGLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);\n\n/*! @brief Returns an attribute of the specified window.\n *\n * This function returns an attribute of the specified window. There are many\n * attributes, some related to the window and others to its context.\n *\n * @param[in] window The window to query.\n * @param[in] attrib The [window attribute](@ref window_attribs) whose value to\n * return.\n * @return The value of the attribute, or zero if an error occurred.\n *\n * @ingroup window\n */\nGLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);\n\n/*! @brief Sets the user pointer of the specified window.\n *\n * This function sets the user-defined pointer of the specified window. The\n * current value is retained until the window is destroyed. The initial value\n * is `NULL`.\n *\n * @param[in] window The window whose pointer to set.\n * @param[in] pointer The new value.\n *\n * @sa glfwGetWindowUserPointer\n *\n * @ingroup window\n */\nGLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);\n\n/*! @brief Returns the user pointer of the specified window.\n *\n * This function returns the current value of the user-defined pointer of the\n * specified window. The initial value is `NULL`.\n *\n * @param[in] window The window whose pointer to return.\n *\n * @sa glfwSetWindowUserPointer\n *\n * @ingroup window\n */\nGLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);\n\n/*! @brief Sets the position callback for the specified window.\n *\n * This function sets the position callback of the specified window, which is\n * called when the window is moved. The callback is provided with the screen\n * position of the upper-left corner of the client area of the window.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);\n\n/*! @brief Sets the size callback for the specified window.\n *\n * This function sets the size callback of the specified window, which is\n * called when the window is resized. The callback is provided with the size,\n * in screen coordinates, of the client area of the window.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);\n\n/*! @brief Sets the close callback for the specified window.\n *\n * This function sets the close callback of the specified window, which is\n * called when the user attempts to close the window, for example by clicking\n * the close widget in the title bar.\n *\n * The close flag is set before this callback is called, but you can modify it\n * at any time with @ref glfwSetWindowShouldClose.\n *\n * The close callback is not triggered by @ref glfwDestroyWindow.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @par New in GLFW 3\n * The close callback no longer returns a value.\n *\n * @remarks **OS X:** Selecting Quit from the application menu will\n * trigger the close callback for all windows.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);\n\n/*! @brief Sets the refresh callback for the specified window.\n *\n * This function sets the refresh callback of the specified window, which is\n * called when the client area of the window needs to be redrawn, for example\n * if the window has been exposed after having been covered by another window.\n *\n * On compositing window systems such as Aero, Compiz or Aqua, where the window\n * contents are saved off-screen, this callback may be called only very\n * infrequently or never at all.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @note On compositing window systems such as Aero, Compiz or Aqua, where the\n * window contents are saved off-screen, this callback may be called only very\n * infrequently or never at all.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);\n\n/*! @brief Sets the focus callback for the specified window.\n *\n * This function sets the focus callback of the specified window, which is\n * called when the window gains or loses focus.\n *\n * After the focus callback is called for a window that lost focus, synthetic\n * key and mouse button release events will be generated for all such that had\n * been pressed. For more information, see @ref glfwSetKeyCallback and @ref\n * glfwSetMouseButtonCallback.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);\n\n/*! @brief Sets the iconify callback for the specified window.\n *\n * This function sets the iconification callback of the specified window, which\n * is called when the window is iconified or restored.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);\n\n/*! @brief Sets the framebuffer resize callback for the specified window.\n *\n * This function sets the framebuffer resize callback of the specified window,\n * which is called when the framebuffer of the specified window is resized.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup window\n */\nGLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);\n\n/*! @brief Processes all pending events.\n *\n * This function processes only those events that have already been received\n * and then returns immediately. Processing events will cause the window and\n * input callbacks associated with those events to be called.\n *\n * This function is not required for joystick input to work.\n *\n * @par New in GLFW 3\n * This function is no longer called by @ref glfwSwapBuffers. You need to call\n * it or @ref glfwWaitEvents yourself.\n *\n * @remarks On some platforms, a window move, resize or menu operation will\n * cause event processing to block. This is due to how event processing is\n * designed on those platforms. You can use the\n * [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents\n * of your window when necessary during the operation.\n *\n * @note This function may only be called from the main thread.\n *\n * @note This function may not be called from a callback.\n *\n * @note On some platforms, certain callbacks may be called outside of a call\n * to one of the event processing functions.\n *\n * @sa glfwWaitEvents\n *\n * @ingroup window\n */\nGLFWAPI void glfwPollEvents(void);\n\n/*! @brief Waits until events are pending and processes them.\n *\n * This function puts the calling thread to sleep until at least one event has\n * been received. Once one or more events have been received, it behaves as if\n * @ref glfwPollEvents was called, i.e. the events are processed and the\n * function then returns immediately. Processing events will cause the window\n * and input callbacks associated with those events to be called.\n *\n * Since not all events are associated with callbacks, this function may return\n * without a callback having been called even if you are monitoring all\n * callbacks.\n *\n * This function is not required for joystick input to work.\n *\n * @remarks On some platforms, a window move, resize or menu operation will\n * cause event processing to block. This is due to how event processing is\n * designed on those platforms. You can use the\n * [window refresh callback](@ref GLFWwindowrefreshfun) to redraw the contents\n * of your window when necessary during the operation.\n *\n * @note This function may only be called from the main thread.\n *\n * @note This function may not be called from a callback.\n *\n * @note On some platforms, certain callbacks may be called outside of a call\n * to one of the event processing functions.\n *\n * @sa glfwPollEvents\n *\n * @ingroup window\n */\nGLFWAPI void glfwWaitEvents(void);\n\n/*! @brief Returns the value of an input option for the specified window.\n *\n * @param[in] window The window to query.\n * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or\n * `GLFW_STICKY_MOUSE_BUTTONS`.\n *\n * @sa glfwSetInputMode\n *\n * @ingroup input\n */\nGLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);\n\n/*! @brief Sets an input option for the specified window.\n * @param[in] window The window whose input mode to set.\n * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or\n * `GLFW_STICKY_MOUSE_BUTTONS`.\n * @param[in] value The new value of the specified input mode.\n *\n * If `mode` is `GLFW_CURSOR`, the value must be one of the supported input\n * modes:\n * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.\n * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client\n * area of the window but does not restrict the cursor from leaving. This is\n * useful if you wish to render your own cursor or have no visible cursor at\n * all.\n * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual\n * and unlimited cursor movement. This is useful for implementing for\n * example 3D camera controls.\n *\n * If `mode` is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to\n * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are\n * enabled, a key press will ensure that @ref glfwGetKey returns @ref\n * GLFW_PRESS the next time it is called even if the key had been released\n * before the call. This is useful when you are only interested in whether\n * keys have been pressed but not when or in which order.\n *\n * If `mode` is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either `GL_TRUE`\n * to enable sticky mouse buttons, or `GL_FALSE` to disable it. If sticky\n * mouse buttons are enabled, a mouse button press will ensure that @ref\n * glfwGetMouseButton returns @ref GLFW_PRESS the next time it is called even\n * if the mouse button had been released before the call. This is useful when\n * you are only interested in whether mouse buttons have been pressed but not\n * when or in which order.\n *\n * @sa glfwGetInputMode\n *\n * @ingroup input\n */\nGLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);\n\n/*! @brief Returns the last reported state of a keyboard key for the specified\n * window.\n *\n * This function returns the last state reported for the specified key to the\n * specified window. The returned state is one of `GLFW_PRESS` or\n * `GLFW_RELEASE`. The higher-level state `GLFW_REPEAT` is only reported to\n * the key callback.\n *\n * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns\n * `GLFW_PRESS` the first time you call this function after a key has been\n * pressed, even if the key has already been released.\n *\n * The key functions deal with physical keys, with [key tokens](@ref keys)\n * named after their use on the standard US keyboard layout. If you want to\n * input text, use the Unicode character callback instead.\n *\n * @param[in] window The desired window.\n * @param[in] key The desired [keyboard key](@ref keys).\n * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.\n *\n * @note `GLFW_KEY_UNKNOWN` is not a valid key for this function.\n *\n * @ingroup input\n */\nGLFWAPI int glfwGetKey(GLFWwindow* window, int key);\n\n/*! @brief Returns the last reported state of a mouse button for the specified\n * window.\n *\n * This function returns the last state reported for the specified mouse button\n * to the specified window.\n *\n * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function\n * returns `GLFW_PRESS` the first time you call this function after a mouse\n * button has been pressed, even if the mouse button has already been released.\n *\n * @param[in] window The desired window.\n * @param[in] button The desired [mouse button](@ref buttons).\n * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.\n *\n * @ingroup input\n */\nGLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);\n\n/*! @brief Retrieves the last reported cursor position, relative to the client\n * area of the window.\n *\n * This function returns the last reported position of the cursor, in screen\n * coordinates, relative to the upper-left corner of the client area of the\n * specified window.\n *\n * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor\n * position is unbounded and limited only by the minimum and maximum values of\n * a `double`.\n *\n * The coordinate can be converted to their integer equivalents with the\n * `floor` function. Casting directly to an integer type works for positive\n * coordinates, but fails for negative ones.\n *\n * @param[in] window The desired window.\n * @param[out] xpos Where to store the cursor x-coordinate, relative to the\n * left edge of the client area, or `NULL`.\n * @param[out] ypos Where to store the cursor y-coordinate, relative to the to\n * top edge of the client area, or `NULL`.\n *\n * @sa glfwSetCursorPos\n *\n * @ingroup input\n */\nGLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);\n\n/*! @brief Sets the position of the cursor, relative to the client area of the\n * window.\n *\n * This function sets the position, in screen coordinates, of the cursor\n * relative to the upper-left corner of the client area of the specified\n * window. The window must be focused. If the window does not have focus when\n * this function is called, it fails silently.\n *\n * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor\n * position is unbounded and limited only by the minimum and maximum values of\n * a `double`.\n *\n * @param[in] window The desired window.\n * @param[in] xpos The desired x-coordinate, relative to the left edge of the\n * client area.\n * @param[in] ypos The desired y-coordinate, relative to the top edge of the\n * client area.\n *\n * @sa glfwGetCursorPos\n *\n * @ingroup input\n */\nGLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);\n\n/*! @brief Sets the key callback.\n *\n * This function sets the key callback of the specific window, which is called\n * when a key is pressed, repeated or released.\n *\n * The key functions deal with physical keys, with layout independent\n * [key tokens](@ref keys) named after their values in the standard US keyboard\n * layout. If you want to input text, use the\n * [character callback](@ref glfwSetCharCallback) instead.\n *\n * When a window loses focus, it will generate synthetic key release events\n * for all pressed keys. You can tell these events from user-generated events\n * by the fact that the synthetic ones are generated after the window has lost\n * focus, i.e. `GLFW_FOCUSED` will be false and the focus callback will have\n * already been called.\n *\n * The scancode of a key is specific to that platform or sometimes even to that\n * machine. Scancodes are intended to allow users to bind keys that don't have\n * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their\n * state is not saved and so it cannot be retrieved with @ref glfwGetKey.\n *\n * Sometimes GLFW needs to generate synthetic key events, in which case the\n * scancode may be zero.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new key callback, or `NULL` to remove the currently\n * set callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);\n\n/*! @brief Sets the Unicode character callback.\n *\n * This function sets the character callback of the specific window, which is\n * called when a Unicode character is input.\n *\n * The character callback is intended for text input. If you want to know\n * whether a specific key was pressed or released, use the\n * [key callback](@ref glfwSetKeyCallback) instead.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);\n\n/*! @brief Sets the mouse button callback.\n *\n * This function sets the mouse button callback of the specified window, which\n * is called when a mouse button is pressed or released.\n *\n * When a window loses focus, it will generate synthetic mouse button release\n * events for all pressed mouse buttons. You can tell these events from\n * user-generated events by the fact that the synthetic ones are generated\n * after the window has lost focus, i.e. `GLFW_FOCUSED` will be false and the\n * focus callback will have already been called.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);\n\n/*! @brief Sets the cursor position callback.\n *\n * This function sets the cursor position callback of the specified window,\n * which is called when the cursor is moved. The callback is provided with the\n * position, in screen coordinates, relative to the upper-left corner of the\n * client area of the window.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);\n\n/*! @brief Sets the cursor enter/exit callback.\n *\n * This function sets the cursor boundary crossing callback of the specified\n * window, which is called when the cursor enters or leaves the client area of\n * the window.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new callback, or `NULL` to remove the currently set\n * callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);\n\n/*! @brief Sets the scroll callback.\n *\n * This function sets the scroll callback of the specified window, which is\n * called when a scrolling device is used, such as a mouse wheel or scrolling\n * area of a touchpad.\n *\n * The scroll callback receives all scrolling input, like that from a mouse\n * wheel or a touchpad scrolling area.\n *\n * @param[in] window The window whose callback to set.\n * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently\n * set callback.\n * @return The previously set callback, or `NULL` if no callback was set or an\n * error occurred.\n *\n * @ingroup input\n */\nGLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);\n\n/*! @brief Returns whether the specified joystick is present.\n *\n * This function returns whether the specified joystick is present.\n *\n * @param[in] joy The joystick to query.\n * @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.\n *\n * @ingroup input\n */\nGLFWAPI int glfwJoystickPresent(int joy);\n\n/*! @brief Returns the values of all axes of the specified joystick.\n *\n * This function returns the values of all axes of the specified joystick.\n *\n * @param[in] joy The joystick to query.\n * @param[out] count Where to store the size of the returned array. This is\n * set to zero if an error occurred.\n * @return An array of axis values, or `NULL` if the joystick is not present.\n *\n * @note The returned array is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned array is valid only until the next call to @ref\n * glfwGetJoystickAxes for that joystick.\n *\n * @ingroup input\n */\nGLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);\n\n/*! @brief Returns the state of all buttons of the specified joystick.\n *\n * This function returns the state of all buttons of the specified joystick.\n *\n * @param[in] joy The joystick to query.\n * @param[out] count Where to store the size of the returned array. This is\n * set to zero if an error occurred.\n * @return An array of button states, or `NULL` if the joystick is not present.\n *\n * @note The returned array is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned array is valid only until the next call to @ref\n * glfwGetJoystickButtons for that joystick.\n *\n * @ingroup input\n */\nGLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);\n\n/*! @brief Returns the name of the specified joystick.\n *\n * This function returns the name, encoded as UTF-8, of the specified joystick.\n *\n * @param[in] joy The joystick to query.\n * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick\n * is not present.\n *\n * @note The returned string is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned string is valid only until the next call to @ref\n * glfwGetJoystickName for that joystick.\n *\n * @ingroup input\n */\nGLFWAPI const char* glfwGetJoystickName(int joy);\n\n/*! @brief Sets the clipboard to the specified string.\n *\n * This function sets the system clipboard to the specified, UTF-8 encoded\n * string. The string is copied before returning, so you don't have to retain\n * it afterwards.\n *\n * @param[in] window The window that will own the clipboard contents.\n * @param[in] string A UTF-8 encoded string.\n *\n * @note This function may only be called from the main thread.\n *\n * @sa glfwGetClipboardString\n *\n * @ingroup clipboard\n */\nGLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);\n\n/*! @brief Retrieves the contents of the clipboard as a string.\n *\n * This function returns the contents of the system clipboard, if it contains\n * or is convertible to a UTF-8 encoded string.\n *\n * @param[in] window The window that will request the clipboard contents.\n * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`\n * if an error occurred.\n *\n * @note This function may only be called from the main thread.\n *\n * @note The returned string is allocated and freed by GLFW. You should not\n * free it yourself.\n *\n * @note The returned string is valid only until the next call to @ref\n * glfwGetClipboardString or @ref glfwSetClipboardString.\n *\n * @sa glfwSetClipboardString\n *\n * @ingroup clipboard\n */\nGLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);\n\n/*! @brief Returns the value of the GLFW timer.\n *\n * This function returns the value of the GLFW timer. Unless the timer has\n * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW\n * was initialized.\n *\n * @return The current value, in seconds, or zero if an error occurred.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @note The resolution of the timer is system dependent, but is usually on the\n * order of a few micro- or nanoseconds. It uses the highest-resolution\n * monotonic time source on each supported platform.\n *\n * @ingroup time\n */\nGLFWAPI double glfwGetTime(void);\n\n/*! @brief Sets the GLFW timer.\n *\n * This function sets the value of the GLFW timer. It then continues to count\n * up from that value.\n *\n * @param[in] time The new value, in seconds.\n *\n * @note The resolution of the timer is system dependent, but is usually on the\n * order of a few micro- or nanoseconds. It uses the highest-resolution\n * monotonic time source on each supported platform.\n *\n * @ingroup time\n */\nGLFWAPI void glfwSetTime(double time);\n\n/*! @brief Makes the context of the specified window current for the calling\n * thread.\n *\n * This function makes the context of the specified window current on the\n * calling thread. A context can only be made current on a single thread at\n * a time and each thread can have only a single current context at a time.\n *\n * @param[in] window The window whose context to make current, or `NULL` to\n * detach the current context.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @sa glfwGetCurrentContext\n *\n * @ingroup context\n */\nGLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);\n\n/*! @brief Returns the window whose context is current on the calling thread.\n *\n * This function returns the window whose context is current on the calling\n * thread.\n *\n * @return The window whose context is current, or `NULL` if no window's\n * context is current.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @sa glfwMakeContextCurrent\n *\n * @ingroup context\n */\nGLFWAPI GLFWwindow* glfwGetCurrentContext(void);\n\n/*! @brief Swaps the front and back buffers of the specified window.\n *\n * This function swaps the front and back buffers of the specified window. If\n * the swap interval is greater than zero, the GPU driver waits the specified\n * number of screen updates before swapping the buffers.\n *\n * @param[in] window The window whose buffers to swap.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @par New in GLFW 3\n * This function no longer calls @ref glfwPollEvents. You need to call it or\n * @ref glfwWaitEvents yourself.\n *\n * @sa glfwSwapInterval\n *\n * @ingroup context\n */\nGLFWAPI void glfwSwapBuffers(GLFWwindow* window);\n\n/*! @brief Sets the swap interval for the current context.\n *\n * This function sets the swap interval for the current context, i.e. the\n * number of screen updates to wait before swapping the buffers of a window and\n * returning from @ref glfwSwapBuffers. This is sometimes called 'vertical\n * synchronization', 'vertical retrace synchronization' or 'vsync'.\n *\n * Contexts that support either of the `WGL_EXT_swap_control_tear` and\n * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,\n * which allow the driver to swap even if a frame arrives a little bit late.\n * You can check for the presence of these extensions using @ref\n * glfwExtensionSupported. For more information about swap tearing, see the\n * extension specifications.\n *\n * @param[in] interval The minimum number of screen updates to wait for\n * until the buffers are swapped by @ref glfwSwapBuffers.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @note This function is not called during window creation, leaving the swap\n * interval set to whatever is the default on that platform. This is done\n * because some swap interval extensions used by GLFW do not allow the swap\n * interval to be reset to zero once it has been set to a non-zero value.\n *\n * @note Some GPU drivers do not honor the requested swap interval, either\n * because of user settings that override the request or due to bugs in the\n * driver.\n *\n * @sa glfwSwapBuffers\n *\n * @ingroup context\n */\nGLFWAPI void glfwSwapInterval(int interval);\n\n/*! @brief Returns whether the specified extension is available.\n *\n * This function returns whether the specified\n * [OpenGL or context creation API extension](@ref context_glext) is supported\n * by the current context. For example, on Windows both the OpenGL and WGL\n * extension strings are checked.\n *\n * @param[in] extension The ASCII encoded name of the extension.\n * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @note As this functions searches one or more extension strings on each call,\n * it is recommended that you cache its results if it's going to be used\n * frequently. The extension strings will not change during the lifetime of\n * a context, so there is no danger in doing this.\n *\n * @ingroup context\n */\nGLFWAPI int glfwExtensionSupported(const char* extension);\n\n/*! @brief Returns the address of the specified function for the current\n * context.\n *\n * This function returns the address of the specified\n * [client API or extension function](@ref context_glext), if it is supported\n * by the current context.\n *\n * @param[in] procname The ASCII encoded name of the function.\n * @return The address of the function, or `NULL` if the function is\n * unavailable.\n *\n * @remarks This function may be called from secondary threads.\n *\n * @note The addresses of these functions are not guaranteed to be the same for\n * all contexts, especially if they use different client APIs or even different\n * context creation hints.\n *\n * @ingroup context\n */\nGLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);\n\n\n/*************************************************************************\n * Global definition cleanup\n *************************************************************************/\n\n/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */\n\n#ifdef GLFW_WINGDIAPI_DEFINED\n #undef WINGDIAPI\n #undef GLFW_WINGDIAPI_DEFINED\n#endif\n\n#ifdef GLFW_CALLBACK_DEFINED\n #undef CALLBACK\n #undef GLFW_CALLBACK_DEFINED\n#endif\n\n/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _glfw3_h_ */\n\n"}, {"path": "includes/GLFW/glfw3native.h", "language": "code", "loc": 159, "comment_density": 0.66, "code": "/*************************************************************************\n * GLFW 3.0 - www.glfw.org\n * A library for OpenGL, window and input\n *------------------------------------------------------------------------\n * Copyright (c) 2002-2006 Marcus Geelnard\n * Copyright (c) 2006-2010 Camilla Berglund \n *\n * This software is provided 'as-is', without any express or implied\n * warranty. In no event will the authors be held liable for any damages\n * arising from the use of this software.\n *\n * Permission is granted to anyone to use this software for any purpose,\n * including commercial applications, and to alter it and redistribute it\n * freely, subject to the following restrictions:\n *\n * 1. The origin of this software must not be misrepresented; you must not\n * claim that you wrote the original software. If you use this software\n * in a product, an acknowledgment in the product documentation would\n * be appreciated but is not required.\n *\n * 2. Altered source versions must be plainly marked as such, and must not\n * be misrepresented as being the original software.\n *\n * 3. This notice may not be removed or altered from any source\n * distribution.\n *\n *************************************************************************/\n\n#ifndef _glfw3_native_h_\n#define _glfw3_native_h_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/*************************************************************************\n * Doxygen documentation\n *************************************************************************/\n\n/*! @defgroup native Native access\n *\n * **By using the native API, you assert that you know what you're doing and\n * how to fix problems caused by using it. If you don't, you shouldn't be\n * using it.**\n *\n * Before the inclusion of @ref glfw3native.h, you must define exactly one\n * window API macro and exactly one context API macro. Failure to do this\n * will cause a compile-time error.\n *\n * The available window API macros are:\n * * `GLFW_EXPOSE_NATIVE_WIN32`\n * * `GLFW_EXPOSE_NATIVE_COCOA`\n * * `GLFW_EXPOSE_NATIVE_X11`\n *\n * The available context API macros are:\n * * `GLFW_EXPOSE_NATIVE_WGL`\n * * `GLFW_EXPOSE_NATIVE_NSGL`\n * * `GLFW_EXPOSE_NATIVE_GLX`\n * * `GLFW_EXPOSE_NATIVE_EGL`\n *\n * These macros select which of the native access functions that are declared\n * and which platform-specific headers to include. It is then up your (by\n * definition platform-specific) code to handle which of these should be\n * defined.\n */\n\n\n/*************************************************************************\n * System headers and types\n *************************************************************************/\n\n#if defined(GLFW_EXPOSE_NATIVE_WIN32)\n #include \n#elif defined(GLFW_EXPOSE_NATIVE_COCOA)\n #if defined(__OBJC__)\n #import \n #else\n typedef void* id;\n #endif\n#elif defined(GLFW_EXPOSE_NATIVE_X11)\n #include \n#else\n #error \"No window API specified\"\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_WGL)\n /* WGL is declared by windows.h */\n#elif defined(GLFW_EXPOSE_NATIVE_NSGL)\n /* NSGL is declared by Cocoa.h */\n#elif defined(GLFW_EXPOSE_NATIVE_GLX)\n #include \n#elif defined(GLFW_EXPOSE_NATIVE_EGL)\n #include \n#else\n #error \"No context API specified\"\n#endif\n\n\n/*************************************************************************\n * Functions\n *************************************************************************/\n\n#if defined(GLFW_EXPOSE_NATIVE_WIN32)\n/*! @brief Returns the `HWND` of the specified window.\n * @return The `HWND` of the specified window.\n * @ingroup native\n */\nGLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_WGL)\n/*! @brief Returns the `HGLRC` of the specified window.\n * @return The `HGLRC` of the specified window.\n * @ingroup native\n */\nGLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_COCOA)\n/*! @brief Returns the `NSWindow` of the specified window.\n * @return The `NSWindow` of the specified window.\n * @ingroup native\n */\nGLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_NSGL)\n/*! @brief Returns the `NSOpenGLContext` of the specified window.\n * @return The `NSOpenGLContext` of the specified window.\n * @ingroup native\n */\nGLFWAPI id glfwGetNSGLContext(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_X11)\n/*! @brief Returns the `Display` used by GLFW.\n * @return The `Display` used by GLFW.\n * @ingroup native\n */\nGLFWAPI Display* glfwGetX11Display(void);\n/*! @brief Returns the `Window` of the specified window.\n * @return The `Window` of the specified window.\n * @ingroup native\n */\nGLFWAPI Window glfwGetX11Window(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_GLX)\n/*! @brief Returns the `GLXContext` of the specified window.\n * @return The `GLXContext` of the specified window.\n * @ingroup native\n */\nGLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);\n#endif\n\n#if defined(GLFW_EXPOSE_NATIVE_EGL)\n/*! @brief Returns the `EGLDisplay` used by GLFW.\n * @return The `EGLDisplay` used by GLFW.\n * @ingroup native\n */\nGLFWAPI EGLDisplay glfwGetEGLDisplay(void);\n/*! @brief Returns the `EGLContext` of the specified window.\n * @return The `EGLContext` of the specified window.\n * @ingroup native\n */\nGLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);\n/*! @brief Returns the `EGLSurface` of the specified window.\n * @return The `EGLSurface` of the specified window.\n * @ingroup native\n */\nGLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _glfw3_native_h_ */\n\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.738, "dedup_hash": "4e18b0b99bb1b3ed", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Glm", "api": "OpenGL Core", "glsl_version": null, "topic": "bumpmapping/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/common.hpp", "language": "code", "loc": 482, "comment_density": 0.809, "code": "/// @ref core\n/// @file glm/common.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n///\n/// @defgroup core_func_common Common functions\n/// @ingroup core\n///\n/// Provides GLSL common functions\n///\n/// These all operate component-wise. The description is per component.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"detail/qualifier.hpp\"\n#include \"detail/_fixes.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_common\n\t/// @{\n\n\t/// Returns x if x >= 0; otherwise, it returns -x.\n\t///\n\t/// @tparam genType floating-point or signed integer; scalar or vector types.\n\t///\n\t/// @see GLSL abs man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType abs(genType x);\n\n\t/// Returns x if x >= 0; otherwise, it returns -x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL abs man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec abs(vec const& x);\n\n\t/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL sign man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec sign(vec const& x);\n\n\t/// Returns a value equal to the nearest integer that is less than or equal to x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL floor man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec floor(vec const& x);\n\n\t/// Returns a value equal to the nearest integer to x\n\t/// whose absolute value is not larger than the absolute value of x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL trunc man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec trunc(vec const& x);\n\n\t/// Returns a value equal to the nearest integer to x.\n\t/// The fraction 0.5 will round in a direction chosen by the\n\t/// implementation, presumably the direction that is fastest.\n\t/// This includes the possibility that round(x) returns the\n\t/// same value as roundEven(x) for all values of x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL round man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec round(vec const& x);\n\n\t/// Returns a value equal to the nearest integer to x.\n\t/// A fractional part of 0.5 will round toward the nearest even\n\t/// integer. (Both 3.5 and 4.5 for x will return 4.0.)\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL roundEven man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\t/// @see New round to even technique\n\ttemplate\n\tGLM_FUNC_DECL vec roundEven(vec const& x);\n\n\t/// Returns a value equal to the nearest integer\n\t/// that is greater than or equal to x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL ceil man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec ceil(vec const& x);\n\n\t/// Return x - floor(x).\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL fract man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType fract(genType x);\n\n\t/// Return x - floor(x).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL fract man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec fract(vec const& x);\n\n\ttemplate\n\tGLM_FUNC_DECL genType mod(genType x, genType y);\n\n\ttemplate\n\tGLM_FUNC_DECL vec mod(vec const& x, T y);\n\n\t/// Modulus. Returns x - y * floor(x / y)\n\t/// for each component in x using the floating point value y.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types, include glm/gtc/integer for integer scalar types support\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL mod man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec mod(vec const& x, vec const& y);\n\n\t/// Returns the fractional part of x and sets i to the integer\n\t/// part (as a whole number floating point value). Both the\n\t/// return value and the output parameter will have the same\n\t/// sign as x.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL modf man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType modf(genType x, genType& i);\n\n\t/// Returns y if y < x; otherwise, it returns x.\n\t///\n\t/// @tparam genType Floating-point or integer; scalar or vector types.\n\t///\n\t/// @see GLSL min man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType min(genType x, genType y);\n\n\t/// Returns y if y < x; otherwise, it returns x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL min man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& x, T y);\n\n\t/// Returns y if y < x; otherwise, it returns x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL min man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& x, vec const& y);\n\n\t/// Returns y if x < y; otherwise, it returns x.\n\t///\n\t/// @tparam genType Floating-point or integer; scalar or vector types.\n\t///\n\t/// @see GLSL max man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType max(genType x, genType y);\n\n\t/// Returns y if x < y; otherwise, it returns x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL max man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec max(vec const& x, T y);\n\n\t/// Returns y if x < y; otherwise, it returns x.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL max man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec max(vec const& x, vec const& y);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x\n\t/// using the floating-point values minVal and maxVal.\n\t///\n\t/// @tparam genType Floating-point or integer; scalar or vector types.\n\t///\n\t/// @see GLSL clamp man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType clamp(genType x, genType minVal, genType maxVal);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x\n\t/// using the floating-point values minVal and maxVal.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL clamp man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec clamp(vec const& x, T minVal, T maxVal);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x\n\t/// using the floating-point values minVal and maxVal.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL clamp man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec clamp(vec const& x, vec const& minVal, vec const& maxVal);\n\n\t/// If genTypeU is a floating scalar or vector:\n\t/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of\n\t/// x and y using the floating-point value a.\n\t/// The value for a is not restricted to the range [0, 1].\n\t///\n\t/// If genTypeU is a boolean scalar or vector:\n\t/// Selects which vector each returned component comes\n\t/// from. For a component of 'a' that is false, the\n\t/// corresponding component of 'x' is returned. For a\n\t/// component of 'a' that is true, the corresponding\n\t/// component of 'y' is returned. Components of 'x' and 'y' that\n\t/// are not selected are allowed to be invalid floating point\n\t/// values and will have no effect on the results. Thus, this\n\t/// provides different functionality than\n\t/// genType mix(genType x, genType y, genType(a))\n\t/// where a is a Boolean vector.\n\t///\n\t/// @see GLSL mix man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\t///\n\t/// @param[in] x Value to interpolate.\n\t/// @param[in] y Value to interpolate.\n\t/// @param[in] a Interpolant.\n\t///\n\t/// @tparam\tgenTypeT Floating point scalar or vector.\n\t/// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT.\n\t///\n\t/// @code\n\t/// #include \n\t/// ...\n\t/// float a;\n\t/// bool b;\n\t/// glm::dvec3 e;\n\t/// glm::dvec3 f;\n\t/// glm::vec4 g;\n\t/// glm::vec4 h;\n\t/// ...\n\t/// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors.\n\t/// glm::vec4 s = glm::mix(g, h, b); // Returns g or h;\n\t/// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second.\n\t/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.\n\t/// @endcode\n\ttemplate\n\tGLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);\n\n\ttemplate\n\tGLM_FUNC_DECL vec mix(vec const& x, vec const& y, vec const& a);\n\n\ttemplate\n\tGLM_FUNC_DECL vec mix(vec const& x, vec const& y, U a);\n\n\t/// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.\n\t///\n\t/// @see GLSL step man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType step(genType edge, genType x);\n\n\t/// Returns 0.0 if x < edge, otherwise it returns 1.0.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL step man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec step(T edge, vec const& x);\n\n\t/// Returns 0.0 if x < edge, otherwise it returns 1.0.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL step man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec step(vec const& edge, vec const& x);\n\n\t/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and\n\t/// performs smooth Hermite interpolation between 0 and 1\n\t/// when edge0 < x < edge1. This is useful in cases where\n\t/// you would want a threshold function with a smooth\n\t/// transition. This is equivalent to:\n\t/// genType t;\n\t/// t = clamp ((x - edge0) / (edge1 - edge0), 0, 1);\n\t/// return t * t * (3 - 2 * t);\n\t/// Results are undefined if edge0 >= edge1.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL smoothstep man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);\n\n\ttemplate\n\tGLM_FUNC_DECL vec smoothstep(T edge0, T edge1, vec const& x);\n\n\ttemplate\n\tGLM_FUNC_DECL vec smoothstep(vec const& edge0, vec const& edge1, vec const& x);\n\n\t/// Returns true if x holds a NaN (not a number)\n\t/// representation in the underlying implementation's set of\n\t/// floating point representations. Returns false otherwise,\n\t/// including for implementations with no NaN\n\t/// representations.\n\t///\n\t/// /!\\ When using compiler fast math, this function may fail.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL isnan man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec isnan(vec const& x);\n\n\t/// Returns true if x holds a positive infinity or negative\n\t/// infinity representation in the underlying implementation's\n\t/// set of floating point representations. Returns false\n\t/// otherwise, including for implementations with no infinity\n\t/// representations.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL isinf man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec isinf(vec const& x);\n\n\t/// Returns a signed integer value representing\n\t/// the encoding of a floating-point value. The floating-point\n\t/// value's bit-level representation is preserved.\n\t///\n\t/// @see GLSL floatBitsToInt man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\tGLM_FUNC_DECL int floatBitsToInt(float const& v);\n\n\t/// Returns a signed integer value representing\n\t/// the encoding of a floating-point value. The floatingpoint\n\t/// value's bit-level representation is preserved.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL floatBitsToInt man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec floatBitsToInt(vec const& v);\n\n\t/// Returns a unsigned integer value representing\n\t/// the encoding of a floating-point value. The floatingpoint\n\t/// value's bit-level representation is preserved.\n\t///\n\t/// @see GLSL floatBitsToUint man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\tGLM_FUNC_DECL uint floatBitsToUint(float const& v);\n\n\t/// Returns a unsigned integer value representing\n\t/// the encoding of a floating-point value. The floatingpoint\n\t/// value's bit-level representation is preserved.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL floatBitsToUint man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec floatBitsToUint(vec const& v);\n\n\t/// Returns a floating-point value corresponding to a signed\n\t/// integer encoding of a floating-point value.\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\t/// resulting floating point value is unspecified. Otherwise,\n\t/// the bit-level representation is preserved.\n\t///\n\t/// @see GLSL intBitsToFloat man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\tGLM_FUNC_DECL float intBitsToFloat(int const& v);\n\n\t/// Returns a floating-point value corresponding to a signed\n\t/// integer encoding of a floating-point value.\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\t/// resulting floating point value is unspecified. Otherwise,\n\t/// the bit-level representation is preserved.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL intBitsToFloat man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec intBitsToFloat(vec const& v);\n\n\t/// Returns a floating-point value corresponding to a\n\t/// unsigned integer encoding of a floating-point value.\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\t/// resulting floating point value is unspecified. Otherwise,\n\t/// the bit-level representation is preserved.\n\t///\n\t/// @see GLSL uintBitsToFloat man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\tGLM_FUNC_DECL float uintBitsToFloat(uint const& v);\n\n\t/// Returns a floating-point value corresponding to a\n\t/// unsigned integer encoding of a floating-point value.\n\t/// If an inf or NaN is passed in, it will not signal, and the\n\t/// resulting floating point value is unspecified. Otherwise,\n\t/// the bit-level representation is preserved.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL uintBitsToFloat man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL vec uintBitsToFloat(vec const& v);\n\n\t/// Computes and returns a * b + c.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL fma man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType fma(genType const& a, genType const& b, genType const& c);\n\n\t/// Splits x into a floating-point significand in the range\n\t/// [0.5, 1.0) and an integral exponent of two, such that:\n\t/// x = significand * exp(2, exponent)\n\t///\n\t/// The significand is returned by the function and the\n\t/// exponent is returned in the parameter exp. For a\n\t/// floating-point value of zero, the significant and exponent\n\t/// are both zero. For a floating-point value that is an\n\t/// infinity or is not a number, the results are undefined.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL frexp man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType frexp(genType const& x, genIType& exp);\n\n\t/// Builds a floating-point number from x and the\n\t/// corresponding integral exponent of two in exp, returning:\n\t/// significand * exp(2, exponent)\n\t///\n\t/// If this product is too large to be represented in the\n\t/// floating-point type, the result is undefined.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL ldexp man page;\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL genType ldexp(genType const& x, genIType const& exp);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_common.inl\"\n\n"}, {"path": "includes/glm/exponential.hpp", "language": "code", "loc": 98, "comment_density": 0.765, "code": "/// @ref core\n/// @file glm/exponential.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n///\n/// @defgroup core_func_exponential Exponential functions\n/// @ingroup core\n///\n/// Provides GLSL exponential functions\n///\n/// These all operate component-wise. The description is per component.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"detail/type_vec1.hpp\"\n#include \"detail/type_vec2.hpp\"\n#include \"detail/type_vec3.hpp\"\n#include \"detail/type_vec4.hpp\"\n#include \n\nnamespace glm\n{\n\t/// @addtogroup core_func_exponential\n\t/// @{\n\n\t/// Returns 'base' raised to the power 'exponent'.\n\t///\n\t/// @param base Floating point value. pow function is defined for input values of 'base' defined in the range (inf-, inf+) in the limit of the type qualifier.\n\t/// @param exponent Floating point value representing the 'exponent'.\n\t///\n\t/// @see GLSL pow man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec pow(vec const& base, vec const& exponent);\n\n\t/// Returns the natural exponentiation of x, i.e., e^x.\n\t///\n\t/// @param v exp function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL exp man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec exp(vec const& v);\n\n\t/// Returns the natural logarithm of v, i.e.,\n\t/// returns the value y which satisfies the equation x = e^y.\n\t/// Results are undefined if v <= 0.\n\t///\n\t/// @param v log function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL log man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec log(vec const& v);\n\n\t/// Returns 2 raised to the v power.\n\t///\n\t/// @param v exp2 function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL exp2 man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec exp2(vec const& v);\n\n\t/// Returns the base 2 log of x, i.e., returns the value y,\n\t/// which satisfies the equation x = 2 ^ y.\n\t///\n\t/// @param v log2 function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL log2 man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec log2(vec const& v);\n\n\t/// Returns the positive square root of v.\n\t///\n\t/// @param v sqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL sqrt man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec sqrt(vec const& v);\n\n\t/// Returns the reciprocal of the positive square root of v.\n\t///\n\t/// @param v inversesqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL inversesqrt man page\n\t/// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions\n\ttemplate\n\tGLM_FUNC_DECL vec inversesqrt(vec const& v);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_exponential.inl\"\n"}, {"path": "includes/glm/ext.hpp", "language": "code", "loc": 177, "comment_density": 0.028, "code": "/// @file glm/ext.hpp\n///\n/// @ref core (Dependence)\n\n#include \"detail/setup.hpp\"\n\n#pragma once\n\n#include \"glm.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED)\n#\tdefine GLM_MESSAGE_EXT_INCLUDED_DISPLAYED\n#\tpragma message(\"GLM: All extensions included (not recommended)\")\n#endif//GLM_MESSAGES\n\n#include \"./ext/matrix_double2x2.hpp\"\n#include \"./ext/matrix_double2x2_precision.hpp\"\n#include \"./ext/matrix_double2x3.hpp\"\n#include \"./ext/matrix_double2x3_precision.hpp\"\n#include \"./ext/matrix_double2x4.hpp\"\n#include \"./ext/matrix_double2x4_precision.hpp\"\n#include \"./ext/matrix_double3x2.hpp\"\n#include \"./ext/matrix_double3x2_precision.hpp\"\n#include \"./ext/matrix_double3x3.hpp\"\n#include \"./ext/matrix_double3x3_precision.hpp\"\n#include \"./ext/matrix_double3x4.hpp\"\n#include \"./ext/matrix_double3x4_precision.hpp\"\n#include \"./ext/matrix_double4x2.hpp\"\n#include \"./ext/matrix_double4x2_precision.hpp\"\n#include \"./ext/matrix_double4x3.hpp\"\n#include \"./ext/matrix_double4x3_precision.hpp\"\n#include \"./ext/matrix_double4x4.hpp\"\n#include \"./ext/matrix_double4x4_precision.hpp\"\n\n#include \"./ext/matrix_float2x2.hpp\"\n#include \"./ext/matrix_float2x2_precision.hpp\"\n#include \"./ext/matrix_float2x3.hpp\"\n#include \"./ext/matrix_float2x3_precision.hpp\"\n#include \"./ext/matrix_float2x4.hpp\"\n#include \"./ext/matrix_float2x4_precision.hpp\"\n#include \"./ext/matrix_float3x2.hpp\"\n#include \"./ext/matrix_float3x2_precision.hpp\"\n#include \"./ext/matrix_float3x3.hpp\"\n#include \"./ext/matrix_float3x3_precision.hpp\"\n#include \"./ext/matrix_float3x4.hpp\"\n#include \"./ext/matrix_float3x4_precision.hpp\"\n#include \"./ext/matrix_float4x2.hpp\"\n#include \"./ext/matrix_float4x2_precision.hpp\"\n#include \"./ext/matrix_float4x3.hpp\"\n#include \"./ext/matrix_float4x3_precision.hpp\"\n#include \"./ext/matrix_float4x4.hpp\"\n#include \"./ext/matrix_float4x4_precision.hpp\"\n\n#include \"./ext/matrix_relational.hpp\"\n\n#include \"./ext/quaternion_double.hpp\"\n#include \"./ext/quaternion_double_precision.hpp\"\n#include \"./ext/quaternion_float.hpp\"\n#include \"./ext/quaternion_float_precision.hpp\"\n#include \"./ext/quaternion_geometric.hpp\"\n#include \"./ext/quaternion_relational.hpp\"\n\n#include \"./ext/scalar_constants.hpp\"\n#include \"./ext/scalar_int_sized.hpp\"\n#include \"./ext/scalar_relational.hpp\"\n\n#include \"./ext/vector_bool1.hpp\"\n#include \"./ext/vector_bool1_precision.hpp\"\n#include \"./ext/vector_bool2.hpp\"\n#include \"./ext/vector_bool2_precision.hpp\"\n#include \"./ext/vector_bool3.hpp\"\n#include \"./ext/vector_bool3_precision.hpp\"\n#include \"./ext/vector_bool4.hpp\"\n#include \"./ext/vector_bool4_precision.hpp\"\n\n#include \"./ext/vector_double1.hpp\"\n#include \"./ext/vector_double1_precision.hpp\"\n#include \"./ext/vector_double2.hpp\"\n#include \"./ext/vector_double2_precision.hpp\"\n#include \"./ext/vector_double3.hpp\"\n#include \"./ext/vector_double3_precision.hpp\"\n#include \"./ext/vector_double4.hpp\"\n#include \"./ext/vector_double4_precision.hpp\"\n\n#include \"./ext/vector_float1.hpp\"\n#include \"./ext/vector_float1_precision.hpp\"\n#include \"./ext/vector_float2.hpp\"\n#include \"./ext/vector_float2_precision.hpp\"\n#include \"./ext/vector_float3.hpp\"\n#include \"./ext/vector_float3_precision.hpp\"\n#include \"./ext/vector_float4.hpp\"\n#include \"./ext/vector_float4_precision.hpp\"\n\n#include \"./ext/vector_int1.hpp\"\n#include \"./ext/vector_int1_precision.hpp\"\n#include \"./ext/vector_int2.hpp\"\n#include \"./ext/vector_int2_precision.hpp\"\n#include \"./ext/vector_int3.hpp\"\n#include \"./ext/vector_int3_precision.hpp\"\n#include \"./ext/vector_int4.hpp\"\n#include \"./ext/vector_int4_precision.hpp\"\n\n#include \"./ext/vector_relational.hpp\"\n\n#include \"./ext/vector_uint1.hpp\"\n#include \"./ext/vector_uint1_precision.hpp\"\n#include \"./ext/vector_uint2.hpp\"\n#include \"./ext/vector_uint2_precision.hpp\"\n#include \"./ext/vector_uint3.hpp\"\n#include \"./ext/vector_uint3_precision.hpp\"\n#include \"./ext/vector_uint4.hpp\"\n#include \"./ext/vector_uint4_precision.hpp\"\n\n#include \"./gtc/bitfield.hpp\"\n#include \"./gtc/color_space.hpp\"\n#include \"./gtc/constants.hpp\"\n#include \"./gtc/epsilon.hpp\"\n#include \"./gtc/integer.hpp\"\n#include \"./gtc/matrix_access.hpp\"\n#include \"./gtc/matrix_integer.hpp\"\n#include \"./gtc/matrix_inverse.hpp\"\n#include \"./gtc/matrix_transform.hpp\"\n#include \"./gtc/noise.hpp\"\n#include \"./gtc/packing.hpp\"\n#include \"./gtc/quaternion.hpp\"\n#include \"./gtc/random.hpp\"\n#include \"./gtc/reciprocal.hpp\"\n#include \"./gtc/round.hpp\"\n#include \"./gtc/type_precision.hpp\"\n#include \"./gtc/type_ptr.hpp\"\n#include \"./gtc/ulp.hpp\"\n#include \"./gtc/vec1.hpp\"\n#if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n#\tinclude \"./gtc/type_aligned.hpp\"\n#endif\n\n#ifdef GLM_ENABLE_EXPERIMENTAL\n#include \"./gtx/associated_min_max.hpp\"\n#include \"./gtx/bit.hpp\"\n#include \"./gtx/closest_point.hpp\"\n#include \"./gtx/color_encoding.hpp\"\n#include \"./gtx/color_space.hpp\"\n#include \"./gtx/color_space_YCoCg.hpp\"\n#include \"./gtx/compatibility.hpp\"\n#include \"./gtx/component_wise.hpp\"\n#include \"./gtx/dual_quaternion.hpp\"\n#include \"./gtx/euler_angles.hpp\"\n#include \"./gtx/extend.hpp\"\n#include \"./gtx/extended_min_max.hpp\"\n#include \"./gtx/fast_exponential.hpp\"\n#include \"./gtx/fast_square_root.hpp\"\n#include \"./gtx/fast_trigonometry.hpp\"\n#include \"./gtx/functions.hpp\"\n#include \"./gtx/gradient_paint.hpp\"\n#include \"./gtx/handed_coordinate_space.hpp\"\n#include \"./gtx/integer.hpp\"\n#include \"./gtx/intersect.hpp\"\n#include \"./gtx/log_base.hpp\"\n#include \"./gtx/matrix_cross_product.hpp\"\n#include \"./gtx/matrix_interpolation.hpp\"\n#include \"./gtx/matrix_major_storage.hpp\"\n#include \"./gtx/matrix_operation.hpp\"\n#include \"./gtx/matrix_query.hpp\"\n#include \"./gtx/mixed_product.hpp\"\n#include \"./gtx/norm.hpp\"\n#include \"./gtx/normal.hpp\"\n#include \"./gtx/normalize_dot.hpp\"\n#include \"./gtx/number_precision.hpp\"\n#include \"./gtx/optimum_pow.hpp\"\n#include \"./gtx/orthonormalize.hpp\"\n#include \"./gtx/perpendicular.hpp\"\n#include \"./gtx/polar_coordinates.hpp\"\n#include \"./gtx/projection.hpp\"\n#include \"./gtx/quaternion.hpp\"\n#include \"./gtx/raw_data.hpp\"\n#include \"./gtx/rotate_vector.hpp\"\n#include \"./gtx/spline.hpp\"\n#include \"./gtx/std_based_type.hpp\"\n#if !(GLM_COMPILER & GLM_COMPILER_CUDA)\n#\tinclude \"./gtx/string_cast.hpp\"\n#endif\n#include \"./gtx/transform.hpp\"\n#include \"./gtx/transform2.hpp\"\n#include \"./gtx/vec_swizzle.hpp\"\n#include \"./gtx/vector_angle.hpp\"\n#include \"./gtx/vector_query.hpp\"\n#include \"./gtx/wrap.hpp\"\n\n#if GLM_HAS_TEMPLATE_ALIASES\n#\tinclude \"./gtx/scalar_multiplication.hpp\"\n#endif\n\n#if GLM_HAS_RANGE_FOR\n#\tinclude \"./gtx/range.hpp\"\n#endif\n#endif//GLM_ENABLE_EXPERIMENTAL\n"}, {"path": "includes/glm/fwd.hpp", "language": "code", "loc": 662, "comment_density": 0.017, "code": "#pragma once\n\n#include \"detail/qualifier.hpp\"\n\nnamespace glm\n{\n#if GLM_HAS_EXTENDED_INTEGER_TYPE\n\ttypedef std::int8_t\t\t\t\tint8;\n\ttypedef std::int16_t\t\t\tint16;\n\ttypedef std::int32_t\t\t\tint32;\n\ttypedef std::int64_t\t\t\tint64;\n\n\ttypedef std::uint8_t\t\t\tuint8;\n\ttypedef std::uint16_t\t\t\tuint16;\n\ttypedef std::uint32_t\t\t\tuint32;\n\ttypedef std::uint64_t\t\t\tuint64;\n#else\n\ttypedef char\t\t\t\t\tint8;\n\ttypedef short\t\t\t\t\tint16;\n\ttypedef int\t\t\t\t\t\tint32;\n\ttypedef detail::int64\t\t\tint64;\n\n\ttypedef unsigned char\t\t\tuint8;\n\ttypedef unsigned short\t\t\tuint16;\n\ttypedef unsigned int\t\t\tuint32;\n\ttypedef detail::uint64\t\t\tuint64;\n#endif\n\n\t// Scalar int\n\n\ttypedef int8\t\t\t\t\tlowp_i8;\n\ttypedef int8\t\t\t\t\tmediump_i8;\n\ttypedef int8\t\t\t\t\thighp_i8;\n\ttypedef int8\t\t\t\t\ti8;\n\n\ttypedef int8\t\t\t\t\tlowp_int8;\n\ttypedef int8\t\t\t\t\tmediump_int8;\n\ttypedef int8\t\t\t\t\thighp_int8;\n\n\ttypedef int8\t\t\t\t\tlowp_int8_t;\n\ttypedef int8\t\t\t\t\tmediump_int8_t;\n\ttypedef int8\t\t\t\t\thighp_int8_t;\n\ttypedef int8\t\t\t\t\tint8_t;\n\n\ttypedef int16\t\t\t\t\tlowp_i16;\n\ttypedef int16\t\t\t\t\tmediump_i16;\n\ttypedef int16\t\t\t\t\thighp_i16;\n\ttypedef int16\t\t\t\t\ti16;\n\n\ttypedef int16\t\t\t\t\tlowp_int16;\n\ttypedef int16\t\t\t\t\tmediump_int16;\n\ttypedef int16\t\t\t\t\thighp_int16;\n\n\ttypedef int16\t\t\t\t\tlowp_int16_t;\n\ttypedef int16\t\t\t\t\tmediump_int16_t;\n\ttypedef int16\t\t\t\t\thighp_int16_t;\n\ttypedef int16\t\t\t\t\tint16_t;\n\n\ttypedef int32\t\t\t\t\tlowp_i32;\n\ttypedef int32\t\t\t\t\tmediump_i32;\n\ttypedef int32\t\t\t\t\thighp_i32;\n\ttypedef int32\t\t\t\t\ti32;\n\n\ttypedef int32\t\t\t\t\tlowp_int32;\n\ttypedef int32\t\t\t\t\tmediump_int32;\n\ttypedef int32\t\t\t\t\thighp_int32;\n\n\ttypedef int32\t\t\t\t\tlowp_int32_t;\n\ttypedef int32\t\t\t\t\tmediump_int32_t;\n\ttypedef int32\t\t\t\t\thighp_int32_t;\n\ttypedef int32\t\t\t\t\tint32_t;\n\n\ttypedef int64\t\t\t\t\tlowp_i64;\n\ttypedef int64\t\t\t\t\tmediump_i64;\n\ttypedef int64\t\t\t\t\thighp_i64;\n\ttypedef int64\t\t\t\t\ti64;\n\n\ttypedef int64\t\t\t\t\tlowp_int64;\n\ttypedef int64\t\t\t\t\tmediump_int64;\n\ttypedef int64\t\t\t\t\thighp_int64;\n\n\ttypedef int64\t\t\t\t\tlowp_int64_t;\n\ttypedef int64\t\t\t\t\tmediump_int64_t;\n\ttypedef int64\t\t\t\t\thighp_int64_t;\n\ttypedef int64\t\t\t\t\tint64_t;\n\n\t// Scalar uint\n\n\ttypedef uint8\t\t\t\t\tlowp_u8;\n\ttypedef uint8\t\t\t\t\tmediump_u8;\n\ttypedef uint8\t\t\t\t\thighp_u8;\n\ttypedef uint8\t\t\t\t\tu8;\n\n\ttypedef uint8\t\t\t\t\tlowp_uint8;\n\ttypedef uint8\t\t\t\t\tmediump_uint8;\n\ttypedef uint8\t\t\t\t\thighp_uint8;\n\n\ttypedef uint8\t\t\t\t\tlowp_uint8_t;\n\ttypedef uint8\t\t\t\t\tmediump_uint8_t;\n\ttypedef uint8\t\t\t\t\thighp_uint8_t;\n\ttypedef uint8\t\t\t\t\tuint8_t;\n\n\ttypedef uint16\t\t\t\t\tlowp_u16;\n\ttypedef uint16\t\t\t\t\tmediump_u16;\n\ttypedef uint16\t\t\t\t\thighp_u16;\n\ttypedef uint16\t\t\t\t\tu16;\n\n\ttypedef uint16\t\t\t\t\tlowp_uint16;\n\ttypedef uint16\t\t\t\t\tmediump_uint16;\n\ttypedef uint16\t\t\t\t\thighp_uint16;\n\n\ttypedef uint16\t\t\t\t\tlowp_uint16_t;\n\ttypedef uint16\t\t\t\t\tmediump_uint16_t;\n\ttypedef uint16\t\t\t\t\thighp_uint16_t;\n\ttypedef uint16\t\t\t\t\tuint16_t;\n\n\ttypedef uint32\t\t\t\t\tlowp_u32;\n\ttypedef uint32\t\t\t\t\tmediump_u32;\n\ttypedef uint32\t\t\t\t\thighp_u32;\n\ttypedef uint32\t\t\t\t\tu32;\n\n\ttypedef uint32\t\t\t\t\tlowp_uint32;\n\ttypedef uint32\t\t\t\t\tmediump_uint32;\n\ttypedef uint32\t\t\t\t\thighp_uint32;\n\n\ttypedef uint32\t\t\t\t\tlowp_uint32_t;\n\ttypedef uint32\t\t\t\t\tmediump_uint32_t;\n\ttypedef uint32\t\t\t\t\thighp_uint32_t;\n\ttypedef uint32\t\t\t\t\tuint32_t;\n\n\ttypedef uint64\t\t\t\t\tlowp_u64;\n\ttypedef uint64\t\t\t\t\tmediump_u64;\n\ttypedef uint64\t\t\t\t\thighp_u64;\n\ttypedef uint64\t\t\t\t\tu64;\n\n\ttypedef uint64\t\t\t\t\tlowp_uint64;\n\ttypedef uint64\t\t\t\t\tmediump_uint64;\n\ttypedef uint64\t\t\t\t\thighp_uint64;\n\n\ttypedef uint64\t\t\t\t\tlowp_uint64_t;\n\ttypedef uint64\t\t\t\t\tmediump_uint64_t;\n\ttypedef uint64\t\t\t\t\thighp_uint64_t;\n\ttypedef uint64\t\t\t\t\tuint64_t;\n\n\t// Scalar float\n\n\ttypedef float\t\t\t\t\tlowp_f32;\n\ttypedef float\t\t\t\t\tmediump_f32;\n\ttypedef float\t\t\t\t\thighp_f32;\n\ttypedef float\t\t\t\t\tf32;\n\n\ttypedef float\t\t\t\t\tlowp_float32;\n\ttypedef float\t\t\t\t\tmediump_float32;\n\ttypedef float\t\t\t\t\thighp_float32;\n\ttypedef float\t\t\t\t\tfloat32;\n\n\ttypedef float\t\t\t\t\tlowp_float32_t;\n\ttypedef float\t\t\t\t\tmediump_float32_t;\n\ttypedef float\t\t\t\t\thighp_float32_t;\n\ttypedef float\t\t\t\t\tfloat32_t;\n\n\n\ttypedef double\t\t\t\t\tlowp_f64;\n\ttypedef double\t\t\t\t\tmediump_f64;\n\ttypedef double\t\t\t\t\thighp_f64;\n\ttypedef double\t\t\t\t\tf64;\n\n\ttypedef double\t\t\t\t\tlowp_float64;\n\ttypedef double\t\t\t\t\tmediump_float64;\n\ttypedef double\t\t\t\t\thighp_float64;\n\ttypedef double\t\t\t\t\tfloat64;\n\n\ttypedef double\t\t\t\t\tlowp_float64_t;\n\ttypedef double\t\t\t\t\tmediump_float64_t;\n\ttypedef double\t\t\t\t\thighp_float64_t;\n\ttypedef double\t\t\t\t\tfloat64_t;\n\n\t// Vector bool\n\n\ttypedef vec<1, bool, lowp>\t\tlowp_bvec1;\n\ttypedef vec<2, bool, lowp>\t\tlowp_bvec2;\n\ttypedef vec<3, bool, lowp>\t\tlowp_bvec3;\n\ttypedef vec<4, bool, lowp>\t\tlowp_bvec4;\n\n\ttypedef vec<1, bool, mediump>\tmediump_bvec1;\n\ttypedef vec<2, bool, mediump>\tmediump_bvec2;\n\ttypedef vec<3, bool, mediump>\tmediump_bvec3;\n\ttypedef vec<4, bool, mediump>\tmediump_bvec4;\n\n\ttypedef vec<1, bool, highp>\t\thighp_bvec1;\n\ttypedef vec<2, bool, highp>\t\thighp_bvec2;\n\ttypedef vec<3, bool, highp>\t\thighp_bvec3;\n\ttypedef vec<4, bool, highp>\t\thighp_bvec4;\n\n\ttypedef vec<1, bool, defaultp>\tbvec1;\n\ttypedef vec<2, bool, defaultp>\tbvec2;\n\ttypedef vec<3, bool, defaultp>\tbvec3;\n\ttypedef vec<4, bool, defaultp>\tbvec4;\n\n\t// Vector int\n\n\ttypedef vec<1, i32, lowp>\t\tlowp_ivec1;\n\ttypedef vec<2, i32, lowp>\t\tlowp_ivec2;\n\ttypedef vec<3, i32, lowp>\t\tlowp_ivec3;\n\ttypedef vec<4, i32, lowp>\t\tlowp_ivec4;\n\n\ttypedef vec<1, i32, mediump>\tmediump_ivec1;\n\ttypedef vec<2, i32, mediump>\tmediump_ivec2;\n\ttypedef vec<3, i32, mediump>\tmediump_ivec3;\n\ttypedef vec<4, i32, mediump>\tmediump_ivec4;\n\n\ttypedef vec<1, i32, highp>\t\thighp_ivec1;\n\ttypedef vec<2, i32, highp>\t\thighp_ivec2;\n\ttypedef vec<3, i32, highp>\t\thighp_ivec3;\n\ttypedef vec<4, i32, highp>\t\thighp_ivec4;\n\n\ttypedef vec<1, i32, defaultp>\tivec1;\n\ttypedef vec<2, i32, defaultp>\tivec2;\n\ttypedef vec<3, i32, defaultp>\tivec3;\n\ttypedef vec<4, i32, defaultp>\tivec4;\n\n\ttypedef vec<1, i8, lowp>\t\tlowp_i8vec1;\n\ttypedef vec<2, i8, lowp>\t\tlowp_i8vec2;\n\ttypedef vec<3, i8, lowp>\t\tlowp_i8vec3;\n\ttypedef vec<4, i8, lowp>\t\tlowp_i8vec4;\n\n\ttypedef vec<1, i8, mediump>\t\tmediump_i8vec1;\n\ttypedef vec<2, i8, mediump>\t\tmediump_i8vec2;\n\ttypedef vec<3, i8, mediump>\t\tmediump_i8vec3;\n\ttypedef vec<4, i8, mediump>\t\tmediump_i8vec4;\n\n\ttypedef vec<1, i8, highp>\t\thighp_i8vec1;\n\ttypedef vec<2, i8, highp>\t\thighp_i8vec2;\n\ttypedef vec<3, i8, highp>\t\thighp_i8vec3;\n\ttypedef vec<4, i8, highp>\t\thighp_i8vec4;\n\n\ttypedef vec<1, i8, defaultp>\ti8vec1;\n\ttypedef vec<2, i8, defaultp>\ti8vec2;\n\ttypedef vec<3, i8, defaultp>\ti8vec3;\n\ttypedef vec<4, i8, defaultp>\ti8vec4;\n\n\ttypedef vec<1, i16, lowp>\t\tlowp_i16vec1;\n\ttypedef vec<2, i16, lowp>\t\tlowp_i16vec2;\n\ttypedef vec<3, i16, lowp>\t\tlowp_i16vec3;\n\ttypedef vec<4, i16, lowp>\t\tlowp_i16vec4;\n\n\ttypedef vec<1, i16, mediump>\tmediump_i16vec1;\n\ttypedef vec<2, i16, mediump>\tmediump_i16vec2;\n\ttypedef vec<3, i16, mediump>\tmediump_i16vec3;\n\ttypedef vec<4, i16, mediump>\tmediump_i16vec4;\n\n\ttypedef vec<1, i16, highp>\t\thighp_i16vec1;\n\ttypedef vec<2, i16, highp>\t\thighp_i16vec2;\n\ttypedef vec<3, i16, highp>\t\thighp_i16vec3;\n\ttypedef vec<4, i16, highp>\t\thighp_i16vec4;\n\n\ttypedef vec<1, i16, defaultp>\ti16vec1;\n\ttypedef vec<2, i16, defaultp>\ti16vec2;\n\ttypedef vec<3, i16, defaultp>\ti16vec3;\n\ttypedef vec<4, i16, defaultp>\ti16vec4;\n\n\ttypedef vec<1, i32, lowp>\t\tlowp_i32vec1;\n\ttypedef vec<2, i32, lowp>\t\tlowp_i32vec2;\n\ttypedef vec<3, i32, lowp>\t\tlowp_i32vec3;\n\ttypedef vec<4, i32, lowp>\t\tlowp_i32vec4;\n\n\ttypedef vec<1, i32, mediump>\tmediump_i32vec1;\n\ttypedef vec<2, i32, mediump>\tmediump_i32vec2;\n\ttypedef vec<3, i32, mediump>\tmediump_i32vec3;\n\ttypedef vec<4, i32, mediump>\tmediump_i32vec4;\n\n\ttypedef vec<1, i32, highp>\t\thighp_i32vec1;\n\ttypedef vec<2, i32, highp>\t\thighp_i32vec2;\n\ttypedef vec<3, i32, highp>\t\thighp_i32vec3;\n\ttypedef vec<4, i32, highp>\t\thighp_i32vec4;\n\n\ttypedef vec<1, i32, defaultp>\ti32vec1;\n\ttypedef vec<2, i32, defaultp>\ti32vec2;\n\ttypedef vec<3, i32, defaultp>\ti32vec3;\n\ttypedef vec<4, i32, defaultp>\ti32vec4;\n\n\ttypedef vec<1, i64, lowp>\t\tlowp_i64vec1;\n\ttypedef vec<2, i64, lowp>\t\tlowp_i64vec2;\n\ttypedef vec<3, i64, lowp>\t\tlowp_i64vec3;\n\ttypedef vec<4, i64, lowp>\t\tlowp_i64vec4;\n\n\ttypedef vec<1, i64, mediump>\tmediump_i64vec1;\n\ttypedef vec<2, i64, mediump>\tmediump_i64vec2;\n\ttypedef vec<3, i64, mediump>\tmediump_i64vec3;\n\ttypedef vec<4, i64, mediump>\tmediump_i64vec4;\n\n\ttypedef vec<1, i64, highp>\t\thighp_i64vec1;\n\ttypedef vec<2, i64, highp>\t\thighp_i64vec2;\n\ttypedef vec<3, i64, highp>\t\thighp_i64vec3;\n\ttypedef vec<4, i64, highp>\t\thighp_i64vec4;\n\n\ttypedef vec<1, i64, defaultp>\ti64vec1;\n\ttypedef vec<2, i64, defaultp>\ti64vec2;\n\ttypedef vec<3, i64, defaultp>\ti64vec3;\n\ttypedef vec<4, i64, defaultp>\ti64vec4;\n\n\t// Vector uint\n\n\ttypedef vec<1, u32, lowp>\t\tlowp_uvec1;\n\ttypedef vec<2, u32, lowp>\t\tlowp_uvec2;\n\ttypedef vec<3, u32, lowp>\t\tlowp_uvec3;\n\ttypedef vec<4, u32, lowp>\t\tlowp_uvec4;\n\n\ttypedef vec<1, u32, mediump>\tmediump_uvec1;\n\ttypedef vec<2, u32, mediump>\tmediump_uvec2;\n\ttypedef vec<3, u32, mediump>\tmediump_uvec3;\n\ttypedef vec<4, u32, mediump>\tmediump_uvec4;\n\n\ttypedef vec<1, u32, highp>\t\thighp_uvec1;\n\ttypedef vec<2, u32, highp>\t\thighp_uvec2;\n\ttypedef vec<3, u32, highp>\t\thighp_uvec3;\n\ttypedef vec<4, u32, highp>\t\thighp_uvec4;\n\n\ttypedef vec<1, u32, defaultp>\tuvec1;\n\ttypedef vec<2, u32, defaultp>\tuvec2;\n\ttypedef vec<3, u32, defaultp>\tuvec3;\n\ttypedef vec<4, u32, defaultp>\tuvec4;\n\n\ttypedef vec<1, u8, lowp>\t\tlowp_u8vec1;\n\ttypedef vec<2, u8, lowp>\t\tlowp_u8vec2;\n\ttypedef vec<3, u8, lowp>\t\tlowp_u8vec3;\n\ttypedef vec<4, u8, lowp>\t\tlowp_u8vec4;\n\n\ttypedef vec<1, u8, mediump>\t\tmediump_u8vec1;\n\ttypedef vec<2, u8, mediump>\t\tmediump_u8vec2;\n\ttypedef vec<3, u8, mediump>\t\tmediump_u8vec3;\n\ttypedef vec<4, u8, mediump>\t\tmediump_u8vec4;\n\n\ttypedef vec<1, u8, highp>\t\thighp_u8vec1;\n\ttypedef vec<2, u8, highp>\t\thighp_u8vec2;\n\ttypedef vec<3, u8, highp>\t\thighp_u8vec3;\n\ttypedef vec<4, u8, highp>\t\thighp_u8vec4;\n\n\ttypedef vec<1, u8, defaultp>\tu8vec1;\n\ttypedef vec<2, u8, defaultp>\tu8vec2;\n\ttypedef vec<3, u8, defaultp>\tu8vec3;\n\ttypedef vec<4, u8, defaultp>\tu8vec4;\n\n\ttypedef vec<1, u16, lowp>\t\tlowp_u16vec1;\n\ttypedef vec<2, u16, lowp>\t\tlowp_u16vec2;\n\ttypedef vec<3, u16, lowp>\t\tlowp_u16vec3;\n\ttypedef vec<4, u16, lowp>\t\tlowp_u16vec4;\n\n\ttypedef vec<1, u16, mediump>\tmediump_u16vec1;\n\ttypedef vec<2, u16, mediump>\tmediump_u16vec2;\n\ttypedef vec<3, u16, mediump>\tmediump_u16vec3;\n\ttypedef vec<4, u16, mediump>\tmediump_u16vec4;\n\n\ttypedef vec<1, u16, highp>\t\thighp_u16vec1;\n\ttypedef vec<2, u16, highp>\t\thighp_u16vec2;\n\ttypedef vec<3, u16, highp>\t\thighp_u16vec3;\n\ttypedef vec<4, u16, highp>\t\thighp_u16vec4;\n\n\ttypedef vec<1, u16, defaultp>\tu16vec1;\n\ttypedef vec<2, u16, defaultp>\tu16vec2;\n\ttypedef vec<3, u16, defaultp>\tu16vec3;\n\ttypedef vec<4, u16, defaultp>\tu16vec4;\n\n\ttypedef vec<1, u32, lowp>\t\tlowp_u32vec1;\n\ttypedef vec<2, u32, lowp>\t\tlowp_u32vec2;\n\ttypedef vec<3, u32, lowp>\t\tlowp_u32vec3;\n\ttypedef vec<4, u32, lowp>\t\tlowp_u32vec4;\n\n\ttypedef vec<1, u32, mediump>\tmediump_u32vec1;\n\ttypedef vec<2, u32, mediump>\tmediump_u32vec2;\n\ttypedef vec<3, u32, mediump>\tmediump_u32vec3;\n\ttypedef vec<4, u32, mediump>\tmediump_u32vec4;\n\n\ttypedef vec<1, u32, highp>\t\thighp_u32vec1;\n\ttypedef vec<2, u32, highp>\t\thighp_u32vec2;\n\ttypedef vec<3, u32, highp>\t\thighp_u32vec3;\n\ttypedef vec<4, u32, highp>\t\thighp_u32vec4;\n\n\ttypedef vec<1, u32, defaultp>\tu32vec1;\n\ttypedef vec<2, u32, defaultp>\tu32vec2;\n\ttypedef vec<3, u32, defaultp>\tu32vec3;\n\ttypedef vec<4, u32, defaultp>\tu32vec4;\n\n\ttypedef vec<1, u64, lowp>\t\tlowp_u64vec1;\n\ttypedef vec<2, u64, lowp>\t\tlowp_u64vec2;\n\ttypedef vec<3, u64, lowp>\t\tlowp_u64vec3;\n\ttypedef vec<4, u64, lowp>\t\tlowp_u64vec4;\n\n\ttypedef vec<1, u64, mediump>\tmediump_u64vec1;\n\ttypedef vec<2, u64, mediump>\tmediump_u64vec2;\n\ttypedef vec<3, u64, mediump>\tmediump_u64vec3;\n\ttypedef vec<4, u64, mediump>\tmediump_u64vec4;\n\n\ttypedef vec<1, u64, highp>\t\thighp_u64vec1;\n\ttypedef vec<2, u64, highp>\t\thighp_u64vec2;\n\ttypedef vec<3, u64, highp>\t\thighp_u64vec3;\n\ttypedef vec<4, u64, highp>\t\thighp_u64vec4;\n\n\ttypedef vec<1, u64, defaultp>\tu64vec1;\n\ttypedef vec<2, u64, defaultp>\tu64vec2;\n\ttypedef vec<3, u64, defaultp>\tu64vec3;\n\ttypedef vec<4, u64, defaultp>\tu64vec4;\n\n\t// Vector float\n\n\ttypedef vec<1, float, lowp>\t\t\tlowp_vec1;\n\ttypedef vec<2, float, lowp>\t\t\tlowp_vec2;\n\ttypedef vec<3, float, lowp>\t\t\tlowp_vec3;\n\ttypedef vec<4, float, lowp>\t\t\tlowp_vec4;\n\n\ttypedef vec<1, float, mediump>\t\tmediump_vec1;\n\ttypedef vec<2, float, mediump>\t\tmediump_vec2;\n\ttypedef vec<3, float, mediump>\t\tmediump_vec3;\n\ttypedef vec<4, float, mediump>\t\tmediump_vec4;\n\n\ttypedef vec<1, float, highp>\t\thighp_vec1;\n\ttypedef vec<2, float, highp>\t\thighp_vec2;\n\ttypedef vec<3, float, highp>\t\thighp_vec3;\n\ttypedef vec<4, float, highp>\t\thighp_vec4;\n\n\ttypedef vec<1, float, defaultp>\t\tvec1;\n\ttypedef vec<2, float, defaultp>\t\tvec2;\n\ttypedef vec<3, float, defaultp>\t\tvec3;\n\ttypedef vec<4, float, defaultp>\t\tvec4;\n\n\ttypedef vec<1, float, lowp>\t\t\tlowp_fvec1;\n\ttypedef vec<2, float, lowp>\t\t\tlowp_fvec2;\n\ttypedef vec<3, float, lowp>\t\t\tlowp_fvec3;\n\ttypedef vec<4, float, lowp>\t\t\tlowp_fvec4;\n\n\ttypedef vec<1, float, mediump>\t\tmediump_fvec1;\n\ttypedef vec<2, float, mediump>\t\tmediump_fvec2;\n\ttypedef vec<3, float, mediump>\t\tmediump_fvec3;\n\ttypedef vec<4, float, mediump>\t\tmediump_fvec4;\n\n\ttypedef vec<1, float, highp>\t\thighp_fvec1;\n\ttypedef vec<2, float, highp>\t\thighp_fvec2;\n\ttypedef vec<3, float, highp>\t\thighp_fvec3;\n\ttypedef vec<4, float, highp>\t\thighp_fvec4;\n\n\ttypedef vec<1, f32, defaultp>\t\tfvec1;\n\ttypedef vec<2, f32, defaultp>\t\tfvec2;\n\ttypedef vec<3, f32, defaultp>\t\tfvec3;\n\ttypedef vec<4, f32, defaultp>\t\tfvec4;\n\n\ttypedef vec<1, f32, lowp>\t\t\tlowp_f32vec1;\n\ttypedef vec<2, f32, lowp>\t\t\tlowp_f32vec2;\n\ttypedef vec<3, f32, lowp>\t\t\tlowp_f32vec3;\n\ttypedef vec<4, f32, lowp>\t\t\tlowp_f32vec4;\n\n\ttypedef vec<1, f32, mediump>\t\tmediump_f32vec1;\n\ttypedef vec<2, f32, mediump>\t\tmediump_f32vec2;\n\ttypedef vec<3, f32, mediump>\t\tmediump_f32vec3;\n\ttypedef vec<4, f32, mediump>\t\tmediump_f32vec4;\n\n\ttypedef vec<1, f32, highp>\t\t\thighp_f32vec1;\n\ttypedef vec<2, f32, highp>\t\t\thighp_f32vec2;\n\ttypedef vec<3, f32, highp>\t\t\thighp_f32vec3;\n\ttypedef vec<4, f32, highp>\t\t\thighp_f32vec4;\n\n\ttypedef vec<1, f32, defaultp>\t\tf32vec1;\n\ttypedef vec<2, f32, defaultp>\t\tf32vec2;\n\ttypedef vec<3, f32, defaultp>\t\tf32vec3;\n\ttypedef vec<4, f32, defaultp>\t\tf32vec4;\n\n\ttypedef vec<1, f64, lowp>\t\t\tlowp_dvec1;\n\ttypedef vec<2, f64, lowp>\t\t\tlowp_dvec2;\n\ttypedef vec<3, f64, lowp>\t\t\tlowp_dvec3;\n\ttypedef vec<4, f64, lowp>\t\t\tlowp_dvec4;\n\n\ttypedef vec<1, f64, mediump>\t\tmediump_dvec1;\n\ttypedef vec<2, f64, mediump>\t\tmediump_dvec2;\n\ttypedef vec<3, f64, mediump>\t\tmediump_dvec3;\n\ttypedef vec<4, f64, mediump>\t\tmediump_dvec4;\n\n\ttypedef vec<1, f64, highp>\t\t\thighp_dvec1;\n\ttypedef vec<2, f64, highp>\t\t\thighp_dvec2;\n\ttypedef vec<3, f64, highp>\t\t\thighp_dvec3;\n\ttypedef vec<4, f64, highp>\t\t\thighp_dvec4;\n\n\ttypedef vec<1, f64, defaultp>\t\tdvec1;\n\ttypedef vec<2, f64, defaultp>\t\tdvec2;\n\ttypedef vec<3, f64, defaultp>\t\tdvec3;\n\ttypedef vec<4, f64, defaultp>\t\tdvec4;\n\n\ttypedef vec<1, f64, lowp>\t\t\tlowp_f64vec1;\n\ttypedef vec<2, f64, lowp>\t\t\tlowp_f64vec2;\n\ttypedef vec<3, f64, lowp>\t\t\tlowp_f64vec3;\n\ttypedef vec<4, f64, lowp>\t\t\tlowp_f64vec4;\n\n\ttypedef vec<1, f64, mediump>\t\tmediump_f64vec1;\n\ttypedef vec<2, f64, mediump>\t\tmediump_f64vec2;\n\ttypedef vec<3, f64, mediump>\t\tmediump_f64vec3;\n\ttypedef vec<4, f64, mediump>\t\tmediump_f64vec4;\n\n\ttypedef vec<1, f64, highp>\t\t\thighp_f64vec1;\n\ttypedef vec<2, f64, highp>\t\t\thighp_f64vec2;\n\ttypedef vec<3, f64, highp>\t\t\thighp_f64vec3;\n\ttypedef vec<4, f64, highp>\t\t\thighp_f64vec4;\n\n\ttypedef vec<1, f64, defaultp>\t\tf64vec1;\n\ttypedef vec<2, f64, defaultp>\t\tf64vec2;\n\ttypedef vec<3, f64, defaultp>\t\tf64vec3;\n\ttypedef vec<4, f64, defaultp>\t\tf64vec4;\n\n\t// Matrix NxN\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_mat2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_mat3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_mat4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_mat2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_mat3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_mat4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_mat2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_mat3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_mat4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tmat2;\n\ttypedef mat<3, 3, f32, defaultp>\tmat3;\n\ttypedef mat<4, 4, f32, defaultp>\tmat4;\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_fmat2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_fmat3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_fmat4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_fmat2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_fmat3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_fmat4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_fmat2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_fmat3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_fmat4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tfmat2;\n\ttypedef mat<3, 3, f32, defaultp>\tfmat3;\n\ttypedef mat<4, 4, f32, defaultp>\tfmat4;\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_f32mat2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_f32mat3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_f32mat4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_f32mat2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_f32mat3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_f32mat4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_f32mat2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_f32mat3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_f32mat4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tf32mat2;\n\ttypedef mat<3, 3, f32, defaultp>\tf32mat3;\n\ttypedef mat<4, 4, f32, defaultp>\tf32mat4;\n\n\ttypedef mat<2, 2, f64, lowp>\t\tlowp_dmat2;\n\ttypedef mat<3, 3, f64, lowp>\t\tlowp_dmat3;\n\ttypedef mat<4, 4, f64, lowp>\t\tlowp_dmat4;\n\n\ttypedef mat<2, 2, f64, mediump>\t\tmediump_dmat2;\n\ttypedef mat<3, 3, f64, mediump>\t\tmediump_dmat3;\n\ttypedef mat<4, 4, f64, mediump>\t\tmediump_dmat4;\n\n\ttypedef mat<2, 2, f64, highp>\t\thighp_dmat2;\n\ttypedef mat<3, 3, f64, highp>\t\thighp_dmat3;\n\ttypedef mat<4, 4, f64, highp>\t\thighp_dmat4;\n\n\ttypedef mat<2, 2, f64, defaultp>\tdmat2;\n\ttypedef mat<3, 3, f64, defaultp>\tdmat3;\n\ttypedef mat<4, 4, f64, defaultp>\tdmat4;\n\n\ttypedef mat<2, 2, f64, lowp>\t\tlowp_f64mat2;\n\ttypedef mat<3, 3, f64, lowp>\t\tlowp_f64mat3;\n\ttypedef mat<4, 4, f64, lowp>\t\tlowp_f64mat4;\n\n\ttypedef mat<2, 2, f64, mediump>\t\tmediump_f64mat2;\n\ttypedef mat<3, 3, f64, mediump>\t\tmediump_f64mat3;\n\ttypedef mat<4, 4, f64, mediump>\t\tmediump_f64mat4;\n\n\ttypedef mat<2, 2, f64, highp>\t\thighp_f64mat2;\n\ttypedef mat<3, 3, f64, highp>\t\thighp_f64mat3;\n\ttypedef mat<4, 4, f64, highp>\t\thighp_f64mat4;\n\n\ttypedef mat<2, 2, f64, defaultp>\tf64mat2;\n\ttypedef mat<3, 3, f64, defaultp>\tf64mat3;\n\ttypedef mat<4, 4, f64, defaultp>\tf64mat4;\n\n\t// Matrix MxN\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_mat2x2;\n\ttypedef mat<2, 3, f32, lowp>\t\tlowp_mat2x3;\n\ttypedef mat<2, 4, f32, lowp>\t\tlowp_mat2x4;\n\ttypedef mat<3, 2, f32, lowp>\t\tlowp_mat3x2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_mat3x3;\n\ttypedef mat<3, 4, f32, lowp>\t\tlowp_mat3x4;\n\ttypedef mat<4, 2, f32, lowp>\t\tlowp_mat4x2;\n\ttypedef mat<4, 3, f32, lowp>\t\tlowp_mat4x3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_mat4x4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_mat2x2;\n\ttypedef mat<2, 3, f32, mediump>\t\tmediump_mat2x3;\n\ttypedef mat<2, 4, f32, mediump>\t\tmediump_mat2x4;\n\ttypedef mat<3, 2, f32, mediump>\t\tmediump_mat3x2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_mat3x3;\n\ttypedef mat<3, 4, f32, mediump>\t\tmediump_mat3x4;\n\ttypedef mat<4, 2, f32, mediump>\t\tmediump_mat4x2;\n\ttypedef mat<4, 3, f32, mediump>\t\tmediump_mat4x3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_mat4x4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_mat2x2;\n\ttypedef mat<2, 3, f32, highp>\t\thighp_mat2x3;\n\ttypedef mat<2, 4, f32, highp>\t\thighp_mat2x4;\n\ttypedef mat<3, 2, f32, highp>\t\thighp_mat3x2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_mat3x3;\n\ttypedef mat<3, 4, f32, highp>\t\thighp_mat3x4;\n\ttypedef mat<4, 2, f32, highp>\t\thighp_mat4x2;\n\ttypedef mat<4, 3, f32, highp>\t\thighp_mat4x3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_mat4x4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tmat2x2;\n\ttypedef mat<3, 2, f32, defaultp>\tmat3x2;\n\ttypedef mat<4, 2, f32, defaultp>\tmat4x2;\n\ttypedef mat<2, 3, f32, defaultp>\tmat2x3;\n\ttypedef mat<3, 3, f32, defaultp>\tmat3x3;\n\ttypedef mat<4, 3, f32, defaultp>\tmat4x3;\n\ttypedef mat<2, 4, f32, defaultp>\tmat2x4;\n\ttypedef mat<3, 4, f32, defaultp>\tmat3x4;\n\ttypedef mat<4, 4, f32, defaultp>\tmat4x4;\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_fmat2x2;\n\ttypedef mat<2, 3, f32, lowp>\t\tlowp_fmat2x3;\n\ttypedef mat<2, 4, f32, lowp>\t\tlowp_fmat2x4;\n\ttypedef mat<3, 2, f32, lowp>\t\tlowp_fmat3x2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_fmat3x3;\n\ttypedef mat<3, 4, f32, lowp>\t\tlowp_fmat3x4;\n\ttypedef mat<4, 2, f32, lowp>\t\tlowp_fmat4x2;\n\ttypedef mat<4, 3, f32, lowp>\t\tlowp_fmat4x3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_fmat4x4;\n\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_fmat2x2;\n\ttypedef mat<2, 3, f32, mediump>\t\tmediump_fmat2x3;\n\ttypedef mat<2, 4, f32, mediump>\t\tmediump_fmat2x4;\n\ttypedef mat<3, 2, f32, mediump>\t\tmediump_fmat3x2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_fmat3x3;\n\ttypedef mat<3, 4, f32, mediump>\t\tmediump_fmat3x4;\n\ttypedef mat<4, 2, f32, mediump>\t\tmediump_fmat4x2;\n\ttypedef mat<4, 3, f32, mediump>\t\tmediump_fmat4x3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_fmat4x4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_fmat2x2;\n\ttypedef mat<2, 3, f32, highp>\t\thighp_fmat2x3;\n\ttypedef mat<2, 4, f32, highp>\t\thighp_fmat2x4;\n\ttypedef mat<3, 2, f32, highp>\t\thighp_fmat3x2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_fmat3x3;\n\ttypedef mat<3, 4, f32, highp>\t\thighp_fmat3x4;\n\ttypedef mat<4, 2, f32, highp>\t\thighp_fmat4x2;\n\ttypedef mat<4, 3, f32, highp>\t\thighp_fmat4x3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_fmat4x4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tfmat2x2;\n\ttypedef mat<3, 2, f32, defaultp>\tfmat3x2;\n\ttypedef mat<4, 2, f32, defaultp>\tfmat4x2;\n\ttypedef mat<2, 3, f32, defaultp>\tfmat2x3;\n\ttypedef mat<3, 3, f32, defaultp>\tfmat3x3;\n\ttypedef mat<4, 3, f32, defaultp>\tfmat4x3;\n\ttypedef mat<2, 4, f32, defaultp>\tfmat2x4;\n\ttypedef mat<3, 4, f32, defaultp>\tfmat3x4;\n\ttypedef mat<4, 4, f32, defaultp>\tfmat4x4;\n\n\ttypedef mat<2, 2, f32, lowp>\t\tlowp_f32mat2x2;\n\ttypedef mat<2, 3, f32, lowp>\t\tlowp_f32mat2x3;\n\ttypedef mat<2, 4, f32, lowp>\t\tlowp_f32mat2x4;\n\ttypedef mat<3, 2, f32, lowp>\t\tlowp_f32mat3x2;\n\ttypedef mat<3, 3, f32, lowp>\t\tlowp_f32mat3x3;\n\ttypedef mat<3, 4, f32, lowp>\t\tlowp_f32mat3x4;\n\ttypedef mat<4, 2, f32, lowp>\t\tlowp_f32mat4x2;\n\ttypedef mat<4, 3, f32, lowp>\t\tlowp_f32mat4x3;\n\ttypedef mat<4, 4, f32, lowp>\t\tlowp_f32mat4x4;\n\t\n\ttypedef mat<2, 2, f32, mediump>\t\tmediump_f32mat2x2;\n\ttypedef mat<2, 3, f32, mediump>\t\tmediump_f32mat2x3;\n\ttypedef mat<2, 4, f32, mediump>\t\tmediump_f32mat2x4;\n\ttypedef mat<3, 2, f32, mediump>\t\tmediump_f32mat3x2;\n\ttypedef mat<3, 3, f32, mediump>\t\tmediump_f32mat3x3;\n\ttypedef mat<3, 4, f32, mediump>\t\tmediump_f32mat3x4;\n\ttypedef mat<4, 2, f32, mediump>\t\tmediump_f32mat4x2;\n\ttypedef mat<4, 3, f32, mediump>\t\tmediump_f32mat4x3;\n\ttypedef mat<4, 4, f32, mediump>\t\tmediump_f32mat4x4;\n\n\ttypedef mat<2, 2, f32, highp>\t\thighp_f32mat2x2;\n\ttypedef mat<2, 3, f32, highp>\t\thighp_f32mat2x3;\n\ttypedef mat<2, 4, f32, highp>\t\thighp_f32mat2x4;\n\ttypedef mat<3, 2, f32, highp>\t\thighp_f32mat3x2;\n\ttypedef mat<3, 3, f32, highp>\t\thighp_f32mat3x3;\n\ttypedef mat<3, 4, f32, highp>\t\thighp_f32mat3x4;\n\ttypedef mat<4, 2, f32, highp>\t\thighp_f32mat4x2;\n\ttypedef mat<4, 3, f32, highp>\t\thighp_f32mat4x3;\n\ttypedef mat<4, 4, f32, highp>\t\thighp_f32mat4x4;\n\n\ttypedef mat<2, 2, f32, defaultp>\tf32mat2x2;\n\ttypedef mat<3, 2, f32, defaultp>\tf32mat3x2;\n\ttypedef mat<4, 2, f32, defaultp>\tf32mat4x2;\n\ttypedef mat<2, 3, f32, defaultp>\tf32mat2x3;\n\ttypedef mat<3, 3, f32, defaultp>\tf32mat3x3;\n\ttypedef mat<4, 3, f32, defaultp>\tf32mat4x3;\n\ttypedef mat<2, 4, f32, defaultp>\tf32mat2x4;\n\ttypedef mat<3, 4, f32, defaultp>\tf32mat3x4;\n\ttypedef mat<4, 4, f32, defaultp>\tf32mat4x4;\n\n\ttypedef mat<2, 2, double, lowp>\t\tlowp_dmat2x2;\n\ttypedef mat<2, 3, double, lowp>\t\tlowp_dmat2x3;\n\ttypedef mat<2, 4, double, lowp>\t\tlowp_dmat2x4;\n\ttypedef mat<3, 2, double, lowp>\t\tlowp_dmat3x2;\n\ttypedef mat<3, 3, double, lowp>\t\tlowp_dmat3x3;\n\ttypedef mat<3, 4, double, lowp>\t\tlowp_dmat3x4;\n\ttypedef mat<4, 2, double, lowp>\t\tlowp_dmat4x2;\n\ttypedef mat<4, 3, double, lowp>\t\tlowp_dmat4x3;\n\ttypedef mat<4, 4, double, lowp>\t\tlowp_dmat4x4;\n\n\ttypedef mat<2, 2, double, mediump>\tmediump_dmat2x2;\n\ttypedef mat<2, 3, double, mediump>\tmediump_dmat2x3;\n\ttypedef mat<2, 4, double, mediump>\tmediump_dmat2x4;\n\ttypedef mat<3, 2, double, mediump>\tmediump_dmat3x2;\n\ttypedef mat<3, 3, double, mediump>\tmediump_dmat3x3;\n\ttypedef mat<3, 4, double, mediump>\tmediump_dmat3x4;\n\ttypedef mat<4, 2, double, mediump>\tmediump_dmat4x2;\n\ttypedef mat<4, 3, double, mediump>\tmediump_dmat4x3;\n\ttypedef mat<4, 4, double, mediump>\tmediump_dmat4x4;\n\n\ttypedef mat<2, 2, double, highp>\thighp_dmat2x2;\n\ttypedef mat<2, 3, double, highp>\thighp_dmat2x3;\n\ttypedef mat<2, 4, double, highp>\thighp_dmat2x4;\n\ttypedef mat<3, 2, double, highp>\thighp_dmat3x2;\n\ttypedef mat<3, 3, double, highp>\thighp_dmat3x3;\n\ttypedef mat<3, 4, double, highp>\thighp_dmat3x4;\n\ttypedef mat<4, 2, double, highp>\thighp_dmat4x2;\n\ttypedef mat<4, 3, double, highp>\thighp_dmat4x3;\n\ttypedef mat<4, 4, double, highp>\thighp_dmat4x4;\n\n\ttypedef mat<2, 2, double, defaultp>\tdmat2x2;\n\ttypedef mat<3, 2, double, defaultp>\tdmat3x2;\n\ttypedef mat<4, 2, double, defaultp>\tdmat4x2;\n\ttypedef mat<2, 3, double, defaultp>\tdmat2x3;\n\ttypedef mat<3, 3, double, defaultp>\tdmat3x3;\n\ttypedef mat<4, 3, double, defaultp>\tdmat4x3;\n\ttypedef mat<2, 4, double, defaultp>\tdmat2x4;\n\ttypedef mat<3, 4, double, defaultp>\tdmat3x4;\n\ttypedef mat<4, 4, double, defaultp>\tdmat4x4;\n\n\ttypedef mat<2, 2, f64, lowp>\t\tlowp_f64mat2x2;\n\ttypedef mat<2, 3, f64, lowp>\t\tlowp_f64mat2x3;\n\ttypedef mat<2, 4, f64, lowp>\t\tlowp_f64mat2x4;\n\ttypedef mat<3, 2, f64, lowp>\t\tlowp_f64mat3x2;\n\ttypedef mat<3, 3, f64, lowp>\t\tlowp_f64mat3x3;\n\ttypedef mat<3, 4, f64, lowp>\t\tlowp_f64mat3x4;\n\ttypedef mat<4, 2, f64, lowp>\t\tlowp_f64mat4x2;\n\ttypedef mat<4, 3, f64, lowp>\t\tlowp_f64mat4x3;\n\ttypedef mat<4, 4, f64, lowp>\t\tlowp_f64mat4x4;\n\n\ttypedef mat<2, 2, f64, mediump>\t\tmediump_f64mat2x2;\n\ttypedef mat<2, 3, f64, mediump>\t\tmediump_f64mat2x3;\n\ttypedef mat<2, 4, f64, mediump>\t\tmediump_f64mat2x4;\n\ttypedef mat<3, 2, f64, mediump>\t\tmediump_f64mat3x2;\n\ttypedef mat<3, 3, f64, mediump>\t\tmediump_f64mat3x3;\n\ttypedef mat<3, 4, f64, mediump>\t\tmediump_f64mat3x4;\n\ttypedef mat<4, 2, f64, mediump>\t\tmediump_f64mat4x2;\n\ttypedef mat<4, 3, f64, mediump>\t\tmediump_f64mat4x3;\n\ttypedef mat<4, 4, f64, mediump>\t\tmediump_f64mat4x4;\n\n\ttypedef mat<2, 2, f64, highp>\t\thighp_f64mat2x2;\n\ttypedef mat<2, 3, f64, highp>\t\thighp_f64mat2x3;\n\ttypedef mat<2, 4, f64, highp>\t\thighp_f64mat2x4;\n\ttypedef mat<3, 2, f64, highp>\t\thighp_f64mat3x2;\n\ttypedef mat<3, 3, f64, highp>\t\thighp_f64mat3x3;\n\ttypedef mat<3, 4, f64, highp>\t\thighp_f64mat3x4;\n\ttypedef mat<4, 2, f64, highp>\t\thighp_f64mat4x2;\n\ttypedef mat<4, 3, f64, highp>\t\thighp_f64mat4x3;\n\ttypedef mat<4, 4, f64, highp>\t\thighp_f64mat4x4;\n\n\ttypedef mat<2, 2, f64, defaultp>\tf64mat2x2;\n\ttypedef mat<3, 2, f64, defaultp>\tf64mat3x2;\n\ttypedef mat<4, 2, f64, defaultp>\tf64mat4x2;\n\ttypedef mat<2, 3, f64, defaultp>\tf64mat2x3;\n\ttypedef mat<3, 3, f64, defaultp>\tf64mat3x3;\n\ttypedef mat<4, 3, f64, defaultp>\tf64mat4x3;\n\ttypedef mat<2, 4, f64, defaultp>\tf64mat2x4;\n\ttypedef mat<3, 4, f64, defaultp>\tf64mat3x4;\n\ttypedef mat<4, 4, f64, defaultp>\tf64mat4x4;\n\n\t// Quaternion\n\n\ttypedef qua\t\t\tlowp_quat;\n\ttypedef qua\t\t\tmediump_quat;\n\ttypedef qua\t\t\thighp_quat;\n\ttypedef qua\t\tquat;\n\n\ttypedef qua\t\t\tlowp_fquat;\n\ttypedef qua\t\t\tmediump_fquat;\n\ttypedef qua\t\t\thighp_fquat;\n\ttypedef qua\t\tfquat;\n\n\ttypedef qua\t\t\t\tlowp_f32quat;\n\ttypedef qua\t\t\tmediump_f32quat;\n\ttypedef qua\t\t\t\thighp_f32quat;\n\ttypedef qua\t\t\tf32quat;\n\n\ttypedef qua\t\t\tlowp_dquat;\n\ttypedef qua\t\tmediump_dquat;\n\ttypedef qua\t\t\thighp_dquat;\n\ttypedef qua\t\tdquat;\n\n\ttypedef qua\t\t\t\tlowp_f64quat;\n\ttypedef qua\t\t\tmediump_f64quat;\n\ttypedef qua\t\t\t\thighp_f64quat;\n\ttypedef qua\t\t\tf64quat;\n}//namespace glm\n\n\n"}, {"path": "includes/glm/geometric.hpp", "language": "code", "loc": 103, "comment_density": 0.718, "code": "/// @ref core\n/// @file glm/geometric.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n///\n/// @defgroup core_func_geometric Geometric functions\n/// @ingroup core\n///\n/// These operate on vectors as vectors, not component-wise.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_geometric\n\t/// @{\n\n\t/// Returns the length of x, i.e., sqrt(x * x).\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL length man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL T length(vec const& x);\n\n\t/// Returns the distance between p0 and p1, i.e., length(p0 - p1).\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL distance man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL T distance(vec const& p0, vec const& p1);\n\n\t/// Returns the dot product of x and y, i.e., result = x * y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL dot man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL T dot(vec const& x, vec const& y);\n\n\t/// Returns the cross product of x and y.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL cross man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> cross(vec<3, T, Q> const& x, vec<3, T, Q> const& y);\n\n\t/// Returns a vector in the same direction as x but with length of 1.\n\t/// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefined and generate an error.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL normalize man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec normalize(vec const& x);\n\n\t/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL faceforward man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec faceforward(\n\t\tvec const& N,\n\t\tvec const& I,\n\t\tvec const& Nref);\n\n\t/// For the incident vector I and surface orientation N,\n\t/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL reflect man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec reflect(\n\t\tvec const& I,\n\t\tvec const& N);\n\n\t/// For the incident vector I and surface normal N,\n\t/// and the ratio of indices of refraction eta,\n\t/// return the refraction vector.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see GLSL refract man page\n\t/// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions\n\ttemplate\n\tGLM_FUNC_DECL vec refract(\n\t\tvec const& I,\n\t\tvec const& N,\n\t\tT eta);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_geometric.inl\"\n"}, {"path": "includes/glm/glm.hpp", "language": "code", "loc": 130, "comment_density": 0.777, "code": "/// @ref core\n/// @file glm/glm.hpp\n///\n/// @defgroup core Core features\n///\n/// @brief Features that implement in C++ the GLSL specification as closely as possible.\n///\n/// The GLM core consists of C++ types that mirror GLSL types and\n/// C++ functions that mirror the GLSL functions.\n///\n/// The best documentation for GLM Core is the current GLSL specification,\n/// version 4.2\n/// (pdf file).\n///\n/// GLM core functionalities require to be included to be used.\n///\n///\n/// @defgroup core_vector Vector types\n///\n/// Vector types of two to four components with an exhaustive set of operators.\n///\n/// @ingroup core\n///\n///\n/// @defgroup core_vector_precision Vector types with precision qualifiers\n///\n/// @brief Vector types with precision qualifiers which may result in various precision in term of ULPs\n///\n/// GLSL allows defining qualifiers for particular variables.\n/// With OpenGL's GLSL, these qualifiers have no effect; they are there for compatibility,\n/// with OpenGL ES's GLSL, these qualifiers do have an effect.\n///\n/// C++ has no language equivalent to qualifier qualifiers. So GLM provides the next-best thing:\n/// a number of typedefs that use a particular qualifier.\n///\n/// None of these types make any guarantees about the actual qualifier used.\n///\n/// @ingroup core\n///\n///\n/// @defgroup core_matrix Matrix types\n///\n/// Matrix types of with C columns and R rows where C and R are values between 2 to 4 included.\n/// These types have exhaustive sets of operators.\n///\n/// @ingroup core\n///\n///\n/// @defgroup core_matrix_precision Matrix types with precision qualifiers\n///\n/// @brief Matrix types with precision qualifiers which may result in various precision in term of ULPs\n///\n/// GLSL allows defining qualifiers for particular variables.\n/// With OpenGL's GLSL, these qualifiers have no effect; they are there for compatibility,\n/// with OpenGL ES's GLSL, these qualifiers do have an effect.\n///\n/// C++ has no language equivalent to qualifier qualifiers. So GLM provides the next-best thing:\n/// a number of typedefs that use a particular qualifier.\n///\n/// None of these types make any guarantees about the actual qualifier used.\n///\n/// @ingroup core\n///\n///\n/// @defgroup ext Stable extensions\n///\n/// @brief Additional features not specified by GLSL specification.\n///\n/// EXT extensions are fully tested and documented.\n///\n/// Even if it's highly unrecommended, it's possible to include all the extensions at once by\n/// including . Otherwise, each extension needs to be included a specific file.\n///\n///\n/// @defgroup gtc Recommended extensions\n///\n/// @brief Additional features not specified by GLSL specification.\n///\n/// GTC extensions aim to be stable with tests and documentation.\n///\n/// Even if it's highly unrecommended, it's possible to include all the extensions at once by\n/// including . Otherwise, each extension needs to be included a specific file.\n///\n///\n/// @defgroup gtx Experimental extensions\n///\n/// @brief Experimental features not specified by GLSL specification.\n///\n/// Experimental extensions are useful functions and types, but the development of\n/// their API and functionality is not necessarily stable. They can change\n/// substantially between versions. Backwards compatibility is not much of an issue\n/// for them.\n///\n/// Even if it's highly unrecommended, it's possible to include all the extensions\n/// at once by including . Otherwise, each extension needs to be\n/// included a specific file.\n///\n/// @mainpage OpenGL Mathematics (GLM)\n/// - Website: glm.g-truc.net\n/// - GLM API documentation\n/// - GLM Manual\n\n#include \"detail/_fixes.hpp\"\n\n#include \"detail/setup.hpp\"\n\n#pragma once\n\n#include \n#include \n#include \n#include \n#include \n#include \"fwd.hpp\"\n\n#include \"vec2.hpp\"\n#include \"vec3.hpp\"\n#include \"vec4.hpp\"\n#include \"mat2x2.hpp\"\n#include \"mat2x3.hpp\"\n#include \"mat2x4.hpp\"\n#include \"mat3x2.hpp\"\n#include \"mat3x3.hpp\"\n#include \"mat3x4.hpp\"\n#include \"mat4x2.hpp\"\n#include \"mat4x3.hpp\"\n#include \"mat4x4.hpp\"\n\n#include \"trigonometric.hpp\"\n#include \"exponential.hpp\"\n#include \"common.hpp\"\n#include \"packing.hpp\"\n#include \"geometric.hpp\"\n#include \"matrix.hpp\"\n#include \"vector_relational.hpp\"\n#include \"integer.hpp\"\n"}, {"path": "includes/glm/integer.hpp", "language": "code", "loc": 194, "comment_density": 0.722, "code": "/// @ref core\n/// @file glm/integer.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n///\n/// @defgroup core_func_integer Integer functions\n/// @ingroup core\n///\n/// Provides GLSL functions on integer types\n///\n/// These all operate component-wise. The description is per component.\n/// The notation [a, b] means the set of bits from bit-number a through bit-number\n/// b, inclusive. The lowest-order bit is bit 0.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"detail/qualifier.hpp\"\n#include \"common.hpp\"\n#include \"vector_relational.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_integer\n\t/// @{\n\n\t/// Adds 32-bit unsigned integer x and y, returning the sum\n\t/// modulo pow(2, 32). The value carry is set to 0 if the sum was\n\t/// less than pow(2, 32), or to 1 otherwise.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL uaddCarry man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec uaddCarry(\n\t\tvec const& x,\n\t\tvec const& y,\n\t\tvec & carry);\n\n\t/// Subtracts the 32-bit unsigned integer y from x, returning\n\t/// the difference if non-negative, or pow(2, 32) plus the difference\n\t/// otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL usubBorrow man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec usubBorrow(\n\t\tvec const& x,\n\t\tvec const& y,\n\t\tvec & borrow);\n\n\t/// Multiplies 32-bit integers x and y, producing a 64-bit\n\t/// result. The 32 least-significant bits are returned in lsb.\n\t/// The 32 most-significant bits are returned in msb.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL umulExtended man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL void umulExtended(\n\t\tvec const& x,\n\t\tvec const& y,\n\t\tvec & msb,\n\t\tvec & lsb);\n\n\t/// Multiplies 32-bit integers x and y, producing a 64-bit\n\t/// result. The 32 least-significant bits are returned in lsb.\n\t/// The 32 most-significant bits are returned in msb.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL imulExtended man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL void imulExtended(\n\t\tvec const& x,\n\t\tvec const& y,\n\t\tvec & msb,\n\t\tvec & lsb);\n\n\t/// Extracts bits [offset, offset + bits - 1] from value,\n\t/// returning them in the least significant bits of the result.\n\t/// For unsigned data types, the most significant bits of the\n\t/// result will be set to zero. For signed data types, the\n\t/// most significant bits will be set to the value of bit offset + base - 1.\n\t///\n\t/// If bits is zero, the result will be zero. The result will be\n\t/// undefined if offset or bits is negative, or if the sum of\n\t/// offset and bits is greater than the number of bits used\n\t/// to store the operand.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL bitfieldExtract man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldExtract(\n\t\tvec const& Value,\n\t\tint Offset,\n\t\tint Bits);\n\n\t/// Returns the insertion the bits least-significant bits of insert into base.\n\t///\n\t/// The result will have bits [offset, offset + bits - 1] taken\n\t/// from bits [0, bits - 1] of insert, and all other bits taken\n\t/// directly from the corresponding bits of base. If bits is\n\t/// zero, the result will simply be base. The result will be\n\t/// undefined if offset or bits is negative, or if the sum of\n\t/// offset and bits is greater than the number of bits used to\n\t/// store the operand.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar or vector types.\n\t///\n\t/// @see GLSL bitfieldInsert man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldInsert(\n\t\tvec const& Base,\n\t\tvec const& Insert,\n\t\tint Offset,\n\t\tint Bits);\n\n\t/// Returns the reversal of the bits of value.\n\t/// The bit numbered n of the result will be taken from bit (bits - 1) - n of value,\n\t/// where bits is the total number of bits used to represent value.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar or vector types.\n\t///\n\t/// @see GLSL bitfieldReverse man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldReverse(vec const& v);\n\n\t/// Returns the number of bits set to 1 in the binary representation of value.\n\t///\n\t/// @tparam genType Signed or unsigned integer scalar or vector types.\n\t///\n\t/// @see GLSL bitCount man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL int bitCount(genType v);\n\n\t/// Returns the number of bits set to 1 in the binary representation of value.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar or vector types.\n\t///\n\t/// @see GLSL bitCount man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec bitCount(vec const& v);\n\n\t/// Returns the bit number of the least significant bit set to\n\t/// 1 in the binary representation of value.\n\t/// If value is zero, -1 will be returned.\n\t///\n\t/// @tparam genIUType Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL findLSB man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL int findLSB(genIUType x);\n\n\t/// Returns the bit number of the least significant bit set to\n\t/// 1 in the binary representation of value.\n\t/// If value is zero, -1 will be returned.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL findLSB man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec findLSB(vec const& v);\n\n\t/// Returns the bit number of the most significant bit in the binary representation of value.\n\t/// For positive integers, the result will be the bit number of the most significant bit set to 1.\n\t/// For negative integers, the result will be the bit number of the most significant\n\t/// bit set to 0. For a value of zero or negative one, -1 will be returned.\n\t///\n\t/// @tparam genIUType Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL findMSB man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL int findMSB(genIUType x);\n\n\t/// Returns the bit number of the most significant bit in the binary representation of value.\n\t/// For positive integers, the result will be the bit number of the most significant bit set to 1.\n\t/// For negative integers, the result will be the bit number of the most significant\n\t/// bit set to 0. For a value of zero or negative one, -1 will be returned.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T Signed or unsigned integer scalar types.\n\t///\n\t/// @see GLSL findMSB man page\n\t/// @see GLSL 4.20.8 specification, section 8.8 Integer Functions\n\ttemplate\n\tGLM_FUNC_DECL vec findMSB(vec const& v);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_integer.inl\"\n"}, {"path": "includes/glm/mat2x2.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat2x2.hpp\n\n#pragma once\n#include \"./ext/matrix_double2x2.hpp\"\n#include \"./ext/matrix_double2x2_precision.hpp\"\n#include \"./ext/matrix_float2x2.hpp\"\n#include \"./ext/matrix_float2x2_precision.hpp\"\n\n"}, {"path": "includes/glm/mat2x3.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat2x3.hpp\n\n#pragma once\n#include \"./ext/matrix_double2x3.hpp\"\n#include \"./ext/matrix_double2x3_precision.hpp\"\n#include \"./ext/matrix_float2x3.hpp\"\n#include \"./ext/matrix_float2x3_precision.hpp\"\n\n"}, {"path": "includes/glm/mat2x4.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat2x4.hpp\n\n#pragma once\n#include \"./ext/matrix_double2x4.hpp\"\n#include \"./ext/matrix_double2x4_precision.hpp\"\n#include \"./ext/matrix_float2x4.hpp\"\n#include \"./ext/matrix_float2x4_precision.hpp\"\n\n"}, {"path": "includes/glm/mat3x2.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat3x2.hpp\n\n#pragma once\n#include \"./ext/matrix_double3x2.hpp\"\n#include \"./ext/matrix_double3x2_precision.hpp\"\n#include \"./ext/matrix_float3x2.hpp\"\n#include \"./ext/matrix_float3x2_precision.hpp\"\n\n"}, {"path": "includes/glm/mat3x3.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat3x3.hpp\n\n#pragma once\n#include \"./ext/matrix_double3x3.hpp\"\n#include \"./ext/matrix_double3x3_precision.hpp\"\n#include \"./ext/matrix_float3x3.hpp\"\n#include \"./ext/matrix_float3x3_precision.hpp\"\n"}, {"path": "includes/glm/mat3x4.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat3x4.hpp\n\n#pragma once\n#include \"./ext/matrix_double3x4.hpp\"\n#include \"./ext/matrix_double3x4_precision.hpp\"\n#include \"./ext/matrix_float3x4.hpp\"\n#include \"./ext/matrix_float3x4_precision.hpp\"\n"}, {"path": "includes/glm/mat4x2.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat4x2.hpp\n\n#pragma once\n#include \"./ext/matrix_double4x2.hpp\"\n#include \"./ext/matrix_double4x2_precision.hpp\"\n#include \"./ext/matrix_float4x2.hpp\"\n#include \"./ext/matrix_float4x2_precision.hpp\"\n\n"}, {"path": "includes/glm/mat4x3.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat4x3.hpp\n\n#pragma once\n#include \"./ext/matrix_double4x3.hpp\"\n#include \"./ext/matrix_double4x3_precision.hpp\"\n#include \"./ext/matrix_float4x3.hpp\"\n#include \"./ext/matrix_float4x3_precision.hpp\"\n"}, {"path": "includes/glm/mat4x4.hpp", "language": "code", "loc": 7, "comment_density": 0.286, "code": "/// @ref core\n/// @file glm/mat4x4.hpp\n\n#pragma once\n#include \"./ext/matrix_double4x4.hpp\"\n#include \"./ext/matrix_double4x4_precision.hpp\"\n#include \"./ext/matrix_float4x4.hpp\"\n#include \"./ext/matrix_float4x4_precision.hpp\"\n\n"}, {"path": "includes/glm/matrix.hpp", "language": "code", "loc": 141, "comment_density": 0.461, "code": "/// @ref core\n/// @file glm/matrix.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n///\n/// @defgroup core_func_matrix Matrix functions\n/// @ingroup core\n///\n/// Provides GLSL matrix functions.\n///\n/// Include to use these core features.\n\n#pragma once\n\n// Dependencies\n#include \"detail/qualifier.hpp\"\n#include \"detail/setup.hpp\"\n#include \"vec2.hpp\"\n#include \"vec3.hpp\"\n#include \"vec4.hpp\"\n#include \"mat2x2.hpp\"\n#include \"mat2x3.hpp\"\n#include \"mat2x4.hpp\"\n#include \"mat3x2.hpp\"\n#include \"mat3x3.hpp\"\n#include \"mat3x4.hpp\"\n#include \"mat4x2.hpp\"\n#include \"mat4x3.hpp\"\n#include \"mat4x4.hpp\"\n\nnamespace glm {\nnamespace detail\n{\n\ttemplate\n\tstruct outerProduct_trait{};\n\n\ttemplate\n\tstruct outerProduct_trait<2, 2, T, Q>\n\t{\n\t\ttypedef mat<2, 2, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<2, 3, T, Q>\n\t{\n\t\ttypedef mat<3, 2, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<2, 4, T, Q>\n\t{\n\t\ttypedef mat<4, 2, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<3, 2, T, Q>\n\t{\n\t\ttypedef mat<2, 3, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<3, 3, T, Q>\n\t{\n\t\ttypedef mat<3, 3, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<3, 4, T, Q>\n\t{\n\t\ttypedef mat<4, 3, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<4, 2, T, Q>\n\t{\n\t\ttypedef mat<2, 4, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<4, 3, T, Q>\n\t{\n\t\ttypedef mat<3, 4, T, Q> type;\n\t};\n\n\ttemplate\n\tstruct outerProduct_trait<4, 4, T, Q>\n\t{\n\t\ttypedef mat<4, 4, T, Q> type;\n\t};\n}//namespace detail\n\n\t /// @addtogroup core_func_matrix\n\t /// @{\n\n\t /// Multiply matrix x by matrix y component-wise, i.e.,\n\t /// result[i][j] is the scalar product of x[i][j] and y[i][j].\n\t ///\n\t /// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t /// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t /// @tparam T Floating-point or signed integer scalar types\n\t /// @tparam Q Value from qualifier enum\n\t ///\n\t /// @see GLSL matrixCompMult man page\n\t /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL mat matrixCompMult(mat const& x, mat const& y);\n\n\t/// Treats the first parameter c as a column vector\n\t/// and the second parameter r as a row vector\n\t/// and does a linear algebraic matrix multiply c * r.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t/// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL outerProduct man page\n\t/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL typename detail::outerProduct_trait::type outerProduct(vec const& c, vec const& r);\n\n\t/// Returns the transposed matrix of x\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t/// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL transpose man page\n\t/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL typename mat::transpose_type transpose(mat const& x);\n\n\t/// Return the determinant of a squared matrix.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t/// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL determinant man page\n\t/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL T determinant(mat const& m);\n\n\t/// Return the inverse of a squared matrix.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number a column\n\t/// @tparam R Integer between 1 and 4 included that qualify the number a row\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL inverse man page\n\t/// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions\n\ttemplate\n\tGLM_FUNC_DECL mat inverse(mat const& m);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_matrix.inl\"\n"}, {"path": "includes/glm/packing.hpp", "language": "code", "loc": 156, "comment_density": 0.878, "code": "/// @ref core\n/// @file glm/packing.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n/// @see gtc_packing\n///\n/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions\n/// @ingroup core\n///\n/// Provides GLSL functions to pack and unpack half, single and double-precision floating point values into more compact integer types.\n///\n/// These functions do not operate component-wise, rather as described in each case.\n///\n/// Include to use these core features.\n\n#pragma once\n\n#include \"./ext/vector_uint2.hpp\"\n#include \"./ext/vector_float2.hpp\"\n#include \"./ext/vector_float4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_packing\n\t/// @{\n\n\t/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm2x16: round(clamp(c, 0, +1) * 65535.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see GLSL packUnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packUnorm2x16(vec2 const& v);\n\n\t/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm2x16: round(clamp(v, -1, +1) * 32767.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see GLSL packSnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packSnorm2x16(vec2 const& v);\n\n\t/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm4x8:\tround(clamp(c, 0, +1) * 255.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packUnorm4x8(vec4 const& v);\n\n\t/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm4x8:\tround(clamp(c, -1, +1) * 127.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packSnorm4x8(vec4 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm2x16: f / 65535.0\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see GLSL unpackUnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackUnorm2x16(uint p);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm2x16: clamp(f / 32767.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see GLSL unpackSnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackSnorm2x16(uint p);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm4x8: f / 255.0\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see GLSL unpackUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackUnorm4x8(uint p);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm4x8: clamp(f / 127.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackSnorm4x8(uint p);\n\n\t/// Returns a double-qualifier value obtained by packing the components of v into a 64-bit value.\n\t/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.\n\t/// Otherwise, the bit- level representation of v is preserved.\n\t/// The first vector component specifies the 32 least significant bits;\n\t/// the second component specifies the 32 most significant bits.\n\t///\n\t/// @see GLSL packDouble2x32 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL double packDouble2x32(uvec2 const& v);\n\n\t/// Returns a two-component unsigned integer vector representation of v.\n\t/// The bit-level representation of v is preserved.\n\t/// The first component of the vector contains the 32 least significant bits of the double;\n\t/// the second component consists the 32 most significant bits.\n\t///\n\t/// @see GLSL unpackDouble2x32 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uvec2 unpackDouble2x32(double v);\n\n\t/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification,\n\t/// and then packing these two 16- bit integers into a 32-bit unsigned integer.\n\t/// The first vector component specifies the 16 least-significant bits of the result;\n\t/// the second component specifies the 16 most-significant bits.\n\t///\n\t/// @see GLSL packHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint packHalf2x16(vec2 const& v);\n\n\t/// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values,\n\t/// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,\n\t/// and converting them to 32-bit floating-point values.\n\t/// The first component of the vector is obtained from the 16 least-significant bits of v;\n\t/// the second component is obtained from the 16 most-significant bits of v.\n\t///\n\t/// @see GLSL unpackHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackHalf2x16(uint v);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_packing.inl\"\n"}, {"path": "includes/glm/trigonometric.hpp", "language": "code", "loc": 190, "comment_density": 0.811, "code": "/// @ref core\n/// @file glm/trigonometric.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n///\n/// @defgroup core_func_trigonometric Angle and Trigonometry Functions\n/// @ingroup core\n///\n/// Function parameters specified as angle are assumed to be in units of radians.\n/// In no case will any of these functions result in a divide by zero error. If\n/// the divisor of a ratio is 0, then results will be undefined.\n///\n/// These all operate component-wise. The description is per component.\n///\n/// Include to use these core features.\n///\n/// @see ext_vector_trigonometric\n\n#pragma once\n\n#include \"detail/setup.hpp\"\n#include \"detail/qualifier.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_trigonometric\n\t/// @{\n\n\t/// Converts degrees to radians and returns the result.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL radians man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec radians(vec const& degrees);\n\n\t/// Converts radians to degrees and returns the result.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL degrees man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec degrees(vec const& radians);\n\n\t/// The standard trigonometric sine function.\n\t/// The values returned by this function will range from [-1, 1].\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL sin man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec sin(vec const& angle);\n\n\t/// The standard trigonometric cosine function.\n\t/// The values returned by this function will range from [-1, 1].\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL cos man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec cos(vec const& angle);\n\n\t/// The standard trigonometric tangent function.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL tan man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec tan(vec const& angle);\n\n\t/// Arc sine. Returns an angle whose sine is x.\n\t/// The range of values returned by this function is [-PI/2, PI/2].\n\t/// Results are undefined if |x| > 1.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL asin man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec asin(vec const& x);\n\n\t/// Arc cosine. Returns an angle whose sine is x.\n\t/// The range of values returned by this function is [0, PI].\n\t/// Results are undefined if |x| > 1.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL acos man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec acos(vec const& x);\n\n\t/// Arc tangent. Returns an angle whose tangent is y/x.\n\t/// The signs of x and y are used to determine what\n\t/// quadrant the angle is in. The range of values returned\n\t/// by this function is [-PI, PI]. Results are undefined\n\t/// if x and y are both 0.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL atan man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec atan(vec const& y, vec const& x);\n\n\t/// Arc tangent. Returns an angle whose tangent is y_over_x.\n\t/// The range of values returned by this function is [-PI/2, PI/2].\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL atan man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec atan(vec const& y_over_x);\n\n\t/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL sinh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec sinh(vec const& angle);\n\n\t/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL cosh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec cosh(vec const& angle);\n\n\t/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL tanh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec tanh(vec const& angle);\n\n\t/// Arc hyperbolic sine; returns the inverse of sinh.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL asinh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec asinh(vec const& x);\n\n\t/// Arc hyperbolic cosine; returns the non-negative inverse\n\t/// of cosh. Results are undefined if x < 1.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL acosh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec acosh(vec const& x);\n\n\t/// Arc hyperbolic tangent; returns the inverse of tanh.\n\t/// Results are undefined if abs(x) >= 1.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see GLSL atanh man page\n\t/// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions\n\ttemplate\n\tGLM_FUNC_DECL vec atanh(vec const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_trigonometric.inl\"\n"}, {"path": "includes/glm/vec2.hpp", "language": "code", "loc": 13, "comment_density": 0.154, "code": "/// @ref core\n/// @file glm/vec2.hpp\n\n#pragma once\n#include \"./ext/vector_bool2.hpp\"\n#include \"./ext/vector_bool2_precision.hpp\"\n#include \"./ext/vector_float2.hpp\"\n#include \"./ext/vector_float2_precision.hpp\"\n#include \"./ext/vector_double2.hpp\"\n#include \"./ext/vector_double2_precision.hpp\"\n#include \"./ext/vector_int2.hpp\"\n#include \"./ext/vector_int2_precision.hpp\"\n#include \"./ext/vector_uint2.hpp\"\n#include \"./ext/vector_uint2_precision.hpp\"\n"}, {"path": "includes/glm/vec3.hpp", "language": "code", "loc": 13, "comment_density": 0.154, "code": "/// @ref core\n/// @file glm/vec3.hpp\n\n#pragma once\n#include \"./ext/vector_bool3.hpp\"\n#include \"./ext/vector_bool3_precision.hpp\"\n#include \"./ext/vector_float3.hpp\"\n#include \"./ext/vector_float3_precision.hpp\"\n#include \"./ext/vector_double3.hpp\"\n#include \"./ext/vector_double3_precision.hpp\"\n#include \"./ext/vector_int3.hpp\"\n#include \"./ext/vector_int3_precision.hpp\"\n#include \"./ext/vector_uint3.hpp\"\n#include \"./ext/vector_uint3_precision.hpp\"\n"}, {"path": "includes/glm/vec4.hpp", "language": "code", "loc": 13, "comment_density": 0.154, "code": "/// @ref core\n/// @file glm/vec4.hpp\n\n#pragma once\n#include \"./ext/vector_bool4.hpp\"\n#include \"./ext/vector_bool4_precision.hpp\"\n#include \"./ext/vector_float4.hpp\"\n#include \"./ext/vector_float4_precision.hpp\"\n#include \"./ext/vector_double4.hpp\"\n#include \"./ext/vector_double4_precision.hpp\"\n#include \"./ext/vector_int4.hpp\"\n#include \"./ext/vector_int4_precision.hpp\"\n#include \"./ext/vector_uint4.hpp\"\n#include \"./ext/vector_uint4_precision.hpp\"\n\n"}, {"path": "includes/glm/vector_relational.hpp", "language": "code", "loc": 107, "comment_density": 0.776, "code": "/// @ref core\n/// @file glm/vector_relational.hpp\n///\n/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n///\n/// @defgroup core_func_vector_relational Vector Relational Functions\n/// @ingroup core\n///\n/// Relational and equality operators (<, <=, >, >=, ==, !=) are defined to\n/// operate on scalars and produce scalar Boolean results. For vector results,\n/// use the following built-in functions.\n///\n/// In all cases, the sizes of all the input and return vectors for any particular\n/// call must match.\n///\n/// Include to use these core features.\n///\n/// @see ext_vector_relational\n\n#pragma once\n\n#include \"detail/qualifier.hpp\"\n#include \"detail/setup.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_func_vector_relational\n\t/// @{\n\n\t/// Returns the component-wise comparison result of x < y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point or integer scalar type.\n\t///\n\t/// @see GLSL lessThan man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec lessThan(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x <= y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point or integer scalar type.\n\t///\n\t/// @see GLSL lessThanEqual man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec lessThanEqual(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x > y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point or integer scalar type.\n\t///\n\t/// @see GLSL greaterThan man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec greaterThan(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x >= y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point or integer scalar type.\n\t///\n\t/// @see GLSL greaterThanEqual man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec greaterThanEqual(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x == y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point, integer or bool scalar type.\n\t///\n\t/// @see GLSL equal man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y);\n\n\t/// Returns the component-wise comparison of result x != y.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t/// @tparam T A floating-point, integer or bool scalar type.\n\t///\n\t/// @see GLSL notEqual man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y);\n\n\t/// Returns true if any component of x is true.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL any man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool any(vec const& v);\n\n\t/// Returns true if all components of x are true.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL all man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool all(vec const& v);\n\n\t/// Returns the component-wise logical complement of x.\n\t/// /!\\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.\n\t///\n\t/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.\n\t///\n\t/// @see GLSL not man page\n\t/// @see GLSL 4.20.8 specification, section 8.7 Vector Relational Functions\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec not_(vec const& v);\n\n\t/// @}\n}//namespace glm\n\n#include \"detail/func_vector_relational.inl\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.426, "dedup_hash": "0f3aebc699d157f0", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_detail", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Detail", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/detail/_features.hpp", "language": "code", "loc": 295, "comment_density": 0.631, "code": "#pragma once\n\n// #define GLM_CXX98_EXCEPTIONS\n// #define GLM_CXX98_RTTI\n\n// #define GLM_CXX11_RVALUE_REFERENCES\n// Rvalue references - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html\n\n// GLM_CXX11_TRAILING_RETURN\n// Rvalue references for *this - GCC not supported\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm\n\n// GLM_CXX11_NONSTATIC_MEMBER_INIT\n// Initialization of class objects by rvalues - GCC any\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1610.html\n\n// GLM_CXX11_NONSTATIC_MEMBER_INIT\n// Non-static data member initializers - GCC 4.7\n// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2756.htm\n\n// #define GLM_CXX11_VARIADIC_TEMPLATE\n// Variadic templates - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf\n\n//\n// Extending variadic template template parameters - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf\n\n// #define GLM_CXX11_GENERALIZED_INITIALIZERS\n// Initializer lists - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm\n\n// #define GLM_CXX11_STATIC_ASSERT\n// Static assertions - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html\n\n// #define GLM_CXX11_AUTO_TYPE\n// auto-typed variables - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf\n\n// #define GLM_CXX11_AUTO_TYPE\n// Multi-declarator auto - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1737.pdf\n\n// #define GLM_CXX11_AUTO_TYPE\n// Removal of auto as a storage-class specifier - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2546.htm\n\n// #define GLM_CXX11_AUTO_TYPE\n// New function declarator syntax - GCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm\n\n// #define GLM_CXX11_LAMBDAS\n// New wording for C++0x lambdas - GCC 4.5\n// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf\n\n// #define GLM_CXX11_DECLTYPE\n// Declared type of an expression - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf\n\n//\n// Right angle brackets - GCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html\n\n//\n// Default template arguments for function templates\tDR226\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226\n\n//\n// Solving the SFINAE problem for expressions\tDR339\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html\n\n// #define GLM_CXX11_ALIAS_TEMPLATE\n// Template aliases\tN2258\tGCC 4.7\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf\n\n//\n// Extern templates\tN1987\tYes\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm\n\n// #define GLM_CXX11_NULLPTR\n// Null pointer constant\tN2431\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf\n\n// #define GLM_CXX11_STRONG_ENUMS\n// Strongly-typed enums\tN2347\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf\n\n//\n// Forward declarations for enums\tN2764\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf\n\n//\n// Generalized attributes\tN2761\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf\n\n//\n// Generalized constant expressions\tN2235\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf\n\n//\n// Alignment support\tN2341\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf\n\n// #define GLM_CXX11_DELEGATING_CONSTRUCTORS\n// Delegating constructors\tN1986\tGCC 4.7\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf\n\n//\n// Inheriting constructors\tN2540\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm\n\n// #define GLM_CXX11_EXPLICIT_CONVERSIONS\n// Explicit conversion operators\tN2437\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf\n\n//\n// New character types\tN2249\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html\n\n//\n// Unicode string literals\tN2442\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm\n\n//\n// Raw string literals\tN2442\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm\n\n//\n// Universal character name literals\tN2170\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html\n\n// #define GLM_CXX11_USER_LITERALS\n// User-defined literals\t\tN2765\tGCC 4.7\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf\n\n//\n// Standard Layout Types\tN2342\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm\n\n// #define GLM_CXX11_DEFAULTED_FUNCTIONS\n// #define GLM_CXX11_DELETED_FUNCTIONS\n// Defaulted and deleted functions\tN2346\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm\n\n//\n// Extended friend declarations\tN1791\tGCC 4.7\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf\n\n//\n// Extending sizeof\tN2253\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html\n\n// #define GLM_CXX11_INLINE_NAMESPACES\n// Inline namespaces\tN2535\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm\n\n// #define GLM_CXX11_UNRESTRICTED_UNIONS\n// Unrestricted unions\tN2544\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf\n\n// #define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS\n// Local and unnamed types as template arguments\tN2657\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm\n\n// #define GLM_CXX11_RANGE_FOR\n// Range-based for\tN2930\tGCC 4.6\n// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html\n\n// #define GLM_CXX11_OVERRIDE_CONTROL\n// Explicit virtual overrides\tN2928 N3206 N3272\tGCC 4.7\n// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm\n\n//\n// Minimal support for garbage collection and reachability-based leak detection\tN2670\tNo\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm\n\n// #define GLM_CXX11_NOEXCEPT\n// Allowing move constructors to throw [noexcept]\tN3050\tGCC 4.6 (core language only)\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html\n\n//\n// Defining move special member functions\tN3053\tGCC 4.6\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html\n\n//\n// Sequence points\tN2239\tYes\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html\n\n//\n// Atomic operations\tN2427\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html\n\n//\n// Strong Compare and Exchange\tN2748\tGCC 4.5\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html\n\n//\n// Bidirectional Fences\tN2752\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm\n\n//\n// Memory model\tN2429\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2429.htm\n\n//\n// Data-dependency ordering: atomics and memory model\tN2664\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2664.htm\n\n//\n// Propagating exceptions\tN2179\tGCC 4.4\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html\n\n//\n// Abandoning a process and at_quick_exit\tN2440\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2440.htm\n\n//\n// Allow atomics use in signal handlers\tN2547\tYes\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm\n\n//\n// Thread-local storage\tN2659\tGCC 4.8\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm\n\n//\n// Dynamic initialization and destruction with concurrency\tN2660\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm\n\n//\n// __func__ predefined identifier\tN2340\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm\n\n//\n// C99 preprocessor\tN1653\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm\n\n//\n// long long\tN1811\tGCC 4.3\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf\n\n//\n// Extended integral types\tN1988\tYes\n// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1988.pdf\n\n#if(GLM_COMPILER & GLM_COMPILER_GCC)\n\n#\tdefine GLM_CXX11_STATIC_ASSERT\n\n#elif(GLM_COMPILER & GLM_COMPILER_CLANG)\n#\tif(__has_feature(cxx_exceptions))\n#\t\tdefine GLM_CXX98_EXCEPTIONS\n#\tendif\n\n#\tif(__has_feature(cxx_rtti))\n#\t\tdefine GLM_CXX98_RTTI\n#\tendif\n\n#\tif(__has_feature(cxx_access_control_sfinae))\n#\t\tdefine GLM_CXX11_ACCESS_CONTROL_SFINAE\n#\tendif\n\n#\tif(__has_feature(cxx_alias_templates))\n#\t\tdefine GLM_CXX11_ALIAS_TEMPLATE\n#\tendif\n\n#\tif(__has_feature(cxx_alignas))\n#\t\tdefine GLM_CXX11_ALIGNAS\n#\tendif\n\n#\tif(__has_feature(cxx_attributes))\n#\t\tdefine GLM_CXX11_ATTRIBUTES\n#\tendif\n\n#\tif(__has_feature(cxx_constexpr))\n#\t\tdefine GLM_CXX11_CONSTEXPR\n#\tendif\n\n#\tif(__has_feature(cxx_decltype))\n#\t\tdefine GLM_CXX11_DECLTYPE\n#\tendif\n\n#\tif(__has_feature(cxx_default_function_template_args))\n#\t\tdefine GLM_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS\n#\tendif\n\n#\tif(__has_feature(cxx_defaulted_functions))\n#\t\tdefine GLM_CXX11_DEFAULTED_FUNCTIONS\n#\tendif\n\n#\tif(__has_feature(cxx_delegating_constructors))\n#\t\tdefine GLM_CXX11_DELEGATING_CONSTRUCTORS\n#\tendif\n\n#\tif(__has_feature(cxx_deleted_functions))\n#\t\tdefine GLM_CXX11_DELETED_FUNCTIONS\n#\tendif\n\n#\tif(__has_feature(cxx_explicit_conversions))\n#\t\tdefine GLM_CXX11_EXPLICIT_CONVERSIONS\n#\tendif\n\n#\tif(__has_feature(cxx_generalized_initializers))\n#\t\tdefine GLM_CXX11_GENERALIZED_INITIALIZERS\n#\tendif\n\n#\tif(__has_feature(cxx_implicit_moves))\n#\t\tdefine GLM_CXX11_IMPLICIT_MOVES\n#\tendif\n\n#\tif(__has_feature(cxx_inheriting_constructors))\n#\t\tdefine GLM_CXX11_INHERITING_CONSTRUCTORS\n#\tendif\n\n#\tif(__has_feature(cxx_inline_namespaces))\n#\t\tdefine GLM_CXX11_INLINE_NAMESPACES\n#\tendif\n\n#\tif(__has_feature(cxx_lambdas))\n#\t\tdefine GLM_CXX11_LAMBDAS\n#\tendif\n\n#\tif(__has_feature(cxx_local_type_template_args))\n#\t\tdefine GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS\n#\tendif\n\n#\tif(__has_feature(cxx_noexcept))\n#\t\tdefine GLM_CXX11_NOEXCEPT\n#\tendif\n\n#\tif(__has_feature(cxx_nonstatic_member_init))\n#\t\tdefine GLM_CXX11_NONSTATIC_MEMBER_INIT\n#\tendif\n\n#\tif(__has_feature(cxx_nullptr))\n#\t\tdefine GLM_CXX11_NULLPTR\n#\tendif\n\n#\tif(__has_feature(cxx_override_control))\n#\t\tdefine GLM_CXX11_OVERRIDE_CONTROL\n#\tendif\n\n#\tif(__has_feature(cxx_reference_qualified_functions))\n#\t\tdefine GLM_CXX11_REFERENCE_QUALIFIED_FUNCTIONS\n#\tendif\n\n#\tif(__has_feature(cxx_range_for))\n#\t\tdefine GLM_CXX11_RANGE_FOR\n#\tendif\n\n#\tif(__has_feature(cxx_raw_string_literals))\n#\t\tdefine GLM_CXX11_RAW_STRING_LITERALS\n#\tendif\n\n#\tif(__has_feature(cxx_rvalue_references))\n#\t\tdefine GLM_CXX11_RVALUE_REFERENCES\n#\tendif\n\n#\tif(__has_feature(cxx_static_assert))\n#\t\tdefine GLM_CXX11_STATIC_ASSERT\n#\tendif\n\n#\tif(__has_feature(cxx_auto_type))\n#\t\tdefine GLM_CXX11_AUTO_TYPE\n#\tendif\n\n#\tif(__has_feature(cxx_strong_enums))\n#\t\tdefine GLM_CXX11_STRONG_ENUMS\n#\tendif\n\n#\tif(__has_feature(cxx_trailing_return))\n#\t\tdefine GLM_CXX11_TRAILING_RETURN\n#\tendif\n\n#\tif(__has_feature(cxx_unicode_literals))\n#\t\tdefine GLM_CXX11_UNICODE_LITERALS\n#\tendif\n\n#\tif(__has_feature(cxx_unrestricted_unions))\n#\t\tdefine GLM_CXX11_UNRESTRICTED_UNIONS\n#\tendif\n\n#\tif(__has_feature(cxx_user_literals))\n#\t\tdefine GLM_CXX11_USER_LITERALS\n#\tendif\n\n#\tif(__has_feature(cxx_variadic_templates))\n#\t\tdefine GLM_CXX11_VARIADIC_TEMPLATES\n#\tendif\n\n#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)\n"}, {"path": "includes/glm/detail/_fixes.hpp", "language": "code", "loc": 21, "comment_density": 0.238, "code": "#include \n\n//! Workaround for compatibility with other libraries\n#ifdef max\n#undef max\n#endif\n\n//! Workaround for compatibility with other libraries\n#ifdef min\n#undef min\n#endif\n\n//! Workaround for Android\n#ifdef isnan\n#undef isnan\n#endif\n\n//! Workaround for Android\n#ifdef isinf\n#undef isinf\n#endif\n\n//! Workaround for Chrome Native Client\n#ifdef log2\n#undef log2\n#endif\n\n"}, {"path": "includes/glm/detail/_noise.hpp", "language": "code", "loc": 67, "comment_density": 0.03, "code": "#pragma once\n\n#include \"../common.hpp\"\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate\n\tGLM_FUNC_QUALIFIER T mod289(T const& x)\n\t{\n\t\treturn x - floor(x * (static_cast(1.0) / static_cast(289.0))) * static_cast(289.0);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER T permute(T const& x)\n\t{\n\t\treturn mod289(((x * static_cast(34)) + static_cast(1)) * x);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<2, T, Q> permute(vec<2, T, Q> const& x)\n\t{\n\t\treturn mod289(((x * static_cast(34)) + static_cast(1)) * x);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<3, T, Q> permute(vec<3, T, Q> const& x)\n\t{\n\t\treturn mod289(((x * static_cast(34)) + static_cast(1)) * x);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<4, T, Q> permute(vec<4, T, Q> const& x)\n\t{\n\t\treturn mod289(((x * static_cast(34)) + static_cast(1)) * x);\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r)\n\t{\n\t\treturn static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r)\n\t{\n\t\treturn static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r)\n\t{\n\t\treturn static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r)\n\t{\n\t\treturn static_cast(1.79284291400159) - static_cast(0.85373472095314) * r;\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t)\n\t{\n\t\treturn (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t)\n\t{\n\t\treturn (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));\n\t}\n\n\ttemplate\n\tGLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t)\n\t{\n\t\treturn (t * t * t) * (t * (t * static_cast(6) - static_cast(15)) + static_cast(10));\n\t}\n}//namespace detail\n}//namespace glm\n\n"}, {"path": "includes/glm/detail/_swizzle.hpp", "language": "code", "loc": 757, "comment_density": 0.073, "code": "#pragma once\n\nnamespace glm{\nnamespace detail\n{\n\t// Internal class for implementing swizzle operators\n\ttemplate\n\tstruct _swizzle_base0\n\t{\n\tprotected:\n\t\tGLM_FUNC_QUALIFIER T& elem(size_t i){ return (reinterpret_cast(_buffer))[i]; }\n\t\tGLM_FUNC_QUALIFIER T const& elem(size_t i) const{ return (reinterpret_cast(_buffer))[i]; }\n\n\t\t// Use an opaque buffer to *ensure* the compiler doesn't call a constructor.\n\t\t// The size 1 buffer is assumed to aligned to the actual members so that the\n\t\t// elem()\n\t\tchar _buffer[1];\n\t};\n\n\ttemplate\n\tstruct _swizzle_base1 : public _swizzle_base0\n\t{\n\t};\n\n\ttemplate\n\tstruct _swizzle_base1<2, T, Q, E0,E1,-1,-2, Aligned> : public _swizzle_base0\n\t{\n\t\tGLM_FUNC_QUALIFIER vec<2, T, Q> operator ()() const { return vec<2, T, Q>(this->elem(E0), this->elem(E1)); }\n\t};\n\n\ttemplate\n\tstruct _swizzle_base1<3, T, Q, E0,E1,E2,-1, Aligned> : public _swizzle_base0\n\t{\n\t\tGLM_FUNC_QUALIFIER vec<3, T, Q> operator ()() const { return vec<3, T, Q>(this->elem(E0), this->elem(E1), this->elem(E2)); }\n\t};\n\n\ttemplate\n\tstruct _swizzle_base1<4, T, Q, E0,E1,E2,E3, Aligned> : public _swizzle_base0\n\t{\n\t\tGLM_FUNC_QUALIFIER vec<4, T, Q> operator ()() const { return vec<4, T, Q>(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); }\n\t};\n\n\t// Internal class for implementing swizzle operators\n\t/*\n\t\tTemplate parameters:\n\n\t\tT\t\t\t= type of scalar values (e.g. float, double)\n\t\tN\t\t\t= number of components in the vector (e.g. 3)\n\t\tE0...3\t\t= what index the n-th element of this swizzle refers to in the unswizzled vec\n\n\t\tDUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles\n\t\t\tcontaining duplicate elements so that they cannot be used as r-values).\n\t*/\n\ttemplate\n\tstruct _swizzle_base2 : public _swizzle_base1::value>\n\t{\n\t\tstruct op_equal\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e = t; }\n\t\t};\n\n\t\tstruct op_minus\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e -= t; }\n\t\t};\n\n\t\tstruct op_plus\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e += t; }\n\t\t};\n\n\t\tstruct op_mul\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e *= t; }\n\t\t};\n\n\t\tstruct op_div\n\t\t{\n\t\t\tGLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e /= t; }\n\t\t};\n\n\tpublic:\n\t\tGLM_FUNC_QUALIFIER _swizzle_base2& operator= (const T& t)\n\t\t{\n\t\t\tfor (int i = 0; i < N; ++i)\n\t\t\t\t(*this)[i] = t;\n\t\t\treturn *this;\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER _swizzle_base2& operator= (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_equal());\n\t\t\treturn *this;\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER void operator -= (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_minus());\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER void operator += (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_plus());\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER void operator *= (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_mul());\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER void operator /= (vec const& that)\n\t\t{\n\t\t\t_apply_op(that, op_div());\n\t\t}\n\n\t\tGLM_FUNC_QUALIFIER T& operator[](size_t i)\n\t\t{\n\t\t\tconst int offset_dst[4] = { E0, E1, E2, E3 };\n\t\t\treturn this->elem(offset_dst[i]);\n\t\t}\n\t\tGLM_FUNC_QUALIFIER T operator[](size_t i) const\n\t\t{\n\t\t\tconst int offset_dst[4] = { E0, E1, E2, E3 };\n\t\t\treturn this->elem(offset_dst[i]);\n\t\t}\n\n\tprotected:\n\t\ttemplate\n\t\tGLM_FUNC_QUALIFIER void _apply_op(vec const& that, const U& op)\n\t\t{\n\t\t\t// Make a copy of the data in this == &that.\n\t\t\t// The copier should optimize out the copy in cases where the function is\n\t\t\t// properly inlined and the copy is not necessary.\n\t\t\tT t[N];\n\t\t\tfor (int i = 0; i < N; ++i)\n\t\t\t\tt[i] = that[i];\n\t\t\tfor (int i = 0; i < N; ++i)\n\t\t\t\top( (*this)[i], t[i] );\n\t\t}\n\t};\n\n\t// Specialization for swizzles containing duplicate elements. These cannot be modified.\n\ttemplate\n\tstruct _swizzle_base2 : public _swizzle_base1::value>\n\t{\n\t\tstruct Stub {};\n\n\t\tGLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const&) { return *this; }\n\n\t\tGLM_FUNC_QUALIFIER T operator[] (size_t i) const\n\t\t{\n\t\t\tconst int offset_dst[4] = { E0, E1, E2, E3 };\n\t\t\treturn this->elem(offset_dst[i]);\n\t\t}\n\t};\n\n\ttemplate\n\tstruct _swizzle : public _swizzle_base2\n\t{\n\t\ttypedef _swizzle_base2 base_type;\n\n\t\tusing base_type::operator=;\n\n\t\tGLM_FUNC_QUALIFIER operator vec () const { return (*this)(); }\n\t};\n\n//\n// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros\n//\n#define GLM_SWIZZLE_TEMPLATE1 template\n#define GLM_SWIZZLE_TEMPLATE2 template\n#define GLM_SWIZZLE_TYPE1 _swizzle\n#define GLM_SWIZZLE_TYPE2 _swizzle\n\n//\n// Wrapper for a binary operator (e.g. u.yy + v.zy)\n//\n#define GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \\\n\tGLM_SWIZZLE_TEMPLATE2 \\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE2& b) \\\n\t{ \\\n\t\treturn a() OPERAND b(); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const GLM_SWIZZLE_TYPE1& a, const vec& b) \\\n\t{ \\\n\t\treturn a() OPERAND b; \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const vec& a, const GLM_SWIZZLE_TYPE1& b) \\\n\t{ \\\n\t\treturn a OPERAND b(); \\\n\t}\n\n//\n// Wrapper for a operand between a swizzle and a binary (e.g. 1.0f - u.xyz)\n//\n#define GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND)\t\t\t\t\t\t\t\t\\\n\tGLM_SWIZZLE_TEMPLATE1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const GLM_SWIZZLE_TYPE1& a, const T& b)\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn a() OPERAND b;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_SWIZZLE_TEMPLATE1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_FUNC_QUALIFIER vec operator OPERAND ( const T& a, const GLM_SWIZZLE_TYPE1& b)\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn a OPERAND b();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t}\n\n//\n// Macro for wrapping a function taking one argument (e.g. abs())\n//\n#define GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION)\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_SWIZZLE_TEMPLATE1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a)\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn FUNCTION(a());\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t}\n\n//\n// Macro for wrapping a function taking two vector arguments (e.g. dot()).\n//\n#define GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \\\n\tGLM_SWIZZLE_TEMPLATE2 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE2& b) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b()); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE1& b) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b()); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const typename V& b) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const GLM_SWIZZLE_TYPE1& b) \\\n\t{ \\\n\t\treturn FUNCTION(a, b()); \\\n\t}\n\n//\n// Macro for wrapping a function take 2 vec arguments followed by a scalar (e.g. mix()).\n//\n#define GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \\\n\tGLM_SWIZZLE_TEMPLATE2 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE2& b, const T& c) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b(), c); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const GLM_SWIZZLE_TYPE1& b, const T& c) \\\n\t{ \\\n\t\treturn FUNCTION(a(), b(), c); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\\\n\t{ \\\n\t\treturn FUNCTION(a(), b, c); \\\n\t} \\\n\tGLM_SWIZZLE_TEMPLATE1 \\\n\tGLM_FUNC_QUALIFIER typename GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const GLM_SWIZZLE_TYPE1& b, const T& c) \\\n\t{ \\\n\t\treturn FUNCTION(a, b(), c); \\\n\t}\n\n}//namespace detail\n}//namespace glm\n\nnamespace glm\n{\n\tnamespace detail\n\t{\n\t\tGLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-)\n\t\tGLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*)\n\t\tGLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+)\n\t\tGLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-)\n\t\tGLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*)\n\t\tGLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/)\n\t}\n\n\t//\n\t// Swizzles are distinct types from the unswizzled type. The below macros will\n\t// provide template specializations for the swizzle types for the given functions\n\t// so that the compiler does not have any ambiguity to choosing how to handle\n\t// the function.\n\t//\n\t// The alternative is to use the operator()() when calling the function in order\n\t// to explicitly convert the swizzled type to the unswizzled type.\n\t//\n\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs);\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos);\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh);\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all);\n\t//GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any);\n\n\t//GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot);\n\t//GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross);\n\t//GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step);\n\t//GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix);\n}\n\n#define GLM_SWIZZLE2_2_MEMBERS(T, Q, E0,E1) \\\n\tstruct { detail::_swizzle<2, T, Q, 0,0,-1,-2> E0 ## E0; }; \\\n\tstruct { detail::_swizzle<2, T, Q, 0,1,-1,-2> E0 ## E1; }; \\\n\tstruct { detail::_swizzle<2, T, Q, 1,0,-1,-2> E1 ## E0; }; \\\n\tstruct { detail::_swizzle<2, T, Q, 1,1,-1,-2> E1 ## E1; };\n\n#define GLM_SWIZZLE2_3_MEMBERS(T, Q, E0,E1) \\\n\tstruct { detail::_swizzle<3,T, Q, 0,0,0,-1> E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 0,0,1,-1> E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 0,1,0,-1> E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 0,1,1,-1> E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 1,0,0,-1> E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 1,0,1,-1> E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 1,1,0,-1> E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3,T, Q, 1,1,1,-1> E1 ## E1 ## E1; };\n\n#define GLM_SWIZZLE2_4_MEMBERS(T, Q, E0,E1) \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,1> E1 ## E1 ## E1 ## E1; };\n\n#define GLM_SWIZZLE3_2_MEMBERS(T, Q, E0,E1,E2) \\\n\tstruct { detail::_swizzle<2,T, Q, 0,0,-1,-2> E0 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,1,-1,-2> E0 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,2,-1,-2> E0 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,0,-1,-2> E1 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,1,-1,-2> E1 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,2,-1,-2> E1 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,0,-1,-2> E2 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,1,-1,-2> E2 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,2,-1,-2> E2 ## E2; };\n\n#define GLM_SWIZZLE3_3_MEMBERS(T, Q ,E0,E1,E2) \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,0,-1> E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,1,-1> E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,2,-1> E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,0,-1> E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,1,-1> E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,2,-1> E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,0,-1> E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,1,-1> E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,2,-1> E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,0,-1> E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,1,-1> E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,2,-1> E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,0,-1> E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,1,-1> E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,2,-1> E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,0,-1> E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,1,-1> E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,2,-1> E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,0,-1> E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,1,-1> E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,2,-1> E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,0,-1> E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,1,-1> E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,2,-1> E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,0,-1> E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,1,-1> E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,2,-1> E2 ## E2 ## E2; };\n\n#define GLM_SWIZZLE3_4_MEMBERS(T, Q, E0,E1,E2) \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4,T, Q, 2,2,2,2> E2 ## E2 ## E2 ## E2; };\n\n#define GLM_SWIZZLE4_2_MEMBERS(T, Q, E0,E1,E2,E3) \\\n\tstruct { detail::_swizzle<2,T, Q, 0,0,-1,-2> E0 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,1,-1,-2> E0 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,2,-1,-2> E0 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 0,3,-1,-2> E0 ## E3; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,0,-1,-2> E1 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,1,-1,-2> E1 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,2,-1,-2> E1 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 1,3,-1,-2> E1 ## E3; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,0,-1,-2> E2 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,1,-1,-2> E2 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,2,-1,-2> E2 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 2,3,-1,-2> E2 ## E3; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 3,0,-1,-2> E3 ## E0; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 3,1,-1,-2> E3 ## E1; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 3,2,-1,-2> E3 ## E2; }; \\\n\tstruct { detail::_swizzle<2,T, Q, 3,3,-1,-2> E3 ## E3; };\n\n#define GLM_SWIZZLE4_3_MEMBERS(T, Q, E0,E1,E2,E3) \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,0,-1> E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,1,-1> E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,2,-1> E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,0,3,-1> E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,0,-1> E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,1,-1> E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,2,-1> E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,1,3,-1> E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,0,-1> E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,1,-1> E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,2,-1> E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,2,3,-1> E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,3,0,-1> E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,3,1,-1> E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,3,2,-1> E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 0,3,3,-1> E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,0,-1> E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,1,-1> E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,2,-1> E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,0,3,-1> E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,0,-1> E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,1,-1> E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,2,-1> E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,1,3,-1> E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,0,-1> E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,1,-1> E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,2,-1> E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,2,3,-1> E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,3,0,-1> E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,3,1,-1> E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,3,2,-1> E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 1,3,3,-1> E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,0,-1> E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,1,-1> E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,2,-1> E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,0,3,-1> E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,0,-1> E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,1,-1> E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,2,-1> E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,1,3,-1> E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,0,-1> E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,1,-1> E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,2,-1> E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,2,3,-1> E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,3,0,-1> E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,3,1,-1> E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,3,2,-1> E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 2,3,3,-1> E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,0,0,-1> E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,0,1,-1> E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,0,2,-1> E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,0,3,-1> E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,1,0,-1> E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,1,1,-1> E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,1,2,-1> E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,1,3,-1> E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,2,0,-1> E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,2,1,-1> E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,2,2,-1> E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,2,3,-1> E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,3,0,-1> E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,3,1,-1> E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,3,2,-1> E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<3, T, Q, 3,3,3,-1> E3 ## E3 ## E3; };\n\n#define GLM_SWIZZLE4_4_MEMBERS(T, Q, E0,E1,E2,E3) \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,0,3> E0 ## E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,1,3> E0 ## E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,2,3> E0 ## E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,3,0> E0 ## E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,3,1> E0 ## E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,3,2> E0 ## E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,0,3,3> E0 ## E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,0,3> E0 ## E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,1,3> E0 ## E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,2,3> E0 ## E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,3,0> E0 ## E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,3,1> E0 ## E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,3,2> E0 ## E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,1,3,3> E0 ## E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,0,3> E0 ## E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,1,3> E0 ## E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,2,3> E0 ## E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,3,0> E0 ## E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,0,3> E1 ## E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,1,3> E1 ## E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,2,3> E1 ## E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,3,0> E1 ## E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,3,1> E1 ## E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,3,2> E1 ## E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,0,3,3> E1 ## E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,0,3> E1 ## E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,1,3> E1 ## E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,2,3> E1 ## E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,3,0> E1 ## E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,3,1> E1 ## E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,3,2> E1 ## E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,1,3,3> E1 ## E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,0,3> E1 ## E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,1,3> E1 ## E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,2,3> E1 ## E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,3,0> E1 ## E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,3,1> E1 ## E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,3,2> E1 ## E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,2,3,3> E1 ## E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,0,0> E1 ## E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,0,1> E1 ## E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,0,2> E1 ## E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,0,3> E1 ## E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,1,0> E1 ## E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,1,1> E1 ## E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,1,2> E1 ## E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,1,3> E1 ## E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,2,0> E1 ## E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,2,1> E1 ## E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,2,2> E1 ## E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,2,3> E1 ## E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,3,0> E1 ## E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,3,1> E1 ## E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,3,2> E1 ## E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 1,3,3,3> E1 ## E3 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,0,3> E2 ## E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,1,3> E2 ## E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,2,3> E2 ## E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,3,0> E2 ## E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,3,1> E2 ## E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,3,2> E2 ## E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,0,3,3> E2 ## E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,0,3> E2 ## E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,1,3> E2 ## E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,2,3> E2 ## E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,3,0> E2 ## E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,3,1> E2 ## E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,3,2> E2 ## E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,1,3,3> E2 ## E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,0,3> E2 ## E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,1,3> E2 ## E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,2,3> E2 ## E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,3,0> E2 ## E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,3,1> E2 ## E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,3,2> E2 ## E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,2,3,3> E2 ## E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,0,0> E2 ## E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,0,1> E2 ## E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,0,2> E2 ## E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,0,3> E2 ## E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,1,0> E2 ## E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,1,1> E2 ## E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,1,2> E2 ## E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,1,3> E2 ## E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,2,0> E2 ## E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,2,1> E2 ## E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,2,2> E2 ## E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,2,3> E2 ## E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,3,0> E2 ## E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,3,1> E2 ## E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,3,2> E2 ## E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 2,3,3,3> E2 ## E3 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,0,0> E3 ## E0 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,0,1> E3 ## E0 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,0,2> E3 ## E0 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,0,3> E3 ## E0 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,1,0> E3 ## E0 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,1,1> E3 ## E0 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,1,2> E3 ## E0 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,1,3> E3 ## E0 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,2,0> E3 ## E0 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,2,1> E3 ## E0 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,2,2> E3 ## E0 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,2,3> E3 ## E0 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,3,0> E3 ## E0 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,3,1> E3 ## E0 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,3,2> E3 ## E0 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,0,3,3> E3 ## E0 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,0,0> E3 ## E1 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,0,1> E3 ## E1 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,0,2> E3 ## E1 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,0,3> E3 ## E1 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,1,0> E3 ## E1 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,1,1> E3 ## E1 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,1,2> E3 ## E1 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,1,3> E3 ## E1 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,2,0> E3 ## E1 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,2,1> E3 ## E1 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,2,2> E3 ## E1 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,2,3> E3 ## E1 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,3,0> E3 ## E1 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,3,1> E3 ## E1 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,3,2> E3 ## E1 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,1,3,3> E3 ## E1 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,0,0> E3 ## E2 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,0,1> E3 ## E2 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,0,2> E3 ## E2 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,0,3> E3 ## E2 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,1,0> E3 ## E2 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,1,1> E3 ## E2 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,1,2> E3 ## E2 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,1,3> E3 ## E2 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,2,0> E3 ## E2 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,2,1> E3 ## E2 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,2,2> E3 ## E2 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,2,3> E3 ## E2 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,3,0> E3 ## E2 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,3,1> E3 ## E2 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,3,2> E3 ## E2 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,2,3,3> E3 ## E2 ## E3 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,0,0> E3 ## E3 ## E0 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,0,1> E3 ## E3 ## E0 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,0,2> E3 ## E3 ## E0 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,0,3> E3 ## E3 ## E0 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,1,0> E3 ## E3 ## E1 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,1,1> E3 ## E3 ## E1 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,1,2> E3 ## E3 ## E1 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,1,3> E3 ## E3 ## E1 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,2,0> E3 ## E3 ## E2 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,2,1> E3 ## E3 ## E2 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,2,2> E3 ## E3 ## E2 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,2,3> E3 ## E3 ## E2 ## E3; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \\\n\tstruct { detail::_swizzle<4, T, Q, 3,3,3,3> E3 ## E3 ## E3 ## E3; };\n"}, {"path": "includes/glm/detail/_swizzle_func.hpp", "language": "code", "loc": 648, "comment_density": 0.0, "code": "#pragma once\n\n#define GLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, CONST, A, B)\t\\\n\tvec<2, T, Q> A ## B() CONST\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<2, T, Q>(this->A, this->B);\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, CONST, A, B, C)\t\t\\\n\tvec<3, T, Q> A ## B ## C() CONST\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<3, T, Q>(this->A, this->B, this->C);\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, CONST, A, B, C, D)\t\t\t\t\t\\\n\tvec<4, T, Q> A ## B ## C ## D() CONST\t\t\t\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<4, T, Q>(this->A, this->B, this->C, this->D);\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(T, P, L, CONST, A, B)\t\\\n\ttemplate\t\t\t\t\t\t\t\t\t\t\\\n\tvec vec::A ## B() CONST\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<2, T, Q>(this->A, this->B);\t\t\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC3_ENTRY_DEF(T, P, L, CONST, A, B, C)\t\t\\\n\ttemplate\t\t\t\t\t\t\t\t\t\t\t\\\n\tvec<3, T, Q> vec::A ## B ## C() CONST\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<3, T, Q>(this->A, this->B, this->C);\t\t\t\t\\\n\t}\n\n#define GLM_SWIZZLE_GEN_VEC4_ENTRY_DEF(T, P, L, CONST, A, B, C, D)\t\t\\\n\ttemplate\t\t\t\t\t\t\t\t\t\t\t\t\\\n\tvec<4, T, Q> vec::A ## B ## C ## D() CONST\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n\t\treturn vec<4, T, Q>(this->A, this->B, this->C, this->D);\t\t\\\n\t}\n\n#define GLM_MUTABLE\n\n#define GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, 2, GLM_MUTABLE, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, 2, GLM_MUTABLE, B, A)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC2(T, P) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(T, P, x, y) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(T, P, r, g) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(T, P, s, t)\n\n#define GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, B)\n\n#define GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, GLM_MUTABLE, C, B, A)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(T, P, A, B, C)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC3(T, P) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, x, y, z) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, r, g, b) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(T, P, s, t, p)\n\n#define GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, GLM_MUTABLE, D, C)\n\n#define GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, , D, C, B)\n\n#define GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , B, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , C, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, , D, B, C, A)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(T, P, A, B, C, D)\n\n#define GLM_SWIZZLE_GEN_REF_FROM_VEC4(T, P) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, x, y, z, w) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, r, g, b, a) \\\n\tGLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(T, P, s, t, p, q)\n\n#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, B)\n\n#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, B)\n\n#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, B)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(T, P, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(T, P, A, B)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, P)\t\t\t\\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, P, x, y)\t\\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, P, r, g)\t\\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(T, P, s, t)\n\n#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, C)\n\n#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, C)\n\n#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, C)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(T, P, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(T, P, A, B, C)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, x, y, z) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, r, g, b) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(T, P, s, t, p)\n\n#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, const, D, D)\n\n#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC3_ENTRY(T, P, const, D, D, D)\n\n#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, A, D, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, B, D, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, C, D, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, A, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, B, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, C, D, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, A, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, A, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, A, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, A, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, B, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, B, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, B, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, B, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, C, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, C, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, C, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, D, A) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, D, B) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, D, C) \\\n\tGLM_SWIZZLE_GEN_VEC4_ENTRY(T, P, const, D, D, D, D)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(T, P, A, B, C, D) \\\n\tGLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(T, P, A, B, C, D)\n\n#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, x, y, z, w) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, r, g, b, a) \\\n\tGLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(T, P, s, t, p, q)\n\n"}, {"path": "includes/glm/detail/_vectorize.hpp", "language": "code", "loc": 108, "comment_density": 0.019, "code": "#pragma once\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate class vec, length_t L, typename R, typename T, qualifier Q>\n\tstruct functor1{};\n\n\ttemplate class vec, typename R, typename T, qualifier Q>\n\tstruct functor1\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<1, R, Q> call(R (*Func) (T x), vec<1, T, Q> const& v)\n\t\t{\n\t\t\treturn vec<1, R, Q>(Func(v.x));\n\t\t}\n\t};\n\n\ttemplate class vec, typename R, typename T, qualifier Q>\n\tstruct functor1\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<2, R, Q> call(R (*Func) (T x), vec<2, T, Q> const& v)\n\t\t{\n\t\t\treturn vec<2, R, Q>(Func(v.x), Func(v.y));\n\t\t}\n\t};\n\n\ttemplate class vec, typename R, typename T, qualifier Q>\n\tstruct functor1\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<3, R, Q> call(R (*Func) (T x), vec<3, T, Q> const& v)\n\t\t{\n\t\t\treturn vec<3, R, Q>(Func(v.x), Func(v.y), Func(v.z));\n\t\t}\n\t};\n\n\ttemplate class vec, typename R, typename T, qualifier Q>\n\tstruct functor1\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<4, R, Q> call(R (*Func) (T x), vec<4, T, Q> const& v)\n\t\t{\n\t\t\treturn vec<4, R, Q>(Func(v.x), Func(v.y), Func(v.z), Func(v.w));\n\t\t}\n\t};\n\n\ttemplate class vec, length_t L, typename T, qualifier Q>\n\tstruct functor2{};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<1, T, Q> call(T (*Func) (T x, T y), vec<1, T, Q> const& a, vec<1, T, Q> const& b)\n\t\t{\n\t\t\treturn vec<1, T, Q>(Func(a.x, b.x));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<2, T, Q> call(T (*Func) (T x, T y), vec<2, T, Q> const& a, vec<2, T, Q> const& b)\n\t\t{\n\t\t\treturn vec<2, T, Q>(Func(a.x, b.x), Func(a.y, b.y));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<3, T, Q> call(T (*Func) (T x, T y), vec<3, T, Q> const& a, vec<3, T, Q> const& b)\n\t\t{\n\t\t\treturn vec<3, T, Q>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<4, T, Q> call(T (*Func) (T x, T y), vec<4, T, Q> const& a, vec<4, T, Q> const& b)\n\t\t{\n\t\t\treturn vec<4, T, Q>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w));\n\t\t}\n\t};\n\n\ttemplate class vec, length_t L, typename T, qualifier Q>\n\tstruct functor2_vec_sca{};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2_vec_sca\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<1, T, Q> call(T (*Func) (T x, T y), vec<1, T, Q> const& a, T b)\n\t\t{\n\t\t\treturn vec<1, T, Q>(Func(a.x, b));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2_vec_sca\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<2, T, Q> call(T (*Func) (T x, T y), vec<2, T, Q> const& a, T b)\n\t\t{\n\t\t\treturn vec<2, T, Q>(Func(a.x, b), Func(a.y, b));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2_vec_sca\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<3, T, Q> call(T (*Func) (T x, T y), vec<3, T, Q> const& a, T b)\n\t\t{\n\t\t\treturn vec<3, T, Q>(Func(a.x, b), Func(a.y, b), Func(a.z, b));\n\t\t}\n\t};\n\n\ttemplate class vec, typename T, qualifier Q>\n\tstruct functor2_vec_sca\n\t{\n\t\tGLM_FUNC_QUALIFIER static vec<4, T, Q> call(T (*Func) (T x, T y), vec<4, T, Q> const& a, T b)\n\t\t{\n\t\t\treturn vec<4, T, Q>(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b));\n\t\t}\n\t};\n}//namespace detail\n}//namespace glm\n"}, {"path": "includes/glm/detail/compute_common.hpp", "language": "code", "loc": 44, "comment_density": 0.091, "code": "#pragma once\n\n#include \"setup.hpp\"\n#include \n\nnamespace glm{\nnamespace detail\n{\n\ttemplate\n\tstruct compute_abs\n\t{};\n\n\ttemplate\n\tstruct compute_abs\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x)\n\t\t{\n\t\t\tGLM_STATIC_ASSERT(\n\t\t\t\tstd::numeric_limits::is_iec559 || std::numeric_limits::is_signed,\n\t\t\t\t\"'abs' only accept floating-point and integer scalar or vector inputs\");\n\n\t\t\treturn x >= genFIType(0) ? x : -x;\n\t\t\t// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;\n\t\t}\n\t};\n\n#if GLM_COMPILER & GLM_COMPILER_CUDA\n\ttemplate<>\n\tstruct compute_abs\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static float call(float x)\n\t\t{\n\t\t\treturn fabsf(x);\n\t\t}\n\t};\n#endif\n\n\ttemplate\n\tstruct compute_abs\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x)\n\t\t{\n\t\t\tGLM_STATIC_ASSERT(\n\t\t\t\t(!std::numeric_limits::is_signed && std::numeric_limits::is_integer),\n\t\t\t\t\"'abs' only accept floating-point and integer scalar or vector inputs\");\n\t\t\treturn x;\n\t\t}\n\t};\n}//namespace detail\n}//namespace glm\n"}, {"path": "includes/glm/detail/compute_vector_relational.hpp", "language": "code", "loc": 28, "comment_density": 0.5, "code": "#pragma once\n\n//#include \"compute_common.hpp\"\n#include \"setup.hpp\"\n#include \n\nnamespace glm{\nnamespace detail\n{\n\ttemplate \n\tstruct compute_equal\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b)\n\t\t{\n\t\t\treturn a == b;\n\t\t}\n\t};\n/*\n\ttemplate \n\tstruct compute_equal\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b)\n\t\t{\n\t\t\treturn detail::compute_abs::is_signed>::call(b - a) <= static_cast(0);\n\t\t\t//return std::memcmp(&a, &b, sizeof(T)) == 0;\n\t\t}\n\t};\n*/\n}//namespace detail\n}//namespace glm\n"}, {"path": "includes/glm/detail/glm.cpp", "language": "code", "loc": 213, "comment_density": 0.085, "code": "/// @ref core\n/// @file glm/glm.cpp\n\n#define GLM_ENABLE_EXPERIMENTAL\n#include \n#include \n#include \n#include \n#include \n#include \n\nnamespace glm\n{\n// tvec1 type explicit instantiation\ntemplate struct vec<1, uint8, lowp>;\ntemplate struct vec<1, uint16, lowp>;\ntemplate struct vec<1, uint32, lowp>;\ntemplate struct vec<1, uint64, lowp>;\ntemplate struct vec<1, int8, lowp>;\ntemplate struct vec<1, int16, lowp>;\ntemplate struct vec<1, int32, lowp>;\ntemplate struct vec<1, int64, lowp>;\ntemplate struct vec<1, float32, lowp>;\ntemplate struct vec<1, float64, lowp>;\n\ntemplate struct vec<1, uint8, mediump>;\ntemplate struct vec<1, uint16, mediump>;\ntemplate struct vec<1, uint32, mediump>;\ntemplate struct vec<1, uint64, mediump>;\ntemplate struct vec<1, int8, mediump>;\ntemplate struct vec<1, int16, mediump>;\ntemplate struct vec<1, int32, mediump>;\ntemplate struct vec<1, int64, mediump>;\ntemplate struct vec<1, float32, mediump>;\ntemplate struct vec<1, float64, mediump>;\n\ntemplate struct vec<1, uint8, highp>;\ntemplate struct vec<1, uint16, highp>;\ntemplate struct vec<1, uint32, highp>;\ntemplate struct vec<1, uint64, highp>;\ntemplate struct vec<1, int8, highp>;\ntemplate struct vec<1, int16, highp>;\ntemplate struct vec<1, int32, highp>;\ntemplate struct vec<1, int64, highp>;\ntemplate struct vec<1, float32, highp>;\ntemplate struct vec<1, float64, highp>;\n\n// tvec2 type explicit instantiation\ntemplate struct vec<2, uint8, lowp>;\ntemplate struct vec<2, uint16, lowp>;\ntemplate struct vec<2, uint32, lowp>;\ntemplate struct vec<2, uint64, lowp>;\ntemplate struct vec<2, int8, lowp>;\ntemplate struct vec<2, int16, lowp>;\ntemplate struct vec<2, int32, lowp>;\ntemplate struct vec<2, int64, lowp>;\ntemplate struct vec<2, float32, lowp>;\ntemplate struct vec<2, float64, lowp>;\n\ntemplate struct vec<2, uint8, mediump>;\ntemplate struct vec<2, uint16, mediump>;\ntemplate struct vec<2, uint32, mediump>;\ntemplate struct vec<2, uint64, mediump>;\ntemplate struct vec<2, int8, mediump>;\ntemplate struct vec<2, int16, mediump>;\ntemplate struct vec<2, int32, mediump>;\ntemplate struct vec<2, int64, mediump>;\ntemplate struct vec<2, float32, mediump>;\ntemplate struct vec<2, float64, mediump>;\n\ntemplate struct vec<2, uint8, highp>;\ntemplate struct vec<2, uint16, highp>;\ntemplate struct vec<2, uint32, highp>;\ntemplate struct vec<2, uint64, highp>;\ntemplate struct vec<2, int8, highp>;\ntemplate struct vec<2, int16, highp>;\ntemplate struct vec<2, int32, highp>;\ntemplate struct vec<2, int64, highp>;\ntemplate struct vec<2, float32, highp>;\ntemplate struct vec<2, float64, highp>;\n\n// tvec3 type explicit instantiation\ntemplate struct vec<3, uint8, lowp>;\ntemplate struct vec<3, uint16, lowp>;\ntemplate struct vec<3, uint32, lowp>;\ntemplate struct vec<3, uint64, lowp>;\ntemplate struct vec<3, int8, lowp>;\ntemplate struct vec<3, int16, lowp>;\ntemplate struct vec<3, int32, lowp>;\ntemplate struct vec<3, int64, lowp>;\ntemplate struct vec<3, float32, lowp>;\ntemplate struct vec<3, float64, lowp>;\n\ntemplate struct vec<3, uint8, mediump>;\ntemplate struct vec<3, uint16, mediump>;\ntemplate struct vec<3, uint32, mediump>;\ntemplate struct vec<3, uint64, mediump>;\ntemplate struct vec<3, int8, mediump>;\ntemplate struct vec<3, int16, mediump>;\ntemplate struct vec<3, int32, mediump>;\ntemplate struct vec<3, int64, mediump>;\ntemplate struct vec<3, float32, mediump>;\ntemplate struct vec<3, float64, mediump>;\n\ntemplate struct vec<3, uint8, highp>;\ntemplate struct vec<3, uint16, highp>;\ntemplate struct vec<3, uint32, highp>;\ntemplate struct vec<3, uint64, highp>;\ntemplate struct vec<3, int8, highp>;\ntemplate struct vec<3, int16, highp>;\ntemplate struct vec<3, int32, highp>;\ntemplate struct vec<3, int64, highp>;\ntemplate struct vec<3, float32, highp>;\ntemplate struct vec<3, float64, highp>;\n\n// tvec4 type explicit instantiation\ntemplate struct vec<4, uint8, lowp>;\ntemplate struct vec<4, uint16, lowp>;\ntemplate struct vec<4, uint32, lowp>;\ntemplate struct vec<4, uint64, lowp>;\ntemplate struct vec<4, int8, lowp>;\ntemplate struct vec<4, int16, lowp>;\ntemplate struct vec<4, int32, lowp>;\ntemplate struct vec<4, int64, lowp>;\ntemplate struct vec<4, float32, lowp>;\ntemplate struct vec<4, float64, lowp>;\n\ntemplate struct vec<4, uint8, mediump>;\ntemplate struct vec<4, uint16, mediump>;\ntemplate struct vec<4, uint32, mediump>;\ntemplate struct vec<4, uint64, mediump>;\ntemplate struct vec<4, int8, mediump>;\ntemplate struct vec<4, int16, mediump>;\ntemplate struct vec<4, int32, mediump>;\ntemplate struct vec<4, int64, mediump>;\ntemplate struct vec<4, float32, mediump>;\ntemplate struct vec<4, float64, mediump>;\n\ntemplate struct vec<4, uint8, highp>;\ntemplate struct vec<4, uint16, highp>;\ntemplate struct vec<4, uint32, highp>;\ntemplate struct vec<4, uint64, highp>;\ntemplate struct vec<4, int8, highp>;\ntemplate struct vec<4, int16, highp>;\ntemplate struct vec<4, int32, highp>;\ntemplate struct vec<4, int64, highp>;\ntemplate struct vec<4, float32, highp>;\ntemplate struct vec<4, float64, highp>;\n\n// tmat2x2 type explicit instantiation\ntemplate struct mat<2, 2, float32, lowp>;\ntemplate struct mat<2, 2, float64, lowp>;\n\ntemplate struct mat<2, 2, float32, mediump>;\ntemplate struct mat<2, 2, float64, mediump>;\n\ntemplate struct mat<2, 2, float32, highp>;\ntemplate struct mat<2, 2, float64, highp>;\n\n// tmat2x3 type explicit instantiation\ntemplate struct mat<2, 3, float32, lowp>;\ntemplate struct mat<2, 3, float64, lowp>;\n\ntemplate struct mat<2, 3, float32, mediump>;\ntemplate struct mat<2, 3, float64, mediump>;\n\ntemplate struct mat<2, 3, float32, highp>;\ntemplate struct mat<2, 3, float64, highp>;\n\n// tmat2x4 type explicit instantiation\ntemplate struct mat<2, 4, float32, lowp>;\ntemplate struct mat<2, 4, float64, lowp>;\n\ntemplate struct mat<2, 4, float32, mediump>;\ntemplate struct mat<2, 4, float64, mediump>;\n\ntemplate struct mat<2, 4, float32, highp>;\ntemplate struct mat<2, 4, float64, highp>;\n\n// tmat3x2 type explicit instantiation\ntemplate struct mat<3, 2, float32, lowp>;\ntemplate struct mat<3, 2, float64, lowp>;\n\ntemplate struct mat<3, 2, float32, mediump>;\ntemplate struct mat<3, 2, float64, mediump>;\n\ntemplate struct mat<3, 2, float32, highp>;\ntemplate struct mat<3, 2, float64, highp>;\n\n// tmat3x3 type explicit instantiation\ntemplate struct mat<3, 3, float32, lowp>;\ntemplate struct mat<3, 3, float64, lowp>;\n\ntemplate struct mat<3, 3, float32, mediump>;\ntemplate struct mat<3, 3, float64, mediump>;\n\ntemplate struct mat<3, 3, float32, highp>;\ntemplate struct mat<3, 3, float64, highp>;\n\n// tmat3x4 type explicit instantiation\ntemplate struct mat<3, 4, float32, lowp>;\ntemplate struct mat<3, 4, float64, lowp>;\n\ntemplate struct mat<3, 4, float32, mediump>;\ntemplate struct mat<3, 4, float64, mediump>;\n\ntemplate struct mat<3, 4, float32, highp>;\ntemplate struct mat<3, 4, float64, highp>;\n\n// tmat4x2 type explicit instantiation\ntemplate struct mat<4, 2, float32, lowp>;\ntemplate struct mat<4, 2, float64, lowp>;\n\ntemplate struct mat<4, 2, float32, mediump>;\ntemplate struct mat<4, 2, float64, mediump>;\n\ntemplate struct mat<4, 2, float32, highp>;\ntemplate struct mat<4, 2, float64, highp>;\n\n// tmat4x3 type explicit instantiation\ntemplate struct mat<4, 3, float32, lowp>;\ntemplate struct mat<4, 3, float64, lowp>;\n\ntemplate struct mat<4, 3, float32, mediump>;\ntemplate struct mat<4, 3, float64, mediump>;\n\ntemplate struct mat<4, 3, float32, highp>;\ntemplate struct mat<4, 3, float64, highp>;\n\n// tmat4x4 type explicit instantiation\ntemplate struct mat<4, 4, float32, lowp>;\ntemplate struct mat<4, 4, float64, lowp>;\n\ntemplate struct mat<4, 4, float32, mediump>;\ntemplate struct mat<4, 4, float64, mediump>;\n\ntemplate struct mat<4, 4, float32, highp>;\ntemplate struct mat<4, 4, float64, highp>;\n\n// tquat type explicit instantiation\ntemplate struct qua;\ntemplate struct qua;\n\ntemplate struct qua;\ntemplate struct qua;\n\ntemplate struct qua;\ntemplate struct qua;\n\n//tdualquat type explicit instantiation\ntemplate struct tdualquat;\ntemplate struct tdualquat;\n\ntemplate struct tdualquat;\ntemplate struct tdualquat;\n\ntemplate struct tdualquat;\ntemplate struct tdualquat;\n\n}//namespace glm\n\n"}, {"path": "includes/glm/detail/qualifier.hpp", "language": "code", "loc": 180, "comment_density": 0.078, "code": "#pragma once\n\n#include \"setup.hpp\"\n\nnamespace glm\n{\n\t/// Qualify GLM types in term of alignment (packed, aligned) and precision in term of ULPs (lowp, mediump, highp)\n\tenum qualifier\n\t{\n\t\tpacked_highp, ///< Typed data is tightly packed in memory and operations are executed with high precision in term of ULPs\n\t\tpacked_mediump, ///< Typed data is tightly packed in memory and operations are executed with medium precision in term of ULPs for higher performance\n\t\tpacked_lowp, ///< Typed data is tightly packed in memory and operations are executed with low precision in term of ULPs to maximize performance\n\n#\t\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n\t\t\taligned_highp, ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs\n\t\t\taligned_mediump, ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs for higher performance\n\t\t\taligned_lowp, // ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs to maximize performance\n\t\t\taligned = aligned_highp, ///< By default aligned qualifier is also high precision\n#\t\tendif\n\n\t\thighp = packed_highp, ///< By default highp qualifier is also packed\n\t\tmediump = packed_mediump, ///< By default mediump qualifier is also packed\n\t\tlowp = packed_lowp, ///< By default lowp qualifier is also packed\n\t\tpacked = packed_highp, ///< By default packed qualifier is also high precision\n\n#\t\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE && defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES)\n\t\t\tdefaultp = aligned_highp\n#\t\telse\n\t\t\tdefaultp = highp\n#\t\tendif\n\t};\n\n\ttypedef qualifier precision;\n\n\ttemplate struct vec;\n\ttemplate struct mat;\n\ttemplate struct qua;\n\n#\tif GLM_HAS_TEMPLATE_ALIASES\n\t\ttemplate using tvec1 = vec<1, T, Q>;\n\t\ttemplate using tvec2 = vec<2, T, Q>;\n\t\ttemplate using tvec3 = vec<3, T, Q>;\n\t\ttemplate using tvec4 = vec<4, T, Q>;\n\t\ttemplate using tmat2x2 = mat<2, 2, T, Q>;\n\t\ttemplate using tmat2x3 = mat<2, 3, T, Q>;\n\t\ttemplate using tmat2x4 = mat<2, 4, T, Q>;\n\t\ttemplate using tmat3x2 = mat<3, 2, T, Q>;\n\t\ttemplate using tmat3x3 = mat<3, 3, T, Q>;\n\t\ttemplate using tmat3x4 = mat<3, 4, T, Q>;\n\t\ttemplate using tmat4x2 = mat<4, 2, T, Q>;\n\t\ttemplate using tmat4x3 = mat<4, 3, T, Q>;\n\t\ttemplate using tmat4x4 = mat<4, 4, T, Q>;\n\t\ttemplate using tquat = qua;\n#\tendif\n\nnamespace detail\n{\n\ttemplate\n\tstruct is_aligned\n\t{\n\t\tstatic const bool value = false;\n\t};\n\n#\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n\t\ttemplate<>\n\t\tstruct is_aligned\n\t\t{\n\t\t\tstatic const bool value = true;\n\t\t};\n\n\t\ttemplate<>\n\t\tstruct is_aligned\n\t\t{\n\t\t\tstatic const bool value = true;\n\t\t};\n\n\t\ttemplate<>\n\t\tstruct is_aligned\n\t\t{\n\t\t\tstatic const bool value = true;\n\t\t};\n#\tendif\n\n\ttemplate\n\tstruct storage\n\t{\n\t\ttypedef struct type {\n\t\t\tT data[L];\n\t\t} type;\n\t};\n\n#\tif GLM_HAS_ALIGNOF\n\t\ttemplate\n\t\tstruct storage\n\t\t{\n\t\t\ttypedef struct alignas(L * sizeof(T)) type {\n\t\t\t\tT data[L];\n\t\t\t} type;\n\t\t};\n\n\t\ttemplate\n\t\tstruct storage<3, T, true>\n\t\t{\n\t\t\ttypedef struct alignas(4 * sizeof(T)) type {\n\t\t\t\tT data[4];\n\t\t\t} type;\n\t\t};\n#\tendif\n\n#\tif GLM_ARCH & GLM_ARCH_SSE2_BIT\n\ttemplate<>\n\tstruct storage<4, float, true>\n\t{\n\t\ttypedef glm_f32vec4 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<4, int, true>\n\t{\n\t\ttypedef glm_i32vec4 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<4, unsigned int, true>\n\t{\n\t\ttypedef glm_u32vec4 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<2, double, true>\n\t{\n\t\ttypedef glm_f64vec2 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<2, detail::int64, true>\n\t{\n\t\ttypedef glm_i64vec2 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<2, detail::uint64, true>\n\t{\n\t\ttypedef glm_u64vec2 type;\n\t};\n#\tendif\n\n#\tif (GLM_ARCH & GLM_ARCH_AVX_BIT)\n\ttemplate<>\n\tstruct storage<4, double, true>\n\t{\n\t\ttypedef glm_f64vec4 type;\n\t};\n#\tendif\n\n#\tif (GLM_ARCH & GLM_ARCH_AVX2_BIT)\n\ttemplate<>\n\tstruct storage<4, detail::int64, true>\n\t{\n\t\ttypedef glm_i64vec4 type;\n\t};\n\n\ttemplate<>\n\tstruct storage<4, detail::uint64, true>\n\t{\n\t\ttypedef glm_u64vec4 type;\n\t};\n#\tendif\n\n\tenum genTypeEnum\n\t{\n\t\tGENTYPE_VEC,\n\t\tGENTYPE_MAT,\n\t\tGENTYPE_QUAT\n\t};\n\n\ttemplate \n\tstruct genTypeTrait\n\t{};\n\n\ttemplate \n\tstruct genTypeTrait >\n\t{\n\t\tstatic const genTypeEnum GENTYPE = GENTYPE_MAT;\n\t};\n\n\ttemplate\n\tstruct init_gentype\n\t{\n\t};\n\n\ttemplate\n\tstruct init_gentype\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static genType identity()\n\t\t{\n\t\t\treturn genType(1, 0, 0, 0);\n\t\t}\n\t};\n\n\ttemplate\n\tstruct init_gentype\n\t{\n\t\tGLM_FUNC_QUALIFIER GLM_CONSTEXPR static genType identity()\n\t\t{\n\t\t\treturn genType(1);\n\t\t}\n\t};\n}//namespace detail\n}//namespace glm\n"}, {"path": "includes/glm/detail/setup.hpp", "language": "code", "loc": 913, "comment_density": 0.136, "code": "#ifndef GLM_SETUP_INCLUDED\n\n#include \n#include \n\n#define GLM_VERSION_MAJOR\t\t\t0\n#define GLM_VERSION_MINOR\t\t\t9\n#define GLM_VERSION_PATCH\t\t\t9\n#define GLM_VERSION_REVISION\t\t3\n#define GLM_VERSION\t\t\t\t\t993\n#define GLM_VERSION_MESSAGE\t\t\t\"GLM: version 0.9.9.3\"\n\n#define GLM_SETUP_INCLUDED\t\t\tGLM_VERSION\n\n///////////////////////////////////////////////////////////////////////////////////\n// Active states\n\n#define GLM_DISABLE\t\t0\n#define GLM_ENABLE\t\t1\n\n///////////////////////////////////////////////////////////////////////////////////\n// Messages\n\n#if defined(GLM_FORCE_MESSAGES)\n#\tdefine GLM_MESSAGES GLM_ENABLE\n#else\n#\tdefine GLM_MESSAGES GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Detect the platform\n\n#include \"../simd/platform.h\"\n\n///////////////////////////////////////////////////////////////////////////////////\n// Build model\n\n#if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__)\n#\tdefine GLM_MODEL\tGLM_MODEL_64\n#elif defined(__i386__) || defined(__ppc__)\n#\tdefine GLM_MODEL\tGLM_MODEL_32\n#else\n#\tdefine GLM_MODEL\tGLM_MODEL_32\n#endif//\n\n#if !defined(GLM_MODEL) && GLM_COMPILER != 0\n#\terror \"GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message.\"\n#endif//GLM_MODEL\n\n///////////////////////////////////////////////////////////////////////////////////\n// C++ Version\n\n// User defines: GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_FORCE_CXX11, GLM_FORCE_CXX14, GLM_FORCE_CXX17, GLM_FORCE_CXX2A\n\n#define GLM_LANG_CXX98_FLAG\t\t\t(1 << 1)\n#define GLM_LANG_CXX03_FLAG\t\t\t(1 << 2)\n#define GLM_LANG_CXX0X_FLAG\t\t\t(1 << 3)\n#define GLM_LANG_CXX11_FLAG\t\t\t(1 << 4)\n#define GLM_LANG_CXX14_FLAG\t\t\t(1 << 5)\n#define GLM_LANG_CXX17_FLAG\t\t\t(1 << 6)\n#define GLM_LANG_CXX2A_FLAG\t\t\t(1 << 7)\n#define GLM_LANG_CXXMS_FLAG\t\t\t(1 << 8)\n#define GLM_LANG_CXXGNU_FLAG\t\t(1 << 9)\n\n#define GLM_LANG_CXX98\t\t\tGLM_LANG_CXX98_FLAG\n#define GLM_LANG_CXX03\t\t\t(GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG)\n#define GLM_LANG_CXX0X\t\t\t(GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG)\n#define GLM_LANG_CXX11\t\t\t(GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG)\n#define GLM_LANG_CXX14\t\t\t(GLM_LANG_CXX11 | GLM_LANG_CXX14_FLAG)\n#define GLM_LANG_CXX17\t\t\t(GLM_LANG_CXX14 | GLM_LANG_CXX17_FLAG)\n#define GLM_LANG_CXX2A\t\t\t(GLM_LANG_CXX17 | GLM_LANG_CXX2A_FLAG)\n#define GLM_LANG_CXXMS\t\t\tGLM_LANG_CXXMS_FLAG\n#define GLM_LANG_CXXGNU\t\t\tGLM_LANG_CXXGNU_FLAG\n\n#if (defined(_MSC_EXTENSIONS))\n#\tdefine GLM_LANG_EXT GLM_LANG_CXXMS_FLAG\n#elif ((GLM_COMPILER & (GLM_COMPILER_CLANG | GLM_COMPILER_GCC)) && (GLM_ARCH & GLM_ARCH_SIMD_BIT))\n#\tdefine GLM_LANG_EXT GLM_LANG_CXXMS_FLAG\n#else\n#\tdefine GLM_LANG_EXT 0\n#endif\n\n#if (defined(GLM_FORCE_CXX_UNKNOWN))\n#\tdefine GLM_LANG 0\n#elif defined(GLM_FORCE_CXX2A)\n#\tdefine GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT)\n#\tdefine GLM_LANG_STL11_FORCED\n#elif defined(GLM_FORCE_CXX17)\n#\tdefine GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT)\n#\tdefine GLM_LANG_STL11_FORCED\n#elif defined(GLM_FORCE_CXX14)\n#\tdefine GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT)\n#\tdefine GLM_LANG_STL11_FORCED\n#elif defined(GLM_FORCE_CXX11)\n#\tdefine GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT)\n#\tdefine GLM_LANG_STL11_FORCED\n#elif defined(GLM_FORCE_CXX03)\n#\tdefine GLM_LANG (GLM_LANG_CXX03 | GLM_LANG_EXT)\n#elif defined(GLM_FORCE_CXX98)\n#\tdefine GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_EXT)\n#else\n#\tif GLM_COMPILER & GLM_COMPILER_VC && defined(_MSVC_LANG)\n#\t\tif GLM_COMPILER >= GLM_COMPILER_VC15_7\n#\t\t\tdefine GLM_LANG_PLATFORM _MSVC_LANG\n#\t\telif GLM_COMPILER >= GLM_COMPILER_VC15\n#\t\t\tif _MSVC_LANG > 201402L\n#\t\t\t\tdefine GLM_LANG_PLATFORM 201402L\n#\t\t\telse\n#\t\t\t\tdefine GLM_LANG_PLATFORM _MSVC_LANG\n#\t\t\tendif\n#\t\telse\n#\t\t\tdefine GLM_LANG_PLATFORM 0\n#\t\tendif\n#\telse\n#\t\tdefine GLM_LANG_PLATFORM 0\n#\tendif\n\n#\tif __cplusplus > 201703L || GLM_LANG_PLATFORM > 201703L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT)\n#\telif __cplusplus == 201703L || GLM_LANG_PLATFORM == 201703L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT)\n#\telif __cplusplus == 201402L || GLM_LANG_PLATFORM == 201402L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT)\n#\telif __cplusplus == 201103L || GLM_LANG_PLATFORM == 201103L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT)\n#\telif defined(__INTEL_CXX11_MODE__) || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)\n#\t\tdefine GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_EXT)\n#\telif __cplusplus == 199711L\n#\t\tdefine GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_EXT)\n#\telse\n#\t\tdefine GLM_LANG (0 | GLM_LANG_EXT)\n#\tendif\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Has of C++ features\n\n// http://clang.llvm.org/cxx_status.html\n// http://gcc.gnu.org/projects/cxx0x.html\n// http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx\n\n// Android has multiple STLs but C++11 STL detection doesn't always work #284 #564\n#if GLM_PLATFORM == GLM_PLATFORM_ANDROID && !defined(GLM_LANG_STL11_FORCED)\n#\tdefine GLM_HAS_CXX11_STL 0\n#elif GLM_COMPILER & GLM_COMPILER_CLANG\n#\tif (defined(_LIBCPP_VERSION) && GLM_LANG & GLM_LANG_CXX11_FLAG) || defined(GLM_LANG_STL11_FORCED)\n#\t\tdefine GLM_HAS_CXX11_STL 1\n#\telse\n#\t\tdefine GLM_HAS_CXX11_STL 0\n#\tendif\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_CXX11_STL 1\n#else\n#\tdefine GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15))))\n#endif\n\n// N1720\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_STATIC_ASSERT 1\n#else\n#\tdefine GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC))))\n#endif\n\n// N1988\n#if GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_EXTENDED_INTEGER_TYPE 1\n#else\n#\tdefine GLM_HAS_EXTENDED_INTEGER_TYPE (\\\n\t\t((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC)) || \\\n\t\t((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \\\n\t\t((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG)))\n#endif\n\n// N2672 Initializer lists http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_INITIALIZER_LISTS 1\n#else\n#\tdefine GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75))))\n#endif\n\n// N2544 Unrestricted unions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_UNRESTRICTED_UNIONS 1\n#else\n#\tdefine GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t(GLM_COMPILER & GLM_COMPILER_VC) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75)))\n#endif\n\n// N2346\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_DEFAULTED_FUNCTIONS 1\n#else\n#\tdefine GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL)) || \\\n\t\t(GLM_COMPILER & GLM_COMPILER_CUDA)))\n#endif\n\n// N2118\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_RVALUE_REFERENCES 1\n#else\n#\tdefine GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n// N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1\n#else\n#\tdefine GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n// N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_TEMPLATE_ALIASES 1\n#else\n#\tdefine GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n// N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_RANGE_FOR __has_feature(cxx_range_for)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_RANGE_FOR 1\n#else\n#\tdefine GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n// N2341 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf\n#if GLM_COMPILER & GLM_COMPILER_CLANG\n#\tdefine GLM_HAS_ALIGNOF __has_feature(cxx_alignas)\n#elif GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_ALIGNOF 1\n#else\n#\tdefine GLM_HAS_ALIGNOF ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA70))))\n#endif\n\n// N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf\n// N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html\n#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) // Compiler SIMD intrinsics don't support constexpr...\n#\tdefine GLM_HAS_CONSTEXPR 0\n#elif (GLM_COMPILER & GLM_COMPILER_CLANG)\n#\tdefine GLM_HAS_CONSTEXPR __has_feature(cxx_relaxed_constexpr)\n#elif (GLM_LANG & GLM_LANG_CXX14_FLAG)\n#\tdefine GLM_HAS_CONSTEXPR 1\n#else\n#\tdefine GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && GLM_HAS_INITIALIZER_LISTS && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL17)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC6)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15))))\n#endif\n\n#if GLM_HAS_CONSTEXPR\n#\tdefine GLM_CONSTEXPR constexpr\n#else\n#\tdefine GLM_CONSTEXPR\n#endif\n\n//\n#if GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_ASSIGNABLE 1\n#else\n#\tdefine GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))))\n#endif\n\n//\n#define GLM_HAS_TRIVIAL_QUERIES 0\n\n//\n#if GLM_LANG & GLM_LANG_CXX11_FLAG\n#\tdefine GLM_HAS_MAKE_SIGNED 1\n#else\n#\tdefine GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_CUDA))))\n#endif\n\n//\n#if defined(GLM_FORCE_PURE)\n#\tdefine GLM_HAS_BITSCAN_WINDOWS 0\n#else\n#\tdefine GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\\\n\t\t((GLM_COMPILER & GLM_COMPILER_INTEL)) || \\\n\t\t((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT))))\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// OpenMP\n#ifdef _OPENMP\n#\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\tif GLM_COMPILER >= GLM_COMPILER_GCC61\n#\t\t\tdefine GLM_HAS_OPENMP 45\n#\t\telif GLM_COMPILER >= GLM_COMPILER_GCC49\n#\t\t\tdefine GLM_HAS_OPENMP 40\n#\t\telif GLM_COMPILER >= GLM_COMPILER_GCC47\n#\t\t\tdefine GLM_HAS_OPENMP 31\n#\t\telse\n#\t\t\tdefine GLM_HAS_OPENMP 0\n#\t\tendif\n#\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\tif GLM_COMPILER >= GLM_COMPILER_CLANG38\n#\t\t\tdefine GLM_HAS_OPENMP 31\n#\t\telse\n#\t\t\tdefine GLM_HAS_OPENMP 0\n#\t\tendif\n#\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tdefine GLM_HAS_OPENMP 20\n#\telif GLM_COMPILER & GLM_COMPILER_INTEL\n#\t\tif GLM_COMPILER >= GLM_COMPILER_INTEL16\n#\t\t\tdefine GLM_HAS_OPENMP 40\n#\t\telse\n#\t\t\tdefine GLM_HAS_OPENMP 0\n#\t\tendif\n#\telse\n#\t\tdefine GLM_HAS_OPENMP 0\n#\tendif\n#else\n#\tdefine GLM_HAS_OPENMP 0\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// nullptr\n\n#if GLM_LANG & GLM_LANG_CXX0X_FLAG\n#\tdefine GLM_CONFIG_NULLPTR GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_NULLPTR GLM_DISABLE\n#endif\n\n#if GLM_CONFIG_NULLPTR == GLM_ENABLE\n#\tdefine GLM_NULLPTR nullptr\n#else\n#\tdefine GLM_NULLPTR 0\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Static assert\n\n#if GLM_HAS_STATIC_ASSERT\n#\tdefine GLM_STATIC_ASSERT(x, message) static_assert(x, message)\n#elif GLM_COMPILER & GLM_COMPILER_VC\n#\tdefine GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]\n#else\n#\tdefine GLM_STATIC_ASSERT(x, message) assert(x)\n#endif//GLM_LANG\n\n///////////////////////////////////////////////////////////////////////////////////\n// Qualifiers\n\n#if GLM_COMPILER & GLM_COMPILER_CUDA\n#\tdefine GLM_CUDA_FUNC_DEF __device__ __host__\n#\tdefine GLM_CUDA_FUNC_DECL __device__ __host__\n#else\n#\tdefine GLM_CUDA_FUNC_DEF\n#\tdefine GLM_CUDA_FUNC_DECL\n#endif\n\n#if defined(GLM_FORCE_INLINE)\n#\tif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tdefine GLM_INLINE __forceinline\n#\t\tdefine GLM_NEVER_INLINE __declspec((noinline))\n#\telif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG)\n#\t\tdefine GLM_INLINE inline __attribute__((__always_inline__))\n#\t\tdefine GLM_NEVER_INLINE __attribute__((__noinline__))\n#\telif GLM_COMPILER & GLM_COMPILER_CUDA\n#\t\tdefine GLM_INLINE __forceinline__\n#\t\tdefine GLM_NEVER_INLINE __noinline__\n#\telse\n#\t\tdefine GLM_INLINE inline\n#\t\tdefine GLM_NEVER_INLINE\n#\tendif//GLM_COMPILER\n#else\n#\tdefine GLM_INLINE inline\n#\tdefine GLM_NEVER_INLINE\n#endif//defined(GLM_FORCE_INLINE)\n\n#define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL\n#define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE\n\n///////////////////////////////////////////////////////////////////////////////////\n// Swizzle operators\n\n// User defines: GLM_FORCE_SWIZZLE\n\n#define GLM_SWIZZLE_DISABLED\t\t0\n#define GLM_SWIZZLE_OPERATOR\t\t1\n#define GLM_SWIZZLE_FUNCTION\t\t2\n\n#if defined(GLM_FORCE_XYZW_ONLY)\n#\tundef GLM_FORCE_SWIZZLE\n#endif\n\n#if defined(GLM_SWIZZLE)\n#\tpragma message(\"GLM: GLM_SWIZZLE is deprecated, use GLM_FORCE_SWIZZLE instead.\")\n#\tdefine GLM_FORCE_SWIZZLE\n#endif\n\n#if defined(GLM_FORCE_SWIZZLE) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)\n#\tdefine GLM_CONFIG_SWIZZLE GLM_SWIZZLE_OPERATOR\n#elif defined(GLM_FORCE_SWIZZLE)\n#\tdefine GLM_CONFIG_SWIZZLE GLM_SWIZZLE_FUNCTION\n#else\n#\tdefine GLM_CONFIG_SWIZZLE GLM_SWIZZLE_DISABLED\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Allows using not basic types as genType\n\n// #define GLM_FORCE_UNRESTRICTED_GENTYPE\n\n#ifdef GLM_FORCE_UNRESTRICTED_GENTYPE\n#\tdefine GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_UNRESTRICTED_GENTYPE GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Clip control, define GLM_FORCE_DEPTH_ZERO_TO_ONE before including GLM\n// to use a clip space between 0 to 1.\n// Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM\n// to use left handed coordinate system by default.\n\n#define GLM_CLIP_CONTROL_ZO_BIT\t\t(1 << 0) // ZERO_TO_ONE\n#define GLM_CLIP_CONTROL_NO_BIT\t\t(1 << 1) // NEGATIVE_ONE_TO_ONE\n#define GLM_CLIP_CONTROL_LH_BIT\t\t(1 << 2) // LEFT_HANDED, For DirectX, Metal, Vulkan\n#define GLM_CLIP_CONTROL_RH_BIT\t\t(1 << 3) // RIGHT_HANDED, For OpenGL, default in GLM\n\n#define GLM_CLIP_CONTROL_LH_ZO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_ZO_BIT)\n#define GLM_CLIP_CONTROL_LH_NO (GLM_CLIP_CONTROL_LH_BIT | GLM_CLIP_CONTROL_NO_BIT)\n#define GLM_CLIP_CONTROL_RH_ZO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_ZO_BIT)\n#define GLM_CLIP_CONTROL_RH_NO (GLM_CLIP_CONTROL_RH_BIT | GLM_CLIP_CONTROL_NO_BIT)\n\n#ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE\n#\tifdef GLM_FORCE_LEFT_HANDED\n#\t\tdefine GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_ZO\n#\telse\n#\t\tdefine GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_ZO\n#\tendif\n#else\n#\tifdef GLM_FORCE_LEFT_HANDED\n#\t\tdefine GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_LH_NO\n#\telse\n#\t\tdefine GLM_CONFIG_CLIP_CONTROL GLM_CLIP_CONTROL_RH_NO\n#\tendif\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Qualifiers\n\n#if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))\n#\tdefine GLM_DEPRECATED __declspec(deprecated)\n#\tdefine GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name\n#elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL)\n#\tdefine GLM_DEPRECATED __attribute__((__deprecated__))\n#\tdefine GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment)))\n#elif GLM_COMPILER & GLM_COMPILER_CUDA\n#\tdefine GLM_DEPRECATED\n#\tdefine GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x)\n#else\n#\tdefine GLM_DEPRECATED\n#\tdefine GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n\n#ifdef GLM_FORCE_EXPLICIT_CTOR\n#\tdefine GLM_EXPLICIT explicit\n#else\n#\tdefine GLM_EXPLICIT\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Length type: all length functions returns a length_t type.\n// When GLM_FORCE_SIZE_T_LENGTH is defined, length_t is a typedef of size_t otherwise\n// length_t is a typedef of int like GLSL defines it.\n\n#define GLM_LENGTH_INT\t\t1\n#define GLM_LENGTH_SIZE_T\t2\n\n#ifdef GLM_FORCE_SIZE_T_LENGTH\n#\tdefine GLM_CONFIG_LENGTH_TYPE\t\tGLM_LENGTH_SIZE_T\n#else\n#\tdefine GLM_CONFIG_LENGTH_TYPE\t\tGLM_LENGTH_INT\n#endif\n\nnamespace glm\n{\n\tusing std::size_t;\n#\tif GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T\n\t\ttypedef size_t length_t;\n#\telse\n\t\ttypedef int length_t;\n#\tendif\n}//namespace glm\n\n///////////////////////////////////////////////////////////////////////////////////\n// constexpr\n\n#if GLM_HAS_CONSTEXPR\n#\tdefine GLM_CONFIG_CONSTEXP GLM_ENABLE\n\n\tnamespace glm\n\t{\n\t\ttemplate\n\t\tconstexpr std::size_t countof(T const (&)[N])\n\t\t{\n\t\t\treturn N;\n\t\t}\n\t}//namespace glm\n#\tdefine GLM_COUNTOF(arr) glm::countof(arr)\n#elif defined(_MSC_VER)\n#\tdefine GLM_CONFIG_CONSTEXP GLM_DISABLE\n\n#\tdefine GLM_COUNTOF(arr) _countof(arr)\n#else\n#\tdefine GLM_CONFIG_CONSTEXP GLM_DISABLE\n\n#\tdefine GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// uint\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate\n\tstruct is_int\n\t{\n\t\tenum test {value = 0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n}//namespace detail\n\n\ttypedef unsigned int\tuint;\n}//namespace glm\n\n///////////////////////////////////////////////////////////////////////////////////\n// 64-bit int\n\n#if GLM_HAS_EXTENDED_INTEGER_TYPE\n#\tinclude \n#endif\n\nnamespace glm{\nnamespace detail\n{\n#\tif GLM_HAS_EXTENDED_INTEGER_TYPE\n\t\ttypedef std::uint64_t\t\t\t\t\t\tuint64;\n\t\ttypedef std::int64_t\t\t\t\t\t\tint64;\n#\telif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available\n\t\ttypedef uint64_t\t\t\t\t\t\t\tuint64;\n\t\ttypedef int64_t\t\t\t\t\t\t\t\tint64;\n#\telif GLM_COMPILER & GLM_COMPILER_VC\n\t\ttypedef unsigned __int64\t\t\t\t\tuint64;\n\t\ttypedef signed __int64\t\t\t\t\t\tint64;\n#\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\tpragma GCC diagnostic ignored \"-Wlong-long\"\n\t\t__extension__ typedef unsigned long long\tuint64;\n\t\t__extension__ typedef signed long long\t\tint64;\n#\telif (GLM_COMPILER & GLM_COMPILER_CLANG)\n#\t\tpragma clang diagnostic ignored \"-Wc++11-long-long\"\n\t\ttypedef unsigned long long\t\t\t\t\tuint64;\n\t\ttypedef signed long long\t\t\t\t\tint64;\n#\telse//unknown compiler\n\t\ttypedef unsigned long long\t\t\t\t\tuint64;\n\t\ttypedef signed long long\t\t\t\t\tint64;\n#\tendif\n}//namespace detail\n}//namespace glm\n\n///////////////////////////////////////////////////////////////////////////////////\n// make_unsigned\n\n#if GLM_HAS_MAKE_SIGNED\n#\tinclude \n\nnamespace glm{\nnamespace detail\n{\n\tusing std::make_unsigned;\n}//namespace detail\n}//namespace glm\n\n#else\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate\n\tstruct make_unsigned\n\t{};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned char type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned short type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned int type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned long type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef uint64 type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned char type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned short type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned int type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef unsigned long type;\n\t};\n\n\ttemplate<>\n\tstruct make_unsigned\n\t{\n\t\ttypedef uint64 type;\n\t};\n}//namespace detail\n}//namespace glm\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Only use x, y, z, w as vector type components\n\n#ifdef GLM_FORCE_XYZW_ONLY\n#\tdefine GLM_CONFIG_XYZW_ONLY GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_XYZW_ONLY GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Configure the use of defaulted initialized types\n\n#define GLM_CTOR_INIT_DISABLE\t\t0\n#define GLM_CTOR_INITIALIZER_LIST\t1\n#define GLM_CTOR_INITIALISATION\t\t2\n\n#if defined(GLM_FORCE_CTOR_INIT) && GLM_HAS_INITIALIZER_LISTS\n#\tdefine GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALIZER_LIST\n#elif defined(GLM_FORCE_CTOR_INIT) && !GLM_HAS_INITIALIZER_LISTS\n#\tdefine GLM_CONFIG_CTOR_INIT GLM_CTOR_INITIALISATION\n#else\n#\tdefine GLM_CONFIG_CTOR_INIT GLM_CTOR_INIT_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Use SIMD instruction sets\n\n#if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)\n#\tdefine GLM_CONFIG_SIMD GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_SIMD GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Configure the use of defaulted function\n\n#if GLM_HAS_DEFAULTED_FUNCTIONS && GLM_CONFIG_CTOR_INIT == GLM_CTOR_INIT_DISABLE\n#\tdefine GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_ENABLE\n#\tdefine GLM_DEFAULT = default\n#else\n#\tdefine GLM_CONFIG_DEFAULTED_FUNCTIONS GLM_DISABLE\n#\tdefine GLM_DEFAULT\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Configure the use of aligned gentypes\n\n#ifdef GLM_FORCE_ALIGNED // Legacy define\n#\tdefine GLM_FORCE_DEFAULT_ALIGNED_GENTYPES\n#endif\n\n#ifdef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES\n#\tdefine GLM_FORCE_ALIGNED_GENTYPES\n#endif\n\n#if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (defined(GLM_FORCE_ALIGNED_GENTYPES) || (GLM_CONFIG_SIMD == GLM_ENABLE))\n#\tdefine GLM_CONFIG_ALIGNED_GENTYPES GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_ALIGNED_GENTYPES GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Configure the use of anonymous structure as implementation detail\n\n#if ((GLM_CONFIG_SIMD == GLM_ENABLE) || (GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR) || (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE))\n#\tdefine GLM_CONFIG_ANONYMOUS_STRUCT GLM_ENABLE\n#else\n#\tdefine GLM_CONFIG_ANONYMOUS_STRUCT GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Silent warnings\n\n#ifdef GLM_FORCE_SILENT_WARNINGS\n#\tdefine GLM_SILENT_WARNINGS GLM_ENABLE\n#else\n#\tdefine GLM_SILENT_WARNINGS GLM_DISABLE\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Precision\n\n#define GLM_HIGHP\t\t1\n#define GLM_MEDIUMP\t\t2\n#define GLM_LOWP\t\t3\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_BOOL) || defined(GLM_PRECISION_HIGHP_BOOL)\n#\tdefine GLM_CONFIG_PRECISION_BOOL\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_BOOL) || defined(GLM_PRECISION_MEDIUMP_BOOL)\n#\tdefine GLM_CONFIG_PRECISION_BOOL\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_BOOL) || defined(GLM_PRECISION_LOWP_BOOL)\n#\tdefine GLM_CONFIG_PRECISION_BOOL\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_BOOL\t\tGLM_HIGHP\n#endif\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_INT) || defined(GLM_PRECISION_HIGHP_INT)\n#\tdefine GLM_CONFIG_PRECISION_INT\t\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_INT) || defined(GLM_PRECISION_MEDIUMP_INT)\n#\tdefine GLM_CONFIG_PRECISION_INT\t\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_INT) || defined(GLM_PRECISION_LOWP_INT)\n#\tdefine GLM_CONFIG_PRECISION_INT\t\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_INT\t\t\tGLM_HIGHP\n#endif\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_UINT) || defined(GLM_PRECISION_HIGHP_UINT)\n#\tdefine GLM_CONFIG_PRECISION_UINT\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_UINT) || defined(GLM_PRECISION_MEDIUMP_UINT)\n#\tdefine GLM_CONFIG_PRECISION_UINT\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_UINT) || defined(GLM_PRECISION_LOWP_UINT)\n#\tdefine GLM_CONFIG_PRECISION_UINT\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_UINT\t\tGLM_HIGHP\n#endif\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_FLOAT) || defined(GLM_PRECISION_HIGHP_FLOAT)\n#\tdefine GLM_CONFIG_PRECISION_FLOAT\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_FLOAT) || defined(GLM_PRECISION_MEDIUMP_FLOAT)\n#\tdefine GLM_CONFIG_PRECISION_FLOAT\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_FLOAT) || defined(GLM_PRECISION_LOWP_FLOAT)\n#\tdefine GLM_CONFIG_PRECISION_FLOAT\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_FLOAT\t\tGLM_HIGHP\n#endif\n\n#if defined(GLM_FORCE_PRECISION_HIGHP_DOUBLE) || defined(GLM_PRECISION_HIGHP_DOUBLE)\n#\tdefine GLM_CONFIG_PRECISION_DOUBLE\t\tGLM_HIGHP\n#elif defined(GLM_FORCE_PRECISION_MEDIUMP_DOUBLE) || defined(GLM_PRECISION_MEDIUMP_DOUBLE)\n#\tdefine GLM_CONFIG_PRECISION_DOUBLE\t\tGLM_MEDIUMP\n#elif defined(GLM_FORCE_PRECISION_LOWP_DOUBLE) || defined(GLM_PRECISION_LOWP_DOUBLE)\n#\tdefine GLM_CONFIG_PRECISION_DOUBLE\t\tGLM_LOWP\n#else\n#\tdefine GLM_CONFIG_PRECISION_DOUBLE\t\tGLM_HIGHP\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////\n// Check inclusions of different versions of GLM\n\n#elif ((GLM_SETUP_INCLUDED != GLM_VERSION) && !defined(GLM_FORCE_IGNORE_VERSION))\n#\terror \"GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error.\"\n#elif GLM_SETUP_INCLUDED == GLM_VERSION\n\n///////////////////////////////////////////////////////////////////////////////////\n// Messages\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_DISPLAYED)\n#\tdefine GLM_MESSAGE_DISPLAYED\n#\t\tdefine GLM_STR_HELPER(x) #x\n#\t\tdefine GLM_STR(x) GLM_STR_HELPER(x)\n\n\t// Report GLM version\n#\t\tpragma message (GLM_STR(GLM_VERSION_MESSAGE))\n\n\t// Report C++ language\n#\tif (GLM_LANG & GLM_LANG_CXX2A_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 2A with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX2A_FLAG)\n#\t\tpragma message(\"GLM: C++ 2A\")\n#\telif (GLM_LANG & GLM_LANG_CXX17_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 17 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX17_FLAG)\n#\t\tpragma message(\"GLM: C++ 17\")\n#\telif (GLM_LANG & GLM_LANG_CXX14_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 14 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX14_FLAG)\n#\t\tpragma message(\"GLM: C++ 14\")\n#\telif (GLM_LANG & GLM_LANG_CXX11_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 11 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX11_FLAG)\n#\t\tpragma message(\"GLM: C++ 11\")\n#\telif (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 0x with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX0X_FLAG)\n#\t\tpragma message(\"GLM: C++ 0x\")\n#\telif (GLM_LANG & GLM_LANG_CXX03_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 03 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX03_FLAG)\n#\t\tpragma message(\"GLM: C++ 03\")\n#\telif (GLM_LANG & GLM_LANG_CXX98_FLAG) && (GLM_LANG & GLM_LANG_EXT)\n#\t\tpragma message(\"GLM: C++ 98 with extensions\")\n#\telif (GLM_LANG & GLM_LANG_CXX98_FLAG)\n#\t\tpragma message(\"GLM: C++ 98\")\n#\telse\n#\t\tpragma message(\"GLM: C++ language undetected\")\n#\tendif//GLM_LANG\n\n\t// Report compiler detection\n#\tif GLM_COMPILER & GLM_COMPILER_CUDA\n#\t\tpragma message(\"GLM: CUDA compiler detected\")\n#\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tpragma message(\"GLM: Visual C++ compiler detected\")\n#\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\tpragma message(\"GLM: Clang compiler detected\")\n#\telif GLM_COMPILER & GLM_COMPILER_INTEL\n#\t\tpragma message(\"GLM: Intel Compiler detected\")\n#\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\tpragma message(\"GLM: GCC compiler detected\")\n#\telse\n#\t\tpragma message(\"GLM: Compiler not detected\")\n#\tendif\n\n\t// Report build target\n#\tif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with AVX2 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with AVX2 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with AVX instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_AVX_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with AVX instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSE4.2 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSE42_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSE4.2 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSE4.1 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSE41_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSE4.1 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSSE3 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSSE3_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSSE3 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSE3 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSE3_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSE3 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits with SSE2 instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_SSE2_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits with SSE2 instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: x86 64 bits build target\")\n#\telif (GLM_ARCH & GLM_ARCH_X86_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: x86 32 bits build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: ARM 64 bits with Neon instruction set build target\")\n#\telif (GLM_ARCH & GLM_ARCH_NEON_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: ARM 32 bits with Neon instruction set build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: ARM 64 bits build target\")\n#\telif (GLM_ARCH & GLM_ARCH_ARM_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: ARM 32 bits build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: MIPS 64 bits build target\")\n#\telif (GLM_ARCH & GLM_ARCH_MIPS_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: MIPS 32 bits build target\")\n\n#\telif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_64)\n#\t\tpragma message(\"GLM: PowerPC 64 bits build target\")\n#\telif (GLM_ARCH & GLM_ARCH_PPC_BIT) && (GLM_MODEL == GLM_MODEL_32)\n#\t\tpragma message(\"GLM: PowerPC 32 bits build target\")\n#\telse\n#\t\tpragma message(\"GLM: Unknown build target\")\n#\tendif//GLM_ARCH\n\n\t// Report platform name\n#\tif(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)\n#\t\tpragma message(\"GLM: QNX platform detected\")\n//#\telif(GLM_PLATFORM & GLM_PLATFORM_IOS)\n//#\t\tpragma message(\"GLM: iOS platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_APPLE)\n#\t\tpragma message(\"GLM: Apple platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_WINCE)\n#\t\tpragma message(\"GLM: WinCE platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)\n#\t\tpragma message(\"GLM: Windows platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)\n#\t\tpragma message(\"GLM: Native Client detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)\n#\t\tpragma message(\"GLM: Android platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_LINUX)\n#\t\tpragma message(\"GLM: Linux platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_UNIX)\n#\t\tpragma message(\"GLM: UNIX platform detected\")\n#\telif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)\n#\t\tpragma message(\"GLM: platform unknown\")\n#\telse\n#\t\tpragma message(\"GLM: platform not detected\")\n#\tendif\n\n\t// Report whether only xyzw component are used\n#\tif defined GLM_FORCE_XYZW_ONLY\n#\t\tpragma message(\"GLM: GLM_FORCE_XYZW_ONLY is defined. Only x, y, z and w component are available in vector type. This define disables swizzle operators and SIMD instruction sets.\")\n#\tendif\n\n\t// Report swizzle operator support\n#\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\t\tpragma message(\"GLM: GLM_FORCE_SWIZZLE is defined, swizzling operators enabled.\")\n#\telif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\t\tpragma message(\"GLM: GLM_FORCE_SWIZZLE is defined, swizzling functions enabled. Enable compiler C++ language extensions to enable swizzle operators.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_SWIZZLE is undefined. swizzling functions or operators are disabled.\")\n#\tendif\n\n\t// Report .length() type\n#\tif GLM_CONFIG_LENGTH_TYPE == GLM_LENGTH_SIZE_T\n#\t\tpragma message(\"GLM: GLM_FORCE_SIZE_T_LENGTH is defined. .length() returns a glm::length_t, a typedef of std::size_t.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_SIZE_T_LENGTH is undefined. .length() returns a glm::length_t, a typedef of int following GLSL.\")\n#\tendif\n\n#\tif GLM_CONFIG_UNRESTRICTED_GENTYPE == GLM_ENABLE\n#\t\tpragma message(\"GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is defined. Removes GLSL restrictions on valid function genTypes.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is undefined. Follows strictly GLSL on valid function genTypes.\")\n#\tendif\n\n#\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\tpragma message(\"GLM: GLM_FORCE_SILENT_WARNINGS is defined. Ignores C++ warnings from using C++ language extensions.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_SILENT_WARNINGS is undefined. Shows C++ warnings from using C++ language extensions.\")\n#\tendif\n\n#\tifdef GLM_FORCE_SINGLE_ONLY\n#\t\tpragma message(\"GLM: GLM_FORCE_SINGLE_ONLY is defined. Using only single precision floating-point types.\")\n#\tendif\n\n#\tif defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE)\n#\t\tundef GLM_FORCE_ALIGNED_GENTYPES\n#\t\tpragma message(\"GLM: GLM_FORCE_ALIGNED_GENTYPES is defined, allowing aligned types. This prevents the use of C++ constexpr.\")\n#\telif defined(GLM_FORCE_ALIGNED_GENTYPES) && (GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE)\n#\t\tundef GLM_FORCE_ALIGNED_GENTYPES\n#\t\tpragma message(\"GLM: GLM_FORCE_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.\")\n#\tendif\n\n#\tif defined(GLM_FORCE_DEFAULT_ALIGNED_GENTYPES)\n#\t\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE\n#\t\t\tundef GLM_FORCE_DEFAULT_ALIGNED_GENTYPES\n#\t\t\tpragma message(\"GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined but is disabled. It requires C++11 and language extensions.\")\n#\t\telif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n#\t\t\tpragma message(\"GLM: GLM_FORCE_DEFAULT_ALIGNED_GENTYPES is defined. All gentypes (e.g. vec3) will be aligned and padded by default.\")\n#\t\tendif\n#\tendif\n\n#\tif GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_ZO_BIT\n#\t\tpragma message(\"GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is defined. Using zero to one depth clip space.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is undefined. Using negative one to one depth clip space.\")\n#\tendif\n\n#\tif GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT\n#\t\tpragma message(\"GLM: GLM_FORCE_LEFT_HANDED is defined. Using left handed coordinate system.\")\n#\telse\n#\t\tpragma message(\"GLM: GLM_FORCE_LEFT_HANDED is undefined. Using right handed coordinate system.\")\n#\tendif\n#endif//GLM_MESSAGES\n\n#endif//GLM_SETUP_INCLUDED\n"}, {"path": "includes/glm/detail/type_float.hpp", "language": "code", "loc": 54, "comment_density": 0.111, "code": "#pragma once\n\n#include \"setup.hpp\"\n\n#if GLM_COMPILER == GLM_COMPILER_VC12\n#\tpragma warning(push)\n#\tpragma warning(disable: 4512) // assignment operator could not be generated\n#endif\n\nnamespace glm{\nnamespace detail\n{\n\ttemplate \n\tunion float_t\n\t{};\n\n\t// https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/\n\ttemplate <>\n\tunion float_t\n\t{\n\t\ttypedef int int_type;\n\t\ttypedef float float_type;\n\n\t\tGLM_CONSTEXPR float_t(float_type Num = 0.0f) : f(Num) {}\n\n\t\tGLM_CONSTEXPR float_t& operator=(float_t const& x)\n\t\t{\n\t\t\tf = x.f;\n\t\t\treturn *this;\n\t\t}\n\n\t\t// Portable extraction of components.\n\t\tGLM_CONSTEXPR bool negative() const { return i < 0; }\n\t\tGLM_CONSTEXPR int_type mantissa() const { return i & ((1 << 23) - 1); }\n\t\tGLM_CONSTEXPR int_type exponent() const { return (i >> 23) & ((1 << 8) - 1); }\n\n\t\tint_type i;\n\t\tfloat_type f;\n\t};\n\n\ttemplate <>\n\tunion float_t\n\t{\n\t\ttypedef detail::int64 int_type;\n\t\ttypedef double float_type;\n\n\t\tGLM_CONSTEXPR float_t(float_type Num = static_cast(0)) : f(Num) {}\n\n\t\tGLM_CONSTEXPR float_t& operator=(float_t const& x)\n\t\t{\n\t\t\tf = x.f;\n\t\t\treturn *this;\n\t\t}\n\n\t\t// Portable extraction of components.\n\t\tGLM_CONSTEXPR bool negative() const { return i < 0; }\n\t\tGLM_CONSTEXPR int_type mantissa() const { return i & ((int_type(1) << 52) - 1); }\n\t\tGLM_CONSTEXPR int_type exponent() const { return (i >> 52) & ((int_type(1) << 11) - 1); }\n\n\t\tint_type i;\n\t\tfloat_type f;\n\t};\n}//namespace detail\n}//namespace glm\n\n#if GLM_COMPILER == GLM_COMPILER_VC12\n#\tpragma warning(pop)\n#endif\n"}, {"path": "includes/glm/detail/type_half.hpp", "language": "code", "loc": 11, "comment_density": 0.182, "code": "#pragma once\n\n#include \"setup.hpp\"\n\nnamespace glm{\nnamespace detail\n{\n\ttypedef short hdata;\n\n\tGLM_FUNC_DECL float toFloat32(hdata value);\n\tGLM_FUNC_DECL hdata toFloat16(float const& value);\n\n}//namespace detail\n}//namespace glm\n\n#include \"type_half.inl\"\n"}, {"path": "includes/glm/detail/type_mat2x2.hpp", "language": "code", "loc": 131, "comment_density": 0.092, "code": "/// @ref core\n/// @file glm/detail/type_mat2x2.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<2, 2, T, Q>\n\t{\n\t\ttypedef vec<2, T, Q> col_type;\n\t\ttypedef vec<2, T, Q> row_type;\n\t\ttypedef mat<2, 2, T, Q> type;\n\t\ttypedef mat<2, 2, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[2];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 2, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT const& x1, T const& y1,\n\t\t\tT const& x2, T const& y2);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2);\n\n\t\t// -- Conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tU const& x1, V const& y1,\n\t\t\tM const& x2, N const& y2);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<2, U, Q> const& v1,\n\t\t\tvec<2, V, Q> const& v2);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator=(mat<2, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator+=(mat<2, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator-=(mat<2, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator*=(mat<2, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator/=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator/=(mat<2, 2, U, Q> const& m);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<2, 2, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator+(T scalar, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator-(T scalar, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(T scalar, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 2, T, Q>::col_type operator*(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 2, T, Q>::row_type operator*(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator/(T scalar, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 2, T, Q>::col_type operator/(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 2, T, Q>::row_type operator/(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n} //namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat2x2.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat2x3.hpp", "language": "code", "loc": 118, "comment_density": 0.102, "code": "/// @ref core\n/// @file glm/detail/type_mat2x3.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \"type_vec3.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<2, 3, T, Q>\n\t{\n\t\ttypedef vec<3, T, Q> col_type;\n\t\ttypedef vec<2, T, Q> row_type;\n\t\ttypedef mat<2, 3, T, Q> type;\n\t\ttypedef mat<3, 2, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[2];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 3, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0, T z0,\n\t\t\tT x1, T y1, T z1);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1);\n\n\t\t// -- Conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1, Z1 z1,\n\t\t\tX2 x2, Y2 y2, Z2 z2);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<3, U, Q> const& v1,\n\t\t\tvec<3, V, Q> const& v2);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator=(mat<2, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator+=(mat<2, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator-=(mat<2, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<2, 3, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator+(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator-(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(mat<2, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(T scalar, mat<2, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 3, T, Q>::col_type operator*(mat<2, 3, T, Q> const& m, typename mat<2, 3, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 3, T, Q>::row_type operator*(typename mat<2, 3, T, Q>::col_type const& v, mat<2, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(mat<2, 3, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(mat<2, 3, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<2, 3, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator/(mat<2, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator/(T scalar, mat<2, 3, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<2, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat2x3.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat2x4.hpp", "language": "code", "loc": 120, "comment_density": 0.1, "code": "/// @ref core\n/// @file glm/detail/type_mat2x4.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<2, 4, T, Q>\n\t{\n\t\ttypedef vec<4, T, Q> col_type;\n\t\ttypedef vec<2, T, Q> row_type;\n\t\ttypedef mat<2, 4, T, Q> type;\n\t\ttypedef mat<4, 2, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[2];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 2; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 4, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0, T z0, T w0,\n\t\t\tT x1, T y1, T z1, T w1);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1, typename W1,\n\t\t\ttypename X2, typename Y2, typename Z2, typename W2>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1, Z1 z1, W1 w1,\n\t\t\tX2 x2, Y2 y2, Z2 z2, W2 w2);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<4, U, Q> const& v1,\n\t\t\tvec<4, V, Q> const& v2);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator=(mat<2, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator+=(mat<2, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator-=(mat<2, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<2, 4, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator+(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator-(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(mat<2, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(T scalar, mat<2, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 4, T, Q>::col_type operator*(mat<2, 4, T, Q> const& m, typename mat<2, 4, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<2, 4, T, Q>::row_type operator*(typename mat<2, 4, T, Q>::col_type const& v, mat<2, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<2, 4, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(mat<2, 4, T, Q> const& m1, mat<2, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(mat<2, 4, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator/(mat<2, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator/(T scalar, mat<2, 4, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<2, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat2x4.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat3x2.hpp", "language": "code", "loc": 125, "comment_density": 0.096, "code": "/// @ref core\n/// @file glm/detail/type_mat3x2.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \"type_vec3.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<3, 2, T, Q>\n\t{\n\t\ttypedef vec<2, T, Q> col_type;\n\t\ttypedef vec<3, T, Q> row_type;\n\t\ttypedef mat<3, 2, T, Q> type;\n\t\ttypedef mat<2, 3, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[3];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 2, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0,\n\t\t\tT x1, T y1,\n\t\t\tT x2, T y2);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1,\n\t\t\ttypename X2, typename Y2,\n\t\t\ttypename X3, typename Y3>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1,\n\t\t\tX2 x2, Y2 y2,\n\t\t\tX3 x3, Y3 y3);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<2, V1, Q> const& v1,\n\t\t\tvec<2, V2, Q> const& v2,\n\t\t\tvec<2, V3, Q> const& v3);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator=(mat<3, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator+=(mat<3, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator-=(mat<3, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<3, 2, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(T scalar, mat<3, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 2, T, Q>::col_type operator*(mat<3, 2, T, Q> const& m, typename mat<3, 2, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 2, T, Q>::row_type operator*(typename mat<3, 2, T, Q>::col_type const& v, mat<3, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator/(mat<3, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator/(T scalar, mat<3, 2, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);\n\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat3x2.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat3x3.hpp", "language": "code", "loc": 138, "comment_density": 0.087, "code": "/// @ref core\n/// @file glm/detail/type_mat3x3.hpp\n\n#pragma once\n\n#include \"type_vec3.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<3, 3, T, Q>\n\t{\n\t\ttypedef vec<3, T, Q> col_type;\n\t\ttypedef vec<3, T, Q> row_type;\n\t\ttypedef mat<3, 3, T, Q> type;\n\t\ttypedef mat<3, 3, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[3];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 3, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0, T z0,\n\t\t\tT x1, T y1, T z1,\n\t\t\tT x2, T y2, T z2);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1,\n\t\t\ttypename X2, typename Y2, typename Z2,\n\t\t\ttypename X3, typename Y3, typename Z3>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1, Z1 z1,\n\t\t\tX2 x2, Y2 y2, Z2 z2,\n\t\t\tX3 x3, Y3 y3, Z3 z3);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<3, V1, Q> const& v1,\n\t\t\tvec<3, V2, Q> const& v2,\n\t\t\tvec<3, V3, Q> const& v3);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator=(mat<3, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator+=(mat<3, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator-=(mat<3, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator*=(mat<3, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator/=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator/=(mat<3, 3, U, Q> const& m);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator++();\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> & operator--();\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<3, 3, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator+(T scalar, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator+(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator-(T scalar, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator-(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(mat<3, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(T scalar, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 3, T, Q>::col_type operator*(mat<3, 3, T, Q> const& m, typename mat<3, 3, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 3, T, Q>::row_type operator*(typename mat<3, 3, T, Q>::col_type const& v, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(mat<3, 3, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<3, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator/(mat<3, 3, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator/(T scalar, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 3, T, Q>::col_type operator/(mat<3, 3, T, Q> const& m, typename mat<3, 3, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 3, T, Q>::row_type operator/(typename mat<3, 3, T, Q>::col_type const& v, mat<3, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator/(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<3, 3, T, Q> const& m1, mat<3, 3, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat3x3.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat3x4.hpp", "language": "code", "loc": 125, "comment_density": 0.096, "code": "/// @ref core\n/// @file glm/detail/type_mat3x4.hpp\n\n#pragma once\n\n#include \"type_vec3.hpp\"\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<3, 4, T, Q>\n\t{\n\t\ttypedef vec<4, T, Q> col_type;\n\t\ttypedef vec<3, T, Q> row_type;\n\t\ttypedef mat<3, 4, T, Q> type;\n\t\ttypedef mat<4, 3, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[3];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 4, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0, T z0, T w0,\n\t\t\tT x1, T y1, T z1, T w1,\n\t\t\tT x2, T y2, T z2, T w2);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1, typename W1,\n\t\t\ttypename X2, typename Y2, typename Z2, typename W2,\n\t\t\ttypename X3, typename Y3, typename Z3, typename W3>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 x1, Y1 y1, Z1 z1, W1 w1,\n\t\t\tX2 x2, Y2 y2, Z2 z2, W2 w2,\n\t\t\tX3 x3, Y3 y3, Z3 z3, W3 w3);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<4, V1, Q> const& v1,\n\t\t\tvec<4, V2, Q> const& v2,\n\t\t\tvec<4, V3, Q> const& v3);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator=(mat<3, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator+=(mat<3, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator-=(mat<3, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator++();\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> & operator--();\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<3, 4, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator+(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator-(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(mat<3, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(T scalar, mat<3, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 4, T, Q>::col_type operator*(mat<3, 4, T, Q> const& m, typename mat<3, 4, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<3, 4, T, Q>::row_type operator*(typename mat<3, 4, T, Q>::col_type const& v, mat<3, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1,\tmat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1, mat<2, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(mat<3, 4, T, Q> const& m1,\tmat<3, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator/(mat<3, 4, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator/(T scalar, mat<3, 4, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<3, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat3x4.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat4x2.hpp", "language": "code", "loc": 130, "comment_density": 0.092, "code": "/// @ref core\n/// @file glm/detail/type_mat4x2.hpp\n\n#pragma once\n\n#include \"type_vec2.hpp\"\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<4, 2, T, Q>\n\t{\n\t\ttypedef vec<2, T, Q> col_type;\n\t\ttypedef vec<4, T, Q> row_type;\n\t\ttypedef mat<4, 2, T, Q> type;\n\t\ttypedef mat<2, 4, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[4];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 2, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT x0, T y0,\n\t\t\tT x1, T y1,\n\t\t\tT x2, T y2,\n\t\t\tT x3, T y3);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2,\n\t\t\tcol_type const& v3);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X0, typename Y0,\n\t\t\ttypename X1, typename Y1,\n\t\t\ttypename X2, typename Y2,\n\t\t\ttypename X3, typename Y3>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX0 x0, Y0 y0,\n\t\t\tX1 x1, Y1 y1,\n\t\t\tX2 x2, Y2 y2,\n\t\t\tX3 x3, Y3 y3);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<2, V1, Q> const& v1,\n\t\t\tvec<2, V2, Q> const& v2,\n\t\t\tvec<2, V3, Q> const& v3,\n\t\t\tvec<2, V4, Q> const& v4);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator=(mat<4, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator+=(mat<4, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator-=(mat<4, 2, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator++ ();\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> & operator-- ();\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<4, 2, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator+(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator-(mat<4, 2, T, Q> const& m1,\tmat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<4, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(T scalar, mat<4, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 2, T, Q>::col_type operator*(mat<4, 2, T, Q> const& m, typename mat<4, 2, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 2, T, Q>::row_type operator*(typename mat<4, 2, T, Q>::col_type const& v, mat<4, 2, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<4, 2, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<4, 2, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<4, 2, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator/(mat<4, 2, T, Q> const& m, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> operator/(T scalar, mat<4, 2, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<4, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat4x2.inl\"\n#endif\n"}, {"path": "includes/glm/detail/type_mat4x3.hpp", "language": "code", "loc": 130, "comment_density": 0.1, "code": "/// @ref core\n/// @file glm/detail/type_mat4x3.hpp\n\n#pragma once\n\n#include \"type_vec3.hpp\"\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<4, 3, T, Q>\n\t{\n\t\ttypedef vec<3, T, Q> col_type;\n\t\ttypedef vec<4, T, Q> row_type;\n\t\ttypedef mat<4, 3, T, Q> type;\n\t\ttypedef mat<3, 4, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[4];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 4; }\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 3, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T const& x);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT const& x0, T const& y0, T const& z0,\n\t\t\tT const& x1, T const& y1, T const& z1,\n\t\t\tT const& x2, T const& y2, T const& z2,\n\t\t\tT const& x3, T const& y3, T const& z3);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2,\n\t\t\tcol_type const& v3);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1,\n\t\t\ttypename X2, typename Y2, typename Z2,\n\t\t\ttypename X3, typename Y3, typename Z3,\n\t\t\ttypename X4, typename Y4, typename Z4>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 const& x1, Y1 const& y1, Z1 const& z1,\n\t\t\tX2 const& x2, Y2 const& y2, Z2 const& z2,\n\t\t\tX3 const& x3, Y3 const& y3, Z3 const& z3,\n\t\t\tX4 const& x4, Y4 const& y4, Z4 const& z4);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<3, V1, Q> const& v1,\n\t\t\tvec<3, V2, Q> const& v2,\n\t\t\tvec<3, V3, Q> const& v3,\n\t\t\tvec<3, V4, Q> const& v4);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator=(mat<4, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator+=(mat<4, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator-=(mat<4, 3, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> & operator/=(U s);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q>& operator++();\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q>& operator--();\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<4, 3, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator+(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator-(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(T const& s, mat<4, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 3, T, Q>::col_type operator*(mat<4, 3, T, Q> const& m, typename mat<4, 3, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 3, T, Q>::row_type operator*(typename mat<4, 3, T, Q>::col_type const& v, mat<4, 3, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1,\tmat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator*(mat<4, 3, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator/(mat<4, 3, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> operator/(T const& s, mat<4, 3, T, Q> const& m);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<4, 3, T, Q> const& m1, mat<4, 3, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat4x3.inl\"\n#endif //GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_mat4x4.hpp", "language": "code", "loc": 143, "comment_density": 0.091, "code": "/// @ref core\n/// @file glm/detail/type_mat4x4.hpp\n\n#pragma once\n\n#include \"type_vec4.hpp\"\n#include \n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct mat<4, 4, T, Q>\n\t{\n\t\ttypedef vec<4, T, Q> col_type;\n\t\ttypedef vec<4, T, Q> row_type;\n\t\ttypedef mat<4, 4, T, Q> type;\n\t\ttypedef mat<4, 4, T, Q> transpose_type;\n\t\ttypedef T value_type;\n\n\tprivate:\n\t\tcol_type value[4];\n\n\tpublic:\n\t\t// -- Accesses --\n\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}\n\n\t\tGLM_FUNC_DECL col_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;\n\n\t\t// -- Constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 4, T, P> const& m);\n\n\t\tGLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T const& x);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tT const& x0, T const& y0, T const& z0, T const& w0,\n\t\t\tT const& x1, T const& y1, T const& z1, T const& w1,\n\t\t\tT const& x2, T const& y2, T const& z2, T const& w2,\n\t\t\tT const& x3, T const& y3, T const& z3, T const& w3);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tcol_type const& v0,\n\t\t\tcol_type const& v1,\n\t\t\tcol_type const& v2,\n\t\t\tcol_type const& v3);\n\n\t\t// -- Conversions --\n\n\t\ttemplate<\n\t\t\ttypename X1, typename Y1, typename Z1, typename W1,\n\t\t\ttypename X2, typename Y2, typename Z2, typename W2,\n\t\t\ttypename X3, typename Y3, typename Z3, typename W3,\n\t\t\ttypename X4, typename Y4, typename Z4, typename W4>\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tX1 const& x1, Y1 const& y1, Z1 const& z1, W1 const& w1,\n\t\t\tX2 const& x2, Y2 const& y2, Z2 const& z2, W2 const& w2,\n\t\t\tX3 const& x3, Y3 const& y3, Z3 const& z3, W3 const& w3,\n\t\t\tX4 const& x4, Y4 const& y4, Z4 const& z4, W4 const& w4);\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR mat(\n\t\t\tvec<4, V1, Q> const& v1,\n\t\t\tvec<4, V2, Q> const& v2,\n\t\t\tvec<4, V3, Q> const& v3,\n\t\t\tvec<4, V4, Q> const& v4);\n\n\t\t// -- Matrix conversions --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, U, P> const& m);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator=(mat<4, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator+=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator+=(mat<4, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator-=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator-=(mat<4, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator*=(mat<4, 4, U, Q> const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator/=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator/=(mat<4, 4, U, Q> const& m);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator++();\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> & operator--();\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL mat<4, 4, T, Q> operator--(int);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator+(T const& s, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator-(T const& s, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m1,\tmat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(T const& s, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 4, T, Q>::col_type operator*(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 4, T, Q>::row_type operator*(typename mat<4, 4, T, Q>::col_type const& v, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator/(T const& s, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 4, T, Q>::col_type operator/(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL typename mat<4, 4, T, Q>::row_type operator/(typename mat<4, 4, T, Q>::col_type const& v, mat<4, 4, T, Q> const& m);\n\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m1,\tmat<4, 4, T, Q> const& m2);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_mat4x4.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_quat.hpp", "language": "code", "loc": 146, "comment_density": 0.253, "code": "/// @ref gtc_quaternion\n/// @file glm/gtc/quaternion.hpp\n///\n/// @see core (dependence)\n/// @see gtc_constants (dependence)\n///\n/// @defgroup gtc_quaternion GLM_GTC_quaternion\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines a templated quaternion type and several quaternion operations.\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_mat3x3.hpp\"\n#include \"../detail/type_mat4x4.hpp\"\n#include \"../detail/type_vec3.hpp\"\n#include \"../detail/type_vec4.hpp\"\n#include \"../ext/vector_relational.hpp\"\n#include \"../ext/quaternion_relational.hpp\"\n#include \"../gtc/constants.hpp\"\n#include \"../gtc/matrix_transform.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup gtc_quaternion\n\t/// @{\n\n\ttemplate\n\tstruct qua\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef qua type;\n\t\ttypedef T value_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_LANG & GLM_LANG_CXXMS_FLAG\n\t\t\tunion\n\t\t\t{\n\t\t\t\tstruct { T x, y, z, w;};\n\n\t\t\t\ttypename detail::storage<4, T, detail::is_aligned::value>::type data;\n\t\t\t};\n#\t\telse\n\t\t\tT x, y, z, w;\n#\t\tendif\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\ttypedef length_t length_type;\n\t\t/// Return the count of components of a quaternion\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua(qua const& q) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua(qua const& q);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua(T s, vec<3, T, Q> const& v);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR qua(T w, T x, T y, T z);\n\n\t\t// -- Conversion constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT qua(qua const& q);\n\n\t\t/// Explicit conversion operators\n#\t\tif GLM_HAS_EXPLICIT_CONVERSION_OPERATORS\n\t\t\tGLM_FUNC_DECL explicit operator mat<3, 3, T, Q>();\n\t\t\tGLM_FUNC_DECL explicit operator mat<4, 4, T, Q>();\n#\t\tendif\n\n\t\t/// Create a quaternion from two normalized axis\n\t\t///\n\t\t/// @param u A first normalized axis\n\t\t/// @param v A second normalized axis\n\t\t/// @see gtc_quaternion\n\t\t/// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors\n\t\tGLM_FUNC_DECL qua(vec<3, T, Q> const& u, vec<3, T, Q> const& v);\n\n\t\t/// Build a quaternion from euler angles (pitch, yaw, roll), in radians.\n\t\tGLM_FUNC_DECL GLM_EXPLICIT qua(vec<3, T, Q> const& eulerAngles);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT qua(mat<3, 3, T, Q> const& q);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT qua(mat<4, 4, T, Q> const& q);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL qua& operator=(qua const& q) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator=(qua const& q);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator+=(qua const& q);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator-=(qua const& q);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator*=(qua const& q);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL qua& operator/=(U s);\n\t};\n\n\t// -- Unary bit operators --\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator+(qua const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator-(qua const& q);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator+(qua const& q, qua const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator-(qua const& q, qua const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator*(qua const& q, qua const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> operator*(qua const& q, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, qua const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> operator*(qua const& q, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, qua const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator*(qua const& q, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator*(T const& s, qua const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL qua operator/(qua const& q, T const& s);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(qua const& q1, qua const& q2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(qua const& q1, qua const& q2);\n\n\t/// @}\n} //namespace glm\n\n#include \"type_quat.inl\"\n"}, {"path": "includes/glm/detail/type_vec1.hpp", "language": "code", "loc": 241, "comment_density": 0.207, "code": "/// @ref core\n/// @file glm/detail/type_vec1.hpp\n\n#pragma once\n\n#include \"qualifier.hpp\"\n#if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\tinclude \"_swizzle.hpp\"\n#elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\tinclude \"_swizzle_func.hpp\"\n#endif\n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct vec<1, T, Q>\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef vec<1, T, Q> type;\n\t\ttypedef vec<1, bool, Q> bool_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_CONFIG_XYZW_ONLY\n\t\t\tT x;\n#\t\telif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE\n\t\t\tunion\n\t\t\t{\n\t\t\t\tT x;\n\t\t\t\tT r;\n\t\t\t\tT s;\n\n\t\t\t\ttypename detail::storage<1, T, detail::is_aligned::value>::type data;\n/*\n#\t\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\t\t\t_GLM_SWIZZLE1_2_MEMBERS(T, Q, x)\n\t\t\t\t\t_GLM_SWIZZLE1_2_MEMBERS(T, Q, r)\n\t\t\t\t\t_GLM_SWIZZLE1_2_MEMBERS(T, Q, s)\n\t\t\t\t\t_GLM_SWIZZLE1_3_MEMBERS(T, Q, x)\n\t\t\t\t\t_GLM_SWIZZLE1_3_MEMBERS(T, Q, r)\n\t\t\t\t\t_GLM_SWIZZLE1_3_MEMBERS(T, Q, s)\n\t\t\t\t\t_GLM_SWIZZLE1_4_MEMBERS(T, Q, x)\n\t\t\t\t\t_GLM_SWIZZLE1_4_MEMBERS(T, Q, r)\n\t\t\t\t\t_GLM_SWIZZLE1_4_MEMBERS(T, Q, s)\n#\t\t\t\tendif\n*/\n\t\t\t};\n#\t\telse\n\t\t\tunion {T x, r, s;};\n/*\n#\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n\t\t\t\tGLM_SWIZZLE_GEN_VEC_FROM_VEC1(T, Q)\n#\t\t\tendif\n*/\n#\t\tendif\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\t/// Return the count of components of the vector\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 1;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, T, P> const& v);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);\n\n\t\t// -- Conversion vector constructors --\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<2, U, P> const& v);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<1, U, P> const& v);\n\n\t\t// -- Swizzle constructors --\n/*\n#\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<1, T, Q, E0, -1,-2,-3> const& that)\n\t\t\t{\n\t\t\t\t*this = that();\n\t\t\t}\n#\t\tendif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n*/\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator=(vec const& v) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator+=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator+=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator-=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator-=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator*=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator*=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator/=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator/=(vec<1, U, Q> const& v);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator++();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator--();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator--(int);\n\n\t\t// -- Unary bit operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator%=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator%=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator&=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator&=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator|=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator|=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator^=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator^=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator<<=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator<<=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator>>=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> & operator>>=(vec<1, U, Q> const& v);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(vec<1, T, Q> const& v);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator+(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator-(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator*(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator*(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator*(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator/(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator/(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator/(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator%(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator%(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator%(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator&(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator&(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator&(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator|(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator|(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator|(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator^(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator^(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator^(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator<<(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator<<(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator<<(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator>>(vec<1, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator>>(T scalar, vec<1, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator>>(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, T, Q> operator~(vec<1, T, Q> const& v);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<1, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, bool, Q> operator&&(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<1, bool, Q> operator||(vec<1, bool, Q> const& v1, vec<1, bool, Q> const& v2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_vec1.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_vec2.hpp", "language": "code", "loc": 306, "comment_density": 0.085, "code": "/// @ref core\n/// @file glm/detail/type_vec2.hpp\n\n#pragma once\n\n#include \"qualifier.hpp\"\n#if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\tinclude \"_swizzle.hpp\"\n#elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\tinclude \"_swizzle_func.hpp\"\n#endif\n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct vec<2, T, Q>\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef vec<2, T, Q> type;\n\t\ttypedef vec<2, bool, Q> bool_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_CONFIG_XYZW_ONLY\n\t\t\tT x, y;\n#\t\telif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE\n\t\t\tunion\n\t\t\t{\n\t\t\t\tstruct{ T x, y; };\n\t\t\t\tstruct{ T r, g; };\n\t\t\t\tstruct{ T s, t; };\n\n\t\t\t\ttypename detail::storage<2, T, detail::is_aligned::value>::type data;\n\n#\t\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\t\t\tGLM_SWIZZLE2_2_MEMBERS(T, Q, x, y)\n\t\t\t\t\tGLM_SWIZZLE2_2_MEMBERS(T, Q, r, g)\n\t\t\t\t\tGLM_SWIZZLE2_2_MEMBERS(T, Q, s, t)\n\t\t\t\t\tGLM_SWIZZLE2_3_MEMBERS(T, Q, x, y)\n\t\t\t\t\tGLM_SWIZZLE2_3_MEMBERS(T, Q, r, g)\n\t\t\t\t\tGLM_SWIZZLE2_3_MEMBERS(T, Q, s, t)\n\t\t\t\t\tGLM_SWIZZLE2_4_MEMBERS(T, Q, x, y)\n\t\t\t\t\tGLM_SWIZZLE2_4_MEMBERS(T, Q, r, g)\n\t\t\t\t\tGLM_SWIZZLE2_4_MEMBERS(T, Q, s, t)\n#\t\t\t\tendif\n\t\t\t};\n#\t\telse\n\t\t\tunion {T x, r, s;};\n\t\t\tunion {T y, g, t;};\n\n#\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n\t\t\t\tGLM_SWIZZLE_GEN_VEC_FROM_VEC2(T, Q)\n#\t\t\tendif//GLM_CONFIG_SWIZZLE\n#\t\tendif\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\t/// Return the count of components of the vector\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T& operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, T, P> const& v);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T x, T y);\n\n\t\t// -- Conversion constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A x, B y);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, B y);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A x, vec<1, B, Q> const& y);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, Q> const& x, vec<1, B, Q> const& y);\n\n\t\t// -- Conversion vector constructors --\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<2, U, P> const& v);\n\n\t\t// -- Swizzle constructors --\n#\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1,-1,-2> const& that)\n\t\t\t{\n\t\t\t\t*this = that();\n\t\t\t}\n#\t\tendif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec const& v) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator+=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator-=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator*=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator/=(vec<2, U, Q> const& v);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator++();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator--();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator--(int);\n\n\t\t// -- Unary bit operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator%=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator&=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator|=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator^=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator<<=(vec<2, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> & operator>>=(vec<2, U, Q> const& v);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(T scalar, vec<2, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator~(vec<2, T, Q> const& v);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator&&(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<2, bool, Q> operator||(vec<2, bool, Q> const& v1, vec<2, bool, Q> const& v2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_vec2.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_vec3.hpp", "language": "code", "loc": 337, "comment_density": 0.092, "code": "/// @ref core\n/// @file glm/detail/type_vec3.hpp\n\n#pragma once\n\n#include \"qualifier.hpp\"\n#if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\tinclude \"_swizzle.hpp\"\n#elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\tinclude \"_swizzle_func.hpp\"\n#endif\n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct vec<3, T, Q>\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef vec<3, T, Q> type;\n\t\ttypedef vec<3, bool, Q> bool_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\t\tif GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE\n#\t\t\t\t\tpragma warning(disable: 4324) // structure was padded due to alignment specifier\n#\t\t\t\tendif\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_CONFIG_XYZW_ONLY\n\t\t\tT x, y, z;\n#\t\telif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE\n\t\t\tunion\n\t\t\t{\n\t\t\t\tstruct{ T x, y, z; };\n\t\t\t\tstruct{ T r, g, b; };\n\t\t\t\tstruct{ T s, t, p; };\n\n\t\t\t\ttypename detail::storage<3, T, detail::is_aligned::value>::type data;\n\n#\t\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\t\t\tGLM_SWIZZLE3_2_MEMBERS(T, Q, x, y, z)\n\t\t\t\t\tGLM_SWIZZLE3_2_MEMBERS(T, Q, r, g, b)\n\t\t\t\t\tGLM_SWIZZLE3_2_MEMBERS(T, Q, s, t, p)\n\t\t\t\t\tGLM_SWIZZLE3_3_MEMBERS(T, Q, x, y, z)\n\t\t\t\t\tGLM_SWIZZLE3_3_MEMBERS(T, Q, r, g, b)\n\t\t\t\t\tGLM_SWIZZLE3_3_MEMBERS(T, Q, s, t, p)\n\t\t\t\t\tGLM_SWIZZLE3_4_MEMBERS(T, Q, x, y, z)\n\t\t\t\t\tGLM_SWIZZLE3_4_MEMBERS(T, Q, r, g, b)\n\t\t\t\t\tGLM_SWIZZLE3_4_MEMBERS(T, Q, s, t, p)\n#\t\t\t\tendif\n\t\t\t};\n#\t\telse\n\t\t\tunion { T x, r, s; };\n\t\t\tunion { T y, g, t; };\n\t\t\tunion { T z, b, p; };\n\n#\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n\t\t\t\tGLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, Q)\n#\t\t\tendif//GLM_CONFIG_SWIZZLE\n#\t\tendif//GLM_LANG\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\t/// Return the count of components of the vector\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 3;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, T, P> const& v);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T a, T b, T c);\n\n\t\t// -- Conversion scalar constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X x, Y y, Z z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, Z _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, Z _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, Z _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, vec<1, Z, Q> const& _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, vec<1, Z, Q> const& _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z);\n\n\t\t// -- Conversion vector constructors --\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, B _z);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<2, B, P> const& _yz);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<3, U, P> const& v);\n\n\t\t// -- Swizzle constructors --\n#\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1> const& that)\n\t\t\t{\n\t\t\t\t*this = that();\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v, T const& scalar)\n\t\t\t{\n\t\t\t\t*this = vec(v(), scalar);\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T const& scalar, detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v)\n\t\t\t{\n\t\t\t\t*this = vec(scalar, v());\n\t\t\t}\n#\t\tendif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q>& operator=(vec<3, T, Q> const& v) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator+=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator-=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator*=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator/=(vec<3, U, Q> const& v);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator++();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator--();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator--(int);\n\n\t\t// -- Unary bit operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator%=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator&=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator|=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator^=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator<<=(vec<3, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> & operator>>=(vec<3, U, Q> const& v);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q> const& v);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator+(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator-(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator*(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator/(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator%(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q> const& v1, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator&(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator|(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator^(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator<<(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(T scalar, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<1, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator>>(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> operator~(vec<3, T, Q> const& v);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<3, T, Q> const& v1, vec<3, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, bool, Q> operator&&(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<3, bool, Q> operator||(vec<3, bool, Q> const& v1, vec<3, bool, Q> const& v2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_vec3.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}, {"path": "includes/glm/detail/type_vec4.hpp", "language": "code", "loc": 405, "comment_density": 0.099, "code": "/// @ref core\n/// @file glm/detail/type_vec4.hpp\n\n#pragma once\n\n#include \"qualifier.hpp\"\n#if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n#\tinclude \"_swizzle.hpp\"\n#elif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n#\tinclude \"_swizzle_func.hpp\"\n#endif\n#include \n\nnamespace glm\n{\n\ttemplate\n\tstruct vec<4, T, Q>\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef vec<4, T, Q> type;\n\t\ttypedef vec<4, bool, Q> bool_type;\n\n\t\t// -- Data --\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic push\n#\t\t\t\tpragma GCC diagnostic ignored \"-Wpedantic\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic push\n#\t\t\t\tpragma clang diagnostic ignored \"-Wgnu-anonymous-struct\"\n#\t\t\t\tpragma clang diagnostic ignored \"-Wnested-anon-types\"\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(push)\n#\t\t\t\tpragma warning(disable: 4201) // nonstandard extension used : nameless struct/union\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_CONFIG_XYZW_ONLY\n\t\t\tT x, y, z, w;\n#\t\telif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE\n\t\t\tunion\n\t\t\t{\n\t\t\t\tstruct { T x, y, z, w; };\n\t\t\t\tstruct { T r, g, b, a; };\n\t\t\t\tstruct { T s, t, p, q; };\n\n\t\t\t\ttypename detail::storage<4, T, detail::is_aligned::value>::type data;\n\n#\t\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\t\t\tGLM_SWIZZLE4_2_MEMBERS(T, Q, x, y, z, w)\n\t\t\t\t\tGLM_SWIZZLE4_2_MEMBERS(T, Q, r, g, b, a)\n\t\t\t\t\tGLM_SWIZZLE4_2_MEMBERS(T, Q, s, t, p, q)\n\t\t\t\t\tGLM_SWIZZLE4_3_MEMBERS(T, Q, x, y, z, w)\n\t\t\t\t\tGLM_SWIZZLE4_3_MEMBERS(T, Q, r, g, b, a)\n\t\t\t\t\tGLM_SWIZZLE4_3_MEMBERS(T, Q, s, t, p, q)\n\t\t\t\t\tGLM_SWIZZLE4_4_MEMBERS(T, Q, x, y, z, w)\n\t\t\t\t\tGLM_SWIZZLE4_4_MEMBERS(T, Q, r, g, b, a)\n\t\t\t\t\tGLM_SWIZZLE4_4_MEMBERS(T, Q, s, t, p, q)\n#\t\t\t\tendif\n\t\t\t};\n#\t\telse\n\t\t\tunion { T x, r, s; };\n\t\t\tunion { T y, g, t; };\n\t\t\tunion { T z, b, p; };\n\t\t\tunion { T w, a, q; };\n\n#\t\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION\n\t\t\t\tGLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, Q)\n#\t\t\tendif\n#\t\tendif\n\n#\t\tif GLM_SILENT_WARNINGS == GLM_ENABLE\n#\t\t\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\t\t\tpragma clang diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_GCC\n#\t\t\t\tpragma GCC diagnostic pop\n#\t\t\telif GLM_COMPILER & GLM_COMPILER_VC\n#\t\t\t\tpragma warning(pop)\n#\t\t\tendif\n#\t\tendif\n\n\t\t// -- Component accesses --\n\n\t\t/// Return the count of components of the vector\n\t\ttypedef length_t length_type;\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<4, T, Q> const& v) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<4, T, P> const& v);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T x, T y, T z, T w);\n\n\t\t// -- Conversion scalar constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, Z _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, Z _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, Z _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, Z _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, vec<1, Z, Q> const& _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, vec<1, Z, Q> const& _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z, W _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, Z _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, Z _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _y, Z _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, Y _y, vec<1, Z, Q> const& _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, Y _y, vec<1, Z, Q> const& _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(X _x, vec<1, Y, Q> const& _y, vec<1, Z, Q> const& _z, vec<1, W, Q> const& _w);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, X, Q> const& _x, vec<1, Y, Q> const& _Y, vec<1, Z, Q> const& _z, vec<1, W, Q> const& _w);\n\n\t\t// -- Conversion vector constructors --\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, B _z, C _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, C _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, B _z, vec<1, C, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<1, B, P> const& _z, vec<1, C, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<2, B, P> const& _yz, C _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, C _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<2, B, P> const& _yz, vec<1, C, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, B _y, vec<2, C, P> const& _zw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, B _y, vec<2, C, P> const& _zw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<1, B, P> const& _y, vec<2, C, P> const& _zw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, A, P> const& _xyz, B _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<3, A, P> const& _xyz, vec<1, B, P> const& _w);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(A _x, vec<3, B, P> const& _yzw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<1, A, P> const& _x, vec<3, B, P> const& _yzw);\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(vec<2, A, P> const& _xy, vec<2, B, P> const& _zw);\n\n\t\t/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<4, U, P> const& v);\n\n\t\t// -- Swizzle constructors --\n#\t\tif GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<4, T, Q, E0, E1, E2, E3> const& that)\n\t\t\t{\n\t\t\t\t*this = that();\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v, detail::_swizzle<2, T, Q, F0, F1, -1, -2> const& u)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(v(), u());\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T const& x, T const& y, detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(x, y, v());\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T const& x, detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v, T const& w)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(x, v(), w);\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<2, T, Q, E0, E1, -1, -2> const& v, T const& z, T const& w)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(v(), z, w);\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(detail::_swizzle<3, T, Q, E0, E1, E2, -1> const& v, T const& w)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(v(), w);\n\t\t\t}\n\n\t\t\ttemplate\n\t\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec(T const& x, detail::_swizzle<3, T, Q, E0, E1, E2, -1> const& v)\n\t\t\t{\n\t\t\t\t*this = vec<4, T, Q>(x, v());\n\t\t\t}\n#\t\tendif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator=(vec<4, T, Q> const& v) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator+=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator+=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator+=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator-=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator-=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator-=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator*=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator*=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator*=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator/=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator/=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q>& operator/=(vec<4, U, Q> const& v);\n\n\t\t// -- Increment and decrement operators --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator++();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator--();\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator++(int);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator--(int);\n\n\t\t// -- Unary bit operators --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator%=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator%=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator%=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator&=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator&=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator&=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator|=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator|=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator|=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator^=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator^=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator^=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator<<=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator<<=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator<<=(vec<4, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator>>=(U scalar);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator>>=(vec<1, U, Q> const& v);\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> & operator>>=(vec<4, U, Q> const& v);\n\t};\n\n\t// -- Unary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v, T const & scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<1, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator+(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v, T const & scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<1, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator-(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v, T const & scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<1, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator*(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v, T const & scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v1, vec<1, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<1, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator/(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator%(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator&(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator|(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator^(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator<<(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(vec<4, T, Q> const& v, T scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(vec<4, T, Q> const& v, vec<1, T, Q> const& scalar);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(T scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(vec<1, T, Q> const& scalar, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator>>(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, T, Q> operator~(vec<4, T, Q> const& v);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<4, T, Q> const& v1, vec<4, T, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, bool, Q> operator&&(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2);\n\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec<4, bool, Q> operator||(vec<4, bool, Q> const& v1, vec<4, bool, Q> const& v2);\n}//namespace glm\n\n#ifndef GLM_EXTERNAL_TEMPLATE\n#include \"type_vec4.inl\"\n#endif//GLM_EXTERNAL_TEMPLATE\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.139, "dedup_hash": "18bfbc78ddf44843", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_ext", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Ext", "api": "OpenGL Core", "glsl_version": null, "topic": "camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/ext/matrix_clip_space.hpp", "language": "code", "loc": 473, "comment_density": 0.712, "code": "/// @ref ext_matrix_clip_space\n/// @file glm/ext/matrix_clip_space.hpp\n///\n/// @defgroup ext_matrix_clip_space GLM_EXT_matrix_clip_space\n/// @ingroup ext\n///\n/// Defines functions that generate clip space transformation matrices.\n///\n/// The matrices generated by this extension use standard OpenGL fixed-function\n/// conventions. For example, the lookAt function generates a transform from world\n/// space into the specific eye space that the projective matrix functions\n/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility\n/// specifications defines the particular layout of this eye space.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_matrix_transform\n/// @see ext_matrix_projection\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_constants.hpp\"\n#include \"../geometric.hpp\"\n#include \"../trigonometric.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_matrix_clip_space extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_matrix_clip_space\n\t/// @{\n\n\t/// Creates a matrix for projecting two-dimensional coordinates onto the screen.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top, T const& zNear, T const& zFar)\n\t/// @see gluOrtho2D man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(\n\t\tT left, T right, T bottom, T top);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_ZO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume using right-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_NO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_ZO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_NO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoZO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoNO(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a matrix for an orthographic parallel viewing volume, using the default handedness and default near and far clip planes definition.\n\t/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t///\n\t/// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)\n\t/// @see glOrtho man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(\n\t\tT left, T right, T bottom, T top, T zNear, T zFar);\n\n\t/// Creates a left handed frustum matrix.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_ZO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a left handed frustum matrix.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_NO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a right handed frustum matrix.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_ZO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a right handed frustum matrix.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_NO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumZO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumNO(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a left handed frustum matrix.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a right handed frustum matrix.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\t/// Creates a frustum matrix with default handedness, using the default handedness and default near and far clip planes definition.\n\t/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @see glFrustum man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> frustum(\n\t\tT left, T right, T bottom, T top, T near, T far);\n\n\n\t/// Creates a matrix for a right handed, symmetric perspective-view frustum.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_ZO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a right handed, symmetric perspective-view frustum.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_NO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a left handed, symmetric perspective-view frustum.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_ZO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a left handed, symmetric perspective-view frustum.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_NO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveZO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveNO(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a right handed, symmetric perspective-view frustum.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a left handed, symmetric perspective-view frustum.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum based on the default handedness and default near and far clip planes definition.\n\t/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @param fovy Specifies the field of view angle in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @see gluPerspective man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspective(\n\t\tT fovy, T aspect, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using right-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_ZO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using right-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_NO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_ZO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using left-handed coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_NO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovZO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovNO(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a right handed perspective projection matrix based on a field of view.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a left handed perspective projection matrix based on a field of view.\n\t/// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t/// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Builds a perspective projection matrix based on a field of view and the default handedness and default near and far clip planes definition.\n\t/// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @param fov Expressed in radians.\n\t/// @param width Width of the viewport\n\t/// @param height Height of the viewport\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFov(\n\t\tT fov, T width, T height, T near, T far);\n\n\t/// Creates a matrix for a left handed, symmetric perspective-view frustum with far plane at infinite.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH(\n\t\tT fovy, T aspect, T near);\n\n\t/// Creates a matrix for a right handed, symmetric perspective-view frustum with far plane at infinite.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH(\n\t\tT fovy, T aspect, T near);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite with default handedness.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspective(\n\t\tT fovy, T aspect, T near);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(\n\t\tT fovy, T aspect, T near);\n\n\t/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.\n\t///\n\t/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.\n\t/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).\n\t/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).\n\t/// @param ep Epsilon\n\t///\n\t/// @tparam T A floating-point scalar type\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(\n\t\tT fovy, T aspect, T near, T ep);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_clip_space.inl\"\n"}, {"path": "includes/glm/ext/matrix_double2x2.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x2.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 2, double, defaultp>\t\tdmat2x2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 2, double, defaultp>\t\tdmat2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x2_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, lowp>\t\tlowp_dmat2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, mediump>\tmediump_dmat2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, highp>\thighp_dmat2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, lowp>\t\tlowp_dmat2x2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, mediump>\tmediump_dmat2x2;\n\n\t/// 2 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, double, highp>\thighp_dmat2x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x3.hpp\n\n#pragma once\n#include \"../detail/type_mat2x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 3 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 3, double, defaultp>\t\tdmat2x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, double, lowp>\t\tlowp_dmat2x3;\n\n\t/// 2 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, double, mediump>\tmediump_dmat2x3;\n\n\t/// 2 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, double, highp>\thighp_dmat2x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x4.hpp\n\n#pragma once\n#include \"../detail/type_mat2x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 4 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 4, double, defaultp>\t\tdmat2x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double2x4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double2x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, double, lowp>\t\tlowp_dmat2x4;\n\n\t/// 2 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, double, mediump>\tmediump_dmat2x4;\n\n\t/// 2 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, double, highp>\thighp_dmat2x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x2.hpp\n\n#pragma once\n#include \"../detail/type_mat3x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 2 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 2, double, defaultp>\t\tdmat3x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, double, lowp>\t\tlowp_dmat3x2;\n\n\t/// 3 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, double, mediump>\tmediump_dmat3x2;\n\n\t/// 3 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, double, highp>\thighp_dmat3x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x3.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x3.hpp\n\n#pragma once\n#include \"../detail/type_mat3x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 3, double, defaultp>\t\tdmat3x3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 3, double, defaultp>\t\tdmat3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x3_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, lowp>\t\tlowp_dmat3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, mediump>\tmediump_dmat3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, highp>\thighp_dmat3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, lowp>\t\tlowp_dmat3x3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, mediump>\tmediump_dmat3x3;\n\n\t/// 3 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, double, highp>\thighp_dmat3x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x4.hpp\n\n#pragma once\n#include \"../detail/type_mat3x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 4 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 4, double, defaultp>\t\tdmat3x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double3x4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double3x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, double, lowp>\t\tlowp_dmat3x4;\n\n\t/// 3 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, double, mediump>\tmediump_dmat3x4;\n\n\t/// 3 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, double, highp>\thighp_dmat3x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x2.hpp\n\n#pragma once\n#include \"../detail/type_mat4x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 2 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 2, double, defaultp>\t\tdmat4x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 2 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, double, lowp>\t\tlowp_dmat4x2;\n\n\t/// 4 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, double, mediump>\tmediump_dmat4x2;\n\n\t/// 4 columns of 2 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, double, highp>\thighp_dmat4x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x3.hpp\n\n#pragma once\n#include \"../detail/type_mat4x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 3 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 3, double, defaultp>\t\tdmat4x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 3 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, double, lowp>\t\tlowp_dmat4x3;\n\n\t/// 4 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, double, mediump>\tmediump_dmat4x3;\n\n\t/// 4 columns of 3 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, double, highp>\thighp_dmat4x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x4.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x4.hpp\n\n#pragma once\n#include \"../detail/type_mat4x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 4, double, defaultp>\t\tdmat4x4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 4, double, defaultp>\t\tdmat4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_double4x4_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_double4x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, lowp>\t\tlowp_dmat4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, mediump>\tmediump_dmat4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, highp>\thighp_dmat4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, lowp>\t\tlowp_dmat4x4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, mediump>\tmediump_dmat4x4;\n\n\t/// 4 columns of 4 components matrix of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, double, highp>\thighp_dmat4x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x2.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x2.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 2, float, defaultp>\t\tmat2x2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 2, float, defaultp>\t\tmat2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x2_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, lowp>\t\tlowp_mat2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, mediump>\tmediump_mat2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, highp>\t\thighp_mat2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, lowp>\t\tlowp_mat2x2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, mediump>\tmediump_mat2x2;\n\n\t/// 2 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 2, float, highp>\t\thighp_mat2x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x3.hpp\n\n#pragma once\n#include \"../detail/type_mat2x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 3 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 3, float, defaultp>\t\tmat2x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, float, lowp>\t\tlowp_mat2x3;\n\n\t/// 2 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, float, mediump>\tmediump_mat2x3;\n\n\t/// 2 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 3, float, highp>\t\thighp_mat2x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x4.hpp\n\n#pragma once\n#include \"../detail/type_mat2x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 2 columns of 4 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<2, 4, float, defaultp>\t\tmat2x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float2x4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 2 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, float, lowp>\t\tlowp_mat2x4;\n\n\t/// 2 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, float, mediump>\tmediump_mat2x4;\n\n\t/// 2 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<2, 4, float, highp>\t\thighp_mat2x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x2.hpp\n\n#pragma once\n#include \"../detail/type_mat3x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core\n\t/// @{\n\n\t/// 3 columns of 2 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 2, float, defaultp>\t\t\tmat3x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, float, lowp>\t\tlowp_mat3x2;\n\n\t/// 3 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, float, mediump>\tmediump_mat3x2;\n\n\t/// 3 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 2, float, highp>\t\thighp_mat3x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x3.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x3.hpp\n\n#pragma once\n#include \"../detail/type_mat3x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 3, float, defaultp>\t\t\tmat3x3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 3, float, defaultp>\t\t\tmat3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x3_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, lowp>\t\tlowp_mat3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, mediump>\tmediump_mat3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, highp>\t\thighp_mat3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, lowp>\t\tlowp_mat3x3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, mediump>\tmediump_mat3x3;\n\n\t/// 3 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 3, float, highp>\t\thighp_mat3x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x4.hpp\n\n#pragma once\n#include \"../detail/type_mat3x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 3 columns of 4 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<3, 4, float, defaultp>\t\t\tmat3x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float3x4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float3x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat3x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 3 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, float, lowp>\t\tlowp_mat3x4;\n\n\t/// 3 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, float, mediump>\tmediump_mat3x4;\n\n\t/// 3 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<3, 4, float, highp>\t\thighp_mat3x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x2.hpp\n\n#pragma once\n#include \"../detail/type_mat4x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 2 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 2, float, defaultp>\t\t\tmat4x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float2x2_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat2x2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 2 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, float, lowp>\t\tlowp_mat4x2;\n\n\t/// 4 columns of 2 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, float, mediump>\tmediump_mat4x2;\n\n\t/// 4 columns of 2 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 2, float, highp>\t\thighp_mat4x2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x3.hpp\n\n#pragma once\n#include \"../detail/type_mat4x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 3 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 3, float, defaultp>\t\t\tmat4x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x3_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 3 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, float, lowp>\t\tlowp_mat4x3;\n\n\t/// 4 columns of 3 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, float, mediump>\tmediump_mat4x3;\n\n\t/// 4 columns of 3 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 3, float, highp>\t\thighp_mat4x3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x4.hpp", "language": "code", "loc": 18, "comment_density": 0.667, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x4.hpp\n\n#pragma once\n#include \"../detail/type_mat4x4.hpp\"\n\nnamespace glm\n{\n\t/// @ingroup core_matrix\n\t/// @{\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 4, float, defaultp>\t\t\tmat4x4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\ttypedef mat<4, 4, float, defaultp>\t\t\tmat4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_float4x4_precision.hpp", "language": "code", "loc": 40, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/matrix_float4x4_precision.hpp\n\n#pragma once\n#include \"../detail/type_mat4x4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_matrix_precision\n\t/// @{\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, lowp>\t\tlowp_mat4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, mediump>\tmediump_mat4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, highp>\t\thighp_mat4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, lowp>\t\tlowp_mat4x4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, mediump>\tmediump_mat4x4;\n\n\t/// 4 columns of 4 components matrix of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.6 Matrices\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef mat<4, 4, float, highp>\t\thighp_mat4x4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/matrix_projection.hpp", "language": "code", "loc": 136, "comment_density": 0.765, "code": "/// @ref ext_matrix_projection\n/// @file glm/ext/matrix_projection.hpp\n///\n/// @defgroup ext_matrix_projection GLM_EXT_matrix_projection\n/// @ingroup ext\n///\n/// Functions that generate common projection transformation matrices.\n///\n/// The matrices generated by this extension use standard OpenGL fixed-function\n/// conventions. For example, the lookAt function generates a transform from world\n/// space into the specific eye space that the projective matrix functions\n/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility\n/// specifications defines the particular layout of this eye space.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_matrix_transform\n/// @see ext_matrix_clip_space\n\n#pragma once\n\n// Dependencies\n#include \"../gtc/constants.hpp\"\n#include \"../geometric.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../matrix.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_matrix_projection extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_matrix_projection\n\t/// @{\n\n\t/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param obj Specify the object coordinates.\n\t/// @param model Specifies the current modelview matrix\n\t/// @param proj Specifies the current projection matrix\n\t/// @param viewport Specifies the current viewport\n\t/// @return Return the computed window coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> projectZO(\n\t\tvec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param obj Specify the object coordinates.\n\t/// @param model Specifies the current modelview matrix\n\t/// @param proj Specifies the current projection matrix\n\t/// @param viewport Specifies the current viewport\n\t/// @return Return the computed window coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> projectNO(\n\t\tvec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates using default near and far clip planes definition.\n\t/// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @param obj Specify the object coordinates.\n\t/// @param model Specifies the current modelview matrix\n\t/// @param proj Specifies the current projection matrix\n\t/// @param viewport Specifies the current viewport\n\t/// @return Return the computed window coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> project(\n\t\tvec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)\n\t///\n\t/// @param win Specify the window coordinates to be mapped.\n\t/// @param model Specifies the modelview matrix\n\t/// @param proj Specifies the projection matrix\n\t/// @param viewport Specifies the viewport\n\t/// @return Returns the computed object coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluUnProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> unProjectZO(\n\t\tvec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.\n\t/// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)\n\t///\n\t/// @param win Specify the window coordinates to be mapped.\n\t/// @param model Specifies the modelview matrix\n\t/// @param proj Specifies the projection matrix\n\t/// @param viewport Specifies the viewport\n\t/// @return Returns the computed object coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluUnProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> unProjectNO(\n\t\tvec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using default near and far clip planes definition.\n\t/// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.\n\t///\n\t/// @param win Specify the window coordinates to be mapped.\n\t/// @param model Specifies the modelview matrix\n\t/// @param proj Specifies the projection matrix\n\t/// @param viewport Specifies the viewport\n\t/// @return Returns the computed object coordinates.\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluUnProject man page\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> unProject(\n\t\tvec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);\n\n\t/// Define a picking region\n\t///\n\t/// @param center Specify the center of a picking region in window coordinates.\n\t/// @param delta Specify the width and height, respectively, of the picking region in window coordinates.\n\t/// @param viewport Rendering viewport\n\t/// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.\n\t/// @tparam U Currently supported: Floating-point types and integer types.\n\t///\n\t/// @see gluPickMatrix man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> pickMatrix(\n\t\tvec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_projection.inl\"\n"}, {"path": "includes/glm/ext/matrix_relational.hpp", "language": "code", "loc": 116, "comment_density": 0.759, "code": "/// @ref ext_matrix_relational\n/// @file glm/ext/matrix_relational.hpp\n///\n/// @defgroup ext_matrix_relational GLM_EXT_matrix_relational\n/// @ingroup ext\n///\n/// Exposes comparison functions for matrix types that take a user defined epsilon values.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_relational\n/// @see ext_scalar_relational\n/// @see ext_quaternion_relational\n\n#pragma once\n\n// Dependencies\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_matrix_relational extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_matrix_relational\n\t/// @{\n\n\t/// Perform a component-wise equal-to comparison of two matrices.\n\t/// Return a boolean vector which components value is True if this expression is satisfied per column of the matrices.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y);\n\n\t/// Perform a component-wise not-equal-to comparison of two matrices.\n\t/// Return a boolean vector which components value is True if this expression is satisfied per column of the matrices.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y, vec const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y, vec const& epsilon);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(mat const& x, mat const& y, vec const& ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix\n\t/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(mat const& x, mat const& y, vec const& ULPs);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_relational.inl\"\n"}, {"path": "includes/glm/ext/matrix_transform.hpp", "language": "code", "loc": 131, "comment_density": 0.763, "code": "/// @ref ext_matrix_transform\n/// @file glm/ext/matrix_transform.hpp\n///\n/// @defgroup ext_matrix_transform GLM_EXT_matrix_transform\n/// @ingroup ext\n///\n/// Defines functions that generate common transformation matrices.\n///\n/// The matrices generated by this extension use standard OpenGL fixed-function\n/// conventions. For example, the lookAt function generates a transform from world\n/// space into the specific eye space that the projective matrix functions\n/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility\n/// specifications defines the particular layout of this eye space.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_matrix_projection\n/// @see ext_matrix_clip_space\n\n#pragma once\n\n// Dependencies\n#include \"../gtc/constants.hpp\"\n#include \"../geometric.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../matrix.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_matrix_transform extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_matrix_transform\n\t/// @{\n\n\t/// Builds an identity matrix.\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType identity();\n\n\t/// Builds a translation 4 * 4 matrix created from a vector of 3 components.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param v Coordinates of a translation vector.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @code\n\t/// #include \n\t/// #include \n\t/// ...\n\t/// glm::mat4 m = glm::translate(glm::mat4(1.0f), glm::vec3(1.0f));\n\t/// // m[0][0] == 1.0f, m[0][1] == 0.0f, m[0][2] == 0.0f, m[0][3] == 0.0f\n\t/// // m[1][0] == 0.0f, m[1][1] == 1.0f, m[1][2] == 0.0f, m[1][3] == 0.0f\n\t/// // m[2][0] == 0.0f, m[2][1] == 0.0f, m[2][2] == 1.0f, m[2][3] == 0.0f\n\t/// // m[3][0] == 1.0f, m[3][1] == 1.0f, m[3][2] == 1.0f, m[3][3] == 1.0f\n\t/// @endcode\n\t///\n\t/// @see - translate(mat<4, 4, T, Q> const& m, T x, T y, T z)\n\t/// @see - translate(vec<3, T, Q> const& v)\n\t/// @see glTranslate man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> translate(\n\t\tmat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);\n\n\t/// Builds a rotation 4 * 4 matrix created from an axis vector and an angle.\n\t///\n\t/// @param m Input matrix multiplied by this rotation matrix.\n\t/// @param angle Rotation angle expressed in radians.\n\t/// @param axis Rotation axis, recommended to be normalized.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)\n\t/// @see - rotate(T angle, vec<3, T, Q> const& v)\n\t/// @see glRotate man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rotate(\n\t\tmat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& axis);\n\n\t/// Builds a scale 4 * 4 matrix created from 3 scalars.\n\t///\n\t/// @param m Input matrix multiplied by this scale matrix.\n\t/// @param v Ratio of scaling for each axis.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - scale(mat<4, 4, T, Q> const& m, T x, T y, T z)\n\t/// @see - scale(vec<3, T, Q> const& v)\n\t/// @see glScale man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> scale(\n\t\tmat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);\n\n\t/// Build a right handed look at view matrix.\n\t///\n\t/// @param eye Position of the camera\n\t/// @param center Position where the camera is looking at\n\t/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> lookAtRH(\n\t\tvec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);\n\n\t/// Build a left handed look at view matrix.\n\t///\n\t/// @param eye Position of the camera\n\t/// @param center Position where the camera is looking at\n\t/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> lookAtLH(\n\t\tvec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);\n\n\t/// Build a look at view matrix based on the default handedness.\n\t///\n\t/// @param eye Position of the camera\n\t/// @param center Position where the camera is looking at\n\t/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)\n\t/// @see gluLookAt man page\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> lookAt(\n\t\tvec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_transform.inl\"\n"}, {"path": "includes/glm/ext/quaternion_common.hpp", "language": "code", "loc": 107, "comment_density": 0.748, "code": "/// @ref ext_quaternion_common\n/// @file glm/ext/quaternion_common.hpp\n///\n/// @defgroup ext_quaternion_common GLM_EXT_quaternion_common\n/// @ingroup ext\n///\n/// Provides common functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_scalar_common\n/// @see ext_vector_common\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_trigonometric\n/// @see ext_quaternion_transform\n\n#pragma once\n\n// Dependency:\n#include \"../ext/scalar_constants.hpp\"\n#include \"../ext/quaternion_geometric.hpp\"\n#include \"../common.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../exponential.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_common extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_common\n\t/// @{\n\n\t/// Spherical linear interpolation of two quaternions.\n\t/// The interpolation is oriented and the rotation is performed at constant speed.\n\t/// For short path spherical linear interpolation, use the slerp function.\n\t///\n\t/// @param x A quaternion\n\t/// @param y A quaternion\n\t/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\t///\n\t/// @see - slerp(qua const& x, qua const& y, T const& a)\n\ttemplate\n\tGLM_FUNC_DECL qua mix(qua const& x, qua const& y, T a);\n\n\t/// Linear interpolation of two quaternions.\n\t/// The interpolation is oriented.\n\t///\n\t/// @param x A quaternion\n\t/// @param y A quaternion\n\t/// @param a Interpolation factor. The interpolation is defined in the range [0, 1].\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua lerp(qua const& x, qua const& y, T a);\n\n\t/// Spherical linear interpolation of two quaternions.\n\t/// The interpolation always take the short path and the rotation is performed at constant speed.\n\t///\n\t/// @param x A quaternion\n\t/// @param y A quaternion\n\t/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua slerp(qua const& x, qua const& y, T a);\n\n\t/// Returns the q conjugate.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua conjugate(qua const& q);\n\n\t/// Returns the q inverse.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua inverse(qua const& q);\n\n\t/// Returns true if x holds a NaN (not a number)\n\t/// representation in the underlying implementation's set of\n\t/// floating point representations. Returns false otherwise,\n\t/// including for implementations with no NaN\n\t/// representations.\n\t///\n\t/// /!\\ When using compiler fast math, this function may fail.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> isnan(qua const& x);\n\n\t/// Returns true if x holds a positive infinity or negative\n\t/// infinity representation in the underlying implementation's\n\t/// set of floating point representations. Returns false\n\t/// otherwise, including for implementations with no infinity\n\t/// representations.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> isinf(qua const& x);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_common.inl\"\n"}, {"path": "includes/glm/ext/quaternion_double.hpp", "language": "code", "loc": 32, "comment_density": 0.75, "code": "/// @ref ext_quaternion_double\n/// @file glm/ext/quaternion_double.hpp\n///\n/// @defgroup ext_quaternion_double GLM_EXT_quaternion_double\n/// @ingroup ext\n///\n/// Exposes double-precision floating point quaternion type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double_precision\n/// @see ext_quaternion_common\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_transform\n/// @see ext_quaternion_trigonometric\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_quat.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_double extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_double\n\t/// @{\n\n\t/// Quaternion of double-precision floating-point numbers.\n\ttypedef qua\t\tdquat;\n\n\t/// @}\n} //namespace glm\n\n"}, {"path": "includes/glm/ext/quaternion_double_precision.hpp", "language": "code", "loc": 33, "comment_density": 0.697, "code": "/// @ref ext_quaternion_double_precision\n/// @file glm/ext/quaternion_double_precision.hpp\n///\n/// @defgroup ext_quaternion_double_precision GLM_EXT_quaternion_double_precision\n/// @ingroup ext\n///\n/// Exposes double-precision floating point quaternion type with various precision in term of ULPs.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_quat.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_double_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_double_precision\n\t/// @{\n\n\t/// Quaternion of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see ext_quaternion_double_precision\n\ttypedef qua\t\tlowp_dquat;\n\n\t/// Quaternion of medium double-qualifier floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see ext_quaternion_double_precision\n\ttypedef qua\tmediump_dquat;\n\n\t/// Quaternion of high double-qualifier floating-point numbers using high precision arithmetic in term of ULPs.\n\t///\n\t/// @see ext_quaternion_double_precision\n\ttypedef qua\t\thighp_dquat;\n\n\t/// @}\n} //namespace glm\n\n"}, {"path": "includes/glm/ext/quaternion_exponential.hpp", "language": "code", "loc": 53, "comment_density": 0.642, "code": "/// @ref ext_quaternion_exponential\n/// @file glm/ext/quaternion_exponential.hpp\n///\n/// @defgroup ext_quaternion_exponential GLM_EXT_quaternion_exponential\n/// @ingroup ext\n///\n/// Provides exponential functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see core_exponential\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n\n#pragma once\n\n// Dependency:\n#include \"../common.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../geometric.hpp\"\n#include \"../ext/scalar_constants.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_exponential extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_transform\n\t/// @{\n\n\t/// Returns a exponential of a quaternion.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua exp(qua const& q);\n\n\t/// Returns a logarithm of a quaternion\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua log(qua const& q);\n\n\t/// Returns a quaternion raised to a power.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua pow(qua const& q, T y);\n\n\t/// Returns the square root of a quaternion\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua sqrt(qua const& q);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_exponential.inl\"\n"}, {"path": "includes/glm/ext/quaternion_float.hpp", "language": "code", "loc": 32, "comment_density": 0.75, "code": "/// @ref ext_quaternion_float\n/// @file glm/ext/quaternion_float.hpp\n///\n/// @defgroup ext_quaternion_float GLM_EXT_quaternion_float\n/// @ingroup ext\n///\n/// Exposes single-precision floating point quaternion type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_quaternion_double\n/// @see ext_quaternion_float_precision\n/// @see ext_quaternion_common\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_transform\n/// @see ext_quaternion_trigonometric\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_quat.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_float extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_float\n\t/// @{\n\n\t/// Quaternion of single-precision floating-point numbers.\n\ttypedef qua\t\tquat;\n\n\t/// @}\n} //namespace glm\n\n"}, {"path": "includes/glm/ext/quaternion_float_precision.hpp", "language": "code", "loc": 27, "comment_density": 0.63, "code": "/// @ref ext_quaternion_float_precision\n/// @file glm/ext/quaternion_float_precision.hpp\n///\n/// @defgroup ext_quaternion_float_precision GLM_EXT_quaternion_float_precision\n/// @ingroup ext\n///\n/// Exposes single-precision floating point quaternion type with various precision in term of ULPs.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n// Dependency:\n#include \"../detail/type_quat.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_float_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_float_precision\n\t/// @{\n\n\t/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef qua\t\tlowp_quat;\n\n\t/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef qua\t\tmediump_quat;\n\n\t/// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef qua\t\thighp_quat;\n\n\t/// @}\n} //namespace glm\n\n"}, {"path": "includes/glm/ext/quaternion_geometric.hpp", "language": "code", "loc": 60, "comment_density": 0.7, "code": "/// @ref ext_quaternion_geometric\n/// @file glm/ext/quaternion_geometric.hpp\n///\n/// @defgroup ext_quaternion_geometric GLM_EXT_quaternion_geometric\n/// @ingroup ext\n///\n/// Provides geometric functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see core_geometric\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n\n#pragma once\n\n// Dependency:\n#include \"../geometric.hpp\"\n#include \"../exponential.hpp\"\n#include \"../ext/vector_relational.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_geometric extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_geometric\n\t/// @{\n\n\t/// Returns the norm of a quaternions\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_geometric\n\ttemplate\n\tGLM_FUNC_DECL T length(qua const& q);\n\n\t/// Returns the normalized quaternion.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_geometric\n\ttemplate\n\tGLM_FUNC_DECL qua normalize(qua const& q);\n\n\t/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_geometric\n\ttemplate\n\tGLM_FUNC_DECL T dot(qua const& x, qua const& y);\n\n\t/// Compute a cross product.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_geometric\n\ttemplate\n\tGLM_FUNC_QUALIFIER qua cross(qua const& q1, qua const& q2);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_geometric.inl\"\n"}, {"path": "includes/glm/ext/quaternion_relational.hpp", "language": "code", "loc": 52, "comment_density": 0.692, "code": "/// @ref ext_quaternion_relational\n/// @file glm/ext/quaternion_relational.hpp\n///\n/// @defgroup ext_quaternion_relational GLM_EXT_quaternion_relational\n/// @ingroup ext\n///\n/// Exposes comparison functions for quaternion types that take a user defined epsilon values.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_vector_relational\n/// @see ext_vector_relational\n/// @see ext_matrix_relational\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n\n#pragma once\n\n// Dependency:\n#include \"../vector_relational.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_relational extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_relational\n\t/// @{\n\n\t/// Returns the component-wise comparison of result x == y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> equal(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> equal(qua const& x, qua const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of result x != y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> notEqual(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> notEqual(qua const& x, qua const& y, T epsilon);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_relational.inl\"\n"}, {"path": "includes/glm/ext/quaternion_transform.hpp", "language": "code", "loc": 41, "comment_density": 0.707, "code": "/// @ref ext_quaternion_transform\n/// @file glm/ext/quaternion_transform.hpp\n///\n/// @defgroup ext_quaternion_transform GLM_EXT_quaternion_transform\n/// @ingroup ext\n///\n/// Provides transformation functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_trigonometric\n\n#pragma once\n\n// Dependency:\n#include \"../common.hpp\"\n#include \"../trigonometric.hpp\"\n#include \"../geometric.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_transform extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_transform\n\t/// @{\n\n\t/// Rotates a quaternion from a vector of 3 components axis and an angle.\n\t///\n\t/// @param q Source orientation\n\t/// @param angle Angle expressed in radians.\n\t/// @param axis Axis of the rotation\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua rotate(qua const& q, T const& angle, vec<3, T, Q> const& axis);\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_transform.inl\"\n"}, {"path": "includes/glm/ext/quaternion_trigonometric.hpp", "language": "code", "loc": 54, "comment_density": 0.667, "code": "/// @ref ext_quaternion_trigonometric\n/// @file glm/ext/quaternion_trigonometric.hpp\n///\n/// @defgroup ext_quaternion_trigonometric GLM_EXT_quaternion_trigonometric\n/// @ingroup ext\n///\n/// Provides trigonometric functions for quaternion types\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_quaternion_float\n/// @see ext_quaternion_double\n/// @see ext_quaternion_exponential\n/// @see ext_quaternion_geometric\n/// @see ext_quaternion_relational\n/// @see ext_quaternion_transform\n\n#pragma once\n\n// Dependency:\n#include \"../trigonometric.hpp\"\n#include \"../exponential.hpp\"\n#include \"scalar_constants.hpp\"\n#include \"vector_relational.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_quaternion_trigonometric extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_quaternion_trigonometric\n\t/// @{\n\n\t/// Returns the quaternion rotation angle.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL T angle(qua const& x);\n\n\t/// Returns the q rotation axis.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> axis(qua const& x);\n\n\t/// Build a quaternion from an angle and a normalized axis.\n\t///\n\t/// @param angle Angle expressed in radians.\n\t/// @param axis Axis of the quaternion, must be normalized.\n\t///\n\t/// @tparam T A floating-point scalar type\n\t/// @tparam Q A value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL qua angleAxis(T const& angle, vec<3, T, Q> const& axis);\n\n\t/// @}\n} //namespace glm\n\n#include \"quaternion_trigonometric.inl\"\n"}, {"path": "includes/glm/ext/scalar_common.hpp", "language": "code", "loc": 87, "comment_density": 0.678, "code": "/// @ref ext_scalar_common\n/// @file glm/ext/scalar_common.hpp\n///\n/// @defgroup ext_scalar_common GLM_EXT_scalar_common\n/// @ingroup ext\n///\n/// Exposes min and max functions for 3 to 4 scalar parameters.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_func_common\n/// @see ext_vector_common\n\n#pragma once\n\n// Dependency:\n#include \"../common.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_common extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_scalar_common\n\t/// @{\n\n\t/// Returns the minimum component-wise values of 3 inputs\n\t///\n\t/// @tparam T A floating-point scalar type.\n\ttemplate\n\tGLM_FUNC_DECL T min(T a, T b, T c);\n\n\t/// Returns the minimum component-wise values of 4 inputs\n\t///\n\t/// @tparam T A floating-point scalar type.\n\ttemplate\n\tGLM_FUNC_DECL T min(T a, T b, T c, T d);\n\n\t/// Returns the maximum component-wise values of 3 inputs\n\t///\n\t/// @tparam T A floating-point scalar type.\n\ttemplate\n\tGLM_FUNC_DECL T max(T a, T b, T c);\n\n\t/// Returns the maximum component-wise values of 4 inputs\n\t///\n\t/// @tparam T A floating-point scalar type.\n\ttemplate\n\tGLM_FUNC_DECL T max(T a, T b, T c, T d);\n\n\t/// Returns the minimum component-wise values of 2 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmin(T a, T b);\n\n\t/// Returns the minimum component-wise values of 3 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmin(T a, T b, T c);\n\n\t/// Returns the minimum component-wise values of 4 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmin(T a, T b, T c, T d);\n\n\t/// Returns the maximum component-wise values of 2 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmax(T a, T b);\n\n\t/// Returns the maximum component-wise values of 3 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmax(T a, T b, T C);\n\n\t/// Returns the maximum component-wise values of 4 inputs. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam T A floating-point scalar type.\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL T fmax(T a, T b, T C, T D);\n\n\t/// @}\n}//namespace glm\n\n#include \"scalar_common.inl\"\n"}, {"path": "includes/glm/ext/scalar_constants.hpp", "language": "code", "loc": 28, "comment_density": 0.571, "code": "/// @ref ext_scalar_constants\n/// @file glm/ext/scalar_constants.hpp\n///\n/// @defgroup ext_scalar_constants GLM_EXT_scalar_constants\n/// @ingroup ext\n///\n/// Provides a list of constants and precomputed useful values.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_constants extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_scalar_constants\n\t/// @{\n\n\t/// Return the epsilon constant for floating point types.\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType epsilon();\n\n\t/// Return the pi constant for floating point types.\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType pi();\n\n\t/// @}\n} //namespace glm\n\n#include \"scalar_constants.inl\"\n"}, {"path": "includes/glm/ext/scalar_int_sized.hpp", "language": "code", "loc": 56, "comment_density": 0.375, "code": "/// @ref ext_scalar_int_sized\n/// @file glm/ext/scalar_int_sized.hpp\n///\n/// @defgroup ext_scalar_int_sized GLM_EXT_scalar_int_sized\n/// @ingroup ext\n///\n/// Exposes sized signed integer scalar types.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_scalar_uint_sized\n\n#pragma once\n\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_int_sized extension included\")\n#endif\n\nnamespace glm{\nnamespace detail\n{\n#\tif GLM_HAS_EXTENDED_INTEGER_TYPE\n\t\ttypedef std::int8_t\t\t\tint8;\n\t\ttypedef std::int16_t\t\tint16;\n\t\ttypedef std::int32_t\t\tint32;\n#\telse\n\t\ttypedef char\t\t\t\tint8;\n\t\ttypedef short\t\t\t\tint16;\n\t\ttypedef int\t\t\t\t\tint32;\n#endif//\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n}//namespace detail\n\n\n\t/// @addtogroup ext_scalar_int_sized\n\t/// @{\n\n\t/// 8 bit signed integer type.\n\ttypedef detail::int8\t\tint8;\n\n\t/// 16 bit signed integer type.\n\ttypedef detail::int16\t\tint16;\n\n\t/// 32 bit signed integer type.\n\ttypedef detail::int32\t\tint32;\n\n\t/// 64 bit signed integer type.\n\ttypedef detail::int64\t\tint64;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/scalar_relational.hpp", "language": "code", "loc": 56, "comment_density": 0.714, "code": "/// @ref ext_scalar_relational\n/// @file glm/ext/scalar_relational.hpp\n///\n/// @defgroup ext_scalar_relational GLM_EXT_scalar_relational\n/// @ingroup ext\n///\n/// Exposes comparison functions for scalar types that take a user defined epsilon values.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_vector_relational\n/// @see ext_vector_relational\n/// @see ext_matrix_relational\n\n#pragma once\n\n// Dependencies\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_relational extension included\")\n#endif\n\nnamespace glm\n{\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam genType Floating-point or integer scalar types\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool equal(genType const& x, genType const& y, genType const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam genType Floating-point or integer scalar types\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, genType const& epsilon);\n\n\t/// Returns the component-wise comparison between two scalars in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @param x First operand.\n\t/// @param y Second operand.\n\t/// @param ULPs Maximum difference in ULPs between the two operators to consider them equal.\n\t///\n\t/// @tparam genType Floating-point or integer scalar types\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool equal(genType const& x, genType const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two scalars in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @param x First operand.\n\t/// @param y Second operand.\n\t/// @param ULPs Maximum difference in ULPs between the two operators to consider them not equal.\n\t///\n\t/// @tparam genType Floating-point or integer scalar types\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, int ULPs);\n\n\t/// @}\n}//namespace glm\n\n#include \"scalar_relational.inl\"\n"}, {"path": "includes/glm/ext/scalar_uint_sized.hpp", "language": "code", "loc": 56, "comment_density": 0.357, "code": "/// @ref ext_scalar_uint_sized\n/// @file glm/ext/scalar_uint_sized.hpp\n///\n/// @defgroup ext_scalar_uint_sized GLM_EXT_scalar_uint_sized\n/// @ingroup ext\n///\n/// Exposes sized unsigned integer scalar types.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_scalar_int_sized\n\n#pragma once\n\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_uint_sized extension included\")\n#endif\n\nnamespace glm{\nnamespace detail\n{\n#\tif GLM_HAS_EXTENDED_INTEGER_TYPE\n\t\ttypedef std::uint8_t\t\tuint8;\n\t\ttypedef std::uint16_t\t\tuint16;\n\t\ttypedef std::uint32_t\t\tuint32;\n#\telse\n\t\ttypedef unsigned char\t\tuint8;\n\t\ttypedef unsigned short\t\tuint16;\n\t\ttypedef unsigned int\t\tuint32;\n#endif\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n\n\ttemplate<>\n\tstruct is_int\n\t{\n\t\tenum test {value = ~0};\n\t};\n}//namespace detail\n\n\n\t/// @addtogroup ext_scalar_uint_sized\n\t/// @{\n\n\t/// 8 bit unsigned integer type.\n\ttypedef detail::uint8\t\tuint8;\n\n\t/// 16 bit unsigned integer type.\n\ttypedef detail::uint16\t\tuint16;\n\n\t/// 32 bit unsigned integer type.\n\ttypedef detail::uint32\t\tuint32;\n\n\t/// 64 bit unsigned integer type.\n\ttypedef detail::uint64\t\tuint64;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/scalar_ulp.hpp", "language": "code", "loc": 63, "comment_density": 0.683, "code": "/// @ref ext_scalar_ulp\n/// @file glm/ext/scalar_ulp.hpp\n///\n/// @defgroup ext_scalar_ulp GLM_EXT_scalar_ulp\n/// @ingroup ext\n///\n/// Allow the measurement of the accuracy of a function against a reference\n/// implementation. This extension works on floating-point data and provide results\n/// in ULP.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_ulp\n/// @see ext_scalar_relational\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_int_sized.hpp\"\n#include \"../common.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_scalar_ulp extension included\")\n#endif\n\nnamespace glm\n{\n\t/// Return the next ULP value(s) after the input value(s).\n\t///\n\t/// @tparam genType A floating-point scalar type.\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL genType next_float(genType x);\n\n\t/// Return the previous ULP value(s) before the input value(s).\n\t///\n\t/// @tparam genType A floating-point scalar type.\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL genType prev_float(genType x);\n\n\t/// Return the value(s) ULP distance after the input value(s).\n\t///\n\t/// @tparam genType A floating-point scalar type.\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL genType next_float(genType x, int ULPs);\n\n\t/// Return the value(s) ULP distance before the input value(s).\n\t///\n\t/// @tparam genType A floating-point scalar type.\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL genType prev_float(genType x, int ULPs);\n\n\t/// Return the distance in the number of ULP between 2 single-precision floating-point scalars.\n\t///\n\t/// @see ext_scalar_ulp\n\tGLM_FUNC_DECL int float_distance(float x, float y);\n\n\t/// Return the distance in the number of ULP between 2 double-precision floating-point scalars.\n\t///\n\t/// @see ext_scalar_ulp\n\tGLM_FUNC_DECL int64 float_distance(double x, double y);\n\n\t/// @}\n}//namespace glm\n\n#include \"scalar_ulp.inl\"\n"}, {"path": "includes/glm/ext/vector_bool1.hpp", "language": "code", "loc": 24, "comment_density": 0.667, "code": "/// @ref ext_vector_bool1\n/// @file glm/ext/vector_bool1.hpp\n///\n/// @defgroup ext_vector_bool1 GLM_EXT_vector_bool1\n/// @ingroup ext\n///\n/// Exposes bvec1 vector type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_bool1_precision extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_bool1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_bool1\n\t/// @{\n\n\t/// 1 components vector of boolean.\n\ttypedef vec<1, bool, defaultp>\t\tbvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool1_precision.hpp", "language": "code", "loc": 26, "comment_density": 0.615, "code": "/// @ref ext_vector_bool1_precision\n/// @file glm/ext/vector_bool1_precision.hpp\n///\n/// @defgroup ext_vector_bool1_precision GLM_EXT_vector_bool1_precision\n/// @ingroup ext\n///\n/// Exposes highp_bvec1, mediump_bvec1 and lowp_bvec1 types.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_bool1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_bool1_precision\n\t/// @{\n\n\t/// 1 component vector of bool values.\n\ttypedef vec<1, bool, highp>\t\t\thighp_bvec1;\n\n\t/// 1 component vector of bool values.\n\ttypedef vec<1, bool, mediump>\t\tmediump_bvec1;\n\n\t/// 1 component vector of bool values.\n\ttypedef vec<1, bool, lowp>\t\t\tlowp_bvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_bool2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of boolean.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, bool, defaultp>\t\tbvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_bool2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, bool, highp>\t\thighp_bvec2;\n\n\t/// 2 components vector of medium qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, bool, mediump>\tmediump_bvec2;\n\n\t/// 2 components vector of low qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, bool, lowp>\t\tlowp_bvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_bool3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of boolean.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, bool, defaultp>\t\tbvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_bool3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, bool, highp>\t\thighp_bvec3;\n\n\t/// 3 components vector of medium qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, bool, mediump>\tmediump_bvec3;\n\n\t/// 3 components vector of low qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, bool, lowp>\t\tlowp_bvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_bool4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of boolean.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, bool, defaultp>\t\tbvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_bool4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_bool4_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, bool, highp>\t\thighp_bvec4;\n\n\t/// 4 components vector of medium qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, bool, mediump>\tmediump_bvec4;\n\n\t/// 4 components vector of low qualifier bool numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, bool, lowp>\t\tlowp_bvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_common.hpp", "language": "code", "loc": 126, "comment_density": 0.738, "code": "/// @ref ext_vector_common\n/// @file glm/ext/vector_common.hpp\n///\n/// @defgroup ext_vector_common GLM_EXT_vector_common\n/// @ingroup ext\n///\n/// Exposes min and max functions for 3 to 4 vector parameters.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_common\n/// @see ext_scalar_common\n\n#pragma once\n\n// Dependency:\n#include \"../ext/scalar_common.hpp\"\n#include \"../common.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_common extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_common\n\t/// @{\n\n\t/// Return the minimum component-wise values of 3 inputs\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& a, vec const& b, vec const& c);\n\n\t/// Return the minimum component-wise values of 4 inputs\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec min(vec const& a, vec const& b, vec const& c, vec const& d);\n\n\t/// Return the maximum component-wise values of 3 inputs\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec max(vec const& x, vec const& y, vec const& z);\n\n\t/// Return the maximum component-wise values of 4 inputs\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec max( vec const& x, vec const& y, vec const& z, vec const& w);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmin(vec const& x, T y);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmin(vec const& x, vec const& y);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmin(vec const& a, vec const& b, vec const& c);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmin documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmin(vec const& a, vec const& b, vec const& c, vec const& d);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmax(vec const& a, T b);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmax(vec const& a, vec const& b);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmax(vec const& a, vec const& b, vec const& c);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL vec fmax(vec const& a, vec const& b, vec const& c, vec const& d);\n\n\t/// @}\n}//namespace glm\n\n#include \"vector_common.inl\"\n"}, {"path": "includes/glm/ext/vector_double1.hpp", "language": "code", "loc": 25, "comment_density": 0.68, "code": "/// @ref ext_vector_double1\n/// @file glm/ext/vector_double1.hpp\n///\n/// @defgroup ext_vector_double1 GLM_EXT_vector_double1\n/// @ingroup ext\n///\n/// Exposes double-precision floating point vector type with one component.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_double1_precision extension.\n/// @see ext_vector_float1 extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_dvec1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_double1\n\t/// @{\n\n\t/// 1 components vector of double-precision floating-point numbers.\n\ttypedef vec<1, double, defaultp>\t\tdvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double1_precision.hpp", "language": "code", "loc": 28, "comment_density": 0.643, "code": "/// @ref ext_vector_double1_precision\n/// @file glm/ext/vector_double1_precision.hpp\n///\n/// @defgroup ext_vector_double1_precision GLM_EXT_vector_double1_precision\n/// @ingroup ext\n///\n/// Exposes highp_dvec1, mediump_dvec1 and lowp_dvec1 types.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_double1\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_double1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_double1_precision\n\t/// @{\n\n\t/// 1 component vector of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, highp>\t\thighp_dvec1;\n\n\t/// 1 component vector of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, mediump>\t\tmediump_dvec1;\n\n\t/// 1 component vector of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, lowp>\t\tlowp_dvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_double2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, double, defaultp>\t\tdvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_double2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high double-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, double, highp>\t\thighp_dvec2;\n\n\t/// 2 components vector of medium double-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, double, mediump>\t\tmediump_dvec2;\n\n\t/// 2 components vector of low double-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, double, lowp>\t\tlowp_dvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_double3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, double, defaultp>\t\tdvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double3_precision.hpp", "language": "code", "loc": 28, "comment_density": 0.75, "code": "/// @ref core\n/// @file glm/ext/vector_double3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, double, highp>\t\thighp_dvec3;\n\n\t/// 3 components vector of medium double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, double, mediump>\t\tmediump_dvec3;\n\n\t/// 3 components vector of low double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, double, lowp>\t\tlowp_dvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_double4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of double-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, double, defaultp>\t\tdvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_double4_precision.hpp", "language": "code", "loc": 29, "comment_density": 0.724, "code": "/// @ref core\n/// @file glm/ext/vector_double4_precision.hpp\n\n#pragma once\n#include \"../detail/setup.hpp\"\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, double, highp>\t\thighp_dvec4;\n\n\t/// 4 components vector of medium double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, double, mediump>\t\tmediump_dvec4;\n\n\t/// 4 components vector of low double-qualifier floating-point numbers.\n\t/// There is no guarantee on the actual qualifier.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, double, lowp>\t\tlowp_dvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float1.hpp", "language": "code", "loc": 25, "comment_density": 0.68, "code": "/// @ref ext_vector_float1\n/// @file glm/ext/vector_float1.hpp\n///\n/// @defgroup ext_vector_float1 GLM_EXT_vector_float1\n/// @ingroup ext\n///\n/// Exposes single-precision floating point vector type with one component.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_float1_precision extension.\n/// @see ext_vector_double1 extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_float1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_float1\n\t/// @{\n\n\t/// 1 components vector of single-precision floating-point numbers.\n\ttypedef vec<1, float, defaultp>\t\tvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float1_precision.hpp", "language": "code", "loc": 28, "comment_density": 0.643, "code": "/// @ref ext_vector_float1_precision\n/// @file glm/ext/vector_float1_precision.hpp\n///\n/// @defgroup ext_vector_float1_precision GLM_EXT_vector_float1_precision\n/// @ingroup ext\n///\n/// Exposes highp_vec1, mediump_vec1 and lowp_vec1 types.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_float1 extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_float1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_float1_precision\n\t/// @{\n\n\t/// 1 component vector of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, highp>\t\thighp_vec1;\n\n\t/// 1 component vector of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, mediump>\t\tmediump_vec1;\n\n\t/// 1 component vector of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, lowp>\t\t\tlowp_vec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_float2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, float, defaultp>\tvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_float2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, float, highp>\t\thighp_vec2;\n\n\t/// 2 components vector of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, float, mediump>\t\tmediump_vec2;\n\n\t/// 2 components vector of low single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, float, lowp>\t\t\tlowp_vec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_float3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, float, defaultp>\t\tvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_float3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, float, highp>\t\thighp_vec3;\n\n\t/// 3 components vector of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, float, mediump>\t\tmediump_vec3;\n\n\t/// 3 components vector of low single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, float, lowp>\t\t\tlowp_vec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_float4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of single-precision floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, float, defaultp>\t\tvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_float4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_float4_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, float, highp>\t\thighp_vec4;\n\n\t/// 4 components vector of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, float, mediump>\t\tmediump_vec4;\n\n\t/// 4 components vector of low single-qualifier floating-point numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, float, lowp>\t\t\tlowp_vec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int1.hpp", "language": "code", "loc": 25, "comment_density": 0.68, "code": "/// @ref ext_vector_int1\n/// @file glm/ext/vector_int1.hpp\n///\n/// @defgroup ext_vector_int1 GLM_EXT_vector_int1\n/// @ingroup ext\n///\n/// Exposes ivec1 vector type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_uint1 extension.\n/// @see ext_vector_int1_precision extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_int1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_int1\n\t/// @{\n\n\t/// 1 component vector of signed integer numbers.\n\ttypedef vec<1, int, defaultp>\t\t\tivec1;\n\n\t/// @}\n}//namespace glm\n\n"}, {"path": "includes/glm/ext/vector_int1_precision.hpp", "language": "code", "loc": 26, "comment_density": 0.615, "code": "/// @ref ext_vector_int1_precision\n/// @file glm/ext/vector_int1_precision.hpp\n///\n/// @defgroup ext_vector_int1_precision GLM_EXT_vector_int1_precision\n/// @ingroup ext\n///\n/// Exposes highp_ivec1, mediump_ivec1 and lowp_ivec1 types.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_int1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_int1_precision\n\t/// @{\n\n\t/// 1 component vector of signed integer values.\n\ttypedef vec<1, int, highp>\t\t\thighp_ivec1;\n\n\t/// 1 component vector of signed integer values.\n\ttypedef vec<1, int, mediump>\t\tmediump_ivec1;\n\n\t/// 1 component vector of signed integer values.\n\ttypedef vec<1, int, lowp>\t\t\tlowp_ivec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_int2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, int, defaultp>\t\tivec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_int2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, int, highp>\t\thighp_ivec2;\n\n\t/// 2 components vector of medium qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, int, mediump>\tmediump_ivec2;\n\n\t/// 2 components vector of low qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, int, lowp>\t\tlowp_ivec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_int3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, int, defaultp>\t\tivec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_int3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, int, highp>\t\thighp_ivec3;\n\n\t/// 3 components vector of medium qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, int, mediump>\tmediump_ivec3;\n\n\t/// 3 components vector of low qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, int, lowp>\t\tlowp_ivec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_int4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, int, defaultp>\t\tivec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_int4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_int4_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, int, highp>\t\thighp_ivec4;\n\n\t/// 4 components vector of medium qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, int, mediump>\tmediump_ivec4;\n\n\t/// 4 components vector of low qualifier signed integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, int, lowp>\t\tlowp_ivec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_relational.hpp", "language": "code", "loc": 90, "comment_density": 0.733, "code": "/// @ref ext_vector_relational\n/// @file glm/ext/vector_relational.hpp\n///\n/// @defgroup ext_vector_relational GLM_EXT_vector_relational\n/// @ingroup ext\n///\n/// Exposes comparison functions for vector types that take a user defined epsilon values.\n///\n/// Include to use the features of this extension.\n///\n/// @see core_vector_relational\n/// @see ext_scalar_relational\n/// @see ext_matrix_relational\n\n#pragma once\n\n// Dependencies\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_relational extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_relational\n\t/// @{\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y, vec const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, T epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, vec const& epsilon);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec equal(vec const& x, vec const& y, vec const& ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, int ULPs);\n\n\t/// Returns the component-wise comparison between two vectors in term of ULPs.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, vec const& ULPs);\n\n\t/// @}\n}//namespace glm\n\n#include \"vector_relational.inl\"\n"}, {"path": "includes/glm/ext/vector_uint1.hpp", "language": "code", "loc": 25, "comment_density": 0.68, "code": "/// @ref ext_vector_uint1\n/// @file glm/ext/vector_uint1.hpp\n///\n/// @defgroup ext_vector_uint1 GLM_EXT_vector_uint1\n/// @ingroup ext\n///\n/// Exposes uvec1 vector type.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_vector_int1 extension.\n/// @see ext_vector_uint1_precision extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_uint1 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_uint1\n\t/// @{\n\n\t/// 1 component vector of unsigned integer numbers.\n\ttypedef vec<1, unsigned int, defaultp>\t\t\tuvec1;\n\n\t/// @}\n}//namespace glm\n\n"}, {"path": "includes/glm/ext/vector_uint1_precision.hpp", "language": "code", "loc": 32, "comment_density": 0.688, "code": "/// @ref ext_vector_uint1_precision\n/// @file glm/ext/vector_uint1_precision.hpp\n///\n/// @defgroup ext_vector_uint1_precision GLM_EXT_vector_uint1_precision\n/// @ingroup ext\n///\n/// Exposes highp_uvec1, mediump_uvec1 and lowp_uvec1 types.\n///\n/// Include to use the features of this extension.\n\n#pragma once\n\n#include \"../detail/type_vec1.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_uint1_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup ext_vector_uint1_precision\n\t/// @{\n\n\t/// 1 component vector of unsigned integer values.\n\t///\n\t/// @see ext_vector_uint1_precision\n\ttypedef vec<1, unsigned int, highp>\t\t\thighp_uvec1;\n\n\t/// 1 component vector of unsigned integer values.\n\t///\n\t/// @see ext_vector_uint1_precision\n\ttypedef vec<1, unsigned int, mediump>\t\tmediump_uvec1;\n\n\t/// 1 component vector of unsigned integer values.\n\t///\n\t/// @see ext_vector_uint1_precision\n\ttypedef vec<1, unsigned int, lowp>\t\t\tlowp_uvec1;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint2.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_uint2.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 2 components vector of unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<2, unsigned int, defaultp>\t\tuvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint2_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_uint2_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec2.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 2 components vector of high qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, unsigned int, highp>\t\thighp_uvec2;\n\n\t/// 2 components vector of medium qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, unsigned int, mediump>\tmediump_uvec2;\n\n\t/// 2 components vector of low qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<2, unsigned int, lowp>\t\tlowp_uvec2;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint3.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_uint3.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 3 components vector of unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<3, unsigned int, defaultp>\t\tuvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint3_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_uint3_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec3.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 3 components vector of high qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, unsigned int, highp>\t\thighp_uvec3;\n\n\t/// 3 components vector of medium qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, unsigned int, mediump>\tmediump_uvec3;\n\n\t/// 3 components vector of low qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<3, unsigned int, lowp>\t\tlowp_uvec3;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint4.hpp", "language": "code", "loc": 14, "comment_density": 0.643, "code": "/// @ref core\n/// @file glm/ext/vector_uint4.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector\n\t/// @{\n\n\t/// 4 components vector of unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\ttypedef vec<4, unsigned int, defaultp>\t\tuvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_uint4_precision.hpp", "language": "code", "loc": 25, "comment_density": 0.72, "code": "/// @ref core\n/// @file glm/ext/vector_uint4_precision.hpp\n\n#pragma once\n#include \"../detail/type_vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup core_vector_precision\n\t/// @{\n\n\t/// 4 components vector of high qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, unsigned int, highp>\t\thighp_uvec4;\n\n\t/// 4 components vector of medium qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, unsigned int, mediump>\tmediump_uvec4;\n\n\t/// 4 components vector of low qualifier unsigned integer numbers.\n\t///\n\t/// @see GLSL 4.20.8 specification, section 4.1.5 Vectors\n\t/// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier\n\ttypedef vec<4, unsigned int, lowp>\t\tlowp_uvec4;\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/ext/vector_ulp.hpp", "language": "code", "loc": 96, "comment_density": 0.75, "code": "/// @ref ext_vector_ulp\n/// @file glm/ext/vector_ulp.hpp\n///\n/// @defgroup ext_vector_ulp GLM_EXT_vector_ulp\n/// @ingroup ext\n///\n/// Allow the measurement of the accuracy of a function against a reference\n/// implementation. This extension works on floating-point data and provide results\n/// in ULP.\n///\n/// Include to use the features of this extension.\n///\n/// @see ext_scalar_ulp\n/// @see ext_scalar_relational\n/// @see ext_vector_relational\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_ulp.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_EXT_vector_ulp extension included\")\n#endif\n\nnamespace glm\n{\n\t/// Return the next ULP value(s) after the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec next_float(vec const& x);\n\n\t/// Return the value(s) ULP distance after the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec next_float(vec const& x, int ULPs);\n\n\t/// Return the value(s) ULP distance after the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec next_float(vec const& x, vec const& ULPs);\n\n\t/// Return the previous ULP value(s) before the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec prev_float(vec const& x);\n\n\t/// Return the value(s) ULP distance before the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec prev_float(vec const& x, int ULPs);\n\n\t/// Return the value(s) ULP distance before the input value(s).\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec prev_float(vec const& x, vec const& ULPs);\n\n\t/// Return the distance in the number of ULP between 2 single-precision floating-point scalars.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec float_distance(vec const& x, vec const& y);\n\n\t/// Return the distance in the number of ULP between 2 double-precision floating-point scalars.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_scalar_ulp\n\ttemplate\n\tGLM_FUNC_DECL vec float_distance(vec const& x, vec const& y);\n\n\t/// @}\n}//namespace glm\n\n#include \"vector_ulp.inl\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.682, "dedup_hash": "e26180dfeedd64ff", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_gtc", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Gtc", "api": "OpenGL Core", "glsl_version": null, "topic": "postprocessing/texturing/bumpmapping/vegetation/procedural", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/gtc/bitfield.hpp", "language": "code", "loc": 227, "comment_density": 0.753, "code": "/// @ref gtc_bitfield\n/// @file glm/gtc/bitfield.hpp\n///\n/// @see core (dependence)\n/// @see gtc_bitfield (dependence)\n///\n/// @defgroup gtc_bitfield GLM_GTC_bitfield\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Allow to perform bit operations on integer values\n\n#include \"../detail/setup.hpp\"\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_int_sized.hpp\"\n#include \"../ext/scalar_uint_sized.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../detail/_vectorize.hpp\"\n#include \"type_precision.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_bitfield extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_bitfield\n\t/// @{\n\n\t/// Build a mask of 'count' bits\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType mask(genIUType Bits);\n\n\t/// Build a mask of 'count' bits\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec mask(vec const& v);\n\n\t/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType bitfieldRotateRight(genIUType In, int Shift);\n\n\t/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldRotateRight(vec const& In, int Shift);\n\n\t/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType bitfieldRotateLeft(genIUType In, int Shift);\n\n\t/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldRotateLeft(vec const& In, int Shift);\n\n\t/// Set to 1 a range of bits.\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount);\n\n\t/// Set to 1 a range of bits.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldFillOne(vec const& Value, int FirstBit, int BitCount);\n\n\t/// Set to 0 a range of bits.\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount);\n\n\t/// Set to 0 a range of bits.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Signed and unsigned integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_bitfield\n\ttemplate\n\tGLM_FUNC_DECL vec bitfieldFillZero(vec const& Value, int FirstBit, int BitCount);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int16 bitfieldInterleave(int8 x, int8 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint16 bitfieldInterleave(uint8 x, uint8 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of v.x followed by the first bit of v.y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint16 bitfieldInterleave(u8vec2 const& v);\n\n\t/// Deinterleaves the bits of x.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL glm::u8vec2 bitfieldDeinterleave(glm::uint16 x);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int32 bitfieldInterleave(int16 x, int16 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint32 bitfieldInterleave(uint16 x, uint16 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of v.x followed by the first bit of v.y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint32 bitfieldInterleave(u16vec2 const& v);\n\n\t/// Deinterleaves the bits of x.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL glm::u16vec2 bitfieldDeinterleave(glm::uint32 x);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of x followed by the first bit of y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y);\n\n\t/// Interleaves the bits of x and y.\n\t/// The first bit is the first bit of v.x followed by the first bit of v.y.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(u32vec2 const& v);\n\n\t/// Deinterleaves the bits of x.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL glm::u32vec2 bitfieldDeinterleave(glm::uint64 x);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y, int32 z);\n\n\t/// Interleaves the bits of x, y and z.\n\t/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z);\n\n\t/// Interleaves the bits of x, y, z and w.\n\t/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w);\n\n\t/// Interleaves the bits of x, y, z and w.\n\t/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w);\n\n\t/// Interleaves the bits of x, y, z and w.\n\t/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w);\n\n\t/// Interleaves the bits of x, y, z and w.\n\t/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.\n\t/// The other bits are interleaved following the previous sequence.\n\t///\n\t/// @see gtc_bitfield\n\tGLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w);\n\n\t/// @}\n} //namespace glm\n\n#include \"bitfield.inl\"\n"}, {"path": "includes/glm/gtc/color_space.hpp", "language": "code", "loc": 46, "comment_density": 0.543, "code": "/// @ref gtc_color_space\n/// @file glm/gtc/color_space.hpp\n///\n/// @see core (dependence)\n/// @see gtc_color_space (dependence)\n///\n/// @defgroup gtc_color_space GLM_GTC_color_space\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../exponential.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_color_space extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_color_space\n\t/// @{\n\n\t/// Convert a linear color to sRGB color using a standard gamma correction.\n\t/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb\n\ttemplate\n\tGLM_FUNC_DECL vec convertLinearToSRGB(vec const& ColorLinear);\n\n\t/// Convert a linear color to sRGB color using a custom gamma correction.\n\t/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb\n\ttemplate\n\tGLM_FUNC_DECL vec convertLinearToSRGB(vec const& ColorLinear, T Gamma);\n\n\t/// Convert a sRGB color to linear color using a standard gamma correction.\n\t/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb\n\ttemplate\n\tGLM_FUNC_DECL vec convertSRGBToLinear(vec const& ColorSRGB);\n\n\t/// Convert a sRGB color to linear color using a custom gamma correction.\n\t// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb\n\ttemplate\n\tGLM_FUNC_DECL vec convertSRGBToLinear(vec const& ColorSRGB, T Gamma);\n\n\t/// @}\n} //namespace glm\n\n#include \"color_space.inl\"\n"}, {"path": "includes/glm/gtc/constants.hpp", "language": "code", "loc": 132, "comment_density": 0.53, "code": "/// @ref gtc_constants\n/// @file glm/gtc/constants.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_constants GLM_GTC_constants\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Provide a list of constants and precomputed useful values.\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_constants.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_constants extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_constants\n\t/// @{\n\n\t/// Return 0.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType zero();\n\n\t/// Return 1.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType one();\n\n\t/// Return pi * 2.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType two_pi();\n\n\t/// Return square root of pi.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_pi();\n\n\t/// Return pi / 2.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType half_pi();\n\n\t/// Return pi / 2 * 3.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType three_over_two_pi();\n\n\t/// Return pi / 4.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType quarter_pi();\n\n\t/// Return 1 / pi.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType one_over_pi();\n\n\t/// Return 1 / (pi * 2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType one_over_two_pi();\n\n\t/// Return 2 / pi.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType two_over_pi();\n\n\t/// Return 4 / pi.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType four_over_pi();\n\n\t/// Return 2 / sqrt(pi).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType two_over_root_pi();\n\n\t/// Return 1 / sqrt(2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType one_over_root_two();\n\n\t/// Return sqrt(pi / 2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_half_pi();\n\n\t/// Return sqrt(2 * pi).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_two_pi();\n\n\t/// Return sqrt(ln(4)).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_ln_four();\n\n\t/// Return e constant.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType e();\n\n\t/// Return Euler's constant.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType euler();\n\n\t/// Return sqrt(2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_two();\n\n\t/// Return sqrt(3).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_three();\n\n\t/// Return sqrt(5).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType root_five();\n\n\t/// Return ln(2).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType ln_two();\n\n\t/// Return ln(10).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType ln_ten();\n\n\t/// Return ln(ln(2)).\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType ln_ln_two();\n\n\t/// Return 1 / 3.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType third();\n\n\t/// Return 2 / 3.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType two_thirds();\n\n\t/// Return the golden ratio constant.\n\t/// @see gtc_constants\n\ttemplate\n\tGLM_FUNC_DECL GLM_CONSTEXPR genType golden_ratio();\n\n\t/// @}\n} //namespace glm\n\n#include \"constants.inl\"\n"}, {"path": "includes/glm/gtc/epsilon.hpp", "language": "code", "loc": 50, "comment_density": 0.66, "code": "/// @ref gtc_epsilon\n/// @file glm/gtc/epsilon.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtc_epsilon GLM_GTC_epsilon\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Comparison functions for a user defined epsilon values.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_epsilon extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_epsilon\n\t/// @{\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL vec epsilonEqual(vec const& x, vec const& y, T const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is satisfied.\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL bool epsilonEqual(genType const& x, genType const& y, genType const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| < epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL vec epsilonNotEqual(vec const& x, vec const& y, T const& epsilon);\n\n\t/// Returns the component-wise comparison of |x - y| >= epsilon.\n\t/// True if this expression is not satisfied.\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL bool epsilonNotEqual(genType const& x, genType const& y, genType const& epsilon);\n\n\t/// @}\n}//namespace glm\n\n#include \"epsilon.inl\"\n"}, {"path": "includes/glm/gtc/integer.hpp", "language": "code", "loc": 56, "comment_density": 0.661, "code": "/// @ref gtc_integer\n/// @file glm/gtc/integer.hpp\n///\n/// @see core (dependence)\n/// @see gtc_integer (dependence)\n///\n/// @defgroup gtc_integer GLM_GTC_integer\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// @brief Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../common.hpp\"\n#include \"../integer.hpp\"\n#include \"../exponential.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_integer extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_integer\n\t/// @{\n\n\t/// Returns the log2 of x for integer values. Can be reliably using to compute mipmap count from the texture size.\n\t/// @see gtc_integer\n\ttemplate\n\tGLM_FUNC_DECL genIUType log2(genIUType x);\n\n\t/// Returns a value equal to the nearest integer to x.\n\t/// The fraction 0.5 will round in a direction chosen by the\n\t/// implementation, presumably the direction that is fastest.\n\t///\n\t/// @param x The values of the argument must be greater or equal to zero.\n\t/// @tparam T floating point scalar types.\n\t///\n\t/// @see GLSL round man page\n\t/// @see gtc_integer\n\ttemplate\n\tGLM_FUNC_DECL vec iround(vec const& x);\n\n\t/// Returns a value equal to the nearest integer to x.\n\t/// The fraction 0.5 will round in a direction chosen by the\n\t/// implementation, presumably the direction that is fastest.\n\t///\n\t/// @param x The values of the argument must be greater or equal to zero.\n\t/// @tparam T floating point scalar types.\n\t///\n\t/// @see GLSL round man page\n\t/// @see gtc_integer\n\ttemplate\n\tGLM_FUNC_DECL vec uround(vec const& x);\n\n\t/// @}\n} //namespace glm\n\n#include \"integer.inl\"\n"}, {"path": "includes/glm/gtc/matrix_access.hpp", "language": "code", "loc": 50, "comment_density": 0.48, "code": "/// @ref gtc_matrix_access\n/// @file glm/gtc/matrix_access.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_matrix_access GLM_GTC_matrix_access\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines functions to access rows or columns of a matrix easily.\n\n#pragma once\n\n// Dependency:\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_matrix_access extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_matrix_access\n\t/// @{\n\n\t/// Get a specific row of a matrix.\n\t/// @see gtc_matrix_access\n\ttemplate\n\tGLM_FUNC_DECL typename genType::row_type row(\n\t\tgenType const& m,\n\t\tlength_t index);\n\n\t/// Set a specific row to a matrix.\n\t/// @see gtc_matrix_access\n\ttemplate\n\tGLM_FUNC_DECL genType row(\n\t\tgenType const& m,\n\t\tlength_t index,\n\t\ttypename genType::row_type const& x);\n\n\t/// Get a specific column of a matrix.\n\t/// @see gtc_matrix_access\n\ttemplate\n\tGLM_FUNC_DECL typename genType::col_type column(\n\t\tgenType const& m,\n\t\tlength_t index);\n\n\t/// Set a specific column to a matrix.\n\t/// @see gtc_matrix_access\n\ttemplate\n\tGLM_FUNC_DECL genType column(\n\t\tgenType const& m,\n\t\tlength_t index,\n\t\ttypename genType::col_type const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_access.inl\"\n"}, {"path": "includes/glm/gtc/matrix_integer.hpp", "language": "code", "loc": 375, "comment_density": 0.565, "code": "/// @ref gtc_matrix_integer\n/// @file glm/gtc/matrix_integer.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_matrix_integer GLM_GTC_matrix_integer\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines a number of matrices with integer types.\n\n#pragma once\n\n// Dependency:\n#include \"../mat2x2.hpp\"\n#include \"../mat2x3.hpp\"\n#include \"../mat2x4.hpp\"\n#include \"../mat3x2.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat3x4.hpp\"\n#include \"../mat4x2.hpp\"\n#include \"../mat4x3.hpp\"\n#include \"../mat4x4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_matrix_integer extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_matrix_integer\n\t/// @{\n\n\t/// High-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, highp>\t\t\t\thighp_imat2;\n\n\t/// High-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, highp>\t\t\t\thighp_imat3;\n\n\t/// High-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, highp>\t\t\t\thighp_imat4;\n\n\t/// High-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, highp>\t\t\t\thighp_imat2x2;\n\n\t/// High-qualifier signed integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, int, highp>\t\t\t\thighp_imat2x3;\n\n\t/// High-qualifier signed integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, int, highp>\t\t\t\thighp_imat2x4;\n\n\t/// High-qualifier signed integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, int, highp>\t\t\t\thighp_imat3x2;\n\n\t/// High-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, highp>\t\t\t\thighp_imat3x3;\n\n\t/// High-qualifier signed integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, int, highp>\t\t\t\thighp_imat3x4;\n\n\t/// High-qualifier signed integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, int, highp>\t\t\t\thighp_imat4x2;\n\n\t/// High-qualifier signed integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, int, highp>\t\t\t\thighp_imat4x3;\n\n\t/// High-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, highp>\t\t\t\thighp_imat4x4;\n\n\n\t/// Medium-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, mediump>\t\t\tmediump_imat2;\n\n\t/// Medium-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, mediump>\t\t\tmediump_imat3;\n\n\t/// Medium-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, mediump>\t\t\tmediump_imat4;\n\n\n\t/// Medium-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, mediump>\t\t\tmediump_imat2x2;\n\n\t/// Medium-qualifier signed integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, int, mediump>\t\t\tmediump_imat2x3;\n\n\t/// Medium-qualifier signed integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, int, mediump>\t\t\tmediump_imat2x4;\n\n\t/// Medium-qualifier signed integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, int, mediump>\t\t\tmediump_imat3x2;\n\n\t/// Medium-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, mediump>\t\t\tmediump_imat3x3;\n\n\t/// Medium-qualifier signed integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, int, mediump>\t\t\tmediump_imat3x4;\n\n\t/// Medium-qualifier signed integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, int, mediump>\t\t\tmediump_imat4x2;\n\n\t/// Medium-qualifier signed integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, int, mediump>\t\t\tmediump_imat4x3;\n\n\t/// Medium-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, mediump>\t\t\tmediump_imat4x4;\n\n\n\t/// Low-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, lowp>\t\t\t\tlowp_imat2;\n\n\t/// Low-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, lowp>\t\t\t\tlowp_imat3;\n\n\t/// Low-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, lowp>\t\t\t\tlowp_imat4;\n\n\n\t/// Low-qualifier signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, int, lowp>\t\t\t\tlowp_imat2x2;\n\n\t/// Low-qualifier signed integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, int, lowp>\t\t\t\tlowp_imat2x3;\n\n\t/// Low-qualifier signed integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, int, lowp>\t\t\t\tlowp_imat2x4;\n\n\t/// Low-qualifier signed integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, int, lowp>\t\t\t\tlowp_imat3x2;\n\n\t/// Low-qualifier signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, int, lowp>\t\t\t\tlowp_imat3x3;\n\n\t/// Low-qualifier signed integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, int, lowp>\t\t\t\tlowp_imat3x4;\n\n\t/// Low-qualifier signed integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, int, lowp>\t\t\t\tlowp_imat4x2;\n\n\t/// Low-qualifier signed integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, int, lowp>\t\t\t\tlowp_imat4x3;\n\n\t/// Low-qualifier signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, int, lowp>\t\t\t\tlowp_imat4x4;\n\n\n\t/// High-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, highp>\t\t\t\thighp_umat2;\n\n\t/// High-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, highp>\t\t\t\thighp_umat3;\n\n\t/// High-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, highp>\t\t\t\thighp_umat4;\n\n\t/// High-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, highp>\t\t\t\thighp_umat2x2;\n\n\t/// High-qualifier unsigned integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, uint, highp>\t\t\t\thighp_umat2x3;\n\n\t/// High-qualifier unsigned integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, uint, highp>\t\t\t\thighp_umat2x4;\n\n\t/// High-qualifier unsigned integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, uint, highp>\t\t\t\thighp_umat3x2;\n\n\t/// High-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, highp>\t\t\t\thighp_umat3x3;\n\n\t/// High-qualifier unsigned integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, uint, highp>\t\t\t\thighp_umat3x4;\n\n\t/// High-qualifier unsigned integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, uint, highp>\t\t\t\thighp_umat4x2;\n\n\t/// High-qualifier unsigned integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, uint, highp>\t\t\t\thighp_umat4x3;\n\n\t/// High-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, highp>\t\t\t\thighp_umat4x4;\n\n\n\t/// Medium-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, mediump>\t\t\tmediump_umat2;\n\n\t/// Medium-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, mediump>\t\t\tmediump_umat3;\n\n\t/// Medium-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, mediump>\t\t\tmediump_umat4;\n\n\n\t/// Medium-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, mediump>\t\t\tmediump_umat2x2;\n\n\t/// Medium-qualifier unsigned integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, uint, mediump>\t\t\tmediump_umat2x3;\n\n\t/// Medium-qualifier unsigned integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, uint, mediump>\t\t\tmediump_umat2x4;\n\n\t/// Medium-qualifier unsigned integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, uint, mediump>\t\t\tmediump_umat3x2;\n\n\t/// Medium-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, mediump>\t\t\tmediump_umat3x3;\n\n\t/// Medium-qualifier unsigned integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, uint, mediump>\t\t\tmediump_umat3x4;\n\n\t/// Medium-qualifier unsigned integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, uint, mediump>\t\t\tmediump_umat4x2;\n\n\t/// Medium-qualifier unsigned integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, uint, mediump>\t\t\tmediump_umat4x3;\n\n\t/// Medium-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, mediump>\t\t\tmediump_umat4x4;\n\n\n\t/// Low-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, lowp>\t\t\t\tlowp_umat2;\n\n\t/// Low-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, lowp>\t\t\t\tlowp_umat3;\n\n\t/// Low-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, lowp>\t\t\t\tlowp_umat4;\n\n\n\t/// Low-qualifier unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 2, uint, lowp>\t\t\t\tlowp_umat2x2;\n\n\t/// Low-qualifier unsigned integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 3, uint, lowp>\t\t\t\tlowp_umat2x3;\n\n\t/// Low-qualifier unsigned integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<2, 4, uint, lowp>\t\t\t\tlowp_umat2x4;\n\n\t/// Low-qualifier unsigned integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 2, uint, lowp>\t\t\t\tlowp_umat3x2;\n\n\t/// Low-qualifier unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 3, uint, lowp>\t\t\t\tlowp_umat3x3;\n\n\t/// Low-qualifier unsigned integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<3, 4, uint, lowp>\t\t\t\tlowp_umat3x4;\n\n\t/// Low-qualifier unsigned integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 2, uint, lowp>\t\t\t\tlowp_umat4x2;\n\n\t/// Low-qualifier unsigned integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 3, uint, lowp>\t\t\t\tlowp_umat4x3;\n\n\t/// Low-qualifier unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mat<4, 4, uint, lowp>\t\t\t\tlowp_umat4x4;\n\n#if(defined(GLM_PRECISION_HIGHP_INT))\n\ttypedef highp_imat2\t\t\t\t\t\t\t\timat2;\n\ttypedef highp_imat3\t\t\t\t\t\t\t\timat3;\n\ttypedef highp_imat4\t\t\t\t\t\t\t\timat4;\n\ttypedef highp_imat2x2\t\t\t\t\t\t\timat2x2;\n\ttypedef highp_imat2x3\t\t\t\t\t\t\timat2x3;\n\ttypedef highp_imat2x4\t\t\t\t\t\t\timat2x4;\n\ttypedef highp_imat3x2\t\t\t\t\t\t\timat3x2;\n\ttypedef highp_imat3x3\t\t\t\t\t\t\timat3x3;\n\ttypedef highp_imat3x4\t\t\t\t\t\t\timat3x4;\n\ttypedef highp_imat4x2\t\t\t\t\t\t\timat4x2;\n\ttypedef highp_imat4x3\t\t\t\t\t\t\timat4x3;\n\ttypedef highp_imat4x4\t\t\t\t\t\t\timat4x4;\n#elif(defined(GLM_PRECISION_LOWP_INT))\n\ttypedef lowp_imat2\t\t\t\t\t\t\t\timat2;\n\ttypedef lowp_imat3\t\t\t\t\t\t\t\timat3;\n\ttypedef lowp_imat4\t\t\t\t\t\t\t\timat4;\n\ttypedef lowp_imat2x2\t\t\t\t\t\t\timat2x2;\n\ttypedef lowp_imat2x3\t\t\t\t\t\t\timat2x3;\n\ttypedef lowp_imat2x4\t\t\t\t\t\t\timat2x4;\n\ttypedef lowp_imat3x2\t\t\t\t\t\t\timat3x2;\n\ttypedef lowp_imat3x3\t\t\t\t\t\t\timat3x3;\n\ttypedef lowp_imat3x4\t\t\t\t\t\t\timat3x4;\n\ttypedef lowp_imat4x2\t\t\t\t\t\t\timat4x2;\n\ttypedef lowp_imat4x3\t\t\t\t\t\t\timat4x3;\n\ttypedef lowp_imat4x4\t\t\t\t\t\t\timat4x4;\n#else //if(defined(GLM_PRECISION_MEDIUMP_INT))\n\n\t/// Signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat2\t\t\t\t\t\t\timat2;\n\n\t/// Signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat3\t\t\t\t\t\t\timat3;\n\n\t/// Signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat4\t\t\t\t\t\t\timat4;\n\n\t/// Signed integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat2x2\t\t\t\t\t\t\timat2x2;\n\n\t/// Signed integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat2x3\t\t\t\t\t\t\timat2x3;\n\n\t/// Signed integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat2x4\t\t\t\t\t\t\timat2x4;\n\n\t/// Signed integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat3x2\t\t\t\t\t\t\timat3x2;\n\n\t/// Signed integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat3x3\t\t\t\t\t\t\timat3x3;\n\n\t/// Signed integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat3x4\t\t\t\t\t\t\timat3x4;\n\n\t/// Signed integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat4x2\t\t\t\t\t\t\timat4x2;\n\n\t/// Signed integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat4x3\t\t\t\t\t\t\timat4x3;\n\n\t/// Signed integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_imat4x4\t\t\t\t\t\t\timat4x4;\n#endif//GLM_PRECISION\n\n#if(defined(GLM_PRECISION_HIGHP_UINT))\n\ttypedef highp_umat2\t\t\t\t\t\t\t\tumat2;\n\ttypedef highp_umat3\t\t\t\t\t\t\t\tumat3;\n\ttypedef highp_umat4\t\t\t\t\t\t\t\tumat4;\n\ttypedef highp_umat2x2\t\t\t\t\t\t\tumat2x2;\n\ttypedef highp_umat2x3\t\t\t\t\t\t\tumat2x3;\n\ttypedef highp_umat2x4\t\t\t\t\t\t\tumat2x4;\n\ttypedef highp_umat3x2\t\t\t\t\t\t\tumat3x2;\n\ttypedef highp_umat3x3\t\t\t\t\t\t\tumat3x3;\n\ttypedef highp_umat3x4\t\t\t\t\t\t\tumat3x4;\n\ttypedef highp_umat4x2\t\t\t\t\t\t\tumat4x2;\n\ttypedef highp_umat4x3\t\t\t\t\t\t\tumat4x3;\n\ttypedef highp_umat4x4\t\t\t\t\t\t\tumat4x4;\n#elif(defined(GLM_PRECISION_LOWP_UINT))\n\ttypedef lowp_umat2\t\t\t\t\t\t\t\tumat2;\n\ttypedef lowp_umat3\t\t\t\t\t\t\t\tumat3;\n\ttypedef lowp_umat4\t\t\t\t\t\t\t\tumat4;\n\ttypedef lowp_umat2x2\t\t\t\t\t\t\tumat2x2;\n\ttypedef lowp_umat2x3\t\t\t\t\t\t\tumat2x3;\n\ttypedef lowp_umat2x4\t\t\t\t\t\t\tumat2x4;\n\ttypedef lowp_umat3x2\t\t\t\t\t\t\tumat3x2;\n\ttypedef lowp_umat3x3\t\t\t\t\t\t\tumat3x3;\n\ttypedef lowp_umat3x4\t\t\t\t\t\t\tumat3x4;\n\ttypedef lowp_umat4x2\t\t\t\t\t\t\tumat4x2;\n\ttypedef lowp_umat4x3\t\t\t\t\t\t\tumat4x3;\n\ttypedef lowp_umat4x4\t\t\t\t\t\t\tumat4x4;\n#else //if(defined(GLM_PRECISION_MEDIUMP_UINT))\n\n\t/// Unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat2\t\t\t\t\t\t\tumat2;\n\n\t/// Unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat3\t\t\t\t\t\t\tumat3;\n\n\t/// Unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat4\t\t\t\t\t\t\tumat4;\n\n\t/// Unsigned integer 2x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat2x2\t\t\t\t\t\t\tumat2x2;\n\n\t/// Unsigned integer 2x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat2x3\t\t\t\t\t\t\tumat2x3;\n\n\t/// Unsigned integer 2x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat2x4\t\t\t\t\t\t\tumat2x4;\n\n\t/// Unsigned integer 3x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat3x2\t\t\t\t\t\t\tumat3x2;\n\n\t/// Unsigned integer 3x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat3x3\t\t\t\t\t\t\tumat3x3;\n\n\t/// Unsigned integer 3x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat3x4\t\t\t\t\t\t\tumat3x4;\n\n\t/// Unsigned integer 4x2 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat4x2\t\t\t\t\t\t\tumat4x2;\n\n\t/// Unsigned integer 4x3 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat4x3\t\t\t\t\t\t\tumat4x3;\n\n\t/// Unsigned integer 4x4 matrix.\n\t/// @see gtc_matrix_integer\n\ttypedef mediump_umat4x4\t\t\t\t\t\t\tumat4x4;\n#endif//GLM_PRECISION\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/gtc/matrix_inverse.hpp", "language": "code", "loc": 42, "comment_density": 0.619, "code": "/// @ref gtc_matrix_inverse\n/// @file glm/gtc/matrix_inverse.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines additional matrix inverting functions.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../matrix.hpp\"\n#include \"../mat2x2.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat4x4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_matrix_inverse extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_matrix_inverse\n\t/// @{\n\n\t/// Fast matrix inverse for affine matrix.\n\t///\n\t/// @param m Input matrix to invert.\n\t/// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly inaccurate.\n\t/// @see gtc_matrix_inverse\n\ttemplate\n\tGLM_FUNC_DECL genType affineInverse(genType const& m);\n\n\t/// Compute the inverse transpose of a matrix.\n\t///\n\t/// @param m Input matrix to invert transpose.\n\t/// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly inaccurate.\n\t/// @see gtc_matrix_inverse\n\ttemplate\n\tGLM_FUNC_DECL genType inverseTranspose(genType const& m);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_inverse.inl\"\n"}, {"path": "includes/glm/gtc/matrix_transform.hpp", "language": "code", "loc": 32, "comment_density": 0.625, "code": "/// @ref gtc_matrix_transform\n/// @file glm/gtc/matrix_transform.hpp\n///\n/// @see core (dependence)\n/// @see gtx_transform\n/// @see gtx_transform2\n///\n/// @defgroup gtc_matrix_transform GLM_GTC_matrix_transform\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines functions that generate common transformation matrices.\n///\n/// The matrices generated by this extension use standard OpenGL fixed-function\n/// conventions. For example, the lookAt function generates a transform from world\n/// space into the specific eye space that the projective matrix functions\n/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility\n/// specifications defines the particular layout of this eye space.\n\n#pragma once\n\n// Dependencies\n#include \"../mat4x4.hpp\"\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../ext/matrix_projection.hpp\"\n#include \"../ext/matrix_clip_space.hpp\"\n#include \"../ext/matrix_transform.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_matrix_transform extension included\")\n#endif\n\n#include \"matrix_transform.inl\"\n"}, {"path": "includes/glm/gtc/noise.hpp", "language": "code", "loc": 52, "comment_density": 0.5, "code": "/// @ref gtc_noise\n/// @file glm/gtc/noise.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_noise GLM_GTC_noise\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines 2D, 3D and 4D procedural noise functions\n/// Based on the work of Stefan Gustavson and Ashima Arts on \"webgl-noise\":\n/// https://github.com/ashima/webgl-noise\n/// Following Stefan Gustavson's paper \"Simplex noise demystified\":\n/// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../detail/_noise.hpp\"\n#include \"../geometric.hpp\"\n#include \"../common.hpp\"\n#include \"../vector_relational.hpp\"\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_noise extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_noise\n\t/// @{\n\n\t/// Classic perlin noise.\n\t/// @see gtc_noise\n\ttemplate\n\tGLM_FUNC_DECL T perlin(\n\t\tvec const& p);\n\n\t/// Periodic perlin noise.\n\t/// @see gtc_noise\n\ttemplate\n\tGLM_FUNC_DECL T perlin(\n\t\tvec const& p,\n\t\tvec const& rep);\n\n\t/// Simplex noise.\n\t/// @see gtc_noise\n\ttemplate\n\tGLM_FUNC_DECL T simplex(\n\t\tvec const& p);\n\n\t/// @}\n}//namespace glm\n\n#include \"noise.inl\"\n"}, {"path": "includes/glm/gtc/packing.hpp", "language": "code", "loc": 648, "comment_density": 0.867, "code": "/// @ref gtc_packing\n/// @file glm/gtc/packing.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_packing GLM_GTC_packing\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// This extension provides a set of function to convert vertors to packed\n/// formats.\n\n#pragma once\n\n// Dependency:\n#include \"type_precision.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_packing extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_packing\n\t/// @{\n\n\t/// First, converts the normalized floating-point value v into a 8-bit integer value.\n\t/// Then, the results are packed into the returned 8-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm1x8:\tround(clamp(c, 0, +1) * 255.0)\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm2x8(vec2 const& v)\n\t/// @see uint32 packUnorm4x8(vec4 const& v)\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint8 packUnorm1x8(float v);\n\n\t/// Convert a single 8-bit integer to a normalized floating-point value.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm4x8: f / 255.0\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackUnorm2x8(uint16 p)\n\t/// @see vec4 unpackUnorm4x8(uint32 p)\n\t/// @see GLSL unpackUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackUnorm1x8(uint8 p);\n\n\t/// First, converts each component of the normalized floating-point value v into 8-bit integer values.\n\t/// Then, the results are packed into the returned 16-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm2x8:\tround(clamp(c, 0, +1) * 255.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint8 packUnorm1x8(float const& v)\n\t/// @see uint32 packUnorm4x8(vec4 const& v)\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packUnorm2x8(vec2 const& v);\n\n\t/// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit unsigned integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm4x8: f / 255.0\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackUnorm1x8(uint8 v)\n\t/// @see vec4 unpackUnorm4x8(uint32 p)\n\t/// @see GLSL unpackUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p);\n\n\t/// First, converts the normalized floating-point value v into 8-bit integer value.\n\t/// Then, the results are packed into the returned 8-bit unsigned integer.\n\t///\n\t/// The conversion to fixed point is done as follows:\n\t/// packSnorm1x8:\tround(clamp(s, -1, +1) * 127.0)\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packSnorm2x8(vec2 const& v)\n\t/// @see uint32 packSnorm4x8(vec4 const& v)\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint8 packSnorm1x8(float s);\n\n\t/// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers.\n\t/// Then, the value is converted to a normalized floating-point value to generate the returned scalar.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm1x8: clamp(f / 127.0, -1, +1)\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackSnorm2x8(uint16 p)\n\t/// @see vec4 unpackSnorm4x8(uint32 p)\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackSnorm1x8(uint8 p);\n\n\t/// First, converts each component of the normalized floating-point value v into 8-bit integer values.\n\t/// Then, the results are packed into the returned 16-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm2x8:\tround(clamp(c, -1, +1) * 127.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint8 packSnorm1x8(float const& v)\n\t/// @see uint32 packSnorm4x8(vec4 const& v)\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packSnorm2x8(vec2 const& v);\n\n\t/// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm2x8: clamp(f / 127.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackSnorm1x8(uint8 p)\n\t/// @see vec4 unpackSnorm4x8(uint32 p)\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p);\n\n\t/// First, converts the normalized floating-point value v into a 16-bit integer value.\n\t/// Then, the results are packed into the returned 16-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm1x16:\tround(clamp(c, 0, +1) * 65535.0)\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packSnorm1x16(float const& v)\n\t/// @see uint64 packSnorm4x16(vec4 const& v)\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packUnorm1x16(float v);\n\n\t/// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers.\n\t/// Then, the value is converted to a normalized floating-point value to generate the returned scalar.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnorm1x16: f / 65535.0\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackUnorm2x16(uint32 p)\n\t/// @see vec4 unpackUnorm4x16(uint64 p)\n\t/// @see GLSL unpackUnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackUnorm1x16(uint16 p);\n\n\t/// First, converts each component of the normalized floating-point value v into 16-bit integer values.\n\t/// Then, the results are packed into the returned 64-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm4x16:\tround(clamp(c, 0, +1) * 65535.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm1x16(float const& v)\n\t/// @see uint32 packUnorm2x16(vec2 const& v)\n\t/// @see GLSL packUnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint64 packUnorm4x16(vec4 const& v);\n\n\t/// First, unpacks a single 64-bit unsigned integer p into four 16-bit unsigned integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackUnormx4x16: f / 65535.0\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackUnorm1x16(uint16 p)\n\t/// @see vec2 unpackUnorm2x16(uint32 p)\n\t/// @see GLSL unpackUnorm2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 p);\n\n\t/// First, converts the normalized floating-point value v into 16-bit integer value.\n\t/// Then, the results are packed into the returned 16-bit unsigned integer.\n\t///\n\t/// The conversion to fixed point is done as follows:\n\t/// packSnorm1x8:\tround(clamp(s, -1, +1) * 32767.0)\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packSnorm2x16(vec2 const& v)\n\t/// @see uint64 packSnorm4x16(vec4 const& v)\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packSnorm1x16(float v);\n\n\t/// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned scalar.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm1x16: clamp(f / 32767.0, -1, +1)\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackSnorm2x16(uint32 p)\n\t/// @see vec4 unpackSnorm4x16(uint64 p)\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackSnorm1x16(uint16 p);\n\n\t/// First, converts each component of the normalized floating-point value v into 16-bit integer values.\n\t/// Then, the results are packed into the returned 64-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm2x8:\tround(clamp(c, -1, +1) * 32767.0)\n\t///\n\t/// The first component of the vector will be written to the least significant bits of the output;\n\t/// the last component will be written to the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packSnorm1x16(float const& v)\n\t/// @see uint32 packSnorm2x16(vec2 const& v)\n\t/// @see GLSL packSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint64 packSnorm4x16(vec4 const& v);\n\n\t/// First, unpacks a single 64-bit unsigned integer p into four 16-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm4x16: clamp(f / 32767.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackSnorm1x16(uint16 p)\n\t/// @see vec2 unpackSnorm2x16(uint32 p)\n\t/// @see GLSL unpackSnorm4x8 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackSnorm4x16(uint64 p);\n\n\t/// Returns an unsigned integer obtained by converting the components of a floating-point scalar\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification,\n\t/// and then packing this 16-bit value into a 16-bit unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packHalf2x16(vec2 const& v)\n\t/// @see uint64 packHalf4x16(vec4 const& v)\n\t/// @see GLSL packHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint16 packHalf1x16(float v);\n\n\t/// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value,\n\t/// interpreted as a 16-bit floating-point number according to the OpenGL Specification,\n\t/// and converting it to 32-bit floating-point values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackHalf2x16(uint32 const& v)\n\t/// @see vec4 unpackHalf4x16(uint64 const& v)\n\t/// @see GLSL unpackHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL float unpackHalf1x16(uint16 v);\n\n\t/// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification,\n\t/// and then packing these four 16-bit values into a 64-bit unsigned integer.\n\t/// The first vector component specifies the 16 least-significant bits of the result;\n\t/// the forth component specifies the 16 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packHalf1x16(float const& v)\n\t/// @see uint32 packHalf2x16(vec2 const& v)\n\t/// @see GLSL packHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL uint64 packHalf4x16(vec4 const& v);\n\n\t/// Returns a four-component floating-point vector with components obtained by unpacking a 64-bit unsigned integer into four 16-bit values,\n\t/// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,\n\t/// and converting them to 32-bit floating-point values.\n\t/// The first component of the vector is obtained from the 16 least-significant bits of v;\n\t/// the forth component is obtained from the 16 most-significant bits of v.\n\t///\n\t/// @see gtc_packing\n\t/// @see float unpackHalf1x16(uint16 const& v)\n\t/// @see vec2 unpackHalf2x16(uint32 const& v)\n\t/// @see GLSL unpackHalf2x16 man page\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\tGLM_FUNC_DECL vec4 unpackHalf4x16(uint64 p);\n\n\t/// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector\n\t/// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification,\n\t/// and then packing these four values into a 32-bit unsigned integer.\n\t/// The first vector component specifies the 10 least-significant bits of the result;\n\t/// the forth component specifies the 2 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packI3x10_1x2(uvec4 const& v)\n\t/// @see uint32 packSnorm3x10_1x2(vec4 const& v)\n\t/// @see uint32 packUnorm3x10_1x2(vec4 const& v)\n\t/// @see ivec4 unpackI3x10_1x2(uint32 const& p)\n\tGLM_FUNC_DECL uint32 packI3x10_1x2(ivec4 const& v);\n\n\t/// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit signed integers.\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packU3x10_1x2(uvec4 const& v)\n\t/// @see vec4 unpackSnorm3x10_1x2(uint32 const& p);\n\t/// @see uvec4 unpackI3x10_1x2(uint32 const& p);\n\tGLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 p);\n\n\t/// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector\n\t/// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification,\n\t/// and then packing these four values into a 32-bit unsigned integer.\n\t/// The first vector component specifies the 10 least-significant bits of the result;\n\t/// the forth component specifies the 2 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packI3x10_1x2(ivec4 const& v)\n\t/// @see uint32 packSnorm3x10_1x2(vec4 const& v)\n\t/// @see uint32 packUnorm3x10_1x2(vec4 const& v)\n\t/// @see ivec4 unpackU3x10_1x2(uint32 const& p)\n\tGLM_FUNC_DECL uint32 packU3x10_1x2(uvec4 const& v);\n\n\t/// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit unsigned integers.\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packU3x10_1x2(uvec4 const& v)\n\t/// @see vec4 unpackSnorm3x10_1x2(uint32 const& p);\n\t/// @see uvec4 unpackI3x10_1x2(uint32 const& p);\n\tGLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 p);\n\n\t/// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values.\n\t/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packSnorm3x10_1x2(xyz):\tround(clamp(c, -1, +1) * 511.0)\n\t/// packSnorm3x10_1x2(w):\tround(clamp(c, -1, +1) * 1.0)\n\t///\n\t/// The first vector component specifies the 10 least-significant bits of the result;\n\t/// the forth component specifies the 2 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec4 unpackSnorm3x10_1x2(uint32 const& p)\n\t/// @see uint32 packUnorm3x10_1x2(vec4 const& v)\n\t/// @see uint32 packU3x10_1x2(uvec4 const& v)\n\t/// @see uint32 packI3x10_1x2(ivec4 const& v)\n\tGLM_FUNC_DECL uint32 packSnorm3x10_1x2(vec4 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm3x10_1x2(xyz): clamp(f / 511.0, -1, +1)\n\t/// unpackSnorm3x10_1x2(w): clamp(f / 511.0, -1, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packSnorm3x10_1x2(vec4 const& v)\n\t/// @see vec4 unpackUnorm3x10_1x2(uint32 const& p))\n\t/// @see uvec4 unpackI3x10_1x2(uint32 const& p)\n\t/// @see uvec4 unpackU3x10_1x2(uint32 const& p)\n\tGLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 p);\n\n\t/// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values.\n\t/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The conversion for component c of v to fixed point is done as follows:\n\t/// packUnorm3x10_1x2(xyz):\tround(clamp(c, 0, +1) * 1023.0)\n\t/// packUnorm3x10_1x2(w):\tround(clamp(c, 0, +1) * 3.0)\n\t///\n\t/// The first vector component specifies the 10 least-significant bits of the result;\n\t/// the forth component specifies the 2 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec4 unpackUnorm3x10_1x2(uint32 const& p)\n\t/// @see uint32 packUnorm3x10_1x2(vec4 const& v)\n\t/// @see uint32 packU3x10_1x2(uvec4 const& v)\n\t/// @see uint32 packI3x10_1x2(ivec4 const& v)\n\tGLM_FUNC_DECL uint32 packUnorm3x10_1x2(vec4 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.\n\t///\n\t/// The conversion for unpacked fixed-point value f to floating point is done as follows:\n\t/// unpackSnorm3x10_1x2(xyz): clamp(f / 1023.0, 0, +1)\n\t/// unpackSnorm3x10_1x2(w): clamp(f / 3.0, 0, +1)\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packSnorm3x10_1x2(vec4 const& v)\n\t/// @see vec4 unpackInorm3x10_1x2(uint32 const& p))\n\t/// @see uvec4 unpackI3x10_1x2(uint32 const& p)\n\t/// @see uvec4 unpackU3x10_1x2(uint32 const& p)\n\tGLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 p);\n\n\t/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.\n\t/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The first vector component specifies the 11 least-significant bits of the result;\n\t/// the last component specifies the 10 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec3 unpackF2x11_1x10(uint32 const& p)\n\tGLM_FUNC_DECL uint32 packF2x11_1x10(vec3 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packF2x11_1x10(vec3 const& v)\n\tGLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p);\n\n\n\t/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.\n\t/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.\n\t/// Then, the results are packed into the returned 32-bit unsigned integer.\n\t///\n\t/// The first vector component specifies the 11 least-significant bits of the result;\n\t/// the last component specifies the 10 most-significant bits.\n\t///\n\t/// packF3x9_E1x5 allows encoding into RGBE / RGB9E5 format\n\t///\n\t/// @see gtc_packing\n\t/// @see vec3 unpackF3x9_E1x5(uint32 const& p)\n\tGLM_FUNC_DECL uint32 packF3x9_E1x5(vec3 const& v);\n\n\t/// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .\n\t/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.\n\t///\n\t/// The first component of the returned vector will be extracted from the least significant bits of the input;\n\t/// the last component will be extracted from the most significant bits.\n\t///\n\t/// unpackF3x9_E1x5 allows decoding RGBE / RGB9E5 data\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packF3x9_E1x5(vec3 const& v)\n\tGLM_FUNC_DECL vec3 unpackF3x9_E1x5(uint32 p);\n\n\t/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification.\n\t/// The first vector component specifies the 16 least-significant bits of the result;\n\t/// the forth component specifies the 16 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& p)\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> packRGBM(vec<3, T, Q> const& rgb);\n\n\t/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.\n\t/// The first component of the vector is obtained from the 16 least-significant bits of v;\n\t/// the forth component is obtained from the 16 most-significant bits of v.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec<4, T, Q> packRGBM(vec<3, float, Q> const& v)\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm);\n\n\t/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector\n\t/// to the 16-bit floating-point representation found in the OpenGL Specification.\n\t/// The first vector component specifies the 16 least-significant bits of the result;\n\t/// the forth component specifies the 16 most-significant bits.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec unpackHalf(vec const& p)\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\ttemplate\n\tGLM_FUNC_DECL vec packHalf(vec const& v);\n\n\t/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.\n\t/// The first component of the vector is obtained from the 16 least-significant bits of v;\n\t/// the forth component is obtained from the 16 most-significant bits of v.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec packHalf(vec const& v)\n\t/// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions\n\ttemplate\n\tGLM_FUNC_DECL vec unpackHalf(vec const& p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec unpackUnorm(vec const& p);\n\ttemplate\n\tGLM_FUNC_DECL vec packUnorm(vec const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec packUnorm(vec const& v)\n\ttemplate\n\tGLM_FUNC_DECL vec unpackUnorm(vec const& v);\n\n\t/// Convert each component of the normalized floating-point vector into signed integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec unpackSnorm(vec const& p);\n\ttemplate\n\tGLM_FUNC_DECL vec packSnorm(vec const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec packSnorm(vec const& v)\n\ttemplate\n\tGLM_FUNC_DECL vec unpackSnorm(vec const& v);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec2 unpackUnorm2x4(uint8 p)\n\tGLM_FUNC_DECL uint8 packUnorm2x4(vec2 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint8 packUnorm2x4(vec2 const& v)\n\tGLM_FUNC_DECL vec2 unpackUnorm2x4(uint8 p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec4 unpackUnorm4x4(uint16 p)\n\tGLM_FUNC_DECL uint16 packUnorm4x4(vec4 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm4x4(vec4 const& v)\n\tGLM_FUNC_DECL vec4 unpackUnorm4x4(uint16 p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec3 unpackUnorm1x5_1x6_1x5(uint16 p)\n\tGLM_FUNC_DECL uint16 packUnorm1x5_1x6_1x5(vec3 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm1x5_1x6_1x5(vec3 const& v)\n\tGLM_FUNC_DECL vec3 unpackUnorm1x5_1x6_1x5(uint16 p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec4 unpackUnorm3x5_1x1(uint16 p)\n\tGLM_FUNC_DECL uint16 packUnorm3x5_1x1(vec4 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packUnorm3x5_1x1(vec4 const& v)\n\tGLM_FUNC_DECL vec4 unpackUnorm3x5_1x1(uint16 p);\n\n\t/// Convert each component of the normalized floating-point vector into unsigned integer values.\n\t///\n\t/// @see gtc_packing\n\t/// @see vec3 unpackUnorm2x3_1x2(uint8 p)\n\tGLM_FUNC_DECL uint8 packUnorm2x3_1x2(vec3 const& v);\n\n\t/// Convert a packed integer to a normalized floating-point vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint8 packUnorm2x3_1x2(vec3 const& v)\n\tGLM_FUNC_DECL vec3 unpackUnorm2x3_1x2(uint8 p);\n\n\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i8vec2 unpackInt2x8(int16 p)\n\tGLM_FUNC_DECL int16 packInt2x8(i8vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int16 packInt2x8(i8vec2 const& v)\n\tGLM_FUNC_DECL i8vec2 unpackInt2x8(int16 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u8vec2 unpackInt2x8(uint16 p)\n\tGLM_FUNC_DECL uint16 packUint2x8(u8vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint16 packInt2x8(u8vec2 const& v)\n\tGLM_FUNC_DECL u8vec2 unpackUint2x8(uint16 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i8vec4 unpackInt4x8(int32 p)\n\tGLM_FUNC_DECL int32 packInt4x8(i8vec4 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int32 packInt2x8(i8vec4 const& v)\n\tGLM_FUNC_DECL i8vec4 unpackInt4x8(int32 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u8vec4 unpackUint4x8(uint32 p)\n\tGLM_FUNC_DECL uint32 packUint4x8(u8vec4 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint32 packUint4x8(u8vec2 const& v)\n\tGLM_FUNC_DECL u8vec4 unpackUint4x8(uint32 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i16vec2 unpackInt2x16(int p)\n\tGLM_FUNC_DECL int packInt2x16(i16vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int packInt2x16(i16vec2 const& v)\n\tGLM_FUNC_DECL i16vec2 unpackInt2x16(int p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i16vec4 unpackInt4x16(int64 p)\n\tGLM_FUNC_DECL int64 packInt4x16(i16vec4 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int64 packInt4x16(i16vec4 const& v)\n\tGLM_FUNC_DECL i16vec4 unpackInt4x16(int64 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u16vec2 unpackUint2x16(uint p)\n\tGLM_FUNC_DECL uint packUint2x16(u16vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint packUint2x16(u16vec2 const& v)\n\tGLM_FUNC_DECL u16vec2 unpackUint2x16(uint p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u16vec4 unpackUint4x16(uint64 p)\n\tGLM_FUNC_DECL uint64 packUint4x16(u16vec4 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see uint64 packUint4x16(u16vec4 const& v)\n\tGLM_FUNC_DECL u16vec4 unpackUint4x16(uint64 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see i32vec2 unpackInt2x32(int p)\n\tGLM_FUNC_DECL int64 packInt2x32(i32vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int packInt2x16(i32vec2 const& v)\n\tGLM_FUNC_DECL i32vec2 unpackInt2x32(int64 p);\n\n\t/// Convert each component from an integer vector into a packed unsigned integer.\n\t///\n\t/// @see gtc_packing\n\t/// @see u32vec2 unpackUint2x32(int p)\n\tGLM_FUNC_DECL uint64 packUint2x32(u32vec2 const& v);\n\n\t/// Convert a packed integer into an integer vector.\n\t///\n\t/// @see gtc_packing\n\t/// @see int packUint2x16(u32vec2 const& v)\n\tGLM_FUNC_DECL u32vec2 unpackUint2x32(uint64 p);\n\n\n\t/// @}\n}// namespace glm\n\n#include \"packing.inl\"\n"}, {"path": "includes/glm/gtc/quaternion.hpp", "language": "code", "loc": 153, "comment_density": 0.614, "code": "/// @ref gtc_quaternion\n/// @file glm/gtc/quaternion.hpp\n///\n/// @see core (dependence)\n/// @see gtc_constants (dependence)\n///\n/// @defgroup gtc_quaternion GLM_GTC_quaternion\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines a templated quaternion type and several quaternion operations.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/constants.hpp\"\n#include \"../gtc/matrix_transform.hpp\"\n#include \"../ext/vector_relational.hpp\"\n#include \"../ext/quaternion_common.hpp\"\n#include \"../ext/quaternion_float.hpp\"\n#include \"../ext/quaternion_float_precision.hpp\"\n#include \"../ext/quaternion_double.hpp\"\n#include \"../ext/quaternion_double_precision.hpp\"\n#include \"../ext/quaternion_relational.hpp\"\n#include \"../ext/quaternion_geometric.hpp\"\n#include \"../ext/quaternion_trigonometric.hpp\"\n#include \"../ext/quaternion_transform.hpp\"\n#include \"../detail/type_mat3x3.hpp\"\n#include \"../detail/type_mat4x4.hpp\"\n#include \"../detail/type_vec3.hpp\"\n#include \"../detail/type_vec4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_quaternion extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_quaternion\n\t/// @{\n\n\t/// Returns euler angles, pitch as x, yaw as y, roll as z.\n\t/// The result is expressed in radians.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> eulerAngles(qua const& x);\n\n\t/// Returns roll value of euler angles expressed in radians.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T roll(qua const& x);\n\n\t/// Returns pitch value of euler angles expressed in radians.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T pitch(qua const& x);\n\n\t/// Returns yaw value of euler angles expressed in radians.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T yaw(qua const& x);\n\n\t/// Converts a quaternion to a 3 * 3 matrix.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> mat3_cast(qua const& x);\n\n\t/// Converts a quaternion to a 4 * 4 matrix.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> mat4_cast(qua const& x);\n\n\t/// Converts a pure rotation 3 * 3 matrix to a quaternion.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua quat_cast(mat<3, 3, T, Q> const& x);\n\n\t/// Converts a pure rotation 4 * 4 matrix to a quaternion.\n\t///\n\t/// @tparam T Floating-point scalar types.\n\t///\n\t/// @see gtc_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua quat_cast(mat<4, 4, T, Q> const& x);\n\n\t/// Returns the component-wise comparison result of x < y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_relational\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> lessThan(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of result x <= y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_relational\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> lessThanEqual(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of result x > y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_relational\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> greaterThan(qua const& x, qua const& y);\n\n\t/// Returns the component-wise comparison of result x >= y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_quaternion_relational\n\ttemplate\n\tGLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(qua const& x, qua const& y);\n\n\t/// Build a look at quaternion based on the default handedness.\n\t///\n\t/// @param direction Desired forward direction. Needs to be normalized.\n\t/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).\n\ttemplate\n\tGLM_FUNC_DECL qua quatLookAt(\n\t\tvec<3, T, Q> const& direction,\n\t\tvec<3, T, Q> const& up);\n\n\t/// Build a right-handed look at quaternion.\n\t///\n\t/// @param direction Desired forward direction onto which the -z-axis gets mapped. Needs to be normalized.\n\t/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).\n\ttemplate\n\tGLM_FUNC_DECL qua quatLookAtRH(\n\t\tvec<3, T, Q> const& direction,\n\t\tvec<3, T, Q> const& up);\n\n\t/// Build a left-handed look at quaternion.\n\t///\n\t/// @param direction Desired forward direction onto which the +z-axis gets mapped. Needs to be normalized.\n\t/// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).\n\ttemplate\n\tGLM_FUNC_DECL qua quatLookAtLH(\n\t\tvec<3, T, Q> const& direction,\n\t\tvec<3, T, Q> const& up);\n\t/// @}\n} //namespace glm\n\n#include \"quaternion.inl\"\n"}, {"path": "includes/glm/gtc/random.hpp", "language": "code", "loc": 69, "comment_density": 0.652, "code": "/// @ref gtc_random\n/// @file glm/gtc/random.hpp\n///\n/// @see core (dependence)\n/// @see gtx_random (extended)\n///\n/// @defgroup gtc_random GLM_GTC_random\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Generate random number from various distribution methods.\n\n#pragma once\n\n// Dependency:\n#include \"../ext/scalar_int_sized.hpp\"\n#include \"../ext/scalar_uint_sized.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_random extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_random\n\t/// @{\n\n\t/// Generate random numbers in the interval [Min, Max], according a linear distribution\n\t///\n\t/// @param Min Minimum value included in the sampling\n\t/// @param Max Maximum value included in the sampling\n\t/// @tparam genType Value type. Currently supported: float or double scalars.\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL genType linearRand(genType Min, genType Max);\n\n\t/// Generate random numbers in the interval [Min, Max], according a linear distribution\n\t///\n\t/// @param Min Minimum value included in the sampling\n\t/// @param Max Maximum value included in the sampling\n\t/// @tparam T Value type. Currently supported: float or double.\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec linearRand(vec const& Min, vec const& Max);\n\n\t/// Generate random numbers in the interval [Min, Max], according a gaussian distribution\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL genType gaussRand(genType Mean, genType Deviation);\n\n\t/// Generate a random 2D vector which coordinates are regularly distributed on a circle of a given radius\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, defaultp> circularRand(T Radius);\n\n\t/// Generate a random 3D vector which coordinates are regularly distributed on a sphere of a given radius\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, defaultp> sphericalRand(T Radius);\n\n\t/// Generate a random 2D vector which coordinates are regularly distributed within the area of a disk of a given radius\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, defaultp> diskRand(T Radius);\n\n\t/// Generate a random 3D vector which coordinates are regularly distributed within the volume of a ball of a given radius\n\t///\n\t/// @see gtc_random\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, defaultp> ballRand(T Radius);\n\n\t/// @}\n}//namespace glm\n\n#include \"random.inl\"\n"}, {"path": "includes/glm/gtc/reciprocal.hpp", "language": "code", "loc": 117, "comment_density": 0.726, "code": "/// @ref gtc_reciprocal\n/// @file glm/gtc/reciprocal.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_reciprocal GLM_GTC_reciprocal\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Define secant, cosecant and cotangent functions.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_reciprocal extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_reciprocal\n\t/// @{\n\n\t/// Secant function.\n\t/// hypotenuse / adjacent or 1 / cos(x)\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType sec(genType angle);\n\n\t/// Cosecant function.\n\t/// hypotenuse / opposite or 1 / sin(x)\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType csc(genType angle);\n\n\t/// Cotangent function.\n\t/// adjacent / opposite or 1 / tan(x)\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType cot(genType angle);\n\n\t/// Inverse secant function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType asec(genType x);\n\n\t/// Inverse cosecant function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType acsc(genType x);\n\n\t/// Inverse cotangent function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType acot(genType x);\n\n\t/// Secant hyperbolic function.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType sech(genType angle);\n\n\t/// Cosecant hyperbolic function.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType csch(genType angle);\n\n\t/// Cotangent hyperbolic function.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType coth(genType angle);\n\n\t/// Inverse secant hyperbolic function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType asech(genType x);\n\n\t/// Inverse cosecant hyperbolic function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType acsch(genType x);\n\n\t/// Inverse cotangent hyperbolic function.\n\t///\n\t/// @return Return an angle expressed in radians.\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtc_reciprocal\n\ttemplate\n\tGLM_FUNC_DECL genType acoth(genType x);\n\n\t/// @}\n}//namespace glm\n\n#include \"reciprocal.inl\"\n"}, {"path": "includes/glm/gtc/round.hpp", "language": "code", "loc": 179, "comment_density": 0.737, "code": "/// @ref gtc_round\n/// @file glm/gtc/round.hpp\n///\n/// @see core (dependence)\n/// @see gtc_round (dependence)\n///\n/// @defgroup gtc_round GLM_GTC_round\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Rounding value to specific boundings\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../detail/_vectorize.hpp\"\n#include \"../vector_relational.hpp\"\n#include \"../common.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_integer extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_round\n\t/// @{\n\n\t/// Return true if the value is a power of two number.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL bool isPowerOfTwo(genIUType v);\n\n\t/// Return true if the value is a power of two number.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec isPowerOfTwo(vec const& v);\n\n\t/// Return the power of two number which value is just higher the input value,\n\t/// round up to a power of two.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genIUType ceilPowerOfTwo(genIUType v);\n\n\t/// Return the power of two number which value is just higher the input value,\n\t/// round up to a power of two.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec ceilPowerOfTwo(vec const& v);\n\n\t/// Return the power of two number which value is just lower the input value,\n\t/// round down to a power of two.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genIUType floorPowerOfTwo(genIUType v);\n\n\t/// Return the power of two number which value is just lower the input value,\n\t/// round down to a power of two.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec floorPowerOfTwo(vec const& v);\n\n\t/// Return the power of two number which value is the closet to the input value.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genIUType roundPowerOfTwo(genIUType v);\n\n\t/// Return the power of two number which value is the closet to the input value.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec roundPowerOfTwo(vec const& v);\n\n\t/// Return true if the 'Value' is a multiple of 'Multiple'.\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL bool isMultiple(genIUType v, genIUType Multiple);\n\n\t/// Return true if the 'Value' is a multiple of 'Multiple'.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec isMultiple(vec const& v, T Multiple);\n\n\t/// Return true if the 'Value' is a multiple of 'Multiple'.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec isMultiple(vec const& v, vec const& Multiple);\n\n\t/// Higher multiple number of Source.\n\t///\n\t/// @tparam genType Floating-point or integer scalar or vector types.\n\t///\n\t/// @param v Source value to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genType ceilMultiple(genType v, genType Multiple);\n\n\t/// Higher multiple number of Source.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @param v Source values to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec ceilMultiple(vec const& v, vec const& Multiple);\n\n\t/// Lower multiple number of Source.\n\t///\n\t/// @tparam genType Floating-point or integer scalar or vector types.\n\t///\n\t/// @param v Source value to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genType floorMultiple(genType v, genType Multiple);\n\n\t/// Lower multiple number of Source.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @param v Source values to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec floorMultiple(vec const& v, vec const& Multiple);\n\n\t/// Lower multiple number of Source.\n\t///\n\t/// @tparam genType Floating-point or integer scalar or vector types.\n\t///\n\t/// @param v Source value to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL genType roundMultiple(genType v, genType Multiple);\n\n\t/// Lower multiple number of Source.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @param v Source values to which is applied the function\n\t/// @param Multiple Must be a null or positive value\n\t///\n\t/// @see gtc_round\n\ttemplate\n\tGLM_FUNC_DECL vec roundMultiple(vec const& v, vec const& Multiple);\n\n\t/// @}\n} //namespace glm\n\n#include \"round.inl\"\n"}, {"path": "includes/glm/gtc/type_aligned.hpp", "language": "code", "loc": 931, "comment_density": 0.424, "code": "/// @ref gtc_type_aligned\n/// @file glm/gtc/type_aligned.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_type_aligned GLM_GTC_type_aligned\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Aligned types allowing SIMD optimizations of vectors and matrices types\n\n#pragma once\n\n#if (GLM_CONFIG_ALIGNED_GENTYPES == GLM_DISABLE)\n#\terror \"GLM: Aligned gentypes require to enable C++ language extensions. Define GLM_FORCE_ALIGNED_GENTYPES before including GLM headers to use aligned types.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n# pragma message(\"GLM: GLM_GTC_type_aligned extension included\")\n#endif\n\n#include \"../mat4x4.hpp\"\n#include \"../mat4x3.hpp\"\n#include \"../mat4x2.hpp\"\n#include \"../mat3x4.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat3x2.hpp\"\n#include \"../mat2x4.hpp\"\n#include \"../mat2x3.hpp\"\n#include \"../mat2x2.hpp\"\n#include \"../gtc/vec1.hpp\"\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup gtc_type_aligned\n\t/// @{\n\n\t// -- *vec1 --\n\n\t/// 1 component vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, aligned_highp>\taligned_highp_vec1;\n\n\t/// 1 component vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, aligned_mediump>\taligned_mediump_vec1;\n\n\t/// 1 component vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, aligned_lowp>\t\taligned_lowp_vec1;\n\n\t/// 1 component vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, aligned_highp>\taligned_highp_dvec1;\n\n\t/// 1 component vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, aligned_mediump>\taligned_mediump_dvec1;\n\n\t/// 1 component vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, aligned_lowp>\taligned_lowp_dvec1;\n\n\t/// 1 component vector aligned in memory of signed integer numbers.\n\ttypedef vec<1, int, aligned_highp>\t\taligned_highp_ivec1;\n\n\t/// 1 component vector aligned in memory of signed integer numbers.\n\ttypedef vec<1, int, aligned_mediump>\taligned_mediump_ivec1;\n\n\t/// 1 component vector aligned in memory of signed integer numbers.\n\ttypedef vec<1, int, aligned_lowp>\t\taligned_lowp_ivec1;\n\n\t/// 1 component vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, aligned_highp>\t\taligned_highp_uvec1;\n\n\t/// 1 component vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, aligned_mediump>\taligned_mediump_uvec1;\n\n\t/// 1 component vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, aligned_lowp>\t\taligned_lowp_uvec1;\n\n\t/// 1 component vector aligned in memory of bool values.\n\ttypedef vec<1, bool, aligned_highp>\t\taligned_highp_bvec1;\n\n\t/// 1 component vector aligned in memory of bool values.\n\ttypedef vec<1, bool, aligned_mediump>\taligned_mediump_bvec1;\n\n\t/// 1 component vector aligned in memory of bool values.\n\ttypedef vec<1, bool, aligned_lowp>\t\taligned_lowp_bvec1;\n\n\t/// 1 component vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, packed_highp>\t\tpacked_highp_vec1;\n\n\t/// 1 component vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, packed_mediump>\tpacked_mediump_vec1;\n\n\t/// 1 component vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, float, packed_lowp>\t\tpacked_lowp_vec1;\n\n\t/// 1 component vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, packed_highp>\tpacked_highp_dvec1;\n\n\t/// 1 component vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, packed_mediump>\tpacked_mediump_dvec1;\n\n\t/// 1 component vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<1, double, packed_lowp>\t\tpacked_lowp_dvec1;\n\n\t/// 1 component vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<1, int, packed_highp>\t\tpacked_highp_ivec1;\n\n\t/// 1 component vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<1, int, packed_mediump>\t\tpacked_mediump_ivec1;\n\n\t/// 1 component vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<1, int, packed_lowp>\t\tpacked_lowp_ivec1;\n\n\t/// 1 component vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, packed_highp>\t\tpacked_highp_uvec1;\n\n\t/// 1 component vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, packed_mediump>\tpacked_mediump_uvec1;\n\n\t/// 1 component vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<1, uint, packed_lowp>\t\tpacked_lowp_uvec1;\n\n\t/// 1 component vector tightly packed in memory of bool values.\n\ttypedef vec<1, bool, packed_highp>\t\tpacked_highp_bvec1;\n\n\t/// 1 component vector tightly packed in memory of bool values.\n\ttypedef vec<1, bool, packed_mediump>\tpacked_mediump_bvec1;\n\n\t/// 1 component vector tightly packed in memory of bool values.\n\ttypedef vec<1, bool, packed_lowp>\t\tpacked_lowp_bvec1;\n\n\t// -- *vec2 --\n\n\t/// 2 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, aligned_highp>\taligned_highp_vec2;\n\n\t/// 2 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, aligned_mediump>\taligned_mediump_vec2;\n\n\t/// 2 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, aligned_lowp>\t\taligned_lowp_vec2;\n\n\t/// 2 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, aligned_highp>\taligned_highp_dvec2;\n\n\t/// 2 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, aligned_mediump>\taligned_mediump_dvec2;\n\n\t/// 2 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, aligned_lowp>\taligned_lowp_dvec2;\n\n\t/// 2 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<2, int, aligned_highp>\t\taligned_highp_ivec2;\n\n\t/// 2 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<2, int, aligned_mediump>\taligned_mediump_ivec2;\n\n\t/// 2 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<2, int, aligned_lowp>\t\taligned_lowp_ivec2;\n\n\t/// 2 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, aligned_highp>\t\taligned_highp_uvec2;\n\n\t/// 2 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, aligned_mediump>\taligned_mediump_uvec2;\n\n\t/// 2 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, aligned_lowp>\t\taligned_lowp_uvec2;\n\n\t/// 2 components vector aligned in memory of bool values.\n\ttypedef vec<2, bool, aligned_highp>\t\taligned_highp_bvec2;\n\n\t/// 2 components vector aligned in memory of bool values.\n\ttypedef vec<2, bool, aligned_mediump>\taligned_mediump_bvec2;\n\n\t/// 2 components vector aligned in memory of bool values.\n\ttypedef vec<2, bool, aligned_lowp>\t\taligned_lowp_bvec2;\n\n\t/// 2 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, packed_highp>\t\tpacked_highp_vec2;\n\n\t/// 2 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, packed_mediump>\tpacked_mediump_vec2;\n\n\t/// 2 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<2, float, packed_lowp>\t\tpacked_lowp_vec2;\n\n\t/// 2 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, packed_highp>\tpacked_highp_dvec2;\n\n\t/// 2 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, packed_mediump>\tpacked_mediump_dvec2;\n\n\t/// 2 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<2, double, packed_lowp>\t\tpacked_lowp_dvec2;\n\n\t/// 2 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<2, int, packed_highp>\t\tpacked_highp_ivec2;\n\n\t/// 2 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<2, int, packed_mediump>\t\tpacked_mediump_ivec2;\n\n\t/// 2 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<2, int, packed_lowp>\t\tpacked_lowp_ivec2;\n\n\t/// 2 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, packed_highp>\t\tpacked_highp_uvec2;\n\n\t/// 2 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, packed_mediump>\tpacked_mediump_uvec2;\n\n\t/// 2 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<2, uint, packed_lowp>\t\tpacked_lowp_uvec2;\n\n\t/// 2 components vector tightly packed in memory of bool values.\n\ttypedef vec<2, bool, packed_highp>\t\tpacked_highp_bvec2;\n\n\t/// 2 components vector tightly packed in memory of bool values.\n\ttypedef vec<2, bool, packed_mediump>\tpacked_mediump_bvec2;\n\n\t/// 2 components vector tightly packed in memory of bool values.\n\ttypedef vec<2, bool, packed_lowp>\t\tpacked_lowp_bvec2;\n\n\t// -- *vec3 --\n\n\t/// 3 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, aligned_highp>\taligned_highp_vec3;\n\n\t/// 3 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, aligned_mediump>\taligned_mediump_vec3;\n\n\t/// 3 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, aligned_lowp>\t\taligned_lowp_vec3;\n\n\t/// 3 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, aligned_highp>\taligned_highp_dvec3;\n\n\t/// 3 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, aligned_mediump>\taligned_mediump_dvec3;\n\n\t/// 3 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, aligned_lowp>\taligned_lowp_dvec3;\n\n\t/// 3 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<3, int, aligned_highp>\t\taligned_highp_ivec3;\n\n\t/// 3 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<3, int, aligned_mediump>\taligned_mediump_ivec3;\n\n\t/// 3 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<3, int, aligned_lowp>\t\taligned_lowp_ivec3;\n\n\t/// 3 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, aligned_highp>\t\taligned_highp_uvec3;\n\n\t/// 3 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, aligned_mediump>\taligned_mediump_uvec3;\n\n\t/// 3 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, aligned_lowp>\t\taligned_lowp_uvec3;\n\n\t/// 3 components vector aligned in memory of bool values.\n\ttypedef vec<3, bool, aligned_highp>\t\taligned_highp_bvec3;\n\n\t/// 3 components vector aligned in memory of bool values.\n\ttypedef vec<3, bool, aligned_mediump>\taligned_mediump_bvec3;\n\n\t/// 3 components vector aligned in memory of bool values.\n\ttypedef vec<3, bool, aligned_lowp>\t\taligned_lowp_bvec3;\n\n\t/// 3 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, packed_highp>\t\tpacked_highp_vec3;\n\n\t/// 3 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, packed_mediump>\tpacked_mediump_vec3;\n\n\t/// 3 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<3, float, packed_lowp>\t\tpacked_lowp_vec3;\n\n\t/// 3 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, packed_highp>\tpacked_highp_dvec3;\n\n\t/// 3 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, packed_mediump>\tpacked_mediump_dvec3;\n\n\t/// 3 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<3, double, packed_lowp>\t\tpacked_lowp_dvec3;\n\n\t/// 3 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<3, int, packed_highp>\t\tpacked_highp_ivec3;\n\n\t/// 3 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<3, int, packed_mediump>\t\tpacked_mediump_ivec3;\n\n\t/// 3 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<3, int, packed_lowp>\t\tpacked_lowp_ivec3;\n\n\t/// 3 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, packed_highp>\t\tpacked_highp_uvec3;\n\n\t/// 3 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, packed_mediump>\tpacked_mediump_uvec3;\n\n\t/// 3 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<3, uint, packed_lowp>\t\tpacked_lowp_uvec3;\n\n\t/// 3 components vector tightly packed in memory of bool values.\n\ttypedef vec<3, bool, packed_highp>\t\tpacked_highp_bvec3;\n\n\t/// 3 components vector tightly packed in memory of bool values.\n\ttypedef vec<3, bool, packed_mediump>\tpacked_mediump_bvec3;\n\n\t/// 3 components vector tightly packed in memory of bool values.\n\ttypedef vec<3, bool, packed_lowp>\t\tpacked_lowp_bvec3;\n\n\t// -- *vec4 --\n\n\t/// 4 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, aligned_highp>\taligned_highp_vec4;\n\n\t/// 4 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, aligned_mediump>\taligned_mediump_vec4;\n\n\t/// 4 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, aligned_lowp>\t\taligned_lowp_vec4;\n\n\t/// 4 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, aligned_highp>\taligned_highp_dvec4;\n\n\t/// 4 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, aligned_mediump>\taligned_mediump_dvec4;\n\n\t/// 4 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, aligned_lowp>\taligned_lowp_dvec4;\n\n\t/// 4 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<4, int, aligned_highp>\t\taligned_highp_ivec4;\n\n\t/// 4 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<4, int, aligned_mediump>\taligned_mediump_ivec4;\n\n\t/// 4 components vector aligned in memory of signed integer numbers.\n\ttypedef vec<4, int, aligned_lowp>\t\taligned_lowp_ivec4;\n\n\t/// 4 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, aligned_highp>\t\taligned_highp_uvec4;\n\n\t/// 4 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, aligned_mediump>\taligned_mediump_uvec4;\n\n\t/// 4 components vector aligned in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, aligned_lowp>\t\taligned_lowp_uvec4;\n\n\t/// 4 components vector aligned in memory of bool values.\n\ttypedef vec<4, bool, aligned_highp>\t\taligned_highp_bvec4;\n\n\t/// 4 components vector aligned in memory of bool values.\n\ttypedef vec<4, bool, aligned_mediump>\taligned_mediump_bvec4;\n\n\t/// 4 components vector aligned in memory of bool values.\n\ttypedef vec<4, bool, aligned_lowp>\t\taligned_lowp_bvec4;\n\n\t/// 4 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, packed_highp>\t\tpacked_highp_vec4;\n\n\t/// 4 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, packed_mediump>\tpacked_mediump_vec4;\n\n\t/// 4 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<4, float, packed_lowp>\t\tpacked_lowp_vec4;\n\n\t/// 4 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, packed_highp>\tpacked_highp_dvec4;\n\n\t/// 4 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, packed_mediump>\tpacked_mediump_dvec4;\n\n\t/// 4 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef vec<4, double, packed_lowp>\t\tpacked_lowp_dvec4;\n\n\t/// 4 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<4, int, packed_highp>\t\tpacked_highp_ivec4;\n\n\t/// 4 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<4, int, packed_mediump>\t\tpacked_mediump_ivec4;\n\n\t/// 4 components vector tightly packed in memory of signed integer numbers.\n\ttypedef vec<4, int, packed_lowp>\t\tpacked_lowp_ivec4;\n\n\t/// 4 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, packed_highp>\t\tpacked_highp_uvec4;\n\n\t/// 4 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, packed_mediump>\tpacked_mediump_uvec4;\n\n\t/// 4 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef vec<4, uint, packed_lowp>\t\tpacked_lowp_uvec4;\n\n\t/// 4 components vector tightly packed in memory of bool values.\n\ttypedef vec<4, bool, packed_highp>\t\tpacked_highp_bvec4;\n\n\t/// 4 components vector tightly packed in memory of bool values.\n\ttypedef vec<4, bool, packed_mediump>\tpacked_mediump_bvec4;\n\n\t/// 4 components vector tightly packed in memory of bool values.\n\ttypedef vec<4, bool, packed_lowp>\t\tpacked_lowp_bvec4;\n\n\t// -- *mat2 --\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_highp>\t\taligned_highp_mat2;\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_mediump>\taligned_mediump_mat2;\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_lowp>\t\taligned_lowp_mat2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_highp>\taligned_highp_dmat2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_mediump>\taligned_mediump_dmat2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_lowp>\t\taligned_lowp_dmat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_highp>\t\tpacked_highp_mat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_mediump>\tpacked_mediump_mat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_lowp>\t\tpacked_lowp_mat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_highp>\t\tpacked_highp_dmat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_mediump>\tpacked_mediump_dmat2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_lowp>\t\tpacked_lowp_dmat2;\n\n\t// -- *mat3 --\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_highp>\t\taligned_highp_mat3;\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_mediump>\taligned_mediump_mat3;\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_lowp>\t\taligned_lowp_mat3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_highp>\taligned_highp_dmat3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_mediump>\taligned_mediump_dmat3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_lowp>\t\taligned_lowp_dmat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_highp>\t\tpacked_highp_mat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_mediump>\tpacked_mediump_mat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_lowp>\t\tpacked_lowp_mat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_highp>\t\tpacked_highp_dmat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_mediump>\tpacked_mediump_dmat3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_lowp>\t\tpacked_lowp_dmat3;\n\n\t// -- *mat4 --\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_highp>\t\taligned_highp_mat4;\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_mediump>\taligned_mediump_mat4;\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_lowp>\t\taligned_lowp_mat4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_highp>\taligned_highp_dmat4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_mediump>\taligned_mediump_dmat4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_lowp>\t\taligned_lowp_dmat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_highp>\t\tpacked_highp_mat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_mediump>\tpacked_mediump_mat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_lowp>\t\tpacked_lowp_mat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_highp>\t\tpacked_highp_dmat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_mediump>\tpacked_mediump_dmat4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_lowp>\t\tpacked_lowp_dmat4;\n\n\t// -- *mat2x2 --\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_highp>\t\taligned_highp_mat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_mediump>\taligned_mediump_mat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, aligned_lowp>\t\taligned_lowp_mat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_highp>\taligned_highp_dmat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_mediump>\taligned_mediump_dmat2x2;\n\n\t/// 2 by 2 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, aligned_lowp>\t\taligned_lowp_dmat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_highp>\t\tpacked_highp_mat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_mediump>\tpacked_mediump_mat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, float, packed_lowp>\t\tpacked_lowp_mat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_highp>\t\tpacked_highp_dmat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_mediump>\tpacked_mediump_dmat2x2;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 2, double, packed_lowp>\t\tpacked_lowp_dmat2x2;\n\n\t// -- *mat2x3 --\n\n\t/// 2 by 3 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, aligned_highp>\t\taligned_highp_mat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, aligned_mediump>\taligned_mediump_mat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, aligned_lowp>\t\taligned_lowp_mat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, aligned_highp>\taligned_highp_dmat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, aligned_mediump>\taligned_mediump_dmat2x3;\n\n\t/// 2 by 3 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, aligned_lowp>\t\taligned_lowp_dmat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, packed_highp>\t\tpacked_highp_mat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, packed_mediump>\tpacked_mediump_mat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, float, packed_lowp>\t\tpacked_lowp_mat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, packed_highp>\t\tpacked_highp_dmat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, packed_mediump>\tpacked_mediump_dmat2x3;\n\n\t/// 2 by 3 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 3, double, packed_lowp>\t\tpacked_lowp_dmat2x3;\n\n\t// -- *mat2x4 --\n\n\t/// 2 by 4 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, aligned_highp>\t\taligned_highp_mat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, aligned_mediump>\taligned_mediump_mat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, aligned_lowp>\t\taligned_lowp_mat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, aligned_highp>\taligned_highp_dmat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, aligned_mediump>\taligned_mediump_dmat2x4;\n\n\t/// 2 by 4 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, aligned_lowp>\t\taligned_lowp_dmat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, packed_highp>\t\tpacked_highp_mat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, packed_mediump>\tpacked_mediump_mat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, float, packed_lowp>\t\tpacked_lowp_mat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, packed_highp>\t\tpacked_highp_dmat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, packed_mediump>\tpacked_mediump_dmat2x4;\n\n\t/// 2 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<2, 4, double, packed_lowp>\t\tpacked_lowp_dmat2x4;\n\n\t// -- *mat3x2 --\n\n\t/// 3 by 2 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, aligned_highp>\t\taligned_highp_mat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, aligned_mediump>\taligned_mediump_mat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, aligned_lowp>\t\taligned_lowp_mat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, aligned_highp>\taligned_highp_dmat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, aligned_mediump>\taligned_mediump_dmat3x2;\n\n\t/// 3 by 2 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, aligned_lowp>\t\taligned_lowp_dmat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, packed_highp>\t\tpacked_highp_mat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, packed_mediump>\tpacked_mediump_mat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, float, packed_lowp>\t\tpacked_lowp_mat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, packed_highp>\t\tpacked_highp_dmat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, packed_mediump>\tpacked_mediump_dmat3x2;\n\n\t/// 3 by 2 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 2, double, packed_lowp>\t\tpacked_lowp_dmat3x2;\n\n\t// -- *mat3x3 --\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_highp>\t\taligned_highp_mat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_mediump>\taligned_mediump_mat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, aligned_lowp>\t\taligned_lowp_mat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_highp>\taligned_highp_dmat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_mediump>\taligned_mediump_dmat3x3;\n\n\t/// 3 by 3 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, aligned_lowp>\t\taligned_lowp_dmat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_highp>\t\tpacked_highp_mat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_mediump>\tpacked_mediump_mat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, float, packed_lowp>\t\tpacked_lowp_mat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_highp>\t\tpacked_highp_dmat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_mediump>\tpacked_mediump_dmat3x3;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 3, double, packed_lowp>\t\tpacked_lowp_dmat3x3;\n\n\t// -- *mat3x4 --\n\n\t/// 3 by 4 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, aligned_highp>\t\taligned_highp_mat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, aligned_mediump>\taligned_mediump_mat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, aligned_lowp>\t\taligned_lowp_mat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, aligned_highp>\taligned_highp_dmat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, aligned_mediump>\taligned_mediump_dmat3x4;\n\n\t/// 3 by 4 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, aligned_lowp>\t\taligned_lowp_dmat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, packed_highp>\t\tpacked_highp_mat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, packed_mediump>\tpacked_mediump_mat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, float, packed_lowp>\t\tpacked_lowp_mat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, packed_highp>\t\tpacked_highp_dmat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, packed_mediump>\tpacked_mediump_dmat3x4;\n\n\t/// 3 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<3, 4, double, packed_lowp>\t\tpacked_lowp_dmat3x4;\n\n\t// -- *mat4x2 --\n\n\t/// 4 by 2 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, aligned_highp>\t\taligned_highp_mat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, aligned_mediump>\taligned_mediump_mat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, aligned_lowp>\t\taligned_lowp_mat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, aligned_highp>\taligned_highp_dmat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, aligned_mediump>\taligned_mediump_dmat4x2;\n\n\t/// 4 by 2 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, aligned_lowp>\t\taligned_lowp_dmat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, packed_highp>\t\tpacked_highp_mat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, packed_mediump>\tpacked_mediump_mat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, float, packed_lowp>\t\tpacked_lowp_mat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, packed_highp>\t\tpacked_highp_dmat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, packed_mediump>\tpacked_mediump_dmat4x2;\n\n\t/// 4 by 2 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 2, double, packed_lowp>\t\tpacked_lowp_dmat4x2;\n\n\t// -- *mat4x3 --\n\n\t/// 4 by 3 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, aligned_highp>\t\taligned_highp_mat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, aligned_mediump>\taligned_mediump_mat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, aligned_lowp>\t\taligned_lowp_mat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, aligned_highp>\taligned_highp_dmat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, aligned_mediump>\taligned_mediump_dmat4x3;\n\n\t/// 4 by 3 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, aligned_lowp>\t\taligned_lowp_dmat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, packed_highp>\t\tpacked_highp_mat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, packed_mediump>\tpacked_mediump_mat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, float, packed_lowp>\t\tpacked_lowp_mat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, packed_highp>\t\tpacked_highp_dmat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, packed_mediump>\tpacked_mediump_dmat4x3;\n\n\t/// 4 by 3 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 3, double, packed_lowp>\t\tpacked_lowp_dmat4x3;\n\n\t// -- *mat4x4 --\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_highp>\t\taligned_highp_mat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_mediump>\taligned_mediump_mat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, aligned_lowp>\t\taligned_lowp_mat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_highp>\taligned_highp_dmat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_mediump>\taligned_mediump_dmat4x4;\n\n\t/// 4 by 4 matrix aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, aligned_lowp>\t\taligned_lowp_dmat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_highp>\t\tpacked_highp_mat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_mediump>\tpacked_mediump_mat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, float, packed_lowp>\t\tpacked_lowp_mat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_highp>\t\tpacked_highp_dmat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_mediump>\tpacked_mediump_dmat4x4;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.\n\ttypedef mat<4, 4, double, packed_lowp>\t\tpacked_lowp_dmat4x4;\n\n\t// -- default --\n\n#if(defined(GLM_PRECISION_LOWP_FLOAT))\n\ttypedef aligned_lowp_vec1\t\t\taligned_vec1;\n\ttypedef aligned_lowp_vec2\t\t\taligned_vec2;\n\ttypedef aligned_lowp_vec3\t\t\taligned_vec3;\n\ttypedef aligned_lowp_vec4\t\t\taligned_vec4;\n\ttypedef packed_lowp_vec1\t\t\tpacked_vec1;\n\ttypedef packed_lowp_vec2\t\t\tpacked_vec2;\n\ttypedef packed_lowp_vec3\t\t\tpacked_vec3;\n\ttypedef packed_lowp_vec4\t\t\tpacked_vec4;\n\n\ttypedef aligned_lowp_mat2\t\t\taligned_mat2;\n\ttypedef aligned_lowp_mat3\t\t\taligned_mat3;\n\ttypedef aligned_lowp_mat4\t\t\taligned_mat4;\n\ttypedef packed_lowp_mat2\t\t\tpacked_mat2;\n\ttypedef packed_lowp_mat3\t\t\tpacked_mat3;\n\ttypedef packed_lowp_mat4\t\t\tpacked_mat4;\n\n\ttypedef aligned_lowp_mat2x2\t\t\taligned_mat2x2;\n\ttypedef aligned_lowp_mat2x3\t\t\taligned_mat2x3;\n\ttypedef aligned_lowp_mat2x4\t\t\taligned_mat2x4;\n\ttypedef aligned_lowp_mat3x2\t\t\taligned_mat3x2;\n\ttypedef aligned_lowp_mat3x3\t\t\taligned_mat3x3;\n\ttypedef aligned_lowp_mat3x4\t\t\taligned_mat3x4;\n\ttypedef aligned_lowp_mat4x2\t\t\taligned_mat4x2;\n\ttypedef aligned_lowp_mat4x3\t\t\taligned_mat4x3;\n\ttypedef aligned_lowp_mat4x4\t\t\taligned_mat4x4;\n\ttypedef packed_lowp_mat2x2\t\t\tpacked_mat2x2;\n\ttypedef packed_lowp_mat2x3\t\t\tpacked_mat2x3;\n\ttypedef packed_lowp_mat2x4\t\t\tpacked_mat2x4;\n\ttypedef packed_lowp_mat3x2\t\t\tpacked_mat3x2;\n\ttypedef packed_lowp_mat3x3\t\t\tpacked_mat3x3;\n\ttypedef packed_lowp_mat3x4\t\t\tpacked_mat3x4;\n\ttypedef packed_lowp_mat4x2\t\t\tpacked_mat4x2;\n\ttypedef packed_lowp_mat4x3\t\t\tpacked_mat4x3;\n\ttypedef packed_lowp_mat4x4\t\t\tpacked_mat4x4;\n#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))\n\ttypedef aligned_mediump_vec1\t\taligned_vec1;\n\ttypedef aligned_mediump_vec2\t\taligned_vec2;\n\ttypedef aligned_mediump_vec3\t\taligned_vec3;\n\ttypedef aligned_mediump_vec4\t\taligned_vec4;\n\ttypedef packed_mediump_vec1\t\t\tpacked_vec1;\n\ttypedef packed_mediump_vec2\t\t\tpacked_vec2;\n\ttypedef packed_mediump_vec3\t\t\tpacked_vec3;\n\ttypedef packed_mediump_vec4\t\t\tpacked_vec4;\n\n\ttypedef aligned_mediump_mat2\t\taligned_mat2;\n\ttypedef aligned_mediump_mat3\t\taligned_mat3;\n\ttypedef aligned_mediump_mat4\t\taligned_mat4;\n\ttypedef packed_mediump_mat2\t\t\tpacked_mat2;\n\ttypedef packed_mediump_mat3\t\t\tpacked_mat3;\n\ttypedef packed_mediump_mat4\t\t\tpacked_mat4;\n\n\ttypedef aligned_mediump_mat2x2\t\taligned_mat2x2;\n\ttypedef aligned_mediump_mat2x3\t\taligned_mat2x3;\n\ttypedef aligned_mediump_mat2x4\t\taligned_mat2x4;\n\ttypedef aligned_mediump_mat3x2\t\taligned_mat3x2;\n\ttypedef aligned_mediump_mat3x3\t\taligned_mat3x3;\n\ttypedef aligned_mediump_mat3x4\t\taligned_mat3x4;\n\ttypedef aligned_mediump_mat4x2\t\taligned_mat4x2;\n\ttypedef aligned_mediump_mat4x3\t\taligned_mat4x3;\n\ttypedef aligned_mediump_mat4x4\t\taligned_mat4x4;\n\ttypedef packed_mediump_mat2x2\t\tpacked_mat2x2;\n\ttypedef packed_mediump_mat2x3\t\tpacked_mat2x3;\n\ttypedef packed_mediump_mat2x4\t\tpacked_mat2x4;\n\ttypedef packed_mediump_mat3x2\t\tpacked_mat3x2;\n\ttypedef packed_mediump_mat3x3\t\tpacked_mat3x3;\n\ttypedef packed_mediump_mat3x4\t\tpacked_mat3x4;\n\ttypedef packed_mediump_mat4x2\t\tpacked_mat4x2;\n\ttypedef packed_mediump_mat4x3\t\tpacked_mat4x3;\n\ttypedef packed_mediump_mat4x4\t\tpacked_mat4x4;\n#else //defined(GLM_PRECISION_HIGHP_FLOAT)\n\t/// 1 component vector aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_vec1\t\t\taligned_vec1;\n\n\t/// 2 components vector aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_vec2\t\t\taligned_vec2;\n\n\t/// 3 components vector aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_vec3\t\t\taligned_vec3;\n\n\t/// 4 components vector aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_vec4 \t\t\taligned_vec4;\n\n\t/// 1 component vector tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_vec1\t\t\tpacked_vec1;\n\n\t/// 2 components vector tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_vec2\t\t\tpacked_vec2;\n\n\t/// 3 components vector tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_vec3\t\t\tpacked_vec3;\n\n\t/// 4 components vector tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_vec4\t\t\tpacked_vec4;\n\n\t/// 2 by 2 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat2\t\t\taligned_mat2;\n\n\t/// 3 by 3 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat3\t\t\taligned_mat3;\n\n\t/// 4 by 4 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat4\t\t\taligned_mat4;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat2\t\t\tpacked_mat2;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat3\t\t\tpacked_mat3;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat4\t\t\tpacked_mat4;\n\n\t/// 2 by 2 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat2x2\t\taligned_mat2x2;\n\n\t/// 2 by 3 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat2x3\t\taligned_mat2x3;\n\n\t/// 2 by 4 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat2x4\t\taligned_mat2x4;\n\n\t/// 3 by 2 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat3x2\t\taligned_mat3x2;\n\n\t/// 3 by 3 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat3x3\t\taligned_mat3x3;\n\n\t/// 3 by 4 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat3x4\t\taligned_mat3x4;\n\n\t/// 4 by 2 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat4x2\t\taligned_mat4x2;\n\n\t/// 4 by 3 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat4x3\t\taligned_mat4x3;\n\n\t/// 4 by 4 matrix tightly aligned in memory of single-precision floating-point numbers.\n\ttypedef aligned_highp_mat4x4\t\taligned_mat4x4;\n\n\t/// 2 by 2 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat2x2\t\t\tpacked_mat2x2;\n\n\t/// 2 by 3 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat2x3\t\t\tpacked_mat2x3;\n\n\t/// 2 by 4 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat2x4\t\t\tpacked_mat2x4;\n\n\t/// 3 by 2 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat3x2\t\t\tpacked_mat3x2;\n\n\t/// 3 by 3 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat3x3\t\t\tpacked_mat3x3;\n\n\t/// 3 by 4 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat3x4\t\t\tpacked_mat3x4;\n\n\t/// 4 by 2 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat4x2\t\t\tpacked_mat4x2;\n\n\t/// 4 by 3 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat4x3\t\t\tpacked_mat4x3;\n\n\t/// 4 by 4 matrix tightly packed in memory of single-precision floating-point numbers.\n\ttypedef packed_highp_mat4x4\t\t\tpacked_mat4x4;\n#endif//GLM_PRECISION\n\n#if(defined(GLM_PRECISION_LOWP_DOUBLE))\n\ttypedef aligned_lowp_dvec1\t\t\taligned_dvec1;\n\ttypedef aligned_lowp_dvec2\t\t\taligned_dvec2;\n\ttypedef aligned_lowp_dvec3\t\t\taligned_dvec3;\n\ttypedef aligned_lowp_dvec4\t\t\taligned_dvec4;\n\ttypedef packed_lowp_dvec1\t\t\tpacked_dvec1;\n\ttypedef packed_lowp_dvec2\t\t\tpacked_dvec2;\n\ttypedef packed_lowp_dvec3\t\t\tpacked_dvec3;\n\ttypedef packed_lowp_dvec4\t\t\tpacked_dvec4;\n\n\ttypedef aligned_lowp_dmat2\t\t\taligned_dmat2;\n\ttypedef aligned_lowp_dmat3\t\t\taligned_dmat3;\n\ttypedef aligned_lowp_dmat4\t\t\taligned_dmat4;\n\ttypedef packed_lowp_dmat2\t\t\tpacked_dmat2;\n\ttypedef packed_lowp_dmat3\t\t\tpacked_dmat3;\n\ttypedef packed_lowp_dmat4\t\t\tpacked_dmat4;\n\n\ttypedef aligned_lowp_dmat2x2\t\taligned_dmat2x2;\n\ttypedef aligned_lowp_dmat2x3\t\taligned_dmat2x3;\n\ttypedef aligned_lowp_dmat2x4\t\taligned_dmat2x4;\n\ttypedef aligned_lowp_dmat3x2\t\taligned_dmat3x2;\n\ttypedef aligned_lowp_dmat3x3\t\taligned_dmat3x3;\n\ttypedef aligned_lowp_dmat3x4\t\taligned_dmat3x4;\n\ttypedef aligned_lowp_dmat4x2\t\taligned_dmat4x2;\n\ttypedef aligned_lowp_dmat4x3\t\taligned_dmat4x3;\n\ttypedef aligned_lowp_dmat4x4\t\taligned_dmat4x4;\n\ttypedef packed_lowp_dmat2x2\t\t\tpacked_dmat2x2;\n\ttypedef packed_lowp_dmat2x3\t\t\tpacked_dmat2x3;\n\ttypedef packed_lowp_dmat2x4\t\t\tpacked_dmat2x4;\n\ttypedef packed_lowp_dmat3x2\t\t\tpacked_dmat3x2;\n\ttypedef packed_lowp_dmat3x3\t\t\tpacked_dmat3x3;\n\ttypedef packed_lowp_dmat3x4\t\t\tpacked_dmat3x4;\n\ttypedef packed_lowp_dmat4x2\t\t\tpacked_dmat4x2;\n\ttypedef packed_lowp_dmat4x3\t\t\tpacked_dmat4x3;\n\ttypedef packed_lowp_dmat4x4\t\t\tpacked_dmat4x4;\n#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))\n\ttypedef aligned_mediump_dvec1\t\taligned_dvec1;\n\ttypedef aligned_mediump_dvec2\t\taligned_dvec2;\n\ttypedef aligned_mediump_dvec3\t\taligned_dvec3;\n\ttypedef aligned_mediump_dvec4\t\taligned_dvec4;\n\ttypedef packed_mediump_dvec1\t\tpacked_dvec1;\n\ttypedef packed_mediump_dvec2\t\tpacked_dvec2;\n\ttypedef packed_mediump_dvec3\t\tpacked_dvec3;\n\ttypedef packed_mediump_dvec4\t\tpacked_dvec4;\n\n\ttypedef aligned_mediump_dmat2\t\taligned_dmat2;\n\ttypedef aligned_mediump_dmat3\t\taligned_dmat3;\n\ttypedef aligned_mediump_dmat4\t\taligned_dmat4;\n\ttypedef packed_mediump_dmat2\t\tpacked_dmat2;\n\ttypedef packed_mediump_dmat3\t\tpacked_dmat3;\n\ttypedef packed_mediump_dmat4\t\tpacked_dmat4;\n\n\ttypedef aligned_mediump_dmat2x2\t\taligned_dmat2x2;\n\ttypedef aligned_mediump_dmat2x3\t\taligned_dmat2x3;\n\ttypedef aligned_mediump_dmat2x4\t\taligned_dmat2x4;\n\ttypedef aligned_mediump_dmat3x2\t\taligned_dmat3x2;\n\ttypedef aligned_mediump_dmat3x3\t\taligned_dmat3x3;\n\ttypedef aligned_mediump_dmat3x4\t\taligned_dmat3x4;\n\ttypedef aligned_mediump_dmat4x2\t\taligned_dmat4x2;\n\ttypedef aligned_mediump_dmat4x3\t\taligned_dmat4x3;\n\ttypedef aligned_mediump_dmat4x4\t\taligned_dmat4x4;\n\ttypedef packed_mediump_dmat2x2\t\tpacked_dmat2x2;\n\ttypedef packed_mediump_dmat2x3\t\tpacked_dmat2x3;\n\ttypedef packed_mediump_dmat2x4\t\tpacked_dmat2x4;\n\ttypedef packed_mediump_dmat3x2\t\tpacked_dmat3x2;\n\ttypedef packed_mediump_dmat3x3\t\tpacked_dmat3x3;\n\ttypedef packed_mediump_dmat3x4\t\tpacked_dmat3x4;\n\ttypedef packed_mediump_dmat4x2\t\tpacked_dmat4x2;\n\ttypedef packed_mediump_dmat4x3\t\tpacked_dmat4x3;\n\ttypedef packed_mediump_dmat4x4\t\tpacked_dmat4x4;\n#else //defined(GLM_PRECISION_HIGHP_DOUBLE)\n\t/// 1 component vector aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dvec1\t\t\taligned_dvec1;\n\n\t/// 2 components vector aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dvec2\t\t\taligned_dvec2;\n\n\t/// 3 components vector aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dvec3\t\t\taligned_dvec3;\n\n\t/// 4 components vector aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dvec4\t\t\taligned_dvec4;\n\n\t/// 1 component vector tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dvec1\t\t\tpacked_dvec1;\n\n\t/// 2 components vector tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dvec2\t\t\tpacked_dvec2;\n\n\t/// 3 components vector tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dvec3\t\t\tpacked_dvec3;\n\n\t/// 4 components vector tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dvec4\t\t\tpacked_dvec4;\n\n\t/// 2 by 2 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat2\t\t\taligned_dmat2;\n\n\t/// 3 by 3 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat3\t\t\taligned_dmat3;\n\n\t/// 4 by 4 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat4\t\t\taligned_dmat4;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat2\t\t\tpacked_dmat2;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat3\t\t\tpacked_dmat3;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat4\t\t\tpacked_dmat4;\n\n\t/// 2 by 2 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat2x2\t\taligned_dmat2x2;\n\n\t/// 2 by 3 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat2x3\t\taligned_dmat2x3;\n\n\t/// 2 by 4 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat2x4\t\taligned_dmat2x4;\n\n\t/// 3 by 2 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat3x2\t\taligned_dmat3x2;\n\n\t/// 3 by 3 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat3x3\t\taligned_dmat3x3;\n\n\t/// 3 by 4 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat3x4\t\taligned_dmat3x4;\n\n\t/// 4 by 2 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat4x2\t\taligned_dmat4x2;\n\n\t/// 4 by 3 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat4x3\t\taligned_dmat4x3;\n\n\t/// 4 by 4 matrix tightly aligned in memory of double-precision floating-point numbers.\n\ttypedef aligned_highp_dmat4x4\t\taligned_dmat4x4;\n\n\t/// 2 by 2 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat2x2\t\tpacked_dmat2x2;\n\n\t/// 2 by 3 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat2x3\t\tpacked_dmat2x3;\n\n\t/// 2 by 4 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat2x4\t\tpacked_dmat2x4;\n\n\t/// 3 by 2 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat3x2\t\tpacked_dmat3x2;\n\n\t/// 3 by 3 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat3x3\t\tpacked_dmat3x3;\n\n\t/// 3 by 4 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat3x4\t\tpacked_dmat3x4;\n\n\t/// 4 by 2 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat4x2\t\tpacked_dmat4x2;\n\n\t/// 4 by 3 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat4x3\t\tpacked_dmat4x3;\n\n\t/// 4 by 4 matrix tightly packed in memory of double-precision floating-point numbers.\n\ttypedef packed_highp_dmat4x4\t\tpacked_dmat4x4;\n#endif//GLM_PRECISION\n\n#if(defined(GLM_PRECISION_LOWP_INT))\n\ttypedef aligned_lowp_ivec1\t\t\taligned_ivec1;\n\ttypedef aligned_lowp_ivec2\t\t\taligned_ivec2;\n\ttypedef aligned_lowp_ivec3\t\t\taligned_ivec3;\n\ttypedef aligned_lowp_ivec4\t\t\taligned_ivec4;\n#elif(defined(GLM_PRECISION_MEDIUMP_INT))\n\ttypedef aligned_mediump_ivec1\t\taligned_ivec1;\n\ttypedef aligned_mediump_ivec2\t\taligned_ivec2;\n\ttypedef aligned_mediump_ivec3\t\taligned_ivec3;\n\ttypedef aligned_mediump_ivec4\t\taligned_ivec4;\n#else //defined(GLM_PRECISION_HIGHP_INT)\n\t/// 1 component vector aligned in memory of signed integer numbers.\n\ttypedef aligned_highp_ivec1\t\t\taligned_ivec1;\n\n\t/// 2 components vector aligned in memory of signed integer numbers.\n\ttypedef aligned_highp_ivec2\t\t\taligned_ivec2;\n\n\t/// 3 components vector aligned in memory of signed integer numbers.\n\ttypedef aligned_highp_ivec3\t\t\taligned_ivec3;\n\n\t/// 4 components vector aligned in memory of signed integer numbers.\n\ttypedef aligned_highp_ivec4\t\t\taligned_ivec4;\n\n\t/// 1 component vector tightly packed in memory of signed integer numbers.\n\ttypedef packed_highp_ivec1\t\t\tpacked_ivec1;\n\n\t/// 2 components vector tightly packed in memory of signed integer numbers.\n\ttypedef packed_highp_ivec2\t\t\tpacked_ivec2;\n\n\t/// 3 components vector tightly packed in memory of signed integer numbers.\n\ttypedef packed_highp_ivec3\t\t\tpacked_ivec3;\n\n\t/// 4 components vector tightly packed in memory of signed integer numbers.\n\ttypedef packed_highp_ivec4\t\t\tpacked_ivec4;\n#endif//GLM_PRECISION\n\n\t// -- Unsigned integer definition --\n\n#if(defined(GLM_PRECISION_LOWP_UINT))\n\ttypedef aligned_lowp_uvec1\t\t\taligned_uvec1;\n\ttypedef aligned_lowp_uvec2\t\t\taligned_uvec2;\n\ttypedef aligned_lowp_uvec3\t\t\taligned_uvec3;\n\ttypedef aligned_lowp_uvec4\t\t\taligned_uvec4;\n#elif(defined(GLM_PRECISION_MEDIUMP_UINT))\n\ttypedef aligned_mediump_uvec1\t\taligned_uvec1;\n\ttypedef aligned_mediump_uvec2\t\taligned_uvec2;\n\ttypedef aligned_mediump_uvec3\t\taligned_uvec3;\n\ttypedef aligned_mediump_uvec4\t\taligned_uvec4;\n#else //defined(GLM_PRECISION_HIGHP_UINT)\n\t/// 1 component vector aligned in memory of unsigned integer numbers.\n\ttypedef aligned_highp_uvec1\t\t\taligned_uvec1;\n\n\t/// 2 components vector aligned in memory of unsigned integer numbers.\n\ttypedef aligned_highp_uvec2\t\t\taligned_uvec2;\n\n\t/// 3 components vector aligned in memory of unsigned integer numbers.\n\ttypedef aligned_highp_uvec3\t\t\taligned_uvec3;\n\n\t/// 4 components vector aligned in memory of unsigned integer numbers.\n\ttypedef aligned_highp_uvec4\t\t\taligned_uvec4;\n\n\t/// 1 component vector tightly packed in memory of unsigned integer numbers.\n\ttypedef packed_highp_uvec1\t\t\tpacked_uvec1;\n\n\t/// 2 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef packed_highp_uvec2\t\t\tpacked_uvec2;\n\n\t/// 3 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef packed_highp_uvec3\t\t\tpacked_uvec3;\n\n\t/// 4 components vector tightly packed in memory of unsigned integer numbers.\n\ttypedef packed_highp_uvec4\t\t\tpacked_uvec4;\n#endif//GLM_PRECISION\n\n#if(defined(GLM_PRECISION_LOWP_BOOL))\n\ttypedef aligned_lowp_bvec1\t\t\taligned_bvec1;\n\ttypedef aligned_lowp_bvec2\t\t\taligned_bvec2;\n\ttypedef aligned_lowp_bvec3\t\t\taligned_bvec3;\n\ttypedef aligned_lowp_bvec4\t\t\taligned_bvec4;\n#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))\n\ttypedef aligned_mediump_bvec1\t\taligned_bvec1;\n\ttypedef aligned_mediump_bvec2\t\taligned_bvec2;\n\ttypedef aligned_mediump_bvec3\t\taligned_bvec3;\n\ttypedef aligned_mediump_bvec4\t\taligned_bvec4;\n#else //defined(GLM_PRECISION_HIGHP_BOOL)\n\t/// 1 component vector aligned in memory of bool values.\n\ttypedef aligned_highp_bvec1\t\t\taligned_bvec1;\n\n\t/// 2 components vector aligned in memory of bool values.\n\ttypedef aligned_highp_bvec2\t\t\taligned_bvec2;\n\n\t/// 3 components vector aligned in memory of bool values.\n\ttypedef aligned_highp_bvec3\t\t\taligned_bvec3;\n\n\t/// 4 components vector aligned in memory of bool values.\n\ttypedef aligned_highp_bvec4\t\t\taligned_bvec4;\n\n\t/// 1 components vector tightly packed in memory of bool values.\n\ttypedef packed_highp_bvec1\t\t\tpacked_bvec1;\n\n\t/// 2 components vector tightly packed in memory of bool values.\n\ttypedef packed_highp_bvec2\t\t\tpacked_bvec2;\n\n\t/// 3 components vector tightly packed in memory of bool values.\n\ttypedef packed_highp_bvec3\t\t\tpacked_bvec3;\n\n\t/// 4 components vector tightly packed in memory of bool values.\n\ttypedef packed_highp_bvec4\t\t\tpacked_bvec4;\n#endif//GLM_PRECISION\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/gtc/type_precision.hpp", "language": "code", "loc": 1544, "comment_density": 0.671, "code": "/// @ref gtc_type_precision\n/// @file glm/gtc/type_precision.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtc_type_precision GLM_GTC_type_precision\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Defines specific C++-based qualifier types.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtc/vec1.hpp\"\n#include \"../ext/scalar_int_sized.hpp\"\n#include \"../ext/scalar_uint_sized.hpp\"\n#include \"../detail/type_vec2.hpp\"\n#include \"../detail/type_vec3.hpp\"\n#include \"../detail/type_vec4.hpp\"\n#include \"../detail/type_mat2x2.hpp\"\n#include \"../detail/type_mat2x3.hpp\"\n#include \"../detail/type_mat2x4.hpp\"\n#include \"../detail/type_mat3x2.hpp\"\n#include \"../detail/type_mat3x3.hpp\"\n#include \"../detail/type_mat3x4.hpp\"\n#include \"../detail/type_mat4x2.hpp\"\n#include \"../detail/type_mat4x3.hpp\"\n#include \"../detail/type_mat4x4.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_type_precision extension included\")\n#endif\n\nnamespace glm\n{\n\t///////////////////////////\n\t// Signed int vector types\n\n\t/// @addtogroup gtc_type_precision\n\t/// @{\n\n\t/// Low qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 lowp_int8;\n\n\t/// Low qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 lowp_int16;\n\n\t/// Low qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 lowp_int32;\n\n\t/// Low qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 lowp_int64;\n\n\t/// Low qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 lowp_int8_t;\n\n\t/// Low qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 lowp_int16_t;\n\n\t/// Low qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 lowp_int32_t;\n\n\t/// Low qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 lowp_int64_t;\n\n\t/// Low qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 lowp_i8;\n\n\t/// Low qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 lowp_i16;\n\n\t/// Low qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 lowp_i32;\n\n\t/// Low qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 lowp_i64;\n\n\t/// Medium qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 mediump_int8;\n\n\t/// Medium qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 mediump_int16;\n\n\t/// Medium qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 mediump_int32;\n\n\t/// Medium qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 mediump_int64;\n\n\t/// Medium qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 mediump_int8_t;\n\n\t/// Medium qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 mediump_int16_t;\n\n\t/// Medium qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 mediump_int32_t;\n\n\t/// Medium qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 mediump_int64_t;\n\n\t/// Medium qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 mediump_i8;\n\n\t/// Medium qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 mediump_i16;\n\n\t/// Medium qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 mediump_i32;\n\n\t/// Medium qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 mediump_i64;\n\n\t/// High qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 highp_int8;\n\n\t/// High qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 highp_int16;\n\n\t/// High qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 highp_int32;\n\n\t/// High qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 highp_int64;\n\n\t/// High qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 highp_int8_t;\n\n\t/// High qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 highp_int16_t;\n\n\t/// 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 highp_int32_t;\n\n\t/// High qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 highp_int64_t;\n\n\t/// High qualifier 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 highp_i8;\n\n\t/// High qualifier 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 highp_i16;\n\n\t/// High qualifier 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 highp_i32;\n\n\t/// High qualifier 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 highp_i64;\n\n\n#if GLM_HAS_EXTENDED_INTEGER_TYPE\n\tusing std::int8_t;\n\tusing std::int16_t;\n\tusing std::int32_t;\n\tusing std::int64_t;\n#else\n\t/// 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 int8_t;\n\n\t/// 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 int16_t;\n\n\t/// 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 int32_t;\n\n\t/// 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 int64_t;\n#endif\n\n\t/// 8 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int8 i8;\n\n\t/// 16 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int16 i16;\n\n\t/// 32 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int32 i32;\n\n\t/// 64 bit signed integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::int64 i64;\n\n\n\n\t/// Low qualifier 8 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i8, lowp> lowp_i8vec1;\n\n\t/// Low qualifier 8 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i8, lowp> lowp_i8vec2;\n\n\t/// Low qualifier 8 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i8, lowp> lowp_i8vec3;\n\n\t/// Low qualifier 8 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i8, lowp> lowp_i8vec4;\n\n\n\t/// Medium qualifier 8 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i8, mediump> mediump_i8vec1;\n\n\t/// Medium qualifier 8 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i8, mediump> mediump_i8vec2;\n\n\t/// Medium qualifier 8 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i8, mediump> mediump_i8vec3;\n\n\t/// Medium qualifier 8 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i8, mediump> mediump_i8vec4;\n\n\n\t/// High qualifier 8 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i8, highp> highp_i8vec1;\n\n\t/// High qualifier 8 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i8, highp> highp_i8vec2;\n\n\t/// High qualifier 8 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i8, highp> highp_i8vec3;\n\n\t/// High qualifier 8 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i8, highp> highp_i8vec4;\n\n\n\n\t/// 8 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i8, defaultp> i8vec1;\n\n\t/// 8 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i8, defaultp> i8vec2;\n\n\t/// 8 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i8, defaultp> i8vec3;\n\n\t/// 8 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i8, defaultp> i8vec4;\n\n\n\n\n\n\t/// Low qualifier 16 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i16, lowp>\t\tlowp_i16vec1;\n\n\t/// Low qualifier 16 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i16, lowp>\t\tlowp_i16vec2;\n\n\t/// Low qualifier 16 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i16, lowp>\t\tlowp_i16vec3;\n\n\t/// Low qualifier 16 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i16, lowp>\t\tlowp_i16vec4;\n\n\n\t/// Medium qualifier 16 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i16, mediump>\t\tmediump_i16vec1;\n\n\t/// Medium qualifier 16 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i16, mediump>\t\tmediump_i16vec2;\n\n\t/// Medium qualifier 16 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i16, mediump>\t\tmediump_i16vec3;\n\n\t/// Medium qualifier 16 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i16, mediump>\t\tmediump_i16vec4;\n\n\n\t/// High qualifier 16 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i16, highp>\t\thighp_i16vec1;\n\n\t/// High qualifier 16 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i16, highp>\t\thighp_i16vec2;\n\n\t/// High qualifier 16 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i16, highp>\t\thighp_i16vec3;\n\n\t/// High qualifier 16 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i16, highp>\t\thighp_i16vec4;\n\n\n\n\n\t/// 16 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i16, defaultp> i16vec1;\n\n\t/// 16 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i16, defaultp> i16vec2;\n\n\t/// 16 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i16, defaultp> i16vec3;\n\n\t/// 16 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i16, defaultp> i16vec4;\n\n\n\n\t/// Low qualifier 32 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i32, lowp>\t\tlowp_i32vec1;\n\n\t/// Low qualifier 32 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i32, lowp>\t\tlowp_i32vec2;\n\n\t/// Low qualifier 32 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i32, lowp>\t\tlowp_i32vec3;\n\n\t/// Low qualifier 32 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i32, lowp>\t\tlowp_i32vec4;\n\n\n\t/// Medium qualifier 32 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i32, mediump>\t\tmediump_i32vec1;\n\n\t/// Medium qualifier 32 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i32, mediump>\t\tmediump_i32vec2;\n\n\t/// Medium qualifier 32 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i32, mediump>\t\tmediump_i32vec3;\n\n\t/// Medium qualifier 32 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i32, mediump>\t\tmediump_i32vec4;\n\n\n\t/// High qualifier 32 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i32, highp>\t\thighp_i32vec1;\n\n\t/// High qualifier 32 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i32, highp>\t\thighp_i32vec2;\n\n\t/// High qualifier 32 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i32, highp>\t\thighp_i32vec3;\n\n\t/// High qualifier 32 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i32, highp>\t\thighp_i32vec4;\n\n\n\t/// 32 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i32, defaultp> i32vec1;\n\n\t/// 32 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i32, defaultp> i32vec2;\n\n\t/// 32 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i32, defaultp> i32vec3;\n\n\t/// 32 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i32, defaultp> i32vec4;\n\n\n\n\n\t/// Low qualifier 64 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i64, lowp>\t\tlowp_i64vec1;\n\n\t/// Low qualifier 64 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i64, lowp>\t\tlowp_i64vec2;\n\n\t/// Low qualifier 64 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i64, lowp>\t\tlowp_i64vec3;\n\n\t/// Low qualifier 64 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i64, lowp>\t\tlowp_i64vec4;\n\n\n\t/// Medium qualifier 64 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i64, mediump>\t\tmediump_i64vec1;\n\n\t/// Medium qualifier 64 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i64, mediump>\t\tmediump_i64vec2;\n\n\t/// Medium qualifier 64 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i64, mediump>\t\tmediump_i64vec3;\n\n\t/// Medium qualifier 64 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i64, mediump>\t\tmediump_i64vec4;\n\n\n\t/// High qualifier 64 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i64, highp>\t\thighp_i64vec1;\n\n\t/// High qualifier 64 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i64, highp>\t\thighp_i64vec2;\n\n\t/// High qualifier 64 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i64, highp>\t\thighp_i64vec3;\n\n\t/// High qualifier 64 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i64, highp>\t\thighp_i64vec4;\n\n\n\t/// 64 bit signed integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, i64, defaultp> i64vec1;\n\n\t/// 64 bit signed integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, i64, defaultp> i64vec2;\n\n\t/// 64 bit signed integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, i64, defaultp> i64vec3;\n\n\t/// 64 bit signed integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, i64, defaultp> i64vec4;\n\n\n\t/////////////////////////////\n\t// Unsigned int vector types\n\n\t/// Low qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 lowp_uint8;\n\n\t/// Low qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 lowp_uint16;\n\n\t/// Low qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 lowp_uint32;\n\n\t/// Low qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 lowp_uint64;\n\n\t/// Low qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 lowp_uint8_t;\n\n\t/// Low qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 lowp_uint16_t;\n\n\t/// Low qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 lowp_uint32_t;\n\n\t/// Low qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 lowp_uint64_t;\n\n\t/// Low qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 lowp_u8;\n\n\t/// Low qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 lowp_u16;\n\n\t/// Low qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 lowp_u32;\n\n\t/// Low qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 lowp_u64;\n\n\t/// Medium qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 mediump_uint8;\n\n\t/// Medium qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 mediump_uint16;\n\n\t/// Medium qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 mediump_uint32;\n\n\t/// Medium qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 mediump_uint64;\n\n\t/// Medium qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 mediump_uint8_t;\n\n\t/// Medium qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 mediump_uint16_t;\n\n\t/// Medium qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 mediump_uint32_t;\n\n\t/// Medium qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 mediump_uint64_t;\n\n\t/// Medium qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 mediump_u8;\n\n\t/// Medium qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 mediump_u16;\n\n\t/// Medium qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 mediump_u32;\n\n\t/// Medium qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 mediump_u64;\n\n\t/// High qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 highp_uint8;\n\n\t/// High qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 highp_uint16;\n\n\t/// High qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 highp_uint32;\n\n\t/// High qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 highp_uint64;\n\n\t/// High qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 highp_uint8_t;\n\n\t/// High qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 highp_uint16_t;\n\n\t/// High qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 highp_uint32_t;\n\n\t/// High qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 highp_uint64_t;\n\n\t/// High qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 highp_u8;\n\n\t/// High qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 highp_u16;\n\n\t/// High qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 highp_u32;\n\n\t/// High qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 highp_u64;\n\n#if GLM_HAS_EXTENDED_INTEGER_TYPE\n\tusing std::uint8_t;\n\tusing std::uint16_t;\n\tusing std::uint32_t;\n\tusing std::uint64_t;\n#else\n\t/// Default qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 uint8_t;\n\n\t/// Default qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 uint16_t;\n\n\t/// Default qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 uint32_t;\n\n\t/// Default qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 uint64_t;\n#endif\n\n\t/// Default qualifier 8 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint8 u8;\n\n\t/// Default qualifier 16 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint16 u16;\n\n\t/// Default qualifier 32 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint32 u32;\n\n\t/// Default qualifier 64 bit unsigned integer type.\n\t/// @see gtc_type_precision\n\ttypedef detail::uint64 u64;\n\n\n\n\n\n\t//////////////////////\n\t// Float vector types\n\n\t/// Single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float float32;\n\n\t/// Double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef double float64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32_t;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64_t;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_f32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_f64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32_t;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64_t;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_f32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_f64;\n\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_float32_t;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_float64_t;\n\n\t/// Low 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 lowp_f32;\n\n\t/// Low 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 lowp_f64;\n\n\n\t/// Medium 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 mediump_float32;\n\n\t/// Medium 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 mediump_float64;\n\n\t/// Medium 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 mediump_float32_t;\n\n\t/// Medium 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 mediump_float64_t;\n\n\t/// Medium 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 mediump_f32;\n\n\t/// Medium 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 mediump_f64;\n\n\n\t/// High 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 highp_float32;\n\n\t/// High 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 highp_float64;\n\n\t/// High 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 highp_float32_t;\n\n\t/// High 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 highp_float64_t;\n\n\t/// High 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 highp_f32;\n\n\t/// High 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float64 highp_f64;\n\n\n#if(defined(GLM_PRECISION_LOWP_FLOAT))\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef lowp_float32_t float32_t;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef lowp_float64_t float64_t;\n\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f32 f32;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f64 f64;\n\n#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef mediump_float32 float32_t;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef mediump_float64 float64_t;\n\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef mediump_float32 f32;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef mediump_float64 f64;\n\n#else//(defined(GLM_PRECISION_HIGHP_FLOAT))\n\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef highp_float32_t float32_t;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef highp_float64_t float64_t;\n\n\t/// Default 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef highp_float32_t f32;\n\n\t/// Default 64 bit double-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef highp_float64_t f64;\n#endif\n\n\n\t/// Low single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, float, lowp> lowp_fvec1;\n\n\t/// Low single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, float, lowp> lowp_fvec2;\n\n\t/// Low single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, float, lowp> lowp_fvec3;\n\n\t/// Low single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, float, lowp> lowp_fvec4;\n\n\n\t/// Medium single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, float, mediump> mediump_fvec1;\n\n\t/// Medium Single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, float, mediump> mediump_fvec2;\n\n\t/// Medium Single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, float, mediump> mediump_fvec3;\n\n\t/// Medium Single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, float, mediump> mediump_fvec4;\n\n\n\t/// High single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, float, highp> highp_fvec1;\n\n\t/// High Single-qualifier floating-point vector of 2 components.\n\t/// @see core_precision\n\ttypedef vec<2, float, highp> highp_fvec2;\n\n\t/// High Single-qualifier floating-point vector of 3 components.\n\t/// @see core_precision\n\ttypedef vec<3, float, highp> highp_fvec3;\n\n\t/// High Single-qualifier floating-point vector of 4 components.\n\t/// @see core_precision\n\ttypedef vec<4, float, highp> highp_fvec4;\n\n\n\t/// Low single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f32, lowp> lowp_f32vec1;\n\n\t/// Low single-qualifier floating-point vector of 2 components.\n\t/// @see core_precision\n\ttypedef vec<2, f32, lowp> lowp_f32vec2;\n\n\t/// Low single-qualifier floating-point vector of 3 components.\n\t/// @see core_precision\n\ttypedef vec<3, f32, lowp> lowp_f32vec3;\n\n\t/// Low single-qualifier floating-point vector of 4 components.\n\t/// @see core_precision\n\ttypedef vec<4, f32, lowp> lowp_f32vec4;\n\n\t/// Medium single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f32, mediump> mediump_f32vec1;\n\n\t/// Medium single-qualifier floating-point vector of 2 components.\n\t/// @see core_precision\n\ttypedef vec<2, f32, mediump> mediump_f32vec2;\n\n\t/// Medium single-qualifier floating-point vector of 3 components.\n\t/// @see core_precision\n\ttypedef vec<3, f32, mediump> mediump_f32vec3;\n\n\t/// Medium single-qualifier floating-point vector of 4 components.\n\t/// @see core_precision\n\ttypedef vec<4, f32, mediump> mediump_f32vec4;\n\n\t/// High single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f32, highp> highp_f32vec1;\n\n\t/// High single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f32, highp> highp_f32vec2;\n\n\t/// High single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f32, highp> highp_f32vec3;\n\n\t/// High single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f32, highp> highp_f32vec4;\n\n\n\t/// Low double-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f64, lowp> lowp_f64vec1;\n\n\t/// Low double-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f64, lowp> lowp_f64vec2;\n\n\t/// Low double-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f64, lowp> lowp_f64vec3;\n\n\t/// Low double-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f64, lowp> lowp_f64vec4;\n\n\t/// Medium double-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f64, mediump> mediump_f64vec1;\n\n\t/// Medium double-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f64, mediump> mediump_f64vec2;\n\n\t/// Medium double-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f64, mediump> mediump_f64vec3;\n\n\t/// Medium double-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f64, mediump> mediump_f64vec4;\n\n\t/// High double-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f64, highp> highp_f64vec1;\n\n\t/// High double-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f64, highp> highp_f64vec2;\n\n\t/// High double-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f64, highp> highp_f64vec3;\n\n\t/// High double-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f64, highp> highp_f64vec4;\n\n\n\n\t//////////////////////\n\t// Float matrix types\n\n\t/// Low single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef lowp_f32 lowp_fmat1x1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, lowp> lowp_fmat2x2;\n\n\t/// Low single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, lowp> lowp_fmat2x3;\n\n\t/// Low single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, lowp> lowp_fmat2x4;\n\n\t/// Low single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, lowp> lowp_fmat3x2;\n\n\t/// Low single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, lowp> lowp_fmat3x3;\n\n\t/// Low single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, lowp> lowp_fmat3x4;\n\n\t/// Low single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, lowp> lowp_fmat4x2;\n\n\t/// Low single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, lowp> lowp_fmat4x3;\n\n\t/// Low single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, lowp> lowp_fmat4x4;\n\n\t/// Low single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef lowp_fmat1x1 lowp_fmat1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_fmat2x2 lowp_fmat2;\n\n\t/// Low single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_fmat3x3 lowp_fmat3;\n\n\t/// Low single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_fmat4x4 lowp_fmat4;\n\n\n\t/// Medium single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef mediump_f32 mediump_fmat1x1;\n\n\t/// Medium single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, mediump> mediump_fmat2x2;\n\n\t/// Medium single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, mediump> mediump_fmat2x3;\n\n\t/// Medium single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, mediump> mediump_fmat2x4;\n\n\t/// Medium single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, mediump> mediump_fmat3x2;\n\n\t/// Medium single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, mediump> mediump_fmat3x3;\n\n\t/// Medium single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, mediump> mediump_fmat3x4;\n\n\t/// Medium single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, mediump> mediump_fmat4x2;\n\n\t/// Medium single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, mediump> mediump_fmat4x3;\n\n\t/// Medium single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, mediump> mediump_fmat4x4;\n\n\t/// Medium single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef mediump_fmat1x1 mediump_fmat1;\n\n\t/// Medium single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_fmat2x2 mediump_fmat2;\n\n\t/// Medium single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_fmat3x3 mediump_fmat3;\n\n\t/// Medium single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_fmat4x4 mediump_fmat4;\n\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef highp_f32 highp_fmat1x1;\n\n\t/// High single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, highp> highp_fmat2x2;\n\n\t/// High single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, highp> highp_fmat2x3;\n\n\t/// High single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, highp> highp_fmat2x4;\n\n\t/// High single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, highp> highp_fmat3x2;\n\n\t/// High single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, highp> highp_fmat3x3;\n\n\t/// High single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, highp> highp_fmat3x4;\n\n\t/// High single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, highp> highp_fmat4x2;\n\n\t/// High single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, highp> highp_fmat4x3;\n\n\t/// High single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, highp> highp_fmat4x4;\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef highp_fmat1x1 highp_fmat1;\n\n\t/// High single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_fmat2x2 highp_fmat2;\n\n\t/// High single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_fmat3x3 highp_fmat3;\n\n\t/// High single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_fmat4x4 highp_fmat4;\n\n\n\t/// Low single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 lowp_f32mat1x1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, lowp> lowp_f32mat2x2;\n\n\t/// Low single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, lowp> lowp_f32mat2x3;\n\n\t/// Low single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, lowp> lowp_f32mat2x4;\n\n\t/// Low single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, lowp> lowp_f32mat3x2;\n\n\t/// Low single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, lowp> lowp_f32mat3x3;\n\n\t/// Low single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, lowp> lowp_f32mat3x4;\n\n\t/// Low single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, lowp> lowp_f32mat4x2;\n\n\t/// Low single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, lowp> lowp_f32mat4x3;\n\n\t/// Low single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, lowp> lowp_f32mat4x4;\n\n\t/// Low single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 lowp_f32mat1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f32mat2x2 lowp_f32mat2;\n\n\t/// Low single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f32mat3x3 lowp_f32mat3;\n\n\t/// Low single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f32mat4x4 lowp_f32mat4;\n\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 mediump_f32mat1x1;\n\n\t/// Low single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, mediump> mediump_f32mat2x2;\n\n\t/// Medium single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, mediump> mediump_f32mat2x3;\n\n\t/// Medium single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, mediump> mediump_f32mat2x4;\n\n\t/// Medium single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, mediump> mediump_f32mat3x2;\n\n\t/// Medium single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, mediump> mediump_f32mat3x3;\n\n\t/// Medium single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, mediump> mediump_f32mat3x4;\n\n\t/// Medium single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, mediump> mediump_f32mat4x2;\n\n\t/// Medium single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, mediump> mediump_f32mat4x3;\n\n\t/// Medium single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, mediump> mediump_f32mat4x4;\n\n\t/// Medium single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 f32mat1;\n\n\t/// Medium single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f32mat2x2 mediump_f32mat2;\n\n\t/// Medium single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f32mat3x3 mediump_f32mat3;\n\n\t/// Medium single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f32mat4x4 mediump_f32mat4;\n\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 highp_f32mat1x1;\n\n\t/// High single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, highp> highp_f32mat2x2;\n\n\t/// High single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, highp> highp_f32mat2x3;\n\n\t/// High single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, highp> highp_f32mat2x4;\n\n\t/// High single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, highp> highp_f32mat3x2;\n\n\t/// High single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, highp> highp_f32mat3x3;\n\n\t/// High single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, highp> highp_f32mat3x4;\n\n\t/// High single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, highp> highp_f32mat4x2;\n\n\t/// High single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, highp> highp_f32mat4x3;\n\n\t/// High single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, highp> highp_f32mat4x4;\n\n\t/// High single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 f32mat1;\n\n\t/// High single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f32mat2x2 highp_f32mat2;\n\n\t/// High single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f32mat3x3 highp_f32mat3;\n\n\t/// High single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f32mat4x4 highp_f32mat4;\n\n\n\t/// Low double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f64 lowp_f64mat1x1;\n\n\t/// Low double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, lowp> lowp_f64mat2x2;\n\n\t/// Low double-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f64, lowp> lowp_f64mat2x3;\n\n\t/// Low double-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f64, lowp> lowp_f64mat2x4;\n\n\t/// Low double-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f64, lowp> lowp_f64mat3x2;\n\n\t/// Low double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, lowp> lowp_f64mat3x3;\n\n\t/// Low double-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f64, lowp> lowp_f64mat3x4;\n\n\t/// Low double-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f64, lowp> lowp_f64mat4x2;\n\n\t/// Low double-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f64, lowp> lowp_f64mat4x3;\n\n\t/// Low double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, lowp> lowp_f64mat4x4;\n\n\t/// Low double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef lowp_f64mat1x1 lowp_f64mat1;\n\n\t/// Low double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f64mat2x2 lowp_f64mat2;\n\n\t/// Low double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f64mat3x3 lowp_f64mat3;\n\n\t/// Low double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef lowp_f64mat4x4 lowp_f64mat4;\n\n\n\t/// Medium double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f64 Highp_f64mat1x1;\n\n\t/// Medium double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, mediump> mediump_f64mat2x2;\n\n\t/// Medium double-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f64, mediump> mediump_f64mat2x3;\n\n\t/// Medium double-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f64, mediump> mediump_f64mat2x4;\n\n\t/// Medium double-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f64, mediump> mediump_f64mat3x2;\n\n\t/// Medium double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, mediump> mediump_f64mat3x3;\n\n\t/// Medium double-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f64, mediump> mediump_f64mat3x4;\n\n\t/// Medium double-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f64, mediump> mediump_f64mat4x2;\n\n\t/// Medium double-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f64, mediump> mediump_f64mat4x3;\n\n\t/// Medium double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, mediump> mediump_f64mat4x4;\n\n\t/// Medium double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef mediump_f64mat1x1 mediump_f64mat1;\n\n\t/// Medium double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f64mat2x2 mediump_f64mat2;\n\n\t/// Medium double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f64mat3x3 mediump_f64mat3;\n\n\t/// Medium double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mediump_f64mat4x4 mediump_f64mat4;\n\n\t/// High double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f64 highp_f64mat1x1;\n\n\t/// High double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, highp> highp_f64mat2x2;\n\n\t/// High double-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f64, highp> highp_f64mat2x3;\n\n\t/// High double-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f64, highp> highp_f64mat2x4;\n\n\t/// High double-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f64, highp> highp_f64mat3x2;\n\n\t/// High double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, highp> highp_f64mat3x3;\n\n\t/// High double-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f64, highp> highp_f64mat3x4;\n\n\t/// High double-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f64, highp> highp_f64mat4x2;\n\n\t/// High double-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f64, highp> highp_f64mat4x3;\n\n\t/// High double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, highp> highp_f64mat4x4;\n\n\t/// High double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef highp_f64mat1x1 highp_f64mat1;\n\n\t/// High double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f64mat2x2 highp_f64mat2;\n\n\t/// High double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f64mat3x3 highp_f64mat3;\n\n\t/// High double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef highp_f64mat4x4 highp_f64mat4;\n\n\n\n\n\t/// Low qualifier 8 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u8, lowp> lowp_u8vec1;\n\n\t/// Low qualifier 8 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u8, lowp> lowp_u8vec2;\n\n\t/// Low qualifier 8 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u8, lowp> lowp_u8vec3;\n\n\t/// Low qualifier 8 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u8, lowp> lowp_u8vec4;\n\n\n\t/// Medium qualifier 8 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u8, mediump> mediump_u8vec1;\n\n\t/// Medium qualifier 8 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u8, mediump> mediump_u8vec2;\n\n\t/// Medium qualifier 8 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u8, mediump> mediump_u8vec3;\n\n\t/// Medium qualifier 8 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u8, mediump> mediump_u8vec4;\n\n\n\t/// High qualifier 8 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u8, highp> highp_u8vec1;\n\n\t/// High qualifier 8 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u8, highp> highp_u8vec2;\n\n\t/// High qualifier 8 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u8, highp> highp_u8vec3;\n\n\t/// High qualifier 8 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u8, highp> highp_u8vec4;\n\n\n\n\t/// Default qualifier 8 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u8, defaultp> u8vec1;\n\n\t/// Default qualifier 8 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u8, defaultp> u8vec2;\n\n\t/// Default qualifier 8 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u8, defaultp> u8vec3;\n\n\t/// Default qualifier 8 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u8, defaultp> u8vec4;\n\n\n\n\n\t/// Low qualifier 16 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u16, lowp>\t\tlowp_u16vec1;\n\n\t/// Low qualifier 16 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u16, lowp>\t\tlowp_u16vec2;\n\n\t/// Low qualifier 16 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u16, lowp>\t\tlowp_u16vec3;\n\n\t/// Low qualifier 16 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u16, lowp>\t\tlowp_u16vec4;\n\n\n\t/// Medium qualifier 16 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u16, mediump>\t\tmediump_u16vec1;\n\n\t/// Medium qualifier 16 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u16, mediump>\t\tmediump_u16vec2;\n\n\t/// Medium qualifier 16 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u16, mediump>\t\tmediump_u16vec3;\n\n\t/// Medium qualifier 16 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u16, mediump>\t\tmediump_u16vec4;\n\n\n\t/// High qualifier 16 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u16, highp>\t\thighp_u16vec1;\n\n\t/// High qualifier 16 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u16, highp>\t\thighp_u16vec2;\n\n\t/// High qualifier 16 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u16, highp>\t\thighp_u16vec3;\n\n\t/// High qualifier 16 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u16, highp>\t\thighp_u16vec4;\n\n\n\n\n\t/// Default qualifier 16 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u16, defaultp> u16vec1;\n\n\t/// Default qualifier 16 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u16, defaultp> u16vec2;\n\n\t/// Default qualifier 16 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u16, defaultp> u16vec3;\n\n\t/// Default qualifier 16 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u16, defaultp> u16vec4;\n\n\n\n\t/// Low qualifier 32 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u32, lowp>\t\tlowp_u32vec1;\n\n\t/// Low qualifier 32 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u32, lowp>\t\tlowp_u32vec2;\n\n\t/// Low qualifier 32 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u32, lowp>\t\tlowp_u32vec3;\n\n\t/// Low qualifier 32 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u32, lowp>\t\tlowp_u32vec4;\n\n\n\t/// Medium qualifier 32 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u32, mediump>\t\tmediump_u32vec1;\n\n\t/// Medium qualifier 32 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u32, mediump>\t\tmediump_u32vec2;\n\n\t/// Medium qualifier 32 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u32, mediump>\t\tmediump_u32vec3;\n\n\t/// Medium qualifier 32 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u32, mediump>\t\tmediump_u32vec4;\n\n\n\t/// High qualifier 32 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u32, highp>\t\thighp_u32vec1;\n\n\t/// High qualifier 32 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u32, highp>\t\thighp_u32vec2;\n\n\t/// High qualifier 32 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u32, highp>\t\thighp_u32vec3;\n\n\t/// High qualifier 32 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u32, highp>\t\thighp_u32vec4;\n\n\n\n\t/// Default qualifier 32 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u32, defaultp> u32vec1;\n\n\t/// Default qualifier 32 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u32, defaultp> u32vec2;\n\n\t/// Default qualifier 32 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u32, defaultp> u32vec3;\n\n\t/// Default qualifier 32 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u32, defaultp> u32vec4;\n\n\n\n\n\t/// Low qualifier 64 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u64, lowp>\t\tlowp_u64vec1;\n\n\t/// Low qualifier 64 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u64, lowp>\t\tlowp_u64vec2;\n\n\t/// Low qualifier 64 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u64, lowp>\t\tlowp_u64vec3;\n\n\t/// Low qualifier 64 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u64, lowp>\t\tlowp_u64vec4;\n\n\n\t/// Medium qualifier 64 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u64, mediump>\t\tmediump_u64vec1;\n\n\t/// Medium qualifier 64 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u64, mediump>\t\tmediump_u64vec2;\n\n\t/// Medium qualifier 64 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u64, mediump>\t\tmediump_u64vec3;\n\n\t/// Medium qualifier 64 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u64, mediump>\t\tmediump_u64vec4;\n\n\n\t/// High qualifier 64 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u64, highp>\t\thighp_u64vec1;\n\n\t/// High qualifier 64 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u64, highp>\t\thighp_u64vec2;\n\n\t/// High qualifier 64 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u64, highp>\t\thighp_u64vec3;\n\n\t/// High qualifier 64 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u64, highp>\t\thighp_u64vec4;\n\n\n\n\n\t/// Default qualifier 64 bit unsigned integer scalar type.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, u64, defaultp> u64vec1;\n\n\t/// Default qualifier 64 bit unsigned integer vector of 2 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, u64, defaultp> u64vec2;\n\n\t/// Default qualifier 64 bit unsigned integer vector of 3 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, u64, defaultp> u64vec3;\n\n\t/// Default qualifier 64 bit unsigned integer vector of 4 components type.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, u64, defaultp> u64vec4;\n\n\n\t//////////////////////\n\t// Float vector types\n\n\t/// 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 float32_t;\n\n\t/// 32 bit single-qualifier floating-point scalar.\n\t/// @see gtc_type_precision\n\ttypedef float32 f32;\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t\t/// 64 bit double-qualifier floating-point scalar.\n\t\t/// @see gtc_type_precision\n\t\ttypedef float64 float64_t;\n\n\t\t/// 64 bit double-qualifier floating-point scalar.\n\t\t/// @see gtc_type_precision\n\t\ttypedef float64 f64;\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t/// Single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, float, defaultp> fvec1;\n\n\t/// Single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, float, defaultp> fvec2;\n\n\t/// Single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, float, defaultp> fvec3;\n\n\t/// Single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, float, defaultp> fvec4;\n\n\n\t/// Single-qualifier floating-point vector of 1 component.\n\t/// @see gtc_type_precision\n\ttypedef vec<1, f32, defaultp> f32vec1;\n\n\t/// Single-qualifier floating-point vector of 2 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<2, f32, defaultp> f32vec2;\n\n\t/// Single-qualifier floating-point vector of 3 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<3, f32, defaultp> f32vec3;\n\n\t/// Single-qualifier floating-point vector of 4 components.\n\t/// @see gtc_type_precision\n\ttypedef vec<4, f32, defaultp> f32vec4;\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\t\t/// Double-qualifier floating-point vector of 1 component.\n\t\t/// @see gtc_type_precision\n\t\ttypedef vec<1, f64, defaultp> f64vec1;\n\n\t\t/// Double-qualifier floating-point vector of 2 components.\n\t\t/// @see gtc_type_precision\n\t\ttypedef vec<2, f64, defaultp> f64vec2;\n\n\t\t/// Double-qualifier floating-point vector of 3 components.\n\t\t/// @see gtc_type_precision\n\t\ttypedef vec<3, f64, defaultp> f64vec3;\n\n\t\t/// Double-qualifier floating-point vector of 4 components.\n\t\t/// @see gtc_type_precision\n\t\ttypedef vec<4, f64, defaultp> f64vec4;\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\n\t//////////////////////\n\t// Float matrix types\n\n\t/// Single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 fmat1;\n\n\t/// Single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, defaultp> fmat2;\n\n\t/// Single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, defaultp> fmat3;\n\n\t/// Single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, defaultp> fmat4;\n\n\n\t/// Single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 fmat1x1;\n\n\t/// Single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, defaultp> fmat2x2;\n\n\t/// Single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, defaultp> fmat2x3;\n\n\t/// Single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, defaultp> fmat2x4;\n\n\t/// Single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, defaultp> fmat3x2;\n\n\t/// Single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, defaultp> fmat3x3;\n\n\t/// Single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, defaultp> fmat3x4;\n\n\t/// Single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, defaultp> fmat4x2;\n\n\t/// Single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, defaultp> fmat4x3;\n\n\t/// Single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, defaultp> fmat4x4;\n\n\n\t/// Single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 f32mat1;\n\n\t/// Single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, defaultp> f32mat2;\n\n\t/// Single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, defaultp> f32mat3;\n\n\t/// Single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, defaultp> f32mat4;\n\n\n\t/// Single-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f32 f32mat1x1;\n\n\t/// Single-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f32, defaultp> f32mat2x2;\n\n\t/// Single-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f32, defaultp> f32mat2x3;\n\n\t/// Single-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f32, defaultp> f32mat2x4;\n\n\t/// Single-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f32, defaultp> f32mat3x2;\n\n\t/// Single-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f32, defaultp> f32mat3x3;\n\n\t/// Single-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f32, defaultp> f32mat3x4;\n\n\t/// Single-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f32, defaultp> f32mat4x2;\n\n\t/// Single-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f32, defaultp> f32mat4x3;\n\n\t/// Single-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f32, defaultp> f32mat4x4;\n\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef detail::tmat1x1 f64mat1;\n\n\t/// Double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, defaultp> f64mat2;\n\n\t/// Double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, defaultp> f64mat3;\n\n\t/// Double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, defaultp> f64mat4;\n\n\n\t/// Double-qualifier floating-point 1x1 matrix.\n\t/// @see gtc_type_precision\n\t//typedef f64 f64mat1x1;\n\n\t/// Double-qualifier floating-point 2x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 2, f64, defaultp> f64mat2x2;\n\n\t/// Double-qualifier floating-point 2x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 3, f64, defaultp> f64mat2x3;\n\n\t/// Double-qualifier floating-point 2x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<2, 4, f64, defaultp> f64mat2x4;\n\n\t/// Double-qualifier floating-point 3x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 2, f64, defaultp> f64mat3x2;\n\n\t/// Double-qualifier floating-point 3x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 3, f64, defaultp> f64mat3x3;\n\n\t/// Double-qualifier floating-point 3x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<3, 4, f64, defaultp> f64mat3x4;\n\n\t/// Double-qualifier floating-point 4x2 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 2, f64, defaultp> f64mat4x2;\n\n\t/// Double-qualifier floating-point 4x3 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 3, f64, defaultp> f64mat4x3;\n\n\t/// Double-qualifier floating-point 4x4 matrix.\n\t/// @see gtc_type_precision\n\ttypedef mat<4, 4, f64, defaultp> f64mat4x4;\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t//////////////////////////\n\t// Quaternion types\n\n\t/// Single-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua f32quat;\n\n\t/// Low single-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua lowp_f32quat;\n\n\t/// Low double-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua lowp_f64quat;\n\n\t/// Medium single-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua mediump_f32quat;\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Medium double-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua mediump_f64quat;\n\n\t/// High single-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua highp_f32quat;\n\n\t/// High double-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua highp_f64quat;\n\n\t/// Double-qualifier floating-point quaternion.\n\t/// @see gtc_type_precision\n\ttypedef qua f64quat;\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t/// @}\n}//namespace glm\n\n#include \"type_precision.inl\"\n"}, {"path": "includes/glm/gtc/type_ptr.hpp", "language": "code", "loc": 191, "comment_density": 0.539, "code": "/// @ref gtc_type_ptr\n/// @file glm/gtc/type_ptr.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtc_type_ptr GLM_GTC_type_ptr\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Handles the interaction between pointers and vector, matrix types.\n///\n/// This extension defines an overloaded function, glm::value_ptr. It returns\n/// a pointer to the memory layout of the object. Matrix types store their values\n/// in column-major order.\n///\n/// This is useful for uploading data to matrices or copying data to buffer objects.\n///\n/// Example:\n/// @code\n/// #include \n/// #include \n///\n/// glm::vec3 aVector(3);\n/// glm::mat4 someMatrix(1.0);\n///\n/// glUniform3fv(uniformLoc, 1, glm::value_ptr(aVector));\n/// glUniformMatrix4fv(uniformMatrixLoc, 1, GL_FALSE, glm::value_ptr(someMatrix));\n/// @endcode\n///\n/// need to be included to use the features of this extension.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtc/vec1.hpp\"\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../mat2x2.hpp\"\n#include \"../mat2x3.hpp\"\n#include \"../mat2x4.hpp\"\n#include \"../mat3x2.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat3x4.hpp\"\n#include \"../mat4x2.hpp\"\n#include \"../mat4x3.hpp\"\n#include \"../mat4x4.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_type_ptr extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtc_type_ptr\n\t/// @{\n\n\t/// Return the constant address to the data of the input parameter.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type const * value_ptr(genType const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<1, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<2, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<3, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<4, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<1, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<2, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<3, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<4, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<1, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<2, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<3, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<4, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<1, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<2, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<3, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate \n\tGLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<4, T, Q> const& v);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, defaultp> make_vec2(T const * const ptr);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, defaultp> make_vec3(T const * const ptr);\n\n\t/// Build a vector from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, defaultp> make_vec4(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, defaultp> make_mat2x2(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, defaultp> make_mat2x3(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, defaultp> make_mat2x4(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, defaultp> make_mat3x2(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, defaultp> make_mat3x3(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, defaultp> make_mat3x4(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, defaultp> make_mat4x2(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, defaultp> make_mat4x3(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> make_mat4x4(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, defaultp> make_mat2(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, defaultp> make_mat3(T const * const ptr);\n\n\t/// Build a matrix from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> make_mat4(T const * const ptr);\n\n\t/// Build a quaternion from a pointer.\n\t/// @see gtc_type_ptr\n\ttemplate\n\tGLM_FUNC_DECL qua make_quat(T const * const ptr);\n\n\t/// @}\n}//namespace glm\n\n#include \"type_ptr.inl\"\n"}, {"path": "includes/glm/gtc/ulp.hpp", "language": "code", "loc": 20, "comment_density": 0.7, "code": "/// @ref gtc_ulp\n/// @file glm/gtc/ulp.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_ulp GLM_GTC_ulp\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Allow the measurement of the accuracy of a function against a reference\n/// implementation. This extension works on floating-point data and provide results\n/// in ULP.\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_ulp.hpp\"\n#include \"../ext/vector_ulp.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_ulp extension included\")\n#endif\n\n"}, {"path": "includes/glm/gtc/vec1.hpp", "language": "code", "loc": 26, "comment_density": 0.462, "code": "/// @ref gtc_vec1\n/// @file glm/gtc/vec1.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtc_vec1 GLM_GTC_vec1\n/// @ingroup gtc\n///\n/// Include to use the features of this extension.\n///\n/// Add vec1, ivec1, uvec1 and bvec1 types.\n\n#pragma once\n\n// Dependency:\n#include \"../ext/vector_bool1.hpp\"\n#include \"../ext/vector_bool1_precision.hpp\"\n#include \"../ext/vector_float1.hpp\"\n#include \"../ext/vector_float1_precision.hpp\"\n#include \"../ext/vector_double1.hpp\"\n#include \"../ext/vector_double1_precision.hpp\"\n#include \"../ext/vector_int1.hpp\"\n#include \"../ext/vector_int1_precision.hpp\"\n#include \"../ext/vector_uint1.hpp\"\n#include \"../ext/vector_uint1_precision.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_vec1 extension included\")\n#endif\n\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.616, "dedup_hash": "383a1470a5b44c54", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_gtx", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Gtx", "api": "OpenGL Core", "glsl_version": null, "topic": "postprocessing/texturing/bumpmapping/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/gtx/associated_min_max.hpp", "language": "code", "loc": 178, "comment_density": 0.343, "code": "/// @ref gtx_associated_min_max\n/// @file glm/gtx/associated_min_max.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_associated_min_max GLM_GTX_associated_min_max\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// @brief Min and max functions that return associated values not the compared onces.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GTX_associated_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_associated_min_max extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_associated_min_max\n\t/// @{\n\n\t/// Minimum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMin(T x, U a, T y, U b);\n\n\t/// Minimum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec<2, U, Q> associatedMin(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b);\n\n\t/// Minimum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tT x, const vec& a,\n\t\tT y, const vec& b);\n\n\t/// Minimum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b);\n\n\t/// Minimum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMin(\n\t\tT x, U a,\n\t\tT y, U b,\n\t\tT z, U c);\n\n\t/// Minimum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b,\n\t\tvec const& z, vec const& c);\n\n\t/// Minimum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMin(\n\t\tT x, U a,\n\t\tT y, U b,\n\t\tT z, U c,\n\t\tT w, U d);\n\n\t/// Minimum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b,\n\t\tvec const& z, vec const& c,\n\t\tvec const& w, vec const& d);\n\n\t/// Minimum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tT x, vec const& a,\n\t\tT y, vec const& b,\n\t\tT z, vec const& c,\n\t\tT w, vec const& d);\n\n\t/// Minimum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMin(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b,\n\t\tvec const& z, U c,\n\t\tvec const& w, U d);\n\n\t/// Maximum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMax(T x, U a, T y, U b);\n\n\t/// Maximum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec<2, U, Q> associatedMax(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b);\n\n\t/// Maximum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tT x, vec const& a,\n\t\tT y, vec const& b);\n\n\t/// Maximum comparison between 2 variables and returns 2 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b);\n\n\t/// Maximum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMax(\n\t\tT x, U a,\n\t\tT y, U b,\n\t\tT z, U c);\n\n\t/// Maximum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b,\n\t\tvec const& z, vec const& c);\n\n\t/// Maximum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tT x, vec const& a,\n\t\tT y, vec const& b,\n\t\tT z, vec const& c);\n\n\t/// Maximum comparison between 3 variables and returns 3 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b,\n\t\tvec const& z, U c);\n\n\t/// Maximum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL U associatedMax(\n\t\tT x, U a,\n\t\tT y, U b,\n\t\tT z, U c,\n\t\tT w, U d);\n\n\t/// Maximum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, vec const& a,\n\t\tvec const& y, vec const& b,\n\t\tvec const& z, vec const& c,\n\t\tvec const& w, vec const& d);\n\n\t/// Maximum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tT x, vec const& a,\n\t\tT y, vec const& b,\n\t\tT z, vec const& c,\n\t\tT w, vec const& d);\n\n\t/// Maximum comparison between 4 variables and returns 4 associated variable values\n\t/// @see gtx_associated_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec associatedMax(\n\t\tvec const& x, U a,\n\t\tvec const& y, U b,\n\t\tvec const& z, U c,\n\t\tvec const& w, U d);\n\n\t/// @}\n} //namespace glm\n\n#include \"associated_min_max.inl\"\n"}, {"path": "includes/glm/gtx/bit.hpp", "language": "code", "loc": 80, "comment_density": 0.637, "code": "/// @ref gtx_bit\n/// @file glm/gtx/bit.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_bit GLM_GTX_bit\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../gtc/bitfield.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_bit is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_bit extension is deprecated, include GLM_GTC_bitfield and GLM_GTC_integer instead\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_bit\n\t/// @{\n\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_FUNC_DECL genIUType highestBitValue(genIUType Value);\n\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_FUNC_DECL genIUType lowestBitValue(genIUType Value);\n\n\t/// Find the highest bit set to 1 in a integer variable and return its value.\n\t///\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_FUNC_DECL vec highestBitValue(vec const& value);\n\n\t/// Return the power of two number which value is just higher the input value.\n\t/// Deprecated, use ceilPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoAbove(genIUType Value);\n\n\t/// Return the power of two number which value is just higher the input value.\n\t/// Deprecated, use ceilPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoAbove(vec const& value);\n\n\t/// Return the power of two number which value is just lower the input value.\n\t/// Deprecated, use floorPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoBelow(genIUType Value);\n\n\t/// Return the power of two number which value is just lower the input value.\n\t/// Deprecated, use floorPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoBelow(vec const& value);\n\n\t/// Return the power of two number which value is the closet to the input value.\n\t/// Deprecated, use roundPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoNearest(genIUType Value);\n\n\t/// Return the power of two number which value is the closet to the input value.\n\t/// Deprecated, use roundPowerOfTwo from GTC_round instead\n\t///\n\t/// @see gtc_round\n\t/// @see gtx_bit\n\ttemplate\n\tGLM_DEPRECATED GLM_FUNC_DECL vec powerOfTwoNearest(vec const& value);\n\n\t/// @}\n} //namespace glm\n\n\n#include \"bit.inl\"\n\n"}, {"path": "includes/glm/gtx/closest_point.hpp", "language": "code", "loc": 40, "comment_density": 0.475, "code": "/// @ref gtx_closest_point\n/// @file glm/gtx/closest_point.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_closest_point GLM_GTX_closest_point\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Find the point on a straight line which is the closet of a point.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_closest_point extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_closest_point\n\t/// @{\n\n\t/// Find the point on a straight line which is the closet of a point.\n\t/// @see gtx_closest_point\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> closestPointOnLine(\n\t\tvec<3, T, Q> const& point,\n\t\tvec<3, T, Q> const& a,\n\t\tvec<3, T, Q> const& b);\n\n\t/// 2d lines work as well\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, Q> closestPointOnLine(\n\t\tvec<2, T, Q> const& point,\n\t\tvec<2, T, Q> const& a,\n\t\tvec<2, T, Q> const& b);\n\n\t/// @}\n}// namespace glm\n\n#include \"closest_point.inl\"\n"}, {"path": "includes/glm/gtx/color_encoding.hpp", "language": "code", "loc": 40, "comment_density": 0.525, "code": "/// @ref gtx_color_encoding\n/// @file glm/gtx/color_encoding.hpp\n///\n/// @see core (dependence)\n/// @see gtx_color_encoding (dependence)\n///\n/// @defgroup gtx_color_encoding GLM_GTX_color_encoding\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// @brief Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../vec3.hpp\"\n#include \n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTC_color_encoding extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_color_encoding\n\t/// @{\n\n\t/// Convert a linear sRGB color to D65 YUV.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD65XYZ(vec<3, T, Q> const& ColorLinearSRGB);\n\n\t/// Convert a linear sRGB color to D50 YUV.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD50XYZ(vec<3, T, Q> const& ColorLinearSRGB);\n\n\t/// Convert a D65 YUV color to linear sRGB.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> convertD65XYZToLinearSRGB(vec<3, T, Q> const& ColorD65XYZ);\n\n\t/// Convert a D65 YUV color to D50 YUV.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> convertD65XYZToD50XYZ(vec<3, T, Q> const& ColorD65XYZ);\n\n\t/// @}\n} //namespace glm\n\n#include \"color_encoding.inl\"\n"}, {"path": "includes/glm/gtx/color_space.hpp", "language": "code", "loc": 59, "comment_density": 0.475, "code": "/// @ref gtx_color_space\n/// @file glm/gtx/color_space.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_color_space GLM_GTX_color_space\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Related to RGB to HSV conversions and operations.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_color_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_color_space extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_color_space\n\t/// @{\n\n\t/// Converts a color from HSV color space to its color in RGB color space.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rgbColor(\n\t\tvec<3, T, Q> const& hsvValue);\n\n\t/// Converts a color from RGB color space to its color in HSV color space.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> hsvColor(\n\t\tvec<3, T, Q> const& rgbValue);\n\n\t/// Build a saturation matrix.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> saturation(\n\t\tT const s);\n\n\t/// Modify the saturation of a color.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> saturation(\n\t\tT const s,\n\t\tvec<3, T, Q> const& color);\n\n\t/// Modify the saturation of a color.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> saturation(\n\t\tT const s,\n\t\tvec<4, T, Q> const& color);\n\n\t/// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals.\n\t/// @see gtx_color_space\n\ttemplate\n\tGLM_FUNC_DECL T luminosity(\n\t\tvec<3, T, Q> const& color);\n\n\t/// @}\n}//namespace glm\n\n#include \"color_space.inl\"\n"}, {"path": "includes/glm/gtx/color_space_YCoCg.hpp", "language": "code", "loc": 49, "comment_density": 0.531, "code": "/// @ref gtx_color_space_YCoCg\n/// @file glm/gtx/color_space_YCoCg.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_color_space_YCoCg GLM_GTX_color_space_YCoCg\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// RGB to YCoCg conversions and operations\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_color_space_YCoCg is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_color_space_YCoCg extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_color_space_YCoCg\n\t/// @{\n\n\t/// Convert a color from RGB color space to YCoCg color space.\n\t/// @see gtx_color_space_YCoCg\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rgb2YCoCg(\n\t\tvec<3, T, Q> const& rgbColor);\n\n\t/// Convert a color from YCoCg color space to RGB color space.\n\t/// @see gtx_color_space_YCoCg\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> YCoCg2rgb(\n\t\tvec<3, T, Q> const& YCoCgColor);\n\n\t/// Convert a color from RGB color space to YCoCgR color space.\n\t/// @see \"YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range\"\n\t/// @see gtx_color_space_YCoCg\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rgb2YCoCgR(\n\t\tvec<3, T, Q> const& rgbColor);\n\n\t/// Convert a color from YCoCgR color space to RGB color space.\n\t/// @see \"YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range\"\n\t/// @see gtx_color_space_YCoCg\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> YCoCgR2rgb(\n\t\tvec<3, T, Q> const& YCoCgColor);\n\n\t/// @}\n}//namespace glm\n\n#include \"color_space_YCoCg.inl\"\n"}, {"path": "includes/glm/gtx/common.hpp", "language": "code", "loc": 65, "comment_density": 0.662, "code": "/// @ref gtx_common\n/// @file glm/gtx/common.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_common GLM_GTX_common\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// @brief Provide functions to increase the compatibility with Cg and HLSL languages\n\n#pragma once\n\n// Dependencies:\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../gtc/vec1.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_common is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_common extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_common\n\t/// @{\n\n\t/// Returns true if x is a denormalized number\n\t/// Numbers whose absolute value is too small to be represented in the normal format are represented in an alternate, denormalized format.\n\t/// This format is less precise but can represent values closer to zero.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see GLSL isnan man page\n\t/// @see GLSL 4.20.8 specification, section 8.3 Common Functions\n\ttemplate\n\tGLM_FUNC_DECL typename genType::bool_type isdenormal(genType const& x);\n\n\t/// Similar to 'mod' but with a different rounding and integer support.\n\t/// Returns 'x - y * trunc(x/y)' instead of 'x - y * floor(x/y)'\n\t///\n\t/// @see GLSL mod vs HLSL fmod\n\t/// @see GLSL mod man page\n\ttemplate\n\tGLM_FUNC_DECL vec fmod(vec const& v);\n\n\t/// Returns whether vector components values are within an interval. A open interval excludes its endpoints, and is denoted with square brackets.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_vector_relational\n\ttemplate \n\tGLM_FUNC_DECL vec openBounded(vec const& Value, vec const& Min, vec const& Max);\n\n\t/// Returns whether vector components values are within an interval. A closed interval includes its endpoints, and is denoted with square brackets.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see ext_vector_relational\n\ttemplate \n\tGLM_FUNC_DECL vec closeBounded(vec const& Value, vec const& Min, vec const& Max);\n\n\t/// @}\n}//namespace glm\n\n#include \"common.inl\"\n"}, {"path": "includes/glm/gtx/compatibility.hpp", "language": "code", "loc": 112, "comment_density": 0.83, "code": "/// @ref gtx_compatibility\n/// @file glm/gtx/compatibility.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_compatibility GLM_GTX_compatibility\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Provide functions to increase the compatibility with Cg and HLSL languages\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_compatibility is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_compatibility extension included\")\n#endif\n\n#if GLM_COMPILER & GLM_COMPILER_VC\n#\tinclude \n#elif GLM_COMPILER & GLM_COMPILER_GCC\n#\tinclude \n#\tif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)\n#\t\tundef isfinite\n#\tendif\n#endif//GLM_COMPILER\n\nnamespace glm\n{\n\t/// @addtogroup gtx_compatibility\n\t/// @{\n\n\ttemplate GLM_FUNC_QUALIFIER T lerp(T x, T y, T a){return mix(x, y, a);}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//!< \\brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<2, T, Q> lerp(const vec<2, T, Q>& x, const vec<2, T, Q>& y, T a){return mix(x, y, a);}\t\t\t\t\t\t\t//!< \\brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\n\ttemplate GLM_FUNC_QUALIFIER vec<3, T, Q> lerp(const vec<3, T, Q>& x, const vec<3, T, Q>& y, T a){return mix(x, y, a);}\t\t\t\t\t\t\t//!< \\brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<4, T, Q> lerp(const vec<4, T, Q>& x, const vec<4, T, Q>& y, T a){return mix(x, y, a);}\t\t\t\t\t\t\t//!< \\brief Returns x * (1.0 - a) + y * a, i.e., the linear blend of x and y using the floating-point value a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<2, T, Q> lerp(const vec<2, T, Q>& x, const vec<2, T, Q>& y, const vec<2, T, Q>& a){return mix(x, y, a);}\t//!< \\brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<3, T, Q> lerp(const vec<3, T, Q>& x, const vec<3, T, Q>& y, const vec<3, T, Q>& a){return mix(x, y, a);}\t//!< \\brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<4, T, Q> lerp(const vec<4, T, Q>& x, const vec<4, T, Q>& y, const vec<4, T, Q>& a){return mix(x, y, a);}\t//!< \\brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility)\n\n\ttemplate GLM_FUNC_QUALIFIER T saturate(T x){return clamp(x, T(0), T(1));}\t\t\t\t\t\t\t\t\t\t\t\t\t\t//!< \\brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<2, T, Q> saturate(const vec<2, T, Q>& x){return clamp(x, T(0), T(1));}\t\t\t\t\t//!< \\brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<3, T, Q> saturate(const vec<3, T, Q>& x){return clamp(x, T(0), T(1));}\t\t\t\t\t//!< \\brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<4, T, Q> saturate(const vec<4, T, Q>& x){return clamp(x, T(0), T(1));}\t\t\t\t\t//!< \\brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility)\n\n\ttemplate GLM_FUNC_QUALIFIER T atan2(T x, T y){return atan(x, y);}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//!< \\brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<2, T, Q> atan2(const vec<2, T, Q>& x, const vec<2, T, Q>& y){return atan(x, y);}\t//!< \\brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<3, T, Q> atan2(const vec<3, T, Q>& x, const vec<3, T, Q>& y){return atan(x, y);}\t//!< \\brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_QUALIFIER vec<4, T, Q> atan2(const vec<4, T, Q>& x, const vec<4, T, Q>& y){return atan(x, y);}\t//!< \\brief Arc tangent. Returns an angle whose tangent is y/x. The signs of x and y are used to determine what quadrant the angle is in. The range of values returned by this function is [-PI, PI]. Results are undefined if x and y are both 0. (From GLM_GTX_compatibility)\n\n\ttemplate GLM_FUNC_DECL bool isfinite(genType const& x);\t\t\t\t\t\t\t\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_DECL vec<1, bool, Q> isfinite(const vec<1, T, Q>& x);\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_DECL vec<2, bool, Q> isfinite(const vec<2, T, Q>& x);\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_DECL vec<3, bool, Q> isfinite(const vec<3, T, Q>& x);\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\ttemplate GLM_FUNC_DECL vec<4, bool, Q> isfinite(const vec<4, T, Q>& x);\t\t\t\t//!< \\brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility)\n\n\ttypedef bool\t\t\t\t\t\tbool1;\t\t\t//!< \\brief boolean type with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef vec<2, bool, highp>\t\t\tbool2;\t\t\t//!< \\brief boolean type with 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<3, bool, highp>\t\t\tbool3;\t\t\t//!< \\brief boolean type with 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<4, bool, highp>\t\t\tbool4;\t\t\t//!< \\brief boolean type with 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef bool\t\t\t\t\t\tbool1x1;\t\t//!< \\brief boolean matrix with 1 x 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 2, bool, highp>\t\tbool2x2;\t\t//!< \\brief boolean matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 3, bool, highp>\t\tbool2x3;\t\t//!< \\brief boolean matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 4, bool, highp>\t\tbool2x4;\t\t//!< \\brief boolean matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 2, bool, highp>\t\tbool3x2;\t\t//!< \\brief boolean matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 3, bool, highp>\t\tbool3x3;\t\t//!< \\brief boolean matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 4, bool, highp>\t\tbool3x4;\t\t//!< \\brief boolean matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 2, bool, highp>\t\tbool4x2;\t\t//!< \\brief boolean matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 3, bool, highp>\t\tbool4x3;\t\t//!< \\brief boolean matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 4, bool, highp>\t\tbool4x4;\t\t//!< \\brief boolean matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef int\t\t\t\t\t\t\tint1;\t\t\t//!< \\brief integer vector with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef vec<2, int, highp>\t\t\tint2;\t\t\t//!< \\brief integer vector with 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<3, int, highp>\t\t\tint3;\t\t\t//!< \\brief integer vector with 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<4, int, highp>\t\t\tint4;\t\t\t//!< \\brief integer vector with 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef int\t\t\t\t\t\t\tint1x1;\t\t\t//!< \\brief integer matrix with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 2, int, highp>\t\tint2x2;\t\t\t//!< \\brief integer matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 3, int, highp>\t\tint2x3;\t\t\t//!< \\brief integer matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 4, int, highp>\t\tint2x4;\t\t\t//!< \\brief integer matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 2, int, highp>\t\tint3x2;\t\t\t//!< \\brief integer matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 3, int, highp>\t\tint3x3;\t\t\t//!< \\brief integer matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 4, int, highp>\t\tint3x4;\t\t\t//!< \\brief integer matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 2, int, highp>\t\tint4x2;\t\t\t//!< \\brief integer matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 3, int, highp>\t\tint4x3;\t\t\t//!< \\brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 4, int, highp>\t\tint4x4;\t\t\t//!< \\brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef float\t\t\t\t\t\tfloat1;\t\t\t//!< \\brief single-qualifier floating-point vector with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef vec<2, float, highp>\t\tfloat2;\t\t\t//!< \\brief single-qualifier floating-point vector with 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<3, float, highp>\t\tfloat3;\t\t\t//!< \\brief single-qualifier floating-point vector with 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<4, float, highp>\t\tfloat4;\t\t\t//!< \\brief single-qualifier floating-point vector with 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef float\t\t\t\t\t\tfloat1x1;\t\t//!< \\brief single-qualifier floating-point matrix with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 2, float, highp>\t\tfloat2x2;\t\t//!< \\brief single-qualifier floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 3, float, highp>\t\tfloat2x3;\t\t//!< \\brief single-qualifier floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 4, float, highp>\t\tfloat2x4;\t\t//!< \\brief single-qualifier floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 2, float, highp>\t\tfloat3x2;\t\t//!< \\brief single-qualifier floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 3, float, highp>\t\tfloat3x3;\t\t//!< \\brief single-qualifier floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 4, float, highp>\t\tfloat3x4;\t\t//!< \\brief single-qualifier floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 2, float, highp>\t\tfloat4x2;\t\t//!< \\brief single-qualifier floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 3, float, highp>\t\tfloat4x3;\t\t//!< \\brief single-qualifier floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 4, float, highp>\t\tfloat4x4;\t\t//!< \\brief single-qualifier floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef double\t\t\t\t\t\tdouble1;\t\t//!< \\brief double-qualifier floating-point vector with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef vec<2, double, highp>\t\tdouble2;\t\t//!< \\brief double-qualifier floating-point vector with 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<3, double, highp>\t\tdouble3;\t\t//!< \\brief double-qualifier floating-point vector with 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef vec<4, double, highp>\t\tdouble4;\t\t//!< \\brief double-qualifier floating-point vector with 4 components. (From GLM_GTX_compatibility extension)\n\n\ttypedef double\t\t\t\t\t\tdouble1x1;\t\t//!< \\brief double-qualifier floating-point matrix with 1 component. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 2, double, highp>\t\tdouble2x2;\t\t//!< \\brief double-qualifier floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 3, double, highp>\t\tdouble2x3;\t\t//!< \\brief double-qualifier floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<2, 4, double, highp>\t\tdouble2x4;\t\t//!< \\brief double-qualifier floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 2, double, highp>\t\tdouble3x2;\t\t//!< \\brief double-qualifier floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 3, double, highp>\t\tdouble3x3;\t\t//!< \\brief double-qualifier floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<3, 4, double, highp>\t\tdouble3x4;\t\t//!< \\brief double-qualifier floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 2, double, highp>\t\tdouble4x2;\t\t//!< \\brief double-qualifier floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 3, double, highp>\t\tdouble4x3;\t\t//!< \\brief double-qualifier floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension)\n\ttypedef mat<4, 4, double, highp>\t\tdouble4x4;\t\t//!< \\brief double-qualifier floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension)\n\n\t/// @}\n}//namespace glm\n\n#include \"compatibility.inl\"\n"}, {"path": "includes/glm/gtx/component_wise.hpp", "language": "code", "loc": 56, "comment_density": 0.571, "code": "/// @ref gtx_component_wise\n/// @file glm/gtx/component_wise.hpp\n/// @date 2007-05-21 / 2011-06-07\n/// @author Christophe Riccio\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_component_wise GLM_GTX_component_wise\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Operations between components of a type\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_component_wise is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_component_wise extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_component_wise\n\t/// @{\n\n\t/// Convert an integer vector to a normalized float vector.\n\t/// If the parameter value type is already a floating qualifier type, the value is passed through.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL vec compNormalize(vec const& v);\n\n\t/// Convert a normalized float vector to an integer vector.\n\t/// If the parameter value type is already a floating qualifier type, the value is passed through.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL vec compScale(vec const& v);\n\n\t/// Add all vector components together.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type compAdd(genType const& v);\n\n\t/// Multiply all vector components together.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type compMul(genType const& v);\n\n\t/// Find the minimum value between single vector components.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type compMin(genType const& v);\n\n\t/// Find the maximum value between single vector components.\n\t/// @see gtx_component_wise\n\ttemplate\n\tGLM_FUNC_DECL typename genType::value_type compMax(genType const& v);\n\n\t/// @}\n}//namespace glm\n\n#include \"component_wise.inl\"\n"}, {"path": "includes/glm/gtx/dual_quaternion.hpp", "language": "code", "loc": 209, "comment_density": 0.431, "code": "/// @ref gtx_dual_quaternion\n/// @file glm/gtx/dual_quaternion.hpp\n/// @author Maksim Vorobiev (msomeone@gmail.com)\n///\n/// @see core (dependence)\n/// @see gtc_constants (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_dual_quaternion GLM_GTX_dual_quaternion\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines a templated dual-quaternion type and several dual-quaternion operations.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/constants.hpp\"\n#include \"../gtc/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_dual_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_dual_quaternion extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_dual_quaternion\n\t/// @{\n\n\ttemplate\n\tstruct tdualquat\n\t{\n\t\t// -- Implementation detail --\n\n\t\ttypedef T value_type;\n\t\ttypedef qua part_type;\n\n\t\t// -- Data --\n\n\t\tqua real, dual;\n\n\t\t// -- Component accesses --\n\n\t\ttypedef length_t length_type;\n\t\t/// Return the count of components of a dual quaternion\n\t\tGLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 2;}\n\n\t\tGLM_FUNC_DECL part_type & operator[](length_type i);\n\t\tGLM_FUNC_DECL part_type const& operator[](length_type i) const;\n\n\t\t// -- Implicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT;\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const& d) GLM_DEFAULT;\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const& d);\n\n\t\t// -- Explicit basic constructors --\n\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(qua const& real);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(qua const& orientation, vec<3, T, Q> const& translation);\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR tdualquat(qua const& real, qua const& dual);\n\n\t\t// -- Conversion constructors --\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tdualquat(tdualquat const& q);\n\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR tdualquat(mat<2, 4, T, Q> const& holder_mat);\n\t\tGLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR tdualquat(mat<3, 4, T, Q> const& aug_mat);\n\n\t\t// -- Unary arithmetic operators --\n\n\t\tGLM_FUNC_DECL tdualquat & operator=(tdualquat const& m) GLM_DEFAULT;\n\n\t\ttemplate\n\t\tGLM_FUNC_DECL tdualquat & operator=(tdualquat const& m);\n\t\ttemplate\n\t\tGLM_FUNC_DECL tdualquat & operator*=(U s);\n\t\ttemplate\n\t\tGLM_FUNC_DECL tdualquat & operator/=(U s);\n\t};\n\n\t// -- Unary bit operators --\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator+(tdualquat const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator-(tdualquat const& q);\n\n\t// -- Binary operators --\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator+(tdualquat const& q, tdualquat const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator*(tdualquat const& q, tdualquat const& p);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> operator*(tdualquat const& q, vec<3, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, tdualquat const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> operator*(tdualquat const& q, vec<4, T, Q> const& v);\n\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, tdualquat const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator*(tdualquat const& q, T const& s);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator*(T const& s, tdualquat const& q);\n\n\ttemplate\n\tGLM_FUNC_DECL tdualquat operator/(tdualquat const& q, T const& s);\n\n\t// -- Boolean operators --\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator==(tdualquat const& q1, tdualquat const& q2);\n\n\ttemplate\n\tGLM_FUNC_DECL bool operator!=(tdualquat const& q1, tdualquat const& q2);\n\n\t/// Creates an identity dual quaternion.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate \n\tGLM_FUNC_DECL tdualquat dual_quat_identity();\n\n\t/// Returns the normalized quaternion.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat normalize(tdualquat const& q);\n\n\t/// Returns the linear interpolation of two dual quaternion.\n\t///\n\t/// @see gtc_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat lerp(tdualquat const& x, tdualquat const& y, T const& a);\n\n\t/// Returns the q inverse.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat inverse(tdualquat const& q);\n\n\t/// Converts a quaternion to a 2 * 4 matrix.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> mat2x4_cast(tdualquat const& x);\n\n\t/// Converts a quaternion to a 3 * 4 matrix.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> mat3x4_cast(tdualquat const& x);\n\n\t/// Converts a 2 * 4 matrix (matrix which holds real and dual parts) to a quaternion.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat dualquat_cast(mat<2, 4, T, Q> const& x);\n\n\t/// Converts a 3 * 4 matrix (augmented matrix rotation + translation) to a quaternion.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttemplate\n\tGLM_FUNC_DECL tdualquat dualquat_cast(mat<3, 4, T, Q> const& x);\n\n\n\t/// Dual-quaternion of low single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\tlowp_dualquat;\n\n\t/// Dual-quaternion of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\tmediump_dualquat;\n\n\t/// Dual-quaternion of high single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\thighp_dualquat;\n\n\n\t/// Dual-quaternion of low single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\tlowp_fdualquat;\n\n\t/// Dual-quaternion of medium single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\tmediump_fdualquat;\n\n\t/// Dual-quaternion of high single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\thighp_fdualquat;\n\n\n\t/// Dual-quaternion of low double-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\t\tlowp_ddualquat;\n\n\t/// Dual-quaternion of medium double-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\tmediump_ddualquat;\n\n\t/// Dual-quaternion of high double-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef tdualquat\thighp_ddualquat;\n\n\n#if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))\n\t/// Dual-quaternion of floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef highp_fdualquat\t\t\tdualquat;\n\n\t/// Dual-quaternion of single-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef highp_fdualquat\t\t\tfdualquat;\n#elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))\n\ttypedef highp_fdualquat\t\t\tdualquat;\n\ttypedef highp_fdualquat\t\t\tfdualquat;\n#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))\n\ttypedef mediump_fdualquat\t\tdualquat;\n\ttypedef mediump_fdualquat\t\tfdualquat;\n#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))\n\ttypedef lowp_fdualquat\t\t\tdualquat;\n\ttypedef lowp_fdualquat\t\t\tfdualquat;\n#else\n#\terror \"GLM error: multiple default precision requested for single-precision floating-point types\"\n#endif\n\n\n#if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))\n\t/// Dual-quaternion of default double-qualifier floating-point numbers.\n\t///\n\t/// @see gtx_dual_quaternion\n\ttypedef highp_ddualquat\t\t\tddualquat;\n#elif(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))\n\ttypedef highp_ddualquat\t\t\tddualquat;\n#elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))\n\ttypedef mediump_ddualquat\t\tddualquat;\n#elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && defined(GLM_PRECISION_LOWP_DOUBLE))\n\ttypedef lowp_ddualquat\t\t\tddualquat;\n#else\n#\terror \"GLM error: Multiple default precision requested for double-precision floating-point types\"\n#endif\n\n\t/// @}\n} //namespace glm\n\n#include \"dual_quaternion.inl\"\n"}, {"path": "includes/glm/gtx/easing.hpp", "language": "code", "loc": 178, "comment_density": 0.551, "code": "/// @ref gtx_easing\n/// @file glm/gtx/easing.hpp\n/// @author Robert Chisholm\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_easing GLM_GTX_easing\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Easing functions for animations and transitions\n/// All functions take a parameter x in the range [0.0,1.0]\n///\n/// Based on the AHEasing project of Warren Moore (https://github.com/warrenm/AHEasing)\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/constants.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_easing is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_easing extension included\")\n#endif\n\nnamespace glm{\n\t/// @addtogroup gtx_easing\n\t/// @{\n\n\t/// Modelled after the line y = x\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType linearInterpolation(genType const & a);\n\n\t/// Modelled after the parabola y = x^2\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quadraticEaseIn(genType const & a);\n\n\t/// Modelled after the parabola y = -x^2 + 2x\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quadraticEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise quadratic\n\t/// y = (1/2)((2x)^2)\t\t\t\t; [0, 0.5)\n\t/// y = -(1/2)((2x-1)*(2x-3) - 1)\t; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quadraticEaseInOut(genType const & a);\n\n\t/// Modelled after the cubic y = x^3\n\ttemplate \n\tGLM_FUNC_DECL genType cubicEaseIn(genType const & a);\n\n\t/// Modelled after the cubic y = (x - 1)^3 + 1\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType cubicEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise cubic\n\t/// y = (1/2)((2x)^3)\t\t; [0, 0.5)\n\t/// y = (1/2)((2x-2)^3 + 2)\t; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType cubicEaseInOut(genType const & a);\n\n\t/// Modelled after the quartic x^4\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quarticEaseIn(genType const & a);\n\n\t/// Modelled after the quartic y = 1 - (x - 1)^4\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quarticEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise quartic\n\t/// y = (1/2)((2x)^4)\t\t\t; [0, 0.5)\n\t/// y = -(1/2)((2x-2)^4 - 2)\t; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quarticEaseInOut(genType const & a);\n\n\t/// Modelled after the quintic y = x^5\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quinticEaseIn(genType const & a);\n\n\t/// Modelled after the quintic y = (x - 1)^5 + 1\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quinticEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise quintic\n\t/// y = (1/2)((2x)^5)\t\t; [0, 0.5)\n\t/// y = (1/2)((2x-2)^5 + 2) ; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType quinticEaseInOut(genType const & a);\n\n\t/// Modelled after quarter-cycle of sine wave\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType sineEaseIn(genType const & a);\n\n\t/// Modelled after quarter-cycle of sine wave (different phase)\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType sineEaseOut(genType const & a);\n\n\t/// Modelled after half sine wave\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType sineEaseInOut(genType const & a);\n\n\t/// Modelled after shifted quadrant IV of unit circle\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType circularEaseIn(genType const & a);\n\n\t/// Modelled after shifted quadrant II of unit circle\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType circularEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise circular function\n\t/// y = (1/2)(1 - sqrt(1 - 4x^2))\t\t\t; [0, 0.5)\n\t/// y = (1/2)(sqrt(-(2x - 3)*(2x - 1)) + 1) ; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType circularEaseInOut(genType const & a);\n\n\t/// Modelled after the exponential function y = 2^(10(x - 1))\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType exponentialEaseIn(genType const & a);\n\n\t/// Modelled after the exponential function y = -2^(-10x) + 1\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType exponentialEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise exponential\n\t/// y = (1/2)2^(10(2x - 1))\t\t\t; [0,0.5)\n\t/// y = -(1/2)*2^(-10(2x - 1))) + 1 ; [0.5,1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType exponentialEaseInOut(genType const & a);\n\n\t/// Modelled after the damped sine wave y = sin(13pi/2*x)*pow(2, 10 * (x - 1))\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType elasticEaseIn(genType const & a);\n\n\t/// Modelled after the damped sine wave y = sin(-13pi/2*(x + 1))*pow(2, -10x) + 1\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType elasticEaseOut(genType const & a);\n\n\t/// Modelled after the piecewise exponentially-damped sine wave:\n\t/// y = (1/2)*sin(13pi/2*(2*x))*pow(2, 10 * ((2*x) - 1))\t\t; [0,0.5)\n\t/// y = (1/2)*(sin(-13pi/2*((2x-1)+1))*pow(2,-10(2*x-1)) + 2)\t; [0.5, 1]\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType elasticEaseInOut(genType const & a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseIn(genType const& a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseOut(genType const& a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseInOut(genType const& a);\n\n\t/// @param a parameter\n\t/// @param o Optional overshoot modifier\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseIn(genType const& a, genType const& o);\n\n\t/// @param a parameter\n\t/// @param o Optional overshoot modifier\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseOut(genType const& a, genType const& o);\n\n\t/// @param a parameter\n\t/// @param o Optional overshoot modifier\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType backEaseInOut(genType const& a, genType const& o);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType bounceEaseIn(genType const& a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType bounceEaseOut(genType const& a);\n\n\t/// @see gtx_easing\n\ttemplate \n\tGLM_FUNC_DECL genType bounceEaseInOut(genType const& a);\n\n\t/// @}\n}//namespace glm\n\n#include \"easing.inl\"\n"}, {"path": "includes/glm/gtx/euler_angles.hpp", "language": "code", "loc": 287, "comment_density": 0.352, "code": "/// @ref gtx_euler_angles\n/// @file glm/gtx/euler_angles.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_euler_angles GLM_GTX_euler_angles\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Build matrices from Euler angles.\n///\n/// Extraction of Euler angles from rotation matrix.\n/// Based on the original paper 2014 Mike Day - Extracting Euler Angles from a Rotation Matrix.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_euler_angles is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_euler_angles extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_euler_angles\n\t/// @{\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle X.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleX(\n\t\tT const& angleX);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Y.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleY(\n\t\tT const& angleY);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Z.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZ(\n\t\tT const& angleZ);\n\n\t/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about X-axis.\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleX(\n\t\tT const & angleX, T const & angularVelocityX);\n\n\t/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about Y-axis.\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleY(\n\t\tT const & angleY, T const & angularVelocityY);\n\n\t/// Creates a 3D 4 * 4 homogeneous derived matrix from the rotation matrix about Z-axis.\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> derivedEulerAngleZ(\n\t\tT const & angleZ, T const & angularVelocityZ);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXY(\n\t\tT const& angleX,\n\t\tT const& angleY);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYX(\n\t\tT const& angleY,\n\t\tT const& angleX);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZ(\n\t\tT const& angleX,\n\t\tT const& angleZ);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZX(\n\t\tT const& angle,\n\t\tT const& angleX);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZ(\n\t\tT const& angleY,\n\t\tT const& angleZ);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZY(\n\t\tT const& angleZ,\n\t\tT const& angleY);\n\n /// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y * Z).\n /// @see gtx_euler_angles\n template\n GLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXYZ(\n T const& t1,\n T const& t2,\n T const& t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYXZ(\n\t\tT const& yaw,\n\t\tT const& pitch,\n\t\tT const& roll);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z * X).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZX(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y * X).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXYX(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Y).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYXY(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z * Y).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZY(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y * Z).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZYZ(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZXZ(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z * Y).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleXZY(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z * X).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleYZX(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y * X).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZYX(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X * Y).\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> eulerAngleZXY(\n\t\tT const & t1,\n\t\tT const & t2,\n\t\tT const & t3);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, defaultp> yawPitchRoll(\n\t\tT const& yaw,\n\t\tT const& pitch,\n\t\tT const& roll);\n\n\t/// Creates a 2D 2 * 2 rotation matrix from an euler angle.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, defaultp> orientate2(T const& angle);\n\n\t/// Creates a 2D 4 * 4 homogeneous rotation matrix from an euler angle.\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, defaultp> orientate3(T const& angle);\n\n\t/// Creates a 3D 3 * 3 rotation matrix from euler angles (Y * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> orientate3(vec<3, T, Q> const& angles);\n\n\t/// Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z).\n\t/// @see gtx_euler_angles\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> orientate4(vec<3, T, Q> const& angles);\n\n /// Extracts the (X * Y * Z) Euler angles from the rotation matrix M\n /// @see gtx_euler_angles\n template\n GLM_FUNC_DECL void extractEulerAngleXYZ(mat<4, 4, T, defaultp> const& M,\n T & t1,\n T & t2,\n T & t3);\n\n\t/// Extracts the (Y * X * Z) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleYXZ(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (X * Z * X) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleXZX(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (X * Y * X) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleXYX(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Y * X * Y) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleYXY(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Y * Z * Y) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleYZY(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Z * Y * Z) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleZYZ(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Z * X * Z) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleZXZ(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (X * Z * Y) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleXZY(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Y * Z * X) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleYZX(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Z * Y * X) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleZYX(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// Extracts the (Z * X * Y) Euler angles from the rotation matrix M\n\t/// @see gtx_euler_angles\n\ttemplate \n\tGLM_FUNC_DECL void extractEulerAngleZXY(mat<4, 4, T, defaultp> const & M,\n\t\t\t\t\t\t\t\t\t\t\tT & t1,\n\t\t\t\t\t\t\t\t\t\t\tT & t2,\n\t\t\t\t\t\t\t\t\t\t\tT & t3);\n\n\t/// @}\n}//namespace glm\n\n#include \"euler_angles.inl\"\n"}, {"path": "includes/glm/gtx/extend.hpp", "language": "code", "loc": 34, "comment_density": 0.529, "code": "/// @ref gtx_extend\n/// @file glm/gtx/extend.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_extend GLM_GTX_extend\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Extend a position from a source to a position at a defined length.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_extend extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_extend\n\t/// @{\n\n\t/// Extends of Length the Origin position using the (Source - Origin) direction.\n\t/// @see gtx_extend\n\ttemplate\n\tGLM_FUNC_DECL genType extend(\n\t\tgenType const& Origin,\n\t\tgenType const& Source,\n\t\ttypename genType::value_type const Length);\n\n\t/// @}\n}//namespace glm\n\n#include \"extend.inl\"\n"}, {"path": "includes/glm/gtx/extended_min_max.hpp", "language": "code", "loc": 157, "comment_density": 0.446, "code": "/// @ref gtx_extended_min_max\n/// @file glm/gtx/extended_min_max.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_extended_min_max GLM_GTX_extended_min_max\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Min and max functions for 3 to 4 parameters.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_extended_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_extended_min_max extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_extended_min_max\n\t/// @{\n\n\t/// Return the minimum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL T min(\n\t\tT const& x,\n\t\tT const& y,\n\t\tT const& z);\n\n\t/// Return the minimum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C min(\n\t\tC const& x,\n\t\ttypename C::T const& y,\n\t\ttypename C::T const& z);\n\n\t/// Return the minimum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C min(\n\t\tC const& x,\n\t\tC const& y,\n\t\tC const& z);\n\n\t/// Return the minimum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL T min(\n\t\tT const& x,\n\t\tT const& y,\n\t\tT const& z,\n\t\tT const& w);\n\n\t/// Return the minimum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C min(\n\t\tC const& x,\n\t\ttypename C::T const& y,\n\t\ttypename C::T const& z,\n\t\ttypename C::T const& w);\n\n\t/// Return the minimum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C min(\n\t\tC const& x,\n\t\tC const& y,\n\t\tC const& z,\n\t\tC const& w);\n\n\t/// Return the maximum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL T max(\n\t\tT const& x,\n\t\tT const& y,\n\t\tT const& z);\n\n\t/// Return the maximum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C max(\n\t\tC const& x,\n\t\ttypename C::T const& y,\n\t\ttypename C::T const& z);\n\n\t/// Return the maximum component-wise values of 3 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C max(\n\t\tC const& x,\n\t\tC const& y,\n\t\tC const& z);\n\n\t/// Return the maximum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL T max(\n\t\tT const& x,\n\t\tT const& y,\n\t\tT const& z,\n\t\tT const& w);\n\n\t/// Return the maximum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C max(\n\t\tC const& x,\n\t\ttypename C::T const& y,\n\t\ttypename C::T const& z,\n\t\ttypename C::T const& w);\n\n\t/// Return the maximum component-wise values of 4 inputs\n\t/// @see gtx_extended_min_max\n\ttemplate class C>\n\tGLM_FUNC_DECL C max(\n\t\tC const& x,\n\t\tC const& y,\n\t\tC const& z,\n\t\tC const& w);\n\n\t/// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam genType Floating-point or integer; scalar or vector types.\n\t///\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL genType fmin(genType x, genType y);\n\n\t/// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam genType Floating-point; scalar or vector types.\n\t///\n\t/// @see gtx_extended_min_max\n\t/// @see std::fmax documentation\n\ttemplate\n\tGLM_FUNC_DECL genType fmax(genType x, genType y);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam genType Floating-point scalar or vector types.\n\t///\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL genType fclamp(genType x, genType minVal, genType maxVal);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec fclamp(vec const& x, T minVal, T maxVal);\n\n\t/// Returns min(max(x, minVal), maxVal) for each component in x. If one of the two arguments is NaN, the value of the other argument is returned.\n\t///\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see gtx_extended_min_max\n\ttemplate\n\tGLM_FUNC_DECL vec fclamp(vec const& x, vec const& minVal, vec const& maxVal);\n\n\n\t/// @}\n}//namespace glm\n\n#include \"extended_min_max.inl\"\n"}, {"path": "includes/glm/gtx/exterior_product.hpp", "language": "code", "loc": 34, "comment_density": 0.676, "code": "/// @ref gtx_exterior_product\n/// @file glm/gtx/exterior_product.hpp\n///\n/// @see core (dependence)\n/// @see gtx_exterior_product (dependence)\n///\n/// @defgroup gtx_exterior_product GLM_GTX_exterior_product\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// @brief Allow to perform bit operations on integer values\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_exterior_product extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_exterior_product\n\t/// @{\n\n\t/// Returns the cross product of x and y.\n\t///\n\t/// @tparam T Floating-point scalar types\n\t/// @tparam Q Value from qualifier enum\n\t///\n\t/// @see Exterior product\n\ttemplate\n\tGLM_FUNC_DECL T cross(vec<2, T, Q> const& v, vec<2, T, Q> const& u);\n\n\t/// @}\n} //namespace glm\n\n#include \"exterior_product.inl\"\n"}, {"path": "includes/glm/gtx/fast_exponential.hpp", "language": "code", "loc": 76, "comment_density": 0.539, "code": "/// @ref gtx_fast_exponential\n/// @file glm/gtx/fast_exponential.hpp\n///\n/// @see core (dependence)\n/// @see gtx_half_float (dependence)\n///\n/// @defgroup gtx_fast_exponential GLM_GTX_fast_exponential\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Fast but less accurate implementations of exponential based functions.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_fast_exponential is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_fast_exponential extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_fast_exponential\n\t/// @{\n\n\t/// Faster than the common pow function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL genType fastPow(genType x, genType y);\n\n\t/// Faster than the common pow function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastPow(vec const& x, vec const& y);\n\n\t/// Faster than the common pow function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL genTypeT fastPow(genTypeT x, genTypeU y);\n\n\t/// Faster than the common pow function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastPow(vec const& x);\n\n\t/// Faster than the common exp function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL T fastExp(T x);\n\n\t/// Faster than the common exp function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastExp(vec const& x);\n\n\t/// Faster than the common log function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL T fastLog(T x);\n\n\t/// Faster than the common exp2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastLog(vec const& x);\n\n\t/// Faster than the common exp2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL T fastExp2(T x);\n\n\t/// Faster than the common exp2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastExp2(vec const& x);\n\n\t/// Faster than the common log2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL T fastLog2(T x);\n\n\t/// Faster than the common log2 function but less accurate.\n\t/// @see gtx_fast_exponential\n\ttemplate\n\tGLM_FUNC_DECL vec fastLog2(vec const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"fast_exponential.inl\"\n"}, {"path": "includes/glm/gtx/fast_square_root.hpp", "language": "code", "loc": 76, "comment_density": 0.592, "code": "/// @ref gtx_fast_square_root\n/// @file glm/gtx/fast_square_root.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_fast_square_root GLM_GTX_fast_square_root\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Fast but less accurate implementations of square root based functions.\n/// - Sqrt optimisation based on Newton's method,\n/// www.gamedev.net/community/forums/topic.asp?topic id=139956\n\n#pragma once\n\n// Dependency:\n#include \"../common.hpp\"\n#include \"../exponential.hpp\"\n#include \"../geometric.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_fast_square_root is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_fast_square_root extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_fast_square_root\n\t/// @{\n\n\t/// Faster than the common sqrt function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastSqrt(genType x);\n\n\t/// Faster than the common sqrt function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL vec fastSqrt(vec const& x);\n\n\t/// Faster than the common inversesqrt function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastInverseSqrt(genType x);\n\n\t/// Faster than the common inversesqrt function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL vec fastInverseSqrt(vec const& x);\n\n\t/// Faster than the common length function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastLength(genType x);\n\n\t/// Faster than the common length function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastLength(vec const& x);\n\n\t/// Faster than the common distance function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastDistance(genType x, genType y);\n\n\t/// Faster than the common distance function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastDistance(vec const& x, vec const& y);\n\n\t/// Faster than the common normalize function but less accurate.\n\t///\n\t/// @see gtx_fast_square_root extension.\n\ttemplate\n\tGLM_FUNC_DECL genType fastNormalize(genType const& x);\n\n\t/// @}\n}// namespace glm\n\n#include \"fast_square_root.inl\"\n"}, {"path": "includes/glm/gtx/fast_trigonometry.hpp", "language": "code", "loc": 64, "comment_density": 0.578, "code": "/// @ref gtx_fast_trigonometry\n/// @file glm/gtx/fast_trigonometry.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_fast_trigonometry GLM_GTX_fast_trigonometry\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Fast but less accurate implementations of trigonometric functions.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/constants.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_fast_trigonometry is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_fast_trigonometry extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_fast_trigonometry\n\t/// @{\n\n\t/// Wrap an angle to [0 2pi[\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T wrapAngle(T angle);\n\n\t/// Faster than the common sin function but less accurate.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastSin(T angle);\n\n\t/// Faster than the common cos function but less accurate.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastCos(T angle);\n\n\t/// Faster than the common tan function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastTan(T angle);\n\n\t/// Faster than the common asin function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastAsin(T angle);\n\n\t/// Faster than the common acos function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastAcos(T angle);\n\n\t/// Faster than the common atan function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastAtan(T y, T x);\n\n\t/// Faster than the common atan function but less accurate.\n\t/// Defined between -2pi and 2pi.\n\t/// From GLM_GTX_fast_trigonometry extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastAtan(T angle);\n\n\t/// @}\n}//namespace glm\n\n#include \"fast_trigonometry.inl\"\n"}, {"path": "includes/glm/gtx/functions.hpp", "language": "code", "loc": 43, "comment_density": 0.535, "code": "/// @ref gtx_functions\n/// @file glm/gtx/functions.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_functions GLM_GTX_functions\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// List of useful common functions.\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n#include \"../detail/qualifier.hpp\"\n#include \"../detail/type_vec2.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_functions extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_functions\n\t/// @{\n\n\t/// 1D gauss function\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL T gauss(\n\t\tT x,\n\t\tT ExpectedValue,\n\t\tT StandardDeviation);\n\n\t/// 2D gauss function\n\t///\n\t/// @see gtc_epsilon\n\ttemplate\n\tGLM_FUNC_DECL T gauss(\n\t\tvec<2, T, Q> const& Coord,\n\t\tvec<2, T, Q> const& ExpectedValue,\n\t\tvec<2, T, Q> const& StandardDeviation);\n\n\t/// @}\n}//namespace glm\n\n#include \"functions.inl\"\n\n"}, {"path": "includes/glm/gtx/gradient_paint.hpp", "language": "code", "loc": 44, "comment_density": 0.477, "code": "/// @ref gtx_gradient_paint\n/// @file glm/gtx/gradient_paint.hpp\n///\n/// @see core (dependence)\n/// @see gtx_optimum_pow (dependence)\n///\n/// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Functions that return the color of procedural gradient for specific coordinates.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/optimum_pow.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_gradient_paint is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_gradient_paint extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_gradient_paint\n\t/// @{\n\n\t/// Return a color from a radial gradient.\n\t/// @see - gtx_gradient_paint\n\ttemplate\n\tGLM_FUNC_DECL T radialGradient(\n\t\tvec<2, T, Q> const& Center,\n\t\tT const& Radius,\n\t\tvec<2, T, Q> const& Focal,\n\t\tvec<2, T, Q> const& Position);\n\n\t/// Return a color from a linear gradient.\n\t/// @see - gtx_gradient_paint\n\ttemplate\n\tGLM_FUNC_DECL T linearGradient(\n\t\tvec<2, T, Q> const& Point0,\n\t\tvec<2, T, Q> const& Point1,\n\t\tvec<2, T, Q> const& Position);\n\n\t/// @}\n}// namespace glm\n\n#include \"gradient_paint.inl\"\n"}, {"path": "includes/glm/gtx/handed_coordinate_space.hpp", "language": "code", "loc": 41, "comment_density": 0.488, "code": "/// @ref gtx_handed_coordinate_space\n/// @file glm/gtx/handed_coordinate_space.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// To know if a set of three basis vectors defines a right or left-handed coordinate system.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_handed_coordinate_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_handed_coordinate_space extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_handed_coordinate_space\n\t/// @{\n\n\t//! Return if a trihedron right handed or not.\n\t//! From GLM_GTX_handed_coordinate_space extension.\n\ttemplate\n\tGLM_FUNC_DECL bool rightHanded(\n\t\tvec<3, T, Q> const& tangent,\n\t\tvec<3, T, Q> const& binormal,\n\t\tvec<3, T, Q> const& normal);\n\n\t//! Return if a trihedron left handed or not.\n\t//! From GLM_GTX_handed_coordinate_space extension.\n\ttemplate\n\tGLM_FUNC_DECL bool leftHanded(\n\t\tvec<3, T, Q> const& tangent,\n\t\tvec<3, T, Q> const& binormal,\n\t\tvec<3, T, Q> const& normal);\n\n\t/// @}\n}// namespace glm\n\n#include \"handed_coordinate_space.inl\"\n"}, {"path": "includes/glm/gtx/hash.hpp", "language": "code", "loc": 113, "comment_density": 0.106, "code": "/// @ref gtx_hash\n/// @file glm/gtx/hash.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_hash GLM_GTX_hash\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add std::hash support for glm types\n\n#pragma once\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_hash is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#include \n\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../gtc/vec1.hpp\"\n\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtx/dual_quaternion.hpp\"\n\n#include \"../mat2x2.hpp\"\n#include \"../mat2x3.hpp\"\n#include \"../mat2x4.hpp\"\n\n#include \"../mat3x2.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../mat3x4.hpp\"\n\n#include \"../mat4x2.hpp\"\n#include \"../mat4x3.hpp\"\n#include \"../mat4x4.hpp\"\n\n#if !GLM_HAS_CXX11_STL\n#\terror \"GLM_GTX_hash requires C++11 standard library support\"\n#endif\n\nnamespace std\n{\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const;\n\t};\n\n\ttemplate\n\tstruct hash>\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::tquat const& q) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::tdualquat const& q) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const;\n\t};\n\n\ttemplate\n\tstruct hash >\n\t{\n\t\tGLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const;\n\t};\n} // namespace std\n\n#include \"hash.inl\"\n"}, {"path": "includes/glm/gtx/integer.hpp", "language": "code", "loc": 59, "comment_density": 0.61, "code": "/// @ref gtx_integer\n/// @file glm/gtx/integer.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_integer GLM_GTX_integer\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add support for integer for core functions\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/integer.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_integer is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_integer extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_integer\n\t/// @{\n\n\t//! Returns x raised to the y power.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL int pow(int x, uint y);\n\n\t//! Returns the positive square root of x.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL int sqrt(int x);\n\n\t//! Returns the floor log2 of x.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL unsigned int floor_log2(unsigned int x);\n\n\t//! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL int mod(int x, int y);\n\n\t//! Return the factorial value of a number (!12 max, integer only)\n\t//! From GLM_GTX_integer extension.\n\ttemplate\n\tGLM_FUNC_DECL genType factorial(genType const& x);\n\n\t//! 32bit signed integer.\n\t//! From GLM_GTX_integer extension.\n\ttypedef signed int\t\t\t\t\tsint;\n\n\t//! Returns x raised to the y power.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL uint pow(uint x, uint y);\n\n\t//! Returns the positive square root of x.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL uint sqrt(uint x);\n\n\t//! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL uint mod(uint x, uint y);\n\n\t//! Returns the number of leading zeros.\n\t//! From GLM_GTX_integer extension.\n\tGLM_FUNC_DECL uint nlz(uint x);\n\n\t/// @}\n}//namespace glm\n\n#include \"integer.inl\"\n"}, {"path": "includes/glm/gtx/intersect.hpp", "language": "code", "loc": 79, "comment_density": 0.405, "code": "/// @ref gtx_intersect\n/// @file glm/gtx/intersect.hpp\n///\n/// @see core (dependence)\n/// @see gtx_closest_point (dependence)\n///\n/// @defgroup gtx_intersect GLM_GTX_intersect\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add intersection functions\n\n#pragma once\n\n// Dependency:\n#include \n#include \n#include \"../glm.hpp\"\n#include \"../geometric.hpp\"\n#include \"../gtx/closest_point.hpp\"\n#include \"../gtx/vector_query.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_closest_point extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_intersect\n\t/// @{\n\n\t//! Compute the intersection of a ray and a plane.\n\t//! Ray direction and plane normal must be unit length.\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectRayPlane(\n\t\tgenType const& orig, genType const& dir,\n\t\tgenType const& planeOrig, genType const& planeNormal,\n\t\ttypename genType::value_type & intersectionDistance);\n\n\t//! Compute the intersection of a ray and a triangle.\n\t/// Based om Tomas Möller implementation http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/raytri/\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectRayTriangle(\n\t\tvec<3, T, Q> const& orig, vec<3, T, Q> const& dir,\n\t\tvec<3, T, Q> const& v0, vec<3, T, Q> const& v1, vec<3, T, Q> const& v2,\n\t\tvec<2, T, Q>& baryPosition, T& distance);\n\n\t//! Compute the intersection of a line and a triangle.\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectLineTriangle(\n\t\tgenType const& orig, genType const& dir,\n\t\tgenType const& vert0, genType const& vert1, genType const& vert2,\n\t\tgenType & position);\n\n\t//! Compute the intersection distance of a ray and a sphere.\n\t//! The ray direction vector is unit length.\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectRaySphere(\n\t\tgenType const& rayStarting, genType const& rayNormalizedDirection,\n\t\tgenType const& sphereCenter, typename genType::value_type const sphereRadiusSquared,\n\t\ttypename genType::value_type & intersectionDistance);\n\n\t//! Compute the intersection of a ray and a sphere.\n\t//! From GLM_GTX_intersect extension.\n\ttemplate\n\tGLM_FUNC_DECL bool intersectRaySphere(\n\t\tgenType const& rayStarting, genType const& rayNormalizedDirection,\n\t\tgenType const& sphereCenter, const typename genType::value_type sphereRadius,\n\t\tgenType & intersectionPosition, genType & intersectionNormal);\n\n\t//! Compute the intersection of a line and a sphere.\n\t//! From GLM_GTX_intersect extension\n\ttemplate\n\tGLM_FUNC_DECL bool intersectLineSphere(\n\t\tgenType const& point0, genType const& point1,\n\t\tgenType const& sphereCenter, typename genType::value_type sphereRadius,\n\t\tgenType & intersectionPosition1, genType & intersectionNormal1,\n\t\tgenType & intersectionPosition2 = genType(), genType & intersectionNormal2 = genType());\n\n\t/// @}\n}//namespace glm\n\n#include \"intersect.inl\"\n"}, {"path": "includes/glm/gtx/io.hpp", "language": "code", "loc": 160, "comment_density": 0.181, "code": "/// @ref gtx_io\n/// @file glm/gtx/io.hpp\n/// @author Jan P Springer (regnirpsj@gmail.com)\n///\n/// @see core (dependence)\n/// @see gtc_matrix_access (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_io GLM_GTX_io\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// std::[w]ostream support for glm types\n///\n/// std::[w]ostream support for glm types + qualifier/width/etc. manipulators\n/// based on howard hinnant's std::chrono io proposal\n/// [http://home.roadrunner.com/~hinnant/bloomington/chrono_io.html]\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_io is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n# pragma message(\"GLM: GLM_GTX_io extension included\")\n#endif\n\n#include // std::basic_ostream<> (fwd)\n#include // std::locale, std::locale::facet, std::locale::id\n#include // std::pair<>\n\nnamespace glm\n{\n\t/// @addtogroup gtx_io\n\t/// @{\n\n\tnamespace io\n\t{\n\t\tenum order_type { column_major, row_major};\n\n\t\ttemplate\n\t\tclass format_punct : public std::locale::facet\n\t\t{\n\t\t\ttypedef CTy char_type;\n\n\t\tpublic:\n\n\t\t\tstatic std::locale::id id;\n\n\t\t\tbool formatted;\n\t\t\tunsigned precision;\n\t\t\tunsigned width;\n\t\t\tchar_type separator;\n\t\t\tchar_type delim_left;\n\t\t\tchar_type delim_right;\n\t\t\tchar_type space;\n\t\t\tchar_type newline;\n\t\t\torder_type order;\n\n\t\t\tGLM_FUNC_DECL explicit format_punct(size_t a = 0);\n\t\t\tGLM_FUNC_DECL explicit format_punct(format_punct const&);\n\t\t};\n\n\t\ttemplate >\n\t\tclass basic_state_saver {\n\n\t\tpublic:\n\n\t\t\tGLM_FUNC_DECL explicit basic_state_saver(std::basic_ios&);\n\t\t\tGLM_FUNC_DECL ~basic_state_saver();\n\n\t\tprivate:\n\n\t\t\ttypedef ::std::basic_ios state_type;\n\t\t\ttypedef typename state_type::char_type char_type;\n\t\t\ttypedef ::std::ios_base::fmtflags flags_type;\n\t\t\ttypedef ::std::streamsize streamsize_type;\n\t\t\ttypedef ::std::locale const locale_type;\n\n\t\t\tstate_type& state_;\n\t\t\tflags_type flags_;\n\t\t\tstreamsize_type precision_;\n\t\t\tstreamsize_type width_;\n\t\t\tchar_type fill_;\n\t\t\tlocale_type locale_;\n\n\t\t\tGLM_FUNC_DECL basic_state_saver& operator=(basic_state_saver const&);\n\t\t};\n\n\t\ttypedef basic_state_saver state_saver;\n\t\ttypedef basic_state_saver wstate_saver;\n\n\t\ttemplate >\n\t\tclass basic_format_saver\n\t\t{\n\t\tpublic:\n\n\t\t\tGLM_FUNC_DECL explicit basic_format_saver(std::basic_ios&);\n\t\t\tGLM_FUNC_DECL ~basic_format_saver();\n\n\t\tprivate:\n\n\t\t\tbasic_state_saver const bss_;\n\n\t\t\tGLM_FUNC_DECL basic_format_saver& operator=(basic_format_saver const&);\n\t\t};\n\n\t\ttypedef basic_format_saver format_saver;\n\t\ttypedef basic_format_saver wformat_saver;\n\n\t\tstruct precision\n\t\t{\n\t\t\tunsigned value;\n\n\t\t\tGLM_FUNC_DECL explicit precision(unsigned);\n\t\t};\n\n\t\tstruct width\n\t\t{\n\t\t\tunsigned value;\n\n\t\t\tGLM_FUNC_DECL explicit width(unsigned);\n\t\t};\n\n\t\ttemplate\n\t\tstruct delimiter\n\t\t{\n\t\t\tCTy value[3];\n\n\t\t\tGLM_FUNC_DECL explicit delimiter(CTy /* left */, CTy /* right */, CTy /* separator */ = ',');\n\t\t};\n\n\t\tstruct order\n\t\t{\n\t\t\torder_type value;\n\n\t\t\tGLM_FUNC_DECL explicit order(order_type);\n\t\t};\n\n\t\t// functions, inlined (inline)\n\n\t\ttemplate\n\t\tFTy const& get_facet(std::basic_ios&);\n\t\ttemplate\n\t\tstd::basic_ios& formatted(std::basic_ios&);\n\t\ttemplate\n\t\tstd::basic_ios& unformatted(std::basic_ios&);\n\n\t\ttemplate\n\t\tstd::basic_ostream& operator<<(std::basic_ostream&, precision const&);\n\t\ttemplate\n\t\tstd::basic_ostream& operator<<(std::basic_ostream&, width const&);\n\t\ttemplate\n\t\tstd::basic_ostream& operator<<(std::basic_ostream&, delimiter const&);\n\t\ttemplate\n\t\tstd::basic_ostream& operator<<(std::basic_ostream&, order const&);\n\t}//namespace io\n\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, qua const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<1, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<2, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<3, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, vec<4, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 2, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 3, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<2, 4, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 2, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 3, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<3, 4, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 2, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 3, T, Q> const&);\n\ttemplate\n\tGLM_FUNC_DECL std::basic_ostream& operator<<(std::basic_ostream&, mat<4, 4, T, Q> const&);\n\n template\n\tGLM_FUNC_DECL std::basic_ostream & operator<<(std::basic_ostream &,\n std::pair const, mat<4, 4, T, Q> const> const&);\n\n\t/// @}\n}//namespace glm\n\n#include \"io.inl\"\n"}, {"path": "includes/glm/gtx/log_base.hpp", "language": "code", "loc": 39, "comment_density": 0.513, "code": "/// @ref gtx_log_base\n/// @file glm/gtx/log_base.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_log_base GLM_GTX_log_base\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Logarithm for any base. base can be a vector or a scalar.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_log_base extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_log_base\n\t/// @{\n\n\t/// Logarithm for any base.\n\t/// From GLM_GTX_log_base.\n\ttemplate\n\tGLM_FUNC_DECL genType log(\n\t\tgenType const& x,\n\t\tgenType const& base);\n\n\t/// Logarithm for any base.\n\t/// From GLM_GTX_log_base.\n\ttemplate\n\tGLM_FUNC_DECL vec sign(\n\t\tvec const& x,\n\t\tvec const& base);\n\n\t/// @}\n}//namespace glm\n\n#include \"log_base.inl\"\n"}, {"path": "includes/glm/gtx/matrix_cross_product.hpp", "language": "code", "loc": 38, "comment_density": 0.553, "code": "/// @ref gtx_matrix_cross_product\n/// @file glm/gtx/matrix_cross_product.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Build cross product matrices\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_cross_product extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_cross_product\n\t/// @{\n\n\t//! Build a cross product matrix.\n\t//! From GLM_GTX_matrix_cross_product extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> matrixCross3(\n\t\tvec<3, T, Q> const& x);\n\n\t//! Build a cross product matrix.\n\t//! From GLM_GTX_matrix_cross_product extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> matrixCross4(\n\t\tvec<3, T, Q> const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_cross_product.inl\"\n"}, {"path": "includes/glm/gtx/matrix_decompose.hpp", "language": "code", "loc": 38, "comment_density": 0.474, "code": "/// @ref gtx_matrix_decompose\n/// @file glm/gtx/matrix_decompose.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_decompose GLM_GTX_matrix_decompose\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Decomposes a model matrix to translations, rotation and scale components\n\n#pragma once\n\n// Dependencies\n#include \"../mat4x4.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../geometric.hpp\"\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtc/matrix_transform.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_decompose is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_decompose extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_decompose\n\t/// @{\n\n\t/// Decomposes a model matrix to translations, rotation and scale components\n\t/// @see gtx_matrix_decompose\n\ttemplate\n\tGLM_FUNC_DECL bool decompose(\n\t\tmat<4, 4, T, Q> const& modelMatrix,\n\t\tvec<3, T, Q> & scale, qua & orientation, vec<3, T, Q> & translation, vec<3, T, Q> & skew, vec<4, T, Q> & perspective);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_decompose.inl\"\n"}, {"path": "includes/glm/gtx/matrix_factorisation.hpp", "language": "code", "loc": 57, "comment_density": 0.649, "code": "/// @ref gtx_matrix_factorisation\n/// @file glm/gtx/matrix_factorisation.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_factorisation GLM_GTX_matrix_factorisation\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Functions to factor matrices in various forms\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_factorisation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_factorisation extension included\")\n#endif\n\n/*\nSuggestions:\n - Move helper functions flipud and fliplr to another file: They may be helpful in more general circumstances.\n - Implement other types of matrix factorisation, such as: QL and LQ, L(D)U, eigendecompositions, etc...\n*/\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_factorisation\n\t/// @{\n\n\t/// Flips the matrix rows up and down.\n\t///\n\t/// From GLM_GTX_matrix_factorisation extension.\n\ttemplate \n\tGLM_FUNC_DECL mat flipud(mat const& in);\n\n\t/// Flips the matrix columns right and left.\n\t///\n\t/// From GLM_GTX_matrix_factorisation extension.\n\ttemplate \n\tGLM_FUNC_DECL mat fliplr(mat const& in);\n\n\t/// Performs QR factorisation of a matrix.\n\t/// Returns 2 matrices, q and r, such that the columns of q are orthonormal and span the same subspace than those of the input matrix, r is an upper triangular matrix, and q*r=in.\n\t/// Given an n-by-m input matrix, q has dimensions min(n,m)-by-m, and r has dimensions n-by-min(n,m).\n\t///\n\t/// From GLM_GTX_matrix_factorisation extension.\n\ttemplate \n\tGLM_FUNC_DECL void qr_decompose(mat const& in, mat<(C < R ? C : R), R, T, Q>& q, mat& r);\n\n\t/// Performs RQ factorisation of a matrix.\n\t/// Returns 2 matrices, r and q, such that r is an upper triangular matrix, the rows of q are orthonormal and span the same subspace than those of the input matrix, and r*q=in.\n\t/// Note that in the context of RQ factorisation, the diagonal is seen as starting in the lower-right corner of the matrix, instead of the usual upper-left.\n\t/// Given an n-by-m input matrix, r has dimensions min(n,m)-by-m, and q has dimensions n-by-min(n,m).\n\t///\n\t/// From GLM_GTX_matrix_factorisation extension.\n\ttemplate \n\tGLM_FUNC_DECL void rq_decompose(mat const& in, mat<(C < R ? C : R), R, T, Q>& r, mat& q);\n\n\t/// @}\n}\n\n#include \"matrix_factorisation.inl\"\n"}, {"path": "includes/glm/gtx/matrix_interpolation.hpp", "language": "code", "loc": 49, "comment_density": 0.531, "code": "/// @ref gtx_matrix_interpolation\n/// @file glm/gtx/matrix_interpolation.hpp\n/// @author Ghenadii Ursachi (the.asteroth@gmail.com)\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_interpolation GLM_GTX_matrix_interpolation\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Allows to directly interpolate two matrices.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_interpolation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_interpolation extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_interpolation\n\t/// @{\n\n\t/// Get the axis and angle of the rotation from a matrix.\n\t/// From GLM_GTX_matrix_interpolation extension.\n\ttemplate\n\tGLM_FUNC_DECL void axisAngle(\n\t\tmat<4, 4, T, Q> const& Mat, vec<3, T, Q> & Axis, T & Angle);\n\n\t/// Build a matrix from axis and angle.\n\t/// From GLM_GTX_matrix_interpolation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> axisAngleMatrix(\n\t\tvec<3, T, Q> const& Axis, T const Angle);\n\n\t/// Extracts the rotation part of a matrix.\n\t/// From GLM_GTX_matrix_interpolation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> extractMatrixRotation(\n\t\tmat<4, 4, T, Q> const& Mat);\n\n\t/// Build a interpolation of 4 * 4 matrixes.\n\t/// From GLM_GTX_matrix_interpolation extension.\n\t/// Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> interpolate(\n\t\tmat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2, T const Delta);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_interpolation.inl\"\n"}, {"path": "includes/glm/gtx/matrix_major_storage.hpp", "language": "code", "loc": 100, "comment_density": 0.41, "code": "/// @ref gtx_matrix_major_storage\n/// @file glm/gtx/matrix_major_storage.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_matrix_major_storage GLM_GTX_matrix_major_storage\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Build matrices with specific matrix order, row or column\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_major_storage is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_major_storage extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_major_storage\n\t/// @{\n\n\t//! Build a row major matrix from row vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> rowMajor2(\n\t\tvec<2, T, Q> const& v1,\n\t\tvec<2, T, Q> const& v2);\n\n\t//! Build a row major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> rowMajor2(\n\t\tmat<2, 2, T, Q> const& m);\n\n\t//! Build a row major matrix from row vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> rowMajor3(\n\t\tvec<3, T, Q> const& v1,\n\t\tvec<3, T, Q> const& v2,\n\t\tvec<3, T, Q> const& v3);\n\n\t//! Build a row major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> rowMajor3(\n\t\tmat<3, 3, T, Q> const& m);\n\n\t//! Build a row major matrix from row vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rowMajor4(\n\t\tvec<4, T, Q> const& v1,\n\t\tvec<4, T, Q> const& v2,\n\t\tvec<4, T, Q> const& v3,\n\t\tvec<4, T, Q> const& v4);\n\n\t//! Build a row major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rowMajor4(\n\t\tmat<4, 4, T, Q> const& m);\n\n\t//! Build a column major matrix from column vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> colMajor2(\n\t\tvec<2, T, Q> const& v1,\n\t\tvec<2, T, Q> const& v2);\n\n\t//! Build a column major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> colMajor2(\n\t\tmat<2, 2, T, Q> const& m);\n\n\t//! Build a column major matrix from column vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> colMajor3(\n\t\tvec<3, T, Q> const& v1,\n\t\tvec<3, T, Q> const& v2,\n\t\tvec<3, T, Q> const& v3);\n\n\t//! Build a column major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> colMajor3(\n\t\tmat<3, 3, T, Q> const& m);\n\n\t//! Build a column major matrix from column vectors.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> colMajor4(\n\t\tvec<4, T, Q> const& v1,\n\t\tvec<4, T, Q> const& v2,\n\t\tvec<4, T, Q> const& v3,\n\t\tvec<4, T, Q> const& v4);\n\n\t//! Build a column major matrix from other matrix.\n\t//! From GLM_GTX_matrix_major_storage extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> colMajor4(\n\t\tmat<4, 4, T, Q> const& m);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_major_storage.inl\"\n"}, {"path": "includes/glm/gtx/matrix_operation.hpp", "language": "code", "loc": 84, "comment_density": 0.476, "code": "/// @ref gtx_matrix_operation\n/// @file glm/gtx/matrix_operation.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_operation GLM_GTX_matrix_operation\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Build diagonal matrices from vectors.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_operation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_operation extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_operation\n\t/// @{\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> diagonal2x2(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 3, T, Q> diagonal2x3(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 4, T, Q> diagonal2x4(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 2, T, Q> diagonal3x2(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> diagonal3x3(\n\t\tvec<3, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 4, T, Q> diagonal3x4(\n\t\tvec<3, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 2, T, Q> diagonal4x2(\n\t\tvec<2, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 3, T, Q> diagonal4x3(\n\t\tvec<3, T, Q> const& v);\n\n\t//! Build a diagonal matrix.\n\t//! From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> diagonal4x4(\n\t\tvec<4, T, Q> const& v);\n\n\t/// Build an adjugate matrix.\n\t/// From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<2, 2, T, Q> adjugate(mat<2, 2, T, Q> const& m);\n\n\t/// Build an adjugate matrix.\n\t/// From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> adjugate(mat<3, 3, T, Q> const& m);\n\n\t/// Build an adjugate matrix.\n\t/// From GLM_GTX_matrix_operation extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> adjugate(mat<4, 4, T, Q> const& m);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_operation.inl\"\n"}, {"path": "includes/glm/gtx/matrix_query.hpp", "language": "code", "loc": 62, "comment_density": 0.532, "code": "/// @ref gtx_matrix_query\n/// @file glm/gtx/matrix_query.hpp\n///\n/// @see core (dependence)\n/// @see gtx_vector_query (dependence)\n///\n/// @defgroup gtx_matrix_query GLM_GTX_matrix_query\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Query to evaluate matrix properties\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/vector_query.hpp\"\n#include \n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_query extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_query\n\t/// @{\n\n\t/// Return whether a matrix a null matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNull(mat<2, 2, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix a null matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNull(mat<3, 3, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is a null matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNull(mat<4, 4, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is an identity matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate class matType>\n\tGLM_FUNC_DECL bool isIdentity(matType const& m, T const& epsilon);\n\n\t/// Return whether a matrix is a normalized matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNormalized(mat<2, 2, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is a normalized matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNormalized(mat<3, 3, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is a normalized matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate\n\tGLM_FUNC_DECL bool isNormalized(mat<4, 4, T, Q> const& m, T const& epsilon);\n\n\t/// Return whether a matrix is an orthonormalized matrix.\n\t/// From GLM_GTX_matrix_query extension.\n\ttemplate class matType>\n\tGLM_FUNC_DECL bool isOrthogonal(matType const& m, T const& epsilon);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_query.inl\"\n"}, {"path": "includes/glm/gtx/matrix_transform_2d.hpp", "language": "code", "loc": 69, "comment_density": 0.536, "code": "/// @ref gtx_matrix_transform_2d\n/// @file glm/gtx/matrix_transform_2d.hpp\n/// @author Miguel Ángel Pérez Martínez\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines functions that generate common 2d transformation matrices.\n\n#pragma once\n\n// Dependency:\n#include \"../mat3x3.hpp\"\n#include \"../vec2.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_matrix_transform_2d is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_matrix_transform_2d extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_matrix_transform_2d\n\t/// @{\n\n\t/// Builds a translation 3 * 3 matrix created from a vector of 2 components.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param v Coordinates of a translation vector.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tvec<2, T, Q> const& v);\n\n\t/// Builds a rotation 3 * 3 matrix created from an angle.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param angle Rotation angle expressed in radians.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tT angle);\n\n\t/// Builds a scale 3 * 3 matrix created from a vector of 2 components.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param v Coordinates of a scale vector.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tvec<2, T, Q> const& v);\n\n\t/// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param y Shear factor.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tT y);\n\n\t/// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix.\n\t///\n\t/// @param m Input matrix multiplied by this translation matrix.\n\t/// @param x Shear factor.\n\ttemplate\n\tGLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY(\n\t\tmat<3, 3, T, Q> const& m,\n\t\tT x);\n\n\t/// @}\n}//namespace glm\n\n#include \"matrix_transform_2d.inl\"\n"}, {"path": "includes/glm/gtx/mixed_product.hpp", "language": "code", "loc": 33, "comment_density": 0.515, "code": "/// @ref gtx_mixed_product\n/// @file glm/gtx/mixed_product.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_mixed_product GLM_GTX_mixed_product\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Mixed product of 3 vectors.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_mixed_product extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_mixed_product\n\t/// @{\n\n\t/// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension)\n\ttemplate\n\tGLM_FUNC_DECL T mixedProduct(\n\t\tvec<3, T, Q> const& v1,\n\t\tvec<3, T, Q> const& v2,\n\t\tvec<3, T, Q> const& v3);\n\n\t/// @}\n}// namespace glm\n\n#include \"mixed_product.inl\"\n"}, {"path": "includes/glm/gtx/norm.hpp", "language": "code", "loc": 61, "comment_density": 0.541, "code": "/// @ref gtx_norm\n/// @file glm/gtx/norm.hpp\n///\n/// @see core (dependence)\n/// @see gtx_quaternion (dependence)\n///\n/// @defgroup gtx_norm GLM_GTX_norm\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Various ways to compute vector norms.\n\n#pragma once\n\n// Dependency:\n#include \"../geometric.hpp\"\n#include \"../gtx/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_norm is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_norm extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_norm\n\t/// @{\n\n\t/// Returns the squared length of x.\n\t/// From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T length2(vec const& x);\n\n\t/// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).\n\t/// From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T distance2(vec const& p0, vec const& p1);\n\n\t//! Returns the L1 norm between x and y.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);\n\n\t//! Returns the L1 norm of v.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& v);\n\n\t//! Returns the L2 norm between x and y.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);\n\n\t//! Returns the L2 norm of v.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x);\n\n\t//! Returns the L norm between x and y.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y, unsigned int Depth);\n\n\t//! Returns the L norm of v.\n\t//! From GLM_GTX_norm extension.\n\ttemplate\n\tGLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, unsigned int Depth);\n\n\t/// @}\n}//namespace glm\n\n#include \"norm.inl\"\n"}, {"path": "includes/glm/gtx/normal.hpp", "language": "code", "loc": 33, "comment_density": 0.606, "code": "/// @ref gtx_normal\n/// @file glm/gtx/normal.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_normal GLM_GTX_normal\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Compute the normal of a triangle.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_normal extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_normal\n\t/// @{\n\n\t/// Computes triangle normal from triangle points.\n\t///\n\t/// @see gtx_normal\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> triangleNormal(vec<3, T, Q> const& p1, vec<3, T, Q> const& p2, vec<3, T, Q> const& p3);\n\n\t/// @}\n}//namespace glm\n\n#include \"normal.inl\"\n"}, {"path": "includes/glm/gtx/normalize_dot.hpp", "language": "code", "loc": 40, "comment_density": 0.625, "code": "/// @ref gtx_normalize_dot\n/// @file glm/gtx/normalize_dot.hpp\n///\n/// @see core (dependence)\n/// @see gtx_fast_square_root (dependence)\n///\n/// @defgroup gtx_normalize_dot GLM_GTX_normalize_dot\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Dot product of vectors that need to be normalize with a single square root.\n\n#pragma once\n\n// Dependency:\n#include \"../gtx/fast_square_root.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_normalize_dot is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_normalize_dot extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_normalize_dot\n\t/// @{\n\n\t/// Normalize parameters and returns the dot product of x and y.\n\t/// It's faster that dot(normalize(x), normalize(y)).\n\t///\n\t/// @see gtx_normalize_dot extension.\n\ttemplate\n\tGLM_FUNC_DECL T normalizeDot(vec const& x, vec const& y);\n\n\t/// Normalize parameters and returns the dot product of x and y.\n\t/// Faster that dot(fastNormalize(x), fastNormalize(y)).\n\t///\n\t/// @see gtx_normalize_dot extension.\n\ttemplate\n\tGLM_FUNC_DECL T fastNormalizeDot(vec const& x, vec const& y);\n\n\t/// @}\n}//namespace glm\n\n#include \"normalize_dot.inl\"\n"}, {"path": "includes/glm/gtx/number_precision.hpp", "language": "code", "loc": 48, "comment_density": 0.729, "code": "/// @ref gtx_number_precision\n/// @file glm/gtx/number_precision.hpp\n///\n/// @see core (dependence)\n/// @see gtc_type_precision (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_number_precision GLM_GTX_number_precision\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defined size types.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/type_precision.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_number_precision is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_number_precision extension included\")\n#endif\n\nnamespace glm{\nnamespace gtx\n{\n\t/////////////////////////////\n\t// Unsigned int vector types\n\n\t/// @addtogroup gtx_number_precision\n\t/// @{\n\n\ttypedef u8\t\t\tu8vec1;\t\t//!< \\brief 8bit unsigned integer scalar. (from GLM_GTX_number_precision extension)\n\ttypedef u16\t\t\tu16vec1; //!< \\brief 16bit unsigned integer scalar. (from GLM_GTX_number_precision extension)\n\ttypedef u32\t\t\tu32vec1; //!< \\brief 32bit unsigned integer scalar. (from GLM_GTX_number_precision extension)\n\ttypedef u64\t\t\tu64vec1; //!< \\brief 64bit unsigned integer scalar. (from GLM_GTX_number_precision extension)\n\n\t//////////////////////\n\t// Float vector types\n\n\ttypedef f32\t\t\tf32vec1; //!< \\brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\ttypedef f64\t\t\tf64vec1; //!< \\brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\n\t//////////////////////\n\t// Float matrix types\n\n\ttypedef f32\t\t\tf32mat1;\t//!< \\brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\ttypedef f32\t\t\tf32mat1x1;\t//!< \\brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\ttypedef f64\t\t\tf64mat1;\t//!< \\brief Double-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\ttypedef f64\t\t\tf64mat1x1;\t//!< \\brief Double-qualifier floating-point scalar. (from GLM_GTX_number_precision extension)\n\n\t/// @}\n}//namespace gtx\n}//namespace glm\n\n#include \"number_precision.inl\"\n"}, {"path": "includes/glm/gtx/optimum_pow.hpp", "language": "code", "loc": 44, "comment_density": 0.591, "code": "/// @ref gtx_optimum_pow\n/// @file glm/gtx/optimum_pow.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_optimum_pow GLM_GTX_optimum_pow\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Integer exponentiation of power functions.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_optimum_pow is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_optimum_pow extension included\")\n#endif\n\nnamespace glm{\nnamespace gtx\n{\n\t/// @addtogroup gtx_optimum_pow\n\t/// @{\n\n\t/// Returns x raised to the power of 2.\n\t///\n\t/// @see gtx_optimum_pow\n\ttemplate\n\tGLM_FUNC_DECL genType pow2(genType const& x);\n\n\t/// Returns x raised to the power of 3.\n\t///\n\t/// @see gtx_optimum_pow\n\ttemplate\n\tGLM_FUNC_DECL genType pow3(genType const& x);\n\n\t/// Returns x raised to the power of 4.\n\t///\n\t/// @see gtx_optimum_pow\n\ttemplate\n\tGLM_FUNC_DECL genType pow4(genType const& x);\n\n\t/// @}\n}//namespace gtx\n}//namespace glm\n\n#include \"optimum_pow.inl\"\n"}, {"path": "includes/glm/gtx/orthonormalize.hpp", "language": "code", "loc": 40, "comment_density": 0.575, "code": "/// @ref gtx_orthonormalize\n/// @file glm/gtx/orthonormalize.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Orthonormalize matrices.\n\n#pragma once\n\n// Dependency:\n#include \"../vec3.hpp\"\n#include \"../mat3x3.hpp\"\n#include \"../geometric.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_orthonormalize is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_orthonormalize extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_orthonormalize\n\t/// @{\n\n\t/// Returns the orthonormalized matrix of m.\n\t///\n\t/// @see gtx_orthonormalize\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m);\n\n\t/// Orthonormalizes x according y.\n\t///\n\t/// @see gtx_orthonormalize\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y);\n\n\t/// @}\n}//namespace glm\n\n#include \"orthonormalize.inl\"\n"}, {"path": "includes/glm/gtx/perpendicular.hpp", "language": "code", "loc": 33, "comment_density": 0.576, "code": "/// @ref gtx_perpendicular\n/// @file glm/gtx/perpendicular.hpp\n///\n/// @see core (dependence)\n/// @see gtx_projection (dependence)\n///\n/// @defgroup gtx_perpendicular GLM_GTX_perpendicular\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Perpendicular of a vector from other one\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/projection.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_perpendicular extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_perpendicular\n\t/// @{\n\n\t//! Projects x a perpendicular axis of Normal.\n\t//! From GLM_GTX_perpendicular extension.\n\ttemplate\n\tGLM_FUNC_DECL genType perp(genType const& x, genType const& Normal);\n\n\t/// @}\n}//namespace glm\n\n#include \"perpendicular.inl\"\n"}, {"path": "includes/glm/gtx/polar_coordinates.hpp", "language": "code", "loc": 39, "comment_density": 0.564, "code": "/// @ref gtx_polar_coordinates\n/// @file glm/gtx/polar_coordinates.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Conversion from Euclidean space to polar space and revert.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_polar_coordinates is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_polar_coordinates extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_polar_coordinates\n\t/// @{\n\n\t/// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude.\n\t///\n\t/// @see gtx_polar_coordinates\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> polar(\n\t\tvec<3, T, Q> const& euclidean);\n\n\t/// Convert Polar to Euclidean coordinates.\n\t///\n\t/// @see gtx_polar_coordinates\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> euclidean(\n\t\tvec<2, T, Q> const& polar);\n\n\t/// @}\n}//namespace glm\n\n#include \"polar_coordinates.inl\"\n"}, {"path": "includes/glm/gtx/projection.hpp", "language": "code", "loc": 32, "comment_density": 0.594, "code": "/// @ref gtx_projection\n/// @file glm/gtx/projection.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_projection GLM_GTX_projection\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Projection of a vector to other one\n\n#pragma once\n\n// Dependency:\n#include \"../geometric.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_projection extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_projection\n\t/// @{\n\n\t/// Projects x on Normal.\n\t///\n\t/// @see gtx_projection\n\ttemplate\n\tGLM_FUNC_DECL genType proj(genType const& x, genType const& Normal);\n\n\t/// @}\n}//namespace glm\n\n#include \"projection.inl\"\n"}, {"path": "includes/glm/gtx/quaternion.hpp", "language": "code", "loc": 150, "comment_density": 0.493, "code": "/// @ref gtx_quaternion\n/// @file glm/gtx/quaternion.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_quaternion GLM_GTX_quaternion\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Extended quaternion types and functions\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/constants.hpp\"\n#include \"../gtc/quaternion.hpp\"\n#include \"../ext/quaternion_exponential.hpp\"\n#include \"../gtx/norm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_quaternion is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_quaternion extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_quaternion\n\t/// @{\n\n\t/// Create an identity quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua quat_identity();\n\n\t/// Compute a cross product between a quaternion and a vector.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> cross(\n\t\tqua const& q,\n\t\tvec<3, T, Q> const& v);\n\n\t//! Compute a cross product between a vector and a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> cross(\n\t\tvec<3, T, Q> const& v,\n\t\tqua const& q);\n\n\t//! Compute a point on a path according squad equation.\n\t//! q1 and q2 are control points; s1 and s2 are intermediate control points.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua squad(\n\t\tqua const& q1,\n\t\tqua const& q2,\n\t\tqua const& s1,\n\t\tqua const& s2,\n\t\tT const& h);\n\n\t//! Returns an intermediate control point for squad interpolation.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua intermediate(\n\t\tqua const& prev,\n\t\tqua const& curr,\n\t\tqua const& next);\n\n\t//! Returns quarternion square root.\n\t///\n\t/// @see gtx_quaternion\n\t//template\n\t//qua sqrt(\n\t//\tqua const& q);\n\n\t//! Rotates a 3 components vector by a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotate(\n\t\tqua const& q,\n\t\tvec<3, T, Q> const& v);\n\n\t/// Rotates a 4 components vector by a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotate(\n\t\tqua const& q,\n\t\tvec<4, T, Q> const& v);\n\n\t/// Extract the real component of a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T extractRealComponent(\n\t\tqua const& q);\n\n\t/// Converts a quaternion to a 3 * 3 matrix.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> toMat3(\n\t\tqua const& x){return mat3_cast(x);}\n\n\t/// Converts a quaternion to a 4 * 4 matrix.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> toMat4(\n\t\tqua const& x){return mat4_cast(x);}\n\n\t/// Converts a 3 * 3 matrix to a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua toQuat(\n\t\tmat<3, 3, T, Q> const& x){return quat_cast(x);}\n\n\t/// Converts a 4 * 4 matrix to a quaternion.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua toQuat(\n\t\tmat<4, 4, T, Q> const& x){return quat_cast(x);}\n\n\t/// Quaternion interpolation using the rotation short path.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua shortMix(\n\t\tqua const& x,\n\t\tqua const& y,\n\t\tT const& a);\n\n\t/// Quaternion normalized linear interpolation.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua fastMix(\n\t\tqua const& x,\n\t\tqua const& y,\n\t\tT const& a);\n\n\t/// Compute the rotation between two vectors.\n\t/// param orig vector, needs to be normalized\n\t/// param dest vector, needs to be normalized\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL qua rotation(\n\t\tvec<3, T, Q> const& orig,\n\t\tvec<3, T, Q> const& dest);\n\n\t/// Returns the squared length of x.\n\t///\n\t/// @see gtx_quaternion\n\ttemplate\n\tGLM_FUNC_DECL T length2(qua const& q);\n\n\t/// @}\n}//namespace glm\n\n#include \"quaternion.inl\"\n"}, {"path": "includes/glm/gtx/range.hpp", "language": "code", "loc": 80, "comment_density": 0.212, "code": "/// @ref gtx_range\n/// @file glm/gtx/range.hpp\n/// @author Joshua Moerman\n///\n/// @defgroup gtx_range GLM_GTX_range\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines begin and end for vectors and matrices. Useful for range-based for loop.\n/// The range is defined over the elements, not over columns or rows (e.g. mat4 has 16 elements).\n\n#pragma once\n\n// Dependencies\n#include \"../detail/setup.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_range is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if !GLM_HAS_RANGE_FOR\n#\terror \"GLM_GTX_range requires C++11 support or 'range for'\"\n#endif\n\n#include \"../gtc/type_ptr.hpp\"\n#include \"../gtc/vec1.hpp\"\n\nnamespace glm\n{\n\t/// @addtogroup gtx_range\n\t/// @{\n\n#\tif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tpragma warning(push)\n#\t\tpragma warning(disable : 4100) // unreferenced formal parameter\n#\tendif\n\n\ttemplate\n\tinline length_t components(vec<1, T, Q> const& v)\n\t{\n\t\treturn v.length();\n\t}\n\n\ttemplate\n\tinline length_t components(vec<2, T, Q> const& v)\n\t{\n\t\treturn v.length();\n\t}\n\n\ttemplate\n\tinline length_t components(vec<3, T, Q> const& v)\n\t{\n\t\treturn v.length();\n\t}\n\n\ttemplate\n\tinline length_t components(vec<4, T, Q> const& v)\n\t{\n\t\treturn v.length();\n\t}\n\n\ttemplate\n\tinline length_t components(genType const& m)\n\t{\n\t\treturn m.length() * m[0].length();\n\t}\n\n\ttemplate\n\tinline typename genType::value_type const * begin(genType const& v)\n\t{\n\t\treturn value_ptr(v);\n\t}\n\n\ttemplate\n\tinline typename genType::value_type const * end(genType const& v)\n\t{\n\t\treturn begin(v) + components(v);\n\t}\n\n\ttemplate\n\tinline typename genType::value_type * begin(genType& v)\n\t{\n\t\treturn value_ptr(v);\n\t}\n\n\ttemplate\n\tinline typename genType::value_type * end(genType& v)\n\t{\n\t\treturn begin(v) + components(v);\n\t}\n\n#\tif GLM_COMPILER & GLM_COMPILER_VC\n#\t\tpragma warning(pop)\n#\tendif\n\n\t/// @}\n}//namespace glm\n"}, {"path": "includes/glm/gtx/raw_data.hpp", "language": "code", "loc": 40, "comment_density": 0.6, "code": "/// @ref gtx_raw_data\n/// @file glm/gtx/raw_data.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_raw_data GLM_GTX_raw_data\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Projection of a vector to other one\n\n#pragma once\n\n// Dependencies\n#include \"../ext/scalar_uint_sized.hpp\"\n#include \"../detail/setup.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_raw_data extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_raw_data\n\t/// @{\n\n\t//! Type for byte numbers.\n\t//! From GLM_GTX_raw_data extension.\n\ttypedef detail::uint8\t\tbyte;\n\n\t//! Type for word numbers.\n\t//! From GLM_GTX_raw_data extension.\n\ttypedef detail::uint16\t\tword;\n\n\t//! Type for dword numbers.\n\t//! From GLM_GTX_raw_data extension.\n\ttypedef detail::uint32\t\tdword;\n\n\t//! Type for qword numbers.\n\t//! From GLM_GTX_raw_data extension.\n\ttypedef detail::uint64\t\tqword;\n\n\t/// @}\n}// namespace glm\n\n#include \"raw_data.inl\"\n"}, {"path": "includes/glm/gtx/rotate_normalized_axis.hpp", "language": "code", "loc": 59, "comment_density": 0.61, "code": "/// @ref gtx_rotate_normalized_axis\n/// @file glm/gtx/rotate_normalized_axis.hpp\n///\n/// @see core (dependence)\n/// @see gtc_matrix_transform\n/// @see gtc_quaternion\n///\n/// @defgroup gtx_rotate_normalized_axis GLM_GTX_rotate_normalized_axis\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Quaternions and matrices rotations around normalized axis.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/epsilon.hpp\"\n#include \"../gtc/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_rotate_normalized_axis is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_rotate_normalized_axis extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_rotate_normalized_axis\n\t/// @{\n\n\t/// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle.\n\t///\n\t/// @param m Input matrix multiplied by this rotation matrix.\n\t/// @param angle Rotation angle expressed in radians.\n\t/// @param axis Rotation axis, must be normalized.\n\t/// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.\n\t///\n\t/// @see gtx_rotate_normalized_axis\n\t/// @see - rotate(T angle, T x, T y, T z)\n\t/// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)\n\t/// @see - rotate(T angle, vec<3, T, Q> const& v)\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rotateNormalizedAxis(\n\t\tmat<4, 4, T, Q> const& m,\n\t\tT const& angle,\n\t\tvec<3, T, Q> const& axis);\n\n\t/// Rotates a quaternion from a vector of 3 components normalized axis and an angle.\n\t///\n\t/// @param q Source orientation\n\t/// @param angle Angle expressed in radians.\n\t/// @param axis Normalized axis of the rotation, must be normalized.\n\t///\n\t/// @see gtx_rotate_normalized_axis\n\ttemplate\n\tGLM_FUNC_DECL qua rotateNormalizedAxis(\n\t\tqua const& q,\n\t\tT const& angle,\n\t\tvec<3, T, Q> const& axis);\n\n\t/// @}\n}//namespace glm\n\n#include \"rotate_normalized_axis.inl\"\n"}, {"path": "includes/glm/gtx/rotate_vector.hpp", "language": "code", "loc": 105, "comment_density": 0.419, "code": "/// @ref gtx_rotate_vector\n/// @file glm/gtx/rotate_vector.hpp\n///\n/// @see core (dependence)\n/// @see gtx_transform (dependence)\n///\n/// @defgroup gtx_rotate_vector GLM_GTX_rotate_vector\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Function to directly rotate a vector\n\n#pragma once\n\n// Dependency:\n#include \"../gtx/transform.hpp\"\n#include \"../gtc/epsilon.hpp\"\n#include \"../ext/vector_relational.hpp\"\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_rotate_vector is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_rotate_vector extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_rotate_vector\n\t/// @{\n\n\t/// Returns Spherical interpolation between two vectors\n\t///\n\t/// @param x A first vector\n\t/// @param y A second vector\n\t/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].\n\t///\n\t/// @see gtx_rotate_vector\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> slerp(\n\t\tvec<3, T, Q> const& x,\n\t\tvec<3, T, Q> const& y,\n\t\tT const& a);\n\n\t//! Rotate a two dimensional vector.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<2, T, Q> rotate(\n\t\tvec<2, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a three dimensional vector around an axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotate(\n\t\tvec<3, T, Q> const& v,\n\t\tT const& angle,\n\t\tvec<3, T, Q> const& normal);\n\n\t//! Rotate a four dimensional vector around an axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotate(\n\t\tvec<4, T, Q> const& v,\n\t\tT const& angle,\n\t\tvec<3, T, Q> const& normal);\n\n\t//! Rotate a three dimensional vector around the X axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotateX(\n\t\tvec<3, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a three dimensional vector around the Y axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotateY(\n\t\tvec<3, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a three dimensional vector around the Z axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<3, T, Q> rotateZ(\n\t\tvec<3, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a four dimensional vector around the X axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotateX(\n\t\tvec<4, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a four dimensional vector around the Y axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotateY(\n\t\tvec<4, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Rotate a four dimensional vector around the Z axis.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL vec<4, T, Q> rotateZ(\n\t\tvec<4, T, Q> const& v,\n\t\tT const& angle);\n\n\t//! Build a rotation matrix from a normal and a up vector.\n\t//! From GLM_GTX_rotate_vector extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> orientation(\n\t\tvec<3, T, Q> const& Normal,\n\t\tvec<3, T, Q> const& Up);\n\n\t/// @}\n}//namespace glm\n\n#include \"rotate_vector.inl\"\n"}, {"path": "includes/glm/gtx/scalar_multiplication.hpp", "language": "code", "loc": 65, "comment_density": 0.246, "code": "/// @ref gtx\n/// @file glm/gtx/scalar_multiplication.hpp\n/// @author Joshua Moerman\n///\n/// Include to use the features of this extension.\n///\n/// Enables scalar multiplication for all types\n///\n/// Since GLSL is very strict about types, the following (often used) combinations do not work:\n/// double * vec4\n/// int * vec4\n/// vec4 / int\n/// So we'll fix that! Of course \"float * vec4\" should remain the same (hence the enable_if magic)\n\n#pragma once\n\n#include \"../detail/setup.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_scalar_multiplication is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if !GLM_HAS_TEMPLATE_ALIASES && !(GLM_COMPILER & GLM_COMPILER_GCC)\n#\terror \"GLM_GTX_scalar_multiplication requires C++11 support or alias templates and if not support for GCC\"\n#endif\n\n#include \"../vec2.hpp\"\n#include \"../vec3.hpp\"\n#include \"../vec4.hpp\"\n#include \"../mat2x2.hpp\"\n#include \n\nnamespace glm\n{\n\ttemplate\n\tusing return_type_scalar_multiplication = typename std::enable_if<\n\t\t!std::is_same::value // T may not be a float\n\t\t&& std::is_arithmetic::value, Vec // But it may be an int or double (no vec3 or mat3, ...)\n\t>::type;\n\n#define GLM_IMPLEMENT_SCAL_MULT(Vec) \\\n\ttemplate \\\n\treturn_type_scalar_multiplication \\\n\toperator*(T const& s, Vec rh){ \\\n\t\treturn rh *= static_cast(s); \\\n\t} \\\n\t \\\n\ttemplate \\\n\treturn_type_scalar_multiplication \\\n\toperator*(Vec lh, T const& s){ \\\n\t\treturn lh *= static_cast(s); \\\n\t} \\\n\t \\\n\ttemplate \\\n\treturn_type_scalar_multiplication \\\n\toperator/(Vec lh, T const& s){ \\\n\t\treturn lh *= 1.0f / s; \\\n\t}\n\nGLM_IMPLEMENT_SCAL_MULT(vec2)\nGLM_IMPLEMENT_SCAL_MULT(vec3)\nGLM_IMPLEMENT_SCAL_MULT(vec4)\n\nGLM_IMPLEMENT_SCAL_MULT(mat2)\nGLM_IMPLEMENT_SCAL_MULT(mat2x3)\nGLM_IMPLEMENT_SCAL_MULT(mat2x4)\nGLM_IMPLEMENT_SCAL_MULT(mat3x2)\nGLM_IMPLEMENT_SCAL_MULT(mat3)\nGLM_IMPLEMENT_SCAL_MULT(mat3x4)\nGLM_IMPLEMENT_SCAL_MULT(mat4x2)\nGLM_IMPLEMENT_SCAL_MULT(mat4x3)\nGLM_IMPLEMENT_SCAL_MULT(mat4)\n\n#undef GLM_IMPLEMENT_SCAL_MULT\n} // namespace glm\n"}, {"path": "includes/glm/gtx/scalar_relational.hpp", "language": "code", "loc": 27, "comment_density": 0.593, "code": "/// @ref gtx_scalar_relational\n/// @file glm/gtx/scalar_relational.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Extend a position from a source to a position at a defined length.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_extend extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_scalar_relational\n\t/// @{\n\n\n\n\t/// @}\n}//namespace glm\n\n#include \"scalar_relational.inl\"\n"}, {"path": "includes/glm/gtx/spline.hpp", "language": "code", "loc": 55, "comment_density": 0.4, "code": "/// @ref gtx_spline\n/// @file glm/gtx/spline.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_spline GLM_GTX_spline\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Spline functions\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/optimum_pow.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_spline is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_spline extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_spline\n\t/// @{\n\n\t/// Return a point from a catmull rom curve.\n\t/// @see gtx_spline extension.\n\ttemplate\n\tGLM_FUNC_DECL genType catmullRom(\n\t\tgenType const& v1,\n\t\tgenType const& v2,\n\t\tgenType const& v3,\n\t\tgenType const& v4,\n\t\ttypename genType::value_type const& s);\n\n\t/// Return a point from a hermite curve.\n\t/// @see gtx_spline extension.\n\ttemplate\n\tGLM_FUNC_DECL genType hermite(\n\t\tgenType const& v1,\n\t\tgenType const& t1,\n\t\tgenType const& v2,\n\t\tgenType const& t2,\n\t\ttypename genType::value_type const& s);\n\n\t/// Return a point from a cubic curve.\n\t/// @see gtx_spline extension.\n\ttemplate\n\tGLM_FUNC_DECL genType cubic(\n\t\tgenType const& v1,\n\t\tgenType const& v2,\n\t\tgenType const& v3,\n\t\tgenType const& v4,\n\t\ttypename genType::value_type const& s);\n\n\t/// @}\n}//namespace glm\n\n#include \"spline.inl\"\n"}, {"path": "includes/glm/gtx/std_based_type.hpp", "language": "code", "loc": 53, "comment_density": 0.623, "code": "/// @ref gtx_std_based_type\n/// @file glm/gtx/std_based_type.hpp\n///\n/// @see core (dependence)\n/// @see gtx_extended_min_max (dependence)\n///\n/// @defgroup gtx_std_based_type GLM_GTX_std_based_type\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Adds vector types based on STL value types.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_std_based_type is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_std_based_type extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_std_based_type\n\t/// @{\n\n\t/// Vector type based of one std::size_t component.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<1, std::size_t, defaultp>\t\tsize1;\n\n\t/// Vector type based of two std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<2, std::size_t, defaultp>\t\tsize2;\n\n\t/// Vector type based of three std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<3, std::size_t, defaultp>\t\tsize3;\n\n\t/// Vector type based of four std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<4, std::size_t, defaultp>\t\tsize4;\n\n\t/// Vector type based of one std::size_t component.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<1, std::size_t, defaultp>\t\tsize1_t;\n\n\t/// Vector type based of two std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<2, std::size_t, defaultp>\t\tsize2_t;\n\n\t/// Vector type based of three std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<3, std::size_t, defaultp>\t\tsize3_t;\n\n\t/// Vector type based of four std::size_t components.\n\t/// @see GLM_GTX_std_based_type\n\ttypedef vec<4, std::size_t, defaultp>\t\tsize4_t;\n\n\t/// @}\n}//namespace glm\n\n#include \"std_based_type.inl\"\n"}, {"path": "includes/glm/gtx/string_cast.hpp", "language": "code", "loc": 43, "comment_density": 0.512, "code": "/// @ref gtx_string_cast\n/// @file glm/gtx/string_cast.hpp\n///\n/// @see core (dependence)\n/// @see gtx_integer (dependence)\n/// @see gtx_quaternion (dependence)\n///\n/// @defgroup gtx_string_cast GLM_GTX_string_cast\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Setup strings for GLM type values\n///\n/// This extension is not supported with CUDA\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/type_precision.hpp\"\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtx/dual_quaternion.hpp\"\n#include \n#include \n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_string_cast is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if(GLM_COMPILER & GLM_COMPILER_CUDA)\n#\terror \"GLM_GTX_string_cast is not supported on CUDA compiler\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_string_cast extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_string_cast\n\t/// @{\n\n\t/// Create a string from a GLM vector or matrix typed variable.\n\t/// @see gtx_string_cast extension.\n\ttemplate\n\tGLM_FUNC_DECL std::string to_string(genType const& x);\n\n\t/// @}\n}//namespace glm\n\n#include \"string_cast.inl\"\n"}, {"path": "includes/glm/gtx/texture.hpp", "language": "code", "loc": 37, "comment_density": 0.595, "code": "/// @ref gtx_texture\n/// @file glm/gtx/texture.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_texture GLM_GTX_texture\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Wrapping mode of texture coordinates.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/integer.hpp\"\n#include \"../gtx/component_wise.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_texture is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_texture extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_texture\n\t/// @{\n\n\t/// Compute the number of mipmaps levels necessary to create a mipmap complete texture\n\t///\n\t/// @param Extent Extent of the texture base level mipmap\n\t/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector\n\t/// @tparam T Floating-point or signed integer scalar types\n\t/// @tparam Q Value from qualifier enum\n\ttemplate \n\tT levels(vec const& Extent);\n\n\t/// @}\n}// namespace glm\n\n#include \"texture.inl\"\n\n"}, {"path": "includes/glm/gtx/transform.hpp", "language": "code", "loc": 50, "comment_density": 0.56, "code": "/// @ref gtx_transform\n/// @file glm/gtx/transform.hpp\n///\n/// @see core (dependence)\n/// @see gtc_matrix_transform (dependence)\n/// @see gtx_transform\n/// @see gtx_transform2\n///\n/// @defgroup gtx_transform GLM_GTX_transform\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add transformation matrices\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/matrix_transform.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_transform extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_transform\n\t/// @{\n\n\t/// Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars.\n\t/// @see gtc_matrix_transform\n\t/// @see gtx_transform\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> translate(\n\t\tvec<3, T, Q> const& v);\n\n\t/// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians.\n\t/// @see gtc_matrix_transform\n\t/// @see gtx_transform\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> rotate(\n\t\tT angle,\n\t\tvec<3, T, Q> const& v);\n\n\t/// Transforms a matrix with a scale 4 * 4 matrix created from a vector of 3 components.\n\t/// @see gtc_matrix_transform\n\t/// @see gtx_transform\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> scale(\n\t\tvec<3, T, Q> const& v);\n\n\t/// @}\n}// namespace glm\n\n#include \"transform.inl\"\n"}, {"path": "includes/glm/gtx/transform2.hpp", "language": "code", "loc": 71, "comment_density": 0.577, "code": "/// @ref gtx_transform2\n/// @file glm/gtx/transform2.hpp\n///\n/// @see core (dependence)\n/// @see gtx_transform (dependence)\n///\n/// @defgroup gtx_transform2 GLM_GTX_transform2\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Add extra transformation matrices\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtx/transform.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_transform2 is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_transform2 extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_transform2\n\t/// @{\n\n\t//! Transforms a matrix with a shearing on X axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> shearX2D(mat<3, 3, T, Q> const& m, T y);\n\n\t//! Transforms a matrix with a shearing on Y axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> shearY2D(mat<3, 3, T, Q> const& m, T x);\n\n\t//! Transforms a matrix with a shearing on X axis\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> shearX3D(mat<4, 4, T, Q> const& m, T y, T z);\n\n\t//! Transforms a matrix with a shearing on Y axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> shearY3D(mat<4, 4, T, Q> const& m, T x, T z);\n\n\t//! Transforms a matrix with a shearing on Z axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> shearZ3D(mat<4, 4, T, Q> const& m, T x, T y);\n\n\t//template GLM_FUNC_QUALIFIER mat<4, 4, T, Q> shear(const mat<4, 4, T, Q> & m, shearPlane, planePoint, angle)\n\t// Identity + tan(angle) * cross(Normal, OnPlaneVector) 0\n\t// - dot(PointOnPlane, normal) * OnPlaneVector 1\n\n\t// Reflect functions seem to don't work\n\t//template mat<3, 3, T, Q> reflect2D(const mat<3, 3, T, Q> & m, const vec<3, T, Q>& normal){return reflect2DGTX(m, normal);}\t\t\t\t\t\t\t\t\t//!< \\brief Build a reflection matrix (from GLM_GTX_transform2 extension)\n\t//template mat<4, 4, T, Q> reflect3D(const mat<4, 4, T, Q> & m, const vec<3, T, Q>& normal){return reflect3DGTX(m, normal);}\t\t\t\t\t\t\t\t\t//!< \\brief Build a reflection matrix (from GLM_GTX_transform2 extension)\n\n\t//! Build planar projection matrix along normal axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<3, 3, T, Q> proj2D(mat<3, 3, T, Q> const& m, vec<3, T, Q> const& normal);\n\n\t//! Build planar projection matrix along normal axis.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> proj3D(mat<4, 4, T, Q> const & m, vec<3, T, Q> const& normal);\n\n\t//! Build a scale bias matrix.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> scaleBias(T scale, T bias);\n\n\t//! Build a scale bias matrix.\n\t//! From GLM_GTX_transform2 extension.\n\ttemplate\n\tGLM_FUNC_DECL mat<4, 4, T, Q> scaleBias(mat<4, 4, T, Q> const& m, T scale, T bias);\n\n\t/// @}\n}// namespace glm\n\n#include \"transform2.inl\"\n"}, {"path": "includes/glm/gtx/type_aligned.hpp", "language": "code", "loc": 698, "comment_density": 0.678, "code": "/// @ref gtx_type_aligned\n/// @file glm/gtx/type_aligned.hpp\n///\n/// @see core (dependence)\n/// @see gtc_quaternion (dependence)\n///\n/// @defgroup gtx_type_aligned GLM_GTX_type_aligned\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines aligned types.\n\n#pragma once\n\n// Dependency:\n#include \"../gtc/type_precision.hpp\"\n#include \"../gtc/quaternion.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_type_aligned is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_type_aligned extension included\")\n#endif\n\nnamespace glm\n{\n\t///////////////////////////\n\t// Signed int vector types\n\n\t/// @addtogroup gtx_type_aligned\n\t/// @{\n\n\t/// Low qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int8, aligned_lowp_int8, 1);\n\n\t/// Low qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int16, aligned_lowp_int16, 2);\n\n\t/// Low qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int32, aligned_lowp_int32, 4);\n\n\t/// Low qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int64, aligned_lowp_int64, 8);\n\n\n\t/// Low qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int8_t, aligned_lowp_int8_t, 1);\n\n\t/// Low qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int16_t, aligned_lowp_int16_t, 2);\n\n\t/// Low qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int32_t, aligned_lowp_int32_t, 4);\n\n\t/// Low qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_int64_t, aligned_lowp_int64_t, 8);\n\n\n\t/// Low qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_i8, aligned_lowp_i8, 1);\n\n\t/// Low qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_i16, aligned_lowp_i16, 2);\n\n\t/// Low qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_i32, aligned_lowp_i32, 4);\n\n\t/// Low qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_i64, aligned_lowp_i64, 8);\n\n\n\t/// Medium qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int8, aligned_mediump_int8, 1);\n\n\t/// Medium qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int16, aligned_mediump_int16, 2);\n\n\t/// Medium qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int32, aligned_mediump_int32, 4);\n\n\t/// Medium qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int64, aligned_mediump_int64, 8);\n\n\n\t/// Medium qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int8_t, aligned_mediump_int8_t, 1);\n\n\t/// Medium qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int16_t, aligned_mediump_int16_t, 2);\n\n\t/// Medium qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int32_t, aligned_mediump_int32_t, 4);\n\n\t/// Medium qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_int64_t, aligned_mediump_int64_t, 8);\n\n\n\t/// Medium qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_i8, aligned_mediump_i8, 1);\n\n\t/// Medium qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_i16, aligned_mediump_i16, 2);\n\n\t/// Medium qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_i32, aligned_mediump_i32, 4);\n\n\t/// Medium qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_i64, aligned_mediump_i64, 8);\n\n\n\t/// High qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int8, aligned_highp_int8, 1);\n\n\t/// High qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int16, aligned_highp_int16, 2);\n\n\t/// High qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int32, aligned_highp_int32, 4);\n\n\t/// High qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int64, aligned_highp_int64, 8);\n\n\n\t/// High qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int8_t, aligned_highp_int8_t, 1);\n\n\t/// High qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int16_t, aligned_highp_int16_t, 2);\n\n\t/// High qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int32_t, aligned_highp_int32_t, 4);\n\n\t/// High qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_int64_t, aligned_highp_int64_t, 8);\n\n\n\t/// High qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_i8, aligned_highp_i8, 1);\n\n\t/// High qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_i16, aligned_highp_i16, 2);\n\n\t/// High qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_i32, aligned_highp_i32, 4);\n\n\t/// High qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_i64, aligned_highp_i64, 8);\n\n\n\t/// Default qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int8, aligned_int8, 1);\n\n\t/// Default qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int16, aligned_int16, 2);\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int32, aligned_int32, 4);\n\n\t/// Default qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int64, aligned_int64, 8);\n\n\n\t/// Default qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int8_t, aligned_int8_t, 1);\n\n\t/// Default qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int16_t, aligned_int16_t, 2);\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int32_t, aligned_int32_t, 4);\n\n\t/// Default qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(int64_t, aligned_int64_t, 8);\n\n\n\t/// Default qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8, aligned_i8, 1);\n\n\t/// Default qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16, aligned_i16, 2);\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32, aligned_i32, 4);\n\n\t/// Default qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64, aligned_i64, 8);\n\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(ivec1, aligned_ivec1, 4);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(ivec2, aligned_ivec2, 8);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(ivec3, aligned_ivec3, 16);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(ivec4, aligned_ivec4, 16);\n\n\n\t/// Default qualifier 8 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8vec1, aligned_i8vec1, 1);\n\n\t/// Default qualifier 8 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8vec2, aligned_i8vec2, 2);\n\n\t/// Default qualifier 8 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8vec3, aligned_i8vec3, 4);\n\n\t/// Default qualifier 8 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i8vec4, aligned_i8vec4, 4);\n\n\n\t/// Default qualifier 16 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16vec1, aligned_i16vec1, 2);\n\n\t/// Default qualifier 16 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16vec2, aligned_i16vec2, 4);\n\n\t/// Default qualifier 16 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16vec3, aligned_i16vec3, 8);\n\n\t/// Default qualifier 16 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i16vec4, aligned_i16vec4, 8);\n\n\n\t/// Default qualifier 32 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32vec1, aligned_i32vec1, 4);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32vec2, aligned_i32vec2, 8);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32vec3, aligned_i32vec3, 16);\n\n\t/// Default qualifier 32 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i32vec4, aligned_i32vec4, 16);\n\n\n\t/// Default qualifier 64 bit signed integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64vec1, aligned_i64vec1, 8);\n\n\t/// Default qualifier 64 bit signed integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64vec2, aligned_i64vec2, 16);\n\n\t/// Default qualifier 64 bit signed integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64vec3, aligned_i64vec3, 32);\n\n\t/// Default qualifier 64 bit signed integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(i64vec4, aligned_i64vec4, 32);\n\n\n\t/////////////////////////////\n\t// Unsigned int vector types\n\n\t/// Low qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint8, aligned_lowp_uint8, 1);\n\n\t/// Low qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint16, aligned_lowp_uint16, 2);\n\n\t/// Low qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint32, aligned_lowp_uint32, 4);\n\n\t/// Low qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint64, aligned_lowp_uint64, 8);\n\n\n\t/// Low qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint8_t, aligned_lowp_uint8_t, 1);\n\n\t/// Low qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint16_t, aligned_lowp_uint16_t, 2);\n\n\t/// Low qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint32_t, aligned_lowp_uint32_t, 4);\n\n\t/// Low qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_uint64_t, aligned_lowp_uint64_t, 8);\n\n\n\t/// Low qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_u8, aligned_lowp_u8, 1);\n\n\t/// Low qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_u16, aligned_lowp_u16, 2);\n\n\t/// Low qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_u32, aligned_lowp_u32, 4);\n\n\t/// Low qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(lowp_u64, aligned_lowp_u64, 8);\n\n\n\t/// Medium qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint8, aligned_mediump_uint8, 1);\n\n\t/// Medium qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint16, aligned_mediump_uint16, 2);\n\n\t/// Medium qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint32, aligned_mediump_uint32, 4);\n\n\t/// Medium qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint64, aligned_mediump_uint64, 8);\n\n\n\t/// Medium qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint8_t, aligned_mediump_uint8_t, 1);\n\n\t/// Medium qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint16_t, aligned_mediump_uint16_t, 2);\n\n\t/// Medium qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint32_t, aligned_mediump_uint32_t, 4);\n\n\t/// Medium qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_uint64_t, aligned_mediump_uint64_t, 8);\n\n\n\t/// Medium qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_u8, aligned_mediump_u8, 1);\n\n\t/// Medium qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_u16, aligned_mediump_u16, 2);\n\n\t/// Medium qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_u32, aligned_mediump_u32, 4);\n\n\t/// Medium qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mediump_u64, aligned_mediump_u64, 8);\n\n\n\t/// High qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint8, aligned_highp_uint8, 1);\n\n\t/// High qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint16, aligned_highp_uint16, 2);\n\n\t/// High qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint32, aligned_highp_uint32, 4);\n\n\t/// High qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint64, aligned_highp_uint64, 8);\n\n\n\t/// High qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint8_t, aligned_highp_uint8_t, 1);\n\n\t/// High qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint16_t, aligned_highp_uint16_t, 2);\n\n\t/// High qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint32_t, aligned_highp_uint32_t, 4);\n\n\t/// High qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_uint64_t, aligned_highp_uint64_t, 8);\n\n\n\t/// High qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_u8, aligned_highp_u8, 1);\n\n\t/// High qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_u16, aligned_highp_u16, 2);\n\n\t/// High qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_u32, aligned_highp_u32, 4);\n\n\t/// High qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(highp_u64, aligned_highp_u64, 8);\n\n\n\t/// Default qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint8, aligned_uint8, 1);\n\n\t/// Default qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint16, aligned_uint16, 2);\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint32, aligned_uint32, 4);\n\n\t/// Default qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint64, aligned_uint64, 8);\n\n\n\t/// Default qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint8_t, aligned_uint8_t, 1);\n\n\t/// Default qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint16_t, aligned_uint16_t, 2);\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint32_t, aligned_uint32_t, 4);\n\n\t/// Default qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uint64_t, aligned_uint64_t, 8);\n\n\n\t/// Default qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8, aligned_u8, 1);\n\n\t/// Default qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16, aligned_u16, 2);\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32, aligned_u32, 4);\n\n\t/// Default qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64, aligned_u64, 8);\n\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uvec1, aligned_uvec1, 4);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uvec2, aligned_uvec2, 8);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uvec3, aligned_uvec3, 16);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(uvec4, aligned_uvec4, 16);\n\n\n\t/// Default qualifier 8 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8vec1, aligned_u8vec1, 1);\n\n\t/// Default qualifier 8 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8vec2, aligned_u8vec2, 2);\n\n\t/// Default qualifier 8 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8vec3, aligned_u8vec3, 4);\n\n\t/// Default qualifier 8 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u8vec4, aligned_u8vec4, 4);\n\n\n\t/// Default qualifier 16 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16vec1, aligned_u16vec1, 2);\n\n\t/// Default qualifier 16 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16vec2, aligned_u16vec2, 4);\n\n\t/// Default qualifier 16 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16vec3, aligned_u16vec3, 8);\n\n\t/// Default qualifier 16 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u16vec4, aligned_u16vec4, 8);\n\n\n\t/// Default qualifier 32 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32vec1, aligned_u32vec1, 4);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32vec2, aligned_u32vec2, 8);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32vec3, aligned_u32vec3, 16);\n\n\t/// Default qualifier 32 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u32vec4, aligned_u32vec4, 16);\n\n\n\t/// Default qualifier 64 bit unsigned integer aligned scalar type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64vec1, aligned_u64vec1, 8);\n\n\t/// Default qualifier 64 bit unsigned integer aligned vector of 2 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64vec2, aligned_u64vec2, 16);\n\n\t/// Default qualifier 64 bit unsigned integer aligned vector of 3 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64vec3, aligned_u64vec3, 32);\n\n\t/// Default qualifier 64 bit unsigned integer aligned vector of 4 components type.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(u64vec4, aligned_u64vec4, 32);\n\n\n\t//////////////////////\n\t// Float vector types\n\n\t/// 32 bit single-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float32, aligned_float32, 4);\n\n\t/// 32 bit single-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float32_t, aligned_float32_t, 4);\n\n\t/// 32 bit single-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float32, aligned_f32, 4);\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// 64 bit double-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float64, aligned_float64, 8);\n\n\t/// 64 bit double-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float64_t, aligned_float64_t, 8);\n\n\t/// 64 bit double-qualifier floating-point aligned scalar.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(float64, aligned_f64, 8);\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\n\t/// Single-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(vec1, aligned_vec1, 4);\n\n\t/// Single-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(vec2, aligned_vec2, 8);\n\n\t/// Single-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(vec3, aligned_vec3, 16);\n\n\t/// Single-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(vec4, aligned_vec4, 16);\n\n\n\t/// Single-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fvec1, aligned_fvec1, 4);\n\n\t/// Single-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fvec2, aligned_fvec2, 8);\n\n\t/// Single-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fvec3, aligned_fvec3, 16);\n\n\t/// Single-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fvec4, aligned_fvec4, 16);\n\n\n\t/// Single-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32vec1, aligned_f32vec1, 4);\n\n\t/// Single-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32vec2, aligned_f32vec2, 8);\n\n\t/// Single-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32vec3, aligned_f32vec3, 16);\n\n\t/// Single-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32vec4, aligned_f32vec4, 16);\n\n\n\t/// Double-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dvec1, aligned_dvec1, 8);\n\n\t/// Double-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dvec2, aligned_dvec2, 16);\n\n\t/// Double-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dvec3, aligned_dvec3, 32);\n\n\t/// Double-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dvec4, aligned_dvec4, 32);\n\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Double-qualifier floating-point aligned vector of 1 component.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64vec1, aligned_f64vec1, 8);\n\n\t/// Double-qualifier floating-point aligned vector of 2 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64vec2, aligned_f64vec2, 16);\n\n\t/// Double-qualifier floating-point aligned vector of 3 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64vec3, aligned_f64vec3, 32);\n\n\t/// Double-qualifier floating-point aligned vector of 4 components.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64vec4, aligned_f64vec4, 32);\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t//////////////////////\n\t// Float matrix types\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1 mat1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat2, aligned_mat2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat3, aligned_mat3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat4, aligned_mat4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1x1 mat1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat2x2, aligned_mat2x2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat3x3, aligned_mat3x3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(mat4x4, aligned_mat4x4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1x1 fmat1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat2x2, aligned_fmat2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat3x3, aligned_fmat3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat4x4, aligned_fmat4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef f32 fmat1x1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat2x2, aligned_fmat2x2, 16);\n\n\t/// Single-qualifier floating-point aligned 2x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat2x3, aligned_fmat2x3, 16);\n\n\t/// Single-qualifier floating-point aligned 2x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat2x4, aligned_fmat2x4, 16);\n\n\t/// Single-qualifier floating-point aligned 3x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat3x2, aligned_fmat3x2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat3x3, aligned_fmat3x3, 16);\n\n\t/// Single-qualifier floating-point aligned 3x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat3x4, aligned_fmat3x4, 16);\n\n\t/// Single-qualifier floating-point aligned 4x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat4x2, aligned_fmat4x2, 16);\n\n\t/// Single-qualifier floating-point aligned 4x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat4x3, aligned_fmat4x3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(fmat4x4, aligned_fmat4x4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1x1 f32mat1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat2x2, aligned_f32mat2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat3x3, aligned_f32mat3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat4x4, aligned_f32mat4, 16);\n\n\n\t/// Single-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef f32 f32mat1x1;\n\n\t/// Single-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat2x2, aligned_f32mat2x2, 16);\n\n\t/// Single-qualifier floating-point aligned 2x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat2x3, aligned_f32mat2x3, 16);\n\n\t/// Single-qualifier floating-point aligned 2x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat2x4, aligned_f32mat2x4, 16);\n\n\t/// Single-qualifier floating-point aligned 3x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat3x2, aligned_f32mat3x2, 16);\n\n\t/// Single-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat3x3, aligned_f32mat3x3, 16);\n\n\t/// Single-qualifier floating-point aligned 3x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat3x4, aligned_f32mat3x4, 16);\n\n\t/// Single-qualifier floating-point aligned 4x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat4x2, aligned_f32mat4x2, 16);\n\n\t/// Single-qualifier floating-point aligned 4x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat4x3, aligned_f32mat4x3, 16);\n\n\t/// Single-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32mat4x4, aligned_f32mat4x4, 16);\n\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Double-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef detail::tmat1x1 f64mat1;\n\n\t/// Double-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat2x2, aligned_f64mat2, 32);\n\n\t/// Double-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat3x3, aligned_f64mat3, 32);\n\n\t/// Double-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat4x4, aligned_f64mat4, 32);\n\n\n\t/// Double-qualifier floating-point aligned 1x1 matrix.\n\t/// @see gtx_type_aligned\n\t//typedef f64 f64mat1x1;\n\n\t/// Double-qualifier floating-point aligned 2x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat2x2, aligned_f64mat2x2, 32);\n\n\t/// Double-qualifier floating-point aligned 2x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat2x3, aligned_f64mat2x3, 32);\n\n\t/// Double-qualifier floating-point aligned 2x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat2x4, aligned_f64mat2x4, 32);\n\n\t/// Double-qualifier floating-point aligned 3x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat3x2, aligned_f64mat3x2, 32);\n\n\t/// Double-qualifier floating-point aligned 3x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat3x3, aligned_f64mat3x3, 32);\n\n\t/// Double-qualifier floating-point aligned 3x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat3x4, aligned_f64mat3x4, 32);\n\n\t/// Double-qualifier floating-point aligned 4x2 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat4x2, aligned_f64mat4x2, 32);\n\n\t/// Double-qualifier floating-point aligned 4x3 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat4x3, aligned_f64mat4x3, 32);\n\n\t/// Double-qualifier floating-point aligned 4x4 matrix.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64mat4x4, aligned_f64mat4x4, 32);\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\n\t//////////////////////////\n\t// Quaternion types\n\n\t/// Single-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(quat, aligned_quat, 16);\n\n\t/// Single-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(quat, aligned_fquat, 16);\n\n\t/// Double-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(dquat, aligned_dquat, 32);\n\n\t/// Single-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f32quat, aligned_f32quat, 16);\n\n#\tifndef GLM_FORCE_SINGLE_ONLY\n\n\t/// Double-qualifier floating-point aligned quaternion.\n\t/// @see gtx_type_aligned\n\tGLM_ALIGNED_TYPEDEF(f64quat, aligned_f64quat, 32);\n\n#\tendif//GLM_FORCE_SINGLE_ONLY\n\n\t/// @}\n}//namespace glm\n\n#include \"type_aligned.inl\"\n"}, {"path": "includes/glm/gtx/type_trait.hpp", "language": "code", "loc": 73, "comment_density": 0.219, "code": "/// @ref gtx_type_trait\n/// @file glm/gtx/type_trait.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_type_trait GLM_GTX_type_trait\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Defines traits for each type.\n\n#pragma once\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_type_trait is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n// Dependency:\n#include \"../detail/qualifier.hpp\"\n#include \"../gtc/quaternion.hpp\"\n#include \"../gtx/dual_quaternion.hpp\"\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_type_trait extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_type_trait\n\t/// @{\n\n\ttemplate\n\tstruct type\n\t{\n\t\tstatic bool const is_vec = false;\n\t\tstatic bool const is_mat = false;\n\t\tstatic bool const is_quat = false;\n\t\tstatic length_t const components = 0;\n\t\tstatic length_t const cols = 0;\n\t\tstatic length_t const rows = 0;\n\t};\n\n\ttemplate\n\tstruct type >\n\t{\n\t\tstatic bool const is_vec = true;\n\t\tstatic bool const is_mat = false;\n\t\tstatic bool const is_quat = false;\n\t\tstatic length_t const components = L;\n\t};\n\n\ttemplate\n\tstruct type >\n\t{\n\t\tstatic bool const is_vec = false;\n\t\tstatic bool const is_mat = true;\n\t\tstatic bool const is_quat = false;\n\t\tstatic length_t const components = C;\n\t\tstatic length_t const cols = C;\n\t\tstatic length_t const rows = R;\n\t};\n\n\ttemplate\n\tstruct type >\n\t{\n\t\tstatic bool const is_vec = false;\n\t\tstatic bool const is_mat = false;\n\t\tstatic bool const is_quat = true;\n\t\tstatic length_t const components = 4;\n\t};\n\n\ttemplate\n\tstruct type >\n\t{\n\t\tstatic bool const is_vec = false;\n\t\tstatic bool const is_mat = false;\n\t\tstatic bool const is_quat = true;\n\t\tstatic length_t const components = 8;\n\t};\n\n\t/// @}\n}//namespace glm\n\n#include \"type_trait.inl\"\n"}, {"path": "includes/glm/gtx/vec_swizzle.hpp", "language": "code", "loc": 2290, "comment_density": 0.152, "code": "/// @ref gtx_vec_swizzle\n/// @file glm/gtx/vec_swizzle.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_vec_swizzle GLM_GTX_vec_swizzle\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Functions to perform swizzle operation.\n\n#pragma once\n\n#include \"../glm.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_vec_swizzle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\nnamespace glm {\n\t// xx\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xx(const glm::vec<1, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.x);\n\t}\n\n\t// xy\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.y);\n\t}\n\n\t// xz\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.z);\n\t}\n\n\t// xw\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> xw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.x, v.w);\n\t}\n\n\t// yx\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.x);\n\t}\n\n\t// yy\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.y);\n\t}\n\n\t// yz\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.z);\n\t}\n\n\t// yw\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> yw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.y, v.w);\n\t}\n\n\t// zx\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.x);\n\t}\n\n\t// zy\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.y);\n\t}\n\n\t// zz\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.z);\n\t}\n\n\t// zw\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> zw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.z, v.w);\n\t}\n\n\t// wx\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> wx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.w, v.x);\n\t}\n\n\t// wy\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> wy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.w, v.y);\n\t}\n\n\t// wz\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> wz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.w, v.z);\n\t}\n\n\t// ww\n\ttemplate\n\tGLM_INLINE glm::vec<2, T, Q> ww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<2, T, Q>(v.w, v.w);\n\t}\n\n\t// xxx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxx(const glm::vec<1, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.x);\n\t}\n\n\t// xxy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.y);\n\t}\n\n\t// xxz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.z);\n\t}\n\n\t// xxw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.x, v.w);\n\t}\n\n\t// xyx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.x);\n\t}\n\n\t// xyy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.y);\n\t}\n\n\t// xyz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.z);\n\t}\n\n\t// xyw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.y, v.w);\n\t}\n\n\t// xzx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.x);\n\t}\n\n\t// xzy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.y);\n\t}\n\n\t// xzz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.z);\n\t}\n\n\t// xzw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.z, v.w);\n\t}\n\n\t// xwx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.w, v.x);\n\t}\n\n\t// xwy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.w, v.y);\n\t}\n\n\t// xwz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.w, v.z);\n\t}\n\n\t// xww\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> xww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.x, v.w, v.w);\n\t}\n\n\t// yxx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.x);\n\t}\n\n\t// yxy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.y);\n\t}\n\n\t// yxz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.z);\n\t}\n\n\t// yxw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.x, v.w);\n\t}\n\n\t// yyx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.x);\n\t}\n\n\t// yyy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.y);\n\t}\n\n\t// yyz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.z);\n\t}\n\n\t// yyw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.y, v.w);\n\t}\n\n\t// yzx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.x);\n\t}\n\n\t// yzy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.y);\n\t}\n\n\t// yzz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.z);\n\t}\n\n\t// yzw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.z, v.w);\n\t}\n\n\t// ywx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> ywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.w, v.x);\n\t}\n\n\t// ywy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> ywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.w, v.y);\n\t}\n\n\t// ywz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> ywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.w, v.z);\n\t}\n\n\t// yww\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> yww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.y, v.w, v.w);\n\t}\n\n\t// zxx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.x);\n\t}\n\n\t// zxy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.y);\n\t}\n\n\t// zxz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.z);\n\t}\n\n\t// zxw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.x, v.w);\n\t}\n\n\t// zyx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.x);\n\t}\n\n\t// zyy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.y);\n\t}\n\n\t// zyz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.z);\n\t}\n\n\t// zyw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.y, v.w);\n\t}\n\n\t// zzx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.x);\n\t}\n\n\t// zzy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.y);\n\t}\n\n\t// zzz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.z);\n\t}\n\n\t// zzw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.z, v.w);\n\t}\n\n\t// zwx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.w, v.x);\n\t}\n\n\t// zwy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.w, v.y);\n\t}\n\n\t// zwz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.w, v.z);\n\t}\n\n\t// zww\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> zww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.z, v.w, v.w);\n\t}\n\n\t// wxx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.x, v.x);\n\t}\n\n\t// wxy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.x, v.y);\n\t}\n\n\t// wxz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.x, v.z);\n\t}\n\n\t// wxw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.x, v.w);\n\t}\n\n\t// wyx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.y, v.x);\n\t}\n\n\t// wyy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.y, v.y);\n\t}\n\n\t// wyz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.y, v.z);\n\t}\n\n\t// wyw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.y, v.w);\n\t}\n\n\t// wzx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.z, v.x);\n\t}\n\n\t// wzy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.z, v.y);\n\t}\n\n\t// wzz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.z, v.z);\n\t}\n\n\t// wzw\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.z, v.w);\n\t}\n\n\t// wwx\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.w, v.x);\n\t}\n\n\t// wwy\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.w, v.y);\n\t}\n\n\t// wwz\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> wwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.w, v.z);\n\t}\n\n\t// www\n\ttemplate\n\tGLM_INLINE glm::vec<3, T, Q> www(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<3, T, Q>(v.w, v.w, v.w);\n\t}\n\n\t// xxxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxx(const glm::vec<1, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.x);\n\t}\n\n\t// xxxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.y);\n\t}\n\n\t// xxxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.z);\n\t}\n\n\t// xxxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.x, v.w);\n\t}\n\n\t// xxyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.x);\n\t}\n\n\t// xxyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.y);\n\t}\n\n\t// xxyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.z);\n\t}\n\n\t// xxyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.y, v.w);\n\t}\n\n\t// xxzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.x);\n\t}\n\n\t// xxzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.y);\n\t}\n\n\t// xxzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.z);\n\t}\n\n\t// xxzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.z, v.w);\n\t}\n\n\t// xxwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.w, v.x);\n\t}\n\n\t// xxwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.w, v.y);\n\t}\n\n\t// xxwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.w, v.z);\n\t}\n\n\t// xxww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xxww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.x, v.w, v.w);\n\t}\n\n\t// xyxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.x);\n\t}\n\n\t// xyxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.y);\n\t}\n\n\t// xyxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.z);\n\t}\n\n\t// xyxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.x, v.w);\n\t}\n\n\t// xyyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.x);\n\t}\n\n\t// xyyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.y);\n\t}\n\n\t// xyyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.z);\n\t}\n\n\t// xyyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.y, v.w);\n\t}\n\n\t// xyzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.x);\n\t}\n\n\t// xyzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.y);\n\t}\n\n\t// xyzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.z);\n\t}\n\n\t// xyzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.z, v.w);\n\t}\n\n\t// xywx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.w, v.x);\n\t}\n\n\t// xywy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.w, v.y);\n\t}\n\n\t// xywz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.w, v.z);\n\t}\n\n\t// xyww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xyww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.y, v.w, v.w);\n\t}\n\n\t// xzxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.x);\n\t}\n\n\t// xzxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.y);\n\t}\n\n\t// xzxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.z);\n\t}\n\n\t// xzxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.x, v.w);\n\t}\n\n\t// xzyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.x);\n\t}\n\n\t// xzyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.y);\n\t}\n\n\t// xzyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.z);\n\t}\n\n\t// xzyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.y, v.w);\n\t}\n\n\t// xzzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.x);\n\t}\n\n\t// xzzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.y);\n\t}\n\n\t// xzzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.z);\n\t}\n\n\t// xzzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.z, v.w);\n\t}\n\n\t// xzwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.w, v.x);\n\t}\n\n\t// xzwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.w, v.y);\n\t}\n\n\t// xzwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.w, v.z);\n\t}\n\n\t// xzww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xzww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.z, v.w, v.w);\n\t}\n\n\t// xwxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.x, v.x);\n\t}\n\n\t// xwxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.x, v.y);\n\t}\n\n\t// xwxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.x, v.z);\n\t}\n\n\t// xwxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.x, v.w);\n\t}\n\n\t// xwyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.y, v.x);\n\t}\n\n\t// xwyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.y, v.y);\n\t}\n\n\t// xwyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.y, v.z);\n\t}\n\n\t// xwyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.y, v.w);\n\t}\n\n\t// xwzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.z, v.x);\n\t}\n\n\t// xwzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.z, v.y);\n\t}\n\n\t// xwzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.z, v.z);\n\t}\n\n\t// xwzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.z, v.w);\n\t}\n\n\t// xwwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.w, v.x);\n\t}\n\n\t// xwwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.w, v.y);\n\t}\n\n\t// xwwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.w, v.z);\n\t}\n\n\t// xwww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> xwww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.x, v.w, v.w, v.w);\n\t}\n\n\t// yxxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.x);\n\t}\n\n\t// yxxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.y);\n\t}\n\n\t// yxxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.z);\n\t}\n\n\t// yxxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.x, v.w);\n\t}\n\n\t// yxyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.x);\n\t}\n\n\t// yxyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.y);\n\t}\n\n\t// yxyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.z);\n\t}\n\n\t// yxyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.y, v.w);\n\t}\n\n\t// yxzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.x);\n\t}\n\n\t// yxzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.y);\n\t}\n\n\t// yxzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.z);\n\t}\n\n\t// yxzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.z, v.w);\n\t}\n\n\t// yxwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.w, v.x);\n\t}\n\n\t// yxwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.w, v.y);\n\t}\n\n\t// yxwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.w, v.z);\n\t}\n\n\t// yxww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yxww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.x, v.w, v.w);\n\t}\n\n\t// yyxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.x);\n\t}\n\n\t// yyxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.y);\n\t}\n\n\t// yyxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.z);\n\t}\n\n\t// yyxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.x, v.w);\n\t}\n\n\t// yyyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyx(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.x);\n\t}\n\n\t// yyyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyy(const glm::vec<2, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.y);\n\t}\n\n\t// yyyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.z);\n\t}\n\n\t// yyyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.y, v.w);\n\t}\n\n\t// yyzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.x);\n\t}\n\n\t// yyzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.y);\n\t}\n\n\t// yyzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.z);\n\t}\n\n\t// yyzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.z, v.w);\n\t}\n\n\t// yywx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.w, v.x);\n\t}\n\n\t// yywy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.w, v.y);\n\t}\n\n\t// yywz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.w, v.z);\n\t}\n\n\t// yyww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yyww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.y, v.w, v.w);\n\t}\n\n\t// yzxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.x);\n\t}\n\n\t// yzxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.y);\n\t}\n\n\t// yzxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.z);\n\t}\n\n\t// yzxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.x, v.w);\n\t}\n\n\t// yzyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.x);\n\t}\n\n\t// yzyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.y);\n\t}\n\n\t// yzyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.z);\n\t}\n\n\t// yzyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.y, v.w);\n\t}\n\n\t// yzzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.x);\n\t}\n\n\t// yzzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.y);\n\t}\n\n\t// yzzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.z);\n\t}\n\n\t// yzzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.z, v.w);\n\t}\n\n\t// yzwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.w, v.x);\n\t}\n\n\t// yzwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.w, v.y);\n\t}\n\n\t// yzwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.w, v.z);\n\t}\n\n\t// yzww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> yzww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.z, v.w, v.w);\n\t}\n\n\t// ywxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.x, v.x);\n\t}\n\n\t// ywxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.x, v.y);\n\t}\n\n\t// ywxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.x, v.z);\n\t}\n\n\t// ywxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.x, v.w);\n\t}\n\n\t// ywyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.y, v.x);\n\t}\n\n\t// ywyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.y, v.y);\n\t}\n\n\t// ywyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.y, v.z);\n\t}\n\n\t// ywyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.y, v.w);\n\t}\n\n\t// ywzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.z, v.x);\n\t}\n\n\t// ywzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.z, v.y);\n\t}\n\n\t// ywzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.z, v.z);\n\t}\n\n\t// ywzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.z, v.w);\n\t}\n\n\t// ywwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.w, v.x);\n\t}\n\n\t// ywwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.w, v.y);\n\t}\n\n\t// ywwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.w, v.z);\n\t}\n\n\t// ywww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> ywww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.y, v.w, v.w, v.w);\n\t}\n\n\t// zxxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.x);\n\t}\n\n\t// zxxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.y);\n\t}\n\n\t// zxxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.z);\n\t}\n\n\t// zxxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.x, v.w);\n\t}\n\n\t// zxyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.x);\n\t}\n\n\t// zxyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.y);\n\t}\n\n\t// zxyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.z);\n\t}\n\n\t// zxyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.y, v.w);\n\t}\n\n\t// zxzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.x);\n\t}\n\n\t// zxzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.y);\n\t}\n\n\t// zxzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.z);\n\t}\n\n\t// zxzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.z, v.w);\n\t}\n\n\t// zxwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.w, v.x);\n\t}\n\n\t// zxwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.w, v.y);\n\t}\n\n\t// zxwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.w, v.z);\n\t}\n\n\t// zxww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zxww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.x, v.w, v.w);\n\t}\n\n\t// zyxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.x);\n\t}\n\n\t// zyxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.y);\n\t}\n\n\t// zyxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.z);\n\t}\n\n\t// zyxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.x, v.w);\n\t}\n\n\t// zyyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.x);\n\t}\n\n\t// zyyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.y);\n\t}\n\n\t// zyyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.z);\n\t}\n\n\t// zyyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.y, v.w);\n\t}\n\n\t// zyzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.x);\n\t}\n\n\t// zyzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.y);\n\t}\n\n\t// zyzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.z);\n\t}\n\n\t// zyzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.z, v.w);\n\t}\n\n\t// zywx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.w, v.x);\n\t}\n\n\t// zywy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.w, v.y);\n\t}\n\n\t// zywz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.w, v.z);\n\t}\n\n\t// zyww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zyww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.y, v.w, v.w);\n\t}\n\n\t// zzxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.x);\n\t}\n\n\t// zzxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.y);\n\t}\n\n\t// zzxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.z);\n\t}\n\n\t// zzxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.x, v.w);\n\t}\n\n\t// zzyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.x);\n\t}\n\n\t// zzyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.y);\n\t}\n\n\t// zzyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.z);\n\t}\n\n\t// zzyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.y, v.w);\n\t}\n\n\t// zzzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzx(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.x);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.x);\n\t}\n\n\t// zzzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzy(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.y);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.y);\n\t}\n\n\t// zzzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzz(const glm::vec<3, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.z);\n\t}\n\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.z);\n\t}\n\n\t// zzzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.z, v.w);\n\t}\n\n\t// zzwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.w, v.x);\n\t}\n\n\t// zzwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.w, v.y);\n\t}\n\n\t// zzwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.w, v.z);\n\t}\n\n\t// zzww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zzww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.z, v.w, v.w);\n\t}\n\n\t// zwxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.x, v.x);\n\t}\n\n\t// zwxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.x, v.y);\n\t}\n\n\t// zwxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.x, v.z);\n\t}\n\n\t// zwxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.x, v.w);\n\t}\n\n\t// zwyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.y, v.x);\n\t}\n\n\t// zwyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.y, v.y);\n\t}\n\n\t// zwyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.y, v.z);\n\t}\n\n\t// zwyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.y, v.w);\n\t}\n\n\t// zwzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.z, v.x);\n\t}\n\n\t// zwzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.z, v.y);\n\t}\n\n\t// zwzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.z, v.z);\n\t}\n\n\t// zwzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.z, v.w);\n\t}\n\n\t// zwwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.w, v.x);\n\t}\n\n\t// zwwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.w, v.y);\n\t}\n\n\t// zwwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.w, v.z);\n\t}\n\n\t// zwww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> zwww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.z, v.w, v.w, v.w);\n\t}\n\n\t// wxxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.x, v.x);\n\t}\n\n\t// wxxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.x, v.y);\n\t}\n\n\t// wxxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.x, v.z);\n\t}\n\n\t// wxxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.x, v.w);\n\t}\n\n\t// wxyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.y, v.x);\n\t}\n\n\t// wxyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.y, v.y);\n\t}\n\n\t// wxyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.y, v.z);\n\t}\n\n\t// wxyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.y, v.w);\n\t}\n\n\t// wxzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.z, v.x);\n\t}\n\n\t// wxzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.z, v.y);\n\t}\n\n\t// wxzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.z, v.z);\n\t}\n\n\t// wxzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.z, v.w);\n\t}\n\n\t// wxwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.w, v.x);\n\t}\n\n\t// wxwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.w, v.y);\n\t}\n\n\t// wxwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.w, v.z);\n\t}\n\n\t// wxww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wxww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.x, v.w, v.w);\n\t}\n\n\t// wyxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.x, v.x);\n\t}\n\n\t// wyxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.x, v.y);\n\t}\n\n\t// wyxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.x, v.z);\n\t}\n\n\t// wyxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.x, v.w);\n\t}\n\n\t// wyyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.y, v.x);\n\t}\n\n\t// wyyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.y, v.y);\n\t}\n\n\t// wyyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.y, v.z);\n\t}\n\n\t// wyyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.y, v.w);\n\t}\n\n\t// wyzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.z, v.x);\n\t}\n\n\t// wyzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.z, v.y);\n\t}\n\n\t// wyzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.z, v.z);\n\t}\n\n\t// wyzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.z, v.w);\n\t}\n\n\t// wywx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wywx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.w, v.x);\n\t}\n\n\t// wywy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wywy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.w, v.y);\n\t}\n\n\t// wywz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wywz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.w, v.z);\n\t}\n\n\t// wyww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wyww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.y, v.w, v.w);\n\t}\n\n\t// wzxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.x, v.x);\n\t}\n\n\t// wzxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.x, v.y);\n\t}\n\n\t// wzxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.x, v.z);\n\t}\n\n\t// wzxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.x, v.w);\n\t}\n\n\t// wzyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.y, v.x);\n\t}\n\n\t// wzyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.y, v.y);\n\t}\n\n\t// wzyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.y, v.z);\n\t}\n\n\t// wzyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.y, v.w);\n\t}\n\n\t// wzzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.z, v.x);\n\t}\n\n\t// wzzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.z, v.y);\n\t}\n\n\t// wzzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.z, v.z);\n\t}\n\n\t// wzzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.z, v.w);\n\t}\n\n\t// wzwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.w, v.x);\n\t}\n\n\t// wzwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.w, v.y);\n\t}\n\n\t// wzwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.w, v.z);\n\t}\n\n\t// wzww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wzww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.z, v.w, v.w);\n\t}\n\n\t// wwxx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwxx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.x, v.x);\n\t}\n\n\t// wwxy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwxy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.x, v.y);\n\t}\n\n\t// wwxz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwxz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.x, v.z);\n\t}\n\n\t// wwxw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwxw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.x, v.w);\n\t}\n\n\t// wwyx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwyx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.y, v.x);\n\t}\n\n\t// wwyy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwyy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.y, v.y);\n\t}\n\n\t// wwyz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwyz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.y, v.z);\n\t}\n\n\t// wwyw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwyw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.y, v.w);\n\t}\n\n\t// wwzx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwzx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.z, v.x);\n\t}\n\n\t// wwzy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwzy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.z, v.y);\n\t}\n\n\t// wwzz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwzz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.z, v.z);\n\t}\n\n\t// wwzw\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwzw(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.z, v.w);\n\t}\n\n\t// wwwx\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwwx(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.w, v.x);\n\t}\n\n\t// wwwy\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwwy(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.w, v.y);\n\t}\n\n\t// wwwz\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwwz(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.w, v.z);\n\t}\n\n\t// wwww\n\ttemplate\n\tGLM_INLINE glm::vec<4, T, Q> wwww(const glm::vec<4, T, Q> &v) {\n\t\treturn glm::vec<4, T, Q>(v.w, v.w, v.w, v.w);\n\t}\n\n}\n"}, {"path": "includes/glm/gtx/vector_angle.hpp", "language": "code", "loc": 47, "comment_density": 0.574, "code": "/// @ref gtx_vector_angle\n/// @file glm/gtx/vector_angle.hpp\n///\n/// @see core (dependence)\n/// @see gtx_quaternion (dependence)\n/// @see gtx_epsilon (dependence)\n///\n/// @defgroup gtx_vector_angle GLM_GTX_vector_angle\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Compute angle between vectors\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/epsilon.hpp\"\n#include \"../gtx/quaternion.hpp\"\n#include \"../gtx/rotate_vector.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_vector_angle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_vector_angle extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_vector_angle\n\t/// @{\n\n\t//! Returns the absolute angle between two vectors.\n\t//! Parameters need to be normalized.\n\t/// @see gtx_vector_angle extension.\n\ttemplate\n\tGLM_FUNC_DECL T angle(vec const& x, vec const& y);\n\n\t//! Returns the oriented angle between two 2d vectors.\n\t//! Parameters need to be normalized.\n\t/// @see gtx_vector_angle extension.\n\ttemplate\n\tGLM_FUNC_DECL T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y);\n\n\t//! Returns the oriented angle between two 3d vectors based from a reference axis.\n\t//! Parameters need to be normalized.\n\t/// @see gtx_vector_angle extension.\n\ttemplate\n\tGLM_FUNC_DECL T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref);\n\n\t/// @}\n}// namespace glm\n\n#include \"vector_angle.inl\"\n"}, {"path": "includes/glm/gtx/vector_query.hpp", "language": "code", "loc": 53, "comment_density": 0.528, "code": "/// @ref gtx_vector_query\n/// @file glm/gtx/vector_query.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_vector_query GLM_GTX_vector_query\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Query informations of vector types\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \n#include \n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_vector_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_vector_query extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_vector_query\n\t/// @{\n\n\t//! Check whether two vectors are collinears.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool areCollinear(vec const& v0, vec const& v1, T const& epsilon);\n\n\t//! Check whether two vectors are orthogonals.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool areOrthogonal(vec const& v0, vec const& v1, T const& epsilon);\n\n\t//! Check whether a vector is normalized.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool isNormalized(vec const& v, T const& epsilon);\n\n\t//! Check whether a vector is null.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool isNull(vec const& v, T const& epsilon);\n\n\t//! Check whether a each component of a vector is null.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL vec isCompNull(vec const& v, T const& epsilon);\n\n\t//! Check whether two vectors are orthonormal.\n\t/// @see gtx_vector_query extensions.\n\ttemplate\n\tGLM_FUNC_DECL bool areOrthonormal(vec const& v0, vec const& v1, T const& epsilon);\n\n\t/// @}\n}// namespace glm\n\n#include \"vector_query.inl\"\n"}, {"path": "includes/glm/gtx/wrap.hpp", "language": "code", "loc": 44, "comment_density": 0.545, "code": "/// @ref gtx_wrap\n/// @file glm/gtx/wrap.hpp\n///\n/// @see core (dependence)\n///\n/// @defgroup gtx_wrap GLM_GTX_wrap\n/// @ingroup gtx\n///\n/// Include to use the features of this extension.\n///\n/// Wrapping mode of texture coordinates.\n\n#pragma once\n\n// Dependency:\n#include \"../glm.hpp\"\n#include \"../gtc/vec1.hpp\"\n\n#ifndef GLM_ENABLE_EXPERIMENTAL\n#\terror \"GLM: GLM_GTX_wrap is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.\"\n#endif\n\n#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)\n#\tpragma message(\"GLM: GLM_GTX_wrap extension included\")\n#endif\n\nnamespace glm\n{\n\t/// @addtogroup gtx_wrap\n\t/// @{\n\n\t/// Simulate GL_CLAMP OpenGL wrap mode\n\t/// @see gtx_wrap extension.\n\ttemplate\n\tGLM_FUNC_DECL genType clamp(genType const& Texcoord);\n\n\t/// Simulate GL_REPEAT OpenGL wrap mode\n\t/// @see gtx_wrap extension.\n\ttemplate\n\tGLM_FUNC_DECL genType repeat(genType const& Texcoord);\n\n\t/// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode\n\t/// @see gtx_wrap extension.\n\ttemplate\n\tGLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord);\n\n\t/// Simulate GL_MIRROR_REPEAT OpenGL wrap mode\n\t/// @see gtx_wrap extension.\n\ttemplate\n\tGLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord);\n\n\t/// @}\n}// namespace glm\n\n#include \"wrap.inl\"\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.512, "dedup_hash": "e6358ecf44f07564", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_glm_simd", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Simd", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/glm/simd/common.h", "language": "code", "loc": 208, "comment_density": 0.101, "code": "/// @ref simd\n/// @file glm/simd/common.h\n\n#pragma once\n\n#include \"platform.h\"\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_add(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_add_ps(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_add(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_add_ss(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sub(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_sub_ps(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sub(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_sub_ss(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_mul(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_mul_ps(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_mul(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_mul_ss(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_div(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_div_ps(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_div(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn _mm_div_ss(a, b);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_div_lowp(glm_f32vec4 a, glm_f32vec4 b)\n{\n\treturn glm_vec4_mul(a, _mm_rcp_ps(b));\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_swizzle_xyzw(glm_f32vec4 a)\n{\n#\tif GLM_ARCH & GLM_ARCH_AVX2_BIT\n\t\treturn _mm_permute_ps(a, _MM_SHUFFLE(3, 2, 1, 0));\n#\telse\n\t\treturn _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 1, 0));\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_fma(glm_f32vec4 a, glm_f32vec4 b, glm_f32vec4 c)\n{\n#\tif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && !(GLM_COMPILER & GLM_COMPILER_CLANG)\n\t\treturn _mm_fmadd_ss(a, b, c);\n#\telse\n\t\treturn _mm_add_ss(_mm_mul_ss(a, b), c);\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_fma(glm_f32vec4 a, glm_f32vec4 b, glm_f32vec4 c)\n{\n#\tif (GLM_ARCH & GLM_ARCH_AVX2_BIT) && !(GLM_COMPILER & GLM_COMPILER_CLANG)\n\t\treturn _mm_fmadd_ps(a, b, c);\n#\telse\n\t\treturn glm_vec4_add(glm_vec4_mul(a, b), c);\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_abs(glm_f32vec4 x)\n{\n\treturn _mm_and_ps(x, _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF)));\n}\n\nGLM_FUNC_QUALIFIER glm_ivec4 glm_ivec4_abs(glm_ivec4 x)\n{\n#\tif GLM_ARCH & GLM_ARCH_SSSE3_BIT\n\t\treturn _mm_sign_epi32(x, x);\n#\telse\n\t\tglm_ivec4 const sgn0 = _mm_srai_epi32(x, 31);\n\t\tglm_ivec4 const inv0 = _mm_xor_si128(x, sgn0);\n\t\tglm_ivec4 const sub0 = _mm_sub_epi32(inv0, sgn0);\n\t\treturn sub0;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_sign(glm_vec4 x)\n{\n\tglm_vec4 const zro0 = _mm_setzero_ps();\n\tglm_vec4 const cmp0 = _mm_cmplt_ps(x, zro0);\n\tglm_vec4 const cmp1 = _mm_cmpgt_ps(x, zro0);\n\tglm_vec4 const and0 = _mm_and_ps(cmp0, _mm_set1_ps(-1.0f));\n\tglm_vec4 const and1 = _mm_and_ps(cmp1, _mm_set1_ps(1.0f));\n\tglm_vec4 const or0 = _mm_or_ps(and0, and1);;\n\treturn or0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_round(glm_vec4 x)\n{\n#\tif GLM_ARCH & GLM_ARCH_SSE41_BIT\n\t\treturn _mm_round_ps(x, _MM_FROUND_TO_NEAREST_INT);\n#\telse\n\t\tglm_vec4 const sgn0 = _mm_castsi128_ps(_mm_set1_epi32(int(0x80000000)));\n\t\tglm_vec4 const and0 = _mm_and_ps(sgn0, x);\n\t\tglm_vec4 const or0 = _mm_or_ps(and0, _mm_set_ps1(8388608.0f));\n\t\tglm_vec4 const add0 = glm_vec4_add(x, or0);\n\t\tglm_vec4 const sub0 = glm_vec4_sub(add0, or0);\n\t\treturn sub0;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_floor(glm_vec4 x)\n{\n#\tif GLM_ARCH & GLM_ARCH_SSE41_BIT\n\t\treturn _mm_floor_ps(x);\n#\telse\n\t\tglm_vec4 const rnd0 = glm_vec4_round(x);\n\t\tglm_vec4 const cmp0 = _mm_cmplt_ps(x, rnd0);\n\t\tglm_vec4 const and0 = _mm_and_ps(cmp0, _mm_set1_ps(1.0f));\n\t\tglm_vec4 const sub0 = glm_vec4_sub(rnd0, and0);\n\t\treturn sub0;\n#\tendif\n}\n\n/* trunc TODO\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_trunc(glm_vec4 x)\n{\n\treturn glm_vec4();\n}\n*/\n\n//roundEven\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_roundEven(glm_vec4 x)\n{\n\tglm_vec4 const sgn0 = _mm_castsi128_ps(_mm_set1_epi32(int(0x80000000)));\n\tglm_vec4 const and0 = _mm_and_ps(sgn0, x);\n\tglm_vec4 const or0 = _mm_or_ps(and0, _mm_set_ps1(8388608.0f));\n\tglm_vec4 const add0 = glm_vec4_add(x, or0);\n\tglm_vec4 const sub0 = glm_vec4_sub(add0, or0);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_ceil(glm_vec4 x)\n{\n#\tif GLM_ARCH & GLM_ARCH_SSE41_BIT\n\t\treturn _mm_ceil_ps(x);\n#\telse\n\t\tglm_vec4 const rnd0 = glm_vec4_round(x);\n\t\tglm_vec4 const cmp0 = _mm_cmpgt_ps(x, rnd0);\n\t\tglm_vec4 const and0 = _mm_and_ps(cmp0, _mm_set1_ps(1.0f));\n\t\tglm_vec4 const add0 = glm_vec4_add(rnd0, and0);\n\t\treturn add0;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_fract(glm_vec4 x)\n{\n\tglm_vec4 const flr0 = glm_vec4_floor(x);\n\tglm_vec4 const sub0 = glm_vec4_sub(x, flr0);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_mod(glm_vec4 x, glm_vec4 y)\n{\n\tglm_vec4 const div0 = glm_vec4_div(x, y);\n\tglm_vec4 const flr0 = glm_vec4_floor(div0);\n\tglm_vec4 const mul0 = glm_vec4_mul(y, flr0);\n\tglm_vec4 const sub0 = glm_vec4_sub(x, mul0);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_clamp(glm_vec4 v, glm_vec4 minVal, glm_vec4 maxVal)\n{\n\tglm_vec4 const min0 = _mm_min_ps(v, maxVal);\n\tglm_vec4 const max0 = _mm_max_ps(min0, minVal);\n\treturn max0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_mix(glm_vec4 v1, glm_vec4 v2, glm_vec4 a)\n{\n\tglm_vec4 const sub0 = glm_vec4_sub(_mm_set1_ps(1.0f), a);\n\tglm_vec4 const mul0 = glm_vec4_mul(v1, sub0);\n\tglm_vec4 const mad0 = glm_vec4_fma(v2, a, mul0);\n\treturn mad0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_step(glm_vec4 edge, glm_vec4 x)\n{\n\tglm_vec4 const cmp = _mm_cmple_ps(x, edge);\n\treturn _mm_movemask_ps(cmp) == 0 ? _mm_set1_ps(1.0f) : _mm_setzero_ps();\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_smoothstep(glm_vec4 edge0, glm_vec4 edge1, glm_vec4 x)\n{\n\tglm_vec4 const sub0 = glm_vec4_sub(x, edge0);\n\tglm_vec4 const sub1 = glm_vec4_sub(edge1, edge0);\n\tglm_vec4 const div0 = glm_vec4_sub(sub0, sub1);\n\tglm_vec4 const clp0 = glm_vec4_clamp(div0, _mm_setzero_ps(), _mm_set1_ps(1.0f));\n\tglm_vec4 const mul0 = glm_vec4_mul(_mm_set1_ps(2.0f), clp0);\n\tglm_vec4 const sub2 = glm_vec4_sub(_mm_set1_ps(3.0f), mul0);\n\tglm_vec4 const mul1 = glm_vec4_mul(clp0, clp0);\n\tglm_vec4 const mul2 = glm_vec4_mul(mul1, sub2);\n\treturn mul2;\n}\n\n// Agner Fog method\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_nan(glm_vec4 x)\n{\n\tglm_ivec4 const t1 = _mm_castps_si128(x);\t\t\t\t\t\t// reinterpret as 32-bit integer\n\tglm_ivec4 const t2 = _mm_sll_epi32(t1, _mm_cvtsi32_si128(1));\t// shift out sign bit\n\tglm_ivec4 const t3 = _mm_set1_epi32(int(0xFF000000));\t\t\t\t// exponent mask\n\tglm_ivec4 const t4 = _mm_and_si128(t2, t3);\t\t\t\t\t\t// exponent\n\tglm_ivec4 const t5 = _mm_andnot_si128(t3, t2);\t\t\t\t\t// fraction\n\tglm_ivec4 const Equal = _mm_cmpeq_epi32(t3, t4);\n\tglm_ivec4 const Nequal = _mm_cmpeq_epi32(t5, _mm_setzero_si128());\n\tglm_ivec4 const And = _mm_and_si128(Equal, Nequal);\n\treturn _mm_castsi128_ps(And);\t\t\t\t\t\t\t\t\t// exponent = all 1s and fraction != 0\n}\n\n// Agner Fog method\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_inf(glm_vec4 x)\n{\n\tglm_ivec4 const t1 = _mm_castps_si128(x);\t\t\t\t\t\t\t\t\t\t// reinterpret as 32-bit integer\n\tglm_ivec4 const t2 = _mm_sll_epi32(t1, _mm_cvtsi32_si128(1));\t\t\t\t\t// shift out sign bit\n\treturn _mm_castsi128_ps(_mm_cmpeq_epi32(t2, _mm_set1_epi32(int(0xFF000000))));\t\t// exponent is all 1s, fraction is 0\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/exponential.h", "language": "code", "loc": 14, "comment_density": 0.214, "code": "/// @ref simd\n/// @file glm/simd/experimental.h\n\n#pragma once\n\n#include \"platform.h\"\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sqrt_lowp(glm_f32vec4 x)\n{\n\treturn _mm_mul_ss(_mm_rsqrt_ss(x), x);\n}\n\nGLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sqrt_lowp(glm_f32vec4 x)\n{\n\treturn _mm_mul_ps(_mm_rsqrt_ps(x), x);\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/geometric.h", "language": "code", "loc": 107, "comment_density": 0.028, "code": "/// @ref simd\n/// @file glm/simd/geometric.h\n\n#pragma once\n\n#include \"common.h\"\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_DECL glm_vec4 glm_vec4_dot(glm_vec4 v1, glm_vec4 v2);\nGLM_FUNC_DECL glm_vec4 glm_vec1_dot(glm_vec4 v1, glm_vec4 v2);\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_length(glm_vec4 x)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(x, x);\n\tglm_vec4 const sqt0 = _mm_sqrt_ps(dot0);\n\treturn sqt0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_distance(glm_vec4 p0, glm_vec4 p1)\n{\n\tglm_vec4 const sub0 = _mm_sub_ps(p0, p1);\n\tglm_vec4 const len0 = glm_vec4_length(sub0);\n\treturn len0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_dot(glm_vec4 v1, glm_vec4 v2)\n{\n#\tif GLM_ARCH & GLM_ARCH_AVX_BIT\n\t\treturn _mm_dp_ps(v1, v2, 0xff);\n#\telif GLM_ARCH & GLM_ARCH_SSE3_BIT\n\t\tglm_vec4 const mul0 = _mm_mul_ps(v1, v2);\n\t\tglm_vec4 const hadd0 = _mm_hadd_ps(mul0, mul0);\n\t\tglm_vec4 const hadd1 = _mm_hadd_ps(hadd0, hadd0);\n\t\treturn hadd1;\n#\telse\n\t\tglm_vec4 const mul0 = _mm_mul_ps(v1, v2);\n\t\tglm_vec4 const swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1));\n\t\tglm_vec4 const add0 = _mm_add_ps(mul0, swp0);\n\t\tglm_vec4 const swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3));\n\t\tglm_vec4 const add1 = _mm_add_ps(add0, swp1);\n\t\treturn add1;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec1_dot(glm_vec4 v1, glm_vec4 v2)\n{\n#\tif GLM_ARCH & GLM_ARCH_AVX_BIT\n\t\treturn _mm_dp_ps(v1, v2, 0xff);\n#\telif GLM_ARCH & GLM_ARCH_SSE3_BIT\n\t\tglm_vec4 const mul0 = _mm_mul_ps(v1, v2);\n\t\tglm_vec4 const had0 = _mm_hadd_ps(mul0, mul0);\n\t\tglm_vec4 const had1 = _mm_hadd_ps(had0, had0);\n\t\treturn had1;\n#\telse\n\t\tglm_vec4 const mul0 = _mm_mul_ps(v1, v2);\n\t\tglm_vec4 const mov0 = _mm_movehl_ps(mul0, mul0);\n\t\tglm_vec4 const add0 = _mm_add_ps(mov0, mul0);\n\t\tglm_vec4 const swp1 = _mm_shuffle_ps(add0, add0, 1);\n\t\tglm_vec4 const add1 = _mm_add_ss(add0, swp1);\n\t\treturn add1;\n#\tendif\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_cross(glm_vec4 v1, glm_vec4 v2)\n{\n\tglm_vec4 const swp0 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 0, 2, 1));\n\tglm_vec4 const swp1 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 1, 0, 2));\n\tglm_vec4 const swp2 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 0, 2, 1));\n\tglm_vec4 const swp3 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 1, 0, 2));\n\tglm_vec4 const mul0 = _mm_mul_ps(swp0, swp3);\n\tglm_vec4 const mul1 = _mm_mul_ps(swp1, swp2);\n\tglm_vec4 const sub0 = _mm_sub_ps(mul0, mul1);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_normalize(glm_vec4 v)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(v, v);\n\tglm_vec4 const isr0 = _mm_rsqrt_ps(dot0);\n\tglm_vec4 const mul0 = _mm_mul_ps(v, isr0);\n\treturn mul0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_faceforward(glm_vec4 N, glm_vec4 I, glm_vec4 Nref)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(Nref, I);\n\tglm_vec4 const sgn0 = glm_vec4_sign(dot0);\n\tglm_vec4 const mul0 = _mm_mul_ps(sgn0, _mm_set1_ps(-1.0f));\n\tglm_vec4 const mul1 = _mm_mul_ps(N, mul0);\n\treturn mul1;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_vec4_reflect(glm_vec4 I, glm_vec4 N)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(N, I);\n\tglm_vec4 const mul0 = _mm_mul_ps(N, dot0);\n\tglm_vec4 const mul1 = _mm_mul_ps(mul0, _mm_set1_ps(2.0f));\n\tglm_vec4 const sub0 = _mm_sub_ps(I, mul1);\n\treturn sub0;\n}\n\nGLM_FUNC_QUALIFIER __m128 glm_vec4_refract(glm_vec4 I, glm_vec4 N, glm_vec4 eta)\n{\n\tglm_vec4 const dot0 = glm_vec4_dot(N, I);\n\tglm_vec4 const mul0 = _mm_mul_ps(eta, eta);\n\tglm_vec4 const mul1 = _mm_mul_ps(dot0, dot0);\n\tglm_vec4 const sub0 = _mm_sub_ps(_mm_set1_ps(1.0f), mul0);\n\tglm_vec4 const sub1 = _mm_sub_ps(_mm_set1_ps(1.0f), mul1);\n\tglm_vec4 const mul2 = _mm_mul_ps(sub0, sub1);\n\n\tif(_mm_movemask_ps(_mm_cmplt_ss(mul2, _mm_set1_ps(0.0f))) == 0)\n\t\treturn _mm_set1_ps(0.0f);\n\n\tglm_vec4 const sqt0 = _mm_sqrt_ps(mul2);\n\tglm_vec4 const mad0 = glm_vec4_fma(eta, dot0, sqt0);\n\tglm_vec4 const mul4 = _mm_mul_ps(mad0, N);\n\tglm_vec4 const mul5 = _mm_mul_ps(eta, I);\n\tglm_vec4 const sub2 = _mm_sub_ps(mul5, mul4);\n\n\treturn sub2;\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/integer.h", "language": "code", "loc": 92, "comment_density": 0.326, "code": "/// @ref simd\n/// @file glm/simd/integer.h\n\n#pragma once\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_QUALIFIER glm_uvec4 glm_i128_interleave(glm_uvec4 x)\n{\n\tglm_uvec4 const Mask4 = _mm_set1_epi32(0x0000FFFF);\n\tglm_uvec4 const Mask3 = _mm_set1_epi32(0x00FF00FF);\n\tglm_uvec4 const Mask2 = _mm_set1_epi32(0x0F0F0F0F);\n\tglm_uvec4 const Mask1 = _mm_set1_epi32(0x33333333);\n\tglm_uvec4 const Mask0 = _mm_set1_epi32(0x55555555);\n\n\tglm_uvec4 Reg1;\n\tglm_uvec4 Reg2;\n\n\t// REG1 = x;\n\t// REG2 = y;\n\t//Reg1 = _mm_unpacklo_epi64(x, y);\n\tReg1 = x;\n\n\t//REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF);\n\t//REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF);\n\tReg2 = _mm_slli_si128(Reg1, 2);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask4);\n\n\t//REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF);\n\t//REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF);\n\tReg2 = _mm_slli_si128(Reg1, 1);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask3);\n\n\t//REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F);\n\t//REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F);\n\tReg2 = _mm_slli_epi32(Reg1, 4);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask2);\n\n\t//REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333);\n\t//REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333);\n\tReg2 = _mm_slli_epi32(Reg1, 2);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask1);\n\n\t//REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555);\n\t//REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555);\n\tReg2 = _mm_slli_epi32(Reg1, 1);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask0);\n\n\t//return REG1 | (REG2 << 1);\n\tReg2 = _mm_slli_epi32(Reg1, 1);\n\tReg2 = _mm_srli_si128(Reg2, 8);\n\tReg1 = _mm_or_si128(Reg1, Reg2);\n\n\treturn Reg1;\n}\n\nGLM_FUNC_QUALIFIER glm_uvec4 glm_i128_interleave2(glm_uvec4 x, glm_uvec4 y)\n{\n\tglm_uvec4 const Mask4 = _mm_set1_epi32(0x0000FFFF);\n\tglm_uvec4 const Mask3 = _mm_set1_epi32(0x00FF00FF);\n\tglm_uvec4 const Mask2 = _mm_set1_epi32(0x0F0F0F0F);\n\tglm_uvec4 const Mask1 = _mm_set1_epi32(0x33333333);\n\tglm_uvec4 const Mask0 = _mm_set1_epi32(0x55555555);\n\n\tglm_uvec4 Reg1;\n\tglm_uvec4 Reg2;\n\n\t// REG1 = x;\n\t// REG2 = y;\n\tReg1 = _mm_unpacklo_epi64(x, y);\n\n\t//REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF);\n\t//REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF);\n\tReg2 = _mm_slli_si128(Reg1, 2);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask4);\n\n\t//REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF);\n\t//REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF);\n\tReg2 = _mm_slli_si128(Reg1, 1);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask3);\n\n\t//REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F);\n\t//REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F);\n\tReg2 = _mm_slli_epi32(Reg1, 4);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask2);\n\n\t//REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333);\n\t//REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333);\n\tReg2 = _mm_slli_epi32(Reg1, 2);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask1);\n\n\t//REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555);\n\t//REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555);\n\tReg2 = _mm_slli_epi32(Reg1, 1);\n\tReg1 = _mm_or_si128(Reg2, Reg1);\n\tReg1 = _mm_and_si128(Reg1, Mask0);\n\n\t//return REG1 | (REG2 << 1);\n\tReg2 = _mm_slli_epi32(Reg1, 1);\n\tReg2 = _mm_srli_si128(Reg2, 8);\n\tReg1 = _mm_or_si128(Reg1, Reg2);\n\n\treturn Reg1;\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/matrix.h", "language": "code", "loc": 848, "comment_density": 0.36, "code": "/// @ref simd\n/// @file glm/simd/matrix.h\n\n#pragma once\n\n#include \"geometric.h\"\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\nGLM_FUNC_QUALIFIER void glm_mat4_matrixCompMult(glm_vec4 const in1[4], glm_vec4 const in2[4], glm_vec4 out[4])\n{\n\tout[0] = _mm_mul_ps(in1[0], in2[0]);\n\tout[1] = _mm_mul_ps(in1[1], in2[1]);\n\tout[2] = _mm_mul_ps(in1[2], in2[2]);\n\tout[3] = _mm_mul_ps(in1[3], in2[3]);\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_add(glm_vec4 const in1[4], glm_vec4 const in2[4], glm_vec4 out[4])\n{\n\tout[0] = _mm_add_ps(in1[0], in2[0]);\n\tout[1] = _mm_add_ps(in1[1], in2[1]);\n\tout[2] = _mm_add_ps(in1[2], in2[2]);\n\tout[3] = _mm_add_ps(in1[3], in2[3]);\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_sub(glm_vec4 const in1[4], glm_vec4 const in2[4], glm_vec4 out[4])\n{\n\tout[0] = _mm_sub_ps(in1[0], in2[0]);\n\tout[1] = _mm_sub_ps(in1[1], in2[1]);\n\tout[2] = _mm_sub_ps(in1[2], in2[2]);\n\tout[3] = _mm_sub_ps(in1[3], in2[3]);\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_mat4_mul_vec4(glm_vec4 const m[4], glm_vec4 v)\n{\n\t__m128 v0 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 v1 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 v2 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 v3 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(3, 3, 3, 3));\n\n\t__m128 m0 = _mm_mul_ps(m[0], v0);\n\t__m128 m1 = _mm_mul_ps(m[1], v1);\n\t__m128 m2 = _mm_mul_ps(m[2], v2);\n\t__m128 m3 = _mm_mul_ps(m[3], v3);\n\n\t__m128 a0 = _mm_add_ps(m0, m1);\n\t__m128 a1 = _mm_add_ps(m2, m3);\n\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\treturn a2;\n}\n\nGLM_FUNC_QUALIFIER __m128 glm_vec4_mul_mat4(glm_vec4 v, glm_vec4 const m[4])\n{\n\t__m128 i0 = m[0];\n\t__m128 i1 = m[1];\n\t__m128 i2 = m[2];\n\t__m128 i3 = m[3];\n\n\t__m128 m0 = _mm_mul_ps(v, i0);\n\t__m128 m1 = _mm_mul_ps(v, i1);\n\t__m128 m2 = _mm_mul_ps(v, i2);\n\t__m128 m3 = _mm_mul_ps(v, i3);\n\n\t__m128 u0 = _mm_unpacklo_ps(m0, m1);\n\t__m128 u1 = _mm_unpackhi_ps(m0, m1);\n\t__m128 a0 = _mm_add_ps(u0, u1);\n\n\t__m128 u2 = _mm_unpacklo_ps(m2, m3);\n\t__m128 u3 = _mm_unpackhi_ps(m2, m3);\n\t__m128 a1 = _mm_add_ps(u2, u3);\n\n\t__m128 f0 = _mm_movelh_ps(a0, a1);\n\t__m128 f1 = _mm_movehl_ps(a1, a0);\n\t__m128 f2 = _mm_add_ps(f0, f1);\n\n\treturn f2;\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_mul(glm_vec4 const in1[4], glm_vec4 const in2[4], glm_vec4 out[4])\n{\n\t{\n\t\t__m128 e0 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 e1 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 e2 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 e3 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 m0 = _mm_mul_ps(in1[0], e0);\n\t\t__m128 m1 = _mm_mul_ps(in1[1], e1);\n\t\t__m128 m2 = _mm_mul_ps(in1[2], e2);\n\t\t__m128 m3 = _mm_mul_ps(in1[3], e3);\n\n\t\t__m128 a0 = _mm_add_ps(m0, m1);\n\t\t__m128 a1 = _mm_add_ps(m2, m3);\n\t\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\t\tout[0] = a2;\n\t}\n\n\t{\n\t\t__m128 e0 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 e1 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 e2 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 e3 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 m0 = _mm_mul_ps(in1[0], e0);\n\t\t__m128 m1 = _mm_mul_ps(in1[1], e1);\n\t\t__m128 m2 = _mm_mul_ps(in1[2], e2);\n\t\t__m128 m3 = _mm_mul_ps(in1[3], e3);\n\n\t\t__m128 a0 = _mm_add_ps(m0, m1);\n\t\t__m128 a1 = _mm_add_ps(m2, m3);\n\t\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\t\tout[1] = a2;\n\t}\n\n\t{\n\t\t__m128 e0 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 e1 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 e2 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 e3 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 m0 = _mm_mul_ps(in1[0], e0);\n\t\t__m128 m1 = _mm_mul_ps(in1[1], e1);\n\t\t__m128 m2 = _mm_mul_ps(in1[2], e2);\n\t\t__m128 m3 = _mm_mul_ps(in1[3], e3);\n\n\t\t__m128 a0 = _mm_add_ps(m0, m1);\n\t\t__m128 a1 = _mm_add_ps(m2, m3);\n\t\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\t\tout[2] = a2;\n\t}\n\n\t{\n\t\t//(__m128&)_mm_shuffle_epi32(__m128i&)in2[0], _MM_SHUFFLE(3, 3, 3, 3))\n\t\t__m128 e0 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 e1 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 e2 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 e3 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 m0 = _mm_mul_ps(in1[0], e0);\n\t\t__m128 m1 = _mm_mul_ps(in1[1], e1);\n\t\t__m128 m2 = _mm_mul_ps(in1[2], e2);\n\t\t__m128 m3 = _mm_mul_ps(in1[3], e3);\n\n\t\t__m128 a0 = _mm_add_ps(m0, m1);\n\t\t__m128 a1 = _mm_add_ps(m2, m3);\n\t\t__m128 a2 = _mm_add_ps(a0, a1);\n\n\t\tout[3] = a2;\n\t}\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_transpose(glm_vec4 const in[4], glm_vec4 out[4])\n{\n\t__m128 tmp0 = _mm_shuffle_ps(in[0], in[1], 0x44);\n\t__m128 tmp2 = _mm_shuffle_ps(in[0], in[1], 0xEE);\n\t__m128 tmp1 = _mm_shuffle_ps(in[2], in[3], 0x44);\n\t__m128 tmp3 = _mm_shuffle_ps(in[2], in[3], 0xEE);\n\n\tout[0] = _mm_shuffle_ps(tmp0, tmp1, 0x88);\n\tout[1] = _mm_shuffle_ps(tmp0, tmp1, 0xDD);\n\tout[2] = _mm_shuffle_ps(tmp2, tmp3, 0x88);\n\tout[3] = _mm_shuffle_ps(tmp2, tmp3, 0xDD);\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_mat4_determinant_highp(glm_vec4 const in[4])\n{\n\t__m128 Fac0;\n\t{\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];\n\t\t//\tvalType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac0 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac1;\n\t{\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];\n\t\t//\tvalType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac1 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\n\t__m128 Fac2;\n\t{\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];\n\t\t//\tvalType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac2 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac3;\n\t{\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];\n\t\t//\tvalType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac3 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac4;\n\t{\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];\n\t\t//\tvalType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac4 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac5;\n\t{\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];\n\t\t//\tvalType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac5 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);\n\t__m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);\n\n\t// m[1][0]\n\t// m[0][0]\n\t// m[0][0]\n\t// m[0][0]\n\t__m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][1]\n\t// m[0][1]\n\t// m[0][1]\n\t// m[0][1]\n\t__m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][2]\n\t// m[0][2]\n\t// m[0][2]\n\t// m[0][2]\n\t__m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][3]\n\t// m[0][3]\n\t// m[0][3]\n\t// m[0][3]\n\t__m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));\n\t__m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// col0\n\t// + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),\n\t// - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),\n\t// + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),\n\t// - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),\n\t__m128 Mul00 = _mm_mul_ps(Vec1, Fac0);\n\t__m128 Mul01 = _mm_mul_ps(Vec2, Fac1);\n\t__m128 Mul02 = _mm_mul_ps(Vec3, Fac2);\n\t__m128 Sub00 = _mm_sub_ps(Mul00, Mul01);\n\t__m128 Add00 = _mm_add_ps(Sub00, Mul02);\n\t__m128 Inv0 = _mm_mul_ps(SignB, Add00);\n\n\t// col1\n\t// - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),\n\t// + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),\n\t// - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),\n\t// + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),\n\t__m128 Mul03 = _mm_mul_ps(Vec0, Fac0);\n\t__m128 Mul04 = _mm_mul_ps(Vec2, Fac3);\n\t__m128 Mul05 = _mm_mul_ps(Vec3, Fac4);\n\t__m128 Sub01 = _mm_sub_ps(Mul03, Mul04);\n\t__m128 Add01 = _mm_add_ps(Sub01, Mul05);\n\t__m128 Inv1 = _mm_mul_ps(SignA, Add01);\n\n\t// col2\n\t// + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),\n\t// - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),\n\t// + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),\n\t// - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),\n\t__m128 Mul06 = _mm_mul_ps(Vec0, Fac1);\n\t__m128 Mul07 = _mm_mul_ps(Vec1, Fac3);\n\t__m128 Mul08 = _mm_mul_ps(Vec3, Fac5);\n\t__m128 Sub02 = _mm_sub_ps(Mul06, Mul07);\n\t__m128 Add02 = _mm_add_ps(Sub02, Mul08);\n\t__m128 Inv2 = _mm_mul_ps(SignB, Add02);\n\n\t// col3\n\t// - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),\n\t// + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),\n\t// - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),\n\t// + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));\n\t__m128 Mul09 = _mm_mul_ps(Vec0, Fac2);\n\t__m128 Mul10 = _mm_mul_ps(Vec1, Fac4);\n\t__m128 Mul11 = _mm_mul_ps(Vec2, Fac5);\n\t__m128 Sub03 = _mm_sub_ps(Mul09, Mul10);\n\t__m128 Add03 = _mm_add_ps(Sub03, Mul11);\n\t__m128 Inv3 = _mm_mul_ps(SignA, Add03);\n\n\t__m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));\n\n\t//\tvalType Determinant = m[0][0] * Inverse[0][0]\n\t//\t\t\t\t\t\t+ m[0][1] * Inverse[1][0]\n\t//\t\t\t\t\t\t+ m[0][2] * Inverse[2][0]\n\t//\t\t\t\t\t\t+ m[0][3] * Inverse[3][0];\n\t__m128 Det0 = glm_vec4_dot(in[0], Row2);\n\treturn Det0;\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_mat4_determinant_lowp(glm_vec4 const m[4])\n{\n\t// _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(\n\n\t//T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t//T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t//T SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t//T SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t//T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t//T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\n\t// First 2 columns\n \t__m128 Swp2A = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(0, 1, 1, 2)));\n \t__m128 Swp3A = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(3, 2, 3, 3)));\n\t__m128 MulA = _mm_mul_ps(Swp2A, Swp3A);\n\n\t// Second 2 columns\n\t__m128 Swp2B = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(3, 2, 3, 3)));\n\t__m128 Swp3B = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(0, 1, 1, 2)));\n\t__m128 MulB = _mm_mul_ps(Swp2B, Swp3B);\n\n\t// Columns subtraction\n\t__m128 SubE = _mm_sub_ps(MulA, MulB);\n\n\t// Last 2 rows\n\t__m128 Swp2C = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[2]), _MM_SHUFFLE(0, 0, 1, 2)));\n\t__m128 Swp3C = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[3]), _MM_SHUFFLE(1, 2, 0, 0)));\n\t__m128 MulC = _mm_mul_ps(Swp2C, Swp3C);\n\t__m128 SubF = _mm_sub_ps(_mm_movehl_ps(MulC, MulC), MulC);\n\n\t//vec<4, T, Q> DetCof(\n\t//\t+ (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02),\n\t//\t- (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04),\n\t//\t+ (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05),\n\t//\t- (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05));\n\n\t__m128 SubFacA = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubE), _MM_SHUFFLE(2, 1, 0, 0)));\n\t__m128 SwpFacA = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(0, 0, 0, 1)));\n\t__m128 MulFacA = _mm_mul_ps(SwpFacA, SubFacA);\n\n\t__m128 SubTmpB = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(0, 0, 3, 1));\n\t__m128 SubFacB = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubTmpB), _MM_SHUFFLE(3, 1, 1, 0)));//SubF[0], SubE[3], SubE[3], SubE[1];\n\t__m128 SwpFacB = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(1, 1, 2, 2)));\n\t__m128 MulFacB = _mm_mul_ps(SwpFacB, SubFacB);\n\n\t__m128 SubRes = _mm_sub_ps(MulFacA, MulFacB);\n\n\t__m128 SubTmpC = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(1, 0, 2, 2));\n\t__m128 SubFacC = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(SubTmpC), _MM_SHUFFLE(3, 3, 2, 0)));\n\t__m128 SwpFacC = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(m[1]), _MM_SHUFFLE(2, 3, 3, 3)));\n\t__m128 MulFacC = _mm_mul_ps(SwpFacC, SubFacC);\n\n\t__m128 AddRes = _mm_add_ps(SubRes, MulFacC);\n\t__m128 DetCof = _mm_mul_ps(AddRes, _mm_setr_ps( 1.0f,-1.0f, 1.0f,-1.0f));\n\n\t//return m[0][0] * DetCof[0]\n\t//\t + m[0][1] * DetCof[1]\n\t//\t + m[0][2] * DetCof[2]\n\t//\t + m[0][3] * DetCof[3];\n\n\treturn glm_vec4_dot(m[0], DetCof);\n}\n\nGLM_FUNC_QUALIFIER glm_vec4 glm_mat4_determinant(glm_vec4 const m[4])\n{\n\t// _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(add)\n\n\t//T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t//T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t//T SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t//T SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t//T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t//T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\n\t// First 2 columns\n \t__m128 Swp2A = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(0, 1, 1, 2));\n \t__m128 Swp3A = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(3, 2, 3, 3));\n\t__m128 MulA = _mm_mul_ps(Swp2A, Swp3A);\n\n\t// Second 2 columns\n\t__m128 Swp2B = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(3, 2, 3, 3));\n\t__m128 Swp3B = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(0, 1, 1, 2));\n\t__m128 MulB = _mm_mul_ps(Swp2B, Swp3B);\n\n\t// Columns subtraction\n\t__m128 SubE = _mm_sub_ps(MulA, MulB);\n\n\t// Last 2 rows\n\t__m128 Swp2C = _mm_shuffle_ps(m[2], m[2], _MM_SHUFFLE(0, 0, 1, 2));\n\t__m128 Swp3C = _mm_shuffle_ps(m[3], m[3], _MM_SHUFFLE(1, 2, 0, 0));\n\t__m128 MulC = _mm_mul_ps(Swp2C, Swp3C);\n\t__m128 SubF = _mm_sub_ps(_mm_movehl_ps(MulC, MulC), MulC);\n\n\t//vec<4, T, Q> DetCof(\n\t//\t+ (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02),\n\t//\t- (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04),\n\t//\t+ (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05),\n\t//\t- (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05));\n\n\t__m128 SubFacA = _mm_shuffle_ps(SubE, SubE, _MM_SHUFFLE(2, 1, 0, 0));\n\t__m128 SwpFacA = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(0, 0, 0, 1));\n\t__m128 MulFacA = _mm_mul_ps(SwpFacA, SubFacA);\n\n\t__m128 SubTmpB = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(0, 0, 3, 1));\n\t__m128 SubFacB = _mm_shuffle_ps(SubTmpB, SubTmpB, _MM_SHUFFLE(3, 1, 1, 0));//SubF[0], SubE[3], SubE[3], SubE[1];\n\t__m128 SwpFacB = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(1, 1, 2, 2));\n\t__m128 MulFacB = _mm_mul_ps(SwpFacB, SubFacB);\n\n\t__m128 SubRes = _mm_sub_ps(MulFacA, MulFacB);\n\n\t__m128 SubTmpC = _mm_shuffle_ps(SubE, SubF, _MM_SHUFFLE(1, 0, 2, 2));\n\t__m128 SubFacC = _mm_shuffle_ps(SubTmpC, SubTmpC, _MM_SHUFFLE(3, 3, 2, 0));\n\t__m128 SwpFacC = _mm_shuffle_ps(m[1], m[1], _MM_SHUFFLE(2, 3, 3, 3));\n\t__m128 MulFacC = _mm_mul_ps(SwpFacC, SubFacC);\n\n\t__m128 AddRes = _mm_add_ps(SubRes, MulFacC);\n\t__m128 DetCof = _mm_mul_ps(AddRes, _mm_setr_ps( 1.0f,-1.0f, 1.0f,-1.0f));\n\n\t//return m[0][0] * DetCof[0]\n\t//\t + m[0][1] * DetCof[1]\n\t//\t + m[0][2] * DetCof[2]\n\t//\t + m[0][3] * DetCof[3];\n\n\treturn glm_vec4_dot(m[0], DetCof);\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_inverse(glm_vec4 const in[4], glm_vec4 out[4])\n{\n\t__m128 Fac0;\n\t{\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];\n\t\t//\tvalType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac0 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac1;\n\t{\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];\n\t\t//\tvalType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac1 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\n\t__m128 Fac2;\n\t{\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];\n\t\t//\tvalType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac2 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac3;\n\t{\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];\n\t\t//\tvalType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac3 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac4;\n\t{\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];\n\t\t//\tvalType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac4 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac5;\n\t{\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];\n\t\t//\tvalType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac5 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);\n\t__m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);\n\n\t// m[1][0]\n\t// m[0][0]\n\t// m[0][0]\n\t// m[0][0]\n\t__m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][1]\n\t// m[0][1]\n\t// m[0][1]\n\t// m[0][1]\n\t__m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][2]\n\t// m[0][2]\n\t// m[0][2]\n\t// m[0][2]\n\t__m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][3]\n\t// m[0][3]\n\t// m[0][3]\n\t// m[0][3]\n\t__m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));\n\t__m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// col0\n\t// + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),\n\t// - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),\n\t// + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),\n\t// - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),\n\t__m128 Mul00 = _mm_mul_ps(Vec1, Fac0);\n\t__m128 Mul01 = _mm_mul_ps(Vec2, Fac1);\n\t__m128 Mul02 = _mm_mul_ps(Vec3, Fac2);\n\t__m128 Sub00 = _mm_sub_ps(Mul00, Mul01);\n\t__m128 Add00 = _mm_add_ps(Sub00, Mul02);\n\t__m128 Inv0 = _mm_mul_ps(SignB, Add00);\n\n\t// col1\n\t// - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),\n\t// + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),\n\t// - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),\n\t// + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),\n\t__m128 Mul03 = _mm_mul_ps(Vec0, Fac0);\n\t__m128 Mul04 = _mm_mul_ps(Vec2, Fac3);\n\t__m128 Mul05 = _mm_mul_ps(Vec3, Fac4);\n\t__m128 Sub01 = _mm_sub_ps(Mul03, Mul04);\n\t__m128 Add01 = _mm_add_ps(Sub01, Mul05);\n\t__m128 Inv1 = _mm_mul_ps(SignA, Add01);\n\n\t// col2\n\t// + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),\n\t// - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),\n\t// + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),\n\t// - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),\n\t__m128 Mul06 = _mm_mul_ps(Vec0, Fac1);\n\t__m128 Mul07 = _mm_mul_ps(Vec1, Fac3);\n\t__m128 Mul08 = _mm_mul_ps(Vec3, Fac5);\n\t__m128 Sub02 = _mm_sub_ps(Mul06, Mul07);\n\t__m128 Add02 = _mm_add_ps(Sub02, Mul08);\n\t__m128 Inv2 = _mm_mul_ps(SignB, Add02);\n\n\t// col3\n\t// - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),\n\t// + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),\n\t// - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),\n\t// + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));\n\t__m128 Mul09 = _mm_mul_ps(Vec0, Fac2);\n\t__m128 Mul10 = _mm_mul_ps(Vec1, Fac4);\n\t__m128 Mul11 = _mm_mul_ps(Vec2, Fac5);\n\t__m128 Sub03 = _mm_sub_ps(Mul09, Mul10);\n\t__m128 Add03 = _mm_add_ps(Sub03, Mul11);\n\t__m128 Inv3 = _mm_mul_ps(SignA, Add03);\n\n\t__m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));\n\n\t//\tvalType Determinant = m[0][0] * Inverse[0][0]\n\t//\t\t\t\t\t\t+ m[0][1] * Inverse[1][0]\n\t//\t\t\t\t\t\t+ m[0][2] * Inverse[2][0]\n\t//\t\t\t\t\t\t+ m[0][3] * Inverse[3][0];\n\t__m128 Det0 = glm_vec4_dot(in[0], Row2);\n\t__m128 Rcp0 = _mm_div_ps(_mm_set1_ps(1.0f), Det0);\n\t//__m128 Rcp0 = _mm_rcp_ps(Det0);\n\n\t//\tInverse /= Determinant;\n\tout[0] = _mm_mul_ps(Inv0, Rcp0);\n\tout[1] = _mm_mul_ps(Inv1, Rcp0);\n\tout[2] = _mm_mul_ps(Inv2, Rcp0);\n\tout[3] = _mm_mul_ps(Inv3, Rcp0);\n}\n\nGLM_FUNC_QUALIFIER void glm_mat4_inverse_lowp(glm_vec4 const in[4], glm_vec4 out[4])\n{\n\t__m128 Fac0;\n\t{\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];\n\t\t//\tvalType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];\n\t\t//\tvalType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac0 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac1;\n\t{\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];\n\t\t//\tvalType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];\n\t\t//\tvalType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac1 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\n\t__m128 Fac2;\n\t{\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];\n\t\t//\tvalType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];\n\t\t//\tvalType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac2 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac3;\n\t{\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];\n\t\t//\tvalType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];\n\t\t//\tvalType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac3 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac4;\n\t{\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];\n\t\t//\tvalType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];\n\t\t//\tvalType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac4 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 Fac5;\n\t{\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];\n\t\t//\tvalType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];\n\t\t//\tvalType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];\n\n\t\t__m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1));\n\t\t__m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0));\n\n\t\t__m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0));\n\t\t__m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0));\n\t\t__m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1));\n\n\t\t__m128 Mul00 = _mm_mul_ps(Swp00, Swp01);\n\t\t__m128 Mul01 = _mm_mul_ps(Swp02, Swp03);\n\t\tFac5 = _mm_sub_ps(Mul00, Mul01);\n\t}\n\n\t__m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f);\n\t__m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f);\n\n\t// m[1][0]\n\t// m[0][0]\n\t// m[0][0]\n\t// m[0][0]\n\t__m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][1]\n\t// m[0][1]\n\t// m[0][1]\n\t// m[0][1]\n\t__m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][2]\n\t// m[0][2]\n\t// m[0][2]\n\t// m[0][2]\n\t__m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// m[1][3]\n\t// m[0][3]\n\t// m[0][3]\n\t// m[0][3]\n\t__m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3));\n\t__m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0));\n\n\t// col0\n\t// + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]),\n\t// - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]),\n\t// + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]),\n\t// - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]),\n\t__m128 Mul00 = _mm_mul_ps(Vec1, Fac0);\n\t__m128 Mul01 = _mm_mul_ps(Vec2, Fac1);\n\t__m128 Mul02 = _mm_mul_ps(Vec3, Fac2);\n\t__m128 Sub00 = _mm_sub_ps(Mul00, Mul01);\n\t__m128 Add00 = _mm_add_ps(Sub00, Mul02);\n\t__m128 Inv0 = _mm_mul_ps(SignB, Add00);\n\n\t// col1\n\t// - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]),\n\t// + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]),\n\t// - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]),\n\t// + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]),\n\t__m128 Mul03 = _mm_mul_ps(Vec0, Fac0);\n\t__m128 Mul04 = _mm_mul_ps(Vec2, Fac3);\n\t__m128 Mul05 = _mm_mul_ps(Vec3, Fac4);\n\t__m128 Sub01 = _mm_sub_ps(Mul03, Mul04);\n\t__m128 Add01 = _mm_add_ps(Sub01, Mul05);\n\t__m128 Inv1 = _mm_mul_ps(SignA, Add01);\n\n\t// col2\n\t// + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]),\n\t// - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]),\n\t// + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]),\n\t// - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]),\n\t__m128 Mul06 = _mm_mul_ps(Vec0, Fac1);\n\t__m128 Mul07 = _mm_mul_ps(Vec1, Fac3);\n\t__m128 Mul08 = _mm_mul_ps(Vec3, Fac5);\n\t__m128 Sub02 = _mm_sub_ps(Mul06, Mul07);\n\t__m128 Add02 = _mm_add_ps(Sub02, Mul08);\n\t__m128 Inv2 = _mm_mul_ps(SignB, Add02);\n\n\t// col3\n\t// - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]),\n\t// + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]),\n\t// - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]),\n\t// + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3]));\n\t__m128 Mul09 = _mm_mul_ps(Vec0, Fac2);\n\t__m128 Mul10 = _mm_mul_ps(Vec1, Fac4);\n\t__m128 Mul11 = _mm_mul_ps(Vec2, Fac5);\n\t__m128 Sub03 = _mm_sub_ps(Mul09, Mul10);\n\t__m128 Add03 = _mm_add_ps(Sub03, Mul11);\n\t__m128 Inv3 = _mm_mul_ps(SignA, Add03);\n\n\t__m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0));\n\n\t//\tvalType Determinant = m[0][0] * Inverse[0][0]\n\t//\t\t\t\t\t\t+ m[0][1] * Inverse[1][0]\n\t//\t\t\t\t\t\t+ m[0][2] * Inverse[2][0]\n\t//\t\t\t\t\t\t+ m[0][3] * Inverse[3][0];\n\t__m128 Det0 = glm_vec4_dot(in[0], Row2);\n\t__m128 Rcp0 = _mm_rcp_ps(Det0);\n\t//__m128 Rcp0 = _mm_div_ps(one, Det0);\n\t//\tInverse /= Determinant;\n\tout[0] = _mm_mul_ps(Inv0, Rcp0);\n\tout[1] = _mm_mul_ps(Inv1, Rcp0);\n\tout[2] = _mm_mul_ps(Inv2, Rcp0);\n\tout[3] = _mm_mul_ps(Inv3, Rcp0);\n}\n/*\nGLM_FUNC_QUALIFIER void glm_mat4_rotate(__m128 const in[4], float Angle, float const v[3], __m128 out[4])\n{\n\tfloat a = glm::radians(Angle);\n\tfloat c = cos(a);\n\tfloat s = sin(a);\n\n\tglm::vec4 AxisA(v[0], v[1], v[2], float(0));\n\t__m128 AxisB = _mm_set_ps(AxisA.w, AxisA.z, AxisA.y, AxisA.x);\n\t__m128 AxisC = detail::sse_nrm_ps(AxisB);\n\n\t__m128 Cos0 = _mm_set_ss(c);\n\t__m128 CosA = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 Sin0 = _mm_set_ss(s);\n\t__m128 SinA = _mm_shuffle_ps(Sin0, Sin0, _MM_SHUFFLE(0, 0, 0, 0));\n\n\t// vec<3, T, Q> temp = (valType(1) - c) * axis;\n\t__m128 Temp0 = _mm_sub_ps(one, CosA);\n\t__m128 Temp1 = _mm_mul_ps(Temp0, AxisC);\n\n\t//Rotate[0][0] = c + temp[0] * axis[0];\n\t//Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2];\n\t//Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1];\n\t__m128 Axis0 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(0, 0, 0, 0));\n\t__m128 TmpA0 = _mm_mul_ps(Axis0, AxisC);\n\t__m128 CosA0 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 1, 1, 0));\n\t__m128 TmpA1 = _mm_add_ps(CosA0, TmpA0);\n\t__m128 SinA0 = SinA;//_mm_set_ps(0.0f, s, -s, 0.0f);\n\t__m128 TmpA2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 1, 2, 3));\n\t__m128 TmpA3 = _mm_mul_ps(SinA0, TmpA2);\n\t__m128 TmpA4 = _mm_add_ps(TmpA1, TmpA3);\n\n\t//Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2];\n\t//Rotate[1][1] = c + temp[1] * axis[1];\n\t//Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0];\n\t__m128 Axis1 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(1, 1, 1, 1));\n\t__m128 TmpB0 = _mm_mul_ps(Axis1, AxisC);\n\t__m128 CosA1 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 1, 0, 1));\n\t__m128 TmpB1 = _mm_add_ps(CosA1, TmpB0);\n\t__m128 SinB0 = SinA;//_mm_set_ps(-s, 0.0f, s, 0.0f);\n\t__m128 TmpB2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 0, 3, 2));\n\t__m128 TmpB3 = _mm_mul_ps(SinA0, TmpB2);\n\t__m128 TmpB4 = _mm_add_ps(TmpB1, TmpB3);\n\n\t//Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1];\n\t//Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0];\n\t//Rotate[2][2] = c + temp[2] * axis[2];\n\t__m128 Axis2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(2, 2, 2, 2));\n\t__m128 TmpC0 = _mm_mul_ps(Axis2, AxisC);\n\t__m128 CosA2 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 0, 1, 1));\n\t__m128 TmpC1 = _mm_add_ps(CosA2, TmpC0);\n\t__m128 SinC0 = SinA;//_mm_set_ps(s, -s, 0.0f, 0.0f);\n\t__m128 TmpC2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 3, 0, 1));\n\t__m128 TmpC3 = _mm_mul_ps(SinA0, TmpC2);\n\t__m128 TmpC4 = _mm_add_ps(TmpC1, TmpC3);\n\n\t__m128 Result[4];\n\tResult[0] = TmpA4;\n\tResult[1] = TmpB4;\n\tResult[2] = TmpC4;\n\tResult[3] = _mm_set_ps(1, 0, 0, 0);\n\n\t//mat<4, 4, valType> Result;\n\t//Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];\n\t//Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];\n\t//Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];\n\t//Result[3] = m[3];\n\t//return Result;\n\tsse_mul_ps(in, Result, out);\n}\n*/\nGLM_FUNC_QUALIFIER void glm_mat4_outerProduct(__m128 const& c, __m128 const& r, __m128 out[4])\n{\n\tout[0] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(0, 0, 0, 0)));\n\tout[1] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(1, 1, 1, 1)));\n\tout[2] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(2, 2, 2, 2)));\n\tout[3] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(3, 3, 3, 3)));\n}\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/packing.h", "language": "code", "loc": 5, "comment_density": 0.6, "code": "/// @ref simd\n/// @file glm/simd/packing.h\n\n#pragma once\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}, {"path": "includes/glm/simd/platform.h", "language": "code", "loc": 326, "comment_density": 0.074, "code": "#pragma once\n\n///////////////////////////////////////////////////////////////////////////////////\n// Platform\n\n#define GLM_PLATFORM_UNKNOWN\t\t0x00000000\n#define GLM_PLATFORM_WINDOWS\t\t0x00010000\n#define GLM_PLATFORM_LINUX\t\t\t0x00020000\n#define GLM_PLATFORM_APPLE\t\t\t0x00040000\n//#define GLM_PLATFORM_IOS\t\t\t0x00080000\n#define GLM_PLATFORM_ANDROID\t\t0x00100000\n#define GLM_PLATFORM_CHROME_NACL\t0x00200000\n#define GLM_PLATFORM_UNIX\t\t\t0x00400000\n#define GLM_PLATFORM_QNXNTO\t\t\t0x00800000\n#define GLM_PLATFORM_WINCE\t\t\t0x01000000\n#define GLM_PLATFORM_CYGWIN\t\t\t0x02000000\n\n#ifdef GLM_FORCE_PLATFORM_UNKNOWN\n#\tdefine GLM_PLATFORM GLM_PLATFORM_UNKNOWN\n#elif defined(__CYGWIN__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_CYGWIN\n#elif defined(__QNXNTO__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_QNXNTO\n#elif defined(__APPLE__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_APPLE\n#elif defined(WINCE)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_WINCE\n#elif defined(_WIN32)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_WINDOWS\n#elif defined(__native_client__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_CHROME_NACL\n#elif defined(__ANDROID__)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_ANDROID\n#elif defined(__linux)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_LINUX\n#elif defined(__unix)\n#\tdefine GLM_PLATFORM GLM_PLATFORM_UNIX\n#else\n#\tdefine GLM_PLATFORM GLM_PLATFORM_UNKNOWN\n#endif//\n\n///////////////////////////////////////////////////////////////////////////////////\n// Compiler\n\n#define GLM_COMPILER_UNKNOWN\t\t0x00000000\n\n// Intel\n#define GLM_COMPILER_INTEL\t\t\t0x00100000\n#define GLM_COMPILER_INTEL14\t\t0x00100040\n#define GLM_COMPILER_INTEL15\t\t0x00100050\n#define GLM_COMPILER_INTEL16\t\t0x00100060\n#define GLM_COMPILER_INTEL17\t\t0x00100070\n\n// Visual C++ defines\n#define GLM_COMPILER_VC\t\t\t\t0x01000000\n#define GLM_COMPILER_VC12\t\t\t0x01000001\n#define GLM_COMPILER_VC14\t\t\t0x01000002\n#define GLM_COMPILER_VC15\t\t\t0x01000003\n#define GLM_COMPILER_VC15_3\t\t\t0x01000004\n#define GLM_COMPILER_VC15_5\t\t\t0x01000005\n#define GLM_COMPILER_VC15_6\t\t\t0x01000006\n#define GLM_COMPILER_VC15_7\t\t\t0x01000007\n\n// GCC defines\n#define GLM_COMPILER_GCC\t\t\t0x02000000\n#define GLM_COMPILER_GCC46\t\t\t0x020000D0\n#define GLM_COMPILER_GCC47\t\t\t0x020000E0\n#define GLM_COMPILER_GCC48\t\t\t0x020000F0\n#define GLM_COMPILER_GCC49\t\t\t0x02000100\n#define GLM_COMPILER_GCC5\t\t\t0x02000200\n#define GLM_COMPILER_GCC6\t\t\t0x02000300\n#define GLM_COMPILER_GCC7\t\t\t0x02000400\n#define GLM_COMPILER_GCC8\t\t\t0x02000500\n\n// CUDA\n#define GLM_COMPILER_CUDA\t\t\t0x10000000\n#define GLM_COMPILER_CUDA70\t\t\t0x100000A0\n#define GLM_COMPILER_CUDA75\t\t\t0x100000B0\n#define GLM_COMPILER_CUDA80\t\t\t0x100000C0\n\n// Clang\n#define GLM_COMPILER_CLANG\t\t\t0x20000000\n#define GLM_COMPILER_CLANG34\t\t0x20000050\n#define GLM_COMPILER_CLANG35\t\t0x20000060\n#define GLM_COMPILER_CLANG36\t\t0x20000070\n#define GLM_COMPILER_CLANG37\t\t0x20000080\n#define GLM_COMPILER_CLANG38\t\t0x20000090\n#define GLM_COMPILER_CLANG39\t\t0x200000A0\n#define GLM_COMPILER_CLANG40\t\t0x200000B0\n#define GLM_COMPILER_CLANG41\t\t0x200000C0\n#define GLM_COMPILER_CLANG42\t\t0x200000D0\n\n// Build model\n#define GLM_MODEL_32\t\t\t\t0x00000010\n#define GLM_MODEL_64\t\t\t\t0x00000020\n\n// Force generic C++ compiler\n#ifdef GLM_FORCE_COMPILER_UNKNOWN\n#\tdefine GLM_COMPILER GLM_COMPILER_UNKNOWN\n\n#elif defined(__INTEL_COMPILER)\n#\tif (__INTEL_COMPILER < 1400)\n#\t\terror \"GLM requires ICC 2013 SP1 or newer\"\n#\telif __INTEL_COMPILER == 1400\n#\t\tdefine GLM_COMPILER GLM_COMPILER_INTEL14\n#\telif __INTEL_COMPILER == 1500\n#\t\tdefine GLM_COMPILER GLM_COMPILER_INTEL15\n#\telif __INTEL_COMPILER == 1600\n#\t\tdefine GLM_COMPILER GLM_COMPILER_INTEL16\n#\telif __INTEL_COMPILER >= 1700\n#\t\tdefine GLM_COMPILER GLM_COMPILER_INTEL17\n#\tendif\n\n// CUDA\n#elif defined(__CUDACC__)\n#\tif !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)\n#\t\tinclude // make sure version is defined since nvcc does not define it itself!\n#\tendif\n#\tif CUDA_VERSION < 7000\n#\t\terror \"GLM requires CUDA 7.0 or higher\"\n#\telif (CUDA_VERSION >= 7000 && CUDA_VERSION < 7500)\n#\t\tdefine GLM_COMPILER GLM_COMPILER_CUDA70\n#\telif (CUDA_VERSION >= 7500 && CUDA_VERSION < 8000)\n#\t\tdefine GLM_COMPILER GLM_COMPILER_CUDA75\n#\telif (CUDA_VERSION >= 8000)\n#\t\tdefine GLM_COMPILER GLM_COMPILER_CUDA80\n#\tendif\n\n// Clang\n#elif defined(__clang__)\n#\tif defined(__apple_build_version__)\n#\t\tif (__clang_major__ < 6)\n#\t\t\terror \"GLM requires Clang 3.4 / Apple Clang 6.0 or higher\"\n#\t\telif __clang_major__ == 6 && __clang_minor__ == 0\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG35\n#\t\telif __clang_major__ == 6 && __clang_minor__ >= 1\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG36\n#\t\telif __clang_major__ >= 7\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG37\n#\t\tendif\n#\telse\n#\t\tif ((__clang_major__ == 3) && (__clang_minor__ < 4)) || (__clang_major__ < 3)\n#\t\t\terror \"GLM requires Clang 3.4 or higher\"\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 4\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG34\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 5\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG35\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 6\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG36\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 7\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG37\n#\t\telif __clang_major__ == 3 && __clang_minor__ == 8\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG38\n#\t\telif __clang_major__ == 3 && __clang_minor__ >= 9\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG39\n#\t\telif __clang_major__ == 4 && __clang_minor__ == 0\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG40\n#\t\telif __clang_major__ == 4 && __clang_minor__ == 1\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG41\n#\t\telif __clang_major__ == 4 && __clang_minor__ >= 2\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG42\n#\t\telif __clang_major__ >= 4\n#\t\t\tdefine GLM_COMPILER GLM_COMPILER_CLANG42\n#\t\tendif\n#\tendif\n\n// Visual C++\n#elif defined(_MSC_VER)\n#\tif _MSC_VER < 1800\n#\t\terror \"GLM requires Visual C++ 12 - 2013 or higher\"\n#\telif _MSC_VER == 1800\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC12\n#\telif _MSC_VER == 1900\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC14\n#\telif _MSC_VER == 1910\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15\n#\telif _MSC_VER == 1911\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15_3\n#\telif _MSC_VER == 1912\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15_5\n#\telif _MSC_VER == 1913\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15_6\n#\telif _MSC_VER >= 1914\n#\t\tdefine GLM_COMPILER GLM_COMPILER_VC15_7\n#\tendif//_MSC_VER\n\n// G++\n#elif defined(__GNUC__) || defined(__MINGW32__)\n#\tif ((__GNUC__ == 4) && (__GNUC_MINOR__ < 6)) || (__GNUC__ < 4)\n#\t\terror \"GLM requires GCC 4.7 or higher\"\n#\telif (__GNUC__ == 4) && (__GNUC_MINOR__ == 6)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC46)\n#\telif (__GNUC__ == 4) && (__GNUC_MINOR__ == 7)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC47)\n#\telif (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC48)\n#\telif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC49)\n#\telif (__GNUC__ == 5)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC5)\n#\telif (__GNUC__ == 6)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC6)\n#\telif (__GNUC__ == 7)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC7)\n#\telif (__GNUC__ >= 8)\n#\t\tdefine GLM_COMPILER (GLM_COMPILER_GCC8)\n#\tendif\n\n#else\n#\tdefine GLM_COMPILER GLM_COMPILER_UNKNOWN\n#endif\n\n#ifndef GLM_COMPILER\n#\terror \"GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message.\"\n#endif//GLM_COMPILER\n\n///////////////////////////////////////////////////////////////////////////////////\n// Instruction sets\n\n// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2 GLM_FORCE_AVX2\n\n#define GLM_ARCH_MIPS_BIT\t(0x10000000)\n#define GLM_ARCH_PPC_BIT\t(0x20000000)\n#define GLM_ARCH_ARM_BIT\t(0x40000000)\n#define GLM_ARCH_X86_BIT\t(0x80000000)\n\n#define GLM_ARCH_SIMD_BIT\t(0x00001000)\n\n#define GLM_ARCH_NEON_BIT\t(0x00000001)\n#define GLM_ARCH_SSE_BIT\t(0x00000002)\n#define GLM_ARCH_SSE2_BIT\t(0x00000004)\n#define GLM_ARCH_SSE3_BIT\t(0x00000008)\n#define GLM_ARCH_SSSE3_BIT\t(0x00000010)\n#define GLM_ARCH_SSE41_BIT\t(0x00000020)\n#define GLM_ARCH_SSE42_BIT\t(0x00000040)\n#define GLM_ARCH_AVX_BIT\t(0x00000080)\n#define GLM_ARCH_AVX2_BIT\t(0x00000100)\n\n#define GLM_ARCH_UNKNOWN\t(0)\n#define GLM_ARCH_X86\t\t(GLM_ARCH_X86_BIT)\n#define GLM_ARCH_SSE\t\t(GLM_ARCH_SSE_BIT | GLM_ARCH_SIMD_BIT | GLM_ARCH_X86)\n#define GLM_ARCH_SSE2\t\t(GLM_ARCH_SSE2_BIT | GLM_ARCH_SSE)\n#define GLM_ARCH_SSE3\t\t(GLM_ARCH_SSE3_BIT | GLM_ARCH_SSE2)\n#define GLM_ARCH_SSSE3\t\t(GLM_ARCH_SSSE3_BIT | GLM_ARCH_SSE3)\n#define GLM_ARCH_SSE41\t\t(GLM_ARCH_SSE41_BIT | GLM_ARCH_SSSE3)\n#define GLM_ARCH_SSE42\t\t(GLM_ARCH_SSE42_BIT | GLM_ARCH_SSE41)\n#define GLM_ARCH_AVX\t\t(GLM_ARCH_AVX_BIT | GLM_ARCH_SSE42)\n#define GLM_ARCH_AVX2\t\t(GLM_ARCH_AVX2_BIT | GLM_ARCH_AVX)\n#define GLM_ARCH_ARM\t\t(GLM_ARCH_ARM_BIT)\n#define GLM_ARCH_NEON\t\t(GLM_ARCH_NEON_BIT | GLM_ARCH_SIMD_BIT | GLM_ARCH_ARM)\n#define GLM_ARCH_MIPS\t\t(GLM_ARCH_MIPS_BIT)\n#define GLM_ARCH_PPC\t\t(GLM_ARCH_PPC_BIT)\n\n#ifdef GLM_FORCE_ARCH_UNKNOWN\n#\tdefine GLM_ARCH GLM_ARCH_UNKNOWN\n#elif defined(GLM_FORCE_PURE) || defined(GLM_FORCE_XYZW_ONLY)\n#\tif defined(__x86_64__) || defined(_M_X64) || defined(_M_IX86) || defined(__i386__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_X86)\n#\telif defined(__arm__ ) || defined(_M_ARM)\n#\t\tdefine GLM_ARCH (GLM_ARCH_ARM)\n#\telif defined(__powerpc__ ) || defined(_M_PPC)\n#\t\tdefine GLM_ARCH (GLM_ARCH_PPC)\n#\telif defined(__mips__ )\n#\t\tdefine GLM_ARCH (GLM_ARCH_MIPS)\n#\telse\n#\t\tdefine GLM_ARCH (GLM_ARCH_UNKNOWN)\n#\tendif\n#elif defined(GLM_FORCE_NEON)\n#\tdefine GLM_ARCH (GLM_ARCH_NEON)\n#elif defined(GLM_FORCE_AVX2)\n#\tdefine GLM_ARCH (GLM_ARCH_AVX2)\n#elif defined(GLM_FORCE_AVX)\n#\tdefine GLM_ARCH (GLM_ARCH_AVX)\n#elif defined(GLM_FORCE_SSE42)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE42)\n#elif defined(GLM_FORCE_SSE41)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE41)\n#elif defined(GLM_FORCE_SSSE3)\n#\tdefine GLM_ARCH (GLM_ARCH_SSSE3)\n#elif defined(GLM_FORCE_SSE3)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE3)\n#elif defined(GLM_FORCE_SSE2)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE2)\n#elif defined(GLM_FORCE_SSE)\n#\tdefine GLM_ARCH (GLM_ARCH_SSE)\n#else\n#\tif defined(__AVX2__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_AVX2)\n#\telif defined(__AVX__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_AVX)\n#\telif defined(__SSE4_2__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSE42)\n#\telif defined(__SSE4_1__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSE41)\n#\telif defined(__SSSE3__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSSE3)\n#\telif defined(__SSE3__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSE3)\n#\telif defined(__SSE2__) || defined(__x86_64__) || defined(_M_X64) || defined(_M_IX86_FP)\n#\t\tdefine GLM_ARCH (GLM_ARCH_SSE2)\n#\telif defined(__i386__)\n#\t\tdefine GLM_ARCH (GLM_ARCH_X86)\n#\telif defined(__ARM_NEON)\n#\t\tdefine GLM_ARCH (GLM_ARCH_ARM | GLM_ARCH_NEON)\n#\telif defined(__arm__ ) || defined(_M_ARM)\n#\t\tdefine GLM_ARCH (GLM_ARCH_ARM)\n#\telif defined(__mips__ )\n#\t\tdefine GLM_ARCH (GLM_ARCH_MIPS)\n#\telif defined(__powerpc__ ) || defined(_M_PPC)\n#\t\tdefine GLM_ARCH (GLM_ARCH_PPC)\n#\telse\n#\t\tdefine GLM_ARCH (GLM_ARCH_UNKNOWN)\n#\tendif\n#endif\n\n#if GLM_ARCH & GLM_ARCH_AVX2_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_AVX_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSE42_BIT\n#\tif GLM_COMPILER & GLM_COMPILER_CLANG\n#\t\tinclude \n#\tendif\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSE41_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSSE3_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSE3_BIT\n#\tinclude \n#elif GLM_ARCH & GLM_ARCH_SSE2_BIT\n#\tinclude \n#endif//GLM_ARCH\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\ttypedef __m128\t\t\tglm_f32vec4;\n\ttypedef __m128i\t\t\tglm_i32vec4;\n\ttypedef __m128i\t\t\tglm_u32vec4;\n\ttypedef __m128d\t\t\tglm_f64vec2;\n\ttypedef __m128i\t\t\tglm_i64vec2;\n\ttypedef __m128i\t\t\tglm_u64vec2;\n\n\ttypedef glm_f32vec4\t\tglm_vec4;\n\ttypedef glm_i32vec4\t\tglm_ivec4;\n\ttypedef glm_u32vec4\t\tglm_uvec4;\n\ttypedef glm_f64vec2\t\tglm_dvec2;\n#endif\n\n#if GLM_ARCH & GLM_ARCH_AVX_BIT\n\ttypedef __m256d\t\t\tglm_f64vec4;\n\ttypedef glm_f64vec4\t\tglm_dvec4;\n#endif\n\n#if GLM_ARCH & GLM_ARCH_AVX2_BIT\n\ttypedef __m256i\t\t\tglm_i64vec4;\n\ttypedef __m256i\t\t\tglm_u64vec4;\n#endif\n"}, {"path": "includes/glm/simd/trigonometric.h", "language": "code", "loc": 5, "comment_density": 0.6, "code": "/// @ref simd\n/// @file glm/simd/trigonometric.h\n\n#pragma once\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n\n"}, {"path": "includes/glm/simd/vector_relational.h", "language": "code", "loc": 5, "comment_density": 0.6, "code": "/// @ref simd\n/// @file glm/simd/vector_relational.h\n\n#pragma once\n\n#if GLM_ARCH & GLM_ARCH_SSE2_BIT\n\n#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.323, "dedup_hash": "fcb1c8ff8437988a", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_irrklang", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Irrklang", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/irrKlang/ik_ESoundEngineOptions.h", "language": "code", "loc": 64, "comment_density": 0.734, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __E_IRRKLANG_SOUND_ENGINE_OPTIONS_H_INCLUDED__\n#define __E_IRRKLANG_SOUND_ENGINE_OPTIONS_H_INCLUDED__\n\nnamespace irrklang \n{\n\t//! An enumeration for all options for starting up the sound engine\n\t/** When using createIrrKlangDevice, use a combination of this these\n\tas 'options' parameter to start up the engine. By default, irrKlang\n\tuses ESEO_DEFAULT_OPTIONS, which is set to the combination \n\tESEO_MULTI_THREADED | ESEO_LOAD_PLUGINS | ESEO_USE_3D_BUFFERS | ESEO_PRINT_DEBUG_INFO_TO_DEBUGGER | ESEO_PRINT_DEBUG_INFO_TO_STDOUT. */\n\tenum E_SOUND_ENGINE_OPTIONS\n\t{\n\t\t//! If specified (default), it will make irrKlang run in a separate thread.\n\t\t/** Using this flag, irrKlang will update\n\t\tall streams, sounds, 3d positions and whatever automatically. You also don't need to call ISoundEngine::update()\n\t\tif irrKlang is running multithreaded. However, if you want to run irrKlang in the same thread\n\t\tas your application (for easier debugging for example), don't set this. But you need to call ISoundEngine::update()\n\t\tas often as you can (at least about 2-3 times per second) to make irrKlang update everything correctly then. */\n\t\tESEO_MULTI_THREADED = 0x01,\n\n\t\t//! If the window of the application doesn't have the focus, irrKlang will be silent if this has been set. \n\t\t/** This will only work when irrKlang is using the DirectSound output driver. */\n\t\tESEO_MUTE_IF_NOT_FOCUSED = 0x02,\n\n\t\t//! Automatically loads external plugins when starting up.\n\t\t/** Plugins usually are .dll, .so or .dylib\n\t\tfiles named for example ikpMP3.dll (= short for irrKlangPluginMP3) which are executed\n\t\tafter the startup of the sound engine and modify it for example to make it possible\n\t\tto play back mp3 files. Plugins are being loaded from the current working directory \n\t\tas well as from the position where the .exe using the irrKlang library resides. \n\t\tIt is also possible to load the plugins after the engine has started up using \n\t\tISoundEngine::loadPlugins(). */\n\t\tESEO_LOAD_PLUGINS = 0x04,\n\n\t\t//! Uses 3D sound buffers instead of emulating them when playing 3d sounds (default).\n\t\t/** If this flag is not specified, all buffers will by created\n\t\tin 2D only and 3D positioning will be emulated in software, making the engine run\n\t\tfaster if hardware 3d audio is slow on the system. */\n\t\tESEO_USE_3D_BUFFERS = 0x08,\n\n\t\t//! Prints debug messages to the debugger window.\n\t\t/** irrKlang will print debug info and status messages to any windows debugger supporting \n\t\tOutputDebugString() (like VisualStudio).\n\t\tThis is useful if your application does not capture any console output (see ESEO_PRINT_DEBUG_INFO_TO_STDOUT). */\n\t\tESEO_PRINT_DEBUG_INFO_TO_DEBUGGER = 0x10,\n\n\t\t//! Prints debug messages to stdout (the ConsoleWindow).\n\t\t/** irrKlang will print debug info and status messages stdout, the console window in Windows. */\n\t\tESEO_PRINT_DEBUG_INFO_TO_STDOUT = 0x20,\n\n\t\t//! Uses linear rolloff for 3D sound.\n\t\t/** If specified, instead of the default logarithmic one, irrKlang will \n\t\t use a linear rolloff model which influences the attenuation \n\t\t of the sounds over distance. The volume is interpolated linearly between the MinDistance\n\t\t and MaxDistance, making it possible to adjust sounds more easily although this is not\n\t\t physically correct.\n\t\t Note that this option may not work when used together with the ESEO_USE_3D_BUFFERS\n\t\t option when using Direct3D for example, irrKlang will then turn off ESEO_USE_3D_BUFFERS\n\t\t automatically to be able to use this option and write out a warning. */\n\t\tESEO_LINEAR_ROLLOFF = 0x40,\n\n\t\t//! Default parameters when starting up the engine.\n\t\tESEO_DEFAULT_OPTIONS = ESEO_MULTI_THREADED | ESEO_LOAD_PLUGINS | ESEO_USE_3D_BUFFERS | ESEO_PRINT_DEBUG_INFO_TO_DEBUGGER | ESEO_PRINT_DEBUG_INFO_TO_STDOUT,\n\n\t\t//! Never used, it only forces the compiler to compile these enumeration values to 32 bit.\n\t\t/** Don't use this. */\n\t\tESEO_FORCE_32_BIT = 0x7fffffff\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_ESoundOutputDrivers.h", "language": "code", "loc": 46, "comment_density": 0.63, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __E_IRRKLANG_SOUND_OUTPUT_DRIVERS_H_INCLUDED__\n#define __E_IRRKLANG_SOUND_OUTPUT_DRIVERS_H_INCLUDED__\n\nnamespace irrklang\n{\n\t//! An enumeration for all types of supported sound drivers\n\t/** Values of this enumeration can be used as parameter when calling createIrrKlangDevice(). */\n\tenum E_SOUND_OUTPUT_DRIVER\n\t{\n\t\t//! Autodetects the best sound driver for the system\n\t\tESOD_AUTO_DETECT = 0,\n\n\t\t//! DirectSound8 sound output driver, windows only. \n\t\t/** In contrast to ESOD_DIRECT_SOUND, this supports sophisticated sound effects\n\t\tbut may not be available on old windows versions. It behaves very similar \n\t\tto ESOD_DIRECT_SOUND but also supports DX8 sound effects.*/\n\t\tESOD_DIRECT_SOUND_8,\n\n\t\t//! DirectSound sound output driver, windows only.\n\t\t/** This uses DirectSound 3 or above, if available. If DX8 sound effects\n\t\tare needed, use ESOD_DIRECT_SOUND_8 instead. The \n\t\tESOD_DIRECT_SOUND driver may be available on more and older windows \n\t\tversions than ESOD_DIRECT_SOUND_8.*/\n\t\tESOD_DIRECT_SOUND,\n\n\t\t//! WinMM sound output driver, windows only.\n\t\t/** Supports the ISoundMixedOutputReceiver interface using setMixedDataOutputReceiver. */\n\t\tESOD_WIN_MM,\n\n\t\t//! ALSA sound output driver, linux only.\n\t\t/** When using ESOD_ALSA in createIrrKlangDevice(), it is possible to set the third parameter,\n\t\t'deviceID' to the name of specific ALSA pcm device, to the irrKlang force to use this one.\n\t\tSet it to 'default', or 'plug:hw' or whatever you need it to be. \n\t\tSupports the ISoundMixedOutputReceiver interface using setMixedDataOutputReceiver. */\n\t\tESOD_ALSA,\n\t\t\n\t\t//! Core Audio sound output driver, mac os only.\n\t\t/** Supports the ISoundMixedOutputReceiver interface using setMixedDataOutputReceiver. */\n\t\tESOD_CORE_AUDIO,\n\n\t\t//! Null driver, creating no sound output\n\t\tESOD_NULL,\n\n\t\t//! Amount of built-in sound output drivers\n\t\tESOD_COUNT,\n\n\t\t//! This enumeration literal is never used, it only forces the compiler to\n\t\t//! compile these enumeration values to 32 bit.\n\t\tESOD_FORCE_32_BIT = 0x7fffffff\n\t};\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_EStreamModes.h", "language": "code", "loc": 22, "comment_density": 0.455, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __E_IRRKLANG_STREAM_MODES_H_INCLUDED__\n#define __E_IRRKLANG_STREAM_MODES_H_INCLUDED__\n\nnamespace irrklang \n{\n\t//! An enumeration for all types of supported stream modes\n\tenum E_STREAM_MODE\n\t{\n\t\t//! Autodetects the best stream mode for a specified audio data.\n\t\tESM_AUTO_DETECT = 0,\n\n\t\t//! Streams the audio data when needed.\n\t\tESM_STREAMING,\n\n\t\t//! Loads the whole audio data into the memory.\n\t\tESM_NO_STREAMING,\n\n\t\t//! This enumeration literal is never used, it only forces the compiler to \n\t\t//! compile these enumeration values to 32 bit.\n\t\tESM_FORCE_32_BIT = 0x7fffffff\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IAudioRecorder.h", "language": "code", "loc": 89, "comment_density": 0.652, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_AUDIO_RECORDER_H_INCLUDED__\n#define __I_IRRKLANG_AUDIO_RECORDER_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_ISoundSource.h\"\n\n\nnamespace irrklang\n{\n\tclass ICapturedAudioDataReceiver;\n\n\t//! Interface to an audio recorder. Create it using the createIrrKlangAudioRecorder() function.\n\t/** It creates sound sources into an ISoundEngine which then can be played there. \n\tSee @ref recordingAudio for an example on how to use this. */\n\tclass IAudioRecorder : public virtual IRefCounted\n\t{\n\tpublic:\n\n\t\t//! Starts recording audio. \n\t\t/** Clears all possibly previously recorded buffered audio data and starts to record. \n\t\tWhen finished recording audio data, call stopRecordingAudio(). \n\t\tAll recorded audio data gets stored into an internal audio buffer, which\n\t\tcan then be accessed for example using addSoundSourceFromRecordedAudio() or\n\t\tgetRecordedAudioData(). For recording audio data not into an internal audio\n\t\tbuffer, use startRecordingCustomHandledAudio().\n\t\t\\param sampleRate: Sample rate of the recorded audio.\n\t\t\\param sampleFormat: Sample format of the recorded audio.\n\t\t\\param channelCount: Amount of audio channels.\n\t\t\\return Returns true if successfully started recording and false if not.*/\n\t\tvirtual bool startRecordingBufferedAudio(ik_s32 sampleRate=22000, \n\t\t ESampleFormat sampleFormat=ESF_S16,\n\t\t\t\t\t\t\t\t\t\t\t\t ik_s32 channelCount=1) = 0;\n\n\t\t//! Starts recording audio. \n\t\t/** Clears all possibly previously recorded buffered audio data and starts to record \n\t\taudio data, which is delivered to a custom user callback interface. \n\t\tWhen finished recording audio data, call stopRecordingAudio(). If instead of \n\t\trecording the data to the receiver interface recording into a managed buffer\n\t\tis wished, use startRecordingBufferedAudio() instead.\n\t\t\\param receiver: Interface to be implemented by the user, gets called once for each\n\t\tcaptured audio data chunk. \n\t\t\\param sampleRate: Sample rate of the recorded audio.\n\t\t\\param sampleFormat: Sample format of the recorded audio.\n\t\t\\param channelCount: Amount of audio channels.\n\t\t\\return Returns true if successfully started recording and false if not. */\n\t\tvirtual bool startRecordingCustomHandledAudio(ICapturedAudioDataReceiver* receiver,\n\t\t\t ik_s32 sampleRate=22000,\n\t\t\t\t\t\t\t\t\t\t\t\t\t ESampleFormat sampleFormat=ESF_S16,\n\t\t\t\t\t\t\t\t\t\t\t\t\t ik_s32 channelCount=1) = 0;\n\n\t\t//! Stops recording audio.\n\t\tvirtual void stopRecordingAudio() = 0;\n\n\t\t//! Creates a sound source for the recorded audio data.\n\t\t/** The returned sound source pointer then can be used to play back the recorded audio data\n\t\tusing ISoundEngine::play2D(). This method only will succeed if the audio was recorded using\n\t\tstartRecordingBufferedAudio() and audio recording is currently stopped.\n\t\t\\param soundName Name of the virtual sound file (e.g. \"someRecordedAudio\"). You can also use this\n\t\tname when calling play3D() or play2D(). */\n\t\tvirtual ISoundSource* addSoundSourceFromRecordedAudio(const char* soundName) = 0;\n\n\t\t//! Clears recorded audio data buffer, freeing memory.\n\t\t/** This method will only succeed if audio recording is currently stopped. */\n\t\tvirtual void clearRecordedAudioDataBuffer() = 0;\n\n\t\t//! Returns if the recorder is currently recording audio.\n\t\tvirtual bool isRecording() = 0;\n\n\t\t//! Returns the audio format of the recorded audio data. \n\t\t/** Also contains informations about the length of the recorded audio stream. */\n\t\tvirtual SAudioStreamFormat getAudioFormat() = 0;\n\n\t\t//! Returns a pointer to the recorded audio data.\n\t\t/** This method will only succeed if audio recording is currently stopped and\n\t\tsomething was recorded previously using startRecordingBufferedAudio(). \n\t\tThe length of the buffer can be retrieved using \n\t\tgetAudioFormat().getSampleDataSize(). Note that the pointer is only valid\n\t\tas long as not clearRecordedAudioDataBuffer() is called or another sample is\n\t\trecorded.*/\n\t\tvirtual void* getRecordedAudioData() = 0;\n\n\t\t//! returns the name of the sound driver, like 'ALSA' for the alsa device.\n\t\t/** Possible returned strings are \"NULL\", \"ALSA\", \"CoreAudio\", \"winMM\", \n\t\t\"DirectSound\" and \"DirectSound8\". */\n\t\tvirtual const char* getDriverName() = 0;\n\t};\n\n\n\t//! Interface to be implemented by the user if access to the recorded audio data is needed.\n\t/** Is used as parameter in IAudioRecorder::startRecordingCustomHandledAudio. */\n\tclass ICapturedAudioDataReceiver : public IRefCounted\n\t{\n\tpublic:\n\n\t\t//! Gets called once for each captured audio data chunk.\n\t\t/** See IAudioRecorder::startRecordingCustomHandledAudio for details.\n\t\t\\param audioData: Pointer to a part of the recorded audio data\n\t\t\\param lengthInBytes: Amount of bytes in the audioData buffer.*/\n\t\tvirtual void OnReceiveAudioDataStreamChunk(unsigned char* audioData, unsigned long lengthInBytes) = 0;\n\t};\n\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_IAudioStream.h", "language": "code", "loc": 35, "comment_density": 0.543, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_AUDIO_STREAM_H_INCLUDED__\n#define __I_IRRKLANG_AUDIO_STREAM_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_SAudioStreamFormat.h\"\n\nnamespace irrklang\n{\n\n\n//!\tReads and decodes audio data into an usable audio stream for the ISoundEngine\nclass IAudioStream : public IRefCounted\n{\npublic:\n\n\t//! destructor\n\tvirtual ~IAudioStream() {};\n\n\t//! returns format of the audio stream\n\tvirtual SAudioStreamFormat getFormat() = 0;\n\n\t//! sets the position of the audio stream.\n\t/** For example to let the stream be read from the beginning of the file again, \n\tsetPosition(0) would be called. This is usually done be the sound engine to\n\tloop a stream after if has reached the end. Return true if successful and 0 if not. \n\t\\param pos: Position in frames.*/\n\tvirtual bool setPosition(ik_s32 pos) = 0;\n\n\t//! returns true if the audio stream is seekable\n\t/* Some file formats like (MODs) don't support seeking */\n\tvirtual bool getIsSeekingSupported() { return true; }\n\n //! tells the audio stream to read frameCountToRead audio frames into the specified buffer\n\t/** \\param target: Target data buffer to the method will write the read frames into. The\n\tspecified buffer will be at least getFormat().getFrameSize()*frameCountToRead bytes big.\n\t\\param frameCountToRead: amount of frames to be read.\n\t\\returns Returns amount of frames really read. Should be frameCountToRead in most cases. */\n\tvirtual ik_s32 readFrames(void* target, ik_s32 frameCountToRead) = 0;\n};\n\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IAudioStreamLoader.h", "language": "code", "loc": 28, "comment_density": 0.464, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_AUDIO_STREAM_LOADER_H_INCLUDED__\n#define __I_IRRKLANG_AUDIO_STREAM_LOADER_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_IFileReader.h\"\n\nnamespace irrklang\n{\n\nclass IAudioStream;\n\n//!\tClass which is able to create an audio file stream from a file.\nclass IAudioStreamLoader : public IRefCounted\n{\npublic:\n\n\t//! destructor\n\tvirtual ~IAudioStreamLoader() {};\n\n\t//! Returns true if the file maybe is able to be loaded by this class.\n\t/** This decision should be based only on the file extension (e.g. \".wav\"). The given\n\tfilename string is guaranteed to be lower case. */\n\tvirtual bool isALoadableFileExtension(const ik_c8* fileName) = 0;\n\n\t//! Creates an audio file input stream from a file\n\t/** \\return Pointer to the created audio stream. Returns 0 if loading failed.\n\tIf you no longer need the stream, you should call IAudioFileStream::drop().\n\tSee IRefCounted::drop() for more information. */\n\tvirtual IAudioStream* createAudioStream(IFileReader* file) = 0;\n};\n\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IFileFactory.h", "language": "code", "loc": 32, "comment_density": 0.594, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_FILE_FACTORY_H_INCLUDED__\n#define __I_IRRKLANG_FILE_FACTORY_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n\nnamespace irrklang\n{\n\tclass IFileReader;\n\n\t//! Interface to overwrite file access in irrKlang.\n\t/** Derive your own class from IFileFactory, overwrite the createFileReader()\n\t\tmethod and return your own implemented IFileReader to overwrite file access of irrKlang.\n\t\tUse ISoundEngine::addFileFactory() to let irrKlang know about your class.\n\t\tExample code can be found in the tutorial 04.OverrideFileAccess.\n\t */\n\tclass IFileFactory : public virtual IRefCounted\n\t{\n\tpublic:\n\n\t\tvirtual ~IFileFactory() {};\n\n\t\t//! Opens a file for read access.\n\t\t/** Derive your own class from IFileFactory, overwrite this\n\t\tmethod and return your own implemented IFileReader to overwrite file access of irrKlang.\n\t\tUse ISoundEngine::addFileFactory() to let irrKlang know about your class.\n\t\tExample code can be found in the tutorial 04.OverrideFileAccess.\n\t\t\\param filename Name of file to open.\n\t\t\\return Returns a pointer to the created file interface.\n\t\tThe returned pointer should be dropped when no longer needed.\n\t\tSee IRefCounted::drop() for more information. Returns 0 if file cannot be opened. */\n\t\tvirtual IFileReader* createFileReader(const ik_c8* filename) = 0;\t\t\n\t};\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IFileReader.h", "language": "code", "loc": 37, "comment_density": 0.568, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_READ_FILE_H_INCLUDED__\n#define __I_IRRKLANG_READ_FILE_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n\nnamespace irrklang\n{\n\n\t//! Interface providing read access to a file.\n\tclass IFileReader : public virtual IRefCounted\n\t{\n\tpublic:\n\n\t\tvirtual ~IFileReader() {};\n\n\t\t//! Reads an amount of bytes from the file.\n\t\t//! \\param buffer: Pointer to buffer where to read bytes will be written to.\n\t\t//! \\param sizeToRead: Amount of bytes to read from the file.\n\t\t//! \\return Returns how much bytes were read.\n\t\tvirtual ik_s32 read(void* buffer, ik_u32 sizeToRead) = 0;\n\n\t\t//! Changes position in file, returns true if successful.\n\t\t//! \\param finalPos: Destination position in the file.\n\t\t//! \\param relativeMovement: If set to true, the position in the file is\n\t\t//! changed relative to current position. Otherwise the position is changed \n\t\t//! from beginning of file.\n\t\t//! \\return Returns true if successful, otherwise false.\n\t\tvirtual bool seek(ik_s32 finalPos, bool relativeMovement = false) = 0;\n\n\t\t//! Returns size of file.\n\t\t//! \\return Returns the size of the file in bytes.\n\t\tvirtual ik_s32 getSize() = 0;\n\n\t\t//! Returns the current position in the file.\n\t\t//! \\return Returns the current position in the file in bytes.\n\t\tvirtual ik_s32 getPos() = 0;\n\n\t\t//! Returns name of file.\n\t\t//! \\return Returns the file name as zero terminated character string.\n\t\tvirtual const ik_c8* getFileName() = 0;\n\t};\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IRefCounted.h", "language": "code", "loc": 101, "comment_density": 0.703, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_IREFERENCE_COUNTED_H_INCLUDED__\n#define __I_IRRKLANG_IREFERENCE_COUNTED_H_INCLUDED__\n\n#include \"ik_irrKlangTypes.h\"\n\nnamespace irrklang\n{\n\t//! Base class of most objects of the irrKlang.\n\t/** This class provides reference counting through the methods grab() and drop().\n\tIt also is able to store a debug string for every instance of an object.\n\tMost objects of irrKlang are derived from IRefCounted, and so they are reference counted.\n\n\tWhen you receive an object in irrKlang (for example an ISound using play2D() or\n\tplay3D()), and you no longer need the object, you have \n\tto call drop(). This will destroy the object, if grab() was not called\n\tin another part of you program, because this part still needs the object.\n\tNote, that you only don't need to call drop() for all objects you receive, it\n\twill be explicitly noted in the documentation.\n\n\tA simple example:\n\n\tIf you want to play a sound, you may want to call the method\n\tISoundEngine::play2D. You call\n\tISound* mysound = engine->play2D(\"foobar.mp3\", false, false true);\n\tIf you no longer need the sound interface, call mysound->drop(). The \n\tsound may still play on after this because the engine still has a reference\n\tto that sound, but you can be sure that it's memory will be released as soon\n\tthe sound is no longer used.\n\n\tIf you want to add a sound source, you may want to call a method\n\tISoundEngine::addSoundSourceFromFile. You do this like\n\tISoundSource* mysource = engine->addSoundSourceFromFile(\"example.jpg\");\n\tYou will not have to drop the pointer to the source, because\n\tsound sources are managed by the engine (it will live as long as the sound engine) and\n\tthe documentation says so. \n\t*/\n\tclass IRefCounted\n\t{\n\tpublic:\n\n\t\t//! Constructor.\n\t\tIRefCounted()\n\t\t\t: ReferenceCounter(1)\n\t\t{\n\t\t}\n\n\t\t//! Destructor.\n\t\tvirtual ~IRefCounted()\n\t\t{\n\t\t}\n\n\t\t//! Grabs the object. Increments the reference counter by one.\n\t\t//! Someone who calls grab() to an object, should later also call\n\t\t//! drop() to it. If an object never gets as much drop() as grab()\n\t\t//! calls, it will never be destroyed.\n\t\t//! The IRefCounted class provides a basic reference counting mechanism\n\t\t//! with its methods grab() and drop(). Most objects of irrklang\n\t\t//! are derived from IRefCounted, and so they are reference counted.\n\t\t//!\n\t\t//! When you receive an object in irrKlang (for example an ISound using play2D() or\n\t\t//! play3D()), and you no longer need the object, you have \n\t\t//! to call drop(). This will destroy the object, if grab() was not called\n\t\t//! in another part of you program, because this part still needs the object.\n\t\t//! Note, that you only don't need to call drop() for all objects you receive, it\n\t\t//! will be explicitly noted in the documentation.\n\t\t//! \n\t\t//! A simple example:\n\t\t//! \n\t\t//! If you want to play a sound, you may want to call the method\n\t\t//! ISoundEngine::play2D. You call\n\t\t//! ISound* mysound = engine->play2D(\"foobar.mp3\", false, false true);\n\t\t//! If you no longer need the sound interface, call mysound->drop(). The \n\t\t//! sound may still play on after this because the engine still has a reference\n\t\t//! to that sound, but you can be sure that it's memory will be released as soon\n\t\t//! the sound is no longer used.\n\t\tvoid grab() { ++ReferenceCounter; }\n\n\t\t//! When you receive an object in irrKlang (for example an ISound using play2D() or\n\t\t//! play3D()), and you no longer need the object, you have \n\t\t//! to call drop(). This will destroy the object, if grab() was not called\n\t\t//! in another part of you program, because this part still needs the object.\n\t\t//! Note, that you only don't need to call drop() for all objects you receive, it\n\t\t//! will be explicitly noted in the documentation.\n\t\t//! \n\t\t//! A simple example:\n\t\t//! \n\t\t//! If you want to play a sound, you may want to call the method\n\t\t//! ISoundEngine::play2D. You call\n\t\t//! ISound* mysound = engine->play2D(\"foobar.mp3\", false, false true);\n\t\t//! If you no longer need the sound interface, call mysound->drop(). The \n\t\t//! sound may still play on after this because the engine still has a reference\n\t\t//! to that sound, but you can be sure that it's memory will be released as soon\n\t\t//! the sound is no longer used.\n\t\tbool drop()\n\t\t{\n\t\t\t--ReferenceCounter;\n\n\t\t\tif (!ReferenceCounter)\n\t\t\t{\n\t\t\t\tdelete this;\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\tprivate:\n\n\t\tik_s32\tReferenceCounter;\n\t};\n\n} // end namespace irr\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_ISound.h", "language": "code", "loc": 160, "comment_density": 0.75, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_H_INCLUDED__\n\n#include \"ik_IVirtualRefCounted.h\"\n#include \"ik_ISoundEffectControl.h\"\n#include \"ik_vec3d.h\"\n\n\nnamespace irrklang\n{\n\tclass ISoundSource;\n\tclass ISoundStopEventReceiver;\n\n\t//! Represents a sound which is currently played.\n\t/** The sound can be stopped, its volume or pan changed, effects added/removed\n\tand similar using this interface.\n\tCreating sounds is done using ISoundEngine::play2D() or ISoundEngine::play3D(). \n\tMore informations about the source of a sound can be obtained from the ISoundSource\n\tinterface. */\n\tclass ISound : public IVirtualRefCounted\n\t{\n\tpublic:\n\n\t\t//! returns source of the sound which stores the filename and other informations about that sound\n\t\t/** \\return Returns the sound source pointer of this sound. May return 0 if the sound source\n\t\thas been removed.*/\n\t\tvirtual ISoundSource* getSoundSource() = 0;\n\n\t\t//! returns if the sound is paused\n\t\tvirtual void setIsPaused( bool paused = true) = 0;\n\n\t\t//! returns if the sound is paused\n\t\tvirtual bool getIsPaused() = 0;\n\n\t\t//! Will stop the sound and free its resources.\n\t\t/** If you just want to pause the sound, use setIsPaused().\n\t\tAfter calling stop(), isFinished() will usually return true. \n\t\tBe sure to also call ->drop() once you are done.*/\n\t\tvirtual void stop() = 0;\n\n\t\t//! returns volume of the sound, a value between 0 (mute) and 1 (full volume).\n\t\t/** (this volume gets multiplied with the master volume of the sound engine\n\t\tand other parameters like distance to listener when played as 3d sound) */\n\t\tvirtual ik_f32 getVolume() = 0;\n\n\t\t//! sets the volume of the sound, a value between 0 (mute) and 1 (full volume).\n\t\t/** This volume gets multiplied with the master volume of the sound engine\n\t\tand other parameters like distance to listener when played as 3d sound. */\n\t\tvirtual void setVolume(ik_f32 volume) = 0;\n\n\t\t//! sets the pan of the sound. Takes a value between -1 and 1, 0 is center.\n\t\tvirtual void setPan(ik_f32 pan) = 0;\n\n\t\t//! returns the pan of the sound. Takes a value between -1 and 1, 0 is center.\n\t\tvirtual ik_f32 getPan() = 0;\n\n\t\t//! returns if the sound has been started to play looped\n\t\tvirtual bool isLooped() = 0;\n\n\t\t//! changes the loop mode of the sound. \n\t\t/** If the sound is playing looped and it is changed to not-looped, then it \n\t\twill stop playing after the loop has finished. \n\t\tIf it is not looped and changed to looped, the sound will start repeating to be \n\t\tplayed when it reaches its end. \n\t\tInvoking this method will not have an effect when the sound already has stopped. */\n\t\tvirtual void setIsLooped(bool looped) = 0;\n\n\t\t//! returns if the sound has finished playing.\n\t\t/** Don't mix this up with isPaused(). isFinished() returns if the sound has been\n\t\tfinished playing. If it has, is maybe already have been removed from the playing list of the\n\t\tsound engine and calls to any other of the methods of ISound will not have any result.\n\t\tIf you call stop() to a playing sound will result that this function will return true\n\t\twhen invoked. */\n\t\tvirtual bool isFinished() = 0;\n\n\t\t//! Sets the minimal distance if this is a 3D sound.\n\t\t/** Changes the distance at which the 3D sound stops getting louder. This works\n\t\tlike this: As a listener approaches a 3D sound source, the sound gets louder.\n\t\tPast a certain point, it is not reasonable for the volume to continue to increase.\n\t\tEither the maximum (zero) has been reached, or the nature of the sound source\n\t\timposes a logical limit. This is the minimum distance for the sound source.\n\t\tSimilarly, the maximum distance for a sound source is the distance beyond\n\t\twhich the sound does not get any quieter.\n\t\tThe default minimum distance is 1, the default max distance is a huge number like 1000000000.0f. */\n\t\tvirtual void setMinDistance(ik_f32 min) = 0;\n\n\t\t//! Returns the minimal distance if this is a 3D sound.\n\t\t/** See setMinDistance() for details. */\n\t\tvirtual ik_f32 getMinDistance() = 0;\n\n\t\t//! Sets the maximal distance if this is a 3D sound.\n\t\t/** Changing this value is usually not necessary. Use setMinDistance() instead.\n\t\tDon't change this value if you don't know what you are doing: This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setMinDistance()) to influence this.\n\t\tThe maximum distance for a sound source is the distance beyond which the sound does not get any quieter.\n\t\tThe default minimum distance is 1, the default max distance is a huge number like 1000000000.0f. */\n\t\tvirtual void setMaxDistance(ik_f32 max) = 0;\n\n\t\t//! Returns the maximal distance if this is a 3D sound.\n\t\t/** See setMaxDistance() for details. */\n\t\tvirtual ik_f32 getMaxDistance() = 0;\n\n\t\t//! sets the position of the sound in 3d space\n\t\tvirtual void setPosition(vec3df position) = 0;\n\n\t\t//! returns the position of the sound in 3d space\n\t\tvirtual vec3df getPosition() = 0;\n\n\t\t//! sets the position of the sound in 3d space, needed for Doppler effects.\n\t\t/** To use doppler effects use ISound::setVelocity to set a sounds velocity, \n\t\tISoundEngine::setListenerPosition() to set the listeners velocity and \n\t\tISoundEngine::setDopplerEffectParameters() to adjust two parameters influencing \n\t\tthe doppler effects intensity. */\n\t\tvirtual void setVelocity(vec3df vel) = 0;\n\n\t\t//! returns the velocity of the sound in 3d space, needed for Doppler effects.\n\t\t/** To use doppler effects use ISound::setVelocity to set a sounds velocity, \n\t\tISoundEngine::setListenerPosition() to set the listeners velocity and \n\t\tISoundEngine::setDopplerEffectParameters() to adjust two parameters influencing \n\t\tthe doppler effects intensity. */\n\t\tvirtual vec3df getVelocity() = 0;\n\n\t\t//! returns the current play position of the sound in milliseconds.\n\t\t/** \\return Returns -1 if not implemented or possible for this sound for example\n\t\tbecause it already has been stopped and freed internally or similar. */\n\t\tvirtual ik_u32 getPlayPosition() = 0;\n\n\t\t//! sets the current play position of the sound in milliseconds.\n /** \\param pos Position in milliseconds. Must be between 0 and the value returned\n\t\tby getPlayPosition().\n\t\t\\return Returns true successful. False is returned for example if the sound already finished\n\t\tplaying and is stopped or the audio source is not seekable, for example if it \n\t\tis an internet stream or a a file format not supporting seeking (a .MOD file for example).\n\t\tA file can be tested if it can bee seeking using ISoundSource::getIsSeekingSupported(). */\n\t\tvirtual bool setPlayPosition(ik_u32 pos) = 0;\n\n\t\t//! Sets the playback speed (frequency) of the sound.\n\t\t/** Plays the sound at a higher or lower speed, increasing or decreasing its\n\t\tfrequency which makes it sound lower or higher.\n\t\tNote that this feature is not available on all sound output drivers (it is on the\n\t\tDirectSound drivers at least), and it does not work together with the \n\t\t'enableSoundEffects' parameter of ISoundEngine::play2D and ISoundEngine::play3D when\n\t\tusing DirectSound.\n\t\t\\param speed Factor of the speed increase or decrease. 2 is twice as fast, \n\t\t0.5 is only half as fast. The default is 1.0.\n\t\t\\return Returns true if successful, false if not. The current sound driver might not\n\t\tsupport changing the playBack speed, or the sound was started with the \n\t\t'enableSoundEffects' parameter. */\n\t\tvirtual bool setPlaybackSpeed(ik_f32 speed = 1.0f) = 0;\n\n\t\t//! Returns the playback speed set by setPlaybackSpeed(). Default: 1.0f.\n\t\t/** See setPlaybackSpeed() for details */\n\t\tvirtual ik_f32 getPlaybackSpeed() = 0;\n\n\t\t//! returns the play length of the sound in milliseconds.\n\t\t/** Returns -1 if not known for this sound for example because its decoder\n\t\tdoes not support length reporting or it is a file stream of unknown size.\n\t\tNote: You can also use ISoundSource::getPlayLength() to get the length of \n\t\ta sound without actually needing to play it. */\n\t\tvirtual ik_u32 getPlayLength() = 0;\n\n\t\t//! Returns the sound effect control interface for this sound.\n\t\t/** Sound effects such as Chorus, Distortions, Echo, Reverb and similar can\n\t\tbe controlled using this. The interface pointer is only valid as long as the ISound pointer is valid.\n\t\tIf the ISound pointer gets dropped (IVirtualRefCounted::drop()), the ISoundEffects\n\t\tmay not be used any more. \n\t\t\\return Returns a pointer to the sound effects interface if available. The sound\n\t\thas to be started via ISoundEngine::play2D() or ISoundEngine::play3D(),\n\t\twith the flag enableSoundEffects=true, otherwise 0 will be returned. Note that\n\t\tif the output driver does not support sound effects, 0 will be returned as well.*/\n\t\tvirtual ISoundEffectControl* getSoundEffectControl() = 0;\n\n\t\t//! Sets the sound stop event receiver, an interface which gets called if a sound has finished playing.\n\t\t/** This event is guaranteed to be called when the sound or sound stream is finished,\n\t\teither because the sound reached its playback end, its sound source was removed,\n\t\tISoundEngine::stopAllSounds() has been called or the whole engine was deleted.\n\t\tThere is an example on how to use events in irrklang at @ref events .\n\t\t\\param receiver Interface to a user implementation of the sound receiver. This interface\n\t\tshould be as long valid as the sound exists or another stop event receiver is set.\n\t\tSet this to null to set no sound stop event receiver.\n\t\t\\param userData: A iser data pointer, can be null. */\n\t\tvirtual void setSoundStopEventReceiver(ISoundStopEventReceiver* receiver, void* userData=0) = 0;\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_ISoundDeviceList.h", "language": "code", "loc": 30, "comment_density": 0.567, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_DEVICE_LIST_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_DEVICE_LIST_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n\nnamespace irrklang\n{\n\n//!\tA list of sound devices for a sound driver. Use irrklang::createSoundDeviceList() to create this list.\n/** The function createIrrKlangDevice() has a parameter 'deviceID' which takes the value returned by\nISoundDeviceList::getDeviceID() and uses that device then. \nThe list of devices in ISoundDeviceList usually also includes the default device which is the first\nentry and has an empty deviceID string (\"\") and the description \"default device\". \nThere is some example code on how to use the ISoundDeviceList in @ref enumeratingDevices.*/\nclass ISoundDeviceList : public IRefCounted\n{\npublic:\n\n\t//! Returns amount of enumerated devices in the list.\n\tvirtual ik_s32 getDeviceCount() = 0;\n\n\t//! Returns the ID of the device. Use this string to identify this device in createIrrKlangDevice().\n\t/** \\param index Index of the device, a value between 0 and ISoundDeviceList::getDeviceCount()-1. \n\t\\return Returns a pointer to a string identifying the device. The string will only as long valid \n\tas long as the ISoundDeviceList exists. */\n\tvirtual const char* getDeviceID(ik_s32 index) = 0;\n\n\t//! Returns description of the device.\n\t/** \\param index Index of the device, a value between 0 and ISoundDeviceList::getDeviceCount()-1. */\n\tvirtual const char* getDeviceDescription(ik_s32 index) = 0;\n};\n\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_ISoundEffectControl.h", "language": "code", "loc": 208, "comment_density": 0.615, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_EFFECT_CONTROL_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_EFFECT_CONTROL_H_INCLUDED__\n\n#include \"ik_IVirtualRefCounted.h\"\n#include \"ik_vec3d.h\"\n\n\nnamespace irrklang\n{\n\t//! Interface to control the active sound effects (echo, reverb,...) of an ISound object, a playing sound.\n\t/** Sound effects such as chorus, distortions, echo, reverb and similar can\n\tbe controlled using this. An instance of this interface can be obtained via\n\tISound::getSoundEffectControl(). The sound containing this interface has to be started via \n\tISoundEngine::play2D() or ISoundEngine::play3D() with the flag enableSoundEffects=true, \n\totherwise no access to this interface will be available.\n\tFor the DirectSound driver, these are effects available since DirectSound8. For most \n\teffects, sounds should have a sample rate of 44 khz and should be at least\n\t150 milli seconds long for optimal quality when using the DirectSound driver.\n\tNote that the interface pointer is only valid as long as\n\tthe ISound pointer is valid. If the ISound pointer gets dropped (IVirtualRefCounted::drop()),\n\tthe ISoundEffects may not be used any more. */\n\tclass ISoundEffectControl\n\t{\n\tpublic:\n\n\t\t//! Disables all active sound effects\n\t\tvirtual void disableAllEffects() = 0;\n\n\t\t//! Enables the chorus sound effect or adjusts its values.\n\t\t/** Chorus is a voice-doubling effect created by echoing the\n\t\toriginal sound with a slight delay and slightly modulating the delay of the echo. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fWetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fDepth Percentage by which the delay time is modulated by the low-frequency oscillator, in hundredths of a percentage point. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fFeedback Percentage of output signal to feed back into the effect's input. Minimal Value:-99, Maximal Value:99.0f;\n\t\t\\param fFrequency Frequency of the LFO. Minimal Value:0, Maximal Value:10.0f;\n\t\t\\param sinusWaveForm True for sinus wave form, false for triangle.\n\t\t\\param fDelay Number of milliseconds the input is delayed before it is played back. Minimal Value:0, Maximal Value:20.0f;\n\t\t\\param lPhase Phase differential between left and right LFOs. Possible values:\n\t\t\t-180, -90, 0, 90, 180\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableChorusSoundEffect(ik_f32 fWetDryMix = 50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fDepth = 10,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFeedback = 25,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFrequency = 1.1,\n\t\t\t\t\t\t\t\t\t\t\tbool sinusWaveForm = true,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fDelay = 16,\n\t\t\t\t\t\t\t\t\t\t\tik_s32 lPhase = 90) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableChorusSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isChorusSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Compressor sound effect or adjusts its values.\n\t\t/** Compressor is a reduction in the fluctuation of a signal above a certain amplitude. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fGain Output gain of signal after Compressor. Minimal Value:-60, Maximal Value:60.0f;\n\t\t\\param fAttack Time before Compressor reaches its full value. Minimal Value:0.01, Maximal Value:500.0f;\n\t\t\\param fRelease Speed at which Compressor is stopped after input drops below fThreshold. Minimal Value:50, Maximal Value:3000.0f;\n\t\t\\param fThreshold Point at which Compressor begins, in decibels. Minimal Value:-60, Maximal Value:0.0f;\n\t\t\\param fRatio Compressor ratio. Minimal Value:1, Maximal Value:100.0f;\n\t\t\\param fPredelay Time after lThreshold is reached before attack phase is started, in milliseconds. Minimal Value:0, Maximal Value:4.0f;\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableCompressorSoundEffect( ik_f32 fGain = 0,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fAttack = 10,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fRelease = 200,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fThreshold = -20,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fRatio = 3,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fPredelay = 4) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableCompressorSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isCompressorSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Distortion sound effect or adjusts its values.\n\t\t/** Distortion is achieved by adding harmonics to the signal in such a way that,\n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\tas the level increases, the top of the waveform becomes squared off or clipped.\n\t\t\\param fGain Amount of signal change after distortion. Minimal Value:-60, Maximal Value:0;\n\t\t\\param fEdge Percentage of distortion intensity. Minimal Value:0, Maximal Value:100;\n\t\t\\param fPostEQCenterFrequency Center frequency of harmonic content addition. Minimal Value:100, Maximal Value:8000;\n\t\t\\param fPostEQBandwidth Width of frequency band that determines range of harmonic content addition. Minimal Value:100, Maximal Value:8000;\n\t\t\\param fPreLowpassCutoff Filter cutoff for high-frequency harmonics attenuation. Minimal Value:100, Maximal Value:8000;\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableDistortionSoundEffect(ik_f32 fGain = -18,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fEdge = 15,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fPostEQCenterFrequency = 2400,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fPostEQBandwidth = 2400,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 fPreLowpassCutoff = 8000) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableDistortionSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isDistortionSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Echo sound effect or adjusts its values.\n\t\t/** An echo effect causes an entire sound to be repeated after a fixed delay.\n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fWetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fFeedback Percentage of output fed back into input. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fLeftDelay Delay for left channel, in milliseconds. Minimal Value:1, Maximal Value:2000.0f;\n\t\t\\param fRightDelay Delay for right channel, in milliseconds. Minimal Value:1, Maximal Value:2000.0f;\n\t\t\\param lPanDelay Value that specifies whether to swap left and right delays with each successive echo. Minimal Value:0, Maximal Value:1;\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableEchoSoundEffect(ik_f32 fWetDryMix = 50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFeedback = 50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fLeftDelay = 500,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fRightDelay = 500,\n\t\t\t\t\t\t\t\t\t\t\tik_s32 lPanDelay = 0) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableEchoSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isEchoSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Flanger sound effect or adjusts its values.\n\t\t/** Flange is an echo effect in which the delay between the original \n\t\tsignal and its echo is very short and varies over time. The result is \n\t\tsometimes referred to as a sweeping sound. The term flange originated\n\t\twith the practice of grabbing the flanges of a tape reel to change the speed. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fWetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fDepth Percentage by which the delay time is modulated by the low-frequency oscillator, in hundredths of a percentage point. Minimal Value:0, Maximal Value:100.0f;\n\t\t\\param fFeedback Percentage of output signal to feed back into the effect's input. Minimal Value:-99, Maximal Value:99.0f;\n\t\t\\param fFrequency Frequency of the LFO. Minimal Value:0, Maximal Value:10.0f;\n\t\t\\param triangleWaveForm True for triangle wave form, false for square.\n\t\t\\param fDelay Number of milliseconds the input is delayed before it is played back. Minimal Value:0, Maximal Value:20.0f;\n\t\t\\param lPhase Phase differential between left and right LFOs. Possible values:\n\t\t\t-180, -90, 0, 90, 180\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableFlangerSoundEffect(ik_f32 fWetDryMix = 50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fDepth = 100,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFeedback = -50,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fFrequency = 0.25f,\n\t\t\t\t\t\t\t\t\t\t\tbool triangleWaveForm = true,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fDelay = 2,\n\t\t\t\t\t\t\t\t\t\t\tik_s32 lPhase = 0) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableFlangerSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isFlangerSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Gargle sound effect or adjusts its values.\n\t\t/** The gargle effect modulates the amplitude of the signal. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param rateHz Rate of modulation, in Hertz. Minimal Value:1, Maximal Value:1000\n\t\t\\param sinusWaveForm True for sinus wave form, false for triangle.\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableGargleSoundEffect(ik_s32 rateHz = 20, bool sinusWaveForm = true) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableGargleSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isGargleSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Interactive 3D Level 2 reverb sound effect or adjusts its values.\n\t\t/** An implementation of the listener properties in the I3DL2 specification. Source properties are not supported.\n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param lRoom Attenuation of the room effect, in millibels (mB). Interval: [-10000, 0] Default: -1000 mB\n\t\t\\param lRoomHF Attenuation of the room high-frequency effect. Interval: [-10000, 0] default: 0 mB\n\t\t\\param flRoomRolloffFactor Rolloff factor for the reflected signals. Interval: [0.0, 10.0] default: 0.0\n\t\t\\param flDecayTime Decay time, in seconds. Interval: [0.1, 20.0] default: 1.49s\n\t\t\\param flDecayHFRatio Ratio of the decay time at high frequencies to the decay time at low frequencies. Interval: [0.1, 2.0] default: 0.83\n\t\t\\param lReflections Attenuation of early reflections relative to lRoom. Interval: [-10000, 1000] default: -2602 mB\n\t\t\\param flReflectionsDelay Delay time of the first reflection relative to the direct path in seconds. Interval: [0.0, 0.3] default: 0.007 s\n\t\t\\param lReverb Attenuation of late reverberation relative to lRoom, in mB. Interval: [-10000, 2000] default: 200 mB\n\t\t\\param flReverbDelay Time limit between the early reflections and the late reverberation relative to the time of the first reflection. Interval: [0.0, 0.1] default: 0.011 s\n\t\t\\param flDiffusion Echo density in the late reverberation decay in percent. Interval: [0.0, 100.0] default: 100.0 %\n\t\t\\param flDensity Modal density in the late reverberation decay, in percent. Interval: [0.0, 100.0] default: 100.0 %\n\t\t\\param flHFReference Reference high frequency, in hertz. Interval: [20.0, 20000.0] default: 5000.0 Hz \n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableI3DL2ReverbSoundEffect(ik_s32 lRoom = -1000,\n\t\t\t\t\t\t\t\t\t\t\t\tik_s32 lRoomHF = -100,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flRoomRolloffFactor = 0,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flDecayTime = 1.49f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flDecayHFRatio = 0.83f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_s32 lReflections = -2602,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flReflectionsDelay = 0.007f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_s32 lReverb = 200,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flReverbDelay = 0.011f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flDiffusion = 100.0f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flDensity = 100.0f,\n\t\t\t\t\t\t\t\t\t\t\t\tik_f32 flHFReference = 5000.0f ) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableI3DL2ReverbSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isI3DL2ReverbSoundEffectEnabled() = 0;\n\n\t\t//! Enables the ParamEq sound effect or adjusts its values.\n\t\t/** Parametric equalizer amplifies or attenuates signals of a given frequency. \n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fCenter Center frequency, in hertz, The default value is 8000. Minimal Value:80, Maximal Value:16000.0f\n\t\t\\param fBandwidth Bandwidth, in semitones, The default value is 12. Minimal Value:1.0f, Maximal Value:36.0f\n\t\t\\param fGain Gain, default value is 0. Minimal Value:-15.0f, Maximal Value:15.0f\n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableParamEqSoundEffect(ik_f32 fCenter = 8000,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fBandwidth = 12,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fGain = 0) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableParamEqSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isParamEqSoundEffectEnabled() = 0;\n\n\t\t//! Enables the Waves Reverb sound effect or adjusts its values.\n\t\t/** \\param fInGain Input gain of signal, in decibels (dB). Min/Max: [-96.0,0.0] Default: 0.0 dB.\n\t\tIf this sound effect is already enabled, calling this only modifies the parameters of the active effect.\n\t\t\\param fReverbMix Reverb mix, in dB. Min/Max: [-96.0,0.0] Default: 0.0 dB\n\t\t\\param fReverbTime Reverb time, in milliseconds. Min/Max: [0.001,3000.0] Default: 1000.0 ms\n\t\t\\param fHighFreqRTRatio High-frequency reverb time ratio. Min/Max: [0.001,0.999] Default: 0.001 \n\t\t\\return Returns true if successful. */\n\t\tvirtual bool enableWavesReverbSoundEffect(ik_f32 fInGain = 0,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fReverbMix = 0,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fReverbTime = 1000,\n\t\t\t\t\t\t\t\t\t\t\tik_f32 fHighFreqRTRatio = 0.001f) = 0;\n\n\t\t//! removes the sound effect from the sound\n\t\tvirtual void disableWavesReverbSoundEffect() = 0;\n\n\t\t//! returns if the sound effect is active on the sound\n\t\tvirtual bool isWavesReverbSoundEffectEnabled() = 0;\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_ISoundEngine.h", "language": "code", "loc": 383, "comment_density": 0.773, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_ENGINE_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_ENGINE_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_vec3d.h\"\n#include \"ik_ISoundSource.h\"\n#include \"ik_ISound.h\"\n#include \"ik_EStreamModes.h\"\n#include \"ik_IFileFactory.h\"\n#include \"ik_ISoundMixedOutputReceiver.h\"\n\n\nnamespace irrklang\n{\n\tclass IAudioStreamLoader;\n\tstruct SInternalAudioInterface;\n\n\t//! Interface to the sound engine, for playing 3d and 2d sound and music.\n\t/** This is the main interface of irrKlang. You usually would create this using\n\tthe createIrrKlangDevice() function. \n\t*/\n\tclass ISoundEngine : public virtual irrklang::IRefCounted\n\t{\n\tpublic:\n\n\t\t//! returns the name of the sound driver, like 'ALSA' for the alsa device\n\t\t/** Possible returned strings are \"NULL\", \"ALSA\", \"CoreAudio\", \"winMM\", \n\t\t\"DirectSound\" and \"DirectSound8\". */\n\t\tvirtual const char* getDriverName() = 0;\n\n\t\t//! loads a sound source (if not loaded already) from a file and plays it.\n\t\t/** \\param sourceFileName Filename of sound, like \"sounds/test.wav\" or \"foobar.ogg\".\n\t\t \\param playLooped plays the sound in loop mode. If set to 'false', the sound is played once, then stopped and deleted from the internal playing list. Calls to\n\t\t ISound have no effect after such a non looped sound has been stopped automatically.\n\t\t \\param startPaused starts the sound paused. This implies that track=true. Use this if you want to modify some of the playing\n\t\t parameters before the sound actually plays. Usually you would set this parameter to true, then use the ISound interface to\n\t\t modify some of the sound parameters and then call ISound::setPaused(false);\n\t\t Note: You need to call ISound::drop() when setting this parameter to true and you don't need the ISound\n\t\t object anymore. See 'return' for details.\n\t\t \\param track Makes it possible to track the sound. Causes the method to return an ISound interface. See 'return' for details.\n\t\t \\param streamMode Specifies if the file should be streamed or loaded completely into memory for playing.\n\t\t ESM_AUTO_DETECT sets this to autodetection. Note: if the sound has been loaded or played before into the\n\t\t engine, this parameter has no effect.\n\t\t \\param enableSoundEffects Makes it possible to use sound effects such as chorus, distortions, echo, \n\t\t reverb and similar for this sound. Sound effects can then be controlled via ISound::getSoundEffectControl().\n\t\t Only enable if necessary. \n\t\t \\return Only returns a pointer to an ISound if the parameters 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been\t set to true. Note: if this method returns an ISound as result, \n\t\t you HAVE to call ISound::drop() after you don't need the ISound interface anymore. Otherwise this \n\t\t will cause memory waste. This method also may return 0 although 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been set to true, if the sound could not be played.*/\n\t\tvirtual ISound* play2D(const char* soundFileName, \n\t\t\t\t\t\t\t bool playLooped = false,\n\t\t\t\t\t\t\t bool startPaused = false, \n\t\t\t\t\t\t\t bool track = false,\n\t\t\t\t\t\t\t E_STREAM_MODE streamMode = ESM_AUTO_DETECT,\n\t\t\t\t\t\t\t bool enableSoundEffects = false) = 0;\n\n\t\t//! Plays a sound source as 2D sound with its default settings stored in ISoundSource.\n\t\t/** An ISoundSource object will be created internally when playing a sound the first time,\n\t\tor can be added with getSoundSource().\n\t\t\\param source The sound source, specifying sound file source and default settings for this file.\n\t\tUse the other ISoundEngine::play2D() overloads if you want to specify a filename string instead of this.\n\t\t\\param playLooped plays the sound in loop mode. If set to 'false', the sound is played once, then stopped and deleted from the internal playing list. Calls to\n\t\t ISound have no effect after such a non looped sound has been stopped automatically.\n\t\t\\param startPaused starts the sound paused. This implies that track=true. Use this if you want to modify some of the playing\n\t\t parameters before the sound actually plays. Usually you would set this parameter to true, then use the ISound interface to\n\t\t modify some of the sound parameters and then call ISound::setPaused(false);\n\t\t Note: You need to call ISound::drop() when setting this parameter to true and you don't need the ISound\n\t\t object anymore. See 'return' for details.\n\t\t \\param track Makes it possible to track the sound. Causes the method to return an ISound interface. See 'return' for details.\n\t\t \\param enableSoundEffects Makes it possible to use sound effects such as chorus, distortions, echo, \n\t\t reverb and similar for this sound. Sound effects can then be controlled via ISound::getSoundEffectControl().\n\t\t Only enable if necessary. \n\t\t \\return Only returns a pointer to an ISound if the parameters 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been\t set to true. Note: if this method returns an ISound as result, \n\t\t you HAVE to call ISound::drop() after you don't need the ISound interface anymore. Otherwise this \n\t\t will cause memory waste. This method also may return 0 although 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been set to true, if the sound could not be played.*/\n\t\tvirtual ISound* play2D(ISoundSource* source, \n\t\t\t\t\t\t\t bool playLooped = false,\n\t\t\t\t\t\t\t bool startPaused = false, \n\t\t\t\t\t\t\t bool track = false,\n\t\t\t\t\t\t\t bool enableSoundEffects = false) = 0;\n\n\t\t//! Loads a sound source (if not loaded already) from a file and plays it as 3D sound.\n\t\t/** There is some example code on how to work with 3D sound at @ref sound3d.\n\t\t\\param sourceFileName Filename of sound, like \"sounds/test.wav\" or \"foobar.ogg\".\n\t\t \\param pos Position of the 3D sound.\n\t\t \\param playLooped plays the sound in loop mode. If set to 'false', the sound is played once, then stopped and deleted from the internal playing list. Calls to\n\t\t ISound have no effect after such a non looped sound has been stopped automatically.\n\t\t \\param startPaused starts the sound paused. This implies that track=true. Use this if you want to modify some of the playing\n\t\t parameters before the sound actually plays. Usually you would set this parameter to true, then use the ISound interface to\n\t\t modify some of the sound parameters and then call ISound::setPaused(false);\n\t\t Note: You need to call ISound::drop() when setting this parameter to true and you don't need the ISound\n\t\t object anymore. See 'return' for details.\n\t\t \\param track Makes it possible to track the sound. Causes the method to return an ISound interface. See 'return' for details.\n \t\t \\param streamMode Specifies if the file should be streamed or loaded completely into memory for playing.\n\t\t ESM_AUTO_DETECT sets this to autodetection. Note: if the sound has been loaded or played before into the\n\t\t engine, this parameter has no effect.\n\t\t \\param enableSoundEffects Makes it possible to use sound effects such as chorus, distortions, echo, \n\t\t reverb and similar for this sound. Sound effects can then be controlled via ISound::getSoundEffectControl().\n\t\t Only enable if necessary. \n\t\t \\return Only returns a pointer to an ISound if the parameters 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been\t set to true. Note: if this method returns an ISound as result, \n\t\t you HAVE to call ISound::drop() after you don't need the ISound interface anymore. Otherwise this \n\t\t will cause memory waste. This method also may return 0 although 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been set to true, if the sound could not be played.*/\n\t\tvirtual ISound* play3D(const char* soundFileName, vec3df pos,\n\t\t\t\t\t\t\t bool playLooped = false, \n\t\t\t\t\t\t\t bool startPaused = false,\n\t\t\t\t\t\t\t bool track = false, \n\t\t\t\t\t\t\t E_STREAM_MODE streamMode = ESM_AUTO_DETECT,\n\t\t\t\t\t\t\t bool enableSoundEffects = false) = 0;\n\n\t\t//! Plays a sound source as 3D sound with its default settings stored in ISoundSource.\n\t\t/** An ISoundSource object will be created internally when playing a sound the first time,\n\t\tor can be added with getSoundSource(). There is some example code on how to work with 3D sound @ref sound3d.\n\t\t\\param source The sound source, specifying sound file source and default settings for this file.\n\t\tUse the other ISoundEngine::play2D() overloads if you want to specify a filename string instead of this.\n\t\t\\param pos Position of the 3D sound.\n\t\t\\param playLooped plays the sound in loop mode. If set to 'false', the sound is played once, then stopped and deleted from the internal playing list. Calls to\n\t\t ISound have no effect after such a non looped sound has been stopped automatically.\n\t\t\\param startPaused starts the sound paused. This implies that track=true. Use this if you want to modify some of the playing\n\t\t parameters before the sound actually plays. Usually you would set this parameter to true, then use the ISound interface to\n\t\t modify some of the sound parameters and then call ISound::setPaused(false);\n\t\t Note: You need to call ISound::drop() when setting this parameter to true and you don't need the ISound\n\t\t object anymore. See 'return' for details.\n\t\t \\param track Makes it possible to track the sound. Causes the method to return an ISound interface. See 'return' for details.\n\t\t \\param enableSoundEffects Makes it possible to use sound effects such as chorus, distortions, echo, \n\t\t reverb and similar for this sound. Sound effects can then be controlled via ISound::getSoundEffectControl().\n\t\t Only enable if necessary. \n\t\t \\return Only returns a pointer to an ISound if the parameters 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been\t set to true. Note: if this method returns an ISound as result, \n\t\t you HAVE to call ISound::drop() after you don't need the ISound interface anymore. Otherwise this \n\t\t will cause memory waste. This method also may return 0 although 'track', 'startPaused' or \n\t\t 'enableSoundEffects' have been set to true, if the sound could not be played.*/\n\t\tvirtual ISound* play3D(ISoundSource* source, vec3df pos,\n\t\t\t\t\t\t\t bool playLooped = false, \n\t\t\t\t\t\t\t bool startPaused = false, \n\t\t\t\t\t\t\t bool track = false,\n\t\t\t\t\t\t\t bool enableSoundEffects = false) = 0;\n\n\t\t//! Stops all currently playing sounds.\n\t\tvirtual void stopAllSounds() = 0;\n\n //! Pauses or unpauses all currently playing sounds.\n\t\tvirtual void setAllSoundsPaused( bool bPaused = true ) = 0;\n\n\t\t//! Gets a sound source by sound name. Adds the sound source as file into the sound engine if not loaded already.\n\t\t/** Please note: For performance reasons most ISoundEngine implementations will\n\t\tnot try to load the sound when calling this method, but only when play() is called\n\t\twith this sound source as parameter. \n\t\t\\param addIfNotFound if 'true' adds the sound source to the list and returns the interface to it\n\t\tif it cannot be found in the sound source list. If 'false', returns 0 if the sound\n\t\tsource is not in the list and does not modify the list. Default value: true.\n\t\t\\return Returns the sound source or 0 if not available.\n\t\tNote: Don't call drop() to this pointer, it will be managed by irrKlang and\n\t\texist as long as you don't delete irrKlang or call removeSoundSource(). However,\n\t\tyou are free to call grab() if you want and drop() it then later of course. */\n\t\tvirtual ISoundSource* getSoundSource(const ik_c8* soundName, bool addIfNotFound=true) = 0;\n\n\t\t//! Returns a sound source by index.\n\t\t/** \\param idx: Index of the loaded sound source, must by smaller than getSoundSourceCount().\n\t\t\\return Returns the sound source or 0 if not available.\n\t\tNote: Don't call drop() to this pointer, it will be managed by irrKlang and\n\t\texist as long as you don't delete irrKlang or call removeSoundSource(). However,\n\t\tyou are free to call grab() if you want and drop() it then later of course. */\t\n\t\tvirtual ISoundSource* getSoundSource(ik_s32 index) = 0;\n\n\t\t//! Returns amount of loaded sound sources.\n\t\tvirtual ik_s32 getSoundSourceCount() = 0;\n\n\t\t//! Adds sound source into the sound engine as file.\n\t\t/** \\param fileName Name of the sound file (e.g. \"sounds/something.mp3\"). You can also use this\n\t\tname when calling play3D() or play2D().\n\t\t\\param mode Streaming mode for this sound source\n\t\t\\param preload If this flag is set to false (which is default) the sound engine will\n\t\tnot try to load the sound file when calling this method, but only when play() is called\n\t\twith this sound source as parameter. Otherwise the sound will be preloaded.\n\t\t\\return Returns the pointer to the added sound source or 0 if not successful because for\n\t\texample a sound already existed with that name. If not successful, the reason will be printed\n\t\tinto the log. Note: Don't call drop() to this pointer, it will be managed by irrKlang and\n\t\texist as long as you don't delete irrKlang or call removeSoundSource(). However,\n\t\tyou are free to call grab() if you want and drop() it then later of course. */\t\n\t\tvirtual ISoundSource* addSoundSourceFromFile(const ik_c8* fileName, E_STREAM_MODE mode=ESM_AUTO_DETECT,\n\t\t\t bool preload=false) = 0;\n\n\t\t//! Adds a sound source into the sound engine as memory source.\n\t\t/** Note: This method only accepts a file (.wav, .ogg, etc) which is totally loaded into memory.\n\t\tIf you want to add a sound source from decoded plain PCM data in memory, use addSoundSourceFromPCMData() instead.\n\t\t\\param memory Pointer to the memory to be treated as loaded sound file.\n\t\t\\param sizeInBytes Size of the memory chunk, in bytes.\n\t\t\\param soundName Name of the virtual sound file (e.g. \"sounds/something.mp3\"). You can also use this\n\t\tname when calling play3D() or play2D(). Hint: If you include the extension of the original file\n\t\tlike .ogg, .mp3 or .wav at the end of the filename, irrKlang will be able to decide better what\n\t\tfile format it is and might be able to start playback faster.\n\t\t\\param copyMemory If set to true which is default, the memory block is copied \n\t\tand stored in the engine, after\tcalling addSoundSourceFromMemory() the memory pointer can be deleted\n\t\tsavely. If set to false, the memory is not copied and the user takes the responsibility that \n\t\tthe memory block pointed to remains there as long as the sound engine or at least this sound\n\t\tsource exists.\n\t\t\\return Returns the pointer to the added sound source or 0 if not successful because for example a sound already\n\t\texisted with that name. If not successful, the reason will be printed into the log. \n\t\tNote: Don't call drop() to this pointer, it will be managed by irrKlang and exist as long as you don't \n\t\tdelete irrKlang or call removeSoundSource(). However, you are free to call grab() if you\n\t\twant and drop() it then later of course. */\n\t\tvirtual ISoundSource* addSoundSourceFromMemory(void* memory, ik_s32 sizeInBytes, const ik_c8* soundName,\n\t\t\t\t\t\t\t\t\t\t\t bool copyMemory=true) = 0;\n\n\n\t\t//! Adds a sound source into the sound engine from plain PCM data in memory.\n\t\t/** \\param memory Pointer to the memory to be treated as loaded sound file.\n\t\t\\param sizeInBytes Size of the memory chunk, in bytes. \n\t\t\\param soundName Name of the virtual sound file (e.g. \"sounds/something.mp3\"). You can also use this\n\t\tname when calling play3D() or play2D(). \n\t\t\\param copyMemory If set to true which is default, the memory block is copied \n\t\tand stored in the engine, after\tcalling addSoundSourceFromPCMData() the memory pointer can be deleted\n\t\tsavely. If set to true, the memory is not copied and the user takes the responsibility that \n\t\tthe memory block pointed to remains there as long as the sound engine or at least this sound\n\t\tsource exists. \n\t\t\\return Returns the pointer to the added sound source or 0 if not successful because for\n\t\texample a sound already existed with that name. If not successful, the reason will be printed\n\t\tinto the log. */\n\t\tvirtual ISoundSource* addSoundSourceFromPCMData(void* memory, ik_s32 sizeInBytes, \n\t\t\t const ik_c8* soundName, SAudioStreamFormat format,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbool copyMemory=true) = 0;\n\n\t\t//! Adds a sound source as alias for an existing sound source, but with a different name or optional different default settings.\n\t\t/** This is useful if you want to play multiple sounds but each sound isn't necessarily one single file.\n\t\tAlso useful if you want to or play the same sound using different names, volumes or min and max 3D distances.\n\t\t\\param baseSource The sound source where this sound source should be based on. This sound\n\t\tsource will use the baseSource as base to access the file and similar, but it will have its\n\t\town name and its own default settings.\n\t\t\\param soundName Name of the new sound source to be added.\n\t\t\\return Returns the pointer to the added sound source or 0 if not successful because for\n\t\texample a sound already existed with that name. If not successful, the reason will be printed\n\t\tinto the log.*/\n\t\tvirtual ISoundSource* addSoundSourceAlias(ISoundSource* baseSource, const ik_c8* soundName) = 0;\n\n\t\t//! Removes a sound source from the engine, freeing the memory it occupies.\n\t\t/** This will also cause all currently playing sounds of this source to be stopped. \n\t\tAlso note that if the source has been removed successfully, the value returned \n\t\tby getSoundSourceCount() will have been decreased by one. \n\t\tRemoving sound sources is only necessary if you know you won't use a lot of non-streamed\n\t\tsounds again. Sound sources of streamed sounds do not cost a lot of memory.*/\n\t\tvirtual void removeSoundSource(ISoundSource* source) = 0;\n\n\t\t//! Removes a sound source from the engine, freeing the memory it occupies.\n\t\t/** This will also cause all currently playing sounds of this source to be stopped. \n\t\tAlso note that if the source has been removed successfully, the value returned \n\t\tby getSoundSourceCount() will have been decreased by one. \n\t\tRemoving sound sources is only necessary if you know you won't use a lot of non-streamed\n\t\tsounds again. Sound sources of streamed sounds do not cost a lot of memory. */\n\t\tvirtual void removeSoundSource(const ik_c8* name) = 0;\n\n\t\t//! Removes all sound sources from the engine\n\t\t/** This will also cause all sounds to be stopped. \n\t\tRemoving sound sources is only necessary if you know you won't use a lot of non-streamed\n\t\tsounds again. Sound sources of streamed sounds do not cost a lot of memory. */\n\t\tvirtual void removeAllSoundSources() = 0;\n\n\t\t//! Sets master sound volume. This value is multiplied with all sounds played.\n\t\t/** \\param volume 0 (silent) to 1.0f (full volume) */\n\t\tvirtual void setSoundVolume(ik_f32 volume) = 0;\n\n\t\t//! Returns master sound volume.\n\t\t/* A value between 0.0 and 1.0. Default is 1.0. Can be changed using setSoundVolume(). */\n\t\tvirtual ik_f32 getSoundVolume() = 0;\n\n\t\t//! Sets the current listener 3d position.\n\t\t/** When playing sounds in 3D, updating the position of the listener every frame should be\n\t\tdone using this function.\n\t\t\\param pos Position of the camera or listener.\n\t\t\\param lookdir Direction vector where the camera or listener is looking into. If you have a \n\t\tcamera position and a target 3d point where it is looking at, this would be cam->getTarget() - cam->getAbsolutePosition().\n\t\t\\param velPerSecond The velocity per second describes the speed of the listener and \n\t\tis only needed for doppler effects.\n\t\t\\param upvector Vector pointing 'up', so the engine can decide where is left and right. \n\t\tThis vector is usually (0,1,0).*/\n\t\tvirtual void setListenerPosition(const vec3df& pos,\n\t\t\tconst vec3df& lookdir,\n\t\t\tconst vec3df& velPerSecond = vec3df(0,0,0),\n\t\t\tconst vec3df& upVector = vec3df(0,1,0)) = 0;\n\n\t\t//! Updates the audio engine. This should be called several times per frame if irrKlang was started in single thread mode.\n\t\t/** This updates the 3d positions of the sounds as well as their volumes, effects,\n\t\tstreams and other stuff. Call this several times per frame (the more the better) if you\n\t\tspecified irrKlang to run single threaded. Otherwise it is not necessary to use this method.\n\t\tThis method is being called by the scene manager automatically if you are using one, so\n\t\tyou might want to ignore this. */\n\t\tvirtual void update() = 0;\n\n\t\t//! Returns if a sound with the specified name is currently playing.\n\t\tvirtual bool isCurrentlyPlaying(const char* soundName) = 0;\n\n\t\t//! Returns if a sound with the specified source is currently playing.\n\t\tvirtual bool isCurrentlyPlaying(ISoundSource* source) = 0;\n\n\t\t//! Stops all sounds of a specific sound source\n\t\tvirtual void stopAllSoundsOfSoundSource(ISoundSource* source) = 0;\n\n\t\t//! Registers a new audio stream loader in the sound engine.\n\t\t/** Use this to enhance the audio engine to support other or new file formats.\n\t\tTo do this, implement your own IAudioStreamLoader interface and register it\n\t\twith this method */\n\t\tvirtual void registerAudioStreamLoader(IAudioStreamLoader* loader) = 0;\n\n\t\t//! Returns if irrKlang is running in the same thread as the application or is using multithreading.\n\t\t/** This basically returns the flag set by the user when creating the sound engine.*/\n\t\tvirtual bool isMultiThreaded() const = 0;\n\n\t\t//! Adds a file factory to the sound engine, making it possible to override file access of the sound engine.\n\t\t/** Derive your own class from IFileFactory, overwrite the createFileReader()\n\t\tmethod and return your own implemented IFileReader to overwrite file access of irrKlang. */\n\t\tvirtual void addFileFactory(IFileFactory* fileFactory) = 0;\n\n\t\t//! Sets the default minimal distance for 3D sounds.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tSee ISound::setMinDistance() for details about what the min distance is.\n\t\tIt is also possible to influence this default value for every sound file \n\t\tusing ISoundSource::setDefaultMinDistance().\n\t\tThis method only influences the initial distance value of sounds. For changing the\n\t\tdistance after the sound has been started to play, use ISound::setMinDistance() and ISound::setMaxDistance().\n\t\t\\param minDistance Default minimal distance for 3d sounds. The default value is 1.0f.*/\n\t\tvirtual void setDefault3DSoundMinDistance(ik_f32 minDistance) = 0;\n\n\t\t//! Returns the default minimal distance for 3D sounds.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tYou can change it using setDefault3DSoundMinDistance().\n\t\tSee ISound::setMinDistance() for details about what the min distance is.\n\t\tIt is also possible to influence this default value for every sound file \n\t\tusing ISoundSource::setDefaultMinDistance().\n\t\t\\return Default minimal distance for 3d sounds. The default value is 1.0f. */\n\t\tvirtual ik_f32 getDefault3DSoundMinDistance() = 0;\n\n\t\t//! Sets the default maximal distance for 3D sounds.\n\t\t/** Changing this value is usually not necessary. Use setDefault3DSoundMinDistance() instead.\n\t\tDon't change this value if you don't know what you are doing: This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setDefault3DSoundMinDistance()) to influence this.\n\t\tSee ISound::setMaxDistance() for details about what the max distance is.\n\t\tIt is also possible to influence this default value for every sound file \n\t\tusing ISoundSource::setDefaultMaxDistance().\n\t\tThis method only influences the initial distance value of sounds. For changing the\n\t\tdistance after the sound has been started to play, use ISound::setMinDistance() and ISound::setMaxDistance().\n\t\t\\param maxDistance Default maximal distance for 3d sounds. The default value is 1000000000.0f. */\n\t\tvirtual void setDefault3DSoundMaxDistance(ik_f32 maxDistance) = 0;\n\n\t\t//! Returns the default maximal distance for 3D sounds.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tYou can change it using setDefault3DSoundmaxDistance(), but \n\t\tchanging this value is usually not necessary. This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setDefault3DSoundMinDistance()) to influence this.\n\t\tSee ISound::setMaxDistance() for details about what the max distance is.\n\t\tIt is also possible to influence this default value for every sound file \n\t\tusing ISoundSource::setDefaultMaxDistance().\n\t\t\\return Default maximal distance for 3d sounds. The default value is 1000000000.0f. */\n\t\tvirtual ik_f32 getDefault3DSoundMaxDistance() = 0;\n\n\t\t//! Sets a rolloff factor which influences the amount of attenuation that is applied to 3D sounds.\n\t\t/** The rolloff factor can range from 0.0 to 10.0, where 0 is no rolloff. 1.0 is the default \n\t\trolloff factor set, the value which we also experience in the real world. A value of 2 would mean\n\t\ttwice the real-world rolloff. */\n\t\tvirtual void setRolloffFactor(ik_f32 rolloff) = 0;\n\n\t\t//! Sets parameters affecting the doppler effect.\n\t\t/** \\param dopplerFactor is a value between 0 and 10 which multiplies the doppler \n\t\teffect. Default value is 1.0, which is the real world doppler effect, and 10.0f \n\t\twould be ten times the real world doppler effect.\n\t\t\\param distanceFactor is the number of meters in a vector unit. The default value\n\t\tis 1.0. Doppler effects are calculated in meters per second, with this parameter,\n\t\tthis can be changed, all velocities and positions are influenced by this. If\n\t\tthe measurement should be in foot instead of meters, set this value to 0.3048f\n\t\tfor example.*/\n\t\tvirtual void setDopplerEffectParameters(ik_f32 dopplerFactor=1.0f, ik_f32 distanceFactor=1.0f) = 0;\n\n\t\t//! Loads irrKlang plugins from a custom path.\n\t\t/** Plugins usually are .dll, .so or .dylib\n\t\tfiles named for example ikpMP3.dll (= short for irrKlangPluginMP3) which\n\t\tmake it possible to play back mp3 files. Plugins are being \n\t\tloaded from the current working directory at startup of the sound engine\n\t\tif the parameter ESEO_LOAD_PLUGINS is set (which it is by default), but\n\t\tusing this method, it is possible to load plugins from a custom path in addition. \n\t\t\\param path Path to the plugin directory, like \"C:\\games\\somegamegame\\irrklangplugins\".\n\t\t\\return returns true if successful or false if not, for example because the path could \n\t\tnot be found. */\n\t\tvirtual bool loadPlugins(const ik_c8* path) = 0;\n\n\t\t//! Returns a pointer to internal sound engine pointers, like the DirectSound interface.\n\t\t/** Use this with caution. This is only exposed to make it possible for other libraries\n\t\tsuch as Video playback packages to extend or use the sound driver irrklang uses. */\n\t\tvirtual const SInternalAudioInterface& getInternalAudioInterface() = 0;\t\t\n\n\t\t//! Sets the OutputMixedDataReceiver, so you can receive the pure mixed output audio data while it is being played.\n\t\t/** This can be used to store the sound output as .wav file or for creating a Oscillograph or similar.\n\t\tThis works only with software based audio drivers, that is ESOD_WIN_MM, ESOD_ALSA, and ESOD_CORE_AUDIO. \n\t\tReturns true if successful and false if the current audio driver doesn't support this feature. Set this to null\n\t\tagain once you don't need it anymore. */\n\t\tvirtual bool setMixedDataOutputReceiver(ISoundMixedOutputReceiver* receiver) = 0;\n\t};\n\n\n\t//! structure for returning pointers to the internal audio interface. \n\t/** Use ISoundEngine::getInternalAudioInterface() to get this. */\n\tstruct SInternalAudioInterface\n\t{\n\t\t//! IDirectSound interface, this is not null when using the ESOD_DIRECT_SOUND audio driver\n\t\tvoid* pIDirectSound;\n\n\t\t//! IDirectSound8 interface, this is not null when using the ESOD_DIRECT_SOUND8 audio driver\n\t\tvoid* pIDirectSound8;\n\n\t\t//! HWaveout interface, this is not null when using the ESOD_WIN_MM audio driver\n\t\tvoid* pWinMM_HWaveOut;\n\n\t\t//! ALSA PCM Handle interface, this is not null when using the ESOD_ALSA audio driver\n\t\tvoid* pALSA_SND_PCM;\n\n\t\t//! AudioDeviceID handle, this is not null when using the ESOD_CORE_AUDIO audio driver\n\t\tik_u32 pCoreAudioDeviceID;\n\t};\n\n\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_ISoundMixedOutputReceiver.h", "language": "code", "loc": 32, "comment_density": 0.594, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_MIXED_OUTPUT_RECEIVER_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_MIXED_OUTPUT_RECEIVER_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_SAudioStreamFormat.h\"\n\n\nnamespace irrklang\n{\n\n\n//! Interface to be implemented by the user, which receives the mixed output when it it played by the sound engine.\n/** This can be used to store the sound output as .wav file or for creating a Oscillograph or similar. \n Simply implement your own class derived from ISoundMixedOutputReceiver and use ISoundEngine::setMixedDataOutputReceiver\n to let the audio driver know about it. */\nclass ISoundMixedOutputReceiver\n{\npublic:\n \n\t//! destructor\n\tvirtual ~ISoundMixedOutputReceiver() {};\n\n\t//! Called when a chunk of sound has been mixed and is about to be played. \n\t/** Note: This is called from the playing thread of the sound library, so you need to \n\tmake everything you are doing in this method thread safe. Additionally, it would\n\tbe a good idea to do nothing complicated in your implementation and return as fast as possible,\n\totherwise sound output may be stuttering.\n\t\\param data representing the sound frames which just have been mixed. Sound data always\n\tconsists of two interleaved sound channels at 16bit per frame. \n\t \\param byteCount Amount of bytes of the data \n\t \\param playbackrate The playback rate at samples per second (usually something like 44000). \n\t This value will not change and always be the same for an instance of an ISoundEngine. */\n\tvirtual void OnAudioDataReady(const void* data, int byteCount, int playbackrate) = 0;\n\n};\n\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_ISoundSource.h", "language": "code", "loc": 143, "comment_density": 0.797, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_IRR_SOUND_SOURCE_H_INCLUDED__\n#define __I_IRRKLANG_IRR_SOUND_SOURCE_H_INCLUDED__\n\n#include \"ik_IVirtualRefCounted.h\"\n#include \"ik_vec3d.h\"\n#include \"ik_EStreamModes.h\"\n#include \"ik_SAudioStreamFormat.h\"\n\n\nnamespace irrklang\n{\n\n\t//! A sound source describes an input file (.ogg, .mp3, .wav or similar) and its default settings.\n\t/** It provides some informations about the sound source like the play length and\n\tcan have default settings for volume, distances for 3d etc. There is some example code on how\n\tto use Sound sources at @ref soundSources.*/\n\tclass ISoundSource : public IVirtualRefCounted\n\t{\n\tpublic:\n\n\t\t//! Returns the name of the sound source (usually, this is the file name)\n\t\tvirtual const ik_c8* getName() = 0;\n\n\t\t//! Sets the stream mode which should be used for a sound played from this source.\n\t\t/** Note that if this is set to ESM_NO_STREAMING, the engine still might decide\n\t\tto stream the sound if it is too big. The threshold for this can be \n\t\tadjusted using ISoundSource::setForcedStreamingThreshold(). */\n\t\tvirtual void setStreamMode(E_STREAM_MODE mode) = 0;\n\n\t\t//! Returns the detected or set type of the sound with wich the sound will be played.\n\t\t/** Note: If the returned type is ESM_AUTO_DETECT, this mode will change after the\n\t\tsound has been played the first time. */\n\t\tvirtual E_STREAM_MODE getStreamMode() = 0;\n\n\t\t//! Returns the play length of the sound in milliseconds.\n\t\t/** Returns -1 if not known for this sound for example because its decoder\n\t\tdoes not support length reporting or it is a file stream of unknown size.\n\t\tNote: If the sound never has been played before, the sound engine will have to open\n\t\tthe file and try to get the play length from there, so this call could take a bit depending\n\t\ton the type of file. */\n\t\tvirtual ik_u32 getPlayLength() = 0;\n\n\t\t//! Returns informations about the sound source: channel count (mono/stereo), frame count, sample rate, etc.\n\t\t/** \\return Returns the structure filled with 0 or negative values if not known for this sound for example because \n\t\tbecause the file could not be opened or similar.\n\t\tNote: If the sound never has been played before, the sound engine will have to open\n\t\tthe file and try to get the play length from there, so this call could take a bit depending\n\t\ton the type of file. */\n\t\tvirtual SAudioStreamFormat getAudioFormat() = 0;\n\n\t\t//! Returns if sounds played from this source will support seeking via ISound::setPlayPosition().\n\t\t/* If a sound is seekable depends on the file type and the audio format. For example MOD files\n\t\tcannot be seeked currently.\n\t\t\\return Returns true of the sound source supports setPlayPosition() and false if not. \n\t\tNote: If the sound never has been played before, the sound engine will have to open\n\t\tthe file and try to get the information from there, so this call could take a bit depending\n\t\ton the type of file. */\n\t\tvirtual bool getIsSeekingSupported() = 0;\n\n\t\t//! Sets the default volume for a sound played from this source.\n\t\t/** The default value of this is 1.0f. \n\t\tNote that the default volume is being multiplied with the master volume\n\t\tof ISoundEngine, change this via ISoundEngine::setSoundVolume(). \n\t\t//! \\param volume 0 (silent) to 1.0f (full volume). Default value is 1.0f. */\n\t\tvirtual void setDefaultVolume(ik_f32 volume=1.0f) = 0;\n\n\t\t//! Returns the default volume for a sound played from this source.\n\t\t/** You can influence this default volume value using setDefaultVolume().\n\t\tNote that the default volume is being multiplied with the master volume\n\t\tof ISoundEngine, change this via ISoundEngine::setSoundVolume(). \n\t\t//! \\return 0 (silent) to 1.0f (full volume). Default value is 1.0f. */\n\t\tvirtual ik_f32 getDefaultVolume() = 0;\n\n\t\t//! sets the default minimal distance for 3D sounds played from this source.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tSee ISound::setMinDistance() for details about what the min distance is.\n\t\tThis method only influences the initial distance value of sounds. For changing the\n\t\tdistance while the sound is playing, use ISound::setMinDistance() and ISound::setMaxDistance().\n\t\t\\param minDistance: Default minimal distance for 3D sounds from this source. Set it to a negative\n\t\tvalue to let sounds of this source use the engine level default min distance, which\n\t\tcan be set via ISoundEngine::setDefault3DSoundMinDistance(). Default value is -1, causing\n\t\tthe default min distance of the sound engine to take effect. */\n\t\tvirtual void setDefaultMinDistance(ik_f32 minDistance) = 0;\n\n\t\t//! Returns the default minimal distance for 3D sounds played from this source.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tSee ISound::setMinDistance() for details about what the minimal distance is.\n\t\t\\return Default minimal distance for 3d sounds from this source. If setDefaultMinDistance()\n\t\twas set to a negative value, it will return the default value set in the engine,\n\t\tusing ISoundEngine::setDefault3DSoundMinDistance(). Default value is -1, causing\n\t\tthe default min distance of the sound engine to take effect. */\n\t\tvirtual ik_f32 getDefaultMinDistance() = 0;\n\n\t\t//! Sets the default maximal distance for 3D sounds played from this source.\n\t\t/** Changing this value is usually not necessary. Use setDefaultMinDistance() instead.\n\t\tDon't change this value if you don't know what you are doing: This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setDefaultMinDistance()) to influence this.\n\t\tSee ISound::setMaxDistance() for details about what the max distance is.\n\t\tThis method only influences the initial distance value of sounds. For changing the\n\t\tdistance while the sound is played, use ISound::setMinDistance() \n\t\tand ISound::setMaxDistance().\n\t\t\\param maxDistance Default maximal distance for 3D sounds from this source. Set it to a negative\n\t\tvalue to let sounds of this source use the engine level default max distance, which\n\t\tcan be set via ISoundEngine::setDefault3DSoundMaxDistance(). Default value is -1, causing\n\t\tthe default max distance of the sound engine to take effect. */\n\t\tvirtual void setDefaultMaxDistance(ik_f32 maxDistance) = 0;\n\n\t\t//! returns the default maximal distance for 3D sounds played from this source.\n\t\t/** This value influences how loud a sound is heard based on its distance.\n\t\tChanging this value is usually not necessary. Use setDefaultMinDistance() instead.\n\t\tDon't change this value if you don't know what you are doing: This value causes the sound\n\t\tto stop attenuating after it reaches the max distance. Most people think that this sets the\n\t\tvolume of the sound to 0 after this distance, but this is not true. Only change the\n\t\tminimal distance (using for example setDefaultMinDistance()) to influence this.\n\t\tSee ISound::setMaxDistance() for details about what the max distance is.\n\t\t\\return Default maximal distance for 3D sounds from this source. If setDefaultMaxDistance()\n\t\twas set to a negative value, it will return the default value set in the engine,\n\t\tusing ISoundEngine::setDefault3DSoundMaxDistance(). Default value is -1, causing\n\t\tthe default max distance of the sound engine to take effect. */\n\t\tvirtual ik_f32 getDefaultMaxDistance() = 0;\n\n\t\t//! Forces the sound to be reloaded at next replay.\n\t\t/** Sounds which are not played as streams are buffered to make it possible to\n\t\treplay them without much overhead. If the sound file is altered after the sound\n\t\thas been played the first time, the engine won't play the changed file then.\n\t\tCalling this method makes the engine reload the file before the file is played\n\t\tthe next time.*/\n\t\tvirtual void forceReloadAtNextUse() = 0;\n\n\t\t//! Sets the threshold size where irrKlang decides to force streaming a file independent of the user specified setting.\n\t\t/** When specifying ESM_NO_STREAMING for playing back a sound file, irrKlang will\n\t\tignore this setting if the file is bigger than this threshold and stream the file\n\t\tanyway. Please note that if an audio format loader is not able to return the \n\t\tsize of a sound source and returns -1 as length, this will be ignored as well \n\t\tand streaming has to be forced.\n\t\t\\param threshold: New threshold. The value is specified in uncompressed bytes and its default value is \n\t\tabout one Megabyte. Set to 0 or a negative value to disable stream forcing. */\n\t\tvirtual void setForcedStreamingThreshold(ik_s32 thresholdBytes) = 0;\n\n\t\t//! Returns the threshold size where irrKlang decides to force streaming a file independent of the user specified setting.\n\t\t/** The value is specified in uncompressed bytes and its default value is \n\t\tabout one Megabyte. See setForcedStreamingThreshold() for details. */\n\t\tvirtual ik_s32 getForcedStreamingThreshold() = 0;\n\n\t\t//! Returns a pointer to the loaded and decoded sample data.\n\t\t/** \\return Returns a pointer to the sample data. The data is provided in decoded PCM data. The\n\t\texact format can be retrieved using getAudioFormat(). Use getAudioFormat().getSampleDataSize()\n\t\tfor getting the amount of bytes. The returned pointer will only be valid as long as the sound\n\t\tsource exists.\n\t\tThis function will only return a pointer to the data if the \n\t\taudio file is not streamed, namely ESM_NO_STREAMING. Otherwise this function will return 0.\n\t\tNote: If the sound never has been played before, the sound engine will have to open\n\t\tthe file and decode audio data from there, so this call could take a bit depending\n\t\ton the type of the file.*/\n\t\tvirtual void* getSampleData() = 0;\n\t};\n\n} // end namespace irrklang\n\n\n#endif\n"}, {"path": "includes/irrKlang/ik_ISoundStopEventReceiver.h", "language": "code", "loc": 53, "comment_density": 0.623, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_SOUND_STOP_EVENT_RECEIVER_H_INCLUDED__\n#define __I_IRRKLANG_SOUND_STOP_EVENT_RECEIVER_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_SAudioStreamFormat.h\"\n\n\nnamespace irrklang\n{\n\n\n//! An enumeration listing all reasons for a fired sound stop event\nenum E_STOP_EVENT_CAUSE\n{\n\t//! The sound stop event was fired because the sound finished playing\n\tESEC_SOUND_FINISHED_PLAYING = 0,\n\n\t//! The sound stop event was fired because the sound was stopped by the user, calling ISound::stop().\n\tESEC_SOUND_STOPPED_BY_USER,\n\n\t//! The sound stop event was fired because the source of the sound was removed, for example\n\t//! because irrKlang was shut down or the user called ISoundEngine::removeSoundSource().\n\tESEC_SOUND_STOPPED_BY_SOURCE_REMOVAL,\n\n\t//! This enumeration literal is never used, it only forces the compiler to \n\t//! compile these enumeration values to 32 bit.\n\tESEC_FORCE_32_BIT = 0x7fffffff\n};\n\n\n//! Interface to be implemented by the user, which receives sound stop events.\n/** The interface has only one method to be implemented by the user: OnSoundStopped().\nImplement this interface and set it via ISound::setSoundStopEventReceiver().\nThe sound stop event is guaranteed to be called when a sound or sound stream is finished,\neither because the sound reached its playback end, its sound source was removed,\nISoundEngine::stopAllSounds() has been called or the whole engine was deleted. */\nclass ISoundStopEventReceiver\n{\npublic:\n \n\t//! destructor\n\tvirtual ~ISoundStopEventReceiver() {};\n\n\t//! Called when a sound has stopped playing. \n\t/** This is the only method to be implemented by the user.\n\tThe sound stop event is guaranteed to be called when a sound or sound stream is finished,\n\teither because the sound reached its playback end, its sound source was removed,\n\tISoundEngine::stopAllSounds() has been called or the whole engine was deleted.\n\tPlease note: Sound events will occur in a different thread when the engine runs in\n\tmulti threaded mode (default). In single threaded mode, the event will happen while\n\tthe user thread is calling ISoundEngine::update().\n\t\\param sound: Sound which has been stopped. \n\t\\param reason: The reason why the sound stop event was fired. Usually, this will be ESEC_SOUND_FINISHED_PLAYING.\n\tWhen the sound was aborted by calling ISound::stop() or ISoundEngine::stopAllSounds();, this would be \n\tESEC_SOUND_STOPPED_BY_USER. If irrKlang was deleted or the sound source was removed, the value is \n\tESEC_SOUND_STOPPED_BY_SOURCE_REMOVAL.\n\t\\param userData: userData pointer set by the user when registering the interface\n\tvia ISound::setSoundStopEventReceiver(). */\n\tvirtual void OnSoundStopped(ISound* sound, E_STOP_EVENT_CAUSE reason, void* userData) = 0;\n\n};\n\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_IVirtualRefCounted.h", "language": "code", "loc": 33, "comment_density": 0.545, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __I_IRRKLANG_VIRTUAL_UNKNOWN_H_INCLUDED__\n#define __I_IRRKLANG_VIRTUAL_UNKNOWN_H_INCLUDED__\n\n#include \"ik_irrKlangTypes.h\"\n\n\nnamespace irrklang\n{\n\n\t//! Reference counting base class for objects in the Irrlicht Engine similar to IRefCounted.\n\t/** See IRefCounted for the basics of this class.\n\tThe difference to IRefCounted is that the class has to implement reference counting\n\tfor itself. \n\t*/\n\tclass IVirtualRefCounted\n\t{\n\tpublic:\n\n\t\t//! Destructor.\n\t\tvirtual ~IVirtualRefCounted()\n\t\t{\n\t\t}\n\n\t\t//! Grabs the object. Increments the reference counter by one.\n\t\t/** To be implemented by the derived class. If you don't want to\n\t\timplement this, use the class IRefCounted instead. See IRefCounted::grab() for details\n\t\tof this method. */\n\t\tvirtual void grab() = 0;\n\n\t\t//! Drops the object. Decrements the reference counter by one.\n\t\t/** To be implemented by the derived class. If you don't want to\n\t\timplement this, use the class IRefCounted instead. See IRefCounted::grab() for details\n\t\tof this method. */\n\t\tvirtual bool drop() = 0;\n\t};\n\n\n\n} // end namespace irrklang\n\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_SAudioStreamFormat.h", "language": "code", "loc": 52, "comment_density": 0.346, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __S_IRRKLANG_AUDIO_STREAM_FORMAT_H_INCLUDED__\n#define __S_IRRKLANG_AUDIO_STREAM_FORMAT_H_INCLUDED__\n\n#include \"ik_IRefCounted.h\"\n\n\nnamespace irrklang\n{\n\n\t//! audio sample data format enumeration for supported formats\n\tenum ESampleFormat\n\t{\n\t\t//! one unsigned byte (0;255)\n\t\tESF_U8, \n\n\t\t//! 16 bit, signed (-32k;32k)\n\t\tESF_S16 \n\t};\n\n\n\t//! structure describing an audio stream format with helper functions\n\tstruct SAudioStreamFormat\n\t{\n\t\t//! channels, 1 for mono, 2 for stereo\n\t\tik_s32 ChannelCount; \n\n\t\t//! amount of frames in the sample data or stream. \n\t\t/** If the stream has an unknown length, this is -1 */\n\t\tik_s32 FrameCount;\t\t\n\n\t\t//! samples per second\n\t\tik_s32 SampleRate;\n\t\t\n\t\t//! format of the sample data\n\t\tESampleFormat SampleFormat;\n\n\t\t//! returns the size of a sample of the data described by the stream data in bytes\n\t\tinline ik_s32 getSampleSize() const\n\t\t{\n\t\t\treturn (SampleFormat == ESF_U8) ? 1 : 2;\n\t\t}\n\n\t\t//! returns the frame size of the stream data in bytes\n\t\tinline ik_s32 getFrameSize() const\n\t\t{\n\t\t\treturn ChannelCount * getSampleSize();\n\t\t}\n\n\t\t//! returns the size of the sample data in bytes\n\t\t/* Returns an invalid negative value when the stream has an unknown length */\n\t\tinline ik_s32 getSampleDataSize() const\n\t\t{\n\t\t\treturn getFrameSize() * FrameCount;\n\t\t}\n\n\t\t//! returns amount of bytes per second\n\t\tinline ik_s32 getBytesPerSecond() const\n\t\t{\n\t\t\treturn getFrameSize() * SampleRate;\n\t\t}\n\t};\n\n\n} // end namespace irrklang\n\n#endif\n\n"}, {"path": "includes/irrKlang/ik_irrKlangTypes.h", "language": "code", "loc": 67, "comment_density": 0.582, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __IRRKLANG_TYPES_H_INCLUDED__\n#define __IRRKLANG_TYPES_H_INCLUDED__\n\n\nnamespace irrklang\n{\n\n\t//! 8 bit unsigned variable.\n\t/** This is a typedef for unsigned char, it ensures portability of the engine. */\n\ttypedef unsigned char ik_u8;\n\n\t//! 8 bit signed variable.\n\t/** This is a typedef for signed char, it ensures portability of the engine. */\n\ttypedef signed char\tik_s8;\n\n\t//! 8 bit character variable.\n\t/** This is a typedef for char, it ensures portability of the engine. */\n\ttypedef char ik_c8;\n\n\n\n\t//! 16 bit unsigned variable.\n\t/** This is a typedef for unsigned short, it ensures portability of the engine. */\n\ttypedef unsigned short ik_u16;\n\n\t//! 16 bit signed variable.\n\t/** This is a typedef for signed short, it ensures portability of the engine. */\n\ttypedef signed short ik_s16;\n\n\n\n\t//! 32 bit unsigned variable.\n\t/** This is a typedef for unsigned int, it ensures portability of the engine. */\n\ttypedef unsigned int ik_u32;\n\n\t//! 32 bit signed variable.\n\t/** This is a typedef for signed int, it ensures portability of the engine. */\n\ttypedef signed int ik_s32;\n\n\n\n\t//! 32 bit floating point variable.\n\t/** This is a typedef for float, it ensures portability of the engine. */\n\ttypedef float ik_f32;\n\n\t//! 64 bit floating point variable.\n\t/** This is a typedef for double, it ensures portability of the engine. */\n\ttypedef double ik_f64;\n\n\n\n // some constants\n\n\tconst ik_f32 IK_ROUNDING_ERROR_32\t= 0.000001f;\n\tconst ik_f64 IK_PI64\t\t\t = 3.1415926535897932384626433832795028841971693993751;\n\tconst ik_f32 IK_PI32\t\t\t = 3.14159265359f;\n\tconst ik_f32 IK_RADTODEG = 180.0f / IK_PI32;\n\tconst ik_f32 IK_DEGTORAD = IK_PI32 / 180.0f;\n\tconst ik_f64 IK_RADTODEG64 = 180.0 / IK_PI64;\n\tconst ik_f64 IK_DEGTORAD64 = IK_PI64 / 180.0;\n\n\t//! returns if a float equals the other one, taking floating\n\t//! point rounding errors into account\n\tinline bool equalsfloat(const ik_f32 a, const ik_f32 b, const ik_f32 tolerance = IK_ROUNDING_ERROR_32)\n\t{\n\t\treturn (a + tolerance > b) && (a - tolerance < b);\n\t}\n\n} // end irrklang namespace\n\n// ensure wchar_t type is existing for unicode support\n#include \n\n// define the wchar_t type if not already built in.\n#ifdef _MSC_VER // microsoft compiler\n\t#ifndef _WCHAR_T_DEFINED\n\t\t//! A 16 bit wide character type.\n\t\t/**\n\t\t\tDefines the wchar_t-type.\n\t\t\tIn VS6, its not possible to tell\n\t\t\tthe standard compiler to treat wchar_t as a built-in type, and\n\t\t\tsometimes we just don't want to include the huge stdlib.h or wchar.h,\n\t\t\tso we'll use this.\n\t\t*/\n\t\ttypedef unsigned short wchar_t;\n\t\t#define _WCHAR_T_DEFINED\n\t#endif // wchar is not defined\n#endif // microsoft compiler\n\n\n#endif // __IRR_TYPES_H_INCLUDED__\n\n"}, {"path": "includes/irrKlang/ik_vec3d.h", "language": "code", "loc": 208, "comment_density": 0.24, "code": "// Copyright (C) 2002-2018 Nikolaus Gebhardt\n// This file is part of the \"irrKlang\" library.\n// For conditions of distribution and use, see copyright notice in irrKlang.h\n\n#ifndef __IRR_IRRKLANG_VEC_3D_H_INCLUDED__\n#define __IRR_IRRKLANG_VEC_3D_H_INCLUDED__\n\n#include \n#include \"ik_irrKlangTypes.h\"\n\n\nnamespace irrklang\n{\n\n\t//! a 3d vector template class for representing vectors and points in 3d\n\ttemplate \n\tclass vec3d\n\t{\n\tpublic:\n\n\t\tvec3d(): X(0), Y(0), Z(0) {};\n\t\tvec3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {};\n\t\tvec3d(const vec3d& other)\t:X(other.X), Y(other.Y), Z(other.Z) {};\n\n\t\t//! constructor creating an irrklang vec3d from an irrlicht vector.\n\t\t#ifdef __IRR_POINT_3D_H_INCLUDED__\n\t\ttemplate\n\t\tvec3d(const B& other)\t:X(other.X), Y(other.Y), Z(other.Z) {};\n\t\t#endif // __IRR_POINT_3D_H_INCLUDED__\n\n\t\t// operators\n\n\t\tvec3d operator-() const { return vec3d(-X, -Y, -Z); }\n\n\t\tvec3d& operator=(const vec3d& other)\t{ X = other.X; Y = other.Y; Z = other.Z; return *this; }\n\n\t\tvec3d operator+(const vec3d& other) const { return vec3d(X + other.X, Y + other.Y, Z + other.Z);\t}\n\t\tvec3d& operator+=(const vec3d& other)\t{ X+=other.X; Y+=other.Y; Z+=other.Z; return *this; }\n\n\t\tvec3d operator-(const vec3d& other) const { return vec3d(X - other.X, Y - other.Y, Z - other.Z);\t}\n\t\tvec3d& operator-=(const vec3d& other)\t{ X-=other.X; Y-=other.Y; Z-=other.Z; return *this; }\n\n\t\tvec3d operator*(const vec3d& other) const { return vec3d(X * other.X, Y * other.Y, Z * other.Z);\t}\n\t\tvec3d& operator*=(const vec3d& other)\t{ X*=other.X; Y*=other.Y; Z*=other.Z; return *this; }\n\t\tvec3d operator*(const T v) const { return vec3d(X * v, Y * v, Z * v);\t}\n\t\tvec3d& operator*=(const T v) { X*=v; Y*=v; Z*=v; return *this; }\n\n\t\tvec3d operator/(const vec3d& other) const { return vec3d(X / other.X, Y / other.Y, Z / other.Z);\t}\n\t\tvec3d& operator/=(const vec3d& other)\t{ X/=other.X; Y/=other.Y; Z/=other.Z; return *this; }\n\t\tvec3d operator/(const T v) const { T i=(T)1.0/v; return vec3d(X * i, Y * i, Z * i);\t}\n\t\tvec3d& operator/=(const T v) { T i=(T)1.0/v; X*=i; Y*=i; Z*=i; return *this; }\n\n\t\tbool operator<=(const vec3d&other) const { return X<=other.X && Y<=other.Y && Z<=other.Z;};\n\t\tbool operator>=(const vec3d&other) const { return X>=other.X && Y>=other.Y && Z>=other.Z;};\n\n\t\tbool operator==(const vec3d& other) const { return other.X==X && other.Y==Y && other.Z==Z; }\n\t\tbool operator!=(const vec3d& other) const { return other.X!=X || other.Y!=Y || other.Z!=Z; }\n\n\t\t// functions\n\n\t\t//! returns if this vector equalsfloat the other one, taking floating point rounding errors into account\n\t\tbool equals(const vec3d& other)\n\t\t{\n\t\t\treturn equalsfloat(X, other.X) &&\n\t\t\t\t equalsfloat(Y, other.Y) &&\n\t\t\t\t equalsfloat(Z, other.Z);\n\t\t}\n\n\t\tvoid set(const T nx, const T ny, const T nz) {X=nx; Y=ny; Z=nz; }\n\t\tvoid set(const vec3d& p) { X=p.X; Y=p.Y; Z=p.Z;}\n\n\t\t//! Returns length of the vector.\n\t\tik_f64 getLength() const { return sqrt(X*X + Y*Y + Z*Z); }\n\n\t\t//! Returns squared length of the vector.\n\t\t/** This is useful because it is much faster then\n\t\tgetLength(). */\n\t\tik_f64 getLengthSQ() const { return X*X + Y*Y + Z*Z; }\n\n\t\t//! Returns the dot product with another vector.\n\t\tT dotProduct(const vec3d& other) const\n\t\t{\n\t\t\treturn X*other.X + Y*other.Y + Z*other.Z;\n\t\t}\n\n\t\t//! Returns distance from another point.\n\t\t/** Here, the vector is interpreted as point in 3 dimensional space. */\n\t\tik_f64 getDistanceFrom(const vec3d& other) const\n\t\t{\n\t\t\tik_f64 vx = X - other.X; ik_f64 vy = Y - other.Y; ik_f64 vz = Z - other.Z;\n\t\t\treturn sqrt(vx*vx + vy*vy + vz*vz);\n\t\t}\n\n\t\t//! Returns squared distance from another point.\n\t\t/** Here, the vector is interpreted as point in 3 dimensional space. */\n\t\tik_f32 getDistanceFromSQ(const vec3d& other) const\n\t\t{\n\t\t\tik_f32 vx = X - other.X; ik_f32 vy = Y - other.Y; ik_f32 vz = Z - other.Z;\n\t\t\treturn (vx*vx + vy*vy + vz*vz);\n\t\t}\n\n\t\t//! Calculates the cross product with another vector\n\t\tvec3d crossProduct(const vec3d& p) const\n\t\t{\n\t\t\treturn vec3d(Y * p.Z - Z * p.Y, Z * p.X - X * p.Z, X * p.Y - Y * p.X);\n\t\t}\n\n\t\t//! Returns if this vector interpreted as a point is on a line between two other points.\n\t\t/** It is assumed that the point is on the line. */\n\t\tbool isBetweenPoints(const vec3d& begin, const vec3d& end) const\n\t\t{\n\t\t\tik_f32 f = (ik_f32)(end - begin).getLengthSQ();\n\t\t\treturn (ik_f32)getDistanceFromSQ(begin) < f &&\n\t\t\t\t(ik_f32)getDistanceFromSQ(end) < f;\n\t\t}\n\n\t\t//! Normalizes the vector.\n\t\tvec3d& normalize()\n\t\t{\n\t\t\tT l = (T)getLength();\n\t\t\tif (l == 0)\n\t\t\t\treturn *this;\n\n\t\t\tl = (T)1.0 / l;\n\t\t\tX *= l;\n\t\t\tY *= l;\n\t\t\tZ *= l;\n\t\t\treturn *this;\n\t\t}\n\n\t\t//! Sets the length of the vector to a new value\n\t\tvoid setLength(T newlength)\n\t\t{\n\t\t\tnormalize();\n\t\t\t*this *= newlength;\n\t\t}\n\n\t\t//! Inverts the vector.\n\t\tvoid invert()\n\t\t{\n\t\t\tX *= -1.0f;\n\t\t\tY *= -1.0f;\n\t\t\tZ *= -1.0f;\n\t\t}\n\n\t\t//! Rotates the vector by a specified number of degrees around the Y\n\t\t//! axis and the specified center.\n\t\t//! \\param degrees: Number of degrees to rotate around the Y axis.\n\t\t//! \\param center: The center of the rotation.\n\t\tvoid rotateXZBy(ik_f64 degrees, const vec3d& center)\n\t\t{\n\t\t\tdegrees *= IK_DEGTORAD64;\n\t\t\tT cs = (T)cos(degrees);\n\t\t\tT sn = (T)sin(degrees);\n\t\t\tX -= center.X;\n\t\t\tZ -= center.Z;\n\t\t\tset(X*cs - Z*sn, Y, X*sn + Z*cs);\n\t\t\tX += center.X;\n\t\t\tZ += center.Z;\n\t\t}\n\n\t\t//! Rotates the vector by a specified number of degrees around the Z\n\t\t//! axis and the specified center.\n\t\t//! \\param degrees: Number of degrees to rotate around the Z axis.\n\t\t//! \\param center: The center of the rotation.\n\t\tvoid rotateXYBy(ik_f64 degrees, const vec3d& center)\n\t\t{\n\t\t\tdegrees *= IK_DEGTORAD64;\n\t\t\tT cs = (T)cos(degrees);\n\t\t\tT sn = (T)sin(degrees);\n\t\t\tX -= center.X;\n\t\t\tY -= center.Y;\n\t\t\tset(X*cs - Y*sn, X*sn + Y*cs, Z);\n\t\t\tX += center.X;\n\t\t\tY += center.Y;\n\t\t}\n\n\t\t//! Rotates the vector by a specified number of degrees around the X\n\t\t//! axis and the specified center.\n\t\t//! \\param degrees: Number of degrees to rotate around the X axis.\n\t\t//! \\param center: The center of the rotation.\n\t\tvoid rotateYZBy(ik_f64 degrees, const vec3d& center)\n\t\t{\n\t\t\tdegrees *= IK_DEGTORAD64;\n\t\t\tT cs = (T)cos(degrees);\n\t\t\tT sn = (T)sin(degrees);\n\t\t\tZ -= center.Z;\n\t\t\tY -= center.Y;\n\t\t\tset(X, Y*cs - Z*sn, Y*sn + Z*cs);\n\t\t\tZ += center.Z;\n\t\t\tY += center.Y;\n\t\t}\n\n\t\t//! Returns interpolated vector.\n\t\t/** \\param other: other vector to interpolate between\n\t\t\\param d: value between 0.0f and 1.0f. */\n\t\tvec3d getInterpolated(const vec3d& other, ik_f32 d) const\n\t\t{\n\t\t\tik_f32 inv = 1.0f - d;\n\t\t\treturn vec3d(other.X*inv + X*d,\n\t\t\t\t\t\t\t\tother.Y*inv + Y*d,\n\t\t\t\t\t\t\t\tother.Z*inv + Z*d);\n\t\t}\n\n\t\t//! Gets the Y and Z rotations of a vector.\n\t\t/** Thanks to Arras on the Irrlicht forums to add this method.\n\t\t \\return A vector representing the rotation in degrees of\n\t\tthis vector. The Z component of the vector will always be 0. */\n\t\tvec3d getHorizontalAngle()\n\t\t{\n\t\t\tvec3d angle;\n\n\t\t\tangle.Y = (T)atan2(X, Z);\n\t\t\tangle.Y *= (ik_f32)IK_RADTODEG;\n\n\t\t\tif (angle.Y < 0.0f) angle.Y += 360.0f;\n\t\t\tif (angle.Y >= 360.0f) angle.Y -= 360.0f;\n\n\t\t\tik_f32 z1 = (T)sqrt(X*X + Z*Z);\n\n\t\t\tangle.X = (T)atan2(z1, Y);\n\t\t\tangle.X *= (ik_f32)IK_RADTODEG;\n\t\t\tangle.X -= 90.0f;\n\n\t\t\tif (angle.X < 0.0f) angle.X += 360.0f;\n\t\t\tif (angle.X >= 360) angle.X -= 360.0f;\n\n\t\t\treturn angle;\n\t\t}\n\n\t\t//! Fills an array of 4 values with the vector data (usually floats).\n\t\t/** Useful for setting in shader constants for example. The fourth value\n\t\t will always be 0. */\n\t\tvoid getAs4Values(T* array)\n\t\t{\n\t\t\tarray[0] = X;\n\t\t\tarray[1] = Y;\n\t\t\tarray[2] = Z;\n\t\t\tarray[3] = 0;\n\t\t}\n\n\n\t\t// member variables\n\n\t\tT X, Y, Z;\n\t};\n\n\n\t//! Typedef for a ik_f32 3d vector, a vector using floats for X, Y and Z\n\ttypedef vec3d vec3df;\n\n\t//! Typedef for an integer 3d vector, a vector using ints for X, Y and Z\n\ttypedef vec3d vec3di;\n\n\ttemplate vec3d operator*(const S scalar, const vec3d& vector) { return vector*scalar; }\n\n} // end namespace irrklang\n\n\n#endif\n\n"}, {"path": "includes/irrKlang/irrKlang.h", "language": "code", "loc": 1015, "comment_density": 0.944, "code": "/* irrKlang.h -- interface of the 'irrKlang' library\n\n Copyright (C) 2002-2018 Nikolaus Gebhardt\n\n This software is provided 'as-is', without any express or implied\n warranty. In no event will the authors be held liable for any damages\n arising from the use of this software.\n*/\n\n#ifndef __IRR_KLANG_H_INCLUDED__\n#define __IRR_KLANG_H_INCLUDED__\n\n#include \"ik_irrKlangTypes.h\"\n#include \"ik_vec3d.h\"\n\n#include \"ik_IRefCounted.h\"\n#include \"ik_IVirtualRefCounted.h\"\n\n#include \"ik_ESoundOutputDrivers.h\"\n#include \"ik_ESoundEngineOptions.h\"\n#include \"ik_EStreamModes.h\"\n#include \"ik_SAudioStreamFormat.h\"\n#include \"ik_ISoundEngine.h\"\n#include \"ik_ISoundSource.h\"\n#include \"ik_ISound.h\"\n#include \"ik_IAudioStream.h\"\n#include \"ik_IAudioStreamLoader.h\"\n#include \"ik_ISoundEffectControl.h\"\n#include \"ik_ISoundStopEventReceiver.h\"\n#include \"ik_IFileFactory.h\"\n#include \"ik_IFileReader.h\"\n#include \"ik_ISoundDeviceList.h\"\n#include \"ik_IAudioRecorder.h\"\n#include \"ik_ISoundMixedOutputReceiver.h\"\n\n//! irrKlang Version\n#define IRR_KLANG_VERSION \"1.6.0\"\n\n/*! \\mainpage irrKlang 1.6.0 API documentation\n *\n *
\n\n * \\section contents Contents\n * General:
\n * @ref intro
\n * @ref features
\n * @ref links
\n * @ref tipsandtricks
\n *
\n * Programming irrKlang:
\n * @ref concept
\n * @ref playingSounds
\n * @ref changingSounds
\n * @ref soundSources
\n * @ref sound3d
\n * @ref removingSounds
\n * @ref events
\n * @ref memoryPlayback
\n * @ref effects
\n * @ref fileOverriding
\n * @ref audioDecoders
\n * @ref plugins
\n * @ref staticLib
\n * @ref enumeratingDevices
\n * @ref recordingAudio
\n * @ref unicode
\n *
\n * Short full examples:
\n * @ref quickstartexample
\n * @ref quickstartexample2
\n *
\n *
\n *\n * \\section intro Introduction\n *\n * Welcome to the irrKlang API documentation. This page should give you a short overview \n * over irrKlang, the high level audio library. \n * In this documentation files you'll find any information you'll need to develop applications with\n * irrKlang using C++. If you are looking for a tutorial on how to start, you'll\n * find some on the homepage of irrKlang at\n * http://www.ambiera.com/irrklang\n * or inside the SDK in the directory \\examples.\n *\n * The irrKlang library is intended to be an easy-to-use 3d and 2d sound engine, so\n * this documentation is an important part of it. If you have any questions or\n * suggestions, please take a look into the ambiera.com forum or just send a mail.\n *\n *
\n *
\n *\n *\n * \\section features Features of irrKlang\n *\n * irrKlang is a high level 2D and 3D \n * cross platform sound engine and audio library.\n * It has a very simply object orientated interface and was designed to be used\n * in games, scientific simulations, architectural visualizations and similar.\n * irrKlang plays several file formats such as\n *
    \n *
  • RIFF WAVE (*.wav)
  • \n *
  • Ogg Vorbis (*.ogg)
  • \n *
  • MPEG-1 Audio Layer 3 (*.mp3)
  • \n *
  • Free Lossless Audio Codec (*.flac)
  • \n *
  • Amiga Modules (*.mod)
  • \n *
  • Impulse Tracker (*.it)
  • \n *
  • Scream Tracker 3 (*.s3d)
  • \n *
  • Fast Tracker 2 (*.xm)
  • \n *
\n * It is also able to run on different operating systems and use several output drivers:\n *
    \n *
  • Windows 98, ME, NT 4, 2000, XP, Vista, Windows 7, Windows 8
  • \n *\t
      \n *
    • DirectSound
    • \n *
    • DirectSound8
    • \n *
    • WinMM
    • \n *\t
    \n *
  • Linux / *nix
  • \t\n *\t
      \n *
    • ALSA
    • \n *\t
    \n *
  • Mac OS X (x86 and PPC)
  • \n *\t
      \n *
    • CoreAudio
    • \n *\t
    \n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section links Links into the API documentation\n *\n * irrklang::ISoundEngine: The main class of irrKlang.
\n * Class list: List of all classes with descriptions.
\n * Class members: Good place to find forgotten features.
\n *
\n *
\n *
\n *\n *\n *\n * \\section tipsandtricks Tips and Tricks\n *\n * This section lists a few tips you might consider when implementing the sound part of your application\n * using irrKlang:\n *\n *
    \n *
  • If you can choose which audio file format is the primary one for your application,\n *\t\t\t\t\t use .OGG files, instead of for example .MP3 files. irrKlang uses a lot less memory\n * and CPU power when playing .OGGs.
  • \n *
  • To keep your application simple, each time you play a sound, you can use for example\n * play2D(\"filename.mp3\") and let irrKlang handle the rest. There is no need to implement\n * a preloading/caching/file management system for the audio playback. irrKlang will handle\n * all this by itself and will never load a file twice.
  • \n *
  • irrKlang is crashing in your application? This should not happen, irrKlang is pretty stable,\n * and in most cases, this is a problem in your code: In a lot of cases the reason is simply\n * a wrong call to irrklang::IRefCounted::drop(). Be sure you are doing it correctly. (If you are unsure,\n * temporarily remove all calls to irrklang::IRefCounted::drop() and see if this helps.)
  • \n *
\n *\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section concept Starting up the Engine\n *\n * irrKlang is designed so that it is very easy to achieve everything, its interface should\n * be very simple to use. The @ref quickstartexample shows how to play and mp3 file, and there\n * is another example, @ref quickstartexample2, showing some few more details.
\n * To start up the sound engine, you simply need to call createIrrKlangDevice(). To shut it down,\n * call IRefCounted::drop():\n *\n * \\code\n * #include \n *\n * // ...\n *\n * // start up the engine\n * irrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();\n *\t\n * // ...\n * \n * // after finished,\n * // close the engine again, similar as calling 'delete'\n * engine->drop(); \n * \\endcode\n *\n * The createIrrKlangDevice() function also accepts several parameters, so that you can \n * specify which sound driver should be used, if plugins should be used, if irrKlang\n * should run in multithreaded mode, and similar.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section playingSounds Playing Sounds\n *\n * Once you have irrKlang running (like in @ref concept), you can start playing sounds:\n *\n * \\code\n * engine->play2D(\"someSoundFile.wav\"); \n * \\endcode\n *\n * This works with all supported file types. You can replace \"someSoundFile.wav\" with\n * \"someSoundFile.mp3\", or \"someSoundFile.ogg\", for example.
\n * To play a sound looped, set the second parameter to 'true':\n *\n * \\code\n * engine->play2D(\"myMusic.mp3\", true); \n * \\endcode \n *\n * To stop this looping sound again, use engine->\\link irrklang::ISoundEngine::stopAllSounds stopAllSounds()\\endlink to stop all sounds, or\n * irrklang::ISound::stop() if you only want to stop that single sound. @ref changingSounds\n * shows how to get to that ISound interface.\n *
\n *
\n *
\n *
\n *\n *\n * \\section changingSounds Influencing Sounds during Playback\n * To influence parameters of the sound such as pan, volume or playback speed during runtime, \n * to get the play position or stop playback of single playing sounds,\n * you can use the irrklang::ISound interface. \n * irrklang::ISoundEngine::play2D (but also play3D) returns\n * a pointer to this interface when its third ('startPaused') or fourth ('track') parameter\n * was set to true:\n *\n * \\code\n * irrklang::ISound* snd = engine->play2D(\"myMusic.mp3\", true, false, true); \n *\n * // ...\n *\n * if (snd)\n * snd->setVolume(someNewValue);\n * \n * // ...\n * \n * if (snd)\n * {\n * snd->drop(); // don't forget to release the pointer once it is no longer needed by you\n * snd = 0;\n * }\n * \\endcode\n *\n * The irrklang::ISound interface can also be used to test if the sound has been finished, \n * set event receivers, pause and unpause sounds and similar. \n *
\n *
\n *
\n *
\n *\n *\n * \\section soundSources Using Sound Sources\n *\n * To be more flexible playing back sounds, irrKlang uses the concept of sound sources. \n * A sound source can be simply the name of a sound file, such as \"sound.wav\". It is possible\n * to add \"sound.wav\" as sound source to irrKlang, and play it using the sound source pointer:\n *\n * \\code\n * irrklang::ISoundSource* shootSound = engine->addSoundSourceFromFile(\"shoot.wav\"); \n *\n * engine->play2D(shootSound);\n *\n * // note: you don't need to drop() the shootSound if you don't use it anymore\n * \\endcode\n *\n * The advantage of using irrklang::ISoundSource is that it is possible to set \n * default values for this source, such\n * as volume or distances if it should be used as 3D sound:\n *\n * \\code\n * irrklang::ISoundSource* shootSound = engine->addSoundSourceFromFile(\"shoot.wav\"); \n *\n * shootSound->setDefaultVolume(0.5f);\n *\n * // shootSound will now be played with half its sound volume by default:\n * engine->play2D(shootSound);\n * \\endcode\n *\n * It is also possible to have multiple settings for the same sound file:\n *\n * \\code\n * irrklang::ISoundSource* shootSound = engine->addSoundSourceFromFile(\"shoot.wav\"); \n * irrklang::ISoundSource* shootSound2 = engine->addSoundSourceAlias(shootSound, \"silentShoot\"); \n *\n * shootSound2->setDefaultVolume(0.1f);\n *\n * // shootSound will now be played with 100% of its sound volume by default,\n * // shootSound2 will now be played 10% of its sound volume by default. It is \n * // also possible to play it using engine->play(\"silentShoot\"), now.\n * \\endcode\n *\n * Using addSoundSourceFromMemory(), it is also possible to play sounds back directly from memory,\n * without files.\n * Of course, it is not necessary to use sound sources. Using irrklang::ISound, it is\n * possible to change the settings of all sounds, too. But using sound sources, it is\n * not necessary to do this every time a sound is played.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section sound3d 3D Sound\n *\n * There is nothing difficult in playing sounds in 3D using irrKlang: Instead of using \n * irrklang::ISoundEngine::play2D(), just use irrklang::ISoundEngine::play3D(), which\n * takes a 3D position as additional parameter:\n *\n * \\code\n * irrklang::vec3df position(23,70,90);\n * engine->play3D(\"yourSound.wav\", position);\n * \\endcode\n *\n * But to make it sound realistic, you need to set a minimal sound\n * distance: If your sound is caused by a bee, it will usually have a smaller\n * sound radius than for example a jet engine. You can set default values using sound sources\n * (see @ref soundSources) or set these values after you have started the sound paused:\n *\n * \\code\n * irrklang::vec3df position(23,70,90);\n *\n * // start the sound paused:\n * irrklang::ISound* snd = engine->play3D(\"yourSound.wav\", position, false, true);\n *\n * if (snd)\n * {\n * snd->setMinDistance(30.0f); // a loud sound\n * snd->setIsPaused(false); // unpause the sound\n * }\n * \\endcode\n * \n * There is also the possibility to change the maxDistance, but it is only necessary to change this\n * in very rare circumstances.\n * If the sound moves, it is also a good idea to update its position from time to time:\n * \n * \\code\n * if (snd)\n * snd->setPosition(newPosition);\n * \\endcode\n *\n * And don't forget to drop() the sound after you don't need it anymore. If you do, it's \n * nothing severe because irrKlang will still clean up the sounds resources after it has\n * finished, but you still would waste some few bytes of memory:\n * \n * \\code\n * if (snd)\n * {\n * snd->drop();\n * snd = 0;\n * }\n * \\endcode\n *\n * To update the position of yourself, the listener of the 3D sounds, use this from\n * time to time:\n *\n * \\code\n * irrklang::vec3df position(0,0,0); // position of the listener\n * irrklang::vec3df lookDirection(10,0,10); // the direction the listener looks into\n * irrklang::vec3df velPerSecond(0,0,0); // only relevant for doppler effects\n * irrklang::vec3df upVector(0,1,0); // where 'up' is in your 3D scene\n *\n * engine->setListenerPosition(position, lookDirection, velPerSecond, upVector);\n * \\endcode\n *\n *
\n *
\n *
\n *
\n *\n *\n * \\section removingSounds Removing Sounds\n *\n * irrKlang manages the memory usage of sounds by itself, so usually, you don't have\n * to care about memory management. But if you know you need to reduce the\n * amount of used memory at a certain point in your program, you can do this:\n *\n * \\code\n * engine->removeAllSoundSources(); \n * \\endcode\n *\n * This will remove all sounds and also cause all sounds to be stopped. To remove single\n * sounds from the engine, use:\n *\n * \\code\n * engine->removeSoundSource(pointerToSomeSoundSource); \n * // or:\n * engine->removeSoundSource(\"nameOfASoundFile.wav\"); \n * \\endcode\n *\n * Note: Only removing buffered sounds will reduce the amount of memory used by irrKlang, streamed\n * sounds don't occupy a lot of memory when they are not played.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section events Using Sound Events\n *\n * In order to wait for a sound to be finished, it is simply possible to \n * poll irrklang::ISound::isFinished(). Another way would be to constantly use \n * irrklang::ISoundEngine::isCurrentlyPlaying to test wether a sound with that name or source\n * is currently playing. But of course, an event based approach is a lot nicer. That's why irrKlang\n * supports sound events.
\n * The key to sound events is the method \n * \\link irrklang::ISound::setSoundStopEventReceiver setSoundStopEventReceiver \\endlink\n * of the irrklang::ISound interface\n * (See @ref changingSounds on how to get the ISound interface):\n *\n * \\code\n * irrklang::ISound* snd = engine->play2D(\"speech.mp3\", false, false, true); \n * if (snd)\n * snd->setSoundStopEventReceiver(yourEventReceiver, 0);\n * \\endcode\n * \n * The optional second parameter of setSoundStopEventReceiver is a user pointer, set it to whatever you like.\n * 'yourEventReceiver' must be an implementation of the irrklang::ISoundStopEventReceiver interface.
\n * A whole implementation could look like this:\n *\n * \\code\n * class MySoundEndReceiver : public irrklang::ISoundStopEventReceiver\n * {\n * public:\n * virtual void OnSoundStopped (irrklang::ISound* sound, irrklang::E_STOP_EVENT_CAUSE reason, void* userData)\n * {\n * // called when the sound has ended playing\n * printf(\"sound has ended\");\n * }\n * }\n *\n * // ...\n *\n * MySoundEndReceiver* myReceiver = new MySoundEndReceiver();\n * irrklang::ISound* snd = engine->play2D(\"speech.mp3\", false, false, true); \n * if (snd)\n * snd->setSoundStopEventReceiver(myReceiver);\n *\n * myReceiver->drop(); // similar to delete\n * \\endcode\n * \n * The irrklang::ISoundStopEventReceiver::OnSoundStopped() method is guaranteed to be called when a sound or sound stream has stopped,\n * either because the sound reached its playback end, its sound source was removed,\n * ISoundEngine::stopAllSounds() has been called or the whole engine was deleted.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section memoryPlayback Memory Playback\n *\n * Using irrKlang, it is easily possible to play sounds directly from memory instead out of \n * files. There is an example project showing this: In the SDK, in /examples/03.MemoryPlayback.\n * But in short, it simply works by adding the memory as sound source (See @ref soundSources for \n * details about sound sources):\n *\n * \\code\n * engine->addSoundSourceFromMemory(pointerToMemory, memorySize, \"nameforthesound.wav\");\n * \n * // play sound now\n * engine->play2D(\"nameforthesound.wav\");\n * \\endcode\n *\n * Or using a sound source pointer:\n *\n * \\code\n * irrklang::ISoundSource* snd = \n * engine->addSoundSourceFromMemory(pointerToMemory, memorySize, \"nameforthesound.wav\");\n * \n * // play sound now\n * engine->play2D(snd);\n * \\endcode\n *\n * Note: It is also possible to overwrite the file access directly, don't use this Memory Playback\n * feature for this. See @ref fileOverriding for details.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section effects Sound Effects\n *\n * irrKlang supports the effects Chorus, Compressor, Distortion, Echo, Flanger\n * Gargle, 3DL2Reverb, ParamEq and WavesReverb, when using the sound driver \n * irrklang::ESOD_DIRECT_SOUND_8, which selected by default when using Windows.
\n *\n * Using the irrklang::ISound interface, you can obtain the irrklang::ISoundEffectControl\n * interface if the sound device supports sound effects and the last parameter ('enableSoundEffects')\n * was set to true when calling play2D():\n *\n * \\code\n * irrklang::ISound* snd = engine->play2D(\"sound.wav\", true, false, true, ESM_AUTO_DETECT, true);\n *\n * if (snd)\n * {\n * irrklang::ISoundEffectControl* fx = snd->getSoundEffectControl();\n * if (fx)\n * {\n * // enable the echo sound effect for this sound\n * fx->enableEchoSoundEffect();\n * }\n * }\n * \n * snd->drop();\n * \\endcode\n *\n * This enabled the echo sound effect for this sound. The method also supports a lot of \n * parameters, and can be called multiple times to change those parameters over time if wished.\n * There are a lot of other sound effects, see irrklang::ISoundEffectControl for details.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section fileOverriding Overriding File Access\n *\n * It is possible to let irrKlang use your own file access functions.\n * This is useful if you want to read sounds from other sources than\n * just files, for example from custom internet streams or \n * an own encrypted archive format. There is an example in the SDK in \n * examples/04.OverrideFileAccess which shows this as well.
\n *\n * The only thing to do for this is to implement your own irrklang::IFileFactory,\n * and set it in irrKlang using irrklang::ISoundEngine::addFileFactory():\n *\n * \\code\n * // a class implementing the IFileFactory interface to override irrklang file access\n * class CMyFileFactory : public irrklang::IFileFactory\n * {\n * public:\n *\n * // Opens a file for read access. Simply return 0 if file not found.\n * virtual irrklang::IFileReader* createFileReader(const ik_c8* filename)\n * {\n * // return your own irrklang::IFileReader implementation here, for example like that:\n * return new CMyReadFile(filename);\n * }\n * };\n * \n * // ...\n *\n * CMyFileFactory* myFactory = new CMyFileFactory();\n * engine->addFileFactory(myFactory);\n * myFactory->drop();\n * \\endcode\n *\n * For a full example implementation, just take a look into the SDK in examples/04.OverrideFileAccess.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section audioDecoders Adding Audio Decoders\n *\n * To add support for new file formats, it is possible to add new audio decoders\n * to irrKlang. \n * The only thing to do for this is to implement your own irrklang::IAudioStreamLoader,\n * and irrklang::IAudioStream, and set it in irrKlang using \n * irrklang::ISoundEngine::registerAudioStreamLoader():\n *\n * \\code\n * class NewAudioStreamLoader : public irrklang::IAudioStreamLoader\n * {\n * // ... returns NewAudioDecoder and the used file name suffices.\n * };\n *\n * class NewAudioDecoder : public irrklang::IAudioStream\n * {\n * public:\n * // ... decodes the new file format\n * };\n *\n * // ...\n *\n * NewAudioDecoder* loader = new NewAudioDecoder();\n * engine->registerAudioStreamLoader(loader);\n * loader->drop();\n * \\endcode\n * \n * There is an example audio decoder and loader with full source in plugins/ikpMP3, which\n * adds MP3 audio decoding capabilities to irrKlang.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section plugins Creating irrKlang Plugins\n *\n * irrKlang plugins are ikp*.dll (Windows), ikp*.so (Unix) or ikp*.dylib (MacOS) \n * files which are loaded by irrKlang at startup when the \n * irrklang::ESEO_LOAD_PLUGINS was set (which is default) or\n * irrklang::ISoundEngine::loadPlugins() was called.
\n *\n * The plugin only needs to contain the following function which will be called by irrKlang:\n *\n * \\code\n * #ifdef WIN32\n * // Windows version\n * __declspec(dllexport) void __stdcall irrKlangPluginInit(ISoundEngine* engine, const char* version)\n * #else\n * // Linux and Mac OS version\n * void irrKlangPluginInit(ISoundEngine* engine, const char* version)\n * #endif\n * {\n * // your implementation here\n * }\n * \\endcode\n *\n * In there, it is for example possible to extend irrKlang with new audio decoders,\n * see @ref audioDecoders for details.
\n * \n * There is an example plugin with full source in plugins/ikpMP3, which\n * adds MP3 audio decoding capabilities to irrKlang.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section staticLib Using irrKlang as static Lib\n *\n * If you don't want to use the irrKlang.DLL file and link irrKlang statically, you can do this\n * by simply linking to the irrKlang.lib in the bin/win32-visualstudio_lib folder. This folder\n * will only available in the pro versions of irrKlang, which you get when purchasing an irrKlang\n * license.\n *\n * To use irrKlang in this way, just define IRRKLANG_STATIC before including irrklang.h, like this:\n *\n * \\code\n * #define IRRKLANG_STATIC\n * #include \n * \\endcode\n *\n * Of course, IRRKLANG_STATIC can also simply be defined in the project/compiler settings instead of\n * in the source file.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section enumeratingDevices Enumerating sound devices\n *\n * irrKlang uses the default sound device when playing sound when started without parameters. But if you want\n * irrKlang to playback sound on one specific sound device, you may want to enumerate the available\n * sound devices on your system and select one of them. Use irrklang::createSoundDeviceList() for this. \n * This example code shows how to print a list of all available sound devices on the current system and lets\n * the user choose one of them: \n *\n * \\code\n * int main(int argc, const char** argv)\n * {\n *\t// enumerate devices\n * \n * \tirrklang::ISoundDeviceList* deviceList = createSoundDeviceList();\n * \n * \t// ask user for a sound device\n * \n * \tprintf(\"Devices available:\\n\\n\");\n * \n * \tfor (int i=0; igetDeviceCount(); ++i)\n * \t\tprintf(\"%d: %s\\n\", i, deviceList->getDeviceDescription(i));\n * \n * \tprintf(\"\\nselect a device using the number (or press any key to use default):\\n\\n\");\n * \tint deviceNumber = getch() - '0';\n * \n * \t// create device with the selected driver\n * \n * \tconst char* deviceID = deviceList->getDeviceID(deviceNumber);\n * \t\t\n * \tISoundEngine* engine = createIrrKlangDevice(irrklang::ESOD_AUTO_DETECT, \n * \t irrklang::ESEO_DEFAULT_OPTIONS,\n * \t deviceID);\n * \n * \tdeviceList->drop(); // delete device list\n *\n * // ... use engine now\n * } \n * \\endcode\n *\n * In this way, it is also possible to play back sound using two devices at the same time: Simply \n * create two irrKlang devices with each a different deviceID.
\n * Note: createSoundDeviceList() takes a driver type parameter (such as irrklang::ESOD_DIRECT_SOUND8), which you\n * have to set to the same value as the first parameter you want to use with createIrrKlangDevice(), if it is \n * other than irrklang::ESOD_AUTO_DETECT.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section recordingAudio Recording Audio\n *\n * irrKlang is able to record audio from sound capturing devices such as microphones (currently only \n * supported in windows). Use the irrklang::IAudioRecorder interface to do this. The following example shows how\n * to record some audio and play it back again using the engine: \n *\n * \\code\n * int main(int argc, const char** argv)\n * {\n *\tirrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();\n *\tirrklang::IAudioRecorder* recorder = irrklang::createIrrKlangAudioRecorder(engine);\n *\n *\tif (!engine || !recorder)\n *\t{\n *\t\tprintf(\"Could not create audio engine or audio recorder\\n\");\n *\t\treturn 1;\n *\t}\n *\n *\tprintf(\"\\nPress any key to start recording audio...\\n\");\n *\tgetch();\n *\n *\t// record some audio\n *\n *\trecorder->startRecordingBufferedAudio();\n *\n *\tprintf(\"\\nRECORDING. Press any key to stop...\\n\");\n *\tgetch();\n *\n *\trecorder->stopRecordingAudio();\n *\n *\tprintf(\"\\nRecording done, recorded %dms of audio.\\n\", \n *\t\trecorder->getAudioFormat().FrameCount * 1000 / recorder->getAudioFormat().SampleRate );\n *\tprintf(\"Press any key to play back recorded audio...\\n\");\n *\tgetch();\n *\n *\t// play the recorded audio\n *\trecorder->addSoundSourceFromRecordedAudio(\"myRecordedVoice\");\n *\tengine->play2D(\"myRecordedVoice\", true);\n *\n *\t// wait until user presses a key\n *\tprintf(\"\\nPress any key to quit...\");\n *\tgetch();\n *\n *\trecorder->drop();\n *\tengine->drop(); // delete engine\n *\n *\treturn 0;\n * } \n * \\endcode\n *\n * In order to select a specific audio capturing device for recording, it is necessary to enumerate\n * the available devices. Simply replace the first to lines of code of the example above with code\n * like this to list all devices and select one:\n *\n * \\code\n * // enumerate recording devices and ask user to select one\n * \n * irrklang::ISoundDeviceList* deviceList = irrklang::createAudioRecorderDeviceList();\n *\n * printf(\"Devices available:\\n\\n\");\n *\n * for (int i=0; igetDeviceCount(); ++i)\n * printf(\"%d: %s\\n\", i, deviceList->getDeviceDescription(i));\n *\n * printf(\"\\nselect a device using the number (or press any key to use default):\\n\\n\");\n * int deviceNumber = getch() - '0';\n *\n * // create recording device with the selected driver\n *\n * const char* deviceID = deviceList->getDeviceID(deviceNumber);\n * irrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();\n * irrklang::IAudioRecorder* recorder = \n * irrklang::createIrrKlangAudioRecorder(engine, irrklang::ESOD_AUTO_DETECT, deviceID);\n *\n * \\endcode\n *\n *
\n *
\n *
\n *
\n *\n *\n * \\section unicode Unicode support\n *\n * irrKlang supports unicode on all operating systems. Internally, it uses UTF8, and all functions accepting strings\n * and file names take UTF8 strings. If you are running irrKlang on Windows, and are using the UNICODE define or using\n * wchar_t* strings directly, you can do this as well. Use the irrKlang provided function makeUTF8fromUTF16string() to \n * convert your wchar_t* string to a char* string.\n *\n * This example shows how:\n *\n * \\code\n * const wchar_t* yourFilename = L\"SomeUnicodeFilename.wav\"; // assuming this is the file name you get from some of your functions\n *\n * const int nBufferSize = 2048; // large enough, but best would be wcslen(yourFilename)*3.\n * char strBuffer[nBufferSize]; \n * irrklang::makeUTF8fromUTF16string(yourFilename, strBuffer, nBufferSize);\n *\n * // now the converted file name is in strBuffer. We can play it for example now:\n * engine->play2D(strBuffer);\n * \\endcode\n *\n * Of course, you can use any other unicode conversion function for this. makeUTF8fromUTF16string() is only provided\n * for convenience.\n *
\n *
\n *
\n *
\n *\n *\n *\n *\n *\n * \\section quickstartexample Quick Start Example\n *\n * To simply start the engine and play a mp3 file, use code like this:\n *\n * \\code\n * #include \n * #include \n * #pragma comment(lib, \"irrKlang.lib\") // link with irrKlang.dll\n *\n * int main(int argc, const char** argv)\n * {\n *\tirrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();\n *\tif (!engine) return 1; // could not start engine\n *\n *\tengine->play2D(\"someMusic.mp3\", true); // play some mp3 file, looped\n * \n *\tstd::cin.get(); // wait until user presses a key\n * \n *\tengine->drop(); // delete engine\n *\treturn 0;\n * } \n * \\endcode\n *\n * A mp3 file is being played until the user presses enter in this example. \n * As you can see, irrKlang uses namespaces, all of\n * the classes are located in the namespace irrklang. If you don't want to write \n * this in front of every class and function you are using, simply write \n *\n * \\code\n * using namespace irrklang;\n * \\endcode\n * in front of your code, as also shown in the next example.\n *
\n *
\n *
\n *
\n *\n *\n *\n * \\section quickstartexample2 Quick Start Example 2\n *\n * The following is a simple interactive application, starting up the sound engine and \n * playing some streaming .ogg music file and a .wav sound effect every time the user\n * presses a key.\n *\n * \\code\n * #include \n * #include \n * using namespace irrklang;\n *\n * #pragma comment(lib, \"irrKlang.lib\") // link with irrKlang.dll\n *\n *\n * int main(int argc, const char** argv)\n * {\n * \t// start the sound engine with default parameters\n * \tISoundEngine* engine = createIrrKlangDevice();\n *\n * \tif (!engine)\n * \t\treturn 0; // error starting up the engine\n *\n * \t// play some sound stream, looped\n * \tengine->play2D(\"../../media/helltroopers.ogg\", true);\n *\n * \tstd::cout << \"\\nHello World!\\n\";\n *\n * \tchar i = 0;\n *\n * \twhile(i != 'q')\n * \t{\n * \t\tstd::cout << \"Press any key to play some sound, press 'q' to quit.\\n\";\n *\n * \t\t// play a single sound\n * \t\tengine->play2D(\"../../media/bell.wav\");\n *\n * \t\tstd::cin >> i; // wait for user to press some key\n * \t}\n *\n * \tengine->drop(); // delete engine\n * \treturn 0;\n * }\n *\n * \\endcode\n */\n\n#if defined(IRRKLANG_STATIC)\n #define IRRKLANG_API\n#else\n #if (defined(WIN32) || defined(WIN64) || defined(_MSC_VER))\n #ifdef IRRKLANG_EXPORTS\n #define IRRKLANG_API __declspec(dllexport)\n #else\n #define IRRKLANG_API __declspec(dllimport)\n #endif // IRRKLANG_EXPORT\n #else\n #define IRRKLANG_API __attribute__((visibility(\"default\")))\n #endif // defined(WIN32) || defined(WIN64)\n#endif // IRRKLANG_STATIC\n\n#if defined(_STDCALL_SUPPORTED)\n#define IRRKLANGCALLCONV __stdcall // Declare the calling convention.\n#else\n#define IRRKLANGCALLCONV\n#endif // STDCALL_SUPPORTED\n\n//! Everything in the irrKlang Sound Engine can be found in this namespace.\nnamespace irrklang\n{\n\t//! Creates an irrKlang device. The irrKlang device is the root object for using the sound engine.\n\t/** \\param driver The sound output driver to be used for sound output. Use irrklang::ESOD_AUTO_DETECT\n\tto let irrKlang decide which driver will be best.\n\t\\param options A combination of irrklang::E_SOUND_ENGINE_OPTIONS literals. Default value is \n\tirrklang::ESEO_DEFAULT_OPTIONS.\n\t\\param deviceID Some additional optional deviceID for the audio driver. If not needed, simple\n\tset this to 0. \n\tThis can be used for example to set a specific ALSA output pcm device for output\n\t(\"default\" or \"hw\", for example). For most driver types, available deviceIDs can be \n\tenumerated using createSoundDeviceList().\n\tSee @ref enumeratingDevices for an example or ISoundDeviceList or details.\n\t\\param sdk_version_do_not_use Don't use or change this parameter. Always set it to\n\tIRRKLANG_SDK_VERSION, which is done by default. This is needed for sdk version checks.\n\t\\return Returns pointer to the created irrKlang device or null if the\n\tdevice could not be created. If you don't need the device, use ISoundEngine::drop() to\n\tdelete it. See IRefCounted::drop() for details.\n\t*/\n\tIRRKLANG_API ISoundEngine* IRRKLANGCALLCONV createIrrKlangDevice(\n\t\tE_SOUND_OUTPUT_DRIVER driver = ESOD_AUTO_DETECT,\n\t\tint options = ESEO_DEFAULT_OPTIONS,\n\t\tconst char* deviceID = 0,\n\t\tconst char* sdk_version_do_not_use = IRR_KLANG_VERSION);\n\n\n\t//! Creates a list of available sound devices for the driver type. \n\t/** The device IDs in this list can be used as parameter to createIrrKlangDevice() to\n\tmake irrKlang use a special sound device. See @ref enumeratingDevices for an example on how\n\tto use this.\n\t\\param driver The sound output driver of which the list is generated. Set it irrklang::ESOD_AUTO_DETECT\n\tto let this function use the same device as createIrrKlangDevice() would choose.\n\t\\param sdk_version_do_not_use Don't use or change this parameter. Always set it to\n\tIRRKLANG_SDK_VERSION, which is done by default. This is needed for sdk version checks.\n\t\\return Returns a pointer to the list of enumerated sound devices for the selected sound driver.\n\tThe device IDs in this list can be used as parameter to createIrrKlangDevice() to\n\tmake irrKlang use a special sound device. \n\tAfter you don't need the list anymore, call ISoundDeviceList::drop() in order to free its memory. */\n\tIRRKLANG_API ISoundDeviceList* IRRKLANGCALLCONV createSoundDeviceList(\n\t\tE_SOUND_OUTPUT_DRIVER driver = ESOD_AUTO_DETECT,\n\t\tconst char* sdk_version_do_not_use = IRR_KLANG_VERSION);\n\n\n\t//! Creates an irrKlang audio recording device. The IAudioRecorder is the root object for recording audio.\n\t/** If you want to play back recorded audio as well, create the ISoundEngine first using\n\tcreateIrrKlangDevice() and then the IAudioRecorder using createIrrKlangAudioRecorder(), where\n\tyou set the ISoundEngine as first parameter. See @ref recordingAudio for an example on how to use this.\n\tNote: audio recording is a very new feature a still beta in irrKlang. It currently only works in Windows\n\tand with DirectSound (subject to change).\n\t\\param irrKlangDeviceForPlayback A pointer to the already existing sound device used for playback\n\tof audio. Sound sources recorded with the IAudioRecorder will be added into that device so that\n\tthey can be played back there.\n\t\\param driver The sound output driver to be used for recording audio. Use irrklang::ESOD_AUTO_DETECT\n\tto let irrKlang decide which driver will be best.\n\t\\param deviceID Some additional optional deviceID for the audio driver. If not needed, simple\n\tset this to 0. Use createAudioRecorderDeviceList() to get a list of all deviceIDs.\n\t\\param sdk_version_do_not_use Don't use or change this parameter. Always set it to\n\tIRRKLANG_SDK_VERSION, which is done by default. This is needed for sdk version checks.\n\t\\return Returns pointer to the created irrKlang device or null if the\n\tdevice could not be created. If you don't need the device, use ISoundEngine::drop() to\n\tdelete it. See IRefCounted::drop() for details.\n\t*/\n\tIRRKLANG_API IAudioRecorder* IRRKLANGCALLCONV createIrrKlangAudioRecorder(\n\t\tISoundEngine* irrKlangDeviceForPlayback,\n\t\tE_SOUND_OUTPUT_DRIVER driver = ESOD_AUTO_DETECT,\n\t\tconst char* deviceID = 0,\n\t\tconst char* sdk_version_do_not_use = IRR_KLANG_VERSION);\n\n\t//! Creates a list of available recording devices for the driver type. \n\t/** The device IDs in this list can be used as parameter to createIrrKlangAudioRecorder() to\n\tmake irrKlang use a special recording device. \n\t\\param driver The sound output driver of which the list is generated. Set it irrklang::ESOD_AUTO_DETECT\n\tto let this function use the same device as createIrrKlangDevice() would choose.\n\t\\param sdk_version_do_not_use Don't use or change this parameter. Always set it to\n\tIRRKLANG_SDK_VERSION, which is done by default. This is needed for sdk version checks.\n\t\\return Returns a pointer to the list of enumerated recording devices for the selected sound driver.\n\tThe device IDs in this list can be used as parameter to createIrrKlangAudioRecorder() to\n\tmake irrKlang use a special sound device. \n\tAfter you don't need the list anymore, call ISoundDeviceList::drop() in order to free its memory. */\n\tIRRKLANG_API ISoundDeviceList* IRRKLANGCALLCONV createAudioRecorderDeviceList(\n\t\tE_SOUND_OUTPUT_DRIVER driver = ESOD_AUTO_DETECT,\n\t\tconst char* sdk_version_do_not_use = IRR_KLANG_VERSION);\n\n\n\t//! Converts a wchar_t string to an utf8 string, useful when using Windows in unicode mode. \n\t/** irrKlang works with unicode file names, and accepts char* strings as parameters for names and filenames.\n\tIf you are running irrKlang in Windows, and working with wchar_t* pointers instead of char* ones, \n\tyou can use this function to create a char* (UTF8) representation of your wchar_t* (UTF16) string.\n\tWorks for filenames and other strings.\n\t\\param pInputString zero terminated input string.\n\t\\param pOutputBuffer the buffer where the converted string is written to. Be sure that this buffer\n\thas a big enough size. A good size would be three times the string length of your input buffer, like\n\twcslen(yourInputBuffer)*3. Because each wchar_t can be represented by up to 3 chars.\n\t\\param outputBufferSize size of your output buffer.\n\t\\return Returns true if successful, and false if not. If 'false' is returned, maybe your buffer was too small. */\n\tIRRKLANG_API bool IRRKLANGCALLCONV makeUTF8fromUTF16string(\n\t\tconst wchar_t* pInputString, char* pOutputBuffer, int outputBufferSize);\n\n\n} // end namespace irrklang\n\n\n/*! \\file irrKlang.h\n \\brief Main header file of the irrKlang sound library, the only file needed to include.\n*/\n\n#endif\n\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.606, "dedup_hash": "b723a5c315ca32ba", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_khr", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Khr", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "includes/KHR/khrplatform.h", "language": "code", "loc": 258, "comment_density": 0.612, "code": "#ifndef __khrplatform_h_\n#define __khrplatform_h_\n\n/*\n** Copyright (c) 2008-2009 The Khronos Group Inc.\n**\n** Permission is hereby granted, free of charge, to any person obtaining a\n** copy of this software and/or associated documentation files (the\n** \"Materials\"), to deal in the Materials without restriction, including\n** without limitation the rights to use, copy, modify, merge, publish,\n** distribute, sublicense, and/or sell copies of the Materials, and to\n** permit persons to whom the Materials are furnished to do so, subject to\n** the following conditions:\n**\n** The above copyright notice and this permission notice shall be included\n** in all copies or substantial portions of the Materials.\n**\n** THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.\n*/\n\n/* Khronos platform-specific types and definitions.\n *\n * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $\n *\n * Adopters may modify this file to suit their platform. Adopters are\n * encouraged to submit platform specific modifications to the Khronos\n * group so that they can be included in future versions of this file.\n * Please submit changes by sending them to the public Khronos Bugzilla\n * (http://khronos.org/bugzilla) by filing a bug against product\n * \"Khronos (general)\" component \"Registry\".\n *\n * A predefined template which fills in some of the bug fields can be\n * reached using http://tinyurl.com/khrplatform-h-bugreport, but you\n * must create a Bugzilla login first.\n *\n *\n * See the Implementer's Guidelines for information about where this file\n * should be located on your system and for more details of its use:\n * http://www.khronos.org/registry/implementers_guide.pdf\n *\n * This file should be included as\n * #include \n * by Khronos client API header files that use its types and defines.\n *\n * The types in khrplatform.h should only be used to define API-specific types.\n *\n * Types defined in khrplatform.h:\n * khronos_int8_t signed 8 bit\n * khronos_uint8_t unsigned 8 bit\n * khronos_int16_t signed 16 bit\n * khronos_uint16_t unsigned 16 bit\n * khronos_int32_t signed 32 bit\n * khronos_uint32_t unsigned 32 bit\n * khronos_int64_t signed 64 bit\n * khronos_uint64_t unsigned 64 bit\n * khronos_intptr_t signed same number of bits as a pointer\n * khronos_uintptr_t unsigned same number of bits as a pointer\n * khronos_ssize_t signed size\n * khronos_usize_t unsigned size\n * khronos_float_t signed 32 bit floating point\n * khronos_time_ns_t unsigned 64 bit time in nanoseconds\n * khronos_utime_nanoseconds_t unsigned time interval or absolute time in\n * nanoseconds\n * khronos_stime_nanoseconds_t signed time interval in nanoseconds\n * khronos_boolean_enum_t enumerated boolean type. This should\n * only be used as a base type when a client API's boolean type is\n * an enum. Client APIs which use an integer or other type for\n * booleans cannot use this as the base type for their boolean.\n *\n * Tokens defined in khrplatform.h:\n *\n * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.\n *\n * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.\n * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.\n *\n * Calling convention macros defined in this file:\n * KHRONOS_APICALL\n * KHRONOS_APIENTRY\n * KHRONOS_APIATTRIBUTES\n *\n * These may be used in function prototypes as:\n *\n * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(\n * int arg1,\n * int arg2) KHRONOS_APIATTRIBUTES;\n */\n\n/*-------------------------------------------------------------------------\n * Definition of KHRONOS_APICALL\n *-------------------------------------------------------------------------\n * This precedes the return type of the function in the function prototype.\n */\n#if defined(_WIN32) && !defined(__SCITECH_SNAP__)\n# define KHRONOS_APICALL __declspec(dllimport)\n#elif defined (__SYMBIAN32__)\n# define KHRONOS_APICALL IMPORT_C\n#elif defined(__ANDROID__)\n# include \n# define KHRONOS_APICALL __attribute__((visibility(\"default\"))) __NDK_FPABI__\n#else\n# define KHRONOS_APICALL\n#endif\n\n/*-------------------------------------------------------------------------\n * Definition of KHRONOS_APIENTRY\n *-------------------------------------------------------------------------\n * This follows the return type of the function and precedes the function\n * name in the function prototype.\n */\n#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)\n /* Win32 but not WinCE */\n# define KHRONOS_APIENTRY __stdcall\n#else\n# define KHRONOS_APIENTRY\n#endif\n\n/*-------------------------------------------------------------------------\n * Definition of KHRONOS_APIATTRIBUTES\n *-------------------------------------------------------------------------\n * This follows the closing parenthesis of the function prototype arguments.\n */\n#if defined (__ARMCC_2__)\n#define KHRONOS_APIATTRIBUTES __softfp\n#else\n#define KHRONOS_APIATTRIBUTES\n#endif\n\n/*-------------------------------------------------------------------------\n * basic type definitions\n *-----------------------------------------------------------------------*/\n#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)\n\n\n/*\n * Using \n */\n#include \ntypedef int32_t khronos_int32_t;\ntypedef uint32_t khronos_uint32_t;\ntypedef int64_t khronos_int64_t;\ntypedef uint64_t khronos_uint64_t;\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#elif defined(__VMS ) || defined(__sgi)\n\n/*\n * Using \n */\n#include \ntypedef int32_t khronos_int32_t;\ntypedef uint32_t khronos_uint32_t;\ntypedef int64_t khronos_int64_t;\ntypedef uint64_t khronos_uint64_t;\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)\n\n/*\n * Win32\n */\ntypedef __int32 khronos_int32_t;\ntypedef unsigned __int32 khronos_uint32_t;\ntypedef __int64 khronos_int64_t;\ntypedef unsigned __int64 khronos_uint64_t;\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#elif defined(__sun__) || defined(__digital__)\n\n/*\n * Sun or Digital\n */\ntypedef int khronos_int32_t;\ntypedef unsigned int khronos_uint32_t;\n#if defined(__arch64__) || defined(_LP64)\ntypedef long int khronos_int64_t;\ntypedef unsigned long int khronos_uint64_t;\n#else\ntypedef long long int khronos_int64_t;\ntypedef unsigned long long int khronos_uint64_t;\n#endif /* __arch64__ */\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#elif 0\n\n/*\n * Hypothetical platform with no float or int64 support\n */\ntypedef int khronos_int32_t;\ntypedef unsigned int khronos_uint32_t;\n#define KHRONOS_SUPPORT_INT64 0\n#define KHRONOS_SUPPORT_FLOAT 0\n\n#else\n\n/*\n * Generic fallback\n */\n#include \ntypedef int32_t khronos_int32_t;\ntypedef uint32_t khronos_uint32_t;\ntypedef int64_t khronos_int64_t;\ntypedef uint64_t khronos_uint64_t;\n#define KHRONOS_SUPPORT_INT64 1\n#define KHRONOS_SUPPORT_FLOAT 1\n\n#endif\n\n\n/*\n * Types that are (so far) the same on all platforms\n */\ntypedef signed char khronos_int8_t;\ntypedef unsigned char khronos_uint8_t;\ntypedef signed short int khronos_int16_t;\ntypedef unsigned short int khronos_uint16_t;\n\n/*\n * Types that differ between LLP64 and LP64 architectures - in LLP64,\n * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears\n * to be the only LLP64 architecture in current use.\n */\n#ifdef _WIN64\ntypedef signed long long int khronos_intptr_t;\ntypedef unsigned long long int khronos_uintptr_t;\ntypedef signed long long int khronos_ssize_t;\ntypedef unsigned long long int khronos_usize_t;\n#else\ntypedef signed long int khronos_intptr_t;\ntypedef unsigned long int khronos_uintptr_t;\ntypedef signed long int khronos_ssize_t;\ntypedef unsigned long int khronos_usize_t;\n#endif\n\n#if KHRONOS_SUPPORT_FLOAT\n/*\n * Float type\n */\ntypedef float khronos_float_t;\n#endif\n\n#if KHRONOS_SUPPORT_INT64\n/* Time types\n *\n * These types can be used to represent a time interval in nanoseconds or\n * an absolute Unadjusted System Time. Unadjusted System Time is the number\n * of nanoseconds since some arbitrary system event (e.g. since the last\n * time the system booted). The Unadjusted System Time is an unsigned\n * 64 bit value that wraps back to 0 every 584 years. Time intervals\n * may be either signed or unsigned.\n */\ntypedef khronos_uint64_t khronos_utime_nanoseconds_t;\ntypedef khronos_int64_t khronos_stime_nanoseconds_t;\n#endif\n\n/*\n * Dummy value used to pad enum types to 32 bits.\n */\n#ifndef KHRONOS_MAX_ENUM\n#define KHRONOS_MAX_ENUM 0x7FFFFFFF\n#endif\n\n/*\n * Enumerated boolean type\n *\n * Values other than zero should be considered to be true. Therefore\n * comparisons should not be made against KHRONOS_TRUE.\n */\ntypedef enum {\n KHRONOS_FALSE = 0,\n KHRONOS_TRUE = 1,\n KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM\n} khronos_boolean_enum_t;\n\n#endif /* __khrplatform_h_ */\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.612, "dedup_hash": "63c07c7f994e5a33", "has_readme": true} +{"id": "joeydevries_learnopengl_includes_learnopengl", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Learnopengl", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/compute/geometry_shader/tessellation/postprocessing", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "includes/learnopengl/animation.h", "language": "code", "loc": 94, "comment_density": 0.032, "code": "#pragma once\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct AssimpNodeData\n{\n\tglm::mat4 transformation;\n\tstd::string name;\n\tint childrenCount;\n\tstd::vector children;\n};\n\nclass Animation\n{\npublic:\n\tAnimation() = default;\n\n\tAnimation(const std::string& animationPath, Model* model)\n\t{\n\t\tAssimp::Importer importer;\n\t\tconst aiScene* scene = importer.ReadFile(animationPath, aiProcess_Triangulate);\n\t\tassert(scene && scene->mRootNode);\n\t\tauto animation = scene->mAnimations[0];\n\t\tm_Duration = animation->mDuration;\n\t\tm_TicksPerSecond = animation->mTicksPerSecond;\n\t\taiMatrix4x4 globalTransformation = scene->mRootNode->mTransformation;\n\t\tglobalTransformation = globalTransformation.Inverse();\n\t\tReadHierarchyData(m_RootNode, scene->mRootNode);\n\t\tReadMissingBones(animation, *model);\n\t}\n\n\t~Animation()\n\t{\n\t}\n\n\tBone* FindBone(const std::string& name)\n\t{\n\t\tauto iter = std::find_if(m_Bones.begin(), m_Bones.end(),\n\t\t\t[&](const Bone& Bone)\n\t\t\t{\n\t\t\t\treturn Bone.GetBoneName() == name;\n\t\t\t}\n\t\t);\n\t\tif (iter == m_Bones.end()) return nullptr;\n\t\telse return &(*iter);\n\t}\n\n\t\n\tinline float GetTicksPerSecond() { return m_TicksPerSecond; }\n\tinline float GetDuration() { return m_Duration;}\n\tinline const AssimpNodeData& GetRootNode() { return m_RootNode; }\n\tinline const std::map& GetBoneIDMap() \n\t{ \n\t\treturn m_BoneInfoMap;\n\t}\n\nprivate:\n\tvoid ReadMissingBones(const aiAnimation* animation, Model& model)\n\t{\n\t\tint size = animation->mNumChannels;\n\n\t\tauto& boneInfoMap = model.GetBoneInfoMap();//getting m_BoneInfoMap from Model class\n\t\tint& boneCount = model.GetBoneCount(); //getting the m_BoneCounter from Model class\n\n\t\t//reading channels(bones engaged in an animation and their keyframes)\n\t\tfor (int i = 0; i < size; i++)\n\t\t{\n\t\t\tauto channel = animation->mChannels[i];\n\t\t\tstd::string boneName = channel->mNodeName.data;\n\n\t\t\tif (boneInfoMap.find(boneName) == boneInfoMap.end())\n\t\t\t{\n\t\t\t\tboneInfoMap[boneName].id = boneCount;\n\t\t\t\tboneCount++;\n\t\t\t}\n\t\t\tm_Bones.push_back(Bone(channel->mNodeName.data,\n\t\t\t\tboneInfoMap[channel->mNodeName.data].id, channel));\n\t\t}\n\n\t\tm_BoneInfoMap = boneInfoMap;\n\t}\n\n\tvoid ReadHierarchyData(AssimpNodeData& dest, const aiNode* src)\n\t{\n\t\tassert(src);\n\n\t\tdest.name = src->mName.data;\n\t\tdest.transformation = AssimpGLMHelpers::ConvertMatrixToGLMFormat(src->mTransformation);\n\t\tdest.childrenCount = src->mNumChildren;\n\n\t\tfor (int i = 0; i < src->mNumChildren; i++)\n\t\t{\n\t\t\tAssimpNodeData newData;\n\t\t\tReadHierarchyData(newData, src->mChildren[i]);\n\t\t\tdest.children.push_back(newData);\n\t\t}\n\t}\n\tfloat m_Duration;\n\tint m_TicksPerSecond;\n\tstd::vector m_Bones;\n\tAssimpNodeData m_RootNode;\n\tstd::map m_BoneInfoMap;\n};\n\n"}, {"path": "includes/learnopengl/animator.h", "language": "code", "loc": 65, "comment_density": 0.0, "code": "#pragma once\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nclass Animator\n{\npublic:\n\tAnimator(Animation* animation)\n\t{\n\t\tm_CurrentTime = 0.0;\n\t\tm_CurrentAnimation = animation;\n\n\t\tm_FinalBoneMatrices.reserve(100);\n\n\t\tfor (int i = 0; i < 100; i++)\n\t\t\tm_FinalBoneMatrices.push_back(glm::mat4(1.0f));\n\t}\n\n\tvoid UpdateAnimation(float dt)\n\t{\n\t\tm_DeltaTime = dt;\n\t\tif (m_CurrentAnimation)\n\t\t{\n\t\t\tm_CurrentTime += m_CurrentAnimation->GetTicksPerSecond() * dt;\n\t\t\tm_CurrentTime = fmod(m_CurrentTime, m_CurrentAnimation->GetDuration());\n\t\t\tCalculateBoneTransform(&m_CurrentAnimation->GetRootNode(), glm::mat4(1.0f));\n\t\t}\n\t}\n\n\tvoid PlayAnimation(Animation* pAnimation)\n\t{\n\t\tm_CurrentAnimation = pAnimation;\n\t\tm_CurrentTime = 0.0f;\n\t}\n\n\tvoid CalculateBoneTransform(const AssimpNodeData* node, glm::mat4 parentTransform)\n\t{\n\t\tstd::string nodeName = node->name;\n\t\tglm::mat4 nodeTransform = node->transformation;\n\n\t\tBone* Bone = m_CurrentAnimation->FindBone(nodeName);\n\n\t\tif (Bone)\n\t\t{\n\t\t\tBone->Update(m_CurrentTime);\n\t\t\tnodeTransform = Bone->GetLocalTransform();\n\t\t}\n\n\t\tglm::mat4 globalTransformation = parentTransform * nodeTransform;\n\n\t\tauto boneInfoMap = m_CurrentAnimation->GetBoneIDMap();\n\t\tif (boneInfoMap.find(nodeName) != boneInfoMap.end())\n\t\t{\n\t\t\tint index = boneInfoMap[nodeName].id;\n\t\t\tglm::mat4 offset = boneInfoMap[nodeName].offset;\n\t\t\tm_FinalBoneMatrices[index] = globalTransformation * offset;\n\t\t}\n\n\t\tfor (int i = 0; i < node->childrenCount; i++)\n\t\t\tCalculateBoneTransform(&node->children[i], globalTransformation);\n\t}\n\n\tstd::vector GetFinalBoneMatrices()\n\t{\n\t\treturn m_FinalBoneMatrices;\n\t}\n\nprivate:\n\tstd::vector m_FinalBoneMatrices;\n\tAnimation* m_CurrentAnimation;\n\tfloat m_CurrentTime;\n\tfloat m_DeltaTime;\n\n};\n"}, {"path": "includes/learnopengl/animdata.h", "language": "code", "loc": 10, "comment_density": 0.2, "code": "#pragma once\n\n#include\n\nstruct BoneInfo\n{\n\t/*id is index in finalBoneMatrices*/\n\tint id;\n\n\t/*offset matrix transforms vertex from model space to bone space*/\n\tglm::mat4 offset;\n\n};\n#pragma once\n"}, {"path": "includes/learnopengl/assimp_glm_helpers.h", "language": "code", "loc": 28, "comment_density": 0.036, "code": "#pragma once\n\n#include\n#include\n#include\n#include\n#include\n\n\nclass AssimpGLMHelpers\n{\npublic:\n\n\tstatic inline glm::mat4 ConvertMatrixToGLMFormat(const aiMatrix4x4& from)\n\t{\n\t\tglm::mat4 to;\n\t\t//the a,b,c,d in assimp is the row ; the 1,2,3,4 is the column\n\t\tto[0][0] = from.a1; to[1][0] = from.a2; to[2][0] = from.a3; to[3][0] = from.a4;\n\t\tto[0][1] = from.b1; to[1][1] = from.b2; to[2][1] = from.b3; to[3][1] = from.b4;\n\t\tto[0][2] = from.c1; to[1][2] = from.c2; to[2][2] = from.c3; to[3][2] = from.c4;\n\t\tto[0][3] = from.d1; to[1][3] = from.d2; to[2][3] = from.d3; to[3][3] = from.d4;\n\t\treturn to;\n\t}\n\n\tstatic inline glm::vec3 GetGLMVec(const aiVector3D& vec) \n\t{ \n\t\treturn glm::vec3(vec.x, vec.y, vec.z); \n\t}\n\n\tstatic inline glm::quat GetGLMQuat(const aiQuaternion& pOrientation)\n\t{\n\t\treturn glm::quat(pOrientation.w, pOrientation.x, pOrientation.y, pOrientation.z);\n\t}\n};"}, {"path": "includes/learnopengl/bone.h", "language": "code", "loc": 160, "comment_density": 0.006, "code": "#pragma once\n\n/* Container for bone data */\n\n#include \n#include \n#include \n#include \n#define GLM_ENABLE_EXPERIMENTAL\n#include \n#include \n\nstruct KeyPosition\n{\n\tglm::vec3 position;\n\tfloat timeStamp;\n};\n\nstruct KeyRotation\n{\n\tglm::quat orientation;\n\tfloat timeStamp;\n};\n\nstruct KeyScale\n{\n\tglm::vec3 scale;\n\tfloat timeStamp;\n};\n\nclass Bone\n{\npublic:\n\tBone(const std::string& name, int ID, const aiNodeAnim* channel)\n\t\t:\n\t\tm_Name(name),\n\t\tm_ID(ID),\n\t\tm_LocalTransform(1.0f)\n\t{\n\t\tm_NumPositions = channel->mNumPositionKeys;\n\n\t\tfor (int positionIndex = 0; positionIndex < m_NumPositions; ++positionIndex)\n\t\t{\n\t\t\taiVector3D aiPosition = channel->mPositionKeys[positionIndex].mValue;\n\t\t\tfloat timeStamp = channel->mPositionKeys[positionIndex].mTime;\n\t\t\tKeyPosition data;\n\t\t\tdata.position = AssimpGLMHelpers::GetGLMVec(aiPosition);\n\t\t\tdata.timeStamp = timeStamp;\n\t\t\tm_Positions.push_back(data);\n\t\t}\n\n\t\tm_NumRotations = channel->mNumRotationKeys;\n\t\tfor (int rotationIndex = 0; rotationIndex < m_NumRotations; ++rotationIndex)\n\t\t{\n\t\t\taiQuaternion aiOrientation = channel->mRotationKeys[rotationIndex].mValue;\n\t\t\tfloat timeStamp = channel->mRotationKeys[rotationIndex].mTime;\n\t\t\tKeyRotation data;\n\t\t\tdata.orientation = AssimpGLMHelpers::GetGLMQuat(aiOrientation);\n\t\t\tdata.timeStamp = timeStamp;\n\t\t\tm_Rotations.push_back(data);\n\t\t}\n\n\t\tm_NumScalings = channel->mNumScalingKeys;\n\t\tfor (int keyIndex = 0; keyIndex < m_NumScalings; ++keyIndex)\n\t\t{\n\t\t\taiVector3D scale = channel->mScalingKeys[keyIndex].mValue;\n\t\t\tfloat timeStamp = channel->mScalingKeys[keyIndex].mTime;\n\t\t\tKeyScale data;\n\t\t\tdata.scale = AssimpGLMHelpers::GetGLMVec(scale);\n\t\t\tdata.timeStamp = timeStamp;\n\t\t\tm_Scales.push_back(data);\n\t\t}\n\t}\n\t\n\tvoid Update(float animationTime)\n\t{\n\t\tglm::mat4 translation = InterpolatePosition(animationTime);\n\t\tglm::mat4 rotation = InterpolateRotation(animationTime);\n\t\tglm::mat4 scale = InterpolateScaling(animationTime);\n\t\tm_LocalTransform = translation * rotation * scale;\n\t}\n\tglm::mat4 GetLocalTransform() { return m_LocalTransform; }\n\tstd::string GetBoneName() const { return m_Name; }\n\tint GetBoneID() { return m_ID; }\n\t\n\n\n\tint GetPositionIndex(float animationTime)\n\t{\n\t\tfor (int index = 0; index < m_NumPositions - 1; ++index)\n\t\t{\n\t\t\tif (animationTime < m_Positions[index + 1].timeStamp)\n\t\t\t\treturn index;\n\t\t}\n\t\tassert(0);\n\t}\n\n\tint GetRotationIndex(float animationTime)\n\t{\n\t\tfor (int index = 0; index < m_NumRotations - 1; ++index)\n\t\t{\n\t\t\tif (animationTime < m_Rotations[index + 1].timeStamp)\n\t\t\t\treturn index;\n\t\t}\n\t\tassert(0);\n\t}\n\n\tint GetScaleIndex(float animationTime)\n\t{\n\t\tfor (int index = 0; index < m_NumScalings - 1; ++index)\n\t\t{\n\t\t\tif (animationTime < m_Scales[index + 1].timeStamp)\n\t\t\t\treturn index;\n\t\t}\n\t\tassert(0);\n\t}\n\n\nprivate:\n\n\tfloat GetScaleFactor(float lastTimeStamp, float nextTimeStamp, float animationTime)\n\t{\n\t\tfloat scaleFactor = 0.0f;\n\t\tfloat midWayLength = animationTime - lastTimeStamp;\n\t\tfloat framesDiff = nextTimeStamp - lastTimeStamp;\n\t\tscaleFactor = midWayLength / framesDiff;\n\t\treturn scaleFactor;\n\t}\n\n\tglm::mat4 InterpolatePosition(float animationTime)\n\t{\n\t\tif (1 == m_NumPositions)\n\t\t\treturn glm::translate(glm::mat4(1.0f), m_Positions[0].position);\n\n\t\tint p0Index = GetPositionIndex(animationTime);\n\t\tint p1Index = p0Index + 1;\n\t\tfloat scaleFactor = GetScaleFactor(m_Positions[p0Index].timeStamp,\n\t\t\tm_Positions[p1Index].timeStamp, animationTime);\n\t\tglm::vec3 finalPosition = glm::mix(m_Positions[p0Index].position, m_Positions[p1Index].position\n\t\t\t, scaleFactor);\n\t\treturn glm::translate(glm::mat4(1.0f), finalPosition);\n\t}\n\n\tglm::mat4 InterpolateRotation(float animationTime)\n\t{\n\t\tif (1 == m_NumRotations)\n\t\t{\n\t\t\tauto rotation = glm::normalize(m_Rotations[0].orientation);\n\t\t\treturn glm::toMat4(rotation);\n\t\t}\n\n\t\tint p0Index = GetRotationIndex(animationTime);\n\t\tint p1Index = p0Index + 1;\n\t\tfloat scaleFactor = GetScaleFactor(m_Rotations[p0Index].timeStamp,\n\t\t\tm_Rotations[p1Index].timeStamp, animationTime);\n\t\tglm::quat finalRotation = glm::slerp(m_Rotations[p0Index].orientation, m_Rotations[p1Index].orientation\n\t\t\t, scaleFactor);\n\t\tfinalRotation = glm::normalize(finalRotation);\n\t\treturn glm::toMat4(finalRotation);\n\n\t}\n\n\tglm::mat4 InterpolateScaling(float animationTime)\n\t{\n\t\tif (1 == m_NumScalings)\n\t\t\treturn glm::scale(glm::mat4(1.0f), m_Scales[0].scale);\n\n\t\tint p0Index = GetScaleIndex(animationTime);\n\t\tint p1Index = p0Index + 1;\n\t\tfloat scaleFactor = GetScaleFactor(m_Scales[p0Index].timeStamp,\n\t\t\tm_Scales[p1Index].timeStamp, animationTime);\n\t\tglm::vec3 finalScale = glm::mix(m_Scales[p0Index].scale, m_Scales[p1Index].scale\n\t\t\t, scaleFactor);\n\t\treturn glm::scale(glm::mat4(1.0f), finalScale);\n\t}\n\n\tstd::vector m_Positions;\n\tstd::vector m_Rotations;\n\tstd::vector m_Scales;\n\tint m_NumPositions;\n\tint m_NumRotations;\n\tint m_NumScalings;\n\n\tglm::mat4 m_LocalTransform;\n\tstd::string m_Name;\n\tint m_ID;\n};\n\n"}, {"path": "includes/learnopengl/camera.h", "language": "code", "loc": 114, "comment_density": 0.158, "code": "#ifndef CAMERA_H\n#define CAMERA_H\n\n#include \n#include \n#include \n\n// Defines several possible options for camera movement. Used as abstraction to stay away from window-system specific input methods\nenum Camera_Movement {\n FORWARD,\n BACKWARD,\n LEFT,\n RIGHT\n};\n\n// Default camera values\nconst float YAW = -90.0f;\nconst float PITCH = 0.0f;\nconst float SPEED = 2.5f;\nconst float SENSITIVITY = 0.1f;\nconst float ZOOM = 45.0f;\n\n\n// An abstract camera class that processes input and calculates the corresponding Euler Angles, Vectors and Matrices for use in OpenGL\nclass Camera\n{\npublic:\n // camera Attributes\n glm::vec3 Position;\n glm::vec3 Front;\n glm::vec3 Up;\n glm::vec3 Right;\n glm::vec3 WorldUp;\n // euler Angles\n float Yaw;\n float Pitch;\n // camera options\n float MovementSpeed;\n float MouseSensitivity;\n float Zoom;\n\n // constructor with vectors\n Camera(glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), float yaw = YAW, float pitch = PITCH) : Front(glm::vec3(0.0f, 0.0f, -1.0f)), MovementSpeed(SPEED), MouseSensitivity(SENSITIVITY), Zoom(ZOOM)\n {\n Position = position;\n WorldUp = up;\n Yaw = yaw;\n Pitch = pitch;\n updateCameraVectors();\n }\n // constructor with scalar values\n Camera(float posX, float posY, float posZ, float upX, float upY, float upZ, float yaw, float pitch) : Front(glm::vec3(0.0f, 0.0f, -1.0f)), MovementSpeed(SPEED), MouseSensitivity(SENSITIVITY), Zoom(ZOOM)\n {\n Position = glm::vec3(posX, posY, posZ);\n WorldUp = glm::vec3(upX, upY, upZ);\n Yaw = yaw;\n Pitch = pitch;\n updateCameraVectors();\n }\n\n // returns the view matrix calculated using Euler Angles and the LookAt Matrix\n glm::mat4 GetViewMatrix()\n {\n return glm::lookAt(Position, Position + Front, Up);\n }\n\n // processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)\n void ProcessKeyboard(Camera_Movement direction, float deltaTime)\n {\n float velocity = MovementSpeed * deltaTime;\n if (direction == FORWARD)\n Position += Front * velocity;\n if (direction == BACKWARD)\n Position -= Front * velocity;\n if (direction == LEFT)\n Position -= Right * velocity;\n if (direction == RIGHT)\n Position += Right * velocity;\n }\n\n // processes input received from a mouse input system. Expects the offset value in both the x and y direction.\n void ProcessMouseMovement(float xoffset, float yoffset, GLboolean constrainPitch = true)\n {\n xoffset *= MouseSensitivity;\n yoffset *= MouseSensitivity;\n\n Yaw += xoffset;\n Pitch += yoffset;\n\n // make sure that when pitch is out of bounds, screen doesn't get flipped\n if (constrainPitch)\n {\n if (Pitch > 89.0f)\n Pitch = 89.0f;\n if (Pitch < -89.0f)\n Pitch = -89.0f;\n }\n\n // update Front, Right and Up Vectors using the updated Euler angles\n updateCameraVectors();\n }\n\n // processes input received from a mouse scroll-wheel event. Only requires input on the vertical wheel-axis\n void ProcessMouseScroll(float yoffset)\n {\n Zoom -= (float)yoffset;\n if (Zoom < 1.0f)\n Zoom = 1.0f;\n if (Zoom > 45.0f)\n Zoom = 45.0f;\n }\n\nprivate:\n // calculates the front vector from the Camera's (updated) Euler Angles\n void updateCameraVectors()\n {\n // calculate the new Front vector\n glm::vec3 front;\n front.x = cos(glm::radians(Yaw)) * cos(glm::radians(Pitch));\n front.y = sin(glm::radians(Pitch));\n front.z = sin(glm::radians(Yaw)) * cos(glm::radians(Pitch));\n Front = glm::normalize(front);\n // also re-calculate the Right and Up vector\n Right = glm::normalize(glm::cross(Front, WorldUp)); // normalize the vectors, because their length gets closer to 0 the more you look up or down which results in slower movement.\n Up = glm::normalize(glm::cross(Right, Front));\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/entity.h", "language": "code", "loc": 394, "comment_density": 0.084, "code": "#ifndef ENTITY_H\n#define ENTITY_H\n\n#include //glm::mat4\n#include //std::list\n#include //std::array\n#include //std::unique_ptr\n\nclass Transform\n{\nprotected:\n\t//Local space information\n\tglm::vec3 m_pos = { 0.0f, 0.0f, 0.0f };\n\tglm::vec3 m_eulerRot = { 0.0f, 0.0f, 0.0f }; //In degrees\n\tglm::vec3 m_scale = { 1.0f, 1.0f, 1.0f };\n\n\t//Global space information concatenate in matrix\n\tglm::mat4 m_modelMatrix = glm::mat4(1.0f);\n\n\t//Dirty flag\n\tbool m_isDirty = true;\n\nprotected:\n\tglm::mat4 getLocalModelMatrix()\n\t{\n\t\tconst glm::mat4 transformX = glm::rotate(glm::mat4(1.0f), glm::radians(m_eulerRot.x), glm::vec3(1.0f, 0.0f, 0.0f));\n\t\tconst glm::mat4 transformY = glm::rotate(glm::mat4(1.0f), glm::radians(m_eulerRot.y), glm::vec3(0.0f, 1.0f, 0.0f));\n\t\tconst glm::mat4 transformZ = glm::rotate(glm::mat4(1.0f), glm::radians(m_eulerRot.z), glm::vec3(0.0f, 0.0f, 1.0f));\n\n\t\t// Y * X * Z\n\t\tconst glm::mat4 rotationMatrix = transformY * transformX * transformZ;\n\n\t\t// translation * rotation * scale (also know as TRS matrix)\n\t\treturn glm::translate(glm::mat4(1.0f), m_pos) * rotationMatrix * glm::scale(glm::mat4(1.0f), m_scale);\n\t}\npublic:\n\n\tvoid computeModelMatrix()\n\t{\n\t\tm_modelMatrix = getLocalModelMatrix();\n\t\tm_isDirty = false;\n\t}\n\n\tvoid computeModelMatrix(const glm::mat4& parentGlobalModelMatrix)\n\t{\n\t\tm_modelMatrix = parentGlobalModelMatrix * getLocalModelMatrix();\n\t\tm_isDirty = false;\n\t}\n\n\tvoid setLocalPosition(const glm::vec3& newPosition)\n\t{\n\t\tm_pos = newPosition;\n\t\tm_isDirty = true;\n\t}\n\n\tvoid setLocalRotation(const glm::vec3& newRotation)\n\t{\n\t\tm_eulerRot = newRotation;\n\t\tm_isDirty = true;\n\t}\n\n\tvoid setLocalScale(const glm::vec3& newScale)\n\t{\n\t\tm_scale = newScale;\n\t\tm_isDirty = true;\n\t}\n\n\tconst glm::vec3& getGlobalPosition() const\n\t{\n\t\treturn m_modelMatrix[3];\n\t}\n\n\tconst glm::vec3& getLocalPosition() const\n\t{\n\t\treturn m_pos;\n\t}\n\n\tconst glm::vec3& getLocalRotation() const\n\t{\n\t\treturn m_eulerRot;\n\t}\n\n\tconst glm::vec3& getLocalScale() const\n\t{\n\t\treturn m_scale;\n\t}\n\n\tconst glm::mat4& getModelMatrix() const\n\t{\n\t\treturn m_modelMatrix;\n\t}\n\n\tglm::vec3 getRight() const\n\t{\n\t\treturn m_modelMatrix[0];\n\t}\n\n\n\tglm::vec3 getUp() const\n\t{\n\t\treturn m_modelMatrix[1];\n\t}\n\n\tglm::vec3 getBackward() const\n\t{\n\t\treturn m_modelMatrix[2];\n\t}\n\n\tglm::vec3 getForward() const\n\t{\n\t\treturn -m_modelMatrix[2];\n\t}\n\n\tglm::vec3 getGlobalScale() const\n\t{\n\t\treturn { glm::length(getRight()), glm::length(getUp()), glm::length(getBackward()) };\n\t}\n\n\tbool isDirty() const\n\t{\n\t\treturn m_isDirty;\n\t}\n};\n\nstruct Plane\n{\n\tglm::vec3 normal = { 0.f, 1.f, 0.f }; // unit vector\n\tfloat distance = 0.f; // Distance with origin\n\n\tPlane() = default;\n\n\tPlane(const glm::vec3& p1, const glm::vec3& norm)\n\t\t: normal(glm::normalize(norm)),\n\t\tdistance(glm::dot(normal, p1))\n\t{}\n\n\tfloat getSignedDistanceToPlane(const glm::vec3& point) const\n\t{\n\t\treturn glm::dot(normal, point) - distance;\n\t}\n};\n\nstruct Frustum\n{\n\tPlane topFace;\n\tPlane bottomFace;\n\n\tPlane rightFace;\n\tPlane leftFace;\n\n\tPlane farFace;\n\tPlane nearFace;\n};\n\nstruct BoundingVolume\n{\n\tvirtual bool isOnFrustum(const Frustum& camFrustum, const Transform& transform) const = 0;\n\n\tvirtual bool isOnOrForwardPlane(const Plane& plane) const = 0;\n\n\tbool isOnFrustum(const Frustum& camFrustum) const\n\t{\n\t\treturn (isOnOrForwardPlane(camFrustum.leftFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.rightFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.topFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.bottomFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.nearFace) &&\n\t\t\tisOnOrForwardPlane(camFrustum.farFace));\n\t};\n};\n\nstruct Sphere : public BoundingVolume\n{\n\tglm::vec3 center{ 0.f, 0.f, 0.f };\n\tfloat radius{ 0.f };\n\n\tSphere(const glm::vec3& inCenter, float inRadius)\n\t\t: BoundingVolume{}, center{ inCenter }, radius{ inRadius }\n\t{}\n\n\tbool isOnOrForwardPlane(const Plane& plane) const final\n\t{\n\t\treturn plane.getSignedDistanceToPlane(center) > -radius;\n\t}\n\n\tbool isOnFrustum(const Frustum& camFrustum, const Transform& transform) const final\n\t{\n\t\t//Get global scale thanks to our transform\n\t\tconst glm::vec3 globalScale = transform.getGlobalScale();\n\n\t\t//Get our global center with process it with the global model matrix of our transform\n\t\tconst glm::vec3 globalCenter{ transform.getModelMatrix() * glm::vec4(center, 1.f) };\n\n\t\t//To wrap correctly our shape, we need the maximum scale scalar.\n\t\tconst float maxScale = std::max(std::max(globalScale.x, globalScale.y), globalScale.z);\n\n\t\t//Max scale is assuming for the diameter. So, we need the half to apply it to our radius\n\t\tSphere globalSphere(globalCenter, radius * (maxScale * 0.5f));\n\n\t\t//Check Firstly the result that have the most chance to failure to avoid to call all functions.\n\t\treturn (globalSphere.isOnOrForwardPlane(camFrustum.leftFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.rightFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.farFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.nearFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.topFace) &&\n\t\t\tglobalSphere.isOnOrForwardPlane(camFrustum.bottomFace));\n\t};\n};\n\nstruct SquareAABB : public BoundingVolume\n{\n\tglm::vec3 center{ 0.f, 0.f, 0.f };\n\tfloat extent{ 0.f };\n\n\tSquareAABB(const glm::vec3& inCenter, float inExtent)\n\t\t: BoundingVolume{}, center{ inCenter }, extent{ inExtent }\n\t{}\n\n\tbool isOnOrForwardPlane(const Plane& plane) const final\n\t{\n\t\t// Compute the projection interval radius of b onto L(t) = b.c + t * p.n\n\t\tconst float r = extent * (std::abs(plane.normal.x) + std::abs(plane.normal.y) + std::abs(plane.normal.z));\n\t\treturn -r <= plane.getSignedDistanceToPlane(center);\n\t}\n\n\tbool isOnFrustum(const Frustum& camFrustum, const Transform& transform) const final\n\t{\n\t\t//Get global scale thanks to our transform\n\t\tconst glm::vec3 globalCenter{ transform.getModelMatrix() * glm::vec4(center, 1.f) };\n\n\t\t// Scaled orientation\n\t\tconst glm::vec3 right = transform.getRight() * extent;\n\t\tconst glm::vec3 up = transform.getUp() * extent;\n\t\tconst glm::vec3 forward = transform.getForward() * extent;\n\n\t\tconst float newIi = std::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, forward));\n\n\t\tconst float newIj = std::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, forward));\n\n\t\tconst float newIk = std::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, forward));\n\n\t\tconst SquareAABB globalAABB(globalCenter, std::max(std::max(newIi, newIj), newIk));\n\n\t\treturn (globalAABB.isOnOrForwardPlane(camFrustum.leftFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.rightFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.topFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.bottomFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.nearFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.farFace));\n\t};\n};\n\nstruct AABB : public BoundingVolume\n{\n\tglm::vec3 center{ 0.f, 0.f, 0.f };\n\tglm::vec3 extents{ 0.f, 0.f, 0.f };\n\n\tAABB(const glm::vec3& min, const glm::vec3& max)\n\t\t: BoundingVolume{}, center{ (max + min) * 0.5f }, extents{ max.x - center.x, max.y - center.y, max.z - center.z }\n\t{}\n\n\tAABB(const glm::vec3& inCenter, float iI, float iJ, float iK)\n\t\t: BoundingVolume{}, center{ inCenter }, extents{ iI, iJ, iK }\n\t{}\n\n\tstd::array getVertice() const\n\t{\n\t\tstd::array vertice;\n\t\tvertice[0] = { center.x - extents.x, center.y - extents.y, center.z - extents.z };\n\t\tvertice[1] = { center.x + extents.x, center.y - extents.y, center.z - extents.z };\n\t\tvertice[2] = { center.x - extents.x, center.y + extents.y, center.z - extents.z };\n\t\tvertice[3] = { center.x + extents.x, center.y + extents.y, center.z - extents.z };\n\t\tvertice[4] = { center.x - extents.x, center.y - extents.y, center.z + extents.z };\n\t\tvertice[5] = { center.x + extents.x, center.y - extents.y, center.z + extents.z };\n\t\tvertice[6] = { center.x - extents.x, center.y + extents.y, center.z + extents.z };\n\t\tvertice[7] = { center.x + extents.x, center.y + extents.y, center.z + extents.z };\n\t\treturn vertice;\n\t}\n\n\t//see https://gdbooks.gitbooks.io/3dcollisions/content/Chapter2/static_aabb_plane.html\n\tbool isOnOrForwardPlane(const Plane& plane) const final\n\t{\n\t\t// Compute the projection interval radius of b onto L(t) = b.c + t * p.n\n\t\tconst float r = extents.x * std::abs(plane.normal.x) + extents.y * std::abs(plane.normal.y) +\n\t\t\textents.z * std::abs(plane.normal.z);\n\n\t\treturn -r <= plane.getSignedDistanceToPlane(center);\n\t}\n\n\tbool isOnFrustum(const Frustum& camFrustum, const Transform& transform) const final\n\t{\n\t\t//Get global scale thanks to our transform\n\t\tconst glm::vec3 globalCenter{ transform.getModelMatrix() * glm::vec4(center, 1.f) };\n\n\t\t// Scaled orientation\n\t\tconst glm::vec3 right = transform.getRight() * extents.x;\n\t\tconst glm::vec3 up = transform.getUp() * extents.y;\n\t\tconst glm::vec3 forward = transform.getForward() * extents.z;\n\n\t\tconst float newIi = std::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, forward));\n\n\t\tconst float newIj = std::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, forward));\n\n\t\tconst float newIk = std::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, forward));\n\n\t\tconst AABB globalAABB(globalCenter, newIi, newIj, newIk);\n\n\t\treturn (globalAABB.isOnOrForwardPlane(camFrustum.leftFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.rightFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.topFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.bottomFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.nearFace) &&\n\t\t\tglobalAABB.isOnOrForwardPlane(camFrustum.farFace));\n\t};\n};\n\nFrustum createFrustumFromCamera(const Camera& cam, float aspect, float fovY, float zNear, float zFar)\n{\n\tFrustum frustum;\n\tconst float halfVSide = zFar * tanf(fovY * .5f);\n\tconst float halfHSide = halfVSide * aspect;\n\tconst glm::vec3 frontMultFar = zFar * cam.Front;\n\n\tfrustum.nearFace = { cam.Position + zNear * cam.Front, cam.Front };\n\tfrustum.farFace = { cam.Position + frontMultFar, -cam.Front };\n\tfrustum.rightFace = { cam.Position, glm::cross(frontMultFar - cam.Right * halfHSide, cam.Up) };\n\tfrustum.leftFace = { cam.Position, glm::cross(cam.Up, frontMultFar + cam.Right * halfHSide) };\n\tfrustum.topFace = { cam.Position, glm::cross(cam.Right, frontMultFar - cam.Up * halfVSide) };\n\tfrustum.bottomFace = { cam.Position, glm::cross(frontMultFar + cam.Up * halfVSide, cam.Right) };\n\treturn frustum;\n}\n\nAABB generateAABB(const Model& model)\n{\n\tglm::vec3 minAABB = glm::vec3(std::numeric_limits::max());\n\tglm::vec3 maxAABB = glm::vec3(std::numeric_limits::min());\n\tfor (auto&& mesh : model.meshes)\n\t{\n\t\tfor (auto&& vertex : mesh.vertices)\n\t\t{\n\t\t\tminAABB.x = std::min(minAABB.x, vertex.Position.x);\n\t\t\tminAABB.y = std::min(minAABB.y, vertex.Position.y);\n\t\t\tminAABB.z = std::min(minAABB.z, vertex.Position.z);\n\n\t\t\tmaxAABB.x = std::max(maxAABB.x, vertex.Position.x);\n\t\t\tmaxAABB.y = std::max(maxAABB.y, vertex.Position.y);\n\t\t\tmaxAABB.z = std::max(maxAABB.z, vertex.Position.z);\n\t\t}\n\t}\n\treturn AABB(minAABB, maxAABB);\n}\n\nSphere generateSphereBV(const Model& model)\n{\n\tglm::vec3 minAABB = glm::vec3(std::numeric_limits::max());\n\tglm::vec3 maxAABB = glm::vec3(std::numeric_limits::min());\n\tfor (auto&& mesh : model.meshes)\n\t{\n\t\tfor (auto&& vertex : mesh.vertices)\n\t\t{\n\t\t\tminAABB.x = std::min(minAABB.x, vertex.Position.x);\n\t\t\tminAABB.y = std::min(minAABB.y, vertex.Position.y);\n\t\t\tminAABB.z = std::min(minAABB.z, vertex.Position.z);\n\n\t\t\tmaxAABB.x = std::max(maxAABB.x, vertex.Position.x);\n\t\t\tmaxAABB.y = std::max(maxAABB.y, vertex.Position.y);\n\t\t\tmaxAABB.z = std::max(maxAABB.z, vertex.Position.z);\n\t\t}\n\t}\n\n\treturn Sphere((maxAABB + minAABB) * 0.5f, glm::length(minAABB - maxAABB));\n}\n\nclass Entity\n{\npublic:\n\t//Scene graph\n\tstd::list> children;\n\tEntity* parent = nullptr;\n\n\t//Space information\n\tTransform transform;\n\n\tModel* pModel = nullptr;\n\tstd::unique_ptr boundingVolume;\n\n\n\t// constructor, expects a filepath to a 3D model.\n\tEntity(Model& model) : pModel{ &model }\n\t{\n\t\tboundingVolume = std::make_unique(generateAABB(model));\n\t\t//boundingVolume = std::make_unique(generateSphereBV(model));\n\t}\n\n\tAABB getGlobalAABB()\n\t{\n\t\t//Get global scale thanks to our transform\n\t\tconst glm::vec3 globalCenter{ transform.getModelMatrix() * glm::vec4(boundingVolume->center, 1.f) };\n\n\t\t// Scaled orientation\n\t\tconst glm::vec3 right = transform.getRight() * boundingVolume->extents.x;\n\t\tconst glm::vec3 up = transform.getUp() * boundingVolume->extents.y;\n\t\tconst glm::vec3 forward = transform.getForward() * boundingVolume->extents.z;\n\n\t\tconst float newIi = std::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 1.f, 0.f, 0.f }, forward));\n\n\t\tconst float newIj = std::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 1.f, 0.f }, forward));\n\n\t\tconst float newIk = std::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, right)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, up)) +\n\t\t\tstd::abs(glm::dot(glm::vec3{ 0.f, 0.f, 1.f }, forward));\n\n\t\treturn AABB(globalCenter, newIi, newIj, newIk);\n\t}\n\n\t//Add child. Argument input is argument of any constructor that you create. By default you can use the default constructor and don't put argument input.\n\ttemplate\n\tvoid addChild(TArgs&... args)\n\t{\n\t\tchildren.emplace_back(std::make_unique(args...));\n\t\tchildren.back()->parent = this;\n\t}\n\n\t//Update transform if it was changed\n\tvoid updateSelfAndChild()\n\t{\n\t\tif (transform.isDirty()) {\n\t\t\tforceUpdateSelfAndChild();\n\t\t\treturn;\n\t\t}\n\t\t\t\n\t\tfor (auto&& child : children)\n\t\t{\n\t\t\tchild->updateSelfAndChild();\n\t\t}\n\t}\n\n\t//Force update of transform even if local space don't change\n\tvoid forceUpdateSelfAndChild()\n\t{\n\t\tif (parent)\n\t\t\ttransform.computeModelMatrix(parent->transform.getModelMatrix());\n\t\telse\n\t\t\ttransform.computeModelMatrix();\n\n\t\tfor (auto&& child : children)\n\t\t{\n\t\t\tchild->forceUpdateSelfAndChild();\n\t\t}\n\t}\n\n\n\tvoid drawSelfAndChild(const Frustum& frustum, Shader& ourShader, unsigned int& display, unsigned int& total)\n\t{\n\t\tif (boundingVolume->isOnFrustum(frustum, transform))\n\t\t{\n\t\t\tourShader.setMat4(\"model\", transform.getModelMatrix());\n\t\t\tpModel->Draw(ourShader);\n\t\t\tdisplay++;\n\t\t}\n\t\ttotal++;\n\n\t\tfor (auto&& child : children)\n\t\t{\n\t\t\tchild->drawSelfAndChild(frustum, ourShader, display, total);\n\t\t}\n\t}\n};\n#endif\n"}, {"path": "includes/learnopengl/filesystem.h", "language": "code", "loc": 42, "comment_density": 0.071, "code": "#ifndef FILESYSTEM_H\n#define FILESYSTEM_H\n\n#include \n#include \n#include \"root_directory.h\" // This is a configuration file generated by CMake.\n\nclass FileSystem\n{\nprivate:\n typedef std::string (*Builder) (const std::string& path);\n\npublic:\n static std::string getPath(const std::string& path)\n {\n static std::string(*pathBuilder)(std::string const &) = getPathBuilder();\n return (*pathBuilder)(path);\n }\n\nprivate:\n static std::string const & getRoot()\n {\n static char const * envRoot = getenv(\"LOGL_ROOT_PATH\");\n static char const * givenRoot = (envRoot != nullptr ? envRoot : logl_root);\n static std::string root = (givenRoot != nullptr ? givenRoot : \"\");\n return root;\n }\n\n //static std::string(*foo (std::string const &)) getPathBuilder()\n static Builder getPathBuilder()\n {\n if (getRoot() != \"\")\n return &FileSystem::getPathRelativeRoot;\n else\n return &FileSystem::getPathRelativeBinary;\n }\n\n static std::string getPathRelativeRoot(const std::string& path)\n {\n return getRoot() + std::string(\"/\") + path;\n }\n\n static std::string getPathRelativeBinary(const std::string& path)\n {\n return \"../../../\" + path;\n }\n\n\n};\n\n// FILESYSTEM_H\n#endif\n"}, {"path": "includes/learnopengl/mesh.h", "language": "code", "loc": 126, "comment_density": 0.294, "code": "#ifndef MESH_H\n#define MESH_H\n\n#include // holds all OpenGL type declarations\n\n#include \n#include \n\n#include \n\n#include \n#include \nusing namespace std;\n\n#define MAX_BONE_INFLUENCE 4\n\nstruct Vertex {\n // position\n glm::vec3 Position;\n // normal\n glm::vec3 Normal;\n // texCoords\n glm::vec2 TexCoords;\n // tangent\n glm::vec3 Tangent;\n // bitangent\n glm::vec3 Bitangent;\n\t//bone indexes which will influence this vertex\n\tint m_BoneIDs[MAX_BONE_INFLUENCE];\n\t//weights from each bone\n\tfloat m_Weights[MAX_BONE_INFLUENCE];\n};\n\nstruct Texture {\n unsigned int id;\n string type;\n string path;\n};\n\nclass Mesh {\npublic:\n // mesh Data\n vector vertices;\n vector indices;\n vector textures;\n unsigned int VAO;\n\n // constructor\n Mesh(vector vertices, vector indices, vector textures)\n {\n this->vertices = vertices;\n this->indices = indices;\n this->textures = textures;\n\n // now that we have all the required data, set the vertex buffers and its attribute pointers.\n setupMesh();\n }\n\n // render the mesh\n void Draw(Shader &shader) \n {\n // bind appropriate textures\n unsigned int diffuseNr = 1;\n unsigned int specularNr = 1;\n unsigned int normalNr = 1;\n unsigned int heightNr = 1;\n for(unsigned int i = 0; i < textures.size(); i++)\n {\n glActiveTexture(GL_TEXTURE0 + i); // active proper texture unit before binding\n // retrieve texture number (the N in diffuse_textureN)\n string number;\n string name = textures[i].type;\n if(name == \"texture_diffuse\")\n number = std::to_string(diffuseNr++);\n else if(name == \"texture_specular\")\n number = std::to_string(specularNr++); // transfer unsigned int to string\n else if(name == \"texture_normal\")\n number = std::to_string(normalNr++); // transfer unsigned int to string\n else if(name == \"texture_height\")\n number = std::to_string(heightNr++); // transfer unsigned int to string\n\n // now set the sampler to the correct texture unit\n glUniform1i(glGetUniformLocation(shader.ID, (name + number).c_str()), i);\n // and finally bind the texture\n glBindTexture(GL_TEXTURE_2D, textures[i].id);\n }\n \n // draw mesh\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, static_cast(indices.size()), GL_UNSIGNED_INT, 0);\n glBindVertexArray(0);\n\n // always good practice to set everything back to defaults once configured.\n glActiveTexture(GL_TEXTURE0);\n }\n\nprivate:\n // render data \n unsigned int VBO, EBO;\n\n // initializes all the buffer objects/arrays\n void setupMesh()\n {\n // create buffers/arrays\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n // load data into vertex buffers\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // A great thing about structs is that their memory layout is sequential for all its items.\n // The effect is that we can simply pass a pointer to the struct and it translates perfectly to a glm::vec3/2 array which\n // again translates to 3/2 floats which translates to a byte array.\n glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), &vertices[0], GL_STATIC_DRAW); \n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);\n\n // set the vertex attribute pointers\n // vertex Positions\n glEnableVertexAttribArray(0);\t\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)0);\n // vertex normals\n glEnableVertexAttribArray(1);\t\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Normal));\n // vertex texture coords\n glEnableVertexAttribArray(2);\t\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, TexCoords));\n // vertex tangent\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Tangent));\n // vertex bitangent\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, Bitangent));\n\t\t// ids\n\t\tglEnableVertexAttribArray(5);\n\t\tglVertexAttribIPointer(5, 4, GL_INT, sizeof(Vertex), (void*)offsetof(Vertex, m_BoneIDs));\n\n\t\t// weights\n\t\tglEnableVertexAttribArray(6);\n\t\tglVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, m_Weights));\n glBindVertexArray(0);\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/model.h", "language": "code", "loc": 219, "comment_density": 0.21, "code": "#ifndef MODEL_H\n#define MODEL_H\n\n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nunsigned int TextureFromFile(const char *path, const string &directory, bool gamma = false);\n\nclass Model \n{\npublic:\n // model data \n vector textures_loaded;\t// stores all the textures loaded so far, optimization to make sure textures aren't loaded more than once.\n vector meshes;\n string directory;\n bool gammaCorrection;\n\n // constructor, expects a filepath to a 3D model.\n Model(string const &path, bool gamma = false) : gammaCorrection(gamma)\n {\n loadModel(path);\n }\n\n // draws the model, and thus all its meshes\n void Draw(Shader &shader)\n {\n for(unsigned int i = 0; i < meshes.size(); i++)\n meshes[i].Draw(shader);\n }\n \nprivate:\n // loads a model with supported ASSIMP extensions from file and stores the resulting meshes in the meshes vector.\n void loadModel(string const &path)\n {\n // read file via ASSIMP\n Assimp::Importer importer;\n const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_FlipUVs | aiProcess_CalcTangentSpace);\n // check for errors\n if(!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) // if is Not Zero\n {\n cout << \"ERROR::ASSIMP:: \" << importer.GetErrorString() << endl;\n return;\n }\n // retrieve the directory path of the filepath\n directory = path.substr(0, path.find_last_of('/'));\n\n // process ASSIMP's root node recursively\n processNode(scene->mRootNode, scene);\n }\n\n // processes a node in a recursive fashion. Processes each individual mesh located at the node and repeats this process on its children nodes (if any).\n void processNode(aiNode *node, const aiScene *scene)\n {\n // process each mesh located at the current node\n for(unsigned int i = 0; i < node->mNumMeshes; i++)\n {\n // the node object only contains indices to index the actual objects in the scene. \n // the scene contains all the data, node is just to keep stuff organized (like relations between nodes).\n aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];\n meshes.push_back(processMesh(mesh, scene));\n }\n // after we've processed all of the meshes (if any) we then recursively process each of the children nodes\n for(unsigned int i = 0; i < node->mNumChildren; i++)\n {\n processNode(node->mChildren[i], scene);\n }\n\n }\n\n Mesh processMesh(aiMesh *mesh, const aiScene *scene)\n {\n // data to fill\n vector vertices;\n vector indices;\n vector textures;\n\n // walk through each of the mesh's vertices\n for(unsigned int i = 0; i < mesh->mNumVertices; i++)\n {\n Vertex vertex;\n glm::vec3 vector; // we declare a placeholder vector since assimp uses its own vector class that doesn't directly convert to glm's vec3 class so we transfer the data to this placeholder glm::vec3 first.\n // positions\n vector.x = mesh->mVertices[i].x;\n vector.y = mesh->mVertices[i].y;\n vector.z = mesh->mVertices[i].z;\n vertex.Position = vector;\n // normals\n if (mesh->HasNormals())\n {\n vector.x = mesh->mNormals[i].x;\n vector.y = mesh->mNormals[i].y;\n vector.z = mesh->mNormals[i].z;\n vertex.Normal = vector;\n }\n // texture coordinates\n if(mesh->mTextureCoords[0]) // does the mesh contain texture coordinates?\n {\n glm::vec2 vec;\n // a vertex can contain up to 8 different texture coordinates. We thus make the assumption that we won't \n // use models where a vertex can have multiple texture coordinates so we always take the first set (0).\n vec.x = mesh->mTextureCoords[0][i].x; \n vec.y = mesh->mTextureCoords[0][i].y;\n vertex.TexCoords = vec;\n // tangent\n vector.x = mesh->mTangents[i].x;\n vector.y = mesh->mTangents[i].y;\n vector.z = mesh->mTangents[i].z;\n vertex.Tangent = vector;\n // bitangent\n vector.x = mesh->mBitangents[i].x;\n vector.y = mesh->mBitangents[i].y;\n vector.z = mesh->mBitangents[i].z;\n vertex.Bitangent = vector;\n }\n else\n vertex.TexCoords = glm::vec2(0.0f, 0.0f);\n\n vertices.push_back(vertex);\n }\n // now wak through each of the mesh's faces (a face is a mesh its triangle) and retrieve the corresponding vertex indices.\n for(unsigned int i = 0; i < mesh->mNumFaces; i++)\n {\n aiFace face = mesh->mFaces[i];\n // retrieve all indices of the face and store them in the indices vector\n for(unsigned int j = 0; j < face.mNumIndices; j++)\n indices.push_back(face.mIndices[j]); \n }\n // process materials\n aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex]; \n // we assume a convention for sampler names in the shaders. Each diffuse texture should be named\n // as 'texture_diffuseN' where N is a sequential number ranging from 1 to MAX_SAMPLER_NUMBER. \n // Same applies to other texture as the following list summarizes:\n // diffuse: texture_diffuseN\n // specular: texture_specularN\n // normal: texture_normalN\n\n // 1. diffuse maps\n vector diffuseMaps = loadMaterialTextures(material, aiTextureType_DIFFUSE, \"texture_diffuse\");\n textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());\n // 2. specular maps\n vector specularMaps = loadMaterialTextures(material, aiTextureType_SPECULAR, \"texture_specular\");\n textures.insert(textures.end(), specularMaps.begin(), specularMaps.end());\n // 3. normal maps\n std::vector normalMaps = loadMaterialTextures(material, aiTextureType_HEIGHT, \"texture_normal\");\n textures.insert(textures.end(), normalMaps.begin(), normalMaps.end());\n // 4. height maps\n std::vector heightMaps = loadMaterialTextures(material, aiTextureType_AMBIENT, \"texture_height\");\n textures.insert(textures.end(), heightMaps.begin(), heightMaps.end());\n \n // return a mesh object created from the extracted mesh data\n return Mesh(vertices, indices, textures);\n }\n\n // checks all material textures of a given type and loads the textures if they're not loaded yet.\n // the required info is returned as a Texture struct.\n vector loadMaterialTextures(aiMaterial *mat, aiTextureType type, string typeName)\n {\n vector textures;\n for(unsigned int i = 0; i < mat->GetTextureCount(type); i++)\n {\n aiString str;\n mat->GetTexture(type, i, &str);\n // check if texture was loaded before and if so, continue to next iteration: skip loading a new texture\n bool skip = false;\n for(unsigned int j = 0; j < textures_loaded.size(); j++)\n {\n if(std::strcmp(textures_loaded[j].path.data(), str.C_Str()) == 0)\n {\n textures.push_back(textures_loaded[j]);\n skip = true; // a texture with the same filepath has already been loaded, continue to next one. (optimization)\n break;\n }\n }\n if(!skip)\n { // if texture hasn't been loaded already, load it\n Texture texture;\n texture.id = TextureFromFile(str.C_Str(), this->directory);\n texture.type = typeName;\n texture.path = str.C_Str();\n textures.push_back(texture);\n textures_loaded.push_back(texture); // store it as texture loaded for entire model, to ensure we won't unnecessary load duplicate textures.\n }\n }\n return textures;\n }\n};\n\n\nunsigned int TextureFromFile(const char *path, const string &directory, bool gamma)\n{\n string filename = string(path);\n filename = directory + '/' + filename;\n\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(filename.c_str(), &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n#endif\n"}, {"path": "includes/learnopengl/model_animation.h", "language": "code", "loc": 238, "comment_density": 0.088, "code": "#ifndef MODEL_H\n#define MODEL_H\n\n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nclass Model \n{\npublic:\n // model data \n vector textures_loaded;\t// stores all the textures loaded so far, optimization to make sure textures aren't loaded more than once.\n vector meshes;\n string directory;\n bool gammaCorrection;\n\t\n\t\n\n // constructor, expects a filepath to a 3D model.\n Model(string const &path, bool gamma = false) : gammaCorrection(gamma)\n {\n loadModel(path);\n }\n\n // draws the model, and thus all its meshes\n void Draw(Shader &shader)\n {\n for(unsigned int i = 0; i < meshes.size(); i++)\n meshes[i].Draw(shader);\n }\n \n\tauto& GetBoneInfoMap() { return m_BoneInfoMap; }\n\tint& GetBoneCount() { return m_BoneCounter; }\n\t\n\nprivate:\n\n\tstd::map m_BoneInfoMap;\n\tint m_BoneCounter = 0;\n\n // loads a model with supported ASSIMP extensions from file and stores the resulting meshes in the meshes vector.\n void loadModel(string const &path)\n {\n // read file via ASSIMP\n Assimp::Importer importer;\n const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_CalcTangentSpace);\n // check for errors\n if(!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) // if is Not Zero\n {\n cout << \"ERROR::ASSIMP:: \" << importer.GetErrorString() << endl;\n return;\n }\n // retrieve the directory path of the filepath\n directory = path.substr(0, path.find_last_of('/'));\n\n // process ASSIMP's root node recursively\n processNode(scene->mRootNode, scene);\n }\n\n // processes a node in a recursive fashion. Processes each individual mesh located at the node and repeats this process on its children nodes (if any).\n void processNode(aiNode *node, const aiScene *scene)\n {\n // process each mesh located at the current node\n for(unsigned int i = 0; i < node->mNumMeshes; i++)\n {\n // the node object only contains indices to index the actual objects in the scene. \n // the scene contains all the data, node is just to keep stuff organized (like relations between nodes).\n aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];\n meshes.push_back(processMesh(mesh, scene));\n }\n // after we've processed all of the meshes (if any) we then recursively process each of the children nodes\n for(unsigned int i = 0; i < node->mNumChildren; i++)\n {\n processNode(node->mChildren[i], scene);\n }\n\n }\n\n\tvoid SetVertexBoneDataToDefault(Vertex& vertex)\n\t{\n\t\tfor (int i = 0; i < MAX_BONE_INFLUENCE; i++)\n\t\t{\n\t\t\tvertex.m_BoneIDs[i] = -1;\n\t\t\tvertex.m_Weights[i] = 0.0f;\n\t\t}\n\t}\n\n\n\tMesh processMesh(aiMesh* mesh, const aiScene* scene)\n\t{\n\t\tvector vertices;\n\t\tvector indices;\n\t\tvector textures;\n\n\t\tfor (unsigned int i = 0; i < mesh->mNumVertices; i++)\n\t\t{\n\t\t\tVertex vertex;\n\t\t\tSetVertexBoneDataToDefault(vertex);\n\t\t\tvertex.Position = AssimpGLMHelpers::GetGLMVec(mesh->mVertices[i]);\n\t\t\tvertex.Normal = AssimpGLMHelpers::GetGLMVec(mesh->mNormals[i]);\n\t\t\t\n\t\t\tif (mesh->mTextureCoords[0])\n\t\t\t{\n\t\t\t\tglm::vec2 vec;\n\t\t\t\tvec.x = mesh->mTextureCoords[0][i].x;\n\t\t\t\tvec.y = mesh->mTextureCoords[0][i].y;\n\t\t\t\tvertex.TexCoords = vec;\n\t\t\t}\n\t\t\telse\n\t\t\t\tvertex.TexCoords = glm::vec2(0.0f, 0.0f);\n\n\t\t\tvertices.push_back(vertex);\n\t\t}\n\t\tfor (unsigned int i = 0; i < mesh->mNumFaces; i++)\n\t\t{\n\t\t\taiFace face = mesh->mFaces[i];\n\t\t\tfor (unsigned int j = 0; j < face.mNumIndices; j++)\n\t\t\t\tindices.push_back(face.mIndices[j]);\n\t\t}\n\t\taiMaterial* material = scene->mMaterials[mesh->mMaterialIndex];\n\n\t\tvector diffuseMaps = loadMaterialTextures(material, aiTextureType_DIFFUSE, \"texture_diffuse\");\n\t\ttextures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());\n\t\tvector specularMaps = loadMaterialTextures(material, aiTextureType_SPECULAR, \"texture_specular\");\n\t\ttextures.insert(textures.end(), specularMaps.begin(), specularMaps.end());\n\t\tstd::vector normalMaps = loadMaterialTextures(material, aiTextureType_HEIGHT, \"texture_normal\");\n\t\ttextures.insert(textures.end(), normalMaps.begin(), normalMaps.end());\n\t\tstd::vector heightMaps = loadMaterialTextures(material, aiTextureType_AMBIENT, \"texture_height\");\n\t\ttextures.insert(textures.end(), heightMaps.begin(), heightMaps.end());\n\n\t\tExtractBoneWeightForVertices(vertices,mesh,scene);\n\n\t\treturn Mesh(vertices, indices, textures);\n\t}\n\n\tvoid SetVertexBoneData(Vertex& vertex, int boneID, float weight)\n\t{\n\t\tfor (int i = 0; i < MAX_BONE_INFLUENCE; ++i)\n\t\t{\n\t\t\tif (vertex.m_BoneIDs[i] < 0)\n\t\t\t{\n\t\t\t\tvertex.m_Weights[i] = weight;\n\t\t\t\tvertex.m_BoneIDs[i] = boneID;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\n\tvoid ExtractBoneWeightForVertices(std::vector& vertices, aiMesh* mesh, const aiScene* scene)\n\t{\n\t\tauto& boneInfoMap = m_BoneInfoMap;\n\t\tint& boneCount = m_BoneCounter;\n\n\t\tfor (int boneIndex = 0; boneIndex < mesh->mNumBones; ++boneIndex)\n\t\t{\n\t\t\tint boneID = -1;\n\t\t\tstd::string boneName = mesh->mBones[boneIndex]->mName.C_Str();\n\t\t\tif (boneInfoMap.find(boneName) == boneInfoMap.end())\n\t\t\t{\n\t\t\t\tBoneInfo newBoneInfo;\n\t\t\t\tnewBoneInfo.id = boneCount;\n\t\t\t\tnewBoneInfo.offset = AssimpGLMHelpers::ConvertMatrixToGLMFormat(mesh->mBones[boneIndex]->mOffsetMatrix);\n\t\t\t\tboneInfoMap[boneName] = newBoneInfo;\n\t\t\t\tboneID = boneCount;\n\t\t\t\tboneCount++;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tboneID = boneInfoMap[boneName].id;\n\t\t\t}\n\t\t\tassert(boneID != -1);\n\t\t\tauto weights = mesh->mBones[boneIndex]->mWeights;\n\t\t\tint numWeights = mesh->mBones[boneIndex]->mNumWeights;\n\n\t\t\tfor (int weightIndex = 0; weightIndex < numWeights; ++weightIndex)\n\t\t\t{\n\t\t\t\tint vertexId = weights[weightIndex].mVertexId;\n\t\t\t\tfloat weight = weights[weightIndex].mWeight;\n\t\t\t\tassert(vertexId <= vertices.size());\n\t\t\t\tSetVertexBoneData(vertices[vertexId], boneID, weight);\n\t\t\t}\n\t\t}\n\t}\n\n\n\tunsigned int TextureFromFile(const char* path, const string& directory, bool gamma = false)\n\t{\n\t\tstring filename = string(path);\n\t\tfilename = directory + '/' + filename;\n\n\t\tunsigned int textureID;\n\t\tglGenTextures(1, &textureID);\n\n\t\tint width, height, nrComponents;\n\t\tunsigned char* data = stbi_load(filename.c_str(), &width, &height, &nrComponents, 0);\n\t\tif (data)\n\t\t{\n\t\t\tGLenum format;\n\t\t\tif (nrComponents == 1)\n\t\t\t\tformat = GL_RED;\n\t\t\telse if (nrComponents == 3)\n\t\t\t\tformat = GL_RGB;\n\t\t\telse if (nrComponents == 4)\n\t\t\t\tformat = GL_RGBA;\n\n\t\t\tglBindTexture(GL_TEXTURE_2D, textureID);\n\t\t\tglTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n\t\t\tglGenerateMipmap(GL_TEXTURE_2D);\n\n\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n\t\t\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n\t\t\tstbi_image_free(data);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tstd::cout << \"Texture failed to load at path: \" << path << std::endl;\n\t\t\tstbi_image_free(data);\n\t\t}\n\n\t\treturn textureID;\n\t}\n \n // checks all material textures of a given type and loads the textures if they're not loaded yet.\n // the required info is returned as a Texture struct.\n vector loadMaterialTextures(aiMaterial *mat, aiTextureType type, string typeName)\n {\n vector textures;\n for(unsigned int i = 0; i < mat->GetTextureCount(type); i++)\n {\n aiString str;\n mat->GetTexture(type, i, &str);\n // check if texture was loaded before and if so, continue to next iteration: skip loading a new texture\n bool skip = false;\n for(unsigned int j = 0; j < textures_loaded.size(); j++)\n {\n if(std::strcmp(textures_loaded[j].path.data(), str.C_Str()) == 0)\n {\n textures.push_back(textures_loaded[j]);\n skip = true; // a texture with the same filepath has already been loaded, continue to next one. (optimization)\n break;\n }\n }\n if(!skip)\n { // if texture hasn't been loaded already, load it\n Texture texture;\n texture.id = TextureFromFile(str.C_Str(), this->directory);\n texture.type = typeName;\n texture.path = str.C_Str();\n textures.push_back(texture);\n textures_loaded.push_back(texture); // store it as texture loaded for entire model, to ensure we won't unnecessary load duplicate textures.\n }\n }\n return textures;\n }\n};\n\n\n\n#endif\n"}, {"path": "includes/learnopengl/shader.h", "language": "code", "loc": 186, "comment_density": 0.156, "code": "#ifndef SHADER_H\n#define SHADER_H\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nclass Shader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n Shader(const char* vertexPath, const char* fragmentPath, const char* geometryPath = nullptr)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::string geometryCode;\n std::ifstream vShaderFile;\n std::ifstream fShaderFile;\n std::ifstream gShaderFile;\n // ensure ifstream objects can throw exceptions:\n vShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n fShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n gShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n try \n {\n // open files\n vShaderFile.open(vertexPath);\n fShaderFile.open(fragmentPath);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vShaderFile.rdbuf();\n fShaderStream << fShaderFile.rdbuf();\t\t\n // close file handlers\n vShaderFile.close();\n fShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\t\t\t\n // if geometry shader path is present, also load a geometry shader\n if(geometryPath != nullptr)\n {\n gShaderFile.open(geometryPath);\n std::stringstream gShaderStream;\n gShaderStream << gShaderFile.rdbuf();\n gShaderFile.close();\n geometryCode = gShaderStream.str();\n }\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" << e.what() << std::endl;\n }\n const char* vShaderCode = vertexCode.c_str();\n const char * fShaderCode = fragmentCode.c_str();\n // 2. compile shaders\n unsigned int vertex, fragment;\n // vertex shader\n vertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertex, 1, &vShaderCode, NULL);\n glCompileShader(vertex);\n checkCompileErrors(vertex, \"VERTEX\");\n // fragment Shader\n fragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragment, 1, &fShaderCode, NULL);\n glCompileShader(fragment);\n checkCompileErrors(fragment, \"FRAGMENT\");\n // if geometry shader is given, compile geometry shader\n unsigned int geometry;\n if(geometryPath != nullptr)\n {\n const char * gShaderCode = geometryCode.c_str();\n geometry = glCreateShader(GL_GEOMETRY_SHADER);\n glShaderSource(geometry, 1, &gShaderCode, NULL);\n glCompileShader(geometry);\n checkCompileErrors(geometry, \"GEOMETRY\");\n }\n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, vertex);\n glAttachShader(ID, fragment);\n if(geometryPath != nullptr)\n glAttachShader(ID, geometry);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(vertex);\n glDeleteShader(fragment);\n if(geometryPath != nullptr)\n glDeleteShader(geometry);\n\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use() \n { \n glUseProgram(ID); \n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); \n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n { \n glUniform1f(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setVec2(const std::string &name, const glm::vec2 &value) const\n { \n glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec2(const std::string &name, float x, float y) const\n { \n glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y); \n }\n // ------------------------------------------------------------------------\n void setVec3(const std::string &name, const glm::vec3 &value) const\n { \n glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec3(const std::string &name, float x, float y, float z) const\n { \n glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z); \n }\n // ------------------------------------------------------------------------\n void setVec4(const std::string &name, const glm::vec4 &value) const\n { \n glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec4(const std::string &name, float x, float y, float z, float w) \n { \n glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w); \n }\n // ------------------------------------------------------------------------\n void setMat2(const std::string &name, const glm::mat2 &mat) const\n {\n glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat3(const std::string &name, const glm::mat3 &mat) const\n {\n glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat4(const std::string &name, const glm::mat4 &mat) const\n {\n glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(GLuint shader, std::string type)\n {\n GLint success;\n GLchar infoLog[1024];\n if(type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if(!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if(!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/shader_c.h", "language": "code", "loc": 145, "comment_density": 0.179, "code": "#ifndef COMPUTE_SHADER_H\n#define COMPUTE_SHADER_H\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nclass ComputeShader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n ComputeShader(const char* computePath)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string computeCode;\n std::ifstream cShaderFile;\n // ensure ifstream objects can throw exceptions:\n cShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);\n try\n {\n // open files\n cShaderFile.open(computePath);\n\n std::stringstream cShaderStream;\n // read file's buffer contents into streams\n cShaderStream << cShaderFile.rdbuf();\n // close file handlers\n cShaderFile.close();\n // convert stream into string\n computeCode = cShaderStream.str();\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" << e.what() << std::endl;\n }\n const char* cShaderCode = computeCode.c_str();\n // 2. compile shaders\n unsigned int compute;\n // compute shader\n compute = glCreateShader(GL_COMPUTE_SHADER);\n glShaderSource(compute, 1, &cShaderCode, NULL);\n glCompileShader(compute);\n checkCompileErrors(compute, \"COMPUTE\");\n \n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, compute);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(compute);\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use() \n { \n glUseProgram(ID); \n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); \n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n { \n glUniform1f(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setVec2(const std::string &name, const glm::vec2 &value) const\n { \n glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec2(const std::string &name, float x, float y) const\n { \n glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y); \n }\n // ------------------------------------------------------------------------\n void setVec3(const std::string &name, const glm::vec3 &value) const\n { \n glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec3(const std::string &name, float x, float y, float z) const\n { \n glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z); \n }\n // ------------------------------------------------------------------------\n void setVec4(const std::string &name, const glm::vec4 &value) const\n { \n glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec4(const std::string &name, float x, float y, float z, float w) \n { \n glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w); \n }\n // ------------------------------------------------------------------------\n void setMat2(const std::string &name, const glm::mat2 &mat) const\n {\n glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat3(const std::string &name, const glm::mat3 &mat) const\n {\n glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat4(const std::string &name, const glm::mat4 &mat) const\n {\n glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(GLuint shader, std::string type)\n {\n GLint success;\n GLchar infoLog[1024];\n if(type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if(!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if(!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif"}, {"path": "includes/learnopengl/shader_m.h", "language": "code", "loc": 160, "comment_density": 0.169, "code": "#ifndef SHADER_H\n#define SHADER_H\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nclass Shader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n Shader(const char* vertexPath, const char* fragmentPath)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::ifstream vShaderFile;\n std::ifstream fShaderFile;\n // ensure ifstream objects can throw exceptions:\n vShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n fShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n try \n {\n // open files\n vShaderFile.open(vertexPath);\n fShaderFile.open(fragmentPath);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vShaderFile.rdbuf();\n fShaderStream << fShaderFile.rdbuf();\t\t\n // close file handlers\n vShaderFile.close();\n fShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\t\t\t\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" << e.what() << std::endl;\n }\n const char* vShaderCode = vertexCode.c_str();\n const char * fShaderCode = fragmentCode.c_str();\n // 2. compile shaders\n unsigned int vertex, fragment;\n // vertex shader\n vertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertex, 1, &vShaderCode, NULL);\n glCompileShader(vertex);\n checkCompileErrors(vertex, \"VERTEX\");\n // fragment Shader\n fragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragment, 1, &fShaderCode, NULL);\n glCompileShader(fragment);\n checkCompileErrors(fragment, \"FRAGMENT\");\n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, vertex);\n glAttachShader(ID, fragment);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(vertex);\n glDeleteShader(fragment);\n\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use() const\n { \n glUseProgram(ID); \n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); \n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n { \n glUniform1f(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setVec2(const std::string &name, const glm::vec2 &value) const\n { \n glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec2(const std::string &name, float x, float y) const\n { \n glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y); \n }\n // ------------------------------------------------------------------------\n void setVec3(const std::string &name, const glm::vec3 &value) const\n { \n glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec3(const std::string &name, float x, float y, float z) const\n { \n glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z); \n }\n // ------------------------------------------------------------------------\n void setVec4(const std::string &name, const glm::vec4 &value) const\n { \n glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]); \n }\n void setVec4(const std::string &name, float x, float y, float z, float w) const\n { \n glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w); \n }\n // ------------------------------------------------------------------------\n void setMat2(const std::string &name, const glm::mat2 &mat) const\n {\n glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat3(const std::string &name, const glm::mat3 &mat) const\n {\n glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat4(const std::string &name, const glm::mat4 &mat) const\n {\n glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(GLuint shader, std::string type)\n {\n GLint success;\n GLchar infoLog[1024];\n if (type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if (!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/shader_s.h", "language": "code", "loc": 117, "comment_density": 0.179, "code": "#ifndef SHADER_H\n#define SHADER_H\n\n#include \n\n#include \n#include \n#include \n#include \n\nclass Shader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n Shader(const char* vertexPath, const char* fragmentPath)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::ifstream vShaderFile;\n std::ifstream fShaderFile;\n // ensure ifstream objects can throw exceptions:\n vShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n fShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n try \n {\n // open files\n vShaderFile.open(vertexPath);\n fShaderFile.open(fragmentPath);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vShaderFile.rdbuf();\n fShaderStream << fShaderFile.rdbuf();\n // close file handlers\n vShaderFile.close();\n fShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" << e.what() << std::endl;\n }\n const char* vShaderCode = vertexCode.c_str();\n const char * fShaderCode = fragmentCode.c_str();\n // 2. compile shaders\n unsigned int vertex, fragment;\n // vertex shader\n vertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertex, 1, &vShaderCode, NULL);\n glCompileShader(vertex);\n checkCompileErrors(vertex, \"VERTEX\");\n // fragment Shader\n fragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragment, 1, &fShaderCode, NULL);\n glCompileShader(fragment);\n checkCompileErrors(fragment, \"FRAGMENT\");\n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, vertex);\n glAttachShader(ID, fragment);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(vertex);\n glDeleteShader(fragment);\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use() \n { \n glUseProgram(ID); \n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value); \n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n { \n glUniform1i(glGetUniformLocation(ID, name.c_str()), value); \n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n { \n glUniform1f(glGetUniformLocation(ID, name.c_str()), value); \n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(unsigned int shader, std::string type)\n {\n int success;\n char infoLog[1024];\n if (type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if (!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif\n"}, {"path": "includes/learnopengl/shader_t.h", "language": "code", "loc": 231, "comment_density": 0.13, "code": "#ifndef SHADER_H\n#define SHADER_H\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nclass Shader\n{\npublic:\n unsigned int ID;\n // constructor generates the shader on the fly\n // ------------------------------------------------------------------------\n Shader(const char* vertexPath, const char* fragmentPath, const char* geometryPath = nullptr,\n const char* tessControlPath = nullptr, const char* tessEvalPath = nullptr)\n {\n // 1. retrieve the vertex/fragment source code from filePath\n std::string vertexCode;\n std::string fragmentCode;\n std::string geometryCode;\n std::string tessControlCode;\n std::string tessEvalCode;\n std::ifstream vShaderFile;\n std::ifstream fShaderFile;\n std::ifstream gShaderFile;\n std::ifstream tcShaderFile;\n std::ifstream teShaderFile;\n // ensure ifstream objects can throw exceptions:\n vShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n fShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n gShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n tcShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n teShaderFile.exceptions (std::ifstream::failbit | std::ifstream::badbit);\n try\n {\n // open files\n vShaderFile.open(vertexPath);\n fShaderFile.open(fragmentPath);\n std::stringstream vShaderStream, fShaderStream;\n // read file's buffer contents into streams\n vShaderStream << vShaderFile.rdbuf();\n fShaderStream << fShaderFile.rdbuf();\n // close file handlers\n vShaderFile.close();\n fShaderFile.close();\n // convert stream into string\n vertexCode = vShaderStream.str();\n fragmentCode = fShaderStream.str();\n // if geometry shader path is present, also load a geometry shader\n if(geometryPath != nullptr)\n {\n gShaderFile.open(geometryPath);\n std::stringstream gShaderStream;\n gShaderStream << gShaderFile.rdbuf();\n gShaderFile.close();\n geometryCode = gShaderStream.str();\n }\n if(tessControlPath != nullptr) {\n tcShaderFile.open(tessControlPath);\n std::stringstream tcShaderStream;\n tcShaderStream << tcShaderFile.rdbuf();\n tcShaderFile.close();\n tessControlCode = tcShaderStream.str();\n }\n if(tessEvalPath != nullptr) {\n teShaderFile.open(tessEvalPath);\n std::stringstream teShaderStream;\n teShaderStream << teShaderFile.rdbuf();\n teShaderFile.close();\n tessEvalCode = teShaderStream.str();\n }\n }\n catch (std::ifstream::failure& e)\n {\n std::cout << \"ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ: \" \n << e.what() << std::endl;\n }\n const char* vShaderCode = vertexCode.c_str();\n const char * fShaderCode = fragmentCode.c_str();\n // 2. compile shaders\n unsigned int vertex, fragment;\n // vertex shader\n vertex = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertex, 1, &vShaderCode, NULL);\n glCompileShader(vertex);\n checkCompileErrors(vertex, \"VERTEX\");\n // fragment Shader\n fragment = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragment, 1, &fShaderCode, NULL);\n glCompileShader(fragment);\n checkCompileErrors(fragment, \"FRAGMENT\");\n // if geometry shader is given, compile geometry shader\n unsigned int geometry;\n if(geometryPath != nullptr)\n {\n const char * gShaderCode = geometryCode.c_str();\n geometry = glCreateShader(GL_GEOMETRY_SHADER);\n glShaderSource(geometry, 1, &gShaderCode, NULL);\n glCompileShader(geometry);\n checkCompileErrors(geometry, \"GEOMETRY\");\n }\n // if tessellation shader is given, compile tessellation shader\n unsigned int tessControl;\n if(tessControlPath != nullptr)\n {\n const char * tcShaderCode = tessControlCode.c_str();\n tessControl = glCreateShader(GL_TESS_CONTROL_SHADER);\n glShaderSource(tessControl, 1, &tcShaderCode, NULL);\n glCompileShader(tessControl);\n checkCompileErrors(tessControl, \"TESS_CONTROL\");\n }\n unsigned int tessEval;\n if(tessEvalPath != nullptr)\n {\n const char * teShaderCode = tessEvalCode.c_str();\n tessEval = glCreateShader(GL_TESS_EVALUATION_SHADER);\n glShaderSource(tessEval, 1, &teShaderCode, NULL);\n glCompileShader(tessEval);\n checkCompileErrors(tessEval, \"TESS_EVALUATION\");\n }\n // shader Program\n ID = glCreateProgram();\n glAttachShader(ID, vertex);\n glAttachShader(ID, fragment);\n if(geometryPath != nullptr)\n glAttachShader(ID, geometry);\n if(tessControlPath != nullptr)\n glAttachShader(ID, tessControl);\n if(tessEvalPath != nullptr)\n glAttachShader(ID, tessEval);\n glLinkProgram(ID);\n checkCompileErrors(ID, \"PROGRAM\");\n // delete the shaders as they're linked into our program now and no longer necessary\n glDeleteShader(vertex);\n glDeleteShader(fragment);\n if(geometryPath != nullptr)\n glDeleteShader(geometry);\n\n }\n // activate the shader\n // ------------------------------------------------------------------------\n void use()\n {\n glUseProgram(ID);\n }\n // utility uniform functions\n // ------------------------------------------------------------------------\n void setBool(const std::string &name, bool value) const\n {\n glUniform1i(glGetUniformLocation(ID, name.c_str()), (int)value);\n }\n // ------------------------------------------------------------------------\n void setInt(const std::string &name, int value) const\n {\n glUniform1i(glGetUniformLocation(ID, name.c_str()), value);\n }\n // ------------------------------------------------------------------------\n void setFloat(const std::string &name, float value) const\n {\n glUniform1f(glGetUniformLocation(ID, name.c_str()), value);\n }\n // ------------------------------------------------------------------------\n void setVec2(const std::string &name, const glm::vec2 &value) const\n {\n glUniform2fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]);\n }\n void setVec2(const std::string &name, float x, float y) const\n {\n glUniform2f(glGetUniformLocation(ID, name.c_str()), x, y);\n }\n // ------------------------------------------------------------------------\n void setVec3(const std::string &name, const glm::vec3 &value) const\n {\n glUniform3fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]);\n }\n void setVec3(const std::string &name, float x, float y, float z) const\n {\n glUniform3f(glGetUniformLocation(ID, name.c_str()), x, y, z);\n }\n // ------------------------------------------------------------------------\n void setVec4(const std::string &name, const glm::vec4 &value) const\n {\n glUniform4fv(glGetUniformLocation(ID, name.c_str()), 1, &value[0]);\n }\n void setVec4(const std::string &name, float x, float y, float z, float w)\n {\n glUniform4f(glGetUniformLocation(ID, name.c_str()), x, y, z, w);\n }\n // ------------------------------------------------------------------------\n void setMat2(const std::string &name, const glm::mat2 &mat) const\n {\n glUniformMatrix2fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat3(const std::string &name, const glm::mat3 &mat) const\n {\n glUniformMatrix3fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n // ------------------------------------------------------------------------\n void setMat4(const std::string &name, const glm::mat4 &mat) const\n {\n glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, &mat[0][0]);\n }\n\nprivate:\n // utility function for checking shader compilation/linking errors.\n // ------------------------------------------------------------------------\n void checkCompileErrors(GLuint shader, std::string type)\n {\n GLint success;\n GLchar infoLog[1024];\n if(type != \"PROGRAM\")\n {\n glGetShaderiv(shader, GL_COMPILE_STATUS, &success);\n if(!success)\n {\n glGetShaderInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::SHADER_COMPILATION_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n else\n {\n glGetProgramiv(shader, GL_LINK_STATUS, &success);\n if(!success)\n {\n glGetProgramInfoLog(shader, 1024, NULL, infoLog);\n std::cout << \"ERROR::PROGRAM_LINKING_ERROR of type: \" << type << \"\\n\" << infoLog << \"\\n -- --------------------------------------------------- -- \" << std::endl;\n }\n }\n }\n};\n#endif\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.124, "dedup_hash": "9174da8610873c2a", "has_readme": true} +{"id": "joeydevries_learnopengl_src", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "Src", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/glad.c", "language": "code", "loc": 2474, "comment_density": 0.008, "code": "/*\n\n OpenGL loader generated by glad 0.1.13a0 on Sun Apr 2 14:54:18 2017.\n\n Language/Generator: C/C++\n Specification: gl\n APIs: gl=4.5\n Profile: compatibility\n Extensions:\n GL_KHR_debug\n Loader: True\n Local files: False\n Omit khrplatform: False\n\n Commandline:\n --profile=\"compatibility\" --api=\"gl=4.5\" --generator=\"c\" --spec=\"gl\" --extensions=\"GL_KHR_debug\"\n Online:\n http://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.5&extensions=GL_KHR_debug\n*/\n\n#include \n#include \n#include \n#include \n\nstatic void* get_proc(const char *namez);\n\n#ifdef _WIN32\n#include \nstatic HMODULE libGL;\n\ntypedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);\nPFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;\n\nstatic\nint open_gl(void) {\n libGL = LoadLibraryW(L\"opengl32.dll\");\n if(libGL != NULL) {\n gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress(\n libGL, \"wglGetProcAddress\");\n return gladGetProcAddressPtr != NULL;\n }\n\n return 0;\n}\n\nstatic\nvoid close_gl(void) {\n if(libGL != NULL) {\n FreeLibrary(libGL);\n libGL = NULL;\n }\n}\n#else\n#include \nstatic void* libGL;\n\n#ifndef __APPLE__\ntypedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);\nPFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;\n#endif\n\nstatic\nint open_gl(void) {\n#ifdef __APPLE__\n static const char *NAMES[] = {\n \"../Frameworks/OpenGL.framework/OpenGL\",\n \"/Library/Frameworks/OpenGL.framework/OpenGL\",\n \"/System/Library/Frameworks/OpenGL.framework/OpenGL\",\n \"/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL\"\n };\n#else\n static const char *NAMES[] = {\"libGL.so.1\", \"libGL.so\"};\n#endif\n\n unsigned int index = 0;\n for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) {\n libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);\n\n if(libGL != NULL) {\n#ifdef __APPLE__\n return 1;\n#else\n gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,\n \"glXGetProcAddressARB\");\n return gladGetProcAddressPtr != NULL;\n#endif\n }\n }\n\n return 0;\n}\n\nstatic\nvoid close_gl() {\n if(libGL != NULL) {\n dlclose(libGL);\n libGL = NULL;\n }\n}\n#endif\n\nstatic\nvoid* get_proc(const char *namez) {\n void* result = NULL;\n if(libGL == NULL) return NULL;\n\n#ifndef __APPLE__\n if(gladGetProcAddressPtr != NULL) {\n result = gladGetProcAddressPtr(namez);\n }\n#endif\n if(result == NULL) {\n#ifdef _WIN32\n result = (void*)GetProcAddress(libGL, namez);\n#else\n result = dlsym(libGL, namez);\n#endif\n }\n\n return result;\n}\n\nint gladLoadGL(void) {\n int status = 0;\n\n if(open_gl()) {\n status = gladLoadGLLoader(&get_proc);\n close_gl();\n }\n\n return status;\n}\n\nstruct gladGLversionStruct GLVersion;\n\n#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)\n#define _GLAD_IS_SOME_NEW_VERSION 1\n#endif\n\nstatic int max_loaded_major;\nstatic int max_loaded_minor;\n\nstatic const char *exts = NULL;\nstatic int num_exts_i = 0;\nstatic const char **exts_i = NULL;\n\nstatic int get_exts(void) {\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n if(max_loaded_major < 3) {\n#endif\n exts = (const char *)glGetString(GL_EXTENSIONS);\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n } else {\n int index;\n\n num_exts_i = 0;\n glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);\n if (num_exts_i > 0) {\n exts_i = (const char **)realloc((void *)exts_i, num_exts_i * sizeof *exts_i);\n }\n\n if (exts_i == NULL) {\n return 0;\n }\n\n for(index = 0; index < num_exts_i; index++) {\n exts_i[index] = (const char*)glGetStringi(GL_EXTENSIONS, index);\n }\n }\n#endif\n return 1;\n}\n\nstatic void free_exts(void) {\n if (exts_i != NULL) {\n free((char **)exts_i);\n exts_i = NULL;\n }\n}\n\nstatic int has_ext(const char *ext) {\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n if(max_loaded_major < 3) {\n#endif\n const char *extensions;\n const char *loc;\n const char *terminator;\n extensions = exts;\n if(extensions == NULL || ext == NULL) {\n return 0;\n }\n\n while(1) {\n loc = strstr(extensions, ext);\n if(loc == NULL) {\n return 0;\n }\n\n terminator = loc + strlen(ext);\n if((loc == extensions || *(loc - 1) == ' ') &&\n (*terminator == ' ' || *terminator == '\\0')) {\n return 1;\n }\n extensions = terminator;\n }\n#ifdef _GLAD_IS_SOME_NEW_VERSION\n } else {\n int index;\n\n for(index = 0; index < num_exts_i; index++) {\n const char *e = exts_i[index];\n\n if(strcmp(e, ext) == 0) {\n return 1;\n }\n }\n }\n#endif\n\n return 0;\n}\nint GLAD_GL_VERSION_1_0;\nint GLAD_GL_VERSION_1_1;\nint GLAD_GL_VERSION_1_2;\nint GLAD_GL_VERSION_1_3;\nint GLAD_GL_VERSION_1_4;\nint GLAD_GL_VERSION_1_5;\nint GLAD_GL_VERSION_2_0;\nint GLAD_GL_VERSION_2_1;\nint GLAD_GL_VERSION_3_0;\nint GLAD_GL_VERSION_3_1;\nint GLAD_GL_VERSION_3_2;\nint GLAD_GL_VERSION_3_3;\nint GLAD_GL_VERSION_4_0;\nint GLAD_GL_VERSION_4_1;\nint GLAD_GL_VERSION_4_2;\nint GLAD_GL_VERSION_4_3;\nint GLAD_GL_VERSION_4_4;\nint GLAD_GL_VERSION_4_5;\nPFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D;\nPFNGLTEXTUREPARAMETERFPROC glad_glTextureParameterf;\nPFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui;\nPFNGLVERTEXARRAYELEMENTBUFFERPROC glad_glVertexArrayElementBuffer;\nPFNGLWINDOWPOS2SPROC glad_glWindowPos2s;\nPFNGLTEXTURESTORAGE3DMULTISAMPLEPROC glad_glTextureStorage3DMultisample;\nPFNGLTEXTUREPARAMETERFVPROC glad_glTextureParameterfv;\nPFNGLWINDOWPOS2IPROC glad_glWindowPos2i;\nPFNGLWINDOWPOS2FPROC glad_glWindowPos2f;\nPFNGLWINDOWPOS2DPROC glad_glWindowPos2d;\nPFNGLVERTEX2FVPROC glad_glVertex2fv;\nPFNGLINDEXIPROC glad_glIndexi;\nPFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer;\nPFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv;\nPFNGLRECTDVPROC glad_glRectdv;\nPFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D;\nPFNGLEVALCOORD2DPROC glad_glEvalCoord2d;\nPFNGLEVALCOORD2FPROC glad_glEvalCoord2f;\nPFNGLGETDOUBLEI_VPROC glad_glGetDoublei_v;\nPFNGLINDEXDPROC glad_glIndexd;\nPFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv;\nPFNGLINDEXFPROC glad_glIndexf;\nPFNGLBINDSAMPLERPROC glad_glBindSampler;\nPFNGLLINEWIDTHPROC glad_glLineWidth;\nPFNGLCOLORP3UIVPROC glad_glColorP3uiv;\nPFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v;\nPFNGLGETMAPFVPROC glad_glGetMapfv;\nPFNGLINDEXSPROC glad_glIndexs;\nPFNGLCOMPILESHADERPROC glad_glCompileShader;\nPFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying;\nPFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv;\nPFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC glad_glDrawTransformFeedbackStreamInstanced;\nPFNGLINDEXFVPROC glad_glIndexfv;\nPFNGLGETCOMPRESSEDTEXTUREIMAGEPROC glad_glGetCompressedTextureImage;\nPFNGLGETNMAPFVPROC glad_glGetnMapfv;\nPFNGLFOGIVPROC glad_glFogiv;\nPFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate;\nPFNGLRASTERPOS2FVPROC glad_glRasterPos2fv;\nPFNGLLIGHTMODELIVPROC glad_glLightModeliv;\nPFNGLDEPTHRANGEFPROC glad_glDepthRangef;\nPFNGLCOLOR4UIPROC glad_glColor4ui;\nPFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv;\nPFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui;\nPFNGLMEMORYBARRIERBYREGIONPROC glad_glMemoryBarrierByRegion;\nPFNGLGETNAMEDBUFFERPARAMETERIVPROC glad_glGetNamedBufferParameteriv;\nPFNGLFOGFVPROC glad_glFogfv;\nPFNGLVERTEXP4UIPROC glad_glVertexP4ui;\nPFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC glad_glDrawElementsInstancedBaseInstance;\nPFNGLENABLEIPROC glad_glEnablei;\nPFNGLPROGRAMUNIFORM3DVPROC glad_glProgramUniform3dv;\nPFNGLVERTEX4IVPROC glad_glVertex4iv;\nPFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv;\nPFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv;\nPFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui;\nPFNGLCREATESHADERPROC glad_glCreateShader;\nPFNGLISBUFFERPROC glad_glIsBuffer;\nPFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv;\nPFNGLPROGRAMUNIFORMMATRIX2DVPROC glad_glProgramUniformMatrix2dv;\nPFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers;\nPFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D;\nPFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D;\nPFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f;\nPFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate;\nPFNGLVERTEX4FVPROC glad_glVertex4fv;\nPFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading;\nPFNGLCLEARNAMEDFRAMEBUFFERFIPROC glad_glClearNamedFramebufferfi;\nPFNGLGETQUERYBUFFEROBJECTUIVPROC glad_glGetQueryBufferObjectuiv;\nPFNGLBINDTEXTUREPROC glad_glBindTexture;\nPFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s;\nPFNGLTEXCOORD2FVPROC glad_glTexCoord2fv;\nPFNGLSAMPLEMASKIPROC glad_glSampleMaski;\nPFNGLVERTEXP2UIPROC glad_glVertexP2ui;\nPFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex;\nPFNGLTEXCOORD4FVPROC glad_glTexCoord4fv;\nPFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv;\nPFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl;\nPFNGLPOINTSIZEPROC glad_glPointSize;\nPFNGLBINDTEXTUREUNITPROC glad_glBindTextureUnit;\nPFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv;\nPFNGLDELETEPROGRAMPROC glad_glDeleteProgram;\nPFNGLCOLOR4BVPROC glad_glColor4bv;\nPFNGLRASTERPOS2FPROC glad_glRasterPos2f;\nPFNGLRASTERPOS2DPROC glad_glRasterPos2d;\nPFNGLLOADIDENTITYPROC glad_glLoadIdentity;\nPFNGLRASTERPOS2IPROC glad_glRasterPos2i;\nPFNGLMULTIDRAWARRAYSINDIRECTPROC glad_glMultiDrawArraysIndirect;\nPFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage;\nPFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv;\nPFNGLCOLOR3BPROC glad_glColor3b;\nPFNGLCLEARBUFFERFVPROC glad_glClearBufferfv;\nPFNGLEDGEFLAGPROC glad_glEdgeFlag;\nPFNGLDELETESAMPLERSPROC glad_glDeleteSamplers;\nPFNGLVERTEX3DPROC glad_glVertex3d;\nPFNGLVERTEX3FPROC glad_glVertex3f;\nPFNGLGETNMAPIVPROC glad_glGetnMapiv;\nPFNGLVERTEX3IPROC glad_glVertex3i;\nPFNGLCOLOR3IPROC glad_glColor3i;\nPFNGLUNIFORM3DPROC glad_glUniform3d;\nPFNGLUNIFORM3FPROC glad_glUniform3f;\nPFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv;\nPFNGLCOLOR3SPROC glad_glColor3s;\nPFNGLVERTEX3SPROC glad_glVertex3s;\nPFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui;\nPFNGLCOLORMASKIPROC glad_glColorMaski;\nPFNGLCLEARBUFFERFIPROC glad_glClearBufferfi;\nPFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect;\nPFNGLTEXCOORD1IVPROC glad_glTexCoord1iv;\nPFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer;\nPFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback;\nPFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui;\nPFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glad_glProgramUniformMatrix3x2dv;\nPFNGLCOPYNAMEDBUFFERSUBDATAPROC glad_glCopyNamedBufferSubData;\nPFNGLNAMEDFRAMEBUFFERTEXTUREPROC glad_glNamedFramebufferTexture;\nPFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glad_glProgramUniformMatrix3x2fv;\nPFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv;\nPFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex;\nPFNGLVERTEXATTRIBL4DPROC glad_glVertexAttribL4d;\nPFNGLBINDIMAGETEXTUREPROC glad_glBindImageTexture;\nPFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f;\nPFNGLPROGRAMUNIFORMMATRIX4FVPROC glad_glProgramUniformMatrix4fv;\nPFNGLVERTEX2IVPROC glad_glVertex2iv;\nPFNGLGETQUERYBUFFEROBJECTI64VPROC glad_glGetQueryBufferObjecti64v;\nPFNGLCOLOR3SVPROC glad_glColor3sv;\nPFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv;\nPFNGLACTIVESHADERPROGRAMPROC glad_glActiveShaderProgram;\nPFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv;\nPFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv;\nPFNGLNORMALPOINTERPROC glad_glNormalPointer;\nPFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv;\nPFNGLVERTEX4SVPROC glad_glVertex4sv;\nPFNGLVERTEXARRAYATTRIBLFORMATPROC glad_glVertexArrayAttribLFormat;\nPFNGLINVALIDATEBUFFERSUBDATAPROC glad_glInvalidateBufferSubData;\nPFNGLPASSTHROUGHPROC glad_glPassThrough;\nPFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui;\nPFNGLFOGIPROC glad_glFogi;\nPFNGLBEGINPROC glad_glBegin;\nPFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv;\nPFNGLCOLOR3UBVPROC glad_glColor3ubv;\nPFNGLVERTEXPOINTERPROC glad_glVertexPointer;\nPFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv;\nPFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers;\nPFNGLDRAWARRAYSPROC glad_glDrawArrays;\nPFNGLUNIFORM1UIPROC glad_glUniform1ui;\nPFNGLGETTRANSFORMFEEDBACKIVPROC glad_glGetTransformFeedbackiv;\nPFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d;\nPFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f;\nPFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri;\nPFNGLLIGHTFVPROC glad_glLightfv;\nPFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui;\nPFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d;\nPFNGLCLEARPROC glad_glClear;\nPFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i;\nPFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName;\nPFNGLMEMORYBARRIERPROC glad_glMemoryBarrier;\nPFNGLGETGRAPHICSRESETSTATUSPROC glad_glGetGraphicsResetStatus;\nPFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s;\nPFNGLISENABLEDPROC glad_glIsEnabled;\nPFNGLSTENCILOPPROC glad_glStencilOp;\nPFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv;\nPFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D;\nPFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv;\nPFNGLTRANSLATEFPROC glad_glTranslatef;\nPFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub;\nPFNGLTRANSLATEDPROC glad_glTranslated;\nPFNGLTEXCOORD3SVPROC glad_glTexCoord3sv;\nPFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation;\nPFNGLGETTEXTUREPARAMETERIIVPROC glad_glGetTextureParameterIiv;\nPFNGLTEXIMAGE1DPROC glad_glTexImage1D;\nPFNGLCOPYTEXTURESUBIMAGE3DPROC glad_glCopyTextureSubImage3D;\nPFNGLVERTEXP3UIVPROC glad_glVertexP3uiv;\nPFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;\nPFNGLVERTEXARRAYATTRIBIFORMATPROC glad_glVertexArrayAttribIFormat;\nPFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv;\nPFNGLGETMATERIALFVPROC glad_glGetMaterialfv;\nPFNGLGETTEXIMAGEPROC glad_glGetTexImage;\nPFNGLFOGCOORDFVPROC glad_glFogCoordfv;\nPFNGLPIXELMAPUIVPROC glad_glPixelMapuiv;\nPFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog;\nPFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v;\nPFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers;\nPFNGLCREATETEXTURESPROC glad_glCreateTextures;\nPFNGLTRANSFORMFEEDBACKBUFFERBASEPROC glad_glTransformFeedbackBufferBase;\nPFNGLINDEXSVPROC glad_glIndexsv;\nPFNGLCLEARTEXSUBIMAGEPROC glad_glClearTexSubImage;\nPFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glad_glProgramUniformMatrix3x4dv;\nPFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders;\nPFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer;\nPFNGLVERTEX3IVPROC glad_glVertex3iv;\nPFNGLBITMAPPROC glad_glBitmap;\nPFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog;\nPFNGLPROGRAMUNIFORM1UIVPROC glad_glProgramUniform1uiv;\nPFNGLMATERIALIPROC glad_glMateriali;\nPFNGLISVERTEXARRAYPROC glad_glIsVertexArray;\nPFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray;\nPFNGLPROGRAMUNIFORM2IVPROC glad_glProgramUniform2iv;\nPFNGLGETQUERYIVPROC glad_glGetQueryiv;\nPFNGLTEXCOORD4FPROC glad_glTexCoord4f;\nPFNGLBLITNAMEDFRAMEBUFFERPROC glad_glBlitNamedFramebuffer;\nPFNGLTEXCOORD4DPROC glad_glTexCoord4d;\nPFNGLCREATEQUERIESPROC glad_glCreateQueries;\nPFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv;\nPFNGLTEXCOORD4IPROC glad_glTexCoord4i;\nPFNGLSHADERSTORAGEBLOCKBINDINGPROC glad_glShaderStorageBlockBinding;\nPFNGLMATERIALFPROC glad_glMaterialf;\nPFNGLTEXCOORD4SPROC glad_glTexCoord4s;\nPFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glad_glProgramUniformMatrix4x2dv;\nPFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices;\nPFNGLISSHADERPROC glad_glIsShader;\nPFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s;\nPFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv;\nPFNGLVERTEX3DVPROC glad_glVertex3dv;\nPFNGLGETINTEGER64VPROC glad_glGetInteger64v;\nPFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv;\nPFNGLGETNMINMAXPROC glad_glGetnMinmax;\nPFNGLENABLEPROC glad_glEnable;\nPFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv;\nPFNGLCOLOR4FVPROC glad_glColor4fv;\nPFNGLTEXCOORD1FVPROC glad_glTexCoord1fv;\nPFNGLVERTEXARRAYATTRIBBINDINGPROC glad_glVertexArrayAttribBinding;\nPFNGLTEXTURESTORAGE1DPROC glad_glTextureStorage1D;\nPFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup;\nPFNGLBLENDEQUATIONIPROC glad_glBlendEquationi;\nPFNGLTEXCOORD2SVPROC glad_glTexCoord2sv;\nPFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv;\nPFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv;\nPFNGLGETPROGRAMINTERFACEIVPROC glad_glGetProgramInterfaceiv;\nPFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i;\nPFNGLTEXCOORD3FVPROC glad_glTexCoord3fv;\nPFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv;\nPFNGLTEXGENFPROC glad_glTexGenf;\nPFNGLMAPNAMEDBUFFERPROC glad_glMapNamedBuffer;\nPFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv;\nPFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui;\nPFNGLVERTEXATTRIBL1DVPROC glad_glVertexAttribL1dv;\nPFNGLTEXTUREBUFFERRANGEPROC glad_glTextureBufferRange;\nPFNGLGETNUNIFORMDVPROC glad_glGetnUniformdv;\nPFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui;\nPFNGLPROGRAMUNIFORM3UIPROC glad_glProgramUniform3ui;\nPFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC glad_glTransformFeedbackBufferRange;\nPFNGLGETPOINTERVPROC glad_glGetPointerv;\nPFNGLVERTEXBINDINGDIVISORPROC glad_glVertexBindingDivisor;\nPFNGLPOLYGONOFFSETPROC glad_glPolygonOffset;\nPFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv;\nPFNGLNORMAL3FVPROC glad_glNormal3fv;\nPFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s;\nPFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC glad_glNamedFramebufferDrawBuffers;\nPFNGLDEPTHRANGEPROC glad_glDepthRange;\nPFNGLFRUSTUMPROC glad_glFrustum;\nPFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv;\nPFNGLVERTEXARRAYBINDINGDIVISORPROC glad_glVertexArrayBindingDivisor;\nPFNGLDRAWBUFFERPROC glad_glDrawBuffer;\nPFNGLPUSHMATRIXPROC glad_glPushMatrix;\nPFNGLGETNPIXELMAPUSVPROC glad_glGetnPixelMapusv;\nPFNGLRASTERPOS3FVPROC glad_glRasterPos3fv;\nPFNGLORTHOPROC glad_glOrtho;\nPFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced;\nPFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv;\nPFNGLVERTEXATTRIBL4DVPROC glad_glVertexAttribL4dv;\nPFNGLPROGRAMUNIFORM1IPROC glad_glProgramUniform1i;\nPFNGLUNIFORM2DVPROC glad_glUniform2dv;\nPFNGLPROGRAMUNIFORM1DPROC glad_glProgramUniform1d;\nPFNGLPROGRAMUNIFORM1FPROC glad_glProgramUniform1f;\nPFNGLCLEARINDEXPROC glad_glClearIndex;\nPFNGLMAP1DPROC glad_glMap1d;\nPFNGLMAP1FPROC glad_glMap1f;\nPFNGLFLUSHPROC glad_glFlush;\nPFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv;\nPFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed;\nPFNGLPROGRAMUNIFORM3IVPROC glad_glProgramUniform3iv;\nPFNGLINDEXIVPROC glad_glIndexiv;\nPFNGLNAMEDRENDERBUFFERSTORAGEPROC glad_glNamedRenderbufferStorage;\nPFNGLRASTERPOS3SVPROC glad_glRasterPos3sv;\nPFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv;\nPFNGLPIXELZOOMPROC glad_glPixelZoom;\nPFNGLFENCESYNCPROC glad_glFenceSync;\nPFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays;\nPFNGLCOLORP3UIPROC glad_glColorP3ui;\nPFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glad_glDrawElementsInstancedBaseVertexBaseInstance;\nPFNGLTEXTURESTORAGE2DMULTISAMPLEPROC glad_glTextureStorage2DMultisample;\nPFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv;\nPFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender;\nPFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup;\nPFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat;\nPFNGLVALIDATEPROGRAMPIPELINEPROC glad_glValidateProgramPipeline;\nPFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex;\nPFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;\nPFNGLLIGHTIPROC glad_glLighti;\nPFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv;\nPFNGLVERTEXARRAYVERTEXBUFFERPROC glad_glVertexArrayVertexBuffer;\nPFNGLLIGHTFPROC glad_glLightf;\nPFNGLBINDVERTEXBUFFERSPROC glad_glBindVertexBuffers;\nPFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation;\nPFNGLTEXSTORAGE3DMULTISAMPLEPROC glad_glTexStorage3DMultisample;\nPFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate;\nPFNGLDISABLEVERTEXARRAYATTRIBPROC glad_glDisableVertexArrayAttrib;\nPFNGLGENSAMPLERSPROC glad_glGenSamplers;\nPFNGLCLAMPCOLORPROC glad_glClampColor;\nPFNGLUNIFORM4IVPROC glad_glUniform4iv;\nPFNGLCLEARSTENCILPROC glad_glClearStencil;\nPFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv;\nPFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC glad_glGetNamedRenderbufferParameteriv;\nPFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC glad_glDrawTransformFeedbackInstanced;\nPFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv;\nPFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv;\nPFNGLGENTEXTURESPROC glad_glGenTextures;\nPFNGLTEXCOORD4IVPROC glad_glTexCoord4iv;\nPFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback;\nPFNGLUNIFORM1DVPROC glad_glUniform1dv;\nPFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv;\nPFNGLGETTRANSFORMFEEDBACKI_VPROC glad_glGetTransformFeedbacki_v;\nPFNGLINDEXPOINTERPROC glad_glIndexPointer;\nPFNGLGETNPOLYGONSTIPPLEPROC glad_glGetnPolygonStipple;\nPFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv;\nPFNGLCLEARNAMEDFRAMEBUFFERUIVPROC glad_glClearNamedFramebufferuiv;\nPFNGLGETVERTEXARRAYINDEXEDIVPROC glad_glGetVertexArrayIndexediv;\nPFNGLISSYNCPROC glad_glIsSync;\nPFNGLVERTEX2FPROC glad_glVertex2f;\nPFNGLVERTEX2DPROC glad_glVertex2d;\nPFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers;\nPFNGLUNIFORM2IPROC glad_glUniform2i;\nPFNGLMAPGRID2DPROC glad_glMapGrid2d;\nPFNGLMAPGRID2FPROC glad_glMapGrid2f;\nPFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui;\nPFNGLVERTEX2IPROC glad_glVertex2i;\nPFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer;\nPFNGLPROGRAMUNIFORM1UIPROC glad_glProgramUniform1ui;\nPFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer;\nPFNGLVERTEX2SPROC glad_glVertex2s;\nPFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel;\nPFNGLTEXTUREPARAMETERIPROC glad_glTextureParameteri;\nPFNGLNORMAL3BVPROC glad_glNormal3bv;\nPFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv;\nPFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange;\nPFNGLPROGRAMUNIFORM2FVPROC glad_glProgramUniform2fv;\nPFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv;\nPFNGLPROGRAMUNIFORMMATRIX4DVPROC glad_glProgramUniformMatrix4dv;\nPFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv;\nPFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glad_glProgramUniformMatrix2x4dv;\nPFNGLDISPATCHCOMPUTEPROC glad_glDispatchCompute;\nPFNGLVERTEX3SVPROC glad_glVertex3sv;\nPFNGLGENQUERIESPROC glad_glGenQueries;\nPFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv;\nPFNGLTEXENVFPROC glad_glTexEnvf;\nPFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui;\nPFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D;\nPFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v;\nPFNGLFOGCOORDDPROC glad_glFogCoordd;\nPFNGLFOGCOORDFPROC glad_glFogCoordf;\nPFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D;\nPFNGLTEXENVIPROC glad_glTexEnvi;\nPFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv;\nPFNGLISENABLEDIPROC glad_glIsEnabledi;\nPFNGLBINDBUFFERSRANGEPROC glad_glBindBuffersRange;\nPFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui;\nPFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i;\nPFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed;\nPFNGLCOPYIMAGESUBDATAPROC glad_glCopyImageSubData;\nPFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv;\nPFNGLUNIFORM2IVPROC glad_glUniform2iv;\nPFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv;\nPFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ;\nPFNGLUNIFORM4UIVPROC glad_glUniform4uiv;\nPFNGLMATRIXMODEPROC glad_glMatrixMode;\nPFNGLGETTEXTUREIMAGEPROC glad_glGetTextureImage;\nPFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer;\nPFNGLPROGRAMUNIFORM2DVPROC glad_glProgramUniform2dv;\nPFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed;\nPFNGLGETMAPIVPROC glad_glGetMapiv;\nPFNGLTEXTURESUBIMAGE3DPROC glad_glTextureSubImage3D;\nPFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D;\nPFNGLUNIFORM4DPROC glad_glUniform4d;\nPFNGLGETSHADERIVPROC glad_glGetShaderiv;\nPFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d;\nPFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f;\nPFNGLPROGRAMUNIFORMMATRIX3FVPROC glad_glProgramUniformMatrix3fv;\nPFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel;\nPFNGLINVALIDATEFRAMEBUFFERPROC glad_glInvalidateFramebuffer;\nPFNGLBINDTEXTURESPROC glad_glBindTextures;\nPFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation;\nPFNGLNAMEDBUFFERSTORAGEPROC glad_glNamedBufferStorage;\nPFNGLSCISSORARRAYVPROC glad_glScissorArrayv;\nPFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures;\nPFNGLCALLLISTPROC glad_glCallList;\nPFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv;\nPFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv;\nPFNGLGETDOUBLEVPROC glad_glGetDoublev;\nPFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv;\nPFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d;\nPFNGLUNIFORM4DVPROC glad_glUniform4dv;\nPFNGLLIGHTMODELFPROC glad_glLightModelf;\nPFNGLGETUNIFORMIVPROC glad_glGetUniformiv;\nPFNGLINVALIDATEBUFFERDATAPROC glad_glInvalidateBufferData;\nPFNGLVERTEX2SVPROC glad_glVertex2sv;\nPFNGLVERTEXARRAYVERTEXBUFFERSPROC glad_glVertexArrayVertexBuffers;\nPFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC glad_glCompressedTextureSubImage1D;\nPFNGLLIGHTMODELIPROC glad_glLightModeli;\nPFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv;\nPFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv;\nPFNGLUNIFORM3FVPROC glad_glUniform3fv;\nPFNGLPIXELSTOREIPROC glad_glPixelStorei;\nPFNGLGETPROGRAMPIPELINEINFOLOGPROC glad_glGetProgramPipelineInfoLog;\nPFNGLCALLLISTSPROC glad_glCallLists;\nPFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glad_glProgramUniformMatrix3x4fv;\nPFNGLINVALIDATESUBFRAMEBUFFERPROC glad_glInvalidateSubFramebuffer;\nPFNGLMAPBUFFERPROC glad_glMapBuffer;\nPFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d;\nPFNGLTEXCOORD3IPROC glad_glTexCoord3i;\nPFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv;\nPFNGLRASTERPOS3IPROC glad_glRasterPos3i;\nPFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b;\nPFNGLRASTERPOS3DPROC glad_glRasterPos3d;\nPFNGLRASTERPOS3FPROC glad_glRasterPos3f;\nPFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D;\nPFNGLTEXCOORD3FPROC glad_glTexCoord3f;\nPFNGLDELETESYNCPROC glad_glDeleteSync;\nPFNGLTEXCOORD3DPROC glad_glTexCoord3d;\nPFNGLGETTRANSFORMFEEDBACKI64_VPROC glad_glGetTransformFeedbacki64_v;\nPFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv;\nPFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample;\nPFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv;\nPFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv;\nPFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements;\nPFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv;\nPFNGLTEXCOORD3SPROC glad_glTexCoord3s;\nPFNGLUNIFORM3IVPROC glad_glUniform3iv;\nPFNGLRASTERPOS3SPROC glad_glRasterPos3s;\nPFNGLPOLYGONMODEPROC glad_glPolygonMode;\nPFNGLDRAWBUFFERSPROC glad_glDrawBuffers;\nPFNGLGETNHISTOGRAMPROC glad_glGetnHistogram;\nPFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv;\nPFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident;\nPFNGLPROGRAMUNIFORM2DPROC glad_glProgramUniform2d;\nPFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glad_glProgramUniformMatrix4x3dv;\nPFNGLISLISTPROC glad_glIsList;\nPFNGLPROGRAMUNIFORM4IVPROC glad_glProgramUniform4iv;\nPFNGLRASTERPOS2SVPROC glad_glRasterPos2sv;\nPFNGLRASTERPOS4SVPROC glad_glRasterPos4sv;\nPFNGLCOLOR4SPROC glad_glColor4s;\nPFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary;\nPFNGLUSEPROGRAMPROC glad_glUseProgram;\nPFNGLLINESTIPPLEPROC glad_glLineStipple;\nPFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv;\nPFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog;\nPFNGLCLEARTEXIMAGEPROC glad_glClearTexImage;\nPFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv;\nPFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv;\nPFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv;\nPFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray;\nPFNGLCOLOR4BPROC glad_glColor4b;\nPFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f;\nPFNGLCOLOR4FPROC glad_glColor4f;\nPFNGLCOLOR4DPROC glad_glColor4d;\nPFNGLCOLOR4IPROC glad_glColor4i;\nPFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv;\nPFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex;\nPFNGLVERTEXATTRIBLFORMATPROC glad_glVertexAttribLFormat;\nPFNGLRASTERPOS3IVPROC glad_glRasterPos3iv;\nPFNGLTEXTURESTORAGE2DPROC glad_glTextureStorage2D;\nPFNGLGENERATETEXTUREMIPMAPPROC glad_glGenerateTextureMipmap;\nPFNGLVERTEX2DVPROC glad_glVertex2dv;\nPFNGLTEXCOORD4SVPROC glad_glTexCoord4sv;\nPFNGLUNIFORM2UIVPROC glad_glUniform2uiv;\nPFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D;\nPFNGLFINISHPROC glad_glFinish;\nPFNGLDEPTHRANGEINDEXEDPROC glad_glDepthRangeIndexed;\nPFNGLGETBOOLEANVPROC glad_glGetBooleanv;\nPFNGLDELETESHADERPROC glad_glDeleteShader;\nPFNGLDRAWELEMENTSPROC glad_glDrawElements;\nPFNGLGETINTERNALFORMATI64VPROC glad_glGetInternalformati64v;\nPFNGLRASTERPOS2SPROC glad_glRasterPos2s;\nPFNGLCOPYTEXTURESUBIMAGE1DPROC glad_glCopyTextureSubImage1D;\nPFNGLGETMAPDVPROC glad_glGetMapdv;\nPFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv;\nPFNGLMATERIALFVPROC glad_glMaterialfv;\nPFNGLTEXTUREPARAMETERIUIVPROC glad_glTextureParameterIuiv;\nPFNGLVIEWPORTPROC glad_glViewport;\nPFNGLUNIFORM1UIVPROC glad_glUniform1uiv;\nPFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings;\nPFNGLINDEXDVPROC glad_glIndexdv;\nPFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D;\nPFNGLTEXCOORD3IVPROC glad_glTexCoord3iv;\nPFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback;\nPFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i;\nPFNGLINVALIDATETEXIMAGEPROC glad_glInvalidateTexImage;\nPFNGLVERTEXATTRIBFORMATPROC glad_glVertexAttribFormat;\nPFNGLCLEARDEPTHPROC glad_glClearDepth;\nPFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv;\nPFNGLTEXPARAMETERFPROC glad_glTexParameterf;\nPFNGLVERTEXATTRIBBINDINGPROC glad_glVertexAttribBinding;\nPFNGLTEXPARAMETERIPROC glad_glTexParameteri;\nPFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv;\nPFNGLGETSHADERSOURCEPROC glad_glGetShaderSource;\nPFNGLCREATETRANSFORMFEEDBACKSPROC glad_glCreateTransformFeedbacks;\nPFNGLGETNTEXIMAGEPROC glad_glGetnTexImage;\nPFNGLTEXBUFFERPROC glad_glTexBuffer;\nPFNGLPOPNAMEPROC glad_glPopName;\nPFNGLVALIDATEPROGRAMPROC glad_glValidateProgram;\nPFNGLPIXELSTOREFPROC glad_glPixelStoref;\nPFNGLUNIFORM3UIVPROC glad_glUniform3uiv;\nPFNGLVIEWPORTINDEXEDFPROC glad_glViewportIndexedf;\nPFNGLRASTERPOS4FVPROC glad_glRasterPos4fv;\nPFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv;\nPFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv;\nPFNGLGENPROGRAMPIPELINESPROC glad_glGenProgramPipelines;\nPFNGLRECTIPROC glad_glRecti;\nPFNGLCOLOR4UBPROC glad_glColor4ub;\nPFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf;\nPFNGLRECTFPROC glad_glRectf;\nPFNGLRECTDPROC glad_glRectd;\nPFNGLNORMAL3SVPROC glad_glNormal3sv;\nPFNGLNEWLISTPROC glad_glNewList;\nPFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glad_glProgramUniformMatrix2x3dv;\nPFNGLCOLOR4USPROC glad_glColor4us;\nPFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv;\nPFNGLLINKPROGRAMPROC glad_glLinkProgram;\nPFNGLHINTPROC glad_glHint;\nPFNGLRECTSPROC glad_glRects;\nPFNGLTEXCOORD2DVPROC glad_glTexCoord2dv;\nPFNGLRASTERPOS4IVPROC glad_glRasterPos4iv;\nPFNGLGETOBJECTLABELPROC glad_glGetObjectLabel;\nPFNGLPROGRAMUNIFORM2FPROC glad_glProgramUniform2f;\nPFNGLGETSTRINGPROC glad_glGetString;\nPFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv;\nPFNGLEDGEFLAGVPROC glad_glEdgeFlagv;\nPFNGLDETACHSHADERPROC glad_glDetachShader;\nPFNGLPROGRAMUNIFORM3IPROC glad_glProgramUniform3i;\nPFNGLSCALEFPROC glad_glScalef;\nPFNGLENDQUERYPROC glad_glEndQuery;\nPFNGLSCALEDPROC glad_glScaled;\nPFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer;\nPFNGLFRAMEBUFFERPARAMETERIPROC glad_glFramebufferParameteri;\nPFNGLGETPROGRAMRESOURCENAMEPROC glad_glGetProgramResourceName;\nPFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv;\nPFNGLDEPTHRANGEARRAYVPROC glad_glDepthRangeArrayv;\nPFNGLCOPYPIXELSPROC glad_glCopyPixels;\nPFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui;\nPFNGLGETPROGRAMRESOURCELOCATIONPROC glad_glGetProgramResourceLocation;\nPFNGLPOPATTRIBPROC glad_glPopAttrib;\nPFNGLDELETETEXTURESPROC glad_glDeleteTextures;\nPFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC glad_glGetActiveAtomicCounterBufferiv;\nPFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate;\nPFNGLGETTEXTUREPARAMETERIVPROC glad_glGetTextureParameteriv;\nPFNGLDELETEQUERIESPROC glad_glDeleteQueries;\nPFNGLNORMALP3UIVPROC glad_glNormalP3uiv;\nPFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f;\nPFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d;\nPFNGLVIEWPORTINDEXEDFVPROC glad_glViewportIndexedfv;\nPFNGLINITNAMESPROC glad_glInitNames;\nPFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v;\nPFNGLCOLOR3DVPROC glad_glColor3dv;\nPFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i;\nPFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;\nPFNGLWAITSYNCPROC glad_glWaitSync;\nPFNGLCREATEVERTEXARRAYSPROC glad_glCreateVertexArrays;\nPFNGLPROGRAMUNIFORM1DVPROC glad_glProgramUniform1dv;\nPFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s;\nPFNGLCOLORMATERIALPROC glad_glColorMaterial;\nPFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage;\nPFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri;\nPFNGLCLEARBUFFERSUBDATAPROC glad_glClearBufferSubData;\nPFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf;\nPFNGLTEXSTORAGE1DPROC glad_glTexStorage1D;\nPFNGLUNIFORM1FPROC glad_glUniform1f;\nPFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv;\nPFNGLUNIFORM1DPROC glad_glUniform1d;\nPFNGLRENDERMODEPROC glad_glRenderMode;\nPFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage;\nPFNGLGETNCOMPRESSEDTEXIMAGEPROC glad_glGetnCompressedTexImage;\nPFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv;\nPFNGLUNIFORM1IPROC glad_glUniform1i;\nPFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib;\nPFNGLUNIFORM3IPROC glad_glUniform3i;\nPFNGLPIXELTRANSFERIPROC glad_glPixelTransferi;\nPFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D;\nPFNGLDISABLEPROC glad_glDisable;\nPFNGLLOGICOPPROC glad_glLogicOp;\nPFNGLEVALPOINT2PROC glad_glEvalPoint2;\nPFNGLPIXELTRANSFERFPROC glad_glPixelTransferf;\nPFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i;\nPFNGLPROGRAMUNIFORM4UIVPROC glad_glProgramUniform4uiv;\nPFNGLUNIFORM4UIPROC glad_glUniform4ui;\nPFNGLCOLOR3FPROC glad_glColor3f;\nPFNGLNAMEDFRAMEBUFFERREADBUFFERPROC glad_glNamedFramebufferReadBuffer;\nPFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer;\nPFNGLGETTEXENVFVPROC glad_glGetTexEnvfv;\nPFNGLRECTFVPROC glad_glRectfv;\nPFNGLCULLFACEPROC glad_glCullFace;\nPFNGLGETLIGHTFVPROC glad_glGetLightfv;\nPFNGLGETNUNIFORMIVPROC glad_glGetnUniformiv;\nPFNGLCOLOR3DPROC glad_glColor3d;\nPFNGLPROGRAMUNIFORM4IPROC glad_glProgramUniform4i;\nPFNGLTEXGENDPROC glad_glTexGend;\nPFNGLPROGRAMUNIFORM4FPROC glad_glProgramUniform4f;\nPFNGLTEXGENIPROC glad_glTexGeni;\nPFNGLPROGRAMUNIFORM4DPROC glad_glProgramUniform4d;\nPFNGLTEXTUREPARAMETERIIVPROC glad_glTextureParameterIiv;\nPFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s;\nPFNGLGETSTRINGIPROC glad_glGetStringi;\nPFNGLGETTEXTUREPARAMETERFVPROC glad_glGetTextureParameterfv;\nPFNGLTEXTURESUBIMAGE2DPROC glad_glTextureSubImage2D;\nPFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i;\nPFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f;\nPFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream;\nPFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d;\nPFNGLATTACHSHADERPROC glad_glAttachShader;\nPFNGLFOGCOORDDVPROC glad_glFogCoorddv;\nPFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv;\nPFNGLGETTEXGENFVPROC glad_glGetTexGenfv;\nPFNGLQUERYCOUNTERPROC glad_glQueryCounter;\nPFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer;\nPFNGLPROGRAMUNIFORMMATRIX3DVPROC glad_glProgramUniformMatrix3dv;\nPFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex;\nPFNGLSHADERBINARYPROC glad_glShaderBinary;\nPFNGLUNMAPNAMEDBUFFERPROC glad_glUnmapNamedBuffer;\nPFNGLGETNCOLORTABLEPROC glad_glGetnColorTable;\nPFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D;\nPFNGLTEXGENIVPROC glad_glTexGeniv;\nPFNGLRASTERPOS2DVPROC glad_glRasterPos2dv;\nPFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv;\nPFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture;\nPFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glNamedRenderbufferStorageMultisample;\nPFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv;\nPFNGLCLEARNAMEDBUFFERDATAPROC glad_glClearNamedBufferData;\nPFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us;\nPFNGLNORMALP3UIPROC glad_glNormalP3ui;\nPFNGLTEXENVFVPROC glad_glTexEnvfv;\nPFNGLREADBUFFERPROC glad_glReadBuffer;\nPFNGLVIEWPORTARRAYVPROC glad_glViewportArrayv;\nPFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv;\nPFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced;\nPFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap;\nPFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC glad_glCompressedTextureSubImage2D;\nPFNGLPROGRAMUNIFORMMATRIX2FVPROC glad_glProgramUniformMatrix2fv;\nPFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv;\nPFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv;\nPFNGLLIGHTMODELFVPROC glad_glLightModelfv;\nPFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv;\nPFNGLDELETELISTSPROC glad_glDeleteLists;\nPFNGLGETCLIPPLANEPROC glad_glGetClipPlane;\nPFNGLVERTEX4DVPROC glad_glVertex4dv;\nPFNGLTEXCOORD2DPROC glad_glTexCoord2d;\nPFNGLPOPMATRIXPROC glad_glPopMatrix;\nPFNGLTEXCOORD2FPROC glad_glTexCoord2f;\nPFNGLCOLOR4IVPROC glad_glColor4iv;\nPFNGLINDEXUBVPROC glad_glIndexubv;\nPFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC glad_glCheckNamedFramebufferStatus;\nPFNGLUNMAPBUFFERPROC glad_glUnmapBuffer;\nPFNGLTEXCOORD2IPROC glad_glTexCoord2i;\nPFNGLRASTERPOS4DPROC glad_glRasterPos4d;\nPFNGLRASTERPOS4FPROC glad_glRasterPos4f;\nPFNGLPROGRAMUNIFORM1IVPROC glad_glProgramUniform1iv;\nPFNGLGETVERTEXARRAYIVPROC glad_glGetVertexArrayiv;\nPFNGLCOPYTEXTURESUBIMAGE2DPROC glad_glCopyTextureSubImage2D;\nPFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s;\nPFNGLTEXCOORD2SPROC glad_glTexCoord2s;\nPFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer;\nPFNGLVERTEX3FVPROC glad_glVertex3fv;\nPFNGLTEXCOORD4DVPROC glad_glTexCoord4dv;\nPFNGLMATERIALIVPROC glad_glMaterialiv;\nPFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv;\nPFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv;\nPFNGLISPROGRAMPROC glad_glIsProgram;\nPFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv;\nPFNGLVERTEX4SPROC glad_glVertex4s;\nPFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv;\nPFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv;\nPFNGLNORMAL3DVPROC glad_glNormal3dv;\nPFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback;\nPFNGLUNIFORM4IPROC glad_glUniform4i;\nPFNGLACTIVETEXTUREPROC glad_glActiveTexture;\nPFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray;\nPFNGLROTATEDPROC glad_glRotated;\nPFNGLISPROGRAMPIPELINEPROC glad_glIsProgramPipeline;\nPFNGLROTATEFPROC glad_glRotatef;\nPFNGLVERTEX4IPROC glad_glVertex4i;\nPFNGLREADPIXELSPROC glad_glReadPixels;\nPFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv;\nPFNGLLOADNAMEPROC glad_glLoadName;\nPFNGLUNIFORM4FPROC glad_glUniform4f;\nPFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample;\nPFNGLCREATEPROGRAMPIPELINESPROC glad_glCreateProgramPipelines;\nPFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays;\nPFNGLSHADEMODELPROC glad_glShadeModel;\nPFNGLMAPGRID1DPROC glad_glMapGrid1d;\nPFNGLGETUNIFORMFVPROC glad_glGetUniformfv;\nPFNGLMAPGRID1FPROC glad_glMapGrid1f;\nPFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv;\nPFNGLVERTEXATTRIBLPOINTERPROC glad_glVertexAttribLPointer;\nPFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState;\nPFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv;\nPFNGLGETNUNIFORMFVPROC glad_glGetnUniformfv;\nPFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex;\nPFNGLVERTEXATTRIBL2DVPROC glad_glVertexAttribL2dv;\nPFNGLMULTIDRAWELEMENTSINDIRECTPROC glad_glMultiDrawElementsIndirect;\nPFNGLENABLEVERTEXARRAYATTRIBPROC glad_glEnableVertexArrayAttrib;\nPFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer;\nPFNGLALPHAFUNCPROC glad_glAlphaFunc;\nPFNGLUNIFORM1IVPROC glad_glUniform1iv;\nPFNGLCREATESHADERPROGRAMVPROC glad_glCreateShaderProgramv;\nPFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName;\nPFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv;\nPFNGLVERTEXATTRIBL2DPROC glad_glVertexAttribL2d;\nPFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv;\nPFNGLSTENCILFUNCPROC glad_glStencilFunc;\nPFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC glad_glInvalidateNamedFramebufferData;\nPFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv;\nPFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding;\nPFNGLCOLOR4UIVPROC glad_glColor4uiv;\nPFNGLRECTIVPROC glad_glRectiv;\nPFNGLCOLORP4UIPROC glad_glColorP4ui;\nPFNGLUSEPROGRAMSTAGESPROC glad_glUseProgramStages;\nPFNGLRASTERPOS3DVPROC glad_glRasterPos3dv;\nPFNGLEVALMESH2PROC glad_glEvalMesh2;\nPFNGLEVALMESH1PROC glad_glEvalMesh1;\nPFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer;\nPFNGLPROGRAMUNIFORM3FPROC glad_glProgramUniform3f;\nPFNGLPROGRAMUNIFORM3DPROC glad_glProgramUniform3d;\nPFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv;\nPFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv;\nPFNGLGETPROGRAMPIPELINEIVPROC glad_glGetProgramPipelineiv;\nPFNGLTEXSTORAGE3DPROC glad_glTexStorage3D;\nPFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv;\nPFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC glad_glNamedFramebufferDrawBuffer;\nPFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv;\nPFNGLCOLOR4UBVPROC glad_glColor4ubv;\nPFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd;\nPFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf;\nPFNGLTEXTUREPARAMETERIVPROC glad_glTextureParameteriv;\nPFNGLOBJECTLABELPROC glad_glObjectLabel;\nPFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i;\nPFNGLRASTERPOS2IVPROC glad_glRasterPos2iv;\nPFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData;\nPFNGLGETVERTEXATTRIBLDVPROC glad_glGetVertexAttribLdv;\nPFNGLGETNUNIFORMUIVPROC glad_glGetnUniformuiv;\nPFNGLGETQUERYBUFFEROBJECTIVPROC glad_glGetQueryBufferObjectiv;\nPFNGLTEXENVIVPROC glad_glTexEnviv;\nPFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate;\nPFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui;\nPFNGLGENBUFFERSPROC glad_glGenBuffers;\nPFNGLSELECTBUFFERPROC glad_glSelectBuffer;\nPFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex;\nPFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv;\nPFNGLSCISSORINDEXEDVPROC glad_glScissorIndexedv;\nPFNGLPUSHATTRIBPROC glad_glPushAttrib;\nPFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer;\nPFNGLBLENDFUNCPROC glad_glBlendFunc;\nPFNGLCREATEPROGRAMPROC glad_glCreateProgram;\nPFNGLNAMEDBUFFERSUBDATAPROC glad_glNamedBufferSubData;\nPFNGLTEXIMAGE3DPROC glad_glTexImage3D;\nPFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer;\nPFNGLCLEARNAMEDFRAMEBUFFERFVPROC glad_glClearNamedFramebufferfv;\nPFNGLLIGHTIVPROC glad_glLightiv;\nPFNGLGETNAMEDBUFFERSUBDATAPROC glad_glGetNamedBufferSubData;\nPFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC glad_glCompressedTextureSubImage3D;\nPFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex;\nPFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC glad_glFlushMappedNamedBufferRange;\nPFNGLINVALIDATETEXSUBIMAGEPROC glad_glInvalidateTexSubImage;\nPFNGLTEXGENFVPROC glad_glTexGenfv;\nPFNGLGETTEXTUREPARAMETERIUIVPROC glad_glGetTextureParameterIuiv;\nPFNGLGETNCONVOLUTIONFILTERPROC glad_glGetnConvolutionFilter;\nPFNGLBINDIMAGETEXTURESPROC glad_glBindImageTextures;\nPFNGLENDPROC glad_glEnd;\nPFNGLDELETEBUFFERSPROC glad_glDeleteBuffers;\nPFNGLBINDPROGRAMPIPELINEPROC glad_glBindProgramPipeline;\nPFNGLSCISSORPROC glad_glScissor;\nPFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv;\nPFNGLCLIPPLANEPROC glad_glClipPlane;\nPFNGLPUSHNAMEPROC glad_glPushName;\nPFNGLTEXGENDVPROC glad_glTexGendv;\nPFNGLINDEXUBPROC glad_glIndexub;\nPFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetNamedFramebufferAttachmentParameteriv;\nPFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC glad_glNamedFramebufferRenderbuffer;\nPFNGLVERTEXP2UIVPROC glad_glVertexP2uiv;\nPFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv;\nPFNGLRASTERPOS4IPROC glad_glRasterPos4i;\nPFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd;\nPFNGLCLEARCOLORPROC glad_glClearColor;\nPFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv;\nPFNGLNORMAL3SPROC glad_glNormal3s;\nPFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv;\nPFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glad_glProgramUniformMatrix2x3fv;\nPFNGLCLEARBUFFERIVPROC glad_glClearBufferiv;\nPFNGLPOINTPARAMETERIPROC glad_glPointParameteri;\nPFNGLPROGRAMUNIFORM4DVPROC glad_glProgramUniform4dv;\nPFNGLCOLORP4UIVPROC glad_glColorP4uiv;\nPFNGLBLENDCOLORPROC glad_glBlendColor;\nPFNGLGETNPIXELMAPUIVPROC glad_glGetnPixelMapuiv;\nPFNGLGETTEXTURELEVELPARAMETERIVPROC glad_glGetTextureLevelParameteriv;\nPFNGLWINDOWPOS3DPROC glad_glWindowPos3d;\nPFNGLPROGRAMUNIFORM3FVPROC glad_glProgramUniform3fv;\nPFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv;\nPFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC glad_glGetNamedFramebufferParameteriv;\nPFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv;\nPFNGLUNIFORM3UIPROC glad_glUniform3ui;\nPFNGLPROGRAMUNIFORM3UIVPROC glad_glProgramUniform3uiv;\nPFNGLCOLOR4DVPROC glad_glColor4dv;\nPFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv;\nPFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv;\nPFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback;\nPFNGLUNIFORM2FVPROC glad_glUniform2fv;\nPFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName;\nPFNGLGETPROGRAMRESOURCEINDEXPROC glad_glGetProgramResourceIndex;\nPFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub;\nPFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect;\nPFNGLGETTEXTURELEVELPARAMETERFVPROC glad_glGetTextureLevelParameterfv;\nPFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui;\nPFNGLTEXCOORD3DVPROC glad_glTexCoord3dv;\nPFNGLGETNAMEDBUFFERPOINTERVPROC glad_glGetNamedBufferPointerv;\nPFNGLDISPATCHCOMPUTEINDIRECTPROC glad_glDispatchComputeIndirect;\nPFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC glad_glInvalidateNamedFramebufferSubData;\nPFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv;\nPFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange;\nPFNGLNORMAL3IVPROC glad_glNormal3iv;\nPFNGLTEXTURESUBIMAGE1DPROC glad_glTextureSubImage1D;\nPFNGLVERTEXATTRIBL3DVPROC glad_glVertexAttribL3dv;\nPFNGLGETUNIFORMDVPROC glad_glGetUniformdv;\nPFNGLWINDOWPOS3SPROC glad_glWindowPos3s;\nPFNGLPOINTPARAMETERFPROC glad_glPointParameterf;\nPFNGLCLEARDEPTHFPROC glad_glClearDepthf;\nPFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv;\nPFNGLWINDOWPOS3IPROC glad_glWindowPos3i;\nPFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s;\nPFNGLGETTEXTURESUBIMAGEPROC glad_glGetTextureSubImage;\nPFNGLWINDOWPOS3FPROC glad_glWindowPos3f;\nPFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks;\nPFNGLCOLOR3USPROC glad_glColor3us;\nPFNGLCOLOR3UIVPROC glad_glColor3uiv;\nPFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv;\nPFNGLGETLIGHTIVPROC glad_glGetLightiv;\nPFNGLDEPTHFUNCPROC glad_glDepthFunc;\nPFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D;\nPFNGLLISTBASEPROC glad_glListBase;\nPFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f;\nPFNGLCOLOR3UBPROC glad_glColor3ub;\nPFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d;\nPFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv;\nPFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei;\nPFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;\nPFNGLCOLOR3UIPROC glad_glColor3ui;\nPFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC glad_glGetProgramResourceLocationIndex;\nPFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i;\nPFNGLBUFFERSTORAGEPROC glad_glBufferStorage;\nPFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple;\nPFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync;\nPFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui;\nPFNGLGETFLOATI_VPROC glad_glGetFloati_v;\nPFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv;\nPFNGLCOLORMASKPROC glad_glColorMask;\nPFNGLTEXTUREBUFFERPROC glad_glTextureBuffer;\nPFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv;\nPFNGLBLENDEQUATIONPROC glad_glBlendEquation;\nPFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation;\nPFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv;\nPFNGLVERTEXARRAYATTRIBFORMATPROC glad_glVertexArrayAttribFormat;\nPFNGLREADNPIXELSPROC glad_glReadnPixels;\nPFNGLRASTERPOS4SPROC glad_glRasterPos4s;\nPFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback;\nPFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv;\nPFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv;\nPFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv;\nPFNGLBINDVERTEXBUFFERPROC glad_glBindVertexBuffer;\nPFNGLCOLOR4SVPROC glad_glColor4sv;\nPFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert;\nPFNGLCREATESAMPLERSPROC glad_glCreateSamplers;\nPFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib;\nPFNGLCLEARBUFFERDATAPROC glad_glClearBufferData;\nPFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback;\nPFNGLFOGFPROC glad_glFogf;\nPFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv;\nPFNGLPROGRAMBINARYPROC glad_glProgramBinary;\nPFNGLISSAMPLERPROC glad_glIsSampler;\nPFNGLVERTEXP3UIPROC glad_glVertexP3ui;\nPFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor;\nPFNGLBINDSAMPLERSPROC glad_glBindSamplers;\nPFNGLCOLOR3IVPROC glad_glColor3iv;\nPFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D;\nPFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks;\nPFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D;\nPFNGLTEXCOORD1IPROC glad_glTexCoord1i;\nPFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus;\nPFNGLTEXCOORD1DPROC glad_glTexCoord1d;\nPFNGLTEXCOORD1FPROC glad_glTexCoord1f;\nPFNGLTEXTURESTORAGE3DPROC glad_glTextureStorage3D;\nPFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender;\nPFNGLENABLECLIENTSTATEPROC glad_glEnableClientState;\nPFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation;\nPFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv;\nPFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv;\nPFNGLBLENDFUNCIPROC glad_glBlendFunci;\nPFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv;\nPFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv;\nPFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements;\nPFNGLTEXCOORD1SPROC glad_glTexCoord1s;\nPFNGLBINDBUFFERBASEPROC glad_glBindBufferBase;\nPFNGLBUFFERSUBDATAPROC glad_glBufferSubData;\nPFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv;\nPFNGLGENLISTSPROC glad_glGenLists;\nPFNGLCOLOR3BVPROC glad_glColor3bv;\nPFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange;\nPFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture;\nPFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei;\nPFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glad_glProgramUniformMatrix4x2fv;\nPFNGLVERTEXATTRIBL1DPROC glad_glVertexAttribL1d;\nPFNGLGETTEXGENDVPROC glad_glGetTexGendv;\nPFNGLCLEARNAMEDFRAMEBUFFERIVPROC glad_glClearNamedFramebufferiv;\nPFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays;\nPFNGLENDLISTPROC glad_glEndList;\nPFNGLSCISSORINDEXEDPROC glad_glScissorIndexed;\nPFNGLVERTEXP4UIVPROC glad_glVertexP4uiv;\nPFNGLUNIFORM2UIPROC glad_glUniform2ui;\nPFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv;\nPFNGLGETNMAPDVPROC glad_glGetnMapdv;\nPFNGLCOLOR3USVPROC glad_glColor3usv;\nPFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv;\nPFNGLTEXTUREVIEWPROC glad_glTextureView;\nPFNGLDISABLEIPROC glad_glDisablei;\nPFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glad_glProgramUniformMatrix2x4fv;\nPFNGLCREATERENDERBUFFERSPROC glad_glCreateRenderbuffers;\nPFNGLINDEXMASKPROC glad_glIndexMask;\nPFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib;\nPFNGLSHADERSOURCEPROC glad_glShaderSource;\nPFNGLGETNSEPARABLEFILTERPROC glad_glGetnSeparableFilter;\nPFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName;\nPFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv;\nPFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler;\nPFNGLVERTEXATTRIBIFORMATPROC glad_glVertexAttribIFormat;\nPFNGLCREATEFRAMEBUFFERSPROC glad_glCreateFramebuffers;\nPFNGLCLEARACCUMPROC glad_glClearAccum;\nPFNGLGETSYNCIVPROC glad_glGetSynciv;\nPFNGLPROGRAMUNIFORM2UIVPROC glad_glProgramUniform2uiv;\nPFNGLGETNPIXELMAPFVPROC glad_glGetnPixelMapfv;\nPFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv;\nPFNGLPATCHPARAMETERIPROC glad_glPatchParameteri;\nPFNGLPROGRAMUNIFORM2IPROC glad_glProgramUniform2i;\nPFNGLUNIFORM2FPROC glad_glUniform2f;\nPFNGLGETNAMEDBUFFERPARAMETERI64VPROC glad_glGetNamedBufferParameteri64v;\nPFNGLBEGINQUERYPROC glad_glBeginQuery;\nPFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex;\nPFNGLBINDBUFFERPROC glad_glBindBuffer;\nPFNGLMAP2DPROC glad_glMap2d;\nPFNGLMAP2FPROC glad_glMap2f;\nPFNGLTEXSTORAGE2DMULTISAMPLEPROC glad_glTexStorage2DMultisample;\nPFNGLUNIFORM2DPROC glad_glUniform2d;\nPFNGLVERTEX4DPROC glad_glVertex4d;\nPFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv;\nPFNGLTEXCOORD1SVPROC glad_glTexCoord1sv;\nPFNGLBUFFERDATAPROC glad_glBufferData;\nPFNGLEVALPOINT1PROC glad_glEvalPoint1;\nPFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv;\nPFNGLGETQUERYBUFFEROBJECTUI64VPROC glad_glGetQueryBufferObjectui64v;\nPFNGLTEXCOORD1DVPROC glad_glTexCoord1dv;\nPFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui;\nPFNGLGETERRORPROC glad_glGetError;\nPFNGLGETTEXENVIVPROC glad_glGetTexEnviv;\nPFNGLGETPROGRAMIVPROC glad_glGetProgramiv;\nPFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui;\nPFNGLGETFLOATVPROC glad_glGetFloatv;\nPFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D;\nPFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv;\nPFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv;\nPFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv;\nPFNGLEVALCOORD1DPROC glad_glEvalCoord1d;\nPFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv;\nPFNGLEVALCOORD1FPROC glad_glEvalCoord1f;\nPFNGLPIXELMAPFVPROC glad_glPixelMapfv;\nPFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv;\nPFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv;\nPFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv;\nPFNGLGETINTEGERVPROC glad_glGetIntegerv;\nPFNGLACCUMPROC glad_glAccum;\nPFNGLGETVERTEXARRAYINDEXED64IVPROC glad_glGetVertexArrayIndexed64iv;\nPFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv;\nPFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv;\nPFNGLRASTERPOS4DVPROC glad_glRasterPos4dv;\nPFNGLPROGRAMUNIFORM4FVPROC glad_glProgramUniform4fv;\nPFNGLTEXCOORD2IVPROC glad_glTexCoord2iv;\nPFNGLTEXTUREBARRIERPROC glad_glTextureBarrier;\nPFNGLISQUERYPROC glad_glIsQuery;\nPFNGLPROGRAMUNIFORM2UIPROC glad_glProgramUniform2ui;\nPFNGLPROGRAMUNIFORM4UIPROC glad_glProgramUniform4ui;\nPFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv;\nPFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv;\nPFNGLTEXIMAGE2DPROC glad_glTexImage2D;\nPFNGLSTENCILMASKPROC glad_glStencilMask;\nPFNGLDRAWPIXELSPROC glad_glDrawPixels;\nPFNGLMULTMATRIXDPROC glad_glMultMatrixd;\nPFNGLMULTMATRIXFPROC glad_glMultMatrixf;\nPFNGLISTEXTUREPROC glad_glIsTexture;\nPFNGLGETMATERIALIVPROC glad_glGetMaterialiv;\nPFNGLNAMEDBUFFERDATAPROC glad_glNamedBufferData;\nPFNGLUNIFORM1FVPROC glad_glUniform1fv;\nPFNGLLOADMATRIXFPROC glad_glLoadMatrixf;\nPFNGLTEXSTORAGE2DPROC glad_glTexStorage2D;\nPFNGLLOADMATRIXDPROC glad_glLoadMatrixd;\nPFNGLCLEARNAMEDBUFFERSUBDATAPROC glad_glClearNamedBufferSubData;\nPFNGLMAPNAMEDBUFFERRANGEPROC glad_glMapNamedBufferRange;\nPFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC glad_glNamedFramebufferTextureLayer;\nPFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;\nPFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv;\nPFNGLVERTEX4FPROC glad_glVertex4f;\nPFNGLRECTSVPROC glad_glRectsv;\nPFNGLCOLOR4USVPROC glad_glColor4usv;\nPFNGLUNIFORM3DVPROC glad_glUniform3dv;\nPFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glad_glProgramUniformMatrix4x3fv;\nPFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple;\nPFNGLBINDBUFFERSBASEPROC glad_glBindBuffersBase;\nPFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays;\nPFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation;\nPFNGLNORMAL3IPROC glad_glNormal3i;\nPFNGLNORMAL3FPROC glad_glNormal3f;\nPFNGLNORMAL3DPROC glad_glNormal3d;\nPFNGLNORMAL3BPROC glad_glNormal3b;\nPFNGLGETFRAMEBUFFERPARAMETERIVPROC glad_glGetFramebufferParameteriv;\nPFNGLPIXELMAPUSVPROC glad_glPixelMapusv;\nPFNGLGETTEXGENIVPROC glad_glGetTexGeniv;\nPFNGLARRAYELEMENTPROC glad_glArrayElement;\nPFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC glad_glGetCompressedTextureSubImage;\nPFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData;\nPFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv;\nPFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d;\nPFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback;\nPFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f;\nPFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv;\nPFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v;\nPFNGLDEPTHMASKPROC glad_glDepthMask;\nPFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s;\nPFNGLCOLOR3FVPROC glad_glColor3fv;\nPFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample;\nPFNGLPROGRAMUNIFORM1FVPROC glad_glProgramUniform1fv;\nPFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv;\nPFNGLUNIFORM4FVPROC glad_glUniform4fv;\nPFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform;\nPFNGLCOLORPOINTERPROC glad_glColorPointer;\nPFNGLFRONTFACEPROC glad_glFrontFace;\nPFNGLTEXBUFFERRANGEPROC glad_glTexBufferRange;\nPFNGLCREATEBUFFERSPROC glad_glCreateBuffers;\nPFNGLNAMEDFRAMEBUFFERPARAMETERIPROC glad_glNamedFramebufferParameteri;\nPFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC glad_glDrawArraysInstancedBaseInstance;\nPFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v;\nPFNGLVERTEXATTRIBL3DPROC glad_glVertexAttribL3d;\nPFNGLDELETEPROGRAMPIPELINESPROC glad_glDeleteProgramPipelines;\nPFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv;\nPFNGLCLIPCONTROLPROC glad_glClipControl;\nPFNGLGETPROGRAMRESOURCEIVPROC glad_glGetProgramResourceiv;\nint GLAD_GL_KHR_debug;\nPFNGLDEBUGMESSAGECONTROLKHRPROC glad_glDebugMessageControlKHR;\nPFNGLDEBUGMESSAGEINSERTKHRPROC glad_glDebugMessageInsertKHR;\nPFNGLDEBUGMESSAGECALLBACKKHRPROC glad_glDebugMessageCallbackKHR;\nPFNGLGETDEBUGMESSAGELOGKHRPROC glad_glGetDebugMessageLogKHR;\nPFNGLPUSHDEBUGGROUPKHRPROC glad_glPushDebugGroupKHR;\nPFNGLPOPDEBUGGROUPKHRPROC glad_glPopDebugGroupKHR;\nPFNGLOBJECTLABELKHRPROC glad_glObjectLabelKHR;\nPFNGLGETOBJECTLABELKHRPROC glad_glGetObjectLabelKHR;\nPFNGLOBJECTPTRLABELKHRPROC glad_glObjectPtrLabelKHR;\nPFNGLGETOBJECTPTRLABELKHRPROC glad_glGetObjectPtrLabelKHR;\nPFNGLGETPOINTERVKHRPROC glad_glGetPointervKHR;\nstatic void load_GL_VERSION_1_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_0) return;\n\tglad_glCullFace = (PFNGLCULLFACEPROC)load(\"glCullFace\");\n\tglad_glFrontFace = (PFNGLFRONTFACEPROC)load(\"glFrontFace\");\n\tglad_glHint = (PFNGLHINTPROC)load(\"glHint\");\n\tglad_glLineWidth = (PFNGLLINEWIDTHPROC)load(\"glLineWidth\");\n\tglad_glPointSize = (PFNGLPOINTSIZEPROC)load(\"glPointSize\");\n\tglad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load(\"glPolygonMode\");\n\tglad_glScissor = (PFNGLSCISSORPROC)load(\"glScissor\");\n\tglad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load(\"glTexParameterf\");\n\tglad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load(\"glTexParameterfv\");\n\tglad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load(\"glTexParameteri\");\n\tglad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load(\"glTexParameteriv\");\n\tglad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load(\"glTexImage1D\");\n\tglad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load(\"glTexImage2D\");\n\tglad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load(\"glDrawBuffer\");\n\tglad_glClear = (PFNGLCLEARPROC)load(\"glClear\");\n\tglad_glClearColor = (PFNGLCLEARCOLORPROC)load(\"glClearColor\");\n\tglad_glClearStencil = (PFNGLCLEARSTENCILPROC)load(\"glClearStencil\");\n\tglad_glClearDepth = (PFNGLCLEARDEPTHPROC)load(\"glClearDepth\");\n\tglad_glStencilMask = (PFNGLSTENCILMASKPROC)load(\"glStencilMask\");\n\tglad_glColorMask = (PFNGLCOLORMASKPROC)load(\"glColorMask\");\n\tglad_glDepthMask = (PFNGLDEPTHMASKPROC)load(\"glDepthMask\");\n\tglad_glDisable = (PFNGLDISABLEPROC)load(\"glDisable\");\n\tglad_glEnable = (PFNGLENABLEPROC)load(\"glEnable\");\n\tglad_glFinish = (PFNGLFINISHPROC)load(\"glFinish\");\n\tglad_glFlush = (PFNGLFLUSHPROC)load(\"glFlush\");\n\tglad_glBlendFunc = (PFNGLBLENDFUNCPROC)load(\"glBlendFunc\");\n\tglad_glLogicOp = (PFNGLLOGICOPPROC)load(\"glLogicOp\");\n\tglad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load(\"glStencilFunc\");\n\tglad_glStencilOp = (PFNGLSTENCILOPPROC)load(\"glStencilOp\");\n\tglad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load(\"glDepthFunc\");\n\tglad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load(\"glPixelStoref\");\n\tglad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load(\"glPixelStorei\");\n\tglad_glReadBuffer = (PFNGLREADBUFFERPROC)load(\"glReadBuffer\");\n\tglad_glReadPixels = (PFNGLREADPIXELSPROC)load(\"glReadPixels\");\n\tglad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load(\"glGetBooleanv\");\n\tglad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load(\"glGetDoublev\");\n\tglad_glGetError = (PFNGLGETERRORPROC)load(\"glGetError\");\n\tglad_glGetFloatv = (PFNGLGETFLOATVPROC)load(\"glGetFloatv\");\n\tglad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load(\"glGetIntegerv\");\n\tglad_glGetString = (PFNGLGETSTRINGPROC)load(\"glGetString\");\n\tglad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load(\"glGetTexImage\");\n\tglad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load(\"glGetTexParameterfv\");\n\tglad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load(\"glGetTexParameteriv\");\n\tglad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load(\"glGetTexLevelParameterfv\");\n\tglad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load(\"glGetTexLevelParameteriv\");\n\tglad_glIsEnabled = (PFNGLISENABLEDPROC)load(\"glIsEnabled\");\n\tglad_glDepthRange = (PFNGLDEPTHRANGEPROC)load(\"glDepthRange\");\n\tglad_glViewport = (PFNGLVIEWPORTPROC)load(\"glViewport\");\n\tglad_glNewList = (PFNGLNEWLISTPROC)load(\"glNewList\");\n\tglad_glEndList = (PFNGLENDLISTPROC)load(\"glEndList\");\n\tglad_glCallList = (PFNGLCALLLISTPROC)load(\"glCallList\");\n\tglad_glCallLists = (PFNGLCALLLISTSPROC)load(\"glCallLists\");\n\tglad_glDeleteLists = (PFNGLDELETELISTSPROC)load(\"glDeleteLists\");\n\tglad_glGenLists = (PFNGLGENLISTSPROC)load(\"glGenLists\");\n\tglad_glListBase = (PFNGLLISTBASEPROC)load(\"glListBase\");\n\tglad_glBegin = (PFNGLBEGINPROC)load(\"glBegin\");\n\tglad_glBitmap = (PFNGLBITMAPPROC)load(\"glBitmap\");\n\tglad_glColor3b = (PFNGLCOLOR3BPROC)load(\"glColor3b\");\n\tglad_glColor3bv = (PFNGLCOLOR3BVPROC)load(\"glColor3bv\");\n\tglad_glColor3d = (PFNGLCOLOR3DPROC)load(\"glColor3d\");\n\tglad_glColor3dv = (PFNGLCOLOR3DVPROC)load(\"glColor3dv\");\n\tglad_glColor3f = (PFNGLCOLOR3FPROC)load(\"glColor3f\");\n\tglad_glColor3fv = (PFNGLCOLOR3FVPROC)load(\"glColor3fv\");\n\tglad_glColor3i = (PFNGLCOLOR3IPROC)load(\"glColor3i\");\n\tglad_glColor3iv = (PFNGLCOLOR3IVPROC)load(\"glColor3iv\");\n\tglad_glColor3s = (PFNGLCOLOR3SPROC)load(\"glColor3s\");\n\tglad_glColor3sv = (PFNGLCOLOR3SVPROC)load(\"glColor3sv\");\n\tglad_glColor3ub = (PFNGLCOLOR3UBPROC)load(\"glColor3ub\");\n\tglad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load(\"glColor3ubv\");\n\tglad_glColor3ui = (PFNGLCOLOR3UIPROC)load(\"glColor3ui\");\n\tglad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load(\"glColor3uiv\");\n\tglad_glColor3us = (PFNGLCOLOR3USPROC)load(\"glColor3us\");\n\tglad_glColor3usv = (PFNGLCOLOR3USVPROC)load(\"glColor3usv\");\n\tglad_glColor4b = (PFNGLCOLOR4BPROC)load(\"glColor4b\");\n\tglad_glColor4bv = (PFNGLCOLOR4BVPROC)load(\"glColor4bv\");\n\tglad_glColor4d = (PFNGLCOLOR4DPROC)load(\"glColor4d\");\n\tglad_glColor4dv = (PFNGLCOLOR4DVPROC)load(\"glColor4dv\");\n\tglad_glColor4f = (PFNGLCOLOR4FPROC)load(\"glColor4f\");\n\tglad_glColor4fv = (PFNGLCOLOR4FVPROC)load(\"glColor4fv\");\n\tglad_glColor4i = (PFNGLCOLOR4IPROC)load(\"glColor4i\");\n\tglad_glColor4iv = (PFNGLCOLOR4IVPROC)load(\"glColor4iv\");\n\tglad_glColor4s = (PFNGLCOLOR4SPROC)load(\"glColor4s\");\n\tglad_glColor4sv = (PFNGLCOLOR4SVPROC)load(\"glColor4sv\");\n\tglad_glColor4ub = (PFNGLCOLOR4UBPROC)load(\"glColor4ub\");\n\tglad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load(\"glColor4ubv\");\n\tglad_glColor4ui = (PFNGLCOLOR4UIPROC)load(\"glColor4ui\");\n\tglad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load(\"glColor4uiv\");\n\tglad_glColor4us = (PFNGLCOLOR4USPROC)load(\"glColor4us\");\n\tglad_glColor4usv = (PFNGLCOLOR4USVPROC)load(\"glColor4usv\");\n\tglad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load(\"glEdgeFlag\");\n\tglad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load(\"glEdgeFlagv\");\n\tglad_glEnd = (PFNGLENDPROC)load(\"glEnd\");\n\tglad_glIndexd = (PFNGLINDEXDPROC)load(\"glIndexd\");\n\tglad_glIndexdv = (PFNGLINDEXDVPROC)load(\"glIndexdv\");\n\tglad_glIndexf = (PFNGLINDEXFPROC)load(\"glIndexf\");\n\tglad_glIndexfv = (PFNGLINDEXFVPROC)load(\"glIndexfv\");\n\tglad_glIndexi = (PFNGLINDEXIPROC)load(\"glIndexi\");\n\tglad_glIndexiv = (PFNGLINDEXIVPROC)load(\"glIndexiv\");\n\tglad_glIndexs = (PFNGLINDEXSPROC)load(\"glIndexs\");\n\tglad_glIndexsv = (PFNGLINDEXSVPROC)load(\"glIndexsv\");\n\tglad_glNormal3b = (PFNGLNORMAL3BPROC)load(\"glNormal3b\");\n\tglad_glNormal3bv = (PFNGLNORMAL3BVPROC)load(\"glNormal3bv\");\n\tglad_glNormal3d = (PFNGLNORMAL3DPROC)load(\"glNormal3d\");\n\tglad_glNormal3dv = (PFNGLNORMAL3DVPROC)load(\"glNormal3dv\");\n\tglad_glNormal3f = (PFNGLNORMAL3FPROC)load(\"glNormal3f\");\n\tglad_glNormal3fv = (PFNGLNORMAL3FVPROC)load(\"glNormal3fv\");\n\tglad_glNormal3i = (PFNGLNORMAL3IPROC)load(\"glNormal3i\");\n\tglad_glNormal3iv = (PFNGLNORMAL3IVPROC)load(\"glNormal3iv\");\n\tglad_glNormal3s = (PFNGLNORMAL3SPROC)load(\"glNormal3s\");\n\tglad_glNormal3sv = (PFNGLNORMAL3SVPROC)load(\"glNormal3sv\");\n\tglad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load(\"glRasterPos2d\");\n\tglad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load(\"glRasterPos2dv\");\n\tglad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load(\"glRasterPos2f\");\n\tglad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load(\"glRasterPos2fv\");\n\tglad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load(\"glRasterPos2i\");\n\tglad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load(\"glRasterPos2iv\");\n\tglad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load(\"glRasterPos2s\");\n\tglad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load(\"glRasterPos2sv\");\n\tglad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load(\"glRasterPos3d\");\n\tglad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load(\"glRasterPos3dv\");\n\tglad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load(\"glRasterPos3f\");\n\tglad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load(\"glRasterPos3fv\");\n\tglad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load(\"glRasterPos3i\");\n\tglad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load(\"glRasterPos3iv\");\n\tglad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load(\"glRasterPos3s\");\n\tglad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load(\"glRasterPos3sv\");\n\tglad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load(\"glRasterPos4d\");\n\tglad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load(\"glRasterPos4dv\");\n\tglad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load(\"glRasterPos4f\");\n\tglad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load(\"glRasterPos4fv\");\n\tglad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load(\"glRasterPos4i\");\n\tglad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load(\"glRasterPos4iv\");\n\tglad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load(\"glRasterPos4s\");\n\tglad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load(\"glRasterPos4sv\");\n\tglad_glRectd = (PFNGLRECTDPROC)load(\"glRectd\");\n\tglad_glRectdv = (PFNGLRECTDVPROC)load(\"glRectdv\");\n\tglad_glRectf = (PFNGLRECTFPROC)load(\"glRectf\");\n\tglad_glRectfv = (PFNGLRECTFVPROC)load(\"glRectfv\");\n\tglad_glRecti = (PFNGLRECTIPROC)load(\"glRecti\");\n\tglad_glRectiv = (PFNGLRECTIVPROC)load(\"glRectiv\");\n\tglad_glRects = (PFNGLRECTSPROC)load(\"glRects\");\n\tglad_glRectsv = (PFNGLRECTSVPROC)load(\"glRectsv\");\n\tglad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load(\"glTexCoord1d\");\n\tglad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load(\"glTexCoord1dv\");\n\tglad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load(\"glTexCoord1f\");\n\tglad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load(\"glTexCoord1fv\");\n\tglad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load(\"glTexCoord1i\");\n\tglad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load(\"glTexCoord1iv\");\n\tglad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load(\"glTexCoord1s\");\n\tglad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load(\"glTexCoord1sv\");\n\tglad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load(\"glTexCoord2d\");\n\tglad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load(\"glTexCoord2dv\");\n\tglad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load(\"glTexCoord2f\");\n\tglad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load(\"glTexCoord2fv\");\n\tglad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load(\"glTexCoord2i\");\n\tglad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load(\"glTexCoord2iv\");\n\tglad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load(\"glTexCoord2s\");\n\tglad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load(\"glTexCoord2sv\");\n\tglad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load(\"glTexCoord3d\");\n\tglad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load(\"glTexCoord3dv\");\n\tglad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load(\"glTexCoord3f\");\n\tglad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load(\"glTexCoord3fv\");\n\tglad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load(\"glTexCoord3i\");\n\tglad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load(\"glTexCoord3iv\");\n\tglad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load(\"glTexCoord3s\");\n\tglad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load(\"glTexCoord3sv\");\n\tglad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load(\"glTexCoord4d\");\n\tglad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load(\"glTexCoord4dv\");\n\tglad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load(\"glTexCoord4f\");\n\tglad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load(\"glTexCoord4fv\");\n\tglad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load(\"glTexCoord4i\");\n\tglad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load(\"glTexCoord4iv\");\n\tglad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load(\"glTexCoord4s\");\n\tglad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load(\"glTexCoord4sv\");\n\tglad_glVertex2d = (PFNGLVERTEX2DPROC)load(\"glVertex2d\");\n\tglad_glVertex2dv = (PFNGLVERTEX2DVPROC)load(\"glVertex2dv\");\n\tglad_glVertex2f = (PFNGLVERTEX2FPROC)load(\"glVertex2f\");\n\tglad_glVertex2fv = (PFNGLVERTEX2FVPROC)load(\"glVertex2fv\");\n\tglad_glVertex2i = (PFNGLVERTEX2IPROC)load(\"glVertex2i\");\n\tglad_glVertex2iv = (PFNGLVERTEX2IVPROC)load(\"glVertex2iv\");\n\tglad_glVertex2s = (PFNGLVERTEX2SPROC)load(\"glVertex2s\");\n\tglad_glVertex2sv = (PFNGLVERTEX2SVPROC)load(\"glVertex2sv\");\n\tglad_glVertex3d = (PFNGLVERTEX3DPROC)load(\"glVertex3d\");\n\tglad_glVertex3dv = (PFNGLVERTEX3DVPROC)load(\"glVertex3dv\");\n\tglad_glVertex3f = (PFNGLVERTEX3FPROC)load(\"glVertex3f\");\n\tglad_glVertex3fv = (PFNGLVERTEX3FVPROC)load(\"glVertex3fv\");\n\tglad_glVertex3i = (PFNGLVERTEX3IPROC)load(\"glVertex3i\");\n\tglad_glVertex3iv = (PFNGLVERTEX3IVPROC)load(\"glVertex3iv\");\n\tglad_glVertex3s = (PFNGLVERTEX3SPROC)load(\"glVertex3s\");\n\tglad_glVertex3sv = (PFNGLVERTEX3SVPROC)load(\"glVertex3sv\");\n\tglad_glVertex4d = (PFNGLVERTEX4DPROC)load(\"glVertex4d\");\n\tglad_glVertex4dv = (PFNGLVERTEX4DVPROC)load(\"glVertex4dv\");\n\tglad_glVertex4f = (PFNGLVERTEX4FPROC)load(\"glVertex4f\");\n\tglad_glVertex4fv = (PFNGLVERTEX4FVPROC)load(\"glVertex4fv\");\n\tglad_glVertex4i = (PFNGLVERTEX4IPROC)load(\"glVertex4i\");\n\tglad_glVertex4iv = (PFNGLVERTEX4IVPROC)load(\"glVertex4iv\");\n\tglad_glVertex4s = (PFNGLVERTEX4SPROC)load(\"glVertex4s\");\n\tglad_glVertex4sv = (PFNGLVERTEX4SVPROC)load(\"glVertex4sv\");\n\tglad_glClipPlane = (PFNGLCLIPPLANEPROC)load(\"glClipPlane\");\n\tglad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load(\"glColorMaterial\");\n\tglad_glFogf = (PFNGLFOGFPROC)load(\"glFogf\");\n\tglad_glFogfv = (PFNGLFOGFVPROC)load(\"glFogfv\");\n\tglad_glFogi = (PFNGLFOGIPROC)load(\"glFogi\");\n\tglad_glFogiv = (PFNGLFOGIVPROC)load(\"glFogiv\");\n\tglad_glLightf = (PFNGLLIGHTFPROC)load(\"glLightf\");\n\tglad_glLightfv = (PFNGLLIGHTFVPROC)load(\"glLightfv\");\n\tglad_glLighti = (PFNGLLIGHTIPROC)load(\"glLighti\");\n\tglad_glLightiv = (PFNGLLIGHTIVPROC)load(\"glLightiv\");\n\tglad_glLightModelf = (PFNGLLIGHTMODELFPROC)load(\"glLightModelf\");\n\tglad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load(\"glLightModelfv\");\n\tglad_glLightModeli = (PFNGLLIGHTMODELIPROC)load(\"glLightModeli\");\n\tglad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load(\"glLightModeliv\");\n\tglad_glLineStipple = (PFNGLLINESTIPPLEPROC)load(\"glLineStipple\");\n\tglad_glMaterialf = (PFNGLMATERIALFPROC)load(\"glMaterialf\");\n\tglad_glMaterialfv = (PFNGLMATERIALFVPROC)load(\"glMaterialfv\");\n\tglad_glMateriali = (PFNGLMATERIALIPROC)load(\"glMateriali\");\n\tglad_glMaterialiv = (PFNGLMATERIALIVPROC)load(\"glMaterialiv\");\n\tglad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load(\"glPolygonStipple\");\n\tglad_glShadeModel = (PFNGLSHADEMODELPROC)load(\"glShadeModel\");\n\tglad_glTexEnvf = (PFNGLTEXENVFPROC)load(\"glTexEnvf\");\n\tglad_glTexEnvfv = (PFNGLTEXENVFVPROC)load(\"glTexEnvfv\");\n\tglad_glTexEnvi = (PFNGLTEXENVIPROC)load(\"glTexEnvi\");\n\tglad_glTexEnviv = (PFNGLTEXENVIVPROC)load(\"glTexEnviv\");\n\tglad_glTexGend = (PFNGLTEXGENDPROC)load(\"glTexGend\");\n\tglad_glTexGendv = (PFNGLTEXGENDVPROC)load(\"glTexGendv\");\n\tglad_glTexGenf = (PFNGLTEXGENFPROC)load(\"glTexGenf\");\n\tglad_glTexGenfv = (PFNGLTEXGENFVPROC)load(\"glTexGenfv\");\n\tglad_glTexGeni = (PFNGLTEXGENIPROC)load(\"glTexGeni\");\n\tglad_glTexGeniv = (PFNGLTEXGENIVPROC)load(\"glTexGeniv\");\n\tglad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load(\"glFeedbackBuffer\");\n\tglad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load(\"glSelectBuffer\");\n\tglad_glRenderMode = (PFNGLRENDERMODEPROC)load(\"glRenderMode\");\n\tglad_glInitNames = (PFNGLINITNAMESPROC)load(\"glInitNames\");\n\tglad_glLoadName = (PFNGLLOADNAMEPROC)load(\"glLoadName\");\n\tglad_glPassThrough = (PFNGLPASSTHROUGHPROC)load(\"glPassThrough\");\n\tglad_glPopName = (PFNGLPOPNAMEPROC)load(\"glPopName\");\n\tglad_glPushName = (PFNGLPUSHNAMEPROC)load(\"glPushName\");\n\tglad_glClearAccum = (PFNGLCLEARACCUMPROC)load(\"glClearAccum\");\n\tglad_glClearIndex = (PFNGLCLEARINDEXPROC)load(\"glClearIndex\");\n\tglad_glIndexMask = (PFNGLINDEXMASKPROC)load(\"glIndexMask\");\n\tglad_glAccum = (PFNGLACCUMPROC)load(\"glAccum\");\n\tglad_glPopAttrib = (PFNGLPOPATTRIBPROC)load(\"glPopAttrib\");\n\tglad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load(\"glPushAttrib\");\n\tglad_glMap1d = (PFNGLMAP1DPROC)load(\"glMap1d\");\n\tglad_glMap1f = (PFNGLMAP1FPROC)load(\"glMap1f\");\n\tglad_glMap2d = (PFNGLMAP2DPROC)load(\"glMap2d\");\n\tglad_glMap2f = (PFNGLMAP2FPROC)load(\"glMap2f\");\n\tglad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load(\"glMapGrid1d\");\n\tglad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load(\"glMapGrid1f\");\n\tglad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load(\"glMapGrid2d\");\n\tglad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load(\"glMapGrid2f\");\n\tglad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load(\"glEvalCoord1d\");\n\tglad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load(\"glEvalCoord1dv\");\n\tglad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load(\"glEvalCoord1f\");\n\tglad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load(\"glEvalCoord1fv\");\n\tglad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load(\"glEvalCoord2d\");\n\tglad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load(\"glEvalCoord2dv\");\n\tglad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load(\"glEvalCoord2f\");\n\tglad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load(\"glEvalCoord2fv\");\n\tglad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load(\"glEvalMesh1\");\n\tglad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load(\"glEvalPoint1\");\n\tglad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load(\"glEvalMesh2\");\n\tglad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load(\"glEvalPoint2\");\n\tglad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load(\"glAlphaFunc\");\n\tglad_glPixelZoom = (PFNGLPIXELZOOMPROC)load(\"glPixelZoom\");\n\tglad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load(\"glPixelTransferf\");\n\tglad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load(\"glPixelTransferi\");\n\tglad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load(\"glPixelMapfv\");\n\tglad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load(\"glPixelMapuiv\");\n\tglad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load(\"glPixelMapusv\");\n\tglad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load(\"glCopyPixels\");\n\tglad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load(\"glDrawPixels\");\n\tglad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load(\"glGetClipPlane\");\n\tglad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load(\"glGetLightfv\");\n\tglad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load(\"glGetLightiv\");\n\tglad_glGetMapdv = (PFNGLGETMAPDVPROC)load(\"glGetMapdv\");\n\tglad_glGetMapfv = (PFNGLGETMAPFVPROC)load(\"glGetMapfv\");\n\tglad_glGetMapiv = (PFNGLGETMAPIVPROC)load(\"glGetMapiv\");\n\tglad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load(\"glGetMaterialfv\");\n\tglad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load(\"glGetMaterialiv\");\n\tglad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load(\"glGetPixelMapfv\");\n\tglad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load(\"glGetPixelMapuiv\");\n\tglad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load(\"glGetPixelMapusv\");\n\tglad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load(\"glGetPolygonStipple\");\n\tglad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load(\"glGetTexEnvfv\");\n\tglad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load(\"glGetTexEnviv\");\n\tglad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load(\"glGetTexGendv\");\n\tglad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load(\"glGetTexGenfv\");\n\tglad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load(\"glGetTexGeniv\");\n\tglad_glIsList = (PFNGLISLISTPROC)load(\"glIsList\");\n\tglad_glFrustum = (PFNGLFRUSTUMPROC)load(\"glFrustum\");\n\tglad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load(\"glLoadIdentity\");\n\tglad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load(\"glLoadMatrixf\");\n\tglad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load(\"glLoadMatrixd\");\n\tglad_glMatrixMode = (PFNGLMATRIXMODEPROC)load(\"glMatrixMode\");\n\tglad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load(\"glMultMatrixf\");\n\tglad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load(\"glMultMatrixd\");\n\tglad_glOrtho = (PFNGLORTHOPROC)load(\"glOrtho\");\n\tglad_glPopMatrix = (PFNGLPOPMATRIXPROC)load(\"glPopMatrix\");\n\tglad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load(\"glPushMatrix\");\n\tglad_glRotated = (PFNGLROTATEDPROC)load(\"glRotated\");\n\tglad_glRotatef = (PFNGLROTATEFPROC)load(\"glRotatef\");\n\tglad_glScaled = (PFNGLSCALEDPROC)load(\"glScaled\");\n\tglad_glScalef = (PFNGLSCALEFPROC)load(\"glScalef\");\n\tglad_glTranslated = (PFNGLTRANSLATEDPROC)load(\"glTranslated\");\n\tglad_glTranslatef = (PFNGLTRANSLATEFPROC)load(\"glTranslatef\");\n}\nstatic void load_GL_VERSION_1_1(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_1) return;\n\tglad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load(\"glDrawArrays\");\n\tglad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load(\"glDrawElements\");\n\tglad_glGetPointerv = (PFNGLGETPOINTERVPROC)load(\"glGetPointerv\");\n\tglad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load(\"glPolygonOffset\");\n\tglad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load(\"glCopyTexImage1D\");\n\tglad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load(\"glCopyTexImage2D\");\n\tglad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load(\"glCopyTexSubImage1D\");\n\tglad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load(\"glCopyTexSubImage2D\");\n\tglad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load(\"glTexSubImage1D\");\n\tglad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load(\"glTexSubImage2D\");\n\tglad_glBindTexture = (PFNGLBINDTEXTUREPROC)load(\"glBindTexture\");\n\tglad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load(\"glDeleteTextures\");\n\tglad_glGenTextures = (PFNGLGENTEXTURESPROC)load(\"glGenTextures\");\n\tglad_glIsTexture = (PFNGLISTEXTUREPROC)load(\"glIsTexture\");\n\tglad_glArrayElement = (PFNGLARRAYELEMENTPROC)load(\"glArrayElement\");\n\tglad_glColorPointer = (PFNGLCOLORPOINTERPROC)load(\"glColorPointer\");\n\tglad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load(\"glDisableClientState\");\n\tglad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load(\"glEdgeFlagPointer\");\n\tglad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load(\"glEnableClientState\");\n\tglad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load(\"glIndexPointer\");\n\tglad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load(\"glInterleavedArrays\");\n\tglad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load(\"glNormalPointer\");\n\tglad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load(\"glTexCoordPointer\");\n\tglad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load(\"glVertexPointer\");\n\tglad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load(\"glAreTexturesResident\");\n\tglad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load(\"glPrioritizeTextures\");\n\tglad_glIndexub = (PFNGLINDEXUBPROC)load(\"glIndexub\");\n\tglad_glIndexubv = (PFNGLINDEXUBVPROC)load(\"glIndexubv\");\n\tglad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load(\"glPopClientAttrib\");\n\tglad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load(\"glPushClientAttrib\");\n}\nstatic void load_GL_VERSION_1_2(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_2) return;\n\tglad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load(\"glDrawRangeElements\");\n\tglad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load(\"glTexImage3D\");\n\tglad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load(\"glTexSubImage3D\");\n\tglad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load(\"glCopyTexSubImage3D\");\n}\nstatic void load_GL_VERSION_1_3(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_3) return;\n\tglad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load(\"glActiveTexture\");\n\tglad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load(\"glSampleCoverage\");\n\tglad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load(\"glCompressedTexImage3D\");\n\tglad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load(\"glCompressedTexImage2D\");\n\tglad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load(\"glCompressedTexImage1D\");\n\tglad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load(\"glCompressedTexSubImage3D\");\n\tglad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load(\"glCompressedTexSubImage2D\");\n\tglad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load(\"glCompressedTexSubImage1D\");\n\tglad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load(\"glGetCompressedTexImage\");\n\tglad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load(\"glClientActiveTexture\");\n\tglad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load(\"glMultiTexCoord1d\");\n\tglad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load(\"glMultiTexCoord1dv\");\n\tglad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load(\"glMultiTexCoord1f\");\n\tglad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load(\"glMultiTexCoord1fv\");\n\tglad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load(\"glMultiTexCoord1i\");\n\tglad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load(\"glMultiTexCoord1iv\");\n\tglad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load(\"glMultiTexCoord1s\");\n\tglad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load(\"glMultiTexCoord1sv\");\n\tglad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load(\"glMultiTexCoord2d\");\n\tglad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load(\"glMultiTexCoord2dv\");\n\tglad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load(\"glMultiTexCoord2f\");\n\tglad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load(\"glMultiTexCoord2fv\");\n\tglad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load(\"glMultiTexCoord2i\");\n\tglad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load(\"glMultiTexCoord2iv\");\n\tglad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load(\"glMultiTexCoord2s\");\n\tglad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load(\"glMultiTexCoord2sv\");\n\tglad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load(\"glMultiTexCoord3d\");\n\tglad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load(\"glMultiTexCoord3dv\");\n\tglad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load(\"glMultiTexCoord3f\");\n\tglad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load(\"glMultiTexCoord3fv\");\n\tglad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load(\"glMultiTexCoord3i\");\n\tglad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load(\"glMultiTexCoord3iv\");\n\tglad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load(\"glMultiTexCoord3s\");\n\tglad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load(\"glMultiTexCoord3sv\");\n\tglad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load(\"glMultiTexCoord4d\");\n\tglad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load(\"glMultiTexCoord4dv\");\n\tglad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load(\"glMultiTexCoord4f\");\n\tglad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load(\"glMultiTexCoord4fv\");\n\tglad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load(\"glMultiTexCoord4i\");\n\tglad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load(\"glMultiTexCoord4iv\");\n\tglad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load(\"glMultiTexCoord4s\");\n\tglad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load(\"glMultiTexCoord4sv\");\n\tglad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load(\"glLoadTransposeMatrixf\");\n\tglad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load(\"glLoadTransposeMatrixd\");\n\tglad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load(\"glMultTransposeMatrixf\");\n\tglad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load(\"glMultTransposeMatrixd\");\n}\nstatic void load_GL_VERSION_1_4(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_4) return;\n\tglad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load(\"glBlendFuncSeparate\");\n\tglad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load(\"glMultiDrawArrays\");\n\tglad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load(\"glMultiDrawElements\");\n\tglad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load(\"glPointParameterf\");\n\tglad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load(\"glPointParameterfv\");\n\tglad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load(\"glPointParameteri\");\n\tglad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load(\"glPointParameteriv\");\n\tglad_glFogCoordf = (PFNGLFOGCOORDFPROC)load(\"glFogCoordf\");\n\tglad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load(\"glFogCoordfv\");\n\tglad_glFogCoordd = (PFNGLFOGCOORDDPROC)load(\"glFogCoordd\");\n\tglad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load(\"glFogCoorddv\");\n\tglad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load(\"glFogCoordPointer\");\n\tglad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load(\"glSecondaryColor3b\");\n\tglad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load(\"glSecondaryColor3bv\");\n\tglad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load(\"glSecondaryColor3d\");\n\tglad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load(\"glSecondaryColor3dv\");\n\tglad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load(\"glSecondaryColor3f\");\n\tglad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load(\"glSecondaryColor3fv\");\n\tglad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load(\"glSecondaryColor3i\");\n\tglad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load(\"glSecondaryColor3iv\");\n\tglad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load(\"glSecondaryColor3s\");\n\tglad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load(\"glSecondaryColor3sv\");\n\tglad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load(\"glSecondaryColor3ub\");\n\tglad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load(\"glSecondaryColor3ubv\");\n\tglad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load(\"glSecondaryColor3ui\");\n\tglad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load(\"glSecondaryColor3uiv\");\n\tglad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load(\"glSecondaryColor3us\");\n\tglad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load(\"glSecondaryColor3usv\");\n\tglad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load(\"glSecondaryColorPointer\");\n\tglad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load(\"glWindowPos2d\");\n\tglad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load(\"glWindowPos2dv\");\n\tglad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load(\"glWindowPos2f\");\n\tglad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load(\"glWindowPos2fv\");\n\tglad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load(\"glWindowPos2i\");\n\tglad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load(\"glWindowPos2iv\");\n\tglad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load(\"glWindowPos2s\");\n\tglad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load(\"glWindowPos2sv\");\n\tglad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load(\"glWindowPos3d\");\n\tglad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load(\"glWindowPos3dv\");\n\tglad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load(\"glWindowPos3f\");\n\tglad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load(\"glWindowPos3fv\");\n\tglad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load(\"glWindowPos3i\");\n\tglad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load(\"glWindowPos3iv\");\n\tglad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load(\"glWindowPos3s\");\n\tglad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load(\"glWindowPos3sv\");\n\tglad_glBlendColor = (PFNGLBLENDCOLORPROC)load(\"glBlendColor\");\n\tglad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load(\"glBlendEquation\");\n}\nstatic void load_GL_VERSION_1_5(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_1_5) return;\n\tglad_glGenQueries = (PFNGLGENQUERIESPROC)load(\"glGenQueries\");\n\tglad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load(\"glDeleteQueries\");\n\tglad_glIsQuery = (PFNGLISQUERYPROC)load(\"glIsQuery\");\n\tglad_glBeginQuery = (PFNGLBEGINQUERYPROC)load(\"glBeginQuery\");\n\tglad_glEndQuery = (PFNGLENDQUERYPROC)load(\"glEndQuery\");\n\tglad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load(\"glGetQueryiv\");\n\tglad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load(\"glGetQueryObjectiv\");\n\tglad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load(\"glGetQueryObjectuiv\");\n\tglad_glBindBuffer = (PFNGLBINDBUFFERPROC)load(\"glBindBuffer\");\n\tglad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load(\"glDeleteBuffers\");\n\tglad_glGenBuffers = (PFNGLGENBUFFERSPROC)load(\"glGenBuffers\");\n\tglad_glIsBuffer = (PFNGLISBUFFERPROC)load(\"glIsBuffer\");\n\tglad_glBufferData = (PFNGLBUFFERDATAPROC)load(\"glBufferData\");\n\tglad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load(\"glBufferSubData\");\n\tglad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load(\"glGetBufferSubData\");\n\tglad_glMapBuffer = (PFNGLMAPBUFFERPROC)load(\"glMapBuffer\");\n\tglad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load(\"glUnmapBuffer\");\n\tglad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load(\"glGetBufferParameteriv\");\n\tglad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load(\"glGetBufferPointerv\");\n}\nstatic void load_GL_VERSION_2_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_2_0) return;\n\tglad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load(\"glBlendEquationSeparate\");\n\tglad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load(\"glDrawBuffers\");\n\tglad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load(\"glStencilOpSeparate\");\n\tglad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load(\"glStencilFuncSeparate\");\n\tglad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load(\"glStencilMaskSeparate\");\n\tglad_glAttachShader = (PFNGLATTACHSHADERPROC)load(\"glAttachShader\");\n\tglad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load(\"glBindAttribLocation\");\n\tglad_glCompileShader = (PFNGLCOMPILESHADERPROC)load(\"glCompileShader\");\n\tglad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load(\"glCreateProgram\");\n\tglad_glCreateShader = (PFNGLCREATESHADERPROC)load(\"glCreateShader\");\n\tglad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load(\"glDeleteProgram\");\n\tglad_glDeleteShader = (PFNGLDELETESHADERPROC)load(\"glDeleteShader\");\n\tglad_glDetachShader = (PFNGLDETACHSHADERPROC)load(\"glDetachShader\");\n\tglad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load(\"glDisableVertexAttribArray\");\n\tglad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load(\"glEnableVertexAttribArray\");\n\tglad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load(\"glGetActiveAttrib\");\n\tglad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load(\"glGetActiveUniform\");\n\tglad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load(\"glGetAttachedShaders\");\n\tglad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load(\"glGetAttribLocation\");\n\tglad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load(\"glGetProgramiv\");\n\tglad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load(\"glGetProgramInfoLog\");\n\tglad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load(\"glGetShaderiv\");\n\tglad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load(\"glGetShaderInfoLog\");\n\tglad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load(\"glGetShaderSource\");\n\tglad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load(\"glGetUniformLocation\");\n\tglad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load(\"glGetUniformfv\");\n\tglad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load(\"glGetUniformiv\");\n\tglad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load(\"glGetVertexAttribdv\");\n\tglad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load(\"glGetVertexAttribfv\");\n\tglad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load(\"glGetVertexAttribiv\");\n\tglad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load(\"glGetVertexAttribPointerv\");\n\tglad_glIsProgram = (PFNGLISPROGRAMPROC)load(\"glIsProgram\");\n\tglad_glIsShader = (PFNGLISSHADERPROC)load(\"glIsShader\");\n\tglad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load(\"glLinkProgram\");\n\tglad_glShaderSource = (PFNGLSHADERSOURCEPROC)load(\"glShaderSource\");\n\tglad_glUseProgram = (PFNGLUSEPROGRAMPROC)load(\"glUseProgram\");\n\tglad_glUniform1f = (PFNGLUNIFORM1FPROC)load(\"glUniform1f\");\n\tglad_glUniform2f = (PFNGLUNIFORM2FPROC)load(\"glUniform2f\");\n\tglad_glUniform3f = (PFNGLUNIFORM3FPROC)load(\"glUniform3f\");\n\tglad_glUniform4f = (PFNGLUNIFORM4FPROC)load(\"glUniform4f\");\n\tglad_glUniform1i = (PFNGLUNIFORM1IPROC)load(\"glUniform1i\");\n\tglad_glUniform2i = (PFNGLUNIFORM2IPROC)load(\"glUniform2i\");\n\tglad_glUniform3i = (PFNGLUNIFORM3IPROC)load(\"glUniform3i\");\n\tglad_glUniform4i = (PFNGLUNIFORM4IPROC)load(\"glUniform4i\");\n\tglad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load(\"glUniform1fv\");\n\tglad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load(\"glUniform2fv\");\n\tglad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load(\"glUniform3fv\");\n\tglad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load(\"glUniform4fv\");\n\tglad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load(\"glUniform1iv\");\n\tglad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load(\"glUniform2iv\");\n\tglad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load(\"glUniform3iv\");\n\tglad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load(\"glUniform4iv\");\n\tglad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load(\"glUniformMatrix2fv\");\n\tglad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load(\"glUniformMatrix3fv\");\n\tglad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load(\"glUniformMatrix4fv\");\n\tglad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load(\"glValidateProgram\");\n\tglad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load(\"glVertexAttrib1d\");\n\tglad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load(\"glVertexAttrib1dv\");\n\tglad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load(\"glVertexAttrib1f\");\n\tglad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load(\"glVertexAttrib1fv\");\n\tglad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load(\"glVertexAttrib1s\");\n\tglad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load(\"glVertexAttrib1sv\");\n\tglad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load(\"glVertexAttrib2d\");\n\tglad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load(\"glVertexAttrib2dv\");\n\tglad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load(\"glVertexAttrib2f\");\n\tglad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load(\"glVertexAttrib2fv\");\n\tglad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load(\"glVertexAttrib2s\");\n\tglad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load(\"glVertexAttrib2sv\");\n\tglad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load(\"glVertexAttrib3d\");\n\tglad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load(\"glVertexAttrib3dv\");\n\tglad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load(\"glVertexAttrib3f\");\n\tglad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load(\"glVertexAttrib3fv\");\n\tglad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load(\"glVertexAttrib3s\");\n\tglad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load(\"glVertexAttrib3sv\");\n\tglad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load(\"glVertexAttrib4Nbv\");\n\tglad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load(\"glVertexAttrib4Niv\");\n\tglad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load(\"glVertexAttrib4Nsv\");\n\tglad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load(\"glVertexAttrib4Nub\");\n\tglad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load(\"glVertexAttrib4Nubv\");\n\tglad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load(\"glVertexAttrib4Nuiv\");\n\tglad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load(\"glVertexAttrib4Nusv\");\n\tglad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load(\"glVertexAttrib4bv\");\n\tglad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load(\"glVertexAttrib4d\");\n\tglad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load(\"glVertexAttrib4dv\");\n\tglad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load(\"glVertexAttrib4f\");\n\tglad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load(\"glVertexAttrib4fv\");\n\tglad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load(\"glVertexAttrib4iv\");\n\tglad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load(\"glVertexAttrib4s\");\n\tglad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load(\"glVertexAttrib4sv\");\n\tglad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load(\"glVertexAttrib4ubv\");\n\tglad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load(\"glVertexAttrib4uiv\");\n\tglad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load(\"glVertexAttrib4usv\");\n\tglad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load(\"glVertexAttribPointer\");\n}\nstatic void load_GL_VERSION_2_1(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_2_1) return;\n\tglad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load(\"glUniformMatrix2x3fv\");\n\tglad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load(\"glUniformMatrix3x2fv\");\n\tglad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load(\"glUniformMatrix2x4fv\");\n\tglad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load(\"glUniformMatrix4x2fv\");\n\tglad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load(\"glUniformMatrix3x4fv\");\n\tglad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load(\"glUniformMatrix4x3fv\");\n}\nstatic void load_GL_VERSION_3_0(GLADloadproc load) {\n\tif(!GLAD_GL_VERSION_3_0) return;\n\tglad_glColorMaski = (PFNGLCOLORMASKIPROC)load(\"glColorMaski\");\n\tglad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load(\"glGetBooleani_v\");\n\tglad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load(\"glGetIntegeri_v\");\n\tglad_glEnablei = (PFNGLENABLEIPROC)load(\"glEnablei\");\n\tglad_glDisablei = (PFNGLDISABLEIPROC)load(\"glDisablei\");\n\tglad_glIsEnabledi = (PFNGLISENABLEDIPROC)load(\"glIsEnabledi\");\n\tglad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load(\"glBeginTransformFeedback\");\n"}, {"path": "src/stb_image.cpp", "language": "code", "loc": 2, "comment_density": 0.0, "code": "#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\""}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": "images/joeydevries_learnopengl_src.png", "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.004, "dedup_hash": "44df987f88843120", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_1_1_hello_window", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "1.1.Hello Window", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/1.1.hello_window/hello_window.cpp", "language": "code", "loc": 69, "comment_density": 0.304, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n } \n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.304, "dedup_hash": "d8ce816b10983838", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_1_2_hello_window_clear", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "1.2.Hello Window Clear", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/1.2.hello_window_clear/hello_window_clear.cpp", "language": "code", "loc": 73, "comment_density": 0.315, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n } \n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.315, "dedup_hash": "cf3c9ca0ab9e3228", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_1_hello_triangle", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.1.Hello Triangle", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp", "language": "code", "loc": 157, "comment_density": 0.299, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, 0.0f, // left \n 0.5f, -0.5f, 0.0f, // right \n 0.0f, 0.5f, 0.0f // top \n }; \n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind\n glBindBuffer(GL_ARRAY_BUFFER, 0); \n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n glBindVertexArray(0); \n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // draw our first triangle\n glUseProgram(shaderProgram);\n glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized\n glDrawArrays(GL_TRIANGLES, 0, 3);\n // glBindVertexArray(0); // no need to unbind it every time \n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.299, "dedup_hash": "5dfc017d52cbb431", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_2_hello_triangle_indexed", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.2.Hello Triangle Indexed", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.2.hello_triangle_indexed/hello_triangle_indexed.cpp", "language": "code", "loc": 169, "comment_density": 0.32, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n 0.5f, 0.5f, 0.0f, // top right\n 0.5f, -0.5f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f // top left \n };\n unsigned int indices[] = { // note that we start from 0!\n 0, 1, 3, // first Triangle\n 1, 2, 3 // second Triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind\n glBindBuffer(GL_ARRAY_BUFFER, 0); \n\n // remember: do NOT unbind the EBO while a VAO is active as the bound element buffer object IS stored in the VAO; keep the EBO bound.\n //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);\n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n glBindVertexArray(0); \n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // draw our first triangle\n glUseProgram(shaderProgram);\n glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized\n //glDrawArrays(GL_TRIANGLES, 0, 6);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n // glBindVertexArray(0); // no need to unbind it every time \n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.32, "dedup_hash": "d7ffa31f226241fe", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_3_hello_triangle_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.3.Hello Triangle Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.3.hello_triangle_exercise1/hello_triangle_exercise1.cpp", "language": "code", "loc": 163, "comment_density": 0.331, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n // add a new set of vertices to form a second triangle (a total of 6 vertices); the vertex attribute configuration remains the same (still one 3-float position vector per vertex)\n float vertices[] = {\n // first triangle\n -0.9f, -0.5f, 0.0f, // left \n -0.0f, -0.5f, 0.0f, // right\n -0.45f, 0.5f, 0.0f, // top \n // second triangle\n 0.0f, -0.5f, 0.0f, // left\n 0.9f, -0.5f, 0.0f, // right\n 0.45f, 0.5f, 0.0f // top \n }; \n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind\n glBindBuffer(GL_ARRAY_BUFFER, 0); \n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n glBindVertexArray(0); \n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // draw our first triangle\n glUseProgram(shaderProgram);\n glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized\n glDrawArrays(GL_TRIANGLES, 0, 6); // set the count to 6 since we're drawing 6 vertices now (2 triangles); not 3!\n // glBindVertexArray(0); // no need to unbind it every time \n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.331, "dedup_hash": "31be20b3b3d6a00a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_4_hello_triangle_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.4.Hello Triangle Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.4.hello_triangle_exercise2/hello_triangle_exercise2.cpp", "language": "code", "loc": 169, "comment_density": 0.331, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float firstTriangle[] = {\n -0.9f, -0.5f, 0.0f, // left \n -0.0f, -0.5f, 0.0f, // right\n -0.45f, 0.5f, 0.0f, // top \n };\n float secondTriangle[] = {\n 0.0f, -0.5f, 0.0f, // left\n 0.9f, -0.5f, 0.0f, // right\n 0.45f, 0.5f, 0.0f // top \n };\n unsigned int VBOs[2], VAOs[2];\n glGenVertexArrays(2, VAOs); // we can also generate multiple VAOs or buffers at the same time\n glGenBuffers(2, VBOs);\n // first triangle setup\n // --------------------\n glBindVertexArray(VAOs[0]);\n glBindBuffer(GL_ARRAY_BUFFER, VBOs[0]);\n glBufferData(GL_ARRAY_BUFFER, sizeof(firstTriangle), firstTriangle, GL_STATIC_DRAW);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\t// Vertex attributes stay the same\n glEnableVertexAttribArray(0);\n // glBindVertexArray(0); // no need to unbind at all as we directly bind a different VAO the next few lines\n // second triangle setup\n // ---------------------\n glBindVertexArray(VAOs[1]);\t// note that we bind to a different VAO now\n glBindBuffer(GL_ARRAY_BUFFER, VBOs[1]);\t// and a different VBO\n glBufferData(GL_ARRAY_BUFFER, sizeof(secondTriangle), secondTriangle, GL_STATIC_DRAW);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0); // because the vertex data is tightly packed we can also specify 0 as the vertex attribute's stride to let OpenGL figure it out\n glEnableVertexAttribArray(0);\n // glBindVertexArray(0); // not really necessary as well, but beware of calls that could affect VAOs while this one is bound (like binding element buffer objects, or enabling/disabling vertex attributes)\n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n glUseProgram(shaderProgram);\n // draw first triangle using the data from the first VAO\n glBindVertexArray(VAOs[0]);\n glDrawArrays(GL_TRIANGLES, 0, 3);\n // then we draw the second triangle using the data from the second VAO\n glBindVertexArray(VAOs[1]);\n glDrawArrays(GL_TRIANGLES, 0, 3);\n \n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(2, VAOs);\n glDeleteBuffers(2, VBOs);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.331, "dedup_hash": "68035e5b3314a206", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_2_5_hello_triangle_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "2.5.Hello Triangle Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/2.5.hello_triangle_exercise3/hello_triangle_exercise3.cpp", "language": "code", "loc": 163, "comment_density": 0.374, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource = \"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\\n\"\n \"}\\0\";\nconst char *fragmentShader1Source = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\\n\"\n \"}\\n\\0\";\nconst char *fragmentShader2Source = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(1.0f, 1.0f, 0.0f, 1.0f);\\n\"\n \"}\\n\\0\";\n\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader program\n // ------------------------------------\n // we skipped compile log checks this time for readability (if you do encounter issues, add the compile-checks! see previous code samples)\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n unsigned int fragmentShaderOrange = glCreateShader(GL_FRAGMENT_SHADER); // the first fragment shader that outputs the color orange\n unsigned int fragmentShaderYellow = glCreateShader(GL_FRAGMENT_SHADER); // the second fragment shader that outputs the color yellow\n unsigned int shaderProgramOrange = glCreateProgram();\n unsigned int shaderProgramYellow = glCreateProgram(); // the second shader program\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n glShaderSource(fragmentShaderOrange, 1, &fragmentShader1Source, NULL);\n glCompileShader(fragmentShaderOrange);\n glShaderSource(fragmentShaderYellow, 1, &fragmentShader2Source, NULL);\n glCompileShader(fragmentShaderYellow);\n // link the first program object\n glAttachShader(shaderProgramOrange, vertexShader);\n glAttachShader(shaderProgramOrange, fragmentShaderOrange);\n glLinkProgram(shaderProgramOrange);\n // then link the second program object using a different fragment shader (but same vertex shader)\n // this is perfectly allowed since the inputs and outputs of both the vertex and fragment shaders are equally matched.\n glAttachShader(shaderProgramYellow, vertexShader);\n glAttachShader(shaderProgramYellow, fragmentShaderYellow);\n glLinkProgram(shaderProgramYellow);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float firstTriangle[] = {\n -0.9f, -0.5f, 0.0f, // left \n -0.0f, -0.5f, 0.0f, // right\n -0.45f, 0.5f, 0.0f, // top \n };\n float secondTriangle[] = {\n 0.0f, -0.5f, 0.0f, // left\n 0.9f, -0.5f, 0.0f, // right\n 0.45f, 0.5f, 0.0f // top \n };\n unsigned int VBOs[2], VAOs[2];\n glGenVertexArrays(2, VAOs); // we can also generate multiple VAOs or buffers at the same time\n glGenBuffers(2, VBOs);\n // first triangle setup\n // --------------------\n glBindVertexArray(VAOs[0]);\n glBindBuffer(GL_ARRAY_BUFFER, VBOs[0]);\n glBufferData(GL_ARRAY_BUFFER, sizeof(firstTriangle), firstTriangle, GL_STATIC_DRAW);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\t// Vertex attributes stay the same\n glEnableVertexAttribArray(0);\n // glBindVertexArray(0); // no need to unbind at all as we directly bind a different VAO the next few lines\n // second triangle setup\n // ---------------------\n glBindVertexArray(VAOs[1]);\t// note that we bind to a different VAO now\n glBindBuffer(GL_ARRAY_BUFFER, VBOs[1]);\t// and a different VBO\n glBufferData(GL_ARRAY_BUFFER, sizeof(secondTriangle), secondTriangle, GL_STATIC_DRAW);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0); // because the vertex data is tightly packed we can also specify 0 as the vertex attribute's stride to let OpenGL figure it out\n glEnableVertexAttribArray(0);\n // glBindVertexArray(0); // not really necessary as well, but beware of calls that could affect VAOs while this one is bound (like binding element buffer objects, or enabling/disabling vertex attributes)\n\n\n // uncomment this call to draw in wireframe polygons.\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // now when we draw the triangle we first use the vertex and orange fragment shader from the first program\n glUseProgram(shaderProgramOrange);\n // draw the first triangle using the data from our first VAO\n glBindVertexArray(VAOs[0]);\n glDrawArrays(GL_TRIANGLES, 0, 3);\t// this call should output an orange triangle\n // then we draw the second triangle using the data from the second VAO\n // when we draw the second triangle we want to use a different shader program so we switch to the shader program with our yellow fragment shader.\n glUseProgram(shaderProgramYellow);\n glBindVertexArray(VAOs[1]);\n glDrawArrays(GL_TRIANGLES, 0, 3);\t// this call should output a yellow triangle\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(2, VAOs);\n glDeleteBuffers(2, VBOs);\n glDeleteProgram(shaderProgramOrange);\n glDeleteProgram(shaderProgramYellow);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.374, "dedup_hash": "fe42700f8b6b9b09", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_1_shaders_uniform", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.1.Shaders Uniform", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.1.shaders_uniform/shaders_uniform.cpp", "language": "code", "loc": 162, "comment_density": 0.29, "code": "#include \n#include \n\n#include \n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource =\"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos, 1.0);\\n\"\n \"}\\0\";\n\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"uniform vec4 ourColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = ourColor;\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n 0.5f, -0.5f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, // bottom left\n 0.0f, 0.5f, 0.0f // top \n };\n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n // glBindVertexArray(0);\n\n\n // bind the VAO (it was already bound, but just to demonstrate): seeing as we only have a single VAO we can \n // just bind it beforehand before rendering the respective triangle; this is another approach.\n glBindVertexArray(VAO);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // be sure to activate the shader before any calls to glUniform\n glUseProgram(shaderProgram);\n\n // update shader uniform\n double timeValue = glfwGetTime();\n float greenValue = static_cast(sin(timeValue) / 2.0 + 0.5);\n int vertexColorLocation = glGetUniformLocation(shaderProgram, \"ourColor\");\n glUniform4f(vertexColorLocation, 0.0f, greenValue, 0.0f, 1.0f);\n\n // render the triangle\n glDrawArrays(GL_TRIANGLES, 0, 3);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.29, "dedup_hash": "c8652da810fd943b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_2_shaders_interpolation", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.2.Shaders Interpolation", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.2.shaders_interpolation/shaders_interpolation.cpp", "language": "code", "loc": 162, "comment_density": 0.29, "code": "#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nconst char *vertexShaderSource =\"#version 330 core\\n\"\n \"layout (location = 0) in vec3 aPos;\\n\"\n \"layout (location = 1) in vec3 aColor;\\n\"\n \"out vec3 ourColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" gl_Position = vec4(aPos, 1.0);\\n\"\n \" ourColor = aColor;\\n\"\n \"}\\0\";\n\nconst char *fragmentShaderSource = \"#version 330 core\\n\"\n \"out vec4 FragColor;\\n\"\n \"in vec3 ourColor;\\n\"\n \"void main()\\n\"\n \"{\\n\"\n \" FragColor = vec4(ourColor, 1.0f);\\n\"\n \"}\\n\\0\";\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader program\n // ------------------------------------\n // vertex shader\n unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);\n glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);\n glCompileShader(vertexShader);\n // check for shader compile errors\n int success;\n char infoLog[512];\n glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::VERTEX::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // fragment shader\n unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);\n glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);\n glCompileShader(fragmentShader);\n // check for shader compile errors\n glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);\n if (!success)\n {\n glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\\n\" << infoLog << std::endl;\n }\n // link shaders\n unsigned int shaderProgram = glCreateProgram();\n glAttachShader(shaderProgram, vertexShader);\n glAttachShader(shaderProgram, fragmentShader);\n glLinkProgram(shaderProgram);\n // check for linking errors\n glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);\n if (!success) {\n glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);\n std::cout << \"ERROR::SHADER::PROGRAM::LINKING_FAILED\\n\" << infoLog << std::endl;\n }\n glDeleteShader(vertexShader);\n glDeleteShader(fragmentShader);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom left\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f // top \n\n };\n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n // glBindVertexArray(0);\n\n // as we only have a single shader, we could also just activate our shader once beforehand if we want to \n glUseProgram(shaderProgram);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // render the triangle\n glBindVertexArray(VAO);\n glDrawArrays(GL_TRIANGLES, 0, 3);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteProgram(shaderProgram);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.29, "dedup_hash": "47a52e3d47f46d1e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_3_shaders_class", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.3.Shaders Class", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.3.shaders_class/3.3.shader.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\n\nvoid main()\n{\n FragColor = vec4(ourColor, 1.0f);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/3.3.shaders_class/3.3.shader.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\n\nout vec3 ourColor;\n\nvoid main()\n{\n gl_Position = vec4(aPos, 1.0);\n ourColor = aColor;\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/3.3.shaders_class/shaders_class.cpp", "language": "code", "loc": 109, "comment_density": 0.376, "code": "#include \n#include \n\n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader program\n // ------------------------------------\n Shader ourShader(\"3.3.shader.vs\", \"3.3.shader.fs\"); // you can name your shader files however you like\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom left\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f // top \n };\n\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other\n // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.\n // glBindVertexArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // render the triangle\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawArrays(GL_TRIANGLES, 0, 3);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.125, "dedup_hash": "20b81b1f4bf91c2a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_4_shaders_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.4.Shaders Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.4.shaders_exercise1/shaders_exercise1.cpp", "language": "code", "loc": 9, "comment_density": 0.111, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\n\nout vec3 ourColor;\n\nvoid main()\n{\n gl_Position = vec4(aPos.x, -aPos.y, aPos.z, 1.0); // just add a - to the y position\n ourColor = aColor;\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.111, "dedup_hash": "f74258d65cc0cb40", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_5_shaders_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.5.Shaders Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.5.shaders_exercise2/shaders_exercise2.cpp", "language": "code", "loc": 16, "comment_density": 0.312, "code": "// In your CPP file:\n// ======================\nfloat offset = 0.5f;\nourShader.setFloat(\"xOffset\", offset);\n\n// In your vertex shader:\n// ======================\n#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\n\nout vec3 ourColor;\n\nuniform float xOffset;\n\nvoid main()\n{\n gl_Position = vec4(aPos.x + xOffset, aPos.y, aPos.z, 1.0); // add the xOffset to the x position of the vertex position\n ourColor = aColor;\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.312, "dedup_hash": "7bf9b0e8ebcb220a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_3_6_shaders_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "3.6.Shaders Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/3.6.shaders_exercise3/shaders_exercise3.cpp", "language": "code", "loc": 32, "comment_density": 0.531, "code": "// Vertex shader:\n// ==============\n#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\n\n// out vec3 ourColor;\nout vec3 ourPosition;\n\nvoid main()\n{\n gl_Position = vec4(aPos, 1.0); \n // ourColor = aColor;\n ourPosition = aPos;\n}\n\n// Fragment shader:\n// ================\n#version 330 core\nout vec4 FragColor;\n// in vec3 ourColor;\nin vec3 ourPosition;\n\nvoid main()\n{\n FragColor = vec4(ourPosition, 1.0); // note how the position value is linearly interpolated to get all the different colors\n}\n\n/* \nAnswer to the question: Do you know why the bottom-left side is black?\n-- --------------------------------------------------------------------\nThink about this for a second: the output of our fragment's color is equal to the (interpolated) coordinate of \nthe triangle. What is the coordinate of the bottom-left point of our triangle? This is (-0.5f, -0.5f, 0.0f). Since the\nxy values are negative they are clamped to a value of 0.0f. This happens all the way to the center sides of the \ntriangle since from that point on the values will be interpolated positively again. Values of 0.0f are of course black\nand that explains the black side of the triangle.\n*/"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.531, "dedup_hash": "a210b57732cf1e8b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_1_textures", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "4.1.Textures", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.1.textures/4.1.texture.fs", "language": "glsl", "loc": 10, "comment_density": 0.1, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\n// texture sampler\nuniform sampler2D texture1;\n\nvoid main()\n{\n\tFragColor = texture(texture1, TexCoord);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.1.textures/4.1.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.1.textures/textures.cpp", "language": "code", "loc": 146, "comment_density": 0.336, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.1.texture.vs\", \"4.1.texture.fs\"); \n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = { \n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture;\n glGenTextures(1, &texture);\n glBindTexture(GL_TEXTURE_2D, texture); // all upcoming GL_TEXTURE_2D operations now have effect on this texture object\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind Texture\n glBindTexture(GL_TEXTURE_2D, texture);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.145, "dedup_hash": "5569850cb433b081", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_2_textures_combined", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "4.2.Textures Combined", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.2.textures_combined/4.2.texture.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.2.textures_combined/4.2.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.2.textures_combined/textures_combined.cpp", "language": "code", "loc": 182, "comment_density": 0.346, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.2.texture.vs\", \"4.2.texture.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1); \n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); // don't forget to activate/use the shader before setting uniforms!\n // either set it manually like so:\n glUniform1i(glGetUniformLocation(ourShader.ID, \"texture1\"), 0);\n // or set it via the texture class\n ourShader.setInt(\"texture2\", 1);\n\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.171, "dedup_hash": "97bf778a7fe22501", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_3_textures_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:06+00:00", "source_type": "repo", "title": "4.3.Textures Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.3.textures_exercise1/textures_exercise1.cpp", "language": "code", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\nuniform sampler2D ourTexture1;\nuniform sampler2D ourTexture2;\n\nvoid main()\n{\n FragColor = mix(texture(ourTexture1, TexCoord), texture(ourTexture2, vec2(1.0 - TexCoord.x, TexCoord.y)), 0.2);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.0, "dedup_hash": "01ff7514417ce6be", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_4_textures_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "4.4.Textures Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.4.textures_exercise2/4.3.texture.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.4.textures_exercise2/4.3.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.4.textures_exercise2/textures_exercise2.cpp", "language": "code", "loc": 182, "comment_density": 0.346, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.3.texture.vs\", \"4.3.texture.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords (note that we changed them to 2.0f!)\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 2.0f, 2.0f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 2.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 2.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // note that we set the container wrapping method to GL_CLAMP_TO_EDGE\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// we want to repeat the awesomeface pattern so we kept it at GL_REPEAT\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); // don't forget to activate/use the shader before setting uniforms!\n // either set it manually like so:\n glUniform1i(glGetUniformLocation(ourShader.ID, \"texture1\"), 0);\n // or set it via the texture class\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.171, "dedup_hash": "8302d82d63c444ea", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_5_textures_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "4.5.Textures Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.5.textures_exercise3/4.4.texture.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.5.textures_exercise3/4.4.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.5.textures_exercise3/textures_exercise3.cpp", "language": "code", "loc": 182, "comment_density": 0.352, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.4.texture.vs\", \"4.4.texture.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords (note that we changed them to 'zoom in' on our texture image)\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.55f, 0.55f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.55f, 0.45f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.45f, 0.45f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.45f, 0.55f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // note that we set the container wrapping method to GL_CLAMP_TO_EDGE\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // set texture filtering to nearest neighbor to clearly see the texels/pixels\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // set texture filtering to nearest neighbor to clearly see the texels/pixels\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); // don't forget to activate/use the shader before setting uniforms!\n // either set it manually like so:\n glUniform1i(glGetUniformLocation(ourShader.ID, \"texture1\"), 0);\n // or set it via the texture class\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.173, "dedup_hash": "e32cb5f4e0296e91", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_4_6_textures_exercise4", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "4.6.Textures Exercise4", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/4.6.textures_exercise4/4.5.texture.fs", "language": "glsl", "loc": 13, "comment_density": 0.154, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 ourColor;\nin vec2 TexCoord;\n\nuniform float mixValue;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), mixValue);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/4.6.textures_exercise4/4.5.texture.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aTexCoord;\n\nout vec3 ourColor;\nout vec2 TexCoord;\n\nvoid main()\n{\n\tgl_Position = vec4(aPos, 1.0);\n\tourColor = aColor;\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/4.6.textures_exercise4/textures_exercise4.cpp", "language": "code", "loc": 198, "comment_density": 0.338, "code": "#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// stores how much we're seeing of either texture\nfloat mixValue = 0.2f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"4.5.texture.vs\", \"4.5.texture.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // colors // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // color attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n // texture coord attribute\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n // The FileSystem::getPath(...) is part of the GitHub repository so we can find files on any IDE/platform; replace it with your own image path.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t// set texture wrapping to GL_REPEAT (default wrapping method)\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); // don't forget to activate/use the shader before setting uniforms!\n // either set it manually like so:\n glUniform1i(glGetUniformLocation(ourShader.ID, \"texture1\"), 0);\n // or set it via the texture class\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // set the texture mix value in the shader\n ourShader.setFloat(\"mixValue\", mixValue);\n\n // render container\n ourShader.use();\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_UP) == GLFW_PRESS)\n {\n mixValue += 0.001f; // change this value accordingly (might be too slow or too fast based on system hardware)\n if(mixValue >= 1.0f)\n mixValue = 1.0f;\n }\n if (glfwGetKey(window, GLFW_KEY_DOWN) == GLFW_PRESS)\n {\n mixValue -= 0.001f; // change this value accordingly (might be too slow or too fast based on system hardware)\n if (mixValue <= 0.0f)\n mixValue = 0.0f;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.164, "dedup_hash": "2545a9fa1e3b41d9", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_5_1_transformations", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "5.1.Transformations", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/5.1.transformations/5.1.transform.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/5.1.transformations/5.1.transform.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 transform;\n\nvoid main()\n{\n\tgl_Position = transform * vec4(aPos, 1.0);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/5.1.transformations/transformations.cpp", "language": "code", "loc": 186, "comment_density": 0.317, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"5.1.transform.vs\", \"5.1.transform.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use(); \n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // create transformations\n glm::mat4 transform = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n transform = glm::translate(transform, glm::vec3(0.5f, -0.5f, 0.0f));\n transform = glm::rotate(transform, (float)glfwGetTime(), glm::vec3(0.0f, 0.0f, 1.0f));\n\n // get matrix's uniform location and set matrix\n ourShader.use();\n unsigned int transformLoc = glGetUniformLocation(ourShader.ID, \"transform\");\n glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transform));\n\n // render container\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.166, "dedup_hash": "253919d01bb096f2", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_5_2_transformations_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "5.2.Transformations Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "graphics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/5.2.transformations_exercise1/transformations_exercise1.cpp", "language": "code", "loc": 30, "comment_density": 0.667, "code": "int main()\n{\n [...]\n while(!glfwWindowShouldClose(window))\n {\n [...] \n // create transformations\n glm::mat4 transform = glm::mat4(1.0f);\n transform = glm::rotate(transform, (float)glfwGetTime(), glm::vec3(0.0f, 0.0f, 1.0f)); // switched the order\n transform = glm::translate(transform, glm::vec3(0.5f, -0.5f, 0.0f)); // switched the order \n [...]\n }\n}\n\n/* Why does our container now spin around our screen?:\n== ===================================================\nRemember that matrix multiplication is applied in reverse. This time a translation is thus\napplied first to the container positioning it in the bottom-right corner of the screen.\nAfter the translation the rotation is applied to the translated container.\n\nA rotation transformation is also known as a change-of-basis transformation\nfor when we dig a bit deeper into linear algebra. Since we're changing the\nbasis of the container, the next resulting translations will translate the container\nbased on the new basis vectors. Once the vector is slightly rotated, the vertical\ntranslations would also be slightly translated for example.\n\nIf we would first apply rotations then they'd resolve around the rotation origin (0,0,0), but \nsince the container is first translated, its rotation origin is no longer (0,0,0) making it\nlooks as if its circling around the origin of the scene.\n\nIf you had trouble visualizing this or figuring it out, don't worry. If you\nexperiment with transformations you'll soon get the grasp of it; all it takes\nis practice and experience.\n*/"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.667, "dedup_hash": "95aa73d5d67784e0", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_5_2_transformations_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "5.2.Transformations Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/5.2.transformations_exercise2/5.2.transform.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/5.2.transformations_exercise2/5.2.transform.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 transform;\n\nvoid main()\n{\n\tgl_Position = transform * vec4(aPos, 1.0);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/5.2.transformations_exercise2/transformations_exercise2.cpp", "language": "code", "loc": 195, "comment_density": 0.333, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"5.2.transform.vs\", \"5.2.transform.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n\n glm::mat4 transform = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n // first container\n // ---------------\n transform = glm::translate(transform, glm::vec3(0.5f, -0.5f, 0.0f));\n transform = glm::rotate(transform, (float)glfwGetTime(), glm::vec3(0.0f, 0.0f, 1.0f));\n // get their uniform location and set matrix (using glm::value_ptr)\n unsigned int transformLoc = glGetUniformLocation(ourShader.ID, \"transform\");\n glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transform));\n\n // with the uniform matrix set, draw the first container\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // second transformation\n // ---------------------\n transform = glm::mat4(1.0f); // reset it to identity matrix\n transform = glm::translate(transform, glm::vec3(-0.5f, 0.5f, 0.0f));\n float scaleAmount = static_cast(sin(glfwGetTime()));\n transform = glm::scale(transform, glm::vec3(scaleAmount, scaleAmount, scaleAmount));\n glUniformMatrix4fv(transformLoc, 1, GL_FALSE, &transform[0][0]); // this time take the matrix value array's first element as its memory pointer value\n\n // now with the uniform matrix being replaced with new transformations, draw it again.\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.172, "dedup_hash": "8caee19431fb9817", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_6_1_coordinate_systems", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "6.1.Coordinate Systems", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/6.1.coordinate_systems/6.1.coordinate_systems.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/6.1.coordinate_systems/6.1.coordinate_systems.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/6.1.coordinate_systems/coordinate_systems.cpp", "language": "code", "loc": 195, "comment_density": 0.318, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"6.1.coordinate_systems.vs\", \"6.1.coordinate_systems.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // texture coords\n 0.5f, 0.5f, 0.0f, 1.0f, 1.0f, // top right\n 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, // bottom right\n -0.5f, -0.5f, 0.0f, 0.0f, 0.0f, // bottom left\n -0.5f, 0.5f, 0.0f, 0.0f, 1.0f // top left \n };\n unsigned int indices[] = {\n 0, 1, 3, // first triangle\n 1, 2, 3 // second triangle\n };\n unsigned int VBO, VAO, EBO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n glGenBuffers(1, &EBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);\n glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\t\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n \n // activate shader\n ourShader.use();\n \n // create transformations\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n glm::mat4 view = glm::mat4(1.0f);\n glm::mat4 projection = glm::mat4(1.0f);\n model = glm::rotate(model, glm::radians(-55.0f), glm::vec3(1.0f, 0.0f, 0.0f));\n view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));\n projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n // retrieve the matrix uniform locations\n unsigned int modelLoc = glGetUniformLocation(ourShader.ID, \"model\");\n unsigned int viewLoc = glGetUniformLocation(ourShader.ID, \"view\");\n // pass them to the shaders (3 different ways)\n glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));\n glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view[0][0]);\n // note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once.\n ourShader.setMat4(\"projection\", projection);\n\n // render container\n glBindVertexArray(VAO);\n glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n glDeleteBuffers(1, &EBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.167, "dedup_hash": "8b055c9cb73255ff", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_6_2_coordinate_systems_depth", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "6.2.Coordinate Systems Depth", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/6.2.coordinate_systems_depth/6.2.coordinate_systems.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/6.2.coordinate_systems_depth/6.2.coordinate_systems.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/6.2.coordinate_systems_depth/coordinate_systems_depth.cpp", "language": "code", "loc": 221, "comment_density": 0.262, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"6.2.coordinate_systems.vs\", \"6.2.coordinate_systems.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // also clear the depth buffer now!\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // create transformations\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n glm::mat4 view = glm::mat4(1.0f);\n glm::mat4 projection = glm::mat4(1.0f);\n model = glm::rotate(model, (float)glfwGetTime(), glm::vec3(0.5f, 1.0f, 0.0f));\n view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));\n projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n // retrieve the matrix uniform locations\n unsigned int modelLoc = glGetUniformLocation(ourShader.ID, \"model\");\n unsigned int viewLoc = glGetUniformLocation(ourShader.ID, \"view\");\n // pass them to the shaders (3 different ways)\n glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));\n glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view[0][0]);\n // note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once.\n ourShader.setMat4(\"projection\", projection);\n\n // render box\n glBindVertexArray(VAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.148, "dedup_hash": "2244972ae86f6a65", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_6_3_coordinate_systems_multiple", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "6.3.Coordinate Systems Multiple", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/6.3.coordinate_systems_multiple/6.3.coordinate_systems.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n FragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/6.3.coordinate_systems_multiple/6.3.coordinate_systems.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0f);\n TexCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/6.3.coordinate_systems_multiple/coordinate_systems_multiple.cpp", "language": "code", "loc": 236, "comment_density": 0.25, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"6.3.coordinate_systems.vs\", \"6.3.coordinate_systems.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // also clear the depth buffer now!\n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // create transformations\n glm::mat4 view = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n glm::mat4 projection = glm::mat4(1.0f);\n projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));\n // pass transformation matrices to the shader\n ourShader.setMat4(\"projection\", projection); // note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once.\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.083, "dedup_hash": "adda10648fd45e9b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_6_4_coordinate_systems_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:07+00:00", "source_type": "repo", "title": "6.4.Coordinate Systems Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/6.4.coordinate_systems_exercise3/coordinate_systems_exercise3.cpp", "language": "code", "loc": 15, "comment_density": 0.133, "code": "...\n\n\nglBindVertexArray(VAO);\nfor(unsigned int i = 0; i < 10; i++)\n{\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i; \n if(i % 3 == 0) // every 3rd iteration (including the first) we set the angle using GLFW's time function.\n angle = glfwGetTime() * 25.0f;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n \n glDrawArrays(GL_TRIANGLES, 0, 36); \n}\n\n..."}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.133, "dedup_hash": "3ec7620dd0da3064", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_1_camera_circle", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.1.Camera Circle", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.1.camera_circle/7.1.camera.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/7.1.camera_circle/7.1.camera.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/7.1.camera_circle/camera_circle.cpp", "language": "code", "loc": 239, "comment_density": 0.243, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"7.1.camera.vs\", \"7.1.camera.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3 (2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n // pass projection matrix to shader (as projection matrix rarely changes there's no need to do this per frame)\n // -----------------------------------------------------------------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n ourShader.setMat4(\"projection\", projection); \n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // camera/view transformation\n glm::mat4 view = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n float radius = 10.0f;\n float camX = static_cast(sin(glfwGetTime()) * radius);\n float camZ = static_cast(cos(glfwGetTime()) * radius);\n view = glm::lookAt(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.142, "dedup_hash": "40c6f809c3f3ccb1", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_2_camera_keyboard_dt", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.2.Camera Keyboard Dt", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.2.camera_keyboard_dt/7.2.camera.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/7.2.camera_keyboard_dt/7.2.camera.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/7.2.camera_keyboard_dt/camera_keyboard_dt.cpp", "language": "code", "loc": 256, "comment_density": 0.246, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nglm::vec3 cameraPos = glm::vec3(0.0f, 0.0f, 3.0f);\nglm::vec3 cameraFront = glm::vec3(0.0f, 0.0f, -1.0f);\nglm::vec3 cameraUp = glm::vec3(0.0f, 1.0f, 0.0f);\n\n// timing\nfloat deltaTime = 0.0f;\t// time between current frame and last frame\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"7.2.camera.vs\", \"7.2.camera.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n // pass projection matrix to shader (as projection matrix rarely changes there's no need to do this per frame)\n // -----------------------------------------------------------------------------------------------------------\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n ourShader.setMat4(\"projection\", projection);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // camera/view transformation\n glm::mat4 view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n float cameraSpeed = static_cast(2.5 * deltaTime);\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n cameraPos += cameraSpeed * cameraFront;\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n cameraPos -= cameraSpeed * cameraFront;\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n cameraPos -= glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n cameraPos += glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.143, "dedup_hash": "17d084bf46328952", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_3_camera_mouse_zoom", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.3.Camera Mouse Zoom", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.3.camera_mouse_zoom/7.3.camera.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/7.3.camera_mouse_zoom/7.3.camera.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/7.3.camera_mouse_zoom/camera_mouse_zoom.cpp", "language": "code", "loc": 309, "comment_density": 0.23, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nglm::vec3 cameraPos = glm::vec3(0.0f, 0.0f, 3.0f);\nglm::vec3 cameraFront = glm::vec3(0.0f, 0.0f, -1.0f);\nglm::vec3 cameraUp = glm::vec3(0.0f, 1.0f, 0.0f);\n\nbool firstMouse = true;\nfloat yaw = -90.0f;\t// yaw is initialized to -90.0 degrees since a yaw of 0.0 results in a direction vector pointing to the right so we initially rotate a bit to the left.\nfloat pitch = 0.0f;\nfloat lastX = 800.0f / 2.0;\nfloat lastY = 600.0 / 2.0;\nfloat fov = 45.0f;\n\n// timing\nfloat deltaTime = 0.0f;\t// time between current frame and last frame\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"7.3.camera.vs\", \"7.3.camera.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // pass projection matrix to shader (note that in this case it could change every frame)\n glm::mat4 projection = glm::perspective(glm::radians(fov), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n ourShader.setMat4(\"projection\", projection);\n\n // camera/view transformation\n glm::mat4 view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n float cameraSpeed = static_cast(2.5 * deltaTime);\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n cameraPos += cameraSpeed * cameraFront;\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n cameraPos -= cameraSpeed * cameraFront;\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n cameraPos -= glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n cameraPos += glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n lastX = xpos;\n lastY = ypos;\n\n float sensitivity = 0.1f; // change this value to your liking\n xoffset *= sensitivity;\n yoffset *= sensitivity;\n\n yaw += xoffset;\n pitch += yoffset;\n\n // make sure that when pitch is out of bounds, screen doesn't get flipped\n if (pitch > 89.0f)\n pitch = 89.0f;\n if (pitch < -89.0f)\n pitch = -89.0f;\n\n glm::vec3 front;\n front.x = cos(glm::radians(yaw)) * cos(glm::radians(pitch));\n front.y = sin(glm::radians(pitch));\n front.z = sin(glm::radians(yaw)) * cos(glm::radians(pitch));\n cameraFront = glm::normalize(front);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n fov -= (float)yoffset;\n if (fov < 1.0f)\n fov = 1.0f;\n if (fov > 45.0f)\n fov = 45.0f;\n}"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.137, "dedup_hash": "1bcdda46187f945b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_4_camera_class", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.4.Camera Class", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.4.camera_class/7.4.camera.fs", "language": "glsl", "loc": 11, "comment_density": 0.182, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoord;\n\n// texture samplers\nuniform sampler2D texture1;\nuniform sampler2D texture2;\n\nvoid main()\n{\n\t// linearly interpolate between both textures (80% container, 20% awesomeface)\n\tFragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.2);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/1.getting_started/7.4.camera_class/7.4.camera.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoord;\n\nout vec2 TexCoord;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0f);\n\tTexCoord = vec2(aTexCoord.x, aTexCoord.y);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/1.getting_started/7.4.camera_class/camera_class.cpp", "language": "code", "loc": 286, "comment_density": 0.238, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\t// time between current frame and last frame\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader ourShader(\"7.4.camera.vs\", \"7.4.camera.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n // world space positions of our cubes\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n unsigned int VBO, VAO;\n glGenVertexArrays(1, &VAO);\n glGenBuffers(1, &VBO);\n\n glBindVertexArray(VAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // texture coord attribute\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // load and create a texture \n // -------------------------\n unsigned int texture1, texture2;\n // texture 1\n // ---------\n glGenTextures(1, &texture1);\n glBindTexture(GL_TEXTURE_2D, texture1);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n int width, height, nrChannels;\n stbi_set_flip_vertically_on_load(true); // tell stb_image.h to flip loaded texture's on the y-axis.\n unsigned char *data = stbi_load(FileSystem::getPath(\"resources/textures/container.jpg\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n // texture 2\n // ---------\n glGenTextures(1, &texture2);\n glBindTexture(GL_TEXTURE_2D, texture2);\n // set the texture wrapping parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // set texture filtering parameters\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n // load image, create texture and generate mipmaps\n data = stbi_load(FileSystem::getPath(\"resources/textures/awesomeface.png\").c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n // note that the awesomeface.png has transparency and thus an alpha channel, so make sure to tell OpenGL the data type is of GL_RGBA\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n }\n else\n {\n std::cout << \"Failed to load texture\" << std::endl;\n }\n stbi_image_free(data);\n\n // tell opengl for each sampler to which texture unit it belongs to (only has to be done once)\n // -------------------------------------------------------------------------------------------\n ourShader.use();\n ourShader.setInt(\"texture1\", 0);\n ourShader.setInt(\"texture2\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.2f, 0.3f, 0.3f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); \n\n // bind textures on corresponding texture units\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, texture1);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, texture2);\n\n // activate shader\n ourShader.use();\n\n // pass projection matrix to shader (note that in this case it could change every frame)\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n ourShader.setMat4(\"projection\", projection);\n\n // camera/view transformation\n glm::mat4 view = camera.GetViewMatrix();\n ourShader.setMat4(\"view\", view);\n\n // render boxes\n glBindVertexArray(VAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n ourShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.14, "dedup_hash": "d9e4ef2435e8e02e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_5_camera_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.5.Camera Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.5.camera_exercise1/camera_exercise1.cpp", "language": "code", "loc": 19, "comment_density": 0.263, "code": "// This function is found in the camera class. What we basically do is keep the y position value at 0.0f to force our\n// user to stick to the ground.\n\n[...]\n// processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems)\nvoid ProcessKeyboard(Camera_Movement direction, float deltaTime)\n{\n float velocity = MovementSpeed * deltaTime;\n if (direction == FORWARD)\n Position += Front * velocity;\n if (direction == BACKWARD)\n Position -= Front * velocity;\n if (direction == LEFT)\n Position -= Right * velocity;\n if (direction == RIGHT)\n Position += Right * velocity;\n // make sure the user stays at the ground level\n Position.y = 0.0f; // <-- this one-liner keeps the user at the ground level (xz plane)\n}\n[...]"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.263, "dedup_hash": "24f861cef5dada66", "has_readme": true} +{"id": "joeydevries_learnopengl_src_1_getting_started_7_6_camera_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "7.6.Camera Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/1.getting_started/7.6.camera_exercise2/camera_exercise2.cpp", "language": "code", "loc": 32, "comment_density": 0.5, "code": "// Custom implementation of the LookAt function\nglm::mat4 calculate_lookAt_matrix(glm::vec3 position, glm::vec3 target, glm::vec3 worldUp)\n{\n // 1. Position = known\n // 2. Calculate cameraDirection\n glm::vec3 zaxis = glm::normalize(position - target);\n // 3. Get positive right axis vector\n glm::vec3 xaxis = glm::normalize(glm::cross(glm::normalize(worldUp), zaxis));\n // 4. Calculate camera up vector\n glm::vec3 yaxis = glm::cross(zaxis, xaxis);\n\n // Create translation and rotation matrix\n // In glm we access elements as mat[col][row] due to column-major layout\n glm::mat4 translation = glm::mat4(1.0f); // Identity matrix by default\n translation[3][0] = -position.x; // Fourth column, first row\n translation[3][1] = -position.y;\n translation[3][2] = -position.z;\n glm::mat4 rotation = glm::mat4(1.0f);\n rotation[0][0] = xaxis.x; // First column, first row\n rotation[1][0] = xaxis.y;\n rotation[2][0] = xaxis.z;\n rotation[0][1] = yaxis.x; // First column, second row\n rotation[1][1] = yaxis.y;\n rotation[2][1] = yaxis.z;\n rotation[0][2] = zaxis.x; // First column, third row\n rotation[1][2] = zaxis.y;\n rotation[2][2] = zaxis.z; \n\n // Return lookAt matrix as combination of translation and rotation matrix\n return rotation * translation; // Remember to read from right to left (first translation then rotation)\n}\n\n\n// Don't forget to replace glm::lookAt with your own version\n// view = glm::lookAt(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));\nview = calculate_lookAt_matrix(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.5, "dedup_hash": "e444c750582aaa96", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_1_colors", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:08+00:00", "source_type": "repo", "title": "1.Colors", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/1.colors/1.colors.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n \nuniform vec3 objectColor;\nuniform vec3 lightColor;\n\nvoid main()\n{\n FragColor = vec4(lightColor * objectColor, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/1.colors/1.colors.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/1.colors/1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/1.colors/1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/1.colors/colors.cpp", "language": "code", "loc": 227, "comment_density": 0.229, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"1.colors.vs\", \"1.colors.fs\");\n Shader lightCubeShader(\"1.light_cube.vs\", \"1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n -0.5f, 0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n\n -0.5f, -0.5f, 0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n -0.5f, -0.5f, 0.5f, \n\n -0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n -0.5f, -0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n\n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n\n -0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, -0.5f, 0.5f, \n -0.5f, -0.5f, 0.5f, \n -0.5f, -0.5f, -0.5f, \n\n -0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, -0.5f, \n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n // we only need to bind to the VBO (to link it with glVertexAttribPointer), no need to fill it; the VBO's data already contains all we need (it's already bound, but we do it again for educational purposes)\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n \n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"objectColor\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"lightColor\", 1.0f, 1.0f, 1.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.079, "dedup_hash": "cb3e04481f608102", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_1_basic_lighting_diffuse", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.1.Basic Lighting Diffuse", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.1.basic_lighting_diffuse/2.1.basic_lighting.fs", "language": "glsl", "loc": 20, "comment_density": 0.1, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 Normal; \nin vec3 FragPos; \n \nuniform vec3 lightPos; \nuniform vec3 lightColor;\nuniform vec3 objectColor;\n\nvoid main()\n{\n // ambient\n float ambientStrength = 0.1;\n vec3 ambient = ambientStrength * lightColor;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(lightPos - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = diff * lightColor;\n \n vec3 result = (ambient + diffuse) * objectColor;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/2.1.basic_lighting_diffuse/2.1.basic_lighting.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = aNormal; \n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/2.1.basic_lighting_diffuse/2.1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/2.1.basic_lighting_diffuse/2.1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/2.1.basic_lighting_diffuse/basic_lighting_diffuse.cpp", "language": "code", "loc": 231, "comment_density": 0.229, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\t\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"2.1.basic_lighting.vs\", \"2.1.basic_lighting.fs\");\n Shader lightCubeShader(\"2.1.light_cube.vs\", \"2.1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // normal attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"objectColor\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"lightColor\", 1.0f, 1.0f, 1.0f);\n lightingShader.setVec3(\"lightPos\", lightPos);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.099, "dedup_hash": "d9c7b9d0e8914f0a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_2_basic_lighting_specular", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.2.Basic Lighting Specular", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.2.basic_lighting_specular/2.2.basic_lighting.fs", "language": "glsl", "loc": 27, "comment_density": 0.111, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 Normal; \nin vec3 FragPos; \n \nuniform vec3 lightPos; \nuniform vec3 viewPos; \nuniform vec3 lightColor;\nuniform vec3 objectColor;\n\nvoid main()\n{\n // ambient\n float ambientStrength = 0.1;\n vec3 ambient = ambientStrength * lightColor;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(lightPos - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = diff * lightColor;\n \n // specular\n float specularStrength = 0.5;\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);\n vec3 specular = specularStrength * spec * lightColor; \n \n vec3 result = (ambient + diffuse + specular) * objectColor;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/2.2.basic_lighting_specular/2.2.basic_lighting.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/2.2.basic_lighting_specular/2.2.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/2.2.basic_lighting_specular/2.2.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/2.2.basic_lighting_specular/basic_lighting_specular.cpp", "language": "code", "loc": 232, "comment_density": 0.228, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\t\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"2.2.basic_lighting.vs\", \"2.2.basic_lighting.fs\");\n Shader lightCubeShader(\"2.2.light_cube.vs\", \"2.2.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // normal attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"objectColor\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"lightColor\", 1.0f, 1.0f, 1.0f);\n lightingShader.setVec3(\"lightPos\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.101, "dedup_hash": "2c764e6e439d1e13", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_3_basic_lighting_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.3.Basic Lighting Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.3.basic_lighting_exercise1/basic_lighting_exercise1.cpp", "language": "code", "loc": 25, "comment_density": 0.28, "code": "int main()\n{\n [...]\n // render loop\n while(!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n float currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n processInput(window);\n\n // clear the colorbuffer\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // change the light's position values over time (can be done anywhere in the render loop actually, but try to do it at least before using the light source positions)\n lightPos.x = 1.0f + sin(glfwGetTime()) * 2.0f;\n lightPos.y = sin(glfwGetTime() / 2.0f) * 1.0f;\n \n // set uniforms, draw objects\n [...]\n \n // glfw: swap buffers and poll IO events\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.28, "dedup_hash": "6a00f18a90146f6b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_4_basic_lighting_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.4.Basic Lighting Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.4.basic_lighting_exercise2/basic_lighting_exercise2.cpp", "language": "code", "loc": 47, "comment_density": 0.234, "code": "// Vertex shader:\n// ================\n#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec3 LightPos;\n\nuniform vec3 lightPos; // we now define the uniform in the vertex shader and pass the 'view space' lightpos to the fragment shader. lightPos is currently in world space.\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n FragPos = vec3(view * model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(view * model))) * aNormal;\n LightPos = vec3(view * vec4(lightPos, 1.0)); // Transform world-space light position to view-space light position\n}\n\n\n// Fragment shader:\n// ================\n#version 330 core\nout vec4 FragColor;\n\nin vec3 FragPos;\nin vec3 Normal;\nin vec3 LightPos; // extra in variable, since we need the light position in view space we calculate this in the vertex shader\n\nuniform vec3 lightColor;\nuniform vec3 objectColor;\n\nvoid main()\n{\n // ambient\n float ambientStrength = 0.1;\n vec3 ambient = ambientStrength * lightColor; \n \n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(LightPos - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = diff * lightColor;\n \n // specular\n float specularStrength = 0.5;\n vec3 viewDir = normalize(-FragPos); // the viewer is always at (0,0,0) in view-space, so viewDir is (0,0,0) - Position => -Position\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);\n vec3 specular = specularStrength * spec * lightColor; \n \n vec3 result = (ambient + diffuse + specular) * objectColor;\n FragColor = vec4(result, 1.0);\n}"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.234, "dedup_hash": "970624504cbb6e4f", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_2_5_basic_lighting_exercise3", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "2.5.Basic Lighting Exercise3", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/2.5.basic_lighting_exercise3/basic_lighting_exercise3.cpp", "language": "code", "loc": 56, "comment_density": 0.393, "code": "// Vertex shader:\n// ================\n#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 LightingColor; // resulting color from lighting calculations\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\nuniform vec3 lightColor;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n \n // gouraud shading\n // ------------------------\n vec3 Position = vec3(model * vec4(aPos, 1.0));\n vec3 Normal = mat3(transpose(inverse(model))) * aNormal;\n \n // ambient\n float ambientStrength = 0.1;\n vec3 ambient = ambientStrength * lightColor;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(lightPos - Position);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = diff * lightColor;\n \n // specular\n float specularStrength = 1.0; // this is set higher to better show the effect of Gouraud shading \n vec3 viewDir = normalize(viewPos - Position);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);\n vec3 specular = specularStrength * spec * lightColor; \n\n LightingColor = ambient + diffuse + specular;\n}\n\n\n// Fragment shader:\n// ================\n#version 330 core\nout vec4 FragColor;\n\nin vec3 LightingColor; \n\nuniform vec3 objectColor;\n\nvoid main()\n{\n FragColor = vec4(LightingColor * objectColor, 1.0);\n}\n\n\n/*\nSo what do we see?\nYou can see (for yourself or in the provided image) the clear distinction of the two triangles at the front of the \ncube. This 'stripe' is visible because of fragment interpolation. From the example image we can see that the top-right \nvertex of the cube's front face is lit with specular highlights. Since the top-right vertex of the bottom-right triangle is \nlit and the other 2 vertices of the triangle are not, the bright values interpolates to the other 2 vertices. The same \nhappens for the upper-left triangle. Since the intermediate fragment colors are not directly from the light source \nbut are the result of interpolation, the lighting is incorrect at the intermediate fragments and the top-left and \nbottom-right triangle collide in their brightness resulting in a visible stripe between both triangles.\n\nThis effect will become more apparent when using more complicated shapes.\n*/"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.393, "dedup_hash": "99c8725902e90dcd", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_3_1_materials", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "3.1.Materials", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/3.1.materials/3.1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/3.1.materials/3.1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/3.1.materials/3.1.materials.fs", "language": "glsl", "loc": 36, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * material.ambient;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * (diff * material.diffuse);\n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * (spec * material.specular); \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/3.1.materials/3.1.materials.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/3.1.materials/materials.cpp", "language": "code", "loc": 245, "comment_density": 0.237, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f; \nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"3.1.materials.vs\", \"3.1.materials.fs\");\n Shader lightCubeShader(\"3.1.light_cube.vs\", \"3.1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // normal attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n glm::vec3 lightColor;\n lightColor.x = static_cast(sin(glfwGetTime() * 2.0));\n lightColor.y = static_cast(sin(glfwGetTime() * 0.7));\n lightColor.z = static_cast(sin(glfwGetTime() * 1.3));\n glm::vec3 diffuseColor = lightColor * glm::vec3(0.5f); // decrease the influence\n glm::vec3 ambientColor = diffuseColor * glm::vec3(0.2f); // low influence\n lightingShader.setVec3(\"light.ambient\", ambientColor);\n lightingShader.setVec3(\"light.diffuse\", diffuseColor);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setVec3(\"material.ambient\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"material.diffuse\", 1.0f, 0.5f, 0.31f);\n lightingShader.setVec3(\"material.specular\", 0.5f, 0.5f, 0.5f); // specular lighting doesn't have full effect on this object's material\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.097, "dedup_hash": "af2ef7aa3103fa79", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_3_2_materials_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:09+00:00", "source_type": "repo", "title": "3.2.Materials Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/3.2.materials_exercise1/3.2.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/3.2.materials_exercise1/3.2.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n\tgl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/3.2.materials_exercise1/3.2.materials.fs", "language": "glsl", "loc": 36, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * material.ambient;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * (diff * material.diffuse);\n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * (spec * material.specular); \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/3.2.materials_exercise1/3.2.materials.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 FragPos;\nout vec3 Normal;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/3.2.materials_exercise1/materials_exercise1.cpp", "language": "code", "loc": 239, "comment_density": 0.234, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"3.2.materials.vs\", \"3.2.materials.fs\");\n Shader lightCubeShader(\"3.2.light_cube.vs\", \"3.2.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n\n // position attribute\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n // normal attribute\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 1.0f, 1.0f, 1.0f); // note that all light colors are set at full intensity\n lightingShader.setVec3(\"light.diffuse\", 1.0f, 1.0f, 1.0f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setVec3(\"material.ambient\", 0.0f, 0.1f, 0.06f);\n lightingShader.setVec3(\"material.diffuse\", 0.0f, 0.50980392f, 0.50980392f);\n lightingShader.setVec3(\"material.specular\", 0.50196078f, 0.50196078f, 0.50196078f);\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.097, "dedup_hash": "dfe1f39833884b43", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_4_1_lighting_maps_diffuse_map", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "4.1.Lighting Maps Diffuse Map", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/4.1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/4.1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/4.1.lighting_maps.fs", "language": "glsl", "loc": 36, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n vec3 specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * (spec * material.specular); \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/4.1.lighting_maps.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.1.lighting_maps_diffuse_map/lighting_maps_diffuse.cpp", "language": "code", "loc": 283, "comment_density": 0.216, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"4.1.lighting_maps.vs\", \"4.1.lighting_maps.fs\");\n Shader lightCubeShader(\"4.1.light_cube.vs\", \"4.1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use(); \n lightingShader.setInt(\"material.diffuse\", 0);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f); \n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setVec3(\"material.specular\", 0.5f, 0.5f, 0.5f);\n lightingShader.setFloat(\"material.shininess\", 64.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n \n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.093, "dedup_hash": "3b2e9da45f46222d", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_4_2_lighting_maps_specular_map", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "4.2.Lighting Maps Specular Map", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/4.2.lighting_maps_specular_map/4.2.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.2.lighting_maps_specular_map/4.2.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.2.lighting_maps_specular_map/4.2.lighting_maps.fs", "language": "glsl", "loc": 36, "comment_density": 0.083, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.2.lighting_maps_specular_map/4.2.lighting_maps.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.2.lighting_maps_specular_map/lighting_maps_specular.cpp", "language": "code", "loc": 287, "comment_density": 0.216, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"4.2.lighting_maps.vs\", \"4.2.lighting_maps.fs\");\n Shader lightCubeShader(\"4.2.light_cube.vs\", \"4.2.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f);\n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 64.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.093, "dedup_hash": "1af0caff55aba608", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_4_3_lighting_maps_exercise2", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "4.3.Lighting Maps Exercise2", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/4.3.lighting_maps_exercise2/lighting_maps_exercise2.cpp", "language": "code", "loc": 35, "comment_density": 0.114, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular;\n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords)); \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * (vec3(1.0) - vec3(texture(material.specular, TexCoords))); // here we inverse the sampled specular color. Black becomes white and white becomes black.\n \n FragColor = vec4(ambient + diffuse + specular, 1.0); \n} "}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.114, "dedup_hash": "f0dc6fe746aa9b5e", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_4_4_lighting_maps_exercise4", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "4.4.Lighting Maps Exercise4", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/4.4.lighting_maps_exercise4/4.4.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.4.lighting_maps_exercise4/4.4.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.4.lighting_maps_exercise4/4.4.lighting_maps.fs", "language": "glsl", "loc": 39, "comment_density": 0.103, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n sampler2D emission;\n float shininess;\n}; \n\nstruct Light {\n vec3 position;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n // emission\n vec3 emission = texture(material.emission, TexCoords).rgb;\n \n vec3 result = ambient + diffuse + specular + emission;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/4.4.lighting_maps_exercise4/4.4.lighting_maps.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/4.4.lighting_maps_exercise4/lighting_maps_exercise4.cpp", "language": "code", "loc": 292, "comment_density": 0.216, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"4.4.lighting_maps.vs\", \"4.4.lighting_maps.fs\");\n Shader lightCubeShader(\"4.4.light_cube.vs\", \"4.4.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n unsigned int emissionMap = loadTexture(FileSystem::getPath(\"resources/textures/matrix.jpg\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n lightingShader.setInt(\"material.emission\", 2);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f);\n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 64.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n // bind emission map\n glActiveTexture(GL_TEXTURE2);\n glBindTexture(GL_TEXTURE_2D, emissionMap);\n\n // render the cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.097, "dedup_hash": "2f3b9be372d51167", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_5_1_light_casters_directional", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:10+00:00", "source_type": "repo", "title": "5.1.Light Casters Directional", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/5.1.light_casters_directional/5.1.light_casters.fs", "language": "glsl", "loc": 38, "comment_density": 0.132, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n //vec3 position;\n vec3 direction;\n\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n // vec3 lightDir = normalize(light.position - FragPos);\n vec3 lightDir = normalize(-light.direction); \n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.1.light_casters_directional/5.1.light_casters.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.1.light_casters_directional/5.1.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.1.light_casters_directional/5.1.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp", "language": "code", "loc": 310, "comment_density": 0.239, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader lightingShader(\"5.1.light_casters.vs\", \"5.1.light_casters.fs\");\n Shader lightCubeShader(\"5.1.light_cube.vs\", \"5.1.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.direction\", -0.2f, -1.0f, -0.3f);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f);\n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render the cube\n // glBindVertexArray(cubeVAO);\n // glDrawArrays(GL_TRIANGLES, 0, 36);*/\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n\n // a lamp object is weird when we only have a directional light, don't render the light object\n // lightCubeShader.use();\n // lightCubeShader.setMat4(\"projection\", projection);\n // lightCubeShader.setMat4(\"view\", view);\n // model = glm::mat4(1.0f);\n // model = glm::translate(model, lightPos);\n // model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n // lightCubeShader.setMat4(\"model\", model);\n\n // glBindVertexArray(lightCubeVAO);\n // glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.108, "dedup_hash": "aabb176c807b3c28", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_5_2_light_casters_point", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "5.2.Light Casters Point", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/5.2.light_casters_point/5.2.light_casters.fs", "language": "glsl", "loc": 45, "comment_density": 0.089, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position; \n \n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n\t\n float constant;\n float linear;\n float quadratic;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \t\n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n // attenuation\n float distance = length(light.position - FragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n\n ambient *= attenuation; \n diffuse *= attenuation;\n specular *= attenuation; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.2.light_casters_point/5.2.light_casters.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.2.light_casters_point/5.2.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.2.light_casters_point/5.2.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.2.light_casters_point/light_casters_point.cpp", "language": "code", "loc": 312, "comment_density": 0.205, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"5.2.light_casters.vs\", \"5.2.light_casters.fs\");\n Shader lightCubeShader(\"5.2.light_cube.vs\", \"5.2.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", lightPos);\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.2f, 0.2f, 0.2f);\n lightingShader.setVec3(\"light.diffuse\", 0.5f, 0.5f, 0.5f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"light.constant\", 1.0f);\n lightingShader.setFloat(\"light.linear\", 0.09f);\n lightingShader.setFloat(\"light.quadratic\", 0.032f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n\n // also draw the lamp object\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n\n glBindVertexArray(lightCubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.092, "dedup_hash": "890bf9e04b8e5ff7", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_5_3_light_casters_spot", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "5.3.Light Casters Spot", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/5.3.light_casters_spot/5.3.light_casters.fs", "language": "glsl", "loc": 58, "comment_density": 0.138, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position; \n vec3 direction;\n float cutOff;\n float outerCutOff;\n \n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n\t\n float constant;\n float linear;\n float quadratic;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n vec3 lightDir = normalize(light.position - FragPos);\n \n // check if lighting is inside the spotlight cone\n float theta = dot(lightDir, normalize(-light.direction)); \n \n if(theta > light.cutOff) // remember that we're working with angles as cosines instead of degrees so a '>' is used.\n { \n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \n // diffuse \n vec3 norm = normalize(Normal);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n // attenuation\n float distance = length(light.position - FragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n\n // ambient *= attenuation; // remove attenuation from ambient, as otherwise at large distances the light would be darker inside than outside the spotlight due the ambient term in the else branch\n diffuse *= attenuation;\n specular *= attenuation; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n }\n else \n {\n // else, use ambient light so scene isn't completely dark outside the spotlight.\n FragColor = vec4(light.ambient * texture(material.diffuse, TexCoords).rgb, 1.0);\n }\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.3.light_casters_spot/5.3.light_casters.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.3.light_casters_spot/5.3.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.3.light_casters_spot/5.3.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp", "language": "code", "loc": 314, "comment_density": 0.232, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"5.3.light_casters.vs\", \"5.3.light_casters.fs\");\n Shader lightCubeShader(\"5.3.light_cube.vs\", \"5.3.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", camera.Position);\n lightingShader.setVec3(\"light.direction\", camera.Front);\n lightingShader.setFloat(\"light.cutOff\", glm::cos(glm::radians(12.5f)));\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.1f, 0.1f, 0.1f);\n // we configure the diffuse intensity slightly higher; the right lighting conditions differ with each lighting method and environment.\n // each environment and lighting type requires some tweaking to get the best out of your environment.\n lightingShader.setVec3(\"light.diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"light.constant\", 1.0f);\n lightingShader.setFloat(\"light.linear\", 0.09f);\n lightingShader.setFloat(\"light.quadratic\", 0.032f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n\n // again, a lamp object is weird when we only have a spot light, don't render the light object\n // lightCubeShader.use();\n // lightCubeShader.setMat4(\"projection\", projection);\n // lightCubeShader.setMat4(\"view\", view);\n // model = glm::mat4(1.0f);\n // model = glm::translate(model, lightPos);\n // model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n // lightCubeShader.setMat4(\"model\", model);\n\n // glBindVertexArray(lightCubeVAO);\n // glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.107, "dedup_hash": "57761de9fbb953b7", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_5_4_light_casters_spot_soft", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "5.4.Light Casters Spot Soft", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/5.4.light_casters_spot_soft/5.4.light_casters.fs", "language": "glsl", "loc": 54, "comment_density": 0.093, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular; \n float shininess;\n}; \n\nstruct Light {\n vec3 position; \n vec3 direction;\n float cutOff;\n float outerCutOff;\n \n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n\t\n float constant;\n float linear;\n float quadratic;\n};\n\nin vec3 FragPos; \nin vec3 Normal; \nin vec2 TexCoords;\n \nuniform vec3 viewPos;\nuniform Material material;\nuniform Light light;\n\nvoid main()\n{\n // ambient\n vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;\n \n // diffuse \n vec3 norm = normalize(Normal);\n vec3 lightDir = normalize(light.position - FragPos);\n float diff = max(dot(norm, lightDir), 0.0);\n vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb; \n \n // specular\n vec3 viewDir = normalize(viewPos - FragPos);\n vec3 reflectDir = reflect(-lightDir, norm); \n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb; \n \n // spotlight (soft edges)\n float theta = dot(lightDir, normalize(-light.direction)); \n float epsilon = (light.cutOff - light.outerCutOff);\n float intensity = clamp((theta - light.outerCutOff) / epsilon, 0.0, 1.0);\n diffuse *= intensity;\n specular *= intensity;\n \n // attenuation\n float distance = length(light.position - FragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n ambient *= attenuation; \n diffuse *= attenuation;\n specular *= attenuation; \n \n vec3 result = ambient + diffuse + specular;\n FragColor = vec4(result, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.4.light_casters_spot_soft/5.4.light_casters.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.4.light_casters_spot_soft/5.4.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/5.4.light_casters_spot_soft/5.4.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp", "language": "code", "loc": 315, "comment_density": 0.232, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"5.4.light_casters.vs\", \"5.4.light_casters.fs\");\n Shader lightCubeShader(\"5.4.light_cube.vs\", \"5.4.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"light.position\", camera.Position);\n lightingShader.setVec3(\"light.direction\", camera.Front);\n lightingShader.setFloat(\"light.cutOff\", glm::cos(glm::radians(12.5f)));\n lightingShader.setFloat(\"light.outerCutOff\", glm::cos(glm::radians(17.5f)));\n lightingShader.setVec3(\"viewPos\", camera.Position);\n\n // light properties\n lightingShader.setVec3(\"light.ambient\", 0.1f, 0.1f, 0.1f);\n // we configure the diffuse intensity slightly higher; the right lighting conditions differ with each lighting method and environment.\n // each environment and lighting type requires some tweaking to get the best out of your environment.\n lightingShader.setVec3(\"light.diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"light.specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"light.constant\", 1.0f);\n lightingShader.setFloat(\"light.linear\", 0.09f);\n lightingShader.setFloat(\"light.quadratic\", 0.032f);\n\n // material properties\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // again, a lamp object is weird when we only have a spot light, don't render the light object\n // lightCubeShader.use();\n // lightCubeShader.setMat4(\"projection\", projection);\n // lightCubeShader.setMat4(\"view\", view);\n // model = glm::mat4(1.0f);\n // model = glm::translate(model, lightPos);\n // model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube\n // lightCubeShader.setMat4(\"model\", model);\n\n // glBindVertexArray(lightCubeVAO);\n // glDrawArrays(GL_TRIANGLES, 0, 36);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.098, "dedup_hash": "a2df867a17853659", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_6_multiple_lights", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "6.Multiple Lights", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/2.lighting/6.multiple_lights/6.light_cube.fs", "language": "glsl", "loc": 6, "comment_density": 0.167, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0); // set all 4 vector values to 1.0\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/6.multiple_lights/6.light_cube.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/6.multiple_lights/6.multiple_lights.fs", "language": "glsl", "loc": 128, "comment_density": 0.203, "code": "#version 330 core\nout vec4 FragColor;\n\nstruct Material {\n sampler2D diffuse;\n sampler2D specular;\n float shininess;\n}; \n\nstruct DirLight {\n vec3 direction;\n\t\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nstruct PointLight {\n vec3 position;\n \n float constant;\n float linear;\n float quadratic;\n\t\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n};\n\nstruct SpotLight {\n vec3 position;\n vec3 direction;\n float cutOff;\n float outerCutOff;\n \n float constant;\n float linear;\n float quadratic;\n \n vec3 ambient;\n vec3 diffuse;\n vec3 specular; \n};\n\n#define NR_POINT_LIGHTS 4\n\nin vec3 FragPos;\nin vec3 Normal;\nin vec2 TexCoords;\n\nuniform vec3 viewPos;\nuniform DirLight dirLight;\nuniform PointLight pointLights[NR_POINT_LIGHTS];\nuniform SpotLight spotLight;\nuniform Material material;\n\n// function prototypes\nvec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir);\nvec3 CalcPointLight(PointLight light, vec3 normal, vec3 fragPos, vec3 viewDir);\nvec3 CalcSpotLight(SpotLight light, vec3 normal, vec3 fragPos, vec3 viewDir);\n\nvoid main()\n{ \n // properties\n vec3 norm = normalize(Normal);\n vec3 viewDir = normalize(viewPos - FragPos);\n \n // == =====================================================\n // Our lighting is set up in 3 phases: directional, point lights and an optional flashlight\n // For each phase, a calculate function is defined that calculates the corresponding color\n // per lamp. In the main() function we take all the calculated colors and sum them up for\n // this fragment's final color.\n // == =====================================================\n // phase 1: directional lighting\n vec3 result = CalcDirLight(dirLight, norm, viewDir);\n // phase 2: point lights\n for(int i = 0; i < NR_POINT_LIGHTS; i++)\n result += CalcPointLight(pointLights[i], norm, FragPos, viewDir); \n // phase 3: spot light\n result += CalcSpotLight(spotLight, norm, FragPos, viewDir); \n \n FragColor = vec4(result, 1.0);\n}\n\n// calculates the color when using a directional light.\nvec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir)\n{\n vec3 lightDir = normalize(-light.direction);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // specular shading\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n // combine results\n vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));\n vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords));\n vec3 specular = light.specular * spec * vec3(texture(material.specular, TexCoords));\n return (ambient + diffuse + specular);\n}\n\n// calculates the color when using a point light.\nvec3 CalcPointLight(PointLight light, vec3 normal, vec3 fragPos, vec3 viewDir)\n{\n vec3 lightDir = normalize(light.position - fragPos);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // specular shading\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n // attenuation\n float distance = length(light.position - fragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n // combine results\n vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));\n vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords));\n vec3 specular = light.specular * spec * vec3(texture(material.specular, TexCoords));\n ambient *= attenuation;\n diffuse *= attenuation;\n specular *= attenuation;\n return (ambient + diffuse + specular);\n}\n\n// calculates the color when using a spot light.\nvec3 CalcSpotLight(SpotLight light, vec3 normal, vec3 fragPos, vec3 viewDir)\n{\n vec3 lightDir = normalize(light.position - fragPos);\n // diffuse shading\n float diff = max(dot(normal, lightDir), 0.0);\n // specular shading\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);\n // attenuation\n float distance = length(light.position - fragPos);\n float attenuation = 1.0 / (light.constant + light.linear * distance + light.quadratic * (distance * distance)); \n // spotlight intensity\n float theta = dot(lightDir, normalize(-light.direction)); \n float epsilon = light.cutOff - light.outerCutOff;\n float intensity = clamp((theta - light.outerCutOff) / epsilon, 0.0, 1.0);\n // combine results\n vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords));\n vec3 diffuse = light.diffuse * diff * vec3(texture(material.diffuse, TexCoords));\n vec3 specular = light.specular * spec * vec3(texture(material.specular, TexCoords));\n ambient *= attenuation * intensity;\n diffuse *= attenuation * intensity;\n specular *= attenuation * intensity;\n return (ambient + diffuse + specular);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/2.lighting/6.multiple_lights/6.multiple_lights.vs", "language": "glsl", "loc": 17, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec3 FragPos;\nout vec3 Normal;\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n FragPos = vec3(model * vec4(aPos, 1.0));\n Normal = mat3(transpose(inverse(model))) * aNormal; \n TexCoords = aTexCoords;\n \n gl_Position = projection * view * vec4(FragPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/2.lighting/6.multiple_lights/multiple_lights.cpp", "language": "code", "loc": 368, "comment_density": 0.207, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// lighting\nglm::vec3 lightPos(1.2f, 1.0f, 2.0f);\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile our shader zprogram\n // ------------------------------------\n Shader lightingShader(\"6.multiple_lights.vs\", \"6.multiple_lights.fs\");\n Shader lightCubeShader(\"6.light_cube.vs\", \"6.light_cube.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float vertices[] = {\n // positions // normals // texture coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f\n };\n // positions all containers\n glm::vec3 cubePositions[] = {\n glm::vec3( 0.0f, 0.0f, 0.0f),\n glm::vec3( 2.0f, 5.0f, -15.0f),\n glm::vec3(-1.5f, -2.2f, -2.5f),\n glm::vec3(-3.8f, -2.0f, -12.3f),\n glm::vec3( 2.4f, -0.4f, -3.5f),\n glm::vec3(-1.7f, 3.0f, -7.5f),\n glm::vec3( 1.3f, -2.0f, -2.5f),\n glm::vec3( 1.5f, 2.0f, -2.5f),\n glm::vec3( 1.5f, 0.2f, -1.5f),\n glm::vec3(-1.3f, 1.0f, -1.5f)\n };\n // positions of the point lights\n glm::vec3 pointLightPositions[] = {\n glm::vec3( 0.7f, 0.2f, 2.0f),\n glm::vec3( 2.3f, -3.3f, -4.0f),\n glm::vec3(-4.0f, 2.0f, -12.0f),\n glm::vec3( 0.0f, 0.0f, -3.0f)\n };\n // first, configure the cube's VAO (and VBO)\n unsigned int VBO, cubeVAO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &VBO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n\n glBindVertexArray(cubeVAO);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(2);\n\n // second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)\n unsigned int lightCubeVAO;\n glGenVertexArrays(1, &lightCubeVAO);\n glBindVertexArray(lightCubeVAO);\n\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n // note that we update the lamp's position attribute's stride to reflect the updated buffer data\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(0);\n\n // load textures (we now use a utility function to keep the code more organized)\n // -----------------------------------------------------------------------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/container2.png\").c_str());\n unsigned int specularMap = loadTexture(FileSystem::getPath(\"resources/textures/container2_specular.png\").c_str());\n\n // shader configuration\n // --------------------\n lightingShader.use();\n lightingShader.setInt(\"material.diffuse\", 0);\n lightingShader.setInt(\"material.specular\", 1);\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // be sure to activate shader when setting uniforms/drawing objects\n lightingShader.use();\n lightingShader.setVec3(\"viewPos\", camera.Position);\n lightingShader.setFloat(\"material.shininess\", 32.0f);\n\n /*\n Here we set all the uniforms for the 5/6 types of lights we have. We have to set them manually and index \n the proper PointLight struct in the array to set each uniform variable. This can be done more code-friendly\n by defining light types as classes and set their values in there, or by using a more efficient uniform approach\n by using 'Uniform buffer objects', but that is something we'll discuss in the 'Advanced GLSL' tutorial.\n */\n // directional light\n lightingShader.setVec3(\"dirLight.direction\", -0.2f, -1.0f, -0.3f);\n lightingShader.setVec3(\"dirLight.ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"dirLight.diffuse\", 0.4f, 0.4f, 0.4f);\n lightingShader.setVec3(\"dirLight.specular\", 0.5f, 0.5f, 0.5f);\n // point light 1\n lightingShader.setVec3(\"pointLights[0].position\", pointLightPositions[0]);\n lightingShader.setVec3(\"pointLights[0].ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"pointLights[0].diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"pointLights[0].specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"pointLights[0].constant\", 1.0f);\n lightingShader.setFloat(\"pointLights[0].linear\", 0.09f);\n lightingShader.setFloat(\"pointLights[0].quadratic\", 0.032f);\n // point light 2\n lightingShader.setVec3(\"pointLights[1].position\", pointLightPositions[1]);\n lightingShader.setVec3(\"pointLights[1].ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"pointLights[1].diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"pointLights[1].specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"pointLights[1].constant\", 1.0f);\n lightingShader.setFloat(\"pointLights[1].linear\", 0.09f);\n lightingShader.setFloat(\"pointLights[1].quadratic\", 0.032f);\n // point light 3\n lightingShader.setVec3(\"pointLights[2].position\", pointLightPositions[2]);\n lightingShader.setVec3(\"pointLights[2].ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"pointLights[2].diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"pointLights[2].specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"pointLights[2].constant\", 1.0f);\n lightingShader.setFloat(\"pointLights[2].linear\", 0.09f);\n lightingShader.setFloat(\"pointLights[2].quadratic\", 0.032f);\n // point light 4\n lightingShader.setVec3(\"pointLights[3].position\", pointLightPositions[3]);\n lightingShader.setVec3(\"pointLights[3].ambient\", 0.05f, 0.05f, 0.05f);\n lightingShader.setVec3(\"pointLights[3].diffuse\", 0.8f, 0.8f, 0.8f);\n lightingShader.setVec3(\"pointLights[3].specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"pointLights[3].constant\", 1.0f);\n lightingShader.setFloat(\"pointLights[3].linear\", 0.09f);\n lightingShader.setFloat(\"pointLights[3].quadratic\", 0.032f);\n // spotLight\n lightingShader.setVec3(\"spotLight.position\", camera.Position);\n lightingShader.setVec3(\"spotLight.direction\", camera.Front);\n lightingShader.setVec3(\"spotLight.ambient\", 0.0f, 0.0f, 0.0f);\n lightingShader.setVec3(\"spotLight.diffuse\", 1.0f, 1.0f, 1.0f);\n lightingShader.setVec3(\"spotLight.specular\", 1.0f, 1.0f, 1.0f);\n lightingShader.setFloat(\"spotLight.constant\", 1.0f);\n lightingShader.setFloat(\"spotLight.linear\", 0.09f);\n lightingShader.setFloat(\"spotLight.quadratic\", 0.032f);\n lightingShader.setFloat(\"spotLight.cutOff\", glm::cos(glm::radians(12.5f)));\n lightingShader.setFloat(\"spotLight.outerCutOff\", glm::cos(glm::radians(15.0f))); \n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n lightingShader.setMat4(\"projection\", projection);\n lightingShader.setMat4(\"view\", view);\n\n // world transformation\n glm::mat4 model = glm::mat4(1.0f);\n lightingShader.setMat4(\"model\", model);\n\n // bind diffuse map\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n // bind specular map\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, specularMap);\n\n // render containers\n glBindVertexArray(cubeVAO);\n for (unsigned int i = 0; i < 10; i++)\n {\n // calculate the model matrix for each object and pass it to shader before drawing\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, cubePositions[i]);\n float angle = 20.0f * i;\n model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));\n lightingShader.setMat4(\"model\", model);\n\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n // also draw the lamp object(s)\n lightCubeShader.use();\n lightCubeShader.setMat4(\"projection\", projection);\n lightCubeShader.setMat4(\"view\", view);\n \n // we now draw as many light bulbs as we have point lights.\n glBindVertexArray(lightCubeVAO);\n for (unsigned int i = 0; i < 4; i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, pointLightPositions[i]);\n model = glm::scale(model, glm::vec3(0.2f)); // Make it a smaller cube\n lightCubeShader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n }\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &lightCubeVAO);\n glDeleteBuffers(1, &VBO);\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.115, "dedup_hash": "db73b606ccb92632", "has_readme": true} +{"id": "joeydevries_learnopengl_src_2_lighting_6_multiple_lights_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:11+00:00", "source_type": "repo", "title": "6.Multiple Lights Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/2.lighting/6.multiple_lights_exercise1/multiple_lights_exercise1.cpp", "language": "code", "loc": 240, "comment_density": 0.15, "code": "// == ==============================================================================================\n// DESERT\n// == ==============================================================================================\nglClearColor(0.75f, 0.52f, 0.3f, 1.0f);\n[...]\nglm::vec3 pointLightColors[] = {\n glm::vec3(1.0f, 0.6f, 0.0f),\n glm::vec3(1.0f, 0.0f, 0.0f),\n glm::vec3(1.0f, 1.0, 0.0),\n glm::vec3(0.2f, 0.2f, 1.0f)\n};\n[...]\n// Directional light\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.direction\"), -0.2f, -1.0f, -0.3f);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.ambient\"), 0.3f, 0.24f, 0.14f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.diffuse\"), 0.7f, 0.42f, 0.26f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.specular\"), 0.5f, 0.5f, 0.5f);\n// Point light 1\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].position\"), pointLightPositions[0].x, pointLightPositions[0].y, pointLightPositions[0].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].ambient\"), pointLightColors[0].x * 0.1, pointLightColors[0].y * 0.1, pointLightColors[0].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].diffuse\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].specular\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].quadratic\"), 0.032);\t\t\n// Point light 2\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].position\"), pointLightPositions[1].x, pointLightPositions[1].y, pointLightPositions[1].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].ambient\"), pointLightColors[1].x * 0.1, pointLightColors[1].y * 0.1, pointLightColors[1].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].diffuse\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].specular\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].quadratic\"), 0.032);\t\t\n// Point light 3\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].position\"), pointLightPositions[2].x, pointLightPositions[2].y, pointLightPositions[2].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].ambient\"), pointLightColors[2].x * 0.1, pointLightColors[2].y * 0.1, pointLightColors[2].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].diffuse\"), pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].specular\") ,pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].quadratic\"), 0.032);\t\t\n// Point light 4\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].position\"), pointLightPositions[3].x, pointLightPositions[3].y, pointLightPositions[3].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].ambient\"), pointLightColors[3].x * 0.1, pointLightColors[3].y * 0.1, pointLightColors[3].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].diffuse\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].specular\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].quadratic\"), 0.032);\t\t\n// SpotLight\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.position\"), camera.Position.x, camera.Position.y, camera.Position.z);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.direction\"), camera.Front.x, camera.Front.y, camera.Front.z);\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.diffuse\"), 0.8f, 0.8f, 0.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.specular\"), 0.8f, 0.8f, 0.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.quadratic\"), 0.032);\t\t\t\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.cutOff\"), glm::cos(glm::radians(12.5f)));\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.outerCutOff\"), glm::cos(glm::radians(13.0f)));\t\n// == ==============================================================================================\n// FACTORY\n// == ==============================================================================================\nglClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n[...]\nglm::vec3 pointLightColors[] = {\n glm::vec3(0.2f, 0.2f, 0.6f),\n glm::vec3(0.3f, 0.3f, 0.7f),\n glm::vec3(0.0f, 0.0f, 0.3f),\n glm::vec3(0.4f, 0.4f, 0.4f)\n};\n[...]\n// Directional light\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.direction\"), -0.2f, -1.0f, -0.3f);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.ambient\"), 0.05f, 0.05f, 0.1f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.diffuse\"), 0.2f, 0.2f, 0.7); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.specular\"), 0.7f, 0.7f, 0.7f);\n// Point light 1\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].position\"), pointLightPositions[0].x, pointLightPositions[0].y, pointLightPositions[0].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].ambient\"), pointLightColors[0].x * 0.1, pointLightColors[0].y * 0.1, pointLightColors[0].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].diffuse\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].specular\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].quadratic\"), 0.032);\t\t\n// Point light 2\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].position\"), pointLightPositions[1].x, pointLightPositions[1].y, pointLightPositions[1].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].ambient\"), pointLightColors[1].x * 0.1, pointLightColors[1].y * 0.1, pointLightColors[1].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].diffuse\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].specular\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].quadratic\"), 0.032);\t\t\n// Point light 3\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].position\"), pointLightPositions[2].x, pointLightPositions[2].y, pointLightPositions[2].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].ambient\"), pointLightColors[2].x * 0.1, pointLightColors[2].y * 0.1, pointLightColors[2].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].diffuse\"), pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].specular\") ,pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].quadratic\"), 0.032);\t\t\n// Point light 4\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].position\"), pointLightPositions[3].x, pointLightPositions[3].y, pointLightPositions[3].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].ambient\"), pointLightColors[3].x * 0.1, pointLightColors[3].y * 0.1, pointLightColors[3].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].diffuse\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].specular\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].quadratic\"), 0.032);\t\t\n// SpotLight\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.position\"), camera.Position.x, camera.Position.y, camera.Position.z);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.direction\"), camera.Front.x, camera.Front.y, camera.Front.z);\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.diffuse\"), 1.0f, 1.0f, 1.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.specular\"), 1.0f, 1.0f, 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.linear\"), 0.009);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.quadratic\"), 0.0032);\t\t\t\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.cutOff\"), glm::cos(glm::radians(10.0f)));\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.outerCutOff\"), glm::cos(glm::radians(12.5f)));\t\n// == ==============================================================================================\n// HORROR\n// == ==============================================================================================\nglClearColor(0.0f, 0.0f, 0.0f, 1.0f);\n[...]\nglm::vec3 pointLightColors[] = {\n glm::vec3(0.1f, 0.1f, 0.1f),\n glm::vec3(0.1f, 0.1f, 0.1f),\n glm::vec3(0.1f, 0.1f, 0.1f),\n glm::vec3(0.3f, 0.1f, 0.1f)\n};\n[...]\n// Directional light\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.direction\"), -0.2f, -1.0f, -0.3f);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.diffuse\"), 0.05f, 0.05f, 0.05); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.specular\"), 0.2f, 0.2f, 0.2f);\n// Point light 1\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].position\"), pointLightPositions[0].x, pointLightPositions[0].y, pointLightPositions[0].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].ambient\"), pointLightColors[0].x * 0.1, pointLightColors[0].y * 0.1, pointLightColors[0].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].diffuse\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].specular\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].linear\"), 0.14);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].quadratic\"), 0.07);\t\t\n// Point light 2\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].position\"), pointLightPositions[1].x, pointLightPositions[1].y, pointLightPositions[1].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].ambient\"), pointLightColors[1].x * 0.1, pointLightColors[1].y * 0.1, pointLightColors[1].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].diffuse\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].specular\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].linear\"), 0.14);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].quadratic\"), 0.07);\t\t\n// Point light 3\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].position\"), pointLightPositions[2].x, pointLightPositions[2].y, pointLightPositions[2].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].ambient\"), pointLightColors[2].x * 0.1, pointLightColors[2].y * 0.1, pointLightColors[2].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].diffuse\"), pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].specular\") ,pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].linear\"), 0.22);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].quadratic\"), 0.20);\t\t\n// Point light 4\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].position\"), pointLightPositions[3].x, pointLightPositions[3].y, pointLightPositions[3].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].ambient\"), pointLightColors[3].x * 0.1, pointLightColors[3].y * 0.1, pointLightColors[3].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].diffuse\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].specular\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].linear\"), 0.14);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].quadratic\"), 0.07);\t\t\n// SpotLight\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.position\"), camera.Position.x, camera.Position.y, camera.Position.z);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.direction\"), camera.Front.x, camera.Front.y, camera.Front.z);\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.diffuse\"), 1.0f, 1.0f, 1.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.specular\"), 1.0f, 1.0f, 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.linear\"), 0.09);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.quadratic\"), 0.032);\t\t\t\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.cutOff\"), glm::cos(glm::radians(10.0f)));\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.outerCutOff\"), glm::cos(glm::radians(15.0f)));\n// == ==============================================================================================\n// BIOCHEMICAL LAB\n// == ==============================================================================================\nglClearColor(0.9f, 0.9f, 0.9f, 1.0f);\n[...]\nglm::vec3 pointLightColors[] = {\n glm::vec3(0.4f, 0.7f, 0.1f),\n glm::vec3(0.4f, 0.7f, 0.1f),\n glm::vec3(0.4f, 0.7f, 0.1f),\n glm::vec3(0.4f, 0.7f, 0.1f)\n};\n[...]\n// Directional light\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.direction\"), -0.2f, -1.0f, -0.3f);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.ambient\"), 0.5f, 0.5f, 0.5f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.diffuse\"), 1.0f, 1.0f, 1.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"dirLight.specular\"), 1.0f, 1.0f, 1.0f);\n// Point light 1\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].position\"), pointLightPositions[0].x, pointLightPositions[0].y, pointLightPositions[0].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].ambient\"), pointLightColors[0].x * 0.1, pointLightColors[0].y * 0.1, pointLightColors[0].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].diffuse\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].specular\"), pointLightColors[0].x, pointLightColors[0].y, pointLightColors[0].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[0].quadratic\"), 0.017);\t\t\n// Point light 2\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].position\"), pointLightPositions[1].x, pointLightPositions[1].y, pointLightPositions[1].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].ambient\"), pointLightColors[1].x * 0.1, pointLightColors[1].y * 0.1, pointLightColors[1].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].diffuse\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].specular\"), pointLightColors[1].x, pointLightColors[1].y, pointLightColors[1].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[1].quadratic\"), 0.017);\t\t\n// Point light 3\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].position\"), pointLightPositions[2].x, pointLightPositions[2].y, pointLightPositions[2].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].ambient\"), pointLightColors[2].x * 0.1, pointLightColors[2].y * 0.1, pointLightColors[2].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].diffuse\"), pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].specular\") ,pointLightColors[2].x, pointLightColors[2].y, pointLightColors[2].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[2].quadratic\"), 0.017);\t\t\n// Point light 4\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].position\"), pointLightPositions[3].x, pointLightPositions[3].y, pointLightPositions[3].z);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].ambient\"), pointLightColors[3].x * 0.1, pointLightColors[3].y * 0.1, pointLightColors[3].z * 0.1);\t\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].diffuse\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].specular\"), pointLightColors[3].x, pointLightColors[3].y, pointLightColors[3].z);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"pointLights[3].quadratic\"), 0.017);\t\t\n// SpotLight\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.position\"), camera.Position.x, camera.Position.y, camera.Position.z);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.direction\"), camera.Front.x, camera.Front.y, camera.Front.z);\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.ambient\"), 0.0f, 0.0f, 0.0f);\t\nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.diffuse\"), 0.0f, 1.0f, 0.0f); \nglUniform3f(glGetUniformLocation(lightingShader.Program, \"spotLight.specular\"), 0.0f, 1.0f, 0.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.constant\"), 1.0f);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.linear\"), 0.07);\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.quadratic\"), 0.017);\t\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.cutOff\"), glm::cos(glm::radians(7.0f)));\nglUniform1f(glGetUniformLocation(lightingShader.Program, \"spotLight.outerCutOff\"), glm::cos(glm::radians(10.0f)));\t"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.15, "dedup_hash": "7e84b0f67b4f362f", "has_readme": true} +{"id": "joeydevries_learnopengl_src_3_model_loading_1_model_loading", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "1.Model Loading", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/3.model_loading/1.model_loading/1.model_loading.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{ \n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/3.model_loading/1.model_loading/1.model_loading.vs", "language": "glsl", "loc": 13, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/3.model_loading/1.model_loading/model_loading.cpp", "language": "code", "loc": 157, "comment_density": 0.299, "code": "#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = SCR_WIDTH / 2.0f;\nfloat lastY = SCR_HEIGHT / 2.0f;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // tell stb_image.h to flip loaded texture's on the y-axis (before loading model).\n stbi_set_flip_vertically_on_load(true);\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader ourShader(\"1.model_loading.vs\", \"1.model_loading.fs\");\n\n // load models\n // -----------\n Model ourModel(FileSystem::getPath(\"resources/objects/backpack/backpack.obj\"));\n\n \n // draw in wireframe\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.05f, 0.05f, 0.05f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // don't forget to enable shader before setting uniforms\n ourShader.use();\n\n // view/projection transformations\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n ourShader.setMat4(\"projection\", projection);\n ourShader.setMat4(\"view\", view);\n\n // render the loaded model\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 0.0f, 0.0f)); // translate it down so it's at the center of the scene\n model = glm::scale(model, glm::vec3(1.0f, 1.0f, 1.0f));\t// it's a bit too big for our scene, so scale it down\n ourShader.setMat4(\"model\", model);\n ourModel.Draw(ourShader);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // glfw: terminate, clearing all previously allocated GLFW resources.\n // ------------------------------------------------------------------\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.1, "dedup_hash": "7d046dd8b8d0163a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_1_1_depth_testing", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "1.1.Depth Testing", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/1.1.depth_testing/1.1.depth_testing.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/1.1.depth_testing/1.1.depth_testing.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/1.1.depth_testing/depth_testing.cpp", "language": "code", "loc": 282, "comment_density": 0.184, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glDepthFunc(GL_ALWAYS); // always pass the depth test (same effect as glDisable(GL_DEPTH_TEST))\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"1.1.depth_testing.vs\", \"1.1.depth_testing.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords (note we set these higher than 1 (together with GL_REPEAT as texture wrapping mode). this will cause the floor texture to repeat)\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\t\t\t\t\t\t\t\t\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while(!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture); \t\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const *path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.061, "dedup_hash": "7877e2d688e4f75c", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_1_2_depth_testing_view", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "1.2.Depth Testing View", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/1.2.depth_testing_view/1.2.depth_testing.fs", "language": "glsl", "loc": 14, "comment_density": 0.143, "code": "#version 330 core\nout vec4 FragColor;\n\nfloat near = 0.1; \nfloat far = 100.0; \nfloat LinearizeDepth(float depth) \n{\n float z = depth * 2.0 - 1.0; // back to NDC \n return (2.0 * near * far) / (far + near - z * (far - near));\t\n}\n\nvoid main()\n{ \n float depth = LinearizeDepth(gl_FragCoord.z) / far; // divide by far to get depth in range [0,1] for visualization purposes\n FragColor = vec4(vec3(depth), 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/1.2.depth_testing_view/1.2.depth_testing.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/1.2.depth_testing_view/depth_testing_view.cpp", "language": "code", "loc": 282, "comment_density": 0.181, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glDepthFunc(GL_LESS);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"1.2.depth_testing.vs\", \"1.2.depth_testing.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords (note we set these higher than 1 (together with GL_REPEAT as texture wrapping mode). this will cause the floor texture to repeat)\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const *path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.108, "dedup_hash": "20ca2c55f12e3e6c", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_10_1_instancing_quads", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "10.1.Instancing Quads", "api": "OpenGL Core", "glsl_version": null, "topic": "instancing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/10.1.instancing_quads/10.1.instancing.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 fColor;\n\nvoid main()\n{\n FragColor = vec4(fColor, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.1.instancing_quads/10.1.instancing.vs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec3 aColor;\nlayout (location = 2) in vec2 aOffset;\n\nout vec3 fColor;\n\nvoid main()\n{\n fColor = aColor;\n gl_Position = vec4(aPos + aOffset, 0.0, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.1.instancing_quads/instancing_quads.cpp", "language": "code", "loc": 125, "comment_density": 0.28, "code": "#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"10.1.instancing.vs\", \"10.1.instancing.fs\");\n\n // generate a list of 100 quad locations/translation-vectors\n // ---------------------------------------------------------\n glm::vec2 translations[100];\n int index = 0;\n float offset = 0.1f;\n for (int y = -10; y < 10; y += 2)\n {\n for (int x = -10; x < 10; x += 2)\n {\n glm::vec2 translation;\n translation.x = (float)x / 10.0f + offset;\n translation.y = (float)y / 10.0f + offset;\n translations[index++] = translation;\n }\n }\n\n // store instance data in an array buffer\n // --------------------------------------\n unsigned int instanceVBO;\n glGenBuffers(1, &instanceVBO);\n glBindBuffer(GL_ARRAY_BUFFER, instanceVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec2) * 100, &translations[0], GL_STATIC_DRAW);\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float quadVertices[] = {\n // positions // colors\n -0.05f, 0.05f, 1.0f, 0.0f, 0.0f,\n 0.05f, -0.05f, 0.0f, 1.0f, 0.0f,\n -0.05f, -0.05f, 0.0f, 0.0f, 1.0f,\n\n -0.05f, 0.05f, 1.0f, 0.0f, 0.0f,\n 0.05f, -0.05f, 0.0f, 1.0f, 0.0f,\n 0.05f, 0.05f, 0.0f, 1.0f, 1.0f\n };\n unsigned int quadVAO, quadVBO;\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(2 * sizeof(float)));\n // also set instance data\n glEnableVertexAttribArray(2);\n glBindBuffer(GL_ARRAY_BUFFER, instanceVBO); // this attribute comes from a different vertex buffer\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0);\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glVertexAttribDivisor(2, 1); // tell OpenGL this is an instanced vertex attribute.\n\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw 100 instanced quads\n shader.use();\n glBindVertexArray(quadVAO);\n glDrawArraysInstanced(GL_TRIANGLES, 0, 6, 100); // 100 triangles of 6 vertices each\n glBindVertexArray(0);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &quadVAO);\n glDeleteBuffers(1, &quadVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.093, "dedup_hash": "ec7493de6623d3ef", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_10_2_asteroids", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "10.2.Asteroids", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/instancing/texturing/framebuffer/basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/10.2.asteroids/10.2.instancing.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.2.asteroids/10.2.instancing.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0f); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.2.asteroids/asteroids.cpp", "language": "code", "loc": 187, "comment_density": 0.257, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 55.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"10.2.instancing.vs\", \"10.2.instancing.fs\");\n\n // load models\n // -----------\n Model rock(FileSystem::getPath(\"resources/objects/rock/rock.obj\"));\n Model planet(FileSystem::getPath(\"resources/objects/planet/planet.obj\"));\n\n // generate a large list of semi-random model transformation matrices\n // ------------------------------------------------------------------\n unsigned int amount = 1000;\n glm::mat4* modelMatrices;\n modelMatrices = new glm::mat4[amount];\n srand(static_cast(glfwGetTime())); // initialize random seed\n float radius = 50.0;\n float offset = 2.5f;\n for (unsigned int i = 0; i < amount; i++)\n {\n glm::mat4 model = glm::mat4(1.0f);\n // 1. translation: displace along circle with 'radius' in range [-offset, offset]\n float angle = (float)i / (float)amount * 360.0f;\n float displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float x = sin(angle) * radius + displacement;\n displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float y = displacement * 0.4f; // keep height of asteroid field smaller compared to width of x and z\n displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float z = cos(angle) * radius + displacement;\n model = glm::translate(model, glm::vec3(x, y, z));\n\n // 2. scale: Scale between 0.05 and 0.25f\n float scale = static_cast((rand() % 20) / 100.0 + 0.05);\n model = glm::scale(model, glm::vec3(scale));\n\n // 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector\n float rotAngle = static_cast((rand() % 360));\n model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f));\n\n // 4. now add to list of matrices\n modelMatrices[i] = model;\n }\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure transformation matrices\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);\n glm::mat4 view = camera.GetViewMatrix();;\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n\n // draw planet\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, -3.0f, 0.0f));\n model = glm::scale(model, glm::vec3(4.0f, 4.0f, 4.0f));\n shader.setMat4(\"model\", model);\n planet.Draw(shader);\n\n // draw meteorites\n for (unsigned int i = 0; i < amount; i++)\n {\n shader.setMat4(\"model\", modelMatrices[i]);\n rock.Draw(shader);\n } \n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.086, "dedup_hash": "f180c1595c566626", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_10_3_asteroids_instanced", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "10.3.Asteroids Instanced", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/10.3.asteroids_instanced/10.3.asteroids.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.3.asteroids_instanced/10.3.asteroids.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\nlayout (location = 3) in mat4 aInstanceMatrix;\n\nout vec2 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * aInstanceMatrix * vec4(aPos, 1.0f); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.3.asteroids_instanced/10.3.planet.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.3.asteroids_instanced/10.3.planet.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0f); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/10.3.asteroids_instanced/asteroids_instanced.cpp", "language": "code", "loc": 225, "comment_density": 0.249, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 155.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader asteroidShader(\"10.3.asteroids.vs\", \"10.3.asteroids.fs\");\n Shader planetShader(\"10.3.planet.vs\", \"10.3.planet.fs\");\n\n // load models\n // -----------\n Model rock(FileSystem::getPath(\"resources/objects/rock/rock.obj\"));\n Model planet(FileSystem::getPath(\"resources/objects/planet/planet.obj\"));\n\n // generate a large list of semi-random model transformation matrices\n // ------------------------------------------------------------------\n unsigned int amount = 100000;\n glm::mat4* modelMatrices;\n modelMatrices = new glm::mat4[amount];\n srand(static_cast(glfwGetTime())); // initialize random seed\n float radius = 150.0;\n float offset = 25.0f;\n for (unsigned int i = 0; i < amount; i++)\n {\n glm::mat4 model = glm::mat4(1.0f);\n // 1. translation: displace along circle with 'radius' in range [-offset, offset]\n float angle = (float)i / (float)amount * 360.0f;\n float displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float x = sin(angle) * radius + displacement;\n displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float y = displacement * 0.4f; // keep height of asteroid field smaller compared to width of x and z\n displacement = (rand() % (int)(2 * offset * 100)) / 100.0f - offset;\n float z = cos(angle) * radius + displacement;\n model = glm::translate(model, glm::vec3(x, y, z));\n\n // 2. scale: Scale between 0.05 and 0.25f\n float scale = static_cast((rand() % 20) / 100.0 + 0.05);\n model = glm::scale(model, glm::vec3(scale));\n\n // 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector\n float rotAngle = static_cast((rand() % 360));\n model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f));\n\n // 4. now add to list of matrices\n modelMatrices[i] = model;\n }\n\n // configure instanced array\n // -------------------------\n unsigned int buffer;\n glGenBuffers(1, &buffer);\n glBindBuffer(GL_ARRAY_BUFFER, buffer);\n glBufferData(GL_ARRAY_BUFFER, amount * sizeof(glm::mat4), &modelMatrices[0], GL_STATIC_DRAW);\n\n // set transformation matrices as an instance vertex attribute (with divisor 1)\n // note: we're cheating a little by taking the, now publicly declared, VAO of the model's mesh(es) and adding new vertexAttribPointers\n // normally you'd want to do this in a more organized fashion, but for learning purposes this will do.\n // -----------------------------------------------------------------------------------------------------------------------------------\n for (unsigned int i = 0; i < rock.meshes.size(); i++)\n {\n unsigned int VAO = rock.meshes[i].VAO;\n glBindVertexArray(VAO);\n // set attribute pointers for matrix (4 times vec4)\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), (void*)0);\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), (void*)(sizeof(glm::vec4)));\n glEnableVertexAttribArray(5);\n glVertexAttribPointer(5, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), (void*)(2 * sizeof(glm::vec4)));\n glEnableVertexAttribArray(6);\n glVertexAttribPointer(6, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4), (void*)(3 * sizeof(glm::vec4)));\n\n glVertexAttribDivisor(3, 1);\n glVertexAttribDivisor(4, 1);\n glVertexAttribDivisor(5, 1);\n glVertexAttribDivisor(6, 1);\n\n glBindVertexArray(0);\n }\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure transformation matrices\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);\n glm::mat4 view = camera.GetViewMatrix();\n asteroidShader.use();\n asteroidShader.setMat4(\"projection\", projection);\n asteroidShader.setMat4(\"view\", view);\n planetShader.use();\n planetShader.setMat4(\"projection\", projection);\n planetShader.setMat4(\"view\", view);\n \n // draw planet\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, -3.0f, 0.0f));\n model = glm::scale(model, glm::vec3(4.0f, 4.0f, 4.0f));\n planetShader.setMat4(\"model\", model);\n planet.Draw(planetShader);\n\n // draw meteorites\n asteroidShader.use();\n asteroidShader.setInt(\"texture_diffuse1\", 0);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, rock.textures_loaded[0].id); // note: we also made the textures_loaded vector public (instead of private) from the model class.\n for (unsigned int i = 0; i < rock.meshes.size(); i++)\n {\n glBindVertexArray(rock.meshes[i].VAO);\n glDrawElementsInstanced(GL_TRIANGLES, static_cast(rock.meshes[i].indices.size()), GL_UNSIGNED_INT, 0, amount);\n glBindVertexArray(0);\n }\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.05, "dedup_hash": "09a41d17509d124b", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_11_1_anti_aliasing_msaa", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:12+00:00", "source_type": "repo", "title": "11.1.Anti Aliasing Msaa", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/11.1.anti_aliasing_msaa/11.1.anti_aliasing.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.1.anti_aliasing_msaa/11.1.anti_aliasing.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.1.anti_aliasing_msaa/anti_aliasing_msaa.cpp", "language": "code", "loc": 195, "comment_density": 0.21, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_MULTISAMPLE); // enabled by default on some drivers, but not all so always enable to make sure\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"11.1.anti_aliasing.vs\", \"11.1.anti_aliasing.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions \n -0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n -0.5f, 0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n\n -0.5f, -0.5f, 0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n -0.5f, -0.5f, 0.5f,\n\n -0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n -0.5f, -0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n\n -0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, -0.5f, 0.5f,\n -0.5f, -0.5f, 0.5f,\n -0.5f, -0.5f, -0.5f,\n\n -0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, -0.5f\n };\n // setup cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // set transformation matrices\t\t\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", camera.GetViewMatrix());\n shader.setMat4(\"model\", glm::mat4(1.0f));\n\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36); \n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.07, "dedup_hash": "447d49abda4ae3d8", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_11_2_anti_aliasing_offscreen", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "11.2.Anti Aliasing Offscreen", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/11.2.aa_post.fs", "language": "glsl", "loc": 10, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D screenTexture;\n\nvoid main()\n{\n vec3 col = texture(screenTexture, TexCoords).rgb;\n float grayscale = 0.2126 * col.r + 0.7152 * col.g + 0.0722 * col.b;\n FragColor = vec4(vec3(grayscale), 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/11.2.aa_post.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); \n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/11.2.anti_aliasing.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/11.2.anti_aliasing.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/11.2.anti_aliasing_offscreen/anti_aliasing_offscreen.cpp", "language": "code", "loc": 276, "comment_density": 0.207, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"11.2.anti_aliasing.vs\", \"11.2.anti_aliasing.fs\");\n Shader screenShader(\"11.2.aa_post.vs\", \"11.2.aa_post.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions \n -0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n -0.5f, 0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n\n -0.5f, -0.5f, 0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n -0.5f, -0.5f, 0.5f,\n\n -0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n -0.5f, -0.5f, -0.5f,\n -0.5f, -0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n\n -0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, -0.5f,\n 0.5f, -0.5f, 0.5f,\n 0.5f, -0.5f, 0.5f,\n -0.5f, -0.5f, 0.5f,\n -0.5f, -0.5f, -0.5f,\n\n -0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, -0.5f,\n 0.5f, 0.5f, 0.5f,\n 0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, 0.5f,\n -0.5f, 0.5f, -0.5f\n };\n float quadVertices[] = { // vertex attributes for a quad that fills the entire screen in Normalized Device Coordinates.\n // positions // texCoords\n -1.0f, 1.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n\n -1.0f, 1.0f, 0.0f, 1.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n 1.0f, 1.0f, 1.0f, 1.0f\n };\n // setup cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n // setup screen VAO\n unsigned int quadVAO, quadVBO;\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));\n\n\n // configure MSAA framebuffer\n // --------------------------\n unsigned int framebuffer;\n glGenFramebuffers(1, &framebuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n // create a multisampled color attachment texture\n unsigned int textureColorBufferMultiSampled;\n glGenTextures(1, &textureColorBufferMultiSampled);\n glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, textureColorBufferMultiSampled);\n glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGB, SCR_WIDTH, SCR_HEIGHT, GL_TRUE);\n glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, textureColorBufferMultiSampled, 0);\n // create a (also multisampled) renderbuffer object for depth and stencil attachments\n unsigned int rbo;\n glGenRenderbuffers(1, &rbo);\n glBindRenderbuffer(GL_RENDERBUFFER, rbo);\n glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH24_STENCIL8, SCR_WIDTH, SCR_HEIGHT);\n glBindRenderbuffer(GL_RENDERBUFFER, 0);\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo);\n\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n cout << \"ERROR::FRAMEBUFFER:: Framebuffer is not complete!\" << endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // configure second post-processing framebuffer\n unsigned int intermediateFBO;\n glGenFramebuffers(1, &intermediateFBO);\n glBindFramebuffer(GL_FRAMEBUFFER, intermediateFBO);\n // create a color attachment texture\n unsigned int screenTexture;\n glGenTextures(1, &screenTexture);\n glBindTexture(GL_TEXTURE_2D, screenTexture);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, screenTexture, 0);\t// we only need a color buffer\n\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n cout << \"ERROR::FRAMEBUFFER:: Intermediate framebuffer is not complete!\" << endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // shader configuration\n // --------------------\n screenShader.use();\n screenShader.setInt(\"screenTexture\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. draw scene as normal in multisampled buffers\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n glEnable(GL_DEPTH_TEST);\n\n // set transformation matrices\t\t\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 1000.0f);\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", camera.GetViewMatrix());\n shader.setMat4(\"model\", glm::mat4(1.0f));\n\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n // 2. now blit multisampled buffer(s) to normal colorbuffer of intermediate FBO. Image is stored in screenTexture\n glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);\n glBindFramebuffer(GL_DRAW_FRAMEBUFFER, intermediateFBO);\n glBlitFramebuffer(0, 0, SCR_WIDTH, SCR_HEIGHT, 0, 0, SCR_WIDTH, SCR_HEIGHT, GL_COLOR_BUFFER_BIT, GL_NEAREST);\n\n // 3. now render quad with scene's visuals as its texture image\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n glClearColor(1.0f, 1.0f, 1.0f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT);\n glDisable(GL_DEPTH_TEST);\n\n // draw Screen quad\n screenShader.use();\n glBindVertexArray(quadVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, screenTexture); // use the now resolved color attachment as the quad's texture\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.041, "dedup_hash": "c9712427cb7440e6", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_2_stencil_testing", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "2.Stencil Testing", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/2.stencil_testing/2.stencil_single_color.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.04, 0.28, 0.26, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/2.stencil_testing/2.stencil_testing.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/2.stencil_testing/2.stencil_testing.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0f);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp", "language": "code", "loc": 322, "comment_density": 0.189, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glDepthFunc(GL_LESS);\n glEnable(GL_STENCIL_TEST);\n glStencilFunc(GL_NOTEQUAL, 1, 0xFF);\n glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"2.stencil_testing.vs\", \"2.stencil_testing.fs\");\n Shader shaderSingleColor(\"2.stencil_testing.vs\", \"2.stencil_single_color.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords (note we set these higher than 1 (together with GL_REPEAT as texture wrapping mode). this will cause the floor texture to repeat)\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // don't forget to clear the stencil buffer!\n\n // set uniforms\n shaderSingleColor.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shaderSingleColor.setMat4(\"view\", view);\n shaderSingleColor.setMat4(\"projection\", projection);\n\n shader.use();\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n\n // draw floor as normal, but don't write the floor to the stencil buffer, we only care about the containers. We set its mask to 0x00 to not write to the stencil buffer.\n glStencilMask(0x00);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // 1st. render pass, draw objects as normal, writing to the stencil buffer\n // --------------------------------------------------------------------\n glStencilFunc(GL_ALWAYS, 1, 0xFF);\n glStencilMask(0xFF);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n // 2nd. render pass: now draw slightly scaled versions of the objects, this time disabling stencil writing.\n // Because the stencil buffer is now filled with several 1s. The parts of the buffer that are 1 are not drawn, thus only drawing \n // the objects' size differences, making it look like borders.\n // -----------------------------------------------------------------------------------------------------------------------------\n glStencilFunc(GL_NOTEQUAL, 1, 0xFF);\n glStencilMask(0x00);\n glDisable(GL_DEPTH_TEST);\n shaderSingleColor.use();\n float scale = 1.1f;\n // cubes\n glBindVertexArray(cubeVAO);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n model = glm::scale(model, glm::vec3(scale, scale, scale));\n shaderSingleColor.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n model = glm::scale(model, glm::vec3(scale, scale, scale));\n shaderSingleColor.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n glStencilMask(0xFF);\n glStencilFunc(GL_ALWAYS, 0, 0xFF);\n glEnable(GL_DEPTH_TEST);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 3, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.047, "dedup_hash": "0d0f06eda545ae4f", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_3_1_blending_discard", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "3.1.Blending Discard", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/3.1.blending_discard/3.1.blending.fs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n vec4 texColor = texture(texture1, TexCoords);\n if(texColor.a < 0.1)\n discard;\n FragColor = texColor;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/3.1.blending_discard/3.1.blending.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/3.1.blending_discard/blending_discard.cpp", "language": "code", "loc": 322, "comment_density": 0.18, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.1.blending.vs\", \"3.1.blending.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords \n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n float transparentVertices[] = {\n // positions // texture Coords (swapped y coordinates because texture is flipped upside down)\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,\n 0.0f, -0.5f, 0.0f, 0.0f, 1.0f,\n 1.0f, -0.5f, 0.0f, 1.0f, 1.0f,\n\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,\n 1.0f, -0.5f, 0.0f, 1.0f, 1.0f,\n 1.0f, 0.5f, 0.0f, 1.0f, 0.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // transparent VAO\n unsigned int transparentVAO, transparentVBO;\n glGenVertexArrays(1, &transparentVAO);\n glGenBuffers(1, &transparentVBO);\n glBindVertexArray(transparentVAO);\n glBindBuffer(GL_ARRAY_BUFFER, transparentVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(transparentVertices), transparentVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n unsigned int transparentTexture = loadTexture(FileSystem::getPath(\"resources/textures/grass.png\").c_str());\n\n // transparent vegetation locations\n // --------------------------------\n vector vegetation \n {\n glm::vec3(-1.5f, 0.0f, -0.48f),\n glm::vec3( 1.5f, 0.0f, 0.51f),\n glm::vec3( 0.0f, 0.0f, 0.7f),\n glm::vec3(-0.3f, 0.0f, -2.3f),\n glm::vec3 (0.5f, 0.0f, -0.6f)\n };\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw objects\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // vegetation\n glBindVertexArray(transparentVAO);\n glBindTexture(GL_TEXTURE_2D, transparentTexture);\n for (unsigned int i = 0; i < vegetation.size(); i++)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, vegetation[i]);\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n }\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.06, "dedup_hash": "fd2126e341bf9bda", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_3_2_blending_sort", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "3.2.Blending Sort", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/3.2.blending_sort/3.2.blending.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/3.2.blending_sort/3.2.blending.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/3.2.blending_sort/blending_sorted.cpp", "language": "code", "loc": 332, "comment_density": 0.181, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.2.blending.vs\", \"3.2.blending.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords \n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n float transparentVertices[] = {\n // positions // texture Coords (swapped y coordinates because texture is flipped upside down)\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,\n 0.0f, -0.5f, 0.0f, 0.0f, 1.0f,\n 1.0f, -0.5f, 0.0f, 1.0f, 1.0f,\n\n 0.0f, 0.5f, 0.0f, 0.0f, 0.0f,\n 1.0f, -0.5f, 0.0f, 1.0f, 1.0f,\n 1.0f, 0.5f, 0.0f, 1.0f, 0.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // transparent VAO\n unsigned int transparentVAO, transparentVBO;\n glGenVertexArrays(1, &transparentVAO);\n glGenBuffers(1, &transparentVBO);\n glBindVertexArray(transparentVAO);\n glBindBuffer(GL_ARRAY_BUFFER, transparentVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(transparentVertices), transparentVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n unsigned int transparentTexture = loadTexture(FileSystem::getPath(\"resources/textures/window.png\").c_str());\n\n // transparent window locations\n // --------------------------------\n vector windows\n {\n glm::vec3(-1.5f, 0.0f, -0.48f),\n glm::vec3( 1.5f, 0.0f, 0.51f),\n glm::vec3( 0.0f, 0.0f, 0.7f),\n glm::vec3(-0.3f, 0.0f, -2.3f),\n glm::vec3( 0.5f, 0.0f, -0.6f)\n };\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // sort the transparent windows before rendering\n // ---------------------------------------------\n std::map sorted;\n for (unsigned int i = 0; i < windows.size(); i++)\n {\n float distance = glm::length(camera.Position - windows[i]);\n sorted[distance] = windows[i];\n }\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw objects\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // windows (from furthest to nearest)\n glBindVertexArray(transparentVAO);\n glBindTexture(GL_TEXTURE_2D, transparentTexture);\n for (std::map::reverse_iterator it = sorted.rbegin(); it != sorted.rend(); ++it)\n {\n model = glm::mat4(1.0f);\n model = glm::translate(model, it->second);\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n }\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.06, "dedup_hash": "ae086ca7dd94e3e3", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_4_face_culling_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "4.Face Culling Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "basics", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/4.face_culling_exercise1/face_culling_exercise1.cpp", "language": "code", "loc": 48, "comment_density": 0.958, "code": "float vertices[] = {\n // back face\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, // bottom-left\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, // bottom-right \n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right \n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, // bottom-left \n // front face\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, // top-right\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-right \n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, // top-right\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, // top-left \n // left face\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-right\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-left\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-left \n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-left\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-right\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-right\n // right face\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-left\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right \n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-right \n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // bottom-right\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-left\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // top-left\n // bottom face \n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // top-right\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-left\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f, // top-left \n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // bottom-left\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, // top-right\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, // bottom-right\n // top face\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, // top-left\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, // top-right\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // bottom-right \n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, // bottom-right\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, // bottom-left \n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f // top-left \n};\n\n/* Also make sure to add a call to OpenGL to specify that triangles defined by a clockwise ordering \n are now 'front-facing' triangles so the cube is rendered as normal:\n glFrontFace(GL_CW);\n*/"}], "validation": {"glslang_valid": 0, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.958, "dedup_hash": "e159f0583133b4b3", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_5_1_framebuffers", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:13+00:00", "source_type": "repo", "title": "5.1.Framebuffers", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/5.1.framebuffers/5.1.framebuffers.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.1.framebuffers/5.1.framebuffers.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.1.framebuffers/5.1.framebuffers_screen.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D screenTexture;\n\nvoid main()\n{\n vec3 col = texture(screenTexture, TexCoords).rgb;\n FragColor = vec4(col, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.1.framebuffers/5.1.framebuffers_screen.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); \n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.1.framebuffers/framebuffers.cpp", "language": "code", "loc": 345, "comment_density": 0.206, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"5.1.framebuffers.vs\", \"5.1.framebuffers.fs\");\n Shader screenShader(\"5.1.framebuffers_screen.vs\", \"5.1.framebuffers_screen.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords \n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n float quadVertices[] = { // vertex attributes for a quad that fills the entire screen in Normalized Device Coordinates.\n // positions // texCoords\n -1.0f, 1.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n\n -1.0f, 1.0f, 0.0f, 1.0f,\n 1.0f, -1.0f, 1.0f, 0.0f,\n 1.0f, 1.0f, 1.0f, 1.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // screen quad VAO\n unsigned int quadVAO, quadVBO;\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/container.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n screenShader.use();\n screenShader.setInt(\"screenTexture\", 0);\n\n // framebuffer configuration\n // -------------------------\n unsigned int framebuffer;\n glGenFramebuffers(1, &framebuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n // create a color attachment texture\n unsigned int textureColorbuffer;\n glGenTextures(1, &textureColorbuffer);\n glBindTexture(GL_TEXTURE_2D, textureColorbuffer);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureColorbuffer, 0);\n // create a renderbuffer object for depth and stencil attachment (we won't be sampling these)\n unsigned int rbo;\n glGenRenderbuffers(1, &rbo);\n glBindRenderbuffer(GL_RENDERBUFFER, rbo);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, SCR_WIDTH, SCR_HEIGHT); // use a single renderbuffer object for both a depth AND stencil buffer.\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); // now actually attach it\n // now that we actually created the framebuffer and added all attachments we want to check if it is actually complete now\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n cout << \"ERROR::FRAMEBUFFER:: Framebuffer is not complete!\" << endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // draw as wireframe\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n\n // render\n // ------\n // bind to framebuffer and draw scene as we normally would to color texture \n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n glEnable(GL_DEPTH_TEST); // enable depth testing (is disabled for rendering screen-space quad)\n\n // make sure we clear the framebuffer's content\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // now bind back to default framebuffer and draw a quad plane with the attached framebuffer color texture\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n glDisable(GL_DEPTH_TEST); // disable depth test so screen-space quad isn't discarded due to depth test.\n // clear all relevant buffers\n glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // set clear color to white (not really necessary actually, since we won't be able to see behind the quad anyways)\n glClear(GL_COLOR_BUFFER_BIT);\n\n screenShader.use();\n glBindVertexArray(quadVAO);\n glBindTexture(GL_TEXTURE_2D, textureColorbuffer);\t// use the color attachment texture as the texture of the quad plane\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteVertexArrays(1, &quadVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n glDeleteBuffers(1, &quadVBO);\n glDeleteRenderbuffers(1, &rbo);\n glDeleteFramebuffers(1, &framebuffer);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.041, "dedup_hash": "65746d2e5892d71d", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_5_2_framebuffers_exercise1", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:14+00:00", "source_type": "repo", "title": "5.2.Framebuffers Exercise1", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/5.2.framebuffers.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/5.2.framebuffers.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/5.2.framebuffers_screen.fs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D screenTexture;\n\nvoid main()\n{\n vec3 col = texture(screenTexture, TexCoords).rgb;\n FragColor = vec4(col, 1.0);\n} ", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/5.2.framebuffers_screen.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); \n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp", "language": "code", "loc": 373, "comment_density": 0.212, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"5.2.framebuffers.vs\", \"5.2.framebuffers.fs\");\n Shader screenShader(\"5.2.framebuffers_screen.vs\", \"5.2.framebuffers_screen.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float planeVertices[] = {\n // positions // texture Coords \n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\n };\n float quadVertices[] = { // vertex attributes for a quad that fills the entire screen in Normalized Device Coordinates. NOTE that this plane is now much smaller and at the top of the screen\n // positions // texCoords\n -0.3f, 1.0f, 0.0f, 1.0f,\n -0.3f, 0.7f, 0.0f, 0.0f,\n 0.3f, 0.7f, 1.0f, 0.0f,\n\n -0.3f, 1.0f, 0.0f, 1.0f,\n 0.3f, 0.7f, 1.0f, 0.0f,\n 0.3f, 1.0f, 1.0f, 1.0f\n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // screen quad VAO\n unsigned int quadVAO, quadVBO;\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/container.jpg\").c_str());\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n screenShader.use();\n screenShader.setInt(\"screenTexture\", 0);\n\n // framebuffer configuration\n // -------------------------\n unsigned int framebuffer;\n glGenFramebuffers(1, &framebuffer);\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n // create a color attachment texture\n unsigned int textureColorbuffer;\n glGenTextures(1, &textureColorbuffer);\n glBindTexture(GL_TEXTURE_2D, textureColorbuffer);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureColorbuffer, 0);\n // create a renderbuffer object for depth and stencil attachment (we won't be sampling these)\n unsigned int rbo;\n glGenRenderbuffers(1, &rbo);\n glBindRenderbuffer(GL_RENDERBUFFER, rbo);\n glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, SCR_WIDTH, SCR_HEIGHT); // use a single renderbuffer object for both a depth AND stencil buffer.\n glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo); // now actually attach it\n // now that we actually created the framebuffer and added all attachments we want to check if it is actually complete now\n if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)\n cout << \"ERROR::FRAMEBUFFER:: Framebuffer is not complete!\" << endl;\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // draw as wireframe\n //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n\n // first render pass: mirror texture.\n // bind to framebuffer and draw to color texture as we normally \n // would, but with the view camera reversed.\n // bind to framebuffer and draw scene as we normally would to color texture \n // ------------------------------------------------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);\n glEnable(GL_DEPTH_TEST); // enable depth testing (is disabled for rendering screen-space quad)\n\n // make sure we clear the framebuffer's content\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n camera.Yaw += 180.0f; // rotate the camera's yaw 180 degrees around\n camera.ProcessMouseMovement(0, 0, false); // call this to make sure it updates its camera vectors, note that we disable pitch constrains for this specific case (otherwise we can't reverse camera's pitch values)\n glm::mat4 view = camera.GetViewMatrix();\n camera.Yaw -= 180.0f; // reset it back to its original orientation\n camera.ProcessMouseMovement(0, 0, true); \n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // second render pass: draw as normal\n // ----------------------------------\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n model = glm::mat4(1.0f);\n view = camera.GetViewMatrix();\n shader.setMat4(\"view\", view);\n\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n shader.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n shader.setMat4(\"model\", glm::mat4(1.0f));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n\n // now draw the mirror quad with screen texture\n // --------------------------------------------\n glDisable(GL_DEPTH_TEST); // disable depth test so screen-space quad isn't discarded due to depth test.\n\n screenShader.use();\n glBindVertexArray(quadVAO);\n glBindTexture(GL_TEXTURE_2D, textureColorbuffer);\t// use the color attachment texture as the texture of the quad plane\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteVertexArrays(1, &quadVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &planeVBO);\n glDeleteBuffers(1, &quadVBO);\n glDeleteRenderbuffers(1, &rbo);\n glDeleteFramebuffers(1, &framebuffer);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.042, "dedup_hash": "27361a61d79a2abd", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_6_1_cubemaps_skybox", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:14+00:00", "source_type": "repo", "title": "6.1.Cubemaps Skybox", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/6.1.cubemaps.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture1;\n\nvoid main()\n{ \n FragColor = texture(texture1, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/6.1.cubemaps.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n TexCoords = aTexCoords; \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/6.1.skybox.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 TexCoords;\n\nuniform samplerCube skybox;\n\nvoid main()\n{ \n FragColor = texture(skybox, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/6.1.skybox.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout vec3 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n TexCoords = aPos;\n vec4 pos = projection * view * vec4(aPos, 1.0);\n gl_Position = pos.xyww;\n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.1.cubemaps_skybox/cubemaps_skybox.cpp", "language": "code", "loc": 360, "comment_density": 0.181, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nunsigned int loadCubemap(vector faces);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"6.1.cubemaps.vs\", \"6.1.cubemaps.fs\");\n Shader skyboxShader(\"6.1.skybox.vs\", \"6.1.skybox.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n float skyboxVertices[] = {\n // positions \n -1.0f, 1.0f, -1.0f,\n -1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n\n -1.0f, -1.0f, 1.0f,\n -1.0f, -1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, 1.0f,\n -1.0f, -1.0f, 1.0f,\n\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n\n -1.0f, -1.0f, 1.0f,\n -1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 1.0f,\n -1.0f, -1.0f, 1.0f,\n\n -1.0f, 1.0f, -1.0f,\n 1.0f, 1.0f, -1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, -1.0f,\n\n -1.0f, -1.0f, -1.0f,\n -1.0f, -1.0f, 1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n -1.0f, -1.0f, 1.0f,\n 1.0f, -1.0f, 1.0f\n };\n\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n // skybox VAO\n unsigned int skyboxVAO, skyboxVBO;\n glGenVertexArrays(1, &skyboxVAO);\n glGenBuffers(1, &skyboxVBO);\n glBindVertexArray(skyboxVAO);\n glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n\n // load textures\n // -------------\n unsigned int cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/container.jpg\").c_str());\n\n vector faces\n {\n FileSystem::getPath(\"resources/textures/skybox/right.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/left.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/top.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/bottom.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/front.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/back.jpg\")\n };\n unsigned int cubemapTexture = loadCubemap(faces);\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n skyboxShader.use();\n skyboxShader.setInt(\"skybox\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw scene as normal\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"model\", model);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, cubeTexture);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n\n // draw skybox as last\n glDepthFunc(GL_LEQUAL); // change depth function so depth test passes when values are equal to depth buffer's content\n skyboxShader.use();\n view = glm::mat4(glm::mat3(camera.GetViewMatrix())); // remove translation from the view matrix\n skyboxShader.setMat4(\"view\", view);\n skyboxShader.setMat4(\"projection\", projection);\n // skybox cube\n glBindVertexArray(skyboxVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n glDepthFunc(GL_LESS); // set depth function back to default\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &skyboxVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &skyboxVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n\n// loads a cubemap texture from 6 individual texture faces\n// order:\n// +X (right)\n// -X (left)\n// +Y (top)\n// -Y (bottom)\n// +Z (front) \n// -Z (back)\n// -------------------------------------------------------\nunsigned int loadCubemap(vector faces)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);\n\n int width, height, nrChannels;\n for (unsigned int i = 0; i < faces.size(); i++)\n {\n unsigned char *data = stbi_load(faces[i].c_str(), &width, &height, &nrChannels, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Cubemap texture failed to load at path: \" << faces[i] << std::endl;\n stbi_image_free(data);\n }\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.036, "dedup_hash": "8d04c782bc3f1696", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_6_2_cubemaps_environment_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:14+00:00", "source_type": "repo", "title": "6.2.Cubemaps Environment Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/6.2.cubemaps.fs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 Normal;\nin vec3 Position;\n\nuniform vec3 cameraPos;\nuniform samplerCube skybox;\n\nvoid main()\n{ \n vec3 I = normalize(Position - cameraPos);\n vec3 R = reflect(I, normalize(Normal));\n FragColor = vec4(texture(skybox, R).rgb, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/6.2.cubemaps.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout vec3 Normal;\nout vec3 Position;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n Normal = mat3(transpose(inverse(model))) * aNormal;\n Position = vec3(model * vec4(aPos, 1.0));\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/6.2.skybox.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 TexCoords;\n\nuniform samplerCube skybox;\n\nvoid main()\n{ \n FragColor = texture(skybox, TexCoords);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/6.2.skybox.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nout vec3 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n TexCoords = aPos;\n vec4 pos = projection * view * vec4(aPos, 1.0);\n gl_Position = pos.xyww;\n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/6.2.cubemaps_environment_mapping/cubemaps_environment_mapping.cpp", "language": "code", "loc": 360, "comment_density": 0.181, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nunsigned int loadCubemap(vector faces);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"6.2.cubemaps.vs\", \"6.2.cubemaps.fs\");\n Shader skyboxShader(\"6.2.skybox.vs\", \"6.2.skybox.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions // normals\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f\n };\n float skyboxVertices[] = {\n // positions \n -1.0f, 1.0f, -1.0f,\n -1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n\n -1.0f, -1.0f, 1.0f,\n -1.0f, -1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, -1.0f,\n -1.0f, 1.0f, 1.0f,\n -1.0f, -1.0f, 1.0f,\n\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n\n -1.0f, -1.0f, 1.0f,\n -1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 1.0f,\n -1.0f, -1.0f, 1.0f,\n\n -1.0f, 1.0f, -1.0f,\n 1.0f, 1.0f, -1.0f,\n 1.0f, 1.0f, 1.0f,\n 1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, 1.0f,\n -1.0f, 1.0f, -1.0f,\n\n -1.0f, -1.0f, -1.0f,\n -1.0f, -1.0f, 1.0f,\n 1.0f, -1.0f, -1.0f,\n 1.0f, -1.0f, -1.0f,\n -1.0f, -1.0f, 1.0f,\n 1.0f, -1.0f, 1.0f\n };\n\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));\n // skybox VAO\n unsigned int skyboxVAO, skyboxVBO;\n glGenVertexArrays(1, &skyboxVAO);\n glGenBuffers(1, &skyboxVBO);\n glBindVertexArray(skyboxVAO);\n glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n\n // load textures\n // -------------\n vector faces\n {\n FileSystem::getPath(\"resources/textures/skybox/right.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/left.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/top.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/bottom.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/front.jpg\"),\n FileSystem::getPath(\"resources/textures/skybox/back.jpg\"),\n };\n unsigned int cubemapTexture = loadCubemap(faces);\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"skybox\", 0);\n\n skyboxShader.use();\n skyboxShader.setInt(\"skybox\", 0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw scene as normal\n shader.use();\n glm::mat4 model = glm::mat4(1.0f);\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n shader.setMat4(\"model\", model);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"projection\", projection);\n shader.setVec3(\"cameraPos\", camera.Position);\n // cubes\n glBindVertexArray(cubeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n\n // draw skybox as last\n glDepthFunc(GL_LEQUAL); // change depth function so depth test passes when values are equal to depth buffer's content\n skyboxShader.use();\n view = glm::mat4(glm::mat3(camera.GetViewMatrix())); // remove translation from the view matrix\n skyboxShader.setMat4(\"view\", view);\n skyboxShader.setMat4(\"projection\", projection);\n // skybox cube\n glBindVertexArray(skyboxVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTexture);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n glDepthFunc(GL_LESS); // set depth function back to default\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteVertexArrays(1, &skyboxVAO);\n glDeleteBuffers(1, &cubeVBO);\n glDeleteBuffers(1, &skyboxVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n\n// loads a cubemap texture from 6 individual texture faces\n// order:\n// +X (right)\n// -X (left)\n// +Y (top)\n// -Y (bottom)\n// +Z (front) \n// -Z (back)\n// -------------------------------------------------------\nunsigned int loadCubemap(vector faces)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);\n\n int width, height, nrComponents;\n for (unsigned int i = 0; i < faces.size(); i++)\n {\n unsigned char *data = stbi_load(faces[i].c_str(), &width, &height, &nrComponents, 0);\n if (data)\n {\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Cubemap texture failed to load at path: \" << faces[i] << std::endl;\n stbi_image_free(data);\n }\n }\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.036, "dedup_hash": "27a9ec9ed5787c05", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_8_advanced_glsl_ubo", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "8.Advanced Glsl Ubo", "api": "OpenGL Core", "glsl_version": null, "topic": "framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.advanced_glsl.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nlayout (std140) uniform Matrices\n{\n mat4 projection;\n mat4 view;\n};\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n} ", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.blue.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.0, 0.0, 1.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.green.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.red.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/8.yellow.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/8.advanced_glsl_ubo/advanced_glsl_ubo.cpp", "language": "code", "loc": 241, "comment_density": 0.232, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shaderRed(\"8.advanced_glsl.vs\", \"8.red.fs\");\n Shader shaderGreen(\"8.advanced_glsl.vs\", \"8.green.fs\");\n Shader shaderBlue(\"8.advanced_glsl.vs\", \"8.blue.fs\");\n Shader shaderYellow(\"8.advanced_glsl.vs\", \"8.yellow.fs\");\n \n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float cubeVertices[] = {\n // positions \n -0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n -0.5f, 0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n\n -0.5f, -0.5f, 0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n -0.5f, -0.5f, 0.5f, \n\n -0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n -0.5f, -0.5f, -0.5f, \n -0.5f, -0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n\n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n\n -0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, -0.5f, \n 0.5f, -0.5f, 0.5f, \n 0.5f, -0.5f, 0.5f, \n -0.5f, -0.5f, 0.5f, \n -0.5f, -0.5f, -0.5f, \n\n -0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, -0.5f, \n 0.5f, 0.5f, 0.5f, \n 0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, 0.5f, \n -0.5f, 0.5f, -0.5f, \n };\n // cube VAO\n unsigned int cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);\n\n // configure a uniform buffer object\n // ---------------------------------\n // first. We get the relevant block indices\n unsigned int uniformBlockIndexRed = glGetUniformBlockIndex(shaderRed.ID, \"Matrices\");\n unsigned int uniformBlockIndexGreen = glGetUniformBlockIndex(shaderGreen.ID, \"Matrices\");\n unsigned int uniformBlockIndexBlue = glGetUniformBlockIndex(shaderBlue.ID, \"Matrices\");\n unsigned int uniformBlockIndexYellow = glGetUniformBlockIndex(shaderYellow.ID, \"Matrices\");\n // then we link each shader's uniform block to this uniform binding point\n glUniformBlockBinding(shaderRed.ID, uniformBlockIndexRed, 0);\n glUniformBlockBinding(shaderGreen.ID, uniformBlockIndexGreen, 0);\n glUniformBlockBinding(shaderBlue.ID, uniformBlockIndexBlue, 0);\n glUniformBlockBinding(shaderYellow.ID, uniformBlockIndexYellow, 0);\n // Now actually create the buffer\n unsigned int uboMatrices;\n glGenBuffers(1, &uboMatrices);\n glBindBuffer(GL_UNIFORM_BUFFER, uboMatrices);\n glBufferData(GL_UNIFORM_BUFFER, 2 * sizeof(glm::mat4), NULL, GL_STATIC_DRAW);\n glBindBuffer(GL_UNIFORM_BUFFER, 0);\n // define the range of the buffer that links to a uniform binding point\n glBindBufferRange(GL_UNIFORM_BUFFER, 0, uboMatrices, 0, 2 * sizeof(glm::mat4));\n\n // store the projection matrix (we only do this once now) (note: we're not using zoom anymore by changing the FoV)\n glm::mat4 projection = glm::perspective(45.0f, (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glBindBuffer(GL_UNIFORM_BUFFER, uboMatrices);\n glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(glm::mat4), glm::value_ptr(projection));\n glBindBuffer(GL_UNIFORM_BUFFER, 0);\n \n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // set the view and projection matrix in the uniform block - we only have to do this once per loop iteration.\n glm::mat4 view = camera.GetViewMatrix();\n glBindBuffer(GL_UNIFORM_BUFFER, uboMatrices);\n glBufferSubData(GL_UNIFORM_BUFFER, sizeof(glm::mat4), sizeof(glm::mat4), glm::value_ptr(view));\n glBindBuffer(GL_UNIFORM_BUFFER, 0);\n\n // draw 4 cubes \n // RED\n glBindVertexArray(cubeVAO);\n shaderRed.use();\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-0.75f, 0.75f, 0.0f)); // move top-left\n shaderRed.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // GREEN\n shaderGreen.use();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.75f, 0.75f, 0.0f)); // move top-right\n shaderGreen.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // YELLOW\n shaderYellow.use();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-0.75f, -0.75f, 0.0f)); // move bottom-left\n shaderYellow.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // BLUE\n shaderBlue.use();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.75f, -0.75f, 0.0f)); // move bottom-right\n shaderBlue.setMat4(\"model\", model);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &cubeVAO);\n glDeleteBuffers(1, &cubeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n"}], "validation": {"glslang_valid": 5, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.039, "dedup_hash": "7d80b9d4bf85cf25", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_9_1_geometry_shader_houses", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "9.1.Geometry Shader Houses", "api": "OpenGL Core", "glsl_version": null, "topic": "geometry_shader/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/9.1.geometry_shader_houses/9.1.geometry_shader.fs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec3 fColor;\n\nvoid main()\n{\n FragColor = vec4(fColor, 1.0); \n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.1.geometry_shader_houses/9.1.geometry_shader.gs", "language": "glsl", "loc": 26, "comment_density": 0.231, "code": "#version 330 core\nlayout (points) in;\nlayout (triangle_strip, max_vertices = 5) out;\n\nin VS_OUT {\n vec3 color;\n} gs_in[];\n\nout vec3 fColor;\n\nvoid build_house(vec4 position)\n{ \n fColor = gs_in[0].color; // gs_in[0] since there's only one input vertex\n gl_Position = position + vec4(-0.2, -0.2, 0.0, 0.0); // 1:bottom-left \n EmitVertex(); \n gl_Position = position + vec4( 0.2, -0.2, 0.0, 0.0); // 2:bottom-right\n EmitVertex();\n gl_Position = position + vec4(-0.2, 0.2, 0.0, 0.0); // 3:top-left\n EmitVertex();\n gl_Position = position + vec4( 0.2, 0.2, 0.0, 0.0); // 4:top-right\n EmitVertex();\n gl_Position = position + vec4( 0.0, 0.4, 0.0, 0.0); // 5:top\n fColor = vec3(1.0, 1.0, 1.0);\n EmitVertex();\n EndPrimitive();\n}\n\nvoid main() { \n build_house(gl_in[0].gl_Position);\n}", "stage": "geometry", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.1.geometry_shader_houses/9.1.geometry_shader.vs", "language": "glsl", "loc": 11, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec2 aPos;\nlayout (location = 1) in vec3 aColor;\n\nout VS_OUT {\n vec3 color;\n} vs_out;\n\nvoid main()\n{\n vs_out.color = aColor;\n gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.1.geometry_shader_houses/geometry_shader_houses.cpp", "language": "code", "loc": 94, "comment_density": 0.319, "code": "#include \n#include \n\n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"9.1.geometry_shader.vs\", \"9.1.geometry_shader.fs\", \"9.1.geometry_shader.gs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float points[] = {\n -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, // top-left\n 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, // top-right\n 0.5f, -0.5f, 0.0f, 0.0f, 1.0f, // bottom-right\n -0.5f, -0.5f, 1.0f, 1.0f, 0.0f // bottom-left\n };\n unsigned int VBO, VAO;\n glGenBuffers(1, &VBO);\n glGenVertexArrays(1, &VAO);\n glBindVertexArray(VAO);\n glBindBuffer(GL_ARRAY_BUFFER, VBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(points), &points, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), 0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(2 * sizeof(float)));\n glBindVertexArray(0);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw points\n shader.use();\n glBindVertexArray(VAO);\n glDrawArrays(GL_POINTS, 0, 4);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &VAO);\n glDeleteBuffers(1, &VBO);\n\n glfwTerminate();\n return 0;\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n"}], "validation": {"glslang_valid": 3, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.138, "dedup_hash": "0013566fe1a83da8", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_9_2_geometry_shader_exploding", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "9.2.Geometry Shader Exploding", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/geometry_shader/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/9.2.geometry_shader_exploding/9.2.geometry_shader.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}\n\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.2.geometry_shader_exploding/9.2.geometry_shader.gs", "language": "glsl", "loc": 33, "comment_density": 0.0, "code": "#version 330 core\nlayout (triangles) in;\nlayout (triangle_strip, max_vertices = 3) out;\n\nin VS_OUT {\n vec2 texCoords;\n} gs_in[];\n\nout vec2 TexCoords; \n\nuniform float time;\n\nvec4 explode(vec4 position, vec3 normal)\n{\n float magnitude = 2.0;\n vec3 direction = normal * ((sin(time) + 1.0) / 2.0) * magnitude; \n return position + vec4(direction, 0.0);\n}\n\nvec3 GetNormal()\n{\n vec3 a = vec3(gl_in[0].gl_Position) - vec3(gl_in[1].gl_Position);\n vec3 b = vec3(gl_in[2].gl_Position) - vec3(gl_in[1].gl_Position);\n return normalize(cross(a, b));\n}\n\nvoid main() { \n vec3 normal = GetNormal();\n\n gl_Position = explode(gl_in[0].gl_Position, normal);\n TexCoords = gs_in[0].texCoords;\n EmitVertex();\n gl_Position = explode(gl_in[1].gl_Position, normal);\n TexCoords = gs_in[1].texCoords;\n EmitVertex();\n gl_Position = explode(gl_in[2].gl_Position, normal);\n TexCoords = gs_in[2].texCoords;\n EmitVertex();\n EndPrimitive();\n}", "stage": "geometry", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.2.geometry_shader_exploding/9.2.geometry_shader.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\n\nout VS_OUT {\n vec2 texCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n vs_out.texCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.2.geometry_shader_exploding/geometry_shader_exploding.cpp", "language": "code", "loc": 151, "comment_density": 0.265, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"9.2.geometry_shader.vs\", \"9.2.geometry_shader.fs\", \"9.2.geometry_shader.gs\");\n\n // load models\n // -----------\n Model nanosuit(FileSystem::getPath(\"resources/objects/nanosuit/nanosuit.obj\")); \n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure transformation matrices\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 1.0f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();;\n glm::mat4 model = glm::mat4(1.0f);\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"model\", model);\n\n // add time component to geometry shader in the form of a uniform\n shader.setFloat(\"time\", static_cast(glfwGetTime()));\n\n // draw model\n nanosuit.Draw(shader);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 3, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.066, "dedup_hash": "8056bca5065bc9e9", "has_readme": true} +{"id": "joeydevries_learnopengl_src_4_advanced_opengl_9_3_geometry_shader_normals", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "9.3.Geometry Shader Normals", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/geometry_shader/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.default.fs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D texture_diffuse1;\n\nvoid main()\n{\n FragColor = texture(texture_diffuse1, TexCoords);\n}\n\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.default.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.normal_visualization.fs", "language": "glsl", "loc": 6, "comment_density": 0.0, "code": "#version 330 core\nout vec4 FragColor;\n\nvoid main()\n{\n FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n}\n\n", "stage": "fragment", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.normal_visualization.gs", "language": "glsl", "loc": 22, "comment_density": 0.136, "code": "#version 330 core\nlayout (triangles) in;\nlayout (line_strip, max_vertices = 6) out;\n\nin VS_OUT {\n vec3 normal;\n} gs_in[];\n\nconst float MAGNITUDE = 0.2;\n\nuniform mat4 projection;\n\nvoid GenerateLine(int index)\n{\n gl_Position = projection * gl_in[index].gl_Position;\n EmitVertex();\n gl_Position = projection * (gl_in[index].gl_Position + vec4(gs_in[index].normal, 0.0) * MAGNITUDE);\n EmitVertex();\n EndPrimitive();\n}\n\nvoid main()\n{\n GenerateLine(0); // first vertex normal\n GenerateLine(1); // second vertex normal\n GenerateLine(2); // third vertex normal\n}", "stage": "geometry", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/9.3.normal_visualization.vs", "language": "glsl", "loc": 14, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\n\nout VS_OUT {\n vec3 normal;\n} vs_out;\n\nuniform mat4 view;\nuniform mat4 model;\n\nvoid main()\n{\n mat3 normalMatrix = mat3(transpose(inverse(view * model)));\n vs_out.normal = vec3(vec4(normalMatrix * aNormal, 0.0));\n gl_Position = view * model * vec4(aPos, 1.0); \n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/4.advanced_opengl/9.3.geometry_shader_normals/normal_visualization.cpp", "language": "code", "loc": 157, "comment_density": 0.255, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"9.3.default.vs\", \"9.3.default.fs\");\n Shader normalShader(\"9.3.normal_visualization.vs\", \"9.3.normal_visualization.fs\", \"9.3.normal_visualization.gs\");\n\n // load models\n // -----------\n stbi_set_flip_vertically_on_load(true);\n Model backpack(FileSystem::getPath(\"resources/objects/backpack/backpack.obj\"));\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure transformation matrices\n glm::mat4 projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 1.0f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();;\n glm::mat4 model = glm::mat4(1.0f);\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n shader.setMat4(\"model\", model);\n\n // draw model as usual\n backpack.Draw(shader);\n\n // then draw model with normal visualizing geometry shader\n normalShader.use();\n normalShader.setMat4(\"projection\", projection);\n normalShader.setMat4(\"view\", view);\n normalShader.setMat4(\"model\", model);\n\n backpack.Draw(normalShader);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n"}], "validation": {"glslang_valid": 5, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.065, "dedup_hash": "02bfee350ad6a2bb", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_1_advanced_lighting", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "1.Advanced Lighting", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/1.advanced_lighting/1.advanced_lighting.fs", "language": "glsl", "loc": 38, "comment_density": 0.105, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D floorTexture;\nuniform vec3 lightPos;\nuniform vec3 viewPos;\nuniform bool blinn;\n\nvoid main()\n{ \n vec3 color = texture(floorTexture, fs_in.TexCoords).rgb;\n // ambient\n vec3 ambient = 0.05 * color;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n vec3 normal = normalize(fs_in.Normal);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * color;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n if(blinn)\n {\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);\n }\n else\n {\n vec3 reflectDir = reflect(-lightDir, normal);\n spec = pow(max(dot(viewDir, reflectDir), 0.0), 8.0);\n }\n vec3 specular = vec3(0.3) * spec; // assuming bright white light color\n FragColor = vec4(ambient + diffuse + specular, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/1.advanced_lighting/1.advanced_lighting.vs", "language": "glsl", "loc": 19, "comment_density": 0.053, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\n// declare an interface block; see 'Advanced GLSL' for what these are.\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n vs_out.FragPos = aPos;\n vs_out.Normal = aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/1.advanced_lighting/advanced_lighting.cpp", "language": "code", "loc": 238, "comment_density": 0.223, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool blinn = false;\nbool blinnKeyPressed = false;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"1.advanced_lighting.vs\", \"1.advanced_lighting.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f,\n -10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f,\n\n 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f,\n -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f,\n 10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 10.0f\n };\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n \n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"texture1\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.0f, 0.0f, 0.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw objects\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setInt(\"blinn\", blinn);\n // floor\n glBindVertexArray(planeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n std::cout << (blinn ? \"Blinn-Phong\" : \"Phong\") << std::endl;\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_B) == GLFW_PRESS && !blinnKeyPressed) \n {\n blinn = !blinn;\n blinnKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_B) == GLFW_RELEASE) \n {\n blinnKeyPressed = false;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.127, "dedup_hash": "d38c3523fc41cdb3", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_2_gamma_correction", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:15+00:00", "source_type": "repo", "title": "2.Gamma Correction", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/framebuffer/basics/camera", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/2.gamma_correction/2.gamma_correction.fs", "language": "glsl", "loc": 44, "comment_density": 0.068, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D floorTexture;\n\nuniform vec3 lightPositions[4];\nuniform vec3 lightColors[4];\nuniform vec3 viewPos;\nuniform bool gamma;\n\nvec3 BlinnPhong(vec3 normal, vec3 fragPos, vec3 lightPos, vec3 lightColor)\n{\n // diffuse\n vec3 lightDir = normalize(lightPos - fragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // simple attenuation\n float max_distance = 1.5;\n float distance = length(lightPos - fragPos);\n float attenuation = 1.0 / (gamma ? distance * distance : distance);\n \n diffuse *= attenuation;\n specular *= attenuation;\n \n return diffuse + specular;\n}\n\nvoid main()\n{ \n vec3 color = texture(floorTexture, fs_in.TexCoords).rgb;\n vec3 lighting = vec3(0.0);\n for(int i = 0; i < 4; ++i)\n lighting += BlinnPhong(normalize(fs_in.Normal), fs_in.FragPos, lightPositions[i], lightColors[i]);\n color *= lighting;\n if(gamma)\n color = pow(color, vec3(1.0/2.2));\n FragColor = vec4(color, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/2.gamma_correction/2.gamma_correction.vs", "language": "glsl", "loc": 18, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvoid main()\n{\n vs_out.FragPos = aPos;\n vs_out.Normal = aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/2.gamma_correction/gamma_correction.cpp", "language": "code", "loc": 260, "comment_density": 0.2, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path, bool gammaCorrection);\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool gammaEnabled = false;\nbool gammaKeyPressed = false;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_BLEND);\n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"2.gamma_correction.vs\", \"2.gamma_correction.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f,\n -10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f,\n\n 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f,\n -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f,\n 10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 10.0f\n };\n // plane VAO\n unsigned int planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str(), false);\n unsigned int floorTextureGammaCorrected = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str(), true);\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"floorTexture\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPositions[] = {\n glm::vec3(-3.0f, 0.0f, 0.0f),\n glm::vec3(-1.0f, 0.0f, 0.0f),\n glm::vec3 (1.0f, 0.0f, 0.0f),\n glm::vec3 (3.0f, 0.0f, 0.0f)\n };\n glm::vec3 lightColors[] = {\n glm::vec3(0.25),\n glm::vec3(0.50),\n glm::vec3(0.75),\n glm::vec3(1.00)\n };\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // draw objects\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n glUniform3fv(glGetUniformLocation(shader.ID, \"lightPositions\"), 4, &lightPositions[0][0]);\n glUniform3fv(glGetUniformLocation(shader.ID, \"lightColors\"), 4, &lightColors[0][0]);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setInt(\"gamma\", gammaEnabled);\n // floor\n glBindVertexArray(planeVAO);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, gammaEnabled ? floorTextureGammaCorrected : floorTexture);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n\n std::cout << (gammaEnabled ? \"Gamma enabled\" : \"Gamma disabled\") << std::endl;\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !gammaKeyPressed)\n {\n gammaEnabled = !gammaEnabled;\n gammaKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)\n {\n gammaKeyPressed = false;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path, bool gammaCorrection)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum internalFormat;\n GLenum dataFormat;\n if (nrComponents == 1)\n {\n internalFormat = dataFormat = GL_RED;\n }\n else if (nrComponents == 3)\n {\n internalFormat = gammaCorrection ? GL_SRGB : GL_RGB;\n dataFormat = GL_RGB;\n }\n else if (nrComponents == 4)\n {\n internalFormat = gammaCorrection ? GL_SRGB_ALPHA : GL_RGBA;\n dataFormat = GL_RGBA;\n }\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, dataFormat, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.089, "dedup_hash": "03692b7620da2b45", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_1_1_shadow_mapping_depth", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:16+00:00", "source_type": "repo", "title": "3.1.1.Shadow Mapping Depth", "api": "OpenGL Core", "glsl_version": null, "topic": "texturing/framebuffer/basics/camera", "difficulty": "beginner", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/3.1.1.debug_quad.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/3.1.1.debug_quad_depth.fs", "language": "glsl", "loc": 18, "comment_density": 0.222, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D depthMap;\nuniform float near_plane;\nuniform float far_plane;\n\n// required when using a perspective projection matrix\nfloat LinearizeDepth(float depth)\n{\n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));\t\n}\n\nvoid main()\n{ \n float depthValue = texture(depthMap, TexCoords).r;\n // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective\n FragColor = vec4(vec3(depthValue), 1.0); // orthographic\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/3.1.1.shadow_mapping_depth.fs", "language": "glsl", "loc": 5, "comment_density": 0.2, "code": "#version 330 core\n\nvoid main()\n{ \n // gl_FragDepth = gl_FragCoord.z;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/3.1.1.shadow_mapping_depth.vs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 lightSpaceMatrix;\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = lightSpaceMatrix * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.1.shadow_mapping_depth/shadow_mapping_depth.cpp", "language": "code", "loc": 395, "comment_density": 0.296, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// meshes\nunsigned int planeVAO;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader simpleDepthShader(\"3.1.1.shadow_mapping_depth.vs\", \"3.1.1.shadow_mapping_depth.fs\");\n Shader debugDepthQuad(\"3.1.1.debug_quad.vs\", \"3.1.1.debug_quad_depth.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n 25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 25.0f\n };\n // plane VAO\n unsigned int planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth texture\n unsigned int depthMap;\n glGenTextures(1, &depthMap);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n debugDepthQuad.use();\n debugDepthQuad.setInt(\"depthMap\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(-2.0f, 4.0f, -1.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render depth of scene to texture (from light's perspective)\n // --------------------------------------------------------------\n glm::mat4 lightProjection, lightView;\n glm::mat4 lightSpaceMatrix;\n float near_plane = 1.0f, far_plane = 7.5f;\n lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);\n lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));\n lightSpaceMatrix = lightProjection * lightView;\n // render scene from light's point of view\n simpleDepthShader.use();\n simpleDepthShader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // reset viewport\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // render Depth map to quad for visual debugging\n // ---------------------------------------------\n debugDepthQuad.use();\n debugDepthQuad.setFloat(\"near_plane\", near_plane);\n debugDepthQuad.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // floor\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glBindVertexArray(planeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 1.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, 2.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.25));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 4, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.144, "dedup_hash": "302a9ab1f17beeb9", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_1_2_shadow_mapping_base", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:16+00:00", "source_type": "repo", "title": "3.1.2.Shadow Mapping Base", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/shadows/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.debug_quad.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.debug_quad_depth.fs", "language": "glsl", "loc": 18, "comment_density": 0.222, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D depthMap;\nuniform float near_plane;\nuniform float far_plane;\n\n// required when using a perspective projection matrix\nfloat LinearizeDepth(float depth)\n{\n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));\t\n}\n\nvoid main()\n{ \n float depthValue = texture(depthMap, TexCoords).r;\n // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective\n FragColor = vec4(vec3(depthValue), 1.0); // orthographic\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.shadow_mapping.fs", "language": "glsl", "loc": 49, "comment_density": 0.184, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n vec4 FragPosLightSpace;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform sampler2D shadowMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nfloat ShadowCalculation(vec4 fragPosLightSpace)\n{\n // perform perspective divide\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n // transform to [0,1] range\n projCoords = projCoords * 0.5 + 0.5;\n // get closest depth value from light's perspective (using [0,1] range fragPosLight as coords)\n float closestDepth = texture(shadowMap, projCoords.xy).r; \n // get depth of current fragment from light's perspective\n float currentDepth = projCoords.z;\n // check whether current frag pos is in shadow\n float shadow = currentDepth > closestDepth ? 1.0 : 0.0;\n\n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * lightColor;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = ShadowCalculation(fs_in.FragPosLightSpace); \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.shadow_mapping.vs", "language": "glsl", "loc": 23, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n vec4 FragPosLightSpace;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat4 lightSpaceMatrix;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n vs_out.FragPosLightSpace = lightSpaceMatrix * vec4(vs_out.FragPos, 1.0);\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.shadow_mapping_depth.fs", "language": "glsl", "loc": 5, "comment_density": 0.2, "code": "#version 330 core\n\nvoid main()\n{ \n // gl_FragDepth = gl_FragCoord.z;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/3.1.2.shadow_mapping_depth.vs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 lightSpaceMatrix;\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = lightSpaceMatrix * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.2.shadow_mapping_base/shadow_mapping_base.cpp", "language": "code", "loc": 415, "comment_density": 0.292, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// meshes\nunsigned int planeVAO;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.1.2.shadow_mapping.vs\", \"3.1.2.shadow_mapping.fs\");\n Shader simpleDepthShader(\"3.1.2.shadow_mapping_depth.vs\", \"3.1.2.shadow_mapping_depth.fs\");\n Shader debugDepthQuad(\"3.1.2.debug_quad.vs\", \"3.1.2.debug_quad_depth.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n 25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 25.0f\n };\n // plane VAO\n unsigned int planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth texture\n unsigned int depthMap;\n glGenTextures(1, &depthMap);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"shadowMap\", 1);\n debugDepthQuad.use();\n debugDepthQuad.setInt(\"depthMap\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(-2.0f, 4.0f, -1.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render depth of scene to texture (from light's perspective)\n // --------------------------------------------------------------\n glm::mat4 lightProjection, lightView;\n glm::mat4 lightSpaceMatrix;\n float near_plane = 1.0f, far_plane = 7.5f;\n lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);\n lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));\n lightSpaceMatrix = lightProjection * lightView;\n // render scene from light's point of view\n simpleDepthShader.use();\n simpleDepthShader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // reset viewport\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 2. render scene as normal using the generated depth/shadow map \n // --------------------------------------------------------------\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n renderScene(shader);\n\n // render Depth map to quad for visual debugging\n // ---------------------------------------------\n debugDepthQuad.use();\n debugDepthQuad.setFloat(\"near_plane\", near_plane);\n debugDepthQuad.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n //renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // floor\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glBindVertexArray(planeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 1.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, 2.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.25));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.128, "dedup_hash": "658856556258338a", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_1_3_shadow_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:17+00:00", "source_type": "repo", "title": "3.1.3.Shadow Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/shadows/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.debug_quad.vs", "language": "glsl", "loc": 9, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nvoid main()\n{\n TexCoords = aTexCoords;\n gl_Position = vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.debug_quad_depth.fs", "language": "glsl", "loc": 18, "comment_density": 0.222, "code": "#version 330 core\nout vec4 FragColor;\n\nin vec2 TexCoords;\n\nuniform sampler2D depthMap;\nuniform float near_plane;\nuniform float far_plane;\n\n// required when using a perspective projection matrix\nfloat LinearizeDepth(float depth)\n{\n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));\t\n}\n\nvoid main()\n{ \n float depthValue = texture(depthMap, TexCoords).r;\n // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective\n FragColor = vec4(vec3(depthValue), 1.0); // orthographic\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.shadow_mapping.fs", "language": "glsl", "loc": 68, "comment_density": 0.191, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n vec4 FragPosLightSpace;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform sampler2D shadowMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nfloat ShadowCalculation(vec4 fragPosLightSpace)\n{\n // perform perspective divide\n vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;\n // transform to [0,1] range\n projCoords = projCoords * 0.5 + 0.5;\n // get closest depth value from light's perspective (using [0,1] range fragPosLight as coords)\n float closestDepth = texture(shadowMap, projCoords.xy).r; \n // get depth of current fragment from light's perspective\n float currentDepth = projCoords.z;\n // calculate bias (based on depth map resolution and slope)\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float bias = max(0.05 * (1.0 - dot(normal, lightDir)), 0.005);\n // check whether current frag pos is in shadow\n // float shadow = currentDepth - bias > closestDepth ? 1.0 : 0.0;\n // PCF\n float shadow = 0.0;\n vec2 texelSize = 1.0 / textureSize(shadowMap, 0);\n for(int x = -1; x <= 1; ++x)\n {\n for(int y = -1; y <= 1; ++y)\n {\n float pcfDepth = texture(shadowMap, projCoords.xy + vec2(x, y) * texelSize).r; \n shadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0; \n } \n }\n shadow /= 9.0;\n \n // keep the shadow at 0.0 when outside the far_plane region of the light's frustum.\n if(projCoords.z > 1.0)\n shadow = 0.0;\n \n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * lightColor;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = ShadowCalculation(fs_in.FragPosLightSpace); \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.shadow_mapping.vs", "language": "glsl", "loc": 23, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n vec4 FragPosLightSpace;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\nuniform mat4 lightSpaceMatrix;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n vs_out.FragPosLightSpace = lightSpaceMatrix * vec4(vs_out.FragPos, 1.0);\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.shadow_mapping_depth.fs", "language": "glsl", "loc": 5, "comment_density": 0.2, "code": "#version 330 core\n\nvoid main()\n{ \n // gl_FragDepth = gl_FragCoord.z;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/3.1.3.shadow_mapping_depth.vs", "language": "glsl", "loc": 8, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 lightSpaceMatrix;\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = lightSpaceMatrix * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.1.3.shadow_mapping/shadow_mapping.cpp", "language": "code", "loc": 422, "comment_density": 0.299, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\n// meshes\nunsigned int planeVAO;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.1.3.shadow_mapping.vs\", \"3.1.3.shadow_mapping.fs\");\n Shader simpleDepthShader(\"3.1.3.shadow_mapping_depth.vs\", \"3.1.3.shadow_mapping_depth.fs\");\n Shader debugDepthQuad(\"3.1.3.debug_quad.vs\", \"3.1.3.debug_quad_depth.fs\");\n\n // set up vertex data (and buffer(s)) and configure vertex attributes\n // ------------------------------------------------------------------\n float planeVertices[] = {\n // positions // normals // texcoords\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n\n 25.0f, -0.5f, 25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 0.0f,\n -25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 0.0f, 25.0f,\n 25.0f, -0.5f, -25.0f, 0.0f, 1.0f, 0.0f, 25.0f, 25.0f\n };\n // plane VAO\n unsigned int planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindVertexArray(0);\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth texture\n unsigned int depthMap;\n glGenTextures(1, &depthMap);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);\n float borderColor[] = { 1.0, 1.0, 1.0, 1.0 };\n glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"shadowMap\", 1);\n debugDepthQuad.use();\n debugDepthQuad.setInt(\"depthMap\", 0);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(-2.0f, 4.0f, -1.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // change light position over time\n //lightPos.x = sin(glfwGetTime()) * 3.0f;\n //lightPos.z = cos(glfwGetTime()) * 2.0f;\n //lightPos.y = 5.0 + cos(glfwGetTime()) * 1.0f;\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 1. render depth of scene to texture (from light's perspective)\n // --------------------------------------------------------------\n glm::mat4 lightProjection, lightView;\n glm::mat4 lightSpaceMatrix;\n float near_plane = 1.0f, far_plane = 7.5f;\n //lightProjection = glm::perspective(glm::radians(45.0f), (GLfloat)SHADOW_WIDTH / (GLfloat)SHADOW_HEIGHT, near_plane, far_plane); // note that if you use a perspective projection matrix you'll have to change the light position as the current light position isn't enough to reflect the whole scene\n lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);\n lightView = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0.0, 1.0, 0.0));\n lightSpaceMatrix = lightProjection * lightView;\n // render scene from light's point of view\n simpleDepthShader.use();\n simpleDepthShader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // reset viewport\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 2. render scene as normal using the generated depth/shadow map \n // --------------------------------------------------------------\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set light uniforms\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n shader.setMat4(\"lightSpaceMatrix\", lightSpaceMatrix);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n renderScene(shader);\n\n // render Depth map to quad for visual debugging\n // ---------------------------------------------\n debugDepthQuad.use();\n debugDepthQuad.setFloat(\"near_plane\", near_plane);\n debugDepthQuad.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, depthMap);\n //renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n // optional: de-allocate all resources once they've outlived their purpose:\n // ------------------------------------------------------------------------\n glDeleteVertexArrays(1, &planeVAO);\n glDeleteBuffers(1, &planeVBO);\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // floor\n glm::mat4 model = glm::mat4(1.0f);\n shader.setMat4(\"model\", model);\n glBindVertexArray(planeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(0.0f, 1.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, 2.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.25));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// renderQuad() renders a 1x1 XY quad in NDC\n// -----------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n float quadVertices[] = {\n // positions // texture Coords\n -1.0f, 1.0f, 0.0f, 0.0f, 1.0f,\n -1.0f, -1.0f, 0.0f, 0.0f, 0.0f,\n 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,\n 1.0f, -1.0f, 0.0f, 1.0f, 0.0f,\n };\n // setup plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 6, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.13, "dedup_hash": "39e33187786c4c28", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_2_1_point_shadows", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:17+00:00", "source_type": "repo", "title": "3.2.1.Point Shadows", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/geometry_shader/texturing/framebuffer/basics", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows.fs", "language": "glsl", "loc": 53, "comment_density": 0.226, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform samplerCube depthMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nuniform float far_plane;\nuniform bool shadows;\n\nfloat ShadowCalculation(vec3 fragPos)\n{\n // get vector between fragment position and light position\n vec3 fragToLight = fragPos - lightPos;\n // ise the fragment to light vector to sample from the depth map \n float closestDepth = texture(depthMap, fragToLight).r;\n // it is currently in linear range between [0,1], let's re-transform it back to original depth value\n closestDepth *= far_plane;\n // now get current linear depth as the length between the fragment and light position\n float currentDepth = length(fragToLight);\n // test for shadows\n float bias = 0.05; // we use a much larger bias since depth is now in [near_plane, far_plane] range\n float shadow = currentDepth - bias > closestDepth ? 1.0 : 0.0; \n // display closestDepth as debug (to visualize depth cubemap)\n // FragColor = vec4(vec3(closestDepth / far_plane), 1.0); \n \n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * lightColor;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = shadows ? ShadowCalculation(fs_in.FragPos) : 0.0; \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows.vs", "language": "glsl", "loc": 24, "comment_density": 0.042, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform bool reverse_normals;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n if(reverse_normals) // a slight hack to make sure the outer large cube displays lighting from the 'inside' instead of the default 'outside'.\n vs_out.Normal = transpose(inverse(mat3(model))) * (-1.0 * aNormal);\n else\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows_depth.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nin vec4 FragPos;\n\nuniform vec3 lightPos;\nuniform float far_plane;\n\nvoid main()\n{\n float lightDistance = length(FragPos.xyz - lightPos);\n \n // map to [0;1] range by dividing by far_plane\n lightDistance = lightDistance / far_plane;\n \n // write this as modified depth\n gl_FragDepth = lightDistance;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows_depth.gs", "language": "glsl", "loc": 19, "comment_density": 0.158, "code": "#version 330 core\nlayout (triangles) in;\nlayout (triangle_strip, max_vertices=18) out;\n\nuniform mat4 shadowMatrices[6];\n\nout vec4 FragPos; // FragPos from GS (output per emitvertex)\n\nvoid main()\n{\n for(int face = 0; face < 6; ++face)\n {\n gl_Layer = face; // built-in variable that specifies to which face we render.\n for(int i = 0; i < 3; ++i) // for each triangle's vertices\n {\n FragPos = gl_in[i].gl_Position;\n gl_Position = shadowMatrices[face] * FragPos;\n EmitVertex();\n } \n EndPrimitive();\n }\n} ", "stage": "geometry", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/3.2.1.point_shadows_depth.vs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.1.point_shadows/point_shadows.cpp", "language": "code", "loc": 378, "comment_density": 0.296, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool shadows = true;\nbool shadowsKeyPressed = false;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_CULL_FACE);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.2.1.point_shadows.vs\", \"3.2.1.point_shadows.fs\");\n Shader simpleDepthShader(\"3.2.1.point_shadows_depth.vs\", \"3.2.1.point_shadows_depth.fs\", \"3.2.1.point_shadows_depth.gs\"); \n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth cubemap texture\n unsigned int depthCubemap;\n glGenTextures(1, &depthCubemap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, depthCubemap);\n for (unsigned int i = 0; i < 6; ++i)\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthCubemap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"depthMap\", 1);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.0f, 0.0f, 0.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // move light position over time\n lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 0. create depth cubemap transformation matrices\n // -----------------------------------------------\n float near_plane = 1.0f;\n float far_plane = 25.0f;\n glm::mat4 shadowProj = glm::perspective(glm::radians(90.0f), (float)SHADOW_WIDTH / (float)SHADOW_HEIGHT, near_plane, far_plane);\n std::vector shadowTransforms;\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3( 0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n\n // 1. render scene to depth cubemap\n // --------------------------------\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n simpleDepthShader.use();\n for (unsigned int i = 0; i < 6; ++i)\n simpleDepthShader.setMat4(\"shadowMatrices[\" + std::to_string(i) + \"]\", shadowTransforms[i]);\n simpleDepthShader.setFloat(\"far_plane\", far_plane);\n simpleDepthShader.setVec3(\"lightPos\", lightPos);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 2. render scene as normal \n // -------------------------\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set lighting uniforms\n shader.setVec3(\"lightPos\", lightPos);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setInt(\"shadows\", shadows); // enable/disable shadows by pressing 'SPACE'\n shader.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_CUBE_MAP, depthCubemap);\n renderScene(shader);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // room cube\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::scale(model, glm::vec3(5.0f));\n shader.setMat4(\"model\", model);\n glDisable(GL_CULL_FACE); // note that we disable culling here since we render 'inside' the cube instead of the usual 'outside' which throws off the normal culling methods.\n shader.setInt(\"reverse_normals\", 1); // A small little hack to invert normals when drawing cube from the inside so lighting still works.\n renderCube();\n shader.setInt(\"reverse_normals\", 0); // and of course disable it\n glEnable(GL_CULL_FACE);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(4.0f, -3.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 3.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.75f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-3.0f, -1.0f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.5f, 1.0f, 1.5));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.5f, 2.0f, -3.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.75f));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !shadowsKeyPressed)\n {\n shadows = !shadows;\n shadowsKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)\n {\n shadowsKeyPressed = false;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 5, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.148, "dedup_hash": "9a5a1b3890cccae0", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_2_2_point_shadows_soft", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:17+00:00", "source_type": "repo", "title": "3.2.2.Point Shadows Soft", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/shadows/geometry_shader/texturing/framebuffer", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows.fs", "language": "glsl", "loc": 94, "comment_density": 0.383, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} fs_in;\n\nuniform sampler2D diffuseTexture;\nuniform samplerCube depthMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nuniform float far_plane;\nuniform bool shadows;\n\n\n// array of offset direction for sampling\nvec3 gridSamplingDisk[20] = vec3[]\n(\n vec3(1, 1, 1), vec3( 1, -1, 1), vec3(-1, -1, 1), vec3(-1, 1, 1), \n vec3(1, 1, -1), vec3( 1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1),\n vec3(1, 1, 0), vec3( 1, -1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0),\n vec3(1, 0, 1), vec3(-1, 0, 1), vec3( 1, 0, -1), vec3(-1, 0, -1),\n vec3(0, 1, 1), vec3( 0, -1, 1), vec3( 0, -1, -1), vec3( 0, 1, -1)\n);\n\nfloat ShadowCalculation(vec3 fragPos)\n{\n // get vector between fragment position and light position\n vec3 fragToLight = fragPos - lightPos;\n // use the fragment to light vector to sample from the depth map \n // float closestDepth = texture(depthMap, fragToLight).r;\n // it is currently in linear range between [0,1], let's re-transform it back to original depth value\n // closestDepth *= far_plane;\n // now get current linear depth as the length between the fragment and light position\n float currentDepth = length(fragToLight);\n // test for shadows\n // float bias = 0.05; // we use a much larger bias since depth is now in [near_plane, far_plane] range\n // float shadow = currentDepth - bias > closestDepth ? 1.0 : 0.0;\n // PCF\n // float shadow = 0.0;\n // float bias = 0.05; \n // float samples = 4.0;\n // float offset = 0.1;\n // for(float x = -offset; x < offset; x += offset / (samples * 0.5))\n // {\n // for(float y = -offset; y < offset; y += offset / (samples * 0.5))\n // {\n // for(float z = -offset; z < offset; z += offset / (samples * 0.5))\n // {\n // float closestDepth = texture(depthMap, fragToLight + vec3(x, y, z)).r; // use lightdir to lookup cubemap\n // closestDepth *= far_plane; // Undo mapping [0;1]\n // if(currentDepth - bias > closestDepth)\n // shadow += 1.0;\n // }\n // }\n // }\n // shadow /= (samples * samples * samples);\n float shadow = 0.0;\n float bias = 0.15;\n int samples = 20;\n float viewDistance = length(viewPos - fragPos);\n float diskRadius = (1.0 + (viewDistance / far_plane)) / 25.0;\n for(int i = 0; i < samples; ++i)\n {\n float closestDepth = texture(depthMap, fragToLight + gridSamplingDisk[i] * diskRadius).r;\n closestDepth *= far_plane; // undo mapping [0;1]\n if(currentDepth - bias > closestDepth)\n shadow += 1.0;\n }\n shadow /= float(samples);\n \n // display closestDepth as debug (to visualize depth cubemap)\n // FragColor = vec4(vec3(closestDepth / far_plane), 1.0); \n \n return shadow;\n}\n\nvoid main()\n{ \n vec3 color = texture(diffuseTexture, fs_in.TexCoords).rgb;\n vec3 normal = normalize(fs_in.Normal);\n vec3 lightColor = vec3(0.3);\n // ambient\n vec3 ambient = 0.3 * lightColor;\n // diffuse\n vec3 lightDir = normalize(lightPos - fs_in.FragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * lightColor;\n // specular\n vec3 viewDir = normalize(viewPos - fs_in.FragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n float spec = 0.0;\n vec3 halfwayDir = normalize(lightDir + viewDir); \n spec = pow(max(dot(normal, halfwayDir), 0.0), 64.0);\n vec3 specular = spec * lightColor; \n // calculate shadow\n float shadow = shadows ? ShadowCalculation(fs_in.FragPos) : 0.0; \n vec3 lighting = (ambient + (1.0 - shadow) * (diffuse + specular)) * color; \n \n FragColor = vec4(lighting, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows.vs", "language": "glsl", "loc": 24, "comment_density": 0.042, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\n\nout vec2 TexCoords;\n\nout VS_OUT {\n vec3 FragPos;\n vec3 Normal;\n vec2 TexCoords;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform bool reverse_normals;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0));\n if(reverse_normals) // a slight hack to make sure the outer large cube displays lighting from the 'inside' instead of the default 'outside'.\n vs_out.Normal = transpose(inverse(mat3(model))) * (-1.0 * aNormal);\n else\n vs_out.Normal = transpose(inverse(mat3(model))) * aNormal;\n vs_out.TexCoords = aTexCoords;\n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows_depth.fs", "language": "glsl", "loc": 12, "comment_density": 0.167, "code": "#version 330 core\nin vec4 FragPos;\n\nuniform vec3 lightPos;\nuniform float far_plane;\n\nvoid main()\n{\n float lightDistance = length(FragPos.xyz - lightPos);\n \n // map to [0;1] range by dividing by far_plane\n lightDistance = lightDistance / far_plane;\n \n // write this as modified depth\n gl_FragDepth = lightDistance;\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows_depth.gs", "language": "glsl", "loc": 19, "comment_density": 0.158, "code": "#version 330 core\nlayout (triangles) in;\nlayout (triangle_strip, max_vertices=18) out;\n\nuniform mat4 shadowMatrices[6];\n\nout vec4 FragPos; // FragPos from GS (output per emitvertex)\n\nvoid main()\n{\n for(int face = 0; face < 6; ++face)\n {\n gl_Layer = face; // built-in variable that specifies to which face we render.\n for(int i = 0; i < 3; ++i) // for each triangle's vertices\n {\n FragPos = gl_in[i].gl_Position;\n gl_Position = shadowMatrices[face] * FragPos;\n EmitVertex();\n } \n EndPrimitive();\n }\n} ", "stage": "geometry", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/3.2.2.point_shadows_depth.vs", "language": "glsl", "loc": 7, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\n\nuniform mat4 model;\n\nvoid main()\n{\n gl_Position = model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.2.2.point_shadows_soft/point_shadows_soft.cpp", "language": "code", "loc": 378, "comment_density": 0.296, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderScene(const Shader &shader);\nvoid renderCube();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\nbool shadows = true;\nbool shadowsKeyPressed = false;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n glEnable(GL_CULL_FACE);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"3.2.2.point_shadows.vs\", \"3.2.2.point_shadows.fs\");\n Shader simpleDepthShader(\"3.2.2.point_shadows_depth.vs\", \"3.2.2.point_shadows_depth.fs\", \"3.2.2.point_shadows_depth.gs\");\n\n // load textures\n // -------------\n unsigned int woodTexture = loadTexture(FileSystem::getPath(\"resources/textures/wood.png\").c_str());\n\n // configure depth map FBO\n // -----------------------\n const unsigned int SHADOW_WIDTH = 1024, SHADOW_HEIGHT = 1024;\n unsigned int depthMapFBO;\n glGenFramebuffers(1, &depthMapFBO);\n // create depth cubemap texture\n unsigned int depthCubemap;\n glGenTextures(1, &depthCubemap);\n glBindTexture(GL_TEXTURE_CUBE_MAP, depthCubemap);\n for (unsigned int i = 0; i < 6; ++i)\n glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);\n glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);\n // attach depth texture as FBO's depth buffer\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthCubemap, 0);\n glDrawBuffer(GL_NONE);\n glReadBuffer(GL_NONE);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseTexture\", 0);\n shader.setInt(\"depthMap\", 1);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.0f, 0.0f, 0.0f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // move light position over time\n lightPos.z = static_cast(sin(glfwGetTime() * 0.5) * 3.0);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // 0. create depth cubemap transformation matrices\n // -----------------------------------------------\n float near_plane = 1.0f;\n float far_plane = 25.0f;\n glm::mat4 shadowProj = glm::perspective(glm::radians(90.0f), (float)SHADOW_WIDTH / (float)SHADOW_HEIGHT, near_plane, far_plane);\n std::vector shadowTransforms;\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(-1.0f, 0.0f, 0.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0f, -1.0f, 0.0f), glm::vec3(0.0f, 0.0f, -1.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0f, 0.0f, 1.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n shadowTransforms.push_back(shadowProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0f, 0.0f, -1.0f), glm::vec3(0.0f, -1.0f, 0.0f)));\n\n // 1. render scene to depth cubemap\n // --------------------------------\n glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);\n glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);\n glClear(GL_DEPTH_BUFFER_BIT);\n simpleDepthShader.use();\n for (unsigned int i = 0; i < 6; ++i)\n simpleDepthShader.setMat4(\"shadowMatrices[\" + std::to_string(i) + \"]\", shadowTransforms[i]);\n simpleDepthShader.setFloat(\"far_plane\", far_plane);\n simpleDepthShader.setVec3(\"lightPos\", lightPos);\n renderScene(simpleDepthShader);\n glBindFramebuffer(GL_FRAMEBUFFER, 0);\n\n // 2. render scene as normal \n // -------------------------\n glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n shader.use();\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // set lighting uniforms\n shader.setVec3(\"lightPos\", lightPos);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setInt(\"shadows\", shadows); // enable/disable shadows by pressing 'SPACE'\n shader.setFloat(\"far_plane\", far_plane);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, woodTexture);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_CUBE_MAP, depthCubemap);\n renderScene(shader);\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders the 3D scene\n// --------------------\nvoid renderScene(const Shader &shader)\n{\n // room cube\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::scale(model, glm::vec3(5.0f));\n shader.setMat4(\"model\", model);\n glDisable(GL_CULL_FACE); // note that we disable culling here since we render 'inside' the cube instead of the usual 'outside' which throws off the normal culling methods.\n shader.setInt(\"reverse_normals\", 1); // A small little hack to invert normals when drawing cube from the inside so lighting still works.\n renderCube();\n shader.setInt(\"reverse_normals\", 0); // and of course disable it\n glEnable(GL_CULL_FACE);\n // cubes\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(4.0f, -3.5f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(2.0f, 3.0f, 1.0));\n model = glm::scale(model, glm::vec3(0.75f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-3.0f, -1.0f, 0.0));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.5f, 1.0f, 1.5));\n model = glm::scale(model, glm::vec3(0.5f));\n shader.setMat4(\"model\", model);\n renderCube();\n model = glm::mat4(1.0f);\n model = glm::translate(model, glm::vec3(-1.5f, 2.0f, -3.0));\n model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));\n model = glm::scale(model, glm::vec3(0.75f));\n shader.setMat4(\"model\", model);\n renderCube();\n}\n\n// renderCube() renders a 1x1 3D cube in NDC.\n// -------------------------------------------------\nunsigned int cubeVAO = 0;\nunsigned int cubeVBO = 0;\nvoid renderCube()\n{\n // initialize (if necessary)\n if (cubeVAO == 0)\n {\n float vertices[] = {\n // back face\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right \n 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right\n -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left\n -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left\n // front face\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right\n -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left\n -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left\n // left face\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right\n // right face\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right\n 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left\n 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left \n // bottom face\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left\n -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right\n -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right\n // top face\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right \n 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right\n -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left\n -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left \n };\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n // fill buffer\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);\n // link vertex attributes\n glBindVertexArray(cubeVAO);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));\n glBindBuffer(GL_ARRAY_BUFFER, 0);\n glBindVertexArray(0);\n }\n // render Cube\n glBindVertexArray(cubeVAO);\n glDrawArrays(GL_TRIANGLES, 0, 36);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !shadowsKeyPressed)\n {\n shadows = !shadows;\n shadowsKeyPressed = true;\n }\n if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)\n {\n shadowsKeyPressed = false;\n }\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 5, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.174, "dedup_hash": "70c0e6825e1a1dba", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_3_3_csm", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:17+00:00", "source_type": "repo", "title": "3.3.Csm", "api": "OpenGL Core", "glsl_version": null, "topic": "shadows/texturing/basics/camera", "difficulty": "advanced", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/3.3.csm/csm.cpp", "language": "code", "loc": 248, "comment_density": 0.177, "code": "// Std. Includes\n#include \n\n// GLEW\n#define GLEW_STATIC\n#include \n\n// GLFW\n#include \n\n// GL includes\n#include \n#include \n\n// GLM Mathematics\n#include \n#include \n#include \n\n// Other Libs\n#include \n\n// Properties\nGLuint screenWidth = 800, screenHeight = 600;\n\n// Function prototypes\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid Do_Movement();\nGLuint loadTexture(GLchar const * path);\n\n// Camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nbool keys[1024];\nGLfloat lastX = 400, lastY = 300;\nbool firstMouse = true;\n\nGLfloat deltaTime = 0.0f;\nGLfloat lastFrame = 0.0f;\n\n// The MAIN function, from here we start our application and run our Game loop\nint main()\n{\n // Init GLFW\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // uncomment this statement to fix compilation on OS X\n#endif\n\n GLFWwindow* window = glfwCreateWindow(screenWidth, screenHeight, \"LearnOpenGL\", nullptr, nullptr); // Windowed\n glfwMakeContextCurrent(window);\n\n // Set the required callback functions\n glfwSetKeyCallback(window, key_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // Options\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // Initialize GLEW to setup the OpenGL Function pointers\n glewExperimental = GL_TRUE;\n glewInit();\n\n // Define the viewport dimensions\n glViewport(0, 0, screenWidth, screenHeight);\n\n // Setup some OpenGL options\n glEnable(GL_DEPTH_TEST);\n // glDepthFunc(GL_ALWAYS); // Set to always pass the depth test (same effect as glDisable(GL_DEPTH_TEST))\n\n // Setup and compile our shaders\n Shader shader(\"depth_testing.vs\", \"depth_testing.frag\");\n\n #pragma region \"object_initialization\"\n // Set the object data (buffers, vertex attributes)\n GLfloat cubeVertices[] = {\n // Positions // Texture Coords\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 0.0f,\n\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, -0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, -0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, -0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, -0.5f, -0.5f, 0.0f, 1.0f,\n\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f,\n 0.5f, 0.5f, -0.5f, 1.0f, 1.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n 0.5f, 0.5f, 0.5f, 1.0f, 0.0f,\n -0.5f, 0.5f, 0.5f, 0.0f, 0.0f,\n -0.5f, 0.5f, -0.5f, 0.0f, 1.0f\n };\n GLfloat planeVertices[] = {\n // Positions // Texture Coords (note we set these higher than 1 that together with GL_REPEAT as texture wrapping mode will cause the floor texture to repeat)\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, 5.0f, 0.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n\n 5.0f, -0.5f, 5.0f, 2.0f, 0.0f,\n -5.0f, -0.5f, -5.0f, 0.0f, 2.0f,\n 5.0f, -0.5f, -5.0f, 2.0f, 2.0f\t\t\t\t\t\t\t\t\n };\n // Setup cube VAO\n GLuint cubeVAO, cubeVBO;\n glGenVertexArrays(1, &cubeVAO);\n glGenBuffers(1, &cubeVBO);\n glBindVertexArray(cubeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, cubeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(cubeVertices), &cubeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));\n glBindVertexArray(0);\n // Setup plane VAO\n GLuint planeVAO, planeVBO;\n glGenVertexArrays(1, &planeVAO);\n glGenBuffers(1, &planeVBO);\n glBindVertexArray(planeVAO);\n glBindBuffer(GL_ARRAY_BUFFER, planeVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(planeVertices), &planeVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));\n glBindVertexArray(0);\n\n // Load textures\n GLuint cubeTexture = loadTexture(FileSystem::getPath(\"resources/textures/marble.jpg\").c_str());\n GLuint floorTexture = loadTexture(FileSystem::getPath(\"resources/textures/metal.png\").c_str());\n #pragma endregion\n\n // Game loop\n while(!glfwWindowShouldClose(window))\n {\n // Set frame time\n GLfloat currentFrame = glfwGetTime();\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // Check and call events\n glfwPollEvents();\n Do_Movement();\n\n // Clear the colorbuffer\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // Draw objects\n shader.Use(); \n glm::mat4 model;\n glm::mat4 view = camera.GetViewMatrix();\n glm::mat4 projection = glm::perspective(camera.Zoom, (float)screenWidth/(float)screenHeight, 0.1f, 100.0f);\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"view\"), 1, GL_FALSE, glm::value_ptr(view));\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"projection\"), 1, GL_FALSE, glm::value_ptr(projection));\n // Cubes\n glBindVertexArray(cubeVAO);\n glBindTexture(GL_TEXTURE_2D, cubeTexture); // We omit the glActiveTexture part since TEXTURE0 is already the default active texture unit. (sampler used in fragment is set to 0 as well as default)\t\t\n model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"model\"), 1, GL_FALSE, glm::value_ptr(model));\n glDrawArrays(GL_TRIANGLES, 0, 36);\n model = glm::mat4();\n model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"model\"), 1, GL_FALSE, glm::value_ptr(model));\n glDrawArrays(GL_TRIANGLES, 0, 36);\n // Floor\n glBindVertexArray(planeVAO);\n glBindTexture(GL_TEXTURE_2D, floorTexture);\n model = glm::mat4();\n glUniformMatrix4fv(glGetUniformLocation(shader.Program, \"model\"), 1, GL_FALSE, glm::value_ptr(model));\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\t\t\t\t\n\n\n // Swap the buffers\n glfwSwapBuffers(window);\n }\n\n glfwTerminate();\n return 0;\n}\n\n// This function loads a texture from file. Note: texture loading functions like these are usually \n// managed by a 'Resource Manager' that manages all resources (like textures, models, audio). \n// For learning purposes we'll just define it as a utility function.\nGLuint loadTexture(GLchar const * path)\n{\n //Generate texture ID and load texture data \n GLuint textureID;\n glGenTextures(1, &textureID);\n int width,height;\n unsigned char* image = SOIL_load_image(path, &width, &height, 0, SOIL_LOAD_RGB);\n // Assign texture to ID\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);\n glGenerateMipmap(GL_TEXTURE_2D);\t\n\n // Parameters\n glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );\n glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );\n glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );\n glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n glBindTexture(GL_TEXTURE_2D, 0);\n SOIL_free_image_data(image);\n return textureID;\n\n}\n\n#pragma region \"User input\"\n\n// Moves/alters the camera positions based on user input\nvoid Do_Movement()\n{\n // Camera controls\n if(keys[GLFW_KEY_W])\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if(keys[GLFW_KEY_S])\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if(keys[GLFW_KEY_A])\n camera.ProcessKeyboard(LEFT, deltaTime);\n if(keys[GLFW_KEY_D])\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// Is called whenever a key is pressed/released via GLFW\nvoid key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)\n{\n if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)\n glfwSetWindowShouldClose(window, GL_TRUE);\n\n if(action == GLFW_PRESS)\n keys[key] = true;\n else if(action == GLFW_RELEASE)\n keys[key] = false;\t\n}\n\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos)\n{\n if(firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n GLfloat xoffset = xpos - lastX;\n GLfloat yoffset = lastY - ypos; \n \n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\t\n\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(yoffset);\n}\n\n#pragma endregion\n"}, {"path": "src/5.advanced_lighting/3.3.csm/csm.fs", "language": "glsl", "loc": 14, "comment_density": 0.143, "code": "#version 330 core\nout vec4 color;\n\nfloat LinearizeDepth(float depth) // Note that this ranges from [0,1] instead of up to 'far plane distance' since we divide by 'far'\n{\n float near = 0.1; \n float far = 100.0; \n float z = depth * 2.0 - 1.0; // Back to NDC \n return (2.0 * near) / (far + near - z * (far - near));\t\n}\n\nvoid main()\n{ \n float depth = LinearizeDepth(gl_FragCoord.z);\n color = vec4(vec3(depth), 1.0f);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/3.3.csm/csm.vs", "language": "glsl", "loc": 12, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 position;\nlayout (location = 1) in vec2 texCoords;\n\nout vec2 TexCoords;\n\nuniform mat4 model;\nuniform mat4 view;\nuniform mat4 projection;\n\nvoid main()\n{\n gl_Position = projection * view * model * vec4(position, 1.0f);\n TexCoords = texCoords;\n}", "stage": "vertex", "validation_status": "valid"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.107, "dedup_hash": "f327f57dc43d8642", "has_readme": true} +{"id": "joeydevries_learnopengl_src_5_advanced_lighting_4_normal_mapping", "source": "https://github.com/JoeyDeVries/LearnOpenGL", "source_commit": "a545a703f95893258d16dbe32f5ccbb6400fd213", "collected_at": "2026-08-17T14:50:18+00:00", "source_type": "repo", "title": "4.Normal Mapping", "api": "OpenGL Core", "glsl_version": null, "topic": "lighting/texturing/bumpmapping/framebuffer/basics", "difficulty": "intermediate", "source_quality": "educational", "files": [{"path": "src/5.advanced_lighting/4.normal_mapping/4.normal_mapping.fs", "language": "glsl", "loc": 35, "comment_density": 0.2, "code": "#version 330 core\nout vec4 FragColor;\n\nin VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} fs_in;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D normalMap;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nvoid main()\n{ \n // obtain normal from normal map in range [0,1]\n vec3 normal = texture(normalMap, fs_in.TexCoords).rgb;\n // transform normal vector to range [-1,1]\n normal = normalize(normal * 2.0 - 1.0); // this normal is in tangent space\n \n // get diffuse color\n vec3 color = texture(diffuseMap, fs_in.TexCoords).rgb;\n // ambient\n vec3 ambient = 0.1 * color;\n // diffuse\n vec3 lightDir = normalize(fs_in.TangentLightPos - fs_in.TangentFragPos);\n float diff = max(dot(lightDir, normal), 0.0);\n vec3 diffuse = diff * color;\n // specular\n vec3 viewDir = normalize(fs_in.TangentViewPos - fs_in.TangentFragPos);\n vec3 reflectDir = reflect(-lightDir, normal);\n vec3 halfwayDir = normalize(lightDir + viewDir); \n float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);\n\n vec3 specular = vec3(0.2) * spec;\n FragColor = vec4(ambient + diffuse + specular, 1.0);\n}", "stage": "fragment", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/4.normal_mapping/4.normal_mapping.vs", "language": "glsl", "loc": 33, "comment_density": 0.0, "code": "#version 330 core\nlayout (location = 0) in vec3 aPos;\nlayout (location = 1) in vec3 aNormal;\nlayout (location = 2) in vec2 aTexCoords;\nlayout (location = 3) in vec3 aTangent;\nlayout (location = 4) in vec3 aBitangent;\n\nout VS_OUT {\n vec3 FragPos;\n vec2 TexCoords;\n vec3 TangentLightPos;\n vec3 TangentViewPos;\n vec3 TangentFragPos;\n} vs_out;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform mat4 model;\n\nuniform vec3 lightPos;\nuniform vec3 viewPos;\n\nvoid main()\n{\n vs_out.FragPos = vec3(model * vec4(aPos, 1.0)); \n vs_out.TexCoords = aTexCoords;\n \n mat3 normalMatrix = transpose(inverse(mat3(model)));\n vec3 T = normalize(normalMatrix * aTangent);\n vec3 N = normalize(normalMatrix * aNormal);\n T = normalize(T - dot(T, N) * N);\n vec3 B = cross(N, T);\n \n mat3 TBN = transpose(mat3(T, B, N)); \n vs_out.TangentLightPos = TBN * lightPos;\n vs_out.TangentViewPos = TBN * viewPos;\n vs_out.TangentFragPos = TBN * vs_out.FragPos;\n \n gl_Position = projection * view * model * vec4(aPos, 1.0);\n}", "stage": "vertex", "validation_status": "valid"}, {"path": "src/5.advanced_lighting/4.normal_mapping/normal_mapping.cpp", "language": "code", "loc": 285, "comment_density": 0.211, "code": "#include \n#include \n#include \n\n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height);\nvoid mouse_callback(GLFWwindow* window, double xpos, double ypos);\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset);\nvoid processInput(GLFWwindow *window);\nunsigned int loadTexture(const char *path);\nvoid renderQuad();\n\n// settings\nconst unsigned int SCR_WIDTH = 800;\nconst unsigned int SCR_HEIGHT = 600;\n\n// camera\nCamera camera(glm::vec3(0.0f, 0.0f, 3.0f));\nfloat lastX = (float)SCR_WIDTH / 2.0;\nfloat lastY = (float)SCR_HEIGHT / 2.0;\nbool firstMouse = true;\n\n// timing\nfloat deltaTime = 0.0f;\nfloat lastFrame = 0.0f;\n\nint main()\n{\n // glfw: initialize and configure\n // ------------------------------\n glfwInit();\n glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);\n glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);\n glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);\n\n#ifdef __APPLE__\n glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);\n#endif\n\n // glfw window creation\n // --------------------\n GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, \"LearnOpenGL\", NULL, NULL);\n if (window == NULL)\n {\n std::cout << \"Failed to create GLFW window\" << std::endl;\n glfwTerminate();\n return -1;\n }\n glfwMakeContextCurrent(window);\n glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);\n glfwSetCursorPosCallback(window, mouse_callback);\n glfwSetScrollCallback(window, scroll_callback);\n\n // tell GLFW to capture our mouse\n glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);\n\n // glad: load all OpenGL function pointers\n // ---------------------------------------\n if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))\n {\n std::cout << \"Failed to initialize GLAD\" << std::endl;\n return -1;\n }\n\n // configure global opengl state\n // -----------------------------\n glEnable(GL_DEPTH_TEST);\n\n // build and compile shaders\n // -------------------------\n Shader shader(\"4.normal_mapping.vs\", \"4.normal_mapping.fs\");\n\n // load textures\n // -------------\n unsigned int diffuseMap = loadTexture(FileSystem::getPath(\"resources/textures/brickwall.jpg\").c_str());\n unsigned int normalMap = loadTexture(FileSystem::getPath(\"resources/textures/brickwall_normal.jpg\").c_str());\n\n // shader configuration\n // --------------------\n shader.use();\n shader.setInt(\"diffuseMap\", 0);\n shader.setInt(\"normalMap\", 1);\n\n // lighting info\n // -------------\n glm::vec3 lightPos(0.5f, 1.0f, 0.3f);\n\n // render loop\n // -----------\n while (!glfwWindowShouldClose(window))\n {\n // per-frame time logic\n // --------------------\n float currentFrame = static_cast(glfwGetTime());\n deltaTime = currentFrame - lastFrame;\n lastFrame = currentFrame;\n\n // input\n // -----\n processInput(window);\n\n // render\n // ------\n glClearColor(0.1f, 0.1f, 0.1f, 1.0f);\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n\n // configure view/projection matrices\n glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);\n glm::mat4 view = camera.GetViewMatrix();\n shader.use();\n shader.setMat4(\"projection\", projection);\n shader.setMat4(\"view\", view);\n // render normal-mapped quad\n glm::mat4 model = glm::mat4(1.0f);\n model = glm::rotate(model, glm::radians((float)glfwGetTime() * -10.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0))); // rotate the quad to show normal mapping from multiple directions\n shader.setMat4(\"model\", model);\n shader.setVec3(\"viewPos\", camera.Position);\n shader.setVec3(\"lightPos\", lightPos);\n glActiveTexture(GL_TEXTURE0);\n glBindTexture(GL_TEXTURE_2D, diffuseMap);\n glActiveTexture(GL_TEXTURE1);\n glBindTexture(GL_TEXTURE_2D, normalMap);\n renderQuad();\n\n // render light source (simply re-renders a smaller plane at the light's position for debugging/visualization)\n model = glm::mat4(1.0f);\n model = glm::translate(model, lightPos);\n model = glm::scale(model, glm::vec3(0.1f));\n shader.setMat4(\"model\", model);\n renderQuad();\n\n // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)\n // -------------------------------------------------------------------------------\n glfwSwapBuffers(window);\n glfwPollEvents();\n }\n\n glfwTerminate();\n return 0;\n}\n\n// renders a 1x1 quad in NDC with manually calculated tangent vectors\n// ------------------------------------------------------------------\nunsigned int quadVAO = 0;\nunsigned int quadVBO;\nvoid renderQuad()\n{\n if (quadVAO == 0)\n {\n // positions\n glm::vec3 pos1(-1.0f, 1.0f, 0.0f);\n glm::vec3 pos2(-1.0f, -1.0f, 0.0f);\n glm::vec3 pos3( 1.0f, -1.0f, 0.0f);\n glm::vec3 pos4( 1.0f, 1.0f, 0.0f);\n // texture coordinates\n glm::vec2 uv1(0.0f, 1.0f);\n glm::vec2 uv2(0.0f, 0.0f);\n glm::vec2 uv3(1.0f, 0.0f); \n glm::vec2 uv4(1.0f, 1.0f);\n // normal vector\n glm::vec3 nm(0.0f, 0.0f, 1.0f);\n\n // calculate tangent/bitangent vectors of both triangles\n glm::vec3 tangent1, bitangent1;\n glm::vec3 tangent2, bitangent2;\n // triangle 1\n // ----------\n glm::vec3 edge1 = pos2 - pos1;\n glm::vec3 edge2 = pos3 - pos1;\n glm::vec2 deltaUV1 = uv2 - uv1;\n glm::vec2 deltaUV2 = uv3 - uv1;\n\n float f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent1.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent1.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent1.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n\n bitangent1.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent1.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent1.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n\n // triangle 2\n // ----------\n edge1 = pos3 - pos1;\n edge2 = pos4 - pos1;\n deltaUV1 = uv3 - uv1;\n deltaUV2 = uv4 - uv1;\n\n f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y);\n\n tangent2.x = f * (deltaUV2.y * edge1.x - deltaUV1.y * edge2.x);\n tangent2.y = f * (deltaUV2.y * edge1.y - deltaUV1.y * edge2.y);\n tangent2.z = f * (deltaUV2.y * edge1.z - deltaUV1.y * edge2.z);\n\n\n bitangent2.x = f * (-deltaUV2.x * edge1.x + deltaUV1.x * edge2.x);\n bitangent2.y = f * (-deltaUV2.x * edge1.y + deltaUV1.x * edge2.y);\n bitangent2.z = f * (-deltaUV2.x * edge1.z + deltaUV1.x * edge2.z);\n\n\n float quadVertices[] = {\n // positions // normal // texcoords // tangent // bitangent\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos2.x, pos2.y, pos2.z, nm.x, nm.y, nm.z, uv2.x, uv2.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent1.x, tangent1.y, tangent1.z, bitangent1.x, bitangent1.y, bitangent1.z,\n\n pos1.x, pos1.y, pos1.z, nm.x, nm.y, nm.z, uv1.x, uv1.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos3.x, pos3.y, pos3.z, nm.x, nm.y, nm.z, uv3.x, uv3.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z,\n pos4.x, pos4.y, pos4.z, nm.x, nm.y, nm.z, uv4.x, uv4.y, tangent2.x, tangent2.y, tangent2.z, bitangent2.x, bitangent2.y, bitangent2.z\n };\n // configure plane VAO\n glGenVertexArrays(1, &quadVAO);\n glGenBuffers(1, &quadVBO);\n glBindVertexArray(quadVAO);\n glBindBuffer(GL_ARRAY_BUFFER, quadVBO);\n glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);\n glEnableVertexAttribArray(0);\n glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)0);\n glEnableVertexAttribArray(1);\n glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(3 * sizeof(float)));\n glEnableVertexAttribArray(2);\n glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(6 * sizeof(float)));\n glEnableVertexAttribArray(3);\n glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(8 * sizeof(float)));\n glEnableVertexAttribArray(4);\n glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), (void*)(11 * sizeof(float)));\n }\n glBindVertexArray(quadVAO);\n glDrawArrays(GL_TRIANGLES, 0, 6);\n glBindVertexArray(0);\n}\n\n// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly\n// ---------------------------------------------------------------------------------------------------------\nvoid processInput(GLFWwindow *window)\n{\n if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)\n glfwSetWindowShouldClose(window, true);\n\n if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)\n camera.ProcessKeyboard(FORWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)\n camera.ProcessKeyboard(BACKWARD, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)\n camera.ProcessKeyboard(LEFT, deltaTime);\n if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)\n camera.ProcessKeyboard(RIGHT, deltaTime);\n}\n\n// glfw: whenever the window size changed (by OS or user resize) this callback function executes\n// ---------------------------------------------------------------------------------------------\nvoid framebuffer_size_callback(GLFWwindow* window, int width, int height)\n{\n // make sure the viewport matches the new window dimensions; note that width and \n // height will be significantly larger than specified on retina displays.\n glViewport(0, 0, width, height);\n}\n\n// glfw: whenever the mouse moves, this callback is called\n// -------------------------------------------------------\nvoid mouse_callback(GLFWwindow* window, double xposIn, double yposIn)\n{\n float xpos = static_cast(xposIn);\n float ypos = static_cast(yposIn);\n if (firstMouse)\n {\n lastX = xpos;\n lastY = ypos;\n firstMouse = false;\n }\n\n float xoffset = xpos - lastX;\n float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top\n\n lastX = xpos;\n lastY = ypos;\n\n camera.ProcessMouseMovement(xoffset, yoffset);\n}\n\n// glfw: whenever the mouse scroll wheel scrolls, this callback is called\n// ----------------------------------------------------------------------\nvoid scroll_callback(GLFWwindow* window, double xoffset, double yoffset)\n{\n camera.ProcessMouseScroll(static_cast(yoffset));\n}\n\n// utility function for loading a 2D texture from file\n// ---------------------------------------------------\nunsigned int loadTexture(char const * path)\n{\n unsigned int textureID;\n glGenTextures(1, &textureID);\n\n int width, height, nrComponents;\n unsigned char *data = stbi_load(path, &width, &height, &nrComponents, 0);\n if (data)\n {\n GLenum format;\n if (nrComponents == 1)\n format = GL_RED;\n else if (nrComponents == 3)\n format = GL_RGB;\n else if (nrComponents == 4)\n format = GL_RGBA;\n\n glBindTexture(GL_TEXTURE_2D, textureID);\n glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);\n glGenerateMipmap(GL_TEXTURE_2D);\n\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT); // for this tutorial: use GL_CLAMP_TO_EDGE to prevent semi-transparent borders. Due to interpolation it takes texels from next repeat \n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, format == GL_RGBA ? GL_CLAMP_TO_EDGE : GL_REPEAT);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\n\n stbi_image_free(data);\n }\n else\n {\n std::cout << \"Texture failed to load at path: \" << path << std::endl;\n stbi_image_free(data);\n }\n\n return textureID;\n}\n"}], "validation": {"glslang_valid": 2, "invalid": 0, "unverified": 0}, "preview_image": null, "license": "CC-BY-NC-4.0", "non_commercial": true, "comment_density": 0.137, "dedup_hash": "8e936dde2a68b7ff", "has_readme": true}